import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; import defaultValues from '@/config/default-values'; import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; const QUERY_GET_QUOTE_CONFIGURATOR_DATA = gql` query GetQuoteConfiguratorData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_baseproductid evo_client_typeid evo_msfo_irr } } `; export async function getKPData({ values: { quote: quoteId }, }: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, } = await apolloClient.query({ query: CRMTypes.GetQuoteConfiguratorDataDocument, variables: { quoteId, }, }); return { values: { IRR_Perc: quote?.evo_msfo_irr ?? defaultValues.IRR_Perc, clientType: quote?.evo_client_typeid, product: quote?.evo_baseproductid, }, }; }