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