## Ekino user consent module

- [Goal](#goal)
- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)

## Goal

The goal of `ucm` is to provide a very simple API to implement the required cookie consent
banner. You can read this European Comission article about [cookie consent](http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm) to know more about it in general.

Also, `ucm` will automatically dialog with `google tag manager` (TMS of your choice soon) in order to communicate about the consented categories by the final user.

## Previous Versions

This package has a previous version named `CCGTM`(version 1.2.0) that is now depracated, it is best to use the current version of this package (`UCM`, version 2.1.0).

## Installation

Execute this command to install ucm

```sh
$ npm install --save-dev ucm
```

Using our cdn

```html
<script type="text/javascript" src="https://unpkg.com/ucm@latest"></script>
```

## Usage

```js
import ucm from 'ucm';

ucm.initialize({
  settings: {
    validateOnClose: false,
    pushTop: true,
    pushPop: false,
    fixBottom: false,
    forceAll: false,
    disableAcceptAll: false,
    disableRejectAll: false,
    pushTopHideOnScroll: false,
    mobileOffCanvas: false,
    switchOrder: false,
    moreLink: '',
    domain: null,
    timeout: 0,
    daysBeforeExpiry: 396
  },
  i18n: {
    popinClose: 'Close'
  }
});
```

## Options

**validateOnClose** - `{Boolean}` (default: `false`)
Validate the consent when the user closes the popin without any modification in the settings

if set to `false`, the popin closes without launching acceptance

**when banner mode is enabled, this setting controls both the banner and parameter popin**

**forceAll** - `{Boolean}` (default: `true`)
Forces acception of all cookie settings upon pressing the "Accept all" button (banner or popin)

**pushTop** - `{Boolean}` (default: `true`)
The banner will appear on top of the page an push the content

**pushPop** - `{Boolean}` (default: `false`)
The modal will open automatically

**fixBottom** - `{Boolean}` (default: `false`)
The banner will appear at the bottom of the page

**if neither `pushTop`, `pushPop` or `fixBottom` are enabled, the default is `pushTop` (top banner)**

**if `pushPop` is enabled and either or both `fixBottom` and `pushTop` are enabled too, the default is `pushPop` (popin)**

**disableAcceptAll** - `{Boolean}` (default: `false`)
Disables the "Accept and Continue" button (banner or popin)

**disableRejectAll** - `{Boolean}` (default: `false`)
Disables the "Reject all" button (banner or popin)

**pushTopHideOnScroll** - `{Boolean}` (default: `false`)
This will hide the banner if the users scrolls

**mobileOffCanvas** - `{Boolean}` (default: `false`)
Controls mobile rendering mode, default is popin

**switchOrder** - `{Boolean}` (default: `false`)
Inverses `Parameters` and `Accept` buttons rendering order on both the banner and popin - default is `Parameters` first then `Accept`

**moreLink** - `{String}` (default: `""`)
Indicates the url of the link to know more about cookie consent

**domain** - `{String}` (default: `""`)
Specify a specific domain to associate the cookie with

**daysBeforeExpiry** - `{Number}` (default: `396`)
Number of days before the cookie expires

**debugMode** - `{Boolean}` (default: `false`)
Not an option in itself, default is set to `false`, enables debug by cleaning cookie at each reload

## Version

Current version is 2.1.0 - see CHANGELOG for infos
