Socket
Book a DemoInstallSign in
Socket

@code-202/cookie-consent

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-202/cookie-consent

Rich cookie consent with react/mobx and bootstrap design

npmnpm
Version
4.0.0
Version published
Weekly downloads
2
-99.28%
Maintainers
1
Weekly downloads
 
Created
Source

Rich cookie consent with react / mobx and bootstrap design

Store injection

Launcher and Dialog components use the @code-202/kernel to get the store service with code 'cookie-consent' Add it in your container like this

    const cookieConsentStore = new CookieConsentStore({ cookie: { secure: false }, cookies: kernel.environment.get('cookies') })

    cookieConsentStore.addService({
        id: 'main',
        needConsent: false,
        type: 'main',
        name: 'Fonctionnement',
        cookies: ['rmcc', 'api-token']
    })

    cookieConsentStore.addService({
        id: 'ga',
        needConsent: true,
        type: 'analytics',
        name: 'Google Analytics',
        cookies: ['_ga', '_gid'],
        onAccept: () => {
            console.log('enable GA')
            //ga.enable()
        },
        onDecline: () => {
            console.log('disable GA')
            //ga.disable()
        }
    })

    kernel.container.add('cookie-consent', cookieConsentStore)

FAQs

Package last updated on 09 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts