@shophost/react 2.0.50 → 2.0.52
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/admin/product/components/products-list/columns.d.ts +2 -2
- package/admin/settings/integrations/components/resend-integration-form.d.ts +1 -0
- package/admin-client.cjs +1 -1
- package/admin-client.js +1996 -1864
- package/package.json +3 -3
- package/react.css +1 -1
- package/storefront/components/cart/cart-drawer-item.d.ts +1 -0
- package/storefront/components/cart/cart-items.d.ts +1 -0
- package/storefront/components/modifiers/modifier-dialog-container.d.ts +3 -1
- package/storefront/components/modifiers/modifiers-dialog.d.ts +3 -1
- package/storefront/components/modifiers/quantity-control.d.ts +4 -0
- package/storefront/providers/cart-provider.d.ts +2 -1
- package/storefront/providers/modifiers-provider.d.ts +4 -1
- package/storefront/types/cart.types.d.ts +6 -2
|
@@ -14,7 +14,9 @@ export interface ModifierContainerProps {
|
|
|
14
14
|
onIncrement: () => void;
|
|
15
15
|
onDecrement: () => void;
|
|
16
16
|
isDecrementDisabled: boolean;
|
|
17
|
-
|
|
17
|
+
isIncrementDisabled: boolean;
|
|
18
|
+
isOutOfStock: boolean;
|
|
19
|
+
onAddToCart: () => Promise<void>;
|
|
18
20
|
validationError: string | null;
|
|
19
21
|
}) => React.ReactNode;
|
|
20
22
|
}
|
|
@@ -8,7 +8,9 @@ export interface ModifiersDialogOptionRenderProps {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ModifiersDialogFooterRenderProps {
|
|
10
10
|
isDecrementDisabled: boolean;
|
|
11
|
-
|
|
11
|
+
isIncrementDisabled: boolean;
|
|
12
|
+
isOutOfStock: boolean;
|
|
13
|
+
onAddToCart: () => Promise<void>;
|
|
12
14
|
onDecrement: () => void;
|
|
13
15
|
onIncrement: () => void;
|
|
14
16
|
quantity: number;
|
|
@@ -20,6 +20,10 @@ export interface QuantityControlProps {
|
|
|
20
20
|
* Whether decrement button should be disabled
|
|
21
21
|
*/
|
|
22
22
|
isDecrementDisabled: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether increment button should be disabled
|
|
25
|
+
*/
|
|
26
|
+
isIncrementDisabled: boolean;
|
|
23
27
|
}) => React.ReactNode;
|
|
24
28
|
/**
|
|
25
29
|
* Minimum quantity (default: 1)
|
|
@@ -15,7 +15,7 @@ export declare const useCart: () => {
|
|
|
15
15
|
loading: boolean;
|
|
16
16
|
formattedCartItems: import('../types/cart.types').FormattedCartItem[];
|
|
17
17
|
add: ({ productId, quantity, modifierGroups, product, onAdded, }: AddToCartInput) => Promise<AddToCartResult>;
|
|
18
|
-
update: ({ productId, quantity, modifierGroups }: UpdateCartItemInput) => void
|
|
18
|
+
update: ({ productId, quantity, modifierGroups }: UpdateCartItemInput) => Promise<void>;
|
|
19
19
|
remove: ({ productId, modifierGroups }: RemoveCartItemInput) => void;
|
|
20
20
|
addProductToCart: (product: Product | LocalizedProduct) => Promise<AddToCartResult>;
|
|
21
21
|
clearCart: () => void;
|
|
@@ -37,6 +37,7 @@ export declare const useCart: () => {
|
|
|
37
37
|
} | null>>;
|
|
38
38
|
shippingMethod: ShippingMethod | null;
|
|
39
39
|
setShippingMethod: React.Dispatch<React.SetStateAction<ShippingMethod | null>>;
|
|
40
|
+
replaceItems: (items: CartItem[]) => void;
|
|
40
41
|
};
|
|
41
42
|
export declare const useCartContext: () => CartContextType;
|
|
42
43
|
export {};
|
|
@@ -9,7 +9,10 @@ interface ModifiersContextType {
|
|
|
9
9
|
quantity: number;
|
|
10
10
|
handleIncrement: () => void;
|
|
11
11
|
handleDecrement: () => void;
|
|
12
|
-
|
|
12
|
+
isIncrementDisabled: boolean;
|
|
13
|
+
isOutOfStock: boolean;
|
|
14
|
+
maxQuantity: number | null;
|
|
15
|
+
handleAddToCart: () => Promise<void>;
|
|
13
16
|
validationError: string | null;
|
|
14
17
|
modifierGroups: any[];
|
|
15
18
|
isModifierSelected: (groupId: string, modifierId: string) => boolean;
|
|
@@ -38,7 +38,7 @@ export interface CartContextType {
|
|
|
38
38
|
total: number;
|
|
39
39
|
shipping?: number;
|
|
40
40
|
subtotal: number;
|
|
41
|
-
addItem: (item: CartItem) => void
|
|
41
|
+
addItem: (item: CartItem) => Promise<void>;
|
|
42
42
|
removeItem: (productId: string, modifierGroups?: {
|
|
43
43
|
id: string;
|
|
44
44
|
modifiers: {
|
|
@@ -52,7 +52,8 @@ export interface CartContextType {
|
|
|
52
52
|
id: string;
|
|
53
53
|
quantity?: number;
|
|
54
54
|
}[];
|
|
55
|
-
}[]) => void
|
|
55
|
+
}[]) => Promise<void>;
|
|
56
|
+
replaceItems: (items: CartItem[]) => void;
|
|
56
57
|
clearCart: () => void;
|
|
57
58
|
itemCount: number;
|
|
58
59
|
totalAmount: number;
|
|
@@ -86,6 +87,9 @@ export interface FormattedCartItem {
|
|
|
86
87
|
export type CartAction = {
|
|
87
88
|
type: "INITIALIZE_CART";
|
|
88
89
|
payload: CartItem[];
|
|
90
|
+
} | {
|
|
91
|
+
type: "REPLACE_ITEMS";
|
|
92
|
+
payload: CartItem[];
|
|
89
93
|
} | {
|
|
90
94
|
type: "SET_INITIALIZED";
|
|
91
95
|
payload: boolean;
|