Floralé manages all client-side shopping cart state through a Zustand store defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dlampatricio/florale/llms.txt
Use this file to discover all available pages before exploring further.
lib/cart-store.ts. The store tracks which items have been added, exposes drawer open/close controls, and is automatically persisted to localStorage so customers don’t lose their cart between page visits. A companion store in lib/toast-store.ts handles ephemeral notification messages that auto-dismiss after 2.5 seconds.
Both
useCartStore and useToastStore are client-only hooks. Any component
that calls them must include the 'use client' directive at the top of the
file. Do not call these hooks inside Server Components or Route Handlers.useCartStore
The primary store for cart management. Created with zustand/middleware’s persist wrapper so that cart items survive full-page navigations and browser refreshes.
Persistence
| Setting | Value |
|---|---|
| Storage key | florale-cart |
| Storage medium | localStorage |
| Persisted fields | items only |
| Not persisted | isDrawerOpen (always resets to false on load) |
CartItem (store-internal interface)
The CartItem used inside the store is different from the CartItem exported by types/index.ts. The store version includes an extra note field for personalisation messages.
The
CartItem in types/index.ts does not have a note field. The
extended interface is exported directly from lib/cart-store.ts for use in
components that need to display or edit the note.State fields
The current contents of the cart. Each entry holds a
productId, a
quantity, and a note. Persisted to localStorage.Whether the cart slide-over drawer is currently visible. Defaults to
false
on every page load (not persisted).Actions
addItem
Adds a product to the cart. If the product is already present its quantity is incremented; otherwise a new CartItem is inserted with an empty note.
The UUID of the product to add.
The number of units to add. Defaults to
1. When the item already exists
in the cart, this value is added to the existing quantity rather than
replacing it.removeItem
Removes a product from the cart entirely, regardless of quantity.
The UUID of the product to remove. If the ID is not found in the cart the
call is a no-op.
updateQuantity
Sets the quantity of a cart item to an explicit value. If the new quantity is 0 or negative the item is automatically removed from the cart.
The UUID of the product whose quantity should be updated.
The new quantity. Passing
0 or any negative number removes the item from
the cart entirely.updateNote
Attaches or replaces the personalisation note on an existing cart item. Useful for gift messages or special instructions.
The UUID of the product whose note should be updated.
The new note text. Pass an empty string to clear the note. If the product is
not in the cart the call is a no-op.
clearCart
Removes all items from the cart at once. Drawer state is unaffected.
openDrawer / closeDrawer / toggleDrawer
Controls for the cart slide-over drawer. These only affect the isDrawerOpen flag — they do not modify cart items.
Common patterns
useToastStore
A lightweight Zustand store for ephemeral notification banners. Toasts are automatically removed after 2 500 ms — no manual cleanup needed in the vast majority of cases.
State fields
The list of currently visible toast notifications. Each entry has an
id
(a crypto.randomUUID() string) and a message string.addToast
Adds a new toast and schedules its automatic removal after 2 500 ms.
The text to display inside the toast notification. Emojis are encouraged 🌸.
removeToast
Manually removes a toast before its automatic timeout fires. Useful for dismissible toasts with a close button.
The
id of the toast to remove. IDs are generated internally by
crypto.randomUUID() when addToast is called.