@gouvfr/dsfr-roller 1.0.72 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -2
- package/src/node/directive/components/button/button-leaf-directive.js +1 -1
- package/src/node/directive/doc/changelog-leaf-directive.js +2 -1
- package/src/node/generic/code-node.js +1 -1
- package/src/node/generic/inline-code-node.js +1 -1
- package/src/node/node.js +2 -1
- package/src/page/body/cgu.js +61 -0
- package/src/page/html.js +10 -7
- package/src/page/page.js +2 -3
- package/src/script/main/cmp/tarteaucitron/services.js +1 -1
- package/src/script/main/core/get-query.js +1 -1
- package/src/script/main/elements/consent-cgu.js +99 -0
- package/src/script/main/elements/search-bar/index.js +1 -1
- package/src/script/main/index.js +2 -0
- package/src/script/main/minisearch/index.js +1 -1
- package/src/style/main/components/_dsfr-doc-modal-cgu.scss +63 -0
- package/src/style/main/components/_index.scss +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gouvfr/dsfr-roller",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"description": "Le module `dsfr-roller` permet de publier le site de documentation du Système de Design de l’État - DSFR",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Système de Design de l'État",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
{
|
|
31
31
|
"name": "Baptiste Zeller",
|
|
32
32
|
"email": "baptiste.zeller@actimage.com"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Sebastien Malot",
|
|
36
|
+
"email": "sebastien.malot@pm.gouv.fr"
|
|
33
37
|
}
|
|
34
38
|
],
|
|
35
39
|
"repository": {
|
|
@@ -56,7 +60,8 @@
|
|
|
56
60
|
],
|
|
57
61
|
"main": "./index.js",
|
|
58
62
|
"dependencies": {
|
|
59
|
-
"@gouvfr/dsfr-forge": "=1.0.
|
|
63
|
+
"@gouvfr/dsfr-forge": "=1.0.75",
|
|
64
|
+
"@gouvfr/dsfr-kit": "=1.0.75",
|
|
60
65
|
"@gouvfr/dsfr-publisher": "npm:@gouvfr/dsfr@1.14.3",
|
|
61
66
|
"deepmerge": "^4.3.1",
|
|
62
67
|
"ejs": "^3.1.10",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node } from '../../node.js'
|
|
2
|
-
import { convertHTMLEntities
|
|
2
|
+
import { convertHTMLEntities } from '@gouvfr/dsfr-kit'
|
|
3
|
+
import { gitmoji, log } from '@gouvfr/dsfr-forge'
|
|
3
4
|
|
|
4
5
|
class ChangelogLeafDirective extends Node {
|
|
5
6
|
structure (data) {
|
package/src/node/node.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Renderable } from '../core/renderable.js';
|
|
2
2
|
import { nodeFactory } from './node-factory.js';
|
|
3
|
-
import { normalize
|
|
3
|
+
import { normalize } from '@gouvfr/dsfr-kit';
|
|
4
|
+
import { TagAttributes } from '@gouvfr/dsfr-forge';
|
|
4
5
|
class Node extends Renderable {
|
|
5
6
|
constructor (data, tagName = null, isSelfClosing = false, hasNormalizedId = false) {
|
|
6
7
|
super(data);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Renderable } from '../../core/renderable.js';
|
|
2
|
+
import { nodeFactory } from '../../node/node-factory.js';
|
|
3
|
+
|
|
4
|
+
class CGU extends Renderable {
|
|
5
|
+
constructor (data) {
|
|
6
|
+
super(data);
|
|
7
|
+
this._requireCGU = data.cgu.required;
|
|
8
|
+
this._version = data.cgu.version;
|
|
9
|
+
this._content = nodeFactory.create({
|
|
10
|
+
type: 'root',
|
|
11
|
+
children: data.cgu.nodes
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async render () {
|
|
16
|
+
if (!this._requireCGU) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const content = await this._content.render();
|
|
21
|
+
|
|
22
|
+
const cleanContent = content.replace(/<h2\s/g, '<h2 class="fr-h5"')
|
|
23
|
+
.replace(/<h3\s/g, '<h3 class="fr-h6"')
|
|
24
|
+
.replace(/<h4\s/g, '<h4 class="fr-text fr-text--bold"')
|
|
25
|
+
.replace(/<h5\s/g, '<h5 class="fr-text"');
|
|
26
|
+
|
|
27
|
+
return `<dialog id="modal-cgu" class="fr-modal" aria-labelledby="modal-cgu-title" data-cgu-version="${this._version}" data-fr-concealing-backdrop="false">
|
|
28
|
+
<div class="fr-container fr-container--fluid fr-container-md">
|
|
29
|
+
<div class="fr-grid-row fr-grid-row--center">
|
|
30
|
+
<div class="fr-col-12 fr-col-md-10 fr-col-lg-8">
|
|
31
|
+
<div class="fr-modal__body">
|
|
32
|
+
<div class="fr-modal__content dsfr-doc-modal-cgu">
|
|
33
|
+
<div tabindex="-1" class="dsfr-doc-modal-cgu__intro fr-background-alt--blue-france">
|
|
34
|
+
<svg aria-hidden="true" class="fr-artwork dsfr-doc-modal-cgu__intro-pictogram" viewBox="0 0 90 90" width="90px" height="90px">
|
|
35
|
+
<use class="fr-artwork-decorative" href="/dist/artwork/pictograms/document/document-signature.svg#artwork-decorative"></use>
|
|
36
|
+
<use class="fr-artwork-minor" href="/dist/artwork/pictograms/document/document-signature.svg#artwork-minor"></use>
|
|
37
|
+
<use class="fr-artwork-major" href="/dist/artwork/pictograms/document/document-signature.svg#artwork-major"></use>
|
|
38
|
+
</svg>
|
|
39
|
+
<h2 id="modal-cgu-title" class="fr-h5">
|
|
40
|
+
Bienvenue dans les ressources du Système de Design de l’État, soumises à l’acceptation des conditions générales d’utilisation
|
|
41
|
+
</h2>
|
|
42
|
+
<p class="fr-modal__desc">
|
|
43
|
+
Nous vous prions de lire et d'accepter les conditions générales d'utilisation avant d'accéder aux ressources du DSFR.
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
<div>${cleanContent}</div>
|
|
47
|
+
<div class="dsfr-doc-modal-cgu__buttons fr-btns-group fr-btns-group--right fr-btns-group--inline-reverse fr-btns-group--inline-lg">
|
|
48
|
+
<button type="button" id="button-cgu-accept" class="fr-btn">Accepter</button>
|
|
49
|
+
<button type="button" id="button-cgu-deny" class="fr-btn fr-btn--secondary">Refuser</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</dialog>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { CGU };
|
package/src/page/html.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Main } from './body/main.js';
|
|
|
7
7
|
import { Scripts } from './scripts/scripts.js';
|
|
8
8
|
import { AnalyticsConfig } from './scripts/analytics-config.js';
|
|
9
9
|
import { HtmlRenderable } from '../core/html-renderable.js';
|
|
10
|
+
import { CGU } from './body/cgu.js'
|
|
10
11
|
|
|
11
12
|
class Html extends HtmlRenderable {
|
|
12
13
|
constructor (data) {
|
|
@@ -18,6 +19,7 @@ class Html extends HtmlRenderable {
|
|
|
18
19
|
this._main = new Main(data);
|
|
19
20
|
this._footer = new Footer(data.resource.footer);
|
|
20
21
|
this._displayModal = new DisplayModal(data);
|
|
22
|
+
this._cgu = new CGU(data);
|
|
21
23
|
this._scripts = new Scripts(data);
|
|
22
24
|
this._analyticsConfig = new AnalyticsConfig(data);
|
|
23
25
|
}
|
|
@@ -27,13 +29,14 @@ class Html extends HtmlRenderable {
|
|
|
27
29
|
<html lang="${this.data.lang}" data-fr-theme>
|
|
28
30
|
${await this._head.render()}
|
|
29
31
|
<body>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
${await this._skiplink.render()}
|
|
33
|
+
${await this._header.render()}
|
|
34
|
+
${await this._main.render()}
|
|
35
|
+
${await this._footer.render()}
|
|
36
|
+
${await this._displayModal.render()}
|
|
37
|
+
${await this._cgu.render()}
|
|
38
|
+
${await this._analyticsConfig.render()}
|
|
39
|
+
${await this._scripts.render()}
|
|
37
40
|
</body>
|
|
38
41
|
</html>`);
|
|
39
42
|
}
|
package/src/page/page.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import yaml from 'yaml';
|
|
3
3
|
import { Html } from './html.js';
|
|
4
|
-
import { log } from '@gouvfr/dsfr-forge';
|
|
4
|
+
import { log, readYAMLSync } from '@gouvfr/dsfr-forge';
|
|
5
5
|
import { Renderable } from '../core/renderable.js'
|
|
6
6
|
|
|
7
7
|
class Page extends Renderable {
|
|
8
8
|
constructor (src) {
|
|
9
9
|
log.info(`Reading page ${src}`);
|
|
10
|
-
const
|
|
11
|
-
const data = yaml.parse(dataFile);
|
|
10
|
+
const data = readYAMLSync(src);
|
|
12
11
|
super(data);
|
|
13
12
|
this._src = src;
|
|
14
13
|
this._dest = `${this.data.url}/index.html`;
|
|
@@ -7838,7 +7838,7 @@ export const faciliti = {
|
|
|
7838
7838
|
(function (w, d, s, f) {
|
|
7839
7839
|
w[f] = w[f] || {
|
|
7840
7840
|
conf: function () {
|
|
7841
|
-
(w[f].
|
|
7841
|
+
(w[f].provider = w[f].data || []).push(arguments);
|
|
7842
7842
|
},
|
|
7843
7843
|
};
|
|
7844
7844
|
var l = d.createElement(s),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const paramsString = window.location.search;
|
|
2
2
|
const searchParams = new URLSearchParams(paramsString);
|
|
3
|
-
import { normalizeTerm } from '@gouvfr/dsfr-
|
|
3
|
+
import { normalizeTerm } from '@gouvfr/dsfr-kit';
|
|
4
4
|
|
|
5
5
|
const getQuery = () => {
|
|
6
6
|
return normalizeTerm(searchParams.get('query'));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Element } from '../core/element.js'
|
|
2
|
+
|
|
3
|
+
class ConsentCGU extends Element {
|
|
4
|
+
get buttonAccept () {
|
|
5
|
+
return this.element.querySelector('#button-cgu-accept');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get buttonDeny () {
|
|
9
|
+
return this.element.querySelector('#button-cgu-deny');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get modalContent () {
|
|
13
|
+
return this.element.querySelector('.fr-modal__body');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
init() {
|
|
17
|
+
this.buttonAccept.addEventListener(
|
|
18
|
+
'click',
|
|
19
|
+
this.handleButtonAcceptClick.bind(this)
|
|
20
|
+
);
|
|
21
|
+
this.buttonDeny.addEventListener(
|
|
22
|
+
'click',
|
|
23
|
+
this.handleButtonDenyClick.bind(this)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
this.handleConsent();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
handleConsent() {
|
|
30
|
+
const modal = document.getElementById('modal-cgu');
|
|
31
|
+
const cguVersion = modal?.getAttribute('data-cgu-version') || null;
|
|
32
|
+
const cguVersionSplit = cguVersion ? cguVersion.split('.') : [];
|
|
33
|
+
const cookieVersion = document.cookie.split('; ').find(row => row.startsWith('cgu-version='))?.split('=')[1];
|
|
34
|
+
const cookieVersionSplit = cookieVersion ? cookieVersion.split('.') : [];
|
|
35
|
+
const isSameVersion = cookieVersion && (cookieVersionSplit[0] === cguVersionSplit[0] && cookieVersionSplit[1] === cguVersionSplit[1]);
|
|
36
|
+
|
|
37
|
+
if (isSameVersion) {
|
|
38
|
+
if (modal) modal.remove();
|
|
39
|
+
} else {
|
|
40
|
+
if (modal) {
|
|
41
|
+
window.dsfr(modal).modal.disclose();
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
modal.querySelector('.dsfr-doc-modal-cgu__intro')?.focus();
|
|
44
|
+
});
|
|
45
|
+
document.addEventListener('keydown', (e) => {
|
|
46
|
+
if (e.key === 'Escape') {
|
|
47
|
+
if (modal?.classList.contains('fr-modal--opened') && !modal.classList.contains('dsfr-doc-modal-cgu-accepted')) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
e.stopImmediatePropagation();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, { capture: true });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getConfirmModalContent() {
|
|
58
|
+
return `
|
|
59
|
+
<div class="fr-modal__header">
|
|
60
|
+
<button aria-controls="modal-cgu" title="Fermer" type="button" id="button-cgu-accepted-close" class="fr-btn fr-btn--close">Fermer</button>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="fr-modal__content dsfr-doc-modal-cgu-accepted__content">
|
|
63
|
+
<svg aria-hidden="true" class="fr-artwork fr-artwork--green-emeraude dsfr-doc-modal-cgu-accepted__pictogram" viewBox="0 0 80 80" width="80px" height="80px">
|
|
64
|
+
<use class="fr-artwork-decorative" href="/dist/artwork/pictograms/system/success.svg#artwork-decorative"></use>
|
|
65
|
+
<use class="fr-artwork-minor" href="/dist/artwork/pictograms/system/success.svg#artwork-minor"></use>
|
|
66
|
+
<use class="fr-artwork-major" href="/dist/artwork/pictograms/system/success.svg#artwork-major"></use>
|
|
67
|
+
</svg>
|
|
68
|
+
<p id="modal-cgu-title" role="alert" class="fr-h4">Merci, votre consentement a été enregistré</p>
|
|
69
|
+
<button type="button" id="button-cgu-accepted-confirm" aria-controls="modal-cgu" class="fr-btn dsfr-doc-modal-cgu-accepted__button">Accéder à la documentation</button>
|
|
70
|
+
<p class="dsfr-doc-modal-cgu-accepted__info">Le formulaire « Conditions générales d’utilisation du Système de Design de l’État » s’inscrit dans le cadre d’un traitement de données personnelles géré par la Direction des Services Administratifs et Financiers du Premier ministre (DSAF). Vous disposez de droits sur vos données personnelles collectées et utilisées dans ce cadre (opposition, accès, rectification, suppression, limitation, portabilité, testament numérique). Pour en savoir plus, consulter la page “Données personnelles”.</p>
|
|
71
|
+
</div>`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
handleButtonAcceptClick() {
|
|
75
|
+
this.modalContent.innerHTML = this.getConfirmModalContent();
|
|
76
|
+
this.element.classList.add('dsfr-doc-modal-cgu-accepted');
|
|
77
|
+
const buttonClose = this.modalContent.querySelector('#button-cgu-accepted-close');
|
|
78
|
+
if (buttonClose) buttonClose.focus();
|
|
79
|
+
const cguVersion = this.element.getAttribute('data-cgu-version');
|
|
80
|
+
this.element.removeAttribute('data-fr-concealing-backdrop');
|
|
81
|
+
document.cookie = `cgu-version=${cguVersion}; path=/; max-age=${60 * 60 * 24 * 365 * 2}`;
|
|
82
|
+
|
|
83
|
+
fetch('/api/cgu_consent', {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: {
|
|
86
|
+
'Content-Type': 'application/json'
|
|
87
|
+
},
|
|
88
|
+
body: JSON.stringify({
|
|
89
|
+
version: cguVersion
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
handleButtonDenyClick() {
|
|
95
|
+
window.location.href = '/';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default ConsentCGU;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Element } from '../../core/element.js';
|
|
2
2
|
import { ResultsDropdown } from './results/results-dropdown.js';
|
|
3
|
-
import { normalizeTerm } from '@gouvfr/dsfr-
|
|
3
|
+
import { normalizeTerm } from '@gouvfr/dsfr-kit';
|
|
4
4
|
|
|
5
5
|
class SearchBar extends Element {
|
|
6
6
|
constructor (element) {
|
package/src/script/main/index.js
CHANGED
|
@@ -2,12 +2,14 @@ import './minisearch/index.js';
|
|
|
2
2
|
import { instantiateElements } from './core/element.js'
|
|
3
3
|
import CopySnippet from './elements/copy-snippet.js';
|
|
4
4
|
import CopyLink from './elements/copy-link.js';
|
|
5
|
+
import ConsentCGU from './elements/consent-cgu.js';
|
|
5
6
|
import Storybook from './elements/storybook.js';
|
|
6
7
|
import { SearchBar } from './elements/search-bar/index.js';
|
|
7
8
|
import { ConsentManagementPlatform } from './cmp/index.js';
|
|
8
9
|
|
|
9
10
|
window.onload = async () => {
|
|
10
11
|
await instantiateElements('.code-snippet--copy', CopySnippet);
|
|
12
|
+
await instantiateElements('#modal-cgu', ConsentCGU);
|
|
11
13
|
await instantiateElements('.dsfr-doc-anchor-heading__button', CopyLink);
|
|
12
14
|
await instantiateElements('.dsfr-doc-storybook-leaf iframe', Storybook);
|
|
13
15
|
await instantiateElements('#search', SearchBar);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.dsfr-doc-modal-cgu {
|
|
2
|
+
&__intro {
|
|
3
|
+
padding: 2rem 1rem 1.5rem 1rem;
|
|
4
|
+
text-align: center;
|
|
5
|
+
margin-top: 2rem;
|
|
6
|
+
margin-bottom: 2.5rem;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
|
|
11
|
+
@media (min-width: 48em) {
|
|
12
|
+
padding: 2rem 4.5rem 1.5rem 4.5rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&-pictogram {
|
|
16
|
+
margin-bottom: 1rem;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-accepted {
|
|
21
|
+
&__content {
|
|
22
|
+
padding: 0.5rem 1rem 0 1rem;
|
|
23
|
+
margin-bottom: 0;
|
|
24
|
+
text-align: center;
|
|
25
|
+
|
|
26
|
+
@media (min-width: 48em) {
|
|
27
|
+
padding: 0.5rem 3rem 0.5rem 3rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__pictogram {
|
|
32
|
+
margin-bottom: 1rem;
|
|
33
|
+
|
|
34
|
+
@media (min-width: 48em) {
|
|
35
|
+
width: 130px;
|
|
36
|
+
height: 130px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__button {
|
|
41
|
+
margin-top: 0.5rem;
|
|
42
|
+
font-size: 1.125rem;
|
|
43
|
+
line-height: 1.75rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__info {
|
|
47
|
+
margin-top: 2.5rem;
|
|
48
|
+
font-size: 0.75rem;
|
|
49
|
+
line-height: 1.25rem;
|
|
50
|
+
color: var(--text-mention-grey);
|
|
51
|
+
text-align: left;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__buttons {
|
|
56
|
+
margin-bottom: -1rem;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
#modal-cgu {
|
|
62
|
+
backdrop-filter: blur(7px);
|
|
63
|
+
}
|