@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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Registerable } from "./registerable";
|
|
4
|
-
interface ProductSliderProps {
|
|
5
|
-
className: string;
|
|
6
|
-
slideContainer?: React.ReactNode;
|
|
7
|
-
thumbsContainer?: React.ReactNode;
|
|
8
|
-
thumbsVisible?: number;
|
|
9
|
-
slideSelected?: number;
|
|
10
|
-
}
|
|
11
|
-
export declare const productSliderMeta: CodeComponentMeta<ProductSliderProps>;
|
|
12
|
-
export declare function ProductSlider(props: ProductSliderProps): React.JSX.Element;
|
|
13
|
-
export declare function registerProductSlider(loader?: Registerable, customProductSliderMeta?: CodeComponentMeta<ProductSliderProps>): void;
|
|
14
|
-
export {};
|
|
1
|
+
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Registerable } from "./registerable";
|
|
4
|
+
interface ProductSliderProps {
|
|
5
|
+
className: string;
|
|
6
|
+
slideContainer?: React.ReactNode;
|
|
7
|
+
thumbsContainer?: React.ReactNode;
|
|
8
|
+
thumbsVisible?: number;
|
|
9
|
+
slideSelected?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const productSliderMeta: CodeComponentMeta<ProductSliderProps>;
|
|
12
|
+
export declare function ProductSlider(props: ProductSliderProps): React.JSX.Element;
|
|
13
|
+
export declare function registerProductSlider(loader?: Registerable, customProductSliderMeta?: CodeComponentMeta<ProductSliderProps>): void;
|
|
14
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Registerable } from "./registerable";
|
|
4
|
-
interface ProductTextFieldProps {
|
|
5
|
-
className: string;
|
|
6
|
-
field: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const productTextFieldMeta: CodeComponentMeta<ProductTextFieldProps>;
|
|
9
|
-
export declare function ProductTextField(props: ProductTextFieldProps): React.JSX.Element;
|
|
10
|
-
export declare function registerTextField(loader?: Registerable, customProductTextFieldMeta?: CodeComponentMeta<ProductTextFieldProps>): void;
|
|
11
|
-
export {};
|
|
1
|
+
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Registerable } from "./registerable";
|
|
4
|
+
interface ProductTextFieldProps {
|
|
5
|
+
className: string;
|
|
6
|
+
field: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const productTextFieldMeta: CodeComponentMeta<ProductTextFieldProps>;
|
|
9
|
+
export declare function ProductTextField(props: ProductTextFieldProps): React.JSX.Element;
|
|
10
|
+
export declare function registerTextField(loader?: Registerable, customProductTextFieldMeta?: CodeComponentMeta<ProductTextFieldProps>): void;
|
|
11
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Registerable } from "./registerable";
|
|
4
|
-
interface ProductVariantPickerProps {
|
|
5
|
-
className: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const productVariantPickerMeta: CodeComponentMeta<ProductVariantPickerProps>;
|
|
8
|
-
export declare function ProductVariantPicker(props: ProductVariantPickerProps): React.JSX.Element;
|
|
9
|
-
export declare function registerProductVariantPicker(loader?: Registerable, customProductVariantPickerMeta?: CodeComponentMeta<ProductVariantPickerProps>): void;
|
|
10
|
-
export {};
|
|
1
|
+
import { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Registerable } from "./registerable";
|
|
4
|
+
interface ProductVariantPickerProps {
|
|
5
|
+
className: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const productVariantPickerMeta: CodeComponentMeta<ProductVariantPickerProps>;
|
|
8
|
+
export declare function ProductVariantPicker(props: ProductVariantPickerProps): React.JSX.Element;
|
|
9
|
+
export declare function registerProductVariantPicker(loader?: Registerable, customProductVariantPickerMeta?: CodeComponentMeta<ProductVariantPickerProps>): void;
|
|
10
|
+
export {};
|
package/dist/registerable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
2
|
-
export
|
|
3
|
-
registerComponent: typeof registerComponent;
|
|
4
|
-
};
|
|
1
|
+
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
2
|
+
export type Registerable = {
|
|
3
|
+
registerComponent: typeof registerComponent;
|
|
4
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SWRHook } from '../utils/types';
|
|
2
|
-
import { GetBrandsHook } from '../types/site';
|
|
3
|
-
export
|
|
4
|
-
declare const useBrands: UseBrands;
|
|
5
|
-
export default useBrands;
|
|
1
|
+
import type { SWRHook } from '../utils/types';
|
|
2
|
+
import { GetBrandsHook } from '../types/site';
|
|
3
|
+
export type UseBrands<H extends SWRHook<GetBrandsHook<any>> = SWRHook<GetBrandsHook>> = ReturnType<H['useHook']>;
|
|
4
|
+
declare const useBrands: UseBrands;
|
|
5
|
+
export default useBrands;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SWRHook } from '../utils/types';
|
|
2
|
-
import { GetCategoriesHook } from '../types/site';
|
|
3
|
-
export
|
|
4
|
-
declare const useCategories: UseCategories;
|
|
5
|
-
export default useCategories;
|
|
1
|
+
import type { SWRHook } from '../utils/types';
|
|
2
|
+
import { GetCategoriesHook } from '../types/site';
|
|
3
|
+
export type UseCategories<H extends SWRHook<GetCategoriesHook<any>> = SWRHook<GetCategoriesHook>> = ReturnType<H['useHook']>;
|
|
4
|
+
declare const useCategories: UseCategories;
|
|
5
|
+
export default useCategories;
|
package/dist/types/cart.d.ts
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
import type { Discount, Measurement, Image } from "./common";
|
|
2
|
-
export
|
|
3
|
-
id?: string;
|
|
4
|
-
name: string;
|
|
5
|
-
value: string;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
id: string;
|
|
9
|
-
variantId: string;
|
|
10
|
-
productId: string;
|
|
11
|
-
name: string;
|
|
12
|
-
quantity: number;
|
|
13
|
-
discounts: Discount[];
|
|
14
|
-
path: string;
|
|
15
|
-
variant: ProductVariant;
|
|
16
|
-
options?: SelectedOption[];
|
|
17
|
-
};
|
|
18
|
-
export
|
|
19
|
-
id: string;
|
|
20
|
-
sku: string;
|
|
21
|
-
name: string;
|
|
22
|
-
requiresShipping: boolean;
|
|
23
|
-
price: number;
|
|
24
|
-
listPrice: number;
|
|
25
|
-
image?: Image;
|
|
26
|
-
isInStock?: boolean;
|
|
27
|
-
availableForSale?: boolean;
|
|
28
|
-
weight?: Measurement;
|
|
29
|
-
height?: Measurement;
|
|
30
|
-
width?: Measurement;
|
|
31
|
-
depth?: Measurement;
|
|
32
|
-
};
|
|
33
|
-
export
|
|
34
|
-
id: string;
|
|
35
|
-
customerId?: string;
|
|
36
|
-
email?: string;
|
|
37
|
-
createdAt: string;
|
|
38
|
-
currency: {
|
|
39
|
-
code: string;
|
|
40
|
-
};
|
|
41
|
-
taxesIncluded: boolean;
|
|
42
|
-
lineItems: LineItem[];
|
|
43
|
-
lineItemsSubtotalPrice: number;
|
|
44
|
-
subtotalPrice: number;
|
|
45
|
-
totalPrice: number;
|
|
46
|
-
discounts?: Discount[];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Base cart item body used for cart mutations
|
|
50
|
-
*/
|
|
51
|
-
export
|
|
52
|
-
variantId: string;
|
|
53
|
-
productId?: string;
|
|
54
|
-
quantity?: number;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Hooks schema
|
|
58
|
-
*/
|
|
59
|
-
export
|
|
60
|
-
cart?: Cart;
|
|
61
|
-
item: LineItem;
|
|
62
|
-
itemBody: CartItemBody;
|
|
63
|
-
};
|
|
64
|
-
export
|
|
65
|
-
getCart: GetCartHook<T>;
|
|
66
|
-
addItem: AddItemHook<T>;
|
|
67
|
-
updateItem: UpdateItemHook<T>;
|
|
68
|
-
removeItem: RemoveItemHook<T>;
|
|
69
|
-
};
|
|
70
|
-
export
|
|
71
|
-
data: T["cart"] | null;
|
|
72
|
-
input: {};
|
|
73
|
-
fetcherInput: {
|
|
74
|
-
cartId?: string;
|
|
75
|
-
};
|
|
76
|
-
swrState: {
|
|
77
|
-
isEmpty: boolean;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
export
|
|
81
|
-
data: T["cart"];
|
|
82
|
-
input?: T["itemBody"];
|
|
83
|
-
fetcherInput: T["itemBody"];
|
|
84
|
-
body: {
|
|
85
|
-
item: T["itemBody"];
|
|
86
|
-
};
|
|
87
|
-
actionInput: T["itemBody"];
|
|
88
|
-
};
|
|
89
|
-
export
|
|
90
|
-
data: T["cart"] | null;
|
|
91
|
-
input: {
|
|
92
|
-
item?: T["item"];
|
|
93
|
-
wait?: number;
|
|
94
|
-
};
|
|
95
|
-
fetcherInput: {
|
|
96
|
-
itemId: string;
|
|
97
|
-
item: Partial<T["itemBody"]>;
|
|
98
|
-
};
|
|
99
|
-
body: {
|
|
100
|
-
itemId: string;
|
|
101
|
-
item: Partial<T["itemBody"]>;
|
|
102
|
-
};
|
|
103
|
-
actionInput: Partial<T["itemBody"]> & {
|
|
104
|
-
id: string;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
export
|
|
108
|
-
data: T["cart"] | null;
|
|
109
|
-
input: {
|
|
110
|
-
item?: T["item"];
|
|
111
|
-
};
|
|
112
|
-
fetcherInput: {
|
|
113
|
-
itemId: string;
|
|
114
|
-
};
|
|
115
|
-
body: {
|
|
116
|
-
itemId: string;
|
|
117
|
-
};
|
|
118
|
-
actionInput: {
|
|
119
|
-
id: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* API Schema
|
|
124
|
-
*/
|
|
125
|
-
export
|
|
126
|
-
endpoint: {
|
|
127
|
-
options: {};
|
|
128
|
-
handlers: CartHandlers<T>;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
export
|
|
132
|
-
getCart: GetCartHandler<T>;
|
|
133
|
-
addItem: AddItemHandler<T>;
|
|
134
|
-
updateItem: UpdateItemHandler<T>;
|
|
135
|
-
removeItem: RemoveItemHandler<T>;
|
|
136
|
-
};
|
|
137
|
-
export
|
|
138
|
-
body: {
|
|
139
|
-
cartId?: string;
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
export
|
|
143
|
-
body: {
|
|
144
|
-
cartId: string;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
export
|
|
148
|
-
data: T["cart"];
|
|
149
|
-
body: {
|
|
150
|
-
cartId: string;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
export
|
|
154
|
-
body: {
|
|
155
|
-
cartId: string;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
1
|
+
import type { Discount, Measurement, Image } from "./common";
|
|
2
|
+
export type SelectedOption = {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type LineItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
variantId: string;
|
|
10
|
+
productId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
quantity: number;
|
|
13
|
+
discounts: Discount[];
|
|
14
|
+
path: string;
|
|
15
|
+
variant: ProductVariant;
|
|
16
|
+
options?: SelectedOption[];
|
|
17
|
+
};
|
|
18
|
+
export type ProductVariant = {
|
|
19
|
+
id: string;
|
|
20
|
+
sku: string;
|
|
21
|
+
name: string;
|
|
22
|
+
requiresShipping: boolean;
|
|
23
|
+
price: number;
|
|
24
|
+
listPrice: number;
|
|
25
|
+
image?: Image;
|
|
26
|
+
isInStock?: boolean;
|
|
27
|
+
availableForSale?: boolean;
|
|
28
|
+
weight?: Measurement;
|
|
29
|
+
height?: Measurement;
|
|
30
|
+
width?: Measurement;
|
|
31
|
+
depth?: Measurement;
|
|
32
|
+
};
|
|
33
|
+
export type Cart = {
|
|
34
|
+
id: string;
|
|
35
|
+
customerId?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
currency: {
|
|
39
|
+
code: string;
|
|
40
|
+
};
|
|
41
|
+
taxesIncluded: boolean;
|
|
42
|
+
lineItems: LineItem[];
|
|
43
|
+
lineItemsSubtotalPrice: number;
|
|
44
|
+
subtotalPrice: number;
|
|
45
|
+
totalPrice: number;
|
|
46
|
+
discounts?: Discount[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Base cart item body used for cart mutations
|
|
50
|
+
*/
|
|
51
|
+
export type CartItemBody = {
|
|
52
|
+
variantId: string;
|
|
53
|
+
productId?: string;
|
|
54
|
+
quantity?: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Hooks schema
|
|
58
|
+
*/
|
|
59
|
+
export type CartTypes = {
|
|
60
|
+
cart?: Cart;
|
|
61
|
+
item: LineItem;
|
|
62
|
+
itemBody: CartItemBody;
|
|
63
|
+
};
|
|
64
|
+
export type CartHooks<T extends CartTypes = CartTypes> = {
|
|
65
|
+
getCart: GetCartHook<T>;
|
|
66
|
+
addItem: AddItemHook<T>;
|
|
67
|
+
updateItem: UpdateItemHook<T>;
|
|
68
|
+
removeItem: RemoveItemHook<T>;
|
|
69
|
+
};
|
|
70
|
+
export type GetCartHook<T extends CartTypes = CartTypes> = {
|
|
71
|
+
data: T["cart"] | null;
|
|
72
|
+
input: {};
|
|
73
|
+
fetcherInput: {
|
|
74
|
+
cartId?: string;
|
|
75
|
+
};
|
|
76
|
+
swrState: {
|
|
77
|
+
isEmpty: boolean;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type AddItemHook<T extends CartTypes = CartTypes> = {
|
|
81
|
+
data: T["cart"];
|
|
82
|
+
input?: T["itemBody"];
|
|
83
|
+
fetcherInput: T["itemBody"];
|
|
84
|
+
body: {
|
|
85
|
+
item: T["itemBody"];
|
|
86
|
+
};
|
|
87
|
+
actionInput: T["itemBody"];
|
|
88
|
+
};
|
|
89
|
+
export type UpdateItemHook<T extends CartTypes = CartTypes> = {
|
|
90
|
+
data: T["cart"] | null;
|
|
91
|
+
input: {
|
|
92
|
+
item?: T["item"];
|
|
93
|
+
wait?: number;
|
|
94
|
+
};
|
|
95
|
+
fetcherInput: {
|
|
96
|
+
itemId: string;
|
|
97
|
+
item: Partial<T["itemBody"]>;
|
|
98
|
+
};
|
|
99
|
+
body: {
|
|
100
|
+
itemId: string;
|
|
101
|
+
item: Partial<T["itemBody"]>;
|
|
102
|
+
};
|
|
103
|
+
actionInput: Partial<T["itemBody"]> & {
|
|
104
|
+
id: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export type RemoveItemHook<T extends CartTypes = CartTypes> = {
|
|
108
|
+
data: T["cart"] | null;
|
|
109
|
+
input: {
|
|
110
|
+
item?: T["item"];
|
|
111
|
+
};
|
|
112
|
+
fetcherInput: {
|
|
113
|
+
itemId: string;
|
|
114
|
+
};
|
|
115
|
+
body: {
|
|
116
|
+
itemId: string;
|
|
117
|
+
};
|
|
118
|
+
actionInput: {
|
|
119
|
+
id: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* API Schema
|
|
124
|
+
*/
|
|
125
|
+
export type CartSchema<T extends CartTypes = CartTypes> = {
|
|
126
|
+
endpoint: {
|
|
127
|
+
options: {};
|
|
128
|
+
handlers: CartHandlers<T>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export type CartHandlers<T extends CartTypes = CartTypes> = {
|
|
132
|
+
getCart: GetCartHandler<T>;
|
|
133
|
+
addItem: AddItemHandler<T>;
|
|
134
|
+
updateItem: UpdateItemHandler<T>;
|
|
135
|
+
removeItem: RemoveItemHandler<T>;
|
|
136
|
+
};
|
|
137
|
+
export type GetCartHandler<T extends CartTypes = CartTypes> = GetCartHook<T> & {
|
|
138
|
+
body: {
|
|
139
|
+
cartId?: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHook<T> & {
|
|
143
|
+
body: {
|
|
144
|
+
cartId: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
|
|
148
|
+
data: T["cart"];
|
|
149
|
+
body: {
|
|
150
|
+
cartId: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export type RemoveItemHandler<T extends CartTypes = CartTypes> = RemoveItemHook<T> & {
|
|
154
|
+
body: {
|
|
155
|
+
cartId: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
package/dist/types/checkout.d.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import type { UseSubmitCheckout } from '../checkout/use-submit-checkout';
|
|
2
|
-
import type { Address, AddressFields } from './customer/address';
|
|
3
|
-
import type { Card, CardFields } from './customer/card';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
card?: Card | CardFields;
|
|
7
|
-
address?: Address | AddressFields;
|
|
8
|
-
checkout?: Checkout;
|
|
9
|
-
hasPayment?: boolean;
|
|
10
|
-
hasShipping?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export
|
|
13
|
-
data: T;
|
|
14
|
-
input?: T;
|
|
15
|
-
fetcherInput: T;
|
|
16
|
-
body: {
|
|
17
|
-
item: T;
|
|
18
|
-
};
|
|
19
|
-
actionInput: T;
|
|
20
|
-
};
|
|
21
|
-
export
|
|
22
|
-
data: T['checkout'] | null;
|
|
23
|
-
input: {};
|
|
24
|
-
fetcherInput: {
|
|
25
|
-
cartId?: string;
|
|
26
|
-
};
|
|
27
|
-
swrState: {
|
|
28
|
-
isEmpty: boolean;
|
|
29
|
-
};
|
|
30
|
-
mutations: {
|
|
31
|
-
submit: UseSubmitCheckout;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export
|
|
35
|
-
submitCheckout?: SubmitCheckoutHook<T>;
|
|
36
|
-
getCheckout: GetCheckoutHook<T>;
|
|
37
|
-
};
|
|
38
|
-
export
|
|
39
|
-
body: {
|
|
40
|
-
cartId: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export
|
|
44
|
-
body: {
|
|
45
|
-
cartId: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export
|
|
49
|
-
getCheckout: GetCheckoutHandler<T>;
|
|
50
|
-
submitCheckout?: SubmitCheckoutHandler<T>;
|
|
51
|
-
};
|
|
52
|
-
export
|
|
53
|
-
endpoint: {
|
|
54
|
-
options: {};
|
|
55
|
-
handlers: CheckoutHandlers<T>;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
1
|
+
import type { UseSubmitCheckout } from '../checkout/use-submit-checkout';
|
|
2
|
+
import type { Address, AddressFields } from './customer/address';
|
|
3
|
+
import type { Card, CardFields } from './customer/card';
|
|
4
|
+
export type Checkout = any;
|
|
5
|
+
export type CheckoutTypes = {
|
|
6
|
+
card?: Card | CardFields;
|
|
7
|
+
address?: Address | AddressFields;
|
|
8
|
+
checkout?: Checkout;
|
|
9
|
+
hasPayment?: boolean;
|
|
10
|
+
hasShipping?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type SubmitCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
13
|
+
data: T;
|
|
14
|
+
input?: T;
|
|
15
|
+
fetcherInput: T;
|
|
16
|
+
body: {
|
|
17
|
+
item: T;
|
|
18
|
+
};
|
|
19
|
+
actionInput: T;
|
|
20
|
+
};
|
|
21
|
+
export type GetCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
22
|
+
data: T['checkout'] | null;
|
|
23
|
+
input: {};
|
|
24
|
+
fetcherInput: {
|
|
25
|
+
cartId?: string;
|
|
26
|
+
};
|
|
27
|
+
swrState: {
|
|
28
|
+
isEmpty: boolean;
|
|
29
|
+
};
|
|
30
|
+
mutations: {
|
|
31
|
+
submit: UseSubmitCheckout;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type CheckoutHooks<T extends CheckoutTypes = CheckoutTypes> = {
|
|
35
|
+
submitCheckout?: SubmitCheckoutHook<T>;
|
|
36
|
+
getCheckout: GetCheckoutHook<T>;
|
|
37
|
+
};
|
|
38
|
+
export type GetCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = GetCheckoutHook<T> & {
|
|
39
|
+
body: {
|
|
40
|
+
cartId: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type SubmitCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = SubmitCheckoutHook<T> & {
|
|
44
|
+
body: {
|
|
45
|
+
cartId: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type CheckoutHandlers<T extends CheckoutTypes = CheckoutTypes> = {
|
|
49
|
+
getCheckout: GetCheckoutHandler<T>;
|
|
50
|
+
submitCheckout?: SubmitCheckoutHandler<T>;
|
|
51
|
+
};
|
|
52
|
+
export type CheckoutSchema<T extends CheckoutTypes = CheckoutTypes> = {
|
|
53
|
+
endpoint: {
|
|
54
|
+
options: {};
|
|
55
|
+
handlers: CheckoutHandlers<T>;
|
|
56
|
+
};
|
|
57
|
+
};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
value: number;
|
|
3
|
-
};
|
|
4
|
-
export
|
|
5
|
-
value: number;
|
|
6
|
-
unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
7
|
-
};
|
|
8
|
-
export
|
|
9
|
-
url: string;
|
|
10
|
-
altText?: string;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
};
|
|
1
|
+
export type Discount = {
|
|
2
|
+
value: number;
|
|
3
|
+
};
|
|
4
|
+
export type Measurement = {
|
|
5
|
+
value: number;
|
|
6
|
+
unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
7
|
+
};
|
|
8
|
+
export type Image = {
|
|
9
|
+
url: string;
|
|
10
|
+
altText?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
};
|