@plasmicpkgs/commerce 0.0.247 → 0.0.248
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/dist/api/endpoints/cart.d.ts +4 -4
- package/dist/api/endpoints/catalog/products.d.ts +4 -4
- package/dist/api/index.d.ts +75 -75
- package/dist/api/operations.d.ts +130 -130
- package/dist/api/utils/errors.d.ts +10 -10
- package/dist/api/utils/is-allowed-method.d.ts +3 -3
- package/dist/api/utils/is-allowed-operation.d.ts +6 -6
- package/dist/api/utils/types.d.ts +34 -34
- package/dist/cart/use-add-item.d.ts +5 -5
- package/dist/cart/use-cart.d.ts +5 -5
- package/dist/cart/use-remove-item.d.ts +5 -5
- package/dist/cart/use-update-item.d.ts +5 -5
- package/dist/commerce.cjs.development.js +23 -20
- package/dist/commerce.cjs.development.js.map +1 -1
- package/dist/commerce.cjs.production.min.js +1 -1
- package/dist/commerce.cjs.production.min.js.map +1 -1
- package/dist/commerce.d.ts +43 -43
- package/dist/commerce.esm.js +23 -20
- package/dist/commerce.esm.js.map +1 -1
- package/dist/contexts.d.ts +26 -26
- package/dist/index.d.ts +46 -46
- package/dist/product/use-price.d.ts +26 -26
- package/dist/product/use-product.d.ts +5 -5
- package/dist/product/use-search.d.ts +6 -6
- package/dist/registerAddToCartButton.d.ts +10 -10
- package/dist/registerCart.d.ts +12 -12
- package/dist/registerCartProvider.d.ts +6 -6
- package/dist/registerCategoryCollection.d.ts +20 -20
- package/dist/registerCategoryField.d.ts +11 -11
- package/dist/registerCategoryLink.d.ts +12 -12
- package/dist/registerCategoryMedia.d.ts +11 -11
- package/dist/registerProductBox.d.ts +18 -18
- package/dist/registerProductCollection.d.ts +29 -29
- package/dist/registerProductLink.d.ts +12 -12
- package/dist/registerProductMedia.d.ts +14 -14
- package/dist/registerProductMediaCollection.d.ts +11 -11
- package/dist/registerProductPrice.d.ts +10 -10
- package/dist/registerProductQuantity.d.ts +11 -11
- package/dist/registerProductSlider.d.ts +14 -14
- package/dist/registerProductTextField.d.ts +11 -11
- package/dist/registerProductVariantPicker.d.ts +10 -10
- package/dist/registerable.d.ts +4 -4
- package/dist/site/use-brands.d.ts +5 -5
- package/dist/site/use-categories.d.ts +5 -5
- 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 +117 -117
- package/dist/types/signup.d.ts +23 -23
- package/dist/types/site.d.ts +55 -55
- package/dist/types/wishlist.d.ts +83 -83
- package/dist/utils/default-fetcher.d.ts +4 -4
- package/dist/utils/default-product.d.ts +2 -2
- 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 -2
- package/dist/utils/types.d.ts +99 -99
- package/dist/utils/use-data.d.ts +13 -13
- package/dist/utils/use-extra-features.d.ts +1 -1
- package/dist/utils/use-hook.d.ts +7 -7
- package/package.json +5 -5
package/dist/types/product.d.ts
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { Category } from "./site";
|
|
2
|
-
export
|
|
3
|
-
url: string;
|
|
4
|
-
alt?: string;
|
|
5
|
-
width?: number;
|
|
6
|
-
height?: number;
|
|
7
|
-
};
|
|
8
|
-
export
|
|
9
|
-
value: number;
|
|
10
|
-
currencyCode?: "USD" | "EUR" | "ARS" | string;
|
|
11
|
-
retailPrice?: number;
|
|
12
|
-
salePrice?: number;
|
|
13
|
-
listPrice?: number;
|
|
14
|
-
extendedSalePrice?: number;
|
|
15
|
-
extendedListPrice?: number;
|
|
16
|
-
};
|
|
17
|
-
export
|
|
18
|
-
__typename?: "MultipleChoiceOption";
|
|
19
|
-
id: string;
|
|
20
|
-
displayName: string;
|
|
21
|
-
values: ProductOptionValues[];
|
|
22
|
-
};
|
|
23
|
-
export
|
|
24
|
-
label: string;
|
|
25
|
-
hexColors?: string[];
|
|
26
|
-
};
|
|
27
|
-
export
|
|
28
|
-
id: string | number;
|
|
29
|
-
options: ProductOption[];
|
|
30
|
-
availableForSale?: boolean;
|
|
31
|
-
name: string;
|
|
32
|
-
price?: number;
|
|
33
|
-
};
|
|
34
|
-
export
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
descriptionHtml?: string;
|
|
39
|
-
sku?: string;
|
|
40
|
-
slug?: string;
|
|
41
|
-
path?: string;
|
|
42
|
-
images: ProductImage[];
|
|
43
|
-
variants: ProductVariant[];
|
|
44
|
-
price: ProductPrice;
|
|
45
|
-
options: ProductOption[];
|
|
46
|
-
};
|
|
47
|
-
export
|
|
48
|
-
search?: string;
|
|
49
|
-
categoryId?: string | number;
|
|
50
|
-
brandId?: string | number;
|
|
51
|
-
sort?: string;
|
|
52
|
-
locale?: string;
|
|
53
|
-
count?: number;
|
|
54
|
-
includeSubCategories?: boolean;
|
|
55
|
-
categories?: Category[];
|
|
56
|
-
};
|
|
57
|
-
export
|
|
58
|
-
id?: string;
|
|
59
|
-
};
|
|
60
|
-
export
|
|
61
|
-
product: Product;
|
|
62
|
-
searchBody: SearchProductsBody;
|
|
63
|
-
getProductBody: GetProductBody;
|
|
64
|
-
};
|
|
65
|
-
export
|
|
66
|
-
data: {
|
|
67
|
-
products: T["product"][];
|
|
68
|
-
found: boolean;
|
|
69
|
-
};
|
|
70
|
-
body: T["searchBody"];
|
|
71
|
-
input: T["searchBody"];
|
|
72
|
-
fetcherInput: T["searchBody"];
|
|
73
|
-
};
|
|
74
|
-
export
|
|
75
|
-
data: T["product"] | null;
|
|
76
|
-
body: T["getProductBody"];
|
|
77
|
-
input: T["getProductBody"];
|
|
78
|
-
fetcherInput: T["getProductBody"];
|
|
79
|
-
};
|
|
80
|
-
export
|
|
81
|
-
endpoint: {
|
|
82
|
-
options: {};
|
|
83
|
-
handlers: {
|
|
84
|
-
getProducts: SearchProductsHook<T>;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
export
|
|
89
|
-
data: {
|
|
90
|
-
products: Pick<T["product"], "path">[];
|
|
91
|
-
};
|
|
92
|
-
variables: {
|
|
93
|
-
first?: number;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
export
|
|
97
|
-
data: {
|
|
98
|
-
products: T["product"][];
|
|
99
|
-
};
|
|
100
|
-
variables: {
|
|
101
|
-
relevance?: "featured" | "best_selling" | "newest";
|
|
102
|
-
ids?: string[];
|
|
103
|
-
first?: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
export
|
|
107
|
-
data: {
|
|
108
|
-
product?: T["product"];
|
|
109
|
-
};
|
|
110
|
-
variables: {
|
|
111
|
-
path: string;
|
|
112
|
-
slug?: never;
|
|
113
|
-
} | {
|
|
114
|
-
path?: never;
|
|
115
|
-
slug: string;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
1
|
+
import { Category } from "./site";
|
|
2
|
+
export type ProductImage = {
|
|
3
|
+
url: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
};
|
|
8
|
+
export type ProductPrice = {
|
|
9
|
+
value: number;
|
|
10
|
+
currencyCode?: "USD" | "EUR" | "ARS" | string;
|
|
11
|
+
retailPrice?: number;
|
|
12
|
+
salePrice?: number;
|
|
13
|
+
listPrice?: number;
|
|
14
|
+
extendedSalePrice?: number;
|
|
15
|
+
extendedListPrice?: number;
|
|
16
|
+
};
|
|
17
|
+
export type ProductOption = {
|
|
18
|
+
__typename?: "MultipleChoiceOption";
|
|
19
|
+
id: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
values: ProductOptionValues[];
|
|
22
|
+
};
|
|
23
|
+
export type ProductOptionValues = {
|
|
24
|
+
label: string;
|
|
25
|
+
hexColors?: string[];
|
|
26
|
+
};
|
|
27
|
+
export type ProductVariant = {
|
|
28
|
+
id: string | number;
|
|
29
|
+
options: ProductOption[];
|
|
30
|
+
availableForSale?: boolean;
|
|
31
|
+
name: string;
|
|
32
|
+
price?: number;
|
|
33
|
+
};
|
|
34
|
+
export type Product = {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
descriptionHtml?: string;
|
|
39
|
+
sku?: string;
|
|
40
|
+
slug?: string;
|
|
41
|
+
path?: string;
|
|
42
|
+
images: ProductImage[];
|
|
43
|
+
variants: ProductVariant[];
|
|
44
|
+
price: ProductPrice;
|
|
45
|
+
options: ProductOption[];
|
|
46
|
+
};
|
|
47
|
+
export type SearchProductsBody = {
|
|
48
|
+
search?: string;
|
|
49
|
+
categoryId?: string | number;
|
|
50
|
+
brandId?: string | number;
|
|
51
|
+
sort?: string;
|
|
52
|
+
locale?: string;
|
|
53
|
+
count?: number;
|
|
54
|
+
includeSubCategories?: boolean;
|
|
55
|
+
categories?: Category[];
|
|
56
|
+
};
|
|
57
|
+
export type GetProductBody = {
|
|
58
|
+
id?: string;
|
|
59
|
+
};
|
|
60
|
+
export type ProductTypes = {
|
|
61
|
+
product: Product;
|
|
62
|
+
searchBody: SearchProductsBody;
|
|
63
|
+
getProductBody: GetProductBody;
|
|
64
|
+
};
|
|
65
|
+
export type SearchProductsHook<T extends ProductTypes = ProductTypes> = {
|
|
66
|
+
data: {
|
|
67
|
+
products: T["product"][];
|
|
68
|
+
found: boolean;
|
|
69
|
+
};
|
|
70
|
+
body: T["searchBody"];
|
|
71
|
+
input: T["searchBody"];
|
|
72
|
+
fetcherInput: T["searchBody"];
|
|
73
|
+
};
|
|
74
|
+
export type GetProductHook<T extends ProductTypes = ProductTypes> = {
|
|
75
|
+
data: T["product"] | null;
|
|
76
|
+
body: T["getProductBody"];
|
|
77
|
+
input: T["getProductBody"];
|
|
78
|
+
fetcherInput: T["getProductBody"];
|
|
79
|
+
};
|
|
80
|
+
export type ProductsSchema<T extends ProductTypes = ProductTypes> = {
|
|
81
|
+
endpoint: {
|
|
82
|
+
options: {};
|
|
83
|
+
handlers: {
|
|
84
|
+
getProducts: SearchProductsHook<T>;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {
|
|
89
|
+
data: {
|
|
90
|
+
products: Pick<T["product"], "path">[];
|
|
91
|
+
};
|
|
92
|
+
variables: {
|
|
93
|
+
first?: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {
|
|
97
|
+
data: {
|
|
98
|
+
products: T["product"][];
|
|
99
|
+
};
|
|
100
|
+
variables: {
|
|
101
|
+
relevance?: "featured" | "best_selling" | "newest";
|
|
102
|
+
ids?: string[];
|
|
103
|
+
first?: number;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export type GetProductOperation<T extends ProductTypes = ProductTypes> = {
|
|
107
|
+
data: {
|
|
108
|
+
product?: T["product"];
|
|
109
|
+
};
|
|
110
|
+
variables: {
|
|
111
|
+
path: string;
|
|
112
|
+
slug?: never;
|
|
113
|
+
} | {
|
|
114
|
+
path?: never;
|
|
115
|
+
slug: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
package/dist/types/signup.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export
|
|
2
|
-
firstName: string;
|
|
3
|
-
lastName: string;
|
|
4
|
-
email: string;
|
|
5
|
-
password: string;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
body: SignupBody;
|
|
9
|
-
};
|
|
10
|
-
export
|
|
11
|
-
data: null;
|
|
12
|
-
body: T['body'];
|
|
13
|
-
actionInput: T['body'];
|
|
14
|
-
fetcherInput: T['body'];
|
|
15
|
-
};
|
|
16
|
-
export
|
|
17
|
-
endpoint: {
|
|
18
|
-
options: {};
|
|
19
|
-
handlers: {
|
|
20
|
-
signup: SignupHook<T>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
1
|
+
export type SignupBody = {
|
|
2
|
+
firstName: string;
|
|
3
|
+
lastName: string;
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
};
|
|
7
|
+
export type SignupTypes = {
|
|
8
|
+
body: SignupBody;
|
|
9
|
+
};
|
|
10
|
+
export type SignupHook<T extends SignupTypes = SignupTypes> = {
|
|
11
|
+
data: null;
|
|
12
|
+
body: T['body'];
|
|
13
|
+
actionInput: T['body'];
|
|
14
|
+
fetcherInput: T['body'];
|
|
15
|
+
};
|
|
16
|
+
export 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,55 +1,55 @@
|
|
|
1
|
-
export
|
|
2
|
-
url: string;
|
|
3
|
-
alt?: string;
|
|
4
|
-
};
|
|
5
|
-
export
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
slug: string;
|
|
9
|
-
path: string;
|
|
10
|
-
isEmpty?: boolean;
|
|
11
|
-
images?: CategoryImage[];
|
|
12
|
-
depth?: number;
|
|
13
|
-
children?: string[];
|
|
14
|
-
parentId?: string;
|
|
15
|
-
};
|
|
16
|
-
export
|
|
17
|
-
name: string;
|
|
18
|
-
entityId: string;
|
|
19
|
-
path: string;
|
|
20
|
-
};
|
|
21
|
-
export
|
|
22
|
-
locale?: string;
|
|
23
|
-
};
|
|
24
|
-
export
|
|
25
|
-
category: Category;
|
|
26
|
-
brand: Brand;
|
|
27
|
-
searchBody: SearchSiteInfoBody;
|
|
28
|
-
getCategoriesBody: GetCategoriesBody;
|
|
29
|
-
};
|
|
30
|
-
export
|
|
31
|
-
data: {
|
|
32
|
-
categories: T["category"][];
|
|
33
|
-
brands: T["brand"][];
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export
|
|
37
|
-
addIsEmptyField?: boolean;
|
|
38
|
-
categoryId?: string;
|
|
39
|
-
};
|
|
40
|
-
export
|
|
41
|
-
data: T["category"][];
|
|
42
|
-
input: T["getCategoriesBody"];
|
|
43
|
-
fetcherInput: T["getCategoriesBody"];
|
|
44
|
-
swrState: {
|
|
45
|
-
isEmpty: boolean;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export
|
|
49
|
-
data: T["brand"][] | null;
|
|
50
|
-
input: {};
|
|
51
|
-
fetcherInput: {};
|
|
52
|
-
swrState: {
|
|
53
|
-
isEmpty: boolean;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
1
|
+
export type CategoryImage = {
|
|
2
|
+
url: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
};
|
|
5
|
+
export type Category = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
path: string;
|
|
10
|
+
isEmpty?: boolean;
|
|
11
|
+
images?: CategoryImage[];
|
|
12
|
+
depth?: number;
|
|
13
|
+
children?: string[];
|
|
14
|
+
parentId?: string;
|
|
15
|
+
};
|
|
16
|
+
export type Brand = {
|
|
17
|
+
name: string;
|
|
18
|
+
entityId: string;
|
|
19
|
+
path: string;
|
|
20
|
+
};
|
|
21
|
+
export type SearchSiteInfoBody = {
|
|
22
|
+
locale?: string;
|
|
23
|
+
};
|
|
24
|
+
export type SiteTypes = {
|
|
25
|
+
category: Category;
|
|
26
|
+
brand: Brand;
|
|
27
|
+
searchBody: SearchSiteInfoBody;
|
|
28
|
+
getCategoriesBody: GetCategoriesBody;
|
|
29
|
+
};
|
|
30
|
+
export type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
|
|
31
|
+
data: {
|
|
32
|
+
categories: T["category"][];
|
|
33
|
+
brands: T["brand"][];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type GetCategoriesBody = {
|
|
37
|
+
addIsEmptyField?: boolean;
|
|
38
|
+
categoryId?: string;
|
|
39
|
+
};
|
|
40
|
+
export type GetCategoriesHook<T extends SiteTypes = SiteTypes> = {
|
|
41
|
+
data: T["category"][];
|
|
42
|
+
input: T["getCategoriesBody"];
|
|
43
|
+
fetcherInput: T["getCategoriesBody"];
|
|
44
|
+
swrState: {
|
|
45
|
+
isEmpty: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type GetBrandsHook<T extends SiteTypes = SiteTypes> = {
|
|
49
|
+
data: T["brand"][] | null;
|
|
50
|
+
input: {};
|
|
51
|
+
fetcherInput: {};
|
|
52
|
+
swrState: {
|
|
53
|
+
isEmpty: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
package/dist/types/wishlist.d.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
variantId: string | number;
|
|
4
|
-
productId: string;
|
|
5
|
-
};
|
|
6
|
-
export
|
|
7
|
-
wishlist: Wishlist;
|
|
8
|
-
itemBody: WishlistItemBody;
|
|
9
|
-
};
|
|
10
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
77
|
-
data: {
|
|
78
|
-
wishlist?: T['wishlist'];
|
|
79
|
-
};
|
|
80
|
-
variables: {
|
|
81
|
-
customerId: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
1
|
+
export type Wishlist = any;
|
|
2
|
+
export type WishlistItemBody = {
|
|
3
|
+
variantId: string | number;
|
|
4
|
+
productId: string;
|
|
5
|
+
};
|
|
6
|
+
export type WishlistTypes = {
|
|
7
|
+
wishlist: Wishlist;
|
|
8
|
+
itemBody: WishlistItemBody;
|
|
9
|
+
};
|
|
10
|
+
export 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 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 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 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 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,2 +1,2 @@
|
|
|
1
|
-
import { Product } from "../types/product";
|
|
2
|
-
export declare const defaultProduct: Product;
|
|
1
|
+
import { Product } from "../types/product";
|
|
2
|
+
export declare const defaultProduct: Product;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
+
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
|
+
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
|
|
2
|
-
message: string;
|
|
3
|
-
code?: string;
|
|
4
|
-
};
|
|
5
|
-
export
|
|
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 type ErrorData = {
|
|
2
|
+
message: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
};
|
|
5
|
+
export 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,2 +1,2 @@
|
|
|
1
|
-
import { Product } from "../types/product";
|
|
2
|
-
export declare const getProductPrice: (product: Product, variantId: string) => number;
|
|
1
|
+
import { Product } from "../types/product";
|
|
2
|
+
export declare const getProductPrice: (product: Product, variantId: string) => number;
|