@gem-sdk/adapter-common 1.0.0 → 1.11.0
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/types/index.d.ts +1 -1
- package/dist/types/types/cart.d.ts +205 -205
- package/dist/types/types/checkout.d.ts +53 -53
- package/dist/types/types/common.d.ts +15 -15
- package/dist/types/types/customer/address.d.ts +110 -110
- package/dist/types/types/customer/card.d.ts +113 -113
- package/dist/types/types/customer/index.d.ts +24 -24
- package/dist/types/types/global-style.d.ts +32 -32
- package/dist/types/types/index.d.ts +13 -13
- package/dist/types/types/login.d.ts +27 -27
- package/dist/types/types/logout.d.ts +17 -17
- package/dist/types/types/page.d.ts +24 -24
- package/dist/types/types/product.d.ts +100 -100
- package/dist/types/types/signup.d.ts +23 -23
- package/dist/types/types/site.d.ts +21 -21
- package/dist/types/types/wishlist.d.ts +83 -83
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './types';
|
|
1
|
+
export * from './types';
|
|
@@ -1,205 +1,205 @@
|
|
|
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 Attribute = {
|
|
8
|
-
key: string;
|
|
9
|
-
value?: string;
|
|
10
|
-
};
|
|
11
|
-
export type LineItem = {
|
|
12
|
-
id: string;
|
|
13
|
-
variantId: string;
|
|
14
|
-
productId: string;
|
|
15
|
-
productTitle: string;
|
|
16
|
-
name: string;
|
|
17
|
-
quantity: number;
|
|
18
|
-
discounts: Discount[];
|
|
19
|
-
path?: string;
|
|
20
|
-
variant: ProductVariant;
|
|
21
|
-
options?: SelectedOption[];
|
|
22
|
-
attributes?: Attribute[];
|
|
23
|
-
};
|
|
24
|
-
export type ProductVariant = {
|
|
25
|
-
id: string;
|
|
26
|
-
sku: string;
|
|
27
|
-
name: string;
|
|
28
|
-
requiresShipping: boolean;
|
|
29
|
-
price: number;
|
|
30
|
-
listPrice: number;
|
|
31
|
-
image?: Image;
|
|
32
|
-
isInStock?: boolean;
|
|
33
|
-
availableForSale?: boolean;
|
|
34
|
-
weight?: Measurement;
|
|
35
|
-
height?: Measurement;
|
|
36
|
-
width?: Measurement;
|
|
37
|
-
depth?: Measurement;
|
|
38
|
-
};
|
|
39
|
-
export type Cart = {
|
|
40
|
-
id: string;
|
|
41
|
-
customerId?: string;
|
|
42
|
-
email?: string;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
currency: {
|
|
45
|
-
code?: string;
|
|
46
|
-
};
|
|
47
|
-
taxesIncluded: boolean;
|
|
48
|
-
lineItems: LineItem[];
|
|
49
|
-
lineItemsSubtotalPrice: number;
|
|
50
|
-
subtotalPrice: number;
|
|
51
|
-
totalPrice: number;
|
|
52
|
-
discounts?: Discount[];
|
|
53
|
-
checkoutUrl?: string;
|
|
54
|
-
/** Cart note */
|
|
55
|
-
note?: string;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Base cart item body used for cart mutations
|
|
59
|
-
*/
|
|
60
|
-
export type CartItemBody = {
|
|
61
|
-
variantId: string;
|
|
62
|
-
productId?: string;
|
|
63
|
-
quantity?: number;
|
|
64
|
-
attributes?: {
|
|
65
|
-
key: string;
|
|
66
|
-
value: string;
|
|
67
|
-
}[];
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Hooks schema
|
|
71
|
-
*/
|
|
72
|
-
export type CartTypes = {
|
|
73
|
-
cart?: Cart;
|
|
74
|
-
item: LineItem;
|
|
75
|
-
itemBody: CartItemBody;
|
|
76
|
-
};
|
|
77
|
-
export type CartHooks<T extends CartTypes = CartTypes> = {
|
|
78
|
-
getCart: GetCartHook<T>;
|
|
79
|
-
addItem: AddItemHook<T>;
|
|
80
|
-
updateItem: UpdateItemHook<T>;
|
|
81
|
-
removeItem: RemoveItemHook<T>;
|
|
82
|
-
};
|
|
83
|
-
export type GetCartHook<T extends CartTypes = CartTypes> = {
|
|
84
|
-
data: T['cart'] | null;
|
|
85
|
-
input: {};
|
|
86
|
-
fetcherInput: {
|
|
87
|
-
cartId?: string;
|
|
88
|
-
};
|
|
89
|
-
swrState: {
|
|
90
|
-
isEmpty: boolean;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export type AddItemHook<T extends CartTypes = CartTypes> = {
|
|
94
|
-
data: T['cart'];
|
|
95
|
-
input?: T['itemBody'];
|
|
96
|
-
fetcherInput: T['itemBody'];
|
|
97
|
-
body: {
|
|
98
|
-
item: T['itemBody'];
|
|
99
|
-
};
|
|
100
|
-
actionInput: T['itemBody'];
|
|
101
|
-
};
|
|
102
|
-
export type UpdateItemHook<T extends CartTypes = CartTypes> = {
|
|
103
|
-
data: T['cart'] | null;
|
|
104
|
-
input: {
|
|
105
|
-
item?: T['item'];
|
|
106
|
-
wait?: number;
|
|
107
|
-
};
|
|
108
|
-
fetcherInput: {
|
|
109
|
-
itemId: string;
|
|
110
|
-
item: T['itemBody'];
|
|
111
|
-
};
|
|
112
|
-
body: {
|
|
113
|
-
itemId: string;
|
|
114
|
-
item: T['itemBody'];
|
|
115
|
-
};
|
|
116
|
-
actionInput: T['itemBody'] & {
|
|
117
|
-
id: string;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
export type RemoveItemHook<T extends CartTypes = CartTypes> = {
|
|
121
|
-
data: T['cart'] | null;
|
|
122
|
-
input: {
|
|
123
|
-
item?: T['item'];
|
|
124
|
-
};
|
|
125
|
-
fetcherInput: {
|
|
126
|
-
itemId: string;
|
|
127
|
-
};
|
|
128
|
-
body: {
|
|
129
|
-
itemId: string;
|
|
130
|
-
};
|
|
131
|
-
actionInput: {
|
|
132
|
-
id: string;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* API Schema
|
|
137
|
-
*/
|
|
138
|
-
export type CartSchema<T extends CartTypes = CartTypes> = {
|
|
139
|
-
endpoint: {
|
|
140
|
-
options: {};
|
|
141
|
-
handlers: CartHandlers<T>;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
export type CartHandlers<T extends CartTypes = CartTypes> = {
|
|
145
|
-
getCart: GetCartHandler<T>;
|
|
146
|
-
addItem: AddItemHandler<T>;
|
|
147
|
-
updateItem: UpdateItemHandler<T>;
|
|
148
|
-
removeItem: RemoveItemHandler<T>;
|
|
149
|
-
};
|
|
150
|
-
export type GetCartHandler<T extends CartTypes = CartTypes> = GetCartHook<T> & {
|
|
151
|
-
body: {
|
|
152
|
-
cartId?: string;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
export type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHook<T> & {
|
|
156
|
-
body: {
|
|
157
|
-
cartId: string;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
export type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
|
|
161
|
-
data: T['cart'];
|
|
162
|
-
body: {
|
|
163
|
-
cartId: string;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
export type RemoveItemHandler<T extends CartTypes = CartTypes> = RemoveItemHook<T> & {
|
|
167
|
-
body: {
|
|
168
|
-
cartId: string;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
export type RemoveCartLineInput = {
|
|
172
|
-
cartId: string;
|
|
173
|
-
lineId: string;
|
|
174
|
-
};
|
|
175
|
-
export type UpdateCartLineInput = {
|
|
176
|
-
cartId: string;
|
|
177
|
-
line: CartItemBody & {
|
|
178
|
-
id: string;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
export type AddCartLineInput = {
|
|
182
|
-
cartId: string;
|
|
183
|
-
lines: CartItemBody[];
|
|
184
|
-
};
|
|
185
|
-
export type CreateCartInput = {
|
|
186
|
-
items: CartItemBody[];
|
|
187
|
-
};
|
|
188
|
-
export type GetCartParams = {
|
|
189
|
-
cartId: string;
|
|
190
|
-
};
|
|
191
|
-
export type CartNoteUpdateInput = {
|
|
192
|
-
cartId: string;
|
|
193
|
-
note?: string;
|
|
194
|
-
};
|
|
195
|
-
export type CartDiscountCodesUpdateInput = {
|
|
196
|
-
cartId: string;
|
|
197
|
-
discountCodes?: string[];
|
|
198
|
-
};
|
|
199
|
-
export type GetCartFunc = (variables: GetCartParams) => Promise<Cart | undefined>;
|
|
200
|
-
export type CreateCartFunc = (variables: CreateCartInput) => Promise<Cart>;
|
|
201
|
-
export type UpdateCartLineFunc = (variables: UpdateCartLineInput) => Promise<Cart>;
|
|
202
|
-
export type RemoveCartLineFunc = (variables: RemoveCartLineInput) => Promise<Cart>;
|
|
203
|
-
export type AddCartLineFunc = (variables: AddCartLineInput) => Promise<Cart>;
|
|
204
|
-
export type CartNoteUpdateFunc = (variables: CartNoteUpdateInput) => Promise<Cart>;
|
|
205
|
-
export type CartDiscountCodesUpdateFunc = (variables: CartDiscountCodesUpdateInput) => Promise<Cart>;
|
|
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 Attribute = {
|
|
8
|
+
key: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
export type LineItem = {
|
|
12
|
+
id: string;
|
|
13
|
+
variantId: string;
|
|
14
|
+
productId: string;
|
|
15
|
+
productTitle: string;
|
|
16
|
+
name: string;
|
|
17
|
+
quantity: number;
|
|
18
|
+
discounts: Discount[];
|
|
19
|
+
path?: string;
|
|
20
|
+
variant: ProductVariant;
|
|
21
|
+
options?: SelectedOption[];
|
|
22
|
+
attributes?: Attribute[];
|
|
23
|
+
};
|
|
24
|
+
export type ProductVariant = {
|
|
25
|
+
id: string;
|
|
26
|
+
sku: string;
|
|
27
|
+
name: string;
|
|
28
|
+
requiresShipping: boolean;
|
|
29
|
+
price: number;
|
|
30
|
+
listPrice: number;
|
|
31
|
+
image?: Image;
|
|
32
|
+
isInStock?: boolean;
|
|
33
|
+
availableForSale?: boolean;
|
|
34
|
+
weight?: Measurement;
|
|
35
|
+
height?: Measurement;
|
|
36
|
+
width?: Measurement;
|
|
37
|
+
depth?: Measurement;
|
|
38
|
+
};
|
|
39
|
+
export type Cart = {
|
|
40
|
+
id: string;
|
|
41
|
+
customerId?: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
currency: {
|
|
45
|
+
code?: string;
|
|
46
|
+
};
|
|
47
|
+
taxesIncluded: boolean;
|
|
48
|
+
lineItems: LineItem[];
|
|
49
|
+
lineItemsSubtotalPrice: number;
|
|
50
|
+
subtotalPrice: number;
|
|
51
|
+
totalPrice: number;
|
|
52
|
+
discounts?: Discount[];
|
|
53
|
+
checkoutUrl?: string;
|
|
54
|
+
/** Cart note */
|
|
55
|
+
note?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Base cart item body used for cart mutations
|
|
59
|
+
*/
|
|
60
|
+
export type CartItemBody = {
|
|
61
|
+
variantId: string;
|
|
62
|
+
productId?: string;
|
|
63
|
+
quantity?: number;
|
|
64
|
+
attributes?: {
|
|
65
|
+
key: string;
|
|
66
|
+
value: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Hooks schema
|
|
71
|
+
*/
|
|
72
|
+
export type CartTypes = {
|
|
73
|
+
cart?: Cart;
|
|
74
|
+
item: LineItem;
|
|
75
|
+
itemBody: CartItemBody;
|
|
76
|
+
};
|
|
77
|
+
export type CartHooks<T extends CartTypes = CartTypes> = {
|
|
78
|
+
getCart: GetCartHook<T>;
|
|
79
|
+
addItem: AddItemHook<T>;
|
|
80
|
+
updateItem: UpdateItemHook<T>;
|
|
81
|
+
removeItem: RemoveItemHook<T>;
|
|
82
|
+
};
|
|
83
|
+
export type GetCartHook<T extends CartTypes = CartTypes> = {
|
|
84
|
+
data: T['cart'] | null;
|
|
85
|
+
input: {};
|
|
86
|
+
fetcherInput: {
|
|
87
|
+
cartId?: string;
|
|
88
|
+
};
|
|
89
|
+
swrState: {
|
|
90
|
+
isEmpty: boolean;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export type AddItemHook<T extends CartTypes = CartTypes> = {
|
|
94
|
+
data: T['cart'];
|
|
95
|
+
input?: T['itemBody'];
|
|
96
|
+
fetcherInput: T['itemBody'];
|
|
97
|
+
body: {
|
|
98
|
+
item: T['itemBody'];
|
|
99
|
+
};
|
|
100
|
+
actionInput: T['itemBody'];
|
|
101
|
+
};
|
|
102
|
+
export type UpdateItemHook<T extends CartTypes = CartTypes> = {
|
|
103
|
+
data: T['cart'] | null;
|
|
104
|
+
input: {
|
|
105
|
+
item?: T['item'];
|
|
106
|
+
wait?: number;
|
|
107
|
+
};
|
|
108
|
+
fetcherInput: {
|
|
109
|
+
itemId: string;
|
|
110
|
+
item: T['itemBody'];
|
|
111
|
+
};
|
|
112
|
+
body: {
|
|
113
|
+
itemId: string;
|
|
114
|
+
item: T['itemBody'];
|
|
115
|
+
};
|
|
116
|
+
actionInput: T['itemBody'] & {
|
|
117
|
+
id: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export type RemoveItemHook<T extends CartTypes = CartTypes> = {
|
|
121
|
+
data: T['cart'] | null;
|
|
122
|
+
input: {
|
|
123
|
+
item?: T['item'];
|
|
124
|
+
};
|
|
125
|
+
fetcherInput: {
|
|
126
|
+
itemId: string;
|
|
127
|
+
};
|
|
128
|
+
body: {
|
|
129
|
+
itemId: string;
|
|
130
|
+
};
|
|
131
|
+
actionInput: {
|
|
132
|
+
id: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* API Schema
|
|
137
|
+
*/
|
|
138
|
+
export type CartSchema<T extends CartTypes = CartTypes> = {
|
|
139
|
+
endpoint: {
|
|
140
|
+
options: {};
|
|
141
|
+
handlers: CartHandlers<T>;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export type CartHandlers<T extends CartTypes = CartTypes> = {
|
|
145
|
+
getCart: GetCartHandler<T>;
|
|
146
|
+
addItem: AddItemHandler<T>;
|
|
147
|
+
updateItem: UpdateItemHandler<T>;
|
|
148
|
+
removeItem: RemoveItemHandler<T>;
|
|
149
|
+
};
|
|
150
|
+
export type GetCartHandler<T extends CartTypes = CartTypes> = GetCartHook<T> & {
|
|
151
|
+
body: {
|
|
152
|
+
cartId?: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHook<T> & {
|
|
156
|
+
body: {
|
|
157
|
+
cartId: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
|
|
161
|
+
data: T['cart'];
|
|
162
|
+
body: {
|
|
163
|
+
cartId: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
export type RemoveItemHandler<T extends CartTypes = CartTypes> = RemoveItemHook<T> & {
|
|
167
|
+
body: {
|
|
168
|
+
cartId: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export type RemoveCartLineInput = {
|
|
172
|
+
cartId: string;
|
|
173
|
+
lineId: string;
|
|
174
|
+
};
|
|
175
|
+
export type UpdateCartLineInput = {
|
|
176
|
+
cartId: string;
|
|
177
|
+
line: CartItemBody & {
|
|
178
|
+
id: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
export type AddCartLineInput = {
|
|
182
|
+
cartId: string;
|
|
183
|
+
lines: CartItemBody[];
|
|
184
|
+
};
|
|
185
|
+
export type CreateCartInput = {
|
|
186
|
+
items: CartItemBody[];
|
|
187
|
+
};
|
|
188
|
+
export type GetCartParams = {
|
|
189
|
+
cartId: string;
|
|
190
|
+
};
|
|
191
|
+
export type CartNoteUpdateInput = {
|
|
192
|
+
cartId: string;
|
|
193
|
+
note?: string;
|
|
194
|
+
};
|
|
195
|
+
export type CartDiscountCodesUpdateInput = {
|
|
196
|
+
cartId: string;
|
|
197
|
+
discountCodes?: string[];
|
|
198
|
+
};
|
|
199
|
+
export type GetCartFunc = (variables: GetCartParams) => Promise<Cart | undefined>;
|
|
200
|
+
export type CreateCartFunc = (variables: CreateCartInput) => Promise<Cart>;
|
|
201
|
+
export type UpdateCartLineFunc = (variables: UpdateCartLineInput) => Promise<Cart>;
|
|
202
|
+
export type RemoveCartLineFunc = (variables: RemoveCartLineInput) => Promise<Cart>;
|
|
203
|
+
export type AddCartLineFunc = (variables: AddCartLineInput) => Promise<Cart>;
|
|
204
|
+
export type CartNoteUpdateFunc = (variables: CartNoteUpdateInput) => Promise<Cart>;
|
|
205
|
+
export type CartDiscountCodesUpdateFunc = (variables: CartDiscountCodesUpdateInput) => Promise<Cart>;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import type { Address, AddressFields } from './customer/address';
|
|
2
|
-
import type { Card, CardFields } from './customer/card';
|
|
3
|
-
export type Checkout = any;
|
|
4
|
-
export type CheckoutTypes = {
|
|
5
|
-
card?: Card | CardFields;
|
|
6
|
-
address?: Address | AddressFields;
|
|
7
|
-
checkout?: Checkout;
|
|
8
|
-
hasPayment?: boolean;
|
|
9
|
-
hasShipping?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export type SubmitCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
12
|
-
data: T;
|
|
13
|
-
input?: T;
|
|
14
|
-
fetcherInput: T;
|
|
15
|
-
body: {
|
|
16
|
-
item: T;
|
|
17
|
-
};
|
|
18
|
-
actionInput: T;
|
|
19
|
-
};
|
|
20
|
-
export type GetCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
21
|
-
data: T['checkout'] | null;
|
|
22
|
-
input: {};
|
|
23
|
-
fetcherInput: {
|
|
24
|
-
cartId?: string;
|
|
25
|
-
};
|
|
26
|
-
swrState: {
|
|
27
|
-
isEmpty: boolean;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export type CheckoutHooks<T extends CheckoutTypes = CheckoutTypes> = {
|
|
31
|
-
submitCheckout?: SubmitCheckoutHook<T>;
|
|
32
|
-
getCheckout: GetCheckoutHook<T>;
|
|
33
|
-
};
|
|
34
|
-
export type GetCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = GetCheckoutHook<T> & {
|
|
35
|
-
body: {
|
|
36
|
-
cartId: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type SubmitCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = SubmitCheckoutHook<T> & {
|
|
40
|
-
body: {
|
|
41
|
-
cartId: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export type CheckoutHandlers<T extends CheckoutTypes = CheckoutTypes> = {
|
|
45
|
-
getCheckout: GetCheckoutHandler<T>;
|
|
46
|
-
submitCheckout?: SubmitCheckoutHandler<T>;
|
|
47
|
-
};
|
|
48
|
-
export type CheckoutSchema<T extends CheckoutTypes = CheckoutTypes> = {
|
|
49
|
-
endpoint: {
|
|
50
|
-
options: {};
|
|
51
|
-
handlers: CheckoutHandlers<T>;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
1
|
+
import type { Address, AddressFields } from './customer/address';
|
|
2
|
+
import type { Card, CardFields } from './customer/card';
|
|
3
|
+
export type Checkout = any;
|
|
4
|
+
export type CheckoutTypes = {
|
|
5
|
+
card?: Card | CardFields;
|
|
6
|
+
address?: Address | AddressFields;
|
|
7
|
+
checkout?: Checkout;
|
|
8
|
+
hasPayment?: boolean;
|
|
9
|
+
hasShipping?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type SubmitCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
12
|
+
data: T;
|
|
13
|
+
input?: T;
|
|
14
|
+
fetcherInput: T;
|
|
15
|
+
body: {
|
|
16
|
+
item: T;
|
|
17
|
+
};
|
|
18
|
+
actionInput: T;
|
|
19
|
+
};
|
|
20
|
+
export type GetCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
|
|
21
|
+
data: T['checkout'] | null;
|
|
22
|
+
input: {};
|
|
23
|
+
fetcherInput: {
|
|
24
|
+
cartId?: string;
|
|
25
|
+
};
|
|
26
|
+
swrState: {
|
|
27
|
+
isEmpty: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type CheckoutHooks<T extends CheckoutTypes = CheckoutTypes> = {
|
|
31
|
+
submitCheckout?: SubmitCheckoutHook<T>;
|
|
32
|
+
getCheckout: GetCheckoutHook<T>;
|
|
33
|
+
};
|
|
34
|
+
export type GetCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = GetCheckoutHook<T> & {
|
|
35
|
+
body: {
|
|
36
|
+
cartId: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type SubmitCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = SubmitCheckoutHook<T> & {
|
|
40
|
+
body: {
|
|
41
|
+
cartId: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export type CheckoutHandlers<T extends CheckoutTypes = CheckoutTypes> = {
|
|
45
|
+
getCheckout: GetCheckoutHandler<T>;
|
|
46
|
+
submitCheckout?: SubmitCheckoutHandler<T>;
|
|
47
|
+
};
|
|
48
|
+
export type CheckoutSchema<T extends CheckoutTypes = CheckoutTypes> = {
|
|
49
|
+
endpoint: {
|
|
50
|
+
options: {};
|
|
51
|
+
handlers: CheckoutHandlers<T>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type Discount = {
|
|
2
|
-
value?: number;
|
|
3
|
-
code: string;
|
|
4
|
-
applicable?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export type Measurement = {
|
|
7
|
-
value: number;
|
|
8
|
-
unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
9
|
-
};
|
|
10
|
-
export type Image = {
|
|
11
|
-
url: string;
|
|
12
|
-
altText?: string;
|
|
13
|
-
width?: number;
|
|
14
|
-
height?: number;
|
|
15
|
-
};
|
|
1
|
+
export type Discount = {
|
|
2
|
+
value?: number;
|
|
3
|
+
code: string;
|
|
4
|
+
applicable?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type Measurement = {
|
|
7
|
+
value: number;
|
|
8
|
+
unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
9
|
+
};
|
|
10
|
+
export type Image = {
|
|
11
|
+
url: string;
|
|
12
|
+
altText?: string;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
};
|