@planetaexo/design-system 0.5.5 → 0.7.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/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { XIcon, ChevronDownIcon, CalendarIcon, SearchIcon, ChevronRightIcon, ArrowLeftIcon, CheckCircle2Icon, MapIcon, MessageCircleIcon, UsersIcon, CreditCardIcon, AlertCircleIcon, MinusIcon, PlusIcon, CircleCheckIcon, ChevronLeftIcon, ClockIcon, ChevronUpIcon, UserIcon, MenuIcon, SunIcon, MoonIcon, MapPinIcon, PackageIcon, InfoIcon, Loader2Icon, SendIcon, CheckCircleIcon, CheckIcon, MailIcon, PhoneIcon, CompassIcon, UserPlusIcon, ExternalLinkIcon, CopyIcon, PencilIcon, Trash2Icon, UserMinusIcon, AlertTriangleIcon, CarIcon, ZoomInIcon, StarIcon, LayoutGridIcon } from 'lucide-react';
7
+ import { XIcon, ChevronDownIcon, CalendarIcon, SearchIcon, ChevronRightIcon, ArrowLeftIcon, CheckCircle2Icon, MapIcon, LogOutIcon, MessageCircleIcon, UsersIcon, CreditCardIcon, AlertCircleIcon, MinusIcon, PlusIcon, CircleCheckIcon, ChevronLeftIcon, ClockIcon, ChevronUpIcon, UserIcon, MenuIcon, SunIcon, MoonIcon, MapPinIcon, PackageIcon, InfoIcon, Loader2Icon, SendIcon, CheckCircleIcon, CheckIcon, MailIcon, PhoneIcon, CompassIcon, UserPlusIcon, ExternalLinkIcon, CopyIcon, PencilIcon, Trash2Icon, UserMinusIcon, AlertTriangleIcon, CarIcon, ZoomInIcon, StarIcon, LayoutGridIcon } from 'lucide-react';
8
8
  import { Separator as Separator$1 } from '@base-ui/react/separator';
9
9
  import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
10
10
  import { Button as Button$1 } from '@base-ui/react/button';
@@ -2241,21 +2241,16 @@ function AdventureSection({
2241
2241
  onRemoveTraveller,
2242
2242
  onAddSuggestedTraveller,
2243
2243
  onAddTraveller,
2244
- onUnassignFromAdventure
2244
+ onUnassignFromAdventure,
2245
+ hasSubmitAddTraveller,
2246
+ hasSubmitEditTraveller,
2247
+ hasConfirmRemoveTraveller,
2248
+ onRequestOpenAddModal,
2249
+ onRequestOpenEditModal,
2250
+ onRequestOpenDeleteModal
2245
2251
  }) {
2246
- var _a, _b, _c;
2252
+ var _a, _b, _c, _d;
2247
2253
  const [detailsOpen, setDetailsOpen] = React22.useState(false);
2248
- const [addModalOpen, setAddModalOpen] = React22.useState(false);
2249
- const [newTraveller, setNewTraveller] = React22.useState({
2250
- firstName: "",
2251
- lastName: "",
2252
- passport: "",
2253
- type: "adult",
2254
- email: "",
2255
- dateOfBirth: "",
2256
- phone: ""
2257
- });
2258
- const setField = (k, v) => setNewTraveller((p) => __spreadProps(__spreadValues({}, p), { [k]: v }));
2259
2254
  const handleCopyUrl = (url) => {
2260
2255
  navigator.clipboard.writeText(url);
2261
2256
  };
@@ -2288,7 +2283,7 @@ function AdventureSection({
2288
2283
  ] })
2289
2284
  ] })
2290
2285
  ] }),
2291
- /* @__PURE__ */ jsxs(
2286
+ (adventure.included && adventure.included.length > 0 || adventure.notIncluded && adventure.notIncluded.length > 0 || adventure.cancellationPolicy && adventure.cancellationPolicy.length > 0) && /* @__PURE__ */ jsxs(
2292
2287
  "button",
2293
2288
  {
2294
2289
  type: "button",
@@ -2320,11 +2315,28 @@ function AdventureSection({
2320
2315
  tag
2321
2316
  )) })
2322
2317
  ] }),
2318
+ (adventure.detailsSlot || adventure.description) && /* @__PURE__ */ jsxs("div", { className: "border-t border-border px-5 lg:px-6 py-5 flex flex-col gap-2", children: [
2319
+ /* @__PURE__ */ jsx("h4", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: (_d = adventure.itineraryLabel) != null ? _d : "Itinerary" }),
2320
+ adventure.detailsSlot ? /* @__PURE__ */ jsx(
2321
+ "div",
2322
+ {
2323
+ className: cn(
2324
+ "text-foreground",
2325
+ "[&_p]:text-sm [&_p]:text-foreground/80 [&_p]:leading-relaxed [&_p]:mb-2",
2326
+ "[&_h2]:text-lg [&_h2]:font-bold [&_h2]:text-foreground [&_h2]:mb-2 [&_h2]:mt-4",
2327
+ "[&_h3]:text-base [&_h3]:font-semibold [&_h3]:text-foreground [&_h3]:mb-1 [&_h3]:mt-3",
2328
+ "[&_strong]:font-bold [&_strong]:text-foreground",
2329
+ "[&_em]:italic",
2330
+ "[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2",
2331
+ "[&_ul]:list-disc [&_ul]:pl-5 [&_ul]:space-y-1",
2332
+ "[&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:space-y-1",
2333
+ "[&_li]:text-sm [&_li]:text-foreground/80 [&_li]:leading-relaxed"
2334
+ ),
2335
+ children: adventure.detailsSlot
2336
+ }
2337
+ ) : /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground/80 leading-relaxed font-sans", children: adventure.description })
2338
+ ] }),
2323
2339
  detailsOpen && /* @__PURE__ */ jsxs("div", { className: "border-t border-border px-5 lg:px-6 py-5 flex flex-col gap-5 bg-muted/10", children: [
2324
- adventure.description && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2325
- /* @__PURE__ */ jsx("h4", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "Itinerary" }),
2326
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground/80 leading-relaxed font-sans", children: adventure.description })
2327
- ] }),
2328
2340
  adventure.included && adventure.included.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2329
2341
  /* @__PURE__ */ jsx("h4", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "O que est\xE1 incluso" }),
2330
2342
  /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1.5", children: adventure.included.map((item, i) => /* @__PURE__ */ jsxs(
