@zorgo/next 1.1.0 → 1.1.1

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.
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { MenuItem, Category, OrderItem, Location } from '@zorgo/universal/interfaces';
3
2
 
4
3
  declare function CookieConsent(): react_jsx_runtime.JSX.Element | null;
5
4
 
@@ -32,6 +31,158 @@ declare function Breadcrumbs({ items, itemClasses, }: {
32
31
  itemClasses?: BreadcrumbsItemClasses;
33
32
  }): react_jsx_runtime.JSX.Element;
34
33
 
34
+ type LocationStatus = "active" | "permanently_closed";
35
+ interface Location {
36
+ location_id: number;
37
+ franchise_id: number;
38
+ name: string;
39
+ address?: string;
40
+ force_close?: boolean;
41
+ status?: LocationStatus | null;
42
+ lat?: number | null;
43
+ lng?: number | null;
44
+ stripe_account_id?: string;
45
+ stripe_location_id?: string;
46
+ monday_open?: string;
47
+ monday_close?: string;
48
+ tuesday_open?: string;
49
+ tuesday_close?: string;
50
+ wednesday_open?: string;
51
+ wednesday_close?: string;
52
+ thursday_open?: string;
53
+ thursday_close?: string;
54
+ friday_open?: string;
55
+ friday_close?: string;
56
+ saturday_open?: string;
57
+ saturday_close?: string;
58
+ sunday_open?: string;
59
+ sunday_close?: string;
60
+ }
61
+ interface Category {
62
+ category_id: number;
63
+ name: string;
64
+ is_catering?: boolean;
65
+ rules: Rule[];
66
+ active_promo_id?: number;
67
+ }
68
+ interface ItemVariant {
69
+ item_id: number;
70
+ name: string;
71
+ price: number;
72
+ components?: Component[];
73
+ base_item_id?: number;
74
+ rules?: Rule[];
75
+ display_price?: number;
76
+ active_promo_id?: number;
77
+ }
78
+ interface MenuItem {
79
+ base_item_id: number;
80
+ category_id: number;
81
+ franchise_id: number;
82
+ name: string;
83
+ per_person?: boolean | null;
84
+ image_path?: string | null;
85
+ variants: ItemVariant[];
86
+ rules: Rule[];
87
+ description?: string | null;
88
+ active_promo_id?: number;
89
+ is_catering?: boolean;
90
+ }
91
+ interface ScalingBehavior {
92
+ headcount_threshold: number;
93
+ starting_amount: number;
94
+ step_interval: number;
95
+ step_size: number;
96
+ maximum: number | null;
97
+ }
98
+ interface Component {
99
+ id: number;
100
+ servings_per_item?: number;
101
+ is_base?: boolean;
102
+ price_per_serving?: number;
103
+ franchise_id?: number;
104
+ component_type_id: number;
105
+ serving_weight?: number;
106
+ name: string;
107
+ item_id?: number;
108
+ prep_ahead?: boolean;
109
+ measurement_type?: "weight" | "count";
110
+ display_unit?: string;
111
+ behavior?: ScalingBehavior;
112
+ }
113
+ interface Rule {
114
+ rule_id?: number;
115
+ item_id?: number;
116
+ base_item_id?: number;
117
+ category_id?: number;
118
+ group_name: string;
119
+ min_selection: number;
120
+ max_selection?: number;
121
+ included_quantity: number;
122
+ items?: RuleItem[];
123
+ components?: RuleComponent[];
124
+ }
125
+ interface RuleItem {
126
+ item_id: number;
127
+ name: string;
128
+ quantity: number;
129
+ upcharge_price: number;
130
+ description?: string | null;
131
+ behavior?: ScalingBehavior;
132
+ }
133
+ interface RuleComponent {
134
+ component_id: number;
135
+ name: string;
136
+ quantity: number;
137
+ upcharge_price: number;
138
+ description?: string | null;
139
+ behavior?: ScalingBehavior;
140
+ serving_weight?: number;
141
+ }
142
+ interface OrderItem {
143
+ item_id: number;
144
+ base_item_id: number;
145
+ name: string;
146
+ quantity: number;
147
+ price: number;
148
+ display_price?: number;
149
+ order_item_id?: number;
150
+ category_id: number;
151
+ category_name?: string;
152
+ is_catering?: boolean;
153
+ /** When true, each unit counts toward catering headcount minimums (menu `per_person`). */
154
+ per_person?: boolean | null;
155
+ components?: OrderComponent[];
156
+ selections?: RuleSelection[];
157
+ comments?: string;
158
+ status?: "removed" | "modified";
159
+ applied_promo_id?: number;
160
+ discount_amount?: number;
161
+ }
162
+ interface OrderComponent extends Component {
163
+ quantity_servings: number;
164
+ upcharge?: number;
165
+ rule_id?: number;
166
+ }
167
+ interface RuleSelection {
168
+ rule_id: number;
169
+ group_name?: string;
170
+ selections: Selection[];
171
+ }
172
+ interface Selection {
173
+ type: "item" | "component";
174
+ id: number;
175
+ quantity: number;
176
+ upcharge: number;
177
+ serving_price?: number;
178
+ name: string;
179
+ status?: "removed" | "modified" | "added";
180
+ component_type_id?: number;
181
+ serving_weight?: number;
182
+ measurement_type?: "weight" | "count";
183
+ display_unit?: string;
184
+ }
185
+
35
186
  /** Per-slot Tailwind classes for the grid menu layout. */
