@fleetbridge/ui 0.0.0-stage → 1.0.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.
package/index.d.ts ADDED
@@ -0,0 +1,1937 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, ComponentType, ElementType, ComponentProps } from 'react';
4
+ import { QueryClient } from '@tanstack/react-query';
5
+ import { LucideIcon } from 'lucide-react';
6
+ import * as zustand from 'zustand';
7
+
8
+ declare const SEARCH_STYLES: readonly ["card", "bar", "hero", "pill", "sidebar", "steps"];
9
+ type SearchStyle = (typeof SEARCH_STYLES)[number];
10
+ declare const LIST_STYLES: readonly ["grid", "rows", "table", "showcase", "grouped"];
11
+ type ListStyle = (typeof LIST_STYLES)[number];
12
+ declare const DEFAULT_SEARCH_STYLE: SearchStyle;
13
+ declare const DEFAULT_LIST_STYLE: ListStyle;
14
+ /** A saved or typed style name, or the default when it is empty or unknown. */
15
+ declare function searchStyleFrom(value: string | null | undefined): SearchStyle;
16
+ declare function listStyleFrom(value: string | null | undefined): ListStyle;
17
+ /** What each style is called and what it is good for, for the admin picker. */
18
+ declare const SEARCH_STYLE_INFO: Record<SearchStyle, {
19
+ title: string;
20
+ description: string;
21
+ }>;
22
+ declare const LIST_STYLE_INFO: Record<ListStyle, {
23
+ title: string;
24
+ description: string;
25
+ }>;
26
+ declare const FILTER_STYLES: readonly ["rail", "chips", "button", "tabs"];
27
+ declare const STEP_STYLES: readonly ["line", "road", "checklist"];
28
+ declare const EXTRA_STYLES: readonly ["cards", "list", "packages"];
29
+ declare const PRICE_STYLES: readonly ["side", "bar", "table"];
30
+ declare const DONE_STYLES: readonly ["pass", "receipt", "next"];
31
+ declare const FIND_STYLES: readonly ["card", "banner", "help"];
32
+ type FilterStyle = (typeof FILTER_STYLES)[number];
33
+ type StepStyle = (typeof STEP_STYLES)[number];
34
+ type ExtraStyle = (typeof EXTRA_STYLES)[number];
35
+ type PriceStyle = (typeof PRICE_STYLES)[number];
36
+ type DoneStyle = (typeof DONE_STYLES)[number];
37
+ type FindStyle = (typeof FIND_STYLES)[number];
38
+ /** Every booking part's chosen look. */
39
+ interface Looks {
40
+ filters: FilterStyle;
41
+ steps: StepStyle;
42
+ extras: ExtraStyle;
43
+ price: PriceStyle;
44
+ done: DoneStyle;
45
+ find: FindStyle;
46
+ }
47
+ type LookKind = keyof Looks;
48
+ /** The choices for each part. The first one is the default (the look it had before). */
49
+ declare const LOOK_CHOICES: {
50
+ [K in LookKind]: readonly Looks[K][];
51
+ };
52
+ declare const DEFAULT_LOOKS: Looks;
53
+ /**
54
+ * The looks from a mount's data-looks attribute (a small JSON object).
55
+ * Anything missing, unknown or broken falls back to the default, so an old
56
+ * page or a typo in a shortcode still shows a working booking.
57
+ */
58
+ declare function looksFrom(value: string | null | undefined): Looks;
59
+ /** What each part is called on the Theme page, and what each of its looks is good for. */
60
+ declare const LOOK_INFO: {
61
+ [K in LookKind]: {
62
+ title: string;
63
+ description: string;
64
+ choices: Record<Looks[K], {
65
+ title: string;
66
+ description: string;
67
+ }>;
68
+ };
69
+ };
70
+
71
+ interface SearchWidgetProps {
72
+ /** Where the form submits to - see lib/search.ts for the params it carries. Defaults to the provider's resultsUrl. */
73
+ resultsPageUrl?: string;
74
+ /** The look the site owner chose, or the one the shortcode asked for (see lib/widget.styles.ts). */
75
+ searchStyle?: SearchStyle;
76
+ /** Headline for the hero and sidebar looks. */
77
+ title?: string;
78
+ /** The line under the hero headline. */
79
+ subtitle?: string;
80
+ }
81
+
82
+ /**
83
+ * The search criteria - one shape shared by the form that collects them, the
84
+ * URL that carries them between the two shortcodes, and the summary bar that
85
+ * echoes them back on the results page.
86
+ *
87
+ * `SAME_AS_PICKUP` is a sentinel rather than an empty string because Radix
88
+ * Select can't use "" as an item value. It's stripped when building the
89
+ * query, so it never reaches the URL.
90
+ */
91
+ declare const SAME_AS_PICKUP = "same";
92
+ interface SearchCriteria {
93
+ pickupLocation: string;
94
+ dropoffLocation: string;
95
+ pickupDate: string;
96
+ dropoffDate: string;
97
+ pickupTime: string;
98
+ dropoffTime: string;
99
+ coupon: string;
100
+ /**
101
+ * Country of residence, same distinction carhire.co.za's own search form
102
+ * makes - some suppliers (e.g. Bluu, see AvailabilityParams.isInternational)
103
+ * quote different rates/terms for a foreign renter.
104
+ */
105
+ residency: 'ZA' | 'INT';
106
+ /**
107
+ * Adapter identifier to search (e.g. "hertz"). Only set for amend: a
108
+ * normal search fans out to every subscribed supplier.
109
+ */
110
+ supplier?: string;
111
+ /**
112
+ * The driver's age, when it is outside the usual 25–70 band. Young (and
113
+ * some older) drivers pay a fee or are refused, so suppliers price it.
114
+ * Left out for the usual band, so those searches stay exactly as before.
115
+ */
116
+ driverAge?: number;
117
+ }
118
+ /** The driver-age choices the card search style offers. `age` is what is sent (the youngest age in the band); none means the usual band. */
119
+ declare const DRIVER_AGE_BANDS: ReadonlyArray<{
120
+ label: string;
121
+ age?: number;
122
+ }>;
123
+ declare const DEFAULT_CRITERIA: SearchCriteria;
124
+ declare function criteriaToQuery(criteria: SearchCriteria): string;
125
+ declare function criteriaFromParams(search: string): SearchCriteria;
126
+ /**
127
+ * Whole days in the rental window, or 0 without one. A rental "day" is a
128
+ * billing unit, so a same-day return still counts as one.
129
+ */
130
+ declare function rentalDays(criteria: SearchCriteria): number;
131
+ /**
132
+ * True when the criteria carry a complete trip the server can search: real
133
+ * pick-up and return dates (return not before pick-up) and real times. A
134
+ * link into the results page without dates (for example "Find a car at
135
+ * Sandton") is not a failed search; the page asks for the dates instead.
136
+ */
137
+ declare function hasValidTrip(criteria: SearchCriteria): boolean;
138
+
139
+ /**
140
+ * How the results page sits on the host page.
141
+ *
142
+ * `boxed` (the default) draws the summary bar and the filter rail as cards
143
+ * inside a content column. `flush` drops the cards for hairlines, so a site
144
+ * can attach the summary to its own header and run the results full width.
145
+ */
146
+ type ResultsLayout = 'boxed' | 'flush';
147
+ /**
148
+ * The search summary, and the form behind it.
149
+ *
150
+ * Collapsed it's a single line of criteria; "Modify search" expands the same
151
+ * form the search shortcode uses, and submitting re-searches in place. Nothing
152
+ * about the criteria needs a round trip today, so reloading here would only
153
+ * cost the user their filters and their place in the list.
154
+ */
155
+ declare function SearchBar({ criteria, days, editing, onToggleEditing, onSubmit, layout, prompt, needsDates, }: {
156
+ criteria: SearchCriteria;
157
+ days: number;
158
+ editing: boolean;
159
+ onToggleEditing: () => void;
160
+ onSubmit: (criteria: SearchCriteria) => void;
161
+ layout?: ResultsLayout;
162
+ /** A line above the open form, e.g. "Choose your dates to see cars at Sandton". */
163
+ prompt?: string | null;
164
+ /** The page has no usable trip yet: the summary asks for dates and the form searches instead of updating. */
165
+ needsDates?: boolean;
166
+ }): react_jsx_runtime.JSX.Element;
167
+
168
+ interface ResultsPageProps {
169
+ /** Passed through to every card's CTA - see CarCard's `bookingUrl`. */
170
+ bookingUrl?: string;
171
+ /** How the cars are laid out: the site owner's choice, or the shortcode's (see lib/widget.styles.ts). */
172
+ listStyle?: ListStyle;
173
+ /**
174
+ * `boxed` (default): the summary and filters as cards in a content column.
175
+ * `flush`: hairlines instead of cards, for a full-width page whose header
176
+ * carries the summary (see `summaryContainer`).
177
+ */
178
+ layout?: ResultsLayout;
179
+ /**
180
+ * Where to draw the search summary and its Modify search form, for example
181
+ * a row in the site's own sticky header. Left out, it sits above the results.
182
+ */
183
+ summaryContainer?: HTMLElement | null;
184
+ }
185
+
186
+ interface ManageBookingProps {
187
+ /** Renders an on-page "Manage my booking" trigger card that opens the
188
+ * lookup dialog - only meaningful where [fleetbridge_manage_booking] was
189
+ * deliberately placed on a page (see the shortcode's own
190
+ * `data-show-trigger` attribute). The wp_footer fallback mount that makes
191
+ * a `#manage=booking&id=&pin=` link work from *any* page renders this
192
+ * component without it - there, the drawer opening itself straight from the
193
+ * URL is the entire interaction. */
194
+ showTrigger?: boolean;
195
+ /** How the cars are laid out when changing a booking (the site owner's choice on the Theme page). */
196
+ listStyle?: ListStyle;
197
+ }
198
+
199
+ /**
200
+ * How the UI talks to the site it is embedded in.
201
+ *
202
+ * Every query in this package goes through one `FleetBridgeTransport`. The
203
+ * transport carries a public action (by its short name, e.g.
204
+ * "search_availability") and its string fields to the host site, and reads
205
+ * back the `{ success, data }` envelope WordPress's `wp_send_json_*` uses -
206
+ * the same envelope `createPublicHandler` from `@fleetbridge/ui/server` sends.
207
+ *
208
+ * - WordPress: `wordpressTransport({ ajaxUrl, nonce })` posts to admin-ajax.php
209
+ * as `fleetbridge_<action>`.
210
+ * - Anything else (Next.js, Remix, Express…): `httpTransport({ endpoint })`
211
+ * posts to one route of your own that runs `createPublicHandler`.
212
+ *
213
+ * Supplier credentials and the account API key never reach the browser:
214
+ * both transports only ever talk to the host site's own server.
215
+ */
216
+ type QueryResult<T> = {
217
+ success: true;
218
+ data: T;
219
+ } | {
220
+ success: false;
221
+ error: string;
222
+ /**
223
+ * Whatever else came back with the failure. Some of it matters to the
224
+ * customer - a booking that the supplier declined still returns the
225
+ * reference the attempt was recorded under. Partial because a transport
226
+ * failure has no payload at all.
227
+ */
228
+ data?: Partial<T>;
229
+ };
230
+ interface FleetBridgeTransport {
231
+ /** `action` is the short name, without the "fleetbridge_" prefix. */
232
+ post<T>(action: string, fields?: Record<string, string>): Promise<QueryResult<T>>;
233
+ }
234
+ /** Every public action the UI calls. */
235
+ declare const PUBLIC_ACTIONS: readonly ["public_branches", "search_sources", "search_availability", "get_estimation", "get_extras", "get_one_way_fee", "supplier_terms", "booking_request", "request_quote", "lookup_quote", "confirm_quote", "lookup_booking", "cancel_my_booking", "amend_my_booking", "payment_methods", "start_payment", "verify_payment"];
236
+ type PublicAction = (typeof PUBLIC_ACTIONS)[number];
237
+ /** Strips a leading "fleetbridge_", so either spelling of an action works. */
238
+ declare function shortAction(action: string): string;
239
+ /** Talks to the FleetBridge WordPress plugin through admin-ajax.php. */
240
+ declare function wordpressTransport(options: {
241
+ ajaxUrl: string;
242
+ nonce: string;
243
+ }): FleetBridgeTransport;
244
+ /**
245
+ * Talks to a route of the host site that runs `createPublicHandler` (see
246
+ * `@fleetbridge/ui/server`). The action travels as the `action` field.
247
+ */
248
+ declare function httpTransport(options: {
249
+ endpoint: string;
250
+ headers?: Record<string, string>;
251
+ credentials?: RequestCredentials;
252
+ }): FleetBridgeTransport;
253
+ declare function setTransport(transport: FleetBridgeTransport): void;
254
+ /** The transport in use, or a stand-in that explains what is missing. */
255
+ declare function getTransport(): FleetBridgeTransport;
256
+
257
+ /**
258
+ * Theming. Every colour the UI paints comes from a CSS custom property, so a
259
+ * host restyles it without touching the package:
260
+ *
261
+ * - The base palette (shadcn names): --primary, --primary-foreground,
262
+ * --accent, --background, --foreground, --muted, --border, --ring, --radius…
263
+ * - The font: --fb-font-sans.
264
+ * - Per-surface tokens (--fb-search-*, --fb-listing-*, --fb-car-*,
265
+ * --fb-filter-*, --fb-wizard-*), which default to the base palette - see
266
+ * styles/public-tokens.css for the full list.
267
+ *
268
+ * `FleetBridgeTheme` is a typed shortcut for the common ones, `colors` sets any
269
+ * element's own colour by name, and anything else goes in `vars`. Pass it to <FleetBridgeProvider theme={…}>, or print
270
+ * themeToCss(theme) in a <style> tag (best for server-rendered pages), or set
271
+ * the properties in your own stylesheet.
272
+ */
273
+ /**
274
+ * Every colour a site owner can set, one per surface token - the same keys
275
+ * and custom properties as the WordPress plugin's Theme tab
276
+ * (ThemeController::COLOR_FIELDS / ShortcodeController::COLOR_VARS), so a
277
+ * theme saved there or in another host's settings maps one-to-one.
278
+ */
279
+ declare const THEME_COLOR_VARS: {
280
+ readonly primary: "--primary";
281
+ readonly primaryForeground: "--primary-foreground";
282
+ readonly background: "--background";
283
+ readonly card: "--card";
284
+ readonly cardForeground: "--card-foreground";
285
+ readonly border: "--border";
286
+ readonly foreground: "--foreground";
287
+ readonly mutedForeground: "--muted-foreground";
288
+ readonly muted: "--muted";
289
+ readonly input: "--input";
290
+ readonly secondary: "--secondary";
291
+ readonly secondaryForeground: "--secondary-foreground";
292
+ readonly searchSurface: "--fb-search-surface";
293
+ readonly searchBorder: "--fb-search-border";
294
+ readonly searchField: "--fb-search-field";
295
+ readonly searchLabel: "--fb-search-label";
296
+ readonly searchValue: "--fb-search-value";
297
+ readonly searchButton: "--fb-search-button";
298
+ readonly searchButtonFg: "--fb-search-button-fg";
299
+ readonly searchToggle: "--fb-search-toggle";
300
+ readonly searchToggleFg: "--fb-search-toggle-fg";
301
+ readonly listingBar: "--fb-listing-bar";
302
+ readonly listingBorder: "--fb-listing-border";
303
+ readonly listingText: "--fb-listing-text";
304
+ readonly listingMuted: "--fb-listing-muted";
305
+ readonly listingModifyBg: "--fb-listing-modify";
306
+ readonly listingModifyBorder: "--fb-listing-modify-border";
307
+ readonly listingChip: "--fb-listing-chip";
308
+ readonly listingChipFg: "--fb-listing-chip-fg";
309
+ readonly listingSidebar: "--fb-listing-sidebar";
310
+ readonly carBg: "--fb-car-bg";
311
+ readonly carBorder: "--fb-car-border";
312
+ readonly carBorderHover: "--fb-car-border-hover";
313
+ readonly carTitle: "--fb-car-title";
314
+ readonly carMuted: "--fb-car-muted";
315
+ readonly carPhoto: "--fb-car-photo";
316
+ readonly carPrice: "--fb-car-price";
317
+ readonly carCta: "--fb-car-cta";
318
+ readonly carCtaFg: "--fb-car-cta-fg";
319
+ readonly carQuoteBorder: "--fb-car-quote-border";
320
+ readonly carBadge: "--fb-car-badge";
321
+ readonly carBadgeFg: "--fb-car-badge-fg";
322
+ readonly carInsured: "--fb-car-insured";
323
+ readonly carInsuredFg: "--fb-car-insured-fg";
324
+ readonly carOption: "--fb-car-option";
325
+ readonly carOptionFg: "--fb-car-option-fg";
326
+ readonly filterTitle: "--fb-filter-title";
327
+ readonly filterMuted: "--fb-filter-muted";
328
+ readonly filterPill: "--fb-filter-pill";
329
+ readonly filterPillFg: "--fb-filter-pill-fg";
330
+ readonly filterPillActive: "--fb-filter-pill-active";
331
+ readonly filterPillActiveFg: "--fb-filter-pill-active-fg";
332
+ readonly filterBar: "--fb-filter-bar";
333
+ readonly surface2: "--fb-surface-2";
334
+ readonly borderStrong: "--fb-border-strong";
335
+ readonly ring: "--ring";
336
+ readonly destructive: "--destructive";
337
+ };
338
+ type ThemeColorKey = keyof typeof THEME_COLOR_VARS;
339
+ interface FleetBridgeTheme {
340
+ /** The main brand colour: search button, selected states, CTAs. */
341
+ primary?: string;
342
+ primaryForeground?: string;
343
+ /** The highlight colour: the "Book"/"View deal" buttons and filter bars. */
344
+ accent?: string;
345
+ accentForeground?: string;
346
+ background?: string;
347
+ foreground?: string;
348
+ /** Field backgrounds and quiet surfaces. */
349
+ muted?: string;
350
+ mutedForeground?: string;
351
+ border?: string;
352
+ ring?: string;
353
+ /** Corner radius, e.g. "12px" or "0.75rem". */
354
+ radius?: string;
355
+ /** Font stack, e.g. "Inter, system-ui, sans-serif". The host page loads the font. */
356
+ fontFamily?: string;
357
+ /**
358
+ * Per-element colours (search form, results bar, car cards, filters,
359
+ * wizard…), keyed as on the WordPress Theme tab. Set ones win over the
360
+ * shortcuts above; unset ones follow them.
361
+ */
362
+ colors?: Partial<Record<ThemeColorKey, string>>;
363
+ /** Any other custom property, e.g. { '--fb-wizard-selected': '#153673' }. */
364
+ vars?: Record<string, string>;
365
+ }
366
+ declare function themeToVars(theme: FleetBridgeTheme): Record<string, string>;
367
+ /** The theme as a `:root { … }` rule, for a server-rendered <style> tag. */
368
+ declare function themeToCss(theme: FleetBridgeTheme, selector?: string): string;
369
+
370
+ /** How long a cached search/quote survives, both as staleTime and as the persisted ceiling. */
371
+ declare const CACHE_MS: number;
372
+ interface FleetBridgeConfig {
373
+ /** Where the search form sends the customer (the page that renders <ResultsPage />). */
374
+ resultsUrl: string;
375
+ /** The page that renders <ManageBooking />. */
376
+ manageUrl?: string;
377
+ /** Where the customer comes back to after paying online. Defaults to the results page. */
378
+ paymentReturnUrl?: string;
379
+ /** Passed to every car card's CTA, when the site has its own booking page. */
380
+ bookingUrl?: string;
381
+ }
382
+ /** The URLs the host gave FleetBridgeProvider. */
383
+ declare function useFleetBridgeConfig(): FleetBridgeConfig;
384
+ interface FleetBridgeProviderProps extends Partial<FleetBridgeConfig> {
385
+ /** How the UI reaches the host site: wordpressTransport(…) or httpTransport(…). */
386
+ transport: FleetBridgeTransport;
387
+ /** Bring your own QueryClient to share a cache with the rest of the app. */
388
+ queryClient?: QueryClient;
389
+ /** Keep successful searches/quotes in localStorage for CACHE_MS, so a page refresh is instant. Default true. */
390
+ persistCache?: boolean;
391
+ /** The look of each booking part (filters, steps, extras, price, confirmation, find-booking). */
392
+ looks?: Partial<Looks>;
393
+ /**
394
+ * Brand colours, radius and font. Written as CSS custom properties on
395
+ * :root while the provider is mounted (portalled dialogs live on <body>,
396
+ * so the tokens have to be inheritable from the root). For a flash-free
397
+ * first paint, also print themeToCss(theme) in a <style> tag on the server.
398
+ */
399
+ theme?: FleetBridgeTheme;
400
+ /** Render the toast viewport. Default true. Turn off if the host already renders @fleetbridge/components' <Toaster />. */
401
+ toaster?: boolean;
402
+ children: ReactNode;
403
+ }
404
+ /**
405
+ * Everything the FleetBridge components need around them: the transport,
406
+ * the query cache, tooltips, toasts, looks, theme and page URLs. Mount it
407
+ * once (or once per island) around any FleetBridge component.
408
+ */
409
+ declare function FleetBridgeProvider({ transport, queryClient, persistCache, looks, theme, toaster, resultsUrl, manageUrl, paymentReturnUrl, bookingUrl, children, }: FleetBridgeProviderProps): react_jsx_runtime.JSX.Element;
410
+ /** True once running in the browser, after hydration. */
411
+ declare function useIsClient(): boolean;
412
+ /** Renders `fallback` on the server and during hydration, then the component. */
413
+ declare function clientOnly<P extends object>(Component: ComponentType<P>, displayName: string): {
414
+ (props: P & {
415
+ fallback?: ReactNode;
416
+ }): react_jsx_runtime.JSX.Element;
417
+ displayName: string;
418
+ };
419
+
420
+ /**
421
+ * The colours a site owner can change, grouped and worded for a settings
422
+ * screen: the WordPress plugin's Theme tab and any other host's (e.g. the
423
+ * Carhire Studio's Booking look → Colours) use the same list, so a theme
424
+ * means the same thing everywhere. Plain data, importing nothing but
425
+ * ../theme (which imports nothing), so a host's server can bundle it without
426
+ * the React components.
427
+ *
428
+ * Store only the colours that were changed ({colors, radius}, see
429
+ * BookingTheme) and pass them as `FleetBridgeTheme.colors` / `radius`.
430
+ */
431
+
432
+ declare const THEME_KEYS: ThemeColorKey[];
433
+ /** FleetBridge's own starting colours, for anything neither the brand nor its parent token sets. */
434
+ declare const FLEETBRIDGE_DEFAULTS: Record<ThemeColorKey, string>;
435
+ /** A part's colours follow this token until they are changed (FleetBridge's CSS fallbacks). */
436
+ declare const THEME_INHERIT: Partial<Record<ThemeColorKey, ThemeColorKey>>;
437
+ type ThemeField = {
438
+ key: ThemeColorKey;
439
+ label: string;
440
+ hint?: string;
441
+ };
442
+ type ThemeSection = {
443
+ title: string;
444
+ fields: ThemeField[];
445
+ };
446
+ type ThemeGroup = {
447
+ id: 'brand' | 'search' | 'listing' | 'filters' | 'card';
448
+ title: string; /** A Remix icon class, for hosts that use Remix icons. */
449
+ icon: string;
450
+ description: string;
451
+ sections: ThemeSection[];
452
+ };
453
+ /** The Theme tab's groups, in its order and wording. `icon` is a Remix icon class for the Studio. */
454
+ declare const THEME_GROUPS: ThemeGroup[];
455
+ /** One-click brand colours for a settings screen. */
456
+ declare const THEME_PRESETS: {
457
+ name: string;
458
+ primary: string;
459
+ primaryForeground: string;
460
+ }[];
461
+ /** Corner radius choices in px (the Theme tab allows 0–40px). */
462
+ declare const THEME_RADII: number[];
463
+ type BookingTheme = {
464
+ colors?: Partial<Record<ThemeColorKey, string>> | null;
465
+ radius?: number | null;
466
+ };
467
+ declare const isHex: (v: unknown) => v is string;
468
+ /** A stored or posted theme with anything unknown or malformed dropped. */
469
+ declare function cleanBookingTheme(raw: unknown): BookingTheme;
470
+ /**
471
+ * What each colour shows as when it has not been changed: the site's brand
472
+ * values (`base`), else the token it follows, else FleetBridge's default.
473
+ */
474
+ declare function effectiveColors(base: Partial<Record<ThemeColorKey, string>>, overrides?: Partial<Record<ThemeColorKey, string>>): Record<ThemeColorKey, string>;
475
+
476
+ interface SearchPanelProps {
477
+ /** Pre-fills the form - the results page passes the criteria from the URL. */
478
+ initialCriteria?: SearchCriteria;
479
+ onSubmit: (criteria: SearchCriteria) => void;
480
+ submitLabel?: string;
481
+ /**
482
+ * Which look to use (see lib/widget.styles.ts). The results page's Modify
483
+ * search drawer and the amend flow always use the bar.
484
+ */
485
+ style?: SearchStyle;
486
+ /**
487
+ * For the bar only. `card` is the standalone shortcode: a soft shadow and a
488
+ * short fade in. `bare` is the same bar without that, for the results
489
+ * page's Modify search drawer.
490
+ */
491
+ variant?: 'card' | 'bare';
492
+ /** The headline of the hero and sidebar styles. An empty string hides it. */
493
+ title?: string;
494
+ /** The line under the hero headline. An empty string hides it. */
495
+ subtitle?: string;
496
+ className?: string;
497
+ /**
498
+ * `Date.now()` when the currently-applied search (the one `initialCriteria`
499
+ * reflects) last actually ran - only meaningful alongside submitLabel="Update".
500
+ */
501
+ resultsFetchedAt?: number;
502
+ }
503
+ /**
504
+ * The search form, in the look the site owner chose. Every look shares one
505
+ * form (useSearchForm), so they check, remember and send a search the same
506
+ * way; they only place the fields differently.
507
+ */
508
+ declare function SearchPanel({ initialCriteria, onSubmit, submitLabel, style, variant, title, subtitle, className, resultsFetchedAt, }: SearchPanelProps): react_jsx_runtime.JSX.Element;
509
+
510
+ /** A location the picker can search - one entry per branch NAME, already
511
+ * merged server-side (see fleetbridge.php's ajax_public_branches) since the
512
+ * same name can exist under more than one supplier. The form searches by
513
+ * name; ajax_search_availability() resolves each active supplier's own
514
+ * branch code for that name at search time (a code means nothing outside
515
+ * the supplier it belongs to). */
516
+ interface BranchLocation {
517
+ name: string;
518
+ region: string;
519
+ isAirportBranch: boolean;
520
+ isInternational: boolean;
521
+ }
522
+ interface LocationOption {
523
+ value: string;
524
+ label: string;
525
+ icon?: LucideIcon;
526
+ }
527
+ interface LocationGroup {
528
+ /** Omitted for a leading, header-less group (e.g. sentinel options). */
529
+ label?: string;
530
+ options: LocationOption[];
531
+ }
532
+
533
+ interface SearchComboboxProps {
534
+ id?: string;
535
+ ariaLabel?: string;
536
+ value: string;
537
+ /** What shows in the closed trigger - may differ from `value` for sentinel
538
+ * options like "Any location" / "Same as pick-up". */
539
+ displayLabel: string;
540
+ groups: LocationGroup[];
541
+ onChange: (value: string) => void;
542
+ searchPlaceholder?: string;
543
+ emptyMessage?: string;
544
+ /** True while `groups` is empty because the list is still being fetched,
545
+ * not because it genuinely has no matches - an empty array reads
546
+ * identically either way otherwise, so a picker opened right as the fetch
547
+ * kicks off would flash `emptyMessage` for what's actually just latency. */
548
+ loading?: boolean;
549
+ triggerClassName?: string;
550
+ contentClassName?: string;
551
+ invalid?: boolean;
552
+ }
553
+ /**
554
+ * A searchable, groupable single-select - the search form's replacement for
555
+ * a plain <select> on pick-up/drop-off location and time, so a long location
556
+ * list can be typed through instead of scrolled.
557
+ */
558
+ declare function SearchCombobox({ id, ariaLabel, value, displayLabel, groups, onChange, searchPlaceholder, emptyMessage, loading, triggerClassName, contentClassName, invalid, }: SearchComboboxProps): react_jsx_runtime.JSX.Element;
559
+
560
+ /**
561
+ * Pick-up -> drop-off as one range, rather than two independent date pickers:
562
+ * a single two-month calendar makes the rental window visible while choosing
563
+ * it, and makes an end-before-start selection impossible by construction.
564
+ *
565
+ * Values are local-date ISO strings (YYYY-MM-DD). `new Date("2026-01-01")`
566
+ * parses as UTC and shifts a day in negative-offset timezones, so parsing and
567
+ * formatting are done by hand - same approach as ui/date-picker.tsx.
568
+ */
569
+ interface DateRangeFieldProps {
570
+ from: string;
571
+ to: string;
572
+ onChange: (range: {
573
+ from: string;
574
+ to: string;
575
+ }) => void;
576
+ className?: string;
577
+ /** Inverted styling for use on a dark surface. */
578
+ tone?: 'default' | 'stage';
579
+ id?: string;
580
+ invalid?: boolean;
581
+ /**
582
+ * What the trigger shows: the whole range (default), or only one end. The
583
+ * "card" search style draws pick-up and return in separate cells; both open
584
+ * the same range calendar, so a return before pick-up is still impossible.
585
+ */
586
+ display?: 'range' | 'from' | 'to';
587
+ /** The text shown for an empty end, e.g. "Add date". */
588
+ placeholder?: string;
589
+ }
590
+ declare function DateRangeField({ from, to, onChange, className, tone, id, invalid, display, placeholder, }: DateRangeFieldProps): react_jsx_runtime.JSX.Element;
591
+
592
+ /**
593
+ * Public results-grid vehicle shape. Mapped from the availability AJAX
594
+ * response (see lib/offers.ts → NormalizedVehicleListing) — only fields the
595
+ * UI can actually populate from a live supplier search.
596
+ */
597
+ /** One CDP / km package on a listing — values already cleaned by the API. */
598
+ interface RatePackage {
599
+ cdpCode: string;
600
+ /**
601
+ * Whether this package's CDP code should show the "Discount" badge - set
602
+ * server-side (by the core's search.availability action) once for
603
+ * DIRECT-mode codes, or only once a matching Coupon was submitted and
604
+ * validated for a COUPON_GATED-mode code.
605
+ */
606
+ isDiscounted: boolean;
607
+ /**
608
+ * False when this option's km allowance is not the one on its CDP. The tab
609
+ * stays visible so the difference is obvious, and it cannot be selected.
610
+ * Omitted on supplier rates, which stay selectable.
611
+ */
612
+ kmSelectable?: boolean;
613
+ /** The CDP's km allowance when this option cannot be selected. 0 or empty means unlimited. */
614
+ cdpKmAllowance?: number | null;
615
+ dailyRate: number;
616
+ totalRate: number;
617
+ /**
618
+ * Pre-discount daily/total rate - only set when this package actually beat
619
+ * a pricier same-km-tier competitor (see aggregator.ts's
620
+ * dedupeCheapestPerKm() and RateOption.discount). Renders as a struck-
621
+ * through "was" price next to the current one.
622
+ */
623
+ wasDailyRate?: number;
624
+ wasTotalRate?: number;
625
+ kmPerDay: number;
626
+ unlimitedMileage: boolean;
627
+ deposit: number;
628
+ liability: number;
629
+ /** Drop-off/one-way fee (ZAR) - non-zero only when this rate's pick-up and
630
+ * return branches differ (see rate.resolver.ts/aggregator.ts on the API
631
+ * side, which is where it's actually computed per supplier). */
632
+ dropOffFee: number;
633
+ rentalDays: number;
634
+ /**
635
+ * The supplier's own identifier for the rate this package was quoted at,
636
+ * carried through from RateOption (see the API's rate.resolver). Not
637
+ * cosmetic: Thermeon's NewReservationRequest books against
638
+ * `QuotedRate rateID`, so a booking made without it is a booking made at
639
+ * whatever rate the supplier happens to pick, not the one that was shown.
640
+ */
641
+ rateNo: string;
642
+ /** Rate serial number - Bluu's MakeBookingWithQuote QuoteNumber. */
643
+ rateSrNo: string;
644
+ /**
645
+ * The supplier's price quote for this package (SaniSixt's QUOTEREF).
646
+ * Each CDP code is quoted on its own, so the quote has to be the one
647
+ * of the package that is booked.
648
+ */
649
+ quoteRef?: string;
650
+ /**
651
+ * SaniSixt price-quote Options for this package (Code/Rate/Inclusive…).
652
+ * Used to price live extras the way carhire merges catalogue ∩ quote options.
653
+ */
654
+ options?: QuoteExtraOption[];
655
+ /**
656
+ * Coverage tier label for dailyRate/totalRate above - 'Standard' unless
657
+ * `superCover` was selected via CarCard's coverage toggle. Persisted
658
+ * verbatim on the booking (see ratePackageLabel in booking.queries.ts) so
659
+ * the confirmation email says what was actually quoted.
660
+ */
661
+ ratePackageLabel: string;
662
+ /** Price of each kilometre over the free allowance, in Rand. 0 when the rate does not say. */
663
+ excessPerKm?: number;
664
+ /**
665
+ * The supplier's higher-cover tier for this same km package (e.g.
666
+ * Europcar's SuperCover), present only when the rate resolver returned a
667
+ * genuinely different total from the standard one above (see
668
+ * rate.resolver.ts - most suppliers mirror standardRate into superRate,
669
+ * which is not a real second tier).
670
+ */
671
+ superCover?: {
672
+ label: string;
673
+ dailyRate: number;
674
+ totalRate: number;
675
+ /** Excess and per-km price for this cover, when they differ from the standard tier. */
676
+ liability?: number;
677
+ excessPerKm?: number;
678
+ deposit?: number;
679
+ };
680
+ }
681
+ /** Raw WheelSys option on a rate — money still in cents until extras merge. */
682
+ interface QuoteExtraOption {
683
+ code: string;
684
+ name?: string;
685
+ rate: number;
686
+ inclusive?: boolean;
687
+ mandatory?: boolean;
688
+ }
689
+ /** Origin + adapter snapshots from the availability API listing.metadata. */
690
+ interface CarMetadata {
691
+ supplierId: string;
692
+ /** True supplier API record(s) for this vehicle group. */
693
+ origin: Record<string, unknown>[];
694
+ /** Intermediate adapter vehicle shape(s) before ZAR / catalogue enrichment. */
695
+ adapter: Record<string, unknown>[];
696
+ }
697
+ interface Car {
698
+ id: string;
699
+ /** Display make when the supplier model string splits cleanly; otherwise empty. */
700
+ make: string;
701
+ model: string;
702
+ /** Vehicle group / ACRISS class shown as a secondary label (e.g. "A", "MDMR"). */
703
+ trim: string;
704
+ category: string;
705
+ /** Categories this listing's cars belong to. An extra limited to one category is offered only when it matches. */
706
+ categories?: string[];
707
+ seats: number;
708
+ doors: number;
709
+ /** Daily rate in Rand — selected package (defaults to first rate). */
710
+ dailyRate: number;
711
+ /** Full quoted total for the rental window, in Rand. */
712
+ totalRate: number;
713
+ /** Selected rate package's pre-discount daily/total rate - see RatePackage.wasDailyRate. */
714
+ wasDailyRate?: number;
715
+ wasTotalRate?: number;
716
+ /** Security deposit required (ZAR). */
717
+ deposit: number;
718
+ /** Excess / waiver liability (ZAR). */
719
+ liability: number;
720
+ /** Drop-off/one-way fee (ZAR) - see RatePackage.dropOffFee's docblock. */
721
+ dropOffFee: number;
722
+ currency: string;
723
+ kmPerDay: number;
724
+ /** Price of each kilometre over the free allowance, in Rand. Follows the selected cover. */
725
+ excessPerKm?: number;
726
+ image: string;
727
+ featured: boolean;
728
+ location: {
729
+ hub: string;
730
+ city: string;
731
+ };
732
+ insuranceIncluded: boolean;
733
+ /** Provided by the API when free km/day is unlimited (≥ 9999). */
734
+ unlimitedMileage: boolean;
735
+ available: boolean;
736
+ supplier: {
737
+ id?: string;
738
+ name: string;
739
+ logoUrl?: string;
740
+ };
741
+ /** ACRISS / supplier vehicle code — needed later for booking. */
742
+ code?: string;
743
+ /** Selected rate package CDP (updates when the user picks a km package). */
744
+ cdpCode?: string;
745
+ /** Selected rate package's discount-badge flag - see RatePackage.isDiscounted. */
746
+ isDiscounted?: boolean;
747
+ /**
748
+ * Selected rate package's supplier rate identifiers - same "follows the
749
+ * chosen km package" behaviour as `cdpCode` above, and for the same
750
+ * reason: the booking has to be made at the rate the customer was shown,
751
+ * not at whichever package happened to be listed first (see
752
+ * RatePackage.rateNo, and withPackage() in CarCard/helpers.ts).
753
+ */
754
+ rateNo?: string;
755
+ rateSrNo?: string;
756
+ /** Selected rate package's price quote - see RatePackage.quoteRef. */
757
+ quoteRef?: string;
758
+ /** Selected rate package's coverage tier label (updates with the coverage
759
+ * toggle) - see RatePackage.ratePackageLabel. */
760
+ ratePackageLabel: string;
761
+ carGroup?: string;
762
+ luggage?: number;
763
+ pickUpBranch?: string;
764
+ returnBranch?: string;
765
+ rentalDays?: number;
766
+ /** All rate/km packages for this vehicle group. */
767
+ packages: RatePackage[];
768
+ /**
769
+ * Price-quote reference(s) from the availability response - WheelSys
770
+ * returns one per rate and sends it back as QUOTEREF at booking time.
771
+ * Booking uses the first; a supplier that doesn't quote has none.
772
+ */
773
+ quoteIds?: string[];
774
+ /** Origin supplier payloads + adapter snapshots from the API. */
775
+ metadata?: CarMetadata;
776
+ /** Optional — only set when the supplier actually returns them. */
777
+ transmission?: string;
778
+ fuelType?: string;
779
+ year?: number;
780
+ condition?: 'New' | 'Used';
781
+ rating?: number;
782
+ reviewCount?: number;
783
+ instantBook?: boolean;
784
+ availableFrom?: string;
785
+ photoCredit?: string;
786
+ }
787
+
788
+ /**
789
+ * A grey stand-in for a car card while the search runs. It copies the real
790
+ * card's shape so the grid does not jump when the cars arrive.
791
+ */
792
+ declare function CarCardSkeleton(): react_jsx_runtime.JSX.Element;
793
+
794
+ interface CarCardProps {
795
+ car: Car;
796
+ bookingUrl?: string;
797
+ onBook?: (car: Car) => void;
798
+ /** Opens a quote request flow for this vehicle / selected rate package. */
799
+ onQuote?: (car: Car) => void;
800
+ rentalDays?: number;
801
+ priority?: boolean;
802
+ bookLabel?: string;
803
+ className?: string;
804
+ }
805
+ /**
806
+ * One car in the results grid.
807
+ *
808
+ * Identity sits above a short photo: group, body class, name, supplier.
809
+ * Specs are a single icon row. Mileage and cover are compact switches, only
810
+ * when the supplier offered more than one. Price, total and Book now close
811
+ * the card. Every colour comes from the --fb-car-* tokens.
812
+ */
813
+ declare function CarCard({ car, bookingUrl, onBook, onQuote, rentalDays, priority, bookLabel, className, }: CarCardProps): react_jsx_runtime.JSX.Element;
814
+
815
+ /**
816
+ * Grey placeholders shown while the search is running. They have the same
817
+ * shape as the chosen list style, so nothing jumps when the cars arrive.
818
+ * Screen readers hear "Loading cars" once instead of a pile of empty boxes.
819
+ */
820
+ declare function CarListSkeleton({ count, listStyle, className, }: {
821
+ count?: number;
822
+ listStyle?: ListStyle;
823
+ className?: string;
824
+ }): react_jsx_runtime.JSX.Element;
825
+
826
+ interface CarListProps {
827
+ cars: Car[];
828
+ /** Which look to use (see lib/widget.styles.ts). Every look books the same way. */
829
+ listStyle?: ListStyle;
830
+ bookingUrl?: string;
831
+ /** Opens the booking dialog; see CarCard's `onBook`. */
832
+ onBook?: (car: Car) => void;
833
+ /** Quote request for the selected car / rate package. */
834
+ onQuote?: (car: Car) => void;
835
+ /** Forwarded to each card for the estimated total. */
836
+ rentalDays?: number;
837
+ /** Renders a reset action in the empty state when provided. */
838
+ onReset?: () => void;
839
+ bookLabel?: string;
840
+ emptyActionLabel?: string;
841
+ emptyDescription?: string;
842
+ /** `card` (default): a dashed card. `inline`: a centred note without a card, for full-width pages. */
843
+ emptyLayout?: 'card' | 'inline';
844
+ className?: string;
845
+ }
846
+ /**
847
+ * The cars, in the look the site owner chose: grid cards (the default),
848
+ * rows, a compare table, a showcase or rows grouped by class. Each car's
849
+ * choices and booking come from the same offer (CarCard/useCarOffer.ts), so
850
+ * the look never changes what gets booked.
851
+ *
852
+ * The list is its own size container (`@container/list`), so each look fits
853
+ * the width it was given, beside the filter rail or on a full-width page.
854
+ */
855
+ declare function CarList({ cars, listStyle, bookingUrl, onBook, onQuote, rentalDays, onReset, bookLabel, emptyActionLabel, emptyDescription, emptyLayout, className, }: CarListProps): react_jsx_runtime.JSX.Element;
856
+
857
+ /**
858
+ * Filtering, sorting and formatting for the results shortcode — kept out of
859
+ * the components so the whole filter model is readable in one place.
860
+ */
861
+
862
+ interface Filters {
863
+ query: string;
864
+ makes: string[];
865
+ models: string[];
866
+ /** Body class (SMALL / MEDIUM / LARGE / PREMIUM) from supplier specs — not group codes. */
867
+ categories: string[];
868
+ fuels: string[];
869
+ suppliers: string[];
870
+ transmission: 'any' | 'Manual' | 'Automatic';
871
+ condition: 'any' | 'New' | 'Used';
872
+ seats: number | null;
873
+ luggage: number | null;
874
+ priceRange: [number, number];
875
+ yearRange: [number, number];
876
+ location: string;
877
+ availableOnly: boolean;
878
+ instantBook: boolean;
879
+ insuranceIncluded: boolean;
880
+ /**
881
+ * Free kilometres per day: null is any, a number keeps cars with at least
882
+ * that many km per day (unlimited counts as more than any number), and
883
+ * "unlimited" keeps only cars with unlimited km.
884
+ */
885
+ mileage: MileageFilter;
886
+ sort: SortOption;
887
+ }
888
+ type MileageFilter = number | 'unlimited' | null;
889
+ type SortOption = 'recommended' | 'price-asc' | 'price-desc' | 'rating-desc' | 'year-desc';
890
+ declare const DEFAULT_FILTERS: Filters;
891
+ declare function priceBoundsFromCars(cars: Car[]): [number, number];
892
+ declare function formatZAR(amount: number): string;
893
+ interface ActiveChip {
894
+ id: string;
895
+ label: string;
896
+ clear: Partial<Filters>;
897
+ }
898
+ declare function activeChips(filters: Filters, bounds?: {
899
+ price: [number, number];
900
+ year: [number, number] | null;
901
+ }): ActiveChip[];
902
+
903
+ type ArrayKey = 'makes' | 'models' | 'categories' | 'fuels' | 'suppliers';
904
+ interface FilterControlProps {
905
+ cars: Car[];
906
+ filters: Filters;
907
+ priceBounds: [number, number];
908
+ onChange: (patch: Partial<Filters>) => void;
909
+ onToggle: (key: ArrayKey, value: string) => void;
910
+ }
911
+
912
+ /**
913
+ * "Chip bar": one strip of chips above the cars, one chip per filter. A chip
914
+ * opens a small panel with that filter's control. A chip that is in use is
915
+ * filled in and shows a dot, so the customer sees at a glance what is on.
916
+ * On a phone the strip scrolls sideways.
917
+ */
918
+ declare function FilterChipBar({ activeCount, onReset, className, ...props }: FilterControlProps & {
919
+ activeCount: number;
920
+ onReset: () => void;
921
+ className?: string;
922
+ }): react_jsx_runtime.JSX.Element;
923
+ /**
924
+ * "Car type tabs": a big tile for each kind of car (small, SUV, bakkie …)
925
+ * with a photo of its cheapest car, how many there are and the lowest price
926
+ * a day. Choosing a tile shows only that kind; "All cars" shows every car.
927
+ * The chosen tile fills with the brand colour. Nothing is drawn when the
928
+ * cars only come in one kind, as there would be nothing to choose.
929
+ */
930
+ declare function CarTypeTabs({ cars, filters, priceBounds, onChange, className }: FilterControlProps & {
931
+ className?: string;
932
+ }): react_jsx_runtime.JSX.Element | null;
933
+
934
+ interface FilterPanelProps {
935
+ cars: Car[];
936
+ filters: Filters;
937
+ priceBounds: [number, number];
938
+ activeCount: number;
939
+ onChange: (patch: Partial<Filters>) => void;
940
+ onToggle: (key: ArrayKey, value: string) => void;
941
+ onReset: () => void;
942
+ }
943
+ /**
944
+ * The filter rail: a heading with a "Clear" button, then one block per
945
+ * filter (price, gearbox, supplier, category, fuel, free km, seats, bags). Category chips are body classes from the API
946
+ * (SMALL / MEDIUM / …), never supplier group codes. The filters themselves
947
+ * live in FilterControls, shared with the other filter looks.
948
+ */
949
+ declare function FilterPanel({ cars, filters, priceBounds, activeCount, onChange, onToggle, onReset }: FilterPanelProps): react_jsx_runtime.JSX.Element;
950
+
951
+ /**
952
+ * Shared transport for every `*.queries.ts` file: all of them talk to
953
+ * FleetBridge the same way - send an action + fields through the transport
954
+ * the host set on FleetBridgeProvider (see transport.ts) and read back `{ success, data }` /
955
+ * `{ success: false, data: { message } }`.
956
+ *
957
+ * Before this, `extras.queries.ts` and `booking.queries.ts` each duplicated
958
+ * that POST-and-parse dance with slightly different error copy and no
959
+ * shared logging. Subclassing this gets every query the same "site not
960
+ * connected" / "couldn't reach the site" messages and the same
961
+ * `console.log`/`console.error` shape, so a network tab or console filtered
962
+ * on "[FleetBridge]" reads consistently across every query.
963
+ */
964
+
965
+ declare abstract class BaseQuery {
966
+ /**
967
+ * Sends `action` + `fields` through the transport, which normalizes
968
+ * every possible outcome - unconfigured site, network failure, non-2xx
969
+ * response, `{success: false}` - into one `QueryResult`, so subclasses
970
+ * never branch on `response.ok` vs `payload.success` vs a thrown error
971
+ * differently from each other.
972
+ */
973
+ protected post<T>(action: string, fields?: Record<string, string>): Promise<QueryResult<T>>;
974
+ }
975
+
976
+ /**
977
+ * The add-on shape the booking wizard's first step renders. Populated live,
978
+ * per car/supplier, by lib/queries/extras.queries.ts (which calls the real
979
+ * adapter - apps/api/src/handlers/suppliers/extras.ts - via the WordPress
980
+ * plugin).
981
+ * There is no static/placeholder list here: a supplier with nothing to
982
+ * offer (or whose adapter doesn't implement getExtras yet) simply has no
983
+ * extras, rather than falling back to invented ones.
984
+ *
985
+ * Prices are in the same currency as the vehicle's daily rate (ZAR).
986
+ *
987
+ * Billing mirrors carhire's `serviceType` / `priceType`:
988
+ * - Per Day → `perDay` (× rental days × quantity)
989
+ * - Per Unit → `onceOff` (× quantity; Quant=true on Sani)
990
+ * - Per Rental → `onceOff` (× 1; Quant=false on Sani)
991
+ * - Per Trip / Per Kilometer / WAIVERS & EXTRAS → `onceOff`
992
+ */
993
+ /** Charge basis labels shown on the card — same set carhire's ExtraOptionItem uses. */
994
+ type ExtraServiceType = 'Per Unit' | 'Per Rental' | 'Per Day' | 'Per Trip' | 'Per Kilometer' | 'WAIVERS & EXTRAS';
995
+ interface Extra {
996
+ /** Supplier extra code, sent verbatim in the booking payload. */
997
+ code: string;
998
+ name: string;
999
+ /** Optional longer blurb; charge basis lives on `serviceType`. */
1000
+ description?: string;
1001
+ /**
1002
+ * How the supplier bills this extra (Per Unit / Per Rental / Per Day / …).
1003
+ * Drives the badge and whether `perDay` or `onceOff` is set.
1004
+ */
1005
+ serviceType: ExtraServiceType;
1006
+ /** Charged for every rental day. Mutually exclusive with `onceOff`. */
1007
+ perDay?: number;
1008
+ /** Charged once for the rental (× quantity for Per Unit). */
1009
+ onceOff?: number;
1010
+ /** Above 1, the card gets a quantity stepper (Per Unit). */
1011
+ maxQuantity: number;
1012
+ icon: 'shield' | 'tyre' | 'child' | 'driver' | 'gps' | 'wifi' | 'delivery' | 'document';
1013
+ /** Surfaced first, with a "Popular" chip. Set client-side via isPopularExtra. */
1014
+ recommended?: boolean;
1015
+ /**
1016
+ * True when `perDay`/`onceOff` is a placeholder, not a real price - e.g.
1017
+ * Bluu's extras-listing endpoint never carries pricing at all (see
1018
+ * BluuAdapter.parseExtrasResponse's docblock), so every Bluu extra starts
1019
+ * this way until BookingWizard's setQuantity live-quotes it. Lets the UI
1020
+ * show "priced once selected" instead of a misleading R0,00.
1021
+ */
1022
+ priceUnknown?: boolean;
1023
+ }
1024
+ /** Selected add-ons, keyed by code. Absent or 0 means not selected. */
1025
+ type ExtraSelection = Record<string, number>;
1026
+
1027
+ /**
1028
+ * What the booking wizard collects and what it costs: driver validation and
1029
+ * the rental/add-ons quote. Submission (posting the finished request to
1030
+ * WordPress) lives in lib/queries/booking.queries.ts.
1031
+ */
1032
+
1033
+ interface Driver {
1034
+ title: string;
1035
+ firstName: string;
1036
+ lastName: string;
1037
+ email: string;
1038
+ phone: string;
1039
+ licenceNumber: string;
1040
+ notes: string;
1041
+ /** Defaults to 'South Africa' - drives the phone dial-code prefix and the
1042
+ * ID-number field's label ("SA ID number" vs "Passport number"). */
1043
+ country: string;
1044
+ /** SA ID number or passport number, label driven by `country` above. */
1045
+ idNumber: string;
1046
+ crossingBorder: boolean;
1047
+ streetAddress: string;
1048
+ city: string;
1049
+ suburb: string;
1050
+ province: string;
1051
+ postalCode: string;
1052
+ /** Optional second recipient for the booking confirmation. */
1053
+ additionalEmail: string;
1054
+ }
1055
+ declare const EMPTY_DRIVER: Driver;
1056
+ interface QuoteLine {
1057
+ id: string;
1058
+ label: string;
1059
+ /** Sub-label: how the amount was arrived at. */
1060
+ detail?: string;
1061
+ amount: number;
1062
+ }
1063
+ interface QuoteNote {
1064
+ label: string;
1065
+ value: string;
1066
+ }
1067
+ interface Quote {
1068
+ days: number;
1069
+ lines: QuoteLine[];
1070
+ /** Things that will change the price but that this bundle can't put a number on. */
1071
+ notes: QuoteNote[];
1072
+ extrasTotal: number;
1073
+ total: number;
1074
+ /** Refundable card hold, not a charge - see PriceSummary's "Funds needed on card". */
1075
+ deposit: number;
1076
+ /** What the driver owes if the car is damaged. Not added to the rental price. */
1077
+ excess: number;
1078
+ }
1079
+
1080
+ /**
1081
+ * Paying online for one of the site's own cars.
1082
+ *
1083
+ * The site's own cars can be paid for online (Paystack, Stitch or PayFast)
1084
+ * or at the branch, depending on the payment methods staff set up in the
1085
+ * admin (Fleets, Payment methods). This file talks to the WordPress plugin's
1086
+ * three public endpoints for that (Controllers\ActionController):
1087
+ *
1088
+ * - methods(): the ways a customer may pay at a pick-up branch. An empty
1089
+ * list means the booking wizard shows no payment step.
1090
+ * - start(): tries the payment again for a booking that waits for one,
1091
+ * and gives back the payment page's address.
1092
+ * - verify(): asks how the payment went when the customer comes back from
1093
+ * the payment page. Once it is paid, the booking is confirmed.
1094
+ *
1095
+ * Payment cards are never typed into this site. The customer pays on the
1096
+ * payment company's own page, and the keys for that company never reach the
1097
+ * browser.
1098
+ */
1099
+
1100
+ type PaymentPurpose = 'FULL' | 'DEPOSIT';
1101
+ /**
1102
+ * The booking wizard as it was when the customer left for the payment page.
1103
+ * When they come back, the results page opens the same wizard again with
1104
+ * it, so they see the normal confirmation step (see ResultsPage).
1105
+ */
1106
+ interface WizardSnapshot {
1107
+ car: Car;
1108
+ criteria: SearchCriteria;
1109
+ days: number;
1110
+ driver: Driver;
1111
+ selection: ExtraSelection;
1112
+ }
1113
+ /** What was chosen before going to the payment page, so the page can carry on when the customer comes back. */
1114
+ interface RememberedPayment {
1115
+ token: string;
1116
+ methodId: string;
1117
+ purpose: PaymentPurpose;
1118
+ supplier: string;
1119
+ wizard?: WizardSnapshot;
1120
+ }
1121
+
1122
+ /**
1123
+ * Submits the booking wizard's booking to WordPress, which makes the real
1124
+ * reservation with the supplier.
1125
+ *
1126
+ * The call still goes through admin-ajax rather than straight to
1127
+ * FleetBridge, and for the original reason: creating a reservation needs the
1128
+ * account's API key plus the supplier's own credentials in the request body
1129
+ * (see apps/api/src/handlers/suppliers/booking.ts), and neither may ever
1130
+ * live in front-end JavaScript. What changed is what the PHP handler does
1131
+ * with the payload - it used to record an enquiry and fire an action for a
1132
+ * site to forward itself; it now records the attempt in the tenant
1133
+ * `Bookings` table and books it (see Frontend\BookingController).
1134
+ *
1135
+ * So the fields below carry everything the reservation needs and nothing the
1136
+ * browser could be trusted to decide: the supplier's adapter identifier and
1137
+ * pre-resolved branch codes, the vehicle group, and the rate/quote/CDP
1138
+ * references from the search - all values FleetBridge itself produced. The
1139
+ * handler re-resolves credentials and the active CDP code server-side.
1140
+ */
1141
+
1142
+ interface BookingRequest {
1143
+ car: Car;
1144
+ criteria: SearchCriteria;
1145
+ driver: Driver;
1146
+ selection: ExtraSelection;
1147
+ /** Whichever catalogue `selection`'s codes were chosen from - live or static. */
1148
+ extras: Extra[];
1149
+ days: number;
1150
+ total: number;
1151
+ /**
1152
+ * The resolved one-way drop-off fee, if any - `quoteFor`'s own
1153
+ * `liveDropOffFee ?? car.dropOffFee` (see BookingWizard, which already
1154
+ * computed this for the price breakdown the customer sees). Persisted on
1155
+ * BookingRate, not folded into `extras` - see that field's own note in
1156
+ * `bookingRequestFields` below.
1157
+ */
1158
+ dropOffFee?: number | null;
1159
+ /** `quoteFor`'s refundable deposit (Quote.deposit) - PriceSummary's "Funds
1160
+ * needed on card", persisted on BookingRate alongside the drop-off fee. */
1161
+ deposit?: number | null;
1162
+ /** The published terms version shown on the review step, when this supplier has one. */
1163
+ terms?: {
1164
+ id: string;
1165
+ version: number;
1166
+ } | null;
1167
+ /** How the customer pays, for the site's own cars (see payment.queries.ts). */
1168
+ payment?: {
1169
+ methodId: string;
1170
+ purpose: PaymentPurpose;
1171
+ } | null;
1172
+ }
1173
+ /**
1174
+ * A booking of the site's own cars that is paid online. It is not confirmed
1175
+ * yet: the customer goes to the payment page first (redirectUrl). When the
1176
+ * page could not be opened, paymentError says why, and the token lets the
1177
+ * customer try again.
1178
+ */
1179
+ interface PendingPayment {
1180
+ token: string;
1181
+ redirectUrl?: string;
1182
+ error?: string;
1183
+ }
1184
+ /** A confirmed reservation, as the confirmation step shows it. */
1185
+ interface ConfirmedBooking {
1186
+ /**
1187
+ * The supplier's booking number - the only id THEY know this booking by,
1188
+ * and so the one the customer quotes at the desk.
1189
+ */
1190
+ reservationId: string;
1191
+ /**
1192
+ * FleetBridge's own PIN for the booking. Paired with the booking number
1193
+ * it finds the booking on FleetBridge's side (the admin Bookings
1194
+ * tab searches on it); the supplier has no idea what it is.
1195
+ */
1196
+ bookingPin: string;
1197
+ supplier: string;
1198
+ /**
1199
+ * Tenant / FleetBridge booking reference (`fb-booking-{uuid}`), generated
1200
+ * before the supplier was called. Deliberately NOT displayed to customers.
1201
+ */
1202
+ reference: string;
1203
+ /**
1204
+ * The tenant Customer row this booking was recorded against (see
1205
+ * BookingController's upsert_customer call). Used to remember "this
1206
+ * device belongs to this customer" for a return visit - see
1207
+ * store/customerStore.ts.
1208
+ */
1209
+ customerId?: string;
1210
+ /** Set when the booking still has to be paid online. The booking number arrives once it is paid. */
1211
+ payment?: PendingPayment;
1212
+ }
1213
+ type BookingResult = ({
1214
+ ok: true;
1215
+ } & ConfirmedBooking) | {
1216
+ ok: false;
1217
+ error: string;
1218
+ /**
1219
+ * Present when the attempt was recorded before it failed - the normal
1220
+ * case, since the row is written before the supplier is called. Worth
1221
+ * showing: a failed attempt has no reservation number, so this is the
1222
+ * only handle on it, including when the reservation did in fact get
1223
+ * created upstream.
1224
+ */
1225
+ bookingPin?: string;
1226
+ };
1227
+ /**
1228
+ * "Request a quote" never makes a reservation - see Tenant\Quote's own
1229
+ * docblock (WordPress plugin) for why the request is emailed rather than
1230
+ * booked immediately. Deliberately not `BookingResult`: there is no
1231
+ * reservation number/PIN/supplier to show on success, only confirmation
1232
+ * that the email went out.
1233
+ */
1234
+ type QuoteRequestResult = {
1235
+ ok: true;
1236
+ message?: string;
1237
+ } | {
1238
+ ok: false;
1239
+ error: string;
1240
+ };
1241
+ declare class BookingQueries extends BaseQuery {
1242
+ /**
1243
+ * Posts the booking to WordPress. Also dispatches
1244
+ * `fleetbridge:booking-requested` either way, so a theme that would rather
1245
+ * handle bookings itself can listen instead.
1246
+ */
1247
+ submitBooking(request: BookingRequest): Promise<BookingResult>;
1248
+ /**
1249
+ * Posts a "Request a quote" - same fields as `submitBooking()` (it's the
1250
+ * same wizard, just ending here instead of at "Confirm booking"), but
1251
+ * WordPress records it as a Quote and emails it rather than calling the
1252
+ * supplier - see Tenant\Quote's own docblock. Dispatches
1253
+ * `fleetbridge:quote-requested`, the quote-mode counterpart of
1254
+ * `fleetbridge:booking-requested` above.
1255
+ */
1256
+ requestQuote(request: BookingRequest): Promise<QuoteRequestResult>;
1257
+ /** The terms version this supplier's customers agree to now. Null when none is published. */
1258
+ supplierTerms(identifier: string): Promise<{
1259
+ id: string;
1260
+ version: number;
1261
+ html: string;
1262
+ } | null>;
1263
+ }
1264
+ declare const bookingQueries: BookingQueries;
1265
+
1266
+ type ManagedBookingStatus = 'PENDING' | 'CONFIRMED' | 'PICKED_UP' | 'RETURNED' | 'CANCELLED' | 'RECONCILED' | 'NO_SHOW';
1267
+ /** One selected add-on, as `BookingExtra` rows come back formatted. */
1268
+ interface ManagedBookingExtra {
1269
+ code: string;
1270
+ name: string;
1271
+ quantity: number;
1272
+ unitPrice: number | null;
1273
+ currency: string;
1274
+ }
1275
+ interface ManagedBookingVehicle {
1276
+ group: string | null;
1277
+ name: string | null;
1278
+ image: string | null;
1279
+ supplierLogo: string | null;
1280
+ seats: number | null;
1281
+ doors: number | null;
1282
+ transmission: string | null;
1283
+ fuelType: string | null;
1284
+ insuranceIncluded: boolean | null;
1285
+ ratePackageLabel: string | null;
1286
+ unlimitedMileage?: boolean | null;
1287
+ kmPerDay?: number | null;
1288
+ }
1289
+ interface ManagedBookingCustomer {
1290
+ name: string | null;
1291
+ firstName?: string | null;
1292
+ lastName?: string | null;
1293
+ title?: string | null;
1294
+ email: string | null;
1295
+ additionalEmail?: string | null;
1296
+ phone: string | null;
1297
+ dialCode?: string | null;
1298
+ idNumber?: string | null;
1299
+ idType?: string | null;
1300
+ licenseNumber?: string | null;
1301
+ country?: string | null;
1302
+ streetAddress?: string | null;
1303
+ suburb?: string | null;
1304
+ city?: string | null;
1305
+ province?: string | null;
1306
+ postalCode?: string | null;
1307
+ }
1308
+ /**
1309
+ * Matches ActionController::booking_view()'s shape -
1310
+ * that method redacts BookingStore::format_row()'s output down to this
1311
+ * (stripping only a handful of internal-only keys) rather than re-listing
1312
+ * every field, so this type is the same "whatever format_row() returns,
1313
+ * minus a short deny-list" contract, not a hand-picked subset.
1314
+ */
1315
+ interface ManagedBooking {
1316
+ supplierRef: string | null;
1317
+ status: ManagedBookingStatus;
1318
+ supplierStatus: string | null;
1319
+ failureReason: string | null;
1320
+ supplierName: string | null;
1321
+ vehicle: ManagedBookingVehicle;
1322
+ pickupLocation: string | null;
1323
+ dropoffLocation: string | null;
1324
+ pickupDate: string | null;
1325
+ dropoffDate: string | null;
1326
+ rentalDays: number | null;
1327
+ extras: ManagedBookingExtra[];
1328
+ totalPrice: number;
1329
+ currency: string;
1330
+ customer: ManagedBookingCustomer;
1331
+ cdpCode: string | null;
1332
+ quoteRef: string | null;
1333
+ rateId: string | null;
1334
+ /** Adapter identifier ("hertz", "bluu", …) — amend re-search is locked to this supplier. */
1335
+ supplierIdentifier: string | null;
1336
+ crossBorder: boolean;
1337
+ notes: string | null;
1338
+ source: string | null;
1339
+ cancelledAt: string | null;
1340
+ cancellationReason: string | null;
1341
+ createdAt: string | null;
1342
+ /** Both gate on `status === 'CONFIRMED'` server-side - see customer_view(). */
1343
+ canCancel: boolean;
1344
+ canAmend: boolean;
1345
+ }
1346
+ interface QuotedQuote {
1347
+ quoteRef: string;
1348
+ status: 'PENDING' | 'CONFIRMED' | 'EXPIRED' | 'CANCELLED';
1349
+ expiresAt: string | null;
1350
+ supplierName: string | null;
1351
+ vehicle: ManagedBookingVehicle;
1352
+ pickupLocation: string | null;
1353
+ dropoffLocation: string | null;
1354
+ pickupDate: string | null;
1355
+ dropoffDate: string | null;
1356
+ rentalDays: number | null;
1357
+ extras: ManagedBookingExtra[];
1358
+ priceBreakdown: {
1359
+ label: string;
1360
+ amount: number;
1361
+ }[];
1362
+ totalPrice: number;
1363
+ currency: string;
1364
+ deposit: number | null;
1365
+ customer: ManagedBookingCustomer;
1366
+ notes: string | null;
1367
+ crossBorder?: boolean;
1368
+ }
1369
+ /** The flat shape `ajax_confirm_quote()` returns on success - the same
1370
+ * create-booking result shape a fresh booking gets, not a full `ManagedBooking`
1371
+ * (that needs a follow-up `lookup()` call - see ManageBooking's own confirm-quote effect). */
1372
+ interface ConfirmedQuoteBooking {
1373
+ reference: string;
1374
+ reservationId: string;
1375
+ bookingPin: string;
1376
+ supplier: string;
1377
+ status: string;
1378
+ customerId?: string;
1379
+ }
1380
+ declare class BookingManagementQueries extends BaseQuery {
1381
+ lookup(reservationNumber: string, bookingPin: string): Promise<QueryResult<{
1382
+ booking: ManagedBooking;
1383
+ }>>;
1384
+ cancel(reservationNumber: string, bookingPin: string, reason: string): Promise<QueryResult<{
1385
+ booking: ManagedBooking;
1386
+ }>>;
1387
+ /**
1388
+ * Load a pending quote for review. The email link calls this first; Book
1389
+ * on that screen then calls `confirmQuote()`.
1390
+ */
1391
+ lookupQuote(token: string): Promise<QueryResult<{
1392
+ quote: QuotedQuote;
1393
+ }>>;
1394
+ /**
1395
+ * Turns a pending Quote into a real reservation after the customer has
1396
+ * reviewed it and clicked Book. The caller still needs its own `lookup()`
1397
+ * afterwards for the full `ManagedBooking` shape the rest of this drawer
1398
+ * expects.
1399
+ */
1400
+ confirmQuote(token: string): Promise<QueryResult<ConfirmedQuoteBooking>>;
1401
+ /**
1402
+ * Re-search submit: same payload as a new booking, plus the reservation
1403
+ * number + PIN that prove ownership. If the supplier doesn't support
1404
+ * amending online (AdapterCapabilities.amendBooking), this fails with a
1405
+ * plain message rather than a structured code.
1406
+ */
1407
+ amend(reservationNumber: string, bookingPin: string, request: BookingRequest): Promise<(BookingResult & {
1408
+ booking?: ManagedBooking;
1409
+ })>;
1410
+ }
1411
+ declare const bookingManagementQueries: BookingManagementQueries;
1412
+
1413
+ interface BookingWizardProps {
1414
+ /** The car being booked; `null` closes the wizard. */
1415
+ car: Car | null;
1416
+ criteria: SearchCriteria;
1417
+ days: number;
1418
+ onClose: () => void;
1419
+ /** Opens the results page's Modify search drawer when dates are missing. */
1420
+ onEditSearch: () => void;
1421
+ /**
1422
+ * When set, submit amends this reservation instead of creating one —
1423
+ * same extras → driver → review path, locked to the original supplier.
1424
+ */
1425
+ amend?: {
1426
+ reservationNumber: string;
1427
+ bookingPin: string;
1428
+ driverPrefill?: Partial<Driver>;
1429
+ onComplete?: (booking: ManagedBooking) => void;
1430
+ };
1431
+ /**
1432
+ * 'quote' walks the exact same add-ons → driver → review path as a normal
1433
+ * booking, but the final step emails the priced request instead of
1434
+ * reserving it immediately - see Tenant\Quote's own docblock (WordPress
1435
+ * plugin) for why. Ignored when `amend` is set (an amend is never quoted).
1436
+ * Defaults to 'book'.
1437
+ */
1438
+ mode?: 'book' | 'quote';
1439
+ /**
1440
+ * Back from the payment page (paying online for one of the site's own
1441
+ * cars): the wizard as it was, and the payment to check. The wizard opens
1442
+ * on its review step, checks the payment, and moves to the normal
1443
+ * confirmation step once the booking is confirmed.
1444
+ */
1445
+ resumePayment?: RememberedPayment & {
1446
+ wizard: WizardSnapshot;
1447
+ };
1448
+ }
1449
+ /**
1450
+ * Full-screen booking bottom sheet: add-ons -> driver -> review -> confirmation.
1451
+ *
1452
+ * A sheet rather than a page or a second shortcode, because the shortcode
1453
+ * can't assume the host theme has a booking route, and coming back lands on the
1454
+ * same filtered results. Full-screen rather than a centred panel because by the
1455
+ * review step there are four things to hold at once - vehicle, window, add-ons,
1456
+ * price - and a modal that scrolls all of them inside 40rem buries the summary.
1457
+ *
1458
+ * Add-ons come first on purpose: they change the total, and the total is what
1459
+ * someone decides on. Asking for a name before showing the real number gets the
1460
+ * form abandoned.
1461
+ */
1462
+ declare function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode, resumePayment }: BookingWizardProps): react_jsx_runtime.JSX.Element | null;
1463
+
1464
+ interface BookingConfirmationProps {
1465
+ car: Car;
1466
+ driver: Driver;
1467
+ quote: Quote;
1468
+ pickupLocation: string;
1469
+ dropoffLocation: string;
1470
+ pickupDate: string;
1471
+ pickupTime: string;
1472
+ dropoffDate: string;
1473
+ dropoffTime: string;
1474
+ supplierName: string;
1475
+ /** The supplier's reservation number. */
1476
+ bookingNumber: string;
1477
+ /** Our own PIN for the booking. */
1478
+ pin: string;
1479
+ /** The card hold at the counter, in rand. */
1480
+ depositAmount: number;
1481
+ /** Set when an existing booking was changed rather than a new one made. */
1482
+ amendedNumber?: string;
1483
+ /** True when the customer paid online as part of booking. */
1484
+ paysOnline?: boolean;
1485
+ onClose: () => void;
1486
+ }
1487
+ /**
1488
+ * The last step of the booking: "you're all set".
1489
+ *
1490
+ * The good news first: a short hello and the rental pass, a ticket in the
1491
+ * site's brand colour with the trip, the car and the two numbers. Then three
1492
+ * "what now" steps, and below them the record of the booking (add-ons,
1493
+ * driver, notes) beside the money and how to change it. This page is the
1494
+ * only record the customer has until the supplier's own email lands, so it
1495
+ * can also be saved as a PDF receipt (see ConfirmationReceipt).
1496
+ *
1497
+ * It only shows what it is given, so the admin preview (see
1498
+ * ConfirmationPreview) can draw it with a made-up booking.
1499
+ */
1500
+ declare function BookingConfirmation({ car, driver, quote, pickupLocation, dropoffLocation, pickupDate, pickupTime, dropoffDate, dropoffTime, supplierName, bookingNumber, pin, depositAmount, amendedNumber, paysOnline, onClose, }: BookingConfirmationProps): react_jsx_runtime.JSX.Element;
1501
+
1502
+ declare const BOOKING_STEPS: readonly [{
1503
+ readonly id: "extras";
1504
+ readonly label: "Add-ons";
1505
+ readonly hint: "Cover and equipment";
1506
+ }, {
1507
+ readonly id: "driver";
1508
+ readonly label: "Driver";
1509
+ readonly hint: "Who is driving";
1510
+ }, {
1511
+ readonly id: "payment";
1512
+ readonly label: "Payment";
1513
+ readonly hint: "How you pay";
1514
+ }, {
1515
+ readonly id: "review";
1516
+ readonly label: "Review";
1517
+ readonly hint: "Check and send";
1518
+ }, {
1519
+ readonly id: "done";
1520
+ readonly label: "Done";
1521
+ readonly hint: "Booking confirmed";
1522
+ }];
1523
+ type BookingStep = (typeof BOOKING_STEPS)[number];
1524
+ /**
1525
+ * The form steps one booking walks through, in order. The confirmation
1526
+ * ("done") is not a form step. The payment step is only there when the
1527
+ * customer chooses how to pay (the site's own cars with payment methods).
1528
+ */
1529
+ declare function formSteps(withPayment: boolean): BookingStep[];
1530
+ interface BookingStepsProps {
1531
+ /** The position of the current step in `steps`. */
1532
+ current: number;
1533
+ /** The steps to show. Defaults to the usual three (no payment step). */
1534
+ steps?: BookingStep[];
1535
+ /** Only completed steps are clickable; omit to make the indicator read-only. */
1536
+ onStepClick?: (index: number) => void;
1537
+ className?: string;
1538
+ }
1539
+ /**
1540
+ * The slim "where am I" row at the top of the booking flow: a small
1541
+ * numbered circle per step, joined by hairlines that fill in as each step
1542
+ * is done.
1543
+ *
1544
+ * - A finished step shows a tick and can be clicked to go back to it.
1545
+ * - The current step is filled with the "selected" colour.
1546
+ * - Steps still to come are an empty outline.
1547
+ *
1548
+ * On a phone only the current step's name is shown next to its circle, so
1549
+ * the row never gets squashed; from `sm` up every step shows its name.
1550
+ */
1551
+ declare function BookingSteps({ current, steps, onStepClick, className }: BookingStepsProps): react_jsx_runtime.JSX.Element;
1552
+
1553
+ interface LookupFormProps {
1554
+ onFound: (reservationNumber: string, bookingPin: string, booking: ManagedBooking) => void;
1555
+ /** Seeds the fields from a `#manage=booking&id=&pin=` deep link (see
1556
+ * ManageBooking's own effect) - filled in even though that link tries the
1557
+ * lookup automatically, so a failed auto-lookup (typo'd link, expired PIN)
1558
+ * lands here with the values already in place to correct rather than
1559
+ * empty. */
1560
+ defaultReservationNumber?: string;
1561
+ defaultBookingPin?: string;
1562
+ /** The deep-link auto-lookup's own failure message, shown once up front. */
1563
+ initialError?: string | null;
1564
+ /**
1565
+ * The look (see lib/widget.styles.ts): 'card' is the small card in the
1566
+ * pop-up, 'banner' a band of brand colour with the fields in one bar,
1567
+ * 'help' the form beside a picture of the email that shows where the two
1568
+ * numbers are. The fields and what they do are the same in every look.
1569
+ */
1570
+ look?: FindStyle;
1571
+ }
1572
+ /**
1573
+ * The only "authentication" this shortcode has: the supplier's reservation
1574
+ * number + PIN a customer was given when they booked - the same pair shown
1575
+ * on the booking wizard's own confirmation step (see BookingWizard/index.tsx's
1576
+ * `done` branch), not FleetBridge's internal `bookingRef` (deliberately never
1577
+ * shown there, so it can't be what's asked for here either). Deliberately
1578
+ * doesn't say which of the two was wrong on a failed lookup - see
1579
+ * ActionController::LOOKUP_ERROR - so the server-side failure is
1580
+ * surfaced as a form-level (`root`) error, not attached to either field.
1581
+ */
1582
+ declare function LookupForm({ onFound, defaultReservationNumber, defaultBookingPin, initialError, look }: LookupFormProps): react_jsx_runtime.JSX.Element;
1583
+
1584
+ interface RevealProps {
1585
+ children: ReactNode;
1586
+ className?: string;
1587
+ as?: ElementType;
1588
+ /** Animates direct children in sequence instead of the container itself. */
1589
+ stagger?: boolean;
1590
+ delay?: number;
1591
+ /** Gates the fade on scrolling into view; omit to run on mount. */
1592
+ onScroll?: boolean;
1593
+ }
1594
+ /**
1595
+ * Mount fade, so a block doesn't pop in at full opacity while React hydrates.
1596
+ * The container renders with `.fb-hidden`; in stagger mode it is un-hidden
1597
+ * immediately and its children carry the fade.
1598
+ */
1599
+ declare function Reveal({ children, className, as: Tag, stagger, delay, onScroll, }: RevealProps): react_jsx_runtime.JSX.Element;
1600
+
1601
+ /**
1602
+ * The props of @fleetbridge/components' Button, spelled out here so the
1603
+ * package's published types don't have to point into that private package.
1604
+ * Keep in step with components/ui/button.tsx.
1605
+ */
1606
+ type ButtonProps = ComponentProps<'button'> & {
1607
+ variant?: 'default' | 'outline' | 'secondary' | 'ghost' | 'destructive' | 'link' | null;
1608
+ size?: 'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-xs' | 'icon-sm' | 'icon-lg' | null;
1609
+ asChild?: boolean;
1610
+ };
1611
+
1612
+ /**
1613
+ * The main "go on" button (Continue, Confirm booking, Find booking...).
1614
+ *
1615
+ * It uses the site's brand colour with its matching text colour, so the
1616
+ * words on it are always easy to read. A soft shadow lifts it off the page,
1617
+ * a keyboard ring shows where focus is, and it dips a tiny bit when pressed
1618
+ * so people can feel the click.
1619
+ */
1620
+ declare function CtaButton({ className, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
1621
+
1622
+ /**
1623
+ * A quiet, outlined pill for second-choice actions (Back, Close, Modify
1624
+ * search). It stays calm so the main button next to it is the one that
1625
+ * stands out.
1626
+ */
1627
+ declare function GhostPill({ className, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
1628
+
1629
+ /** A small, spaced-out capital-letter label that sits above a heading. */
1630
+ declare function Eyebrow({ children, className }: {
1631
+ children: ReactNode;
1632
+ className?: string;
1633
+ }): react_jsx_runtime.JSX.Element;
1634
+
1635
+ /**
1636
+ * Segmented control for facets with two or three mutually exclusive options -
1637
+ * cheaper to scan than a select, and it shows the alternatives without a click.
1638
+ *
1639
+ * The active pill is one shared-layout element (framer-motion `layoutId`)
1640
+ * that slides between options rather than each button toggling its own
1641
+ * background - `useId()` scopes the layoutId per rendered instance, so two
1642
+ * Segmented controls on the same page (e.g. one per card in a grid) never
1643
+ * animate against each other.
1644
+ */
1645
+ declare function Segmented<T extends string | number | null>({ options, value, onChange, className,
1646
+ /** Track, buttons and the sliding pill all share one radius so the pill
1647
+ * never looks like it's escaping a squarer or rounder track underneath. */
1648
+ radiusClassName,
1649
+ /** Pill background - defaults to a neutral raised look, but e.g. CarCard's
1650
+ * rate tabs pass `bg-primary` to match its "Book now" button, so the
1651
+ * selected rate reads as the same kind of affirmative choice. */
1652
+ activeBgClassName,
1653
+ /** Active label colour, paired with `activeBgClassName` above. */
1654
+ activeTextClassName,
1655
+ /** Equal-width columns (the default) only work while there are few, short
1656
+ * options - a facet whose length varies at runtime (CarCard's rate
1657
+ * packages: "100 km/d" through "Unlimited") needs each tab sized to its
1658
+ * own text instead, with the row scrolling if they don't all fit. */
1659
+ scrollable, itemClassName, }: {
1660
+ options: {
1661
+ value: T;
1662
+ label: string;
1663
+ count?: number;
1664
+ tooltip?: string;
1665
+ disabled?: boolean;
1666
+ }[];
1667
+ value: T;
1668
+ onChange: (value: T) => void;
1669
+ className?: string;
1670
+ radiusClassName?: string;
1671
+ activeBgClassName?: string;
1672
+ activeTextClassName?: string;
1673
+ scrollable?: boolean;
1674
+ /** Extra classes on each option, for a shorter control. */
1675
+ itemClassName?: string;
1676
+ }): react_jsx_runtime.JSX.Element;
1677
+
1678
+ /**
1679
+ * A row of round pills where only one can be on at a time (for example
1680
+ * "Any / 2 / 4 / 5 seats"). The chosen pill is filled with the filter's
1681
+ * "active" colour and its matching text colour; the others use the quiet
1682
+ * "idle" pair and get a soft outline when the pointer is over them.
1683
+ */
1684
+ declare function PillGroup<T extends string | number | null>({ options, value, onChange, className, }: {
1685
+ options: {
1686
+ value: T;
1687
+ label: string;
1688
+ }[];
1689
+ value: T;
1690
+ onChange: (value: T) => void;
1691
+ className?: string;
1692
+ }): react_jsx_runtime.JSX.Element;
1693
+
1694
+ /**
1695
+ * Multi-select facet row: label left, count right, whole row clickable.
1696
+ * Reads as a list rather than a pill cloud, which keeps a long facet (brands,
1697
+ * body types) scannable top-to-bottom.
1698
+ */
1699
+ declare function FacetRow({ label, count, active, onClick, }: {
1700
+ label: string;
1701
+ count?: number;
1702
+ active: boolean;
1703
+ onClick: () => void;
1704
+ }): react_jsx_runtime.JSX.Element;
1705
+
1706
+ interface BookingStepperItem {
1707
+ icon: LucideIcon;
1708
+ /** Small uppercase label above the value, e.g. "Pick-up". */
1709
+ label: string;
1710
+ /** The value itself, e.g. a location name or "12 Sep, 10:00". */
1711
+ title: string;
1712
+ subtitle?: string;
1713
+ /** Small pills under the value, e.g. vehicle specs. */
1714
+ tags?: string[];
1715
+ onEdit?: () => void;
1716
+ }
1717
+ /**
1718
+ * A vertical, connected sequence of booking facts - one icon-badged step per
1719
+ * card, joined by a line, each editable in place. Replaces a flat list of
1720
+ * label/value rows for exactly the same reason a real itinerary reads better
1721
+ * as a timeline than a table: pick-up, dates, and vehicle are steps in one
1722
+ * booking, not unrelated fields, and this is what makes that order visible.
1723
+ */
1724
+ declare function BookingStepper({ items, className }: {
1725
+ items: BookingStepperItem[];
1726
+ className?: string;
1727
+ }): react_jsx_runtime.JSX.Element;
1728
+
1729
+ /**
1730
+ * A simple bar that shows how far along a booking is (booked, picked up,
1731
+ * returned). It is a status read-out, not a loading spinner.
1732
+ *
1733
+ * The bar is filled with the "selected" colour on a light track, and the
1734
+ * label and number sit above it in normal text colours, so the words are
1735
+ * easy to read whatever brand colour the site uses.
1736
+ */
1737
+ declare function BookingProgress({ label, percent, className, }: {
1738
+ label: string;
1739
+ percent: number;
1740
+ className?: string;
1741
+ }): react_jsx_runtime.JSX.Element;
1742
+
1743
+ declare function LooksProvider({ looks, children }: {
1744
+ looks: Looks;
1745
+ children: ReactNode;
1746
+ }): react_jsx_runtime.JSX.Element;
1747
+ /** The look chosen for one booking part. */
1748
+ declare function useLook<K extends LookKind>(kind: K): Looks[K];
1749
+
1750
+ /**
1751
+ * Maps the availability search response onto the `Car` shape the results grid
1752
+ * renders. The API normalizer owns money/km/image cleaning — this only flattens
1753
+ * offers → fleets → Car and copies fields.
1754
+ */
1755
+
1756
+ interface RawRateOption {
1757
+ cdpCode?: string;
1758
+ standardRate: number;
1759
+ /** Supplier's higher-cover tier total (e.g. Europcar's SuperCover) - see
1760
+ * rate.resolver.ts. Most suppliers mirror standardRate into this, which
1761
+ * toPackage() treats as "no real second tier" rather than a choice. */
1762
+ superRate?: number;
1763
+ dailyRate?: number;
1764
+ kmPerDay?: number;
1765
+ rentalDays?: number;
1766
+ unlimitedMileage?: boolean;
1767
+ superDeposit?: number;
1768
+ liability?: number;
1769
+ /** Extra-kilometre price in Rand. Suppliers send standardPricePerKm; own fleet sends standardExcessRatePerKm. */
1770
+ standardPricePerKm?: number;
1771
+ standardExcessRatePerKm?: number;
1772
+ superPricePerKm?: number;
1773
+ superExcessRatePerKm?: number;
1774
+ /** Own fleet: excess and deposit for the higher cover. */
1775
+ superExcess?: number;
1776
+ superCoverDeposit?: number;
1777
+ /** Drop-off/one-way fee (ZAR) - set only when pick-up and return branches
1778
+ * differ (see rate.resolver.ts/aggregator.ts on the API side). */
1779
+ dropOffFee?: number;
1780
+ /** Supplier rate identifiers - needed to BOOK this rate, see RatePackage. */
1781
+ rateNo?: string | number;
1782
+ rateSrNo?: string | number;
1783
+ /** The supplier's price quote for this rate (SaniSixt), sent back when booking it. */
1784
+ quoteRef?: string;
1785
+ /** Amount (ZAR, off standardRate) this rate beat a pricier same-km-tier
1786
+ * competitor by - see aggregator.ts's dedupeCheapestPerKm(). */
1787
+ discount?: number;
1788
+ /** Own fleet: false when this plan's km allowance differs from its CDP. */
1789
+ kmSelectable?: boolean;
1790
+ /** Own fleet: the CDP km allowance behind a blocked option. 0 means unlimited. */
1791
+ cdpKmAllowance?: number | null;
1792
+ options?: Record<string, unknown>[];
1793
+ }
1794
+ interface RawSupplier {
1795
+ id?: string;
1796
+ name?: string;
1797
+ logoUrl?: string;
1798
+ }
1799
+ interface RawListingMetadata {
1800
+ supplierId?: string;
1801
+ origin?: Record<string, unknown>[];
1802
+ adapter?: Record<string, unknown>[];
1803
+ }
1804
+ interface RawFleetListing {
1805
+ seat?: number;
1806
+ door?: number;
1807
+ code?: string;
1808
+ carGroup: string;
1809
+ carGroupInt?: string | number;
1810
+ model: string;
1811
+ carImage?: string;
1812
+ category?: string;
1813
+ /** Every category the cars in this listing belong to. Own fleet can have more than one. */
1814
+ categories?: string[];
1815
+ transmission?: string;
1816
+ fuel?: string;
1817
+ luggage?: number;
1818
+ rates: RawRateOption[];
1819
+ /** WheelSys price-quote references, one per rate (see Car.quoteIds). */
1820
+ quoteId?: string[] | string;
1821
+ pickUpBranch?: string;
1822
+ returnBranch?: string;
1823
+ supplier?: RawSupplier;
1824
+ termsAndConditions?: string;
1825
+ metadata?: RawListingMetadata;
1826
+ }
1827
+ interface RawOffer {
1828
+ supplier?: string | RawSupplier;
1829
+ available: boolean;
1830
+ fleets: RawFleetListing[] | null;
1831
+ pickBranch?: string | null;
1832
+ returnBranch?: string | null;
1833
+ cdpCode?: string | null;
1834
+ /** CDP codes this search should badge as discounted - worked out by the core's search.availability action. */
1835
+ discountCodes?: string[];
1836
+ message?: string;
1837
+ metadata?: {
1838
+ supplierId?: string;
1839
+ rentalDays?: number;
1840
+ originResponse?: string;
1841
+ };
1842
+ }
1843
+ /** How one source (a supplier, or the site's own cars) answered a search. */
1844
+ interface SourceNotice {
1845
+ source: string;
1846
+ supplierName?: string;
1847
+ status: string;
1848
+ /** How many cars this source answered with (for status "ok"). */
1849
+ count?: number;
1850
+ /** A short reason for customers when this source has no cars to show (from the core). */
1851
+ customerMessage?: string;
1852
+ }
1853
+ interface OffersResult {
1854
+ offers: RawOffer[];
1855
+ sources?: SourceNotice[];
1856
+ }
1857
+ interface MapOffersOptions {
1858
+ pickupLabel?: string;
1859
+ }
1860
+ declare function isOffersResult(value: unknown): value is OffersResult;
1861
+ declare function mapOffersToCars(offers: RawOffer[], options?: MapOffersOptions): Car[];
1862
+
1863
+ /** Every field of `criteria` feeds the search, so the whole object is the
1864
+ * cache key - two identical searches (e.g. the same trip re-opened within
1865
+ * the 10-minute staleTime) hit the same cache entry and skip the round trip. */
1866
+ declare function availabilityQueryKey(criteria: SearchCriteria): readonly ["availability", SearchCriteria];
1867
+ /** How one source stands while a search runs: still asking, or answered. */
1868
+ interface SourceProgress extends SourceNotice {
1869
+ /** True until this source has answered (or failed). */
1870
+ pending?: boolean;
1871
+ }
1872
+ /**
1873
+ * Searches every source for the trip.
1874
+ *
1875
+ * It first asks the site who to search (fleetbridge_search_sources), then
1876
+ * searches each source on its own, all at the same time. Each time a
1877
+ * source answers, `onProgress` gets the whole list again, so the page can
1878
+ * tick that source off while the others are still being asked. The answer
1879
+ * comes once every source has answered, with all their cars together, in
1880
+ * the same shape one big search gives.
1881
+ *
1882
+ * A search for one supplier only (criteria.supplier, used when changing a
1883
+ * booking), or a site whose plugin has no fleetbridge_search_sources yet,
1884
+ * makes one request for everything, as before.
1885
+ */
1886
+ declare function searchAvailability(criteria: SearchCriteria, onProgress?: (sources: SourceProgress[]) => void): Promise<unknown>;
1887
+
1888
+ type LocationsStatus = 'idle' | 'loading' | 'success' | 'error';
1889
+ interface LocationsState {
1890
+ status: LocationsStatus;
1891
+ locations: BranchLocation[];
1892
+ error: string | null;
1893
+ /** No-ops once loaded/loading - the search form calls this on mount, and
1894
+ * both pick-up and drop-off pickers share the one fetch. */
1895
+ load: () => Promise<void>;
1896
+ }
1897
+ declare const useLocationsStore: zustand.UseBoundStore<zustand.StoreApi<LocationsState>>;
1898
+
1899
+ /** The search form on its own. Sends the customer to the results page. */
1900
+ declare const SearchWidget: {
1901
+ (props: SearchWidgetProps & {
1902
+ fallback?: react.ReactNode;
1903
+ }): react_jsx_runtime.JSX.Element;
1904
+ displayName: string;
1905
+ };
1906
+ /** The results page: search bar, filters, cars, and the booking wizard. */
1907
+ declare const ResultsPage: {
1908
+ (props: ResultsPageProps & {
1909
+ fallback?: react.ReactNode;
1910
+ }): react_jsx_runtime.JSX.Element;
1911
+ displayName: string;
1912
+ };
1913
+ /** Find, change or cancel a booking by booking number + PIN. */
1914
+ declare const ManageBooking: {
1915
+ (props: ManageBookingProps & {
1916
+ fallback?: react.ReactNode;
1917
+ }): react_jsx_runtime.JSX.Element;
1918
+ displayName: string;
1919
+ };
1920
+ /** Picks up the customer coming back from paying online (?fb_payment=…). */
1921
+ declare const PaymentReturn: {
1922
+ (props: object & {
1923
+ fallback?: react.ReactNode;
1924
+ }): react_jsx_runtime.JSX.Element;
1925
+ displayName: string;
1926
+ };
1927
+ /** A sample "booking confirmed" screen, for previewing the confirmation look. */
1928
+ declare const ConfirmationPreview: {
1929
+ (props: {
1930
+ enabled: boolean;
1931
+ } & {
1932
+ fallback?: react.ReactNode;
1933
+ }): react_jsx_runtime.JSX.Element;
1934
+ displayName: string;
1935
+ };
1936
+
1937
+ export { BOOKING_STEPS, BookingConfirmation, BookingProgress, BookingStepper, type BookingStepperItem, BookingSteps, type BookingTheme, BookingWizard, type BranchLocation, CACHE_MS, type Car, CarCard, CarCardSkeleton, CarList, CarListSkeleton, CarTypeTabs, ConfirmationPreview, CtaButton, DEFAULT_CRITERIA, DEFAULT_FILTERS, DEFAULT_LIST_STYLE, DEFAULT_LOOKS, DEFAULT_SEARCH_STYLE, DONE_STYLES, DRIVER_AGE_BANDS, DateRangeField, type DoneStyle, type Driver, EMPTY_DRIVER, EXTRA_STYLES, type Extra, type ExtraSelection, type ExtraStyle, Eyebrow, FILTER_STYLES, FIND_STYLES, FLEETBRIDGE_DEFAULTS, FacetRow, FilterChipBar, FilterPanel, type FilterPanelProps, type FilterStyle, type Filters, type FindStyle, type FleetBridgeConfig, FleetBridgeProvider, type FleetBridgeProviderProps, type FleetBridgeTheme, type FleetBridgeTransport, GhostPill, LIST_STYLES, LIST_STYLE_INFO, LOOK_CHOICES, LOOK_INFO, type ListStyle, type LookKind, type Looks, LooksProvider, LookupForm, ManageBooking, type ManageBookingProps, type ManagedBooking, type ManagedBookingCustomer, type ManagedBookingExtra, type ManagedBookingStatus, type ManagedBookingVehicle, PRICE_STYLES, PUBLIC_ACTIONS, PaymentReturn, PillGroup, type PriceStyle, type PublicAction, type QueryResult, type Quote, type RatePackage, type ResultsLayout, ResultsPage, type ResultsPageProps, Reveal, SAME_AS_PICKUP, SEARCH_STYLES, SEARCH_STYLE_INFO, STEP_STYLES, SearchBar, SearchCombobox, type SearchCriteria, SearchPanel, type SearchStyle, SearchWidget, type SearchWidgetProps, Segmented, type StepStyle, THEME_COLOR_VARS, THEME_GROUPS, THEME_INHERIT, THEME_KEYS, THEME_PRESETS, THEME_RADII, type ThemeColorKey, type ThemeField, type ThemeGroup, type ThemeSection, activeChips, availabilityQueryKey, bookingManagementQueries, bookingQueries, cleanBookingTheme, clientOnly, criteriaFromParams, criteriaToQuery, effectiveColors, formSteps, formatZAR, getTransport, hasValidTrip, httpTransport, isHex, isOffersResult, listStyleFrom, looksFrom, mapOffersToCars, priceBoundsFromCars, rentalDays, searchAvailability, searchStyleFrom, setTransport, shortAction, themeToCss, themeToVars, useFleetBridgeConfig, useIsClient, useLocationsStore, useLook, wordpressTransport };