@cimplify/sdk 0.45.0 → 0.45.2

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.
Files changed (38) hide show
  1. package/dist/advanced.d.mts +1 -1
  2. package/dist/advanced.d.ts +1 -1
  3. package/dist/{chunk-W72W6M6M.mjs → chunk-EMEUSFSR.mjs} +32 -12
  4. package/dist/{chunk-GCSZYC5C.js → chunk-F4CGIOIJ.js} +32 -12
  5. package/dist/{chunk-T4E4R4YG.js → chunk-JNXCY43J.js} +2 -2
  6. package/dist/{chunk-D3TVW7JP.mjs → chunk-YVIIBCJR.mjs} +1 -1
  7. package/dist/{client-5B9IPDmf.d.ts → client-Bsd4Vi_y.d.ts} +1 -0
  8. package/dist/{client-CpVMRI8V.d.mts → client-C5LcbNxL.d.mts} +1 -0
  9. package/dist/{client-DMhRxuzm.d.ts → client-DjzIoewX.d.ts} +1 -1
  10. package/dist/{client-Cwb1sMr3.d.mts → client-EM8xKCPO.d.mts} +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/mock/cli.mjs +32 -12
  14. package/dist/mock/library.js +32 -12
  15. package/dist/mock/library.mjs +32 -12
  16. package/dist/mock/msw.js +32 -12
  17. package/dist/mock/msw.mjs +32 -12
  18. package/dist/react.d.mts +120 -45
  19. package/dist/react.d.ts +120 -45
  20. package/dist/react.js +453 -97
  21. package/dist/react.mjs +452 -98
  22. package/dist/server.d.mts +2 -2
  23. package/dist/server.d.ts +2 -2
  24. package/dist/styles.css +2 -2
  25. package/dist/testing/msw.js +2 -2
  26. package/dist/testing/msw.mjs +1 -1
  27. package/dist/testing/suite.d.mts +2 -2
  28. package/dist/testing/suite.d.ts +2 -2
  29. package/dist/testing/suite.js +21 -21
  30. package/dist/testing/suite.mjs +2 -2
  31. package/dist/testing.d.mts +2 -2
  32. package/dist/testing.d.ts +2 -2
  33. package/dist/testing.js +77 -77
  34. package/dist/testing.mjs +3 -3
  35. package/package.json +1 -1
  36. package/registry/booking-page.json +19 -0
  37. package/registry/bookings-page.json +17 -0
  38. package/registry/index.json +24 -0
package/dist/react.mjs CHANGED
@@ -9475,6 +9475,457 @@ function BookingList({
9475
9475
  booking.order_id
9476
9476
  )) });
9477
9477
  }
