import type { ApolloQueryResult } from "@apollo/client/core"; import type { CustomHeaders, CustomQuery, RoutableInterface, RouteQuery } from "@vue-storefront/magento-types"; import type { Context } from "../../types/context"; /** * Resolve a route object data * * @example * Simple usage: * ```ts * import { sdk } from '~/sdk.config.ts'; * * // fetch route object data * const result = await sdk.magento.route({ * url: 'aether-gym-pant.html' * }); * * // Example result: * { * data: { * route: { type: 'PRODUCT', sku: 'MP11', __typename: 'ConfigurableProduct' } * }, * loading: false, * networkStatus: 7 * } * ``` * * @example * Creating a custom GraphQL query to fetch additional data: * * ```ts * module.exports = { * integrations: { * magento: { * customQueries: { * 'route-custom-query': ({ variables, metadata }) => ({ * variables, * query: ` * query route($url: String!) { * route(url: $url) { * ${metadata?.fields} * } * } * }` * }), * }, * } * } * }; * ``` * * @example * Using a custom GraphQL query created in the previous example. * * ```ts * import { sdk } from '~/sdk.config.ts'; * * // reduce the amount of fields returned by the query, when compared to the default query * const customQuery = { * route: 'route-custom-query', * metadata: { * fields: 'type ... on CategoryInterface { uid name image}' // fetch additional name and image fields * } * }; * * // data will contain only the fields specified in the custom query. * const { data } = await sdk.magento.route({ url: 'women.html' }, customQuery); * ``` */ export declare function route(context: Context, url: string, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise>>; //# sourceMappingURL=index.d.ts.map