import { AxiosInstance } from 'axios'; import { ApiInstance, IntegrationContext } from '@vue-storefront/core'; import * as Apis from './api/clients/interfaces'; import { Checkout as SdkCheckout, Search as SdkSearch, Product as SdkProduct, Customer as SdkCustomer } from 'commerce-sdk'; export declare type Customer = SdkCustomer.ShopperCustomers.Customer & { birthday?: Date; creationDate?: Date; lastLoginTime?: Date; lastModified?: Date; lastVisitTime?: Date; previousLoginTime?: Date; previousVisitTime?: Date; }; export declare type ContactInfo = { customerId?: string; customerNo?: string; firstName: string; lastName: string; email: string; }; export declare type CustomerAddress = SdkCustomer.ShopperCustomers.CustomerAddress; export declare type OrderAddress = SdkCheckout.ShopperOrders.OrderAddress; export declare type ShippingMethodResult = SdkCheckout.ShopperBaskets.ShippingMethodResult; export declare type PaymentMethodResult = SdkCheckout.ShopperBaskets.PaymentMethodResult; export declare type PaymentInstrument = SdkCheckout.ShopperOrders.BasketPaymentInstrumentRequest; export declare type Cart = SdkCheckout.ShopperBaskets.Basket & { lineItems?: LineItem[]; }; export declare type CartItem = SdkCheckout.ShopperBaskets.ProductItem; export declare type CouponItem = SdkCheckout.ShopperBaskets.CouponItem; export declare type WishlistItem = SdkCustomer.ShopperCustomers.CustomerProductListItem & { fullProduct?: Product; }; export declare type Wishlist = SdkCustomer.ShopperCustomers.CustomerProductList & { items: WishlistItem[]; }; export declare type VariationAttributeValue = SdkProduct.ShopperProducts.VariationAttributeValue & { selected: boolean; }; export declare type VariationAttribute = SdkProduct.ShopperProducts.VariationAttribute & { values?: VariationAttributeValue[]; }; export declare type Variant = SdkProduct.Products.Variant; export declare type Product = { _id: string; _description: string; _categoriesRef: string[]; name: string; sku: string; images: string[]; attributes?: VariationAttribute[]; variationValues?: { [key: string]: string; }; variants?: Variant[]; price: { original: number; current: number; }; }; export declare type Category = SdkProduct.ShopperProducts.Category & { c_showInMenu: boolean; }; export declare type ProductHitTypeSearchParam = ('product' | 'master' | 'set' | 'bundle' | 'slicing_group' | 'variation_group')[]; export declare type ProductSearchRefinementValue = SdkSearch.ShopperSearch.ProductSearchRefinementValue & { selected: boolean; values?: ProductSearchRefinementValue[]; }; export declare type ProductSearchRefinement = SdkSearch.ShopperSearch.ProductSearchRefinement & { values?: ProductSearchRefinementValue[]; }; export declare type ProductSortingOption = SdkSearch.ShopperSearch.ProductSearchSortingOption & { selected: boolean; }; export declare type ProductSearchParams = { q?: string; categorySlug?: string; filters?: { promoId?: string; hitType?: ProductHitTypeSearchParam; orderableOnly?: boolean; attributes?: { [attr: string]: string | string[]; }; }; sort?: string; page: number; itemsPerPage: number; }; export declare type ProductSearchResponse = { total: number; products: Product[]; filters: ProductSearchRefinement[]; selectedFilters: Record; sortOptions: ProductSortingOption[]; }; export declare type CategoryFilter = Record; export declare type PaymentMethod = SdkCheckout.ShopperOrders.PaymentMethod; export declare type ShippingMethod = SdkCheckout.ShopperOrders.ShippingMethod; export declare type BasketShippingMethods = SdkCheckout.ShopperBaskets.ShippingMethodResult; export declare type LineItem = Product & { itemId: string; quantity: number; }; export declare type Order = SdkCheckout.ShopperOrders.Order; export declare type OrderSearchParams = { crossSites?: boolean; from?: string; until?: string; status?: string; offset?: number; limit?: number; }; export declare type ApiClients = { CustomersApi: Apis.CustomersApi; CategoriesApi: Apis.CategoriesApi; ProductsApi: Apis.ProductsApi; ProductSearchApi: Apis.ProductSearchApi; WishlistsApi: Apis.WishlistsApi; CartsApi: Apis.CartsApi; OrdersApi: Apis.OrdersApi; }; export declare type SfccSetupConfig = IntegrationContext; export declare type SfccIntegrationContext = IntegrationContext; export declare type Endpoints = { guestSignIn(context: SfccIntegrationContext): Promise; refreshToken(context: SfccIntegrationContext): Promise; signIn(context: SfccIntegrationContext, username: string, password: string): Promise; getCustomer(context: SfccIntegrationContext): Promise; getCustomerAddresses(context: SfccIntegrationContext): Promise; createCustomerAddress(context: SfccIntegrationContext, address: CustomerAddress): Promise; updateCustomerAddress(context: SfccIntegrationContext, address: CustomerAddress): Promise; deleteCustomerAddress(context: SfccIntegrationContext, address: CustomerAddress): Promise; createCustomer(context: SfccIntegrationContext, email: string, password: string, firstName: string, lastName: string): Promise; updateCustomer(context: SfccIntegrationContext, email: string, firstName: string, lastName: string): Promise; updateCustomerPassword(context: SfccIntegrationContext, currentPassword: string, newPassword: string): Promise; getCategory(context: SfccIntegrationContext, id: string, levels?: number): Promise; searchProducts(context: SfccIntegrationContext, params: ProductSearchParams): Promise; getProduct(context: SfccIntegrationContext, id: string): Promise; getProducts(context: SfccIntegrationContext, ids: string[]): Promise; getWishlist(context: SfccIntegrationContext): Promise; addToWishlist(context: SfccIntegrationContext, listId: string, productId: string): Promise; removeFromWishlist(context: SfccIntegrationContext, listId: string, itemId: string): Promise; getCart(context: SfccIntegrationContext): Promise; resetCart(context: SfccIntegrationContext, cartId: string): Promise; addToCart(context: SfccIntegrationContext, cartId: string, product: Product, quantity: number): Promise; removeFromCart(context: SfccIntegrationContext, cartId: string, item: LineItem): Promise; addCouponToCart(context: SfccIntegrationContext, cartId: string, couponCode: string): Promise; removeCouponFromCart(context: SfccIntegrationContext, cartId: string, couponItemId: string): Promise; updateCartItem(context: SfccIntegrationContext, cartId: string, item: LineItem, quantity: number): Promise; getApplicablePaymentMethods(context: SfccIntegrationContext, cartId: string): Promise; getApplicableShippingMethods(context: SfccIntegrationContext, cartId: string): Promise; saveShippingAddress(context: SfccIntegrationContext, cartId: string, shippingAddress: OrderAddress, shipmentId?: string): Promise; saveShippingMethod(context: SfccIntegrationContext, cartId: string, shippingAddress: OrderAddress, shipmentId?: string): Promise; saveBillingAddress(context: SfccIntegrationContext, cartId: string, billingAddress: OrderAddress): Promise; savePaymentInstrument(context: SfccIntegrationContext, cartId: string, paymentMethodId: string, amount: number, body: any): Promise; updateCart(context: SfccIntegrationContext, cartId: string, contactInfo: ContactInfo, shippingAddress: OrderAddress, shippingMethodId: string, billingAddress: OrderAddress, paymentMethodId: string): Promise; createOrder(context: SfccIntegrationContext, cartId: string): Promise; getCustomerOrders(context: SfccIntegrationContext, params: OrderSearchParams): Promise; }; export declare type ContextualizedEndpoints = { [T in keyof Endpoints]: Endpoints[T] extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never; }; export interface ApiClientSettings { origin: string; clientId?: string; siteId: string; ocapiVersion: string; commerceApiVersion?: string; shortCode?: string; organizationId?: string; enableCommerceApi?: boolean; locale?: string; jwtToken?: string; cache?: boolean; timeout?: number; viewType?: string; enableCookies?: boolean; overrideHttpPut?: boolean; defaultHeaders?: Record; cookieNames?: { authToken?: string; }; clientHeaders: { locale?: string; }; callbacks?: { auth?: { onSessionTimeout?: (isGuest: boolean) => void; onTokenChange?: (token: string) => void; }; }; overrides?: Partial; } export interface Context { $sfcc: SfccIntegrationContext; } export interface AppContext { $vsf: Context; } export interface SfccApiInstance extends ApiInstance { api: Endpoints; client: AxiosInstance; settings: ApiClientSettings; }