@shophost/react 2.0.52 → 2.0.53
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-client.cjs +1 -1
- package/admin-client.js +1827 -1745
- package/package.json +3 -3
- package/react.css +1 -1
- package/storefront/components/modifiers/modifier-dialog-container.d.ts +4 -0
- package/storefront/components/modifiers/modifiers-dialog.d.ts +4 -0
- package/storefront/components/modifiers/quantity-control.d.ts +4 -0
- package/storefront/components/pages/account-pages/shared.d.ts +2 -2
- package/storefront/providers/cart-provider.d.ts +2 -2
- package/storefront/providers/modifiers-provider.d.ts +3 -0
- package/storefront/translations/en.d.ts +1 -0
- package/storefront/translations/pl.d.ts +1 -0
- package/storefront/types/cart.types.d.ts +16 -2
|
@@ -13,9 +13,13 @@ export interface ModifierContainerProps {
|
|
|
13
13
|
quantity: number;
|
|
14
14
|
onIncrement: () => void;
|
|
15
15
|
onDecrement: () => void;
|
|
16
|
+
onQuantityInput: (value: string) => void;
|
|
16
17
|
isDecrementDisabled: boolean;
|
|
17
18
|
isIncrementDisabled: boolean;
|
|
19
|
+
isSubmitting: boolean;
|
|
18
20
|
isOutOfStock: boolean;
|
|
21
|
+
maxQuantity: number | null;
|
|
22
|
+
stockMessage: string | null;
|
|
19
23
|
onAddToCart: () => Promise<void>;
|
|
20
24
|
validationError: string | null;
|
|
21
25
|
}) => React.ReactNode;
|
|
@@ -9,11 +9,15 @@ export interface ModifiersDialogOptionRenderProps {
|
|
|
9
9
|
export interface ModifiersDialogFooterRenderProps {
|
|
10
10
|
isDecrementDisabled: boolean;
|
|
11
11
|
isIncrementDisabled: boolean;
|
|
12
|
+
isSubmitting: boolean;
|
|
12
13
|
isOutOfStock: boolean;
|
|
14
|
+
maxQuantity: number | null;
|
|
13
15
|
onAddToCart: () => Promise<void>;
|
|
14
16
|
onDecrement: () => void;
|
|
15
17
|
onIncrement: () => void;
|
|
18
|
+
onQuantityInput: (value: string) => void;
|
|
16
19
|
quantity: number;
|
|
20
|
+
stockMessage: string | null;
|
|
17
21
|
validationError: string | null;
|
|
18
22
|
}
|
|
19
23
|
export interface ModifiersDialogProps {
|
|
@@ -16,6 +16,10 @@ export interface QuantityControlProps {
|
|
|
16
16
|
* Function to decrement quantity
|
|
17
17
|
*/
|
|
18
18
|
onDecrement: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Function to set quantity from a typed input
|
|
21
|
+
*/
|
|
22
|
+
onQuantityInput: (value: string) => void;
|
|
19
23
|
/**
|
|
20
24
|
* Whether decrement button should be disabled
|
|
21
25
|
*/
|
|
@@ -3,9 +3,9 @@ import { LucideIcon } from 'lucide-react';
|
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
type Tone = "danger" | "info" | "neutral" | "success" | "warning";
|
|
5
5
|
declare const formatAccountDate: (value: Date | string | null | undefined, fallback?: string, pattern?: string) => string;
|
|
6
|
-
declare const formatOrderStatus: (status?: Order["status"]) => "
|
|
6
|
+
declare const formatOrderStatus: (status?: Order["status"]) => "Pending" | "Cancelled" | "Accepted" | "Preparing" | "On the way" | "Completed";
|
|
7
7
|
declare const getOrderTone: (status?: Order["status"]) => Tone;
|
|
8
|
-
declare const getReservationStatus: (reservation: Reservation) => "
|
|
8
|
+
declare const getReservationStatus: (reservation: Reservation) => "Pending" | "Confirmed" | "Cancelled";
|
|
9
9
|
declare const getReservationTone: (reservation: Reservation) => Tone;
|
|
10
10
|
declare const getInitials: (name?: string | null) => string;
|
|
11
11
|
interface AccountPageShellProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CartItem, Locale, LocalizedProduct, Product, ShippingMethod } from '../../../../client/src/index.ts';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import { AddToCartInput, AddToCartResult, CartContextType, RemoveCartItemInput, UpdateCartItemInput } from '../types/cart.types';
|
|
3
|
+
import { AddToCartInput, AddToCartResult, CartContextType, CartSyncResult, RemoveCartItemInput, UpdateCartItemInput } from '../types/cart.types';
|
|
4
4
|
interface CartProviderProps {
|
|
5
5
|
organizationId: string;
|
|
6
6
|
children: React.ReactNode;
|
|
@@ -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) => Promise<
|
|
18
|
+
update: ({ productId, quantity, modifierGroups }: UpdateCartItemInput) => Promise<CartSyncResult>;
|
|
19
19
|
remove: ({ productId, modifierGroups }: RemoveCartItemInput) => void;
|
|
20
20
|
addProductToCart: (product: Product | LocalizedProduct) => Promise<AddToCartResult>;
|
|
21
21
|
clearCart: () => void;
|
|
@@ -9,9 +9,12 @@ interface ModifiersContextType {
|
|
|
9
9
|
quantity: number;
|
|
10
10
|
handleIncrement: () => void;
|
|
11
11
|
handleDecrement: () => void;
|
|
12
|
+
handleQuantityInput: (value: string) => void;
|
|
12
13
|
isIncrementDisabled: boolean;
|
|
14
|
+
isSubmitting: boolean;
|
|
13
15
|
isOutOfStock: boolean;
|
|
14
16
|
maxQuantity: number | null;
|
|
17
|
+
stockMessage: string | null;
|
|
15
18
|
handleAddToCart: () => Promise<void>;
|
|
16
19
|
validationError: string | null;
|
|
17
20
|
modifierGroups: any[];
|
|
@@ -31,6 +31,20 @@ export interface RemoveCartItemInput {
|
|
|
31
31
|
export interface AddToCartResult {
|
|
32
32
|
openedModifiers: boolean;
|
|
33
33
|
}
|
|
34
|
+
export interface CartSyncOptions {
|
|
35
|
+
showAdjustmentAlert?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface CartSyncResult {
|
|
38
|
+
adjustments: Array<{
|
|
39
|
+
modifierGroups?: CartItem["modifierGroups"];
|
|
40
|
+
productId: string;
|
|
41
|
+
reason: string;
|
|
42
|
+
requestedQuantity: number;
|
|
43
|
+
resolvedQuantity: number;
|
|
44
|
+
}>;
|
|
45
|
+
invalidProductIds: string[];
|
|
46
|
+
normalizedItems: CartItem[];
|
|
47
|
+
}
|
|
34
48
|
export interface CartContextType {
|
|
35
49
|
locale: string;
|
|
36
50
|
organizationId: string;
|
|
@@ -38,7 +52,7 @@ export interface CartContextType {
|
|
|
38
52
|
total: number;
|
|
39
53
|
shipping?: number;
|
|
40
54
|
subtotal: number;
|
|
41
|
-
addItem: (item: CartItem) => Promise<
|
|
55
|
+
addItem: (item: CartItem, options?: CartSyncOptions) => Promise<CartSyncResult>;
|
|
42
56
|
removeItem: (productId: string, modifierGroups?: {
|
|
43
57
|
id: string;
|
|
44
58
|
modifiers: {
|
|
@@ -52,7 +66,7 @@ export interface CartContextType {
|
|
|
52
66
|
id: string;
|
|
53
67
|
quantity?: number;
|
|
54
68
|
}[];
|
|
55
|
-
}[]) => Promise<
|
|
69
|
+
}[], options?: CartSyncOptions) => Promise<CartSyncResult>;
|
|
56
70
|
replaceItems: (items: CartItem[]) => void;
|
|
57
71
|
clearCart: () => void;
|
|
58
72
|
itemCount: number;
|