@@ -2383,7 +2395,12 @@ function AdventureSection({
2383
2395
  {
2384
2396
  type: "button",
2385
2397
  onClick: () => onAddContactAsTraveller(adventure.id),
2386
- className: "flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-muted-foreground hover:border-primary hover:text-primary hover:bg-primary/5 transition-colors",
2398
+ disabled: adventure.addContactAsTravellerDisabled,
2399
+ className: cn(
2400
+ "flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-muted-foreground transition-colors",
2401
+ "hover:border-primary hover:text-primary hover:bg-primary/5",
2402
+ "disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none disabled:hover:border-border disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
2403
+ ),
2387
2404
  children: [
2388
2405
  /* @__PURE__ */ jsx(UserPlusIcon, { className: "w-3 h-3" }),
2389
2406
  /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Add contact as traveller" }),
@@ -2391,11 +2408,17 @@ function AdventureSection({
2391
2408
  ]
2392
2409
  }
2393
2410
  ),
2394
- /* @__PURE__ */ jsxs(
2411
+ (onAddTraveller || hasSubmitAddTraveller) && /* @__PURE__ */ jsxs(
2395
2412
  "button",
2396
2413
  {
2397
2414
  type: "button",
2398
- onClick: () => onAddTraveller ? onAddTraveller(adventure.id) : setAddModalOpen(true),
2415
+ onClick: () => {
2416
+ if (onAddTraveller) {
2417
+ onAddTraveller(adventure.id);
2418
+ } else {
2419
+ onRequestOpenAddModal == null ? void 0 : onRequestOpenAddModal(adventure.id);
2420
+ }
2421
+ },
2399
2422
  className: "flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-primary hover:border-primary hover:bg-primary/5 transition-colors",
2400
2423
  children: [
2401
2424
  /* @__PURE__ */ jsx(PlusIcon, { className: "w-3 h-3" }),
@@ -2458,31 +2481,51 @@ function AdventureSection({
2458
2481
  }
2459
2482
  ),
2460
2483
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 shrink-0", children: [
2461
- onEditTraveller && /* @__PURE__ */ jsx(
2484
+ (onEditTraveller || hasSubmitEditTraveller) && /* @__PURE__ */ jsx(
2462
2485
  "button",
2463
2486
  {
2464
2487
  type: "button",
2465
- onClick: () => onEditTraveller(adventure.id, t.id),
2488
+ onClick: () => {
2489
+ if (onEditTraveller) {
2490
+ onEditTraveller(adventure.id, t.id);
2491
+ } else {
2492
+ onRequestOpenEditModal == null ? void 0 : onRequestOpenEditModal(adventure.id, t);
2493
+ }
2494
+ },
2466
2495
  className: "flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors",
2467
2496
  "aria-label": `Edit ${t.firstName}`,
2468
2497
  children: /* @__PURE__ */ jsx(PencilIcon, { className: "w-3.5 h-3.5" })
2469
2498
  }
2470
2499
  ),
2471
- onRemoveTraveller && /* @__PURE__ */ jsx(
2500
+ (onRemoveTraveller || hasConfirmRemoveTraveller) && /* @__PURE__ */ jsx(
2472
2501
  "button",
2473
2502
  {
2474
2503
  type: "button",
2475
- onClick: () => onRemoveTraveller(adventure.id, t.id),
2504
+ onClick: () => {
2505
+ if (onRemoveTraveller) {
2506
+ onRemoveTraveller(adventure.id, t.id);
2507
+ } else {
2508
+ onRequestOpenDeleteModal == null ? void 0 : onRequestOpenDeleteModal(adventure.id, t);
2509
+ }
2510
+ },
2476
2511
  className: "flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",
2477
2512
  "aria-label": `Delete ${t.firstName}`,
2478
2513
  children: /* @__PURE__ */ jsx(Trash2Icon, { className: "w-3.5 h-3.5" })
2479
2514
  }
2480
2515
  ),
2481
- (onUnassignFromAdventure || onRemoveTraveller) && /* @__PURE__ */ jsx(
2516
+ (onUnassignFromAdventure || onRemoveTraveller || hasConfirmRemoveTraveller) && /* @__PURE__ */ jsx(
2482
2517
  "button",
2483
2518
  {
2484
2519
  type: "button",
2485
- onClick: () => onUnassignFromAdventure ? onUnassignFromAdventure(adventure.id, t.id) : onRemoveTraveller(adventure.id, t.id),
2520
+ onClick: () => {
2521
+ if (onUnassignFromAdventure) {
2522
+ onUnassignFromAdventure(adventure.id, t.id);
2523
+ } else if (onRemoveTraveller) {
2524
+ onRemoveTraveller(adventure.id, t.id);
2525
+ } else {
2526
+ onRequestOpenDeleteModal == null ? void 0 : onRequestOpenDeleteModal(adventure.id, t);
2527
+ }
2528
+ },
2486
2529
  className: "flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-amber-500 hover:bg-amber-500/10 transition-colors",
2487
2530
  "aria-label": `Remove ${t.firstName} from adventure`,
2488
2531
  children: /* @__PURE__ */ jsx(UserMinusIcon, { className: "w-3.5 h-3.5" })
@@ -2515,132 +2558,327 @@ function AdventureSection({
2515
2558
  adventure.travellers.length > 0 && totalSlots > 0 && (() => {
2516
2559
  const completed = adventure.travellers.filter((t) => t.status === "completed").length;
2517
2560
  const percent = Math.round(completed / totalSlots * 100);
2518
- const isComplete = completed === totalSlots;
2561
+ const isComplete = completed >= totalSlots;
2562
+ const isEmpty = completed === 0;
2563
+ const barColor = isComplete ? "bg-success" : isEmpty ? "bg-destructive" : "bg-warning";
2564
+ const textColor = isComplete ? "text-success" : isEmpty ? "text-destructive" : "text-warning";
2519
2565
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mt-1", children: [
2520
2566
  /* @__PURE__ */ jsx("div", { className: "flex-1 h-2 rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ jsx(
2521
2567
  "div",
2522
2568
  {
2523
- className: "h-full rounded-full bg-primary transition-all duration-500",
2569
+ className: cn("h-full rounded-full transition-all duration-500", barColor),
2524
2570
  style: { width: `${percent}%` }
2525
2571
  }
2526
2572
  ) }),
2527
2573
  /* @__PURE__ */ jsxs("span", { className: cn(
2528
2574
  "text-xs font-semibold font-ui shrink-0 flex items-center gap-1",
2529
- isComplete ? "text-primary" : "text-destructive"
2575
+ textColor
2530
2576
  ), children: [
2531
2577
  completed,
2532
2578
  " of ",
2533
2579
  totalSlots,
2534
2580
  " travellers registered",
2535
- !isComplete && /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "w-3 h-3" })
2581
+ isComplete ? /* @__PURE__ */ jsx(CheckIcon, { className: "w-3 h-3" }) : /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "w-3 h-3" })
2536
2582
  ] })
2537
2583
  ] });
2538
2584
  })()
2539
- ] }),
2540
- /* @__PURE__ */ jsx(Dialog, { open: addModalOpen, onOpenChange: setAddModalOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
2541
- /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { className: "font-heading text-xl", children: "Add traveller" }) }),
2542
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 pt-2", children: [
2543
- /* @__PURE__ */ jsx(
2544
- FloatingInput,
2545
- {
2546
- label: "First name",
2547
- required: true,
2548
- value: newTraveller.firstName,
2549
- onChange: (e) => setField("firstName", e.target.value)
2550
- }
2551
- ),
2552
- /* @__PURE__ */ jsx(
2553
- FloatingInput,
2554
- {
2555
- label: "Last name",
2556
- required: true,
2557
- value: newTraveller.lastName,
2558
- onChange: (e) => setField("lastName", e.target.value)
2559
- }
2560
- ),
2561
- /* @__PURE__ */ jsx(
2562
- FloatingInput,
2563
- {
2564
- label: "Passport (optional)",
2565
- value: newTraveller.passport,
2566
- onChange: (e) => setField("passport", e.target.value)
2567
- }
2568
- ),
2569
- /* @__PURE__ */ jsxs(
2570
- FloatingSelect,
2571
- {
2572
- label: "Type (adult/child/senior)",
2573
- value: newTraveller.type,
2574
- onChange: (e) => setField("type", e.target.value),
2575
- children: [
2576
- /* @__PURE__ */ jsx("option", { value: "adult", children: "Adult" }),
2577
- /* @__PURE__ */ jsx("option", { value: "child", children: "Child" }),
2578
- /* @__PURE__ */ jsx("option", { value: "senior", children: "Senior" })
2579
- ]
2580
- }
2581
- ),
2582
- /* @__PURE__ */ jsx(
2583
- FloatingInput,
2584
- {
2585
- label: "Email",
2586
- type: "email",
2587
- required: true,
2588
- value: newTraveller.email,
2589
- onChange: (e) => setField("email", e.target.value)
2590
- }
2591
- ),
2592
- /* @__PURE__ */ jsx(
2593
- FloatingInput,
2594
- {
2595
- label: "Date of birth",
2596
- type: "date",
2597
- value: newTraveller.dateOfBirth,
2598
- onChange: (e) => setField("dateOfBirth", e.target.value)
2599
- }
2600
- ),
2601
- /* @__PURE__ */ jsx(
2602
- FloatingInput,
2603
- {
2604
- label: "Phone (optional)",
2605
- type: "tel",
2606
- value: newTraveller.phone,
2607
- onChange: (e) => setField("phone", e.target.value)
2608
- }
2609
- ),
2610
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-3 pt-2", children: [
2585
+ ] })
2586
+ ] });
2587
+ }
2588
+ function TravellerFormFields({ value, onChange, config }) {
2589
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2590
+ const labels = (_a = config == null ? void 0 : config.labels) != null ? _a : {};
2591
+ const disabledTypes = new Set((_b = config == null ? void 0 : config.disabledPersonTypes) != null ? _b : []);
2592
+ const documentLabel = (config == null ? void 0 : config.requireCpf) ? (_c = labels.documentCpf) != null ? _c : "CPF" : (_d = labels.documentPassport) != null ? _d : "Passport (optional)";
2593
+ const documentPlaceholder = (config == null ? void 0 : config.requireCpf) ? "000.000.000-00" : void 0;
2594
+ const isChild = value.personType === "CHILD";
2595
+ const childEmail = config == null ? void 0 : config.childEmailFromContact;
2596
+ const emailRequired = value.personType === "ADULT" || value.personType === "SENIOR";
2597
+ const emailLabel = `${(_e = labels.email) != null ? _e : "Email"}${emailRequired ? " *" : ""}`;
2598
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2599
+ /* @__PURE__ */ jsx(
2600
+ FloatingInput,
2601
+ {
2602
+ label: (_f = labels.firstName) != null ? _f : "First name *",
2603
+ required: true,
2604
+ value: value.firstName,
2605
+ onChange: (e) => onChange({ firstName: e.target.value })
2606
+ }
2607
+ ),
2608
+ /* @__PURE__ */ jsx(
2609
+ FloatingInput,
2610
+ {
2611
+ label: (_g = labels.lastName) != null ? _g : "Last name *",
2612
+ required: true,
2613
+ value: value.lastName,
2614
+ onChange: (e) => onChange({ lastName: e.target.value })
2615
+ }
2616
+ ),
2617
+ /* @__PURE__ */ jsx(
2618
+ FloatingInput,
2619
+ {
2620
+ label: documentLabel,
2621
+ placeholder: documentPlaceholder,
2622
+ value: (_h = value.documentNumber) != null ? _h : "",
2623
+ onChange: (e) => onChange({ documentNumber: e.target.value })
2624
+ }
2625
+ ),
2626
+ /* @__PURE__ */ jsxs(
2627
+ FloatingSelect,
2628
+ {
2629
+ label: (_i = labels.personTypeLabel) != null ? _i : "Type (adult/child/senior)",
2630
+ value: value.personType,
2631
+ onChange: (e) => onChange({ personType: e.target.value }),
2632
+ children: [
2633
+ /* @__PURE__ */ jsx("option", { value: "ADULT", disabled: disabledTypes.has("ADULT"), children: (_j = labels.personTypeAdult) != null ? _j : "Adult" }),
2634
+ /* @__PURE__ */ jsx("option", { value: "CHILD", disabled: disabledTypes.has("CHILD"), children: (_k = labels.personTypeChild) != null ? _k : "Child" }),
2635
+ /* @__PURE__ */ jsx("option", { value: "SENIOR", disabled: disabledTypes.has("SENIOR"), children: (_l = labels.personTypeSenior) != null ? _l : "Senior" })
2636
+ ]
2637
+ }
2638
+ ),
2639
+ isChild && childEmail ? /* @__PURE__ */ jsx(
2640
+ FloatingInput,
2641
+ {
2642
+ label: (_m = labels.email) != null ? _m : "Email",
2643
+ type: "email",
2644
+ value: childEmail,
2645
+ readOnly: true,
2646
+ disabled: true
2647
+ }
2648
+ ) : /* @__PURE__ */ jsx(
2649
+ FloatingInput,
2650
+ {
2651
+ label: emailLabel,
2652
+ type: "email",
2653
+ value: (_n = value.email) != null ? _n : "",
2654
+ onChange: (e) => onChange({ email: e.target.value }),
2655
+ required: emailRequired
2656
+ }
2657
+ ),
2658
+ /* @__PURE__ */ jsx(
2659
+ FloatingInput,
2660
+ {
2661
+ label: (_o = labels.birthDate) != null ? _o : "Date of birth",
2662
+ type: "date",
2663
+ value: (_p = value.birthDate) != null ? _p : "",
2664
+ onChange: (e) => onChange({ birthDate: e.target.value })
2665
+ }
2666
+ ),
2667
+ /* @__PURE__ */ jsx(
2668
+ FloatingInput,
2669
+ {
2670
+ label: (_q = labels.phone) != null ? _q : "Phone (optional)",
2671
+ type: "tel",
2672
+ value: (_r = value.phone) != null ? _r : "",
2673
+ onChange: (e) => onChange({ phone: e.target.value }),
2674
+ placeholder: "+5511987654321"
2675
+ }
2676
+ )
2677
+ ] });
2678
+ }
2679
+ function createInitialAddFormData(config) {
2680
+ var _a;
2681
+ const disabled = new Set((_a = config == null ? void 0 : config.disabledPersonTypes) != null ? _a : []);
2682
+ const personType = !disabled.has("ADULT") ? "ADULT" : !disabled.has("CHILD") ? "CHILD" : "SENIOR";
2683
+ return {
2684
+ firstName: "",
2685
+ lastName: "",
2686
+ email: "",
2687
+ documentNumber: "",
2688
+ phone: "",
2689
+ birthDate: "",
2690
+ personType
2691
+ };
2692
+ }
2693
+ function AddTravellerDialog({
2694
+ open,
2695
+ adventureId,
2696
+ onClose,
2697
+ onSubmit,
2698
+ config,
2699
+ saving,
2700
+ errorMessage
2701
+ }) {
2702
+ var _a, _b, _c, _d, _e;
2703
+ const [form, setForm] = React22.useState(() => createInitialAddFormData(config));
2704
+ React22.useEffect(() => {
2705
+ if (open) {
2706
+ setForm(createInitialAddFormData(config));
2707
+ }
2708
+ }, [open, config]);
2709
+ const childEmailFromContact = config == null ? void 0 : config.childEmailFromContact;
2710
+ const labels = (_a = config == null ? void 0 : config.labels) != null ? _a : {};
2711
+ const handleSubmit = async (e) => {
2712
+ var _a2, _b2, _c2;
2713
+ e.preventDefault();
2714
+ if (!adventureId) return;
2715
+ const data = __spreadProps(__spreadValues({}, form), {
2716
+ firstName: form.firstName.trim(),
2717
+ lastName: form.lastName.trim(),
2718
+ email: form.personType === "CHILD" && childEmailFromContact ? childEmailFromContact : ((_a2 = form.email) == null ? void 0 : _a2.trim()) || void 0,
2719
+ documentNumber: ((_b2 = form.documentNumber) == null ? void 0 : _b2.trim()) || void 0,
2720
+ phone: ((_c2 = form.phone) == null ? void 0 : _c2.trim()) || void 0,
2721
+ birthDate: form.birthDate || void 0
2722
+ });
2723
+ await onSubmit(adventureId, data);
2724
+ };
2725
+ return /* @__PURE__ */ jsx(
2726
+ Dialog,
2727
+ {
2728
+ open,
2729
+ onOpenChange: (o) => {
2730
+ if (!o) onClose();
2731
+ },
2732
+ children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-lg", children: [
2733
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { className: "font-heading text-xl", children: (_b = labels.modalAddTitle) != null ? _b : "Add traveller" }) }),
2734
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-3", children: [
2611
2735
  /* @__PURE__ */ jsx(
2612
- "button",
2736
+ TravellerFormFields,
2613
2737
  {
2614
- type: "button",
2615
- onClick: () => setAddModalOpen(false),
2616
- className: "text-sm font-ui text-muted-foreground hover:text-foreground transition-colors",
2617
- children: "Cancel"
2738
+ value: form,
2739
+ onChange: (patch) => setForm((prev) => __spreadValues(__spreadValues({}, prev), patch)),
2740
+ config
2618
2741
  }
2619
2742
  ),
