@fleetbridge/ui 1.0.0 → 1.1.0
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 +10 -0
- package/index.js +619 -304
- package/package.json +1 -1
- package/server.js +10 -5
- package/styles.css +1 -1
package/index.js
CHANGED
|
@@ -98,7 +98,7 @@ var LOOK_INFO = {
|
|
|
98
98
|
choices: {
|
|
99
99
|
cards: { title: "Picture cards", description: "A card for each add-on. Popular ones are shown first." },
|
|
100
100
|
list: { title: "Switch list", description: "Tidy groups (cover, people, gadgets) with a switch on each row." },
|
|
101
|
-
packages: { title: "
|
|
101
|
+
packages: { title: "Plans", description: "Basic or Essential side by side; Essential\u2019s add-ons can each be unticked. Other add-ons below." }
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
price: {
|
|
@@ -457,7 +457,8 @@ function groupLocationsByRegion(locations) {
|
|
|
457
457
|
const option = {
|
|
458
458
|
value: location.name,
|
|
459
459
|
label: location.name,
|
|
460
|
-
icon: isAirport(location) ? Plane : Building2
|
|
460
|
+
icon: isAirport(location) ? Plane : Building2,
|
|
461
|
+
...location.address ? { description: location.address } : {}
|
|
461
462
|
};
|
|
462
463
|
const existing = map.get(key);
|
|
463
464
|
if (existing) {
|
|
@@ -2762,10 +2763,228 @@ function DateRangeField({
|
|
|
2762
2763
|
}
|
|
2763
2764
|
|
|
2764
2765
|
// src/components/SearchCombobox.tsx
|
|
2765
|
-
import { useEffect as useEffect10, useRef as useRef4, useState as useState10 } from "react";
|
|
2766
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef4, useState as useState10 } from "react";
|
|
2766
2767
|
import { Command as CommandPrimitive2 } from "cmdk";
|
|
2767
|
-
import { Check, ChevronsUpDown, MapPin as MapPin2, Search } from "lucide-react";
|
|
2768
|
-
|
|
2768
|
+
import { Check, ChevronsUpDown, MapPin as MapPin2, Search, X as X3 } from "lucide-react";
|
|
2769
|
+
|
|
2770
|
+
// src/lib/locationSearch.ts
|
|
2771
|
+
function fold(text) {
|
|
2772
|
+
let out = "";
|
|
2773
|
+
for (const ch of text) {
|
|
2774
|
+
const plain = ch.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
2775
|
+
out += plain.length === ch.length ? plain : ch.toLowerCase();
|
|
2776
|
+
}
|
|
2777
|
+
return out;
|
|
2778
|
+
}
|
|
2779
|
+
function searchTerms(query) {
|
|
2780
|
+
return fold(query).replace(/(\d)\s*[.:h]\s*(\d)/g, "$1$2").split(/[\s,/()–-]+/).map((term) => term.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter(Boolean);
|
|
2781
|
+
}
|
|
2782
|
+
var ALIASES2 = {
|
|
2783
|
+
// Cities
|
|
2784
|
+
johannesburg: ["johannesburg", "or tambo"],
|
|
2785
|
+
durban: ["durban", "king shaka"],
|
|
2786
|
+
"cape town": ["cape town"],
|
|
2787
|
+
jhb: ["johannesburg", "or tambo"],
|
|
2788
|
+
joburg: ["johannesburg", "or tambo"],
|
|
2789
|
+
jozi: ["johannesburg", "or tambo"],
|
|
2790
|
+
egoli: ["johannesburg"],
|
|
2791
|
+
cpt: ["cape town"],
|
|
2792
|
+
kaapstad: ["cape town"],
|
|
2793
|
+
dbn: ["durban", "king shaka"],
|
|
2794
|
+
pta: ["pretoria"],
|
|
2795
|
+
tshwane: ["pretoria"],
|
|
2796
|
+
pe: ["port elizabeth", "gqeberha"],
|
|
2797
|
+
gqeberha: ["port elizabeth", "gqeberha"],
|
|
2798
|
+
"port elizabeth": ["gqeberha"],
|
|
2799
|
+
pmb: ["pietermaritzburg"],
|
|
2800
|
+
nelspruit: ["mbombela", "nelspruit"],
|
|
2801
|
+
mbombela: ["nelspruit", "mbombela"],
|
|
2802
|
+
pietersburg: ["polokwane"],
|
|
2803
|
+
bloem: ["bloemfontein"],
|
|
2804
|
+
plett: ["plettenberg"],
|
|
2805
|
+
stellies: ["stellenbosch"],
|
|
2806
|
+
// Airports (IATA codes)
|
|
2807
|
+
jnb: ["or tambo", "johannesburg"],
|
|
2808
|
+
hla: ["lanseria"],
|
|
2809
|
+
dur: ["king shaka", "durban"],
|
|
2810
|
+
plz: ["port elizabeth", "gqeberha"],
|
|
2811
|
+
els: ["east london", "king phalo"],
|
|
2812
|
+
grj: ["george"],
|
|
2813
|
+
bfn: ["bloemfontein"],
|
|
2814
|
+
kim: ["kimberley"],
|
|
2815
|
+
mqp: ["kruger mpumalanga", "nelspruit", "mbombela"],
|
|
2816
|
+
ptg: ["polokwane"],
|
|
2817
|
+
utn: ["upington"],
|
|
2818
|
+
rcb: ["richards bay"],
|
|
2819
|
+
hds: ["hoedspruit"],
|
|
2820
|
+
pzb: ["pietermaritzburg"],
|
|
2821
|
+
utt: ["mthatha", "umtata"],
|
|
2822
|
+
wdh: ["windhoek"],
|
|
2823
|
+
wvb: ["walvis bay"],
|
|
2824
|
+
gbe: ["gaborone"],
|
|
2825
|
+
mub: ["maun"],
|
|
2826
|
+
bbk: ["kasane"],
|
|
2827
|
+
mts: ["matsapha"],
|
|
2828
|
+
shs: ["king mswati"],
|
|
2829
|
+
msu: ["maseru"],
|
|
2830
|
+
// Words
|
|
2831
|
+
intl: ["international"],
|
|
2832
|
+
int: ["international"],
|
|
2833
|
+
apt: ["airport"],
|
|
2834
|
+
arpt: ["airport"],
|
|
2835
|
+
ap: ["airport"]
|
|
2836
|
+
};
|
|
2837
|
+
function distance(a, b, max) {
|
|
2838
|
+
if (Math.abs(a.length - b.length) > max) return max + 1;
|
|
2839
|
+
let before = [];
|
|
2840
|
+
let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
2841
|
+
for (let i = 1; i <= a.length; i++) {
|
|
2842
|
+
const row = [i];
|
|
2843
|
+
let best = i;
|
|
2844
|
+
for (let j = 1; j <= b.length; j++) {
|
|
2845
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
2846
|
+
let v = Math.min(prev[j] + 1, row[j - 1] + 1, prev[j - 1] + cost);
|
|
2847
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) v = Math.min(v, before[j - 2] + 1);
|
|
2848
|
+
row[j] = v;
|
|
2849
|
+
if (v < best) best = v;
|
|
2850
|
+
}
|
|
2851
|
+
if (best > max) return max + 1;
|
|
2852
|
+
before = prev;
|
|
2853
|
+
prev = row;
|
|
2854
|
+
}
|
|
2855
|
+
return prev[b.length];
|
|
2856
|
+
}
|
|
2857
|
+
var wordsOf = (text) => text.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
2858
|
+
var startsAWord = (text, phrase) => text.startsWith(phrase) || text.includes(` ${phrase}`) || text.includes(`(${phrase}`) || text.includes(`-${phrase}`);
|
|
2859
|
+
function nearlyAWord(words, term) {
|
|
2860
|
+
if (term.length < 4) return false;
|
|
2861
|
+
const max = term.length >= 8 ? 2 : 1;
|
|
2862
|
+
return words.some((word) => {
|
|
2863
|
+
if (distance(term, word, max) <= max) return true;
|
|
2864
|
+
return word.length > term.length && distance(term, word.slice(0, term.length), max) <= max;
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
function phraseScore(place, phrase, exactOnly = false) {
|
|
2868
|
+
const { name, address, region } = place;
|
|
2869
|
+
if (/^\d+$/.test(phrase)) {
|
|
2870
|
+
const digits = name.replace(/\D/g, "");
|
|
2871
|
+
if (digits === phrase || digits.replace(/^0+/, "") === phrase) return 12;
|
|
2872
|
+
if (digits.startsWith(phrase) || digits.replace(/^0+/, "").startsWith(phrase)) return 9;
|
|
2873
|
+
}
|
|
2874
|
+
if (phrase.length < 3) {
|
|
2875
|
+
if (startsAWord(name, phrase)) return name.startsWith(phrase) ? 9 : 7;
|
|
2876
|
+
if (startsAWord(region, phrase)) return 4;
|
|
2877
|
+
return startsAWord(address, phrase) ? 3 : 0;
|
|
2878
|
+
}
|
|
2879
|
+
if (startsAWord(name, phrase)) return name.startsWith(phrase) ? 12 : 10;
|
|
2880
|
+
if (name.includes(phrase)) return 7;
|
|
2881
|
+
if (startsAWord(region, phrase)) return 5;
|
|
2882
|
+
if (startsAWord(address, phrase)) return 4;
|
|
2883
|
+
if (region.includes(phrase) || address.includes(phrase)) return 3;
|
|
2884
|
+
if (exactOnly || phrase.includes(" ")) return 0;
|
|
2885
|
+
if (nearlyAWord(place.nameWords, phrase)) return 2.5;
|
|
2886
|
+
if (nearlyAWord(place.addressWords, phrase) || nearlyAWord(wordsOf(region), phrase)) return 1;
|
|
2887
|
+
return 0;
|
|
2888
|
+
}
|
|
2889
|
+
function aliasesFor(term) {
|
|
2890
|
+
if (ALIASES2[term]) return ALIASES2[term];
|
|
2891
|
+
if (term.length < 5) return [];
|
|
2892
|
+
const max = term.length >= 8 ? 2 : 1;
|
|
2893
|
+
for (const [key, phrases] of Object.entries(ALIASES2)) {
|
|
2894
|
+
if (key.length >= 5 && distance(term, key, max) <= max) return [key, ...phrases];
|
|
2895
|
+
}
|
|
2896
|
+
return [];
|
|
2897
|
+
}
|
|
2898
|
+
function rankLocations(groups, query) {
|
|
2899
|
+
const terms = searchTerms(query);
|
|
2900
|
+
const total = groups.reduce((n, g) => n + g.options.length, 0);
|
|
2901
|
+
if (!terms.length) return { groups, marks: [], count: total, first: groups[0]?.options[0]?.label ?? null };
|
|
2902
|
+
const whole = terms.join(" ");
|
|
2903
|
+
const phrases = /* @__PURE__ */ new Map();
|
|
2904
|
+
for (const term of terms) phrases.set(term, [term, ...aliasesFor(term)]);
|
|
2905
|
+
if (terms.length > 1 && ALIASES2[whole]) phrases.set(whole, [whole, ...ALIASES2[whole]]);
|
|
2906
|
+
const marks = new Set(terms);
|
|
2907
|
+
const scored = [];
|
|
2908
|
+
groups.forEach((group, order) => {
|
|
2909
|
+
const region = fold(group.label ?? "");
|
|
2910
|
+
const options = [];
|
|
2911
|
+
for (const option of group.options) {
|
|
2912
|
+
const name = fold(option.label);
|
|
2913
|
+
const address = fold(option.description ?? "");
|
|
2914
|
+
const place = { name, address, region, nameWords: wordsOf(name), addressWords: wordsOf(address) };
|
|
2915
|
+
let sum = 0;
|
|
2916
|
+
let matched = true;
|
|
2917
|
+
const wholeAlias = terms.length > 1 && ALIASES2[whole] ? Math.max(...ALIASES2[whole].map((p) => phraseScore(place, p, true))) : 0;
|
|
2918
|
+
for (const term of terms) {
|
|
2919
|
+
const alternatives = phrases.get(term) ?? [term];
|
|
2920
|
+
let best = 0;
|
|
2921
|
+
alternatives.forEach((phrase, i) => {
|
|
2922
|
+
const s = phraseScore(place, phrase, i > 0) * (i > 0 ? 0.9 : 1);
|
|
2923
|
+
if (s > best) best = s;
|
|
2924
|
+
if (s > 0 && i > 0) marks.add(phrase);
|
|
2925
|
+
});
|
|
2926
|
+
if (best === 0 && wholeAlias === 0) {
|
|
2927
|
+
matched = false;
|
|
2928
|
+
break;
|
|
2929
|
+
}
|
|
2930
|
+
sum += best || wholeAlias;
|
|
2931
|
+
}
|
|
2932
|
+
if (!matched) continue;
|
|
2933
|
+
let score = sum / terms.length;
|
|
2934
|
+
if (name === whole) score += 8;
|
|
2935
|
+
else if (name.startsWith(whole)) score += 5;
|
|
2936
|
+
else if (terms.length > 1 && name.includes(whole)) score += 3;
|
|
2937
|
+
if (wholeAlias) score += wholeAlias / 2;
|
|
2938
|
+
options.push({ option, score });
|
|
2939
|
+
}
|
|
2940
|
+
if (!options.length) return;
|
|
2941
|
+
options.sort((a, b) => b.score - a.score || a.option.label.localeCompare(b.option.label));
|
|
2942
|
+
scored.push({ group, order, best: options[0].score, options });
|
|
2943
|
+
});
|
|
2944
|
+
scored.sort((a, b) => b.best - a.best || a.order - b.order);
|
|
2945
|
+
const ranked = scored.map(({ group, options }) => ({ ...group, options: options.map((o) => o.option) }));
|
|
2946
|
+
return {
|
|
2947
|
+
groups: ranked,
|
|
2948
|
+
marks: [...marks].sort((a, b) => b.length - a.length),
|
|
2949
|
+
count: ranked.reduce((n, g) => n + g.options.length, 0),
|
|
2950
|
+
first: ranked[0]?.options[0]?.label ?? null
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
function markRanges(text, marks) {
|
|
2954
|
+
if (!marks.length) return [];
|
|
2955
|
+
const folded = fold(text);
|
|
2956
|
+
const on = new Array(text.length).fill(false);
|
|
2957
|
+
const digitAt = [];
|
|
2958
|
+
for (let i = 0; i < text.length; i++) if (/\d/.test(text[i])) digitAt.push(i);
|
|
2959
|
+
const digits = digitAt.map((i) => text[i]).join("");
|
|
2960
|
+
for (const mark of marks) {
|
|
2961
|
+
if (/^\d+$/.test(mark) && !folded.includes(mark) && digits) {
|
|
2962
|
+
const zeros = digits.length - digits.replace(/^0+/, "").length;
|
|
2963
|
+
const start2 = digits.startsWith(mark) ? 0 : digits.slice(zeros).startsWith(mark) ? zeros : -1;
|
|
2964
|
+
if (start2 !== -1) for (let i = digitAt[start2]; i <= digitAt[start2 + mark.length - 1]; i++) on[i] = true;
|
|
2965
|
+
continue;
|
|
2966
|
+
}
|
|
2967
|
+
let from = folded.indexOf(mark);
|
|
2968
|
+
while (from !== -1) {
|
|
2969
|
+
for (let i = from; i < from + mark.length; i++) on[i] = true;
|
|
2970
|
+
from = folded.indexOf(mark, from + mark.length);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
const ranges = [];
|
|
2974
|
+
let start = -1;
|
|
2975
|
+
for (let i = 0; i <= text.length; i++) {
|
|
2976
|
+
if (i < text.length && on[i]) {
|
|
2977
|
+
if (start === -1) start = i;
|
|
2978
|
+
} else if (start !== -1) {
|
|
2979
|
+
ranges.push([start, i]);
|
|
2980
|
+
start = -1;
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
return ranges;
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
// src/components/SearchCombobox.tsx
|
|
2987
|
+
import { Fragment as Fragment2, jsx as jsx64, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2769
2988
|
function SearchCombobox({
|
|
2770
2989
|
id,
|
|
2771
2990
|
ariaLabel,
|
|
@@ -2782,7 +3001,15 @@ function SearchCombobox({
|
|
|
2782
3001
|
}) {
|
|
2783
3002
|
const [open, setOpen] = useState10(false);
|
|
2784
3003
|
const [active, setActive] = useState10(displayLabel);
|
|
3004
|
+
const [query, setQuery] = useState10("");
|
|
2785
3005
|
const panelRef = useRef4(null);
|
|
3006
|
+
const inputRef = useRef4(null);
|
|
3007
|
+
const ranked = useMemo7(() => rankLocations(groups, query), [groups, query]);
|
|
3008
|
+
const searching = query.trim() !== "";
|
|
3009
|
+
const places = groups.some((g) => g.label || g.options.some((o) => o.description));
|
|
3010
|
+
useEffect10(() => {
|
|
3011
|
+
if (searching && ranked.first) setActive(ranked.first);
|
|
3012
|
+
}, [searching, ranked.first]);
|
|
2786
3013
|
const selectedLabel = labelForValue(groups, value) || displayLabel;
|
|
2787
3014
|
useEffect10(() => {
|
|
2788
3015
|
if (!open) return;
|
|
@@ -2803,7 +3030,10 @@ function SearchCombobox({
|
|
|
2803
3030
|
open,
|
|
2804
3031
|
onOpenChange: (next) => {
|
|
2805
3032
|
setOpen(next);
|
|
2806
|
-
if (next)
|
|
3033
|
+
if (next) {
|
|
3034
|
+
setActive(selectedLabel);
|
|
3035
|
+
setQuery("");
|
|
3036
|
+
}
|
|
2807
3037
|
},
|
|
2808
3038
|
children: [
|
|
2809
3039
|
/* @__PURE__ */ jsx64(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs30(
|
|
@@ -2832,26 +3062,47 @@ function SearchCombobox({
|
|
|
2832
3062
|
contentClassName
|
|
2833
3063
|
),
|
|
2834
3064
|
align: "start",
|
|
2835
|
-
children: /* @__PURE__ */ jsx64("div", { ref: panelRef, children: /* @__PURE__ */ jsxs30(Command, { className: "p-0", value: active, onValueChange: setActive, children: [
|
|
3065
|
+
children: /* @__PURE__ */ jsx64("div", { ref: panelRef, children: /* @__PURE__ */ jsxs30(Command, { className: "p-0", value: active, onValueChange: setActive, shouldFilter: false, children: [
|
|
2836
3066
|
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2 border-b border-border px-3", children: [
|
|
2837
3067
|
/* @__PURE__ */ jsx64(Search, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
2838
3068
|
/* @__PURE__ */ jsx64(
|
|
2839
3069
|
CommandPrimitive2.Input,
|
|
2840
3070
|
{
|
|
3071
|
+
ref: inputRef,
|
|
3072
|
+
value: query,
|
|
3073
|
+
onValueChange: setQuery,
|
|
2841
3074
|
placeholder: searchPlaceholder,
|
|
2842
3075
|
className: "h-11 w-full min-w-0 border-0 bg-transparent text-sm text-foreground outline-none ring-0 placeholder:text-muted-foreground"
|
|
2843
3076
|
}
|
|
3077
|
+
),
|
|
3078
|
+
query && /* @__PURE__ */ jsx64(
|
|
3079
|
+
"button",
|
|
3080
|
+
{
|
|
3081
|
+
type: "button",
|
|
3082
|
+
"aria-label": "Clear the search",
|
|
3083
|
+
onClick: () => {
|
|
3084
|
+
setQuery("");
|
|
3085
|
+
inputRef.current?.focus();
|
|
3086
|
+
},
|
|
3087
|
+
className: "flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground",
|
|
3088
|
+
children: /* @__PURE__ */ jsx64(X3, { className: "size-3.5", "aria-hidden": "true" })
|
|
3089
|
+
}
|
|
2844
3090
|
)
|
|
2845
3091
|
] }),
|
|
2846
|
-
/* @__PURE__ */ jsxs30(
|
|
3092
|
+
searching && /* @__PURE__ */ jsxs30("div", { "aria-live": "polite", className: "flex items-center justify-between gap-3 border-b border-border bg-muted/40 px-3.5 py-1.5 text-[0.6875rem] whitespace-nowrap text-muted-foreground", children: [
|
|
3093
|
+
/* @__PURE__ */ jsx64("span", { className: "truncate", children: places ? ranked.count === 0 ? "No matching places" : `${ranked.count} ${ranked.count === 1 ? "place" : "places"}, best match first` : `${ranked.count} ${ranked.count === 1 ? "match" : "matches"}` }),
|
|
3094
|
+
places && /* @__PURE__ */ jsx64("span", { className: "hidden truncate sm:inline", children: "Name, address or province" })
|
|
3095
|
+
] }),
|
|
3096
|
+
/* @__PURE__ */ jsxs30(CommandList, { className: "h-(--cmdk-list-height) max-h-[min(22rem,60vh)] p-0 transition-[height] duration-200 ease-out motion-reduce:transition-none", children: [
|
|
2847
3097
|
/* @__PURE__ */ jsx64(CommandEmpty, { children: loading ? "Loading locations\u2026" : emptyMessage }),
|
|
2848
|
-
groups.map((group, index) => /* @__PURE__ */ jsxs30(CommandGroup, { className: "p-0", children: [
|
|
3098
|
+
ranked.groups.map((group, index) => /* @__PURE__ */ jsxs30(CommandGroup, { value: group.label ?? `_${index}`, className: "p-0", children: [
|
|
2849
3099
|
group.label && /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-1.5 border-l-2 border-l-wizard-selected bg-muted px-3.5 py-2 text-[0.6875rem] font-semibold tracking-[0.06em] text-foreground uppercase", children: [
|
|
2850
3100
|
/* @__PURE__ */ jsx64(MapPin2, { className: "size-3", "aria-hidden": "true" }),
|
|
2851
|
-
group.label
|
|
3101
|
+
/* @__PURE__ */ jsx64(Highlight, { text: group.label, marks: ranked.marks })
|
|
2852
3102
|
] }),
|
|
2853
|
-
/* @__PURE__ */ jsx64("div", { className: "p-1", children: group.options.map((option) => {
|
|
3103
|
+
/* @__PURE__ */ jsx64("div", { className: "p-1", children: group.options.map((option, optionIndex) => {
|
|
2854
3104
|
const selected = value === option.value;
|
|
3105
|
+
const best = places && searching && index === 0 && optionIndex === 0;
|
|
2855
3106
|
const Icon = option.icon;
|
|
2856
3107
|
return /* @__PURE__ */ jsxs30(
|
|
2857
3108
|
CommandItem,
|
|
@@ -2862,17 +3113,24 @@ function SearchCombobox({
|
|
|
2862
3113
|
onChange(option.value);
|
|
2863
3114
|
setOpen(false);
|
|
2864
3115
|
},
|
|
2865
|
-
className: cn(
|
|
3116
|
+
className: cn(
|
|
3117
|
+
"items-start rounded-lg py-2 text-[0.875rem] transition-colors duration-150",
|
|
3118
|
+
selected && "bg-accent font-medium"
|
|
3119
|
+
),
|
|
2866
3120
|
children: [
|
|
2867
3121
|
/* @__PURE__ */ jsx64(
|
|
2868
3122
|
Check,
|
|
2869
3123
|
{
|
|
2870
|
-
className: cn("size-3.5 shrink-0 text-foreground", selected ? "opacity-100" : "opacity-0"),
|
|
3124
|
+
className: cn("mt-0.5 size-3.5 shrink-0 text-foreground", selected ? "opacity-100" : "opacity-0"),
|
|
2871
3125
|
"aria-hidden": "true"
|
|
2872
3126
|
}
|
|
2873
3127
|
),
|
|
2874
|
-
Icon && /* @__PURE__ */ jsx64(Icon, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
2875
|
-
/* @__PURE__ */
|
|
3128
|
+
Icon && /* @__PURE__ */ jsx64(Icon, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
3129
|
+
/* @__PURE__ */ jsxs30("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
3130
|
+
/* @__PURE__ */ jsx64("span", { children: /* @__PURE__ */ jsx64(Highlight, { text: option.label, marks: ranked.marks }) }),
|
|
3131
|
+
option.description && /* @__PURE__ */ jsx64("span", { className: "truncate text-[0.75rem] font-normal text-muted-foreground", children: /* @__PURE__ */ jsx64(Highlight, { text: option.description, marks: ranked.marks }) })
|
|
3132
|
+
] }),
|
|
3133
|
+
best && /* @__PURE__ */ jsx64("span", { className: "ml-auto shrink-0 self-center rounded-full bg-wizard-selected/15 px-2 py-0.5 text-[0.625rem] font-semibold tracking-[0.04em] text-foreground uppercase", children: "Best match" })
|
|
2876
3134
|
]
|
|
2877
3135
|
},
|
|
2878
3136
|
option.value
|
|
@@ -2887,6 +3145,21 @@ function SearchCombobox({
|
|
|
2887
3145
|
}
|
|
2888
3146
|
);
|
|
2889
3147
|
}
|
|
3148
|
+
function Highlight({ text, marks }) {
|
|
3149
|
+
const ranges = markRanges(text, marks);
|
|
3150
|
+
if (!ranges.length) return /* @__PURE__ */ jsx64(Fragment2, { children: text });
|
|
3151
|
+
const parts2 = [];
|
|
3152
|
+
let at = 0;
|
|
3153
|
+
for (const [start, end] of ranges) {
|
|
3154
|
+
if (start > at) parts2.push(text.slice(at, start));
|
|
3155
|
+
parts2.push(
|
|
3156
|
+
/* @__PURE__ */ jsx64("mark", { className: "rounded-[3px] bg-wizard-selected/20 px-px font-semibold text-foreground", children: text.slice(start, end) }, start)
|
|
3157
|
+
);
|
|
3158
|
+
at = end;
|
|
3159
|
+
}
|
|
3160
|
+
if (at < text.length) parts2.push(text.slice(at));
|
|
3161
|
+
return /* @__PURE__ */ jsx64(Fragment2, { children: parts2 });
|
|
3162
|
+
}
|
|
2890
3163
|
function labelForValue(groups, value) {
|
|
2891
3164
|
for (const group of groups) {
|
|
2892
3165
|
const match = group.options.find((option) => option.value === value);
|
|
@@ -3459,7 +3732,7 @@ function HeroStyle({
|
|
|
3459
3732
|
// src/components/SearchPanel/styles/PillStyle.tsx
|
|
3460
3733
|
import { useLayoutEffect, useRef as useRef5, useState as useState11 } from "react";
|
|
3461
3734
|
import { ChevronDown, Search as Search3 } from "lucide-react";
|
|
3462
|
-
import { Fragment as
|
|
3735
|
+
import { Fragment as Fragment3, jsx as jsx70, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3463
3736
|
var FULL_PILL_WIDTH = 760;
|
|
3464
3737
|
var SEGMENT = "min-w-0 rounded-full bg-transparent px-5 py-1.5 [&+&]:border-l [&+&]:border-search-border";
|
|
3465
3738
|
function PillStyle({ form, className }) {
|
|
@@ -3484,7 +3757,7 @@ function PillStyle({ form, className }) {
|
|
|
3484
3757
|
onSubmit: form.handleSubmit,
|
|
3485
3758
|
"aria-label": "Search for a rental car",
|
|
3486
3759
|
className: cn("fb-hidden", className),
|
|
3487
|
-
children: /* @__PURE__ */ jsx70("div", { ref: boxRef, children: full ? /* @__PURE__ */ jsxs36(
|
|
3760
|
+
children: /* @__PURE__ */ jsx70("div", { ref: boxRef, children: full ? /* @__PURE__ */ jsxs36(Fragment3, { children: [
|
|
3488
3761
|
/* @__PURE__ */ jsxs36("div", { className: "flex items-center rounded-full border border-search-border bg-search-surface p-1.5 shadow-search", children: [
|
|
3489
3762
|
/* @__PURE__ */ jsxs36("div", { className: "flex min-w-0 flex-1 items-center", children: [
|
|
3490
3763
|
/* @__PURE__ */ jsx70(PickupField, { form, label: "Where", className: cn(SEGMENT, "flex-[1.3]") }),
|
|
@@ -3498,7 +3771,7 @@ function PillStyle({ form, className }) {
|
|
|
3498
3771
|
/* @__PURE__ */ jsx70(ResidenceToggle, { form }),
|
|
3499
3772
|
/* @__PURE__ */ jsx70(CouponField, { form })
|
|
3500
3773
|
] })
|
|
3501
|
-
] }) : /* @__PURE__ */ jsxs36(
|
|
3774
|
+
] }) : /* @__PURE__ */ jsxs36(Fragment3, { children: [
|
|
3502
3775
|
/* @__PURE__ */ jsxs36(
|
|
3503
3776
|
"button",
|
|
3504
3777
|
{
|
|
@@ -3566,7 +3839,7 @@ function SidebarStyle({ form, title = "Find a car", className }) {
|
|
|
3566
3839
|
// src/components/SearchPanel/styles/StepsStyle.tsx
|
|
3567
3840
|
import { useState as useState12 } from "react";
|
|
3568
3841
|
import { ArrowLeft, ArrowRight as ArrowRight2 } from "lucide-react";
|
|
3569
|
-
import { Fragment as
|
|
3842
|
+
import { Fragment as Fragment4, jsx as jsx72, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3570
3843
|
var STEPS = [
|
|
3571
3844
|
{ name: "Where", question: "Where do you need the car?", needs: ["pickup"] },
|
|
3572
3845
|
{ name: "When", question: "When do you need it?", needs: ["dates", "times"] },
|
|
@@ -3616,16 +3889,16 @@ function StepsStyle({ form, className }) {
|
|
|
3616
3889
|
/* @__PURE__ */ jsxs38("div", { className: "grid gap-3", children: [
|
|
3617
3890
|
/* @__PURE__ */ jsx72("h2", { className: "text-[1.375rem] leading-tight font-semibold tracking-[-0.01em] text-search-value", children: current2.question }),
|
|
3618
3891
|
step > 0 && tripSummary(form) && /* @__PURE__ */ jsx72("p", { className: "-mt-1.5 text-[0.8125rem] text-search-value/60", children: tripSummary(form) }),
|
|
3619
|
-
step === 0 && /* @__PURE__ */ jsxs38(
|
|
3892
|
+
step === 0 && /* @__PURE__ */ jsxs38(Fragment4, { children: [
|
|
3620
3893
|
/* @__PURE__ */ jsx72(PickupField, { form, large: true, className: cn(BOXED, "py-3") }),
|
|
3621
3894
|
/* @__PURE__ */ jsx72(SameReturnToggle, { form, className: "px-0.5" }),
|
|
3622
3895
|
form.criteria.dropoffLocation !== SAME_AS_PICKUP && /* @__PURE__ */ jsx72(DropoffField, { form, large: true, className: cn(BOXED, "py-3") })
|
|
3623
3896
|
] }),
|
|
3624
|
-
step === 1 && /* @__PURE__ */ jsxs38(
|
|
3897
|
+
step === 1 && /* @__PURE__ */ jsxs38(Fragment4, { children: [
|
|
3625
3898
|
/* @__PURE__ */ jsx72(DatesField, { form, large: true, className: cn(BOXED, "py-3") }),
|
|
3626
3899
|
/* @__PURE__ */ jsx72(TimesField, { form, large: true, className: cn(BOXED, "py-3") })
|
|
3627
3900
|
] }),
|
|
3628
|
-
step === 2 && /* @__PURE__ */ jsxs38(
|
|
3901
|
+
step === 2 && /* @__PURE__ */ jsxs38(Fragment4, { children: [
|
|
3629
3902
|
/* @__PURE__ */ jsx72(ResidenceToggle, { form, className: "flex-wrap" }),
|
|
3630
3903
|
/* @__PURE__ */ jsx72(CouponField, { form, className: "h-10 w-full" })
|
|
3631
3904
|
] })
|
|
@@ -3704,7 +3977,7 @@ import {
|
|
|
3704
3977
|
createContext as createContext7,
|
|
3705
3978
|
useContext as useContext8,
|
|
3706
3979
|
useEffect as useEffect11,
|
|
3707
|
-
useMemo as
|
|
3980
|
+
useMemo as useMemo8,
|
|
3708
3981
|
useState as useState13,
|
|
3709
3982
|
useSyncExternalStore
|
|
3710
3983
|
} from "react";
|
|
@@ -3822,7 +4095,7 @@ function themeToCss(theme, selector = ":root") {
|
|
|
3822
4095
|
}
|
|
3823
4096
|
|
|
3824
4097
|
// src/provider.tsx
|
|
3825
|
-
import { Fragment as
|
|
4098
|
+
import { Fragment as Fragment5, jsx as jsx75, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3826
4099
|
var CACHE_MS = 10 * 60 * 1e3;
|
|
3827
4100
|
var ConfigContext = createContext7({ resultsUrl: "/cars/" });
|
|
3828
4101
|
function useFleetBridgeConfig() {
|
|
@@ -3846,11 +4119,11 @@ function FleetBridgeProvider({
|
|
|
3846
4119
|
}) {
|
|
3847
4120
|
setTransport(transport);
|
|
3848
4121
|
const [client] = useState13(() => queryClient ?? makeQueryClient());
|
|
3849
|
-
const config =
|
|
4122
|
+
const config = useMemo8(
|
|
3850
4123
|
() => ({ resultsUrl, manageUrl, paymentReturnUrl: paymentReturnUrl2, bookingUrl }),
|
|
3851
4124
|
[resultsUrl, manageUrl, paymentReturnUrl2, bookingUrl]
|
|
3852
4125
|
);
|
|
3853
|
-
const mergedLooks =
|
|
4126
|
+
const mergedLooks = useMemo8(() => ({ ...DEFAULT_LOOKS, ...looks }), [looks]);
|
|
3854
4127
|
useEffect11(() => {
|
|
3855
4128
|
if (!theme || typeof document === "undefined") return;
|
|
3856
4129
|
const root = document.documentElement;
|
|
@@ -3864,7 +4137,7 @@ function FleetBridgeProvider({
|
|
|
3864
4137
|
}
|
|
3865
4138
|
};
|
|
3866
4139
|
}, [theme]);
|
|
3867
|
-
const persister =
|
|
4140
|
+
const persister = useMemo8(
|
|
3868
4141
|
() => persistCache && typeof window !== "undefined" ? createAsyncStoragePersister({ storage: window.localStorage, key: "fleetbridge-query-cache" }) : null,
|
|
3869
4142
|
[persistCache]
|
|
3870
4143
|
);
|
|
@@ -3902,7 +4175,7 @@ function clientOnly(Component, displayName2) {
|
|
|
3902
4175
|
function ClientOnly(props) {
|
|
3903
4176
|
const isClient = useIsClient();
|
|
3904
4177
|
const { fallback = null, ...rest } = props;
|
|
3905
|
-
return isClient ? /* @__PURE__ */ jsx75(Component, { ...rest }) : /* @__PURE__ */ jsx75(
|
|
4178
|
+
return isClient ? /* @__PURE__ */ jsx75(Component, { ...rest }) : /* @__PURE__ */ jsx75(Fragment5, { children: fallback });
|
|
3906
4179
|
}
|
|
3907
4180
|
ClientOnly.displayName = displayName2;
|
|
3908
4181
|
return ClientOnly;
|
|
@@ -3921,13 +4194,13 @@ function SearchWidget({ resultsPageUrl: resultsPageUrlProp, searchStyle, title,
|
|
|
3921
4194
|
}
|
|
3922
4195
|
|
|
3923
4196
|
// src/components/ResultsPage/index.tsx
|
|
3924
|
-
import { useCallback as useCallback3, useEffect as useEffect19, useId as useId4, useMemo as
|
|
4197
|
+
import { useCallback as useCallback3, useEffect as useEffect19, useId as useId4, useMemo as useMemo14, useState as useState20 } from "react";
|
|
3925
4198
|
import { createPortal as createPortal3 } from "react-dom";
|
|
3926
4199
|
import { useQueries, useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3927
|
-
import { ArrowUpDown, CalendarDays as CalendarDays5, ChevronDown as ChevronDown6, CircleAlert as CircleAlert4, Info as Info5, RotateCw, SlidersHorizontal as SlidersHorizontal2, X as
|
|
4200
|
+
import { ArrowUpDown, CalendarDays as CalendarDays5, ChevronDown as ChevronDown6, CircleAlert as CircleAlert4, Info as Info5, RotateCw, SlidersHorizontal as SlidersHorizontal2, X as X5 } from "lucide-react";
|
|
3928
4201
|
|
|
3929
4202
|
// src/components/BookingWizard/index.tsx
|
|
3930
|
-
import { useEffect as useEffect14, useMemo as
|
|
4203
|
+
import { useEffect as useEffect14, useMemo as useMemo9, useRef as useRef7, useState as useState17 } from "react";
|
|
3931
4204
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3932
4205
|
import { AnimatePresence as AnimatePresence3, motion as motion9 } from "framer-motion";
|
|
3933
4206
|
import {
|
|
@@ -3952,7 +4225,7 @@ import {
|
|
|
3952
4225
|
Phone as Phone3,
|
|
3953
4226
|
ShieldCheck as ShieldCheck5,
|
|
3954
4227
|
Users as Users4,
|
|
3955
|
-
X as
|
|
4228
|
+
X as X4
|
|
3956
4229
|
} from "lucide-react";
|
|
3957
4230
|
|
|
3958
4231
|
// src/components/BookingSteps.tsx
|
|
@@ -4460,7 +4733,7 @@ var paystackLogo = '<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox=
|
|
|
4460
4733
|
var payfastLogo = '<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" id="Layer_2" data-name="Layer 2" viewBox="0 0 112.17 40"><defs><style> .cls-1 { fill: #e54360; } .cls-2 { fill: #0069b1; } </style></defs><g id="Layer_1-2" data-name="Layer 1"><g><g id="Layer_1-2" data-name="Layer 1-2"><g><path class="cls-1" d="M105.59,6.14h-3.81l6.58,7.82-6.51,7.76h3.81l6.51-7.76-6.58-7.82Z"></path><path class="cls-2" d="M15.91,13.83c0,1.32-.2,2.43-.59,3.42-.39.99-.92,1.84-1.58,2.56-.66.66-1.45,1.18-2.3,1.58-.85.33-1.71.53-2.63.53s-2.3-.26-3.16-.79-1.51-1.18-2.1-1.91v7.04H0V6.14h3.55v2.56c.59-.79,1.25-1.51,2.1-2.04.85-.59,1.91-.85,3.16-.85s1.78.2,2.63.53,1.64.85,2.3,1.58c.66.66,1.25,1.51,1.64,2.5s.53,2.1.53,3.42h0ZM12.3,13.83c0-.79-.13-1.45-.33-2.04-.26-.59-.53-1.12-.99-1.58-.39-.46-.85-.79-1.38-.99-.53-.26-1.12-.33-1.71-.33s-1.18.13-1.71.33c-.53.26-1.05.59-1.45,1.05-.39.46-.72.92-.99,1.58-.26.59-.33,1.32-.33,2.04s.13,1.45.33,2.04c.26.59.59,1.12.99,1.58s.85.79,1.45.99c.53.26,1.12.33,1.71.33s1.18-.13,1.71-.33c.53-.26.99-.59,1.38-.99.39-.46.72-.92.99-1.58.26-.59.33-1.32.33-2.1ZM31.49,21.52h-3.48v-1.91c-.53.59-1.18,1.12-2.04,1.58-.79.46-1.84.66-2.96.66s-1.45-.13-2.1-.33-1.25-.46-1.78-.85c-.46-.39-.85-.92-1.18-1.51-.26-.59-.46-1.32-.46-2.1h0c0-.92.13-1.64.46-2.24s.72-1.12,1.32-1.58c.59-.39,1.25-.72,1.97-.92.79-.2,1.64-.33,2.5-.33s1.71,0,2.37.2c.66.13,1.32.26,1.91.46v-.39c0-1.05-.33-1.91-.99-2.43-.66-.59-1.58-.85-2.83-.85s-1.64.07-2.37.26c-.66.2-1.38.39-2.1.72l-.99-2.83c.85-.39,1.71-.72,2.63-.92.92-.26,1.97-.33,3.22-.33,2.3,0,4.01.59,5.13,1.71,1.12,1.12,1.64,2.7,1.64,4.8v9.14h.13ZM28.08,15.94v-.99c-.46-.2-.99-.33-1.58-.46s-1.25-.2-1.91-.2c-1.12,0-1.97.2-2.63.66-.59.46-.92,1.05-.92,1.84h0c0,.79.26,1.38.85,1.78.59.39,1.32.59,2.1.59s1.12-.07,1.58-.26c.53-.13.92-.39,1.32-.66s.66-.66.85-1.05.33-.85.33-1.32v.07ZM48.92,6.14l-6.11,15.85c-.33.79-.66,1.45-.99,2.04-.33.53-.72.99-1.12,1.32s-.85.59-1.32.79c-.46.13-1.05.26-1.64.26s-1.38-.07-1.97-.26c-.59-.13-1.12-.39-1.64-.66l1.18-2.63c.33.2.66.33.99.39.33.13.72.2,1.05.2s.92-.13,1.25-.39c.33-.26.66-.72.92-1.38l-6.44-15.39h3.75l4.41,11.44,4.01-11.44h3.68s0-.13,0-.13ZM74.5,21.52h-3.48v-1.91c-.53.59-1.18,1.12-2.04,1.58-.79.46-1.84.66-2.96.66s-1.45-.13-2.1-.33-1.25-.46-1.78-.85c-.46-.39-.85-.92-1.18-1.51-.26-.59-.46-1.32-.46-2.1h0c0-.92.13-1.64.46-2.24s.72-1.12,1.32-1.58c.59-.39,1.25-.72,1.97-.92.79-.2,1.64-.33,2.5-.33s1.71,0,2.37.2c.66.13,1.32.26,1.91.46v-.39c0-1.05-.33-1.91-.99-2.43-.66-.59-1.58-.85-2.83-.85s-1.64.07-2.37.26c-.66.2-1.38.39-2.1.72l-.99-2.83c.85-.39,1.71-.72,2.63-.92.92-.26,1.97-.33,3.22-.33,2.3,0,4.01.59,5.13,1.71,1.12,1.12,1.64,2.7,1.64,4.8v9.14h.13ZM71.08,15.94v-.99c-.46-.2-.99-.33-1.58-.46s-1.25-.2-1.91-.2c-1.12,0-1.97.2-2.63.66s-.92,1.05-.92,1.84h0c0,.79.26,1.38.85,1.78.59.39,1.32.59,2.1.59s1.12-.07,1.58-.26c.53-.13.92-.39,1.32-.66s.66-.66.85-1.05.33-.85.33-1.32v.07ZM88.57,16.99c0,.79-.13,1.51-.46,2.1-.26.59-.72,1.12-1.25,1.51-.53.39-1.12.72-1.84.92-.72.2-1.45.26-2.24.26s-2.24-.2-3.42-.59c-1.12-.39-2.17-.99-3.16-1.71l1.58-2.37c.85.59,1.71,1.12,2.56,1.45.85.33,1.71.46,2.5.46s1.32-.13,1.78-.46.66-.72.66-1.25h0c0-.33-.07-.59-.26-.79-.2-.2-.46-.39-.79-.53-.33-.2-.66-.33-1.12-.46-.39-.13-.85-.26-1.32-.39-.59-.2-1.12-.39-1.71-.59-.59-.2-1.05-.46-1.58-.79-.46-.33-.79-.79-1.12-1.25-.26-.53-.46-1.12-.46-1.84h0c0-.79.13-1.45.39-2.04.26-.59.66-1.05,1.18-1.51.53-.39,1.12-.72,1.78-.92.66-.2,1.38-.33,2.17-.33s1.97.13,2.96.46,1.91.72,2.7,1.32l-1.38,2.5c-.72-.46-1.51-.79-2.24-1.05-.79-.26-1.45-.39-2.1-.39s-1.25.13-1.58.46c-.39.26-.53.66-.53,1.12h0c0,.33.07.59.26.79.2.2.46.39.79.53s.72.33,1.12.46c.46.13.85.26,1.32.39.59.2,1.12.39,1.71.59.59.26,1.05.53,1.51.85s.85.72,1.12,1.25c.26.46.46,1.05.46,1.78h0v.07h0ZM94.15,9.16v7.56c0,.66.2,1.18.53,1.51.33.26.79.46,1.38.46s1.51-.2,2.17-.53v2.89c-.46.26-.92.46-1.45.59s-1.12.2-1.78.2-1.25-.07-1.78-.26c-.53-.13-1.05-.39-1.45-.79-.39-.33-.72-.79-.92-1.38-.2-.59-.33-1.32-.33-2.17v-8.09h0v-3.02h0V1.93h3.55v4.21h4.14v3.02h-4.14.07,0Z"></path><path class="cls-2" d="M55.85,6.18h4.08v2.92h-4.02v12.36h-3.53v-12.36h-1.95v-2.94h1.95v-1.11c0-1.71.41-2.97,1.22-3.79.82-.84,1.98-1.25,3.5-1.25.62,0,1.16.04,1.6.12.45.08.86.17,1.25.29v2.97c-.35-.12-.69-.2-1.02-.26-.31-.08-.66-.12-1.05-.12-1.36,0-2.04.78-2.04,2.33v.85Z"></path></g></g><g><path class="cls-2" d="M67.39,33.45c0-.24-.04-.46-.12-.67-.07-.21-.18-.39-.32-.54-.14-.15-.32-.27-.53-.36s-.45-.14-.74-.14c-.25,0-.5.04-.72.14-.23.09-.42.21-.59.36-.16.15-.3.33-.41.54-.11.21-.17.43-.18.67h3.59ZM68.61,33.93v.2c0,.07,0,.14,0,.2h-4.8c0,.25.06.49.17.72.11.23.25.42.43.58.18.16.38.29.62.39.24.09.48.14.74.14.41,0,.76-.09,1.06-.27.3-.18.53-.4.7-.66l.84.67c-.33.43-.7.74-1.14.95-.43.2-.93.3-1.46.3-.46,0-.88-.07-1.27-.23-.39-.15-.72-.36-1.01-.64-.28-.27-.5-.61-.66-1-.16-.39-.25-.82-.25-1.3s.08-.9.24-1.3c.15-.4.38-.74.66-1.02.28-.28.62-.5,1-.66.38-.15.8-.24,1.23-.24s.84.07,1.21.22c.36.14.67.35.92.63.25.27.45.6.58.99.15.41.21.84.21,1.32h0Z"></path><path class="cls-2" d="M80.72,31.02l-1.37,4.66-1.48-4.66h-1.26l-1.45,4.66-1.38-4.66h-1.3l2.02,6.05h1.24l1.48-4.54h.03l1.49,4.54h1.25l2-6.05h-1.26Z"></path><path class="cls-2" d="M87.13,34.03c0-.29-.04-.56-.14-.82-.09-.27-.22-.49-.39-.69-.17-.2-.38-.35-.64-.48-.25-.12-.54-.18-.86-.18s-.61.06-.86.18c-.25.12-.46.28-.64.48-.17.21-.3.43-.39.69-.09.27-.14.54-.14.82s.04.56.14.82c.09.26.22.5.39.7.17.2.38.36.64.48.25.12.54.18.86.18s.61-.06.86-.18c.25-.12.46-.28.64-.48.17-.2.3-.43.39-.7.1-.26.14-.53.14-.82ZM88.39,34.02c0,.47-.08.9-.25,1.29-.16.39-.4.72-.69,1.02-.29.28-.64.51-1.03.66-.4.15-.82.24-1.29.24s-.89-.08-1.29-.24c-.4-.15-.74-.38-1.03-.66-.29-.28-.52-.63-.68-1.02-.16-.39-.25-.82-.25-1.29s.08-.9.25-1.28c.16-.39.39-.72.68-1,.29-.28.64-.5,1.03-.66.4-.15.82-.24,1.29-.24s.89.08,1.29.24c.4.15.74.37,1.03.66.29.28.53.62.69,1,.17.39.25.82.25,1.28Z"></path><path class="cls-2" d="M94.2,29.15h-1.2v7.92h1.2v-7.92Z"></path><path class="cls-2" d="M71.99,31.93v-.92h-1.51v-1.87h-1.19v6.13c0,.63.15,1.1.45,1.42.3.32.74.47,1.31.47.19,0,.36-.02.54-.04.14-.03.27-.06.39-.1v-.99c-.09.04-.19.06-.3.09-.13.03-.25.04-.35.04-.3,0-.52-.08-.66-.24-.14-.15-.2-.42-.2-.78v-3.21h1.51s0,0,0,0Z"></path><path class="cls-2" d="M91.98,30.85c-.41,0-.77.11-1.1.33-.33.22-.62.5-.78.86v-1.03h-1.13v6.05h1.2v-3.18c0-.25.04-.5.1-.74.06-.24.17-.43.31-.62.14-.18.32-.32.53-.43.21-.11.46-.16.75-.16.19,0,.37.02.54.06v-1.11c-.12-.03-.26-.04-.43-.04h0Z"></path><path class="cls-2" d="M61.81,32.35c-.09-.3-.23-.55-.42-.78-.19-.22-.42-.4-.7-.53-.28-.13-.62-.2-1.01-.2-.22,0-.43.03-.64.09-.2.06-.39.14-.56.25-.17.11-.32.23-.45.37-.14.14-.27.29-.35.45v-.99h-1.13v6.05h1.2v-3.22c0-.6.15-1.09.45-1.44.3-.36.69-.54,1.16-.54.28,0,.51.06.69.15.18.1.32.24.42.41.1.17.17.36.21.59.04.22.06.45.06.7v3.35h1.21v-3.75c0-.35-.04-.67-.14-.97h0Z"></path><path class="cls-2" d="M96.75,31.02h1.48l-2.55,3.05,2.51,3h-1.48l-2.52-3,2.55-3.05Z"></path><path class="cls-2" d="M44.34,36.12c.3,0,.57-.05.81-.15.24-.11.44-.25.61-.42.17-.18.29-.4.39-.65.09-.26.14-.53.14-.83s-.05-.57-.14-.82c-.09-.26-.22-.47-.39-.65-.17-.18-.37-.32-.61-.42-.24-.11-.51-.16-.81-.16s-.57.05-.81.16c-.24.1-.44.24-.61.42-.17.17-.29.39-.39.65-.09.25-.14.52-.14.82s.05.57.14.83c.09.25.22.46.39.65.17.17.37.31.61.42.24.1.51.15.81.15ZM41.29,27.64h1.12v4.34h.03c.2-.31.48-.54.86-.72.37-.18.77-.27,1.19-.27.45,0,.86.08,1.23.24.37.16.69.38.94.66.27.27.47.6.61.98.14.37.21.78.21,1.22s-.07.84-.21,1.22c-.14.37-.34.7-.61.98-.26.28-.57.5-.94.66-.36.16-.77.24-1.23.24-.4,0-.78-.09-1.17-.26-.37-.17-.67-.42-.88-.73h-.03v.84h-1.12v-9.38h0Z"></path><path class="cls-2" d="M47.55,31.14h1.29l1.75,4.59h.03l1.66-4.59h1.2l-2.79,7.15c-.1.26-.2.49-.31.69-.11.21-.24.4-.39.54-.15.15-.33.27-.54.35-.21.08-.46.12-.77.12-.17,0-.33-.01-.51-.04-.17-.02-.33-.06-.48-.12l.14-1.02c.22.09.45.14.67.14.17,0,.32-.03.43-.07.12-.04.23-.11.31-.2.09-.08.17-.18.22-.3.06-.12.12-.25.17-.4l.36-.93-2.44-5.92h0Z"></path></g></g></g></svg> ';
|
|
4461
4734
|
|
|
4462
4735
|
// src/components/BookingWizard/PaymentStep.tsx
|
|
4463
|
-
import { Fragment as
|
|
4736
|
+
import { Fragment as Fragment6, jsx as jsx79, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4464
4737
|
var svgPicture = (svg) => `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
4465
4738
|
var BUILT_IN_LOGO = {
|
|
4466
4739
|
PAYSTACK: svgPicture(paystackLogo),
|
|
@@ -4513,11 +4786,11 @@ function PaymentStep({
|
|
|
4513
4786
|
return /* @__PURE__ */ jsxs42("div", { className: "mt-6", children: [
|
|
4514
4787
|
/* @__PURE__ */ jsx79(AmountCard, { total, deposit, days, chosen }),
|
|
4515
4788
|
/* @__PURE__ */ jsxs42("div", { role: "radiogroup", "aria-label": "How you pay", className: "mt-2", children: [
|
|
4516
|
-
online.length > 0 && /* @__PURE__ */ jsxs42(
|
|
4789
|
+
online.length > 0 && /* @__PURE__ */ jsxs42(Fragment6, { children: [
|
|
4517
4790
|
/* @__PURE__ */ jsx79(GroupLabel, { icon: Lock, children: "Pay online now" }),
|
|
4518
4791
|
/* @__PURE__ */ jsx79("div", { className: "flex flex-col gap-2", children: online.map(card) })
|
|
4519
4792
|
] }),
|
|
4520
|
-
atBranch.length > 0 && /* @__PURE__ */ jsxs42(
|
|
4793
|
+
atBranch.length > 0 && /* @__PURE__ */ jsxs42(Fragment6, { children: [
|
|
4521
4794
|
/* @__PURE__ */ jsx79(GroupLabel, { icon: Building22, children: "Pay at the branch" }),
|
|
4522
4795
|
/* @__PURE__ */ jsx79("div", { className: "flex flex-col gap-2", children: atBranch.map(card) })
|
|
4523
4796
|
] })
|
|
@@ -5606,6 +5879,15 @@ function normalizeServiceType(raw) {
|
|
|
5606
5879
|
}
|
|
5607
5880
|
|
|
5608
5881
|
// src/lib/queries/extras.queries.ts
|
|
5882
|
+
var SUPPLIER_GROUPS = {
|
|
5883
|
+
WAI: "Waivers",
|
|
5884
|
+
ADC: "Additional services",
|
|
5885
|
+
ADH: "Additional services",
|
|
5886
|
+
EXS: "Extended services"
|
|
5887
|
+
};
|
|
5888
|
+
function supplierGroup(raw) {
|
|
5889
|
+
return raw ? SUPPLIER_GROUPS[raw.trim().toUpperCase()] : void 0;
|
|
5890
|
+
}
|
|
5609
5891
|
function extrasQueryKey(car) {
|
|
5610
5892
|
const categories = (car.categories?.length ? car.categories : car.category ? [car.category] : []).join(",");
|
|
5611
5893
|
return ["extras", car.id, categories];
|
|
@@ -5619,12 +5901,12 @@ var ExtrasQueries = class extends BaseQuery {
|
|
|
5619
5901
|
*/
|
|
5620
5902
|
inferIcon(name, type) {
|
|
5621
5903
|
const haystack = `${name} ${type ?? ""}`.toLowerCase();
|
|
5622
|
-
if (/child|baby|infant/.test(haystack)) return "child";
|
|
5623
|
-
if (/waiver|excess|insur|cdw|damage|theft|liab/.test(haystack)) return "shield";
|
|
5904
|
+
if (/child|baby|infant|isofix|booster/.test(haystack)) return "child";
|
|
5624
5905
|
if (/tyre|tire|glass|windscreen/.test(haystack)) return "tyre";
|
|
5906
|
+
if (/waiver|excess|insur|cdw|damage|theft|liab|protect/.test(haystack)) return "shield";
|
|
5625
5907
|
if (/driver/.test(haystack)) return "driver";
|
|
5626
5908
|
if (/gps|navigat/.test(haystack)) return "gps";
|
|
5627
|
-
if (/
|
|
5909
|
+
if (/wi-?fi|hotspot|internet|mifi|router|\bdata\b|\bsim\b/.test(haystack)) return "wifi";
|
|
5628
5910
|
if (/deliver|collect/.test(haystack)) return "delivery";
|
|
5629
5911
|
return "document";
|
|
5630
5912
|
}
|
|
@@ -5748,6 +6030,11 @@ var ExtrasQueries = class extends BaseQuery {
|
|
|
5748
6030
|
if (!catalogue.length) return null;
|
|
5749
6031
|
let mapped = identifier === "sanisixt" ? this.mergeSaniCatalogue(catalogue, this.quoteOptions(car)) : catalogue.map((item) => this.mapCatalogueRow(item));
|
|
5750
6032
|
if (identifier === "bluu") mapped = this.applyBluuGrouping(mapped);
|
|
6033
|
+
const groups = new Map(catalogue.map((item) => [item.code, supplierGroup(item.serviceType)]));
|
|
6034
|
+
mapped = mapped.map((extra) => {
|
|
6035
|
+
const group = groups.get(extra.code);
|
|
6036
|
+
return group ? { ...extra, group } : extra;
|
|
6037
|
+
});
|
|
5751
6038
|
return mapped.length > 0 ? mapped : null;
|
|
5752
6039
|
}
|
|
5753
6040
|
};
|
|
@@ -5901,7 +6188,7 @@ function Stepper({
|
|
|
5901
6188
|
}
|
|
5902
6189
|
|
|
5903
6190
|
// src/components/BookingWizard/ExtraCard.tsx
|
|
5904
|
-
import { Fragment as
|
|
6191
|
+
import { Fragment as Fragment7, jsx as jsx89, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5905
6192
|
function ExtraCard({
|
|
5906
6193
|
extra,
|
|
5907
6194
|
quantity,
|
|
@@ -5973,7 +6260,7 @@ function ExtraCard({
|
|
|
5973
6260
|
/* @__PURE__ */ jsx89("span", { className: "mt-3 flex min-h-8 items-center justify-between gap-2 border-t border-border pt-3", children: pricePending ? /* @__PURE__ */ jsxs47("span", { className: "flex items-center gap-1.5 text-[0.75rem] text-muted-foreground", children: [
|
|
5974
6261
|
/* @__PURE__ */ jsx89(LoaderCircle, { className: "size-3 animate-spin", "aria-hidden": "true" }),
|
|
5975
6262
|
"Fetching your quote\u2026"
|
|
5976
|
-
] }) : extra.priceUnknown ? /* @__PURE__ */ jsx89("span", { className: "text-[0.75rem] text-muted-foreground", children: selected ? "Couldn't price this \u2014 confirm with supplier" : "Priced once selected" }) : /* @__PURE__ */ jsxs47(
|
|
6263
|
+
] }) : extra.priceUnknown ? /* @__PURE__ */ jsx89("span", { className: "text-[0.75rem] text-muted-foreground", children: selected ? "Couldn't price this \u2014 confirm with supplier" : "Priced once selected" }) : /* @__PURE__ */ jsxs47(Fragment7, { children: [
|
|
5977
6264
|
/* @__PURE__ */ jsxs47("span", { className: "fb-tabular text-[0.875rem] font-semibold text-foreground", children: [
|
|
5978
6265
|
formatZAR(extra.perDay ?? extra.onceOff ?? 0),
|
|
5979
6266
|
/* @__PURE__ */ jsx89("span", { className: "text-[0.75rem] font-normal text-muted-foreground", children: priceSuffix })
|
|
@@ -6391,7 +6678,7 @@ var useCustomerStore = create2()(
|
|
|
6391
6678
|
|
|
6392
6679
|
// src/components/BookingWizard/PriceSummary.tsx
|
|
6393
6680
|
import { Info } from "lucide-react";
|
|
6394
|
-
import { Fragment as
|
|
6681
|
+
import { Fragment as Fragment8, jsx as jsx99, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
6395
6682
|
function PriceSummary({ quote, className }) {
|
|
6396
6683
|
return /* @__PURE__ */ jsxs57(
|
|
6397
6684
|
"section",
|
|
@@ -6424,7 +6711,7 @@ function PriceSummary({ quote, className }) {
|
|
|
6424
6711
|
/* @__PURE__ */ jsx99("span", { className: "text-[0.75rem] text-muted-foreground", children: "Excess if the car is damaged" }),
|
|
6425
6712
|
/* @__PURE__ */ jsx99("span", { className: "fb-tabular text-[0.8125rem] font-medium text-foreground", children: formatZAR(quote.excess) })
|
|
6426
6713
|
] }),
|
|
6427
|
-
quote.deposit > 0 && /* @__PURE__ */ jsxs57(
|
|
6714
|
+
quote.deposit > 0 && /* @__PURE__ */ jsxs57(Fragment8, { children: [
|
|
6428
6715
|
/* @__PURE__ */ jsxs57("div", { className: `flex items-baseline justify-between gap-4 ${quote.excess > 0 ? "mt-1.5" : ""}`, children: [
|
|
6429
6716
|
/* @__PURE__ */ jsx99("span", { className: "text-[0.75rem] text-muted-foreground", children: "Deposit needed (refundable)" }),
|
|
6430
6717
|
/* @__PURE__ */ jsx99("span", { className: "fb-tabular text-[0.8125rem] font-medium text-foreground", children: formatZAR(quote.deposit) })
|
|
@@ -7242,7 +7529,7 @@ function WhatsNext(props) {
|
|
|
7242
7529
|
}
|
|
7243
7530
|
|
|
7244
7531
|
// src/components/BookingWizard/BookingConfirmation.tsx
|
|
7245
|
-
import { Fragment as
|
|
7532
|
+
import { Fragment as Fragment9, jsx as jsx107, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
7246
7533
|
function BookingConfirmation({
|
|
7247
7534
|
car,
|
|
7248
7535
|
driver,
|
|
@@ -7325,7 +7612,7 @@ function BookingConfirmation({
|
|
|
7325
7612
|
`A credit card in the driver's own name for the deposit${depositAmount > 0 ? ` of ${formatZAR(depositAmount)}` : ""}.${car.liability > 0 ? ` The excess on this vehicle is ${formatZAR(car.liability)}.` : ""}`,
|
|
7326
7613
|
`The booking number ${bookingNumber}.`
|
|
7327
7614
|
];
|
|
7328
|
-
const changeNote = /* @__PURE__ */ jsxs64(
|
|
7615
|
+
const changeNote = /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
7329
7616
|
"Contact us with your PIN ",
|
|
7330
7617
|
/* @__PURE__ */ jsx107("span", { className: "fb-tabular font-medium text-foreground", children: pin }),
|
|
7331
7618
|
" and we'll handle it with ",
|
|
@@ -7354,7 +7641,7 @@ function BookingConfirmation({
|
|
|
7354
7641
|
bringLine: `Bring the driving licence, ${isSouthAfrica ? "ID" : "passport"} and a credit card in the driver's name${depositAmount > 0 ? ` for the ${formatZAR(depositAmount)} deposit` : ""}.`
|
|
7355
7642
|
};
|
|
7356
7643
|
return /* @__PURE__ */ jsxs64("div", { className: "flex flex-col gap-6 py-2", children: [
|
|
7357
|
-
look === "next" ? /* @__PURE__ */ jsxs64(
|
|
7644
|
+
look === "next" ? /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
7358
7645
|
/* @__PURE__ */ jsx107("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs64(GhostPill, { type: "button", onClick: downloadReceipt, children: [
|
|
7359
7646
|
/* @__PURE__ */ jsx107(Download, { className: "size-4", "aria-hidden": "true" }),
|
|
7360
7647
|
"Download receipt"
|
|
@@ -7386,7 +7673,7 @@ function BookingConfirmation({
|
|
|
7386
7673
|
" ",
|
|
7387
7674
|
"A copy is on its way to ",
|
|
7388
7675
|
/* @__PURE__ */ jsx107("span", { className: "font-medium text-foreground", children: driver.email }),
|
|
7389
|
-
driver.additionalEmail ? /* @__PURE__ */ jsxs64(
|
|
7676
|
+
driver.additionalEmail ? /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
7390
7677
|
" ",
|
|
7391
7678
|
"and ",
|
|
7392
7679
|
/* @__PURE__ */ jsx107("span", { className: "font-medium text-foreground", children: driver.additionalEmail })
|
|
@@ -7403,7 +7690,7 @@ function BookingConfirmation({
|
|
|
7403
7690
|
}
|
|
7404
7691
|
),
|
|
7405
7692
|
look === "receipt" && /* @__PURE__ */ jsx107(motion8.div, { initial: { opacity: 0, y: 16 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.45, ease: "easeOut", delay: 0.1 }, children: /* @__PURE__ */ jsx107(ReceiptSlip, { ...lookProps }) }),
|
|
7406
|
-
look === "pass" && /* @__PURE__ */ jsxs64(
|
|
7693
|
+
look === "pass" && /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
7407
7694
|
/* @__PURE__ */ jsx107(
|
|
7408
7695
|
motion8.div,
|
|
7409
7696
|
{
|
|
@@ -7430,7 +7717,7 @@ function BookingConfirmation({
|
|
|
7430
7717
|
},
|
|
7431
7718
|
{
|
|
7432
7719
|
title: "Check your email",
|
|
7433
|
-
body: /* @__PURE__ */ jsxs64(
|
|
7720
|
+
body: /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
7434
7721
|
"The confirmation is on its way to",
|
|
7435
7722
|
" ",
|
|
7436
7723
|
/* @__PURE__ */ jsx107("span", { className: "font-medium break-all text-foreground", children: driver.email }),
|
|
@@ -7611,9 +7898,9 @@ function StepChecklist({
|
|
|
7611
7898
|
|
|
7612
7899
|
// src/components/BookingWizard/ExtrasLooks.tsx
|
|
7613
7900
|
import { Check as Check8, CircleAlert as CircleAlert3, LoaderCircle as LoaderCircle2, Minus as Minus2, Plus as Plus2, ShieldCheck as ShieldCheck4, Sparkles, Users as Users3 } from "lucide-react";
|
|
7614
|
-
import { Fragment as
|
|
7901
|
+
import { Fragment as Fragment10, jsx as jsx109, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7615
7902
|
function extraKind(extra) {
|
|
7616
|
-
if (extra.icon === "shield" || extra.icon === "tyre"
|
|
7903
|
+
if (extra.icon === "shield" || extra.icon === "tyre") return "cover";
|
|
7617
7904
|
if (extra.icon === "child" || extra.icon === "driver") return "people";
|
|
7618
7905
|
return "gadgets";
|
|
7619
7906
|
}
|
|
@@ -7638,80 +7925,6 @@ function Quantity({ extra, quantity, onChange }) {
|
|
|
7638
7925
|
/* @__PURE__ */ jsx109(Stepper, { label: `More ${name}`, onClick: () => onChange(quantity + 1), disabled: quantity >= extra.maxQuantity, children: /* @__PURE__ */ jsx109(Plus2, { className: "size-3" }) })
|
|
7639
7926
|
] });
|
|
7640
7927
|
}
|
|
7641
|
-
function PriceLine({ extra, days, pending }) {
|
|
7642
|
-
if (pending) {
|
|
7643
|
-
return /* @__PURE__ */ jsxs66("span", { className: "flex items-center gap-1.5 text-[0.75rem] text-muted-foreground", children: [
|
|
7644
|
-
/* @__PURE__ */ jsx109(LoaderCircle2, { className: "size-3 animate-spin", "aria-hidden": "true" }),
|
|
7645
|
-
"Fetching price"
|
|
7646
|
-
] });
|
|
7647
|
-
}
|
|
7648
|
-
if (extra.priceUnknown) return /* @__PURE__ */ jsx109("span", { className: "text-[0.75rem] text-muted-foreground", children: "Priced once added" });
|
|
7649
|
-
return /* @__PURE__ */ jsxs66("span", { className: "fb-tabular text-[0.8125rem] text-muted-foreground", children: [
|
|
7650
|
-
/* @__PURE__ */ jsx109("span", { className: "font-medium text-foreground", children: priceWords(extra) }),
|
|
7651
|
-
extra.perDay ? ` \xB7 ${formatZAR(unitTotal(extra, days))} for ${days} ${days === 1 ? "day" : "days"}` : null
|
|
7652
|
-
] });
|
|
7653
|
-
}
|
|
7654
|
-
function ExtraRow({
|
|
7655
|
-
extra,
|
|
7656
|
-
quantity,
|
|
7657
|
-
days,
|
|
7658
|
-
pending,
|
|
7659
|
-
error,
|
|
7660
|
-
onChange
|
|
7661
|
-
}) {
|
|
7662
|
-
const selected = quantity > 0;
|
|
7663
|
-
const Icon = EXTRA_ICONS[extra.icon];
|
|
7664
|
-
const name = displayName(extra.name);
|
|
7665
|
-
return /* @__PURE__ */ jsxs66(
|
|
7666
|
-
"li",
|
|
7667
|
-
{
|
|
7668
|
-
className: cn(
|
|
7669
|
-
"rounded-xl border bg-card px-3.5 py-3 transition-colors duration-200",
|
|
7670
|
-
selected ? "border-wizard-selected bg-wizard-selected/[0.04]" : "border-border hover:border-border-strong"
|
|
7671
|
-
),
|
|
7672
|
-
children: [
|
|
7673
|
-
/* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-3", children: [
|
|
7674
|
-
/* @__PURE__ */ jsx109(
|
|
7675
|
-
"span",
|
|
7676
|
-
{
|
|
7677
|
-
className: cn(
|
|
7678
|
-
"grid size-9 shrink-0 place-items-center rounded-lg transition-colors duration-200",
|
|
7679
|
-
selected ? "bg-wizard-selected/12 text-foreground" : "bg-surface-2 text-muted-foreground"
|
|
7680
|
-
),
|
|
7681
|
-
children: /* @__PURE__ */ jsx109(Icon, { className: "size-4", "aria-hidden": "true", strokeWidth: 1.75 })
|
|
7682
|
-
}
|
|
7683
|
-
),
|
|
7684
|
-
/* @__PURE__ */ jsxs66("span", { className: "min-w-0 flex-1", children: [
|
|
7685
|
-
/* @__PURE__ */ jsx109("span", { className: "block truncate text-[0.875rem] leading-snug font-medium text-foreground", children: name }),
|
|
7686
|
-
/* @__PURE__ */ jsx109("span", { className: "mt-0.5 block truncate", children: /* @__PURE__ */ jsx109(PriceLine, { extra, days, pending }) })
|
|
7687
|
-
] }),
|
|
7688
|
-
selected && extra.maxQuantity > 1 && /* @__PURE__ */ jsx109(Quantity, { extra, quantity, onChange }),
|
|
7689
|
-
/* @__PURE__ */ jsxs66(
|
|
7690
|
-
"button",
|
|
7691
|
-
{
|
|
7692
|
-
type: "button",
|
|
7693
|
-
"aria-pressed": selected,
|
|
7694
|
-
"aria-label": `${selected ? "Remove" : "Add"} ${name}`,
|
|
7695
|
-
onClick: () => onChange(selected ? 0 : 1),
|
|
7696
|
-
className: cn(
|
|
7697
|
-
"fb-focus flex h-8 shrink-0 items-center gap-1 rounded-lg border px-3 text-[0.8125rem] font-medium transition-colors duration-150",
|
|
7698
|
-
selected ? "border-wizard-selected bg-wizard-selected text-wizard-selected-fg hover:bg-wizard-selected/90" : "border-border bg-card text-foreground hover:border-border-strong hover:bg-surface-2"
|
|
7699
|
-
),
|
|
7700
|
-
children: [
|
|
7701
|
-
selected ? /* @__PURE__ */ jsx109(Check8, { className: "size-3.5", strokeWidth: 2.5, "aria-hidden": "true" }) : /* @__PURE__ */ jsx109(Plus2, { className: "size-3.5", "aria-hidden": "true" }),
|
|
7702
|
-
selected ? "Added" : "Add"
|
|
7703
|
-
]
|
|
7704
|
-
}
|
|
7705
|
-
)
|
|
7706
|
-
] }),
|
|
7707
|
-
error && /* @__PURE__ */ jsxs66("p", { className: "mt-2 flex items-start gap-1.5 pl-12 text-[0.75rem] leading-snug text-destructive", children: [
|
|
7708
|
-
/* @__PURE__ */ jsx109(CircleAlert3, { className: "mt-px size-3 shrink-0", "aria-hidden": "true" }),
|
|
7709
|
-
error
|
|
7710
|
-
] })
|
|
7711
|
-
]
|
|
7712
|
-
}
|
|
7713
|
-
);
|
|
7714
|
-
}
|
|
7715
7928
|
function PriceText({ extra, quantity, days, pending }) {
|
|
7716
7929
|
if (pending) {
|
|
7717
7930
|
return /* @__PURE__ */ jsxs66("span", { className: "flex items-center gap-1.5 text-[0.75rem] text-muted-foreground", children: [
|
|
@@ -7776,135 +7989,205 @@ function ExtrasList({ extras, selection, days, pendingCode, errors, onChange })
|
|
|
7776
7989
|
] }, kind);
|
|
7777
7990
|
}) });
|
|
7778
7991
|
}
|
|
7779
|
-
function
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
}
|
|
7787
|
-
packages.push({ id: "full", name: "Full", blurb: "Every cover this supplier offers", covers });
|
|
7788
|
-
return packages;
|
|
7992
|
+
function isEssential(extra) {
|
|
7993
|
+
if (extra.icon === "tyre" || extra.icon === "gps" || extra.icon === "wifi") return true;
|
|
7994
|
+
return /usb|charger/i.test(extra.name);
|
|
7995
|
+
}
|
|
7996
|
+
function essentialExtras(extras) {
|
|
7997
|
+
const rank = (extra) => extra.icon === "tyre" ? 0 : extra.icon === "gps" ? 1 : /usb|charger/i.test(extra.name) ? 2 : 3;
|
|
7998
|
+
return extras.filter(isEssential).sort((a, b) => rank(a) - rank(b));
|
|
7789
7999
|
}
|
|
7790
8000
|
function CoverPackages(props) {
|
|
7791
8001
|
const { extras, selection, days, pendingCode, errors, onChange } = props;
|
|
7792
|
-
const
|
|
7793
|
-
if (
|
|
7794
|
-
const allCovers = packages[packages.length - 1].covers;
|
|
8002
|
+
const essentials = essentialExtras(extras);
|
|
8003
|
+
if (essentials.length === 0) return /* @__PURE__ */ jsx109(ExtrasList, { ...props });
|
|
7795
8004
|
const isOn = (extra) => (selection[extra.code] ?? 0) > 0;
|
|
7796
|
-
const
|
|
7797
|
-
const
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
if (want !== isOn(extra)) onChange(extra, want ? 1 : 0);
|
|
7801
|
-
}
|
|
8005
|
+
const picked = essentials.filter(isOn);
|
|
8006
|
+
const plan = picked.length ? "essential" : "basic";
|
|
8007
|
+
const setAll = (on) => {
|
|
8008
|
+
for (const extra of essentials) if (isOn(extra) !== on) onChange(extra, on ? 1 : 0);
|
|
7802
8009
|
};
|
|
7803
|
-
const others = extras.filter((extra) =>
|
|
8010
|
+
const others = extras.filter((extra) => !isEssential(extra));
|
|
7804
8011
|
const dayWords = `${days} ${days === 1 ? "day" : "days"}`;
|
|
8012
|
+
const sum = (list) => list.reduce((total, extra) => total + unitTotal(extra, days), 0);
|
|
8013
|
+
const shown = plan === "essential" ? picked : essentials;
|
|
8014
|
+
const unpriced = shown.some((extra) => extra.priceUnknown);
|
|
8015
|
+
const pending = essentials.some((extra) => extra.code === pendingCode);
|
|
8016
|
+
const card = (on) => cn(
|
|
8017
|
+
"relative flex flex-col rounded-xl border bg-card transition-[border-color,background-color,box-shadow] duration-200",
|
|
8018
|
+
on ? "border-wizard-selected bg-wizard-selected/[0.04] ring-1 ring-wizard-selected" : "border-border hover:border-border-strong"
|
|
8019
|
+
);
|
|
8020
|
+
const mark = (on) => /* @__PURE__ */ jsx109(
|
|
8021
|
+
"span",
|
|
8022
|
+
{
|
|
8023
|
+
"aria-hidden": "true",
|
|
8024
|
+
className: cn(
|
|
8025
|
+
"absolute top-4 right-4 grid size-4 place-items-center rounded-full border transition-colors duration-200",
|
|
8026
|
+
on ? "border-wizard-selected bg-wizard-selected text-wizard-selected-fg" : "border-border-strong bg-card"
|
|
8027
|
+
),
|
|
8028
|
+
children: on && /* @__PURE__ */ jsx109(Check8, { className: "size-2.5", strokeWidth: 3.5 })
|
|
8029
|
+
}
|
|
8030
|
+
);
|
|
7805
8031
|
return /* @__PURE__ */ jsxs66("div", { className: "mt-7 flex flex-col gap-8", children: [
|
|
7806
8032
|
/* @__PURE__ */ jsxs66("section", { "aria-labelledby": "fb-cover-heading", children: [
|
|
7807
8033
|
/* @__PURE__ */ jsxs66("div", { className: "mb-3", children: [
|
|
7808
|
-
/* @__PURE__ */ jsx109("h3", { id: "fb-cover-heading", className: "text-[0.9375rem] font-semibold text-foreground", children: "
|
|
8034
|
+
/* @__PURE__ */ jsx109("h3", { id: "fb-cover-heading", className: "text-[0.9375rem] font-semibold text-foreground", children: "Your plan" }),
|
|
7809
8035
|
/* @__PURE__ */ jsxs66("p", { className: "mt-0.5 text-[0.8125rem] text-muted-foreground", children: [
|
|
7810
|
-
"
|
|
8036
|
+
"Basic keeps the rental as quoted. Essential adds the everyday extras; untick any you don\u2019t need. Prices are for your ",
|
|
7811
8037
|
dayWords,
|
|
7812
8038
|
"."
|
|
7813
8039
|
] })
|
|
7814
8040
|
] }),
|
|
7815
|
-
/* @__PURE__ */
|
|
7816
|
-
"div",
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
"
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
8041
|
+
/* @__PURE__ */ jsxs66("div", { role: "radiogroup", "aria-labelledby": "fb-cover-heading", className: "grid gap-3 md:grid-cols-2", children: [
|
|
8042
|
+
/* @__PURE__ */ jsx109("div", { className: card(plan === "basic"), children: /* @__PURE__ */ jsxs66("button", { type: "button", role: "radio", "aria-checked": plan === "basic", onClick: () => setAll(false), className: "fb-focus flex h-full flex-col rounded-xl p-4 text-left", children: [
|
|
8043
|
+
mark(plan === "basic"),
|
|
8044
|
+
/* @__PURE__ */ jsx109("span", { className: "pr-6 text-[0.9375rem] font-semibold text-foreground", children: "Basic" }),
|
|
8045
|
+
/* @__PURE__ */ jsx109("span", { className: "mt-0.5 text-[0.8125rem] leading-snug text-muted-foreground", children: "The rental as quoted, with nothing added" }),
|
|
8046
|
+
/* @__PURE__ */ jsx109("span", { className: "mt-3 text-[0.9375rem] font-semibold text-foreground", children: "No extra cost" })
|
|
8047
|
+
] }) }),
|
|
8048
|
+
/* @__PURE__ */ jsxs66("div", { className: card(plan === "essential"), children: [
|
|
8049
|
+
/* @__PURE__ */ jsxs66("button", { type: "button", role: "radio", "aria-checked": plan === "essential", onClick: () => setAll(true), className: "fb-focus flex flex-col rounded-t-xl px-4 pt-4 pb-3 text-left", children: [
|
|
8050
|
+
mark(plan === "essential"),
|
|
8051
|
+
/* @__PURE__ */ jsxs66("span", { className: "flex items-center gap-2 pr-6", children: [
|
|
8052
|
+
/* @__PURE__ */ jsx109("span", { className: "text-[0.9375rem] font-semibold text-foreground", children: "Essential" }),
|
|
8053
|
+
/* @__PURE__ */ jsx109("span", { className: "text-[0.75rem] font-medium text-muted-foreground", children: "\xB7 Recommended" })
|
|
8054
|
+
] }),
|
|
8055
|
+
/* @__PURE__ */ jsx109("span", { className: "mt-0.5 text-[0.8125rem] leading-snug text-muted-foreground", children: "Cover and the gadgets most people want" }),
|
|
8056
|
+
/* @__PURE__ */ jsx109("span", { className: "fb-tabular mt-3 flex min-h-6 items-baseline gap-1.5 text-[0.9375rem] font-semibold text-foreground", children: pending ? /* @__PURE__ */ jsx109(LoaderCircle2, { className: "size-4 animate-spin text-muted-foreground", "aria-label": "Fetching price" }) : unpriced ? /* @__PURE__ */ jsx109("span", { className: "text-[0.8125rem] font-medium text-muted-foreground", children: "Priced once chosen" }) : /* @__PURE__ */ jsxs66(Fragment10, { children: [
|
|
8057
|
+
"+",
|
|
8058
|
+
formatZAR(sum(shown)),
|
|
8059
|
+
/* @__PURE__ */ jsxs66("span", { className: "text-[0.75rem] font-normal text-muted-foreground", children: [
|
|
8060
|
+
"for ",
|
|
8061
|
+
dayWords
|
|
8062
|
+
] })
|
|
8063
|
+
] }) })
|
|
8064
|
+
] }),
|
|
8065
|
+
/* @__PURE__ */ jsx109("ul", { className: "mx-4 mb-4 flex flex-col gap-0.5 border-t border-border pt-2 text-[0.8125rem]", children: essentials.map((extra) => {
|
|
8066
|
+
const on = isOn(extra);
|
|
8067
|
+
return /* @__PURE__ */ jsx109("li", { children: /* @__PURE__ */ jsxs66(
|
|
7827
8068
|
"button",
|
|
7828
8069
|
{
|
|
7829
8070
|
type: "button",
|
|
7830
|
-
role: "
|
|
8071
|
+
role: "checkbox",
|
|
7831
8072
|
"aria-checked": on,
|
|
7832
|
-
onClick: () =>
|
|
7833
|
-
className:
|
|
7834
|
-
"fb-focus relative flex flex-col rounded-xl border bg-card p-4 text-left transition-[border-color,background-color,box-shadow] duration-200",
|
|
7835
|
-
on ? "border-wizard-selected bg-wizard-selected/[0.04] ring-1 ring-wizard-selected" : "border-border hover:border-border-strong"
|
|
7836
|
-
),
|
|
8073
|
+
onClick: () => onChange(extra, on ? 0 : 1),
|
|
8074
|
+
className: "fb-focus -mx-1.5 flex w-[calc(100%+0.75rem)] items-center gap-2.5 rounded-lg px-1.5 py-1.5 text-left transition-colors duration-150 hover:bg-muted",
|
|
7837
8075
|
children: [
|
|
7838
8076
|
/* @__PURE__ */ jsx109(
|
|
7839
8077
|
"span",
|
|
7840
8078
|
{
|
|
7841
8079
|
"aria-hidden": "true",
|
|
7842
8080
|
className: cn(
|
|
7843
|
-
"
|
|
8081
|
+
"grid size-4 shrink-0 place-items-center rounded-[5px] border transition-colors duration-150",
|
|
7844
8082
|
on ? "border-wizard-selected bg-wizard-selected text-wizard-selected-fg" : "border-border-strong bg-card"
|
|
7845
8083
|
),
|
|
7846
|
-
children: on && /* @__PURE__ */ jsx109(Check8, { className: "size-
|
|
8084
|
+
children: on && /* @__PURE__ */ jsx109(Check8, { className: "size-3", strokeWidth: 3.5 })
|
|
7847
8085
|
}
|
|
7848
8086
|
),
|
|
7849
|
-
/* @__PURE__ */
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
/* @__PURE__ */ jsx109("span", { className: "fb-tabular mt-3 flex min-h-6 items-baseline gap-1.5 text-[0.9375rem] font-semibold text-foreground", children: pending ? /* @__PURE__ */ jsx109(LoaderCircle2, { className: "size-4 animate-spin text-muted-foreground", "aria-label": "Fetching price" }) : unpriced ? /* @__PURE__ */ jsx109("span", { className: "text-[0.8125rem] font-medium text-muted-foreground", children: "Priced once chosen" }) : cost > 0 ? /* @__PURE__ */ jsxs66(Fragment9, { children: [
|
|
7855
|
-
"+",
|
|
7856
|
-
formatZAR(cost),
|
|
7857
|
-
/* @__PURE__ */ jsxs66("span", { className: "text-[0.75rem] font-normal text-muted-foreground", children: [
|
|
7858
|
-
"for ",
|
|
7859
|
-
dayWords
|
|
7860
|
-
] })
|
|
7861
|
-
] }) : "Included" }),
|
|
7862
|
-
/* @__PURE__ */ jsx109("ul", { className: "mt-3 flex flex-col gap-1.5 border-t border-border pt-3 text-[0.8125rem]", children: allCovers.map((extra) => {
|
|
7863
|
-
const has = pkg.covers.includes(extra);
|
|
7864
|
-
return /* @__PURE__ */ jsxs66("li", { className: cn("flex items-start gap-2", has ? "text-foreground" : "text-muted-foreground"), children: [
|
|
7865
|
-
has ? /* @__PURE__ */ jsx109(Check8, { className: "mt-0.5 size-3.5 shrink-0 text-wizard-selected", strokeWidth: 2.5, "aria-hidden": "true" }) : /* @__PURE__ */ jsx109(Minus2, { className: "mt-0.5 size-3.5 shrink-0 opacity-50", "aria-hidden": "true" }),
|
|
7866
|
-
/* @__PURE__ */ jsxs66("span", { className: "leading-snug", children: [
|
|
7867
|
-
displayName(extra.name),
|
|
7868
|
-
/* @__PURE__ */ jsx109("span", { className: "sr-only", children: has ? " (included)" : " (not included)" })
|
|
7869
|
-
] })
|
|
7870
|
-
] }, extra.code);
|
|
7871
|
-
}) })
|
|
8087
|
+
/* @__PURE__ */ jsx109("span", { className: cn("flex-1 leading-snug", on ? "text-foreground" : "text-muted-foreground"), children: displayName(extra.name) }),
|
|
8088
|
+
/* @__PURE__ */ jsx109("span", { className: "fb-tabular shrink-0 text-[0.75rem] text-muted-foreground", children: pendingCode === extra.code ? /* @__PURE__ */ jsxs66("span", { className: "flex items-center gap-1.5", children: [
|
|
8089
|
+
/* @__PURE__ */ jsx109(LoaderCircle2, { className: "size-3.5 animate-spin", "aria-hidden": "true" }),
|
|
8090
|
+
"Fetching price\u2026"
|
|
8091
|
+
] }) : extra.priceUnknown ? "" : formatZAR(unitTotal(extra, days)) })
|
|
7872
8092
|
]
|
|
7873
|
-
}
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
),
|
|
7879
|
-
allCovers.some((extra) => errors[extra.code]) && /* @__PURE__ */ jsxs66("p", { className: "mt-3 flex items-start gap-1.5 text-[0.75rem] text-destructive", children: [
|
|
8093
|
+
}
|
|
8094
|
+
) }, extra.code);
|
|
8095
|
+
}) })
|
|
8096
|
+
] })
|
|
8097
|
+
] }),
|
|
8098
|
+
essentials.some((extra) => errors[extra.code]) && /* @__PURE__ */ jsxs66("p", { className: "mt-3 flex items-start gap-1.5 text-[0.75rem] text-destructive", children: [
|
|
7880
8099
|
/* @__PURE__ */ jsx109(CircleAlert3, { className: "mt-0.5 size-3.5 shrink-0", "aria-hidden": "true" }),
|
|
7881
|
-
|
|
8100
|
+
essentials.map((extra) => errors[extra.code]).filter(Boolean).join(" ")
|
|
7882
8101
|
] })
|
|
7883
8102
|
] }),
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
8103
|
+
/* @__PURE__ */ jsx109(ExtrasGroups, { extras: others, selection, days, pendingCode, errors, onChange })
|
|
8104
|
+
] });
|
|
8105
|
+
}
|
|
8106
|
+
var GROUPS = [
|
|
8107
|
+
{ id: "waivers", title: "Damage waivers" },
|
|
8108
|
+
{ id: "people", title: "Drivers and child seats" },
|
|
8109
|
+
{ id: "travel", title: "Travel" },
|
|
8110
|
+
{ id: "equipment", title: "Equipment and more" }
|
|
8111
|
+
];
|
|
8112
|
+
function groupOf(extra) {
|
|
8113
|
+
if (extra.icon === "shield" || extra.icon === "tyre") return "waivers";
|
|
8114
|
+
if (extra.icon === "driver" || extra.icon === "child") return "people";
|
|
8115
|
+
if (extra.icon === "delivery" || /cross.?border|border|one.?way/i.test(extra.name)) return "travel";
|
|
8116
|
+
return "equipment";
|
|
8117
|
+
}
|
|
8118
|
+
function ExtrasGroups({ extras, selection, pendingCode, errors, onChange }) {
|
|
8119
|
+
if (extras.length === 0) return null;
|
|
8120
|
+
const pricedLater = extras.some((extra) => extra.priceUnknown);
|
|
8121
|
+
const fromSupplier = extras.some((extra) => extra.group);
|
|
8122
|
+
const order = Object.values(SUPPLIER_GROUPS);
|
|
8123
|
+
const groups = fromSupplier ? [...new Set(extras.map((extra) => extra.group ?? "Other add-ons"))].sort((a, b) => (order.indexOf(a) + 1 || 99) - (order.indexOf(b) + 1 || 99)).map((title) => ({ id: title, title })) : GROUPS;
|
|
8124
|
+
const inGroup = (extra, id) => fromSupplier ? (extra.group ?? "Other add-ons") === id : groupOf(extra) === id;
|
|
8125
|
+
return /* @__PURE__ */ jsxs66("section", { "aria-labelledby": "fb-extras-heading", className: "flex flex-col gap-5", children: [
|
|
8126
|
+
/* @__PURE__ */ jsxs66("div", { children: [
|
|
8127
|
+
/* @__PURE__ */ jsx109("h3", { id: "fb-extras-heading", className: "text-[0.9375rem] font-semibold text-foreground", children: "Extras" }),
|
|
8128
|
+
/* @__PURE__ */ jsxs66("p", { className: "mt-0.5 text-[0.8125rem] text-muted-foreground", children: [
|
|
8129
|
+
"Optional equipment and services, added to this booking.",
|
|
8130
|
+
pricedLater && " This supplier prices each one when you add it."
|
|
8131
|
+
] })
|
|
8132
|
+
] }),
|
|
8133
|
+
groups.map(({ id, title }) => {
|
|
8134
|
+
const list = extras.filter((extra) => inGroup(extra, id));
|
|
8135
|
+
if (list.length === 0) return null;
|
|
8136
|
+
return /* @__PURE__ */ jsxs66("div", { children: [
|
|
8137
|
+
/* @__PURE__ */ jsx109("h4", { className: "mb-1 border-b border-border pb-1.5 text-[0.75rem] font-semibold tracking-[0.06em] text-muted-foreground uppercase", children: title }),
|
|
8138
|
+
/* @__PURE__ */ jsx109("ul", { className: "grid gap-x-6 sm:grid-cols-2", children: list.map((extra) => {
|
|
8139
|
+
const quantity = selection[extra.code] ?? 0;
|
|
8140
|
+
const on = quantity > 0;
|
|
8141
|
+
const pending = pendingCode === extra.code;
|
|
8142
|
+
const name = displayName(extra.name);
|
|
8143
|
+
const Icon = EXTRA_ICONS[extra.icon];
|
|
8144
|
+
return /* @__PURE__ */ jsxs66("li", { className: "border-b border-border/70", children: [
|
|
8145
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex min-h-12 items-center gap-2.5 py-1.5", children: [
|
|
8146
|
+
/* @__PURE__ */ jsxs66(
|
|
8147
|
+
"button",
|
|
8148
|
+
{
|
|
8149
|
+
type: "button",
|
|
8150
|
+
role: "checkbox",
|
|
8151
|
+
"aria-checked": on,
|
|
8152
|
+
onClick: () => onChange(extra, on ? 0 : 1),
|
|
8153
|
+
className: "fb-focus -mx-1.5 flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-1.5 py-1.5 text-left transition-colors duration-150 hover:bg-muted",
|
|
8154
|
+
children: [
|
|
8155
|
+
/* @__PURE__ */ jsx109(
|
|
8156
|
+
"span",
|
|
8157
|
+
{
|
|
8158
|
+
"aria-hidden": "true",
|
|
8159
|
+
className: cn(
|
|
8160
|
+
"grid size-4 shrink-0 place-items-center rounded-[5px] border transition-colors duration-150",
|
|
8161
|
+
on ? "border-wizard-selected bg-wizard-selected text-wizard-selected-fg" : "border-border-strong bg-card"
|
|
8162
|
+
),
|
|
8163
|
+
children: on && /* @__PURE__ */ jsx109(Check8, { className: "size-3", strokeWidth: 3.5 })
|
|
8164
|
+
}
|
|
8165
|
+
),
|
|
8166
|
+
/* @__PURE__ */ jsx109(Icon, { className: "size-3.5 shrink-0 text-muted-foreground", strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
8167
|
+
/* @__PURE__ */ jsx109("span", { className: cn("min-w-0 flex-1 truncate text-[0.8125rem] leading-snug", on ? "font-medium text-foreground" : "text-foreground/90"), children: name }),
|
|
8168
|
+
/* @__PURE__ */ jsx109("span", { className: "fb-tabular shrink-0 text-right text-[0.75rem] text-muted-foreground", children: pending ? /* @__PURE__ */ jsxs66("span", { className: "flex items-center gap-1.5", role: "status", children: [
|
|
8169
|
+
/* @__PURE__ */ jsx109(LoaderCircle2, { className: "size-3.5 animate-spin", "aria-hidden": "true" }),
|
|
8170
|
+
"Fetching price\u2026"
|
|
8171
|
+
] }) : extra.priceUnknown ? "" : priceWords(extra) })
|
|
8172
|
+
]
|
|
8173
|
+
}
|
|
8174
|
+
),
|
|
8175
|
+
on && extra.maxQuantity > 1 && /* @__PURE__ */ jsx109(Quantity, { extra, quantity, onChange: (next) => onChange(extra, next) })
|
|
8176
|
+
] }),
|
|
8177
|
+
errors[extra.code] && /* @__PURE__ */ jsxs66("p", { className: "mb-2 flex items-start gap-1.5 pl-7 text-[0.75rem] leading-snug text-destructive", children: [
|
|
8178
|
+
/* @__PURE__ */ jsx109(CircleAlert3, { className: "mt-px size-3 shrink-0", "aria-hidden": "true" }),
|
|
8179
|
+
errors[extra.code]
|
|
8180
|
+
] })
|
|
8181
|
+
] }, extra.code);
|
|
8182
|
+
}) })
|
|
8183
|
+
] }, id);
|
|
8184
|
+
})
|
|
7902
8185
|
] });
|
|
7903
8186
|
}
|
|
7904
8187
|
|
|
7905
8188
|
// src/components/BookingWizard/PriceLooks.tsx
|
|
7906
8189
|
import { ChevronUp, Info as Info3 } from "lucide-react";
|
|
7907
|
-
import { Fragment as
|
|
8190
|
+
import { Fragment as Fragment11, jsx as jsx110, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7908
8191
|
function parts(quote) {
|
|
7909
8192
|
const car = quote.lines.find((line) => line.id === "vehicle")?.amount ?? 0;
|
|
7910
8193
|
const addOns = quote.extrasTotal;
|
|
@@ -7992,7 +8275,7 @@ function PriceBreakdown({ quote, className, compact = false }) {
|
|
|
7992
8275
|
/* @__PURE__ */ jsx110("td", { className: "px-3.5 py-2 text-[0.75rem] text-muted-foreground", children: "Excess if the car is damaged" }),
|
|
7993
8276
|
/* @__PURE__ */ jsx110("td", { className: "fb-tabular px-3.5 py-2 text-right text-[0.75rem] text-foreground", children: formatZAR(quote.excess) })
|
|
7994
8277
|
] }),
|
|
7995
|
-
quote.deposit > 0 && /* @__PURE__ */ jsxs67(
|
|
8278
|
+
quote.deposit > 0 && /* @__PURE__ */ jsxs67(Fragment11, { children: [
|
|
7996
8279
|
/* @__PURE__ */ jsxs67("tr", { className: "border-t border-border", children: [
|
|
7997
8280
|
/* @__PURE__ */ jsx110("td", { className: "px-3.5 py-2 text-[0.75rem] text-muted-foreground", children: "Deposit needed (refundable)" }),
|
|
7998
8281
|
/* @__PURE__ */ jsx110("td", { className: "fb-tabular px-3.5 py-2 text-right text-[0.75rem] text-foreground", children: formatZAR(quote.deposit) })
|
|
@@ -8055,7 +8338,7 @@ function PriceBar({ quote, open, onToggle, detailId }) {
|
|
|
8055
8338
|
}
|
|
8056
8339
|
|
|
8057
8340
|
// src/components/BookingWizard/index.tsx
|
|
8058
|
-
import { Fragment as
|
|
8341
|
+
import { Fragment as Fragment12, jsx as jsx111, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
8059
8342
|
var DRIVER_FIELD_ORDER = [
|
|
8060
8343
|
{ field: "firstName", id: "fb-first-name" },
|
|
8061
8344
|
{ field: "lastName", id: "fb-last-name" },
|
|
@@ -8149,7 +8432,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8149
8432
|
enabled: Boolean(car) && isOwnFleet && !amend && !isQuote,
|
|
8150
8433
|
staleTime: 60 * 1e3
|
|
8151
8434
|
});
|
|
8152
|
-
const paymentMethods =
|
|
8435
|
+
const paymentMethods = useMemo9(
|
|
8153
8436
|
() => isOwnFleet && !amend && !isQuote ? methodsQuery.data ?? [] : [],
|
|
8154
8437
|
[isOwnFleet, amend, isQuote, methodsQuery.data]
|
|
8155
8438
|
);
|
|
@@ -8310,6 +8593,9 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8310
8593
|
depositQuery.data?.deposit ?? null,
|
|
8311
8594
|
liveDropOffFee ?? null
|
|
8312
8595
|
);
|
|
8596
|
+
const fetchingPrices = new Set(activeExtras.filter((extra) => (selection[extra.code] ?? 0) > 0 && extra.priceUnknown).map((extra) => extra.code));
|
|
8597
|
+
if (priceExtraMutation.isPending && priceExtraMutation.variables) fetchingPrices.add(priceExtraMutation.variables.extra.code);
|
|
8598
|
+
const fetching = fetchingPrices.size > 0;
|
|
8313
8599
|
const datesMissing = days === 0;
|
|
8314
8600
|
const carName = carDisplayName(car);
|
|
8315
8601
|
const hasLogo = Boolean(car.supplier.logoUrl) && !logoFailed;
|
|
@@ -8536,10 +8822,13 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8536
8822
|
const done = stepId === "done";
|
|
8537
8823
|
const renderPrimaryAction = (className) => {
|
|
8538
8824
|
if (stepId === "extras") {
|
|
8539
|
-
return /* @__PURE__ */
|
|
8825
|
+
return /* @__PURE__ */ jsx111(CtaButton, { type: "button", onClick: goToDriver, className, disabled: fetching, "aria-busy": fetching || void 0, children: fetching ? /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8826
|
+
/* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-3.5 animate-spin", "aria-hidden": "true" }),
|
|
8827
|
+
"Fetching prices\u2026"
|
|
8828
|
+
] }) : /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8540
8829
|
quote.extrasTotal > 0 ? "Continue" : "Skip add-ons",
|
|
8541
8830
|
/* @__PURE__ */ jsx111(ArrowRight4, { className: "size-3.5" })
|
|
8542
|
-
] });
|
|
8831
|
+
] }) });
|
|
8543
8832
|
}
|
|
8544
8833
|
if (stepId === "driver") {
|
|
8545
8834
|
return /* @__PURE__ */ jsxs68(CtaButton, { type: "button", onClick: goToReview, className, children: [
|
|
@@ -8561,10 +8850,10 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8561
8850
|
onClick: send,
|
|
8562
8851
|
disabled: sendMutation.isPending || redirecting || datesMissing || paymentCheck !== null,
|
|
8563
8852
|
className,
|
|
8564
|
-
children: sendMutation.isPending || redirecting || paymentCheck === "checking" ? /* @__PURE__ */ jsxs68(
|
|
8853
|
+
children: sendMutation.isPending || redirecting || paymentCheck === "checking" ? /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8565
8854
|
/* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-3.5 animate-spin" }),
|
|
8566
8855
|
amend ? "Saving" : isQuote ? "Sending" : paymentCheck === "checking" ? "Checking payment" : redirecting ? "Opening payment" : "Booking"
|
|
8567
|
-
] }) : /* @__PURE__ */ jsxs68(
|
|
8856
|
+
] }) : /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8568
8857
|
amend ? "Confirm changes" : isQuote ? "Email me this quote" : pendingPayment ? "Try paying again" : paysOnline ? `Pay ${formatZAR(quote.total + (quote.deposit || 0))}` : "Confirm booking",
|
|
8569
8858
|
/* @__PURE__ */ jsx111(ArrowRight4, { className: "size-3.5" })
|
|
8570
8859
|
] })
|
|
@@ -8620,7 +8909,10 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8620
8909
|
line.detail && /* @__PURE__ */ jsx111("p", { className: "fb-tabular mt-0.5 text-[0.75rem] text-muted-foreground", children: line.detail })
|
|
8621
8910
|
] })
|
|
8622
8911
|
] }),
|
|
8623
|
-
/* @__PURE__ */
|
|
8912
|
+
fetchingPrices.has(line.id) ? /* @__PURE__ */ jsxs68("p", { className: "flex shrink-0 items-center gap-1.5 text-[0.75rem] text-muted-foreground", role: "status", children: [
|
|
8913
|
+
/* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-3.5 animate-spin", "aria-hidden": "true" }),
|
|
8914
|
+
"Fetching price\u2026"
|
|
8915
|
+
] }) : /* @__PURE__ */ jsx111("p", { className: "fb-tabular shrink-0 text-[0.8125rem] font-medium text-foreground", children: formatZAR(line.amount) })
|
|
8624
8916
|
]
|
|
8625
8917
|
},
|
|
8626
8918
|
line.id
|
|
@@ -8679,7 +8971,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8679
8971
|
] })
|
|
8680
8972
|
] }),
|
|
8681
8973
|
/* @__PURE__ */ jsxs68(GhostPill, { type: "button", onClick: requestClose, className: "order-2 h-8 shrink-0 rounded-lg px-3 md:order-3", children: [
|
|
8682
|
-
/* @__PURE__ */ jsx111(
|
|
8974
|
+
/* @__PURE__ */ jsx111(X4, { className: "size-3.5", "aria-hidden": "true" }),
|
|
8683
8975
|
"Close"
|
|
8684
8976
|
] }),
|
|
8685
8977
|
!done && stepLook === "road" && /* @__PURE__ */ jsx111(
|
|
@@ -8735,7 +9027,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8735
9027
|
}
|
|
8736
9028
|
),
|
|
8737
9029
|
/* @__PURE__ */ jsxs68("div", { className: "min-w-0", children: [
|
|
8738
|
-
stepId === "extras" && /* @__PURE__ */ jsxs68(
|
|
9030
|
+
stepId === "extras" && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8739
9031
|
/* @__PURE__ */ jsx111(
|
|
8740
9032
|
StepHeading,
|
|
8741
9033
|
{
|
|
@@ -8759,8 +9051,8 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8759
9051
|
onChange: setQuantity
|
|
8760
9052
|
};
|
|
8761
9053
|
return extrasLook === "list" ? /* @__PURE__ */ jsx111(ExtrasList, { ...lookProps }) : /* @__PURE__ */ jsx111(CoverPackages, { ...lookProps });
|
|
8762
|
-
})() : /* @__PURE__ */ jsxs68(
|
|
8763
|
-
popularExtras.length > 0 && /* @__PURE__ */ jsxs68(
|
|
9054
|
+
})() : /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
9055
|
+
popularExtras.length > 0 && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8764
9056
|
/* @__PURE__ */ jsx111(GroupLabel, { icon: Flame2, children: "Most popular" }),
|
|
8765
9057
|
/* @__PURE__ */ jsx111(
|
|
8766
9058
|
motion9.div,
|
|
@@ -8808,7 +9100,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
8808
9100
|
)
|
|
8809
9101
|
] })
|
|
8810
9102
|
] }),
|
|
8811
|
-
stepId === "driver" && /* @__PURE__ */ jsxs68(
|
|
9103
|
+
stepId === "driver" && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
8812
9104
|
/* @__PURE__ */ jsx111(
|
|
8813
9105
|
StepHeading,
|
|
8814
9106
|
{
|
|
@@ -9027,7 +9319,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9027
9319
|
] }) })
|
|
9028
9320
|
] })
|
|
9029
9321
|
] }),
|
|
9030
|
-
stepId === "payment" && /* @__PURE__ */ jsxs68(
|
|
9322
|
+
stepId === "payment" && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
9031
9323
|
/* @__PURE__ */ jsx111(
|
|
9032
9324
|
StepHeading,
|
|
9033
9325
|
{
|
|
@@ -9039,7 +9331,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9039
9331
|
),
|
|
9040
9332
|
/* @__PURE__ */ jsx111(PaymentStep, { methods: paymentMethods, choice: payChoice, onChange: setPayChoice, total: quote.total, deposit: quote.deposit || 0, days: quote.days })
|
|
9041
9333
|
] }),
|
|
9042
|
-
stepId === "review" && /* @__PURE__ */ jsxs68(
|
|
9334
|
+
stepId === "review" && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
9043
9335
|
/* @__PURE__ */ jsx111(
|
|
9044
9336
|
StepHeading,
|
|
9045
9337
|
{
|
|
@@ -9080,7 +9372,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9080
9372
|
] }),
|
|
9081
9373
|
failure && /* @__PURE__ */ jsxs68(Notice, { tone: "error", className: "mt-5", children: [
|
|
9082
9374
|
failure,
|
|
9083
|
-
failedPin && /* @__PURE__ */ jsxs68(
|
|
9375
|
+
failedPin && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
9084
9376
|
" ",
|
|
9085
9377
|
"We've logged this attempt under PIN",
|
|
9086
9378
|
" ",
|
|
@@ -9184,11 +9476,11 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9184
9476
|
"section",
|
|
9185
9477
|
{
|
|
9186
9478
|
className: cn(
|
|
9187
|
-
"overflow-hidden rounded-xl border bg-card",
|
|
9188
|
-
termsError ? "border-destructive" : "border-border"
|
|
9479
|
+
"overflow-hidden rounded-xl border bg-card transition-[border-color,box-shadow] duration-300",
|
|
9480
|
+
termsError ? "border-destructive" : acceptsTerms ? "border-border" : "border-wizard-selected/45 shadow-[0_0_0_3px_color-mix(in_oklab,var(--fb-wizard-selected)_12%,transparent)]"
|
|
9189
9481
|
),
|
|
9190
9482
|
children: [
|
|
9191
|
-
supplierTerms?.html && /* @__PURE__ */ jsxs68(
|
|
9483
|
+
supplierTerms?.html && /* @__PURE__ */ jsxs68(Fragment12, { children: [
|
|
9192
9484
|
/* @__PURE__ */ jsxs68("header", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5", children: [
|
|
9193
9485
|
/* @__PURE__ */ jsxs68("h3", { className: "flex items-center gap-2 text-[0.875rem] font-semibold text-foreground", children: [
|
|
9194
9486
|
/* @__PURE__ */ jsx111(ScrollText, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
@@ -9219,10 +9511,12 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9219
9511
|
setTermsError(false);
|
|
9220
9512
|
},
|
|
9221
9513
|
className: cn(
|
|
9222
|
-
"flex cursor-pointer items-start gap-3 px-4 py-
|
|
9514
|
+
"relative flex cursor-pointer items-start gap-3 px-4 py-4 transition-colors duration-300 sm:px-5",
|
|
9223
9515
|
supplierTerms?.html && "border-t border-border",
|
|
9224
|
-
|
|
9225
|
-
|
|
9516
|
+
// Until it is ticked the row stands out: a bar in the brand colour and a tint.
|
|
9517
|
+
"before:absolute before:inset-y-0 before:left-0 before:w-1 before:transition-colors before:duration-300",
|
|
9518
|
+
acceptsTerms ? "bg-wizard-selected/[0.05] before:bg-transparent" : "bg-wizard-selected/[0.09] before:bg-wizard-selected",
|
|
9519
|
+
termsError && "bg-destructive/8 before:bg-destructive"
|
|
9226
9520
|
),
|
|
9227
9521
|
children: [
|
|
9228
9522
|
/* @__PURE__ */ jsx111(
|
|
@@ -9234,11 +9528,23 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9234
9528
|
setAcceptsTerms(Boolean(checked));
|
|
9235
9529
|
setTermsError(false);
|
|
9236
9530
|
},
|
|
9237
|
-
className: "mt-px size-5 rounded-md border border-
|
|
9531
|
+
className: "mt-px size-5 rounded-md border-2 border-wizard-selected bg-card data-[state=checked]:border-wizard-selected data-[state=checked]:bg-wizard-selected data-[state=checked]:text-wizard-selected-fg data-checked:border-wizard-selected data-checked:bg-wizard-selected data-checked:text-wizard-selected-fg [&_svg]:size-3.5"
|
|
9238
9532
|
}
|
|
9239
9533
|
),
|
|
9240
9534
|
/* @__PURE__ */ jsxs68("label", { htmlFor: "fb-terms", className: "min-w-0 cursor-pointer", onClick: (event) => event.stopPropagation(), children: [
|
|
9241
|
-
/* @__PURE__ */
|
|
9535
|
+
/* @__PURE__ */ jsxs68("span", { className: "flex flex-wrap items-center gap-2 text-[0.875rem] leading-snug font-semibold text-foreground", children: [
|
|
9536
|
+
"I agree to the terms and conditions",
|
|
9537
|
+
/* @__PURE__ */ jsx111(
|
|
9538
|
+
"span",
|
|
9539
|
+
{
|
|
9540
|
+
className: cn(
|
|
9541
|
+
"rounded-full px-2 py-0.5 text-[0.6875rem] font-semibold tracking-[0.04em] uppercase transition-colors duration-300",
|
|
9542
|
+
acceptsTerms ? "bg-wizard-selected/12 text-foreground" : termsError ? "bg-destructive text-white" : "bg-wizard-selected text-wizard-selected-fg"
|
|
9543
|
+
),
|
|
9544
|
+
children: acceptsTerms ? "Agreed" : "Required"
|
|
9545
|
+
}
|
|
9546
|
+
)
|
|
9547
|
+
] }),
|
|
9242
9548
|
/* @__PURE__ */ jsx111("span", { className: "mt-0.5 block text-[0.8125rem] leading-relaxed text-muted-foreground", children: "Required before this car can be booked. The kilometres and excess shown are the ones for this vehicle." }),
|
|
9243
9549
|
termsError && /* @__PURE__ */ jsx111("span", { role: "alert", className: "mt-2 block text-[0.8125rem] font-semibold text-destructive", children: "Tick this to continue" })
|
|
9244
9550
|
] })
|
|
@@ -9331,14 +9637,17 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9331
9637
|
children: [
|
|
9332
9638
|
/* @__PURE__ */ jsxs68("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
9333
9639
|
/* @__PURE__ */ jsx111("span", { className: "text-[0.875rem] font-medium", children: "Total" }),
|
|
9334
|
-
/* @__PURE__ */
|
|
9640
|
+
/* @__PURE__ */ jsxs68(
|
|
9335
9641
|
motion9.span,
|
|
9336
9642
|
{
|
|
9337
9643
|
initial: { opacity: 0.4 },
|
|
9338
9644
|
animate: { opacity: 1 },
|
|
9339
9645
|
transition: { duration: 0.25, ease: easeStandard },
|
|
9340
|
-
className: "fb-tabular text-[1.375rem] leading-none font-semibold tracking-[-0.015em]",
|
|
9341
|
-
children:
|
|
9646
|
+
className: cn("fb-tabular flex items-center gap-2 text-[1.375rem] leading-none font-semibold tracking-[-0.015em] transition-opacity", fetching && "opacity-50"),
|
|
9647
|
+
children: [
|
|
9648
|
+
fetching && /* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-4 animate-spin", "aria-label": "Updating the total" }),
|
|
9649
|
+
formatZAR(quote.total)
|
|
9650
|
+
]
|
|
9342
9651
|
},
|
|
9343
9652
|
quote.total
|
|
9344
9653
|
)
|
|
@@ -9348,7 +9657,7 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9348
9657
|
quote.days,
|
|
9349
9658
|
" ",
|
|
9350
9659
|
quote.days === 1 ? "day" : "days",
|
|
9351
|
-
quote.extrasTotal > 0 ? ` \xB7 incl. ${formatZAR(quote.extrasTotal)} add-ons` : ""
|
|
9660
|
+
fetching ? " \xB7 fetching add-on prices\u2026" : quote.extrasTotal > 0 ? ` \xB7 incl. ${formatZAR(quote.extrasTotal)} add-ons` : ""
|
|
9352
9661
|
] }),
|
|
9353
9662
|
renderPrimaryAction("mt-3.5 h-11 w-full justify-center"),
|
|
9354
9663
|
stepIndex > 0 && /* @__PURE__ */ jsxs68(
|
|
@@ -9399,7 +9708,10 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9399
9708
|
className: "fb-focus flex items-center gap-1.5 rounded-lg px-1 text-right",
|
|
9400
9709
|
children: [
|
|
9401
9710
|
/* @__PURE__ */ jsxs68("span", { children: [
|
|
9402
|
-
/* @__PURE__ */
|
|
9711
|
+
/* @__PURE__ */ jsxs68("span", { className: cn("fb-tabular flex items-center gap-1.5 text-[0.9375rem] font-semibold text-foreground", fetching && "opacity-60"), children: [
|
|
9712
|
+
fetching && /* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-3.5 animate-spin", "aria-label": "Updating the total" }),
|
|
9713
|
+
formatZAR(quote.total)
|
|
9714
|
+
] }),
|
|
9403
9715
|
/* @__PURE__ */ jsxs68("span", { className: "block text-[0.75rem] text-muted-foreground", children: [
|
|
9404
9716
|
quote.days,
|
|
9405
9717
|
" ",
|
|
@@ -9417,7 +9729,10 @@ function BookingWizard({ car, criteria, days, onClose, onEditSearch, amend, mode
|
|
|
9417
9729
|
]
|
|
9418
9730
|
}
|
|
9419
9731
|
),
|
|
9420
|
-
priceLook === "table" && /* @__PURE__ */
|
|
9732
|
+
priceLook === "table" && /* @__PURE__ */ jsxs68("span", { className: cn("fb-tabular hidden items-center gap-1.5 text-[0.9375rem] font-semibold text-foreground sm:flex", fetching && "opacity-60"), children: [
|
|
9733
|
+
fetching && /* @__PURE__ */ jsx111(LoaderCircle3, { className: "size-3.5 animate-spin", "aria-label": "Updating the total" }),
|
|
9734
|
+
formatZAR(quote.total)
|
|
9735
|
+
] }),
|
|
9421
9736
|
renderPrimaryAction("h-10 px-5")
|
|
9422
9737
|
] })
|
|
9423
9738
|
] })
|
|
@@ -9611,7 +9926,7 @@ function Spec({
|
|
|
9611
9926
|
}
|
|
9612
9927
|
|
|
9613
9928
|
// src/components/CarCard/OfferParts.tsx
|
|
9614
|
-
import { Fragment as
|
|
9929
|
+
import { Fragment as Fragment13, jsx as jsx115, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
9615
9930
|
function SpecList({ car, className }) {
|
|
9616
9931
|
return /* @__PURE__ */ jsxs72("ul", { className: cn("flex flex-wrap items-center gap-x-2.5 gap-y-1", className), "aria-label": "Key features", children: [
|
|
9617
9932
|
car.seats > 0 && /* @__PURE__ */ jsx115(Spec, { icon: Users5, label: `${car.seats} seats`, children: /* @__PURE__ */ jsx115("span", { className: "fb-tabular", children: car.seats }) }),
|
|
@@ -9623,7 +9938,7 @@ function SpecList({ car, className }) {
|
|
|
9623
9938
|
{
|
|
9624
9939
|
icon: car.unlimitedMileage ? InfinityIcon3 : Gauge4,
|
|
9625
9940
|
label: car.unlimitedMileage ? "Unlimited kilometres" : `${car.kmPerDay} km per day`,
|
|
9626
|
-
children: car.unlimitedMileage ? "Unlimited" : /* @__PURE__ */ jsxs72(
|
|
9941
|
+
children: car.unlimitedMileage ? "Unlimited" : /* @__PURE__ */ jsxs72(Fragment13, { children: [
|
|
9627
9942
|
/* @__PURE__ */ jsx115("span", { className: "fb-tabular", children: car.kmPerDay }),
|
|
9628
9943
|
" km/d"
|
|
9629
9944
|
] })
|
|
@@ -9802,7 +10117,7 @@ function TotalWithBreakdown({ offer, className }) {
|
|
|
9802
10117
|
}
|
|
9803
10118
|
|
|
9804
10119
|
// src/components/CarCard/useCarOffer.ts
|
|
9805
|
-
import { useEffect as useEffect15, useMemo as
|
|
10120
|
+
import { useEffect as useEffect15, useMemo as useMemo10, useRef as useRef8, useState as useState18 } from "react";
|
|
9806
10121
|
function useCarOffer(car, { bookingUrl, onBook, onQuote, rentalDays: rentalDays2 }) {
|
|
9807
10122
|
const [imageLoaded, setImageLoaded] = useState18(false);
|
|
9808
10123
|
const [imageFailed, setImageFailed] = useState18(false);
|
|
@@ -9831,7 +10146,7 @@ function useCarOffer(car, { bookingUrl, onBook, onQuote, rentalDays: rentalDays2
|
|
|
9831
10146
|
}
|
|
9832
10147
|
if (priceRef.current) pulseValue(priceRef.current);
|
|
9833
10148
|
}, [packageIndex, tier]);
|
|
9834
|
-
const rateOptions =
|
|
10149
|
+
const rateOptions = useMemo10(() => {
|
|
9835
10150
|
const packages = car.packages?.length ? car.packages : [];
|
|
9836
10151
|
if (!packages.length) return [];
|
|
9837
10152
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -10191,7 +10506,7 @@ function CarCard({
|
|
|
10191
10506
|
var GRID_CLASSES = "grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-3.5 xl:grid-cols-3";
|
|
10192
10507
|
|
|
10193
10508
|
// src/components/CarList/styles/GroupedStyle.tsx
|
|
10194
|
-
import { useMemo as
|
|
10509
|
+
import { useMemo as useMemo11 } from "react";
|
|
10195
10510
|
import { jsx as jsx118, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
10196
10511
|
function groupNameFor(car) {
|
|
10197
10512
|
const group = (car.carGroup || "").toUpperCase();
|
|
@@ -10200,7 +10515,7 @@ function groupNameFor(car) {
|
|
|
10200
10515
|
return group ? `Group ${group}` : "More cars";
|
|
10201
10516
|
}
|
|
10202
10517
|
function GroupedStyle({ cars, ...item }) {
|
|
10203
|
-
const groups =
|
|
10518
|
+
const groups = useMemo11(() => {
|
|
10204
10519
|
const byName = /* @__PURE__ */ new Map();
|
|
10205
10520
|
for (const car of cars) {
|
|
10206
10521
|
const name = groupNameFor(car);
|
|
@@ -10643,7 +10958,7 @@ function FilterBlock({
|
|
|
10643
10958
|
}
|
|
10644
10959
|
|
|
10645
10960
|
// src/components/FilterPanel/FilterControls.tsx
|
|
10646
|
-
import { useMemo as
|
|
10961
|
+
import { useMemo as useMemo12 } from "react";
|
|
10647
10962
|
import { Briefcase as Briefcase5, Cog as Cog5, Fuel as Fuel3, Gauge as Gauge5, LayoutGrid, Store, Users as Users6, Wallet as Wallet2 } from "lucide-react";
|
|
10648
10963
|
|
|
10649
10964
|
// src/components/FilterPanel/ScrollRow.tsx
|
|
@@ -10680,7 +10995,7 @@ function Pill({
|
|
|
10680
10995
|
}
|
|
10681
10996
|
|
|
10682
10997
|
// src/components/FilterPanel/FilterControls.tsx
|
|
10683
|
-
import { Fragment as
|
|
10998
|
+
import { Fragment as Fragment14, jsx as jsx128, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
10684
10999
|
function isBodyCategory(value) {
|
|
10685
11000
|
const trimmed = value.trim();
|
|
10686
11001
|
if (!trimmed || /^[A-Z]{1,3}\d?$/i.test(trimmed)) return false;
|
|
@@ -10689,7 +11004,7 @@ function isBodyCategory(value) {
|
|
|
10689
11004
|
);
|
|
10690
11005
|
}
|
|
10691
11006
|
function useFilterOptions(cars, priceBounds) {
|
|
10692
|
-
return
|
|
11007
|
+
return useMemo12(
|
|
10693
11008
|
() => ({
|
|
10694
11009
|
bodyCategories: uniqueSorted(cars.map((car) => car.category).filter(isBodyCategory)),
|
|
10695
11010
|
suppliers: uniqueSorted(cars.map((car) => car.supplier.name)),
|
|
@@ -10826,7 +11141,7 @@ function PriceControl({
|
|
|
10826
11141
|
onChange,
|
|
10827
11142
|
options
|
|
10828
11143
|
}) {
|
|
10829
|
-
return /* @__PURE__ */ jsxs84(
|
|
11144
|
+
return /* @__PURE__ */ jsxs84(Fragment14, { children: [
|
|
10830
11145
|
/* @__PURE__ */ jsx128("div", { className: "mb-3 grid grid-cols-2 gap-2", children: ["From", "To"].map((label2, index) => /* @__PURE__ */ jsxs84("div", { className: "rounded-lg border border-listing-border px-2.5 py-1.5", children: [
|
|
10831
11146
|
/* @__PURE__ */ jsx128("p", { className: "text-[0.625rem] font-semibold tracking-[0.08em] text-filter-muted uppercase", children: label2 }),
|
|
10832
11147
|
/* @__PURE__ */ jsx128("p", { className: "fb-tabular text-[0.8125rem] font-semibold text-filter-title", children: formatZAR(filters.priceRange[index]) })
|
|
@@ -10862,9 +11177,9 @@ function PriceControl({
|
|
|
10862
11177
|
}
|
|
10863
11178
|
|
|
10864
11179
|
// src/components/FilterPanel/FilterLooks.tsx
|
|
10865
|
-
import { useMemo as
|
|
11180
|
+
import { useMemo as useMemo13 } from "react";
|
|
10866
11181
|
import { CarFront, ChevronDown as ChevronDown4, RotateCcw as RotateCcw2 } from "lucide-react";
|
|
10867
|
-
import { Fragment as
|
|
11182
|
+
import { Fragment as Fragment15, jsx as jsx129, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
10868
11183
|
var Z_ABOVE_HOST_THEME = "z-2147483000";
|
|
10869
11184
|
function clearSection(id, priceBounds) {
|
|
10870
11185
|
switch (id) {
|
|
@@ -10942,7 +11257,7 @@ function FilterChipBar({
|
|
|
10942
11257
|
] })
|
|
10943
11258
|
] }, section.id);
|
|
10944
11259
|
}),
|
|
10945
|
-
activeCount > 0 && /* @__PURE__ */ jsxs85(
|
|
11260
|
+
activeCount > 0 && /* @__PURE__ */ jsxs85(Fragment15, { children: [
|
|
10946
11261
|
/* @__PURE__ */ jsx129("span", { className: "mx-1 h-6 w-px shrink-0 bg-listing-border", "aria-hidden": "true" }),
|
|
10947
11262
|
/* @__PURE__ */ jsxs85(
|
|
10948
11263
|
"button",
|
|
@@ -10963,7 +11278,7 @@ function FilterChipBar({
|
|
|
10963
11278
|
}
|
|
10964
11279
|
function CarTypeTabs({ cars, filters, priceBounds, onChange, className }) {
|
|
10965
11280
|
const options = useFilterOptions(cars, priceBounds);
|
|
10966
|
-
const tiles =
|
|
11281
|
+
const tiles = useMemo13(() => {
|
|
10967
11282
|
const cheapest = (list) => list.reduce((best, car) => !best || car.dailyRate < best.dailyRate ? car : best, void 0);
|
|
10968
11283
|
const all = { key: "", title: "All cars", cars, car: cheapest(cars) };
|
|
10969
11284
|
return [
|
|
@@ -11349,7 +11664,7 @@ async function searchAvailability(criteria, onProgress) {
|
|
|
11349
11664
|
// src/components/ResultsPage/SearchBar.tsx
|
|
11350
11665
|
import { useEffect as useEffect18, useRef as useRef12, useState as useState19 } from "react";
|
|
11351
11666
|
import { CalendarDays as CalendarDays4, ChevronDown as ChevronDown5, Pencil as Pencil2 } from "lucide-react";
|
|
11352
|
-
import { Fragment as
|
|
11667
|
+
import { Fragment as Fragment16, jsx as jsx131, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
11353
11668
|
function SearchBar({
|
|
11354
11669
|
criteria,
|
|
11355
11670
|
days,
|
|
@@ -11399,7 +11714,7 @@ function SearchBar({
|
|
|
11399
11714
|
),
|
|
11400
11715
|
children: [
|
|
11401
11716
|
/* @__PURE__ */ jsx131(Pencil2, { className: "size-3.5", "aria-hidden": "true" }),
|
|
11402
|
-
editing ? "Close" : flush ? /* @__PURE__ */ jsxs87(
|
|
11717
|
+
editing ? "Close" : flush ? /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11403
11718
|
/* @__PURE__ */ jsx131("span", { className: "sm:hidden", children: "Edit" }),
|
|
11404
11719
|
/* @__PURE__ */ jsx131("span", { className: "max-sm:hidden", children: needsDates ? "Choose dates" : "Modify search" })
|
|
11405
11720
|
] }) : "Modify search",
|
|
@@ -11413,7 +11728,7 @@ function SearchBar({
|
|
|
11413
11728
|
]
|
|
11414
11729
|
}
|
|
11415
11730
|
);
|
|
11416
|
-
const form = /* @__PURE__ */ jsxs87(
|
|
11731
|
+
const form = /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11417
11732
|
prompt && /* @__PURE__ */ jsxs87(
|
|
11418
11733
|
"p",
|
|
11419
11734
|
{
|
|
@@ -11438,15 +11753,15 @@ function SearchBar({
|
|
|
11438
11753
|
)
|
|
11439
11754
|
] });
|
|
11440
11755
|
if (flush) {
|
|
11441
|
-
const place = /* @__PURE__ */ jsxs87(
|
|
11756
|
+
const place = /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11442
11757
|
criteria.pickupLocation,
|
|
11443
|
-
dropoff && /* @__PURE__ */ jsxs87(
|
|
11758
|
+
dropoff && /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11444
11759
|
/* @__PURE__ */ jsx131("span", { className: "px-1.5 text-listing-muted", "aria-hidden": "true", children: "\u2192" }),
|
|
11445
11760
|
/* @__PURE__ */ jsx131("span", { className: "sr-only", children: " to " }),
|
|
11446
11761
|
dropoff
|
|
11447
11762
|
] })
|
|
11448
11763
|
] });
|
|
11449
|
-
const dates = hasDates ? /* @__PURE__ */ jsxs87(
|
|
11764
|
+
const dates = hasDates ? /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11450
11765
|
formatDateLabel(criteria.pickupDate),
|
|
11451
11766
|
criteria.pickupTime && /* @__PURE__ */ jsxs87("span", { className: "font-medium text-listing-muted", children: [
|
|
11452
11767
|
" ",
|
|
@@ -11511,7 +11826,7 @@ function SearchBar({
|
|
|
11511
11826
|
/* @__PURE__ */ jsxs87("div", { className: "flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-stretch sm:gap-0 sm:divide-x sm:divide-listing-border", children: [
|
|
11512
11827
|
/* @__PURE__ */ jsxs87(Fact, { label: "Pick-up", children: [
|
|
11513
11828
|
criteria.pickupLocation,
|
|
11514
|
-
dropoff && /* @__PURE__ */ jsxs87(
|
|
11829
|
+
dropoff && /* @__PURE__ */ jsxs87(Fragment16, { children: [
|
|
11515
11830
|
/* @__PURE__ */ jsx131("span", { className: "px-1 text-listing-muted", "aria-label": "to", children: "\u2192" }),
|
|
11516
11831
|
dropoff
|
|
11517
11832
|
] })
|
|
@@ -11571,7 +11886,7 @@ function Fact({ label: label2, children }) {
|
|
|
11571
11886
|
}
|
|
11572
11887
|
|
|
11573
11888
|
// src/components/ResultsPage/index.tsx
|
|
11574
|
-
import { Fragment as
|
|
11889
|
+
import { Fragment as Fragment17, jsx as jsx132, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
11575
11890
|
function todayIso() {
|
|
11576
11891
|
const now = /* @__PURE__ */ new Date();
|
|
11577
11892
|
return [now.getFullYear(), String(now.getMonth() + 1).padStart(2, "0"), String(now.getDate()).padStart(2, "0")].join("-");
|
|
@@ -11647,15 +11962,15 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11647
11962
|
};
|
|
11648
11963
|
});
|
|
11649
11964
|
}, []);
|
|
11650
|
-
const pool =
|
|
11965
|
+
const pool = useMemo14(() => {
|
|
11651
11966
|
if (!availabilityQuery.isSuccess || !isOffersResult(availabilityQuery.data)) return [];
|
|
11652
11967
|
return mapOffersToCars(availabilityQuery.data.offers, { pickupLabel: criteria.pickupLocation });
|
|
11653
11968
|
}, [availabilityQuery.isSuccess, availabilityQuery.data, criteria.pickupLocation]);
|
|
11654
|
-
const notices =
|
|
11969
|
+
const notices = useMemo14(
|
|
11655
11970
|
() => availabilityQuery.isSuccess && isOffersResult(availabilityQuery.data) ? sourceNotices(availabilityQuery.data) : [],
|
|
11656
11971
|
[availabilityQuery.isSuccess, availabilityQuery.data]
|
|
11657
11972
|
);
|
|
11658
|
-
const bluuCars =
|
|
11973
|
+
const bluuCars = useMemo14(() => pool.filter((car) => car.supplier.id === "bluu"), [pool]);
|
|
11659
11974
|
const depositQueries = useQueries({
|
|
11660
11975
|
queries: bluuCars.map((car) => ({
|
|
11661
11976
|
queryKey: bluuDepositQueryKey(car, criteria),
|
|
@@ -11664,7 +11979,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11664
11979
|
retry: false
|
|
11665
11980
|
}))
|
|
11666
11981
|
});
|
|
11667
|
-
const bluuOneWayCars =
|
|
11982
|
+
const bluuOneWayCars = useMemo14(
|
|
11668
11983
|
() => bluuCars.filter((car) => car.returnBranch && car.returnBranch !== car.pickUpBranch),
|
|
11669
11984
|
[bluuCars]
|
|
11670
11985
|
);
|
|
@@ -11676,7 +11991,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11676
11991
|
retry: false
|
|
11677
11992
|
}))
|
|
11678
11993
|
});
|
|
11679
|
-
const europcarOneWayCars =
|
|
11994
|
+
const europcarOneWayCars = useMemo14(
|
|
11680
11995
|
() => pool.filter(
|
|
11681
11996
|
(car) => (car.supplier.id === "europcar" || car.supplier.id === "tempest") && car.returnBranch && car.returnBranch !== car.pickUpBranch
|
|
11682
11997
|
),
|
|
@@ -11690,7 +12005,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11690
12005
|
retry: false
|
|
11691
12006
|
}))
|
|
11692
12007
|
});
|
|
11693
|
-
const cars =
|
|
12008
|
+
const cars = useMemo14(() => {
|
|
11694
12009
|
const deposits = /* @__PURE__ */ new Map();
|
|
11695
12010
|
bluuCars.forEach((car, index) => {
|
|
11696
12011
|
const deposit = depositQueries[index]?.data?.deposit;
|
|
@@ -11730,8 +12045,8 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11730
12045
|
europcarOneWayCars,
|
|
11731
12046
|
europcarOneWayResults
|
|
11732
12047
|
]);
|
|
11733
|
-
const priceBounds =
|
|
11734
|
-
const yearBounds =
|
|
12048
|
+
const priceBounds = useMemo14(() => priceBoundsFromCars(pool), [pool]);
|
|
12049
|
+
const yearBounds = useMemo14(() => yearBoundsFromCars(pool), [pool]);
|
|
11735
12050
|
const reset = useCallback3(
|
|
11736
12051
|
() => setFilters({
|
|
11737
12052
|
...DEFAULT_FILTERS,
|
|
@@ -11755,15 +12070,15 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11755
12070
|
...yearBounds ? { yearRange: yearBounds } : {}
|
|
11756
12071
|
}));
|
|
11757
12072
|
}, [pool, priceBounds, yearBounds]);
|
|
11758
|
-
const results =
|
|
12073
|
+
const results = useMemo14(
|
|
11759
12074
|
() => sortCars(filterCars(cars, filters), filters.sort),
|
|
11760
12075
|
[cars, filters]
|
|
11761
12076
|
);
|
|
11762
|
-
const chips =
|
|
12077
|
+
const chips = useMemo14(
|
|
11763
12078
|
() => activeChips(filters, { price: priceBounds, year: yearBounds }),
|
|
11764
12079
|
[filters, priceBounds, yearBounds]
|
|
11765
12080
|
);
|
|
11766
|
-
const days =
|
|
12081
|
+
const days = useMemo14(() => rentalDays(criteria), [criteria]);
|
|
11767
12082
|
const panel = /* @__PURE__ */ jsx132(
|
|
11768
12083
|
FilterPanel,
|
|
11769
12084
|
{
|
|
@@ -11822,10 +12137,10 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11822
12137
|
/* @__PURE__ */ jsx132("div", { className: cn("min-w-0", showRail && flush && "lg:pl-8"), children: needsDates ? (
|
|
11823
12138
|
// While the form is open its own prompt says it; this is for after it is closed.
|
|
11824
12139
|
!editingSearch && /* @__PURE__ */ jsx132(ChooseDates, { place, past: problem === "past", flush, onChoose: openEditor })
|
|
11825
|
-
) : /* @__PURE__ */ jsxs88(
|
|
12140
|
+
) : /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
11826
12141
|
showControls && /* @__PURE__ */ jsxs88("div", { className: "flex flex-wrap items-end justify-between gap-3 border-b border-listing-border pb-4", children: [
|
|
11827
12142
|
/* @__PURE__ */ jsxs88("div", { "aria-live": "polite", children: [
|
|
11828
|
-
/* @__PURE__ */ jsx132("h2", { className: "text-[1.25rem] leading-tight font-semibold tracking-[-0.02em] text-listing-text sm:text-[1.5rem]", children: availabilityQuery.isPending ? "Finding cars\u2026" : /* @__PURE__ */ jsxs88(
|
|
12143
|
+
/* @__PURE__ */ jsx132("h2", { className: "text-[1.25rem] leading-tight font-semibold tracking-[-0.02em] text-listing-text sm:text-[1.5rem]", children: availabilityQuery.isPending ? "Finding cars\u2026" : /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
11829
12144
|
/* @__PURE__ */ jsx132("span", { className: "fb-tabular", children: results.length }),
|
|
11830
12145
|
" ",
|
|
11831
12146
|
pluralize(results.length, "car"),
|
|
@@ -11833,7 +12148,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11833
12148
|
"available"
|
|
11834
12149
|
] }) }),
|
|
11835
12150
|
days > 0 && /* @__PURE__ */ jsxs88("p", { className: "mt-1 text-[0.8125rem] text-listing-muted", children: [
|
|
11836
|
-
flush && /* @__PURE__ */ jsxs88(
|
|
12151
|
+
flush && /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
11837
12152
|
place,
|
|
11838
12153
|
" \xB7 "
|
|
11839
12154
|
] }),
|
|
@@ -11936,7 +12251,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11936
12251
|
className: "fb-focus flex h-8 items-center gap-1.5 rounded-full border border-listing-border bg-listing-chip pr-2 pl-3 text-[0.75rem] font-medium text-listing-chip-fg transition-colors duration-200 hover:border-listing-text/30",
|
|
11937
12252
|
children: [
|
|
11938
12253
|
chip.label,
|
|
11939
|
-
/* @__PURE__ */ jsx132(
|
|
12254
|
+
/* @__PURE__ */ jsx132(X5, { className: "size-3.5 opacity-60", "aria-hidden": "true" }),
|
|
11940
12255
|
/* @__PURE__ */ jsx132("span", { className: "sr-only", children: "Remove filter" })
|
|
11941
12256
|
]
|
|
11942
12257
|
},
|
|
@@ -11952,7 +12267,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11952
12267
|
}
|
|
11953
12268
|
)
|
|
11954
12269
|
] }),
|
|
11955
|
-
searching ? /* @__PURE__ */ jsxs88(
|
|
12270
|
+
searching ? /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
11956
12271
|
/* @__PURE__ */ jsx132(SourceChips, { sources: progress }),
|
|
11957
12272
|
/* @__PURE__ */ jsx132(CarListSkeleton, { listStyle, className: "mt-5" })
|
|
11958
12273
|
] }) : failed && flush ? /* @__PURE__ */ jsxs88(
|
|
@@ -11982,7 +12297,7 @@ function ResultsPage({ bookingUrl: bookingUrlProp, listStyle, layout = "boxed",
|
|
|
11982
12297
|
/* @__PURE__ */ jsx132(GhostPill, { type: "button", onClick: () => setEditingSearch(true), className: "mt-3", children: "Modify search" })
|
|
11983
12298
|
]
|
|
11984
12299
|
}
|
|
11985
|
-
) : /* @__PURE__ */ jsxs88(
|
|
12300
|
+
) : /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
11986
12301
|
flush && nothingFound && /* @__PURE__ */ jsx132(
|
|
11987
12302
|
InlineState,
|
|
11988
12303
|
{
|
|
@@ -12105,7 +12420,7 @@ function ChooseDates({ place, past, flush, onChoose }) {
|
|
|
12105
12420
|
|
|
12106
12421
|
// src/components/ManageBooking/index.tsx
|
|
12107
12422
|
import { useEffect as useEffect22, useRef as useRef14, useState as useState23 } from "react";
|
|
12108
|
-
import { CircleAlert as CircleAlert6, TicketCheck as TicketCheck2, X as
|
|
12423
|
+
import { CircleAlert as CircleAlert6, TicketCheck as TicketCheck2, X as X6 } from "lucide-react";
|
|
12109
12424
|
|
|
12110
12425
|
// src/components/ManageBooking/LookupForm.tsx
|
|
12111
12426
|
import { useEffect as useEffect20 } from "react";
|
|
@@ -12361,7 +12676,7 @@ function daysBetween(pickupIso, dropoffIso) {
|
|
|
12361
12676
|
}
|
|
12362
12677
|
|
|
12363
12678
|
// src/components/ManageBooking/BookingOverview.tsx
|
|
12364
|
-
import { Fragment as
|
|
12679
|
+
import { Fragment as Fragment18, jsx as jsx134, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
12365
12680
|
var STATUS_ICON = {
|
|
12366
12681
|
PENDING: Clock4,
|
|
12367
12682
|
CONFIRMED: CircleCheck2,
|
|
@@ -12452,7 +12767,7 @@ function BookingOverview({ booking, bookingPin, onCancel, onAmend, onReceipt, on
|
|
|
12452
12767
|
}
|
|
12453
12768
|
)
|
|
12454
12769
|
] }),
|
|
12455
|
-
/* @__PURE__ */ jsx134("p", { className: "mt-3 max-w-xl text-[0.9375rem] leading-relaxed text-muted-foreground", children: cancelled ? /* @__PURE__ */ jsx134(
|
|
12770
|
+
/* @__PURE__ */ jsx134("p", { className: "mt-3 max-w-xl text-[0.9375rem] leading-relaxed text-muted-foreground", children: cancelled ? /* @__PURE__ */ jsx134(Fragment18, { children: "This trip won't go ahead \u2014 see the note below." }) : /* @__PURE__ */ jsxs90(Fragment18, { children: [
|
|
12456
12771
|
booking.supplierName ?? "Your supplier",
|
|
12457
12772
|
" is holding the",
|
|
12458
12773
|
" ",
|
|
@@ -12665,7 +12980,7 @@ import {
|
|
|
12665
12980
|
User as User3,
|
|
12666
12981
|
Users as Users8
|
|
12667
12982
|
} from "lucide-react";
|
|
12668
|
-
import { Fragment as
|
|
12983
|
+
import { Fragment as Fragment19, jsx as jsx135, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
12669
12984
|
function QuoteReview({ quote, booking, onBook }) {
|
|
12670
12985
|
const [, setNow] = useState21(() => Date.now());
|
|
12671
12986
|
useEffect21(() => {
|
|
@@ -12792,10 +13107,10 @@ function QuoteReview({ quote, booking, onBook }) {
|
|
|
12792
13107
|
className: "fb-focus h-12 w-full gap-2 rounded-xl bg-car-cta text-[0.9375rem] font-semibold text-car-cta-fg shadow-sm transition-[background-color,transform] duration-150 hover:bg-car-cta/90 active:scale-[0.99]",
|
|
12793
13108
|
onClick: onBook,
|
|
12794
13109
|
disabled: booking || expired,
|
|
12795
|
-
children: booking ? /* @__PURE__ */ jsxs91(
|
|
13110
|
+
children: booking ? /* @__PURE__ */ jsxs91(Fragment19, { children: [
|
|
12796
13111
|
/* @__PURE__ */ jsx135(LoaderCircle5, { className: "size-3.5 animate-spin" }),
|
|
12797
13112
|
"Booking"
|
|
12798
|
-
] }) : /* @__PURE__ */ jsxs91(
|
|
13113
|
+
] }) : /* @__PURE__ */ jsxs91(Fragment19, { children: [
|
|
12799
13114
|
"Book now",
|
|
12800
13115
|
/* @__PURE__ */ jsx135(ArrowRight8, { "data-icon": "inline-end", className: "size-3.5", "aria-hidden": "true" })
|
|
12801
13116
|
] })
|
|
@@ -12896,7 +13211,7 @@ function CancelDialog({ reservationNumber, bookingPin, open, onOpenChange, onCan
|
|
|
12896
13211
|
}
|
|
12897
13212
|
|
|
12898
13213
|
// src/components/ManageBooking/AmendFlow.tsx
|
|
12899
|
-
import { useMemo as
|
|
13214
|
+
import { useMemo as useMemo15, useRef as useRef13, useState as useState22 } from "react";
|
|
12900
13215
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
12901
13216
|
import { ArrowLeft as ArrowLeft4 } from "lucide-react";
|
|
12902
13217
|
import { jsx as jsx137, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
@@ -12937,7 +13252,7 @@ function AmendFlow({
|
|
|
12937
13252
|
onCancel,
|
|
12938
13253
|
listStyle
|
|
12939
13254
|
}) {
|
|
12940
|
-
const initialCriteria =
|
|
13255
|
+
const initialCriteria = useMemo15(() => criteriaFromBooking(booking), [booking]);
|
|
12941
13256
|
const [criteria, setCriteria] = useState22(null);
|
|
12942
13257
|
const [lastCriteria, setLastCriteria] = useState22(initialCriteria);
|
|
12943
13258
|
const [car, setCar] = useState22(null);
|
|
@@ -12953,7 +13268,7 @@ function AmendFlow({
|
|
|
12953
13268
|
enabled: searching && Boolean(lockedSupplier),
|
|
12954
13269
|
staleTime: 10 * 60 * 1e3
|
|
12955
13270
|
});
|
|
12956
|
-
const cars =
|
|
13271
|
+
const cars = useMemo15(() => {
|
|
12957
13272
|
if (!availabilityQuery.isSuccess || !isOffersResult(availabilityQuery.data) || !criteria) {
|
|
12958
13273
|
return [];
|
|
12959
13274
|
}
|
|
@@ -13186,7 +13501,7 @@ function Receipt({ booking, onBack }) {
|
|
|
13186
13501
|
}
|
|
13187
13502
|
|
|
13188
13503
|
// src/components/ManageBooking/index.tsx
|
|
13189
|
-
import { Fragment as
|
|
13504
|
+
import { Fragment as Fragment20, jsx as jsx140, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
13190
13505
|
var Z_ABOVE_HOST_THEME2 = "z-2147483000";
|
|
13191
13506
|
function readDeepLink() {
|
|
13192
13507
|
const merged = new URLSearchParams(window.location.search);
|
|
@@ -13432,7 +13747,7 @@ function ManageBooking({ showTrigger = false, listStyle }) {
|
|
|
13432
13747
|
view === "quote-review" ? "Your quote" : "Manage your booking"
|
|
13433
13748
|
] }),
|
|
13434
13749
|
/* @__PURE__ */ jsxs96(GhostPill, { type: "button", onClick: () => setDrawerOpen(false), children: [
|
|
13435
|
-
/* @__PURE__ */ jsx140(
|
|
13750
|
+
/* @__PURE__ */ jsx140(X6, { className: "size-3.5", "aria-hidden": "true" }),
|
|
13436
13751
|
"Close"
|
|
13437
13752
|
] })
|
|
13438
13753
|
] }),
|
|
@@ -13484,7 +13799,7 @@ function ManageBooking({ showTrigger = false, listStyle }) {
|
|
|
13484
13799
|
}
|
|
13485
13800
|
),
|
|
13486
13801
|
view === "receipt" && booking && /* @__PURE__ */ jsx140(Receipt, { booking, onBack: () => setView("overview") }),
|
|
13487
|
-
view === "overview" && booking && /* @__PURE__ */ jsxs96(
|
|
13802
|
+
view === "overview" && booking && /* @__PURE__ */ jsxs96(Fragment20, { children: [
|
|
13488
13803
|
/* @__PURE__ */ jsx140(
|
|
13489
13804
|
BookingOverview,
|
|
13490
13805
|
{
|
|
@@ -13519,7 +13834,7 @@ function ManageBooking({ showTrigger = false, listStyle }) {
|
|
|
13519
13834
|
// src/components/PaymentReturn.tsx
|
|
13520
13835
|
import { useCallback as useCallback4, useEffect as useEffect23, useRef as useRef15, useState as useState24 } from "react";
|
|
13521
13836
|
import { CircleAlert as CircleAlert7, CircleCheck as CircleCheck3, LoaderCircle as LoaderCircle6, RotateCw as RotateCw2 } from "lucide-react";
|
|
13522
|
-
import { Fragment as
|
|
13837
|
+
import { Fragment as Fragment21, jsx as jsx141, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
13523
13838
|
var Z_ABOVE_HOST_THEME3 = "z-2147483000";
|
|
13524
13839
|
var WAIT_MS = 3e3;
|
|
13525
13840
|
var MAX_TRIES = 8;
|
|
@@ -13575,7 +13890,7 @@ function PaymentReturn() {
|
|
|
13575
13890
|
if (!token || saved?.wizard) return null;
|
|
13576
13891
|
return /* @__PURE__ */ jsx141(Dialog, { open, onOpenChange: (next) => !next && close(), children: /* @__PURE__ */ jsxs97(DialogContent, { className: `${Z_ABOVE_HOST_THEME3} rounded-2xl p-6 sm:max-w-md sm:p-8`, overlayClassName: Z_ABOVE_HOST_THEME3, children: [
|
|
13577
13892
|
view.kind === "checking" && /* @__PURE__ */ jsx141(Body, { icon: /* @__PURE__ */ jsx141(LoaderCircle6, { className: "size-6 animate-spin text-muted-foreground" }), title: "Checking your payment", text: "This takes a few seconds. Please keep this page open." }),
|
|
13578
|
-
view.kind === "confirmed" && /* @__PURE__ */ jsxs97(
|
|
13893
|
+
view.kind === "confirmed" && /* @__PURE__ */ jsxs97(Fragment21, { children: [
|
|
13579
13894
|
/* @__PURE__ */ jsx141(Body, { icon: /* @__PURE__ */ jsx141(CircleCheck3, { className: "size-6 text-wizard-selected" }), title: "Paid, and your booking is confirmed", text: "Keep these two codes: you need both to find or change your booking." }),
|
|
13580
13895
|
/* @__PURE__ */ jsxs97("dl", { className: "mt-5 grid grid-cols-2 gap-3 rounded-xl border border-border bg-surface-2 p-4", children: [
|
|
13581
13896
|
/* @__PURE__ */ jsxs97("div", { children: [
|
|
@@ -13589,7 +13904,7 @@ function PaymentReturn() {
|
|
|
13589
13904
|
] }),
|
|
13590
13905
|
/* @__PURE__ */ jsx141(CtaButton, { type: "button", onClick: close, className: "mt-6 h-11 w-full", children: "Done" })
|
|
13591
13906
|
] }),
|
|
13592
|
-
view.kind === "waiting" && /* @__PURE__ */ jsxs97(
|
|
13907
|
+
view.kind === "waiting" && /* @__PURE__ */ jsxs97(Fragment21, { children: [
|
|
13593
13908
|
/* @__PURE__ */ jsx141(
|
|
13594
13909
|
Body,
|
|
13595
13910
|
{
|
|
@@ -13606,7 +13921,7 @@ function PaymentReturn() {
|
|
|
13606
13921
|
"Check again"
|
|
13607
13922
|
] })
|
|
13608
13923
|
] }),
|
|
13609
|
-
view.kind === "attention" && /* @__PURE__ */ jsxs97(
|
|
13924
|
+
view.kind === "attention" && /* @__PURE__ */ jsxs97(Fragment21, { children: [
|
|
13610
13925
|
/* @__PURE__ */ jsx141(
|
|
13611
13926
|
Body,
|
|
13612
13927
|
{
|
|
@@ -13617,7 +13932,7 @@ function PaymentReturn() {
|
|
|
13617
13932
|
),
|
|
13618
13933
|
/* @__PURE__ */ jsx141(CtaButton, { type: "button", onClick: close, className: "mt-6 h-11 w-full", children: "Done" })
|
|
13619
13934
|
] }),
|
|
13620
|
-
view.kind === "failed" && /* @__PURE__ */ jsxs97(
|
|
13935
|
+
view.kind === "failed" && /* @__PURE__ */ jsxs97(Fragment21, { children: [
|
|
13621
13936
|
/* @__PURE__ */ jsx141(
|
|
13622
13937
|
Body,
|
|
13623
13938
|
{
|
|
@@ -13646,7 +13961,7 @@ function Body({ icon, title, text }) {
|
|
|
13646
13961
|
|
|
13647
13962
|
// src/components/BookingWizard/ConfirmationPreview.tsx
|
|
13648
13963
|
import { useState as useState25 } from "react";
|
|
13649
|
-
import { Car as CarIcon11, Eye, X as
|
|
13964
|
+
import { Car as CarIcon11, Eye, X as X7 } from "lucide-react";
|
|
13650
13965
|
import { jsx as jsx142, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
13651
13966
|
var PREVIEW_PARAM = "fleetbridge_preview";
|
|
13652
13967
|
function ConfirmationPreview({ enabled }) {
|
|
@@ -13695,7 +14010,7 @@ function ConfirmationPreview({ enabled }) {
|
|
|
13695
14010
|
] })
|
|
13696
14011
|
] }),
|
|
13697
14012
|
/* @__PURE__ */ jsxs98(GhostPill, { type: "button", onClick: close, className: "shrink-0", children: [
|
|
13698
|
-
/* @__PURE__ */ jsx142(
|
|
14013
|
+
/* @__PURE__ */ jsx142(X7, { className: "size-3.5", "aria-hidden": "true" }),
|
|
13699
14014
|
"Close"
|
|
13700
14015
|
] })
|
|
13701
14016
|
] }),
|