Initial commit

This commit is contained in:
Sipachev Igor 2021-03-03 18:22:44 +07:00
commit d081c6ba6a
72 changed files with 14116 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.idea/
/popup/node_modules/

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
build-popup:
bash bash/popup.sh

0
README.md Normal file
View File

View File

@ -0,0 +1,5 @@
{
"MSG_BROWSER_ACTION_TITLE": {
"message": "2509634311667449183"
}
}

0
assets/js/background.js Normal file
View File

29
assets/js/script.js Normal file
View File

@ -0,0 +1,29 @@
function insertValueToNode(target, value) {
let nodeList = []
switch (target) {
case 'personal_id':
nodeList = document.querySelectorAll('*[name*="personal_id"]')
break
case 'iban':
nodeList = document.querySelectorAll('*[name*="bankaccount"]')
break
case 'phone':
nodeList = document.querySelectorAll('*[name*="phone"]')
break
case 'first_name':
nodeList = document.querySelectorAll('*[name*="first_name"]')
break
case 'last_name':
nodeList = document.querySelectorAll('*[name*="last_name"]')
break
}
for (const node of nodeList) {
node.value = value
}
}
chrome.runtime.onMessage.addListener(
function(autocompleteDTO, sender, sendResponse) {
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
}
);

7
bash/popup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# todo реализовать сборку popup.
cd popup && yarn build
cd ..
sed -i 's|href="/|href="/popup/dist/|g' ./popup/dist/index.html
sed -i 's|src="/|src="/popup/dist/|g' ./popup/dist/index.html

BIN
icons/144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
icons/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

BIN
icons/180.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
icons/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

50
manifest.json Normal file
View File

@ -0,0 +1,50 @@
{
"name": "SVEAK",
"background": {
"scripts": [ "assets/js/background.js" ]
},
"browser_action": {
"default_icon": {
"16": "icons/16.png",
"32": "icons/32.png"
},
"default_popup": "popup/dist/index.html",
"default_title": "SVEAK"
},
"content_scripts": [ {
"all_frames": true,
"js": [ "assets/js/script.js" ],
"matches": [ "\u003Call_urls>" ]
} ],
"default_locale": "ru",
"description": "Plug-in for SVEAK",
"icons": {
"16": "icons/16.png",
"32": "icons/32.png",
"144": "icons/144.png",
"180": "icons/180.png"
},
"manifest_version": 2,
"permissions": [ "tabs", "contextMenus", "\u003Call_urls>" ],
"short_name": "SVEAK helper",
"version": "1.0.0",
"commands": {
"_execute_browser_action": {
"suggested_key": {
"chromeos": "Alt+A",
"linux": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
},
"_execute_page_action": {
"suggested_key": {
"default": "Alt+A",
"mac": "Alt+A",
"windows": "Alt+A"
}
}
},
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApt0rB/UETdl+DvFC54JXH1uPu9C8kGll8EJi8Cfi7BC8CozN/CGnj/wy3EYP7iwO+qbIqK98dlUX/9aEEmsrJEPHhPKPFaN9KmBrVk852eGdYWK9zXQDzFzza3KxvmaAZhlaarEMBow+TPWdvqBGtf+/vYhoDaWBwIE7aawJZK4B8ulVxCLm67/NAPAC2VQ/aJph2egceD4Mfu6n0mCwzIevAa/FuoplAAQ5OC8AztxV3Xv6px2NL3kq+1O988t5SURsGij4oc15QHE5OUF67thrSP/22PWgMTzi+rkNAZO6Ps66zAWFA9MM+rKjT36B4tJnE5yLMGzCdsxP7WydeQIDAQAB",
"update_url": "https://clients2.google.com/service/update2/crx"
}

3
popup/.browserslistrc Normal file
View File

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

5
popup/.editorconfig Normal file
View File

@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

29
popup/.eslintrc.js Normal file
View File

@ -0,0 +1,29 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard',
'@vue/typescript/recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
]
}

26
popup/.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist
/tests/e2e/videos/
/tests/e2e/screenshots/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

34
popup/README.md Normal file
View File