2743
+ errorMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-sans", children: errorMessage }),
2744
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2745
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onClose, children: (_c = labels.cancel) != null ? _c : "Cancel" }),
2746
+ /* @__PURE__ */ jsx(Button, { type: "submit", size: "sm", disabled: saving, children: saving ? (_d = labels.saving) != null ? _d : "Saving..." : (_e = labels.add) != null ? _e : "Add" })
2747
+ ] })
2748
+ ] })
2749
+ ] })
2750
+ }
2751
+ );
2752
+ }
2753
+ function EditTravellerDialog({
2754
+ open,
2755
+ adventureId,
2756
+ traveller,
2757
+ onClose,
2758
+ onSubmit,
2759
+ config,
2760
+ saving,
2761
+ errorMessage
2762
+ }) {
2763
+ var _a, _b, _c, _d, _e;
2764
+ const [form, setForm] = React22.useState(() => ({
2765
+ firstName: "",
2766
+ lastName: "",
2767
+ email: "",
2768
+ documentNumber: "",
2769
+ phone: "",
2770
+ birthDate: "",
2771
+ personType: "ADULT"
2772
+ }));
2773
+ React22.useEffect(() => {
2774
+ var _a2, _b2, _c2, _d2, _e2, _f;
2775
+ if (open && traveller) {
2776
+ setForm({
2777
+ firstName: (_a2 = traveller.firstName) != null ? _a2 : "",
2778
+ lastName: (_b2 = traveller.lastName) != null ? _b2 : "",
2779
+ email: (_c2 = traveller.email) != null ? _c2 : "",
2780
+ documentNumber: (_d2 = traveller.documentNumber) != null ? _d2 : "",
2781
+ phone: (_e2 = traveller.phone) != null ? _e2 : "",
2782
+ birthDate: traveller.birthDate ? traveller.birthDate.slice(0, 10) : "",
2783
+ personType: (_f = traveller.personType) != null ? _f : traveller.isChild ? "CHILD" : "ADULT"
2784
+ });
2785
+ }
2786
+ }, [open, traveller]);
2787
+ const childEmailFromContact = config == null ? void 0 : config.childEmailFromContact;
2788
+ const labels = (_a = config == null ? void 0 : config.labels) != null ? _a : {};
2789
+ const handleSubmit = async (e) => {
2790
+ var _a2, _b2, _c2;
2791
+ e.preventDefault();
2792
+ if (!adventureId || !traveller) return;
2793
+ const data = __spreadProps(__spreadValues({}, form), {
2794
+ firstName: form.firstName.trim(),
2795
+ lastName: form.lastName.trim(),
2796
+ email: form.personType === "CHILD" && childEmailFromContact ? childEmailFromContact : ((_a2 = form.email) == null ? void 0 : _a2.trim()) || void 0,
2797
+ documentNumber: ((_b2 = form.documentNumber) == null ? void 0 : _b2.trim()) || void 0,
2798
+ phone: ((_c2 = form.phone) == null ? void 0 : _c2.trim()) || void 0,
2799
+ birthDate: form.birthDate || void 0
2800
+ });
2801
+ await onSubmit(adventureId, traveller.id, data);
2802
+ };
2803
+ return /* @__PURE__ */ jsx(
2804
+ Dialog,
2805
+ {
2806
+ open,
2807
+ onOpenChange: (o) => {
2808
+ if (!o) onClose();
2809
+ },
2810
+ children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-lg", children: [
2811
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { className: "font-heading text-xl", children: (_b = labels.modalEditTitle) != null ? _b : "Edit traveller" }) }),
2812
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-3", children: [
2620
2813
  /* @__PURE__ */ jsx(
2621
- "button",
2814
+ TravellerFormFields,
2815
+ {
2816
+ value: form,
2817
+ onChange: (patch) => setForm((prev) => __spreadValues(__spreadValues({}, prev), patch)),
2818
+ config
2819
+ }
2820
+ ),
2821
+ errorMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-sans", children: errorMessage }),
2822
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2823
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onClose, children: (_c = labels.cancel) != null ? _c : "Cancel" }),
2824
+ /* @__PURE__ */ jsx(Button, { type: "submit", size: "sm", disabled: saving, children: saving ? (_d = labels.saving) != null ? _d : "Saving..." : (_e = labels.save) != null ? _e : "Save" })
2825
+ ] })
2826
+ ] })
2827
+ ] })
2828
+ }
2829
+ );
2830
+ }
2831
+ function DeleteTravellerDialog({
2832
+ open,
2833
+ adventureId,
2834
+ traveller,
2835
+ onClose,
2836
+ onConfirm,
2837
+ config,
2838
+ saving,
2839
+ errorMessage
2840
+ }) {
2841
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2842
+ const labels = (_a = config == null ? void 0 : config.labels) != null ? _a : {};
2843
+ const name = traveller ? `${(_b = traveller.firstName) != null ? _b : ""} ${(_c = traveller.lastName) != null ? _c : ""}`.trim() : "";
2844
+ const description = ((_d = labels.modalDeleteConfirm) != null ? _d : 'Delete traveller "{name}"?').replace(
2845
+ "{name}",
2846
+ name
2847
+ );
2848
+ return /* @__PURE__ */ jsx(
2849
+ Dialog,
2850
+ {
2851
+ open,
2852
+ onOpenChange: (o) => {
2853
+ if (!o) onClose();
2854
+ },
2855
+ children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-sm", children: [
2856
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
2857
+ /* @__PURE__ */ jsx(DialogTitle, { children: (_e = labels.modalDeleteTitle) != null ? _e : "Delete traveller?" }),
2858
+ /* @__PURE__ */ jsx(DialogDescription, { children: description })
2859
+ ] }),
2860
+ errorMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-sans", children: errorMessage }),
2861
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2862
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onClose, children: (_f = labels.cancel) != null ? _f : "Cancel" }),
2863
+ /* @__PURE__ */ jsx(
2864
+ Button,
2622
2865
  {
2623
2866
  type: "button",
2867
+ variant: "destructive",
2868
+ size: "sm",
2869
+ disabled: saving,
2624
2870
  onClick: () => {
2625
- setAddModalOpen(false);
2626
- setNewTraveller({
2627
- firstName: "",
2628
- lastName: "",
2629
- passport: "",
2630
- type: "adult",
2631
- email: "",
2632
- dateOfBirth: "",
2633
- phone: ""
2634
- });
2871
+ if (adventureId && traveller) {
2872
+ void onConfirm(adventureId, traveller.id);
2873
+ }
2635
2874
  },
2636
- className: "rounded-full bg-primary px-6 py-2.5 text-sm font-bold text-primary-foreground font-heading hover:bg-primary/90 transition-colors",
2637
- children: "Add"
2875
+ children: saving ? (_h = (_g = labels.deleting) != null ? _g : labels.saving) != null ? _h : "Deleting..." : (_i = labels.delete) != null ? _i : "Delete"
2638
2876
  }
2639
2877
  )
