From bcd7bed22efce4dc547eb007aa38c48ac03d86a6 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 27 Feb 2023 15:36:36 +0300 Subject: [PATCH] load-kp: fix type names remove shake function --- apps/web/graphql/crm.types.ts | 42 ++++---- apps/web/process/bonuses/get-kp-data.ts | 24 ++--- apps/web/process/configurator/get-kp-data.ts | 21 ++-- apps/web/process/fingap/get-kp-data.ts | 23 ++-- apps/web/process/gibdd/get-kp-data.ts | 61 ++++------- .../web/process/leasing-object/get-kp-data.ts | 100 ++++++------------ apps/web/process/load-kp/types.ts | 28 +++-- apps/web/process/payments/get-kp-data.ts | 33 +++--- apps/web/process/price/get-kp-data.ts | 51 +++++---- .../supplier-agent/get-kp-data/get-sums.ts | 21 ++-- .../supplier-agent/get-kp-data/index.ts | 44 +++----- apps/web/trpc/routers/quote.ts | 25 ++--- 12 files changed, 204 insertions(+), 269 deletions(-) diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index 7a848ae..384d978 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -400,26 +400,26 @@ export type GetAddProductTypeQueryVariables = Exact<{ export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null } | null }; -export type GetBonusDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteBonusDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetBonusDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_sale_bonus: number | null } | null }; +export type GetQuoteBonusDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_sale_bonus: number | null } | null }; -export type GetConfiguratorDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteConfiguratorDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetConfiguratorDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null }; +export type GetQuoteConfiguratorDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null }; -export type GetFingapDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteFingapDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetFingapDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; +export type GetQuoteFingapDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; export type GetFinGapAddProductTypesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -428,12 +428,12 @@ export type GetFinGapAddProductTypesQueryVariables = Exact<{ export type GetFinGapAddProductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null, evo_name: string | null, evo_type_calc_cerebellum: number | null, evo_cost_service_provider_withoutnds: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null } | null> | null } | null> | null }; -export type GetGibddDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteGibddDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetGibddDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_db_accept_registration: number | null, evo_object_registration: number | null, evo_pts_type: number | null, evo_vehicle_tax_year: number | null, evo_vehicle_tax_approved: number | null, evo_category_tr: number | null, evo_vehicle_type_tax: number | null, evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null, evo_registration_regionid: string | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | null } | null }; +export type GetQuoteGibddDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_db_accept_registration: number | null, evo_object_registration: number | null, evo_pts_type: number | null, evo_vehicle_tax_year: number | null, evo_vehicle_tax_approved: number | null, evo_category_tr: number | null, evo_vehicle_type_tax: number | null, evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null, evo_registration_regionid: string | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | null } | null }; export type GetQuoteRegionTownQueryVariables = Exact<{ quoteId: Scalars['Uuid']; @@ -470,12 +470,12 @@ export type GetQuoteUrlQueryVariables = Exact<{ export type GetQuoteUrlQuery = { __typename?: 'Query', entity: { __typename?: 'quote', link: string | null } | null }; -export type GetLeasingObjectDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteLeasingObjectDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetLeasingObjectDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_vin: string | null, evo_year: number | null } | null }; +export type GetQuoteLeasingObjectDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_vin: string | null, evo_year: number | null } | null }; export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{ currentDate: InputMaybe; @@ -484,19 +484,19 @@ export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{ export type GetLeasingWithoutKaskoOptionsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_min_price: number | null, evo_max_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null> | null }; -export type GetPaymentsDataFromQuoteQueryVariables = Exact<{ +export type GetQuotePaymentsDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetPaymentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string | null, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null } | null> | null } | null> | null } | null }; +export type GetQuotePaymentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string | null, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null } | null> | null } | null> | null } | null }; -export type GetPriceDataFromQuoteQueryVariables = Exact<{ +export type GetQuotePriceDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetPriceDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_perc: number | null, evo_discount_perc: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null } | null }; +export type GetQuotePriceDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_perc: number | null, evo_discount_perc: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null } | null }; export type GetRewardRulesQueryVariables = Exact<{ conditionId: Scalars['Uuid']; @@ -555,19 +555,19 @@ export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":" export const GetAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddproductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}}]}}]} as unknown as DocumentNode; export const GetRegistrationTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegistrationTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_whom_register"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gibdd_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_towtruck"}}]}}]}}]} as unknown as DocumentNode; export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}}]}}]}}]} as unknown as DocumentNode; -export const GetBonusDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBonusDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; -export const GetConfiguratorDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguratorDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; -export const GetFingapDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFingapDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteBonusDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteBonusData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteConfiguratorDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteConfiguratorData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteFingapDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteFingapData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetGibddDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGibddDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteGibddDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteGibddData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteRegionTownDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteRegionTown"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}}]}}]}}]} as unknown as DocumentNode; export const GetInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"osago"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"kasko"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"fingap"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeadUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunityUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; -export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteLeasingObjectDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteLeasingObjectData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode; export const GetLeasingWithoutKaskoOptionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoOptions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetPaymentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentsDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuotePaymentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePaymentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetQuotePriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePriceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardRules"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode; export const GetAgentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentsDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/apps/web/process/bonuses/get-kp-data.ts b/apps/web/process/bonuses/get-kp-data.ts index 187bd76..b0ba0f8 100644 --- a/apps/web/process/bonuses/get-kp-data.ts +++ b/apps/web/process/bonuses/get-kp-data.ts @@ -1,32 +1,30 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_BONUS_DATA_FROM_QUOTE = gql` - query GetBonusDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_BONUS_DATA = gql` + query GetQuoteBonusData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_sale_bonus } } `; -type QuotePaymentsProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetBonusDataFromQuoteQuery, - CRMTypes.GetBonusDataFromQuoteQueryVariables - >({ - query: QUERY_GET_BONUS_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteBonusDataDocument, variables: { quoteId, }, @@ -34,7 +32,7 @@ export async function getKPData({ return { values: { - saleBonus: quote?.evo_sale_bonus ?? undefined, + saleBonus: quote?.evo_sale_bonus ?? defaultValues.saleBonus, }, }; } diff --git a/apps/web/process/configurator/get-kp-data.ts b/apps/web/process/configurator/get-kp-data.ts index deb7fd8..b00611b 100644 --- a/apps/web/process/configurator/get-kp-data.ts +++ b/apps/web/process/configurator/get-kp-data.ts @@ -1,32 +1,29 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE = gql` - query GetConfiguratorDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_CONFIGURATOR_DATA = gql` + query GetQuoteConfiguratorData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_baseproductid } } `; -type QuotePaymentsProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetConfiguratorDataFromQuoteQuery, - CRMTypes.GetConfiguratorDataFromQuoteQueryVariables - >({ - query: QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteConfiguratorDataDocument, variables: { quoteId, }, diff --git a/apps/web/process/fingap/get-kp-data.ts b/apps/web/process/fingap/get-kp-data.ts index a6de230..5498d10 100644 --- a/apps/web/process/fingap/get-kp-data.ts +++ b/apps/web/process/fingap/get-kp-data.ts @@ -1,14 +1,14 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; import { defaultValues } from '@/config/tables/insurance-table'; -import type * as CRMTypes from '@/graphql/crm.types'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const DEFAULT_FINGAP_ROW = defaultValues.find((x) => x.key === 'fingap')!; -const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql` - query GetFingapDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_FINGAP_DATA = gql` + query GetQuoteFingapData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_fingap_accountid evo_fingap_payer @@ -20,25 +20,22 @@ const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql` } `; -type QuoteFingapProcessData = { - fingap: GetQuoteDataOutput['fingap']; +type OutputData = { + fingap: GetQuoteOutputData['fingap']; insurance: { - values: Pick; + values: Pick; }; }; export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetFingapDataFromQuoteQuery, - CRMTypes.GetFingapDataFromQuoteQueryVariables - >({ - query: QUERY_GET_FINGAP_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteFingapDataDocument, variables: { quoteId, }, diff --git a/apps/web/process/gibdd/get-kp-data.ts b/apps/web/process/gibdd/get-kp-data.ts index 10b5ec5..08e72a9 100644 --- a/apps/web/process/gibdd/get-kp-data.ts +++ b/apps/web/process/gibdd/get-kp-data.ts @@ -1,12 +1,13 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import helper from './lib/helper'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_GIBDD_DATA_FROM_QUOTE = gql` - query GetGibddDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_GIBDD_DATA = gql` + query GetQuoteGibddData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_db_accept_registration evo_object_registration @@ -28,33 +29,24 @@ const QUERY_GET_GIBDD_DATA_FROM_QUOTE = gql` } `; -export type Quote = NonNullable; - -type QuoteLeasingObjectProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; -export async function getKPData({ - values: { quote: quoteId, recalcWithRevision, lead: leadId, opportunity: opportunityId }, -}: GetQuoteDataInput): Promise { +export async function getKPData({ values }: GetQuoteInputData): Promise { + const { quote: quoteId, recalcWithRevision, lead: leadId, opportunity: opportunityId } = values; + const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetGibddDataFromQuoteQuery, - CRMTypes.GetGibddDataFromQuoteQueryVariables - >({ - query: QUERY_GET_GIBDD_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteGibddDataDocument, variables: { quoteId, }, }); - if (!quote) { - throw new Error('Quote is empty'); - } - const { getLegalRegion, getLegalTown, getRegion, getTown } = helper({ apolloClient, }); @@ -85,19 +77,7 @@ export async function getKPData({ regionId, }); - const { - evo_db_accept_registration, - evo_object_registration, - evo_pts_type, - evo_vehicle_tax_approved, - evo_vehicle_tax_year, - evo_registration_regionid, - evo_addproduct_types, - evo_category_tr, - evo_vehicle_type_tax, - } = quote; - - const registration = evo_addproduct_types?.find( + const registration = quote?.evo_addproduct_types?.find( (x) => x?.evo_product_type === 100_000_001 )?.evo_addproduct_typeid; @@ -105,16 +85,19 @@ export async function getKPData({ values: { legalClientRegion: legalRegionId, legalClientTown: legalTownId, - objectCategoryTax: evo_category_tr, - objectRegionRegistration: evo_registration_regionid, - objectRegistration: recalcWithRevision ? evo_db_accept_registration : evo_object_registration, - objectTypeTax: evo_vehicle_type_tax ?? undefined, + objectCategoryTax: quote?.evo_category_tr, + objectRegionRegistration: quote?.evo_registration_regionid, + objectRegistration: recalcWithRevision + ? quote?.evo_db_accept_registration + : quote?.evo_object_registration, + objectTypeTax: quote?.evo_vehicle_type_tax, regionRegistration: regionId, registration, townRegistration: townId, - typePTS: evo_pts_type, + typePTS: quote?.evo_pts_type, vehicleTaxInYear: - (recalcWithRevision ? evo_vehicle_tax_approved : evo_vehicle_tax_year) ?? undefined, + (recalcWithRevision ? quote?.evo_vehicle_tax_approved : quote?.evo_vehicle_tax_year) ?? + defaultValues.vehicleTaxInYear, }, }; } diff --git a/apps/web/process/leasing-object/get-kp-data.ts b/apps/web/process/leasing-object/get-kp-data.ts index 9b5a2ce..7fa052d 100644 --- a/apps/web/process/leasing-object/get-kp-data.ts +++ b/apps/web/process/leasing-object/get-kp-data.ts @@ -1,11 +1,12 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE = gql` - query GetLeasingObjectDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_LEASING_OBJECT_DATA = gql` + query GetQuoteLeasingObjectData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_brandid evo_category @@ -32,85 +33,48 @@ const QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE = gql` } `; -export type Quote = NonNullable; - -type QuoteLeasingObjectProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; export async function getKPData({ values: { quote: quoteId, recalcWithRevision }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetLeasingObjectDataFromQuoteQuery, - CRMTypes.GetLeasingObjectDataFromQuoteQueryVariables - >({ - query: QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteLeasingObjectDataDocument, variables: { quoteId, }, }); - if (!quote) { - throw new Error('Quote is empty'); - } - - const { - evo_brandid, - evo_category, - evo_delivery_time, - evo_engine_hours, - evo_engine_type, - evo_engine_volume, - evo_equipmentid, - evo_leasingobject_typeid, - evo_leasingobject_used, - evo_max_mass, - evo_max_speed, - evo_mileage, - evo_modelid, - evo_object_count, - evo_power, - evo_recalc_limit, - evo_seats, - evo_trailer, - evo_use_for, - evo_year, - evo_vin, - } = quote; - - let leaseObjectCount = evo_object_count ?? undefined; - - if (recalcWithRevision && evo_recalc_limit) { - leaseObjectCount = evo_recalc_limit; - } - return { values: { - brand: evo_brandid, - configuration: evo_equipmentid, - countSeats: evo_seats ?? undefined, - deliveryTime: evo_delivery_time, - engineHours: evo_engine_hours ?? undefined, - engineType: evo_engine_type, - engineVolume: evo_engine_volume ?? undefined, - leaseObjectCategory: evo_category, - leaseObjectCount, - leaseObjectMotorPower: evo_power ?? undefined, - leaseObjectType: evo_leasingobject_typeid, - leaseObjectUseFor: evo_use_for, - leaseObjectUsed: evo_leasingobject_used ?? undefined, - leaseObjectYear: evo_year ?? undefined, - maxMass: evo_max_mass ?? undefined, - maxSpeed: evo_max_speed ?? undefined, - mileage: evo_mileage ?? undefined, - model: evo_modelid, - vin: evo_vin, - withTrailer: evo_trailer ?? undefined, + brand: quote?.evo_brandid, + configuration: quote?.evo_equipmentid, + countSeats: quote?.evo_seats ?? defaultValues.countSeats, + deliveryTime: quote?.evo_delivery_time, + engineHours: quote?.evo_engine_hours ?? defaultValues.engineHours, + engineType: quote?.evo_engine_type, + engineVolume: quote?.evo_engine_volume ?? defaultValues.engineVolume, + leaseObjectCategory: quote?.evo_category, + leaseObjectCount: + (recalcWithRevision ? quote?.evo_recalc_limit : quote?.evo_object_count) ?? + defaultValues.leaseObjectCount, + leaseObjectMotorPower: quote?.evo_power ?? defaultValues.leaseObjectMotorPower, + leaseObjectType: quote?.evo_leasingobject_typeid, + leaseObjectUseFor: quote?.evo_use_for, + leaseObjectUsed: quote?.evo_leasingobject_used ?? defaultValues.leaseObjectUsed, + leaseObjectYear: quote?.evo_year ?? defaultValues.leaseObjectYear, + maxMass: quote?.evo_max_mass ?? defaultValues.maxMass, + maxSpeed: quote?.evo_max_speed ?? defaultValues.maxSpeed, + mileage: quote?.evo_mileage ?? defaultValues.mileage, + model: quote?.evo_modelid, + vin: quote?.evo_vin, + withTrailer: quote?.evo_trailer ?? defaultValues.withTrailer, }, }; } diff --git a/apps/web/process/load-kp/types.ts b/apps/web/process/load-kp/types.ts index d669a6c..f47dd2a 100644 --- a/apps/web/process/load-kp/types.ts +++ b/apps/web/process/load-kp/types.ts @@ -6,26 +6,31 @@ import ValuesSchema from '@/config/schema/values'; import { z } from 'zod'; const { quote, recalcWithRevision, lead, opportunity } = ValuesSchema.shape; -const InputValuesSchema = z.object({ - lead, - opportunity, - quote: quote.unwrap(), - recalcWithRevision, -}); -export const GetQuoteDataInputSchema = z + +export const GetQuoteInputDataSchema = z .object({ - values: InputValuesSchema.required(), + values: z + .object({ + lead, + opportunity, + quote: quote.unwrap(), + recalcWithRevision, + }) + .required(), }) .strict(); -export type GetQuoteDataInput = z.infer; + +export type GetQuoteInputData = z.infer; const FinGAPSchema = z.object({ keys: z.array(RiskSchema.shape.key), }); + const InsuranceSchema = z.object({ values: z.record(KeysSchema, RowSchema), }); -export const GetQuoteDataOutputSchema = z + +export const GetQuoteOutputDataSchema = z .object({ fingap: FinGAPSchema.optional(), insurance: InsuranceSchema.required(), @@ -33,4 +38,5 @@ export const GetQuoteDataOutputSchema = z values: ValuesSchema, }) .strict(); -export type GetQuoteDataOutput = z.infer; + +export type GetQuoteOutputData = z.infer; diff --git a/apps/web/process/payments/get-kp-data.ts b/apps/web/process/payments/get-kp-data.ts index a0367e7..5e674fa 100644 --- a/apps/web/process/payments/get-kp-data.ts +++ b/apps/web/process/payments/get-kp-data.ts @@ -1,11 +1,12 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; import { sort } from 'radash'; -const QUERY_GET_PAYMENTS_DATA_FROM_QUOTE = gql` - query GetPaymentsDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_PAYMENTS_DATA = gql` + query GetQuotePaymentsData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_period evo_accept_period @@ -26,23 +27,20 @@ const QUERY_GET_PAYMENTS_DATA_FROM_QUOTE = gql` } `; -type QuotePaymentsProcessData = { - payments: GetQuoteDataOutput['payments']; - values: Partial; +type OutputData = { + payments: GetQuoteOutputData['payments']; + values: Partial; }; export async function getKPData({ values: { quote: quoteId, recalcWithRevision }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetPaymentsDataFromQuoteQuery, - CRMTypes.GetPaymentsDataFromQuoteQueryVariables - >({ - query: QUERY_GET_PAYMENTS_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuotePaymentsDataDocument, variables: { quoteId, }, @@ -71,12 +69,13 @@ export async function getKPData({ ], }, values: { - firstPaymentPerc: quote?.evo_first_payment_perc ?? undefined, - graphType: quote?.evo_graph_type ?? undefined, + firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc, + graphType: quote?.evo_graph_type, highSeasonStart: quote?.evo_high_season, - lastPaymentPerc: quote?.evo_last_payment_perc ?? undefined, + lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc, leasingPeriod, - parmentsDecreasePercent: quote?.evo_payments_decrease_perc ?? undefined, + parmentsDecreasePercent: + quote?.evo_payments_decrease_perc ?? defaultValues.parmentsDecreasePercent, seasonType: quote?.evo_seasons_type, }, }; diff --git a/apps/web/process/price/get-kp-data.ts b/apps/web/process/price/get-kp-data.ts index f43e488..ac384d4 100644 --- a/apps/web/process/price/get-kp-data.ts +++ b/apps/web/process/price/get-kp-data.ts @@ -1,43 +1,41 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_PRICE_DATA_FROM_QUOTE = gql` - query GetPriceDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_PRICE_DATA = gql` + query GetQuotePriceData($quoteId: Uuid!) { quote(quoteId: $quoteId) { - # evo_comission_rub + evo_comission_rub evo_comission_perc evo_discount_perc - # evo_discount_supplier_currency + evo_discount_supplier_currency evo_first_payment_perc evo_last_payment_calc evo_last_payment_perc - # evo_last_payment_rub + evo_last_payment_rub evo_nds_in_price_supplier_currency - # evo_price_without_nds_supplier_currency + evo_price_without_nds_supplier_currency evo_supplier_currency_price evo_transactioncurrencyid } } `; -type QuotePaymentsProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetPriceDataFromQuoteQuery, - CRMTypes.GetPriceDataFromQuoteQueryVariables - >({ - query: QUERY_GET_PRICE_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuotePriceDataDocument, variables: { quoteId, }, @@ -45,18 +43,19 @@ export async function getKPData({ return { values: { - VATInLeaseObjectPrice: quote?.evo_nds_in_price_supplier_currency ?? undefined, - comissionPerc: quote?.evo_comission_perc ?? undefined, - // comissionRub: quote?.evo_comission_rub ?? undefined, - firstPaymentPerc: quote?.evo_first_payment_perc ?? undefined, - // lastPaymentRub: quote?.evo_last_payment_rub ?? undefined, - lastPaymentPerc: quote?.evo_last_payment_perc ?? undefined, + VATInLeaseObjectPrice: + quote?.evo_nds_in_price_supplier_currency ?? defaultValues.VATInLeaseObjectPrice, + comissionPerc: quote?.evo_comission_perc ?? defaultValues.comissionPerc, + // comissionRub: quote?.evo_comission_rub , + firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc, + // lastPaymentRub: quote?.evo_last_payment_rub , + lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc, lastPaymentRule: quote?.evo_last_payment_calc, - leaseObjectPrice: quote?.evo_supplier_currency_price ?? undefined, - // leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency ?? undefined, + leaseObjectPrice: quote?.evo_supplier_currency_price ?? defaultValues.leaseObjectPrice, + // leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency , supplierCurrency: quote?.evo_transactioncurrencyid, - supplierDiscountPerc: quote?.evo_discount_perc ?? undefined, - // supplierDiscountRub: quote?.evo_discount_supplier_currency ?? undefined, + supplierDiscountPerc: quote?.evo_discount_perc ?? defaultValues.supplierDiscountPerc, + // supplierDiscountRub: quote?.evo_discount_supplier_currency , }, }; } diff --git a/apps/web/process/supplier-agent/get-kp-data/get-sums.ts b/apps/web/process/supplier-agent/get-kp-data/get-sums.ts index 59af825..22cef2b 100644 --- a/apps/web/process/supplier-agent/get-kp-data/get-sums.ts +++ b/apps/web/process/supplier-agent/get-kp-data/get-sums.ts @@ -1,9 +1,10 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { Quote } from './index'; import initializeApollo from '@/apollo/client'; import type * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; +type Quote = NonNullable; + const QUERY_GET_REWARD_RULES = gql` query GetRewardRules($conditionId: Uuid!) { evo_reward_condition(evo_reward_conditionid: $conditionId) { @@ -55,7 +56,11 @@ async function getRewardSum( return quote[quoteRewardTotalField]; } -export default async function getSums(quote: Quote) { +export default async function getSums(quote: Quote | null) { + if (!quote) { + return null; + } + const [ dealerRewardSumm, dealerBrokerRewardSumm, @@ -103,11 +108,11 @@ export default async function getSums(quote: Quote) { ]); return { - calcBrokerRewardSum: calcBrokerRewardSum ?? 0, - calcDoubleAgentRewardSumm: calcDoubleAgentRewardSumm ?? 0, - dealerBrokerRewardSumm: dealerBrokerRewardSumm ?? 0, - dealerRewardSumm: dealerRewardSumm ?? 0, - finDepartmentRewardSumm: finDepartmentRewardSumm ?? 0, - indAgentRewardSumm: indAgentRewardSumm ?? 0, + calcBrokerRewardSum, + calcDoubleAgentRewardSumm, + dealerBrokerRewardSumm, + dealerRewardSumm, + finDepartmentRewardSumm, + indAgentRewardSumm, }; } diff --git a/apps/web/process/supplier-agent/get-kp-data/index.ts b/apps/web/process/supplier-agent/get-kp-data/index.ts index 65df0dd..920c138 100644 --- a/apps/web/process/supplier-agent/get-kp-data/index.ts +++ b/apps/web/process/supplier-agent/get-kp-data/index.ts @@ -1,12 +1,13 @@ /* eslint-disable canonical/sort-keys */ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../../load-kp/types'; +import type { GetQuoteInputData, GetQuoteOutputData } from '../../load-kp/types'; import getSums from './get-sums'; import initializeApollo from '@/apollo/client'; +import defaultValues from '@/config/default-values'; import type * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_AGENTS_DATA_FROM_QUOTE = gql` - query GetAgentsDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_AGENTS_DATA = gql` + query GetQuoteAgentsData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_supplier_accountid evo_dealer_person_accountid @@ -37,15 +38,13 @@ const QUERY_GET_AGENTS_DATA_FROM_QUOTE = gql` } `; -export type Quote = NonNullable; - -type QuoteSupplierAgentProcessData = { - values: Partial; +type OutputData = { + values: Partial; }; export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { @@ -54,47 +53,38 @@ export async function getKPData({ CRMTypes.GetAgentsDataFromQuoteQuery, CRMTypes.GetAgentsDataFromQuoteQueryVariables >({ - query: QUERY_GET_AGENTS_DATA_FROM_QUOTE, + query: QUERY_GET_QUOTE_AGENTS_DATA, variables: { quoteId, }, }); - if (!quote) { - throw new Error('Quote is empty'); - } - - const { - dealerRewardSumm, - dealerBrokerRewardSumm, - indAgentRewardSumm, - calcDoubleAgentRewardSumm, - calcBrokerRewardSum, - finDepartmentRewardSumm, - } = await getSums(quote); + const sums = await getSums(quote); return { values: { dealer: quote?.evo_supplier_accountid, dealerBroker: quote?.evo_dealer_broker_accountid, dealerBrokerRewardCondition: quote?.evo_dealer_broker_reward_conditionid, - dealerBrokerRewardSumm, + dealerBrokerRewardSumm: sums?.dealerBrokerRewardSumm ?? defaultValues.dealerBrokerRewardSumm, dealerPerson: quote?.evo_dealer_person_accountid, dealerRewardCondition: quote?.evo_dealer_reward_conditionid, - dealerRewardSumm, + dealerRewardSumm: sums?.dealerRewardSumm ?? defaultValues.dealerRewardSumm, calcBroker: quote?.evo_broker_accountid, calcBrokerRewardCondition: quote?.evo_broker_reward_conditionid, - calcBrokerRewardSum, + calcBrokerRewardSum: sums?.calcBrokerRewardSum ?? defaultValues.calcBrokerRewardSum, calcDoubleAgent: quote?.evo_double_agent_accountid, calcDoubleAgentRewardCondition: quote?.evo_double_agent_reward_conditionid, - calcDoubleAgentRewardSumm, + calcDoubleAgentRewardSumm: + sums?.calcDoubleAgentRewardSumm ?? defaultValues.calcDoubleAgentRewardSumm, calcFinDepartment: quote?.evo_fin_department_accountid, finDepartmentRewardCondtion: quote?.evo_fin_department_reward_conditionid, - finDepartmentRewardSumm, + finDepartmentRewardSumm: + sums?.finDepartmentRewardSumm ?? defaultValues.finDepartmentRewardSumm, indAgent: quote?.evo_agent_accountid, indAgentRewardCondition: quote?.evo_agent_reward_conditionid, - indAgentRewardSumm, + indAgentRewardSumm: sums?.indAgentRewardSumm ?? defaultValues.indAgentRewardSumm, }, }; } diff --git a/apps/web/trpc/routers/quote.ts b/apps/web/trpc/routers/quote.ts index d7c6781..de5e568 100644 --- a/apps/web/trpc/routers/quote.ts +++ b/apps/web/trpc/routers/quote.ts @@ -11,12 +11,14 @@ import * as loadKP 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'); const DEFAULT_KASKO_ROW = defaultInsuranceValues.find((x) => x.key === 'kasko'); -const { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } = loadKP; +const { + GetQuoteInputDataSchema: GetQuoteDataInputSchema, + GetQuoteOutputDataSchema: GetQuoteDataOutputSchema, +} = loadKP; const quoteRouter = t.router({ getData: t.procedure @@ -32,21 +34,16 @@ const quoteRouter = t.router({ const { fingap, insurance: fingapInsurance } = await fingapProcess.getKPData(input); const { values: gibddValues } = await gibdd.getKPData(input); - // TODO: remove this temp fix - const quoteValues = shake({ - ...configuratorValues, - ...supplierAgentsValues, - ...paymentsValues, - ...priceValues, - ...bonusesValues, - ...leasingObjectValues, - ...gibddValues, - }); - return { values: { ...defaultValues, - ...quoteValues, + ...configuratorValues, + ...supplierAgentsValues, + ...paymentsValues, + ...priceValues, + ...bonusesValues, + ...leasingObjectValues, + ...gibddValues, }, payments, insurance: {