@myrjfa/ui 2.1.8 → 2.2.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/chat/ChatMain.d.ts +1 -1
- package/dist/chat/ChatMain.d.ts.map +1 -1
- package/dist/chat/ChatMain.js +3 -3
- package/dist/chat/ChatSidebar.d.ts +1 -1
- package/dist/chat/ChatSidebar.d.ts.map +1 -1
- package/dist/chat/ConversationList.d.ts +1 -1
- package/dist/chat/ConversationList.d.ts.map +1 -1
- package/dist/chat/ConversationList.js +1 -1
- package/dist/chat/ExpensePanel.js +1 -1
- package/dist/chat/MessageBubble.d.ts +1 -1
- package/dist/chat/MessageBubble.d.ts.map +1 -1
- package/dist/chat/MessageInput.js +1 -1
- package/dist/chat/MilestonePanel.js +1 -1
- package/dist/chat/components/SplitInputs.d.ts +1 -1
- package/dist/chat/components/SplitInputs.d.ts.map +1 -1
- package/dist/chat/components/SplitTypeSelector.d.ts +1 -1
- package/dist/chat/components/SplitTypeSelector.d.ts.map +1 -1
- package/dist/chat/dialogs/AddMemberDialog.d.ts +1 -1
- package/dist/chat/dialogs/AddMemberDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/AddMemberDialog.js +1 -1
- package/dist/chat/dialogs/ExpenseAnalyticsDialog.js +1 -1
- package/dist/chat/dialogs/GroupInfoDialog.d.ts +1 -1
- package/dist/chat/dialogs/GroupInfoDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/GroupInfoDialog.js +1 -1
- package/dist/chat/dialogs/GroupInfoViewDialog.d.ts +1 -1
- package/dist/chat/dialogs/GroupInfoViewDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/NewChatDialog.js +2 -2
- package/dist/chat/dialogs/NewGroupDialog.js +2 -2
- package/dist/chat/dialogs/ParticipantsDialog.d.ts +1 -1
- package/dist/chat/dialogs/ParticipantsDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/ParticipantsDialog.js +1 -1
- package/dist/components/CityAutocomplete.d.ts +5 -0
- package/dist/components/CityAutocomplete.d.ts.map +1 -0
- package/dist/components/CityAutocomplete.js +112 -0
- package/dist/components/CreateListingDropdown.d.ts +5 -0
- package/dist/components/CreateListingDropdown.d.ts.map +1 -0
- package/dist/components/CreateListingDropdown.js +21 -0
- package/dist/components/DestinationAutocomplete.d.ts +11 -0
- package/dist/components/DestinationAutocomplete.d.ts.map +1 -0
- package/dist/components/DestinationAutocomplete.js +24 -0
- package/dist/components/StateAutocomplete.d.ts +10 -0
- package/dist/components/StateAutocomplete.d.ts.map +1 -0
- package/dist/components/StateAutocomplete.js +34 -0
- package/dist/components/admin/AdminBookingRegistrationsList.d.ts +5 -0
- package/dist/components/admin/AdminBookingRegistrationsList.d.ts.map +1 -0
- package/dist/components/admin/AdminBookingRegistrationsList.js +69 -0
- package/dist/components/admin/AdminListingActionsWrapper.d.ts +9 -0
- package/dist/components/admin/AdminListingActionsWrapper.d.ts.map +1 -0
- package/dist/components/admin/AdminListingActionsWrapper.js +200 -0
- package/dist/components/ads/ActivateAdPlacementButton.d.ts +6 -0
- package/dist/components/ads/ActivateAdPlacementButton.d.ts.map +1 -0
- package/dist/components/ads/ActivateAdPlacementButton.js +27 -0
- package/dist/components/ads/AdOfferCard.d.ts +6 -0
- package/dist/components/ads/AdOfferCard.d.ts.map +1 -0
- package/dist/components/ads/AdOfferCard.js +15 -0
- package/dist/components/adventure/AdventureAvailabilityPlanner.d.ts +17 -0
- package/dist/components/adventure/AdventureAvailabilityPlanner.d.ts.map +1 -0
- package/dist/components/adventure/AdventureAvailabilityPlanner.js +106 -0
- package/dist/components/adventure/AdventureQueryCard.d.ts +5 -0
- package/dist/components/adventure/AdventureQueryCard.d.ts.map +1 -0
- package/dist/components/adventure/AdventureQueryCard.js +65 -0
- package/dist/components/adventure/AdventureSlotBuilder.d.ts +41 -0
- package/dist/components/adventure/AdventureSlotBuilder.d.ts.map +1 -0
- package/dist/components/adventure/AdventureSlotBuilder.js +146 -0
- package/dist/components/booking/booking-form.d.ts +39 -0
- package/dist/components/booking/booking-form.d.ts.map +1 -0
- package/dist/components/booking/booking-form.js +824 -0
- package/dist/components/brand/BrandPageView.d.ts +8 -0
- package/dist/components/brand/BrandPageView.d.ts.map +1 -0
- package/dist/components/brand/BrandPageView.js +97 -0
- package/dist/components/companion/AnonymousChat.d.ts +22 -0
- package/dist/components/companion/AnonymousChat.d.ts.map +1 -0
- package/dist/components/companion/AnonymousChat.js +24 -0
- package/dist/components/companion/SwipeCard.d.ts +25 -0
- package/dist/components/companion/SwipeCard.d.ts.map +1 -0
- package/dist/components/companion/SwipeCard.js +58 -0
- package/dist/components/create-flow/ConfirmDiscardDialog.d.ts +11 -0
- package/dist/components/create-flow/ConfirmDiscardDialog.d.ts.map +1 -0
- package/dist/components/create-flow/ConfirmDiscardDialog.js +14 -0
- package/dist/components/create-flow/EntityEditLoadingState.d.ts +2 -0
- package/dist/components/create-flow/EntityEditLoadingState.d.ts.map +1 -0
- package/dist/components/create-flow/EntityEditLoadingState.js +6 -0
- package/dist/components/create-flow/EntityFormCompletionState.d.ts +12 -0
- package/dist/components/create-flow/EntityFormCompletionState.d.ts.map +1 -0
- package/dist/components/create-flow/EntityFormCompletionState.js +10 -0
- package/dist/components/create-flow/EntityFormHeader.d.ts +9 -0
- package/dist/components/create-flow/EntityFormHeader.d.ts.map +1 -0
- package/dist/components/create-flow/EntityFormHeader.js +7 -0
- package/dist/components/create-flow/EntityFormPageFrame.d.ts +10 -0
- package/dist/components/create-flow/EntityFormPageFrame.d.ts.map +1 -0
- package/dist/components/create-flow/EntityFormPageFrame.js +10 -0
- package/dist/components/create-flow/ImageUploadStep.d.ts +15 -0
- package/dist/components/create-flow/ImageUploadStep.d.ts.map +1 -0
- package/dist/components/create-flow/ImageUploadStep.js +11 -0
- package/dist/components/create-flow/ImageUploader.d.ts +30 -0
- package/dist/components/create-flow/ImageUploader.d.ts.map +1 -0
- package/dist/components/create-flow/ImageUploader.js +193 -0
- package/dist/components/create-flow/MultiStepWizard.d.ts +25 -0
- package/dist/components/create-flow/MultiStepWizard.d.ts.map +1 -0
- package/dist/components/create-flow/MultiStepWizard.js +31 -0
- package/dist/components/create-flow/ReviewConfirmationCard.d.ts +8 -0
- package/dist/components/create-flow/ReviewConfirmationCard.d.ts.map +1 -0
- package/dist/components/create-flow/ReviewConfirmationCard.js +5 -0
- package/dist/components/create-flow/ReviewMetricGrid.d.ts +15 -0
- package/dist/components/create-flow/ReviewMetricGrid.d.ts.map +1 -0
- package/dist/components/create-flow/ReviewMetricGrid.js +8 -0
- package/dist/components/create-flow/TemplateSelectionDialog.d.ts +17 -0
- package/dist/components/create-flow/TemplateSelectionDialog.d.ts.map +1 -0
- package/dist/components/create-flow/TemplateSelectionDialog.js +7 -0
- package/dist/components/enquiry/EnquiryFormParts.d.ts +40 -0
- package/dist/components/enquiry/EnquiryFormParts.d.ts.map +1 -0
- package/dist/components/enquiry/EnquiryFormParts.js +29 -0
- package/dist/components/form-sections/FaqSection.d.ts +24 -0
- package/dist/components/form-sections/FaqSection.d.ts.map +1 -0
- package/dist/components/form-sections/FaqSection.js +17 -0
- package/dist/components/form-sections/ImageUploadSection.d.ts +12 -0
- package/dist/components/form-sections/ImageUploadSection.d.ts.map +1 -0
- package/dist/components/form-sections/ImageUploadSection.js +8 -0
- package/dist/components/form-sections/OpportunityBasicsSection.d.ts +8 -0
- package/dist/components/form-sections/OpportunityBasicsSection.d.ts.map +1 -0
- package/dist/components/form-sections/OpportunityBasicsSection.js +26 -0
- package/dist/components/form-sections/OpportunityDetailsSection.d.ts +18 -0
- package/dist/components/form-sections/OpportunityDetailsSection.d.ts.map +1 -0
- package/dist/components/form-sections/OpportunityDetailsSection.js +10 -0
- package/dist/components/form-sections/OpportunityTypeSection.d.ts +7 -0
- package/dist/components/form-sections/OpportunityTypeSection.d.ts.map +1 -0
- package/dist/components/form-sections/OpportunityTypeSection.js +15 -0
- package/dist/components/form-sections/PackageDetailsSection.d.ts +22 -0
- package/dist/components/form-sections/PackageDetailsSection.d.ts.map +1 -0
- package/dist/components/form-sections/PackageDetailsSection.js +20 -0
- package/dist/components/form-sections/PackageItinerarySection.d.ts +21 -0
- package/dist/components/form-sections/PackageItinerarySection.d.ts.map +1 -0
- package/dist/components/form-sections/PackageItinerarySection.js +112 -0
- package/dist/components/form-sections/PackagePricingSection.d.ts +8 -0
- package/dist/components/form-sections/PackagePricingSection.d.ts.map +1 -0
- package/dist/components/form-sections/PackagePricingSection.js +11 -0
- package/dist/components/form-sections/PackageReviewSection.d.ts +12 -0
- package/dist/components/form-sections/PackageReviewSection.d.ts.map +1 -0
- package/dist/components/form-sections/PackageReviewSection.js +26 -0
- package/dist/components/form-sections/RentalBasicsSection.d.ts +12 -0
- package/dist/components/form-sections/RentalBasicsSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalBasicsSection.js +91 -0
- package/dist/components/form-sections/RentalCapacitySection.d.ts +9 -0
- package/dist/components/form-sections/RentalCapacitySection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalCapacitySection.js +23 -0
- package/dist/components/form-sections/RentalLocationSection.d.ts +10 -0
- package/dist/components/form-sections/RentalLocationSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalLocationSection.js +41 -0
- package/dist/components/form-sections/RentalPhotosSection.d.ts +8 -0
- package/dist/components/form-sections/RentalPhotosSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalPhotosSection.js +7 -0
- package/dist/components/form-sections/RentalReviewSection.d.ts +10 -0
- package/dist/components/form-sections/RentalReviewSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalReviewSection.js +27 -0
- package/dist/components/form-sections/RentalRulesSection.d.ts +7 -0
- package/dist/components/form-sections/RentalRulesSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalRulesSection.js +10 -0
- package/dist/components/form-sections/RentalSpecsSection.d.ts +7 -0
- package/dist/components/form-sections/RentalSpecsSection.d.ts.map +1 -0
- package/dist/components/form-sections/RentalSpecsSection.js +10 -0
- package/dist/components/host-dashboard/HostCalendar.d.ts +8 -0
- package/dist/components/host-dashboard/HostCalendar.d.ts.map +1 -0
- package/dist/components/host-dashboard/HostCalendar.js +43 -0
- package/dist/components/host-dashboard/HostCalendarGrid.d.ts +34 -0
- package/dist/components/host-dashboard/HostCalendarGrid.d.ts.map +1 -0
- package/dist/components/host-dashboard/HostCalendarGrid.js +30 -0
- package/dist/components/host-dashboard/HostListingMultiSelect.d.ts +12 -0
- package/dist/components/host-dashboard/HostListingMultiSelect.d.ts.map +1 -0
- package/dist/components/host-dashboard/HostListingMultiSelect.js +24 -0
- package/dist/components/host-dashboard/HostManageCalendarShell.d.ts +17 -0
- package/dist/components/host-dashboard/HostManageCalendarShell.d.ts.map +1 -0
- package/dist/components/host-dashboard/HostManageCalendarShell.js +5 -0
- package/dist/components/host-dashboard/HostSidebarNavigation.d.ts +2 -0
- package/dist/components/host-dashboard/HostSidebarNavigation.d.ts.map +1 -0
- package/dist/components/host-dashboard/HostSidebarNavigation.js +262 -0
- package/dist/components/host-dashboard/ManageFeatureSwitcher.d.ts +15 -0
- package/dist/components/host-dashboard/ManageFeatureSwitcher.d.ts.map +1 -0
- package/dist/components/host-dashboard/ManageFeatureSwitcher.js +43 -0
- package/dist/components/host-dashboard/PageHeader.d.ts +14 -0
- package/dist/components/host-dashboard/PageHeader.d.ts.map +1 -0
- package/dist/components/host-dashboard/PageHeader.js +8 -0
- package/dist/components/host-dashboard/PlaceholderPage.d.ts +4 -0
- package/dist/components/host-dashboard/PlaceholderPage.d.ts.map +1 -0
- package/dist/components/host-dashboard/PlaceholderPage.js +9 -0
- package/dist/components/host-dashboard/StatCard.d.ts +15 -0
- package/dist/components/host-dashboard/StatCard.d.ts.map +1 -0
- package/dist/components/host-dashboard/StatCard.js +38 -0
- package/dist/components/layout/AppProviders.d.ts +5 -0
- package/dist/components/layout/AppProviders.d.ts.map +1 -0
- package/dist/components/layout/AppProviders.js +11 -0
- package/dist/components/layout/PublicRouteLayout.d.ts +5 -0
- package/dist/components/layout/PublicRouteLayout.d.ts.map +1 -0
- package/dist/components/layout/PublicRouteLayout.js +5 -0
- package/dist/components/layout/PublicShell.d.ts +5 -0
- package/dist/components/layout/PublicShell.d.ts.map +1 -0
- package/dist/components/layout/PublicShell.js +5 -0
- package/dist/components/location/LocationPicker.d.ts +27 -0
- package/dist/components/location/LocationPicker.d.ts.map +1 -0
- package/dist/components/location/LocationPicker.js +415 -0
- package/dist/components/location/LocationPreview.d.ts +11 -0
- package/dist/components/location/LocationPreview.d.ts.map +1 -0
- package/dist/components/location/LocationPreview.js +12 -0
- package/dist/components/location/MapPicker.d.ts +9 -0
- package/dist/components/location/MapPicker.d.ts.map +1 -0
- package/dist/components/location/MapPicker.js +40 -0
- package/dist/components/location/MapPreview.d.ts +8 -0
- package/dist/components/location/MapPreview.d.ts.map +1 -0
- package/dist/components/location/MapPreview.js +17 -0
- package/dist/components/location/PlaceLinkInline.d.ts +14 -0
- package/dist/components/location/PlaceLinkInline.d.ts.map +1 -0
- package/dist/components/location/PlaceLinkInline.js +30 -0
- package/dist/components/location/leafletMap.d.ts +8 -0
- package/dist/components/location/leafletMap.d.ts.map +1 -0
- package/dist/components/location/leafletMap.js +74 -0
- package/dist/components/ui/GuestOrLoginDialog.d.ts +11 -0
- package/dist/components/ui/GuestOrLoginDialog.d.ts.map +1 -0
- package/dist/components/ui/GuestOrLoginDialog.js +19 -0
- package/dist/components/ui/ImageGalleryViewer.d.ts +10 -0
- package/dist/components/ui/ImageGalleryViewer.d.ts.map +1 -0
- package/dist/components/ui/ImageGalleryViewer.js +59 -0
- package/dist/components/ui/LocationInput.d.ts +12 -0
- package/dist/components/ui/LocationInput.d.ts.map +1 -0
- package/dist/components/ui/LocationInput.js +39 -0
- package/dist/components/ui/PropertyGalleryClient.d.ts +8 -0
- package/dist/components/ui/PropertyGalleryClient.d.ts.map +1 -0
- package/dist/components/ui/PropertyGalleryClient.js +22 -0
- package/dist/components/ui/calendar.d.ts +9 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +75 -0
- package/dist/components/ui/dashboard/admin-adventures-table.d.ts +12 -0
- package/dist/components/ui/dashboard/admin-adventures-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/admin-adventures-table.js +94 -0
- package/dist/components/ui/dashboard/admin-blogs-table.d.ts +11 -0
- package/dist/components/ui/dashboard/admin-blogs-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/admin-blogs-table.js +58 -0
- package/dist/components/ui/dashboard/admin-opportunities-table.d.ts +20 -0
- package/dist/components/ui/dashboard/admin-opportunities-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/admin-opportunities-table.js +133 -0
- package/dist/components/ui/dashboard/admin-rentals-table.d.ts +12 -0
- package/dist/components/ui/dashboard/admin-rentals-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/admin-rentals-table.js +85 -0
- package/dist/components/ui/dashboard/admin-travel-package-table.d.ts +16 -0
- package/dist/components/ui/dashboard/admin-travel-package-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/admin-travel-package-table.js +100 -0
- package/dist/components/ui/dashboard/adventures-table.d.ts +16 -0
- package/dist/components/ui/dashboard/adventures-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/adventures-table.js +151 -0
- package/dist/components/ui/dashboard/approver-applications-table.d.ts +13 -0
- package/dist/components/ui/dashboard/approver-applications-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/approver-applications-table.js +85 -0
- package/dist/components/ui/dashboard/approver-package-enquiries-table.d.ts +11 -0
- package/dist/components/ui/dashboard/approver-package-enquiries-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/approver-package-enquiries-table.js +102 -0
- package/dist/components/ui/dashboard/archive-confirm-modal.d.ts +9 -0
- package/dist/components/ui/dashboard/archive-confirm-modal.d.ts.map +1 -0
- package/dist/components/ui/dashboard/archive-confirm-modal.js +6 -0
- package/dist/components/ui/dashboard/blogs-table.d.ts +10 -0
- package/dist/components/ui/dashboard/blogs-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/blogs-table.js +62 -0
- package/dist/components/ui/dashboard/bookings-table.d.ts +12 -0
- package/dist/components/ui/dashboard/bookings-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/bookings-table.js +160 -0
- package/dist/components/ui/dashboard/dashboard-page-shell.d.ts +7 -0
- package/dist/components/ui/dashboard/dashboard-page-shell.d.ts.map +1 -0
- package/dist/components/ui/dashboard/dashboard-page-shell.js +5 -0
- package/dist/components/ui/dashboard/data-table-shell.d.ts +18 -0
- package/dist/components/ui/dashboard/data-table-shell.d.ts.map +1 -0
- package/dist/components/ui/dashboard/data-table-shell.js +6 -0
- package/dist/components/ui/dashboard/delete-confirm-modal.d.ts +9 -0
- package/dist/components/ui/dashboard/delete-confirm-modal.d.ts.map +1 -0
- package/dist/components/ui/dashboard/delete-confirm-modal.js +6 -0
- package/dist/components/ui/dashboard/entity-list-page-state.d.ts +25 -0
- package/dist/components/ui/dashboard/entity-list-page-state.d.ts.map +1 -0
- package/dist/components/ui/dashboard/entity-list-page-state.js +17 -0
- package/dist/components/ui/dashboard/generic-entity-table.d.ts +36 -0
- package/dist/components/ui/dashboard/generic-entity-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/generic-entity-table.js +203 -0
- package/dist/components/ui/dashboard/opportunities-table.d.ts +17 -0
- package/dist/components/ui/dashboard/opportunities-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/opportunities-table.js +143 -0
- package/dist/components/ui/dashboard/rentals-table.d.ts +17 -0
- package/dist/components/ui/dashboard/rentals-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/rentals-table.js +155 -0
- package/dist/components/ui/dashboard/restore-confirm-modal.d.ts +9 -0
- package/dist/components/ui/dashboard/restore-confirm-modal.d.ts.map +1 -0
- package/dist/components/ui/dashboard/restore-confirm-modal.js +6 -0
- package/dist/components/ui/dashboard/stats-card.d.ts +6 -0
- package/dist/components/ui/dashboard/stats-card.d.ts.map +1 -0
- package/dist/components/ui/dashboard/stats-card.js +5 -0
- package/dist/components/ui/dashboard/travel-packages-table.d.ts +16 -0
- package/dist/components/ui/dashboard/travel-packages-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/travel-packages-table.js +134 -0
- package/dist/components/ui/dashboard/user-applications-table.d.ts +12 -0
- package/dist/components/ui/dashboard/user-applications-table.d.ts.map +1 -0
- package/dist/components/ui/dashboard/user-applications-table.js +79 -0
- package/dist/components/ui/loading-skeleton.d.ts +10 -0
- package/dist/components/ui/loading-skeleton.d.ts.map +1 -0
- package/dist/components/ui/loading-skeleton.js +49 -0
- package/dist/components/ui/misc/IosPwaNavBar.d.ts +8 -0
- package/dist/components/ui/misc/IosPwaNavBar.d.ts.map +1 -0
- package/dist/components/ui/misc/IosPwaNavBar.js +25 -0
- package/dist/components/ui/misc/document-upload-button.d.ts +10 -0
- package/dist/components/ui/misc/document-upload-button.d.ts.map +1 -0
- package/dist/components/ui/misc/document-upload-button.js +12 -0
- package/dist/components/ui/misc/empty-state.d.ts +9 -0
- package/dist/components/ui/misc/empty-state.d.ts.map +1 -0
- package/dist/components/ui/misc/empty-state.js +4 -0
- package/dist/components/ui/misc/image-cropper.d.ts +9 -0
- package/dist/components/ui/misc/image-cropper.d.ts.map +1 -0
- package/dist/components/ui/misc/image-cropper.js +28 -0
- package/dist/components/ui/misc/rental-tile.d.ts +6 -0
- package/dist/components/ui/misc/rental-tile.d.ts.map +1 -0
- package/dist/components/ui/misc/rental-tile.js +56 -0
- package/dist/components/ui/misc/skeleton-extras.d.ts +32 -0
- package/dist/components/ui/misc/skeleton-extras.d.ts.map +1 -0
- package/dist/components/ui/misc/skeleton-extras.js +58 -0
- package/dist/components/ui/misc/tile.d.ts +4 -0
- package/dist/components/ui/misc/tile.d.ts.map +1 -0
- package/dist/components/ui/misc/tile.js +45 -0
- package/dist/components/ui/misc/whatsapp-help.d.ts +7 -0
- package/dist/components/ui/misc/whatsapp-help.d.ts.map +1 -0
- package/dist/components/ui/misc/whatsapp-help.js +6 -0
- package/dist/components/ui/motion.d.ts +14 -0
- package/dist/components/ui/motion.d.ts.map +1 -0
- package/dist/components/ui/motion.js +17 -0
- package/dist/components/ui/trippeaze/breadcrumb-trail.d.ts +10 -0
- package/dist/components/ui/trippeaze/breadcrumb-trail.d.ts.map +1 -0
- package/dist/components/ui/trippeaze/breadcrumb-trail.js +15 -0
- package/dist/components/ui/trippeaze/chip-tabs.d.ts +13 -0
- package/dist/components/ui/trippeaze/chip-tabs.d.ts.map +1 -0
- package/dist/components/ui/trippeaze/chip-tabs.js +6 -0
- package/dist/components/ui/trippeaze/page-shell.d.ts +22 -0
- package/dist/components/ui/trippeaze/page-shell.d.ts.map +1 -0
- package/dist/components/ui/trippeaze/page-shell.js +15 -0
- package/dist/components/ui/trippeaze/search-input.d.ts +5 -0
- package/dist/components/ui/trippeaze/search-input.d.ts.map +1 -0
- package/dist/components/ui/trippeaze/search-input.js +7 -0
- package/dist/components/user-dashboard/UserDashboardShellSidebar.d.ts +2 -0
- package/dist/components/user-dashboard/UserDashboardShellSidebar.d.ts.map +1 -0
- package/dist/components/user-dashboard/UserDashboardShellSidebar.js +17 -0
- package/dist/components/user-dashboard/UserSidebarNav.d.ts +2 -0
- package/dist/components/user-dashboard/UserSidebarNav.d.ts.map +1 -0
- package/dist/components/user-dashboard/UserSidebarNav.js +67 -0
- package/dist/dashboard/action-buttons.d.ts +2 -1
- package/dist/dashboard/action-buttons.d.ts.map +1 -1
- package/dist/dashboard/action-buttons.js +18 -11
- package/dist/dashboard/app-sidebar.d.ts.map +1 -1
- package/dist/dashboard/app-sidebar.js +3 -36
- package/dist/dashboard/dashboard-components.js +1 -1
- package/dist/dashboard/data-table.d.ts +5 -1
- package/dist/dashboard/data-table.d.ts.map +1 -1
- package/dist/dashboard/data-table.js +39 -7
- package/dist/dashboard/table.js +1 -1
- package/dist/header/mobile-nav-item.js +2 -2
- package/dist/header/mobile-navbar.d.ts.map +1 -1
- package/dist/header/mobile-navbar.js +10 -1
- package/dist/header/nav-item.js +2 -2
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/main/footer.d.ts +0 -1
- package/dist/main/footer.d.ts.map +1 -1
- package/dist/main/footer.js +0 -1
- package/dist/main/navbar.d.ts +2 -2
- package/dist/main/navbar.d.ts.map +1 -1
- package/dist/main/navbar.js +73 -44
- package/dist/main/portfolio/portfolioItem.d.ts +1 -1
- package/dist/main/portfolio/portfolioItem.d.ts.map +1 -1
- package/dist/main/portfolio/portfolioPopup.d.ts +1 -1
- package/dist/main/portfolio/portfolioPopup.d.ts.map +1 -1
- package/dist/main/review-page.d.ts +2 -1
- package/dist/main/review-page.d.ts.map +1 -1
- package/dist/main/review-page.js +34 -4
- package/dist/misc/accordion.js +1 -1
- package/dist/misc/alert-dialog.js +1 -1
- package/dist/misc/alert.js +1 -1
- package/dist/misc/alertdialogclaude.js +1 -1
- package/dist/misc/avatar.js +1 -1
- package/dist/misc/badge.js +1 -1
- package/dist/misc/button.d.ts +6 -3
- package/dist/misc/button.d.ts.map +1 -1
- package/dist/misc/button.js +33 -5
- package/dist/misc/card.js +1 -1
- package/dist/misc/carousel.d.ts +2 -2
- package/dist/misc/carousel.d.ts.map +1 -1
- package/dist/misc/carousel.js +13 -5
- package/dist/misc/checkbox.js +1 -1
- package/dist/misc/command.js +1 -1
- package/dist/misc/datepicker.d.ts +2 -1
- package/dist/misc/datepicker.d.ts.map +1 -1
- package/dist/misc/datepicker.js +23 -21
- package/dist/misc/dialog.js +3 -3
- package/dist/misc/discount-strategy-editor.d.ts +11 -0
- package/dist/misc/discount-strategy-editor.d.ts.map +1 -0
- package/dist/misc/discount-strategy-editor.js +82 -0
- package/dist/misc/dropdown-menu.js +1 -1
- package/dist/misc/faq.d.ts +1 -1
- package/dist/misc/faq.d.ts.map +1 -1
- package/dist/misc/filter.js +2 -2
- package/dist/misc/filterBar.d.ts +11 -3
- package/dist/misc/filterBar.d.ts.map +1 -1
- package/dist/misc/filterBar.js +109 -55
- package/dist/misc/form.js +1 -1
- package/dist/misc/input.d.ts +4 -1
- package/dist/misc/input.d.ts.map +1 -1
- package/dist/misc/input.js +8 -3
- package/dist/misc/label.js +1 -1
- package/dist/misc/listing-wishlist-button.d.ts +13 -0
- package/dist/misc/listing-wishlist-button.d.ts.map +1 -0
- package/dist/misc/listing-wishlist-button.js +42 -0
- package/dist/misc/location/locationPicker.js +1 -1
- package/dist/misc/location-autocomplete.d.ts +28 -0
- package/dist/misc/location-autocomplete.d.ts.map +1 -0
- package/dist/misc/location-autocomplete.js +121 -0
- package/dist/misc/notification.js +2 -2
- package/dist/misc/pagination.js +1 -1
- package/dist/misc/popover.js +1 -1
- package/dist/misc/pricing-strategy-editor.d.ts +17 -0
- package/dist/misc/pricing-strategy-editor.d.ts.map +1 -0
- package/dist/misc/pricing-strategy-editor.js +80 -0
- package/dist/misc/progress.js +1 -1
- package/dist/misc/pwa-install-button.d.ts.map +1 -1
- package/dist/misc/pwa-install-button.js +2 -0
- package/dist/misc/rental-tile.d.ts +1 -1
- package/dist/misc/rental-tile.d.ts.map +1 -1
- package/dist/misc/rental-tile.js +24 -14
- package/dist/misc/scroll-area.js +1 -1
- package/dist/misc/select.js +1 -1
- package/dist/misc/separator.js +1 -1
- package/dist/misc/sheet.js +1 -1
- package/dist/misc/sidebar.js +2 -2
- package/dist/misc/slider.js +1 -1
- package/dist/misc/stateCard.d.ts +1 -1
- package/dist/misc/stateCard.d.ts.map +1 -1
- package/dist/misc/stateCard.js +1 -1
- package/dist/misc/step-progress.d.ts +16 -0
- package/dist/misc/step-progress.d.ts.map +1 -0
- package/dist/misc/step-progress.js +40 -0
- package/dist/misc/switch.js +1 -1
- package/dist/misc/tabs.js +1 -1
- package/dist/misc/tag-filter-input.d.ts +16 -0
- package/dist/misc/tag-filter-input.d.ts.map +1 -0
- package/dist/misc/tag-filter-input.js +26 -0
- package/dist/misc/textarea.js +1 -1
- package/dist/misc/tile.d.ts +1 -1
- package/dist/misc/tile.d.ts.map +1 -1
- package/dist/misc/tile.js +12 -47
- package/dist/misc/time-select.d.ts +14 -0
- package/dist/misc/time-select.d.ts.map +1 -0
- package/dist/misc/time-select.js +13 -0
- package/dist/misc/tooltip.js +1 -1
- package/dist/misc/wizard-footer.d.ts +18 -0
- package/dist/misc/wizard-footer.d.ts.map +1 -0
- package/dist/misc/wizard-footer.js +11 -0
- package/package.json +9 -6
- package/dist/misc/dashboard/action-buttons.js +0 -31
- package/dist/misc/misc/alertdialogclaude.js +0 -221
- package/dist/misc/misc/button.js +0 -46
- package/dist/misc/misc/dropdown-menu.js +0 -136
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { format, } from "date-fns";
|
|
6
|
+
import { useAtomValue } from "jotai";
|
|
7
|
+
import { userAtom } from "@myrjfa/state/dist/lib/userAtom";
|
|
8
|
+
import { calculatePricingStrategyUnitTotal, getPricingCurrency, getPricingStrategies } from "@myrjfa/state/dist/lib/models/pricing";
|
|
9
|
+
import { calculateDiscountAmount, getApplicableDiscountStrategy } from "@myrjfa/state/dist/lib/models/discount";
|
|
10
|
+
import { createBooking, verifyBookingPayment } from "@myrjfa/state/dist/lib/actions/booking";
|
|
11
|
+
import { Input } from "@myrjfa/ui/dist/misc/input";
|
|
12
|
+
import { Label } from "@myrjfa/ui/dist/misc/label";
|
|
13
|
+
import { Textarea } from "@myrjfa/ui/dist/misc/textarea";
|
|
14
|
+
import { showAlert } from "@myrjfa/ui/dist/misc/alertdialogclaude";
|
|
15
|
+
import { DatePicker } from "@myrjfa/ui/dist/misc/datepicker";
|
|
16
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@myrjfa/ui/dist/misc/select";
|
|
17
|
+
import { ExternalLink, FileText, } from "lucide-react";
|
|
18
|
+
import { GuestOrLoginDialog } from "@myrjfa/ui/dist/components/ui/GuestOrLoginDialog";
|
|
19
|
+
const BOOKING_CONFIRMATION_STORAGE_KEY = "latest_booking_confirmation";
|
|
20
|
+
function formatDateKey(value) {
|
|
21
|
+
return format(new Date(value), "yyyy-MM-dd");
|
|
22
|
+
}
|
|
23
|
+
function addMonthsClamped(date, months) {
|
|
24
|
+
const next = new Date(date);
|
|
25
|
+
const day = next.getDate();
|
|
26
|
+
next.setDate(1);
|
|
27
|
+
next.setMonth(next.getMonth() + months);
|
|
28
|
+
const lastDay = new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate();
|
|
29
|
+
next.setDate(Math.min(day, lastDay));
|
|
30
|
+
return next;
|
|
31
|
+
}
|
|
32
|
+
function addPackageFrequency(date, entity) {
|
|
33
|
+
const frequency = String((entity === null || entity === void 0 ? void 0 : entity.frequency) || "weekly").toLowerCase();
|
|
34
|
+
const next = new Date(date);
|
|
35
|
+
if (frequency === "daily")
|
|
36
|
+
next.setDate(next.getDate() + 1);
|
|
37
|
+
else if (frequency === "weekly")
|
|
38
|
+
next.setDate(next.getDate() + 7);
|
|
39
|
+
else if (frequency === "bi-weekly" || frequency === "biweekly")
|
|
40
|
+
next.setDate(next.getDate() + 14);
|
|
41
|
+
else if (frequency === "monthly")
|
|
42
|
+
return addMonthsClamped(next, 1);
|
|
43
|
+
else if (frequency === "yearly")
|
|
44
|
+
return addMonthsClamped(next, 12);
|
|
45
|
+
else if (frequency === "custom")
|
|
46
|
+
next.setDate(next.getDate() + Math.max(1, Number(entity === null || entity === void 0 ? void 0 : entity.customFrequencyDays) || 1));
|
|
47
|
+
else
|
|
48
|
+
next.setDate(next.getDate() + 7);
|
|
49
|
+
return next;
|
|
50
|
+
}
|
|
51
|
+
function buildPackageAvailableDateKeys(entity) {
|
|
52
|
+
if (Array.isArray(entity === null || entity === void 0 ? void 0 : entity.availableDateKeys) && entity.availableDateKeys.length) {
|
|
53
|
+
return entity.availableDateKeys.map((value) => formatDateKey(value));
|
|
54
|
+
}
|
|
55
|
+
if (!(entity === null || entity === void 0 ? void 0 : entity.availableFrom))
|
|
56
|
+
return [];
|
|
57
|
+
const dateKeys = [];
|
|
58
|
+
const todayKey = formatDateKey(new Date());
|
|
59
|
+
const bookedCounts = (entity === null || entity === void 0 ? void 0 : entity.bookedDateCounts) || {};
|
|
60
|
+
const capacity = Math.max(1, Number(entity === null || entity === void 0 ? void 0 : entity.peopleRequired) || 1);
|
|
61
|
+
let cursor = new Date(entity.availableFrom);
|
|
62
|
+
cursor = new Date(cursor.getFullYear(), cursor.getMonth(), cursor.getDate(), 12);
|
|
63
|
+
const horizon = new Date();
|
|
64
|
+
horizon.setDate(horizon.getDate() + 730);
|
|
65
|
+
let guard = 0;
|
|
66
|
+
while (cursor <= horizon && guard < 800) {
|
|
67
|
+
const key = formatDateKey(cursor);
|
|
68
|
+
if (key >= todayKey && Number(bookedCounts[key] || 0) < capacity) {
|
|
69
|
+
dateKeys.push(key);
|
|
70
|
+
}
|
|
71
|
+
cursor = addPackageFrequency(cursor, entity);
|
|
72
|
+
guard += 1;
|
|
73
|
+
}
|
|
74
|
+
return dateKeys;
|
|
75
|
+
}
|
|
76
|
+
function toNonNegativeAmount(value) {
|
|
77
|
+
const amount = Number(value);
|
|
78
|
+
return Number.isFinite(amount) ? Math.max(amount, 0) : 0;
|
|
79
|
+
}
|
|
80
|
+
function parseTimeMinutes(value) {
|
|
81
|
+
const [hourRaw, minuteRaw] = String(value || "").split(":");
|
|
82
|
+
const hour = Number(hourRaw);
|
|
83
|
+
const minute = Number(minuteRaw);
|
|
84
|
+
if (!Number.isFinite(hour) || !Number.isFinite(minute))
|
|
85
|
+
return null;
|
|
86
|
+
return hour * 60 + minute;
|
|
87
|
+
}
|
|
88
|
+
function calculateRentalChargeDays(startDate, endDate, pickupTime, returnTime, normalPickupTime, normalDropTime) {
|
|
89
|
+
if (!startDate || !endDate)
|
|
90
|
+
return 0;
|
|
91
|
+
const diff = new Date(endDate).getTime() - new Date(startDate).getTime();
|
|
92
|
+
const baseDays = Math.max(1, Math.ceil(diff / (1000 * 60 * 60 * 24)));
|
|
93
|
+
const pickupMins = parseTimeMinutes(pickupTime);
|
|
94
|
+
const returnMins = parseTimeMinutes(returnTime);
|
|
95
|
+
const normalPickupMins = parseTimeMinutes(normalPickupTime);
|
|
96
|
+
const normalDropMins = parseTimeMinutes(normalDropTime);
|
|
97
|
+
const pickupExtra = pickupMins !== null && normalPickupMins !== null && pickupMins < normalPickupMins
|
|
98
|
+
? 1
|
|
99
|
+
: 0;
|
|
100
|
+
const dropExtra = returnMins !== null && normalDropMins !== null && returnMins > normalDropMins
|
|
101
|
+
? 1
|
|
102
|
+
: 0;
|
|
103
|
+
return baseDays + pickupExtra + dropExtra;
|
|
104
|
+
}
|
|
105
|
+
function getCustomerProductUnitPrice(strategy) {
|
|
106
|
+
var _a;
|
|
107
|
+
if (!strategy)
|
|
108
|
+
return 0;
|
|
109
|
+
return (toNonNegativeAmount((_a = strategy.finalBasePrice) !== null && _a !== void 0 ? _a : strategy.basePrice) +
|
|
110
|
+
toNonNegativeAmount(strategy.platformFee));
|
|
111
|
+
}
|
|
112
|
+
function getCustomerTaxUnitTotal(strategy) {
|
|
113
|
+
if (!strategy)
|
|
114
|
+
return 0;
|
|
115
|
+
return (toNonNegativeAmount(strategy.gst) +
|
|
116
|
+
toNonNegativeAmount(strategy.governmentTaxes) +
|
|
117
|
+
toNonNegativeAmount(strategy.convenienceFee));
|
|
118
|
+
}
|
|
119
|
+
function getCustomerUnitTotal(strategy) {
|
|
120
|
+
return getCustomerProductUnitPrice(strategy) + getCustomerTaxUnitTotal(strategy);
|
|
121
|
+
}
|
|
122
|
+
function EditableNumberInput({ value, min = 0, onValueChange, ...props }) {
|
|
123
|
+
const [draft, setDraft] = useState(String(value !== null && value !== void 0 ? value : min));
|
|
124
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (!isFocused)
|
|
127
|
+
setDraft(String(value !== null && value !== void 0 ? value : min));
|
|
128
|
+
}, [isFocused, min, value]);
|
|
129
|
+
return (_jsx(Input, { ...props, type: "number", min: min, value: draft, onFocus: () => {
|
|
130
|
+
setIsFocused(true);
|
|
131
|
+
if (Number(draft) === 0)
|
|
132
|
+
setDraft("");
|
|
133
|
+
}, onBlur: () => {
|
|
134
|
+
setIsFocused(false);
|
|
135
|
+
const nextValue = draft.trim() === "" ? min : Math.max(min, Number(draft) || min);
|
|
136
|
+
setDraft(String(nextValue));
|
|
137
|
+
onValueChange(nextValue);
|
|
138
|
+
}, onChange: (event) => {
|
|
139
|
+
const nextDraft = event.target.value;
|
|
140
|
+
setDraft(nextDraft);
|
|
141
|
+
if (nextDraft.trim() !== "") {
|
|
142
|
+
onValueChange(Math.max(min, Number(nextDraft) || min));
|
|
143
|
+
}
|
|
144
|
+
} }));
|
|
145
|
+
}
|
|
146
|
+
export function BookingForm({ entity, type, preStartDate, preEndDate, preStartTime, prePickupTime, preReturnTime, prePickupPointIndex, preHomeDeliverySelected, preRoomId, preRoomQty, preNumberOfPeople, prePricingIndex, onDatesChange, onPackageSummaryChange, onBookingSnapshotChange, }) {
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
148
|
+
const user = useAtomValue(userAtom);
|
|
149
|
+
const router = useRouter();
|
|
150
|
+
const [loading, setLoading] = useState(false);
|
|
151
|
+
const [termsAccepted, setTermsAccepted] = useState(false);
|
|
152
|
+
const [showGuestDialog, setShowGuestDialog] = useState(false);
|
|
153
|
+
// Derive operating hours from entity (set during creation); default 09:00–21:00
|
|
154
|
+
const opStart = ((_a = entity === null || entity === void 0 ? void 0 : entity.operatingHours) === null || _a === void 0 ? void 0 : _a.start) || "09:00";
|
|
155
|
+
const opEnd = ((_b = entity === null || entity === void 0 ? void 0 : entity.operatingHours) === null || _b === void 0 ? void 0 : _b.end) || "21:00";
|
|
156
|
+
const normalPickupTime = (entity === null || entity === void 0 ? void 0 : entity.normalPickupTime) || opStart;
|
|
157
|
+
const normalDropTime = (entity === null || entity === void 0 ? void 0 : entity.normalDropTime) || opEnd;
|
|
158
|
+
// Dynamically generate 30-min slots within operating hours
|
|
159
|
+
const buildSlots = (start, end) => {
|
|
160
|
+
if (!start || !end)
|
|
161
|
+
return [];
|
|
162
|
+
const startParts = start.split(":").map(Number);
|
|
163
|
+
const endParts = end.split(":").map(Number);
|
|
164
|
+
const startH = startParts[0] !== undefined ? startParts[0] : 0;
|
|
165
|
+
const startM = startParts[1] !== undefined ? startParts[1] : 0;
|
|
166
|
+
const endH = endParts[0] !== undefined ? endParts[0] : 0;
|
|
167
|
+
const endM = endParts[1] !== undefined ? endParts[1] : 0;
|
|
168
|
+
const startMins = startH * 60 + startM;
|
|
169
|
+
const endMins = endH * 60 + endM;
|
|
170
|
+
const slots = [];
|
|
171
|
+
for (let m = startMins; m <= endMins; m += 30) {
|
|
172
|
+
const h = Math.floor(m / 60)
|
|
173
|
+
.toString()
|
|
174
|
+
.padStart(2, "0");
|
|
175
|
+
const min = (m % 60).toString().padStart(2, "0");
|
|
176
|
+
slots.push(`${h}:${min}`);
|
|
177
|
+
}
|
|
178
|
+
return slots;
|
|
179
|
+
};
|
|
180
|
+
const TIME_SLOTS = buildSlots(opStart, opEnd);
|
|
181
|
+
const todayDateKey = format(new Date(), "yyyy-MM-dd");
|
|
182
|
+
const blockedAdventureDateKeys = new Set(((entity === null || entity === void 0 ? void 0 : entity.blockedDates) || []).map((value) => format(new Date(value), "yyyy-MM-dd")));
|
|
183
|
+
const configuredAdventureSlots = Array.isArray(entity === null || entity === void 0 ? void 0 : entity.slots)
|
|
184
|
+
? entity.slots
|
|
185
|
+
.map((slot) => {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
const dateKey = (slot === null || slot === void 0 ? void 0 : slot.date)
|
|
188
|
+
? format(new Date(slot.date), "yyyy-MM-dd")
|
|
189
|
+
: "";
|
|
190
|
+
const remainingCapacity = (_a = slot === null || slot === void 0 ? void 0 : slot.remainingCapacity) !== null && _a !== void 0 ? _a : Math.max((Number(slot === null || slot === void 0 ? void 0 : slot.maxParticipants) || 0) -
|
|
191
|
+
(Number(slot === null || slot === void 0 ? void 0 : slot.bookedCount) || 0), 0);
|
|
192
|
+
return {
|
|
193
|
+
...slot,
|
|
194
|
+
dateKey,
|
|
195
|
+
startTime: String((slot === null || slot === void 0 ? void 0 : slot.startTime) || "").trim(),
|
|
196
|
+
endTime: String((slot === null || slot === void 0 ? void 0 : slot.endTime) || "").trim(),
|
|
197
|
+
remainingCapacity,
|
|
198
|
+
isBookable: (_b = slot === null || slot === void 0 ? void 0 : slot.isBookable) !== null && _b !== void 0 ? _b : ((slot === null || slot === void 0 ? void 0 : slot.isAvailable) !== false && remainingCapacity > 0),
|
|
199
|
+
};
|
|
200
|
+
})
|
|
201
|
+
.filter((slot) => slot.dateKey && slot.startTime)
|
|
202
|
+
: [];
|
|
203
|
+
const [formData, setFormData] = useState({
|
|
204
|
+
startDate: preStartDate ? new Date(preStartDate) : undefined,
|
|
205
|
+
endDate: preEndDate ? new Date(preEndDate) : undefined,
|
|
206
|
+
startTime: preStartTime || opStart,
|
|
207
|
+
pickupTime: prePickupTime || normalPickupTime,
|
|
208
|
+
returnTime: preReturnTime || normalDropTime,
|
|
209
|
+
numberOfPeople: preNumberOfPeople || 1,
|
|
210
|
+
specialRequests: "",
|
|
211
|
+
name: (user === null || user === void 0 ? void 0 : user.firstName) ? `${user.firstName} ${user.lastName}` : "",
|
|
212
|
+
email: (user === null || user === void 0 ? void 0 : user.email) || "",
|
|
213
|
+
phone: (user === null || user === void 0 ? void 0 : user.phoneNumber) || "",
|
|
214
|
+
});
|
|
215
|
+
const DRAFT_KEY = `booking_draft_${entity._id}`;
|
|
216
|
+
// Restore saved form state after login redirect
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
const saved = sessionStorage.getItem(DRAFT_KEY);
|
|
219
|
+
if (!saved)
|
|
220
|
+
return;
|
|
221
|
+
try {
|
|
222
|
+
const parsed = JSON.parse(saved);
|
|
223
|
+
sessionStorage.removeItem(DRAFT_KEY);
|
|
224
|
+
const start = parsed.startDate ? new Date(parsed.startDate) : undefined;
|
|
225
|
+
const end = parsed.endDate ? new Date(parsed.endDate) : undefined;
|
|
226
|
+
setFormData((prev) => ({
|
|
227
|
+
...prev,
|
|
228
|
+
...parsed,
|
|
229
|
+
startDate: start,
|
|
230
|
+
endDate: end,
|
|
231
|
+
// User profile takes precedence over saved contact info
|
|
232
|
+
name: (user === null || user === void 0 ? void 0 : user.firstName) ? `${user.firstName} ${user.lastName}` : parsed.name || prev.name,
|
|
233
|
+
email: (user === null || user === void 0 ? void 0 : user.email) || parsed.email || prev.email,
|
|
234
|
+
phone: (user === null || user === void 0 ? void 0 : user.phoneNumber) || parsed.phone || prev.phone,
|
|
235
|
+
}));
|
|
236
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(start !== null && start !== void 0 ? start : null, end !== null && end !== void 0 ? end : null);
|
|
237
|
+
}
|
|
238
|
+
catch (_a) { }
|
|
239
|
+
}, []);
|
|
240
|
+
const isRental = type === "Rental";
|
|
241
|
+
const isStay = type === "Stay";
|
|
242
|
+
const isEvent = type === "Event";
|
|
243
|
+
const isAdventure = type === "Adventure";
|
|
244
|
+
const isPackage = type === "TravelPackage";
|
|
245
|
+
const selectedAdventureDateKey = formData.startDate
|
|
246
|
+
? format(formData.startDate, "yyyy-MM-dd")
|
|
247
|
+
: "";
|
|
248
|
+
const availableAdventureDateKeys = Array.from(new Set(configuredAdventureSlots
|
|
249
|
+
.filter((slot) => slot.isBookable &&
|
|
250
|
+
slot.dateKey >= todayDateKey &&
|
|
251
|
+
!blockedAdventureDateKeys.has(slot.dateKey))
|
|
252
|
+
.map((slot) => String(slot.dateKey))));
|
|
253
|
+
const selectedAdventureSlots = isAdventure
|
|
254
|
+
? configuredAdventureSlots.filter((slot) => slot.dateKey === selectedAdventureDateKey &&
|
|
255
|
+
!blockedAdventureDateKeys.has(slot.dateKey))
|
|
256
|
+
: [];
|
|
257
|
+
const bookableAdventureSlots = selectedAdventureSlots.filter((slot) => slot.isBookable);
|
|
258
|
+
const selectedAdventureSlot = bookableAdventureSlots.find((slot) => slot.startTime === formData.startTime);
|
|
259
|
+
const deliveryCharge = isRental && preHomeDeliverySelected && entity.homeDeliveryAvailable
|
|
260
|
+
? entity.homeDeliveryPrice || 0
|
|
261
|
+
: 0;
|
|
262
|
+
const selectedPickupPoint = isRental && prePickupPointIndex !== null && prePickupPointIndex !== undefined
|
|
263
|
+
? (_c = entity.pickupPoints) === null || _c === void 0 ? void 0 : _c[prePickupPointIndex]
|
|
264
|
+
: null;
|
|
265
|
+
const packagePricing = getPricingStrategies(entity) || [];
|
|
266
|
+
const packageAvailableDateKeys = useMemo(() => (isPackage ? buildPackageAvailableDateKeys(entity) : []), [entity, isPackage]);
|
|
267
|
+
const entityCurrency = getPricingCurrency(entity) || "INR";
|
|
268
|
+
const primaryEntityPricing = packagePricing[0];
|
|
269
|
+
const packageActivities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
|
|
270
|
+
const compulsoryPackageActivities = packageActivities.filter((activity) => activity.type === "compulsory");
|
|
271
|
+
const optionalPackageActivities = packageActivities.filter((activity) => activity.type === "optional");
|
|
272
|
+
const [selectedPricingIndex, setSelectedPricingIndex] = useState(Math.max(0, Number(prePricingIndex) || 0));
|
|
273
|
+
const [males, setMales] = useState(0);
|
|
274
|
+
const [females, setFemales] = useState(0);
|
|
275
|
+
const [selectedOptionalActivities, setSelectedOptionalActivities] = useState([]);
|
|
276
|
+
const selectedEntityPricing = packagePricing[selectedPricingIndex] || primaryEntityPricing;
|
|
277
|
+
const adventureUnitPrice = isAdventure
|
|
278
|
+
? getCustomerUnitTotal(selectedEntityPricing)
|
|
279
|
+
: 0;
|
|
280
|
+
// Calculate number of days/nights
|
|
281
|
+
let duration = 0;
|
|
282
|
+
if (isRental && formData.startDate && formData.endDate) {
|
|
283
|
+
duration = calculateRentalChargeDays(formData.startDate, formData.endDate, formData.pickupTime, formData.returnTime, normalPickupTime, normalDropTime);
|
|
284
|
+
}
|
|
285
|
+
else if (isStay && formData.startDate && formData.endDate) {
|
|
286
|
+
const diff = new Date(formData.endDate).getTime() - new Date(formData.startDate).getTime();
|
|
287
|
+
duration = Math.max(1, Math.ceil(diff / (1000 * 60 * 60 * 24)));
|
|
288
|
+
}
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
if (!isPackage)
|
|
291
|
+
return;
|
|
292
|
+
const preferredKey = preStartDate && packageAvailableDateKeys.includes(formatDateKey(preStartDate))
|
|
293
|
+
? formatDateKey(preStartDate)
|
|
294
|
+
: packageAvailableDateKeys[0];
|
|
295
|
+
const pkgStartDate = preferredKey ? new Date(`${preferredKey}T12:00:00`) : undefined;
|
|
296
|
+
setFormData((prev) => {
|
|
297
|
+
const currentKey = prev.startDate ? formatDateKey(prev.startDate) : "";
|
|
298
|
+
if (currentKey &&
|
|
299
|
+
packageAvailableDateKeys.includes(currentKey) &&
|
|
300
|
+
prev.endDate === undefined) {
|
|
301
|
+
return prev;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
...prev,
|
|
305
|
+
startDate: pkgStartDate,
|
|
306
|
+
endDate: undefined,
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(pkgStartDate !== null && pkgStartDate !== void 0 ? pkgStartDate : null, null);
|
|
310
|
+
}, [isPackage, onDatesChange, packageAvailableDateKeys, preStartDate]);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (!isEvent || !(entity === null || entity === void 0 ? void 0 : entity.startTime))
|
|
313
|
+
return;
|
|
314
|
+
setFormData((prev) => ({
|
|
315
|
+
...prev,
|
|
316
|
+
startTime: entity.startTime,
|
|
317
|
+
}));
|
|
318
|
+
}, [isEvent, entity === null || entity === void 0 ? void 0 : entity.startTime]);
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
if (!isAdventure)
|
|
322
|
+
return;
|
|
323
|
+
if (configuredAdventureSlots.length === 0) {
|
|
324
|
+
if (formData.startTime) {
|
|
325
|
+
setFormData((prev) => ({ ...prev, startTime: "" }));
|
|
326
|
+
}
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const dateHasBookableSlot = selectedAdventureDateKey &&
|
|
330
|
+
availableAdventureDateKeys.includes(selectedAdventureDateKey);
|
|
331
|
+
const nextDateKey = dateHasBookableSlot
|
|
332
|
+
? selectedAdventureDateKey
|
|
333
|
+
: availableAdventureDateKeys[0] || "";
|
|
334
|
+
const nextDate = nextDateKey ? new Date(`${nextDateKey}T12:00:00`) : undefined;
|
|
335
|
+
const nextDateSlots = configuredAdventureSlots.filter((slot) => slot.dateKey === nextDateKey &&
|
|
336
|
+
slot.isBookable &&
|
|
337
|
+
!blockedAdventureDateKeys.has(slot.dateKey));
|
|
338
|
+
const nextSlot = nextDateSlots.find((slot) => slot.startTime === formData.startTime)
|
|
339
|
+
? formData.startTime
|
|
340
|
+
: ((_a = nextDateSlots[0]) === null || _a === void 0 ? void 0 : _a.startTime) || "";
|
|
341
|
+
const shouldChangeDate = ((nextDate === null || nextDate === void 0 ? void 0 : nextDate.getTime()) || 0) !== (((_b = formData.startDate) === null || _b === void 0 ? void 0 : _b.getTime()) || 0);
|
|
342
|
+
const shouldChangeTime = nextSlot !== formData.startTime;
|
|
343
|
+
if (shouldChangeDate || shouldChangeTime) {
|
|
344
|
+
setFormData((prev) => ({
|
|
345
|
+
...prev,
|
|
346
|
+
startDate: shouldChangeDate ? nextDate : prev.startDate,
|
|
347
|
+
startTime: nextSlot,
|
|
348
|
+
}));
|
|
349
|
+
if (shouldChangeDate)
|
|
350
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(nextDate !== null && nextDate !== void 0 ? nextDate : null, null);
|
|
351
|
+
}
|
|
352
|
+
}, [
|
|
353
|
+
availableAdventureDateKeys,
|
|
354
|
+
configuredAdventureSlots.length,
|
|
355
|
+
formData.startTime,
|
|
356
|
+
formData.startDate,
|
|
357
|
+
isAdventure,
|
|
358
|
+
onDatesChange,
|
|
359
|
+
selectedAdventureDateKey,
|
|
360
|
+
]);
|
|
361
|
+
const getRentalTotal = (days) => {
|
|
362
|
+
const daily = calculatePricingStrategyUnitTotal(primaryEntityPricing);
|
|
363
|
+
const baseTotal = daily * days;
|
|
364
|
+
const discountStrategy = getApplicableDiscountStrategy(entity.discount, days);
|
|
365
|
+
return Math.max(baseTotal - calculateDiscountAmount(baseTotal, discountStrategy), 0);
|
|
366
|
+
};
|
|
367
|
+
const getRentalUpfrontPayment = (days) => {
|
|
368
|
+
var _a, _b;
|
|
369
|
+
const strategy = (primaryEntityPricing || {});
|
|
370
|
+
const hostUnit = Number((_b = (_a = strategy.finalBasePrice) !== null && _a !== void 0 ? _a : strategy.basePrice) !== null && _b !== void 0 ? _b : 0);
|
|
371
|
+
const platformUnit = Number(strategy.platformFee || 0);
|
|
372
|
+
const gstUnit = Number(strategy.gst || 0);
|
|
373
|
+
const governmentUnit = Number(strategy.governmentTaxes || 0);
|
|
374
|
+
const convenienceUnit = Number(strategy.convenienceFee || 0);
|
|
375
|
+
const baseSubtotal = hostUnit * days;
|
|
376
|
+
const feeSubtotal = (platformUnit + gstUnit + governmentUnit + convenienceUnit) * days;
|
|
377
|
+
const totalBeforeDiscount = baseSubtotal + feeSubtotal;
|
|
378
|
+
const discountStrategy = getApplicableDiscountStrategy(entity.discount, days);
|
|
379
|
+
const discountAmount = calculateDiscountAmount(totalBeforeDiscount, discountStrategy);
|
|
380
|
+
const discountedHostSubtotal = Math.max(baseSubtotal - discountAmount, 0);
|
|
381
|
+
const total = discountedHostSubtotal + feeSubtotal + (preHomeDeliverySelected ? deliveryCharge : 0);
|
|
382
|
+
return entity.payAtPickup
|
|
383
|
+
? total - discountedHostSubtotal - (preHomeDeliverySelected ? deliveryCharge : 0)
|
|
384
|
+
: total;
|
|
385
|
+
};
|
|
386
|
+
let baseTotalPrice = 0;
|
|
387
|
+
if (isRental) {
|
|
388
|
+
baseTotalPrice = duration > 0 ? getRentalTotal(duration) : calculatePricingStrategyUnitTotal(primaryEntityPricing);
|
|
389
|
+
if (preHomeDeliverySelected) {
|
|
390
|
+
baseTotalPrice += deliveryCharge;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
else if (isStay) {
|
|
394
|
+
const room = preRoomId ? (_d = entity.rooms) === null || _d === void 0 ? void 0 : _d.find((r) => r._id === preRoomId) : null;
|
|
395
|
+
const roomRate = room ? room.pricePerNight : 0;
|
|
396
|
+
const qty = preRoomQty || 1;
|
|
397
|
+
let base = roomRate * (duration > 0 ? duration : 1) * qty;
|
|
398
|
+
let cleaningFee = ((_e = entity.fees) === null || _e === void 0 ? void 0 : _e.cleaningFee) || 0;
|
|
399
|
+
let taxAmount = Math.round(base * ((((_f = entity.fees) === null || _f === void 0 ? void 0 : _f.taxPercentage) || 0) / 100));
|
|
400
|
+
baseTotalPrice = base + cleaningFee + taxAmount;
|
|
401
|
+
}
|
|
402
|
+
else if (isEvent) {
|
|
403
|
+
baseTotalPrice = entity.isFree ? 0 : calculatePricingStrategyUnitTotal(primaryEntityPricing) * (formData.numberOfPeople || 1);
|
|
404
|
+
}
|
|
405
|
+
else if (isPackage) {
|
|
406
|
+
const selectedPricing = packagePricing[selectedPricingIndex];
|
|
407
|
+
const totalPeople = males + females;
|
|
408
|
+
const activityTotal = optionalPackageActivities
|
|
409
|
+
.filter((activity) => selectedOptionalActivities.includes(activity.name))
|
|
410
|
+
.reduce((sum, activity) => sum + ((activity.additionalPrice || 0) * totalPeople), 0);
|
|
411
|
+
if (selectedPricing && totalPeople > 0) {
|
|
412
|
+
baseTotalPrice = (getCustomerUnitTotal(selectedPricing) * totalPeople) + activityTotal;
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
baseTotalPrice = 0;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
// Adventure
|
|
420
|
+
baseTotalPrice = adventureUnitPrice * formData.numberOfPeople;
|
|
421
|
+
}
|
|
422
|
+
const upfrontPayment = isRental
|
|
423
|
+
? (duration > 0 ? getRentalUpfrontPayment(duration) : baseTotalPrice)
|
|
424
|
+
: baseTotalPrice;
|
|
425
|
+
const packageTotalPeople = males + females;
|
|
426
|
+
useEffect(() => {
|
|
427
|
+
if (!isPackage)
|
|
428
|
+
return;
|
|
429
|
+
onPackageSummaryChange === null || onPackageSummaryChange === void 0 ? void 0 : onPackageSummaryChange({
|
|
430
|
+
selectedPricingIndex,
|
|
431
|
+
totalPeople: packageTotalPeople,
|
|
432
|
+
males,
|
|
433
|
+
females,
|
|
434
|
+
totalPrice: baseTotalPrice,
|
|
435
|
+
optionalActivityNames: selectedOptionalActivities,
|
|
436
|
+
});
|
|
437
|
+
}, [
|
|
438
|
+
baseTotalPrice,
|
|
439
|
+
females,
|
|
440
|
+
isPackage,
|
|
441
|
+
males,
|
|
442
|
+
onPackageSummaryChange,
|
|
443
|
+
packageTotalPeople,
|
|
444
|
+
selectedOptionalActivities,
|
|
445
|
+
selectedPricingIndex,
|
|
446
|
+
]);
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
onBookingSnapshotChange === null || onBookingSnapshotChange === void 0 ? void 0 : onBookingSnapshotChange({
|
|
449
|
+
startDate: formData.startDate || null,
|
|
450
|
+
endDate: formData.endDate || null,
|
|
451
|
+
startTime: formData.startTime,
|
|
452
|
+
pickupTime: formData.pickupTime,
|
|
453
|
+
returnTime: formData.returnTime,
|
|
454
|
+
numberOfPeople: isPackage ? packageTotalPeople : Number(formData.numberOfPeople) || 1,
|
|
455
|
+
totalPrice: baseTotalPrice,
|
|
456
|
+
termsAccepted,
|
|
457
|
+
specialRequests: formData.specialRequests,
|
|
458
|
+
selectedPricingIndex,
|
|
459
|
+
});
|
|
460
|
+
}, [
|
|
461
|
+
baseTotalPrice,
|
|
462
|
+
formData.endDate,
|
|
463
|
+
formData.numberOfPeople,
|
|
464
|
+
formData.pickupTime,
|
|
465
|
+
formData.returnTime,
|
|
466
|
+
formData.specialRequests,
|
|
467
|
+
formData.startDate,
|
|
468
|
+
formData.startTime,
|
|
469
|
+
isPackage,
|
|
470
|
+
onBookingSnapshotChange,
|
|
471
|
+
packageTotalPeople,
|
|
472
|
+
selectedPricingIndex,
|
|
473
|
+
termsAccepted,
|
|
474
|
+
]);
|
|
475
|
+
const isFormValid = formData.startDate &&
|
|
476
|
+
(!(isRental || isStay) || formData.endDate) &&
|
|
477
|
+
(!isAdventure || !!selectedAdventureSlot) &&
|
|
478
|
+
(!(isAdventure || isEvent) || !!formData.startTime) &&
|
|
479
|
+
(!isPackage || packageTotalPeople > 0) &&
|
|
480
|
+
formData.name &&
|
|
481
|
+
formData.email &&
|
|
482
|
+
formData.phone &&
|
|
483
|
+
termsAccepted;
|
|
484
|
+
const handleChange = (e) => {
|
|
485
|
+
const { name, value } = e.target;
|
|
486
|
+
setFormData((prev) => ({ ...prev, [name]: value }));
|
|
487
|
+
};
|
|
488
|
+
const loadRazorpayScript = () => new Promise((resolve) => {
|
|
489
|
+
if (window.Razorpay)
|
|
490
|
+
return resolve(true);
|
|
491
|
+
const script = document.createElement("script");
|
|
492
|
+
script.src = "https://checkout.razorpay.com/v1/checkout.js";
|
|
493
|
+
script.onload = () => resolve(true);
|
|
494
|
+
script.onerror = () => resolve(false);
|
|
495
|
+
document.body.appendChild(script);
|
|
496
|
+
});
|
|
497
|
+
const postGuestJson = async (path, payload) => {
|
|
498
|
+
const baseUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
499
|
+
const response = await fetch(`${baseUrl}${path}`, {
|
|
500
|
+
method: "POST",
|
|
501
|
+
credentials: "omit",
|
|
502
|
+
headers: {
|
|
503
|
+
"Content-Type": "application/json",
|
|
504
|
+
Accept: "application/json",
|
|
505
|
+
},
|
|
506
|
+
body: JSON.stringify(payload),
|
|
507
|
+
});
|
|
508
|
+
const data = await response.json().catch(() => ({}));
|
|
509
|
+
if (!response.ok) {
|
|
510
|
+
throw new Error((data === null || data === void 0 ? void 0 : data.error) || (data === null || data === void 0 ? void 0 : data.message) || "Request failed");
|
|
511
|
+
}
|
|
512
|
+
return data;
|
|
513
|
+
};
|
|
514
|
+
const proceedWithSubmit = async () => {
|
|
515
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
516
|
+
if (isAdventure && !selectedAdventureSlot) {
|
|
517
|
+
await showAlert("Please select an available adventure slot.");
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
setLoading(true);
|
|
521
|
+
try {
|
|
522
|
+
const bookingRequest = {
|
|
523
|
+
entityId: isPackage ? (entity.slug || entity._id) : entity._id,
|
|
524
|
+
entityType: type,
|
|
525
|
+
roomId: preRoomId || undefined,
|
|
526
|
+
roomQty: preRoomQty || undefined,
|
|
527
|
+
startDate: formData.startDate.toISOString(),
|
|
528
|
+
endDate: formData.endDate ? formData.endDate.toISOString() : undefined,
|
|
529
|
+
startTime: (isAdventure || isEvent) ? formData.startTime : undefined,
|
|
530
|
+
pickupTime: isRental ? formData.pickupTime : undefined,
|
|
531
|
+
returnTime: isRental ? formData.returnTime : undefined,
|
|
532
|
+
pickupPointIndex: isRental ? prePickupPointIndex !== null && prePickupPointIndex !== void 0 ? prePickupPointIndex : undefined : undefined,
|
|
533
|
+
homeDeliverySelected: isRental ? !!preHomeDeliverySelected : undefined,
|
|
534
|
+
numberOfPeople: isPackage ? packageTotalPeople : formData.numberOfPeople,
|
|
535
|
+
totalPrice: baseTotalPrice,
|
|
536
|
+
currency: entityCurrency,
|
|
537
|
+
contactDetails: {
|
|
538
|
+
name: formData.name,
|
|
539
|
+
email: formData.email,
|
|
540
|
+
phone: formData.phone,
|
|
541
|
+
},
|
|
542
|
+
specialRequests: formData.specialRequests,
|
|
543
|
+
selectedPricingIndex: isPackage || isAdventure || isRental ? selectedPricingIndex : undefined,
|
|
544
|
+
selectedActivities: isPackage
|
|
545
|
+
? [
|
|
546
|
+
...compulsoryPackageActivities.map((activity) => ({
|
|
547
|
+
activityName: activity.name,
|
|
548
|
+
name: activity.name,
|
|
549
|
+
type: activity.type,
|
|
550
|
+
additionalPrice: activity.additionalPrice || 0,
|
|
551
|
+
})),
|
|
552
|
+
...optionalPackageActivities
|
|
553
|
+
.filter((activity) => selectedOptionalActivities.includes(activity.name))
|
|
554
|
+
.map((activity) => ({
|
|
555
|
+
activityName: activity.name,
|
|
556
|
+
name: activity.name,
|
|
557
|
+
type: activity.type,
|
|
558
|
+
additionalPrice: activity.additionalPrice || 0,
|
|
559
|
+
})),
|
|
560
|
+
]
|
|
561
|
+
: undefined,
|
|
562
|
+
males: isPackage ? males : undefined,
|
|
563
|
+
females: isPackage ? females : undefined,
|
|
564
|
+
};
|
|
565
|
+
const result = user
|
|
566
|
+
? await createBooking(bookingRequest)
|
|
567
|
+
: await (async () => {
|
|
568
|
+
try {
|
|
569
|
+
const data = await postGuestJson("/bookings/create", bookingRequest);
|
|
570
|
+
return {
|
|
571
|
+
success: true,
|
|
572
|
+
booking: data.data.booking,
|
|
573
|
+
razorpayOrderId: data.data.razorpayOrderId,
|
|
574
|
+
razorpayKeyId: data.data.razorpayKeyId,
|
|
575
|
+
amount: data.data.amount,
|
|
576
|
+
currency: data.data.currency,
|
|
577
|
+
message: data.message,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
return {
|
|
582
|
+
success: false,
|
|
583
|
+
booking: null,
|
|
584
|
+
error: error.message,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
})();
|
|
588
|
+
const createdBooking = result.booking;
|
|
589
|
+
if (result.success && !result.razorpayOrderId && (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.status) === "confirmed") {
|
|
590
|
+
sessionStorage.setItem(BOOKING_CONFIRMATION_STORAGE_KEY, JSON.stringify({
|
|
591
|
+
bookingId: createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking._id,
|
|
592
|
+
bookingCode: createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.bookingCode,
|
|
593
|
+
entityTitle: entity.title,
|
|
594
|
+
entityType: type,
|
|
595
|
+
currency: entityCurrency,
|
|
596
|
+
totalPrice: (_a = createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.totalPrice) !== null && _a !== void 0 ? _a : baseTotalPrice,
|
|
597
|
+
pickupPointName: (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.pickupPointName) || (selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.name),
|
|
598
|
+
pickupPointAddress: (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.pickupPointAddress) || (selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.address),
|
|
599
|
+
homeDeliverySelected: (_b = createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.homeDeliverySelected) !== null && _b !== void 0 ? _b : !!preHomeDeliverySelected,
|
|
600
|
+
homeDeliveryCharge: (_c = createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.homeDeliveryCharge) !== null && _c !== void 0 ? _c : deliveryCharge,
|
|
601
|
+
startDate: (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.startDate) || ((_d = formData.startDate) === null || _d === void 0 ? void 0 : _d.toISOString()),
|
|
602
|
+
endDate: (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.endDate) || ((_e = formData.endDate) === null || _e === void 0 ? void 0 : _e.toISOString()),
|
|
603
|
+
startTime: (createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.startTime) || formData.startTime,
|
|
604
|
+
numberOfPeople: (_f = createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking.numberOfPeople) !== null && _f !== void 0 ? _f : bookingRequest.numberOfPeople,
|
|
605
|
+
contactName: formData.name,
|
|
606
|
+
contactEmail: formData.email,
|
|
607
|
+
specialRequests: formData.specialRequests,
|
|
608
|
+
createdAt: Date.now(),
|
|
609
|
+
}));
|
|
610
|
+
router.push(`/booking/confirmed?bookingId=${(createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking._id) || ""}`);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
if (!result.success || !result.razorpayOrderId) {
|
|
614
|
+
setLoading(false);
|
|
615
|
+
await showAlert(result.error || "Failed to initiate booking");
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (!result.razorpayKeyId) {
|
|
619
|
+
setLoading(false);
|
|
620
|
+
await showAlert("Payment gateway is not configured. Please contact support.");
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const scriptLoaded = await loadRazorpayScript();
|
|
624
|
+
if (!scriptLoaded) {
|
|
625
|
+
setLoading(false);
|
|
626
|
+
await showAlert("Failed to load payment gateway. Please try again.");
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
const bookingId = createdBooking === null || createdBooking === void 0 ? void 0 : createdBooking._id;
|
|
630
|
+
const options = {
|
|
631
|
+
key: result.razorpayKeyId,
|
|
632
|
+
amount: ((_g = result.amount) !== null && _g !== void 0 ? _g : 0) * 100,
|
|
633
|
+
currency: result.currency || "INR",
|
|
634
|
+
name: "Trippeaze",
|
|
635
|
+
description: entity.title,
|
|
636
|
+
order_id: result.razorpayOrderId,
|
|
637
|
+
prefill: {
|
|
638
|
+
name: formData.name,
|
|
639
|
+
email: formData.email,
|
|
640
|
+
contact: formData.phone,
|
|
641
|
+
},
|
|
642
|
+
theme: { color: "#6366f1" },
|
|
643
|
+
retry: { enabled: false },
|
|
644
|
+
handler: async (response) => {
|
|
645
|
+
var _a, _b, _c, _d, _e, _f;
|
|
646
|
+
setLoading(true);
|
|
647
|
+
try {
|
|
648
|
+
const verifyPayload = {
|
|
649
|
+
bookingId,
|
|
650
|
+
razorpay_order_id: response.razorpay_order_id,
|
|
651
|
+
razorpay_payment_id: response.razorpay_payment_id,
|
|
652
|
+
razorpay_signature: response.razorpay_signature,
|
|
653
|
+
};
|
|
654
|
+
const verifyResult = user
|
|
655
|
+
? await verifyBookingPayment(verifyPayload)
|
|
656
|
+
: await (async () => {
|
|
657
|
+
try {
|
|
658
|
+
const data = await postGuestJson("/bookings/verify-payment", verifyPayload);
|
|
659
|
+
return {
|
|
660
|
+
success: true,
|
|
661
|
+
booking: data.data.booking,
|
|
662
|
+
message: data.message,
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
catch (error) {
|
|
666
|
+
return {
|
|
667
|
+
success: false,
|
|
668
|
+
booking: null,
|
|
669
|
+
error: error.message,
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
})();
|
|
673
|
+
if (verifyResult.success) {
|
|
674
|
+
const confirmedBooking = verifyResult.booking;
|
|
675
|
+
sessionStorage.setItem(BOOKING_CONFIRMATION_STORAGE_KEY, JSON.stringify({
|
|
676
|
+
bookingId: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking._id) || bookingId,
|
|
677
|
+
bookingCode: confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.bookingCode,
|
|
678
|
+
entityTitle: entity.title,
|
|
679
|
+
entityType: type,
|
|
680
|
+
currency: entityCurrency,
|
|
681
|
+
totalPrice: (_a = confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.totalPrice) !== null && _a !== void 0 ? _a : baseTotalPrice,
|
|
682
|
+
pickupPointName: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.pickupPointName) || (selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.name),
|
|
683
|
+
pickupPointAddress: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.pickupPointAddress) || (selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.address),
|
|
684
|
+
homeDeliverySelected: (_b = confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.homeDeliverySelected) !== null && _b !== void 0 ? _b : !!preHomeDeliverySelected,
|
|
685
|
+
homeDeliveryCharge: (_c = confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.homeDeliveryCharge) !== null && _c !== void 0 ? _c : deliveryCharge,
|
|
686
|
+
startDate: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.startDate) || ((_d = formData.startDate) === null || _d === void 0 ? void 0 : _d.toISOString()),
|
|
687
|
+
endDate: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.endDate) || ((_e = formData.endDate) === null || _e === void 0 ? void 0 : _e.toISOString()),
|
|
688
|
+
startTime: (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.startTime) || formData.startTime,
|
|
689
|
+
numberOfPeople: (_f = confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.numberOfPeople) !== null && _f !== void 0 ? _f : bookingRequest.numberOfPeople,
|
|
690
|
+
contactName: formData.name,
|
|
691
|
+
contactEmail: formData.email,
|
|
692
|
+
specialRequests: formData.specialRequests,
|
|
693
|
+
createdAt: Date.now(),
|
|
694
|
+
}));
|
|
695
|
+
await showAlert(`Booking confirmed! A confirmation email has been sent to ${formData.email}. Booking ID: ${bookingId === null || bookingId === void 0 ? void 0 : bookingId.slice(-8).toUpperCase()}`, "Payment Successful");
|
|
696
|
+
const query = new URLSearchParams();
|
|
697
|
+
if ((confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking._id) || bookingId)
|
|
698
|
+
query.set("bookingId", (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking._id) || bookingId);
|
|
699
|
+
if (confirmedBooking === null || confirmedBooking === void 0 ? void 0 : confirmedBooking.bookingCode)
|
|
700
|
+
query.set("bookingCode", confirmedBooking.bookingCode);
|
|
701
|
+
router.push(`/book/confirmed?${query.toString()}`);
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
await showAlert(verifyResult.error || "Payment verification failed. Please contact support.");
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
finally {
|
|
708
|
+
setLoading(false);
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
modal: {
|
|
712
|
+
ondismiss: () => setLoading(false),
|
|
713
|
+
},
|
|
714
|
+
};
|
|
715
|
+
const rzp = new window.Razorpay(options);
|
|
716
|
+
rzp.on("payment.failed", async (response) => {
|
|
717
|
+
var _a;
|
|
718
|
+
try {
|
|
719
|
+
rzp.close();
|
|
720
|
+
}
|
|
721
|
+
catch (_b) { }
|
|
722
|
+
setLoading(false);
|
|
723
|
+
await showAlert(`Payment failed: ${((_a = response.error) === null || _a === void 0 ? void 0 : _a.description) || "Unknown error"}`, "Payment Failed");
|
|
724
|
+
});
|
|
725
|
+
rzp.open();
|
|
726
|
+
// loading stays true until handler/ondismiss fires
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
catch (error) {
|
|
730
|
+
await showAlert(error.message || "An unexpected error occurred");
|
|
731
|
+
setLoading(false);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
const handleSubmit = (e) => {
|
|
735
|
+
var _a, _b;
|
|
736
|
+
e.preventDefault();
|
|
737
|
+
if (!user) {
|
|
738
|
+
sessionStorage.setItem(DRAFT_KEY, JSON.stringify({
|
|
739
|
+
...formData,
|
|
740
|
+
startDate: (_a = formData.startDate) === null || _a === void 0 ? void 0 : _a.toISOString(),
|
|
741
|
+
endDate: (_b = formData.endDate) === null || _b === void 0 ? void 0 : _b.toISOString(),
|
|
742
|
+
}));
|
|
743
|
+
setShowGuestDialog(true);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
proceedWithSubmit();
|
|
747
|
+
};
|
|
748
|
+
return (_jsxs("form", { id: "booking-form", onSubmit: handleSubmit, className: "space-y-8", children: [_jsx(GuestOrLoginDialog, { open: showGuestDialog, onClose: () => setShowGuestDialog(false), onContinueAsGuest: proceedWithSubmit }), !user && (_jsxs("div", { className: "rounded-2xl border border-amber-200 bg-amber-50 px-4 py-4 text-sm text-amber-900", children: [_jsx("p", { className: "font-bold", children: "You can continue as a guest or log in." }), _jsx("p", { className: "mt-1 leading-6 text-amber-800", children: "Choose your date and time first. If you continue without logging in, we will ask for your contact details before payment." })] })), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-100", children: [_jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-sm", children: "1" }), _jsx("h3", { className: "font-bold text-slate-800", children: isRental ? "Rental Details" : isStay ? "Stay Details" : isPackage ? "Package Details" : "Activity Details" })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [isPackage && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "space-y-2", children: [_jsx(DatePicker, { label: "Trip Start Date", field: {
|
|
749
|
+
value: formData.startDate || null,
|
|
750
|
+
onChange: (date) => {
|
|
751
|
+
setFormData((prev) => ({
|
|
752
|
+
...prev,
|
|
753
|
+
startDate: date !== null && date !== void 0 ? date : undefined,
|
|
754
|
+
endDate: undefined,
|
|
755
|
+
}));
|
|
756
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(date !== null && date !== void 0 ? date : null, null);
|
|
757
|
+
},
|
|
758
|
+
}, minDate: new Date(), availableDateKeys: packageAvailableDateKeys }), _jsx("p", { className: "text-xs font-semibold text-slate-400", children: "Dates are based on package frequency and remaining group capacity." })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Pricing Plan" }), _jsxs(Select, { value: String(selectedPricingIndex), onValueChange: (val) => setSelectedPricingIndex(Number.parseInt(val, 10) || 0), children: [_jsx(SelectTrigger, { className: "w-full bg-slate-50 border-slate-200", children: _jsx(SelectValue, { placeholder: "Select pricing plan" }) }), _jsx(SelectContent, { children: packagePricing.map((plan, index) => (_jsx(SelectItem, { value: String(index), children: plan.description || `Plan ${index + 1}` }, `${plan.description || "plan"}-${index}`))) })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "packageMales", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Male Travellers" }), _jsx(EditableNumberInput, { id: "packageMales", className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", value: males, onValueChange: setMales })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "packageFemales", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Female Travellers" }), _jsx(EditableNumberInput, { id: "packageFemales", className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", value: females, onValueChange: setFemales })] }), (compulsoryPackageActivities.length > 0 || optionalPackageActivities.length > 0) && (_jsxs("div", { className: "md:col-span-2 space-y-4 rounded-2xl border border-slate-200 bg-slate-50 p-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Activities" }), _jsx("p", { className: "text-sm text-slate-600 mt-1", children: "Compulsory activities are included automatically. Optional activities are charged per traveller." })] }), compulsoryPackageActivities.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-semibold text-slate-800", children: "Included Activities" }), _jsx("div", { className: "flex flex-wrap gap-2", children: compulsoryPackageActivities.map((activity) => (_jsx("span", { className: "rounded-full bg-emerald-100 px-3 py-1 text-xs font-semibold text-emerald-700", children: activity.name }, activity.name))) })] })), optionalPackageActivities.length > 0 && (_jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-sm font-semibold text-slate-800", children: "Optional Add-ons" }), optionalPackageActivities.map((activity) => {
|
|
759
|
+
const checked = selectedOptionalActivities.includes(activity.name);
|
|
760
|
+
return (_jsxs("label", { className: `flex cursor-pointer select-none items-start gap-3 rounded-2xl border-2 p-4 transition-all duration-200 ${checked
|
|
761
|
+
? "border-emerald-300 bg-emerald-50/40"
|
|
762
|
+
: "border-slate-200 bg-white hover:border-primary/40"}`, children: [_jsxs("span", { className: "relative mt-0.5 shrink-0", children: [_jsx("input", { type: "checkbox", checked: checked, onChange: () => setSelectedOptionalActivities((prev) => checked ? prev.filter((name) => name !== activity.name) : [...prev, activity.name]), className: "sr-only peer" }), _jsx("span", { className: `flex h-5 w-5 items-center justify-center rounded-md border-2 transition-all duration-200 ${checked
|
|
763
|
+
? "border-emerald-500 bg-emerald-500"
|
|
764
|
+
: "border-slate-300 bg-white"}`, children: checked && (_jsx("svg", { className: "h-3 w-3 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })) })] }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "font-semibold text-slate-900", children: activity.name }), _jsx("p", { className: "text-xs text-slate-500", children: toNonNegativeAmount(activity.additionalPrice) > 0
|
|
765
|
+
? `+ ${(entityCurrency || "INR").toUpperCase()} ${toNonNegativeAmount(activity.additionalPrice).toLocaleString()} per traveller`
|
|
766
|
+
: "Included" })] })] }, activity.name));
|
|
767
|
+
})] }))] }))] })), isRental && (selectedPickupPoint || preHomeDeliverySelected) && (_jsx("div", { className: "md:col-span-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600", children: preHomeDeliverySelected
|
|
768
|
+
? `Delivery mode: Home delivery${deliveryCharge > 0 ? ` (+${deliveryCharge} ${entityCurrency})` : ""}`
|
|
769
|
+
: `Pickup point: ${(selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.address) || (selectedPickupPoint === null || selectedPickupPoint === void 0 ? void 0 : selectedPickupPoint.name) || "Selected pickup point"}` })), (isRental || isStay) && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(DatePicker, { label: isStay ? "Check-in Date" : "Pickup Date", field: {
|
|
770
|
+
value: formData.startDate || null,
|
|
771
|
+
onChange: (date) => {
|
|
772
|
+
var _a;
|
|
773
|
+
setFormData((prev) => ({ ...prev, startDate: date !== null && date !== void 0 ? date : undefined }));
|
|
774
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(date !== null && date !== void 0 ? date : null, (_a = formData.endDate) !== null && _a !== void 0 ? _a : null);
|
|
775
|
+
},
|
|
776
|
+
}, minDate: new Date() }) }), isRental && (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Pickup Time" }), _jsxs(Select, { value: formData.pickupTime, onValueChange: (val) => setFormData((prev) => ({ ...prev, pickupTime: val })), children: [_jsx(SelectTrigger, { className: "w-full bg-slate-50 border-slate-200", children: _jsx(SelectValue, { placeholder: "Time" }) }), _jsx(SelectContent, { children: TIME_SLOTS.map((t) => (_jsx(SelectItem, { value: t, children: t }, t))) })] })] }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(DatePicker, { label: isStay ? "Check-out Date" : "Drop Date", field: {
|
|
777
|
+
value: formData.endDate || null,
|
|
778
|
+
onChange: (date) => {
|
|
779
|
+
var _a;
|
|
780
|
+
setFormData((prev) => ({ ...prev, endDate: date !== null && date !== void 0 ? date : undefined }));
|
|
781
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange((_a = formData.startDate) !== null && _a !== void 0 ? _a : null, date !== null && date !== void 0 ? date : null);
|
|
782
|
+
},
|
|
783
|
+
}, minDate: formData.startDate || new Date() }) }), isRental && (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Drop Time" }), _jsxs(Select, { value: formData.returnTime, onValueChange: (val) => setFormData((prev) => ({ ...prev, returnTime: val })), children: [_jsx(SelectTrigger, { className: "w-full bg-slate-50 border-slate-200", children: _jsx(SelectValue, { placeholder: "Time" }) }), _jsx(SelectContent, { children: TIME_SLOTS.map((t) => (_jsx(SelectItem, { value: t, children: t }, t))) })] })] }))] })] })), !(isRental || isStay || isPackage) && (_jsxs(_Fragment, { children: [isAdventure && packagePricing.length > 1 && (_jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Pricing Option" }), _jsxs(Select, { value: String(selectedPricingIndex), onValueChange: (val) => setSelectedPricingIndex(parseInt(val, 10) || 0), children: [_jsx(SelectTrigger, { className: "w-full bg-slate-50 border-slate-200", children: _jsx(SelectValue, { placeholder: "Select pricing option" }) }), _jsx(SelectContent, { children: packagePricing.map((plan, index) => (_jsx(SelectItem, { value: String(index), children: plan.description || `Pricing ${index + 1}` }, `${plan.description || "plan"}-${index}`))) })] })] })), _jsx("div", { className: "space-y-2", children: isEvent ? (_jsxs(_Fragment, { children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Event Date" }), _jsx(Input, { value: formData.startDate ? formData.startDate.toLocaleDateString("en-IN", { day: "numeric", month: "short", year: "numeric" }) : "", disabled: true, className: "bg-slate-50 border-slate-200" })] })) : (_jsxs("div", { className: "space-y-2", children: [_jsx(DatePicker, { label: "Activity Date", field: {
|
|
784
|
+
value: formData.startDate || null,
|
|
785
|
+
onChange: (date) => {
|
|
786
|
+
const nextDate = date || undefined;
|
|
787
|
+
const nextDateKey = nextDate ? formatDateKey(nextDate) : "";
|
|
788
|
+
const nextDaySlots = configuredAdventureSlots.filter((slot) => slot.dateKey === nextDateKey &&
|
|
789
|
+
slot.isBookable &&
|
|
790
|
+
!blockedAdventureDateKeys.has(slot.dateKey));
|
|
791
|
+
setFormData((prev) => {
|
|
792
|
+
var _a, _b;
|
|
793
|
+
return ({
|
|
794
|
+
...prev,
|
|
795
|
+
startDate: nextDate,
|
|
796
|
+
startTime: isAdventure && configuredAdventureSlots.length
|
|
797
|
+
? ((_a = nextDaySlots.find((slot) => slot.startTime === prev.startTime)) === null || _a === void 0 ? void 0 : _a.startTime) ||
|
|
798
|
+
((_b = nextDaySlots[0]) === null || _b === void 0 ? void 0 : _b.startTime) ||
|
|
799
|
+
""
|
|
800
|
+
: prev.startTime || opStart,
|
|
801
|
+
});
|
|
802
|
+
});
|
|
803
|
+
onDatesChange === null || onDatesChange === void 0 ? void 0 : onDatesChange(date !== null && date !== void 0 ? date : null, null);
|
|
804
|
+
},
|
|
805
|
+
}, minDate: new Date(), availableDateKeys: isAdventure ? availableAdventureDateKeys : undefined }), isAdventure && (_jsx("div", { className: "rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm leading-6 text-slate-600", children: availableAdventureDateKeys.length <= 0
|
|
806
|
+
? "No upcoming bookable slots are configured for this adventure yet."
|
|
807
|
+
: selectedAdventureDateKey && bookableAdventureSlots.length > 0
|
|
808
|
+
? `${bookableAdventureSlots.length} slot${bookableAdventureSlots.length > 1 ? "s are" : " is"} open for ${(_g = formData.startDate) === null || _g === void 0 ? void 0 : _g.toLocaleDateString("en-IN", { day: "numeric", month: "short", year: "numeric" })}.`
|
|
809
|
+
: "Choose an available date to see open time slots." }))] })) }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: isEvent ? "Event Time" : "Preferred Time" }), isEvent ? (_jsx(Input, { value: formData.startTime, disabled: true, className: "bg-slate-50 border-slate-200" })) : (_jsxs(Select, { value: formData.startTime, onValueChange: (val) => setFormData((prev) => ({ ...prev, startTime: val })), disabled: isAdventure && !bookableAdventureSlots.length, children: [_jsx(SelectTrigger, { className: "w-full bg-slate-50 border-slate-200", children: _jsx(SelectValue, { placeholder: "Time" }) }), _jsx(SelectContent, { children: (isAdventure ? bookableAdventureSlots : TIME_SLOTS).map((slotOrTime) => {
|
|
810
|
+
const value = isAdventure ? slotOrTime.startTime : slotOrTime;
|
|
811
|
+
const label = isAdventure
|
|
812
|
+
? `${slotOrTime.startTime}${slotOrTime.endTime ? ` - ${slotOrTime.endTime}` : ""}`
|
|
813
|
+
: slotOrTime;
|
|
814
|
+
return (_jsx(SelectItem, { value: value, children: label }, value));
|
|
815
|
+
}) })] })), isAdventure && selectedAdventureSlot && (_jsxs("div", { className: "rounded-2xl border border-primary/10 bg-primary/5 px-4 py-3 text-xs leading-5 text-slate-700", children: [selectedAdventureSlot.remainingCapacity, " of", " ", selectedAdventureSlot.maxParticipants, " spots left for this slot", selectedAdventureSlot.endTime
|
|
816
|
+
? ` until ${selectedAdventureSlot.endTime}`
|
|
817
|
+
: "", "."] }))] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "numberOfPeople", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Persons" }), _jsx(EditableNumberInput, { id: "numberOfPeople", name: "numberOfPeople", required: true, className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", min: 1, value: Number(formData.numberOfPeople) || 1, onValueChange: (value) => setFormData((prev) => ({ ...prev, numberOfPeople: value })) })] })] })] }))] })] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-100", children: [_jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-sm", children: "2" }), _jsx("h3", { className: "font-bold text-slate-800", children: "Your Information" })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "name", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Full Name" }), _jsx(Input, { id: "name", name: "name", placeholder: "John Doe", required: true, className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", value: formData.name, onChange: handleChange })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "email", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Email Address" }), _jsx(Input, { id: "email", name: "email", type: "email", placeholder: "john@example.com", required: true, className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", value: formData.email, onChange: handleChange })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "phone", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Phone Number" }), _jsx(Input, { id: "phone", name: "phone", placeholder: "+91 9876543210", required: true, className: "bg-slate-50 border-slate-200 focus:bg-white transition-all", value: formData.phone, onChange: handleChange })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-100", children: [_jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-sm", children: "3" }), _jsx("h3", { className: "font-bold text-slate-800", children: "Additional Requests" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "specialRequests", className: "text-xs font-semibold uppercase tracking-wider text-slate-500", children: "Special Instructions (Optional)" }), _jsx(Textarea, { id: "specialRequests", name: "specialRequests", placeholder: "Any specific requirements or questions?", className: "bg-slate-50 border-slate-200 focus:bg-white transition-all min-h-[100px]", value: formData.specialRequests, onChange: handleChange })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-100", children: [_jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary font-bold text-sm", children: "4" }), _jsx("h3", { className: "font-bold text-slate-800", children: "Terms & Conditions" })] }), _jsxs("div", { className: `relative rounded-2xl border-2 p-5 transition-all duration-200 ${termsAccepted
|
|
818
|
+
? "border-emerald-300 bg-emerald-50/40"
|
|
819
|
+
: "border-slate-200 bg-slate-50/50"}`, children: [_jsxs("div", { className: "mb-4 text-xs text-slate-500 leading-relaxed space-y-2 max-h-28 overflow-y-auto pr-1 scrollbar-thin", children: [_jsxs("p", { className: "font-semibold text-slate-700 text-sm flex items-center gap-2", children: [_jsx(FileText, { className: "w-4 h-4 text-primary shrink-0" }), "Booking Terms Summary"] }), _jsxs("p", { children: ["\u2022 ", isAdventure || isEvent
|
|
820
|
+
? "Your reservation is confirmed after successful payment if the selected slot is still available."
|
|
821
|
+
: "Your booking confirmation depends on the selected listing and payment completion."] }), _jsxs("p", { children: ["\u2022 Cancellations made 48 hours before the start date may be eligible for a partial refund per our ", _jsx("a", { href: "/terms#cancellation", target: "_blank", className: "text-primary underline", children: "Cancellation Policy" }), "."] }), isRental && (_jsxs(_Fragment, { children: [_jsx("p", { children: "\u2022 A valid driving license must be shown during vehicle pickup." }), _jsx("p", { children: "\u2022 Record a short video of the vehicle condition during pickup before starting the ride." })] })), _jsx("p", { children: "\u2022 By confirming, you agree that the information provided is accurate and truthful." }), _jsx("p", { children: "\u2022 Trippeaze acts as a platform; the host is responsible for delivering the booked experience." }), _jsx("p", { children: "\u2022 In case of any dispute, Trippeaze's decision shall be final and binding." })] }), _jsxs("label", { htmlFor: "terms-checkbox", className: "flex items-start gap-3 cursor-pointer group select-none", children: [_jsxs("div", { className: "relative mt-0.5 shrink-0", children: [_jsx("input", { id: "terms-checkbox", type: "checkbox", checked: termsAccepted, onChange: (e) => setTermsAccepted(e.target.checked), className: "sr-only peer" }), _jsx("div", { className: `w-5 h-5 rounded-md border-2 flex items-center justify-center transition-all duration-200 ${termsAccepted
|
|
822
|
+
? "bg-emerald-500 border-emerald-500"
|
|
823
|
+
: "border-slate-300 bg-white group-hover:border-primary"}`, children: termsAccepted && (_jsx("svg", { className: "w-3 h-3 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })) })] }), _jsxs("span", { className: "text-sm text-slate-700 leading-snug", children: ["I have read and agree to the", " ", _jsxs("a", { href: "/terms", target: "_blank", rel: "noopener noreferrer", className: "text-primary font-semibold hover:underline inline-flex items-center gap-0.5", onClick: (e) => e.stopPropagation(), children: ["Terms & Conditions", _jsx(ExternalLink, { className: "w-3 h-3" })] }), " ", "and", " ", _jsxs("a", { href: "/privacy", target: "_blank", rel: "noopener noreferrer", className: "text-primary font-semibold hover:underline inline-flex items-center gap-0.5", onClick: (e) => e.stopPropagation(), children: ["Privacy Policy", _jsx(ExternalLink, { className: "w-3 h-3" })] }), ". I understand the cancellation and refund terms."] })] }), !termsAccepted && (_jsxs("p", { className: "mt-3 text-[11px] text-amber-600 font-semibold flex items-center gap-1.5", children: [_jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-amber-500 shrink-0" }), "You must accept the terms before proceeding to payment."] }))] })] })] }));
|
|
824
|
+
}
|