2640
2878
  ] })
2641
2879
  ] })
2642
- ] }) })
2643
- ] });
2880
+ }
2881
+ );
2644
2882
  }
2645
2883
  function OrderSummary({
2646
2884
  adventures,
@@ -2767,164 +3005,316 @@ function BookingDetails({
2767
3005
  onAddSuggestedTraveller,
2768
3006
  onAddTraveller,
2769
3007
  onUnassignFromAdventure,
3008
+ onSubmitAddTraveller,
3009
+ onSubmitEditTraveller,
3010
+ onConfirmRemoveTraveller,
3011
+ travellerFormConfig,
3012
+ addTravellerSaving,
3013
+ editTravellerSaving,
3014
+ removeTravellerSaving,
3015
+ travellerFormError,
2770
3016
  onPayBalance,
2771
3017
  onCancelRequest,
3018
+ logoSrc,
3019
+ logoAlt,
3020
+ onSignOut,
3021
+ signOutLabel,
2772
3022
  className
2773
3023
  }) {
2774
3024
  var _a, _b, _c;
2775
3025
  const people = totalPeople(adventures);
2776
- return /* @__PURE__ */ jsxs(
2777
- "div",
2778
- {
2779
- className: cn("w-full max-w-5xl mx-auto flex flex-col gap-6 px-4 sm:px-6 lg:px-0", className),
2780
- children: [
2781
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [
2782
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
2783
- /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-black text-foreground font-heading leading-tight", children: [
2784
- "Booking",
2785
- " ",
2786
- /* @__PURE__ */ jsxs("span", { className: "text-primary", children: [
2787
- "#",
2788
- bookingId
3026
+ const hasSubmitAddTraveller = !!onSubmitAddTraveller;
3027
+ const hasSubmitEditTraveller = !!onSubmitEditTraveller;
3028
+ const hasConfirmRemoveTraveller = !!onConfirmRemoveTraveller;
3029
+ const [addModalState, setAddModalState] = React22.useState({
3030
+ open: false,
3031
+ adventureId: null
3032
+ });
3033
+ const [editModalState, setEditModalState] = React22.useState({ open: false, adventureId: null, traveller: null });
3034
+ const [deleteModalState, setDeleteModalState] = React22.useState({ open: false, adventureId: null, traveller: null });
3035
+ const handleRequestOpenAddModal = React22.useCallback((adventureId) => {
3036
+ setAddModalState({ open: true, adventureId });
3037
+ }, []);
3038
+ const handleRequestOpenEditModal = React22.useCallback(
3039
+ (adventureId, traveller) => {
3040
+ setEditModalState({ open: true, adventureId, traveller });
3041
+ },
3042
+ []
3043
+ );
3044
+ const handleRequestOpenDeleteModal = React22.useCallback(
3045
+ (adventureId, traveller) => {
3046
+ setDeleteModalState({ open: true, adventureId, traveller });
3047
+ },
3048
+ []
3049
+ );
3050
+ const closeAddModal = React22.useCallback(() => {
3051
+ setAddModalState({ open: false, adventureId: null });
3052
+ }, []);
3053
+ const closeEditModal = React22.useCallback(() => {
3054
+ setEditModalState({ open: false, adventureId: null, traveller: null });
3055
+ }, []);
3056
+ const closeDeleteModal = React22.useCallback(() => {
3057
+ setDeleteModalState({ open: false, adventureId: null, traveller: null });
3058
+ }, []);
3059
+ const handleAddSubmit = React22.useCallback(
3060
+ async (adventureId, data) => {
3061
+ if (!onSubmitAddTraveller) return;
3062
+ try {
3063
+ await onSubmitAddTraveller(adventureId, data);
3064
+ closeAddModal();
3065
+ } catch (e) {
3066
+ }
3067
+ },
3068
+ [onSubmitAddTraveller, closeAddModal]
3069
+ );
3070
+ const handleEditSubmit = React22.useCallback(
3071
+ async (adventureId, travellerId, data) => {
3072
+ if (!onSubmitEditTraveller) return;
3073
+ try {
3074
+ await onSubmitEditTraveller(adventureId, travellerId, data);
3075
+ closeEditModal();
3076
+ } catch (e) {
3077
+ }
3078
+ },
3079
+ [onSubmitEditTraveller, closeEditModal]
3080
+ );
3081
+ const handleDeleteConfirm = React22.useCallback(
3082
+ async (adventureId, travellerId) => {
3083
+ if (!onConfirmRemoveTraveller) return;
3084
+ try {
3085
+ await onConfirmRemoveTraveller(adventureId, travellerId);
3086
+ closeDeleteModal();
3087
+ } catch (e) {
3088
+ }
3089
+ },
3090
+ [onConfirmRemoveTraveller, closeDeleteModal]
3091
+ );
3092
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3093
+ (logoSrc || onSignOut) && /* @__PURE__ */ jsx("header", { className: "w-full border-b border-border bg-card/50 backdrop-blur-sm sticky top-0 z-30", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-5xl mx-auto px-4 sm:px-6 lg:px-0 h-14 flex items-center justify-between gap-4", children: [
3094
+ /* @__PURE__ */ jsx("div", { className: "flex-1" }),
3095
+ logoSrc ? /* @__PURE__ */ jsx(
3096
+ "img",
3097
+ {
3098
+ src: logoSrc,
3099
+ alt: logoAlt != null ? logoAlt : "",
3100
+ className: "h-11 w-auto object-contain shrink-0"
3101
+ }
3102
+ ) : /* @__PURE__ */ jsx("div", {}),
3103
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: onSignOut && /* @__PURE__ */ jsxs(
3104
+ "button",
3105
+ {
3106
+ type: "button",
3107
+ onClick: onSignOut,
3108
+ className: "inline-flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-muted-foreground hover:border-primary hover:text-primary hover:bg-primary/5 transition-colors",
3109
+ children: [
3110
+ /* @__PURE__ */ jsx(LogOutIcon, { className: "w-3.5 h-3.5" }),
3111
+ signOutLabel != null ? signOutLabel : "Sign out"
3112
+ ]
3113
+ }
3114
+ ) })
3115
+ ] }) }),
3116
+ /* @__PURE__ */ jsxs(
3117
+ "div",
3118
+ {
3119
+ className: cn(
3120
+ "w-full max-w-5xl mx-auto flex flex-col gap-6 px-4 sm:px-6 lg:px-0 py-8 sm:py-12",
3121
+ className
3122
+ ),
3123
+ children: [
3124
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [
3125
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
3126
+ /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-black text-foreground font-heading leading-tight", children: [
3127
+ "Booking",
3128
+ " ",
3129
+ /* @__PURE__ */ jsxs("span", { className: "text-primary", children: [
3130
+ "#",
3131
+ bookingId
3132
+ ] })
3133
+ ] }),
3134
+ /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground font-sans", children: [
3135
+ "Created on ",
3136
+ createdAt
2789
3137
  ] })
2790
3138
  ] }),
2791
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground font-sans", children: [
2792
- "Created on ",
2793
- createdAt
2794
- ] })
3139
+ /* @__PURE__ */ jsx(StatusBadge, { status })
2795
3140
  ] }),
2796
- /* @__PURE__ */ jsx(StatusBadge, { status })
2797
- ] }),
2798
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
2799
- /* @__PURE__ */ jsxs(InfoCard, { label: "Contact", children: [
2800
- /* @__PURE__ */ jsx("p", { className: "font-semibold", children: contact.name }),
2801
- contact.email && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-sans truncate", children: contact.email })
3141
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
3142
+ /* @__PURE__ */ jsxs(InfoCard, { label: "Contact", children: [
3143
+ /* @__PURE__ */ jsx("p", { className: "font-semibold", children: contact.name }),
3144
+ contact.email && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-sans truncate", children: contact.email })
3145
+ ] }),
3146
+ agentName && /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card p-4 flex items-center gap-3.5 min-w-0", children: [
3147
+ /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary font-heading font-bold text-sm uppercase", children: agentName.charAt(0) }),
3148
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
3149
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "Your Agent" }),
3150
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground font-sans", children: agentName })
3151
+ ] }),
3152
+ agentContactUrl && /* @__PURE__ */ jsxs(
3153
+ "a",
3154
+ {
3155
+ href: agentContactUrl,
3156
+ target: "_blank",
3157
+ rel: "noopener noreferrer",
3158
+ className: "ml-auto shrink-0 flex items-center gap-1.5 rounded-full bg-primary/10 px-3.5 py-1.5 text-xs font-semibold text-primary font-ui transition-colors hover:bg-primary/20",
3159
+ children: [
3160
+ /* @__PURE__ */ jsx(MessageCircleIcon, { className: "w-3.5 h-3.5" }),
3161
+ "Contact"
3162
+ ]
3163
+ }
3164
+ )
3165
+ ] }),
3166
+ /* @__PURE__ */ jsxs(InfoCard, { label: "Total People", children: [
3167
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3168
+ /* @__PURE__ */ jsx(UsersIcon, { className: "w-4 h-4 text-primary shrink-0" }),
3169
+ /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
3170
+ people.total,
3171
+ " person(s)"
3172
+ ] })
3173
+ ] }),
3174
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-sans", children: [
3175
+ people.adults > 0 ? `Adults: ${people.adults}` : null,
3176
+ people.children > 0 ? `Children: ${people.children}` : null,
3177
+ people.seniors > 0 ? `Seniors: ${people.seniors}` : null
3178
+ ].filter(Boolean).join(" \xB7 ") })
3179
+ ] })
2802
3180
  ] }),
