@antik-web/cookie-consent
Advanced tools
Comparing version 2.0.5 to 3.0.0
@@ -1,35 +0,6 @@ | ||
/*!**********************!*\ | ||
!*** ./src/index.js ***! | ||
\**********************/ | ||
/*!*****************************!*\ | ||
!*** ./src/requests/gtm.js ***! | ||
\*****************************/ | ||
/*!******************************!*\ | ||
!*** ./src/helpers/debug.js ***! | ||
\******************************/ | ||
/*!******************************!*\ | ||
!*** ./src/lang/synced.json ***! | ||
\******************************/ | ||
/*!*******************************!*\ | ||
!*** ./src/helpers/colors.js ***! | ||
\*******************************/ | ||
/*!*******************************!*\ | ||
!*** ./src/helpers/design.js ***! | ||
\*******************************/ | ||
/*!*******************************!*\ | ||
!*** ./src/helpers/events.js ***! | ||
\*******************************/ | ||
/*!**********************************!*\ | ||
!*** ./src/helpers/detection.js ***! | ||
\**********************************/ | ||
/*!******************************************************************!*\ | ||
!*** ./node_modules/vanilla-cookieconsent/dist/cookieconsent.js ***! | ||
\******************************************************************/ | ||
/*! | ||
* CookieConsent 3.0.0 | ||
* https://github.com/orestbida/cookieconsent/tree/v3 | ||
* Author Orest Bida | ||
* Released under the MIT License | ||
*/ |
@@ -0,8 +1,12 @@ | ||
import CookieConsent from 'vanilla-cookieconsent'; | ||
export interface AntikConsentOptions { | ||
main_color?: string; | ||
shouldDownloadCss?: boolean; | ||
debug?: boolean; | ||
lang?: string; | ||
shouldInjectCss?: boolean; | ||
mainColor?: string; | ||
cookieExpiration?: number; | ||
gtach?: string[]; | ||
lang?: string; | ||
meta_cookie?: boolean; | ||
analytics_cookies?: { | ||
disableMetaCookie?: boolean; | ||
analyticCookies?: { | ||
provider: string; | ||
@@ -13,3 +17,3 @@ information: { | ||
}[]; | ||
marketing_cookies?: { | ||
marketingCookies?: { | ||
provider: string; | ||
@@ -20,21 +24,16 @@ information: { | ||
}[]; | ||
cookie_expiration?: number; | ||
force_consent?: boolean; | ||
force_reload_cookie?: boolean; | ||
debug?: boolean; | ||
// eslint-disable-next-line no-unused-vars | ||
onAccepted: (config: {cookie: CookieConsent.CookieValue}) => any, | ||
} | ||
export type ConsentObject = { | ||
// eslint-disable-next-line no-unused-vars | ||
run: (options: AntikConsentOptions) => void; | ||
gtag: () => any; | ||
cookieConsent: { | ||
updateLanguage: () => any, | ||
allowedCategory: () => any, | ||
run: () => any, | ||
showSettings: () => any, | ||
set: () => any, | ||
}; | ||
cookieConsent: typeof CookieConsent | ||
webUrl: string, | ||
showSettingsModal: () => void, | ||
setLanguage: (lang: string) => Promise<void>, | ||
}; | ||
export declare const AntikConsent: ConsentObject; |
{ | ||
"name": "@antik-web/cookie-consent", | ||
"version": "2.0.5", | ||
"version": "3.0.0", | ||
"description": "A lightweight & gdpr compliant cookie consent plugin written in plain javascript, implementing laman.", | ||
@@ -12,6 +12,9 @@ "main": "dist/acs.js", | ||
"build": "./node_modules/.bin/webpack", | ||
"tsc": "./node_modules/.bin/tsc ./src/indexv3.ts --esModuleInterop --resolveJsonModule", | ||
"tsc:win": ".\\node_modules\\.bin\\tsc .\\src\\indexv3.ts --esModuleInterop --resolveJsonModule", | ||
"build:production": "./node_modules/.bin/webpack --env production", | ||
"build:production:win": ".\\node_modules\\.bin\\webpack --env production", | ||
"build:watch": "./node_modules/.bin/webpack --watch", | ||
"fetch:laman": "node --experimental-json-modules ./src/requests/fetchLaman.js" | ||
"fetch:laman": "node --experimental-json-modules ./src/requests/fetchLaman.js", | ||
"dev": "webpack serve --mode development --open" | ||
}, | ||
@@ -27,9 +30,18 @@ "keywords": [ | ||
"@babel/eslint-parser": "^7.17.0", | ||
"axios": "^0.26.1", | ||
"dotenv": "^16.0.0", | ||
"dotenv-webpack": "^7.1.0", | ||
"eslint": "^8.12.0", | ||
"terser-webpack-plugin": "^5.3.1", | ||
"webpack": "^5.71.0", | ||
"webpack-cli": "^4.9.2" | ||
"@types/node": "^20.11.20", | ||
"@typescript-eslint/parser": "^7.0.2", | ||
"axios": "^1.6.7", | ||
"copy-webpack-plugin": "^12.0.2", | ||
"css-loader": "^6.10.0", | ||
"dotenv": "^16.4.5", | ||
"dotenv-webpack": "^8.0.1", | ||
"eslint": "^8.56.0", | ||
"style-loader": "^3.3.4", | ||
"terser-webpack-plugin": "^5.3.10", | ||
"ts-loader": "^9.5.1", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.90.3", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^5.0.2" | ||
}, | ||
@@ -39,4 +51,4 @@ "dependencies": { | ||
"lodash": "^4.17.21", | ||
"vanilla-cookieconsent": "^2.8.0" | ||
"vanilla-cookieconsent": "^3.0.0" | ||
} | ||
} |
@@ -42,7 +42,10 @@ # Antik Cookie Consent | ||
AntikConsent.run({ | ||
main_color: '#ff0000', | ||
gtach: ['G-XXXXXXXXXX', 'G-XXXXXXXXXX'], | ||
debug: true, | ||
lang: 'sk', | ||
meta_cookie: false, | ||
analytics_cookies: [ | ||
shouldInjectCss: true, | ||
mainColor: '#8102ad', | ||
cookieExpiration: 20, | ||
gtach: ['GTM-XXXXXX'], | ||
disableMetaCookie: false, | ||
analyticCookies: [ | ||
{ | ||
@@ -52,6 +55,7 @@ provider: 'Test, Inc.', | ||
sk: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Zásady používania údajov spoločnosti Test</a>', | ||
en: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Policy</a>', | ||
}, | ||
} | ||
], | ||
marketing_cookies: [ | ||
marketingCookies: [ | ||
{ | ||
@@ -61,9 +65,10 @@ provider: 'Test, Inc.', | ||
sk: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Zásady používania údajov spoločnosti Test</a>', | ||
en: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Policy</a>', | ||
}, | ||
} | ||
], | ||
cookie_expiration: 182, | ||
force_consent: false, | ||
force_reload_cookie: true, | ||
debug: true | ||
onAccepted: (cookies) => { | ||
console.log('Accepted cookies, detail below'); | ||
console.log(cookies); | ||
} | ||
}); | ||
@@ -84,4 +89,2 @@ </script> | ||
Since `version 2.0.0`, you can use this package as a JS module. Install it from npm package store. | ||
``` | ||
@@ -95,14 +98,12 @@ npm install @antik-web/cookie-consent | ||
import { AntikConsent } from '@antik-web/cookie-consent'; | ||
import '@antik-web/cookie-consent/dist/cookieconsent.min.css'; | ||
import '@antik-web/cookie-consent/dist/cookieconsent-v3.css'; | ||
AntikConsent.webUrl = import.meta.env.VITE_APP_ANTIK_CONSENT_URL; | ||
AntikConsent.run({ | ||
main_color: '#009BFF', | ||
mainColor: '#009BFF', | ||
gtach: import.meta.env.VITE_APP_GTACH.split(','), | ||
shouldDownloadCss: false, | ||
shouldInjectCss: false, | ||
}); | ||
``` | ||
See the *shouldDownloadCss*. If you set it to false, you have to provide css as we did in the second import. Otherwise, the default css will be downloaded and it may be blocked by browser, because its requesting different domain. | ||
### Options | ||
@@ -112,15 +113,14 @@ | ||
| Option | Type | Default | Description | | ||
|-------------------------------------|---------------------------------|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `main_color` | string | #2d4156 | If provided, the main color of cookie bar will be the one you provided. Hovering the element will have the same color with opacity of 65%. Pay attention, main_color argument must be in <b>#xxxxxx</b> HEX format. | | ||
| `lang` | string | Browser's language | If you want to manually select language of cookie consent box, include this parameter with proper language code. | | ||
| `meta_cookie` | boolean | true | Pass <b>false</b> value when you do not want to show Meta in analytic and marketing cookie tables. | | ||
| `analytics_cookies` | Object || Object[] | - | Names of used cookies provided in the analytics table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, <b>when you use HTML tags, you dont need to wrap attributes in quotation marks.</b> | | ||
| `marketing_cookies` | Object || Object[] | - | Names of used cookies provided in the marketing table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, <b>when you use HTML tags, you dont need to wrap attributes in quotation marks.</b> | | ||
| `gtach` | string || string[] | - | As we spoke of implementation of GTAG in this package, in this parameter, you have to provide google tag manager id(s) to allow the package to use it. You can either provide a only string with ID, or Array of strings containing multiple IDs. <b>If valid ID is provided, Google is automatically inserted in analytics table and marketing table as well.</b> | | ||
| `force_consent` | boolean | false | Enable if you want to block page navigation until user action. | | ||
| `cookie_expiration` | number (integer) | 182 (specified in env, set during build) | Cookie expiration time in <b>days</b>. | | ||
| `force_reload_cookie` | boolean | false | Remove cookies before running app. This makes cookie box show everytime user opens a page. | | ||
| `debug` | boolean | false | Enable logs. | | ||
| `shouldDownloadCss` | boolean | false | Tells the library if it should download css from cdn or you provide css yourself. | | ||
| Option | Type | Default | Description | | ||
|-----------------------------------|---------------------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `mainColor` | string | #2d4156 | If provided, the main color of cookie bar will be the one you provided. Hovering the element will have the same color with opacity of 65%. Pay attention, main_color argument must be in <b>#xxxxxx</b> HEX format. | | ||
| `lang` | string | Browser's language | If you want to manually select language of cookie consent box, include this parameter with proper language code. | | ||
| `disableMetaCookie` | boolean | false | Pass <b>true</b> value when you do not want to show Meta in analytic and marketing cookie tables. | | ||
| `analyticCookies` | Object || Object[] | - | Names of used cookies provided in the analytics table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, <b>when you use HTML tags, you dont need to wrap attributes in quotation marks.</b> | | ||
| `marketingCookies` | Object || Object[] | - | Names of used cookies provided in the marketing table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, <b>when you use HTML tags, you dont need to wrap attributes in quotation marks.</b> | | ||
| `gtach` | string[] | - | As we spoke of implementation of GTAG in this package, in this parameter, you have to provide google tag manager id(s) to allow the package to use it. You have to provide Array of string(s) containing ID(s). <b>If valid ID is provided, Google tag manager would be automatically inserted to head and initialized.</b> | | ||
| `cookieExpiration` | number (integer) | 182 (specified in env, set during build) | Cookie expiration time in <b>days</b>. | | ||
| `debug` | boolean | false | Enable logs. | | ||
| `shouldInjectCss` | boolean | false | Tells the library if it should download css from cdn or you provide css yourself. | | ||
| `onAccepted` | function | - | This function is called right after user agreed with cookies usage (excluding necessary cookies). As a parameter, you receive object with details about user preferences. | | ||
@@ -132,7 +132,9 @@ | ||
| Option | Returns | Parameters | Description | | ||
|-------------------------------|------------------------------|---------------------|----------------------------------------------------| | ||
| `run` | void | Options object | Runs the application with specified configuration. | | ||
| `cookieConsent` | function | - | Function to get raw cookie-consent object. | | ||
| `gtag` | function || null | - | Function to get gtag function when available. | | ||
| `webUrl` | string | - | Get or set web_url, that is used in analytics. | | ||
| Option | Returns | Parameters | Description | | ||
|-----------------------------------|------------------------------|---------------------|----------------------------------------------------| | ||
| `run` | void | Options object | Runs the application with specified configuration. | | ||
| `gtag` | function || null | - | Function to get gtag function when available. | | ||
| `cookieConsent` | function | - | Function to get raw cookie-consent object. | | ||
| `webUrl` | string | - or string | Get or set web_url, that is used in analytics. | | ||
| `showSettingsModal` | void | - | Open cookie settings modal using Javascript. | | ||
| `setLanguage` | string | - or string | Set language of all cookie-related elements. | |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
132753
134
17
36
+ Addedvanilla-cookieconsent@3.0.1(transitive)
- Removedvanilla-cookieconsent@2.9.2(transitive)
Updatedvanilla-cookieconsent@^3.0.0