import { getConfig, ShopifyConfig } from '@framework/api' import getCustomerIdQuery from '@framework/utils/queries/get-customer-id-query' import Cookies from 'js-cookie' async function getCustomerId({ customerToken: customerAccesToken, config, }: { customerToken: string config?: ShopifyConfig }): Promise { config = getConfig(config) const { data } = await config.fetch(getCustomerIdQuery, { variables: { customerAccesToken: customerAccesToken || Cookies.get(config.customerCookie), }, }) return data?.customer?.id } export default getCustomerId