2803
- agentName && /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card p-4 flex items-center gap-3.5 min-w-0", children: [
2804
- /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary font-heading font-bold text-sm uppercase", children: agentName.charAt(0) }),
2805
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
2806
- /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "Your Agent" }),
2807
- /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground font-sans", children: agentName })
3181
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4", children: [
3182
+ /* @__PURE__ */ jsxs("h2", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: [
3183
+ "Adventures (",
3184
+ adventures.length,
3185
+ ")"
2808
3186
  ] }),
2809
- agentContactUrl && /* @__PURE__ */ jsxs(
2810
- "a",
3187
+ adventures.map((adventure) => /* @__PURE__ */ jsx(
3188
+ AdventureSection,
3189
+ {
3190
+ adventure,
3191
+ onAddContactAsTraveller,
3192
+ onEditTraveller,
3193
+ onRemoveTraveller,
3194
+ onAddSuggestedTraveller,
3195
+ onAddTraveller,
3196
+ onUnassignFromAdventure,
3197
+ hasSubmitAddTraveller,
3198
+ hasSubmitEditTraveller,
3199
+ hasConfirmRemoveTraveller,
3200
+ onRequestOpenAddModal: handleRequestOpenAddModal,
3201
+ onRequestOpenEditModal: handleRequestOpenEditModal,
3202
+ onRequestOpenDeleteModal: handleRequestOpenDeleteModal
3203
+ },
3204
+ adventure.id
3205
+ ))
3206
+ ] }),
3207
+ /* @__PURE__ */ jsx(
3208
+ OrderSummary,
3209
+ {
3210
+ adventures,
3211
+ summaryLineItems,
3212
+ subtotal,
3213
+ total,
3214
+ depositInfo
3215
+ }
3216
+ ),
3217
+ /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-border bg-card p-5 lg:p-6 flex flex-col gap-4", children: [
3218
+ /* @__PURE__ */ jsx("h3", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "Responsible Person" }),
3219
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-6 gap-y-3", children: [
3220
+ /* @__PURE__ */ jsxs("div", { children: [
3221
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Name" }),
3222
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground font-sans", children: contact.name })
3223
+ ] }),
3224
+ /* @__PURE__ */ jsxs("div", { children: [
3225
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Email" }),
3226
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans truncate", children: (_a = contact.email) != null ? _a : "\u2014" })
3227
+ ] }),
3228
+ /* @__PURE__ */ jsxs("div", { children: [
3229
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Phone" }),
3230
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: (_b = contact.phone) != null ? _b : "\u2014" })
3231
+ ] }),
3232
+ /* @__PURE__ */ jsxs("div", { children: [
3233
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Country" }),
3234
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: (_c = contact.country) != null ? _c : "\u2014" })
3235
+ ] }),
3236
+ contact.passport && /* @__PURE__ */ jsxs("div", { children: [
3237
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Passport / CPF" }),
3238
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: contact.passport })
3239
+ ] })
3240
+ ] })
3241
+ ] }),
3242
+ (onPayBalance || onCancelRequest) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
3243
+ depositInfo && !depositInfo.isPaidInFull && // Se consumer passar remainingAmountValue, só mostra botão quando saldo > 0.
3244
+ // Quando undefined, mantém comportamento antigo (backward compat).
3245
+ (depositInfo.remainingAmountValue === void 0 || depositInfo.remainingAmountValue > 0) && onPayBalance && /* @__PURE__ */ jsxs(
3246
+ "button",
2811
3247
  {
2812
- href: agentContactUrl,
2813
- target: "_blank",
2814
- rel: "noopener noreferrer",
2815
- className: "ml-auto shrink-0 flex items-center gap-1.5 rounded-full bg-primary/10 px-3.5 py-1.5 text-xs font-semibold text-primary font-ui transition-colors hover:bg-primary/20",
3248
+ type: "button",
3249
+ onClick: onPayBalance,
3250
+ className: cn(
3251
+ "w-full rounded-full bg-primary py-3.5 text-center text-sm font-bold uppercase tracking-wide",
3252
+ "text-primary-foreground font-heading transition-colors hover:bg-primary/90",
3253
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3254
+ "flex items-center justify-center gap-2"
3255
+ ),
2816
3256
  children: [
2817
- /* @__PURE__ */ jsx(MessageCircleIcon, { className: "w-3.5 h-3.5" }),
2818
- "Contact"
3257
+ /* @__PURE__ */ jsx(CreditCardIcon, { className: "w-4 h-4" }),
3258
+ "Pay remaining balance \u2014 ",
3259
+ depositInfo.remainingAmount
3260
+ ]
3261
+ }
3262
+ ),
3263
+ onCancelRequest && status !== "cancelled" && /* @__PURE__ */ jsxs(
3264
+ "button",
3265
+ {
3266
+ type: "button",
3267
+ onClick: onCancelRequest,
3268
+ className: "flex items-center gap-1.5 text-xs font-ui text-muted-foreground hover:text-destructive transition-colors underline underline-offset-2",
3269
+ children: [
3270
+ /* @__PURE__ */ jsx(AlertCircleIcon, { className: "w-3 h-3" }),
3271
+ "Request cancellation"
2819
3272
  ]
2820
3273
  }
2821
3274
  )