@ -0,0 +1,34 @@
# sveak-helper
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Run your unit tests
```
yarn test:unit
```
### Run your end-to-end tests
```
yarn test:e2e
```
### Lints and fixes files
```
yarn lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
popup/babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

3
popup/cypress.json Normal file
View File

@ -0,0 +1,3 @@
{
"pluginsFile": "tests/e2e/plugins/index.js"
}

3
popup/jest.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
}

47
popup/package.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "sveak-helper",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@types/clipboard": "^2.0.1",
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
"register-service-worker": "^1.7.1",
"sass": "^1.32.7",
"sass-loader": "10.1.1",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-clipboard2": "^0.3.1",
"vue-property-decorator": "^9.1.2"
},
"devDependencies": {
"@types/jest": "^24.0.19",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-pwa": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^1.0.3",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"typescript": "~3.9.3",
"vue-template-compiler": "^2.6.11"
}
}

BIN
popup/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.00251 14.9297L0 1.07422H6.14651L8.00251 4.27503L9.84583 1.07422H16L8.00251 14.9297Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 215 B

17
popup/public/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

2
popup/public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

30
popup/src/App.vue Normal file
View File

@ -0,0 +1,30 @@
<template>
<div id="app">
<Main msg="Welcome to Your Vue.js + TypeScript App"/>
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import Main from './components/main.vue'
@Component({
components: {
Main
}
})
export default class App extends Vue {}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
body {
margin: 0px;
}
</style>

BIN
popup/src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,7 @@
import { Country } from '@/classes/Enum/Country'
import { Gender } from '@/classes/Enum/Gender'
export class Person {
country: Country = Country.ESTONIA
gender: Gender = Gender.RANDOM
}

View File

@ -0,0 +1,5 @@
export enum Country {
ESTONIA = 'ee',
LITHUANIA = 'lt',
POLAND = 'pl',
}

View File

@ -0,0 +1,5 @@
export enum Gender {
MALE = 'male',
FEMALE = 'female',
RANDOM = 'random'
}

View File

@ -0,0 +1,8 @@
export enum Target {
PERSONAL_ID= 'personal_id',
IBAN = 'iban',
PHONE = 'phone',
FIRST_NAME = 'first_name',
LAST_NAME = 'last_name',
PASSWORD = 'password',
}

View File

@ -0,0 +1,11 @@
export class Sender {
send (message: Record<string, any>) {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs: any) {
chrome.tabs.sendMessage(tabs[0].id, message, function (response: any) {
console.log(response)
})
})
}
}
export default new Sender()

View File

@ -0,0 +1,55 @@
import randomGenerator from "@/classes/Service/Generators/RandomGenerator"
export class DocumentNumberGenerator {
letters: Array<string> = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
letterValues: Record<string, number> = {
A: 10,
B: 11,
C: 12,
D: 13,
E: 14,
F: 15,
G: 16,
H: 17,
I: 18,
J: 19,
K: 20,
L: 21,
M: 22,
N: 23,
O: 24,
P: 25,
Q: 26,
R: 27,
S: 28,
T: 29,
U: 30,
V: 31,
W: 32,
X: 33,
Y: 34,
Z: 35
}
generate () {
var e = this.getLetterPart()
, t = this.getDigitPart();
return e + this.getControlSum(e, t) + t
}
getLetterPart () {
for (var e = "", t = 0; t < 3; t++)
e += this.letters[Math.floor(Math.random() * this.letters.length)];
return e
}
getDigitPart () {
return randomGenerator.generate(1, 99999).toString().padStart(5, "0")
}
getControlSum (e: Record<number, any>, t: Record<number, any>) {
return String((7 * this.letterValues[e[0]] + 3 * this.letterValues[e[1]] + this.letterValues[e[2]] + 7 * +t[0] + 3 * +t[1] + +t[2] + 7 * +t[3] + 3 * +t[4]) % 10)
}
}
export default new DocumentNumberGenerator()

View File

@ -0,0 +1,862 @@
import { Country } from '@/classes/Enum/Country'
import { Gender } from '@/classes/Enum/Gender'
export class FirstNameGenerator {
plMaleFirstNames = [
'Adamek',
'Ada\u015b',
'Aleksander',
'Alfons',
'Alojzy',
'Ambro\u017cy',
'Andrzej',
'Antoni',
'Arkadiusz',
'Artur',
'Baltazar',
'Barnaba',
'Bartek',
'Bart\u0142omiej',
'Bartosz',
'Bernard',
'Biernat',
'Bogumi\u0142',
'Bogurad',
'Bogus\u0142aw',
'Bogu\u015b',
'Bolek',
'Boles\u0142aw',
'Bonawentura',
'Bonifacy',
'Borys',
'Bronis\u0142aw',
'Cezary',
'Cyryl',
'Czes\u0142aw',
'Damian',
'Daniel',
'Dariusz',
'Dawid',
'Domarad',
'Domaradz',
'Dominik',
'Dzier\u017cykraj',
'Edward',
'Emil',
'Eryk',
'Ezdrasz',
'Fabian',
'Filip',
'Franciszek',
'Gabriel',
'Gniewosz',
'Goc\u0142aw',
'Gracjan',
'Grzegorz',
'Grzesiek',
'Grze\u015b',
'Gustaw',
'Habakuk',
'Henryk',
'Hubert',
'Igor',
'Igorek',
'Ildefons',
'Ireneusz',
'Iwan',
'Izajasz',
'Jacek',
'Jakub',
'Jan',
'Janusz',
'Jaros\u0142aw',
'Jaru\u015b',
'Jasiek',
'Jerzy',
'Jonatan',
'J\xf3zef',
'Judasz',
'Juliusz',
'Jurek',
'Juru\u015b',
'Justyn',
'Kacper',
'Kamil',
'Karol',
'Kazimierz',
'Klaudiusz',
'Kochan',
'Konrad',
'Krystian',
'Krzysztof',
'Krzy\u015b',
'Ksawery',
'Lasota',
'Lech',
'Les\u0142aw',
'Leszek',
'Lew',
'Lucek',
'Lucjan',
'Lucjusz',
'Ludwik',
'\u0141ukasz',
'Maciej',
'Marcel',
'Marcin',
'Marek',
'Marian',
'Mariusz',
'Mateusz',
'Maurycy',
'Micha\u0142',
'Micha\u0142ek',
'Micha\u015b',
'Mieczys\u0142aw',
'Mieszko',
'Mietek',
'Miko\u0142aj',
'Mi\u0142osz',
'Miros\u0142aw',
'Nawoj',
'Niemir',
'Nierod',
'Norbert',
'Olaf',
'Oleg',
'Olek',
'Olgierd',
'Oliwer',
'Oliwier',
'Oskar',
'Pawe\u0142',
'Pawe\u0142ek',
'Piotr',
'Piotrek',
'Piotru\u015b',
'Poniat',
'Przemys\u0142aw',
'Racibor',
'Rac\u0142aw',
'Radek',
'Rados\u0142aw',
'Radzim',
'Radzis\u0142aw',
'Rafa\u0142',
'Rec\u0142aw',
'Remigiusz',
'Robert',
'Roman',
'Romek',
'Ryszard',
'Ry\u015b',
'Sambor',
'Sebastian',
'Sergiusz',
'Seweryn',
'S\u0142awomir',
'Stanis\u0142aw',
'Sta\u015b',
'Stefan',
'Sulejman',
'Sulich',
'Sylwester',
'Szczepan',
'Szcz\u0119sny',
'Szymek',
'Szymon',
'Szymu\u015b',
'Tadeusz',
'Tomasz',
'Tytus',
'Ulryk',
'Wac\u0142aw',
'Waldek',
'Waldemar',
'Waleriusz',
'Wawrzyniec',
'Wies\u0142aw',
'Wiktor',
'Wincenty',
'Wit',
'Witek',
'Witold',
'Witos\u0142aw',
'W\u0142adys\u0142aw',
'W\u0142odek',
'W\u0142odzimierz',
'Wojciech',
'Wojcik',
'Wojs\u0142aw',
'Wojtas',
'Wojtasz',
'Wojtek',
'Wojtu\u015b',
'Wszerad',
'Zachariasz',
'Zbigniew',
'Zbylut',
'Zbyszek',
'Zdzis\u0142aw',
'Zygmunt',
'Zygu\u015b',
'\u017begota'
]
plFemaleFirstNames = [
'Agata',
'Agnieszka',
'Agusia',
'Aleksandra',
'Alicja',
'Amanda',
'Anastazja',
'Aneta',
'Ania',
'Anka',
'Anna',
'Apolonia',
'Asia',
'Barbara',
'Basia',
'Beata',
'Benedykta',
'Bernadeta',
'Bogdana',
'Bogumi\u0142a',
'Boles\u0142awa',
'Bo\u017cena',
'Bo\u017cenka',
'Bronis\u0142awa',
'Brygida',
'Cecylia',
'Celestyna',
'Czes\u0142awa',
'Dagmara',
'Danuta',
'Dobros\u0142awa',
'Dominika',
'Dorota',
'Dorotka',
'Edwarda',
'Edyta',
'Ela',
'Eleonora',
'El\u017cbieta',
'Emilia',
'Emilka',
'Ewa',
'Ewelina',
'Ewka',
'Ewunia',
'Franciszka',
'Gabriela',
'Genowefa',
'Gosia',
'Gra\u017cyna',
'Halina',
'Hania',
'Hanna',
'Helena',
'Henryka',
'Hildegarda',
'Honorata',
'Iga',
'Irena',
'Iwana',
'Iwona',
'Iwonka',
'Izabela',
'Jadwiga',
'Jadzia',
'Jagoda',
'Janina',
'Joanna',
'Joasia',
'Jolanta',
'Judyta',
'Julia',
'Justyna',
'Kamila',
'Karolina',
'Kasia',
'Katarzyna',
'Kazimiera',
'Klara',
'Klaudia',
'Klotylda',
'Krysia',
'Krystyna',
'Kunegunda',
'Lena',
'\u0141ucja',
'Magda',
'Magdalena',
'Malina',
'Ma\u0142gorzata',
'Maria',
'Marianna',
'Mariola',
'Mariolka',
'Marta',
'Martyna',
'Marycha',
'Maryla',
'Marylka',
'Marysia',
'Marzena',
'Matylda',
'Melania',
'Michalina',
'Monika',
'Nadia',
'Natalia',
'Oliwia',
'Patrycja',
'Paulina',
'Renata',
'R\xf3\u017ca',
'Stanis\u0142awa',
'Stefania',
'Sylwia',
'Szarlota',
'Teresa',
'Urszula',
'Wanda',
'Weronika',
'Wies\u0142awa',
'Wiktoria',
'Wioleta',
'Zofia',
'Zuzanna',
'\u017baneta'
]
ltMaleFirstNames = [
'Adolfas',
'Aivaras',
'Albinas',
'Aleksandras',
'Alfonsas',
'Alfredas',
'Algimantas',
'Algirdas ',
'Algis',
'Alvydas',
'Andrius',
'Antanas',
'Antons',
'Arnoldas',
'Arturas',
'Arunas',
'Arvydas',
'Audrius',
'Aurelijus',
'Aurimas',
'Balys',
'Benas',
'Benjaminas',
'Bernardas',
'Bronislovas',
'Bronius',
'Ceslovas',
'Dainius',
'Danas',
'Darius',
'Daumantas',
'Deimantas',
'Deividas',
'Domantas',
'Donatas',
'Edgaras',
'Edmundas',
'Eduardas',
'Edvardas',
'Edvinas',
'Egidijus',
'Eimantas',
'Ernestas',
'Eugenijus',
'Evaldas',
'Feliksas',
'Gediminas',
'Giedrius',
'Gintaras',
'Gintautas',
'Henrikas',
'Ignas',
'Isakas',
'Jeronimas',
'Jokubas',
'Jonas',
'Juozapas',
'Juozas',
'Jurgis',
'Justas',
'Justinas',
'Karolis',
'Kazimieras',
'Kazys',
'Kestutis',
'Laurynas',
'Leonardas',
'Leonas',
'Linas',
'Lionginas',
'Liudvikas',
'Lukas',
'Mantas',
'Marijonas',
'Marius ',
'Markas',
'Martynas',
'Mikalojus',
'Mindaugas ',
'Modestas',
'Mykolas',
'Nerijus',
'Osvaldas',
'Ovidijus',
'Paulius',
'Petras',
'Povilas',
'Pranas',
'Raimundas',
'Ramunas',
'Remigijus',
'Ricardas',
'Rimantas',
'Rimas',
'Rimvydas',
'Robertas',
'Rolandas',
'Romanas',
'Romualdas',
'Rytis',
'Sarunas',
'Saulius',
'Sigitas',
'Silvestras',
'Simas',
'Simonas',
'Stasys',
'Steponas',
'Svajunas',
'Tadas ',
'Tauras',
'Tautvilas',
'Teodoras',
'Tomas',
'Urbonas',
'Vaidas',
'Vaidotas ',
'Valdas',
'Valdemaras',
'Vidmantas',
'Viktoras',
'Vincas',
'Virgilijus',
'Virginijus',
'Vladas',
'Vygantas',
'Vytautas',
'Vytenis ',
'Zenonas',
'Zigmas',
'Zydrunas',
'Zygimantas'
]
ltFemaleFirstNames = ['Agne',
'Akvile',
'Aldona',
'Aukse',
'Ausra',
'Ausrine',
'Austeja',
'Austra',
'Biruta',
'Brigita',
'Daina',
'Dalia',
'Danguole',
'Danute',
'Deimante',
'Diana',
'Edita',
'Egle',
'Elena',
'Eugenija',
'Gabija',
'Gabriele',
'Genovaite',
'Gintare',
'Grazina',
'Ieva',
'Indre',
'Inga',
'Ingrida',
'Irena',
'Irene',
'Irina',
'Jolanta',
'Jurate',
'Jurga',
'Justina',
'Kristina',
'Laima',
'Laura',
'Lilija',
'Lina',
'Loreta',
'Magdalena',
'Marija',
'Milda',
'Monika',
'Nijole',
'Olga',
'Ona',
'Paulina',
'Raminta',
'Ramune',
'Rasa',
'Ruta',
'Salomeja',
'Sigita',
'Silvija',
'Sofija',
'Sonata',
'Ugne',
'Urte',
'Vaida',
'Vaiva',
'Vanda',
'Veronica',
'Viktorija',
'Vilija',
'Vilma',
'Violeta',
'Virginija',
'Vitalija',
'Zita',
'Zivile'
]
eeMaleFirstNames = ['Aadu',
'Aarne',
'Ado',
'Ago',
'Ain',
'Aivar',
'Aksel',
'Alar',
'Albert',
'Allar',
'Alo',
'Andreas',
'Andres',
'Andrus',
'Anti',
'Anto',
'Anton',
'Ants',
'Ardo',
'Argo',
'Arno',
'Arnold',
'Artur',
'Arvi',
'Arvo',
'Asko',
'August',
'Avo',
'Eduard',
'Eerik',
'Eero',
'Egon',
'Eiko',
'Einar',
'Eino',
'Elmar',
'Elmo',
'Emil',
'Endel',
'Enn',
'Erki',
'Erkki',
'Erni',
'Ervin',
'Evald',
'Georg',
'Gert',
'Gunnar',
'Gustav',
'Hannes',
'Harald',
'Harri',
'Heiki',
'Heino',
'Hendrik',
'Henrik',
'Hillar',
'Illimar',
'Ilmar',
'Imre',
'Indrek',
'Ingmar',
'Innar',
'Ivar',
'Ivo',
'Jaagup',
'Jaak',
'Jaan',
'Jaanus',
'Jan',
'Janar',
'Johannes',
'Joonas',
'Joosep',
'Juhan',
'Juho',
'J\xfcrgen',
'J\xfcri',
'Kaarel',
'Kaido',
'Kalev',
'Kaljo',
'Kalju',
'Kalle',
'Kalmer',
'Kaspar',
'Kasper',
'Kert',
'Koit',
'Kristjan',
'Kristo',
'Lauri',
'Laurits',
'Leho',
'Lembit',
'Lennart',
'Madis',
'Magnus',
'Mait',
'Marek',
'Margus',
'Marko',
'M\xe4rt',
'Mart',
'Martin',
'Mati',
'Mattias',
'Meelis',
'Mihkel',
'Mikk',
'Neeme',
'Niilo',
'Olari',
'Olev',
'Oscar',
'Osvald',
'Ott',
'Paavo',
'Paul',
'Peep',
'Peeter',
'Priidu',
'Priit',
'Ragnar',
'Raimo',
'Rain',
'Rainer',
'Rait',
'Raivo',
'Rasmus',
'Raul',
'Rauno',
'Rein',
'Riho',
'Risto',
'Robert',
'Roland',
'Sander',
'Siim',
'Silver',
'Sten',
'Sulev',
'Sven',
'Taavi',
'Tanel',
'Tarmo',
'Tauno',
'Teet',
'Tiit',
'Timo',
'Toivo',
'T\xf5nis',
'T\xf5nu',
'Toomas',
'Uku',
'\xdclar',
'\xdcllar',
'\xdclo',
'Ulrik',
'Uno',
'Urmas',
'Uuno',
'Vahur',
'Vaino',
'Valdo',
'Vallo',
'Valter',
'Veiko',
'Vello',
'Viljar',
'Viljo',
'Villem',
'Villu',
'Voldemar'
]
eeFemaleFirstNames = [
'Agnes',
'Aili',
'Aino',
'Airi',
'Alma',
'Anna',
'Anne',
'Anneli',
'Anni',
'Annika',
'Anu',
'Asta',
'Astrid',
'Birgit',
'Dagmar',
'Eeva',
'Elina',
'Ellen',
'Elli',
'Elsa',
'Ene',
'Epp',
'Erika',
'Erna',
'Ester',
'Eva',
'Eve',
'Evelin',
'Evi',
'Gerli',
'Getter',
'Grete',
'Heidi',
'Hele',
'Helene',
'Helge',
'Heli',
'Helmi',
'Herta',
'Hilda',
'Hilja',
'Ida',
'Iiris',
'Ilse',
'Imbi',
'Ines',
'Inge',
'Ingrid',
'Ita',
'Jaana',
'Johanna',
'Kadri',
'Kaia',
'Kaija',
'Kaili',
'Kaire',
'Kaisa',
'Kaja',
'Karin',
'Karoliina',
'Katariina',
'K\xe4tlin',
'Katrin',
'Kersti',
'Ketlin',
'Kirsti',
'Klaudia',
'Koidu',
'Krista',
'Kristel',
'Kristiina',
'Kulli',
'Laine',
'Laura',
'Lenna',
'Liina',
'Liis',
'Liisa',
'Liisi',
'Lilli',
'Linda',
'Lotte',
'Maarja',
'Maia',
'Mare',
'Maret',
'Margit',
'Mari',
'Maria',
'Meeli',
'Merike',
'Merle',
'Meta',
'Miina',
'Minna',
'Mirjam',
'Monika',
'Piia',
'Piret',
'Raine',
'Riin',
'Riina',
'Rita',
'Saara',
'Salme',
'Selma',
'Signe',
'Silvia',
'Sirje',
'Terje',
'Tiina',
'Tiiu',
'Triin',
'Tuuli',
'\xdclle',
'Ulvi',
'Urve',
'Valve',
'Vilma',
'Virve'
]
generate (country: Country, gender: Gender) {
switch (country) {
case Country.POLAND:
return Gender.MALE === gender
? this.plMaleFirstNames[Math.floor(Math.random() * this.plMaleFirstNames.length)]
: this.plFemaleFirstNames[Math.floor(Math.random() * this.plFemaleFirstNames.length)]
case Country.LITHUANIA:
return Gender.MALE === gender
? this.ltMaleFirstNames[Math.floor(Math.random() * this.ltMaleFirstNames.length)]
: this.ltFemaleFirstNames[Math.floor(Math.random() * this.ltFemaleFirstNames.length)]
default:
return Gender.MALE === gender
? this.eeMaleFirstNames[Math.floor(Math.random() * this.eeMaleFirstNames.length)]
: this.eeFemaleFirstNames[Math.floor(Math.random() * this.eeFemaleFirstNames.length)]
}
}
}
export default new FirstNameGenerator()

View File

@ -0,0 +1,12 @@
import {Gender} from '../../Enum/Gender';
export class GenderGenerator {
generate() {
var gender = [Gender.MALE, Gender.FEMALE];
return gender[Math.floor(Math.random() * gender.length)]
}
verify(gender: Gender) {
return Gender.MALE === gender || Gender.FEMALE === gender
}
}

View File

@ -0,0 +1,67 @@
import { Country } from '@/classes/Enum/Country'
export class IbanGenerator {
generate (country: Country) {
const t = this.getBankAccount(country)
const n = this.getNationalCheckDigit(t)
const r = this.getBankCode(country)
switch (country) {
case Country.ESTONIA:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + n + '141400') + r + t + n
case Country.LITHUANIA:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + '212900') + r + t
default:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + '252100') + r + t
}
}
getBankAccount (country: Country) {
let t
const i = BigInt(97)
const o = BigInt((t = Country.POLAND === country
? Math.floor(9999999 * Math.random()).toString().padStart(7, '0') +
Math.floor(9999999 * Math.random()).toString().padStart(7, '0')
: Math.floor(99999 * Math.random()).toString().padStart(5, '0') +
Math.floor(9999 * Math.random()).toString().padStart(4, '0')) + '00')
return t + String(i - (o % i)).padStart(2, '0')
}
getNationalCheckDigit (e: string) {
const t = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7]
const n = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let r = 0
const i = e.length
let o = 18
for (let a = i - 1; a > -1; a--) {
n[o] = t[o] * +e[a]
o--
}
o = 18
for (let a = i - 1; a > -1; a--) {
r -= -n[o]
o--
}
return String(r % 10 !== 0 ? 10 - r % 10 : 0)
}
getBankCode (e: Country) {
const t = ['16000003', '11602231', '10301612', '18900002', '15002240', '19401018', '19101152']
const n = ['2200', '1010', '3300', '7700', '1700', '4204']
const r = ['20900', '72900', '74000', '40100', '21200', '72300', '21700', '21400', '70440', '71800', '73000']
switch (e) {
case Country.POLAND:
return t[Math.floor(Math.random() * t.length)]
case Country.ESTONIA:
return n[Math.floor(Math.random() * n.length)]
default:
return r[Math.floor(Math.random() * r.length)]
}
}
getIbanCheckDigits (e: string) {
return String(BigInt('98') - (BigInt(e) % BigInt('97'))).padStart(2, '0')
}
}
export default new IbanGenerator()

View File

@ -0,0 +1,553 @@
import { Country } from '@/classes/Enum/Country'
export class LastNameGenerator {
plLastNames: Array<string> = [
'Abgarowicz',
'Abrahamowicz',
'Abramczyk',
'Abramowicz',
'Adamczak',
'Adamczyk',
'Adamiak',
'Adamiec',
'Adamowski',
'Adamski',
'Aleksandrowicz',
'Ambroziak',
'Anczok',
'Andrzejewski',
'Ankwicz',
'Antek',
'Araszkiewicz',
'Babiuch',
'Bachleda',
'Baginski',
'B\u0105k',
'Bakula',
'Balcerzak',
'Balicki',
'Banasiak',
'Baranowska',
'Baranowski',
'Bara\u0144ski',
'Bargiel',
'Bartnicki',
'Barton',
'Bartosiewicz',
'Bednarek',
'Bednarski',
'Beksi\u0144ski',
'Beres',
'Berezovsky',
'Bia\u0142as',
'Bialik',
'Bia\u0142kowski',
'Bia\u0142y',
'Bieganski',
'Bielawski',
'Bielecki',
'Bieli\u0144ski',
'Bielski',
'Bierut',
'Biesiadecki',
'Bieszczad',
'Biskupski',
'B\u0142aszczyk',
'Blechacz',
'Bobak',
'Bobrowski',
'Bochenek',
'Bogusz',
'Bojarski',
'Boniecki',
'Bonikowski',
'Bonk',
'Borkowski',
'Borowicz',
'Borowiec',
'Borowiecki',
'Borowski',
'Bortkiewicz',
'Borysewicz',
'Borzym',
'Bratkowski',
'Brodnicki',
'Brodowski',
'Brodzki',
'Bronikowski',
'Bronowski',
'Br\xf3zda',
'Bro\u017cyna',
'Brzechwa',
'Brzezi\u0144ski',
'Brzozowski',
'Brzyski',
'Buczkowski',
'Bujak',
'Bujwid',
'Bukowski',
'Burzy\u0144ski',
'Butkiewicz',
'Bystron',
'Bytnar',
'Cebertowicz',
'Chadaj',
'Chalupa',
'Cha\u0142upa',
'Chlapowski',
'Ch\u0142apowski',
'Chmara',
'Chmiel',
'Chmielewski',
'Chmielowski',
'Chojnacki',
'Cholewa',
'Chor\u0105\u017cycki',
'Chrobak',
'Chrzanowski',
'Cichocki',
'Cichy',
'Ciechanowski',
'Cieplak',
'Ciesielski',
'Cie\u015bla',
'Cie\u015blak',
'Cie\u015blar',
'Cie\u015blik',
'Cio\u0142ek',
'Ciszewski',
'Cuch',
'Cukier',
'Cybulka',
'Cybulska',
'Cybulski',
'Cygan',
'Cyrankiewicz',
'Czachowski',
'Czajkowski',
'Czaplic',
'Czapski',
'Czarnecki',
'Czarniecki',
'Czarny',
'Czechowicz',
'Czerniak',
'Czerwonka',
'Czy\u017c',
'Czy\u017cewski',
'D\u0105browski',
'Danilowicz',
'Dawidowicz',
'Dawidowska',
'Dawidowski',
'D\u0119bicki',
'D\u0119bski',
'Dembski',
'D\u0142ugosz',
'Dobrowolski',
'Dolniak',
'Domaga\u0142a',
'Dombrovsky',
'Dombrowski',
'Drozd',
'Dryja',
'Drzyzga',
'Duczy\u0144ski',
'Dudek',
'Dunajewski',
'Dunin',
'Dus',
'Dzi\u0119cio\u0142',
'Dziedzic',
'Dzikowski',
'Dziuba',
'Fedorowicz',
'Filipowicz',
'Flatau',
'Fr\u0105ckowiak',
'Frankowski',
'Ga\u0142ecki',
'Galecki',
'G\u0105sienica',
'G\u0105sior',
'Geremek',
'Giedroy\u0107',
'Gielgud',
'Gierczak',
'Gierek',
'Giertych',
'Gieysztor',
'Ginter',
'G\u0142owacki',
'Gminski',
'Godlewski',
'Gojowczyk',
'Go\u0142\u0105b',
'Golomb',
'Gomu\u0142ka',
'G\xf3rski',
'Grabarczyk',
'Grabowski',
'Graczyk',
'Grinevsky',
'Grochowiak',
'Grochowski',
'Gronkowski',
'Grudzi\u0144ski',
'Grunitzky',
'Gruszka',
'Grycz',
'Grzyb',
'Grzybowski',
'Grzywacz',
'Gudowicz'
]
ltLastNames: Array<string> = [
'Abramavicius',
'Abromavicius',
'Adomaitis',
'Aleliunas',
'Andrijauskas',
'Andriukaitis',
'Andriuskevicius',
'Andrulis',
'Antanavicius',
'Arlauskas',
'Arlauskiene',
'Astrauskas',
'Baciulis',
'Bagdonas',
'Bakaitis',
'Balciunas',
'Balsys',
'Baranauskas',
'Bartkevicius',
'Bartkus',
'Bartulis',
'Basanavicius',
'Berankis',
'Bernotas',
'Brazauskas',
'Brazdauskis',
'Briedis',
'Budrys',
'Butkevicius',
'Butkus',
'Butrym',
'Cesnauskis',
'Dagys',
'Daukantaite',
'Daukantas',
'Daukantiene',
'Dauksa',
'Daumantas',
'Dirgela',
'Donelaitis',
'Garsva',
'Gerulaitis',
'Giedraitis',
'Grazulis',
'Grinius',
'Grybauskas',
'Gudaitis',
'Gustaitis',
'Gylys',
'Ilgauskas',
'Ivanauskas',
'Jakubenas',
'Jankauskas',
'Jankunas',
'Janonis',
'Jasaitis',
'Jasikevicius',
'Javtokas',
'Jovaisa',
'Juknevicius',
'Jurevicius',
'Kacinskas',
'Kairys',
'Kalinauskas',
'Kaminskas',
'Karnisovas',
'Karosas',
'Karvelis',
'Katelynas',
'Kaukenas',
'Kavaliauskas',
'Kiedis',
'Kleiza',
'Klimaitis',
'Klimas',
'Klimavicius',
'Kubilius',
'Kudirka',
'Kundrotas',
'Kuprevicius',
'Kuris',
'Laurinavicius',
'Leonas',
'Liepa',
'Lozoraitis',
'Lupeikis',
'Macijauskas',
'Maciulis',
'Mackevicius',
'Malinauskas',
'Mamontovas',
'Marcinkeviciene',
'Marcinkevicius',
'Marcinkeviciute',
'Marciulionis',
'Markevicius',
'Martinaitis',
'Masiulis',
'Matonis',
'Matulevicius',
'Mazeika',
'Mekas',
'Mickevicius',
'Mikenas',
'Mikutavicius',
'Miskinis',
'Motiejunas',
'Navickas',
'Noreika',
'Norkus',
'Novickis',
'Pakalniskis',
'Paleckis',
'Palubinskas',
'Paulauskas',
'Petkevicius',
'Petraitis',
'Petrauskas',
'Petrulis',
'Pleckaitis',
'Pocius',
'Poskus',
'Pozela',
'Prudius',
'Rackauskas',
'Ramanauskas',
'Rimas',
'Rimkus',
'Rimsa',
'Sabonis',
'Sabutis',
'Sakalauskas',
'Saltenis',
'Saulys',
'Savickas',
'Sernas',
'Sidlauskas',
'Simkus',
'Simonavicius',
'Sinkevicius',
'Skema',
'Smetona',
'Songaila',
'Stankevicius',
'Stauskas',
'Steponavicius',
'Stonkus',
'Stonys',
'Sulskis',
'Sutkus',
'Svedas',
'Urbonas',
'Urbonavicius',
'Vaisvila',
'Vaitkevicius',
'Vaitkus',
'Valaitis',
'Valantinas',
'Valinskas',
'Vanagas',
'Varnas',
'Vasiliauskas',
'Venclova',
'Venskus',
'Vilkaitis',
'Vilkas',
'Visinskis',
'Vysniauskas',
'Zemaitis',
'Ziemelis',
'Zikaras',
'Zilinskas',
'Zukauskas'
]
eeLastNames: Array<string> = [
'Aare',
'Aarma',
'Aas',
'Aasm\xe4e',
'Aav',
'Aavik',
'Allik',
'Alver',
'Aru',
'Eenpalu',
'Eensaar',
'Eskola',
'H\xe4rma',
'Ilves',
'J\xe4\xe4ger',
'Jakobson',
'J\xe4nes',
'J\xe4rve',
'J\xe4rvis',
'J\xf5gi',
'Kaaleste',
'Kaasik',
'K\xe4bin',
'Kalda',
'Kaljulaid',
'Kaljurand',
'Kallas',
'Kallaste',
'Kangro',
'Kangur',
'Kapp',
'K\xe4rner',
'Kask',
'K\xe4sper',
'Kass',
'Keres',
'Keskk\xfcla',
'Kesk\xfcla',
'Kikkas',
'Kingsepp',
'Kirs',
'Kirsipuu',
'Kivi',
'Klavan',
'K\xf5iv',
'Kokk',
'Kontaveit',
'Koppel',
'Korjus',
'Kotkas',
'Kreek',
'Kross',
'Kruus',
'Kukk',
'K\xfctt',
'Kuusik',
'Kuusk',
'Laar',
'Laht',
'Lass',
'Laur',
'Laurits',
'Lemsalu',
'Lepik',
'Lepmets',
'Lepp',
'Levandi',
'Liiv',
'Lill',
'Lindmaa',
'Linna',
'Lipp',
'Lippmaa',
'L\xf5hmus',
'Loo',
'L\xf5oke',
'Luik',
'Luts',
'M\xe4gi',
'M\xe4lk',
'M\xe4nd',
'M\xe4nnik',
'Margiste',
'Mark',
'Masing',
'Mets',
'Must',
'N\xf5mmik',
'Nurme',
'Nurmsalu',
'Oja',
'Olesk',
'\xd6pik',
'Orav',
'P\xe4\xe4suke',
'Padar',
'P\xe4rn',
'Peebo',
'Peetre',
'Pihlak',
'Piho',
'Piip',
'P\xf5der',
'P\xf5ld',
'Poska',
'Puhvel',
'P\xfctsep',
'Puusepp',
'Raag',
'Rand',
'Raud',
'Raudsepp',
'Rebane',
'Reek',
'Reinsalu',
'Rooba',
'Roolaid',
'Rootare',
'Rummo',
'R\xfc\xfctel',
'R\xfc\xfctli',
'Saar',
'Salum\xe4e',
'Sepp',
'Sibul',
'Siimar',
'Simm',
'Sirel',
'Sisask',
'Sokk',
'Soosaar',
'Susi',
'Talts',
'Talvik',
'Tamm',
'Tamme',
'Tarvas',
'Teder',
'Toom',
'Toome',
'Toots',
'Vaher',
'Vahtra',
'Vaino',
'Vainola',
'V\xe4lbe',
'Valdma',
'V\xe4ljas',
'Valk',
'Vesik',
'Veski',
'Viiding',
'Visnapuu',
'Vitsut',
'V\xf5igemast',
'V\xf5su'
]
generate (country: Country) {
switch (country) {
case Country.POLAND:
return this.plLastNames[Math.floor(Math.random() * this.plLastNames.length)]
case Country.LITHUANIA:
return this.ltLastNames[Math.floor(Math.random() * this.ltLastNames.length)]
default:
return this.eeLastNames[Math.floor(Math.random() * this.eeLastNames.length)]
}
}
}
export default new LastNameGenerator()

View File

@ -0,0 +1,143 @@
import randomGenerator from './RandomGenerator'
import { Country } from '../../Enum/Country'
import { Gender } from '../../Enum/Gender'
export class PersonalIdGenerator {
/**
* return e.generate = function (e, t) {
var
n = this.getYearPart(),
r = this.getMonthPart(),
i = this.getDayPart(),
o = this.getIdNumPart(),
a = this.getGenderPart(e, t),
l = this.getControlSum(e, n, r, i, o, a);
return "pl" === e ? n + r + i + o + a + l : a + n + r + i + o + l
},
* @param country
* @param gender
*/
generate (country: Country, gender: Gender) {
console.log(country, gender)
const n = this.getYearPart()
const r = this.getMonthPart()
const i = this.getDayPart()
const o = this.getIdNumPart()
const a = this.getGenderPart(country, gender)
console.log(country, gender, a)
const l = this.getControlSum(country, n, r, i, o, a)
return Country.POLAND === country ? n + r + i + o + a + l : a + n + r + i + o + l
}
/**
* e.getYearPart = function () {
var e = (new Date).getFullYear();
return String(Iu.generate(e - 25, e - 55)).substring(2, 4)
},
*/
getYearPart () {
const e = (new Date()).getFullYear()
return String(randomGenerator.generate(e - 25, e - 55)).substring(2, 4)
}
/**
* e.getMonthPart = function () {
return Iu.generate(1, 12).toString().padStart(2, "0")
},
*/
getMonthPart () {
return randomGenerator.generate(1, 12).toString().padStart(2, '0')
}
/**
* e.getDayPart = function () {
return Iu.generate(1, 28).toString().padStart(2, "0")
},
*/
getDayPart () {
return randomGenerator.generate(1, 28).toString().padStart(2, '0')
}
/**
* e.getIdNumPart = function () {
return Iu.generate(1, 999).toString().padStart(3, "0")
},
*/
getIdNumPart () {
return randomGenerator.generate(1, 999).toString().padStart(3, '0')
}
/**
* e.getGenderPart = function (e, t) {
switch (e) {
case"pl":
"male" === t ? t = String(2 * Iu.generate(1, 5) - 1) : "female" === t && (t = String(2 * Iu.generate(1, 4)));
break;
default:
"male" === t ? t = "3" : "female" === t && (t = "4")
}
return t
},
* @param country
* @param gender
*/
getGenderPart (country: Country, gender: Gender) {
console.log(country, gender)
switch (country) {
case Country.POLAND:
console.log(country)
return Gender.MALE === gender
? String(2 * randomGenerator.generate(1, 5) - 1)
: String(2 * randomGenerator.generate(1, 4))
default:
console.log(gender, Gender.MALE === gender)
return Gender.MALE === gender ? '3' : '4'
}
}
/**
* e.getControlSum = function (e, t, n, r, i, o) {
var a, l;
if ("pl" === e) return l = +(a = t + n + r + i + o)[0] + 3 * +a[1] + 7 * +a[2] + 9 * +a[3] + +a[4] + 3 * +a[5] + 7 * +a[6] + 9 * +a[7] + +a[8] + 3 * +a[9], 0 != (l %= 10) && (l = 10 - l), String(l);
a = o + t + n + r + i;
for (var s = 1, u = 3, c = 0, d = 0, h = 0; h < 10; h++) {
var p = +a[h];
c += p * s, d += p * u, 10 == ++s && (s = 1), 10 == ++u && (u = 1)
}
return d %= 11, (c %= 11) < 10 ? String(c) : d < 10 ? String(d) : String(0)
}
* @param e
* @param t
* @param n
* @param r
* @param i
* @param o
*/
getControlSum (e: Country, t: string, n: string, r: string, i: string, o: string) {
let a
let l
if (Country.POLAND === e) {
l = +(a = t + n + r + i + o)[0] + 3 * +a[1] + 7 * +a[2] + 9 * +a[3] + +a[4] + 3 * +a[5] + 7 * +a[6] + 9 * +a[7] + +a[8] + 3 * +a[9];
(l %= 10) !== 0 && (l = 10 - l)
l = String(l)
return l
}
let c = 0
let d = 0
a = o + t + n + r + i
for (let s = 1, u = 3, c = 0, d = 0, h = 0; h < 10; h++) {
const p = +a[h]
c += p * s
d += p * u
++s === 10 && (s = 1)
++u === 10 && (u = 1)
}
d %= 11
return (c %= 11) < 10 ? String(c) : d < 10 ? String(d) : String(0)
}
}
export default new PersonalIdGenerator()

View File

@ -0,0 +1,41 @@
import { Country } from '../../Enum/Country'
export class PhoneGenerator {
generate (country: Country) {
switch (country) {
case Country.POLAND:
return this.getPlPhoneNum()
case Country.LITHUANIA:
return this.getLtPhoneNum()
default:
return this.getEePhoneNum()
}
}
getPlPhoneNum () {
const e = ['45', '50', '51', '53', '57', '60', '66', '69', '72', '73', '78', '79', '88']
let t = this.getBasePhone()
for (let n = 0; n <= 8; n++) {
let i = ''
for (let r = n.toString(), o = 0; o <= 6; o++) {
i += r
}
t === i && (t = t.substring(0, 6) + '9')
}
return e[Math.floor(Math.random() * e.length)] + t
}
getLtPhoneNum () {
return '6' + this.getBasePhone()
}
getEePhoneNum () {
return '5' + this.getBasePhone()
}
getBasePhone () {
return Math.floor(9999999 * Math.random()).toString().padStart(7, '0')
}
}
export default new PhoneGenerator()

View File

@ -0,0 +1,7 @@
export class RandomGenerator {
generate (min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
}
export default new RandomGenerator()

View File

@ -0,0 +1,3 @@
class NotificationCleaner {
}

View File

@ -0,0 +1,4 @@
<template src="./template.html"></template>
<script lang="ts" src="./script.ts"></script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss" src="./style.scss"></style>

View File

@ -0,0 +1,62 @@
import { Component, Vue } from 'vue-property-decorator'
import personalIdGenerator from '@/classes/Service/Generators/PersonalIdGenerator'
import ibanGenerator from '@/classes/Service/Generators/IbanGenerator'
import phoneGenerator from '@/classes/Service/Generators/PhoneGenerator'
import firstNameGenerator from '@/classes/Service/Generators/FirstNameGenerator'
import lastNameGenerator from '@/classes/Service/Generators/LastNameGenerator'
import { Person } from '@/classes/DTO/Person'
import VueClipboard from 'vue-clipboard2'
import { Target } from '@/classes/Enum/Target'
import sender from '@/classes/Service/Browser/Chrome/Sender'
Vue.use(VueClipboard)
@Component
export default class HelloWorld extends Vue {
tab = 'person'
person = new Person()
copyText = ''
copyPersonalId () {
console.log(JSON.stringify(this.person))
const personalId = personalIdGenerator.generate(this.person.country, this.person.gender)
this.copy(personalId)
}
copyIban () {
console.log(JSON.stringify(this.person))
const iban = ibanGenerator.generate(this.person.country)
this.copy(iban)
}
copyPhone () {
console.log(JSON.stringify(this.person))
const phone = phoneGenerator.generate(this.person.country)
this.copy(phone)
}
copy (text: string) {
this.copyText = text
this.$copyText(text)
}
autocomplete () {
const personalId = personalIdGenerator.generate(this.person.country, this.person.gender)
this.insertValueToNode(Target.PERSONAL_ID, personalId)
const iban = ibanGenerator.generate(this.person.country)
this.insertValueToNode(Target.IBAN, iban)
const phone = phoneGenerator.generate(this.person.country)
this.insertValueToNode(Target.PHONE, phone)
const firstName = firstNameGenerator.generate(this.person.country, this.person.gender)
this.insertValueToNode(Target.FIRST_NAME, firstName)
const lastName = lastNameGenerator.generate(this.person.country)
this.insertValueToNode(Target.LAST_NAME, lastName)
}
insertValueToNode (target: Target, value: string): void {
sender.send({
target: target,
value: value
})
}
}

View File

@ -0,0 +1,60 @@
.container {
max-width: 400px;
min-width: 400px;
border: solid 2px gray;
.wrapper {
padding: 10px;
.tab-panel {
display: flex;
&__item {
flex-grow: 1;
padding: 5px;
cursor: pointer;
border-bottom: solid 2px #cae5fa;
&_active {
border-bottom: solid 2px #298df8;
}
&:hover {
border-bottom: solid 2px #298df8;
}
}
}
.tab-page {
padding-top: 10px;
&__item {
display: none;
&_show {
display: block;
}
.form-row {
display: flex;
margin-bottom: 5px;
&__item {
flex-grow: 1;
}
&:last-child {
margin-bottom: 0px;
}
}
}
}
.memory-panel {
text-align: left;
padding: 5px;
margin-top: 10px;
}
}
}

View File

@ -0,0 +1,75 @@
<div class="container">
<div class="wrapper">
<div class="tab-panel">
<div @click="tab = 'person'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'person'}">Person
</div>
<div @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
Ember
</div>
</div>
<div class="tab-page">
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'person'}">
<div class="form-row">
<div class="form-row__item">
<label>
Country
<select v-model="person.country">
<option value="ee">Estonia</option>
<option value="lt">Lithuania</option>
</select>
</label>
</div>
<div class="form-row__item">
<label>
Gender
<select v-model="person.gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="random">Random</option>
</select>
</label>
</div>
</div>
<div class="form-row">
<div
@click="autocomplete"
class="form-row__item copy-button" data-clipboard-text="text1">
<button>Autocomplete</button>
</div>
<div
@click="copyPersonalId"
class="form-row__item copy-button" data-clipboard-text="text2">
<button>PersonalId</button>
</div>
<div
@click="copyIban"
class="form-row__item copy-button" data-clipboard-text="text3">
<button>Iban</button>
</div>
<div
@click="copyPhone"
class="form-row__item copy-button" data-clipboard-text="text3">
<button>Phone</button>
</div>
</div>
</div>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'ember'}">
<div class="form-row">
<div class="form-row__item">
<label for="autocleaner">
Use notification cleaner
<input type="checkbox" name="autocleaner" id="autocleaner">
</label>
</div>
</div>
<div class="form-row">
<div class="form-row__item">
<button>Clean</button>
</div>
</div>
</div>
</div>
<div class="memory-panel">Memory: {{copyText}}</div>
</div>
</div>

9
popup/src/main.ts Normal file
View File

@ -0,0 +1,9 @@
import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')

View File

@ -0,0 +1,32 @@
/* eslint-disable no-console */
import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready () {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
},
registered () {
console.log('Service worker has been registered.')
},
cached () {
console.log('Content has been cached for offline use.')
},
updatefound () {
console.log('New content is downloading.')
},
updated () {
console.log('New content is available; please refresh.')
},
offline () {
console.log('No internet connection found. App is running in offline mode.')
},
error (error) {
console.error('Error during service worker registration:', error)
}
})
}

13
popup/src/shims-tsx.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import Vue, { VNode } from 'vue'
declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
}
}
}

4
popup/src/shims-vue.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}

View File

@ -0,0 +1,12 @@
module.exports = {
plugins: [
'cypress'
],
env: {
mocha: true,
'cypress/globals': true
},
rules: {
strict: 'off'
}
}

View File

@ -0,0 +1,25 @@
/* eslint-disable arrow-body-style */
// https://docs.cypress.io/guides/guides/plugins-guide.html
// if you need a custom webpack configuration you can uncomment the following import
// and then use the `file:preprocessor` event
// as explained in the cypress docs
// https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples
// /* eslint-disable import/no-extraneous-dependencies, global-require */
// const webpack = require('@cypress/webpack-preprocessor')
module.exports = (on, config) => {
// on('file:preprocessor', webpack({
// webpackOptions: require('@vue/cli-service/webpack.config'),
// watchOptions: {}
// }))
return Object.assign({}, config, {
fixturesFolder: 'tests/e2e/fixtures',
integrationFolder: 'tests/e2e/specs',
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
supportFile: 'tests/e2e/support/index.js'
})
}

View File

@ -0,0 +1,8 @@
// https://docs.cypress.io/api/introduction/api.html
describe('My First Test', () => {
it('Visits the app root url', () => {
cy.visit('/')
cy.contains('h1', 'Welcome to Your Vue.js + TypeScript App')
})
})

View File

@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

View File

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

View File

@ -0,0 +1,12 @@
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/main.vue'
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message'
const wrapper = shallowMount(HelloWorld, {
propsData: { msg }
})
expect(wrapper.text()).toMatch(msg)
})
})

41
popup/tsconfig.json Normal file
View File

@ -0,0 +1,41 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

11629
popup/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

4
style.css Normal file
View File

@ -0,0 +1,4 @@
button.alx-button-send {
width: auto;
text-align: center;
}