Compare commits

..

No commits in common. 'master' and 'c43f1caed80b216f71c51b842ab5c3531f4f2b57' have entirely different histories.

  1. 2
      manifest.json
  2. 1
      popup/dist/css/app.34e76007.css
  3. 1
      popup/dist/css/app.95f2e473.css
  4. 2
      popup/dist/index.html
  5. 2
      popup/dist/js/app.9bdde6bd.js
  6. 1
      popup/dist/js/app.9bdde6bd.js.map
  7. 2
      popup/dist/js/app.d8c86962.js
  8. 1
      popup/dist/js/app.d8c86962.js.map
  9. 20
      popup/dist/js/chunk-vendors.49bbd58a.js
  10. 1
      popup/dist/js/chunk-vendors.49bbd58a.js.map
  11. 20
      popup/dist/js/chunk-vendors.d437ab16.js
  12. 1
      popup/dist/js/chunk-vendors.d437ab16.js.map
  13. 26
      popup/dist/precache-manifest.ea391085ddd36de2a7ecbc5dff885460.js
  14. 2
      popup/dist/service-worker.js
  15. 1
      popup/package.json
  16. 40
      popup/src/api/CountryResolver.ts
  17. 54
      popup/src/api/DomainResolver.ts
  18. 11
      popup/src/api/Handlers/TokenRequestHandler.ts
  19. 123
      popup/src/api/HttpClient.ts
  20. 38
      popup/src/api/Main/HttpClient.ts
  21. 17
      popup/src/api/Main/Schemas/AddMockSchema.ts
  22. 11
      popup/src/api/Main/Schemas/ChangeMockValueSchema.ts
  23. 9
      popup/src/api/Main/Schemas/MocksSchema.ts
  24. 9
      popup/src/api/Main/Schemas/ToggleNewClientTypeSchema.ts
  25. 9
      popup/src/api/Main/Schemas/ToggleRegularClientTypeSchema.ts
  26. 9
      popup/src/api/Main/Schemas/UserIdentificationByIdenfySchema.ts
  27. 7
      popup/src/api/SchemaInterface.ts
  28. 18
      popup/src/classes/DTO/Registers.ts
  29. 74
      popup/src/classes/Service/Generators/IbanGenerator.ts
  30. 30
      popup/src/classes/Service/Generators/PersonalIdGenerator.ts
  31. 6
      popup/src/classes/Service/NotificationCleaner.ts
  32. 4
      popup/src/components/ember-tab/main.vue
  33. 37
      popup/src/components/ember-tab/script.ts
  34. 65
      popup/src/components/ember-tab/style.scss
  35. 17
      popup/src/components/ember-tab/template.html
  36. 4
      popup/src/components/mocks-tab/main.vue
  37. 14
      popup/src/components/mocks-tab/script.ts
  38. 65
      popup/src/components/mocks-tab/style.scss
  39. 10
      popup/src/components/mocks-tab/template.html
  40. 4
      popup/src/components/mocks/main.vue
  41. 142
      popup/src/components/mocks/script.ts
  42. 75
      popup/src/components/mocks/style.scss
  43. 69
      popup/src/components/mocks/template.html
  44. 4
      popup/src/components/person-tab/main.vue
  45. 93
      popup/src/components/person-tab/script.ts
  46. 65
      popup/src/components/person-tab/style.scss
  47. 65
      popup/src/components/person-tab/template.html
  48. 110
      popup/src/components/script.ts
  49. 6
      popup/src/components/style.scss
  50. 92
      popup/src/components/template.html
  51. 4
      popup/src/components/user-tab/main.vue
  52. 59
      popup/src/components/user-tab/script.ts
  53. 65
      popup/src/components/user-tab/style.scss
  54. 37
      popup/src/components/user-tab/template.html
  55. 3
      popup/src/stubs/FlowEnum.ts
  56. 11
      popup/src/stubs/Stub2Flow.ts
  57. 24
      popup/src/stubs/StubResolver.ts
  58. 4
      popup/src/stubs/config.ts
  59. 20
      popup/src/stubs/stubs/Main/MocksSchema/MocksSchemaSuccess.ts
  60. 12
      popup/yarn.lock

@ -27,7 +27,7 @@
"manifest_version": 2, "manifest_version": 2,
"permissions": [ "tabs", "contextMenus", "\u003Call_urls>", "storage" ], "permissions": [ "tabs", "contextMenus", "\u003Call_urls>", "storage" ],
"short_name": "SVEAK helper", "short_name": "SVEAK helper",
"version": "1.0.1", "version": "1.0.0",
"commands": { "commands": {
"_execute_browser_action": { "_execute_browser_action": {
"suggested_key": { "suggested_key": {

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.container[data-v-5e51ebac]{max-width:400px;min-width:400px;border:2px solid grey}.container .wrapper[data-v-5e51ebac]{padding:10px}.container .wrapper .tab-panel[data-v-5e51ebac]{display:flex}.container .wrapper .tab-panel__item[data-v-5e51ebac]{flex-grow:1;padding:5px;cursor:pointer;border-bottom:2px solid #cae5fa}.container .wrapper .tab-panel__item[data-v-5e51ebac]:hover,.container .wrapper .tab-panel__item_active[data-v-5e51ebac]{border-bottom:2px solid #298df8}.container .wrapper .tab-page[data-v-5e51ebac]{padding-top:10px}.container .wrapper .tab-page__item[data-v-5e51ebac]{display:none}.container .wrapper .tab-page__item_show[data-v-5e51ebac]{display:block}.container .wrapper .tab-page__item .form-row[data-v-5e51ebac]{display:flex;margin-bottom:5px}.container .wrapper .tab-page__item .form-row__item[data-v-5e51ebac]{flex-grow:1;margin-right:10px}.container .wrapper .tab-page__item .form-row__item-input[data-v-5e51ebac]{width:100%}.container .wrapper .tab-page__item .form-row[data-v-5e51ebac]:last-child{margin-bottom:0}.container .wrapper .memory-panel[data-v-5e51ebac]{text-align:left;padding:5px;margin-top:10px}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}body{margin:0}

@ -1 +1 @@
<!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"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.34e76007.css" rel="preload" as="style"><link href="/popup/dist/js/app.d8c86962.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.d437ab16.js" rel="preload" as="script"><link href="/popup/dist/css/app.34e76007.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.d437ab16.js"></script><script src="/popup/dist/js/app.d8c86962.js"></script></body></html> <!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"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.95f2e473.css" rel="preload" as="style"><link href="/popup/dist/js/app.9bdde6bd.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.95f2e473.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.9bdde6bd.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,26 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "9f7cc03f956475eec94c",
"url": "/css/app.95f2e473.css"
},
{
"revision": "117c3b5969bea3eacecac9b36d7196ef",
"url": "/index.html"
},
{
"revision": "9f7cc03f956475eec94c",
"url": "/js/app.9bdde6bd.js"
},
{
"revision": "55fa3e18a2c5425a215c",
"url": "/js/chunk-vendors.49bbd58a.js"
},
{
"revision": "b7d7baa709e9512123d49c9e80d3b21f",
"url": "/manifest.json"
},
{
"revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
"url": "/robots.txt"
}
]);

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts( importScripts(
"/precache-manifest.0e568ea1504b4c258da6e583c00648bc.js" "/precache-manifest.ea391085ddd36de2a7ecbc5dff885460.js"
); );
workbox.core.setCacheNameDetails({prefix: "sveak-helper"}); workbox.core.setCacheNameDetails({prefix: "sveak-helper"});

@ -12,7 +12,6 @@
"dependencies": { "dependencies": {
"@types/chrome": "^0.0.133", "@types/chrome": "^0.0.133",
"@types/clipboard": "^2.0.1", "@types/clipboard": "^2.0.1",
"axios": "^0.26.1",
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"register-service-worker": "^1.7.1", "register-service-worker": "^1.7.1",

@ -1,40 +0,0 @@
import { Country } from '@/classes/Enum/Country'
export class CountryResolver {
resolve (): Promise<Country> {
const promise = new Promise((resolve) => {
if (typeof chrome.tabs === 'undefined') {
const country = this.grabCountry(location.href || '')
resolve(country)
return
}
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
for (const tab of tabs) {
const country = this.grabCountry(tab.url || '')
resolve(country)
return
}
})
})
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
return promise.then((country) => {
console.log('country', country)
return country
})
}
grabCountry (url: string): Country {
const isNordecum = url.indexOf('smspinigai') > -1 ||
url.indexOf('paskolos') > -1 ||
url.indexOf('nordecum') > -1
if (isNordecum) {
return Country.LITHUANIA
}
return Country.ESTONIA
}
}
export default new CountryResolver()

@ -1,54 +0,0 @@
export class DomainResolver {
resolve (): Promise<string> {
const promise = new Promise((resolve) => {
if (typeof chrome.tabs === 'undefined') {
const url = this.grabTargetUrl(location.href || '')
resolve(url)
return
}
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
for (const tab of tabs) {
const url = this.grabTargetUrl(tab.url || '')
resolve(url)
return
}
})
})
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
return promise.then((url) => {
console.log('url', url)
return url
})
}
grabTargetUrl (url: string): string | null {
if (url.indexOf('localhost') > -1) {
return null
}
const parts = url.match(/http:\/\/.*?\.(.*?)\..*?/) || []
const nickname = parts[1] || null
const isNordecum = url.indexOf('smspinigai') > -1 ||
url.indexOf('paskolos') > -1 ||
url.indexOf('nordecum') > -1
const project = isNordecum ? 'nordecum' : 'placetgroup'
const tld = isNordecum ? 'lt' : 'com'
const isLocal = url.indexOf('.sv') !== -1
if (isLocal && !nickname) {
return null
}
url = isLocal
? 'http://' + project + '.' + nickname + '.sv'
: 'https://dev.' + project + '.' + tld
console.log('domain_resolver', parts, nickname, isNordecum, project, tld, url)
return url
}
}
export default new DomainResolver()

@ -1,11 +0,0 @@
import { RequestHandler, RequestInterface } from '@/api/HttpClient'
export class TokenRequestHandler extends RequestHandler {
handle = (request: RequestInterface): void => {
request.headers = request.headers || {}
request.headers['x-plugin-token'] = 'GxwGRM'
console.log(request, 'DeviceIdHandler')
}
}
export default new TokenRequestHandler()

@ -1,123 +0,0 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { SchemaInterface } from './SchemaInterface'
import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'
import stubResolver from '@/stubs/StubResolver'
import domainResolver from '@/api/DomainResolver'
export abstract class Handler {
abstract handle: any
}
export interface RequestInterface {
method: Method;
url: string;
data: Record<string, any> | null;
headers: Record<string, any> | null;
}
interface RequestHandleFunction {
(request: RequestInterface): void;
}
export abstract class RequestHandler extends Handler {
abstract handle: RequestHandleFunction
}
export interface ResponseInterface extends AxiosResponse {
}
interface ResponseHandleFunction {
(response: ResponseInterface): void;
}
export abstract class ResponseHandler extends Handler {
abstract handle: ResponseHandleFunction
}
export class HttpClient {
private baseUrl: string
private handlers: Handler[] = []
constructor (baseUrl: string) {
this.baseUrl = baseUrl
this.syncBaseUrlWithStand()
}
async syncBaseUrlWithStand () {
await domainResolver
.resolve()
.then((url) => {
this.baseUrl = url || this.baseUrl
})
}
send (schema: SchemaInterface, data: any | null = null): Promise<AxiosResponse> {
let url = schema.url
const preparedData = data
for (const key in data) {
if (url.indexOf('{' + key + '}') > -1) {
url = url.replace('{' + key + '}', preparedData[key])
delete preparedData[key]
}
}
console.log(data, 'data')
const requestData = {
method: schema.method as Method,
url: this.baseUrl + url,
data: preparedData,
headers: {
'Content-Type': 'application/json;charset=utf-8'
}
} as RequestInterface
/**
* todo перевести на промисы +
*/
this.handlers
.filter((handler: Handler) => {
return handler instanceof RequestHandler
})
.map((handler: Handler) => {
handler.handle(requestData)
return handler
})
const stub = stubResolver.handle(schema.code)
const axiosData = requestData as AxiosRequestConfig
if (schema.prefix) {
const temp: any = {}
temp[schema.prefix] = axiosData.data
axiosData.data = temp
}
if (axiosData.method === 'GET') {
axiosData.params = axiosData.data
delete axiosData.data
}
const response = stub || axios(axiosData)
return response
.then((response: any) => {
/**
* todo перевести на промисы +
*/
this.handlers
.filter((handler: Handler) => {
return handler instanceof ResponseHandler
})
.map((handler: Handler) => {
handler.handle(response)
return handler
})
return response
})
}
addHandler (handler: Handler) {
this.handlers.push(handler)
return this
}
}

@ -1,38 +0,0 @@
import { HttpClient as BaseClient } from '../../api/HttpClient'
import MocksSchema, { MockConfigurationsRequest } from '../../api/Main/Schemas/MocksSchema'
import { SchemaInterface } from '@/api/SchemaInterface'
import { TokenRequestHandler } from '@/api/Handlers/TokenRequestHandler'
import AddMockSchema, { AddMockConfigurationsRequest } from '@/api/Main/Schemas/AddMockSchema'
import ChangeMockValueSchema, { ChangeMockConfigurationValueRequest } from '@/api/Main/Schemas/ChangeMockValueSchema'
import ToggleNewClientTypeSchema, { ToggleNewClientTypeRequest } from '@/api/Main/Schemas/ToggleNewClientTypeSchema'
import ToggleRegularClientTypeSchema, { ToggleRegularClientTypeRequest } from '@/api/Main/Schemas/ToggleRegularClientTypeSchema'
import UserIdentificationByIdenfySchema, { UserIdentificationByIdenfyRequest } from '@/api/Main/Schemas/UserIdentificationByIdenfySchema'
export class HttpClient extends BaseClient {
mockConfigurations (data: MockConfigurationsRequest): any {
return this.send(MocksSchema as SchemaInterface, data)
}
addMockConfigurations (data: AddMockConfigurationsRequest): any {
return this.send(AddMockSchema as SchemaInterface, data)
}
changeMockValueConfiguration (data: ChangeMockConfigurationValueRequest): any {
return this.send(ChangeMockValueSchema as SchemaInterface, data)
}
toggleNewClientType (data: ToggleNewClientTypeRequest): any {
return this.send(ToggleNewClientTypeSchema as SchemaInterface, data)
}
toggleRegularClientType (data: ToggleRegularClientTypeRequest): any {
return this.send(ToggleRegularClientTypeSchema as SchemaInterface, data)
}
userIdentificationByIdenfyType (data: UserIdentificationByIdenfyRequest): any {
return this.send(UserIdentificationByIdenfySchema as SchemaInterface, data)
}
}
export default new HttpClient('http://placetgroup.sipachev.sv')
.addHandler(new TokenRequestHandler())

@ -1,17 +0,0 @@
export class MockConfiguration {
personalCode!: string
code!: string
value!: number
active!: string
}
export class AddMockConfigurationsRequest {
items!: MockConfiguration[]
}
export default {
code: 'api_plugin_add_configurations',
method: 'POST',
url: '/plugin/mock-configurations',
prefix: 'mockConfigurations'
}

@ -1,11 +0,0 @@
export class ChangeMockConfigurationValueRequest {
id!: string
value!: string
}
export default {
code: 'api_plugin_change_configuration_value',
method: 'PATCH',
url: '/plugin/mock-configurations/{id}/value',
prefix: 'mockConfigurations'
}

@ -1,9 +0,0 @@
export class MockConfigurationsRequest {
personalCode!: string
}
export default {
code: 'api_plugin_get_configurations',
method: 'GET',
url: '/plugin/mock-configurations'
}

@ -1,9 +0,0 @@
export class ToggleNewClientTypeRequest {
personalCode!: string
}
export default {
code: 'api_plugin_toggle_new_client_type',
method: 'POST',
url: '/plugin/user/{personalCode}/toggleNewClientType'
}

@ -1,9 +0,0 @@
export class ToggleRegularClientTypeRequest {
personalCode!: string
}
export default {
code: 'api_plugin_toggle_regular_client_type',
method: 'POST',
url: '/plugin/user/{personalCode}/toggleRegularClientType'
}

@ -1,9 +0,0 @@
export class UserIdentificationByIdenfyRequest {
user!: string
}
export default {
code: 'api_post_user_identification_by_indefy',
method: 'POST',
url: '/plugin/users/{user}/identificationByIdenfy'
}

@ -1,7 +0,0 @@
export interface SchemaInterface {
code: string;
method: string;
url: string;
stub: any;
prefix?: string;
}

@ -1,18 +0,0 @@
export class Registers {
xtee_mta = ''
ria = ''
scoring = ''
scoring_d = ''
xtee_pension = ''
reset () {
// eslint-disable-next-line @typescript-eslint/camelcase
this.xtee_mta = ''
this.ria = ''
this.scoring = ''
// eslint-disable-next-line @typescript-eslint/camelcase
this.scoring_d = ''
// eslint-disable-next-line @typescript-eslint/camelcase
this.xtee_pension = ''
}
}

@ -2,16 +2,16 @@ import { Country } from '@/classes/Enum/Country'
export class IbanGenerator { export class IbanGenerator {
generate (country: Country) { generate (country: Country) {
const shortBankAccount = this.getBankAccount(country) const t = this.getBankAccount(country)
const bankCode = this.getBankCode(country) const n = this.getNationalCheckDigit(t)
const estonianCheckDigit = this.getEstonianCheckDigit(bankCode + shortBankAccount) const r = this.getBankCode(country)
switch (country) { switch (country) {
case Country.ESTONIA: case Country.ESTONIA:
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + estonianCheckDigit + '141400') + bankCode + shortBankAccount + estonianCheckDigit return country.toUpperCase() + this.getIbanCheckDigits(r + t + n + '141400') + r + t + n
case Country.LITHUANIA: case Country.LITHUANIA:
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + '212900') + bankCode + shortBankAccount return country.toUpperCase() + this.getIbanCheckDigits(r + t + '212900') + r + t
default: default:
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + '252100') + bankCode + shortBankAccount return country.toUpperCase() + this.getIbanCheckDigits(r + t + '252100') + r + t
} }
} }
@ -26,50 +26,36 @@ export class IbanGenerator {
return t + String(i - (o % i)).padStart(2, '0') 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]
* @param bban c 5 знака 16 символов const n = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
* @return одну цифру let r = 0
*/ const i = e.length
getEstonianCheckDigit (bban: string) { let o = 18
const toCheck = bban.substring(2, 15) for (let a = i - 1; a > -1; a--) {
const weights = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7] n[o] = t[o] * +e[a]
o--
let sum = 0 }
for (let index = 0; index < toCheck.length; index++) { o = 18
sum += parseInt(toCheck.charAt(index), 10) * weights[index] for (let a = i - 1; a > -1; a--) {
r -= -n[o]
o--
} }
const remainder = sum % 10
return remainder === 0 ? 0 : 10 - remainder return String(r % 10 !== 0 ? 10 - r % 10 : 0)
}; }
getBankCode (country: Country) { getBankCode (e: Country) {
const plBankCodes = [ const t = ['16000003', '11602231', '10301612', '18900002', '15002240', '19401018', '19101152']
'16000003', // (BNPPL Centrala) BNP PARIBAS BANK POLSKA SA Centrala const n = ['2200', '1010', '3300', '7700', '1700', '4204']
'11602231', // Bank Millennium SA Bankowy Punkt Rozlicze Nr 4 const r = ['20900', '72900', '74000', '40100', '21200', '72300', '21700', '21400', '70440', '71800', '73000']
'10301612', // BH Regionalne Centrum Rozliczeń switch (e) {
'18900002', // HYPO Centrala
'15002240', // KBSA O. w Ełku
'19401018', // CABP F. nr 3 we Wrocławiu
'19101152'
]
const eeBankCodes = [
'2200', // Swedbank
'1010', // SEB
'3300', // Danske Bank A/S Eesti filiaal (Sampo Pank)
'7700', // LHV Pank
'1700', // Luminor
'4204' // COOP Bank
]
const ltBankCodes = ['20900', '72900', '74000', '40100', '21200', '72300', '21700', '21400', '70440', '71800', '73000']
switch (country) {
case Country.POLAND: case Country.POLAND:
return plBankCodes[Math.floor(Math.random() * plBankCodes.length)] return t[Math.floor(Math.random() * t.length)]
case Country.ESTONIA: case Country.ESTONIA:
return eeBankCodes[Math.floor(Math.random() * eeBankCodes.length)] return n[Math.floor(Math.random() * n.length)]
default: default:
return ltBankCodes[Math.floor(Math.random() * ltBankCodes.length)] return r[Math.floor(Math.random() * r.length)]
} }
} }

@ -8,33 +8,29 @@ export class PersonalIdGenerator {
* @param person * @param person
*/ */
generate (person: Person) { generate (person: Person) {
const fullYear = this.grabFullYear(person.birthday.year) const year = this.getYearPart(person.birthday.year)
const year = this.getYearPart(fullYear)
const month = this.getMonthPart(person.birthday.month) const month = this.getMonthPart(person.birthday.month)
const day = this.getDayPart(person.birthday.day) const day = this.getDayPart(person.birthday.day)
const o = this.getIdNumPart() const o = this.getIdNumPart()
const a = this.getGenderPart(person.country, person.gender, fullYear) const a = this.getGenderPart(person.country, person.gender)
const l = this.getControlSum(person.country, year, month, day, o, a) const l = this.getControlSum(person.country, year, month, day, o, a)
const l2 = this.getChecksum(a + year + month + day + o) const l2 = this.getChecksum(a + year + month + day + o)
return a + year + month + day + o + l2 return a + year + month + day + o + l2
} }
grabFullYear (year: bigint | null): bigint {
if (!year) {
const e = (new Date()).getFullYear()
year = BigInt(randomGenerator.generate(e - 25, e - 55))
}
return year
}
/** /**
* e.getYearPart = function () { * e.getYearPart = function () {
var e = (new Date).getFullYear(); var e = (new Date).getFullYear();
return String(Iu.generate(e - 25, e - 55)).substring(2, 4) return String(Iu.generate(e - 25, e - 55)).substring(2, 4)
}, },
*/ */
getYearPart (year: bigint) { getYearPart (year: bigint | null) {
if (!year) {
const e = (new Date()).getFullYear()
year = BigInt(randomGenerator.generate(e - 25, e - 55))
}
return String(year).substring(2, 4) return String(year).substring(2, 4)
} }
@ -84,11 +80,9 @@ export class PersonalIdGenerator {
}, },
* @param country * @param country
* @param gender * @param gender
* @param year
*/ */
getGenderPart (country: Country, gender: Gender, year: bigint) { getGenderPart (country: Country, gender: Gender) {
console.log(country, gender) console.log(country, gender)
let tempGender = gender
switch (country) { switch (country) {
case Country.POLAND: case Country.POLAND:
console.log(country) console.log(country)
@ -97,11 +91,7 @@ export class PersonalIdGenerator {
: String(2 * randomGenerator.generate(1, 4)) : String(2 * randomGenerator.generate(1, 4))
default: default:
console.log(gender, Gender.MALE === gender) console.log(gender, Gender.MALE === gender)
if (Gender.RANDOM === gender) { return Gender.MALE === gender ? '3' : '4'
tempGender = randomGenerator.generate(1, 999) > 500 ? Gender.FEMALE : Gender.MALE
}
console.log(year, 'year', typeof year)
return Gender.MALE === tempGender ? (year < 2000 ? '3' : '5') : (year < 2000 ? '4' : '6')
} }
} }

@ -1,19 +1,19 @@
export class NotificationCleaner { export class NotificationCleaner {
enable () { enable () {
chrome.storage && chrome.storage.sync.set({ 'need-clean-notification': true }, function () { chrome.storage.sync.set({ 'need-clean-notification': true }, function () {
console.log('need-clean-notification: ' + true) console.log('need-clean-notification: ' + true)
}) })
} }
disable () { disable () {
chrome.storage && chrome.storage.sync.set({ 'need-clean-notification': false }, function () { chrome.storage.sync.set({ 'need-clean-notification': false }, function () {
console.log('need-clean-notification: ' + false) console.log('need-clean-notification: ' + false)
}) })
} }
state (): Promise<boolean> { state (): Promise<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
chrome.storage && chrome.storage.sync.get(['need-clean-notification'], function (result) { chrome.storage.sync.get(['need-clean-notification'], function (result) {
console.log('Value currently is ' + result['need-clean-notification']) console.log('Value currently is ' + result['need-clean-notification'])
resolve(result['need-clean-notification'] || false) resolve(result['need-clean-notification'] || false)
}) })

@ -1,4 +0,0 @@
<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>

@ -1,37 +0,0 @@
import { Component, Vue } from 'vue-property-decorator'
import { Person } from '@/classes/DTO/Person'
import VueClipboard from 'vue-clipboard2'
import sender from '@/classes/Service/Browser/Chrome/Sender'
import { Action } from '@/classes/Enum/Action'
import notificationCleaner from '@/classes/Service/NotificationCleaner'
Vue.use(VueClipboard)
@Component
export default class HelloWorld extends Vue {
person = new Person()
isAutoCleaner = false
mounted () {
/** todo заполнить первоначальное значение */
notificationCleaner.state().then((isAutoCleaner) => {
this.isAutoCleaner = isAutoCleaner
console.log('this.isAutoCleaner = ' + isAutoCleaner)
})
}
cleanNotifications (): void {
sender.send({
action: Action.CLEAN_NOTIFICATION
})
}
onChangeAutoCleaner () {
console.log(this.isAutoCleaner)
if (this.isAutoCleaner) {
notificationCleaner.enable()
} else {
notificationCleaner.disable()
}
}
}

@ -1,65 +0,0 @@
.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;
margin-right: 10px;
&-input {
width: 100%;
}
}
&:last-child {
margin-bottom: 0;
}
}
}
}
.memory-panel {
text-align: left;
padding: 5px;
margin-top: 10px;
}
}
}

@ -1,17 +0,0 @@
<div>
<div class="form-row">
<div class="form-row__item">
<label>
Use notification cleaner
<input @change="onChangeAutoCleaner" type="checkbox" v-model="isAutoCleaner">
</label>
</div>
</div>
<div class="form-row">
<div class="form-row__item">
<button
@click="cleanNotifications"
>Clean</button>
</div>
</div>
</div>

@ -1,4 +0,0 @@
<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>

@ -1,14 +0,0 @@
import { Component, Vue } from 'vue-property-decorator'
import VueClipboard from 'vue-clipboard2'
import Mocks from '@/components/mocks/main.vue'
Vue.use(VueClipboard)
@Component({
components: {
Mocks
}
})
export default class MocksTab extends Vue {
personalCode = ''
}

@ -1,65 +0,0 @@
.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;
margin-right: 10px;
&-input {
width: 100%;
}
}
&:last-child {
margin-bottom: 0;
}
}
}
}
.memory-panel {
text-align: left;
padding: 5px;
margin-top: 10px;
}
}
}

@ -1,10 +0,0 @@
<div>
<label>
Personal id
<input type="text" v-model="personalCode"/>
</label>
<div v-if="personalCode">
<hr />
<Mocks :mode="'update'" :personalCode="personalCode"></Mocks>
</div>
</div>

@ -1,4 +0,0 @@
<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>

@ -1,142 +0,0 @@
import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
import VueClipboard from 'vue-clipboard2'
import { Registers } from '@/classes/DTO/Registers'
import httpClient from '@/api/Main/HttpClient'
import { MockConfiguration } from '@/api/Main/Schemas/AddMockSchema'
Vue.use(VueClipboard)
export enum Mode {
ADD = 'add',
UPDATE = 'update',
}
@Component
export default class Mocks extends Vue {
@Prop()
personalCode!: string
@Prop()
mode!: Mode
showLoader = false
isHidden = false
registers = new Registers()
register2Id: Record<string, string> = {}
mounted () {
console.log('mounted', this.personalCode)
}
@Watch('personalCode', { immediate: true })
onPersonalCodeChanged () {
this.registers.reset()
this.showLoader = false
this.isHidden = false
this.refreshMocks()
}
refreshMocks () {
if (this.mode !== Mode.UPDATE) {
return
}
this.showLoader = true
httpClient.mockConfigurations({ personalCode: this.personalCode })
.then((data: any) => {
const existServiceKeys = []
for (const mockConfiguration of data.data) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.registers[mockConfiguration.code] = mockConfiguration.value
this.register2Id[mockConfiguration.code] = mockConfiguration.id
existServiceKeys.push(mockConfiguration.code)
}
for (const serviceCode in this.registers) {
if (existServiceKeys.indexOf(serviceCode) > -1) {
continue
}
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.registers[serviceCode] = ''
delete this.register2Id[serviceCode]
}
})
.then(() => {
this.showLoader = false
})
}
async onServiceChanged (serviceKey: string) {
if (this.mode !== Mode.UPDATE) {
return
}
if (typeof this.register2Id[serviceKey] === 'undefined') {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
await this.saveMock(this.personalCode, serviceKey, Number(this.registers[serviceKey]))
await this.refreshMocks()
return
}
this.showLoader = true
httpClient.changeMockValueConfiguration({
id: this.register2Id[serviceKey],
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
value: this.registers[serviceKey]
})
.then((data: any) => {
console.log('updateMock')
console.log(data)
})
.then(() => {
this.showLoader = false
})
}
saveMocks () {
const mockConfigurations: MockConfiguration[] = []
for (const serviceCode in this.registers) {
const mockConfiguration = new MockConfiguration()
mockConfiguration.personalCode = this.personalCode
mockConfiguration.code = serviceCode
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
mockConfiguration.value = this.registers[serviceCode]
if (!mockConfiguration.value) {
continue
}
mockConfiguration.active = 'true'
mockConfigurations.push(mockConfiguration)
}
this.showLoader = true
httpClient.addMockConfigurations({ items: mockConfigurations })
.then((data: any) => {
console.log('saveMocks')
console.log(data)
})
.then(() => {
this.showLoader = false
this.isHidden = true
})
}
saveMock (personalCode: string, serviceCode: string, value: number): Promise<any> {
const mockConfigurations: MockConfiguration[] = []
const mockConfiguration = new MockConfiguration()
mockConfiguration.personalCode = personalCode
mockConfiguration.code = serviceCode
mockConfiguration.value = value
mockConfiguration.active = 'true'
mockConfigurations.push(mockConfiguration)
this.showLoader = true
return httpClient.addMockConfigurations({ items: mockConfigurations })
.then((data: any) => {
console.log('saveMocks')
console.log(data)
})
.then(() => {
this.showLoader = false
})
}
}

@ -1,75 +0,0 @@
.option-select {
width: 350px;
}
.mock-service__select {
margin-bottom: 5px;
}
.lds-grid {
display: inline-block;
position: relative;
width: 80px;
height: 80px;
}
.lds-grid div {
position: absolute;
width: 16px;
height: 16px;
border-radius: 50%;
background: #298df8;
animation: lds-grid 1.2s linear infinite;
}
.lds-grid div:nth-child(1) {
top: 8px;
left: 8px;
animation-delay: 0s;
}
.lds-grid div:nth-child(2) {
top: 8px;
left: 32px;
animation-delay: -0.4s;
}
.lds-grid div:nth-child(3) {
top: 8px;
left: 56px;
animation-delay: -0.8s;
}
.lds-grid div:nth-child(4) {
top: 32px;
left: 8px;
animation-delay: -0.4s;
}
.lds-grid div:nth-child(5) {
top: 32px;
left: 32px;
animation-delay: -0.8s;
}
.lds-grid div:nth-child(6) {
top: 32px;
left: 56px;
animation-delay: -1.2s;
}
.lds-grid div:nth-child(7) {
top: 56px;
left: 8px;
animation-delay: -0.8s;
}
.lds-grid div:nth-child(8) {
top: 56px;
left: 32px;
animation-delay: -1.2s;
}
.lds-grid div:nth-child(9) {
top: 56px;
left: 56px;
animation-delay: -1.6s;
}
@keyframes lds-grid {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}

@ -1,69 +0,0 @@
<div v-if="!isHidden">
<div v-if="showLoader" class="lds-grid"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div v-if="!showLoader">
<div class="mock-service__select">
<div>MTA</div>
<div>
<select class="option-select" v-model="registers.xtee_mta" @change="onServiceChanged('xtee_mta')">
<option value="-1">-</option>
<option value="0">Не замокано (делать запрос)</option>
<option value="1">Выписка на хороший доход</option>
<option value="2">Выписка на маленький доход</option>
<option value="3">Ошибка загрузки выписки (перезапрос)</option>
<option value="4">Ошибка загрузки выписки (нет данных)</option>
<option value="5">По персональному коду (3 - выписка с хорошим доходом, остальные - ошибка загрузки выписки)</option>
<option value="6">Выписка на хороший доход, последние два месяца доход 0</option>
<option value="7">Выписка на хороший доход, последний месяц доход 0</option>
<option value="8">Выписка на хороший доход, но у пользователя нет активного работодателя. Не можем выдать</option>
<option value="9">Выписка на хороший доход, в выписке есть выплаты, которые не учитываются в подсчёте среднего дохода</option>
<option value="10">Выписка на хороший доход, в выписке нет дохода "зарплата" и его производных.</option>
<option value="11">Выписка на хороший доход, у пользователя нет активного работодателя, пользователь самозанятый</option>
</select>
</div>
</div>
<div class="mock-service__select">
<div>Ria</div>
<div>
<select class="option-select" v-model="registers.ria" @change="onServiceChanged('ria')">
<option value="-1">-</option>
<option value="0">Не замокано (делать запрос)</option>
<option value="1">Успешный запрос</option>
<option value="2">Все запросы отклонены</option>
<option value="3">По персональному коду (3 - успешно, остальные - ошибка)</option>
</select>
</div>
</div>
<div class="mock-service__select">
<div>Scoring</div>
<div>
<select class="option-select" v-model="registers.scoring" @change="onServiceChanged('scoring')">
<option value="-1">-</option>
<option value="0">Не замокано</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
<option value="5">E</option>
<option value="6">F</option>
</select>
</div>
</div>
<div class="mock-service__select">
<div>Scoring D</div>
<div>
<select class="option-select" v-model="registers.scoring_d" @change="onServiceChanged('scoring_d')">
<option value="-1">-</option>
<option value="0">Не замокано</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
<option value="5">E</option>
<option value="6">F</option>
</select>
</div>
</div>
<br />
<button v-if="'add' === mode" @click="saveMocks">Сохранить моки</button>
</div>
</div>

@ -1,4 +0,0 @@
<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>