9478
+ var ANY_VALUE2 = "__any__";
9479
+ function roomToResource(room) {
9480
+ return {
9481
+ id: room.id,
9482
+ name: room.name,
9483
+ capacity: room.capacity,
9484
+ floor: room.floor,
9485
+ is_available: room.status === "available"
9486
+ };
9487
+ }
9488
+ function ResourcePicker({
9489
+ resources,
9490
+ selectedResourceId,
9491
+ onResourceSelect,
9492
+ showAnyOption = true,
9493
+ anyLabel = "Any available",
9494
+ renderImage,
9495
+ className,
9496
+ classNames
9497
+ }) {
9498
+ const groupValue = selectedResourceId === null ? ANY_VALUE2 : selectedResourceId ?? "";
9499
+ return /* @__PURE__ */ jsxs(
9500
+ RadioGroup,
9501
+ {
9502
+ "data-cimplify-resource-picker": true,
9503
+ className: cn("flex flex-col gap-2", className, classNames?.root),
9504
+ value: groupValue,
9505
+ onValueChange: (value) => {
9506
+ onResourceSelect?.(value === ANY_VALUE2 ? null : value);
9507
+ },
9508
+ children: [
9509
+ showAnyOption && /* @__PURE__ */ jsx(
9510
+ Radio.Root,
9511
+ {
9512
+ value: ANY_VALUE2,
9513
+ "data-cimplify-resource-option": true,
9514
+ "data-selected": selectedResourceId === null || void 0,
9515
+ "data-any": true,
9516
+ className: cn(
9517
+ "flex items-center gap-3 rounded-lg border border-border p-3 transition-colors cursor-pointer",
9518
+ "hover:bg-muted data-[checked]:border-primary data-[checked]:bg-primary/5",
9519
+ classNames?.option
9520
+ ),
9521
+ children: /* @__PURE__ */ jsx("span", { "data-cimplify-resource-name": true, className: cn("font-medium text-foreground", classNames?.name), children: anyLabel })
9522
+ }
9523
+ ),
9524
+ resources.map((resource) => {
9525
+ const unavailable = resource.is_available === false;
9526
+ return /* @__PURE__ */ jsxs(
9527
+ Radio.Root,
9528
+ {
9529
+ value: resource.id,
9530
+ disabled: unavailable,
9531
+ "data-cimplify-resource-option": true,
9532
+ "data-selected": selectedResourceId === resource.id || void 0,
9533
+ "data-unavailable": unavailable || void 0,
9534
+ className: cn(
9535
+ "flex items-center gap-3 rounded-lg border border-border p-3 transition-colors cursor-pointer",
9536
+ "hover:bg-muted data-[checked]:border-primary data-[checked]:bg-primary/5",
9537
+ unavailable && "opacity-50 cursor-not-allowed",
9538
+ classNames?.option,
9539
+ unavailable ? classNames?.unavailable : void 0
9540
+ ),
9541
+ children: [
9542
+ resource.image_url && (renderImage ? renderImage({
9543
+ src: resource.image_url,
9544
+ alt: resource.name,
9545
+ className: classNames?.image
9546
+ }) : /* @__PURE__ */ jsx(
9547
+ "img",
9548
+ {
9549
+ src: resource.image_url,
9550
+ alt: resource.name,
9551
+ "data-cimplify-resource-image": true,
9552
+ className: cn("w-10 h-10 rounded-lg object-cover", classNames?.image)
9553
+ }
9554
+ )),
9555
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [
9556
+ /* @__PURE__ */ jsx("span", { "data-cimplify-resource-name": true, className: cn("font-medium text-foreground", classNames?.name), children: resource.name }),
9557
+ resource.description && /* @__PURE__ */ jsx("span", { "data-cimplify-resource-description": true, className: cn("text-sm text-muted-foreground truncate", classNames?.description), children: resource.description }),
9558
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-resource-meta": true, className: cn("flex items-center gap-2 text-xs text-muted-foreground", classNames?.meta), children: [
9559
+ resource.capacity !== void 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-resource-capacity": true, className: classNames?.capacity, children: [
9560
+ "Up to ",
9561
+ resource.capacity
9562
+ ] }),
9563
+ resource.floor && /* @__PURE__ */ jsx("span", { "data-cimplify-resource-floor": true, className: classNames?.floor, children: resource.floor })
9564
+ ] })
9565
+ ] })
9566
+ ]
9567
+ },
9568
+ resource.id
9569
+ );
9570
+ })
9571
+ ]
9572
+ }
9573
+ );
9574
+ }
9575
+ var STEP = {
9576
+ SELECT_SLOT: "select-slot",
9577
+ SELECT_RESOURCE: "select-resource",
9578
+ SELECT_STAFF: "select-staff",
9579
+ CONFIRM: "confirm"
9580
+ };
9581
+ function BookingPage({
9582
+ service,
9583
+ product,
9584
+ staff,
9585
+ resources,
9586
+ participantCount,
9587
+ title,
9588
+ onBooked,
9589
+ onBack,
9590
+ existingBooking,
9591
+ onRescheduled,
9592
+ showPrice = true,
9593
+ className,
9594
+ classNames
9595
+ }) {
9596
+ const { addItem } = useCart();
9597
+ const { client } = useCimplifyClient();
9598
+ const isReschedule = existingBooking !== void 0;
9599
+ const [step, setStep] = useState(STEP.SELECT_SLOT);
9600
+ const [selectedSlot, setSelectedSlot] = useState(null);
9601
+ const [selectedDate, setSelectedDate] = useState(null);
9602
+ const [selectedStaffId, setSelectedStaffId] = useState(null);
9603
+ const [selectedResourceId, setSelectedResourceId] = useState(null);
9604
+ const [isSubmitting, setIsSubmitting] = useState(false);
9605
+ const [error, setError] = useState(null);
9606
+ const hasResourceStep = resources && resources.length > 0;
9607
+ const hasStaffStep = staff && staff.length > 0;
9608
+ const depositType = product?.deposit_type;
9609
+ const depositAmount = product?.deposit_amount;
9610
+ const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && parsePrice(depositAmount) !== 0;
9611
+ const cancellationMinutes = product?.cancellation_window_minutes;
9612
+ const noShowFee = product?.no_show_fee;
9613
+ const handleSlotSelect = useCallback(
9614
+ (slot, date) => {
9615
+ setSelectedSlot(slot);
9616
+ setSelectedDate(date);
9617
+ setError(null);
9618
+ if (hasResourceStep) {
9619
+ setStep(STEP.SELECT_RESOURCE);
9620
+ } else if (hasStaffStep) {
9621
+ setStep(STEP.SELECT_STAFF);
9622
+ } else {
9623
+ setStep(STEP.CONFIRM);
9624
+ }
9625
+ },
9626
+ [hasResourceStep, hasStaffStep]
9627
+ );
9628
+ const handleResourceSelect = useCallback(
9629
+ (resourceId) => {
9630
+ setSelectedResourceId(resourceId);
9631
+ if (hasStaffStep) {
9632
+ setStep(STEP.SELECT_STAFF);
9633
+ } else {
9634
+ setStep(STEP.CONFIRM);
9635
+ }
9636
+ },
9637
+ [hasStaffStep]
9638
+ );
9639
+ const handleStaffSelect = useCallback((staffId) => {
9640
+ setSelectedStaffId(staffId);
9641
+ setStep(STEP.CONFIRM);
9642
+ }, []);
9643
+ const handleBack = useCallback(() => {
9644
+ setError(null);
9645
+ if (step === STEP.CONFIRM && hasStaffStep) {
9646
+ setStep(STEP.SELECT_STAFF);
9647
+ } else if (step === STEP.CONFIRM && hasResourceStep) {
9648
+ setStep(STEP.SELECT_RESOURCE);
9649
+ } else if (step === STEP.SELECT_STAFF && hasResourceStep) {
9650
+ setStep(STEP.SELECT_RESOURCE);
9651
+ } else if (step === STEP.CONFIRM || step === STEP.SELECT_STAFF || step === STEP.SELECT_RESOURCE) {
9652
+ setStep(STEP.SELECT_SLOT);
9653
+ } else {
9654
+ onBack?.();
9655
+ }
9656
+ }, [step, hasStaffStep, hasResourceStep, onBack]);
9657
+ const handleConfirm = useCallback(async () => {
9658
+ if (!selectedSlot || !selectedDate) return;
9659
+ setIsSubmitting(true);
9660
+ setError(null);
9661
+ try {
9662
+ if (isReschedule && existingBooking) {
9663
+ const serviceItem = existingBooking.service_items[0];
9664
+ const result = await client.scheduling.rescheduleBooking({
9665
+ order_id: existingBooking.order_id,
9666
+ line_item_id: serviceItem?.service_id ?? existingBooking.order_id,
9667
+ new_start_time: selectedSlot.start_time,
9668
+ new_end_time: selectedSlot.end_time,
9669
+ new_staff_id: selectedStaffId || void 0,
9670
+ reschedule_type: "customer"
9671
+ });
9672
+ if (!result.ok) {
9673
+ throw result.error;
9674
+ }
9675
+ onRescheduled?.(existingBooking, selectedSlot);
9676
+ } else {
9677
+ const serviceProduct = {
9678
+ id: service.product_id || service.id,
9679
+ business_id: service.business_id || "",
9680
+ category_id: service.category_id || void 0,
9681
+ name: service.name,
9682
+ slug: service.id,
9683
+ description: service.description || void 0,
9684
+ image_url: service.image_url || void 0,
9685
+ default_price: service.price || "0",
9686
+ type: "service",
9687
+ inventory_type: "none",
9688
+ variant_strategy: "fetch_all",
9689
+ is_active: service.is_available,
9690
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
9691
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
9692
+ };
9693
+ await addItem(serviceProduct, 1, {
9694
+ scheduledStart: selectedSlot.start_time,
9695
+ scheduledEnd: selectedSlot.end_time,
9696
+ staffId: selectedStaffId || void 0,
9697
+ resourceId: selectedResourceId || void 0
9698
+ });
9699
+ onBooked?.(selectedSlot, selectedStaffId);
9700
+ }
9701
+ } catch (err) {
9702
+ const fallbackMessage = isReschedule ? "Failed to reschedule booking" : "Failed to add booking to cart";
9703
+ setError(err instanceof Error ? err.message : fallbackMessage);
9704
+ } finally {
9705
+ setIsSubmitting(false);
9706
+ }
9707
+ }, [selectedSlot, selectedDate, selectedStaffId, service, addItem, onBooked, isReschedule, existingBooking, client, onRescheduled]);
9708
+ return /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-page": true, className: cn(className, classNames?.root), children: [
9709
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-page-header": true, className: classNames?.header, children: [
9710
+ onBack && step === STEP.SELECT_SLOT && /* @__PURE__ */ jsx(
9711
+ "button",
9712
+ {
9713
+ type: "button",
9714
+ onClick: onBack,
9715
+ "data-cimplify-booking-page-back": true,
9716
+ className: classNames?.backButton,
9717
+ children: "Back"
9718
+ }
9719
+ ),
9720
+ step !== STEP.SELECT_SLOT && /* @__PURE__ */ jsx(
9721
+ "button",
9722
+ {
9723
+ type: "button",
9724
+ onClick: handleBack,
9725
+ "data-cimplify-booking-page-back": true,
9726
+ className: classNames?.backButton,
9727
+ children: "Back"
9728
+ }
9729
+ ),
9730
+ /* @__PURE__ */ jsx("h1", { "data-cimplify-booking-page-title": true, className: classNames?.title, children: title || (isReschedule ? "Reschedule Booking" : `Book ${service.name}`) })
9731
+ ] }),
9732
+ isReschedule && existingBooking && /* @__PURE__ */ jsx("div", { "data-cimplify-booking-reschedule-info": true, className: classNames?.rescheduleInfo, children: /* @__PURE__ */ jsxs("span", { children: [
9733
+ "Rescheduling booking from ",
9734
+ new Date(existingBooking.service_items[0]?.scheduled_start ?? existingBooking.created_at).toLocaleDateString()
9735
+ ] }) }),
9736
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-service-info": true, className: classNames?.serviceInfo, children: [
9737
+ /* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-name": true, children: service.name }),
9738
+ /* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-duration": true, children: formatDuration2(service.duration_minutes, service.duration_unit) }),
9739
+ service.price && /* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsx(Price, { amount: service.price }) }),
9740
+ hasDeposit && /* @__PURE__ */ jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
9741
+ "Deposit: ",
9742
+ depositType === "percentage" ? `${parsePrice(depositAmount)}%` : /* @__PURE__ */ jsx(Price, { amount: depositAmount })
9743
+ ] }),
9744
+ cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
9745
+ "Free cancellation up to ",
9746
+ cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
9747
+ " before"
9748
+ ] }),
9749
+ noShowFee !== void 0 && parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
9750
+ "No-show fee: ",
9751
+ /* @__PURE__ */ jsx(Price, { amount: noShowFee })
9752
+ ] })
9753
+ ] }),
9754
+ error && /* @__PURE__ */ jsx("div", { "data-cimplify-booking-error": true, className: classNames?.error, children: error }),
9755
+ step === STEP.SELECT_SLOT && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-step": "select-slot", className: classNames?.step, children: [
9756
+ /* @__PURE__ */ jsx("h2", { "data-cimplify-booking-step-title": true, className: classNames?.stepTitle, children: "Select a date & time" }),
9757
+ /* @__PURE__ */ jsx(
9758
+ DateSlotPicker,
9759
+ {
9760
+ serviceId: service.id,
9761
+ participantCount,
9762
+ selectedSlot,
9763
+ onSlotSelect: handleSlotSelect,
9764
+ showPrice
9765
+ }
9766
+ )
9767
+ ] }),
9768
+ step === STEP.SELECT_RESOURCE && resources && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-step": "select-resource", className: cn(classNames?.step, classNames?.resourceStep), children: [
9769
+ /* @__PURE__ */ jsx("h2", { "data-cimplify-booking-step-title": true, className: classNames?.stepTitle, children: "Choose a room" }),
9770
+ /* @__PURE__ */ jsx(
9771
+ ResourcePicker,
9772
+ {
9773
+ resources,
9774
+ selectedResourceId,
9775
+ onResourceSelect: handleResourceSelect
9776
+ }
9777
+ )
9778
+ ] }),
9779
+ step === STEP.SELECT_STAFF && staff && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-step": "select-staff", className: classNames?.step, children: [
9780
+ /* @__PURE__ */ jsx("h2", { "data-cimplify-booking-step-title": true, className: classNames?.stepTitle, children: "Choose a provider" }),
9781
+ /* @__PURE__ */ jsx(
9782
+ StaffPicker,
9783
+ {
9784
+ staff,
9785
+ selectedStaffId,
9786
+ onStaffSelect: handleStaffSelect
9787
+ }
9788
+ )
9789
+ ] }),
9790
+ step === STEP.CONFIRM && selectedSlot && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-step": "confirm", className: classNames?.step, children: [
9791
+ /* @__PURE__ */ jsx("h2", { "data-cimplify-booking-step-title": true, className: classNames?.stepTitle, children: "Confirm your booking" }),
9792
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary": true, className: classNames?.summary, children: [
9793
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9794
+ /* @__PURE__ */ jsx("span", { children: "Service" }),
9795
+ /* @__PURE__ */ jsx("span", { children: service.name })
9796
+ ] }),
9797
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9798
+ /* @__PURE__ */ jsx("span", { children: "Date" }),
9799
+ /* @__PURE__ */ jsx("span", { children: selectedDate })
9800
+ ] }),
9801
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9802
+ /* @__PURE__ */ jsx("span", { children: "Time" }),
9803
+ /* @__PURE__ */ jsx("span", { children: new Date(selectedSlot.start_time).toLocaleTimeString(void 0, {
9804
+ hour: "numeric",
9805
+ minute: "2-digit"
9806
+ }) })
9807
+ ] }),
9808
+ /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9809
+ /* @__PURE__ */ jsx("span", { children: "Duration" }),
9810
+ /* @__PURE__ */ jsx("span", { children: formatDuration2(service.duration_minutes, service.duration_unit) })
9811
+ ] }),
9812
+ selectedResourceId && resources && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9813
+ /* @__PURE__ */ jsx("span", { children: "Room" }),
9814
+ /* @__PURE__ */ jsx("span", { children: resources.find((r) => r.id === selectedResourceId)?.name ?? "Selected" })
9815
+ ] }),
9816
+ selectedStaffId && staff && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9817
+ /* @__PURE__ */ jsx("span", { children: "Provider" }),
9818
+ /* @__PURE__ */ jsx("span", { children: staff.find((s) => s.id === selectedStaffId)?.name ?? "Selected" })
9819
+ ] }),
9820
+ (selectedSlot.price || service.price) && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
9821
+ /* @__PURE__ */ jsx("span", { children: "Price" }),
9822
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Price, { amount: selectedSlot.price || service.price }) })
9823
+ ] }),
9824
+ hasDeposit && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
9825
+ /* @__PURE__ */ jsx("span", { children: "Deposit" }),
9826
+ /* @__PURE__ */ jsx("span", { children: depositType === "percentage" ? `${parsePrice(depositAmount)}%` : /* @__PURE__ */ jsx(Price, { amount: depositAmount }) })
9827
+ ] })
9828
+ ] }),
9829
+ /* @__PURE__ */ jsx(
9830
+ "button",
9831
+ {
9832
+ type: "button",
9833
+ onClick: handleConfirm,
9834
+ disabled: isSubmitting,
9835
+ "data-cimplify-booking-confirm": true,
9836
+ className: classNames?.confirmButton,
9837
+ children: isSubmitting ? isReschedule ? "Rescheduling\u2026" : "Adding to cart\u2026" : isReschedule ? "Reschedule" : "Confirm Booking"
9838
+ }
9839
+ )
9840
+ ] })
9841
+ ] });
9842
+ }
9843
+ var BOOKING_FILTERS = [
9844
+ { label: "All", value: "all" },
9845
+ { label: "Upcoming", value: "upcoming" },
9846
+ { label: "Past", value: "past" }
9847
+ ];
9848
+ function BookingsPage({
9849
+ title = "My Bookings",
9850
+ bookings: bookingsProp,
9851
+ onBookingNavigate,
9852
+ onCancel,
9853
+ onReschedule,
9854
+ showFilters = true,
9855
+ renderBooking,
9856
+ className,
9857
+ classNames
9858
+ }) {
9859
+ const [filter, setFilter] = useState("all");
9860
+ const [selectedBooking, setSelectedBooking] = useState(null);
9861
+ const handleBookingClick = useCallback(
9862
+ (booking) => {
9863
+ if (onBookingNavigate) {
9864
+ onBookingNavigate(booking);
9865
+ } else {
9866
+ setSelectedBooking(booking);
9867
+ }
9868
+ },
9869
+ [onBookingNavigate]
9870
+ );
9871
+ const handleBack = useCallback(() => {
9872
+ setSelectedBooking(null);
9873
+ }, []);
9874
+ if (selectedBooking && !onBookingNavigate) {
9875
+ return /* @__PURE__ */ jsx("div", { "data-cimplify-bookings-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxs("div", { "data-cimplify-bookings-detail": true, className: classNames?.detail, children: [
9876
+ /* @__PURE__ */ jsx(
9877
+ "button",
9878
+ {
9879
+ type: "button",
9880
+ onClick: handleBack,
9881
+ "data-cimplify-bookings-back": true,
9882
+ className: classNames?.backButton,
9883
+ children: "Back to bookings"
9884
+ }
9885
+ ),
9886
+ /* @__PURE__ */ jsx(
9887
+ BookingCard,
9888
+ {
9889
+ booking: selectedBooking,
9890
+ onCancel,
9891
+ onReschedule
9892
+ }
9893
+ )
9894
+ ] }) });
9895
+ }
9896
+ return /* @__PURE__ */ jsxs("div", { "data-cimplify-bookings-page": true, className: cn(className, classNames?.root), children: [
9897
+ /* @__PURE__ */ jsx("div", { "data-cimplify-bookings-header": true, className: classNames?.header, children: /* @__PURE__ */ jsx("h1", { "data-cimplify-bookings-title": true, className: classNames?.title, children: title }) }),
9898
+ showFilters && /* @__PURE__ */ jsx(
9899
+ Tabs.Root,
9900
+ {
9901
+ value: filter,
9902
+ onValueChange: (value) => setFilter(value),
9903
+ children: /* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-bookings-filters": true, className: classNames?.filters, children: BOOKING_FILTERS.map((f) => /* @__PURE__ */ jsx(
9904
+ Tabs.Tab,
9905
+ {
9906
+ value: f.value,
9907
+ "data-cimplify-booking-filter": true,
9908
+ "data-selected": filter === f.value || void 0,
9909
+ className: classNames?.filterButton,
9910
+ children: f.label
9911
+ },
9912
+ f.value
9913
+ )) })
9914
+ }
9915
+ ),
9916
+ /* @__PURE__ */ jsx("div", { "data-cimplify-bookings-list": true, className: classNames?.list, children: /* @__PURE__ */ jsx(
9917
+ BookingList,
9918
+ {
9919
+ bookings: bookingsProp,
9920
+ filter,
9921
+ onCancel,
9922
+ onReschedule,
9923
+ onBookingClick: handleBookingClick,
9924
+ renderBooking
9925
+ }
9926
+ ) })
9927
+ ] });
9928
+ }
9478
9929
  function DefaultCatalogueLayout({
9479
9930
  products,
9480
9931
  categories,
@@ -12424,103 +12875,6 @@ function CurrencySelector({
12424
12875
  );
12425
12876
  }) });
