Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Build Deno SPA
run: |
deno install --allow-scripts --reload
VITE_API_URL=https://api.nanoapi.io deno task build:app
VITE_API_URL=${{ vars.VITE_API_URL }} VITE_GOOGLE_ANALYTICS_ID=${{ vars.VITE_GOOGLE_ANALYTICS_ID }} deno task build:app

- name: Deploy to Firebase
# only deploy on main branch
Expand Down
6 changes: 6 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"stripe:forward": "deno task stripe:cli listen --forward-to http://host.docker.internal:4000/billing/webhook",
"stripe:mock": "docker run --rm -it -p 12111-12112:12111-12112 stripe/stripe-mock:latest"
},
"lint": {
"exclude": [
"packages/app/dist/**/*",
"packages/app/public/tarteaucitron/**/*"
]
},
"compilerOptions": {
"strict": true
}
Expand Down
88 changes: 88 additions & 0 deletions packages/app/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="/tarteaucitron/tarteaucitron.min.js"></script>
<script type="text/javascript">
tarteaucitron.init({
"privacyUrl": "", /* Privacy policy url */
"bodyPosition":
"top", /* top to bring it as first element for accessibility */

"hashtag":
"#tarteaucitron", /* Open the panel with this hashtag */
"cookieName": "tarteaucitron", /* Cookie name */

"orientation": "middle", /* Banner position (top - bottom) */

"groupServices": true, /* Group services by category */
"showDetailsOnClick":
true, /* Click to expand the description */
"serviceDefaultState":
"wait", /* Default state (true - wait - false) */

"showAlertSmall":
false, /* Show the small banner on bottom right */
"cookieslist": false, /* Show the cookie list */

"closePopup": false, /* Show a close X on the banner */

"showIcon": false, /* Show cookie icon to manage cookies */
"iconSrc":
"/logo.png", /* Optionnal: URL or base64 encoded image */
"iconPosition":
"BottomRight", /* Position of the cookie (BottomRight - BottomLeft - TopRight - TopLeft) */

"adblocker":
false, /* Show a Warning if an adblocker is detected */

"DenyAllCta": true, /* Show the deny all button */
"AcceptAllCta": true, /* Show the accept all button */
"highPrivacy":
true, /* HIGHLY RECOMMANDED Disable auto consent */
"alwaysNeedConsent":
false, /* Ask the consent for "Privacy by design" services */

"handleBrowserDNTRequest":
false, /* If Do Not Track == 1, disallow all */

"removeCredit": true, /* Remove credit link */
"moreInfoLink": true, /* Show more info link */

"useExternalCss":
false, /* Expert mode: do not load the tarteaucitron.css file */
"useExternalJs":
false, /* Expert mode: do not load the tarteaucitron js files */

//"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */

"readmoreLink": "", /* Change the default readmore link */

"mandatory": true, /* Show a message about mandatory cookies */
"mandatoryCta":
false, /* Show the disabled accept button when mandatory on */

//"customCloserId": "", /* Optional a11y: Custom element ID used to open the panel */

"googleConsentMode":
true, /* Enable Google Consent Mode v2 for Google ads & GA4 */
"bingConsentMode":
true, /* Enable Bing Consent Mode for Clarity & Bing Ads */
"softConsentMode":
false, /* Soft consent mode (consent is required to load the services) */

"dataLayer":
false, /* Send an event to dataLayer with the services status */
"serverSide":
false, /* Server side only, tags are not loaded client side */

"partnersList":
true, /* Show the number of partners on the popup/middle banner */
});
</script>
<script>
tarteaucitron.user.gtagUa = "%VITE_GOOGLE_ANALYTICS_ID%";
// tarteaucitron.user.gtagCrossdomain = ['example.com', 'example2.com'];
tarteaucitron.user.gtagMore = function () {
/* add here your optionnal gtag() */
};
(tarteaucitron.job = tarteaucitron.job || []).push("gtag");
</script>