36
187
  type GridMenuItemClasses = Partial<{
37
188
  baseContainer: string;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,242 @@
1
- export * from '@zorgo/universal/hooks/hooks';
2
- export * from '@zorgo/universal/components/Form';
1
+ import * as _stripe_stripe_js from '@stripe/stripe-js';
2
+ import { StripeElementsOptions } from '@stripe/stripe-js';
3
+ import * as react from 'react';
4
+ import { ModalInstance } from '../store';
5
+ import { Menu as Menu$1 } from '../utils/menuUtils';
6
+ import { OrderItem as OrderItem$1, Customer as Customer$1, Promotion as Promotion$1, Order as Order$1, MenuItem as MenuItem$1, ItemVariant as ItemVariant$1, CustomizationRule as CustomizationRule$1, Location as Location$1, Category as Category$1, RecommendationResult as RecommendationResult$1, RecommendationStrategy as RecommendationStrategy$1, RecommendationRequest as RecommendationRequest$1 } from '../interfaces';
7
+ export { Platforms } from '../interfaces';
8
+ export { default as DynamicFormShell } from './Form';
9
+ export { default as SubmitButton } from './components/SubmitButton';
10
+ export { default as FieldError } from './components/FieldError';
11
+ export { default as Header } from './components/Header';
12
+ export { default as PricePreview } from './components/PricePreview';
13
+ export { default as SectionLabel } from './components/SectionLabel';
14
+ export { default as DisclaimerText } from './components/DisclaimerText';
15
+ export { default as ConditionalRenderer } from './composites/ConditionalRenderer';
16
+ export { default as TextField } from './fields/TextField';
17
+ export { default as PhoneField } from './fields/PhoneField';
18
+ export { default as EmailField } from './fields/EmailField';
19
+ export { default as ClickableField } from './fields/ClickableField';
20
+ export { default as LocationField } from './fields/Location';
21
+ export { default as TimeField } from './fields/TimeField';
22
+ export { default as DateField } from './fields/DateField';
23
+ export { default as DiscreteNumberField } from './fields/DiscreteNumberField';
24
+ export { default as SliderField } from './fields/SliderField';
25
+ export { default as CheckboxField } from './fields/CheckboxField';
26
+ export { default as FieldLabel } from './fields/FieldLabel';
27
+ export { default as IncrementField } from './fields/Increment';
28
+ export { default as NameFields } from './composites/NameFields';
29
+ export { default as DateTime } from './composites/DateTime';
30
+ export { default as DateTimeRange } from './composites/DateTimeRange';
31
+ export { default as GuestCountField } from './composites/GuestCountField';
32
+ export { TimeConstraints } from './timeConstraints';
33
+ export { default as useRegisterField } from './hooks/useRegisterField';
34
+ export { default as useField } from './hooks/useField';
35
+ export { default as useFormStatus } from './hooks/useFormStatus';
36
+ export { default as useFormValues } from './hooks/useFormValues';
37
+ export { default as useFormValidity } from './hooks/useFormValidity';
38
+
39
+ declare function setZorgoBoot(fn: () => Promise<void>): void;
40
+ declare function setZorgoPathnameHook(fn: () => string): void;
41
+ /**
42
+ * Modal stack control + usage. Consumers call `open(type, props)` to push a
43
+ * modal; the app's ModalHost renders whatever's on top via its registry map.
44
+ * `type` is a plain string keyed to that registry — no coupling here.
45
+ *
46
+ * @example
47
+ * const { open } = useModal();
48
+ * open("ITEM_MODAL", { itemId });
49
+ */
50
+ declare function useModal(): {
51
+ current: ModalInstance | null;
52
+ isOpen: boolean;
53
+ depth: number;
54
+ open: (type: string, props?: unknown, displayStyle?: ModalInstance["displayStyle"]) => void;
55
+ close: () => void;
56
+ back: () => void;
57
+ setWorkingData: (data: any, index?: number) => void;
58
+ getWorkingData: (index?: number) => any;
59
+ };
60
+ declare function useCart(): {
61
+ items: OrderItem$1[];
62
+ itemCount: number;
63
+ isEmpty: boolean;
64
+ customer: Customer$1;
65
+ promoCode: string | undefined;
66
+ tip: number | undefined;
67
+ subtotal: number;
68
+ discount: number;
69
+ tax: number;
70
+ serviceFee: number;
71
+ total: number;
72
+ addItem: (item: OrderItem$1, promoOverride?: Promotion$1 | null) => void;
73
+ removeItem: (index: number) => void;
74
+ updateItem: (item: OrderItem$1, index: number, promoOverride?: Promotion$1 | null) => void;
75
+ resetCart: () => void;
76
+ setCustomer: (customer: Customer$1) => void;
77
+ setLocationId: (location_id: number) => void;
78
+ setOrderType: (type_id: number) => void;
79
+ setTimeRequested: (t: string) => void;
80
+ setTip: (tip: number) => void;
81
+ getItemTotal: (item: OrderItem$1) => number;
82
+ getOrder: () => Order$1;
83
+ resolveShortUrl: (slug: string) => Promise<boolean>;
84
+ };
85
+ declare function useLocation(options?: {
86
+ promptLocationSelection?: boolean;
87
+ }): {
88
+ availableLocations: Location$1[];
89
+ currentLocation: Location$1 | null;
90
+ setLocation: (location: Location$1) => void;
91
+ getIsCurrentLocationOpen: () => boolean;
92
+ needsLocationSelection: boolean;
93
+ };
94
+ /**
95
+ * Reactive menu data for the configured franchise.
96
+ *
97
+ * `items` excludes catering categories; use `allItems`,
98
+ * `cateringPrimaryItem`, or `cateringAddOns` when building catering flows.
99
+ *
100
+ * @example
101
+ * const { items, categories } = useMenu();
102
+ */
103
+ declare function useMenu(): {
104
+ items: MenuItem$1[];
105
+ allItems: MenuItem$1[];
106
+ categories: Category$1[];
107
+ getItemImageUrl: (imagePath?: string | null) => string | null;
108
+ };
109
+ /**
110
+ * Seeds a store with prebuilt data (see the app's prebuild script) during the
111
+ * first render, so the first client paint already shows content instead of empty
112
+ * state. Boot then refreshes the store from Supabase.
113
+ *
114
+ * Only seeds when the store is still empty (`isEmpty`), so client-side navigation
115
+ * never clobbers freshly fetched data with the stale build-time snapshot.
116
+ *
117
+ * Note: this only helps the client's first paint — zustand serves
118
+ * getInitialState() during SSR, so the seed never reaches server HTML. Pages that
119
+ * need SSR content must read the prebuilt data directly (see app/menu/page.tsx).
120
+ *
121
+ * @example
122
+ * useHydrateStore(MenuStore, menu, (s) => s.hydrate, (s) => !s.items?.length);
123
+ */
124
+ declare function useHydrateStore<S, D>(store: {
125
+ getState: () => S;
126
+ }, seed: D, getHydrate: (state: S) => (data: D) => void, isEmpty: (state: S) => boolean): void;
127
+ /** MenuStore-specific wrapper. `items` may be nullish before persist rehydrates. */
128
+ declare function useHydrateMenu(menu: Menu$1): void;
129
+ /**
130
+ * Drives the item customization flow for a single menu item: variant choice,
131
+ * rule selections, component servings, quantity, and comments. Produces a
132
+ * live `draft` OrderItem and a `submit` that adds or updates the cart.
133
+ *
134
+ * @param baseItemId - `base_item_id` of the menu item being customized.
135
+ * @param seed - Existing OrderItem to pre-fill from, e.g. when editing a cart line.
136
+ * @param editIndex - Cart index to update on submit; omit to add a new item instead.
137
+ *
138
+ * @returns `item`/`variant`/`variants` for the item being built, `setVariant`
139
+ * to switch variants, `ruleGroups` for rendering rule UI (each option carries
140
+ * a `toggle`), `unmetRule`/`canSubmit` for validation state, `submit` to
141
+ * commit the draft to the cart, `quantity`/`setQuantity`, `comments`/`setComments`,
142
+ * `setComponentServings`, `price`/`salePrice`, `isEditMode`, and the raw `draft`.
143
+ *
144
+ * @example
145
+ * const { item, ruleGroups, canSubmit, submit } = useItemCustomization(baseItemId);
146
+ */
147
+ declare function useItemCustomization(baseItemId: number, seed?: OrderItem$1, editIndex?: number): {
148
+ item: MenuItem$1 | undefined;
149
+ variant: ItemVariant$1;
150
+ variants: ItemVariant$1[];
151
+ setVariant: (next: ItemVariant$1) => void;
152
+ ruleGroups: CustomizationRule$1[];
153
+ unmetRule: CustomizationRule$1 | null;
154
+ canSubmit: boolean;
155
+ submit: () => OrderItem$1 | null;
156
+ quantity: number;
157
+ setQuantity: react.Dispatch<react.SetStateAction<number>>;
158
+ comments: string;
159
+ setComments: react.Dispatch<react.SetStateAction<string>>;
160
+ setComponentServings: (componentId: number, qty: number) => void;
161
+ price: number;
162
+ salePrice: number | undefined;
163
+ isEditMode: boolean;
164
+ draft: OrderItem$1 | null;
165
+ };
166
+ declare function usePromotions(): {
167
+ promoCode: string;
168
+ setPromoCode: (code: string) => void;
169
+ appliedPromo: Promotion$1 | null;
170
+ discountAmount: number;
171
+ error: string | null;
172
+ loading: boolean;
173
+ applyPromo: (code: string) => Promise<void>;
174
+ removePromo: () => void;
175
+ activePromotions: Promotion$1[];
176
+ };
177
+ declare function usePayment(): {
178
+ clientSecret: string | null;
179
+ intentType: "payment_intent" | "setup_intent" | null;
180
+ stripe: _stripe_stripe_js.Stripe | undefined;
181
+ elementOptions: StripeElementsOptions | null;
182
+ total: number | null;
183
+ isLoading: boolean;
184
+ error: string | null;
185
+ isReady: boolean;
186
+ startCheckout: () => Promise<void>;
187
+ resetCheckout: () => void;
188
+ submitPayment: (stripe: unknown, elements: unknown, clientSecret: string, returnUrl: string, customer: Customer$1) => Promise<{
189
+ success: boolean;
190
+ error?: string;
191
+ paymentIntentId?: string;
192
+ }>;
193
+ paymentElementOptions: {
194
+ layout: "accordion";
195
+ fields: {
196
+ billingDetails: {
197
+ name: "never";
198
+ email: "never";
199
+ phone: "never";
200
+ address: "auto";
201
+ };
202
+ };
203
+ };
204
+ getReturnStatus: (url: string | URL) => {
205
+ succeeded: boolean;
206
+ amount?: number;
207
+ paymentIntentId?: string;
208
+ error?: string;
209
+ };
210
+ getReturnUrl: () => string | undefined;
211
+ };
212
+ declare function useCateringConfig(): {
213
+ minimum_notice_hours: number | null | undefined;
214
+ minimum_people_required: number | null | undefined;
215
+ minimum_price: number | null | undefined;
216
+ does_cater: boolean | null | undefined;
217
+ does_deliver: boolean | null | undefined;
218
+ delivery_fee_cents: number | null | undefined;
219
+ max_delivery_radius_miles: number | null | undefined;
220
+ cents_per_mile: number | null | undefined;
221
+ };
222
+ declare function useRecommendations(): {
223
+ recommendations: RecommendationResult$1[];
224
+ isLoading: boolean;
225
+ error: string | null;
226
+ strategy: RecommendationStrategy$1;
227
+ lastFetchedAt: Date | null;
228
+ refresh: (request: RecommendationRequest$1) => Promise<void>;
229
+ setStrategy: (s: RecommendationStrategy$1) => void;
230
+ clear: () => void;
231
+ };
232
+ declare function useCustomer(): {
233
+ customer: Customer$1;
234
+ consentGiven: boolean;
235
+ setCustomer: (customer: Customer$1) => void;
236
+ consentAnswered: boolean;
237
+ setConsent: (granted: boolean) => void;
238
+ anonymousId: string | null;
239
+ };
3
240
 
4
241
  type LocationStatus = "active" | "permanently_closed";
5
242
  interface Location {
@@ -304,4 +541,4 @@ interface Menu {
304
541
  rules: Rule[];
305
542
  }
306
543
 
307
- export type { Category, Customer, CustomizationOption, CustomizationRule, ItemVariant, Location, Menu, MenuItem, Order, OrderComponent, OrderItem, Promotion, RecommendationRequest, RecommendationResult, RecommendationStrategy, Rule, RuleComponent, RuleItem, RuleSelection, Selection };
544
+ export { type Category, type Customer, type CustomizationOption, type CustomizationRule, type ItemVariant, type Location, type Menu, type MenuItem, type Order, type OrderComponent, type OrderItem, type Promotion, type RecommendationRequest, type RecommendationResult, type RecommendationStrategy, type Rule, type RuleComponent, type RuleItem, type RuleSelection, type Selection, setZorgoBoot, setZorgoPathnameHook, useCart, useCateringConfig, useCustomer, useHydrateMenu, useHydrateStore, useItemCustomization, useLocation, useMenu, useModal, usePayment, usePromotions, useRecommendations };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,242 @@
1
- export * from '@zorgo/universal/hooks/hooks';
2
- export * from '@zorgo/universal/components/Form';
1
+ import * as _stripe_stripe_js from '@stripe/stripe-js';
2
+ import { StripeElementsOptions } from '@stripe/stripe-js';
3
+ import * as react from 'react';
4
+ import { ModalInstance } from '../store';
5
+ import { Menu as Menu$1 } from '../utils/menuUtils';
6
+ import { OrderItem as OrderItem$1, Customer as Customer$1, Promotion as Promotion$1, Order as Order$1, MenuItem as MenuItem$1, ItemVariant as ItemVariant$1, CustomizationRule as CustomizationRule$1, Location as Location$1, Category as Category$1, RecommendationResult as RecommendationResult$1, RecommendationStrategy as RecommendationStrategy$1, RecommendationRequest as RecommendationRequest$1 } from '../interfaces';
7
+ export { Platforms } from '../interfaces';
8
+ export { default as DynamicFormShell } from './Form';
9
+ export { default as SubmitButton } from './components/SubmitButton';
10
+ export { default as FieldError } from './components/FieldError';
11
+ export { default as Header } from './components/Header';
12
+ export { default as PricePreview } from './components/PricePreview';
13
+ export { default as SectionLabel } from './components/SectionLabel';
14
+ export { default as DisclaimerText } from './components/DisclaimerText';
15
+ export { default as ConditionalRenderer } from './composites/ConditionalRenderer';
16
+ export { default as TextField } from './fields/TextField';
17
+ export { default as PhoneField } from './fields/PhoneField';
18
+ export { default as EmailField } from './fields/EmailField';
19
+ export { default as ClickableField } from './fields/ClickableField';
20
+ export { default as LocationField } from './fields/Location';
21
+ export { default as TimeField } from './fields/TimeField';
22
+ export { default as DateField } from './fields/DateField';
23
+ export { default as DiscreteNumberField } from './fields/DiscreteNumberField';
24
+ export { default as SliderField } from './fields/SliderField';
25
+ export { default as CheckboxField } from './fields/CheckboxField';
26
+ export { default as FieldLabel } from './fields/FieldLabel';
27
+ export { default as IncrementField } from './fields/Increment';
28
+ export { default as NameFields } from './composites/NameFields';
29
+ export { default as DateTime } from './composites/DateTime';
30
+ export { default as DateTimeRange } from './composites/DateTimeRange';
31
+ export { default as GuestCountField } from './composites/GuestCountField';
32
+ export { TimeConstraints } from './timeConstraints';
33
+ export { default as useRegisterField } from './hooks/useRegisterField';
34
+ export { default as useField } from './hooks/useField';
35
+ export { default as useFormStatus } from './hooks/useFormStatus';
36
+ export { default as useFormValues } from './hooks/useFormValues';
37
+ export { default as useFormValidity } from './hooks/useFormValidity';
38
+
39
+ declare function setZorgoBoot(fn: () => Promise<void>): void;
40
+ declare function setZorgoPathnameHook(fn: () => string): void;
41
+ /**
42
+ * Modal stack control + usage. Consumers call `open(type, props)` to push a
43
+ * modal; the app's ModalHost renders whatever's on top via its registry map.
44
+ * `type` is a plain string keyed to that registry — no coupling here.
45
+ *
46
+ * @example
47
+ * const { open } = useModal();
48
+ * open("ITEM_MODAL", { itemId });
49
+ */
50
+ declare function useModal(): {
51
+ current: ModalInstance | null;
52
+ isOpen: boolean;
53
+ depth: number;
54
+ open: (type: string, props?: unknown, displayStyle?: ModalInstance["displayStyle"]) => void;
55
+ close: () => void;
56
+ back: () => void;
57
+ setWorkingData: (data: any, index?: number) => void;
58
+ getWorkingData: (index?: number) => any;
59
+ };
60
+ declare function useCart(): {
61
+ items: OrderItem$1[];
62
+ itemCount: number;
63
+ isEmpty: boolean;
64
+ customer: Customer$1;
65
+ promoCode: string | undefined;
66
+ tip: number | undefined;
67
+ subtotal: number;
68
+ discount: number;
69
+ tax: number;
70
+ serviceFee: number;
71
+ total: number;
72
+ addItem: (item: OrderItem$1, promoOverride?: Promotion$1 | null) => void;
73
+ removeItem: (index: number) => void;
74
+ updateItem: (item: OrderItem$1, index: number, promoOverride?: Promotion$1 | null) => void;
75
+ resetCart: () => void;
76
+ setCustomer: (customer: Customer$1) => void;
77
+ setLocationId: (location_id: number) => void;
78
+ setOrderType: (type_id: number) => void;
79
+ setTimeRequested: (t: string) => void;
80
+ setTip: (tip: number) => void;
81
+ getItemTotal: (item: OrderItem$1) => number;
82
+ getOrder: () => Order$1;
83
+ resolveShortUrl: (slug: string) => Promise<boolean>;
84
+ };
85
+ declare function useLocation(options?: {
86
+ promptLocationSelection?: boolean;
87
+ }): {
88
+ availableLocations: Location$1[];
89
+ currentLocation: Location$1 | null;
90
+ setLocation: (location: Location$1) => void;
91
+ getIsCurrentLocationOpen: () => boolean;
92
+ needsLocationSelection: boolean;
93
+ };
94
+ /**
95
+ * Reactive menu data for the configured franchise.
96
+ *
97
+ * `items` excludes catering categories; use `allItems`,
98
+ * `cateringPrimaryItem`, or `cateringAddOns` when building catering flows.
99
+ *
100
+ * @example
101
+ * const { items, categories } = useMenu();
102
+ */
103
+ declare function useMenu(): {
104
+ items: MenuItem$1[];
105
+ allItems: MenuItem$1[];
106
+ categories: Category$1[];
107
+ getItemImageUrl: (imagePath?: string | null) => string | null;
108
+ };
109
+ /**
110
+ * Seeds a store with prebuilt data (see the app's prebuild script) during the
111
+ * first render, so the first client paint already shows content instead of empty
112
+ * state. Boot then refreshes the store from Supabase.
113
+ *
114
+ * Only seeds when the store is still empty (`isEmpty`), so client-side navigation
115
+ * never clobbers freshly fetched data with the stale build-time snapshot.
116
+ *
117
+ * Note: this only helps the client's first paint — zustand serves
118
+ * getInitialState() during SSR, so the seed never reaches server HTML. Pages that
119
+ * need SSR content must read the prebuilt data directly (see app/menu/page.tsx).
120
+ *
121
+ * @example
122
+ * useHydrateStore(MenuStore, menu, (s) => s.hydrate, (s) => !s.items?.length);
123
+ */
124
+ declare function useHydrateStore<S, D>(store: {
125
+ getState: () => S;
126
+ }, seed: D, getHydrate: (state: S) => (data: D) => void, isEmpty: (state: S) => boolean): void;
127
+ /** MenuStore-specific wrapper. `items` may be nullish before persist rehydrates. */
128
+ declare function useHydrateMenu(menu: Menu$1): void;
129
+ /**
130
+ * Drives the item customization flow for a single menu item: variant choice,
131
+ * rule selections, component servings, quantity, and comments. Produces a
132
+ * live `draft` OrderItem and a `submit` that adds or updates the cart.
133
+ *
134
+ * @param baseItemId - `base_item_id` of the menu item being customized.
135
+ * @param seed - Existing OrderItem to pre-fill from, e.g. when editing a cart line.
136
+ * @param editIndex - Cart index to update on submit; omit to add a new item instead.
137
+ *
138
+ * @returns `item`/`variant`/`variants` for the item being built, `setVariant`
139
+ * to switch variants, `ruleGroups` for rendering rule UI (each option carries
140
+ * a `toggle`), `unmetRule`/`canSubmit` for validation state, `submit` to
141
+ * commit the draft to the cart, `quantity`/`setQuantity`, `comments`/`setComments`,
142
+ * `setComponentServings`, `price`/`salePrice`, `isEditMode`, and the raw `draft`.
143
+ *
144
+ * @example
145
+ * const { item, ruleGroups, canSubmit, submit } = useItemCustomization(baseItemId);
146
+ */
147
+ declare function useItemCustomization(baseItemId: number, seed?: OrderItem$1, editIndex?: number): {
148
+ item: MenuItem$1 | undefined;
149
+ variant: ItemVariant$1;
150
+ variants: ItemVariant$1[];
151
+ setVariant: (next: ItemVariant$1) => void;
152
+ ruleGroups: CustomizationRule$1[];
153
+ unmetRule: CustomizationRule$1 | null;
154
+ canSubmit: boolean;
155
+ submit: () => OrderItem$1 | null;
156
+ quantity: number;
157
+ setQuantity: react.Dispatch<react.SetStateAction<number>>;
158
+ comments: string;
159
+ setComments: react.Dispatch<react.SetStateAction<string>>;
160
+ setComponentServings: (componentId: number, qty: number) => void;
161
+ price: number;
162
+ salePrice: number | undefined;
163
+ isEditMode: boolean;
164
+ draft: OrderItem$1 | null;
165
+ };
166
+ declare function usePromotions(): {
167
+ promoCode: string;
168
+ setPromoCode: (code: string) => void;
169
+ appliedPromo: Promotion$1 | null;
170
+ discountAmount: number;
171
+ error: string | null;
172
+ loading: boolean;
173
+ applyPromo: (code: string) => Promise<void>;
174
+ removePromo: () => void;
175
+ activePromotions: Promotion$1[];
176
+ };
177
+ declare function usePayment(): {
178
+ clientSecret: string | null;
179
+ intentType: "payment_intent" | "setup_intent" | null;
180
+ stripe: _stripe_stripe_js.Stripe | undefined;
181
+ elementOptions: StripeElementsOptions | null;
182
+ total: number | null;
183
+ isLoading: boolean;
184
+ error: string | null;
185
+ isReady: boolean;
186
+ startCheckout: () => Promise<void>;
187
+ resetCheckout: () => void;
188
+ submitPayment: (stripe: unknown, elements: unknown, clientSecret: string, returnUrl: string, customer: Customer$1) => Promise<{
189
+ success: boolean;
190
+ error?: string;
191
+ paymentIntentId?: string;
192
+ }>;
193
+ paymentElementOptions: {
194
+ layout: "accordion";
195
+ fields: {
196
+ billingDetails: {
197
+ name: "never";
198
+ email: "never";
199
+ phone: "never";
200
+ address: "auto";
201
+ };
202
+ };
203
+ };
204
+ getReturnStatus: (url: string | URL) => {
205
+ succeeded: boolean;
206
+ amount?: number;
207
+ paymentIntentId?: string;
208
+ error?: string;
209
+ };
210
+ getReturnUrl: () => string | undefined;
211
+ };
212
+ declare function useCateringConfig(): {
213
+ minimum_notice_hours: number | null | undefined;
214
+ minimum_people_required: number | null | undefined;
215
+ minimum_price: number | null | undefined;
216
+ does_cater: boolean | null | undefined;
217
+ does_deliver: boolean | null | undefined;
218
+ delivery_fee_cents: number | null | undefined;
219
+ max_delivery_radius_miles: number | null | undefined;
220
+ cents_per_mile: number | null | undefined;
221
+ };
222
+ declare function useRecommendations(): {
223
+ recommendations: RecommendationResult$1[];
224
+ isLoading: boolean;
225
+ error: string | null;
226
+ strategy: RecommendationStrategy$1;
227
+ lastFetchedAt: Date | null;
228
+ refresh: (request: RecommendationRequest$1) => Promise<void>;
229
+ setStrategy: (s: RecommendationStrategy$1) => void;
230
+ clear: () => void;
231
+ };
232
+ declare function useCustomer(): {
233
+ customer: Customer$1;
234
+ consentGiven: boolean;
235
+ setCustomer: (customer: Customer$1) => void;
236
+ consentAnswered: boolean;
237
+ setConsent: (granted: boolean) => void;
238
+ anonymousId: string | null;
239
+ };
3
240
 
4
241
  type LocationStatus = "active" | "permanently_closed";
5
242
  interface Location {
@@ -304,4 +541,4 @@ interface Menu {
304
541
  rules: Rule[];
305
542
  }
306
543
 
307
- export type { Category, Customer, CustomizationOption, CustomizationRule, ItemVariant, Location, Menu, MenuItem, Order, OrderComponent, OrderItem, Promotion, RecommendationRequest, RecommendationResult, RecommendationStrategy, Rule, RuleComponent, RuleItem, RuleSelection, Selection };
544
+ export { type Category, type Customer, type CustomizationOption, type CustomizationRule, type ItemVariant, type Location, type Menu, type MenuItem, type Order, type OrderComponent, type OrderItem, type Promotion, type RecommendationRequest, type RecommendationResult, type RecommendationStrategy, type Rule, type RuleComponent, type RuleItem, type RuleSelection, type Selection, setZorgoBoot, setZorgoPathnameHook, useCart, useCateringConfig, useCustomer, useHydrateMenu, useHydrateStore, useItemCustomization, useLocation, useMenu, useModal, usePayment, usePromotions, useRecommendations };