Wsparcie dla zaimków
This commit is contained in:
parent
d9cacab0a7
commit
2885cc09b6
|
@ -1,43 +1,40 @@
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
/* import { EmailTemplate3Config } from './email-template-3';
|
||||||
import hostSettingsRadio from './host-settings-radio';
|
* import hostSettingsRadio from './host-settings-radio';
|
||||||
|
*
|
||||||
export default function ConsentProblems({
|
* export default function ConsentProblems({
|
||||||
settings,
|
* settings,
|
||||||
host_id,
|
* host_id,
|
||||||
setConfig,
|
* setConfig,
|
||||||
pronoun,
|
* pronoun,
|
||||||
}: {
|
* }: {
|
||||||
host_id: string;
|
* host_id: string;
|
||||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
* setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||||
settings: EmailTemplate3Config['hosts_settings'][string];
|
* settings: EmailTemplate3Config['hosts_settings'][string];
|
||||||
pronoun: 0 | 1 | 2 | 3;
|
* pronoun: 0 | 1 | 2 | 3;
|
||||||
}) {
|
* }) {
|
||||||
if (settings.legal_basis_type !== 'consent') {
|
* if (settings.legal_basis_type !== 'consent') {
|
||||||
return '';
|
* return '';
|
||||||
}
|
* }
|
||||||
const p = pronoun;
|
* const p = pronoun;
|
||||||
return (
|
* return (
|
||||||
<div>
|
* <div>
|
||||||
{hostSettingsRadio({
|
* {hostSettingsRadio({
|
||||||
host_id,
|
* host_id,
|
||||||
setConfig,
|
* setConfig,
|
||||||
field: 'consent_problems' as const,
|
* field: 'consent_problems' as const,
|
||||||
value: settings.consent_problems,
|
* value: settings.consent_problems,
|
||||||
options: {
|
* options: {
|
||||||
claims_consent_but_sends_before_consent: /* HTML */ `Strona wysłała
|
* claims_consent_but_sends_before_consent: `Strona wysłała
|
||||||
${p == 3 ? 'nasze' : 'moje'} dane do ${host_id} zanim
|
* ${p == 3 ? 'nasze' : 'moje'} dane do ${host_id} zanim
|
||||||
${['wyraziłem', 'wyraziłam', 'wyraziłom', 'wyraziliśmy'][p]} na to zgodę.`,
|
* ${['wyraziłem', 'wyraziłam', 'wyraziłom', 'wyraziliśmy'][p]} na to zgodę.`,
|
||||||
claims_consent_but_there_was_no_easy_refuse: /* HTML */ `${[
|
* claims_consent_but_there_was_no_easy_refuse: `${
|
||||||
'Kliknąłem',
|
* ['Kliknąłem', 'Kliknęłam', 'Kliknęłom', 'Kliknęliśmy'][p]
|
||||||
'Kliknęłam',
|
* }
|
||||||
'Kliknęłom',
|
* przycisk od wyrażania zgody, ale w okienku o zgodę nie było natychmiastowo
|
||||||
'Kliknęliśmy',
|
* dostępnego przycisku do niewyrażenia zgody jednym kliknięciem.`,
|
||||||
][p]}
|
* none: 'Żadne z powyższych.',
|
||||||
przycisk od wyrażania zgody, ale w okienku o zgodę nie było natychmiastowo
|
* },
|
||||||
dostępnego przycisku do niewyrażenia zgody jednym kliknięciem.`,
|
* })}
|
||||||
none: 'Żadne z powyższych.',
|
* </div>
|
||||||
},
|
* );
|
||||||
})}
|
* } */
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
import { EmailTemplate3Config } from './email-template-3';
|
||||||
import hostSettingsDropdown from './host-setting-dropdown';
|
/* import hostSettingsDropdown from './host-setting-dropdown'; */
|
||||||
import ConsentProblems from './consent-problems';
|
/* import ConsentProblems from './consent-problems'; */
|
||||||
import LegitimateInteresProblems from './legitimate-interest-problems';
|
import LegitimateInteresProblems from './legitimate-interest-problems';
|
||||||
import { hostNeedsQuestions } from './host-needs-questions';
|
/* import { hostNeedsQuestions } from './host-needs-questions'; */
|
||||||
|
|
||||||
export function setHostSetting<
|
export function setHostSetting<
|
||||||
P1 extends keyof EmailTemplate3Config['hosts_settings'],
|
P1 extends keyof EmailTemplate3Config['hosts_settings'],
|
||||||
|
@ -48,12 +48,10 @@ export default function emailHostSettings(
|
||||||
<aside>
|
<aside>
|
||||||
{Object.entries(config.hosts_settings).map(([host_id, settings]) => (
|
{Object.entries(config.hosts_settings).map(([host_id, settings]) => (
|
||||||
<div key={host_id}>
|
<div key={host_id}>
|
||||||
<h5>
|
<h5>{/* {host_id}, {hostNeedsQuestions(settings).toString()} */}</h5>
|
||||||
{host_id}, {hostNeedsQuestions(settings).toString()}
|
|
||||||
</h5>
|
|
||||||
<p>
|
<p>
|
||||||
Cele przetwarzania danych przez właściciela domeny {host_id}{' '}
|
Cele przetwarzania danych przez właściciela domeny {host_id}{' '}
|
||||||
{hostSettingsDropdown({
|
{/* {hostSettingsDropdown({
|
||||||
host_id,
|
host_id,
|
||||||
setConfig,
|
setConfig,
|
||||||
settings,
|
settings,
|
||||||
|
@ -67,13 +65,13 @@ export default function emailHostSettings(
|
||||||
],
|
],
|
||||||
mentioned_in_popup: ['są opisane w okienku RODO'],
|
mentioned_in_popup: ['są opisane w okienku RODO'],
|
||||||
},
|
},
|
||||||
})}
|
})} */}
|
||||||
</p>
|
</p>
|
||||||
{!['not_mentioned', 'null'].includes(settings.presence) ? (
|
{!['not_mentioned', 'null'].includes(settings.presence) ? (
|
||||||
<p>
|
<p>
|
||||||
Wskazana przez administratora podstawa prawna dla{' '}
|
Wskazana przez administratora podstawa prawna dla{' '}
|
||||||
<strong> tego konkretnego celu</strong>{' '}
|
<strong> tego konkretnego celu</strong>{' '}
|
||||||
{hostSettingsDropdown({
|
{/* {hostSettingsDropdown({
|
||||||
host_id,
|
host_id,
|
||||||
setConfig,
|
setConfig,
|
||||||
settings,
|
settings,
|
||||||
|
@ -84,7 +82,7 @@ export default function emailHostSettings(
|
||||||
legitimate_interest: ['to uzasadniony interes.'],
|
legitimate_interest: ['to uzasadniony interes.'],
|
||||||
not_mentioned: ['nie jest wskazana nigdzie na stronie.'],
|
not_mentioned: ['nie jest wskazana nigdzie na stronie.'],
|
||||||
},
|
},
|
||||||
})}
|
})} */}
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
|
|
|
@ -3,74 +3,64 @@ import * as Survey from 'survey-react';
|
||||||
import { toBase64 } from '../util';
|
import { toBase64 } from '../util';
|
||||||
import emailHostSettings from './email-host-settings';
|
import emailHostSettings from './email-host-settings';
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
import { EmailTemplate3Config } from './email-template-3';
|
||||||
|
import verbs from './verbs';
|
||||||
|
|
||||||
var json = {
|
var json = {
|
||||||
showQuestionNumbers: 'off',
|
showQuestionNumbers: 'off',
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
title: 'Zaimki',
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
type: 'radiogroup',
|
type: 'dropdown',
|
||||||
name: 'haveKids',
|
name: 'zaimek',
|
||||||
title: 'Do you have a kid(s)?',
|
title: 'Forma czasownika:',
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
choices: ['Yes', 'No'],
|
choices: [
|
||||||
colCount: 0,
|
{ value: 0, text: 'Wysłałem' },
|
||||||
|
{ value: 1, text: 'Wysłałam' },
|
||||||
|
{ value: 2, text: 'Wysłałom' },
|
||||||
|
{ value: 3, text: 'Wysłaliśmy' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'dropdown',
|
title: 'Polityka prywatności',
|
||||||
name: 'kids',
|
elements: [
|
||||||
title: 'How many kids do you have',
|
|
||||||
visibleIf: "{haveKids}='Yes'",
|
|
||||||
isRequired: true,
|
|
||||||
choices: [1, 2, 3, 4, 5],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'dropdown',
|
type: 'dropdown',
|
||||||
name: 'kid1Age',
|
title: 'Czy polityka prywatności jest dostępna i czytelna?',
|
||||||
title: 'The first kid age:',
|
|
||||||
visibleIf: "{haveKids}='Yes' and {kids} >= 1",
|
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
choicesMax: 18,
|
choices: [
|
||||||
|
{ value: 'yes', text: 'dostępna i czytelna' },
|
||||||
|
{
|
||||||
|
value: 'entirely_obscured_by_popup',
|
||||||
|
text: 'dostępna, ale nieczytelna. Zasłania ją popup o RODO',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'dropdown',
|
value: 'cant_find',
|
||||||
name: 'kid2Age',
|
text: `Niedostępna. {Szukałem}, ale nie {znalazłem} jej na stronie`,
|
||||||
title: 'The second kid age:',
|
|
||||||
visibleIf: "{haveKids}='Yes' and {kids} >= 2",
|
|
||||||
isRequired: true,
|
|
||||||
startWithNewLine: false,
|
|
||||||
choicesMax: 18,
|
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
type: 'dropdown',
|
|
||||||
name: 'kid3Age',
|
|
||||||
title: 'The third kid age:',
|
|
||||||
visibleIf: "{haveKids}='Yes' and {kids} >= 3",
|
|
||||||
isRequired: true,
|
|
||||||
startWithNewLine: false,
|
|
||||||
choicesMax: 18,
|
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
type: 'dropdown',
|
|
||||||
name: 'kid4Age',
|
|
||||||
title: 'The fourth kid age:',
|
|
||||||
visibleIf: "{haveKids}='Yes' and {kids} >= 4",
|
|
||||||
isRequired: true,
|
|
||||||
startWithNewLine: false,
|
|
||||||
choicesMax: 18,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'dropdown',
|
|
||||||
name: 'kid5Age',
|
|
||||||
title: 'The fifth kid age:',
|
|
||||||
visibleIf: "{haveKids}='Yes' and {kids} >= 5",
|
|
||||||
isRequired: true,
|
|
||||||
startWithNewLine: false,
|
|
||||||
choicesMax: 18,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const survey = new Survey.Model(json);
|
const survey = new Survey.Model(json);
|
||||||
|
survey.onProcessTextValue.add(function (
|
||||||
|
sender: Survey.SurveyModel,
|
||||||
|
options: { name: string; value?: string }
|
||||||
|
) {
|
||||||
|
if (verbs[options.name.toLowerCase()]) {
|
||||||
|
options.value = verbs[options.name.toLowerCase()][sender.valuesHash.zaimek];
|
||||||
|
if (options.name[0] == options.name[0].toUpperCase()) {
|
||||||
|
options.value = [options.value[0].toUpperCase(), ...options.value.slice(1)].join('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default function EmailTemplate3Controls() {
|
export default function EmailTemplate3Controls() {
|
||||||
return <Survey.Survey model={survey} />;
|
return <Survey.Survey model={survey} />;
|
||||||
|
@ -83,57 +73,8 @@ export function _EmailTemplate3Controls({
|
||||||
config: EmailTemplate3Config;
|
config: EmailTemplate3Config;
|
||||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const p = config.pronoun;
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
|
||||||
<label htmlFor="pronoun">Forma czasownika:</label>
|
|
||||||
<select
|
|
||||||
id="pronoun"
|
|
||||||
value={config.pronoun}
|
|
||||||
onChange={(e) =>
|
|
||||||
setConfig((v) => ({
|
|
||||||
...v,
|
|
||||||
pronoun: parseInt(e.target.value) as EmailTemplate3Config['pronoun'],
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<option value="0">Wysłałem</option>
|
|
||||||
<option value="1">Wysłałam</option>
|
|
||||||
<option value="2">Wysłałom</option>
|
|
||||||
<option value="3">Wysłaliśmy</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label htmlFor="policy_readable">
|
|
||||||
Czy polityka prywatności jest dostępna i czytelna?
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="policy_readable"
|
|
||||||
value={config.policy_readable}
|
|
||||||
onChange={(e) =>
|
|
||||||
setConfig((v) => ({
|
|
||||||
...v,
|
|
||||||
policy_readable: e.target
|
|
||||||
.value as EmailTemplate3Config['policy_readable'],
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<option value="null" disabled>
|
|
||||||
wybierz opcję
|
|
||||||
</option>
|
|
||||||
<option value="yes">dostępna i czytelna</option>
|
|
||||||
<option value="entirely_obscured_by_popup">
|
|
||||||
dostępna, ale nieczytelna. Zasłania ją popup o RODO
|
|
||||||
</option>
|
|
||||||
<option value="cant_find">
|
|
||||||
Niedostępna. {['Szukałem', 'Szukałam', 'Szukałom', 'Szukaliśmy'][p]}, ale
|
|
||||||
nie {['znalazłem', 'znalazłam', 'znalazłom', 'znaleźliśmy'][p]} jej na
|
|
||||||
stronie
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
{emailHostSettings(config, setConfig)}
|
{emailHostSettings(config, setConfig)}
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="poup_type">Typ okienka o RODO: </label>
|
<label htmlFor="poup_type">Typ okienka o RODO: </label>
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
|
||||||
|
|
||||||
export function hostNeedsQuestions({
|
|
||||||
presence,
|
|
||||||
legal_basis_type,
|
|
||||||
consent_problems,
|
|
||||||
legitimate_interest_activity_description,
|
|
||||||
legitimate_interest_activity_specified,
|
|
||||||
}: EmailTemplate3Config['hosts_settings'][string]) {
|
|
||||||
if (presence == 'not_mentioned') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (legal_basis_type == 'not_mentioned') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (legal_basis_type == 'consent' && consent_problems !== 'null') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
legitimate_interest_activity_specified !== 'null' &&
|
|
||||||
legitimate_interest_activity_specified !== 'vague'
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
legal_basis_type == 'legitimate_interest' &&
|
|
||||||
legitimate_interest_activity_description != ''
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
import { setHostSetting } from './email-host-settings';
|
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
|
||||||
|
|
||||||
export default function hostSettingsDropdown<
|
|
||||||
Field extends keyof EmailTemplate3Config['hosts_settings'][string]
|
|
||||||
>({
|
|
||||||
host_id,
|
|
||||||
setConfig,
|
|
||||||
value,
|
|
||||||
field,
|
|
||||||
options,
|
|
||||||
}: {
|
|
||||||
host_id: string;
|
|
||||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
|
||||||
settings: EmailTemplate3Config['hosts_settings'][string];
|
|
||||||
field: Field;
|
|
||||||
value: string;
|
|
||||||
options: Record<
|
|
||||||
Exclude<EmailTemplate3Config['hosts_settings'][string][Field], 'null'>,
|
|
||||||
[string, boolean?]
|
|
||||||
>;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<select
|
|
||||||
value={value}
|
|
||||||
onChange={(e) =>
|
|
||||||
setHostSetting(
|
|
||||||
setConfig,
|
|
||||||
[host_id, field],
|
|
||||||
e.target.value as EmailTemplate3Config['hosts_settings'][string][typeof field]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<option value="null" disabled>
|
|
||||||
wybierz opcję
|
|
||||||
</option>
|
|
||||||
{Object.entries(options).map(
|
|
||||||
([value, [display, disabled]]: [string, [string, boolean]]) => (
|
|
||||||
<option value={value} disabled={disabled}>
|
|
||||||
{display}
|
|
||||||
</option>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
import { normalizeForClassname } from '../util';
|
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
|
||||||
|
|
||||||
export default function hostSettingsRadio<
|
|
||||||
Field extends keyof EmailTemplate3Config['hosts_settings'][string]
|
|
||||||
>({
|
|
||||||
options,
|
|
||||||
host_id,
|
|
||||||
field,
|
|
||||||
setConfig,
|
|
||||||
value,
|
|
||||||
}: {
|
|
||||||
host_id: string;
|
|
||||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
|
||||||
field: Field;
|
|
||||||
options: Record<Exclude<EmailTemplate3Config['hosts_settings'][string][Field], 'null'>, string>;
|
|
||||||
value: EmailTemplate3Config['hosts_settings'][string][Field];
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{Object.entries(options).map(([option_value, display]) => (
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name={normalizeForClassname(host_id + '_consent_problems')}
|
|
||||||
value={option_value}
|
|
||||||
checked={value == option_value}
|
|
||||||
id={normalizeForClassname(option_value + host_id)}
|
|
||||||
onChange={(e) => {
|
|
||||||
setConfig((v) => ({
|
|
||||||
...v,
|
|
||||||
hosts_settings: {
|
|
||||||
...v.hosts_settings,
|
|
||||||
[host_id]: {
|
|
||||||
...v.hosts_settings[host_id],
|
|
||||||
[field]: e.target.value,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<label htmlFor={normalizeForClassname(option_value + host_id)}>{display}</label>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { setHostSetting } from './email-host-settings';
|
import { setHostSetting } from './email-host-settings';
|
||||||
import { EmailTemplate3Config } from './email-template-3';
|
import { EmailTemplate3Config } from './email-template-3';
|
||||||
import hostSettingsDropdown from './host-setting-dropdown';
|
|
||||||
|
|
||||||
export default function LegitimateInteresProblems({
|
export default function LegitimateInteresProblems({
|
||||||
settings,
|
settings,
|
||||||
|
@ -22,7 +21,7 @@ export default function LegitimateInteresProblems({
|
||||||
<div>
|
<div>
|
||||||
Czy administrator strony opisał szczegółowo, na czym polega uzasadniony interes w
|
Czy administrator strony opisał szczegółowo, na czym polega uzasadniony interes w
|
||||||
kontekście tego celu?
|
kontekście tego celu?
|
||||||
{hostSettingsDropdown({
|
{/* {hostSettingsDropdown({
|
||||||
settings,
|
settings,
|
||||||
host_id,
|
host_id,
|
||||||
setConfig,
|
setConfig,
|
||||||
|
@ -35,7 +34,7 @@ export default function LegitimateInteresProblems({
|
||||||
vague: ['Wskazuje tylko ogólnie, jak np. „marketing” czy „statystyki”.'],
|
vague: ['Wskazuje tylko ogólnie, jak np. „marketing” czy „statystyki”.'],
|
||||||
no: ['Nie. Nie wiadomo, na czym ten uzasadniony interes polega.'],
|
no: ['Nie. Nie wiadomo, na czym ten uzasadniony interes polega.'],
|
||||||
},
|
},
|
||||||
})}
|
})} */}
|
||||||
</div>
|
</div>
|
||||||
{settings.legitimate_interest_activity_specified === 'vague' ? (
|
{settings.legitimate_interest_activity_specified === 'vague' ? (
|
||||||
<div>
|
<div>
|
||||||
|
|
5
report-window/verbs.ts
Normal file
5
report-window/verbs.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export default {
|
||||||
|
zrobiłem: ['zrobiłem', 'zrobiłam', 'zrobiłom', 'zrobiliśmy'],
|
||||||
|
szukałem: ['szukałem', 'szukałam', 'szukałom', 'szukaliśmy'],
|
||||||
|
znalazłem: ['znalazłem', 'znalazłam', 'znalazłom', 'znaleźliśmy'],
|
||||||
|
} as { [key: string]: string[] };
|
Loading…
Reference in New Issue
Block a user