<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="src/styles/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NanoAPI</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
Expand Down
21 changes: 21 additions & 0 deletions packages/app/public/tarteaucitron/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 AmauriC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
179 changes: 179 additions & 0 deletions packages/app/public/tarteaucitron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
[![](https://data.jsdelivr.com/v1/package/npm/tarteaucitronjs/badge)](https://www.jsdelivr.com/package/npm/tarteaucitronjs)
[![npm](https://img.shields.io/npm/v/tarteaucitronjs.svg)](https://www.npmjs.com/package/tarteaucitronjs)
[![GitHub contributors](https://img.shields.io/github/contributors/AmauriC/tarteaucitron.js.svg)](https://github.com/AmauriC/tarteaucitron.js/graphs/contributors)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/AmauriC)

👋 Hey, I'm Amauri, a french dev that build a GDPR friendly cookie manager.

tarteaucitron was initially a simple script for my personal blog (in 2013), a
few months later, the Github repository is opened and tarteaucitron is now
reliable and recognized.

The european cookie law regulates the management of cookies and you should ask
your visitors their consent before exposing them to third party services.

Clearly this script will:

- Disable all services by default,
- Display a banner on the first page view and a small one on other pages,
- Display a panel to allow or deny each services one by one,
- Store the consent in a cookie for 365 days.

Bonus:

- Load service when user click on Allow (without reload of the page),
- Incorporate a fallback system (display a link instead of social button and a
static banner instead of advertising).

# How to use

```html
<script src="/tarteaucitron/tarteaucitron.js"></script>

<script>
tarteaucitron.init({
"privacyUrl": "", /* Privacy policy url */
"bodyPosition":
"bottom", /* or top to bring it as first element for accessibility */

"hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
"cookieName": "tarteaucitron", /* Cookie name */

"orientation":
"middle", /* Banner position (top - bottom - middle - popup) */

"groupServices": false, /* Group services by category */
"showDetailsOnClick": true, /* Click to expand the description */
"serviceDefaultState": "wait", /* Default state (true - wait - false) */

"showAlertSmall": false, /* Show the small banner on bottom right */
"cookieslist": false, /* Show the cookie list */

"showIcon": true, /* Show cookie icon to manage cookies */
// "iconSrc": "", /* Optional: URL or base64 encoded image */
"iconPosition":
"BottomRight", /* Position of the icon between BottomRight, BottomLeft, TopRight and TopLeft */

"adblocker": false, /* Show a Warning if an adblocker is detected */

"DenyAllCta": true, /* Show the deny all button */
"AcceptAllCta":
true, /* Show the accept all button when highPrivacy on */
"highPrivacy": true, /* HIGHLY RECOMMANDED Disable auto consent */
"alwaysNeedConsent":
false, /* Ask the consent for "Privacy by design" services */

"handleBrowserDNTRequest":
false, /* If Do Not Track == 1, disallow all */

"removeCredit": false, /* Remove credit link */
"moreInfoLink": true, /* Show more info link */
"useExternalCss":
false, /* If false, the tarteaucitron.css file will be loaded */
"useExternalJs":
false, /* If false, the tarteaucitron.services.js file will be loaded */

// "cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for subdomain website */

"readmoreLink":
"", /* Change the default readmore link pointing to tarteaucitron.io */

"mandatory": true, /* Show a message about mandatory cookies */
"mandatoryCta":
true, /* Show the disabled accept button when mandatory on */

// "customCloserId": "", /* Optional a11y: Custom element ID used to open the panel */

"googleConsentMode":
true, /* Enable Google Consent Mode v2 for Google ads and GA4 */
"bingConsentMode":
true, /* Enable Bing Consent Mode for Clarity and Bing Ads */
"softConsentMode":
false, /* Soft consent mode (consent is required to load the services) */

"dataLayer":
false, /* Send an event to dataLayer with the services status */
"serverSide":
false, /* Server side only, tags are not loaded client side */

"partnersList":
false, /* Details the number of partners on the popup and middle banner */
});
</script>
```

# Add a service

[Installation guide](https://tarteaucitron.io/en/free-installation-open-source/)

# Customization

## Create custom service

```js
tarteaucitron.services.mycustomservice = {
"key": "mycustomservice",
"type": "ads|analytic|api|comment|other|social|support|video",
"name": "MyCustomService",
"needConsent": true,
"cookies": ["cookie", "cookie2"],
"readmoreLink": "/custom_read_more", // If you want to change readmore link
"js": function () {
"use strict";
// When user allow cookie
},
"fallback": function () {
"use strict";
// when use deny cookie
},
};
```

## Events

The following events are available:

- (document) `{SERVICE_KEY}_added` for each enabled service
- (document) `{SERVICE_KEY}_loaded` for each enabled service
- (document) `{SERVICE_KEY}_allowed` for each service when allowed
- (document) `{SERVICE_KEY}_disallowed` for each service when disallowed

- (window) `tac.root_available`: the root element with panel has been created,
services will be loaded
- (window) `tac.open_alert`
- (window) `tac.close_alert`
- (window) `tac.open_panel`
- (window) `tac.close_panel`

## Customize text

To change a translation, use `tarteaucitronCustomText` variable. It will be
merge with the translation shipping with TAC. This variable must be defined
before the initialization. For example:

```js
tarteaucitronCustomText = {
'support': {
'title': 'Support client',
},
'close': 'Enregistrer et fermer',
};
tarteaucitron.init(...);
```

There is a special case for engagement text. By the default, the engagement text
is _{SERVICE_NAME} is disabled._, however you can change it per service. For
example:

```js
tarteaucitronCustomText = {
"engage-twitter": "Follow us on Twitter!",
};
```

# Thanks to the sponsors 😊

| ![Amaury Cleuziou](https://avatars.githubusercontent.com/u/26336203?v=4&s=60) | ![Route4me](https://tarteaucitron.io/images/route4me-min.png) | |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------ | - |
| [Amaury Cleuziou](https://github.com/MoryCorp) - first sponsor 🎉 | [Route Optimizer and Route Planner Software](https://route4me.com) | |
| | | |
12 changes: 12 additions & 0 deletions packages/app/public/tarteaucitron/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 1.x | :white_check_mark: |

## Reporting a Vulnerability

Please report any security vulnerabilities to amauri@tarteaucitron.io I'll get
back to you within 24 hours and fix the issue asap.
2 changes: 2 additions & 0 deletions packages/app/public/tarteaucitron/advertising.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* min ready */
tarteaucitronNoAdBlocker = true;
1 change: 1 addition & 0 deletions packages/app/public/tarteaucitron/advertising.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tarteaucitronNoAdBlocker = true;
Loading