12426
12877
  }
12427
- var ANY_VALUE2 = "__any__";
12428
- function roomToResource(room) {
12429
- return {
12430
- id: room.id,
12431
- name: room.name,
12432
- capacity: room.capacity,
12433
- floor: room.floor,
12434
- is_available: room.status === "available"
12435
- };
12436
- }
12437
- function ResourcePicker({
12438
- resources,
12439
- selectedResourceId,
12440
- onResourceSelect,
12441
- showAnyOption = true,
12442
- anyLabel = "Any available",
12443
- renderImage,
12444
- className,
12445
- classNames
12446
- }) {
12447
- const groupValue = selectedResourceId === null ? ANY_VALUE2 : selectedResourceId ?? "";
12448
- return /* @__PURE__ */ jsxs(
12449
- RadioGroup,
12450
- {
12451
- "data-cimplify-resource-picker": true,
12452
- className: cn("flex flex-col gap-2", className, classNames?.root),
12453
- value: groupValue,
12454
- onValueChange: (value) => {
12455
- onResourceSelect?.(value === ANY_VALUE2 ? null : value);
12456
- },
12457
- children: [
12458
- showAnyOption && /* @__PURE__ */ jsx(
12459
- Radio.Root,
12460
- {
12461
- value: ANY_VALUE2,
12462
- "data-cimplify-resource-option": true,
12463
- "data-selected": selectedResourceId === null || void 0,
12464
- "data-any": true,
12465
- className: cn(
12466
- "flex items-center gap-3 rounded-lg border border-border p-3 transition-colors cursor-pointer",
12467
- "hover:bg-muted data-[checked]:border-primary data-[checked]:bg-primary/5",
12468
- classNames?.option
12469
- ),
12470
- children: /* @__PURE__ */ jsx("span", { "data-cimplify-resource-name": true, className: cn("font-medium text-foreground", classNames?.name), children: anyLabel })
12471
- }
12472
- ),
12473
- resources.map((resource) => {
12474
- const unavailable = resource.is_available === false;
12475
- return /* @__PURE__ */ jsxs(
12476
- Radio.Root,
12477
- {
12478
- value: resource.id,
12479
- disabled: unavailable,
12480
- "data-cimplify-resource-option": true,
12481
- "data-selected": selectedResourceId === resource.id || void 0,
12482
- "data-unavailable": unavailable || void 0,
12483
- className: cn(
12484
- "flex items-center gap-3 rounded-lg border border-border p-3 transition-colors cursor-pointer",
12485
- "hover:bg-muted data-[checked]:border-primary data-[checked]:bg-primary/5",
12486
- unavailable && "opacity-50 cursor-not-allowed",
12487
- classNames?.option,
12488
- unavailable ? classNames?.unavailable : void 0
12489
- ),
12490
- children: [
12491
- resource.image_url && (renderImage ? renderImage({
12492
- src: resource.image_url,
12493
- alt: resource.name,
12494
- className: classNames?.image
12495
- }) : /* @__PURE__ */ jsx(
12496
- "img",
12497
- {
12498
- src: resource.image_url,
12499
- alt: resource.name,
12500
- "data-cimplify-resource-image": true,
12501
- className: cn("w-10 h-10 rounded-lg object-cover", classNames?.image)
12502
- }
12503
- )),
12504
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [
12505
- /* @__PURE__ */ jsx("span", { "data-cimplify-resource-name": true, className: cn("font-medium text-foreground", classNames?.name), children: resource.name }),
12506
- resource.description && /* @__PURE__ */ jsx("span", { "data-cimplify-resource-description": true, className: cn("text-sm text-muted-foreground truncate", classNames?.description), children: resource.description }),
12507
- /* @__PURE__ */ jsxs("div", { "data-cimplify-resource-meta": true, className: cn("flex items-center gap-2 text-xs text-muted-foreground", classNames?.meta), children: [
12508
- resource.capacity !== void 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-resource-capacity": true, className: classNames?.capacity, children: [
12509
- "Up to ",
12510
- resource.capacity
12511
- ] }),
12512
- resource.floor && /* @__PURE__ */ jsx("span", { "data-cimplify-resource-floor": true, className: classNames?.floor, children: resource.floor })
12513
- ] })
12514
- ] })
12515
- ]
12516
- },
12517
- resource.id
12518
- );
12519
- })
12520
- ]
12521
- }
12522
- );
12523
- }
12524
12878
  function ChatWidget({
12525
12879
  client: clientProp,
12526
12880
  businessName = "Support",
@@ -13008,4 +13362,4 @@ function SparkleIcon({ className }) {
13008
13362
  );
13009
13363
  }
13010
13364
 
13011
- export { AccommodationCard, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BundleProductCard, BundleProductLayout, BundleSelector, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckoutPage, CimplifyAccount, CimplifyCheckout, CimplifyProvider, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, CurrencySelector, CustomAttributesTable, CustomerInputFields, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, FeaturedCollectionLayout, FoodProductCard, FoodProductLayout, InventoryBadge, LeaseServiceCard, LocationPicker, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, ServiceProductLayout, SessionMessageBanner, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, StoreNav, SubscriptionCard, TagPills, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
13365
+ export { AccommodationCard, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleProductCard, BundleProductLayout, BundleSelector, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckoutPage, CimplifyAccount, CimplifyCheckout, CimplifyProvider, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, CurrencySelector, CustomAttributesTable, CustomerInputFields, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, FeaturedCollectionLayout, FoodProductCard, FoodProductLayout, InventoryBadge, LeaseServiceCard, LocationPicker, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, ServiceProductLayout, SessionMessageBanner, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, StoreNav, SubscriptionCard, TagPills, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
package/dist/server.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CimplifyClient } from './client-CpVMRI8V.mjs';
2
- export { aN as Result } from './client-CpVMRI8V.mjs';
1
+ import { C as CimplifyClient } from './client-C5LcbNxL.mjs';
2
+ export { aN as Result } from './client-C5LcbNxL.mjs';
3
3
  export { an as Category, h as CimplifyError, ap as Collection, U as Product, a8 as ProductWithDetails } from './payment-4JSLNTVM.mjs';
4
4
 
5
5
  interface ServerClientOptions {
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CimplifyClient } from './client-5B9IPDmf.js';
2
- export { aN as Result } from './client-5B9IPDmf.js';
1
+ import { C as CimplifyClient } from './client-Bsd4Vi_y.js';
2
+ export { aN as Result } from './client-Bsd4Vi_y.js';
3
3
  export { an as Category, h as CimplifyError, ap as Collection, U as Product, a8 as ProductWithDetails } from './payment-4JSLNTVM.js';
4
4
 
5
5
  interface ServerClientOptions {