Socket
Book a DemoInstallSign in
Socket

freeman.gdpr.cookieconsentb3

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freeman.gdpr.cookieconsentb3

This is a jquery plugin to display a form to consent to application cookies

1.0.4
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

Freeman.GDPR.CookieConsentB3 is a lightweight jQuery plugin, to display a modal where users can choose to consent to application specific cookies. This plugin supports Bootstrap 3.

Getting Started

1.Installation process
    NPM:
        npm install freeman.gdpr.cookieconsentb3 --save-dev

2.Software dependencies
    jQuery 3.x:
        Via NPM:   npm install jQuery@latest --save-dev

                    OR

        Via CDN -  Uncompressed: <script
                        src="https://code.jquery.com/jquery-3.3.1.js"
                        integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
                        crossorigin="anonymous"></script>
                    OR

        Via CDN -  Minified: <script
                    src="https://code.jquery.com/jquery-3.3.1.min.js"
                    integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
                    crossorigin="anonymous"></script>

    Bootstrap 3.x :
        Via NPM -  npm install bootstrap3.3.7@latest --save-dev

                    OR

        Via CDN -  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

        Via CDN (script) - <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

3.Latest releases
    Current Release: 1.0.4

How to use this plugin:

Step 1: Go to https://freemanco.visualstudio.com/Freeman/_packaging?feed=Freeman.GDPR.Packages&_a=feed
Step 2: Click on Connect to feed. A pop-up is displayed.
Step 3: Choose npm from the list (on the left). Scroll down and click on Generate npm credentials.
Step 4: Copy and paste the token in .npmrc (Windows - C://Users//<username>) on your local machine. Generate 1 token per team
Step 5: Install the plugin and the necessary software dependencies in your application
Step 6: In the entry component,
    import '~/node_modules/freeman.gdpr.cookieconsentb3/js/jquery.cookieconsentb3.js';
    declare let $: any;  //If using TypeScript; else use 'var' instead of 'let'

    In the OnInit() method (before any cookies are set),

        // ALL FIELDS ARE REQUIRED. PASS EMPTY STRING TO email IF NO VALID EMAIL AVAILABLE
        let appData = {
            appName: "nexus",
            userName: "john.doe@freemanco.com",
            email: "",  // Send email address of the User if they want to receive System Communication else send empty string
            environment: <environment> ('dev', 'test', 'uat', 'prod'),
            apiKey: "" // Will be provided by us
            appKey: "" // Will be provided by us
        };

        $('selectorName').getToken(appData, function(token) {
            console.log(token);
            // Use this token to call the Privacy Management System (Dashboard)
        })

        $('selectorName').addCookieModal(appData, function(action) {
            let returnValue = action;
            // 'action' is the consentObject returned by the plugin. This consentObject has the user consent information for each application cookie.
        });
                    OR
        $('selectorName').addCookieModal(appData, returnValue => {
            // Use returnValue
        });

Return Values:
    1. If user has not consented to Cookies,
        {
            Application: "<applicationName>",
            Token: "<ReturnToken>",
            UserCookies: [], // List of all cookies with User consents
            Username: "<username>",
            UserTermsConsent: <boolean value>
        }

    2. If user has already consented,
        {
            Application: "<applicationName>",
            ApplicationId: <Id>,
            Email: "",
            IsShow: false,
            Token: "<ReturnToken>",
            UserCookies: [], // List of all cookies with User consents
            UserId: <userId>,
            Username: "<username>",
            UserTermsConsent: <boolean value>
        }

Default CSS Classes:
    .policyText {
        font-weight: bold;
    }
    .categoryText {
        font-size: 13px;
        font-style: italic;
    }
    .cookieAnchor {
        color: orange;
        cursor: pointer;
    }
    .cookieTable {
        height: 250px;
        overflow: auto;
    }

    // DO NOT CHANGE THE FOLLOWING STYLES
    .switch { 
        position: relative; 
        display: inline-block;
        width: 54px; 
        height: 28px;
    }
    .switch input { 
        display: none; 
    }
    .slider { 
        position: absolute; 
        cursor: pointer; 
        top: 0; 
        left: 0; 
        right: 0; 
        bottom: 0; 
        background-color: #ccc; 
        -webkit-transition: .4s; 
        transition: .4s; 
        -webkit-transition: .4s; 
        transition: .4s;
    }
    .slider::before { 
        position: absolute; 
        content: ''; 
        height: 20px; 
        width: 20px; 
        left: 4px; 
        bottom: 4px; 
        background-color: white; 
        -webkit-transition: .4s; 
        transition: .4s;
    }
    input[type=checkbox]:checked + .slider { 
        background-color: #2196F3; 
    }
    input:focus + .slider { 
        box-shadow: 0 0 1px #2196f3; 
    }
    input[type=checkbox]:checked + .slider:before { 
        -webkit-transform: translateX(26px); 
        -ms-transform: translateX(26px); 
        transform: translateX(26px); 
    }
    .slider.round { 
        border-radius: 34px 
    }
    .slider.round::before { 
        border-radius: 50%; 
    }

 To change the default styles: Go to the global stylesheet in the application and reference the element using class names or Id.
    For example: 
        a .cookieAnchor {
            color: red
        }
        Will change the color of the link with class cookieAnchor, to red.

Purpose of cookieBanner Plugin:

When a user logs into an application on page load, before any of the application cookies are set, a modal will pop up which contains the cookie policy and a list of all the cookies the application uses. Cookies can either be required (essential to the application) or optional (application can be accessed without these cookies). Required cookies will always to turned on and cannot be turned off. Users can either turn on (give consent) or turn off(revoke consent) to only the optional cookies.
Once the user makes a decision and clicks 'Continue', the consent is stored and returned to the application. The application must make the necessary changes to the cookies based on the consent given by the user.

Keywords

jquery-plugin

FAQs

Package last updated on 26 Aug 2018

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.