import { ApolloQueryResult } from "@apollo/client/core"; import { CustomQuery, GuestAvailableShippingMethodsQuery, GuestAvailableShippingMethodsQueryVariables } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { Context } from "../../types/context"; /** * Fetch guest's available shipping methods * * @example * Simple usage: * ```ts * import { sdk } from '~/sdk.config.ts'; * * // fetch guest's available shipping methods * const result = await sdk.magento.getAvailableShippingMethods({ * cart_id: TEST_CART_ID * }); * // array of available shipping methods for selected shipping address: * result.data.cart.shipping_addresses[0].available_shipping_methods[0]; * ``` * * @example * Creating a custom GraphQL query for fetching only what's requested from shipping methods * * ```ts * module.exports = { * integrations: { * magento: { * customQueries: { * 'get-available-shipping-methods-custom-query': ({ variables, metadata }) => ({ * variables, * query: ` * query GuestAvailableShippingMethods($cart_id: String!) { * cart(cart_id:$cart_id) { * shipping_addresses { * available_shipping_methods { * ${metadata.fields} * } * } * } * } * ` * }), * }, * } * } * }; * ``` * * @example * Using a custom GraphQL query to fetch only method_title field * * ```ts * import { sdk } from '~/sdk.config.ts'; * // reduce the amount of fields returned by the query, when compared to the default query * const customQuery = { * shippingMethods: 'get-available-shipping-methods-custom-query', * metadata: { * fields: 'method_title' * } * }; * * const result = await sdk.magento.getAvailableShippingMethods({ cart_id: '123'}, customQuery); * * // result contains the customer addresses with only the city method_title. Of course, it has same shape as in the "simple usage" example. * ``` */ export declare function getAvailableShippingMethods(context: Context, params: GuestAvailableShippingMethodsQueryVariables, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise>; //# sourceMappingURL=index.d.ts.map