@plasmicpkgs/commerce 0.0.1 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/api/endpoints/cart.d.ts +4 -0
- package/dist/api/endpoints/catalog/products.d.ts +4 -0
- package/dist/api/index.d.ts +75 -0
- package/dist/api/operations.d.ts +130 -0
- package/dist/api/utils/errors.d.ts +10 -0
- package/dist/api/utils/is-allowed-method.d.ts +3 -0
- package/dist/api/utils/is-allowed-operation.d.ts +6 -0
- package/dist/api/utils/types.d.ts +34 -0
- package/dist/cart/use-add-item.d.ts +5 -6
- package/dist/cart/use-cart.d.ts +5 -6
- package/dist/cart/use-remove-item.d.ts +5 -6
- package/dist/cart/use-update-item.d.ts +5 -6
- package/dist/commerce.cjs.development.js +1933 -0
- package/dist/commerce.cjs.development.js.map +1 -0
- package/dist/commerce.cjs.production.min.js +2 -0
- package/dist/commerce.cjs.production.min.js.map +1 -0
- package/dist/commerce.d.ts +41 -0
- package/dist/commerce.esm.js +1908 -0
- package/dist/commerce.esm.js.map +1 -0
- package/dist/contexts.d.ts +10 -7
- package/dist/index.d.ts +25 -71
- package/dist/index.js +7 -28
- package/dist/product/use-price.d.ts +26 -26
- package/dist/product/use-search.d.ts +6 -6
- package/dist/registerAddToCartButton.d.ts +9 -0
- package/dist/registerProductCollection.d.ts +18 -11
- package/dist/registerProductMedia.d.ts +10 -0
- package/dist/registerProductPrice.d.ts +9 -0
- package/dist/registerProductQuantity.d.ts +11 -0
- package/dist/registerProductTextField.d.ts +10 -0
- package/dist/registerProductVariantPicker.d.ts +9 -0
- package/dist/registerUseCart.d.ts +9 -0
- package/dist/registerable.d.ts +4 -4
- package/dist/site/use-brands.d.ts +5 -0
- package/dist/site/use-categories.d.ts +5 -0
- package/dist/types/cart.d.ts +157 -157
- package/dist/types/checkout.d.ts +57 -57
- package/dist/types/common.d.ts +13 -13
- package/dist/types/customer/address.d.ts +110 -110
- package/dist/types/customer/card.d.ts +113 -113
- package/dist/types/customer/index.d.ts +24 -24
- package/dist/types/index.d.ts +12 -12
- package/dist/types/login.d.ts +27 -27
- package/dist/types/logout.d.ts +17 -17
- package/dist/types/page.d.ts +24 -24
- package/dist/types/product.d.ts +102 -99
- package/dist/types/signup.d.ts +23 -23
- package/dist/types/site.d.ts +41 -17
- package/dist/types/wishlist.d.ts +83 -83
- package/dist/utils/default-fetcher.d.ts +4 -4
- package/dist/utils/define-property.d.ts +21 -21
- package/dist/utils/errors.d.ts +27 -27
- package/dist/utils/get-product-price.d.ts +2 -0
- package/dist/utils/types.d.ts +95 -94
- package/dist/utils/use-data.d.ts +12 -12
- package/dist/utils/use-hook.d.ts +6 -6
- package/package.json +13 -13
- package/dist/auth/use-login.d.ts +0 -6
- package/dist/auth/use-login.js +0 -9
- package/dist/auth/use-logout.d.ts +0 -6
- package/dist/auth/use-logout.js +0 -9
- package/dist/auth/use-signup.d.ts +0 -6
- package/dist/auth/use-signup.js +0 -9
- package/dist/cart/use-add-item.js +0 -9
- package/dist/cart/use-cart.js +0 -18
- package/dist/cart/use-remove-item.js +0 -9
- package/dist/cart/use-update-item.js +0 -9
- package/dist/checkout/use-checkout.d.ts +0 -6
- package/dist/checkout/use-checkout.js +0 -18
- package/dist/checkout/use-submit-checkout.d.ts +0 -6
- package/dist/checkout/use-submit-checkout.js +0 -9
- package/dist/contexts.js +0 -46
- package/dist/customer/address/use-add-item.d.ts +0 -6
- package/dist/customer/address/use-add-item.js +0 -9
- package/dist/customer/address/use-addresses.d.ts +0 -6
- package/dist/customer/address/use-addresses.js +0 -18
- package/dist/customer/address/use-remove-item.d.ts +0 -6
- package/dist/customer/address/use-remove-item.js +0 -9
- package/dist/customer/address/use-update-item.d.ts +0 -6
- package/dist/customer/address/use-update-item.js +0 -9
- package/dist/customer/card/use-add-item.d.ts +0 -6
- package/dist/customer/card/use-add-item.js +0 -9
- package/dist/customer/card/use-cards.d.ts +0 -6
- package/dist/customer/card/use-cards.js +0 -18
- package/dist/customer/card/use-remove-item.d.ts +0 -6
- package/dist/customer/card/use-remove-item.js +0 -9
- package/dist/customer/card/use-update-item.d.ts +0 -6
- package/dist/customer/card/use-update-item.js +0 -9
- package/dist/customer/use-customer.d.ts +0 -6
- package/dist/customer/use-customer.js +0 -9
- package/dist/product/use-price.js +0 -33
- package/dist/product/use-search.js +0 -9
- package/dist/registerProductCollection.js +0 -42
- package/dist/registerProductImage.d.ts +0 -13
- package/dist/registerProductImage.js +0 -37
- package/dist/registerable.js +0 -0
- package/dist/tsconfig.tsbuildinfo +0 -2970
- package/dist/types/cart.js +0 -0
- package/dist/types/checkout.js +0 -0
- package/dist/types/common.js +0 -0
- package/dist/types/customer/address.js +0 -0
- package/dist/types/customer/card.js +0 -0
- package/dist/types/customer/index.js +0 -2
- package/dist/types/index.js +0 -11
- package/dist/types/login.js +0 -0
- package/dist/types/logout.js +0 -0
- package/dist/types/page.js +0 -0
- package/dist/types/product.js +0 -0
- package/dist/types/signup.js +0 -0
- package/dist/types/site.js +0 -0
- package/dist/types/wishlist.js +0 -0
- package/dist/utils/default-fetcher.js +0 -3
- package/dist/utils/define-property.js +0 -4
- package/dist/utils/errors.js +0 -24
- package/dist/utils/types.js +0 -0
- package/dist/utils/use-data.js +0 -43
- package/dist/utils/use-hook.js +0 -37
package/dist/types/product.d.ts
CHANGED
|
@@ -1,99 +1,102 @@
|
|
|
1
|
-
export declare type ProductImage = {
|
|
2
|
-
url: string;
|
|
3
|
-
alt?: string;
|
|
4
|
-
};
|
|
5
|
-
export declare type ProductPrice = {
|
|
6
|
-
value: number;
|
|
7
|
-
currencyCode?: 'USD' | 'EUR' | 'ARS' | string;
|
|
8
|
-
retailPrice?: number;
|
|
9
|
-
salePrice?: number;
|
|
10
|
-
listPrice?: number;
|
|
11
|
-
extendedSalePrice?: number;
|
|
12
|
-
extendedListPrice?: number;
|
|
13
|
-
};
|
|
14
|
-
export declare type ProductOption = {
|
|
15
|
-
__typename?: 'MultipleChoiceOption';
|
|
16
|
-
id: string;
|
|
17
|
-
displayName: string;
|
|
18
|
-
values: ProductOptionValues[];
|
|
19
|
-
};
|
|
20
|
-
export declare type ProductOptionValues = {
|
|
21
|
-
label: string;
|
|
22
|
-
hexColors?: string[];
|
|
23
|
-
};
|
|
24
|
-
export declare type ProductVariant = {
|
|
25
|
-
id: string | number;
|
|
26
|
-
options: ProductOption[];
|
|
27
|
-
availableForSale?: boolean;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
path
|
|
97
|
-
slug
|
|
98
|
-
}
|
|
99
|
-
|
|
1
|
+
export declare type ProductImage = {
|
|
2
|
+
url: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type ProductPrice = {
|
|
6
|
+
value: number;
|
|
7
|
+
currencyCode?: 'USD' | 'EUR' | 'ARS' | string;
|
|
8
|
+
retailPrice?: number;
|
|
9
|
+
salePrice?: number;
|
|
10
|
+
listPrice?: number;
|
|
11
|
+
extendedSalePrice?: number;
|
|
12
|
+
extendedListPrice?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare type ProductOption = {
|
|
15
|
+
__typename?: 'MultipleChoiceOption';
|
|
16
|
+
id: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
values: ProductOptionValues[];
|
|
19
|
+
};
|
|
20
|
+
export declare type ProductOptionValues = {
|
|
21
|
+
label: string;
|
|
22
|
+
hexColors?: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare type ProductVariant = {
|
|
25
|
+
id: string | number;
|
|
26
|
+
options: ProductOption[];
|
|
27
|
+
availableForSale?: boolean;
|
|
28
|
+
name: string;
|
|
29
|
+
price?: number;
|
|
30
|
+
};
|
|
31
|
+
export declare type Product = {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
descriptionHtml?: string;
|
|
36
|
+
sku?: string;
|
|
37
|
+
slug?: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
images: ProductImage[];
|
|
40
|
+
variants: ProductVariant[];
|
|
41
|
+
price: ProductPrice;
|
|
42
|
+
options: ProductOption[];
|
|
43
|
+
};
|
|
44
|
+
export declare type SearchProductsBody = {
|
|
45
|
+
search?: string;
|
|
46
|
+
categoryId?: string | number;
|
|
47
|
+
brandId?: string | number;
|
|
48
|
+
sort?: string;
|
|
49
|
+
locale?: string;
|
|
50
|
+
count?: number;
|
|
51
|
+
};
|
|
52
|
+
export declare type ProductTypes = {
|
|
53
|
+
product: Product;
|
|
54
|
+
searchBody: SearchProductsBody;
|
|
55
|
+
};
|
|
56
|
+
export declare type SearchProductsHook<T extends ProductTypes = ProductTypes> = {
|
|
57
|
+
data: {
|
|
58
|
+
products: T['product'][];
|
|
59
|
+
found: boolean;
|
|
60
|
+
};
|
|
61
|
+
body: T['searchBody'];
|
|
62
|
+
input: T['searchBody'];
|
|
63
|
+
fetcherInput: T['searchBody'];
|
|
64
|
+
};
|
|
65
|
+
export declare type ProductsSchema<T extends ProductTypes = ProductTypes> = {
|
|
66
|
+
endpoint: {
|
|
67
|
+
options: {};
|
|
68
|
+
handlers: {
|
|
69
|
+
getProducts: SearchProductsHook<T>;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {
|
|
74
|
+
data: {
|
|
75
|
+
products: Pick<T['product'], 'path'>[];
|
|
76
|
+
};
|
|
77
|
+
variables: {
|
|
78
|
+
first?: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export declare type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {
|
|
82
|
+
data: {
|
|
83
|
+
products: T['product'][];
|
|
84
|
+
};
|
|
85
|
+
variables: {
|
|
86
|
+
relevance?: 'featured' | 'best_selling' | 'newest';
|
|
87
|
+
ids?: string[];
|
|
88
|
+
first?: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export declare type GetProductOperation<T extends ProductTypes = ProductTypes> = {
|
|
92
|
+
data: {
|
|
93
|
+
product?: T['product'];
|
|
94
|
+
};
|
|
95
|
+
variables: {
|
|
96
|
+
path: string;
|
|
97
|
+
slug?: never;
|
|
98
|
+
} | {
|
|
99
|
+
path?: never;
|
|
100
|
+
slug: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
package/dist/types/signup.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export declare type SignupBody = {
|
|
2
|
-
firstName: string;
|
|
3
|
-
lastName: string;
|
|
4
|
-
email: string;
|
|
5
|
-
password: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type SignupTypes = {
|
|
8
|
-
body: SignupBody;
|
|
9
|
-
};
|
|
10
|
-
export declare type SignupHook<T extends SignupTypes = SignupTypes> = {
|
|
11
|
-
data: null;
|
|
12
|
-
body: T['body'];
|
|
13
|
-
actionInput: T['body'];
|
|
14
|
-
fetcherInput: T['body'];
|
|
15
|
-
};
|
|
16
|
-
export declare type SignupSchema<T extends SignupTypes = SignupTypes> = {
|
|
17
|
-
endpoint: {
|
|
18
|
-
options: {};
|
|
19
|
-
handlers: {
|
|
20
|
-
signup: SignupHook<T>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
1
|
+
export declare type SignupBody = {
|
|
2
|
+
firstName: string;
|
|
3
|
+
lastName: string;
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type SignupTypes = {
|
|
8
|
+
body: SignupBody;
|
|
9
|
+
};
|
|
10
|
+
export declare type SignupHook<T extends SignupTypes = SignupTypes> = {
|
|
11
|
+
data: null;
|
|
12
|
+
body: T['body'];
|
|
13
|
+
actionInput: T['body'];
|
|
14
|
+
fetcherInput: T['body'];
|
|
15
|
+
};
|
|
16
|
+
export declare type SignupSchema<T extends SignupTypes = SignupTypes> = {
|
|
17
|
+
endpoint: {
|
|
18
|
+
options: {};
|
|
19
|
+
handlers: {
|
|
20
|
+
signup: SignupHook<T>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
package/dist/types/site.d.ts
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
export declare type Category = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
slug: string;
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type Brand =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
export declare type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
export declare type Category = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type Brand = {
|
|
8
|
+
name: string;
|
|
9
|
+
entityId: string;
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type SearchSiteInfoBody = {
|
|
13
|
+
locale?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type SiteTypes = {
|
|
16
|
+
category: Category;
|
|
17
|
+
brand: Brand;
|
|
18
|
+
searchBody: SearchSiteInfoBody;
|
|
19
|
+
};
|
|
20
|
+
export declare type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
|
|
21
|
+
data: {
|
|
22
|
+
categories: T['category'][];
|
|
23
|
+
brands: T['brand'][];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare type GetCategoriesHook<T extends SiteTypes = SiteTypes> = {
|
|
27
|
+
data: T['category'][] | null;
|
|
28
|
+
input: {};
|
|
29
|
+
fetcherInput: {};
|
|
30
|
+
swrState: {
|
|
31
|
+
isEmpty: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare type GetBrandsHook<T extends SiteTypes = SiteTypes> = {
|
|
35
|
+
data: T['brand'][] | null;
|
|
36
|
+
input: {};
|
|
37
|
+
fetcherInput: {};
|
|
38
|
+
swrState: {
|
|
39
|
+
isEmpty: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
package/dist/types/wishlist.d.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
export declare type Wishlist = any;
|
|
2
|
-
export declare type WishlistItemBody = {
|
|
3
|
-
variantId: string | number;
|
|
4
|
-
productId: string;
|
|
5
|
-
};
|
|
6
|
-
export declare type WishlistTypes = {
|
|
7
|
-
wishlist: Wishlist;
|
|
8
|
-
itemBody: WishlistItemBody;
|
|
9
|
-
};
|
|
10
|
-
export declare type GetWishlistHook<T extends WishlistTypes = WishlistTypes> = {
|
|
11
|
-
data: T['wishlist'] | null;
|
|
12
|
-
body: {
|
|
13
|
-
includeProducts?: boolean;
|
|
14
|
-
};
|
|
15
|
-
input: {
|
|
16
|
-
includeProducts?: boolean;
|
|
17
|
-
};
|
|
18
|
-
fetcherInput: {
|
|
19
|
-
customerId: string;
|
|
20
|
-
includeProducts?: boolean;
|
|
21
|
-
};
|
|
22
|
-
swrState: {
|
|
23
|
-
isEmpty: boolean;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export declare type AddItemHook<T extends WishlistTypes = WishlistTypes> = {
|
|
27
|
-
data: T['wishlist'];
|
|
28
|
-
body: {
|
|
29
|
-
item: T['itemBody'];
|
|
30
|
-
};
|
|
31
|
-
fetcherInput: {
|
|
32
|
-
item: T['itemBody'];
|
|
33
|
-
};
|
|
34
|
-
actionInput: T['itemBody'];
|
|
35
|
-
};
|
|
36
|
-
export declare type RemoveItemHook<T extends WishlistTypes = WishlistTypes> = {
|
|
37
|
-
data: T['wishlist'] | null;
|
|
38
|
-
body: {
|
|
39
|
-
itemId: string;
|
|
40
|
-
};
|
|
41
|
-
fetcherInput: {
|
|
42
|
-
itemId: string;
|
|
43
|
-
};
|
|
44
|
-
actionInput: {
|
|
45
|
-
id: string;
|
|
46
|
-
};
|
|
47
|
-
input: {
|
|
48
|
-
wishlist?: {
|
|
49
|
-
includeProducts?: boolean;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export declare type WishlistSchema<T extends WishlistTypes = WishlistTypes> = {
|
|
54
|
-
endpoint: {
|
|
55
|
-
options: {};
|
|
56
|
-
handlers: {
|
|
57
|
-
getWishlist: GetWishlistHook<T> & {
|
|
58
|
-
data: T['wishlist'] | null;
|
|
59
|
-
body: {
|
|
60
|
-
customerToken?: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
addItem: AddItemHook<T> & {
|
|
64
|
-
body: {
|
|
65
|
-
customerToken?: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
removeItem: RemoveItemHook<T> & {
|
|
69
|
-
body: {
|
|
70
|
-
customerToken?: string;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
export declare type GetCustomerWishlistOperation<T extends WishlistTypes = WishlistTypes> = {
|
|
77
|
-
data: {
|
|
78
|
-
wishlist?: T['wishlist'];
|
|
79
|
-
};
|
|
80
|
-
variables: {
|
|
81
|
-
customerId: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
1
|
+
export declare type Wishlist = any;
|
|
2
|
+
export declare type WishlistItemBody = {
|
|
3
|
+
variantId: string | number;
|
|
4
|
+
productId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type WishlistTypes = {
|
|
7
|
+
wishlist: Wishlist;
|
|
8
|
+
itemBody: WishlistItemBody;
|
|
9
|
+
};
|
|
10
|
+
export declare type GetWishlistHook<T extends WishlistTypes = WishlistTypes> = {
|
|
11
|
+
data: T['wishlist'] | null;
|
|
12
|
+
body: {
|
|
13
|
+
includeProducts?: boolean;
|
|
14
|
+
};
|
|
15
|
+
input: {
|
|
16
|
+
includeProducts?: boolean;
|
|
17
|
+
};
|
|
18
|
+
fetcherInput: {
|
|
19
|
+
customerId: string;
|
|
20
|
+
includeProducts?: boolean;
|
|
21
|
+
};
|
|
22
|
+
swrState: {
|
|
23
|
+
isEmpty: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare type AddItemHook<T extends WishlistTypes = WishlistTypes> = {
|
|
27
|
+
data: T['wishlist'];
|
|
28
|
+
body: {
|
|
29
|
+
item: T['itemBody'];
|
|
30
|
+
};
|
|
31
|
+
fetcherInput: {
|
|
32
|
+
item: T['itemBody'];
|
|
33
|
+
};
|
|
34
|
+
actionInput: T['itemBody'];
|
|
35
|
+
};
|
|
36
|
+
export declare type RemoveItemHook<T extends WishlistTypes = WishlistTypes> = {
|
|
37
|
+
data: T['wishlist'] | null;
|
|
38
|
+
body: {
|
|
39
|
+
itemId: string;
|
|
40
|
+
};
|
|
41
|
+
fetcherInput: {
|
|
42
|
+
itemId: string;
|
|
43
|
+
};
|
|
44
|
+
actionInput: {
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
input: {
|
|
48
|
+
wishlist?: {
|
|
49
|
+
includeProducts?: boolean;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export declare type WishlistSchema<T extends WishlistTypes = WishlistTypes> = {
|
|
54
|
+
endpoint: {
|
|
55
|
+
options: {};
|
|
56
|
+
handlers: {
|
|
57
|
+
getWishlist: GetWishlistHook<T> & {
|
|
58
|
+
data: T['wishlist'] | null;
|
|
59
|
+
body: {
|
|
60
|
+
customerToken?: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
addItem: AddItemHook<T> & {
|
|
64
|
+
body: {
|
|
65
|
+
customerToken?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
removeItem: RemoveItemHook<T> & {
|
|
69
|
+
body: {
|
|
70
|
+
customerToken?: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare type GetCustomerWishlistOperation<T extends WishlistTypes = WishlistTypes> = {
|
|
77
|
+
data: {
|
|
78
|
+
wishlist?: T['wishlist'];
|
|
79
|
+
};
|
|
80
|
+
variables: {
|
|
81
|
+
customerId: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HookFetcherFn } from './types';
|
|
2
|
-
export declare const SWRFetcher: HookFetcherFn<any>;
|
|
3
|
-
export declare const mutationFetcher: HookFetcherFn<any>;
|
|
4
|
-
export default SWRFetcher;
|
|
1
|
+
import type { HookFetcherFn } from './types';
|
|
2
|
+
export declare const SWRFetcher: HookFetcherFn<any>;
|
|
3
|
+
export declare const mutationFetcher: HookFetcherFn<any>;
|
|
4
|
+
export default SWRFetcher;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
declare type InferValue<Prop extends PropertyKey, Desc> = Desc extends {
|
|
2
|
-
get(): any;
|
|
3
|
-
value: any;
|
|
4
|
-
} ? never : Desc extends {
|
|
5
|
-
value: infer T;
|
|
6
|
-
} ? Record<Prop, T> : Desc extends {
|
|
7
|
-
get(): infer T;
|
|
8
|
-
} ? Record<Prop, T> : never;
|
|
9
|
-
declare type DefineProperty<Prop extends PropertyKey, Desc extends PropertyDescriptor> = Desc extends {
|
|
10
|
-
writable: any;
|
|
11
|
-
set(val: any): any;
|
|
12
|
-
} ? never : Desc extends {
|
|
13
|
-
writable: any;
|
|
14
|
-
get(): any;
|
|
15
|
-
} ? never : Desc extends {
|
|
16
|
-
writable: false;
|
|
17
|
-
} ? Readonly<InferValue<Prop, Desc>> : Desc extends {
|
|
18
|
-
writable: true;
|
|
19
|
-
} ? InferValue<Prop, Desc> : Readonly<InferValue<Prop, Desc>>;
|
|
20
|
-
export default function defineProperty<Obj extends object, Key extends PropertyKey, PDesc extends PropertyDescriptor>(obj: Obj, prop: Key, val: PDesc): asserts obj is Obj & DefineProperty<Key, PDesc>;
|
|
21
|
-
export {};
|
|
1
|
+
declare type InferValue<Prop extends PropertyKey, Desc> = Desc extends {
|
|
2
|
+
get(): any;
|
|
3
|
+
value: any;
|
|
4
|
+
} ? never : Desc extends {
|
|
5
|
+
value: infer T;
|
|
6
|
+
} ? Record<Prop, T> : Desc extends {
|
|
7
|
+
get(): infer T;
|
|
8
|
+
} ? Record<Prop, T> : never;
|
|
9
|
+
declare type DefineProperty<Prop extends PropertyKey, Desc extends PropertyDescriptor> = Desc extends {
|
|
10
|
+
writable: any;
|
|
11
|
+
set(val: any): any;
|
|
12
|
+
} ? never : Desc extends {
|
|
13
|
+
writable: any;
|
|
14
|
+
get(): any;
|
|
15
|
+
} ? never : Desc extends {
|
|
16
|
+
writable: false;
|
|
17
|
+
} ? Readonly<InferValue<Prop, Desc>> : Desc extends {
|
|
18
|
+
writable: true;
|
|
19
|
+
} ? InferValue<Prop, Desc> : Readonly<InferValue<Prop, Desc>>;
|
|
20
|
+
export default function defineProperty<Obj extends object, Key extends PropertyKey, PDesc extends PropertyDescriptor>(obj: Obj, prop: Key, val: PDesc): asserts obj is Obj & DefineProperty<Key, PDesc>;
|
|
21
|
+
export {};
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export declare type ErrorData = {
|
|
2
|
-
message: string;
|
|
3
|
-
code?: string;
|
|
4
|
-
};
|
|
5
|
-
export declare type ErrorProps = {
|
|
6
|
-
code?: string;
|
|
7
|
-
} & ({
|
|
8
|
-
message: string;
|
|
9
|
-
errors?: never;
|
|
10
|
-
} | {
|
|
11
|
-
message?: never;
|
|
12
|
-
errors: ErrorData[];
|
|
13
|
-
});
|
|
14
|
-
export declare class CommerceError extends Error {
|
|
15
|
-
code?: string;
|
|
16
|
-
errors: ErrorData[];
|
|
17
|
-
constructor({ message, code, errors }: ErrorProps);
|
|
18
|
-
}
|
|
19
|
-
export declare class ValidationError extends CommerceError {
|
|
20
|
-
constructor(options: ErrorProps);
|
|
21
|
-
}
|
|
22
|
-
export declare class FetcherError extends CommerceError {
|
|
23
|
-
status: number;
|
|
24
|
-
constructor(options: {
|
|
25
|
-
status: number;
|
|
26
|
-
} & ErrorProps);
|
|
27
|
-
}
|
|
1
|
+
export declare type ErrorData = {
|
|
2
|
+
message: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type ErrorProps = {
|
|
6
|
+
code?: string;
|
|
7
|
+
} & ({
|
|
8
|
+
message: string;
|
|
9
|
+
errors?: never;
|
|
10
|
+
} | {
|
|
11
|
+
message?: never;
|
|
12
|
+
errors: ErrorData[];
|
|
13
|
+
});
|
|
14
|
+
export declare class CommerceError extends Error {
|
|
15
|
+
code?: string;
|
|
16
|
+
errors: ErrorData[];
|
|
17
|
+
constructor({ message, code, errors }: ErrorProps);
|
|
18
|
+
}
|
|
19
|
+
export declare class ValidationError extends CommerceError {
|
|
20
|
+
constructor(options: ErrorProps);
|
|
21
|
+
}
|
|
22
|
+
export declare class FetcherError extends CommerceError {
|
|
23
|
+
status: number;
|
|
24
|
+
constructor(options: {
|
|
25
|
+
status: number;
|
|
26
|
+
} & ErrorProps);
|
|
27
|
+
}
|