more-apartments-astro-integration 1.4.0 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -107,7 +107,7 @@ declare const PropertySchema: z.ZodObject<{
107
107
  zipcode: z.ZodNullable<z.ZodString>;
108
108
  area: z.ZodNullable<z.ZodString>;
109
109
  city: z.ZodString;
110
- country: z.ZodString;
110
+ country: z.ZodNullable<z.ZodString>;
111
111
  latitude: z.ZodNumber;
112
112
  longitude: z.ZodNumber;
113
113
  single_bed: z.ZodNullable<z.ZodNumber>;
@@ -231,7 +231,7 @@ declare const PropertySearchResultSchema: z.ZodObject<{
231
231
  zipcode: z.ZodNullable<z.ZodString>;
232
232
  area: z.ZodNullable<z.ZodString>;
233
233
  city: z.ZodString;
234
- country: z.ZodString;
234
+ country: z.ZodNullable<z.ZodString>;
235
235
  latitude: z.ZodNumber;
236
236
  longitude: z.ZodNumber;
237
237
  single_bed: z.ZodNullable<z.ZodNumber>;
@@ -516,47 +516,294 @@ type ThemeSettings = z.infer<typeof ThemeSettingsSchema>;
516
516
  type PropertySettings = z.infer<typeof PropertySettingsSchema>;
517
517
  type BookingSettings = z.infer<typeof BookingSettingsSchema>;
518
518
 
519
- declare const BookingRequestSchema: z.ZodObject<{
519
+ /**
520
+ * Booking-related types and schemas for the 3-step booking wizard
521
+ */
522
+ type BookingStatus = 'pending_details' | 'waiting_payment' | 'fresh' | 'confirmed' | 'cancelled' | 'completed';
523
+ type PaymentMethod = 'stripe' | 'bank_transfer' | 'cash';
524
+ interface BookingDraftRequest {
525
+ property_id: number;
526
+ arrival: string;
527
+ departure: string;
528
+ amount_adults: number;
529
+ amount_children: number;
530
+ }
531
+ interface BookingDraftResponse {
532
+ uuid: string;
533
+ status: 'pending_details';
534
+ property_id: number;
535
+ arrival: string;
536
+ departure: string;
537
+ amount_adults: number;
538
+ amount_children: number;
539
+ total_price: number;
540
+ nights: number;
541
+ expires_at: string;
542
+ created_at: string;
543
+ updated_at: string;
544
+ }
545
+ interface PersonalInfoRequest {
546
+ first_name: string;
547
+ last_name: string;
548
+ email: string;
549
+ phone: string;
550
+ address_1: string;
551
+ address_2?: string;
552
+ postal_code?: string;
553
+ city: string;
554
+ country: string;
555
+ }
556
+ interface BookingDetailsRequest {
557
+ time_arrival: string;
558
+ flight?: string;
559
+ notes?: string;
560
+ }
561
+ interface ReviewRequest {
562
+ terms_accepted: boolean;
563
+ marketing_consent?: boolean;
564
+ }
565
+ interface PriceBreakdown {
566
+ base_price: number;
567
+ cleaning_fee: number;
568
+ tourist_tax: number;
569
+ vat: number;
570
+ total: number;
571
+ }
572
+ interface PropertySummary {
573
+ id: number;
574
+ name: string;
575
+ slug: string;
576
+ city: string;
577
+ image: string;
578
+ max_guests: number;
579
+ }
580
+ interface BookingResponse {
581
+ uuid: string;
582
+ status: BookingStatus;
583
+ property_id: number;
584
+ property?: PropertySummary;
585
+ arrival: string;
586
+ departure: string;
587
+ amount_adults: number;
588
+ amount_children: number;
589
+ first_name?: string;
590
+ last_name?: string;
591
+ email?: string;
592
+ phone?: string;
593
+ address_1?: string;
594
+ address_2?: string;
595
+ postal_code?: string;
596
+ city?: string;
597
+ country?: string;
598
+ time_arrival?: string;
599
+ flight?: string;
600
+ notes?: string;
601
+ terms_accepted?: boolean;
602
+ marketing_consent?: boolean;
603
+ total_price: number;
604
+ price_breakdown?: PriceBreakdown;
605
+ nights: number;
606
+ expires_at: string;
607
+ created_at: string;
608
+ updated_at: string;
609
+ }
610
+ interface BookingConfirmResponse {
611
+ message: string;
612
+ data: {
613
+ uuid: string;
614
+ status: BookingStatus;
615
+ property_id: number;
616
+ arrival: string;
617
+ departure: string;
618
+ first_name: string;
619
+ last_name: string;
620
+ email: string;
621
+ phone: string;
622
+ address_1: string;
623
+ address_2?: string;
624
+ postal_code?: string;
625
+ city: string;
626
+ country: string;
627
+ amount_adults: number;
628
+ amount_children: number;
629
+ time_arrival: string;
630
+ flight?: string;
631
+ notes?: string;
632
+ external_id?: string;
633
+ identifier?: string;
634
+ balance_due: number;
635
+ created_at: string;
636
+ updated_at: string;
637
+ };
638
+ stripe_url?: string;
639
+ }
640
+ declare const BookingDraftRequestSchema: z.ZodObject<{
520
641
  property_id: z.ZodNumber;
521
- check_in: z.ZodString;
522
- check_out: z.ZodString;
523
- guests: z.ZodNumber;
642
+ arrival: z.ZodString;
643
+ departure: z.ZodString;
644
+ amount_adults: z.ZodNumber;
645
+ amount_children: z.ZodNumber;
646
+ }, z.core.$strip>;
647
+ declare const BookingDraftResponseSchema: z.ZodObject<{
648
+ uuid: z.ZodString;
649
+ status: z.ZodLiteral<"pending_details">;
650
+ property_id: z.ZodNumber;
651
+ arrival: z.ZodString;
652
+ departure: z.ZodString;
653
+ amount_adults: z.ZodNumber;
654
+ amount_children: z.ZodNumber;
655
+ total_price: z.ZodNumber;
656
+ nights: z.ZodNumber;
657
+ expires_at: z.ZodString;
658
+ created_at: z.ZodString;
659
+ updated_at: z.ZodString;
660
+ }, z.core.$strip>;
661
+ declare const PersonalInfoRequestSchema: z.ZodObject<{
524
662
  first_name: z.ZodString;
525
663
  last_name: z.ZodString;
526
664
  email: z.ZodString;
527
- phone: z.ZodOptional<z.ZodString>;
665
+ phone: z.ZodString;
666
+ address_1: z.ZodString;
667
+ address_2: z.ZodOptional<z.ZodString>;
668
+ postal_code: z.ZodOptional<z.ZodString>;
669
+ city: z.ZodString;
670
+ country: z.ZodString;
671
+ }, z.core.$strip>;
672
+ declare const BookingDetailsRequestSchema: z.ZodObject<{
673
+ time_arrival: z.ZodString;
674
+ flight: z.ZodOptional<z.ZodString>;
528
675
  notes: z.ZodOptional<z.ZodString>;
529
- total_amount: z.ZodNumber;
530
- payment_method: z.ZodOptional<z.ZodEnum<{
531
- stripe: "stripe";
532
- cash: "cash";
533
- bank_transfer: "bank_transfer";
534
- }>>;
535
676
  }, z.core.$strip>;
536
- declare const BookingResponseSchema: z.ZodObject<{
537
- id: z.ZodString;
677
+ declare const ReviewRequestSchema: z.ZodObject<{
678
+ terms_accepted: z.ZodBoolean;
679
+ marketing_consent: z.ZodOptional<z.ZodBoolean>;
680
+ }, z.core.$strip>;
681
+ declare const PropertySummarySchema: z.ZodObject<{
682
+ id: z.ZodNumber;
683
+ name: z.ZodString;
684
+ slug: z.ZodString;
685
+ city: z.ZodString;
686
+ image: z.ZodString;
687
+ max_guests: z.ZodNumber;
688
+ }, z.core.$strip>;
689
+ declare const PriceBreakdownSchema: z.ZodObject<{
690
+ base_price: z.ZodNumber;
691
+ cleaning_fee: z.ZodNumber;
692
+ tourist_tax: z.ZodNumber;
693
+ vat: z.ZodNumber;
694
+ total: z.ZodNumber;
695
+ }, z.core.$strip>;
696
+ interface BookingPricingResponse {
697
+ uuid: string;
698
+ property_id: number;
699
+ arrival: string;
700
+ departure: string;
701
+ amount_adults: number;
702
+ amount_children: number;
703
+ nights: number;
704
+ total_price: number;
705
+ price_per_night: number;
706
+ currency: string;
707
+ }
708
+ declare const BookingPricingResponseSchema: z.ZodObject<{
709
+ uuid: z.ZodString;
538
710
  property_id: z.ZodNumber;
539
- check_in: z.ZodString;
540
- check_out: z.ZodString;
541
- guests: z.ZodNumber;
711
+ arrival: z.ZodString;
712
+ departure: z.ZodString;
713
+ amount_adults: z.ZodNumber;
714
+ amount_children: z.ZodNumber;
715
+ nights: z.ZodNumber;
716
+ total_price: z.ZodNumber;
717
+ price_per_night: z.ZodNumber;
718
+ currency: z.ZodString;
719
+ }, z.core.$strip>;
720
+ declare const BookingResponseSchema: z.ZodObject<{
721
+ uuid: z.ZodString;
542
722
  status: z.ZodEnum<{
543
- pending: "pending";
723
+ pending_details: "pending_details";
724
+ waiting_payment: "waiting_payment";
725
+ fresh: "fresh";
544
726
  confirmed: "confirmed";
545
727
  cancelled: "cancelled";
546
728
  completed: "completed";
547
729
  }>;
548
- total_amount: z.ZodNumber;
549
- payment_status: z.ZodEnum<{
550
- pending: "pending";
551
- paid: "paid";
552
- refunded: "refunded";
553
- }>;
554
- confirmation_code: z.ZodString;
730
+ property_id: z.ZodNumber;
731
+ property: z.ZodOptional<z.ZodObject<{
732
+ id: z.ZodNumber;
733
+ name: z.ZodString;
734
+ slug: z.ZodString;
735
+ city: z.ZodString;
736
+ image: z.ZodString;
737
+ max_guests: z.ZodNumber;
738
+ }, z.core.$strip>>;
739
+ arrival: z.ZodString;
740
+ departure: z.ZodString;
741
+ amount_adults: z.ZodNumber;
742
+ amount_children: z.ZodNumber;
743
+ first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
744
+ last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
745
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
746
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
747
+ address_1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
748
+ address_2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
749
+ postal_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
750
+ city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
751
+ country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
752
+ time_arrival: z.ZodOptional<z.ZodNullable<z.ZodString>>;
753
+ flight: z.ZodOptional<z.ZodNullable<z.ZodString>>;
754
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
755
+ terms_accepted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
756
+ marketing_consent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
757
+ total_price: z.ZodNumber;
758
+ price_breakdown: z.ZodOptional<z.ZodObject<{
759
+ base_price: z.ZodNumber;
760
+ cleaning_fee: z.ZodNumber;
761
+ tourist_tax: z.ZodNumber;
762
+ vat: z.ZodNumber;
763
+ total: z.ZodNumber;
764
+ }, z.core.$strip>>;
765
+ nights: z.ZodNumber;
766
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
555
767
  created_at: z.ZodString;
556
768
  updated_at: z.ZodString;
557
769
  }, z.core.$strip>;
558
- type BookingRequest = z.infer<typeof BookingRequestSchema>;
559
- type BookingResponse = z.infer<typeof BookingResponseSchema>;
770
+ declare const BookingConfirmResponseSchema: z.ZodObject<{
771
+ message: z.ZodString;
772
+ data: z.ZodObject<{
773
+ uuid: z.ZodString;
774
+ status: z.ZodEnum<{
775
+ pending_details: "pending_details";
776
+ waiting_payment: "waiting_payment";
777
+ fresh: "fresh";
778
+ confirmed: "confirmed";
779
+ cancelled: "cancelled";
780
+ completed: "completed";
781
+ }>;
782
+ property_id: z.ZodNumber;
783
+ arrival: z.ZodString;
784
+ departure: z.ZodString;
785
+ first_name: z.ZodString;
786
+ last_name: z.ZodString;
787
+ email: z.ZodString;
788
+ phone: z.ZodString;
789
+ address_1: z.ZodString;
790
+ address_2: z.ZodOptional<z.ZodString>;
791
+ postal_code: z.ZodOptional<z.ZodString>;
792
+ city: z.ZodString;
793
+ country: z.ZodString;
794
+ amount_adults: z.ZodNumber;
795
+ amount_children: z.ZodNumber;
796
+ time_arrival: z.ZodString;
797
+ flight: z.ZodOptional<z.ZodString>;
798
+ notes: z.ZodOptional<z.ZodString>;
799
+ external_id: z.ZodOptional<z.ZodString>;
800
+ identifier: z.ZodOptional<z.ZodString>;
801
+ balance_due: z.ZodNumber;
802
+ created_at: z.ZodString;
803
+ updated_at: z.ZodString;
804
+ }, z.core.$strip>;
805
+ stripe_url: z.ZodOptional<z.ZodString>;
806
+ }, z.core.$strip>;
560
807
 
561
808
  declare const MoreApartmentsConfigSchema: z.ZodObject<{
562
809
  baseUrl: z.ZodOptional<z.ZodString>;
@@ -624,8 +871,52 @@ declare class MoreApartmentsClient {
624
871
  getThemeSettings(): Promise<ThemeSettings>;
625
872
  getPropertySettings(): Promise<PropertySettings>;
626
873
  getBookingSettings(): Promise<BookingSettings>;
627
- createBooking(booking: BookingRequest): Promise<BookingResponse>;
628
- getBooking(bookingId: string): Promise<BookingResponse>;
874
+ /**
875
+ * Create a booking draft with property and dates
876
+ * @param data Draft booking data (property, dates, guests)
877
+ * @returns BookingDraftResponse with UUID and status
878
+ */
879
+ createBookingDraft(data: BookingDraftRequest): Promise<BookingDraftResponse>;
880
+ /**
881
+ * Update booking with personal information (Step 1)
882
+ * @param uuid Booking UUID
883
+ * @param data Personal info (name, email, phone, address)
884
+ * @returns Updated BookingResponse
885
+ */
886
+ updateBookingStep1(uuid: string, data: PersonalInfoRequest): Promise<BookingResponse>;
887
+ /**
888
+ * Update booking with arrival details (Step 2)
889
+ * @param uuid Booking UUID
890
+ * @param data Arrival time, flight, notes
891
+ * @returns Updated BookingResponse
892
+ */
893
+ updateBookingStep2(uuid: string, data: BookingDetailsRequest): Promise<BookingResponse>;
894
+ /**
895
+ * Update booking with review data (Step 3)
896
+ * @param uuid Booking UUID
897
+ * @param data Terms acceptance, marketing consent
898
+ * @returns Updated BookingResponse with price breakdown
899
+ */
900
+ updateBookingStep3(uuid: string, data: ReviewRequest): Promise<BookingResponse>;
901
+ /**
902
+ * Confirm booking and get payment URL
903
+ * @param uuid Booking UUID
904
+ * @param paymentMethod Payment method (stripe, bank_transfer, cash)
905
+ * @returns Confirmation response with payment URL
906
+ */
907
+ confirmBooking(uuid: string, paymentMethod?: PaymentMethod): Promise<BookingConfirmResponse>;
908
+ /**
909
+ * Get current booking state
910
+ * @param uuid Booking UUID
911
+ * @returns Full BookingResponse with all data
912
+ */
913
+ getBookingState(uuid: string): Promise<BookingResponse>;
914
+ /**
915
+ * Get pricing details for a booking
916
+ * @param uuid Booking UUID
917
+ * @returns Pricing breakdown with total, per-night rate, and currency
918
+ */
919
+ getPricing(uuid: string): Promise<BookingPricingResponse>;
629
920
  /**
630
921
  * Search properties with advanced filtering
631
922
  */
@@ -721,6 +1012,12 @@ interface MoreApartmentsIntegrationOptions extends MoreApartmentsConfig {
721
1012
  * @example '../prj-more-apartments/instance/stayci.com'
722
1013
  */
723
1014
  instancePath?: string;
1015
+ /**
1016
+ * Path to More Apartments project root directory
1017
+ * Used for auto-loading .headless-token file during local development
1018
+ * @example '../prj-more-apartments'
1019
+ */
1020
+ projectPath?: string;
724
1021
  }
725
1022
  declare function moreApartmentsIntegration(options: MoreApartmentsIntegrationOptions): AstroIntegration;
726
1023
  /**
@@ -767,7 +1064,7 @@ declare function fetchProperties(client: MoreApartmentsClient, params?: {
767
1064
  zipcode: string | null;
768
1065
  area: string | null;
769
1066
  city: string;
770
- country: string;
1067
+ country: string | null;
771
1068
  latitude: number;
772
1069
  longitude: number;
773
1070
  single_bed: number | null;
@@ -889,7 +1186,7 @@ declare function fetchProperty(client: MoreApartmentsClient, idOrSlug: number |
889
1186
  zipcode: string | null;
890
1187
  area: string | null;
891
1188
  city: string;
892
- country: string;
1189
+ country: string | null;
893
1190
  latitude: number;
894
1191
  longitude: number;
895
1192
  single_bed: number | null;
@@ -1250,7 +1547,7 @@ declare function searchProperties(client: MoreApartmentsClient, params: Property
1250
1547
  zipcode: string | null;
1251
1548
  area: string | null;
1252
1549
  city: string;
1253
- country: string;
1550
+ country: string | null;
1254
1551
  latitude: number;
1255
1552
  longitude: number;
1256
1553
  single_bed: number | null;
@@ -1335,4 +1632,4 @@ declare function searchProperties(client: MoreApartmentsClient, params: Property
1335
1632
  }[] | undefined;
1336
1633
  }[]>;
1337
1634
 
1338
- export { type ApiError, ApiErrorSchema, type Availability, AvailabilitySchema, AvailableDay, type BookingRequest, BookingRequestSchema, type BookingResponse, BookingResponseSchema, type BookingSettings, BookingSettingsSchema, type Category, CategorySchema, type CategorySegment, CategorySegmentSchema, type MainSettings, MainSettingsSchema, MoreApartmentsClient, type MoreApartmentsConfig, MoreApartmentsConfigSchema, type Page, PageSchema, type PaginatedResponse, PaginatedResponseSchema, type PaginationLinks, PaginationLinksSchema, type PaginationMeta, PaginationMetaSchema, type Post, PostSchema, type Property, type PropertyImage, PropertyImageSchema, type PropertyPageSettings, PropertyPageSettingsSchema, PropertySchema, type PropertySearchParams, PropertySearchParamsSchema, type PropertySearchResult, PropertySearchResultSchema, type PropertySettings, PropertySettingsSchema, type ThemeSettings, ThemeSettingsSchema, moreApartmentsIntegration as default, fetchAvailability, fetchPage, fetchPages, fetchPost, fetchPosts, fetchProperties, fetchProperty, fetchSettings, generateBookingUrl, getAllImageUrls, getAllThumbnailUrls, getImage, getImageCount, getImageWithAlt, getPrimaryImageUrl, getThumbnailUrl, hasImages, searchProperties };
1635
+ export { type ApiError, ApiErrorSchema, type Availability, AvailabilitySchema, AvailableDay, type BookingConfirmResponse, BookingConfirmResponseSchema, type BookingDetailsRequest, BookingDetailsRequestSchema, type BookingDraftRequest, BookingDraftRequestSchema, type BookingDraftResponse, BookingDraftResponseSchema, type BookingPricingResponse, BookingPricingResponseSchema, type BookingResponse, BookingResponseSchema, type BookingSettings, BookingSettingsSchema, type BookingStatus, type Category, CategorySchema, type CategorySegment, CategorySegmentSchema, type MainSettings, MainSettingsSchema, MoreApartmentsClient, type MoreApartmentsConfig, MoreApartmentsConfigSchema, type Page, PageSchema, type PaginatedResponse, PaginatedResponseSchema, type PaginationLinks, PaginationLinksSchema, type PaginationMeta, PaginationMetaSchema, type PaymentMethod, type PersonalInfoRequest, PersonalInfoRequestSchema, type Post, PostSchema, type PriceBreakdown, PriceBreakdownSchema, type Property, type PropertyImage, PropertyImageSchema, type PropertyPageSettings, PropertyPageSettingsSchema, PropertySchema, type PropertySearchParams, PropertySearchParamsSchema, type PropertySearchResult, PropertySearchResultSchema, type PropertySettings, PropertySettingsSchema, type PropertySummary, PropertySummarySchema, type ReviewRequest, ReviewRequestSchema, type ThemeSettings, ThemeSettingsSchema, moreApartmentsIntegration as default, fetchAvailability, fetchPage, fetchPages, fetchPost, fetchPosts, fetchProperties, fetchProperty, fetchSettings, generateBookingUrl, getAllImageUrls, getAllThumbnailUrls, getImage, getImageCount, getImageWithAlt, getPrimaryImageUrl, getThumbnailUrl, hasImages, searchProperties };