2822
- ] }),
2823
- /* @__PURE__ */ jsxs(InfoCard, { label: "Total People", children: [
2824
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2825
- /* @__PURE__ */ jsx(UsersIcon, { className: "w-4 h-4 text-primary shrink-0" }),
2826
- /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
2827
- people.total,
2828
- " person(s)"
2829
- ] })
2830
- ] }),
2831
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-sans", children: [
2832
- people.adults > 0 ? `Adults: ${people.adults}` : null,
2833
- people.children > 0 ? `Children: ${people.children}` : null,
2834
- people.seniors > 0 ? `Seniors: ${people.seniors}` : null
2835
- ].filter(Boolean).join(" \xB7 ") })
2836
- ] })
2837
- ] }),
2838
- /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4", children: [
2839
- /* @__PURE__ */ jsxs("h2", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: [
2840
- "Adventures (",
2841
- adventures.length,
2842
- ")"
2843
- ] }),
2844
- adventures.map((adventure) => /* @__PURE__ */ jsx(
2845
- AdventureSection,
2846
- {
2847
- adventure,
2848
- onAddContactAsTraveller,
2849
- onEditTraveller,
2850
- onRemoveTraveller,
2851
- onAddSuggestedTraveller,
2852
- onAddTraveller,
2853
- onUnassignFromAdventure
2854
- },
2855
- adventure.id
2856
- ))
2857
- ] }),
2858
- /* @__PURE__ */ jsx(
2859
- OrderSummary,
2860
- {
2861
- adventures,
2862
- summaryLineItems,
2863
- subtotal,
2864
- total,
2865
- depositInfo
2866
- }
2867
- ),
2868
- /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-border bg-card p-5 lg:p-6 flex flex-col gap-4", children: [
2869
- /* @__PURE__ */ jsx("h3", { className: "text-xs font-bold text-muted-foreground font-heading uppercase tracking-widest", children: "Responsible Person" }),
2870
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-6 gap-y-3", children: [
2871
- /* @__PURE__ */ jsxs("div", { children: [
2872
- /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Name" }),
2873
- /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground font-sans", children: contact.name })
2874
- ] }),
2875
- /* @__PURE__ */ jsxs("div", { children: [
2876
- /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Email" }),
2877
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans truncate", children: (_a = contact.email) != null ? _a : "\u2014" })
2878
- ] }),
2879
- /* @__PURE__ */ jsxs("div", { children: [
2880
- /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Phone" }),
2881
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: (_b = contact.phone) != null ? _b : "\u2014" })
2882
- ] }),
2883
- /* @__PURE__ */ jsxs("div", { children: [
2884
- /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Country" }),
2885
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: (_c = contact.country) != null ? _c : "\u2014" })
2886
- ] }),
2887
- contact.passport && /* @__PURE__ */ jsxs("div", { children: [
2888
- /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-muted-foreground/60 font-heading uppercase tracking-widest mb-0.5", children: "Passport / CPF" }),
2889
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground font-sans", children: contact.passport })
2890
- ] })
2891
3275
  ] })
