Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c25ba30d0 | ||
|
|
ba36eb502b | ||
|
|
2c9a2bd30c | ||
|
|
f35acee64b | ||
|
|
a4c02a747f | ||
|
|
66b1e2cdcb | ||
|
|
81eca1c6e0 | ||
|
|
89f2b3b68c | ||
|
|
549bd901da | ||
|
|
6aad2d3aa2 | ||
|
|
09959e3ac3 | ||
|
|
7014462d42 | ||
|
|
62417b88ba | ||
|
|
bf0b5c9907 | ||
|
|
5347c3ef6c | ||
|
|
194292c083 | ||
|
|
7d023dba1e | ||
|
|
9c63cadf29 | ||
|
|
88b7501b4d | ||
|
|
8f53187a3c | ||
|
|
ef8059b3b1 | ||
|
|
8627233a17 |
@ -14,6 +14,7 @@ export const queryTTL: Record<string, number | false> = {
|
||||
GetDealerPerson: seconds().fromHours(1),
|
||||
GetDealerPersons: seconds().fromHours(1),
|
||||
GetDealers: seconds().fromMinutes(15),
|
||||
GetEltInsuranceRules: seconds().fromHours(12),
|
||||
GetFuelCards: seconds().fromHours(12),
|
||||
GetGPSBrands: seconds().fromHours(24),
|
||||
GetGPSModels: seconds().fromHours(24),
|
||||
@ -32,6 +33,7 @@ export const queryTTL: Record<string, number | false> = {
|
||||
GetOpportunities: false,
|
||||
GetOpportunity: false,
|
||||
GetOpportunityUrl: seconds().fromHours(12),
|
||||
GetOsagoAddproductTypes: seconds().fromHours(12),
|
||||
GetProduct: seconds().fromHours(12),
|
||||
GetProducts: seconds().fromHours(12),
|
||||
GetQuote: false,
|
||||
|
||||
@ -1,129 +1,41 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
import { PolicyTable, ReloadButton, Validation } from './Components';
|
||||
import { columns } from './lib/config';
|
||||
import { makeEltKaskoRequest } from './lib/make-request';
|
||||
import { resetRow } from './lib/tools';
|
||||
import type { Row, StoreSelector } from './types';
|
||||
import { getEltKasko } from '@/api/elt/query';
|
||||
import { MAX_FRANCHISE, MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values';
|
||||
import helper from '@/process/elt/lib/helper';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { trpcClient } from '@/trpc/client';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { omit, sift } from 'radash';
|
||||
import { useCallback } from 'react';
|
||||
import { Flex } from 'ui/grid';
|
||||
|
||||
const storeSelector: StoreSelector = ({ kasko }) => kasko;
|
||||
|
||||
const initialData = {
|
||||
...omit(defaultRow, ['name', 'key', 'id']),
|
||||
error: null,
|
||||
kaskoSum: 0,
|
||||
paymentPeriods: [
|
||||
{
|
||||
kaskoSum: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const Kasko = observer(() => {
|
||||
const store = useStore();
|
||||
const { $calculation, $tables } = store;
|
||||
const apolloClient = useApolloClient();
|
||||
const { init } = helper({ apolloClient, store });
|
||||
|
||||
const handleOnClick = useCallback(async () => {
|
||||
$tables.elt.kasko.abortController?.abort();
|
||||
$tables.elt.kasko.abortController = new AbortController();
|
||||
const calculateKasko = trpcClient.eltKasko.useMutation({
|
||||
onError() {
|
||||
$tables.elt.kasko.setRows(
|
||||
$tables.elt.kasko.getRows.map((row) => ({ ...row, status: 'error' }))
|
||||
);
|
||||
},
|
||||
onMutate: () => {
|
||||
const rows = $tables.elt.kasko.getRows;
|
||||
$tables.elt.kasko.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' })));
|
||||
},
|
||||
onSuccess: ({ rows }) => {
|
||||
$tables.elt.kasko.setRows(rows);
|
||||
},
|
||||
});
|
||||
|
||||
const { kasko } = await init();
|
||||
$tables.elt.kasko.setRows(kasko);
|
||||
const kaskoCompanyIds = sift(
|
||||
$tables.insurance
|
||||
.row('kasko')
|
||||
.getOptions('insuranceCompany')
|
||||
.map((x) => x.value)
|
||||
);
|
||||
const values = $calculation.$values.getValues();
|
||||
|
||||
kaskoCompanyIds.forEach((key) => {
|
||||
const row = $tables.elt.kasko.getRow(key);
|
||||
if (row) {
|
||||
$tables.elt.kasko.setRow({ key, status: 'fetching' });
|
||||
makeEltKaskoRequest({ apolloClient, store }, row)
|
||||
.then((payload) =>
|
||||
getEltKasko(payload, { signal: $tables.elt.kasko.abortController?.signal })
|
||||
)
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
const {
|
||||
kaskoSum = 0,
|
||||
message,
|
||||
paymentPeriods,
|
||||
requestId,
|
||||
skCalcId,
|
||||
totalFranchise = 0,
|
||||
} = res;
|
||||
let { error } = res;
|
||||
|
||||
const sum =
|
||||
values.leasingPeriod <= 16 ? kaskoSum : paymentPeriods?.[0]?.kaskoSum || 0;
|
||||
|
||||
if (totalFranchise > MAX_FRANCHISE) {
|
||||
error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_FRANCHISE)}`;
|
||||
}
|
||||
|
||||
if (sum > MAX_INSURANCE) {
|
||||
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_INSURANCE)}`;
|
||||
}
|
||||
|
||||
if (sum < MIN_INSURANCE) {
|
||||
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MIN_INSURANCE)}`;
|
||||
}
|
||||
|
||||
$tables.elt.kasko.setRow({
|
||||
key,
|
||||
message: error || message,
|
||||
numCalc: '0',
|
||||
requestId,
|
||||
skCalcId,
|
||||
status: error ? 'error' : null,
|
||||
sum,
|
||||
totalFranchise,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
const _err = error as Error;
|
||||
$tables.elt.kasko.setRow({
|
||||
...initialData,
|
||||
key,
|
||||
message: _err.message || String(error),
|
||||
status: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
function handleOnClick() {
|
||||
calculateKasko.mutate({
|
||||
calculation: {
|
||||
values: store.$calculation.$values.getValues(),
|
||||
},
|
||||
});
|
||||
}, [$calculation.$values, $tables.elt.kasko, $tables.insurance, apolloClient, init, store]);
|
||||
}
|
||||
|
||||
function handleOnSelectRow(row: Row) {
|
||||
$tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key);
|
||||
|
||||
@ -2,125 +2,41 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
import { PolicyTable, ReloadButton, Validation } from './Components';
|
||||
import { columns } from './lib/config';
|
||||
import { makeEltOsagoRequest, makeOwnOsagoRequest } from './lib/make-request';
|
||||
import { resetRow } from './lib/tools';
|
||||
import type { Row, StoreSelector } from './types';
|
||||
import { getEltOsago } from '@/api/elt/query';
|
||||
import { MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values';
|
||||
import helper from '@/process/elt/lib/helper';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { trpcClient } from '@/trpc/client';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { omit, sift } from 'radash';
|
||||
import { useCallback } from 'react';
|
||||
import { Flex } from 'ui/grid';
|
||||
|
||||
const storeSelector: StoreSelector = ({ osago }) => osago;
|
||||
|
||||
const initialData = {
|
||||
...omit(defaultRow, ['name', 'key', 'id']),
|
||||
error: null,
|
||||
premiumSum: 0,
|
||||
};
|
||||
|
||||
export const Osago = observer(() => {
|
||||
const store = useStore();
|
||||
const { $tables } = store;
|
||||
const apolloClient = useApolloClient();
|
||||
const { init } = helper({ apolloClient, store });
|
||||
|
||||
const handleOnClick = useCallback(async () => {
|
||||
$tables.elt.osago.abortController?.abort();
|
||||
$tables.elt.osago.abortController = new AbortController();
|
||||
const calculateOsago = trpcClient.eltOsago.useMutation({
|
||||
onError() {
|
||||
$tables.elt.osago.setRows(
|
||||
$tables.elt.osago.getRows.map((row) => ({ ...row, status: 'error' }))
|
||||
);
|
||||
},
|
||||
onMutate: () => {
|
||||
const rows = $tables.elt.osago.getRows;
|
||||
$tables.elt.osago.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' })));
|
||||
},
|
||||
onSuccess: ({ rows }) => {
|
||||
$tables.elt.osago.setRows(rows);
|
||||
},
|
||||
});
|
||||
|
||||
const { osago } = await init();
|
||||
$tables.elt.osago.setRows(osago);
|
||||
const osagoCompanyIds = sift(
|
||||
$tables.insurance
|
||||
.row('osago')
|
||||
.getOptions('insuranceCompany')
|
||||
.map((x) => x.value)
|
||||
);
|
||||
|
||||
osagoCompanyIds.forEach((key) => {
|
||||
const row = $tables.elt.osago.getRow(key);
|
||||
if (row) {
|
||||
row.status = 'fetching';
|
||||
$tables.elt.osago.setRow(row);
|
||||
|
||||
if (row.metodCalc === 'CRM') {
|
||||
makeOwnOsagoRequest({ apolloClient, store }, row).then((res) => {
|
||||
if (!res) {
|
||||
$tables.elt.osago.setRow({
|
||||
key,
|
||||
message:
|
||||
'Для получения расчета ОСАГО следует использовать калькулятор ЭЛТ или Индивидуальный запрос',
|
||||
numCalc: undefined,
|
||||
skCalcId: undefined,
|
||||
status: 'error',
|
||||
sum: 0,
|
||||
totalFranchise: 0,
|
||||
});
|
||||
} else {
|
||||
$tables.elt.osago.setRow({
|
||||
key,
|
||||
message: null,
|
||||
numCalc: res.evo_id || undefined,
|
||||
status: null,
|
||||
sum: res.evo_graph_price_withoutnds || undefined,
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
makeEltOsagoRequest({ apolloClient, store }, row)
|
||||
.then((payload) =>
|
||||
getEltOsago(payload, { signal: $tables.elt.osago.abortController.signal })
|
||||
)
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
const { message, numCalc, premiumSum = 0, skCalcId } = res;
|
||||
let { error } = res;
|
||||
if (premiumSum > MAX_INSURANCE) {
|
||||
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости ОСАГО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_INSURANCE)}`;
|
||||
}
|
||||
if (premiumSum < MIN_INSURANCE) {
|
||||
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости ОСАГО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MIN_INSURANCE)}`;
|
||||
}
|
||||
$tables.elt.osago.setRow({
|
||||
key,
|
||||
message: error || message,
|
||||
numCalc: `${numCalc}`,
|
||||
skCalcId,
|
||||
status: error ? 'error' : null,
|
||||
sum: premiumSum,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
const _err = error as Error;
|
||||
$tables.elt.osago.setRow({
|
||||
...initialData,
|
||||
key,
|
||||
message: _err.message || String(error),
|
||||
status: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
async function handleOnClick() {
|
||||
calculateOsago.mutate({
|
||||
calculation: {
|
||||
values: store.$calculation.$values.getValues(),
|
||||
},
|
||||
});
|
||||
}, [$tables.elt.osago, $tables.insurance, apolloClient, init, store]);
|
||||
}
|
||||
|
||||
function handleOnSelectRow(row: Row) {
|
||||
$tables.insurance.row('osago').column('insuranceCompany').setValue(row.key);
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
import type { RowSchema } from '@/config/schema/elt';
|
||||
import type { Row } from '../types';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons';
|
||||
import { Flex } from 'ui/grid';
|
||||
import type { z } from 'zod';
|
||||
|
||||
type Row = z.infer<typeof RowSchema>;
|
||||
|
||||
const formatter = Intl.NumberFormat('ru', {
|
||||
currency: 'RUB',
|
||||
|
||||
12
apps/web/Components/Calculation/Form/ELT/lib/tools.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { Row } from '@/Components/Calculation/Form/ELT/types';
|
||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||
|
||||
export function resetRow(row: Row): Row {
|
||||
return {
|
||||
...defaultRow,
|
||||
id: row.id,
|
||||
key: row.key,
|
||||
metodCalc: row.metodCalc,
|
||||
name: row.name,
|
||||
};
|
||||
}
|
||||
@ -47,6 +47,8 @@ ARG URL_CORE_CALCULATE_DIRECT
|
||||
ARG URL_1C_TRANSTAX_DIRECT
|
||||
ARG URL_ELT_OSAGO_DIRECT
|
||||
ARG URL_ELT_KASKO_DIRECT
|
||||
ARG USERNAME_1C_TRANSTAX
|
||||
ARG PASSWORD_1C_TRANSTAX
|
||||
RUN pnpm dotenv -v NODE_ENV=production -e .env turbo run prebuild --filter=web...
|
||||
RUN pnpm dotenv -e .env turbo run build --filter=web...
|
||||
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
export type RequestTransTax = {
|
||||
CalcDate: string;
|
||||
CarCategory: string;
|
||||
OKTMO: string;
|
||||
calcDate: Date;
|
||||
carCategory: string;
|
||||
power: number;
|
||||
year: number;
|
||||
Power: number;
|
||||
Year: number;
|
||||
};
|
||||
export type ResponseTransTax = {
|
||||
error: string;
|
||||
tax: number;
|
||||
Error: string;
|
||||
Tax: number;
|
||||
TaxRate: number;
|
||||
};
|
||||
|
||||
@ -6,6 +6,7 @@ import ValuesSchema from '@/config/schema/values';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const RequestCreateKPSchema = z.object({
|
||||
__info: z.record(z.any()).optional(),
|
||||
calculation: z
|
||||
.object({
|
||||
calculationValues: ValuesSchema,
|
||||
|
||||
@ -6,24 +6,18 @@ import axios from 'axios';
|
||||
|
||||
const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls();
|
||||
|
||||
export async function getEltOsago(
|
||||
payload: ELT.RequestEltOsago,
|
||||
{ signal }: { signal: AbortSignal }
|
||||
) {
|
||||
export async function getEltOsago(payload: ELT.RequestEltOsago) {
|
||||
return withHandleError(
|
||||
axios
|
||||
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { signal, timeout: TIMEOUT })
|
||||
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { timeout: TIMEOUT })
|
||||
.then(({ data }) => data)
|
||||
);
|
||||
}
|
||||
|
||||
export async function getEltKasko(
|
||||
payload: ELT.RequestEltKasko,
|
||||
{ signal }: { signal: AbortSignal }
|
||||
) {
|
||||
export async function getEltKasko(payload: ELT.RequestEltKasko) {
|
||||
return withHandleError(
|
||||
axios
|
||||
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { signal, timeout: TIMEOUT })
|
||||
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { timeout: TIMEOUT })
|
||||
.then(({ data }) => data)
|
||||
);
|
||||
}
|
||||
|
||||
@ -14,6 +14,10 @@ function createApolloClient(headers) {
|
||||
}
|
||||
|
||||
export default function initializeApollo(initialState, headers) {
|
||||
if (isServer() && !headers) {
|
||||
throw new Error('initializeApollo: headers must be provided in server side');
|
||||
}
|
||||
|
||||
const _apolloClient = apolloClient ?? createApolloClient(headers);
|
||||
|
||||
// If your page has Next.js data fetching methods that use Apollo Client, the initial state
|
||||
|
||||
@ -9,6 +9,10 @@ import { getCurrentScope } from '@sentry/nextjs';
|
||||
import getConfig from 'next/config';
|
||||
import { isServer } from 'tools';
|
||||
|
||||
function isSovkom(account) {
|
||||
return account.label.toLowerCase().includes('совком');
|
||||
}
|
||||
|
||||
export function createLink(headers) {
|
||||
const { URL_CRM_GRAPHQL } = getUrls();
|
||||
|
||||
@ -44,16 +48,24 @@ export function createLink(headers) {
|
||||
}
|
||||
|
||||
if (operation.operationName === 'GetInsuranceCompanies') {
|
||||
response.data.accounts = response.data.accounts.map((account) => {
|
||||
const substring = account.label.match(/"(.+)"/u);
|
||||
if (substring)
|
||||
return {
|
||||
...account,
|
||||
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
|
||||
};
|
||||
response.data.accounts = response.data.accounts
|
||||
.sort((a, b) => {
|
||||
if (isSovkom(a)) return -1;
|
||||
|
||||
return account;
|
||||
});
|
||||
if (isSovkom(b)) return 1;
|
||||
|
||||
return 0;
|
||||
})
|
||||
.map((account) => {
|
||||
const substring = account.label.match(/"(.+)"/u);
|
||||
if (substring)
|
||||
return {
|
||||
...account,
|
||||
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
|
||||
};
|
||||
|
||||
return account;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ export const selectObjectCategoryTax = [
|
||||
export const selectLeaseObjectUseFor = alphabetical(
|
||||
[
|
||||
{
|
||||
label: 'Для представительских целей',
|
||||
label: 'Для представительских целей / перевозки сотрудников ЛП',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
@ -151,10 +151,10 @@ export const selectLeaseObjectUseFor = alphabetical(
|
||||
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
|
||||
value: 100_000_011,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки сотрудников ЛП',
|
||||
value: 100_000_012,
|
||||
},
|
||||
// {
|
||||
// label: 'Для перевозки сотрудников ЛП',
|
||||
// value: 100_000_012,
|
||||
// },
|
||||
{
|
||||
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
|
||||
value: 100_000_013,
|
||||
|
||||
@ -22,7 +22,7 @@ const defaultValues: CalculationValues = {
|
||||
comissionRub: 0,
|
||||
configuration: null,
|
||||
costIncrease: true,
|
||||
countSeats: 0,
|
||||
countSeats: 4,
|
||||
creditRate: RATE,
|
||||
dealer: null,
|
||||
dealerBroker: null,
|
||||
|
||||
@ -270,6 +270,7 @@ export const ResultEltOsagoSchema = z.object({
|
||||
|
||||
export const RowSchema = z.object({
|
||||
id: z.string(),
|
||||
insuranceCondition: z.string().nullable(),
|
||||
key: z.string(),
|
||||
message: z.string().nullable(),
|
||||
metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]),
|
||||
|
||||
@ -2,6 +2,8 @@ const { z } = require('zod');
|
||||
|
||||
const envSchema = z.object({
|
||||
BASE_PATH: z.string().optional().default(''),
|
||||
DEV_AUTH_TOKEN: z.string().optional(),
|
||||
PASSWORD_1C_TRANSTAX: z.string(),
|
||||
PORT: z.string().optional(),
|
||||
SENTRY_AUTH_TOKEN: z.string(),
|
||||
SENTRY_DSN: z.string(),
|
||||
@ -11,7 +13,6 @@ const envSchema = z.object({
|
||||
URL_CACHE_GET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/get-queries'),
|
||||
URL_CACHE_GET_QUERY_DIRECT: z.string().default('http://api:3001/proxy/get-query'),
|
||||
URL_CACHE_RESET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/reset'),
|
||||
DEV_AUTH_TOKEN: z.string().optional(),
|
||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
URL_CRM_CREATEKP_DIRECT: z.string(),
|
||||
@ -22,6 +23,7 @@ const envSchema = z.object({
|
||||
URL_ELT_OSAGO_DIRECT: z.string(),
|
||||
URL_GET_USER_DIRECT: z.string(),
|
||||
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
|
||||
USERNAME_1C_TRANSTAX: z.string(),
|
||||
});
|
||||
|
||||
module.exports = envSchema;
|
||||
|
||||
@ -11,6 +11,7 @@ const publicRuntimeConfigSchema = envSchema.pick({
|
||||
const serverRuntimeConfigSchema = envSchema.pick({
|
||||
BASE_PATH: true,
|
||||
DEV_AUTH_TOKEN: true,
|
||||
PASSWORD_1C_TRANSTAX: true,
|
||||
PORT: true,
|
||||
SENTRY_DSN: true,
|
||||
SENTRY_ENVIRONMENT: true,
|
||||
@ -27,6 +28,7 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
||||
URL_ELT_KASKO_DIRECT: true,
|
||||
URL_ELT_OSAGO_DIRECT: true,
|
||||
URL_GET_USER_DIRECT: true,
|
||||
USERNAME_1C_TRANSTAX: true,
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -12,3 +12,5 @@ export const VEHICLE_SEATS = 20;
|
||||
export const ESN = 1.3;
|
||||
export const NSIB_MAX = 5_000_000;
|
||||
export const NDFL = 0.13;
|
||||
|
||||
export const IRR_THRESHOLD = 0.001;
|
||||
|
||||
@ -255,7 +255,7 @@ query GetQuoteData($quoteId: UUID!) {
|
||||
evo_graphs {
|
||||
createdon
|
||||
evo_sumpay_withnds
|
||||
evo_planpayments {
|
||||
evo_planpayments(orderby: { fieldName: "evo_plandate", sortingType: ASC }) {
|
||||
evo_payment_ratio
|
||||
}
|
||||
}
|
||||
@ -310,6 +310,12 @@ query GetQuoteData($quoteId: UUID!) {
|
||||
evo_equip_price
|
||||
evo_coefficien_bonus_reducttion
|
||||
evo_accept_limit_quote
|
||||
evo_kasko_insurance_rulesidData {
|
||||
evo_id
|
||||
}
|
||||
evo_osago_insurance_rulesiddData {
|
||||
evo_id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -712,6 +718,8 @@ query GetDealerPerson($dealerPersonId: UUID!) {
|
||||
evo_return_leasing_dealer
|
||||
evo_broker_accountid
|
||||
evo_supplier_financing_accept
|
||||
evo_legal_form
|
||||
evo_inn
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,6 +727,7 @@ query GetAgent($agentid: UUID!) {
|
||||
agent(accountid: $agentid) {
|
||||
label: name
|
||||
value: accountid
|
||||
evo_inn
|
||||
}
|
||||
}
|
||||
|
||||
@ -1059,6 +1068,8 @@ query GetInsuranceCompany($accountId: UUID!) {
|
||||
evo_osago_with_kasko
|
||||
evo_legal_region_calc
|
||||
accountid
|
||||
evo_kasko_fact_part
|
||||
evo_kasko_plan_part
|
||||
}
|
||||
}
|
||||
|
||||
@ -1073,6 +1084,64 @@ query GetInsuranceCompanies {
|
||||
evo_id_elt
|
||||
evo_id_elt_smr
|
||||
evo_osago_id
|
||||
evo_kasko_category
|
||||
evo_osago_category
|
||||
}
|
||||
}
|
||||
|
||||
query GetEltInsuranceRules($currentDate: DateTime) {
|
||||
evo_insurance_ruleses(
|
||||
filterConditionGroup: {
|
||||
andFilterConditions: [
|
||||
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
|
||||
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
|
||||
]
|
||||
}
|
||||
) {
|
||||
evo_id
|
||||
evo_datefrom
|
||||
evo_dateto
|
||||
evo_risk
|
||||
evo_category
|
||||
evo_min_period
|
||||
evo_max_period
|
||||
evo_object_type
|
||||
evo_use_for
|
||||
evo_min_price
|
||||
evo_max_price
|
||||
evo_min_year
|
||||
evo_max_year
|
||||
evo_min_power
|
||||
evo_max_power
|
||||
evo_enginie_type
|
||||
evo_opf
|
||||
evo_min_mileage
|
||||
evo_max_mileage
|
||||
evo_brand
|
||||
evo_model
|
||||
evo_region
|
||||
evo_dealer
|
||||
evo_rules_type
|
||||
evo_message
|
||||
evo_discount
|
||||
evo_insurer_accountid
|
||||
evo_brand
|
||||
evo_model
|
||||
evo_region
|
||||
evo_dealer
|
||||
evo_brands {
|
||||
evo_brandid
|
||||
}
|
||||
evo_models {
|
||||
evo_modelid
|
||||
}
|
||||
accounts {
|
||||
accountid
|
||||
}
|
||||
evo_regions {
|
||||
evo_regionid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,8 @@ type Query {
|
||||
evo_insurance_periods(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_period]
|
||||
evo_insurance_policy(evo_insurance_policyid: UUID!): evo_insurance_policy
|
||||
evo_insurance_policies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_policy]
|
||||
evo_insurance_rules(evo_insurance_rulesid: UUID!): evo_insurance_rules
|
||||
evo_insurance_ruleses(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_rules]
|
||||
evo_job_title(evo_job_titleid: UUID!): evo_job_title
|
||||
evo_job_titles(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_job_title]
|
||||
evo_leasingobject(evo_leasingobjectid: UUID!): evo_leasingobject
|
||||
@ -2174,8 +2176,8 @@ type systemuser {
|
||||
roles: [role]
|
||||
evo_edo_departmentData: [picklist_value]
|
||||
businessunitidData: businessunit
|
||||
leads(orderby: OrderByInput): [lead]
|
||||
opportunities(orderby: OrderByInput): [opportunity]
|
||||
leads(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [lead]
|
||||
opportunities(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [opportunity]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -2270,7 +2272,7 @@ type role {
|
||||
evo_documenttypes: [evo_documenttype]
|
||||
evo_documenttypes_letter: [evo_documenttype]
|
||||
evo_connection_roleData: [evo_connection_role]
|
||||
systemusers: [systemuser]
|
||||
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
}
|
||||
@ -2807,9 +2809,9 @@ type quote {
|
||||
evo_statuscodeidData: evo_statuscode
|
||||
evo_evokasko_insurer_accountidData: account
|
||||
evo_supplier_accountidData: account
|
||||
evo_addproduct_types: [evo_addproduct_type]
|
||||
evo_product_risks: [evo_product_risk]
|
||||
evo_graphs: [evo_graph]
|
||||
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
|
||||
evo_product_risks(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_product_risk]
|
||||
evo_graphs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_graph]
|
||||
evo_approvallogs: [evo_approvallog]
|
||||
evo_lessor_bank_detailsidData: evo_bank_details
|
||||
evo_accept_control_addproduct_typeidData: evo_addproduct_type
|
||||
@ -2819,6 +2821,8 @@ type quote {
|
||||
evo_req_telematicname: String
|
||||
evo_req_telematic_acceptname: String
|
||||
evo_question_credit_committees: [evo_question_credit_committee]
|
||||
evo_kasko_insurance_rulesidData: evo_insurance_rules
|
||||
evo_osago_insurance_rulesiddData: evo_insurance_rules
|
||||
ownerid_systemuserData: systemuser
|
||||
ownerid_teamData: team
|
||||
link: String
|
||||
@ -4082,10 +4086,10 @@ type evo_tarif {
|
||||
organizationid: UUID
|
||||
evo_client_risks: [evo_client_risk]
|
||||
evo_client_types: [evo_client_type]
|
||||
evo_leasingobject_types: [evo_leasingobject_type]
|
||||
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||
evo_models: [evo_model]
|
||||
evo_model_exceptions: [evo_model]
|
||||
evo_rates: [evo_rate]
|
||||
evo_rates(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_rate]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -4265,10 +4269,10 @@ type evo_subsidy {
|
||||
modifiedby: UUID
|
||||
createdby: UUID
|
||||
organizationid: UUID
|
||||
evo_brands: [evo_brand]
|
||||
evo_models: [evo_model]
|
||||
accounts: [account]
|
||||
evo_leasingobject_types: [evo_leasingobject_type]
|
||||
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
|
||||
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -4879,7 +4883,7 @@ type evo_region {
|
||||
modifiedby: UUID
|
||||
createdby: UUID
|
||||
organizationid: UUID
|
||||
accounts: [account]
|
||||
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -4937,7 +4941,7 @@ type evo_rate {
|
||||
createdby: UUID
|
||||
organizationid: UUID
|
||||
evo_brands: [evo_brand]
|
||||
evo_tarifs: [evo_tarif]
|
||||
evo_tarifs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_tarif]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -5798,8 +5802,8 @@ type evo_leasingobject_type {
|
||||
modifiedby: UUID
|
||||
createdby: UUID
|
||||
organizationid: UUID
|
||||
evo_subsidies: [evo_subsidy]
|
||||
evo_vehicle_body_types: [evo_vehicle_body_type]
|
||||
evo_subsidies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_subsidy]
|
||||
evo_vehicle_body_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_vehicle_body_type]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -6024,6 +6028,92 @@ type evo_job_title {
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
}
|
||||
|
||||
type evo_insurance_rules {
|
||||
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
|
||||
toOdataCreate: [KeyValuePairOfStringAndObject!]
|
||||
toOdataUpdate: [KeyValuePairOfStringAndObject!]
|
||||
emptyGuids: [String]
|
||||
entitySetName: String
|
||||
primaryId: UUID!
|
||||
relativePathForUpdate: String
|
||||
containerFields: [KeyValuePairOfStringAndObject!]
|
||||
evo_insurance_rulesid: UUID
|
||||
createdon: DateTime
|
||||
modifiedon: DateTime
|
||||
overriddencreatedon: DateTime
|
||||
evo_dateto: DateTime
|
||||
evo_datefrom: DateTime
|
||||
evo_opf: Int
|
||||
evo_risk: Int
|
||||
evo_max_year: Int
|
||||
evo_object_type: Int
|
||||
evo_dealer: Int
|
||||
statecode: Int
|
||||
timezoneruleversionnumber: Int
|
||||
evo_rules_type: Int
|
||||
utcconversiontimezonecode: Int
|
||||
importsequencenumber: Int
|
||||
evo_brand: Int
|
||||
evo_max_period: Int
|
||||
evo_model: Int
|
||||
evo_min_year: Int
|
||||
evo_region: Int
|
||||
statuscode: Int
|
||||
evo_min_period: Int
|
||||
evo_min_price: Decimal
|
||||
evo_min_mileage: Decimal
|
||||
evo_min_power: Decimal
|
||||
evo_max_power: Decimal
|
||||
evo_max_price: Decimal
|
||||
evo_max_mileage: Decimal
|
||||
evo_discount: Decimal
|
||||
modifiedbyname: String
|
||||
evo_insurer_accountidname: String
|
||||
evo_message: String
|
||||
evo_id: String
|
||||
createdonbehalfbyname: String
|
||||
createdbyyominame: String
|
||||
evo_name: String
|
||||
createdbyname: String
|
||||
modifiedonbehalfbyname: String
|
||||
createdonbehalfbyyominame: String
|
||||
modifiedbyyominame: String
|
||||
evo_insurer_accountidyominame: String
|
||||
modifiedonbehalfbyyominame: String
|
||||
organizationidname: String
|
||||
evo_use_for: [Int!]
|
||||
evo_enginie_type: [Int!]
|
||||
evo_category: [Int!]
|
||||
createdonbehalfby: UUID
|
||||
modifiedonbehalfby: UUID
|
||||
evo_insurer_accountid: UUID
|
||||
createdby: UUID
|
||||
modifiedby: UUID
|
||||
organizationid: UUID
|
||||
evo_models: [evo_model]
|
||||
evo_brands: [evo_brand]
|
||||
evo_regions: [evo_region]
|
||||
accounts: [account]
|
||||
evo_riskname: String
|
||||
evo_rules_typename: String
|
||||
evo_brandname: String
|
||||
evo_modelname: String
|
||||
evo_regionname: String
|
||||
evo_dealername: String
|
||||
evo_categorynames: [String]
|
||||
evo_use_fornames: [String]
|
||||
evo_enginie_typenames: [String]
|
||||
evo_opfname: String
|
||||
evo_object_typename: String
|
||||
ownerid_systemuser: UUID
|
||||
ownerid_team: UUID
|
||||
ownerid_systemuserData: systemuser
|
||||
ownerid_teamData: team
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
}
|
||||
|
||||
type evo_insurance_policy {
|
||||
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
|
||||
toOdataCreate: [KeyValuePairOfStringAndObject!]
|
||||
@ -6593,7 +6683,7 @@ type evo_graph {
|
||||
modifiedonbehalfby: UUID
|
||||
ownerid_systemuser: UUID
|
||||
ownerid_team: UUID
|
||||
evo_planpayments: [evo_planpayment]
|
||||
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
|
||||
ownerid_systemuserData: systemuser
|
||||
ownerid_teamData: team
|
||||
link: String
|
||||
@ -8344,9 +8434,9 @@ type evo_coefficient {
|
||||
evo_businessunitid: UUID
|
||||
organizationid: UUID
|
||||
evo_job_titleid: UUID
|
||||
evo_leasingobject_types: [evo_leasingobject_type]
|
||||
evo_businessunits: [evo_businessunit]
|
||||
evo_baseproducts: [evo_baseproduct]
|
||||
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||
evo_businessunits(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_businessunit]
|
||||
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
|
||||
evo_sot_coefficient_typeidData: evo_sot_coefficient_type
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
@ -8633,12 +8723,12 @@ type evo_baseproduct {
|
||||
modifiedby: UUID
|
||||
createdby: UUID
|
||||
organizationid: UUID
|
||||
evo_leasingobject_types: [evo_leasingobject_type]
|
||||
evo_brands: [evo_brand]
|
||||
systemusers: [systemuser]
|
||||
accounts: [account]
|
||||
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
|
||||
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||
evo_coefficients: [evo_coefficient]
|
||||
evo_baseproducts: [evo_baseproduct]
|
||||
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
@ -9226,11 +9316,11 @@ type evo_addproduct_type {
|
||||
modifiedonbehalfby: UUID
|
||||
organizationid: UUID
|
||||
evo_accountid: UUID
|
||||
evo_leasingobject_types: [evo_leasingobject_type]
|
||||
evo_planpayments: [evo_planpayment]
|
||||
evo_addproduct_types: [evo_addproduct_type]
|
||||
evo_models: [evo_model]
|
||||
evo_brands: [evo_brand]
|
||||
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
|
||||
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
|
||||
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
|
||||
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||
link: String
|
||||
picklistName(value: Int, key: String): String
|
||||
twoParamsName(value: Boolean, key: String): String
|
||||
|
||||
@ -39,20 +39,23 @@ export const handlers = [
|
||||
rest.post(URL_1C_TRANSTAX, (req, res, ctx) =>
|
||||
res(
|
||||
ctx.json({
|
||||
error: null,
|
||||
tax: _.random(100000, 200000),
|
||||
Error: null,
|
||||
Tax: _.random(100000, 200000),
|
||||
})
|
||||
)
|
||||
),
|
||||
rest.post(URL_ELT_OSAGO, async (req, res, ctx) => res(
|
||||
rest.post(URL_ELT_OSAGO, async (req, res, ctx) =>
|
||||
res(
|
||||
ctx.json({
|
||||
numCalc: _.random(1000000, 3000000),
|
||||
skCalcId: _.random(50000000, 60000000).toString(),
|
||||
premiumSum: _.random(10000, 20000),
|
||||
message: 'OSAGO Message',
|
||||
})
|
||||
)),
|
||||
rest.post(URL_ELT_KASKO, async (req, res, ctx) => res(
|
||||
)
|
||||
),
|
||||
rest.post(URL_ELT_KASKO, async (req, res, ctx) =>
|
||||
res(
|
||||
ctx.json({
|
||||
requestId: _.random(3000000, 4000000).toString(),
|
||||
skCalcId: _.random(50000000, 60000000).toString(),
|
||||
@ -67,7 +70,8 @@ export const handlers = [
|
||||
],
|
||||
totalFranchise: _.random(20000, 40000),
|
||||
})
|
||||
)),
|
||||
)
|
||||
),
|
||||
|
||||
// rest.post(URL_CRM_GRAPHQL, (req, res, ctx) => {
|
||||
// return res(ctx.status(503));
|
||||
|
||||
@ -66,10 +66,10 @@ module.exports = withSentryConfig(
|
||||
destination: env.URL_CORE_FINGAP_DIRECT,
|
||||
source: urls.URL_CORE_FINGAP_PROXY,
|
||||
},
|
||||
{
|
||||
destination: env.URL_1C_TRANSTAX_DIRECT,
|
||||
source: urls.URL_1C_TRANSTAX_PROXY,
|
||||
},
|
||||
// {
|
||||
// destination: env.URL_1C_TRANSTAX_DIRECT,
|
||||
// source: urls.URL_1C_TRANSTAX_PROXY,
|
||||
// },
|
||||
{
|
||||
destination: env.URL_ELT_KASKO_DIRECT,
|
||||
source: urls.URL_ELT_KASKO_PROXY,
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
"styled-components": "^5.3.11",
|
||||
"superjson": "^2.2.1",
|
||||
"tools": "workspace:*",
|
||||
"ua-parser-js": "^1.0.38",
|
||||
"ui": "workspace:*",
|
||||
"use-debounce": "^9.0.4",
|
||||
"zod": "^3.22.4"
|
||||
@ -54,6 +55,7 @@
|
||||
"@types/react": "^18.2.14",
|
||||
"@types/react-dom": "^18.2.6",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"@vchikalkin/eslint-config-awesome": "^1.1.6",
|
||||
"antd": "^5.14.2",
|
||||
"eslint": "^8.52.0",
|
||||
|
||||
@ -29,7 +29,10 @@ const colorPrimary = getColors().COLOR_PRIMARY;
|
||||
|
||||
function App({ Component, pageProps }) {
|
||||
const { initialApolloState, initialQueryState } = pageProps;
|
||||
const apolloClient = useMemo(() => initializeApollo(initialApolloState), [initialApolloState]);
|
||||
const apolloClient = useMemo(
|
||||
() => initializeApollo(initialApolloState, {}),
|
||||
[initialApolloState]
|
||||
);
|
||||
const queryClient = useMemo(() => initializeQueryClient(initialQueryState), [initialQueryState]);
|
||||
|
||||
const { loading } = usePageLoading();
|
||||
|
||||
38
apps/web/pages/api/1c/transtax.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import type { ResponseTransTax } from '@/api/1c/types';
|
||||
import { serverRuntimeConfigSchema } from '@/config/schema/runtime-config';
|
||||
import { withHandleError } from '@/utils/axios';
|
||||
import type { HttpError } from '@/utils/error';
|
||||
import axios from 'axios';
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
const { serverRuntimeConfig } = getConfig();
|
||||
const { USERNAME_1C_TRANSTAX, PASSWORD_1C_TRANSTAX, URL_1C_TRANSTAX_DIRECT } =
|
||||
serverRuntimeConfigSchema.parse(serverRuntimeConfig);
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const abortController = new AbortController();
|
||||
|
||||
req.on('close', () => {
|
||||
abortController.abort();
|
||||
});
|
||||
|
||||
const params = req.body as ResponseTransTax;
|
||||
|
||||
withHandleError(
|
||||
axios.get<ResponseTransTax>(URL_1C_TRANSTAX_DIRECT, {
|
||||
auth: {
|
||||
password: PASSWORD_1C_TRANSTAX,
|
||||
username: USERNAME_1C_TRANSTAX,
|
||||
},
|
||||
params,
|
||||
signal: abortController.signal,
|
||||
})
|
||||
)
|
||||
.then(({ data }) => res.json(data))
|
||||
.catch((error) => {
|
||||
const _err = error as HttpError;
|
||||
|
||||
return res.json({ message: _err.message });
|
||||
});
|
||||
}
|
||||
@ -7,11 +7,11 @@ import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { reaction, toJS } from 'mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { max } from 'radash';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables, $process } = store;
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType', 'maxMass']),
|
||||
@ -160,35 +160,35 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
|
||||
const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
|
||||
const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
|
||||
// reaction(
|
||||
// () => {
|
||||
// const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
|
||||
// const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
|
||||
// const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
|
||||
|
||||
return {
|
||||
...values,
|
||||
fingapInsured,
|
||||
kaskoInsured,
|
||||
};
|
||||
},
|
||||
({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
|
||||
if (
|
||||
leasingPeriod < 12 ||
|
||||
leasingWithoutKasko ||
|
||||
kaskoInsured === 100_000_001 ||
|
||||
(fingapInsured === 100_000_001 && leasingPeriod < 36)
|
||||
) {
|
||||
$calculation.element('selectInsNSIB').resetValue().block();
|
||||
} else {
|
||||
$calculation.element('selectInsNSIB').unblock();
|
||||
}
|
||||
},
|
||||
{
|
||||
delay: 10,
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
// return {
|
||||
// ...values,
|
||||
// fingapInsured,
|
||||
// kaskoInsured,
|
||||
// };
|
||||
// },
|
||||
// ({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
|
||||
// if (
|
||||
// leasingPeriod < 12 ||
|
||||
// leasingWithoutKasko ||
|
||||
// kaskoInsured === 100_000_001 ||
|
||||
// (fingapInsured === 100_000_001 && leasingPeriod < 36)
|
||||
// ) {
|
||||
// $calculation.element('selectInsNSIB').resetValue().block();
|
||||
// } else {
|
||||
// $calculation.element('selectInsNSIB').unblock();
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// delay: 10,
|
||||
// fireImmediately: true,
|
||||
// }
|
||||
// );
|
||||
|
||||
debouncedReaction(
|
||||
() =>
|
||||
|
||||
@ -10,8 +10,17 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
return ValuesSchema.pick({ product: true, saleBonus: true }).superRefine(
|
||||
async ({ product, saleBonus }, ctx) => {
|
||||
const coefficient = await getCoefficient(product);
|
||||
const minBonus = (coefficient?.evo_correction_coefficient || 0) * 100;
|
||||
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
|
||||
|
||||
if (round(saleBonus, 2) < round(minBonus, 2)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Бонус не может быть ниже установленного по СОТ',
|
||||
path: ['tbxSaleBonus'],
|
||||
});
|
||||
}
|
||||
|
||||
if (round(saleBonus, 2) > round(maxBonus, 2)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import helper from '../lib/helper';
|
||||
import { IRR_THRESHOLD } from '@/constants/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { comparer, reaction } from 'mobx';
|
||||
@ -31,7 +32,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
|
||||
const { getIrr } = helper({ apolloClient });
|
||||
|
||||
reaction(
|
||||
disposableReaction(
|
||||
() => $process.has('LoadKP'),
|
||||
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
||||
async (values) => {
|
||||
const { min, max } = await getIrr(values);
|
||||
@ -40,6 +42,19 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
// костыль
|
||||
disposableReaction(
|
||||
() =>
|
||||
$process.has('LoadKP') ||
|
||||
$calculation.element('radioLastPaymentRule').getValue() === 100_000_002,
|
||||
() => $calculation.element('labelIrrInfo').getValue(),
|
||||
({ min }) => {
|
||||
if ($calculation.element('radioLastPaymentRule').getValue() === 100_000_002) return;
|
||||
|
||||
$calculation.element('tbxIRR_Perc').setValue(min + IRR_THRESHOLD);
|
||||
}
|
||||
);
|
||||
|
||||
disposableReaction(
|
||||
() => $process.has('Calculate') || $process.has('CreateKP'),
|
||||
() => {
|
||||
|
||||
@ -1,28 +1,37 @@
|
||||
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
|
||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||
|
||||
export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteProcessData> {
|
||||
const elt: NonNullable<GetQuoteProcessData['elt']> = { kasko: undefined, osago: undefined };
|
||||
|
||||
if (
|
||||
quote?.evo_kasko_accountid &&
|
||||
quote?.evo_id_elt_kasko &&
|
||||
quote?.evo_id_kasko_calc &&
|
||||
((quote?.evo_id_elt_kasko && quote?.evo_id_kasko_calc) ||
|
||||
quote.evo_kasko_insurance_rulesidData?.evo_id) &&
|
||||
quote?.evo_kasko_price &&
|
||||
quote?.evo_franchise !== null
|
||||
) {
|
||||
elt.kasko = {
|
||||
insuranceCondition:
|
||||
quote.evo_kasko_insurance_rulesidData?.evo_id ?? defaultRow.insuranceCondition,
|
||||
key: quote?.evo_kasko_accountid,
|
||||
requestId: quote?.evo_id_elt_kasko,
|
||||
skCalcId: quote?.evo_id_kasko_calc,
|
||||
requestId: quote?.evo_id_elt_kasko ?? defaultRow.requestId,
|
||||
skCalcId: quote?.evo_id_kasko_calc ?? defaultRow.skCalcId,
|
||||
sum: quote?.evo_kasko_price,
|
||||
totalFranchise: quote?.evo_franchise,
|
||||
};
|
||||
}
|
||||
|
||||
if (quote?.evo_osago_accountid && quote?.evo_id_elt_osago && quote?.evo_osago_price) {
|
||||
if (
|
||||
quote?.evo_osago_accountid &&
|
||||
(quote?.evo_id_elt_osago || quote.evo_osago_insurance_rulesiddData?.evo_id) &&
|
||||
quote?.evo_osago_price
|
||||
) {
|
||||
elt.osago = {
|
||||
insuranceCondition:
|
||||
quote.evo_osago_insurance_rulesiddData?.evo_id ?? defaultRow.insuranceCondition,
|
||||
key: quote?.evo_osago_accountid,
|
||||
numCalc: quote?.evo_id_elt_osago,
|
||||
numCalc: quote?.evo_id_elt_osago ?? defaultRow.numCalc,
|
||||
sum: quote?.evo_osago_price,
|
||||
};
|
||||
}
|
||||
|
||||
@ -30,14 +30,19 @@ export default function helper({
|
||||
({ evo_leasingobject_type } = data);
|
||||
}
|
||||
|
||||
// const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue();
|
||||
|
||||
return {
|
||||
kasko: (accounts
|
||||
?.filter((x) =>
|
||||
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
||||
evo_leasingobject_type?.evo_id &&
|
||||
['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
|
||||
? Boolean(x.evo_id_elt_smr)
|
||||
: Boolean(x?.evo_id_elt)
|
||||
?.filter(
|
||||
(x) =>
|
||||
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
||||
// leaseObjectCategory &&
|
||||
// x.evo_kasko_category?.includes(leaseObjectCategory) &&
|
||||
(evo_leasingobject_type?.evo_id &&
|
||||
['6', '9', '10'].includes(evo_leasingobject_type.evo_id)
|
||||
? x?.evo_id_elt_smr
|
||||
: x?.evo_id_elt)
|
||||
)
|
||||
.map((x) => ({
|
||||
...defaultRow,
|
||||
@ -53,6 +58,8 @@ export default function helper({
|
||||
?.filter(
|
||||
(x) =>
|
||||
x?.evo_type_ins_policy?.includes(100_000_001) &&
|
||||
// leaseObjectCategory &&
|
||||
// x.evo_osago_category?.includes(leaseObjectCategory) &&
|
||||
(x?.evo_id_elt_osago || x.evo_osago_id)
|
||||
)
|
||||
.map((x) => ({
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
/* eslint-disable complexity */
|
||||
import type { Row } from '../types';
|
||||
import type { RequestEltKasko, RequestEltOsago } from '@/api/elt/types';
|
||||
import type { Row } from '@/Components/Calculation/Form/ELT/types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import dayjs from 'dayjs';
|
||||
import { first, sort } from 'radash';
|
||||
|
||||
export async function makeOwnOsagoRequest(
|
||||
export async function ownOsagoRequest(
|
||||
{ store, apolloClient }: Pick<ProcessContext, 'apolloClient' | 'store'>,
|
||||
row: Row
|
||||
): Promise<NonNullable<CRMTypes.GetOsagoAddproductTypesQuery['evo_addproduct_types']>[number]> {
|
||||
@ -471,7 +471,8 @@ export async function makeEltKaskoRequest(
|
||||
let selfIgnitionSpecified = false;
|
||||
if (
|
||||
leaseObjectCategory === 100_000_002 ||
|
||||
(evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id))
|
||||
(evo_leasingobject_type?.evo_id &&
|
||||
['6', '8', '9', '10'].includes(evo_leasingobject_type?.evo_id))
|
||||
) {
|
||||
notConfirmedGlassesDamages = 3;
|
||||
notConfirmedGlassesDamagesSpecified = true;
|
||||
@ -617,10 +618,26 @@ export async function makeEltKaskoRequest(
|
||||
}
|
||||
}
|
||||
|
||||
const classification =
|
||||
leaseObjectCategory && [100_000_002, 100_000_003, 100_000_004].includes(leaseObjectCategory)
|
||||
? '11635'
|
||||
: '0';
|
||||
let classification = '11606';
|
||||
|
||||
switch (evo_leasingobject_type?.evo_id) {
|
||||
case '7': {
|
||||
classification = '11611';
|
||||
break;
|
||||
}
|
||||
case '3': {
|
||||
classification = '11607';
|
||||
break;
|
||||
}
|
||||
case '8': {
|
||||
classification = '11650';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
classification = '11606';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let INN = '';
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
284
apps/web/process/elt/lib/response.ts
Normal file
@ -0,0 +1,284 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
/* eslint-disable complexity */
|
||||
import type { ownOsagoRequest } from './request';
|
||||
import { getInsuranceRule } from './tools';
|
||||
import type { BaseConvertResponseInput } from './types';
|
||||
import type * as ELT from '@/api/elt/types';
|
||||
import type { Row } from '@/Components/Calculation/Form/ELT/types';
|
||||
import { MAX_FRANCHISE, MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||
import { round } from 'tools';
|
||||
|
||||
type ConvertEltOsagoResponseInput = BaseConvertResponseInput & {
|
||||
response: ELT.ResponseEltOsago;
|
||||
};
|
||||
|
||||
export async function convertEltOsagoResponse(input: ConvertEltOsagoResponseInput): Promise<Row> {
|
||||
const { context, response, row } = input;
|
||||
const { store } = context;
|
||||
|
||||
const { premiumSum = 0 } = response;
|
||||
let { message, numCalc, skCalcId, error } = response;
|
||||
let sum = premiumSum;
|
||||
|
||||
const { $calculation } = store;
|
||||
|
||||
const cost =
|
||||
$calculation.$values.getValue('plPriceRub') -
|
||||
$calculation.$values.getValue('discountRub') -
|
||||
$calculation.$values.getValue('importProgramSum') +
|
||||
$calculation.$values.getValue('addEquipmentPrice');
|
||||
|
||||
const selectedRule = await getInsuranceRule(input, { cost, riskType: 'osago' });
|
||||
|
||||
const insuranceCondition = selectedRule?.evo_id ?? null;
|
||||
|
||||
if (selectedRule) {
|
||||
const rule_evo_discount = selectedRule.evo_discount ?? 0;
|
||||
|
||||
switch (selectedRule.evo_rules_type) {
|
||||
// "не выводить результат расчета"
|
||||
case 100_000_000: {
|
||||
sum = 0;
|
||||
numCalc = Number.parseInt(defaultRow.numCalc, 2);
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
break;
|
||||
}
|
||||
|
||||
// "проверка на мин.тариф"
|
||||
case 100_000_001: {
|
||||
const newSum = round((sum / cost) * 100, 2);
|
||||
if (newSum < rule_evo_discount) {
|
||||
sum = 0;
|
||||
numCalc = Number.parseInt(defaultRow.numCalc, 2);
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// "скидка за счет КВ"
|
||||
case 100_000_002: {
|
||||
sum = (sum * (100 - rule_evo_discount)) / 100;
|
||||
numCalc = Number.parseInt(defaultRow.numCalc, 2);
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
break;
|
||||
}
|
||||
|
||||
// "акционный тариф"
|
||||
case 100_000_003: {
|
||||
sum = (rule_evo_discount / 100) * cost;
|
||||
numCalc = Number.parseInt(defaultRow.numCalc, 2);
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sum > MAX_INSURANCE) {
|
||||
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости ОСАГО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_INSURANCE)}`;
|
||||
}
|
||||
if (sum < MIN_INSURANCE) {
|
||||
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости ОСАГО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MIN_INSURANCE)}`;
|
||||
}
|
||||
|
||||
return {
|
||||
...row,
|
||||
insuranceCondition,
|
||||
message: error || message,
|
||||
numCalc: `${numCalc}`,
|
||||
skCalcId,
|
||||
status: error ? 'error' : null,
|
||||
sum,
|
||||
};
|
||||
}
|
||||
|
||||
type ResponseOwnOsago = Awaited<ReturnType<typeof ownOsagoRequest>>;
|
||||
|
||||
export function convertOwnOsagoResult(result: ResponseOwnOsago | undefined, row: Row): Row {
|
||||
if (!result) {
|
||||
return {
|
||||
...row,
|
||||
message:
|
||||
'Для получения расчета ОСАГО следует использовать калькулятор ЭЛТ или Индивидуальный запрос',
|
||||
numCalc: '',
|
||||
skCalcId: '',
|
||||
status: 'error',
|
||||
sum: 0,
|
||||
totalFranchise: 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (!result.evo_id) {
|
||||
return {
|
||||
...row,
|
||||
message: 'Сервер не вернул идентификатор страховки evo_id',
|
||||
numCalc: '',
|
||||
skCalcId: '',
|
||||
status: 'error',
|
||||
sum: result.evo_graph_price_withoutnds || 0,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...row,
|
||||
message: null,
|
||||
numCalc: result.evo_id,
|
||||
status: null,
|
||||
sum: result.evo_graph_price_withoutnds || 0,
|
||||
};
|
||||
}
|
||||
|
||||
type ConvertEltKaskoResponseInput = BaseConvertResponseInput & {
|
||||
response: ELT.ResponseEltKasko;
|
||||
};
|
||||
|
||||
export async function convertEltKaskoResponse(input: ConvertEltKaskoResponseInput): Promise<Row> {
|
||||
const { context, response, row } = input;
|
||||
const { apolloClient, store } = context;
|
||||
|
||||
const { kaskoSum = 0, paymentPeriods } = response;
|
||||
let { message, requestId, skCalcId, totalFranchise = 0, error } = response;
|
||||
|
||||
const { $calculation } = store;
|
||||
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
|
||||
let sum = leasingPeriod <= 16 ? kaskoSum : paymentPeriods?.[0]?.kaskoSum || 0;
|
||||
|
||||
const {
|
||||
data: { account: insuranceCompany },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetInsuranceCompanyDocument,
|
||||
variables: { accountId: row.key },
|
||||
});
|
||||
|
||||
if (
|
||||
insuranceCompany?.evo_kasko_fact_part !== null &&
|
||||
insuranceCompany?.evo_kasko_plan_part !== undefined &&
|
||||
insuranceCompany?.evo_kasko_plan_part !== null &&
|
||||
insuranceCompany?.evo_kasko_plan_part !== undefined &&
|
||||
insuranceCompany?.evo_kasko_fact_part > insuranceCompany?.evo_kasko_plan_part
|
||||
) {
|
||||
requestId = defaultRow.requestId;
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
sum = defaultRow.sum;
|
||||
totalFranchise = defaultRow.totalFranchise;
|
||||
error = 'Расчет закрыт';
|
||||
}
|
||||
|
||||
const cost =
|
||||
$calculation.$values.getValue('plPriceRub') -
|
||||
$calculation.$values.getValue('discountRub') -
|
||||
$calculation.$values.getValue('importProgramSum') +
|
||||
$calculation.$values.getValue('addEquipmentPrice');
|
||||
|
||||
const selectedRule = await getInsuranceRule(input, { cost, riskType: 'kasko' });
|
||||
|
||||
const insuranceCondition = selectedRule?.evo_id ?? null;
|
||||
|
||||
if (selectedRule) {
|
||||
const rule_evo_discount = selectedRule.evo_discount ?? 0;
|
||||
|
||||
switch (selectedRule.evo_rules_type) {
|
||||
// "не выводить результат расчета"
|
||||
case 100_000_000: {
|
||||
sum = 0;
|
||||
requestId = defaultRow.requestId;
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
totalFranchise = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// "проверка на мин.тариф"
|
||||
case 100_000_001: {
|
||||
const newSum = round((sum / cost) * 100, 2);
|
||||
if (newSum < rule_evo_discount) {
|
||||
sum = 0;
|
||||
requestId = defaultRow.requestId;
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
totalFranchise = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// "скидка за счет КВ"
|
||||
case 100_000_002: {
|
||||
sum = (sum * (100 - rule_evo_discount)) / 100;
|
||||
requestId = defaultRow.requestId;
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
totalFranchise = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// "акционный тариф"
|
||||
case 100_000_003: {
|
||||
sum = (rule_evo_discount / 100) * cost;
|
||||
requestId = defaultRow.requestId;
|
||||
skCalcId = defaultRow.skCalcId;
|
||||
if (selectedRule.evo_message) message = selectedRule.evo_message;
|
||||
totalFranchise = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalFranchise > MAX_FRANCHISE) {
|
||||
error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_FRANCHISE)}`;
|
||||
}
|
||||
|
||||
if (sum > MAX_INSURANCE) {
|
||||
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MAX_INSURANCE)}`;
|
||||
}
|
||||
|
||||
if (sum < MIN_INSURANCE) {
|
||||
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat(
|
||||
'ru',
|
||||
{
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}
|
||||
).format(MIN_INSURANCE)}`;
|
||||
}
|
||||
|
||||
return {
|
||||
...row,
|
||||
insuranceCondition,
|
||||
message: error || message,
|
||||
numCalc: '0',
|
||||
requestId,
|
||||
skCalcId,
|
||||
status: error ? 'error' : null,
|
||||
sum,
|
||||
totalFranchise,
|
||||
};
|
||||
}
|
||||
142
apps/web/process/elt/lib/tools.ts
Normal file
@ -0,0 +1,142 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
/* eslint-disable complexity */
|
||||
import type { BaseConvertResponseInput } from './types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import dayjs from 'dayjs';
|
||||
import { sort } from 'radash';
|
||||
|
||||
type GetInsuranceConditionParams = {
|
||||
cost: number;
|
||||
riskType: 'osago' | 'kasko';
|
||||
};
|
||||
|
||||
type Rule =
|
||||
| NonNullable<CRMTypes.GetEltInsuranceRulesQuery['evo_insurance_ruleses']>[number]
|
||||
| undefined;
|
||||
|
||||
export async function getInsuranceRule(
|
||||
input: BaseConvertResponseInput,
|
||||
{ cost, riskType }: GetInsuranceConditionParams
|
||||
) {
|
||||
const { context, row } = input;
|
||||
const { apolloClient, store } = context;
|
||||
|
||||
const { $calculation } = store;
|
||||
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
|
||||
|
||||
const currentDate = getCurrentDateString();
|
||||
|
||||
const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue();
|
||||
const leaseObjectYear = $calculation.element('tbxLeaseObjectYear').getValue();
|
||||
const leaseObjectMotorPower = $calculation.element('tbxLeaseObjectMotorPower').getValue();
|
||||
const engineType = $calculation.element('selectEngineType').getValue();
|
||||
const tbxMileage = $calculation.element('tbxMileage').getValue();
|
||||
const brand = $calculation.element('selectBrand').getValue();
|
||||
const model = $calculation.element('selectModel').getValue();
|
||||
const selectLeaseObjectUseFor = $calculation.element('selectLeaseObjectUseFor').getValue();
|
||||
const legalClientRegion = $calculation.element('selectLegalClientRegion').getValue();
|
||||
const dealerPerson = $calculation.element('selectDealerPerson').getValue();
|
||||
const cbxLeaseObjectUsed = $calculation.element('cbxLeaseObjectUsed').getValue();
|
||||
|
||||
let lead: CRMTypes.GetLeadQuery['lead'] = null;
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
if (leadid) {
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetLeadDocument,
|
||||
variables: { leadid },
|
||||
});
|
||||
({ lead } = data);
|
||||
}
|
||||
const insuranceOPF = lead?.evo_inn?.length === 12 ? 100_000_001 : 100_000_000;
|
||||
|
||||
const {
|
||||
data: { evo_insurance_ruleses },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetEltInsuranceRulesDocument,
|
||||
variables: {
|
||||
currentDate,
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: { account: insuranceCompany },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetInsuranceCompanyDocument,
|
||||
variables: { accountId: row.key },
|
||||
});
|
||||
|
||||
const filteredRules = evo_insurance_ruleses?.filter(
|
||||
(rule) =>
|
||||
rule &&
|
||||
rule.evo_insurer_accountid === insuranceCompany?.accountid &&
|
||||
(riskType === 'kasko' ? rule.evo_risk === 100_000_000 : rule.evo_risk === 100_000_003) &&
|
||||
leaseObjectCategory &&
|
||||
rule.evo_category?.includes(leaseObjectCategory) &&
|
||||
rule.evo_min_period !== null &&
|
||||
rule.evo_max_period !== null &&
|
||||
leasingPeriod !== null &&
|
||||
rule.evo_min_period <= leasingPeriod &&
|
||||
rule.evo_max_period >= leasingPeriod &&
|
||||
(rule.evo_object_type === 100_000_000 ||
|
||||
(rule.evo_object_type === 100_000_001 && cbxLeaseObjectUsed === false) ||
|
||||
(rule.evo_object_type === 100_000_002 && cbxLeaseObjectUsed === true)) &&
|
||||
selectLeaseObjectUseFor &&
|
||||
rule.evo_use_for?.includes(selectLeaseObjectUseFor) &&
|
||||
rule.evo_min_price !== null &&
|
||||
rule.evo_max_price !== null &&
|
||||
cost !== null &&
|
||||
rule.evo_min_price <= cost &&
|
||||
rule.evo_max_price >= cost &&
|
||||
rule.evo_min_year !== null &&
|
||||
rule.evo_max_year !== null &&
|
||||
leaseObjectYear !== null &&
|
||||
rule.evo_min_year <= leaseObjectYear &&
|
||||
rule.evo_max_year >= leaseObjectYear &&
|
||||
rule.evo_min_power !== null &&
|
||||
rule.evo_max_power !== null &&
|
||||
leaseObjectMotorPower !== null &&
|
||||
rule.evo_min_power <= leaseObjectMotorPower &&
|
||||
rule.evo_max_power >= leaseObjectMotorPower &&
|
||||
engineType &&
|
||||
rule.evo_enginie_type?.includes(engineType) &&
|
||||
rule.evo_opf === insuranceOPF &&
|
||||
rule.evo_min_mileage !== null &&
|
||||
rule.evo_max_mileage !== null &&
|
||||
tbxMileage !== null &&
|
||||
rule.evo_min_mileage <= tbxMileage &&
|
||||
rule.evo_max_mileage >= tbxMileage &&
|
||||
(rule.evo_brand === 100_000_000 ||
|
||||
(rule.evo_brand === 100_000_001 &&
|
||||
rule.evo_brands?.some((x) => x?.evo_brandid === brand)) ||
|
||||
(rule.evo_brand === 100_000_002 &&
|
||||
!rule.evo_brands?.some((x) => x?.evo_brandid === brand))) &&
|
||||
(rule.evo_model === 100_000_000 ||
|
||||
(rule.evo_model === 100_000_001 &&
|
||||
rule.evo_models?.some((x) => x?.evo_modelid === model)) ||
|
||||
(rule.evo_model === 100_000_002 &&
|
||||
!rule.evo_models?.some((x) => x?.evo_modelid === model))) &&
|
||||
(rule.evo_region === 100_000_000 ||
|
||||
(rule.evo_region === 100_000_001 &&
|
||||
rule.evo_regions?.some((x) => x?.evo_regionid === legalClientRegion)) ||
|
||||
(rule.evo_region === 100_000_002 &&
|
||||
!rule.evo_regions?.some((x) => x?.evo_regionid === legalClientRegion))) &&
|
||||
(rule.evo_dealer === 100_000_000 ||
|
||||
(rule.evo_dealer === 100_000_001 &&
|
||||
rule.accounts?.some((x) => x?.accountid === dealerPerson)) ||
|
||||
(rule.evo_dealer === 100_000_002 &&
|
||||
!rule.accounts?.some((x) => x?.accountid === dealerPerson)))
|
||||
);
|
||||
|
||||
// Обработка найденных записей по приоритету
|
||||
const sortedRules = filteredRules
|
||||
? sort(filteredRules, (x) => dayjs(x?.evo_datefrom).date(), true)
|
||||
: [];
|
||||
|
||||
const priorities = [100_000_000, 100_000_003, 100_000_001, 100_000_002];
|
||||
|
||||
return priorities.reduce(
|
||||
(found, priority) => found || sortedRules.find((rule) => rule?.evo_rules_type === priority),
|
||||
null as Rule
|
||||
);
|
||||
}
|
||||
7
apps/web/process/elt/lib/types.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { Row } from '@/Components/Calculation/Form/ELT/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
|
||||
export type BaseConvertResponseInput = {
|
||||
context: Pick<ProcessContext, 'apolloClient' | 'store'>;
|
||||
row: Row;
|
||||
};
|
||||
@ -259,6 +259,8 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
}
|
||||
|
||||
let okved: string | null | undefined;
|
||||
let evo_inn: string | null | undefined;
|
||||
|
||||
if (leadid) {
|
||||
const {
|
||||
data: { lead },
|
||||
@ -268,6 +270,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
});
|
||||
|
||||
okved = lead?.accountidData?.evo_okved;
|
||||
evo_inn = lead?.evo_inn;
|
||||
}
|
||||
|
||||
if (!okved && opportunityid) {
|
||||
@ -302,6 +305,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
path: ['eltKasko', 'eltOsago'],
|
||||
});
|
||||
}
|
||||
|
||||
if (!evo_inn) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'ИНН в интересе не заполнен',
|
||||
path: ['eltKasko', 'eltOsago'],
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
@ -186,18 +185,16 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
const carCategory = getCarCategory(objectTypeTax);
|
||||
|
||||
if (OKTMO) {
|
||||
const currentDate = dayjs().utc(false).toDate();
|
||||
|
||||
const response = await queryClient.fetchQuery(
|
||||
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear],
|
||||
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear, OKTMO],
|
||||
(context) =>
|
||||
getTransTax(
|
||||
{
|
||||
CalcDate: getCurrentDateString(),
|
||||
CarCategory: carCategory,
|
||||
OKTMO,
|
||||
calcDate: currentDate,
|
||||
carCategory,
|
||||
power: leaseObjectMotorPower,
|
||||
year: leaseObjectYear,
|
||||
Power: leaseObjectMotorPower,
|
||||
Year: leaseObjectYear,
|
||||
},
|
||||
context
|
||||
),
|
||||
@ -206,8 +203,8 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
if (response?.tax) {
|
||||
$calculation.element('tbxVehicleTaxInYear').setValue(response.tax);
|
||||
if (response?.Tax) {
|
||||
$calculation.element('tbxVehicleTaxInYear').setValue(response.Tax);
|
||||
} else {
|
||||
$calculation.element('tbxVehicleTaxInYear').resetValue();
|
||||
}
|
||||
|
||||
@ -207,6 +207,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
// объединить со строчкой 308
|
||||
debouncedReaction(
|
||||
() => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']),
|
||||
async ({ leaseObjectCategory, leasingWithoutKasko }) => {
|
||||
@ -304,6 +305,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
// объединить со строчкой 210
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leaseObjectType', 'maxSpeed']),
|
||||
async ({ leaseObjectType: leaseObjectTypeId, maxSpeed }) => {
|
||||
@ -330,7 +332,11 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
query: CRMTypes.GetInsuranceCompaniesDocument,
|
||||
});
|
||||
|
||||
if (evo_leasingobject_type?.evo_id === '9' && maxSpeed < 20) {
|
||||
if (
|
||||
evo_leasingobject_type?.evo_id &&
|
||||
['9', '6', '10'].includes(evo_leasingobject_type.evo_id) &&
|
||||
maxSpeed < 20
|
||||
) {
|
||||
const otherInsuranceCompany = accounts?.find(
|
||||
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
|
||||
);
|
||||
@ -347,7 +353,16 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
|
||||
$tables.insurance.row('osago').column('insCost').setValue(0).block();
|
||||
} else {
|
||||
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
||||
const defaultOsagoOptions = accounts?.filter((x) =>
|
||||
x?.evo_type_ins_policy?.includes(100_000_001)
|
||||
);
|
||||
|
||||
$tables.insurance
|
||||
.row('osago')
|
||||
.column('insuranceCompany')
|
||||
.setOptions(normalizeOptions(defaultOsagoOptions))
|
||||
.unblock();
|
||||
|
||||
$tables.insurance.row('osago').column('insured').unblock();
|
||||
$tables.insurance.row('osago').column('insCost').unblock();
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
|
||||
if (
|
||||
evo_leasingobject_type?.evo_id &&
|
||||
['9'].includes(evo_leasingobject_type?.evo_id) &&
|
||||
['9', '6', '10'].includes(evo_leasingobject_type?.evo_id) &&
|
||||
maxSpeed < 20 &&
|
||||
insurance.values.osago.insured === 100_000_001
|
||||
) {
|
||||
|
||||
@ -136,21 +136,21 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
}
|
||||
}
|
||||
|
||||
if (evo_leasingobject_type?.evo_id === '1' && countSeats >= 9) {
|
||||
if (evo_leasingobject_type?.evo_id === '1' && (countSeats <= 0 || countSeats > 9)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Количество мест должно быть меньше 9',
|
||||
message: 'Количество мест должно быть от 0 до 9',
|
||||
path: ['tbxCountSeats'],
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
|
||||
countSeats <= 8
|
||||
countSeats <= 9
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Количество мест должно быть больше 8',
|
||||
message: 'Количество мест должно быть не меньше 9',
|
||||
path: ['tbxCountSeats'],
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValue('quote'),
|
||||
async () => {
|
||||
() => {
|
||||
const quote = $calculation.element('selectQuote').getOption();
|
||||
|
||||
if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'))
|
||||
@ -29,8 +29,6 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||
onClick: () => message.destroy(key),
|
||||
});
|
||||
|
||||
const eltInitialValues = await initElt();
|
||||
|
||||
trpcClient.getQuote
|
||||
.query({
|
||||
values: {
|
||||
@ -38,7 +36,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||
...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']),
|
||||
},
|
||||
})
|
||||
.then(({ values, payments, insurance, fingap, elt, options }) => {
|
||||
.then(async ({ values, payments, insurance, fingap, elt, options }) => {
|
||||
if (options?.selectTarif) {
|
||||
$calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif));
|
||||
} else {
|
||||
@ -76,6 +74,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||
$tables.fingap.setRisks(fingap.risks);
|
||||
$tables.fingap.setSelectedKeys(fingap.keys);
|
||||
}
|
||||
const eltInitialValues = await initElt();
|
||||
|
||||
if (eltInitialValues) {
|
||||
$tables.elt.kasko.setRows(eltInitialValues.kasko);
|
||||
|
||||
@ -167,4 +167,53 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
.setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept));
|
||||
}
|
||||
);
|
||||
|
||||
{
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
function unblock() {
|
||||
const cbxPartialVAT = $calculation.element('cbxPartialVAT');
|
||||
cbxPartialVAT.unblock();
|
||||
if (cbxPartialVAT.getValue()) $calculation.element('tbxVATInLeaseObjectPrice').unblock();
|
||||
|
||||
$calculation.element('cbxInsDecentral').unblock();
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerRewardCondition').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
$calculation.element('selectDealerBrokerRewardCondition').unblock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see 'apps/web/process/used-pl/reactions.ts:common (40)'
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['dealerPerson', 'partialVAT']),
|
||||
async ({ dealerPerson: dealerPersonId }) => {
|
||||
if (!dealerPersonId) {
|
||||
unblock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetDealerPersonDocument,
|
||||
variables: {
|
||||
dealerPersonId,
|
||||
},
|
||||
});
|
||||
|
||||
if (data?.dealer_person?.evo_legal_form === 100_000_004) {
|
||||
$calculation.element('cbxPartialVAT').setValue(true).block();
|
||||
$calculation.element('tbxVATInLeaseObjectPrice').resetValue().block();
|
||||
$calculation.element('cbxInsDecentral').setValue(false).block();
|
||||
$calculation.element('selectDealerRewardCondition').block();
|
||||
$calculation.element('tbxDealerRewardSumm').resetValue().block();
|
||||
$calculation.element('selectDealerBroker').resetValue().block();
|
||||
$calculation.element('selectDealerBrokerRewardCondition').resetValue().block();
|
||||
$calculation.element('tbxDealerBrokerRewardSumm').resetValue().block();
|
||||
} else {
|
||||
unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
dealerBroker,
|
||||
dealerBrokerRewardCondition,
|
||||
dealerBrokerRewardSumm,
|
||||
dealerPerson,
|
||||
dealerPerson: dealerPersonId,
|
||||
dealerRewardCondition,
|
||||
dealerRewardSumm,
|
||||
finDepartmentRewardCondtion,
|
||||
@ -248,12 +248,12 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
|
||||
if (
|
||||
dealerRewardSumm > 0 &&
|
||||
Boolean(dealerPerson) &&
|
||||
((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(dealerPerson === indAgent && indAgentRewardSumm > 0) ||
|
||||
(dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
(dealerPerson === calcBroker && calcBrokerRewardSum > 0) ||
|
||||
(dealerPerson === calcFinDepartment && finDepartmentRewardSumm > 0))
|
||||
Boolean(dealerPersonId) &&
|
||||
((dealerPersonId === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(dealerPersonId === indAgent && indAgentRewardSumm > 0) ||
|
||||
(dealerPersonId === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
(dealerPersonId === calcBroker && calcBrokerRewardSum > 0) ||
|
||||
(dealerPersonId === calcFinDepartment && finDepartmentRewardSumm > 0))
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
@ -265,7 +265,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (
|
||||
dealerBrokerRewardSumm > 0 &&
|
||||
Boolean(dealerBroker) &&
|
||||
((dealerBroker === dealerPerson && dealerRewardSumm > 0) ||
|
||||
((dealerBroker === dealerPersonId && dealerRewardSumm > 0) ||
|
||||
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
|
||||
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
|
||||
@ -281,7 +281,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (
|
||||
indAgentRewardSumm > 0 &&
|
||||
Boolean(indAgent) &&
|
||||
((indAgent === dealerPerson && dealerRewardSumm > 0) ||
|
||||
((indAgent === dealerPersonId && dealerRewardSumm > 0) ||
|
||||
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
||||
@ -297,7 +297,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (
|
||||
calcDoubleAgentRewardSumm > 0 &&
|
||||
Boolean(calcDoubleAgent) &&
|
||||
((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) ||
|
||||
((calcDoubleAgent === dealerPersonId && dealerRewardSumm > 0) ||
|
||||
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
|
||||
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
||||
@ -313,7 +313,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (
|
||||
calcBrokerRewardSum > 0 &&
|
||||
Boolean(calcBroker) &&
|
||||
((calcBroker === dealerPerson && dealerRewardSumm > 0) ||
|
||||
((calcBroker === dealerPersonId && dealerRewardSumm > 0) ||
|
||||
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
|
||||
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
@ -329,7 +329,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (
|
||||
finDepartmentRewardSumm > 0 &&
|
||||
Boolean(calcFinDepartment) &&
|
||||
((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) ||
|
||||
((calcFinDepartment === dealerPersonId && dealerRewardSumm > 0) ||
|
||||
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
|
||||
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||
@ -360,7 +360,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!dealerPerson && !dealer?.evo_return_leasing_dealer)
|
||||
if (!dealerPersonId && !dealer?.evo_return_leasing_dealer)
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Не заполнено поле',
|
||||
@ -377,14 +377,29 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
|
||||
|
||||
await validateRewardSum({
|
||||
agentid: dealerPerson,
|
||||
agentid: dealerPersonId,
|
||||
conditionId: dealerRewardCondition,
|
||||
sum: dealerRewardSumm,
|
||||
sumFieldName: 'tbxDealerRewardSumm',
|
||||
});
|
||||
|
||||
let evo_broker_accountid: string | null = null;
|
||||
|
||||
if (dealerPersonId) {
|
||||
const {
|
||||
data: { dealer_person },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetDealerPersonDocument,
|
||||
variables: {
|
||||
dealerPersonId,
|
||||
},
|
||||
});
|
||||
|
||||
evo_broker_accountid = dealer_person?.evo_broker_accountid || null;
|
||||
}
|
||||
|
||||
await validateRewardSum({
|
||||
agentid: dealerBroker,
|
||||
agentid: dealerBroker || evo_broker_accountid,
|
||||
conditionId: dealerBrokerRewardCondition,
|
||||
sum: dealerBrokerRewardSumm,
|
||||
sumFieldName: 'tbxDealerBrokerRewardSumm',
|
||||
@ -467,6 +482,46 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
});
|
||||
}
|
||||
|
||||
if (dealerPersonId) {
|
||||
const {
|
||||
data: { dealer_person },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetDealerPersonDocument,
|
||||
variables: {
|
||||
dealerPersonId,
|
||||
},
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
async function isAgentEqualsToDealerPerson(agentid: string | null) {
|
||||
if (!agentid) return false;
|
||||
if (agentid === dealerPersonId) return true;
|
||||
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetAgentDocument,
|
||||
variables: {
|
||||
agentid,
|
||||
},
|
||||
});
|
||||
|
||||
return data?.agent?.evo_inn === dealer_person?.evo_inn;
|
||||
}
|
||||
|
||||
if (
|
||||
dealer_person?.evo_legal_form === 100_000_004 &&
|
||||
((await isAgentEqualsToDealerPerson(indAgent)) ||
|
||||
(await isAgentEqualsToDealerPerson(calcDoubleAgent)) ||
|
||||
(await isAgentEqualsToDealerPerson(calcBroker)) ||
|
||||
(await isAgentEqualsToDealerPerson(calcFinDepartment)))
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Нельзя закладывать АВ поставщику-ФЛ',
|
||||
path: ['selectDealerPerson'],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (brandId) {
|
||||
const {
|
||||
data: { evo_brand },
|
||||
|
||||
@ -90,13 +90,13 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
$calculation.element('selectImportProgram').resetValue();
|
||||
}
|
||||
|
||||
if (
|
||||
productId &&
|
||||
partialVAT &&
|
||||
$calculation.element('cbxRecalcWithRevision').getValue() === false
|
||||
) {
|
||||
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||
}
|
||||
// if (
|
||||
// productId &&
|
||||
// partialVAT &&
|
||||
// $calculation.element('cbxRecalcWithRevision').getValue() === false
|
||||
// ) {
|
||||
// $calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||
// }
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 16 KiB |
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="789.000000pt" height="789.000000pt" viewBox="0 0 789.000000 789.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,789.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M3157 7885 c-1 -2 -54 -5 -117 -9 -100 -6 -205 -17 -290 -31 -14 -3
|
||||
-43 -7 -65 -10 -68 -10 -209 -37 -290 -56 -369 -85 -762 -240 -1094 -431 -46
|
||||
-26 -85 -48 -87 -48 -8 0 -234 -154 -330 -225 -111 -82 -295 -238 -346 -291
|
||||
l-27 -29 66 -70 c124 -131 388 -409 478 -504 50 -52 101 -106 115 -121 155
|
||||
-166 325 -340 330 -338 7 3 127 108 155 134 27 27 241 176 317 222 238 141
|
||||
499 245 763 306 108 24 128 28 230 41 28 4 61 9 75 11 36 6 225 17 295 17 127
|
||||
0 313 -14 427 -34 32 -6 70 -12 85 -15 16 -2 84 -18 152 -35 514 -127 1007
|
||||
-429 1334 -819 40 -47 75 -87 78 -90 3 -3 37 -50 76 -105 131 -188 227 -370
|
||||
304 -579 32 -88 85 -272 94 -326 3 -19 8 -42 10 -50 2 -8 7 -33 10 -55 3 -23
|
||||
8 -52 11 -65 18 -90 25 -418 11 -565 -55 -572 -304 -1093 -722 -1510 -213
|
||||
-213 -420 -361 -690 -494 -234 -115 -497 -201 -725 -236 -19 -3 -46 -7 -60
|
||||
-10 -22 -4 -60 -8 -195 -21 -55 -5 -353 -5 -390 0 -16 2 -61 7 -100 10 -98 9
|
||||
-327 50 -345 61 -3 2 -19 6 -34 9 -64 12 -243 70 -351 114 -83 35 -360 176
|
||||
-375 192 -3 3 -30 21 -60 40 -65 41 -51 31 -176 129 -56 43 -123 99 -150 125
|
||||
-27 25 -52 46 -55 46 -6 0 -50 -46 -329 -340 -85 -90 -175 -184 -200 -211 -25
|
||||
-26 -106 -111 -180 -190 -74 -79 -148 -157 -165 -174 -106 -110 -119 -126
|
||||
-109 -133 6 -4 47 -39 90 -79 303 -275 708 -535 1084 -697 36 -15 66 -27 68
|
||||
-27 1 1 17 -6 35 -15 33 -18 321 -120 359 -128 13 -3 72 -19 132 -35 129 -36
|
||||
282 -69 401 -86 22 -4 47 -8 55 -10 8 -2 43 -7 78 -10 35 -4 71 -8 80 -10 129
|
||||
-24 730 -24 882 0 14 3 50 7 80 10 61 6 79 9 195 30 44 8 91 16 105 19 14 2
|
||||
66 14 115 26 50 12 97 23 105 25 87 18 389 118 516 170 908 375 1640 1047
|
||||
2070 1905 120 239 217 490 270 695 1 6 12 46 23 90 12 44 23 90 26 103 2 12 6
|
||||
30 9 40 3 9 7 28 10 42 2 14 9 52 15 85 6 33 13 76 15 95 2 19 7 55 10 80 4
|
||||
25 8 61 11 80 26 207 26 621 -1 860 -13 126 -61 394 -83 468 -5 18 -10 33 -10
|
||||
35 1 7 -17 75 -43 162 -200 674 -573 1272 -1099 1760 -101 94 -130 118 -261
|
||||
220 -68 52 -128 99 -133 103 -29 23 -195 132 -201 132 -4 0 -15 6 -23 14 -9 8
|
||||
-32 23 -51 34 -19 11 -69 39 -110 62 -208 119 -540 261 -783 334 -126 38 -290
|
||||
81 -347 91 -19 3 -51 10 -70 15 -38 9 -66 14 -175 30 -121 18 -212 28 -315 36
|
||||
-71 6 -487 13 -493 9z"/>
|
||||
<path d="M3348 4996 c-1 -2 -41 -6 -88 -10 -110 -7 -139 -13 -235 -43 -293
|
||||
-92 -534 -309 -651 -585 -57 -135 -76 -223 -80 -378 -5 -192 21 -324 93 -476
|
||||
28 -58 82 -154 93 -164 3 -3 17 -21 32 -41 139 -186 385 -334 638 -384 108
|
||||
-21 340 -14 442 13 318 86 554 278 696 567 30 62 67 168 77 220 27 154 31 290
|
||||
10 420 -11 67 -64 214 -105 294 -164 312 -484 527 -830 557 -36 3 -70 7 -77 9
|
||||
-6 2 -13 2 -15 1z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.0 KiB |
@ -4,7 +4,7 @@ import type { inferAsyncReturnType } from '@trpc/server';
|
||||
import type { CreateNextContextOptions } from '@trpc/server/adapters/next';
|
||||
|
||||
export async function createContext({ req }: CreateNextContextOptions) {
|
||||
const { cookie = '', authorization } = req.headers;
|
||||
const { cookie = '', authorization, 'user-agent': userAgent } = req.headers;
|
||||
|
||||
const user = await getUser({
|
||||
headers: {
|
||||
@ -18,6 +18,7 @@ export async function createContext({ req }: CreateNextContextOptions) {
|
||||
return {
|
||||
headers: { authorization },
|
||||
user,
|
||||
userAgent,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { mergeRouters } from '../trpc';
|
||||
import { calculateRouter } from './calculate';
|
||||
import { eltRouter } from './elt';
|
||||
import { quoteRouter } from './quote';
|
||||
import { tarifRouter } from './tarif';
|
||||
|
||||
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter);
|
||||
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter, eltRouter);
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
|
||||
5
apps/web/server/routers/elt/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { mergeRouters } from '../../trpc';
|
||||
import { eltKaskoRouter } from './kasko';
|
||||
import { eltOsagoRouter } from './osago';
|
||||
|
||||
export const eltRouter = mergeRouters(eltOsagoRouter, eltKaskoRouter);
|
||||
45
apps/web/server/routers/elt/kasko.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { protectedProcedure } from '../../procedure';
|
||||
import { router } from '../../trpc';
|
||||
import { EltInputSchema, EltOutputSchema } from './types';
|
||||
import { getEltKasko } from '@/api/elt/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import eltHelper from '@/process/elt/lib/helper';
|
||||
import { makeEltKaskoRequest } from '@/process/elt/lib/request';
|
||||
import { convertEltKaskoResponse } from '@/process/elt/lib/response';
|
||||
import RootStore from '@/stores/root';
|
||||
import { createTRPCError } from '@/utils/trpc';
|
||||
|
||||
export const eltKaskoRouter = router({
|
||||
eltKasko: protectedProcedure
|
||||
.input(EltInputSchema)
|
||||
.output(EltOutputSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
try {
|
||||
const apolloClient = initializeApollo(null, ctx.headers);
|
||||
const store = new RootStore();
|
||||
store.$calculation.$values.hydrate(input.calculation.values);
|
||||
|
||||
const context = { apolloClient, store };
|
||||
const { init: initElt } = await eltHelper(context);
|
||||
const { kasko: initRows } = await initElt();
|
||||
|
||||
const requests = initRows.map((row) =>
|
||||
makeEltKaskoRequest(context, row)
|
||||
.then((request) => getEltKasko(request))
|
||||
.then((response) => convertEltKaskoResponse({ context, response, row }))
|
||||
.then((convertedRow) => convertedRow)
|
||||
.catch((error) => ({
|
||||
...row,
|
||||
message: error.message,
|
||||
status: 'error',
|
||||
}))
|
||||
);
|
||||
|
||||
return {
|
||||
rows: await Promise.all(requests),
|
||||
};
|
||||
} catch (error) {
|
||||
throw createTRPCError(error);
|
||||
}
|
||||
}),
|
||||
});
|
||||
47
apps/web/server/routers/elt/osago.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { protectedProcedure } from '../../procedure';
|
||||
import { router } from '../../trpc';
|
||||
import { EltInputSchema, EltOutputSchema } from './types';
|
||||
import { getEltOsago } from '@/api/elt/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import eltHelper from '@/process/elt/lib/helper';
|
||||
import { makeEltOsagoRequest, ownOsagoRequest } from '@/process/elt/lib/request';
|
||||
import { convertEltOsagoResponse, convertOwnOsagoResult } from '@/process/elt/lib/response';
|
||||
import RootStore from '@/stores/root';
|
||||
import { createTRPCError } from '@/utils/trpc';
|
||||
|
||||
export const eltOsagoRouter = router({
|
||||
eltOsago: protectedProcedure
|
||||
.input(EltInputSchema)
|
||||
.output(EltOutputSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
try {
|
||||
const apolloClient = initializeApollo(null, ctx.headers);
|
||||
const store = new RootStore();
|
||||
store.$calculation.$values.hydrate(input.calculation.values);
|
||||
|
||||
const context = { apolloClient, store };
|
||||
const { init: initElt } = await eltHelper({ apolloClient, store });
|
||||
const { osago: initRows } = await initElt();
|
||||
|
||||
const requests = initRows.map(async (row) => {
|
||||
if (row.metodCalc === 'CRM') {
|
||||
return ownOsagoRequest({ apolloClient, store }, row).then((request) =>
|
||||
convertOwnOsagoResult(request, row)
|
||||
);
|
||||
}
|
||||
|
||||
return makeEltOsagoRequest({ apolloClient, store }, row).then((request) =>
|
||||
getEltOsago(request)
|
||||
.then((response) => convertEltOsagoResponse({ context, response, row }))
|
||||
.catch((error) => ({ ...row, message: error.message, status: 'error' }))
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
rows: await Promise.all(requests),
|
||||
};
|
||||
} catch (error) {
|
||||
throw createTRPCError(error);
|
||||
}
|
||||
}),
|
||||
});
|
||||
13
apps/web/server/routers/elt/types.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { RowSchema } from '@/config/schema/elt';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const EltInputSchema = z.object({
|
||||
calculation: z.object({
|
||||
values: ValuesSchema,
|
||||
}),
|
||||
});
|
||||
|
||||
export const EltOutputSchema = z.object({
|
||||
rows: RowSchema.array(),
|
||||
});
|
||||
@ -42,6 +42,7 @@ import type { CalculationValues } from '@/stores/calculation/values/types';
|
||||
import { HttpError } from '@/utils/error';
|
||||
import { createTRPCError } from '@/utils/trpc';
|
||||
import { QueryClient } from '@tanstack/react-query';
|
||||
import { UAParser } from 'ua-parser-js';
|
||||
|
||||
const defaultInsurance = {
|
||||
values: {
|
||||
@ -184,6 +185,7 @@ export const quoteRouter = router({
|
||||
additionalData: requestData.additionalData,
|
||||
},
|
||||
elt: input.elt,
|
||||
__info: new UAParser(ctx.userAgent).getResult(),
|
||||
});
|
||||
|
||||
const createKPResult = await createKP(requestCreateKP);
|
||||
|
||||
@ -48,6 +48,7 @@ export const GetQuoteOutputDataSchema = z
|
||||
elt: z
|
||||
.object({
|
||||
kasko: EltRowSchema.pick({
|
||||
insuranceCondition: true,
|
||||
key: true,
|
||||
requestId: true,
|
||||
skCalcId: true,
|
||||
@ -55,6 +56,7 @@ export const GetQuoteOutputDataSchema = z
|
||||
totalFranchise: true,
|
||||
}).optional(),
|
||||
osago: EltRowSchema.pick({
|
||||
insuranceCondition: true,
|
||||
key: true,
|
||||
numCalc: true,
|
||||
sum: true,
|
||||
|
||||
@ -2,6 +2,7 @@ import type * as ELT from '@/Components/Calculation/Form/ELT/types';
|
||||
|
||||
export const defaultRow: ELT.Row = {
|
||||
id: '',
|
||||
insuranceCondition: null,
|
||||
key: '',
|
||||
message: null,
|
||||
metodCalc: 'ELT',
|
||||
|
||||
@ -4,12 +4,20 @@ import type { AxiosError } from 'axios';
|
||||
import { isAxiosError } from 'axios';
|
||||
import { pick } from 'radash';
|
||||
|
||||
function getErrorMessage<T extends { error?: string; errors?: string[]; message?: string }>(
|
||||
error: AxiosError<T>
|
||||
) {
|
||||
type ResponseError = {
|
||||
Error?: string;
|
||||
error?: string;
|
||||
errors?: string[];
|
||||
fullMessage?: string;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
function getErrorMessage<T extends ResponseError>(error: AxiosError<T>) {
|
||||
return (
|
||||
error.response?.data?.Error ||
|
||||
error.response?.data?.error ||
|
||||
error.response?.data?.errors?.[0] ||
|
||||
error.response?.data.fullMessage ||
|
||||
error.response?.data?.message ||
|
||||
error.message
|
||||
);
|
||||
|
||||
@ -16,6 +16,8 @@ services:
|
||||
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
||||
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
||||
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
||||
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
|
||||
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
|
||||
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
||||
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
||||
build:
|
||||
@ -34,6 +36,8 @@ services:
|
||||
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
||||
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
||||
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
||||
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
|
||||
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
|
||||
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
||||
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
||||
context: .
|
||||
|
||||
17
pnpm-lock.yaml
generated
@ -189,6 +189,9 @@ importers:
|
||||
tools:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/tools
|
||||
ua-parser-js:
|
||||
specifier: ^1.0.38
|
||||
version: 1.0.38
|
||||
ui:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/ui
|
||||
@ -235,6 +238,9 @@ importers:
|
||||
'@types/styled-components':
|
||||
specifier: ^5.1.26
|
||||
version: 5.1.34
|
||||
'@types/ua-parser-js':
|
||||
specifier: ^0.7.39
|
||||
version: 0.7.39
|
||||
'@vchikalkin/eslint-config-awesome':
|
||||
specifier: ^1.1.6
|
||||
version: 1.1.6(@babel/eslint-plugin@7.23.5)(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(@types/node@18.19.18)(eslint-plugin-import@2.29.1)(eslint@8.57.0)(graphql@16.8.1)(jest@29.7.0)(prettier@3.2.5)(typescript@5.3.3)
|
||||
@ -3953,6 +3959,10 @@ packages:
|
||||
resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
|
||||
dev: true
|
||||
|
||||
/@types/ua-parser-js@0.7.39:
|
||||
resolution: {integrity: sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==}
|
||||
dev: true
|
||||
|
||||
/@types/ws@8.5.10:
|
||||
resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
|
||||
dependencies:
|
||||
@ -7715,7 +7725,7 @@ packages:
|
||||
object-assign: 4.1.1
|
||||
promise: 7.3.1
|
||||
setimmediate: 1.0.5
|
||||
ua-parser-js: 1.0.37
|
||||
ua-parser-js: 1.0.38
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: true
|
||||
@ -13570,9 +13580,8 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/ua-parser-js@1.0.37:
|
||||
resolution: {integrity: sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==}
|
||||
dev: true
|
||||
/ua-parser-js@1.0.38:
|
||||
resolution: {integrity: sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==}
|
||||
|
||||
/uid@2.0.2:
|
||||
resolution: {integrity: sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==}
|
||||
|
||||