diff --git a/package-lock.json b/package-lock.json index 747dd6f..dab0533 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,8 @@ "events": "^3.3.0", "react": "^17.0.2", "react-dom": "^17.0.2", + "survey-core": "^1.9.8", + "survey-react": "^1.9.8", "tai-password-strength": "^1.1.3" }, "devDependencies": { @@ -6421,6 +6423,20 @@ "node": ">=8" } }, + "node_modules/survey-core": { + "version": "1.9.8", + "resolved": "https://registry.npmjs.org/survey-core/-/survey-core-1.9.8.tgz", + "integrity": "sha512-NniKOrmlKM7nGDuM0xvwDSDK5MiVdZr7IHySqWuPWJ1YcFAPy4FqXq920wkAwfqEuKFBh16IUwzat73/nfmuRg==" + }, + "node_modules/survey-react": { + "version": "1.9.8", + "resolved": "https://registry.npmjs.org/survey-react/-/survey-react-1.9.8.tgz", + "integrity": "sha512-Mcq5mRDLXORjZOHaybeYyuy/wlf3P4Z97GXdLk94NObVpo4u5iovCdmLAaqD7xsO5L89T+CkHBT7MhPV50NfpA==", + "peerDependencies": { + "react": "^16.5.0 || ^17.0.1", + "react-dom": "^16.5.0 || ^17.0.1" + } + }, "node_modules/tai-password-strength": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tai-password-strength/-/tai-password-strength-1.1.3.tgz", @@ -12470,6 +12486,17 @@ "has-flag": "^4.0.0" } }, + "survey-core": { + "version": "1.9.8", + "resolved": "https://registry.npmjs.org/survey-core/-/survey-core-1.9.8.tgz", + "integrity": "sha512-NniKOrmlKM7nGDuM0xvwDSDK5MiVdZr7IHySqWuPWJ1YcFAPy4FqXq920wkAwfqEuKFBh16IUwzat73/nfmuRg==" + }, + "survey-react": { + "version": "1.9.8", + "resolved": "https://registry.npmjs.org/survey-react/-/survey-react-1.9.8.tgz", + "integrity": "sha512-Mcq5mRDLXORjZOHaybeYyuy/wlf3P4Z97GXdLk94NObVpo4u5iovCdmLAaqD7xsO5L89T+CkHBT7MhPV50NfpA==", + "requires": {} + }, "tai-password-strength": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tai-password-strength/-/tai-password-strength-1.1.3.tgz", diff --git a/package.json b/package.json index 0d8371a..6a96938 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "events": "^3.3.0", "react": "^17.0.2", "react-dom": "^17.0.2", + "survey-core": "^1.9.8", + "survey-react": "^1.9.8", "tai-password-strength": "^1.1.3" }, "keywords": [ diff --git a/report-window/data-preview.tsx b/report-window/data-preview.tsx new file mode 100644 index 0000000..3d84bfe --- /dev/null +++ b/report-window/data-preview.tsx @@ -0,0 +1,69 @@ +import { Classifications, StolenDataEntry } from '../stolen-data-entry'; + +export function DataPreview({ + entries, + refresh, +}: { + entries: StolenDataEntry[]; + refresh: () => void; +}) { + // currently not used, maybe scraped entirely in the future + return ( + + + + + + + + + + + {entries.map((entry) => ( + + + + + + + ))} + +
Adres docelowyŹródło danychTreść danychKlasyfikacja
{entry.request.shorthost} + {entry.source}:{entry.name} + + {entry.getValuePreview()} + {/* always gonna have + one key, because unwrapEntry is called above */} + + +
+ ); +} diff --git a/report-window/email-template-3-controls.tsx b/report-window/email-template-3-controls.tsx index 9008186..7169bf0 100644 --- a/report-window/email-template-3-controls.tsx +++ b/report-window/email-template-3-controls.tsx @@ -1,10 +1,82 @@ import React from 'react'; +import * as Survey from 'survey-react'; import { toBase64 } from '../util'; -import ConsentProblems from './consent-problems'; import emailHostSettings from './email-host-settings'; import { EmailTemplate3Config } from './email-template-3'; -export default function EmailTemplate3Controls({ +var json = { + showQuestionNumbers: 'off', + elements: [ + { + type: 'radiogroup', + name: 'haveKids', + title: 'Do you have a kid(s)?', + isRequired: true, + choices: ['Yes', 'No'], + colCount: 0, + }, + { + type: 'dropdown', + name: 'kids', + title: 'How many kids do you have', + visibleIf: "{haveKids}='Yes'", + isRequired: true, + choices: [1, 2, 3, 4, 5], + }, + { + type: 'dropdown', + name: 'kid1Age', + title: 'The first kid age:', + visibleIf: "{haveKids}='Yes' and {kids} >= 1", + isRequired: true, + choicesMax: 18, + }, + { + type: 'dropdown', + name: 'kid2Age', + 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); + +export default function EmailTemplate3Controls() { + return ; +} + +export function _EmailTemplate3Controls({ config, setConfig, }: { diff --git a/report-window/report-window.html b/report-window/report-window.html index b98e43b..e3debcd 100644 --- a/report-window/report-window.html +++ b/report-window/report-window.html @@ -1,20 +1,17 @@ + + + Treść maila do zgłoszenia + + + + - - - Treść maila do zgłoszenia - - - - -
- - - - - - \ No newline at end of file + +
+ + + + + diff --git a/report-window/report-window.tsx b/report-window/report-window.tsx index 89fc5bb..a12124d 100644 --- a/report-window/report-window.tsx +++ b/report-window/report-window.tsx @@ -1,75 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { getMemory } from '../memory'; -import { Classifications, StolenDataEntry } from '../stolen-data-entry'; +import { StolenDataEntry } from '../stolen-data-entry'; import { reduceConcat, useEmitter } from '../util'; import EmailTemplate from './email-template'; -import HARConverter from './har-converter'; import './report-window.scss'; -function DataPreview({ entries, refresh }: { entries: StolenDataEntry[]; refresh: () => void }) { - // currently not used, maybe scraped entirely in the future - return ( - - - - - - - - - - - {entries.map((entry) => ( - - - - - - - ))} - -
Adres docelowyŹródło danychTreść danychKlasyfikacja
{entry.request.shorthost} - {entry.source}:{entry.name} - - {entry.getValuePreview()} - {/* always gonna have - one key, because unwrapEntry is called above */} - - -
- ); -} - function Report() { try { const origin = new URL(document.location.toString()).searchParams.get('origin'); diff --git a/tsconfig.json b/tsconfig.json index ec25951..50d873e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "jsx": "react-jsx", "noImplicitAny": true, "esModuleInterop": true, + "moduleResolution": "node", "lib": ["es2017", "dom", "es2019"], "typeRoots": ["node_modules/@types", "node_modules/web-ext-types"], "target": "es2019",