import { ApolloQueryResult } from '@apollo/client/core' ; import { CustomQuery } from '@vue-storefront/core' ; import { Context } from '../../types/context' ; import GuestAvailableShippingMethods from './GuestAvailableShippingMethods' ; import { GuestAvailableShippingMethodsQuery , GuestAvailableShippingMethodsQueryVariables , } from '../../types/GraphQL' ; export default async ( context , params , customQuery = { shippingMethods : 'shippingMethods' } ) : Promise < ApolloQueryResult < GuestAvailableShippingMethodsQuery > > => { const { shippingMethods } = context . extendQuery ( customQuery , { shippingMethods : { query : GuestAvailableShippingMethods , variables : { ... params } , } , } ) ; try { return await context . client . query < GuestAvailableShippingMethodsQuery , GuestAvailableShippingMethodsQueryVariables > ( { query : shippingMethods . query , variables : shippingMethods . variables , } ) ; } catch ( error ) { throw error . graphQLErrors ?. [ 0 ] . message || error . networkError ?. result || error ; } } ;