<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"></script>
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
{#
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{% endblock %}
#}
{# Axeptio TCF API #}
{# <script rel="preconnect" src="//static.axept.io/tcf/sdk.js"></script>#}
{# <script>#}
{# window.axeptioSettings = {#}
{# clientId: "66137db6ae83de5e566cfc53",#}
{# cookiesVersion: "first-id sandbox-fr-EU",#}
{# };#}
{# (function (d, s) {#}
{# var t = d.getElementsByTagName(s)[0],#}
{# e = d.createElement(s);#}
{# e.async = true;#}
{# e.async = true;#}
{# e.src = "//static.axept.io/tcf/sdk.js";#}
{# e.type = "module";#}
{# t.parentNode.insertBefore(e, t);#}
{# })(document, "script");#}
{# </script>#}
{# End Axeptio TCF API #}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{{ path('app_index') }}">{{ site_name }}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h3>First ID : <span id="firstid"></span></h3>
</div>
</div>
{% block body %}{% endblock %}
</div>
</body>
<script>
// Define a constant for the FirstID vendor ID (1178)
// const FIRSTID_VENDOR_ID = 1178;
//
// // This function listens for user consent via the TCF API
// function listenForTCFConsent(callback) {
// // Output to console that the system is now listening for TCF consent
// console.debug('Listening for TCF consent...');
//
// // Check if the TCF API (__tcfapi) is present on the window object
// if (!window.__tcfapi)
// return; // Exit if TCF API is not found
//
// // Register an event listener to receive updates when consent is given through the TCF API
// window.__tcfapi('addEventListener', 2, (tcData, success) => {
// // Check if the API call was successful and GDPR applies
// if (success && tcData.gdprApplies) {
// // Check if the user has given consent for the specific vendor ID
// if (tcData.vendor.consents[FIRSTID_VENDOR_ID] && tcData.eventStatus === 'useractioncomplete') {
// console.log('User consented to the flex feature.');
// // TODO: Set cookie ??
// callback(); // Execute the callback function if consent is given
// } else {
// console.log('User did not consent to the flex feature.');
// }
// } else {
// console.log('__tcfapi failed to load or is not applicable.');
// }
// });
// }
// Call the listenForTCFConsent function with a callback function that reloads the page
// listenForTCFConsent(window.location.reload)
function getCookieValueFromCookieName(cookieName) {
let cookieArr = document.cookie.split(";");
console.log(cookieArr)
for (let i = 0; i < cookieArr.length; i++) {
let cookiePair = cookieArr[i].split("=");
if (cookieName === cookiePair[0].trim()) {
return decodeURIComponent(cookiePair[1]);
}
}
return null;
}
function checkFirstidCookie() {
let firstidCookieValue = getCookieValueFromCookieName("firstid");
if (firstidCookieValue) {
console.log(`First ID : ${firstidCookieValue}`)
} else {
console.log('No First ID cookie find.')
}
}
// function setCookie(cName, cValue, expDays) {
// let date = new Date();
// date.setTime(date.getTime() + (expDays * 24 * 60 * 60 * 1000));
// const expires = "expires=" + date.toUTCString();
// document.cookie = cName + "=" + cValue + "; " + expires + "; path=/";
// }
// function getFirstidIfNeeded() {
// let consentCookie = getCookieValueFromCookieName('consent');
// let firstidCookieValue = getCookieValueFromCookieName("firstid");
//
// if (consentCookie === 'yes' && !firstidCookieValue) {
// let currentLocation = window.location.href;
// let currentLocationBase64 = btoa(currentLocation);
// window.location = `https://gate2.preprod.first-id.fr?redirectUrl=${currentLocationBase64}`;
// }
// }
// function createFirstidCookieIfNeeded() {
// let params = new URLSearchParams(window.location.search);
// let firstidCookieValue = getCookieValueFromCookieName("firstid");
//
// if (params.has('firstId') && !firstidCookieValue) {
// setCookie('firstid', params.get('firstId'), 180);
// console.log(`cookie first id is set with value ${params.get('firstId')}`)
// }
// }
// function loadFirstIdSdk() {
// var script = document.createElement('script');
// script.src = "https://cdn.preprod.first-id.fr/sdk/loader/loader.min.js";
// script.defer = true;
// document.head.appendChild(script);
//
// script.onload = function () {
// window.firstId = window.firstId || {
// callbacks: [],
// debug: true,
// cookieName: 'firstid'
// };
//
// window.firstId.callbacks.push(() => {
// console.log('FirstID SDK loaded and initialized after user consent.');
// // Additional FirstID SDK logic here
// });
//
// window.firstId.callbacks.push(() => {
// console.log(FIRSTID.get)
// });
// };
// }
// function checkConsentAndLoadSdk() {
// // Check if consent cookie is set, if so, load the SDK
// let consent = getCookieValueFromCookieName('consent');
// if (consent === 'yes') {
// loadFirstIdSdk();
// }
// }
// checkConsentAndLoadSdk();
checkFirstidCookie();
//createFirstidCookieIfNeeded();
//getFirstidIfNeeded();
// loadFirstIdSdk();
let fid = getCookieValueFromCookieName('firstid')
if (fid) {
$('#firstid').text(fid)
} else {
$('#firstid').text('No First ID cookie find.')
}
</script>
</html>