42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
|
|
import { gql } from '@apollo/client';
|
|
import initializeApollo from 'apollo/client';
|
|
import type * as CRMTypes from 'graphql/crm.types';
|
|
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
|
|
|
|
const QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE = gql`
|
|
query GetConfiguratorDataFromQuote($quoteId: Uuid!) {
|
|
quote(quoteId: $quoteId) {
|
|
evo_baseproductid
|
|
}
|
|
}
|
|
`;
|
|
|
|
type QuotePaymentsProcessData = {
|
|
values: Partial<GetQuoteDataOutput['values']>;
|
|
};
|
|
|
|
export default async function getConfiguratorDataFromKP({
|
|
values: { quote: quoteId },
|
|
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
|
|
const apolloClient = initializeApollo();
|
|
|
|
const {
|
|
data: { quote },
|
|
} = await apolloClient.query<
|
|
CRMTypes.GetConfiguratorDataFromQuoteQuery,
|
|
CRMTypes.GetConfiguratorDataFromQuoteQueryVariables
|
|
>({
|
|
query: QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE,
|
|
variables: {
|
|
quoteId,
|
|
},
|
|
});
|
|
|
|
return {
|
|
values: {
|
|
product: quote?.evo_baseproductid,
|
|
},
|
|
};
|
|
}
|