@vue-storefront/core
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -11,1 +11,2 @@ export * from './useCartFactory'; | ||
export * from './useReviewFactory'; | ||
export * from './useFacetFactory'; |
@@ -1,4 +0,4 @@ | ||
import { UseCart } from '../types'; | ||
import { CustomQuery, UseCart } from '../types'; | ||
export declare type UseCartFactoryParams<CART, CART_ITEM, PRODUCT, COUPON> = { | ||
loadCart: () => Promise<CART>; | ||
loadCart: (customQuery?: CustomQuery) => Promise<CART>; | ||
addToCart: (params: { | ||
@@ -8,7 +8,7 @@ currentCart: CART; | ||
quantity: any; | ||
}) => Promise<CART>; | ||
}, customQuery?: CustomQuery) => Promise<CART>; | ||
removeFromCart: (params: { | ||
currentCart: CART; | ||
product: CART_ITEM; | ||
}) => Promise<CART>; | ||
}, customQuery?: CustomQuery) => Promise<CART>; | ||
updateQuantity: (params: { | ||
@@ -18,3 +18,3 @@ currentCart: CART; | ||
quantity: number; | ||
}) => Promise<CART>; | ||
}, customQuery?: CustomQuery) => Promise<CART>; | ||
clearCart: (prams: { | ||
@@ -25,6 +25,5 @@ currentCart: CART; | ||
currentCart: CART; | ||
coupon: string; | ||
}) => Promise<{ | ||
couponCode: string; | ||
}, customQuery?: CustomQuery) => Promise<{ | ||
updatedCart: CART; | ||
updatedCoupon: COUPON; | ||
}>; | ||
@@ -34,3 +33,3 @@ removeCoupon: (params: { | ||
coupon: COUPON; | ||
}) => Promise<{ | ||
}, customQuery?: CustomQuery) => Promise<{ | ||
updatedCart: CART; | ||
@@ -37,0 +36,0 @@ }>; |
@@ -17,5 +17,5 @@ import { UseProduct } from '../types'; | ||
export declare type UseProductFactoryParams<PRODUCT, PRODUCT_SEARCH_PARAMS extends SearchParams, PRODUCT_FILTERS, SORTING_OPTIONS> = { | ||
productsSearch: (searchParams: PRODUCT_SEARCH_PARAMS, customQuery: CustomQuery) => Promise<ProductsSearchResult<PRODUCT, PRODUCT_FILTERS, SORTING_OPTIONS>>; | ||
productsSearch: (searchParams: PRODUCT_SEARCH_PARAMS, customQuery?: CustomQuery) => Promise<ProductsSearchResult<PRODUCT, PRODUCT_FILTERS, SORTING_OPTIONS>>; | ||
}; | ||
export declare function useProductFactory<PRODUCT, PRODUCT_SEARCH_PARAMS, PRODUCT_FILTERS, SORTING_OPTIONS>(factoryParams: UseProductFactoryParams<PRODUCT, PRODUCT_SEARCH_PARAMS, PRODUCT_FILTERS, SORTING_OPTIONS>): (id: string) => UseProduct<PRODUCT, PRODUCT_FILTERS, SORTING_OPTIONS>; | ||
export {}; |
@@ -20,4 +20,2 @@ import { Ref } from '@vue/composition-api'; | ||
totalProducts: ComputedProperty<number>; | ||
availableFilters: ComputedProperty<PRODUCT_FILTERS>; | ||
availableSortingOptions: ComputedProperty<SORTING_OPTIONS>; | ||
loading: ComputedProperty<boolean>; | ||
@@ -44,3 +42,3 @@ search: typeof Search; | ||
changePassword: (currentPassword: string, newPassword: string) => Promise<void>; | ||
refreshUser: () => Promise<void>; | ||
load: () => Promise<void>; | ||
isAuthenticated: Ref<boolean>; | ||
@@ -93,13 +91,21 @@ loading: ComputedProperty<boolean>; | ||
} | ||
export declare function AddToCart<PRODUCT>(product: PRODUCT, quantity?: number): Promise<void>; | ||
export declare function AddToCart<PRODUCT>(product: PRODUCT, quantity: number, customQuery: {}): Promise<void>; | ||
export declare function RemoveFromCart<CART_ITEM>(product: CART_ITEM): Promise<void>; | ||
export declare function RemoveFromCart<CART_ITEM>(product: CART_ITEM, customQuery: {}): Promise<void>; | ||
export declare function ApplyCoupon(coupon: string): Promise<void>; | ||
export declare function ApplyCoupon(coupon: string, customQuery: {}): Promise<void>; | ||
export declare function RemoveCoupon<COUPON>(coupon: COUPON): Promise<void>; | ||
export declare function RemoveCoupon<COUPON>(coupon: COUPON, customQuery: {}): Promise<void>; | ||
export declare function LoadCart(customQuery?: {}): Promise<void>; | ||
export interface UseCart<CART, CART_ITEM, PRODUCT, COUPON> { | ||
cart: ComputedProperty<CART>; | ||
addToCart: (product: PRODUCT, quantity: number) => Promise<void>; | ||
addToCart: typeof AddToCart; | ||
isOnCart: (product: PRODUCT) => boolean; | ||
removeFromCart: (product: CART_ITEM) => Promise<void>; | ||
updateQuantity: (product: CART_ITEM, quantity?: number) => Promise<void>; | ||
removeFromCart: typeof RemoveFromCart; | ||
updateQuantity: typeof AddToCart; | ||
clearCart: () => Promise<void>; | ||
coupon: ComputedProperty<COUPON | null>; | ||
applyCoupon: (coupon: string) => Promise<void>; | ||
removeCoupon: () => Promise<void>; | ||
loadCart: () => Promise<void>; | ||
applyCoupon: typeof ApplyCoupon; | ||
removeCoupon: typeof RemoveCoupon; | ||
loadCart: typeof LoadCart; | ||
loading: ComputedProperty<boolean>; | ||
@@ -139,4 +145,9 @@ } | ||
loading: ComputedProperty<boolean>; | ||
error: ComputedProperty<string | null>; | ||
[x: string]: any; | ||
} | ||
export interface UseFacet<SEARCH_DATA> { | ||
result: ComputedProperty<FacetSearchResult<SEARCH_DATA>>; | ||
loading: ComputedProperty<boolean>; | ||
search: (params?: AgnosticFacetSearchParams) => Promise<void>; | ||
} | ||
export interface ProductGetters<PRODUCT, PRODUCT_FILTER> { | ||
@@ -169,2 +180,3 @@ getName: (product: PRODUCT) => string; | ||
getFormattedPrice: (price: number) => string; | ||
getCoupons: (cart: CART) => AgnosticCoupon[]; | ||
[getterName: string]: (element: any, options?: any) => unknown; | ||
@@ -227,2 +239,18 @@ } | ||
} | ||
export interface FacetsGetters<SEARCH_DATA, RESULTS, CRITERIA = any> { | ||
getAll: (searchData: FacetSearchResult<SEARCH_DATA>, criteria?: CRITERIA) => AgnosticFacet[]; | ||
getGrouped: (searchData: FacetSearchResult<SEARCH_DATA>, criteria?: CRITERIA) => AgnosticGroupedFacet[]; | ||
getCategoryTree: (searchData: FacetSearchResult<SEARCH_DATA>) => AgnosticCategoryTree; | ||
getSortOptions: (searchData: FacetSearchResult<SEARCH_DATA>) => AgnosticSort; | ||
getProducts: (searchData: FacetSearchResult<SEARCH_DATA>) => RESULTS; | ||
getPagination: (searchData: FacetSearchResult<SEARCH_DATA>) => AgnosticPagination; | ||
getBreadcrumbs: (searchData: FacetSearchResult<SEARCH_DATA>) => AgnosticBreadcrumb[]; | ||
[getterName: string]: (element: any, options?: any) => unknown; | ||
} | ||
export interface AgnosticCoupon { | ||
id: string; | ||
name: string; | ||
code: string; | ||
value: number; | ||
} | ||
export interface AgnosticMediaGalleryItem { | ||
@@ -237,2 +265,3 @@ small: string; | ||
items: AgnosticCategoryTree[]; | ||
isCurrent: boolean; | ||
[x: string]: unknown; | ||
@@ -300,1 +329,46 @@ } | ||
} | ||
export interface AgnosticFacet { | ||
type: string; | ||
id: string; | ||
value: any; | ||
attrName?: string; | ||
count?: number; | ||
selected?: boolean; | ||
metadata?: any; | ||
} | ||
export interface AgnosticGroupedFacet { | ||
id: string; | ||
label: string; | ||
count?: number; | ||
options: AgnosticFacet[]; | ||
} | ||
export interface AgnosticSort { | ||
options: AgnosticFacet[]; | ||
selected: string; | ||
} | ||
export interface AgnosticPagination { | ||
currentPage: number; | ||
totalPages: number; | ||
totalItems: number; | ||
itemsPerPage: number; | ||
pageOptions: number[]; | ||
} | ||
export interface FacetSearchResult<S> { | ||
data: S; | ||
input: AgnosticFacetSearchParams; | ||
} | ||
export interface AgnosticFacetSearchParams { | ||
categorySlug?: string; | ||
page?: number; | ||
itemsPerPage?: number; | ||
sort?: string; | ||
filters?: Record<string, string[]>; | ||
metadata?: any; | ||
[x: string]: any; | ||
} | ||
export interface VSFLogger { | ||
debug(message?: any, ...args: any): void; | ||
info(message?: any, ...args: any): void; | ||
warn(message?: any, ...args: any): void; | ||
error(message?: any, ...args: any): void; | ||
} |
import { onSSR, vsfRef, configureSSR } from './ssr'; | ||
import { sharedRef } from './shared'; | ||
import wrap from './wrap'; | ||
export { wrap, onSSR, vsfRef, configureSSR, sharedRef }; | ||
import { Logger, registerLogger } from './logger'; | ||
import mask from './logger/mask'; | ||
export { wrap, onSSR, vsfRef, configureSSR, sharedRef, Logger, registerLogger, mask }; |
{ | ||
"name": "@vue-storefront/core", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "main": "lib/index.cjs.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
622900
37
7002
3