2022-04-13 11:44:59 +02:00
|
|
|
|
import { RequestCluster } from '../../request-cluster';
|
2022-02-08 22:27:12 +01:00
|
|
|
|
import deduceProblems from './deduce-problems';
|
|
|
|
|
import { Explainers } from './explainers';
|
2022-02-07 21:11:25 +01:00
|
|
|
|
import { ParsedAnswers } from './parse-answers';
|
2022-02-08 22:27:12 +01:00
|
|
|
|
import { v } from './verbs';
|
2022-05-21 14:42:15 +02:00
|
|
|
|
import './email-content.scss';
|
2022-07-03 14:28:42 +02:00
|
|
|
|
import { Fragment, useState } from 'react';
|
2022-07-08 20:53:12 +02:00
|
|
|
|
import emailIntro from './email-intro';
|
|
|
|
|
import { reportIntro } from './report-intro';
|
2022-02-08 22:27:12 +01:00
|
|
|
|
|
2022-07-08 22:41:58 +02:00
|
|
|
|
const SS_URL = 'http://65.108.60.135:3000';
|
|
|
|
|
|
2022-02-08 22:27:12 +01:00
|
|
|
|
export default function EmailContent({
|
2022-04-24 22:11:33 +02:00
|
|
|
|
answers,
|
|
|
|
|
visited_url,
|
|
|
|
|
clusters,
|
2022-07-08 22:41:58 +02:00
|
|
|
|
scrRequestPath,
|
|
|
|
|
downloadFiles,
|
2022-07-08 23:13:57 +02:00
|
|
|
|
user_role,
|
2022-02-08 22:27:12 +01:00
|
|
|
|
}: {
|
2022-04-24 22:11:33 +02:00
|
|
|
|
answers: ParsedAnswers;
|
|
|
|
|
visited_url: string;
|
|
|
|
|
clusters: Record<string, RequestCluster>;
|
2022-07-08 22:41:58 +02:00
|
|
|
|
scrRequestPath: string;
|
|
|
|
|
downloadFiles: Function;
|
2022-07-08 23:13:57 +02:00
|
|
|
|
user_role: string;
|
2022-02-08 22:27:12 +01:00
|
|
|
|
}) {
|
2022-04-24 22:11:33 +02:00
|
|
|
|
const _ = (key: string) => v(key, answers.zaimek);
|
|
|
|
|
const problems = deduceProblems(answers, clusters);
|
|
|
|
|
const explainers = Array.from(
|
|
|
|
|
new Set(
|
|
|
|
|
problems
|
|
|
|
|
.map((problem) => problem.getNecessaryExplainers())
|
|
|
|
|
.reduce((a, b) => a.concat(b), [])
|
|
|
|
|
)
|
|
|
|
|
).map((explainer_key) => Explainers[explainer_key]);
|
2022-07-03 14:28:42 +02:00
|
|
|
|
const [copied, setCopy] = useState<boolean>(false);
|
|
|
|
|
|
|
|
|
|
function copyTextToClipboard() {
|
|
|
|
|
// Should be changed in the future to Clipboard API (https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write#browser_compatibility)
|
|
|
|
|
let r = document.createRange();
|
2022-07-09 15:28:37 +02:00
|
|
|
|
const container = document.querySelector('.mail-container__content');
|
|
|
|
|
if (!container) return;
|
|
|
|
|
r.selectNode(container);
|
|
|
|
|
window.getSelection()?.addRange(r);
|
2022-07-03 14:28:42 +02:00
|
|
|
|
document.execCommand('copy');
|
2022-07-09 15:28:37 +02:00
|
|
|
|
window.getSelection()?.removeAllRanges();
|
2022-07-03 14:28:42 +02:00
|
|
|
|
setCopy(true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-08 20:53:12 +02:00
|
|
|
|
const mode = answers.user_role === 'user' ? 'email' : 'report';
|
|
|
|
|
const email_tone = answers.email_type === 'polite_information' ? 'polite' : 'official';
|
|
|
|
|
|
2022-04-24 22:11:33 +02:00
|
|
|
|
return (
|
2022-05-22 16:49:24 +02:00
|
|
|
|
<Fragment>
|
2022-05-22 18:22:29 +02:00
|
|
|
|
<div className="generator-container">
|
2022-07-08 20:53:12 +02:00
|
|
|
|
<h1>Treść {mode === 'email' ? 'maila' : 'raportu'}</h1>
|
2022-05-22 18:22:29 +02:00
|
|
|
|
<div className="mail-container">
|
|
|
|
|
<div className="mail-container__header">
|
2022-07-03 14:28:42 +02:00
|
|
|
|
<div className="mail-container__header--control"></div>
|
2022-05-22 16:49:24 +02:00
|
|
|
|
</div>
|
2022-05-22 18:22:29 +02:00
|
|
|
|
<article className="mail-container__content">
|
2022-07-08 20:53:12 +02:00
|
|
|
|
{mode === 'email'
|
|
|
|
|
? emailIntro(email_tone, _, visited_url)
|
|
|
|
|
: reportIntro(visited_url)}
|
2022-07-09 20:14:10 +02:00
|
|
|
|
{problems.map((problem, index) => {
|
|
|
|
|
const Component = problem.getEmailContent.bind(problem);
|
|
|
|
|
return <Component mode={mode} tone={email_tone} key={index} />;
|
|
|
|
|
})}
|
2022-05-22 18:22:29 +02:00
|
|
|
|
{explainers.map((explainer) => explainer(answers.zaimek))}
|
|
|
|
|
<h2>Państwa rola jako współadministratora danych osobowych</h2>
|
2022-07-08 20:53:12 +02:00
|
|
|
|
{mode == 'email' ? (
|
|
|
|
|
<p>
|
|
|
|
|
{_('Zwracam')} Państwa uwagę na fakt, że w myśl{' '}
|
|
|
|
|
<a href="https://curia.europa.eu/juris/document/document.jsf?text=&docid=216555&pageIndex=0&doclang=PL&mode=lst&dir=&occ=first&part=1&cid=1254905">
|
|
|
|
|
treści wyroku TSUE w sprawie C-40/17
|
|
|
|
|
</a>{' '}
|
|
|
|
|
poprzez wysyłanie moich danych w wyżej opisanym zakresie stają się
|
|
|
|
|
Państwo współadministratorem {_('moich')} danych osobowych, nawet
|
|
|
|
|
jeżeli nie są Państwo bezpośrednimi autorami osadzonych na Państwa
|
|
|
|
|
stronie skryptów czy innych zasobów ujawniających dane użytkowników
|
|
|
|
|
Państwa strony podmiotom trzecim. Dlatego ciąży na Państwu obowiązek
|
|
|
|
|
odpowiedzi na {_('moje')} pytania na mocy Art. 12 i 13
|
|
|
|
|
Rozporządzenia 2016/679 Parlamentu Europejskiego i Rady (UE) z dnia
|
|
|
|
|
27 kwietnia 2016 r. w sprawie ochrony osób fizycznych w związku z
|
|
|
|
|
przetwarzaniem danych osobowych i w sprawie swobodnego przepływu
|
|
|
|
|
takich danych oraz uchylenia dyrektywy 95/46/WE (ogólne
|
|
|
|
|
rozporządzenie o ochronie danych) – RODO
|
|
|
|
|
</p>
|
|
|
|
|
) : (
|
|
|
|
|
<p>
|
|
|
|
|
W myśl{' '}
|
|
|
|
|
<a href="https://curia.europa.eu/juris/document/document.jsf?text=&docid=216555&pageIndex=0&doclang=PL&mode=lst&dir=&occ=first&part=1&cid=1254905">
|
|
|
|
|
treści wyroku TSUE w sprawie C-40/17
|
|
|
|
|
</a>
|
|
|
|
|
, ponoszą Państwo współodpowiedzialność za skrypty i inne zasoby
|
|
|
|
|
ujawniajace dane osobowe na Państwa stronie, nawet jeżeli nie są
|
|
|
|
|
Państwo ich bezpośrednimi autorami.
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
2022-05-22 18:22:29 +02:00
|
|
|
|
</article>
|
|
|
|
|
</div>
|
2022-07-08 22:41:58 +02:00
|
|
|
|
<div
|
|
|
|
|
className={
|
|
|
|
|
scrRequestPath
|
|
|
|
|
? 'buttons-email-container'
|
|
|
|
|
: 'buttons-email-container buttons-email-container--single'
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{scrRequestPath ? (
|
|
|
|
|
<button
|
|
|
|
|
className="sv_prev_btn"
|
|
|
|
|
onClick={() => downloadFiles(`${SS_URL}${scrRequestPath}`)}
|
|
|
|
|
>
|
|
|
|
|
Pobierz zrzuty ekranów
|
|
|
|
|
</button>
|
|
|
|
|
) : null}
|
|
|
|
|
<button
|
|
|
|
|
className={
|
|
|
|
|
scrRequestPath ? 'sv_next_btn' : 'sv_next_btn sv_next_btn--single'
|
|
|
|
|
}
|
|
|
|
|
onClick={() => copyTextToClipboard()}
|
|
|
|
|
>
|
|
|
|
|
{copied ? 'Skopiowano!' : 'Kopiuj treść'}
|
2022-07-03 14:28:42 +02:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2022-07-08 23:13:57 +02:00
|
|
|
|
{copied && user_role === 'user' ? (
|
2022-07-03 19:35:36 +02:00
|
|
|
|
<section className="greeting-text">
|
|
|
|
|
<strong>Przed Tobą ostatni krok! 😊</strong>
|
|
|
|
|
<p>
|
|
|
|
|
<a href="mailto:?subject=Zapytanie o przetwarzanie moich danych osobowych przez Państwa stronę">
|
|
|
|
|
Przejdź do swojego klienta pocztowego
|
|
|
|
|
</a>
|
|
|
|
|
, załącz zrzuty ekranów, wklej treść wiadomości i wyślij ją do
|
|
|
|
|
administratorów witryny {visited_url.split('/').slice(0, 3).join('/')}.
|
|
|
|
|
</p>
|
|
|
|
|
</section>
|
|
|
|
|
) : null}
|
2022-05-22 16:49:24 +02:00
|
|
|
|
</div>
|
|
|
|
|
</Fragment>
|
2022-04-24 22:11:33 +02:00
|
|
|
|
);
|
2022-02-07 21:11:25 +01:00
|
|
|
|
}
|