2892
- ] }),
2893
- (onPayBalance || onCancelRequest) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
2894
- depositInfo && !depositInfo.isPaidInFull && onPayBalance && /* @__PURE__ */ jsxs(
2895
- "button",
2896
- {
2897
- type: "button",
2898
- onClick: onPayBalance,
2899
- className: cn(
2900
- "w-full rounded-full bg-primary py-3.5 text-center text-sm font-bold uppercase tracking-wide",
2901
- "text-primary-foreground font-heading transition-colors hover:bg-primary/90",
2902
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2903
- "flex items-center justify-center gap-2"
2904
- ),
2905
- children: [
2906
- /* @__PURE__ */ jsx(CreditCardIcon, { className: "w-4 h-4" }),
2907
- "Pay remaining balance \u2014 ",
2908
- depositInfo.remainingAmount
2909
- ]
2910
- }
2911
- ),
2912
- onCancelRequest && status !== "cancelled" && /* @__PURE__ */ jsxs(
2913
- "button",
2914
- {
2915
- type: "button",
2916
- onClick: onCancelRequest,
2917
- className: "flex items-center gap-1.5 text-xs font-ui text-muted-foreground hover:text-destructive transition-colors underline underline-offset-2",
2918
- children: [
2919
- /* @__PURE__ */ jsx(AlertCircleIcon, { className: "w-3 h-3" }),
2920
- "Request cancellation"
2921
- ]
2922
- }
2923
- )
2924
- ] })
2925
- ]
2926
- }
2927
- );
3276
+ ]
3277
+ }
3278
+ ),
3279
+ hasSubmitAddTraveller && /* @__PURE__ */ jsx(
3280
+ AddTravellerDialog,
3281
+ {
3282
+ open: addModalState.open,
3283
+ adventureId: addModalState.adventureId,
3284
+ onClose: closeAddModal,
3285
+ onSubmit: handleAddSubmit,
3286
+ config: travellerFormConfig,
3287
+ saving: addTravellerSaving,
3288
+ errorMessage: addModalState.open ? travellerFormError : null
3289
+ }
3290
+ ),
3291
+ hasSubmitEditTraveller && /* @__PURE__ */ jsx(
3292
+ EditTravellerDialog,
3293
+ {
3294
+ open: editModalState.open,
3295
+ adventureId: editModalState.adventureId,
3296
+ traveller: editModalState.traveller,
3297
+ onClose: closeEditModal,
3298
+ onSubmit: handleEditSubmit,
3299
+ config: travellerFormConfig,
3300
+ saving: editTravellerSaving,
3301
+ errorMessage: editModalState.open ? travellerFormError : null
3302
+ }
3303
+ ),
3304
+ hasConfirmRemoveTraveller && /* @__PURE__ */ jsx(
3305
+ DeleteTravellerDialog,
3306
+ {
3307
+ open: deleteModalState.open,
3308
+ adventureId: deleteModalState.adventureId,
3309
+ traveller: deleteModalState.traveller,
3310
+ onClose: closeDeleteModal,
3311
+ onConfirm: handleDeleteConfirm,
3312
+ config: travellerFormConfig,
3313
+ saving: removeTravellerSaving,
3314
+ errorMessage: deleteModalState.open ? travellerFormError : null
3315
+ }
3316
+ )
3317
+ ] });
2928
3318
  }
2929
3319
 
2930
3320
  // src/lib/emailAssets.ts