add processes exports
This commit is contained in:
parent
dc0b19296f
commit
4a71384fcd
@ -10,14 +10,14 @@ type BuilderProps = {
|
||||
|
||||
export default function buildAction<T>(
|
||||
Component: ComponentType<T>,
|
||||
{ elementName, valueName: actionName }: BuilderProps
|
||||
{ elementName, valueName: processName }: BuilderProps
|
||||
) {
|
||||
return observer((props: T) => {
|
||||
const status = useStatus(elementName);
|
||||
|
||||
return (
|
||||
<Component
|
||||
action={() => import(`process/${actionName}`).then((module) => module.default())}
|
||||
action={() => import(`process/${processName}/action`).then((module) => module.action())}
|
||||
status={status}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
@ -15,7 +15,7 @@ type QuotePaymentsProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getBonusDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId },
|
||||
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/bonuses/index.ts
Normal file
2
apps/web/process/bonuses/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
@ -1 +1 @@
|
||||
export default () => {};
|
||||
export function action() {}
|
||||
|
||||
2
apps/web/process/calculate/index.ts
Normal file
2
apps/web/process/calculate/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './action';
|
||||
export * from './reactions';
|
||||
@ -15,7 +15,7 @@ type QuotePaymentsProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getConfiguratorDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId },
|
||||
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/configurator/index.ts
Normal file
2
apps/web/process/configurator/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
@ -1 +1 @@
|
||||
export default () => {};
|
||||
export function action() {}
|
||||
|
||||
2
apps/web/process/create-kp/index.ts
Normal file
2
apps/web/process/create-kp/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './action';
|
||||
export * from './reactions';
|
||||
@ -27,7 +27,7 @@ type QuoteFingapProcessData = {
|
||||
};
|
||||
};
|
||||
|
||||
export default async function getFingapDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId },
|
||||
}: GetQuoteDataInput): Promise<QuoteFingapProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/fingap/index.ts
Normal file
2
apps/web/process/fingap/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
@ -1,42 +1,42 @@
|
||||
import * as bonusesReactions from '../../bonuses/reactions';
|
||||
import * as calculateReactions from '../../calculate/reactions';
|
||||
import * as configurator from '../../configurator/reactions';
|
||||
import * as createKPReactions from '../../create-kp/reactions';
|
||||
import * as fingapReactions from '../../fingap/reactions';
|
||||
import * as leadOpportunityReactions from '../../lead-opportunity/reactions';
|
||||
import * as leasingObject from '../../leasing-object/reactions';
|
||||
import * as leasingWithoutKaskoReactions from '../../leasing-without-kasko/reactions';
|
||||
import * as loadKP from '../../load-kp/reactions';
|
||||
import * as priceReactions from '../../price/reactions';
|
||||
import * as subsidyReactions from '../../subsidy/reactions';
|
||||
import * as subsidyImportProgram from '../../subsidy-import-program/reactions';
|
||||
import * as agentsReactions from '../../supplier-agent/reactions';
|
||||
import * as usedPl from '../../used-pl/reactions';
|
||||
import * as bonuses from '../../bonuses';
|
||||
import * as calculate from '../../calculate';
|
||||
import * as configurator from '../../configurator';
|
||||
import * as createKP from '../../create-kp';
|
||||
import * as fingap from '../../fingap';
|
||||
import * as leadOpportunity from '../../lead-opportunity';
|
||||
import * as leasingObject from '../../leasing-object';
|
||||
import * as leasingWithoutKasko from '../../leasing-without-kasko';
|
||||
import * as loadKP from '../../load-kp';
|
||||
import * as price from '../../price';
|
||||
import * as subsidy from '../../subsidy';
|
||||
import * as subsidyImportProgram from '../../subsidy-import-program';
|
||||
import * as agents from '../../supplier-agent';
|
||||
import * as usedPl from '../../used-pl';
|
||||
|
||||
export default function injectDefaultReactions(context) {
|
||||
leadOpportunityReactions.common(context);
|
||||
leadOpportunityReactions.urls(context);
|
||||
leadOpportunity.common(context);
|
||||
leadOpportunity.urls(context);
|
||||
loadKP.common(context);
|
||||
calculateReactions.validation(context);
|
||||
calculateReactions.common(context);
|
||||
agentsReactions.common(context);
|
||||
agentsReactions.validation(context);
|
||||
priceReactions.computed(context);
|
||||
priceReactions.common(context);
|
||||
priceReactions.validation(context);
|
||||
fingapReactions.common(context);
|
||||
fingapReactions.validation(context);
|
||||
calculate.validation(context);
|
||||
calculate.common(context);
|
||||
agents.common(context);
|
||||
agents.validation(context);
|
||||
price.computed(context);
|
||||
price.common(context);
|
||||
price.validation(context);
|
||||
fingap.common(context);
|
||||
fingap.validation(context);
|
||||
loadKP.common(context);
|
||||
leasingWithoutKaskoReactions.common(context);
|
||||
subsidyReactions.common(context);
|
||||
leasingWithoutKasko.common(context);
|
||||
subsidy.common(context);
|
||||
leasingObject.common(context);
|
||||
leasingObject.validation(context);
|
||||
configurator.filters(context);
|
||||
configurator.values(context);
|
||||
configurator.validation(context);
|
||||
createKPReactions.common(context);
|
||||
bonusesReactions.common(context);
|
||||
bonusesReactions.validation(context);
|
||||
createKP.common(context);
|
||||
bonuses.common(context);
|
||||
bonuses.validation(context);
|
||||
usedPl.common(context);
|
||||
subsidyImportProgram.common(context);
|
||||
}
|
||||
|
||||
1
apps/web/process/lead-opportunity/index.ts
Normal file
1
apps/web/process/lead-opportunity/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './reactions';
|
||||
@ -38,7 +38,7 @@ type QuoteLeasingObjectProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getLeasingObjectDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId, recalcWithRevision },
|
||||
}: GetQuoteDataInput): Promise<QuoteLeasingObjectProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/leasing-object/index.ts
Normal file
2
apps/web/process/leasing-object/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
1
apps/web/process/leasing-without-kasko/index.ts
Normal file
1
apps/web/process/leasing-without-kasko/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './reactions';
|
||||
2
apps/web/process/load-kp/index.ts
Normal file
2
apps/web/process/load-kp/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './reactions';
|
||||
export * from './types';
|
||||
@ -31,7 +31,7 @@ type QuotePaymentsProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getPaymentsDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId, recalcWithRevision },
|
||||
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/payments/index.ts
Normal file
2
apps/web/process/payments/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
@ -26,7 +26,7 @@ type QuotePaymentsProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getPriceDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId },
|
||||
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/price/index.ts
Normal file
2
apps/web/process/price/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
1
apps/web/process/subsidy-import-program/index.ts
Normal file
1
apps/web/process/subsidy-import-program/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './reactions';
|
||||
1
apps/web/process/subsidy/index.ts
Normal file
1
apps/web/process/subsidy/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './reactions';
|
||||
@ -43,7 +43,7 @@ type QuoteSupplierAgentProcessData = {
|
||||
values: Partial<GetQuoteDataOutput['values']>;
|
||||
};
|
||||
|
||||
export default async function getSupplierAgentsDataFromKP({
|
||||
export async function getKPData({
|
||||
values: { quote: quoteId },
|
||||
}: GetQuoteDataInput): Promise<QuoteSupplierAgentProcessData> {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
2
apps/web/process/supplier-agent/index.ts
Normal file
2
apps/web/process/supplier-agent/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * from './reactions';
|
||||
1
apps/web/process/used-pl/index.ts
Normal file
1
apps/web/process/used-pl/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './reactions';
|
||||
@ -2,14 +2,14 @@
|
||||
import { t } from '../server';
|
||||
import defaultValues from '@/config/default-values';
|
||||
import { defaultValues as defaultInsuranceValues } from '@/config/tables/insurance-table';
|
||||
import getBonusDataFromKP from '@/process/bonuses/get-kp-data';
|
||||
import getConfiguratorDataFromKP from '@/process/configurator/get-kp-data';
|
||||
import getFingapDataFromKP from '@/process/fingap/get-kp-data';
|
||||
import getLeasingObjectDataFromKP from '@/process/leasing-object/get-kp-data';
|
||||
import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from '@/process/load-kp/types';
|
||||
import getPaymentsDataFromKP from '@/process/payments/get-kp-data';
|
||||
import getPriceDataFromKP from '@/process/price/get-kp-data';
|
||||
import getSupplierAgentsDataFromKP from '@/process/supplier-agent/get-kp-data';
|
||||
import * as bonuses from '@/process/bonuses';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as fingapProcess from '@/process/fingap';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from '@/process/load-kp';
|
||||
import * as paymentsProcess from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
import { shake } from 'radash';
|
||||
|
||||
const DEFAULT_OSAGO_ROW = defaultInsuranceValues.find((x) => x.key === 'osago');
|
||||
@ -20,13 +20,13 @@ const quoteRouter = t.router({
|
||||
.input(GetQuoteDataInputSchema)
|
||||
.output(GetQuoteDataOutputSchema)
|
||||
.query(async ({ input }) => {
|
||||
const { values: configuratorValues } = await getConfiguratorDataFromKP(input);
|
||||
const { values: supplierAgentsValues } = await getSupplierAgentsDataFromKP(input);
|
||||
const { values: paymentsValues, payments } = await getPaymentsDataFromKP(input);
|
||||
const { values: priceValues } = await getPriceDataFromKP(input);
|
||||
const { values: bonusValues } = await getBonusDataFromKP(input);
|
||||
const { values: leasingObjectValues } = await getLeasingObjectDataFromKP(input);
|
||||
const { fingap, insurance: fingapInsurance } = await getFingapDataFromKP(input);
|
||||
const { values: configuratorValues } = await configurator.getKPData(input);
|
||||
const { values: supplierAgentsValues } = await supplierAgent.getKPData(input);
|
||||
const { values: paymentsValues, payments } = await paymentsProcess.getKPData(input);
|
||||
const { values: priceValues } = await price.getKPData(input);
|
||||
const { values: bonusesValues } = await bonuses.getKPData(input);
|
||||
const { values: leasingObjectValues } = await leasingObject.getKPData(input);
|
||||
const { fingap, insurance: fingapInsurance } = await fingapProcess.getKPData(input);
|
||||
|
||||
// TODO: remove this temp fix
|
||||
const quoteValues = shake({
|
||||
@ -34,7 +34,7 @@ const quoteRouter = t.router({
|
||||
...supplierAgentsValues,
|
||||
...paymentsValues,
|
||||
...priceValues,
|
||||
...bonusValues,
|
||||
...bonusesValues,
|
||||
...leasingObjectValues,
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user