import { useReducer } from 'react'
interface FormState {
values: Record<string, any>
errors: Record<string, string>
touched: Record<string, boolean>
export const initialCart = { items: {} };
export function cartReducer(state, action) {
switch (action.type) {
case 'ADD_ITEM': {
const { product, qty = 1 } = action;
export const MAX_VISIBLE = 4;
const DEFAULTS = {
variant: "info",
duration: 4000,
};
export interface Todo {
id: string;
title: string;
done: boolean;
pending: boolean;
}
export interface CartItem {
sku: string;
name: string;
unitPrice: number; // cents
qty: number;
}
export const initialState = (steps, initialData = {}) => ({
steps,
stepIndex: 0,
data: initialData,
errors: {},
});
export interface Todo {
id: string;
title: string;
done: boolean;
}
import React from 'react';
export function UndoSnackbar({ pending, onUndo }) {
if (!pending) return null;
return (
export interface CartItem {
id: string;
name: string;
price: number;
quantity: number;
}