UNPKG

@spree/storefront-api-v2-sdk

Version:

Node module to easily integrate your JavaScript or TypeScript application with Spree API V2. You can create an entirely custom Storefront in JS/TS with this package including one page checkout, Single Page Apps, PWAs and so on

37 lines (35 loc) 2.38 kB
export const storefrontPath = `api/v2/storefront` export const Routes = { productsPath: () => `${storefrontPath}/products`, productPath: (id: string) => `${storefrontPath}/products/${id}`, taxonsPath: () => `${storefrontPath}/taxons`, taxonPath: (id: string) => `${storefrontPath}/taxons/${id}`, countriesPath: () => `${storefrontPath}/countries`, countryPath: (iso: string) => `${storefrontPath}/countries/${iso}`, cartPath: () => `${storefrontPath}/cart`, cartAddItemPath: () => `${storefrontPath}/cart/add_item`, cartRemoveItemPath: (id: string) => `${storefrontPath}/cart/remove_line_item/${id}`, cartEmptyPath: () => `${storefrontPath}/cart/empty`, cartSetItemQuantity: () => `${storefrontPath}/cart/set_quantity`, cartApplyCodePath: () => `${storefrontPath}/cart/apply_coupon_code`, cartRemoveCodePath: (code?: string) => `${storefrontPath}/cart/remove_coupon_code/${code}`, cartEstimateShippingMethodsPath: () => `${storefrontPath}/cart/estimate_shipping_rates`, checkoutPath: () => `${storefrontPath}/checkout`, checkoutNextPath: () => `${storefrontPath}/checkout/next`, checkoutAdvancePath: () => `${storefrontPath}/checkout/advance`, checkoutCompletePath: () => `${storefrontPath}/checkout/complete`, checkoutAddStoreCreditsPath: () => `${storefrontPath}/checkout/add_store_credit`, checkoutRemoveStoreCreditsPath: () => `${storefrontPath}/checkout/remove_store_credit`, checkoutPaymentMethodsPath: () => `${storefrontPath}/checkout/payment_methods`, checkoutShippingMethodsPath: () => `${storefrontPath}/checkout/shipping_rates`, oauthTokenPath: () => `spree_oauth/token`, accountPath: () => `${storefrontPath}/account`, accountAddressPath: (id: string) => `${storefrontPath}/account/addresses/${id}`, accountAddressesPath: () => `${storefrontPath}/account/addresses`, accountConfirmPath: (confirmationToken: string) => `${storefrontPath}/account_confirmations/${confirmationToken}`, accountCreditCardsPath: () => `${storefrontPath}/account/credit_cards`, accountDefaultCreditCardPath: () => `${storefrontPath}/account/credit_cards/default`, accountCompletedOrdersPath: () => `${storefrontPath}/account/orders`, accountCompletedOrderPath: (orderNumber: string) => `${storefrontPath}/account/orders/${orderNumber}`, orderStatusPath: (orderNumber: string) => `${storefrontPath}/order_status/${orderNumber}` }