Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Callbacks are not triggered in individually togglable services. #640

Closed
handplant opened this issue Feb 12, 2024 · 3 comments
Closed
Labels
invalid This doesn't seem right

Comments

@handplant
Copy link

Expected Behavior

The onAccept callbacks should be triggered for all services, including Personio, when the user accepts the corresponding category/service.

Current Behavior

The onAccept callbacks are triggered for YouTube and Vimeo services, but not for the Personio service.

Steps to reproduce

Set up a web application with my categories/services functionality.

Here are my categories/services.

  categories: {
    necessary: {
      readOnly: true,
      enabled: true,
    },
    videos: {
      services: {
        youtube: {
          label: 'Youtube Embed',
          onAccept: () => {
            console.log('accept youtube');
          }
        },
        vimeo: {
          label: 'Vimeo Embed',
          onAccept: () => {
            console.log('accept vimeo');
          }
        },
      },
    },
    personio: {
      label: 'Personio',
      onAccept: () => {
        console.log('accept personio');
      }
    }
  },

Proposed fix or additional info.

No response

Version

3.0.0

On which browser do you see the issue?

Chrome

@handplant handplant added the bug Something isn't working label Feb 12, 2024
@github-actions github-actions bot added the triage yet to be reviewed label Feb 12, 2024
@orestbida orestbida added invalid This doesn't seem right and removed triage yet to be reviewed bug Something isn't working labels Feb 12, 2024
@orestbida
Copy link
Owner

You have declared personio outside services, as a category: [necessary, videos, personio]

@handplant
Copy link
Author

I would like it to be visually and functionally like this!

Bildschirmfoto 2024-02-13 um 08 54 14

If I only have one service, then the following doesn't make sense, right? Or am I misunderstanding something?

Bildschirmfoto 2024-02-13 um 08 57 06

Am I correct in understanding that categories themselves don't have callbacks?
Thank you!

@handplant
Copy link
Author

Okay, I'm now solving it through the CookieConsent onChange callback!

  onChange: ({ cookie, changedCategories, changedServices }) => {
    if (cookie.categories.includes('personio')) {
      im.acceptService('personio');
    } else {
      im.rejectService('personio')
    }
  },

Thank you very much for this first-class consent management tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants