Compare commits

..

59 Commits

Author SHA1 Message Date
Dmitriev Alexander a9d9a93ed0 PLG-7746 - Если по ЕМТА клиент безработный, то не отклонять есди он FIE - опция для самозанятых 12 months ago
Suhorukov eda7177716 PGT-1577 -- [Sveak extension] Add idenfy mock 1 year ago
Sipachev Igor f8ddeedf9d Поменял список вариантов дат 1 year ago
Valkov Dmitry 886440a0c6 Правка iban-генератора (сборка) 2 years ago
Valkov Dmitry 85901209dd Правка iban-генератора 2 years ago
Suhorukov eb7bd0067a PGT-1371 -- Добавить на dev возможность перевести клиента из Нового в Постоянного 2 years ago
Suhorukov 79cb7feec9 PGT-1371 -- Добавить на dev возможность перевести клиента из Нового в Постоянного 2 years ago
Sipachev Igor 2153296023 Сгенерил прод версию 2 years ago
Sipachev Igor 36922eb4b7 Добавил новый варинт мока для мта 2 years ago
Sipachev Igor bae8e6fbe6 Сгенерировал прод версию 2 years ago
Sipachev Igor 20d89cbb0e Настроил скрытие формы после успешного добавления 2 years ago
Sipachev Igor 6bb6835145 Сгенерил прод версию 2 years ago
Sipachev Igor d4a7dbeb08 оменял логику определения сервера 2 years ago
Sipachev Igor a6bdaac2ef Добавил d скоринг 2 years ago
Sipachev Igor a254fc7b7d сгенерил прод версию 2 years ago
Sipachev Igor d902bbc872 вернул список 2 years ago
Sipachev Igor febf87c5fb Сгенерировал прод версию 3 years ago
Sipachev Igor 668a0bc20e Проинтегрировал скоринг 3 years ago
Sipachev Igor 10da8bb075 Добавил автоопределение страны 3 years ago
Sipachev Igor 8b8c0d64f4 Добавил автоопределение страны 3 years ago
Sipachev Igor 576dfd3c5d обновил прод версию библиотеки 3 years ago
Sipachev Igor 5672773345 Добавил лоадер 3 years ago
Sipachev Igor f2fcce4646 обновил прод версию библиотеки 3 years ago
Sipachev Igor 93e78e2b77 Настроил добавление для ранее существующего кода 3 years ago
Sipachev Igor 0ebbee5e23 Сгенерировал прод версию 3 years ago
Sipachev Igor e7ada8774d Добавил значение без мока 3 years ago
Sipachev Igor efaca5ca2c вернул интервал годов для персонального кода, чтобы чаще выпадали нормальные кода по которым можно получить кредит 3 years ago
Sipachev Igor 338258a753 Сгенерировал прод версию 3 years ago
Sipachev Igor bc356f6cfa Настроил синхронизацию домена до запроса 3 years ago
Sipachev Igor 1146bf8f3b сгенерировал прод версию 3 years ago
Sipachev Igor e5c055cdc2 Доработал резолвер доменов для режима вне плагина 3 years ago
Sipachev Igor 3658044216 Сгенерировал прод версию 3 years ago
Sipachev Igor 6e5b768904 Адаптировал чтобы работало вне плагина 3 years ago
Sipachev Igor 46172dace0 Сгенерировал прод версию 3 years ago
Sipachev Igor b2c297a7fd Убрал лишние запросы 3 years ago
Sipachev Igor 3411794a08 рефакторинг года 3 years ago
Sipachev Igor 4e7a1adf56 Сгенерировал новую версию 3 years ago
Sipachev Igor 00e81a8f49 поправил выбор пола 3 years ago
Sipachev Igor c9c12a3d02 поправил рассчет кода 3 years ago
Sipachev Igor bd7f1e436e сгенерировал новую версию плагина 3 years ago
Sipachev Igor 420eb3973b Попарвил рассчет кода 3 years ago
Sipachev Igor 97bb8653d1 сгенерил новую версию для прод 3 years ago
Sipachev Igor 993caaea23 Поправил хэдер аутентификации 3 years ago
Sipachev Igor 4a3a8c430c сгенерировал прод версию 3 years ago
Sipachev Igor 28555b58a3 Поправил верстку 3 years ago
Sipachev Igor b89b96ebbe Поправил рассчет доменов 3 years ago
Sipachev Igor 77408cdb73 добавил домен резолвер 3 years ago
Sipachev Igor ae75816951 Проинтегрировал ria 3 years ago
Sipachev Igor 2c0d4ba69a Проинтегрировал обновление моков 3 years ago
Sipachev Igor 47c51fb5fa Настроил использование внешнего апи. 3 years ago
Sipachev Igor 5461b2241b Рабочий вариант с моками 3 years ago
Sipachev Igor b83319aa26 Убрал регистр пенса. пока не проинтегрирован на бэкенде 3 years ago
Sipachev Igor 43339e6a92 Добавил механизм работы с апи 3 years ago
Sipachev Igor 5b0960da0c Вынес таб в компонент 3 years ago
Sipachev Igor ea4fcae1b9 Вынес таб в компонент 3 years ago
Sipachev Igor 6b45516d94 Вынес таб в компонент 3 years ago
Sipachev Igor b6e5d9199c Вынес моки в компонент 3 years ago
Sipachev Igor 1fec9d9408 Добавил интерфейс поиска моков 3 years ago
Sipachev Igor e427e02098 Добавил интерфейс сохранения моков 3 years ago
  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,
"permissions": [ "tabs", "contextMenus", "\u003Call_urls>", "storage" ],
"short_name": "SVEAK helper",
"version": "1.0.0",
"version": "1.0.1",
"commands": {
"_execute_browser_action": {
"suggested_key": {

File diff suppressed because one or more lines are too long

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

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

@ -1,26 +0,0 @@
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(
"/precache-manifest.ea391085ddd36de2a7ecbc5dff885460.js"
"/precache-manifest.0e568ea1504b4c258da6e583c00648bc.js"
);
workbox.core.setCacheNameDetails({prefix: "sveak-helper"});

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

@ -0,0 +1,40 @@
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()

@ -0,0 +1,54 @@
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()

@ -0,0 +1,11 @@
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()

@ -0,0 +1,123 @@
/* 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
}
}

@ -0,0 +1,38 @@
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())

@ -0,0 +1,17 @@
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'
}

@ -0,0 +1,11 @@
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'
}

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

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

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

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

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

@ -0,0 +1,18 @@
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 {
generate (country: Country) {
const t = this.getBankAccount(country)
const n = this.getNationalCheckDigit(t)
const r = this.getBankCode(country)
const shortBankAccount = this.getBankAccount(country)
const bankCode = this.getBankCode(country)
const estonianCheckDigit = this.getEstonianCheckDigit(bankCode + shortBankAccount)
switch (country) {
case Country.ESTONIA:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + n + '141400') + r + t + n
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + estonianCheckDigit + '141400') + bankCode + shortBankAccount + estonianCheckDigit
case Country.LITHUANIA:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + '212900') + r + t
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + '212900') + bankCode + shortBankAccount
default:
return country.toUpperCase() + this.getIbanCheckDigits(r + t + '252100') + r + t
return country.toUpperCase() + this.getIbanCheckDigits(bankCode + shortBankAccount + '252100') + bankCode + shortBankAccount
}
}
@ -26,36 +26,50 @@ export class IbanGenerator {
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--
}
/**
*
* @param bban c 5 знака 16 символов
* @return одну цифру
*/
getEstonianCheckDigit (bban: string) {
const toCheck = bban.substring(2, 15)
const weights = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7]
return String(r % 10 !== 0 ? 10 - r % 10 : 0)
let sum = 0
for (let index = 0; index < toCheck.length; index++) {
sum += parseInt(toCheck.charAt(index), 10) * weights[index]
}
const remainder = sum % 10
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) {
return remainder === 0 ? 0 : 10 - remainder
};
getBankCode (country: Country) {
const plBankCodes = [
'16000003', // (BNPPL Centrala) BNP PARIBAS BANK POLSKA SA Centrala
'11602231', // Bank Millennium SA Bankowy Punkt Rozlicze Nr 4
'10301612', // BH Regionalne Centrum Rozliczeń
'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:
return t[Math.floor(Math.random() * t.length)]
return plBankCodes[Math.floor(Math.random() * plBankCodes.length)]
case Country.ESTONIA:
return n[Math.floor(Math.random() * n.length)]
return eeBankCodes[Math.floor(Math.random() * eeBankCodes.length)]
default:
return r[Math.floor(Math.random() * r.length)]
return ltBankCodes[Math.floor(Math.random() * ltBankCodes.length)]
}
}

@ -8,29 +8,33 @@ export class PersonalIdGenerator {
* @param person
*/
generate (person: Person) {
const year = this.getYearPart(person.birthday.year)
const fullYear = this.grabFullYear(person.birthday.year)
const year = this.getYearPart(fullYear)
const month = this.getMonthPart(person.birthday.month)
const day = this.getDayPart(person.birthday.day)
const o = this.getIdNumPart()
const a = this.getGenderPart(person.country, person.gender)
const a = this.getGenderPart(person.country, person.gender, fullYear)
const l = this.getControlSum(person.country, year, month, day, o, a)
const l2 = this.getChecksum(a + year + month + day + o)
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 () {
var e = (new Date).getFullYear();
return String(Iu.generate(e - 25, e - 55)).substring(2, 4)
},
*/
getYearPart (year: bigint | null) {
if (!year) {
const e = (new Date()).getFullYear()
year = BigInt(randomGenerator.generate(e - 25, e - 55))
}
getYearPart (year: bigint) {
return String(year).substring(2, 4)
}
@ -80,9 +84,11 @@ export class PersonalIdGenerator {
},
* @param country
* @param gender
* @param year
*/
getGenderPart (country: Country, gender: Gender) {
getGenderPart (country: Country, gender: Gender, year: bigint) {
console.log(country, gender)
let tempGender = gender
switch (country) {
case Country.POLAND:
console.log(country)
@ -91,7 +97,11 @@ export class PersonalIdGenerator {
: String(2 * randomGenerator.generate(1, 4))
default:
console.log(gender, Gender.MALE === gender)
return Gender.MALE === gender ? '3' : '4'
if (Gender.RANDOM === gender) {
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 {
enable () {
chrome.storage.sync.set({ 'need-clean-notification': true }, function () {
chrome.storage && chrome.storage.sync.set({ 'need-clean-notification': true }, function () {
console.log('need-clean-notification: ' + true)
})
}
disable () {
chrome.storage.sync.set({ 'need-clean-notification': false }, function () {
chrome.storage && chrome.storage.sync.set({ 'need-clean-notification': false }, function () {
console.log('need-clean-notification: ' + false)
})
}
state (): Promise<boolean> {
return new Promise((resolve, reject) => {
chrome.storage.sync.get(['need-clean-notification'], function (result) {
chrome.storage && chrome.storage.sync.get(['need-clean-notification'], function (result) {
console.log('Value currently is ' + result['need-clean-notification'])
resolve(result['need-clean-notification'] || false)
})

@ -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>

@ -0,0 +1,37 @@
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()
}
}
}

@ -0,0 +1,65 @@
.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;
}
}
}

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

@ -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>

@ -0,0 +1,14 @@
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 = ''
}

@ -0,0 +1,65 @@
.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;
}
}
}

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

@ -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>

@ -0,0 +1,142 @@
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
})
}
}

@ -0,0 +1,75 @@
.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;
}
}

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

@ -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>

@ -0,0 +1,93 @@
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
})
}
}

@ -0,0 +1,65 @@
.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;
}
}
}

@ -0,0 +1,65 @@
<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,103 +1,27 @@
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 notificationCleaner from '@/classes/Service/NotificationCleaner'
import Mocks from '@/components/mocks/main.vue'
import PersonTab from '@/components/person-tab/main.vue'
import MocksTab from '@/components/mocks-tab/main.vue'
import EmberTab from '@/components/ember-tab/main.vue'
import UserTab from '@/components/user-tab/main.vue'
Vue.use(VueClipboard)
@Component
export default class HelloWorld extends Vue {
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)
@Component({
components: {
Mocks,
PersonTab,
MocksTab,
EmberTab,
UserTab
}
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)
}
insertValueToNode (target: Target, value: string): void {
sender.send({
action: Action.INSERT,
target: target,
value: value
})
}
cleanNotifications (): void {
sender.send({
action: Action.CLEAN_NOTIFICATION
})
}
export default class HelloWorld extends Vue {
tab = 'person'
onChangeAutoCleaner () {
console.log(this.isAutoCleaner)
if (this.isAutoCleaner) {
notificationCleaner.enable()
} else {
notificationCleaner.disable()
}
isPlugin (): boolean {
console.log(chrome)
return !!chrome.tabs
}
}

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

@ -2,91 +2,33 @@
<div class="wrapper">
<div class="tab-panel">
<div @click="tab = 'person'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'person'}">Person
:class="{'tab-panel__item_active': tab === 'person'}">
Person
</div>
<div @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
<div @click="personalId=''; tab = 'mocks'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'mocks'}">
Mocks
</div>
<div v-if="isPlugin()" @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
Ember
</div>
<div @click="tab = 'user'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'user'}">
User
</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">
<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>
<PersonTab/>
</div>
<div class="form-row">
<div class="form-row__item">
<button
@click="cleanNotifications"
>Clean</button>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'mocks'}">
<MocksTab/>
</div>
<div v-if="isPlugin()" class="tab-page__item" :class="{'tab-page__item_show': tab === 'ember'}">
<EmberTab/>
</div>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'user'}">
<userTab/>
</div>
</div>
<div class="memory-panel">Memory: {{copyText}}</div>
</div>
</div>

@ -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>

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

@ -0,0 +1,65 @@
.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;
}
}
}

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

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

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

@ -0,0 +1,24 @@
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()

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

@ -0,0 +1,20 @@
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,6 +2322,13 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
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:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@ -5088,6 +5095,11 @@ follow-redirects@^1.0.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147"
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:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"

Loading…
Cancel
Save