Cookie notice

This commit is contained in:
noah.lancien 2023-06-05 07:06:57 +00:00 • committed by Vincent BRIDIER
parent 69c90777e8
commit f263578cf6
13 changed files with 3252 additions and 3462 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ node_modules
.env
auth.json
.vscode
.npmrc

5879
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@
"stylelint-ci": "node ./node_modules/.bin/stylelint --max-warnings 0 '**/*.scss' -f json"
},
"devDependencies": {
"@ldc-web/cookie-notice": "^3.0.8",
"@popperjs/core": "^2.10.2",
"@rushstack/eslint-patch": "^1.2.0",
"@types/bootstrap": "^5.2.4",

View file

@ -0,0 +1,28 @@
<?php
// * Version 3.0.8
// phpcs:disable
return [
'button_customize_cookies' => 'Personnaliser les cookies',
'button_forbid' => 'Interdire',
'button_allow' => 'Autoriser',
'button_forbid_all' => 'Tout refuser',
'button_allow_all' => 'Tout accepter',
'button_customize' => 'Personnaliser',
'button_back' => 'Retour',
'banner_title' => 'Le site internet :site_name utilise des cookies !',
'banner_text_open' => 'Ce site web stocke les cookies sur votre ordinateur. :site_name utilise ces informations afin d’améliorer et de personnaliser votre expérience de navigation, ainsi que pour l’analyse et les indicateurs concernant nos visiteurs à la fois sur ce site web et sur d’autres supports. Vous pouvez cliquer sur « Accepter » si vous consentez à l’utilisation de ces cookies.',
'banner_text' => 'Nous utilisons des cookies pour nous assurer du bon fonctionnement de notre site et à des fins analytiques. En poursuivant votre navigation sur ce site ou en fermant ce bandeau, vous consentez à l’utilisationde ces cookies.',
'banner_details' => 'Si vous refusez l’utilisation des cookies, vos informations ne seront pas suivies lors de votre visite sur ce site. Un cookie sera utilisé dans votre navigateur afin de se souvenir de ne pas suivre vos préférences. Certaines fonctionnalités ne seront pas accessibles. Vous pouvez changer d’avis et modifier votre consentement à tout moment en revenant sur ce site.',
'banner_details_link' =>
'Pour en savoir plus sur les cookies que nous utilisons, consultez notre charte de confidentialité.',
'banner_details_link_title' => 'Charte de confidentialité',
'banner_more_details' => 'Plus de détails...',
'banner_less_details' => 'Moins de détails...',
'Panel_title' => 'Panneau de gestion des cookies',
'Panel_subtitle' => 'Le respect de votre vie privée est notre priorité',
'Panel_details' => 'Les fonctionnalités de ce site s’appuient sur des services proposés par des tiers. Si vous acceptez, ces tiers déposeront des cookies qui vous permettront de visualiser sur le site du contenu hébergé par ces tiers. Via ces cookies, ces tiers collecteront et utiliseront vos données de navigation pour des finalités qui leur sont propres, conformément à leur politique de confidentialité (lien ci-dessous). Cette page vous permet de donner ou de retirer votre consentement, soit globalement soit service par service.',
'custom' => []
];

View file

@ -1,10 +1,10 @@
// * LIBS
@import "~animate.css/animate.min.css";
@import "~@ldc-web/cookie-notice";
// * UTILITIES
@import "./utilities/variables";
@import "./utilities/mixin";
@import "./utilities/ldcweb-cookies";
// * PARTIALS
@import "./fo/partials/links";

View file

@ -3,6 +3,7 @@
// 2. Include remainder of required Bootstrap stylesheets.
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/variables-dark";
// 3. Include remainder of required parts.
@import "~bootstrap/scss/maps";

View file

@ -1,6 +1,8 @@
// UTILITIES
import { LdcwebCn } from "./utilities/ldcweb-cookies";
window.LdcwebCn = LdcwebCn;
import CookieNotice from "@ldc-web/cookie-notice";
console.log(CookieNotice);
window.CookieNotice = CookieNotice;
// CUSTOM
import "./fo/custom";

View file

@ -1,7 +1,7 @@
export {};
import { Carrousel } from "./fo/caroussel";
import type { LdcwebCn } from "./utilities/ldcweb-cookies";
import type CookieNotice from "@ldc-web/cookie-notice";
import { AxiosStatic } from "axios";
// * Recursive List<string>
@ -14,7 +14,7 @@ type NestedStringList = NestedStringListInterface | StringList | string;
declare global {
interface Window {
Carrousel: Carrousel | {};
LdcwebCn: LdcwebCn | {};
CookieNotice: typeof CookieNotice;
axios: AxiosStatic;
Swal: Function;
__SYSTEM: {

View file

@ -1,598 +0,0 @@
/**
* LDC Service Web Cookies
* Version 2.1.0
*/
enum LdcwebCookieStatus {
true = "true",
false = "false",
wait = "wait",
}
type LdcwebCookieStatusString = keyof typeof LdcwebCookieStatus;
type LdcwebCnOptions = {
name: string;
description: string;
link: string;
labelLink: string;
cookies: string[];
/**
* Fonction qui sert à initialiser la fonctionnalité
* conduisant à la génération du cookie
* @return void
*/
script: () => void;
/**
* Fonction qui sert à informer l'utilisateur
* sur chaque élèment que le cookie
* associé à la fonctionnalité
* est désactivé et propose un lien sur
* cookie notice pour l'activer
* @return void
*/
fallback: () => void | null;
};
export class LdcwebCn {
config: Record<string, LdcwebCnOptions>;
cookieContainer: HTMLDivElement;
bannerContainer: HTMLDivElement;
bannerBtn: HTMLButtonElement;
ldcwebBtn: HTMLButtonElement;
ldcwebBannerParaP: HTMLParagraphElement;
ldcwebBannerContent: HTMLDivElement;
ldcwebBannerDetails: HTMLDivElement;
ldcwebBannerBtnDetails: HTMLDivElement;
modalContainer: HTMLDivElement;
acceptAllBtnBanner: HTMLButtonElement;
denyAllBtnBanner: HTMLButtonElement;
personalizeBtnBanner: HTMLButtonElement;
changeBtn: HTMLCollectionOf<HTMLElement>;
cookiesList: HTMLUListElement;
cookieLink: HTMLElement;
modalDetails: HTMLDivElement;
template: HTMLDivElement;
modalBtnBoolean: boolean;
bannerBtnTextBoolean: boolean;
constructor(config: Record<string, LdcwebCnOptions>) {
// * INITIALIZE VARS
this.config = config;
let cookieContainer: HTMLDivElement | null = null;
if (!(cookieContainer = document.querySelector("#ldcweb-cn"))) {
throw new Error("Cannot find #ldcweb-cn");
}
this.cookieContainer = cookieContainer;
this.bannerContainer = document.querySelector(
".ldcweb-cn-banner"
) as HTMLDivElement;
this.bannerBtn = document.querySelector(
"button.ldcweb-banner-btn-details-p"
) as HTMLButtonElement;
this.ldcwebBtn = document.querySelector(
"button.ldcweb-btn"
) as HTMLButtonElement;
this.ldcwebBannerParaP = document.querySelector(
".ldcweb-banner-para-p"
) as HTMLParagraphElement;
this.ldcwebBannerContent = document.querySelector(
".ldcweb-banner-content"
) as HTMLDivElement;
this.ldcwebBannerDetails = document.querySelector(
".ldcweb-banner-details"
) as HTMLDivElement;
this.ldcwebBannerBtnDetails = document.querySelector(
".ldcweb-banner-btn-details"
) as HTMLDivElement;
this.modalContainer = document.getElementById(
"ldcweb-cn-modal"
) as HTMLDivElement;
this.acceptAllBtnBanner = document.getElementById(
"ldcweb-cn-accept-banner"
) as HTMLButtonElement;
this.denyAllBtnBanner = document.getElementById(
"ldcweb-cn-deny-banner"
) as HTMLButtonElement;
this.personalizeBtnBanner = document.querySelector(
".ldcweb-cn-personalize"
) as HTMLButtonElement;
this.changeBtn = document.getElementsByClassName(
"ldcweb-cn-change"
) as HTMLCollectionOf<HTMLElement>;
this.cookiesList = document.getElementById(
"ldcweb-cn-list"
) as HTMLUListElement;
this.cookieLink = document.querySelector(
".ldcweb-cn-cookie-link"
) as HTMLAnchorElement;
this.modalDetails = document.querySelector(
".modal-details"
) as HTMLDivElement;
this.modalBtnBoolean = false;
this.bannerBtnTextBoolean = false;
let template: HTMLDivElement | null = null;
if (!(template = document.querySelector("#template"))) {
throw new Error("Cannot find 'template' element");
}
this.template = template;
const memoryTemplate = this.template.cloneNode(true) as HTMLDivElement;
this.template.remove();
this.template = memoryTemplate;
// * LOGIC
const self = this;
const cookies = this.getLDCWebCookie("ldcwebcn-init");
if (cookies === undefined) {
const newCookie: string[] = [];
for (const [key] of Object.entries(this.config)) {
newCookie.push(key + "=wait");
}
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
this.saveLDCWebCookie(newCookie.join(","));
} else {
const test = cookies.split(",");
test.forEach((elm) => {
const test = elm.split("=");
if (test[1] === "wait") {
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
}
});
}
/**
* Accept a specific cookie
*/
const accept = function (e: { preventDefault: () => void }) {
e.preventDefault();
for (const [key, value] of Object.entries(self.config)) {
self.addCookie(key, value);
}
for (const acceptLabel of self.cookieContainer.querySelectorAll(
".accept > label"
)) {
acceptLabel.classList.add("active");
}
for (const denyLabel of self.cookieContainer.querySelectorAll(
".deny > label"
)) {
denyLabel.classList.remove("active");
}
self.bannerContainer.classList.remove("ldcweb-cn-banner-open");
}.bind(this);
this.acceptAllBtnBanner.addEventListener("click", accept);
/**
* Deny a specific cookie
*/
const deny = function (e: { preventDefault: () => void }) {
e.preventDefault();
for (const [key, value] of Object.entries(self.config)) {
self.removeCookie(key, value);
}
for (const acceptLabel of self.cookieContainer.querySelectorAll(
".accept > label"
)) {
acceptLabel.classList.remove("active");
}
for (const denyLabel of self.cookieContainer.querySelectorAll(
".deny > label"
)) {
denyLabel.classList.add("active");
}
self.bannerContainer.classList.remove("ldcweb-cn-banner-open");
}.bind(this);
this.denyAllBtnBanner.addEventListener("click", deny);
const openLdcwebCookies = function (e: { preventDefault: () => void }) {
e.preventDefault();
self.openModal();
}.bind(this);
this.cookieLink.addEventListener("click", openLdcwebCookies);
/**
* Show the modal with the list of all cookies
*/
const hideModal = function (e: { preventDefault: () => void }) {
e.preventDefault();
self.ldcwebBannerContent.classList.toggle("visibility");
self.ldcwebBannerDetails.classList.toggle("visibility");
self.ldcwebBannerBtnDetails.classList.toggle("visibility");
self.modalContainer.classList.toggle("visibility");
self.setCookieList();
}.bind(this);
this.personalizeBtnBanner.addEventListener("click", hideModal);
this.personalizeBtnBanner.addEventListener("click", (e) => {
e.preventDefault();
self.modalDetails.scrollTop = 0;
if (!self.modalBtnBoolean) {
self.personalizeBtnOpen();
self.modalBtnBoolean = true;
} else {
self.personalizeBtnClose();
self.modalBtnBoolean = false;
}
});
this.setListenerOnChange();
const cookie = this.getLDCWebCookie("ldcwebcn-init");
if (cookie === undefined) {
throw Error("Ldcweb cookie is not set");
}
const test = cookie.split(",");
test.forEach((elm) => {
const test = elm.split("=");
if (test[1] === "true") {
this.config[test[0]].script();
} else {
if (this.config[test[0]].fallback != null) {
this.config[test[0]].fallback();
}
}
});
this.bannerBtn.addEventListener("click", () => {
self.ldcwebBannerDetails.classList.toggle(
"ldcweb-banner-details-open"
);
self.bannerBtn.classList.toggle("ldcweb-banner-btn-details-p-open");
if (!self.bannerBtn.dataset.open || !self.bannerBtn.dataset.close) {
throw new Error(
"Cannot find attribute data-open or data-close"
);
}
if (
!self.ldcwebBannerParaP.dataset.open ||
!self.ldcwebBannerParaP.dataset.close
) {
throw new Error(
"Cannot find attribute data-open or data-close"
);
}
if (self.bannerBtnTextBoolean) {
self.bannerBtn.innerHTML = self.bannerBtn.dataset.close;
self.ldcwebBannerParaP.innerHTML =
self.ldcwebBannerParaP.dataset.close;
self.ldcwebBannerDetails.style.height = "0px";
self.bannerBtnTextBoolean = false;
} else {
self.bannerBtn.innerHTML = self.bannerBtn.dataset.open;
self.ldcwebBannerParaP.innerHTML =
self.ldcwebBannerParaP.dataset.open;
self.ldcwebBannerDetails.style.height =
self.ldcwebBannerDetails.children[0].clientHeight + "px";
self.bannerBtnTextBoolean = true;
}
});
/**
* Show the default vue of the cookies modal
*/
const resetVue = function (e: { preventDefault: () => void }) {
e.preventDefault();
self.bannerContainer.classList.toggle("ldcweb-cn-banner-open");
if (
self.bannerContainer.classList.contains("ldcweb-cn-banner-open")
) {
self.ldcwebBannerContent.classList.remove("visibility");
self.ldcwebBannerDetails.classList.remove("visibility");
self.ldcwebBannerBtnDetails.classList.remove("visibility");
self.modalContainer.classList.add("visibility");
if (!self.personalizeBtnBanner.dataset.closeModal) {
throw new Error("Cannot find attribut data-close-modal");
}
self.personalizeBtnBanner.innerHTML =
self.personalizeBtnBanner.dataset.closeModal;
self.modalBtnBoolean = false;
}
}.bind(this);
this.ldcwebBtn.addEventListener("click", resetVue);
}
/**
* Set the cookies list in the modal
*/
setCookieList() {
const self = this;
this.cookiesList.innerHTML = "";
for (const [key, value] of Object.entries(this.config)) {
const cookie = document.createElement("li");
const childItem = this.template.children.item(
0
) as HTMLDivElement | null;
if (childItem === null) {
throw new Error("Cannot find child item");
}
cookie.append(childItem.cloneNode(true));
const name = cookie.querySelector(
"span.ldcweb-cn-name"
) as HTMLSpanElement;
const description = cookie.querySelector(
"span.ldcweb-cn-description"
) as HTMLSpanElement;
const link = cookie.querySelector(
"a.ldcweb-cn-link"
) as HTMLAnchorElement;
const acceptInput = cookie.querySelector(
".accept > input"
) as HTMLInputElement;
const denyInput = cookie.querySelector(
".deny > input"
) as HTMLInputElement;
const acceptLabel = cookie.querySelector(
".accept > label"
) as HTMLLabelElement;
const denyLabel = cookie.querySelector(
".deny > label"
) as HTMLLabelElement;
name.textContent = value.name;
description.textContent = value.description;
link.textContent = value.labelLink;
link.setAttribute("href", value.link);
acceptInput.id = key + "1";
acceptInput.name = key;
acceptInput.dataset.name = key;
acceptLabel.htmlFor = key + "1";
denyInput.id = key + "2";
denyInput.name = key;
denyInput.dataset.name = key;
denyLabel.htmlFor = key + "2";
acceptInput.addEventListener("click", () => {
acceptLabel.classList.add("active");
denyLabel.classList.remove("active");
self.addCookie(key, value);
});
denyInput.addEventListener("click", () => {
acceptLabel.classList.remove("active");
denyLabel.classList.add("active");
self.removeCookie(key, value);
});
this.cookiesList.append(cookie);
const cookiesSite = this.getLDCWebCookie("ldcwebcn-init");
if (cookiesSite === undefined) {
throw Error("Ldcweb cookie is not set");
}
const cookiesArray = cookiesSite.split(",");
for (const cookieEl of cookiesArray) {
const name = cookieEl.slice(0, cookieEl.indexOf("="));
const status = cookieEl.slice(cookieEl.indexOf("=") + 1);
if (name === key) {
acceptLabel.classList.remove("active");
denyLabel.classList.remove("active");
switch (status) {
case "true":
acceptLabel.classList.add("active");
break;
case "false":
denyLabel.classList.add("active");
break;
}
}
}
}
this.setListenerOnChange();
}
/**
* Add a specific cookie and
* change his status to true
*
* @param key
* @param value
*/
addCookie(key: string, value: LdcwebCnOptions) {
if (value.script) {
value.script();
}
this.changeStatus(key, "true");
}
/**
* Remove a specific cookie and
* change his status to false
*
* @param key
* @param value
*/
removeCookie(key: string, value: LdcwebCnOptions) {
for (const cookieName of value.cookies) {
this.deleteBrowserCookie(cookieName, "/", "." + location.host);
}
const cookieName = document.getElementById(key);
if (cookieName) {
cookieName.remove();
}
if (value.fallback) {
value.fallback();
}
this.changeStatus(key, "false");
}
/**
* Add events for each cookie buttons
* Activate or Deactivate a specific cookie
*/
setListenerOnChange() {
const self = this;
this.changeBtn = document.getElementsByClassName(
"ldcweb-cn-change"
) as HTMLCollectionOf<HTMLElement>;
for (const item of this.changeBtn) {
this.addEvent(item, "click", () => {
if (!item.dataset.name) {
throw new Error("Dataset is missing required elements");
}
const status = item.dataset.status as
| LdcwebCookieStatus
| undefined;
if (!status || !(status in LdcwebCookieStatus)) {
throw new Error("Dataset is missing required elements");
}
self.changeStatus(item.dataset.name, status);
});
}
}
/**
* Change the status of a cookie
*
* @param name
* @param status
*/
changeStatus(name: string, status: LdcwebCookieStatusString) {
/** Contains array of string like youtube=true etc */
const newCookie: string[] = [];
const cookie = this.getLDCWebCookie("ldcwebcn-init");
if (cookie === undefined) {
throw Error("Ldcweb cookie is not set");
}
/** specificCookieString contains youtube=true like */
cookie.split(",").forEach((specificCookieString) => {
/** Contanins cookie name 0 and cookie value 1 */
const test = specificCookieString.split("=");
// Check this cookie is the one to update
if (test[0] === name) {
newCookie.push(name + "=" + status);
if (status === "false") {
// * Iterer sur chque cookie possible de la config
this.config[test[0]].cookies.forEach(
(cookieNametoRemove) => {
const cookies =
this.getLDCWebCookie(cookieNametoRemove);
// * Si le navigateur possede le cookie
if (cookies !== undefined) {
// * Suppression du cookie et de sa version precedé dun point
document.cookie =
cookieNametoRemove +
"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=" +
document.domain +
"; path=/";
document.cookie =
cookieNametoRemove +
"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=." +
document.domain +
"; path=/";
}
}
);
}
} else {
newCookie.push(specificCookieString);
}
});
this.saveLDCWebCookie(newCookie.join(","));
}
/**
* Set an older expire parameter to a specific cookie
*
* @param name
* @param path
* @param domain
*/
deleteBrowserCookie(name: string, path: string, domain: string) {
if (this.getLDCWebCookie(name)) {
document.cookie =
name +
"=" +
(path ? ";path=" + path : "") +
(domain ? ";domain=" + domain : "") +
";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
}
/**
* Get the Ldcweb cookie
*
* @param name
* @returns A string like analytics=true,youtube=true or undefined
*/
getLDCWebCookie(name: string) {
const matches = document.cookie.match(
new RegExp(
"(?:^|; )" +
name.replace(/([.$?*|{}()[\]\\/+^])/g, "\\$1") +
"=([^;]*)"
)
);
return matches ? decodeURIComponent(matches[1]) : undefined;
}
/**
* Add event on a specific element
*
* @param element
* @param evnt
* @param funct
* @returns
*/
addEvent(element: HTMLElement, evnt: string, funct: () => void) {
return element.addEventListener(evnt, funct, false);
}
/**
* Save cookie content on web browser
*
* @param content
*/
saveLDCWebCookie(content: string) {
const date = new Date();
const newDate = new Date(date.setMonth(date.getMonth() + 13));
document.cookie =
"ldcwebcn-init=" +
content +
"; expires=" +
newDate.toUTCString() +
"; path=/;";
}
/**
* Open the cookies modal
*/
openModal() {
this.bannerContainer.classList.add("ldcweb-cn-banner-open");
this.ldcwebBannerContent.classList.add("visibility");
this.ldcwebBannerDetails.classList.add("visibility");
this.ldcwebBannerBtnDetails.classList.add("visibility");
this.modalContainer.classList.remove("visibility");
this.modalBtnBoolean = true;
this.personalizeBtnOpen();
// Scroll to the top of the cookies list
this.modalDetails.scrollTop = 0;
this.setCookieList();
}
/**
* Change the text of the button "personalize" when the modal is opening
*/
personalizeBtnOpen() {
const personalizeBtnBannerText = this.personalizeBtnBanner.dataset
.openModal as string;
this.personalizeBtnBanner.innerHTML = personalizeBtnBannerText;
}
/**
* Change the text of the button "personalize" when the modal is closing
*/
personalizeBtnClose() {
const personalizeBtnBannerText = this.personalizeBtnBanner.dataset
.closeModal as string;
this.personalizeBtnBanner.innerHTML = personalizeBtnBannerText;
}
}

View file

@ -10,12 +10,12 @@
@include('layouts.frontend.header')
<button id="backtotop"><i class="arrow up"></i></button>
@yield('content')
@include('layouts.frontend.cookie')
@include('layouts.frontend.footer')
@include('vendor.cn-cookies')
<!-- Scripts -->
<script src="{{ mix('js/front.js', 'build') }}" type="text/javascript"></script>
@stack('scripts')
</body>
</html>
</html>

View file

@ -17,7 +17,7 @@
<li><a href="{{ route('mention') }}">{{ __('Legal_notices') }}</a></li>
<li><a href="{{ route('charte') }}">{{ __('Privacy_policy') }}</a></li>
<li><a href="{{ route('contact') }}">{{ __('Contact') }}</a></li>
<li><a href="#" class="ldcweb-cn-cookie-link">{{ __('Gestion des cookies') }}</a></li>
<li><a href="#" class="cn-cookie-link">{{ __('Gestion des cookies') }}</a></li>
{{-- <li><a href="{{ route('faq') }}">FAQ</a></li> --}}
</ul>
<ul>

View file

@ -0,0 +1,96 @@
@php
$site_name = Str::ucfirst(config('app.name'));
$logo_picture_url = mix('assets/images/global/logo.png', 'build');
$logo_alt_text = "Logo {$site_name}";
$confidentiality_page_url = route('charte');
$strings = (object)[
'button_customize_cookies' => __('cookie-notice.button_customize_cookies'),
'button_forbid' => __('cookie-notice.button_forbid'),
'button_allow' => __('cookie-notice.button_allow'),
'button_forbid_all' => Str::upper(__('cookie-notice.button_forbid_all')),
'button_allow_all' => Str::upper(__('cookie-notice.button_allow_all')),
'button_customize' => Str::upper(__('cookie-notice.button_customize')),
'button_back' => Str::upper(__('cookie-notice.button_back')),
'banner_title' => __('cookie-notice.banner_title', ['site_name' => $site_name]),
'banner_text_open' => __('cookie-notice.banner_text_open', ['site_name' => $site_name]),
'banner_text' => __('cookie-notice.banner_text'),
'banner_details' => __('cookie-notice.banner_details'),
'banner_details_link' => __('cookie-notice.banner_details_link'),
'banner_details_link_title' => __('cookie-notice.banner_details_link_title'),
'banner_more_details' => __('cookie-notice.banner_more_details'),
'banner_less_details' => __('cookie-notice.banner_less_details'),
'Panel_title' => __('cookie-notice.Panel_title'),
'Panel_subtitle' => __('cookie-notice.Panel_subtitle'),
'Panel_details' => __('cookie-notice.Panel_details'),
];
$cookies = [];
// ANALYCTICS
$cookies['analytics'] = [
'name' => __('MESURES D’AUDIENCE') . ' - Google Analytics',
'description' => __('Les cookies qui sont déposés via le recaptcha sur les formulaires ont pour finalité d’empêcher que ceux-ci ne soient soumis par des robots.'),
'link' => 'https://policies.google.com/privacy',
'labelLink' => __('En savoir +'),
'cookies' => [
'_ga',
'_gat_gtag_' . str_replace("-", "_", config("ldcweb-cookies.analyticsKey")),
'_gid'
]
];
$cookies['analytics']['script'] = <<<SCRIPT
function () {
(function (d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'https://www.googletagmanager.com/gtag/js?id={{ config("ldcweb-cookies.analyticsKey") }}';
g.id = 'analytics';
s.parentNode.insertBefore(g, s)
}(document, 'script'));
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '{{ config("ldcweb-cookies.analyticsKey") }}');
}
SCRIPT;
@endphp
{{-- INCLUDE TEMPLATE --}}
@include('vendor.cookie-notice-templates.standard', compact(
'site_name', 'logo_picture_url', 'logo_alt_text',
'confidentiality_page_url', 'strings'
))
@push('scripts')
<script nonce="{{ $nonce ?? '' }}">
document.addEventListener('DOMContentLoaded', function () {
window.WebCookieNotice = {};
@foreach($cookies as $index_name => $cookie)
window.WebCookieNotice['{{ $index_name }}'] = {};
window.WebCookieNotice['{{ $index_name }}'].tmp = {};
// SCRIPT
window.WebCookieNotice['{{ $index_name }}'].tmp.script = {!! strip_tags($cookie['script']) !!};
@php unset($cookie['script']); @endphp
// FALLBACK
@if(isset($cookie['fallback']))
window.WebCookieNotice['{{ $index_name }}'].tmp.fallback = {!! strip_tags($cookie['fallback']) !!};
@php unset($cookie['fallback']); @endphp
@endif
window.WebCookieNotice['{{ $index_name }}'].conf = @json($cookie);
window.WebCookieNotice['{{ $index_name }}'].conf.script = window.WebCookieNotice['{{ $index_name }}'].tmp.script;
window.WebCookieNotice['{{ $index_name }}'].conf.fallback = window.WebCookieNotice['{{ $index_name }}'].tmp.fallback;
window.WebCookieNotice['{{ $index_name }}'] = window.WebCookieNotice['{{ $index_name }}'].conf;
@endforeach
window.WebCookieNotice = new CookieNotice(window.WebCookieNotice);
});
</script>
@endpush

View file

@ -0,0 +1,92 @@
<div id="cn-wrapper" tabindex="-1" role="dialog">
<button id="cn-cookie-btn" title="{{ $strings->button_customize_cookies }}">
{{-- COOKIE SVG --}}
<svg viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M14.0001 2.93383C14.0001 4.16622 14.6159 5.25477 15.5567 5.90849C15.3526 6.46423 15.2412 7.06473 15.2412 7.69126C15.2412 10.5472 17.5564 12.8624 20.4123 12.8624C21.0807 12.8624 21.7195 12.7356 22.3059 12.5047C22.9456 13.527 24.0817 14.2069 25.3766 14.2069C26.1872 14.2069 26.9357 13.9404 27.539 13.4903C27.5453 13.6594 27.5484 13.8294 27.5484 14C27.5484 21.4826 21.4826 27.5484 14 27.5484C6.51748 27.5484 0.45166 21.4826 0.45166 14C0.45166 6.51748 6.51748 0.45166 14 0.45166C14.3209 0.45166 14.6391 0.462811 14.9543 0.484747C14.3618 1.12929 14.0001 1.98931 14.0001 2.93383ZM21.2176 2.53212C21.2195 2.54914 21.2213 2.56619 21.2229 2.58328C21.2569 2.58864 21.2909 2.59433 21.3247 2.60035C21.2891 2.57745 21.2534 2.5547 21.2176 2.53212ZM25.5171 6.86104C25.523 6.89745 25.5285 6.93399 25.5336 6.97066C25.5512 6.97141 25.5687 6.97228 25.5861 6.97328C25.5633 6.93574 25.5403 6.89833 25.5171 6.86104ZM12.5247 2.09283C12.4748 2.38291 12.4487 2.68118 12.4487 2.98553C12.4487 4.33316 12.9591 5.56158 13.7972 6.48802C13.7266 6.87842 13.6898 7.28054 13.6898 7.69126C13.6898 11.404 16.6996 14.4137 20.4123 14.4137C20.8725 14.4137 21.3219 14.3675 21.7562 14.2794C22.689 15.1941 23.9669 15.7582 25.3766 15.7582C25.5439 15.7582 25.7094 15.7503 25.8726 15.7347C25.0321 21.5385 20.0368 25.9971 14.0001 25.9971C7.37431 25.9971 2.00305 20.6258 2.00305 14.0001C2.00305 7.87378 6.59498 2.82 12.5247 2.09283Z"
fill="#FF4E4E" />
<circle cx="7.58784" cy="12.8624" r="1.96503" fill="#FF4E4E" />
<circle cx="8.82887" cy="19.2745" r="1.3445" fill="#FF4E4E" />
<circle cx="13.6897" cy="14.5171" r="1.03423" fill="#FF4E4E" />
<circle cx="11.4144" cy="7.48439" r="0.930805" fill="#FF4E4E" />
<circle cx="17.5164" cy="20.3089" r="1.86161" fill="#FF4E4E" />
<circle cx="21.3432" cy="6.7604" r="0.930805" fill="#FF4E4E" />
<circle cx="22.1706" cy="1.89958" r="1.44792" fill="#FF4E4E" />
<circle cx="26.8245" cy="8.31185" r="0.72396" fill="#FF4E4E" />
</svg>
</button>
{{-- BANNER --}}
<div id="cn-banner" tabindex="-1">
<div class="cn-modal-top-line">
<button id="cn-close-modal">X</button>
</div>
{{-- CONTENT VIEW --}}
<div class="cn-content">
{{-- 1ST PAGE BANNER --}}
<div class="cn-banner-content">
<div class="cn-banner-img">
<img src="{{ $logo_picture_url }}" alt="{{ $logo_alt_text }}">
</div>
<div class="cn-banner-text">
<div class="cn-banner-title">
<span>{!! nl2br(e($strings->banner_title)) !!}</span>
</div>
<div class="cn-banner-para-p">
<p class="cn-banner-para-p-close">{!! nl2br(e($strings->banner_text)) !!}</p>
<p class="cn-banner-para-p-open d-none">{!! nl2br(e($strings->banner_text_open)) !!}</p>
</div>
</div>
<div class="cn-banner-details">
<p>
{!! nl2br(e($strings->banner_details)) !!}<br>
<a href="{{ $confidentiality_page_url }}" title="{{ $strings->banner_details_link_title }}">{{ $strings->banner_details_link }}</a>
</p>
</div>
<div class="cn-banner-btn-details">
<button class="cn-banner-btn-details-p" data-open="{{ $strings->banner_less_details }}" data-close="{{ $strings->banner_more_details }}">{!!
nl2br(e($strings->banner_more_details))
!!}</button>
</div>
</div>
{{-- 2ND PAGE CUSTOMIZE PANEL --}}
<div class="cn-modal-container d-none">
<p class="cn-modal-title" aria-level="h2">{{ $strings->Panel_title }}</p>
<p class="cn-modal-subtitle">{!! nl2br(e($strings->Panel_subtitle)) !!}</p>
<p class="cn-modal-description">{!! nl2br(e($strings->Panel_details)) !!}</p>
<div class="cn-modal-wrapper">
{{-- COOKIES LIST --}}
<ul id="cn-modal-list"></ul>
</div>
</div>
</div>
{{-- NAV BAR --}}
<div class="cn-nav">
<button id="cn-deny-banner" class="cn-banner-btn cn-deny">{{ $strings->button_forbid_all }}</button>
<button id="cn-accept-banner" class="cn-banner-btn cn-accept">{{ $strings->button_allow_all }}</button>
<button id="cn-settings-banner" class="cn-banner-btn cn-custom" data-open-modal="{{ $strings->button_back }}" data-close-modal="{{ $strings->button_customize }}">{{
$strings->button_customize
}}</button>
</div>
{{-- COOKIE LIST LI TEMPLATE --}}
<div id="cn-li-template">
<div class="cn-cookie-wrapper">
<div class="cn-cookie-infos">
<span class="cn-cookie-name">#name</span>
<span class="cn-cookie-description">#description</span>
<a class="cn-cookie-link">#link</a>
</div>
<div class="cn-cookie-buttons">
<div class="deny">
<input type="radio" id="" name="" data-name="" data-status="false">
<label for="" role="button" tabindex="0">{{ $strings->button_forbid }}</label>
</div>
<div class="accept">
<input type="radio" id="" name="" data-name="" data-status="true">
<label for="" role="button" tabindex="0">{{ $strings->button_allow }}</label>
</div>
</div>
</div>
</div>
</div>
</div>