@ -1,93 +0,0 @@
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'
import { Action } from '@/classes/Enum/Action'
import Mocks from '@/components/mocks/main.vue'
import countryResolver from '@/api/CountryResolver'
Vue.use(VueClipboard)
@Component({
components: {
Mocks
}
})
export default class PersonTab extends Vue {
personalCode = ''
person = new Person()
copyText = ''
async mounted () {
this.person.country = await countryResolver.resolve()
}
get allowedMonths () {
const result = []
for (let i = 1; i <= 12; i++) {
result.push(i)
}
return result
}
get allowedYears () {
const result = []
const currentYear = (new Date()).getFullYear()
for (let i = 1930; i <= currentYear; i++) {
result.push(i)
}
return result
}
copyPersonalCode () {
const personalCode = personalIdGenerator.generate(this.person)
this.personalCode = personalCode
this.copy(personalCode)
}
copyIban () {
const iban = ibanGenerator.generate(this.person.country)
this.personalCode = ''
this.copy(iban)
}
copyPhone () {
const phone = phoneGenerator.generate(this.person.country)
this.personalCode = ''
this.copy(phone)
}
copy (text: string) {
this.copyText = text
this.$copyText(text)
}
autocomplete () {
const personalCode = personalIdGenerator.generate(this.person)
this.personalCode = personalCode
this.copy(personalCode)
this.insertValueToNode(Target.PERSONAL_ID, personalCode)
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({
action: Action.INSERT,
target: target,
value: value
})
}
}

@ -1,65 +0,0 @@
.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;
margin-right: 10px;
&-input {
width: 100%;
}
}
&:last-child {
margin-bottom: 0;
}
}
}
}
.memory-panel {
text-align: left;
padding: 5px;
margin-top: 10px;
}
}
}

@ -1,65 +0,0 @@
<div>
<div class="form-row">
<div class="form-row__item">
<input title="Day" class="form-row__item-input" type="text" v-model="person.birthday.day" placeholder="Day">
</div>
<div class="form-row__item">
<select title="Month" v-model="person.birthday.month">
<option v-for="allowedMonth in allowedMonths" :value="allowedMonth">{{ allowedMonth }}</option>
</select>
</div>
<div class="form-row__item">
<select title="Year" v-model="person.birthday.year">
<option v-for="allowedYear in allowedYears" :value="allowedYear">{{ allowedYear }}</option>
</select>
</div>
</div>
<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="copyPersonalCode"
class="form-row__item copy-button" data-clipboard-text="text2">
<button>personalCode</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 class="memory-panel">Memory: {{copyText}}</div>
<div v-if="personalCode">
<hr />
<Mocks :mode="'add'" :personalCode="personalCode"></Mocks>
</div>
</div>

@ -1,27 +1,103 @@
import { Component, Vue } from 'vue-property-decorator' 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 VueClipboard from 'vue-clipboard2'
import Mocks from '@/components/mocks/main.vue' import { Target } from '@/classes/Enum/Target'
import PersonTab from '@/components/person-tab/main.vue' import sender from '@/classes/Service/Browser/Chrome/Sender'
import MocksTab from '@/components/mocks-tab/main.vue' import { Action } from '@/classes/Enum/Action'
import EmberTab from '@/components/ember-tab/main.vue' import notificationCleaner from '@/classes/Service/NotificationCleaner'
import UserTab from '@/components/user-tab/main.vue'
Vue.use(VueClipboard) Vue.use(VueClipboard)
@Component({ @Component
components: {
Mocks,
PersonTab,
MocksTab,
EmberTab,
UserTab
}
})
export default class HelloWorld extends Vue { export default class HelloWorld extends Vue {
tab = 'person' tab = 'person'
person = new Person()
isAutoCleaner = false
copyText = ''
get allowedMonths () {
const result = []
for (let i = 1; i <= 12; i++) {
result.push(i)
}
return result
}
get allowedYears () {
const result = []
const currentYear = (new Date()).getFullYear()
for (let i = 1960; i <= currentYear; i++) {
result.push(i)
}
return result
}
mounted () {
/** todo заполнить первоначальное значение */
notificationCleaner.state().then((isAutoCleaner) => {
this.isAutoCleaner = isAutoCleaner
console.log('this.isAutoCleaner = ' + isAutoCleaner)
})
}
copyPersonalId () {
const personalId = personalIdGenerator.generate(this.person)
this.copy(personalId)
}
copyIban () {
const iban = ibanGenerator.generate(this.person.country)
this.copy(iban)
}
copyPhone () {
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)
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)
}
isPlugin (): boolean { insertValueToNode (target: Target, value: string): void {
console.log(chrome) sender.send({
return !!chrome.tabs action: Action.INSERT,
target: target,
value: value
})
}
cleanNotifications (): void {
sender.send({
action: Action.CLEAN_NOTIFICATION
})
}
onChangeAutoCleaner () {
console.log(this.isAutoCleaner)
if (this.isAutoCleaner) {
notificationCleaner.enable()
} else {
notificationCleaner.disable()
}
} }
} }

@ -50,7 +50,7 @@
} }
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0px;
} }
} }
} }
@ -61,9 +61,5 @@
padding: 5px; padding: 5px;
margin-top: 10px; margin-top: 10px;
} }
.option-select {
width: 350px;
}
} }
} }

@ -2,33 +2,91 @@
<div class="wrapper"> <div class="wrapper">
<div class="tab-panel"> <div class="tab-panel">
<div @click="tab = 'person'" class="tab-panel__item" <div @click="tab = 'person'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'person'}"> :class="{'tab-panel__item_active': tab === 'person'}">Person
Person
</div> </div>
<div @click="personalId=''; tab = 'mocks'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'mocks'}"> <div @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
Mocks
</div>
<div v-if="isPlugin()" @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
Ember Ember
</div> </div>
<div @click="tab = 'user'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'user'}">
User
</div>
</div> </div>
<div class="tab-page"> <div class="tab-page">
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'person'}"> <div class="tab-page__item" :class="{'tab-page__item_show': tab === 'person'}">
<PersonTab/> <div class="form-row">
<div class="form-row__item">
<input title="Day" class="form-row__item-input" type="text" v-model="person.birthday.day" placeholder="Day">
</div>
<div class="form-row__item">
<select title="Month" v-model="person.birthday.month">
<option v-for="allowedMonth in allowedMonths" :value="allowedMonth">{{ allowedMonth }}</option>
</select>
</div>
<div class="form-row__item">
<select title="Year" v-model="person.birthday.year">
<option v-for="allowedYear in allowedYears" :value="allowedYear">{{ allowedYear }}</option>
</select>
</div>
</div>
<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 @change="onChangeAutoCleaner" type="checkbox" v-model="isAutoCleaner">
</label>
</div>
</div> </div>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'mocks'}"> <div class="form-row">
<MocksTab/> <div class="form-row__item">
<button
@click="cleanNotifications"
>Clean</button>
</div> </div>
<div v-if="isPlugin()" class="tab-page__item" :class="{'tab-page__item_show': tab === 'ember'}">
<EmberTab/>
</div> </div>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'user'}">
<userTab/>
</div> </div>
</div> </div>
<div class="memory-panel">Memory: {{copyText}}</div>
</div> </div>
</div> </div>

@ -1,4 +0,0 @@
<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>

@ -1,59 +0,0 @@
import { Component, Prop, Vue } from 'vue-property-decorator'
import VueClipboard from 'vue-clipboard2'
import httpClient from '@/api/Main/HttpClient'
import { ToggleNewClientTypeRequest } from '@/api/Main/Schemas/ToggleNewClientTypeSchema'
import { UserIdentificationByIdenfyRequest } from '@/api/Main/Schemas/UserIdentificationByIdenfySchema'
Vue.use(VueClipboard)
@Component
export default class UserTab extends Vue {
@Prop()
clientTypeUpdate!: string
personalCode!: string
user!: string
clientType = 'New';
copyText = '';
update () {
if (this.clientType === 'New') {
const newToggle = new ToggleNewClientTypeRequest()
newToggle.personalCode = this.personalCode
httpClient.toggleNewClientType(newToggle)
} else {
const regularToggle = new ToggleNewClientTypeRequest()
regularToggle.personalCode = this.personalCode
httpClient.toggleRegularClientType(regularToggle)
}
}
identificationByIdenfy () {
const userIdentificationByIdenfy = new UserIdentificationByIdenfyRequest()
userIdentificationByIdenfy.user = this.user
httpClient.userIdentificationByIdenfyType(userIdentificationByIdenfy).then((data: any) => {
this.copyText = data.data.url
})
}
setClientType (event: FocusEvent) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.clientType = event.target.value
}
setPersonalCode (event: FocusEvent) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.personalCode = event.target.value
}
setUserId (event: FocusEvent) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.user = event.target.value
}
}

@ -1,65 +0,0 @@
.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;
margin-right: 10px;
&-input {
width: 100%;
}
}
&:last-child {
margin-bottom: 0;
}
}
}
}
.memory-panel {
text-align: left;
padding: 5px;
margin-top: 10px;
}
}
}

@ -1,37 +0,0 @@
<div>
<div class="form-row">
<div class="form-row__item">
<input title="Personal code" class="form-row__item-input" type="text" placeholder="Personal code" v-on:change="setPersonalCode">
<input type="radio" id="client_type_new"
name="client_type" value="New" checked v-on:focus="setClientType">
<label for="client_type_new">New</label>
<input type="radio" id="client_type_regular"
name="client_type" value="Regular" v-on:focus="setClientType">
<label for="client_type_regular">Regular</label>
</div>
</div>
<div class="form-row">
<label>
<input type="button" v-on:click="update" value="Update"/>
</label>
</div>
<div class="form-row"></div>
<div class="form-row">
<div class="form-row__item">
<input title="User id" class="form-row__item-input" type="text" placeholder="User id" v-on:change="setUserId">
</div>
<div class="form-row__item">
<label>
<input type="button" v-on:click="identificationByIdenfy" value="Identification by Idenfy"/>
</label>
</div>
</div>
<div class="form-row__item">
<div class="memory-panel">Url: {{copyText}}</div>
</div>
</div>

@ -1,3 +0,0 @@
export enum FlowEnum {
base
}

@ -1,11 +0,0 @@
import { FlowEnum } from '@/stubs/FlowEnum'
import MocksSchema from '@/api/Main/Schemas/MocksSchema'
import MocksSchemaSuccess from '@/stubs/stubs/Main/MocksSchema/MocksSchemaSuccess'
const map: Record<string, any> = {}
// Регистрируем базовые успешные заглуши
map[FlowEnum.base] = {}
map[FlowEnum.base][MocksSchema.code] = MocksSchemaSuccess
export default map

@ -1,24 +0,0 @@
import { flow, useStub } from '@/stubs/config'
import map from '@/stubs/Stub2Flow'
export class StubResolver {
handle (routeCode: string): Promise<any> | null {
if (!useStub) {
return null
}
const hasFlow = flow in map || false
if (!hasFlow) {
throw new Error('Flow not found!!! Change flow in @/stubs/config.ts')
}
const availableStubs = map[flow]
const hasRoute = routeCode in availableStubs || false
if (!hasRoute) {
throw new Error('Route`s stub not found!!! Add stub or change flow to check application')
}
return availableStubs[routeCode]
// return new Promise(() => {})
}
}
export default new StubResolver()

@ -1,4 +0,0 @@
import { FlowEnum } from '@/stubs/FlowEnum'
export const useStub = false
export const flow = FlowEnum.base

@ -1,20 +0,0 @@
import { AxiosResponse } from 'axios'
export default new Promise((resolve) => {
const response = {
data: [
{
id: 'casdasdc34c342cr341c34r123d',
personalId: '48907031677',
code: 'xtee_mta',
value: '2',
active: true
}
],
status: 200,
statusText: 'OK',
headers: {},
config: {}
} as AxiosResponse
resolve(response)
})

@ -2322,13 +2322,6 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axios@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
dependencies:
follow-redirects "^1.14.8"
babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0" version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@ -5095,11 +5088,6 @@ follow-redirects@^1.0.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147"
integrity sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA== integrity sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==
follow-redirects@^1.14.8:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
for-each@^0.3.3: for-each@^0.3.3:
version "0.3.3" version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"

Loading…
Cancel
Save