@uptrademedia/site-kit 1.0.24 → 1.0.26

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
@@ -704,8 +704,10 @@ interface BookingResult {
704
704
  };
705
705
  }
706
706
  interface BookingWidgetProps {
707
- /** Organization slug (e.g., 'heinrich-law') */
708
- orgSlug: string;
707
+ /** Organization slug – required for public (unauthenticated) mode, optional with apiKey */
708
+ orgSlug?: string;
709
+ /** API key – when provided, uses authenticated /sync/widget/* endpoints (no orgSlug needed) */
710
+ apiKey?: string;
709
711
  /** API base URL - defaults to https://api.uptrademedia.com */
710
712
  apiUrl?: string;
711
713
  /** Specific booking type slug to show (optional - shows all if not provided) */
@@ -741,44 +743,72 @@ interface SyncWidgetConfig {
741
743
  timezone: string;
742
744
  }
743
745
 
744
- declare function BookingWidget({ orgSlug, apiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
746
+ declare function BookingWidget({ orgSlug, apiKey: propApiKey, apiUrl: propApiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
745
747
 
746
748
  /**
747
749
  * Sync API Functions - Client-side API calls for booking widget
750
+ *
751
+ * Two modes:
752
+ * 1. API-key flow (preferred): Uses x-api-key header → /sync/widget/* endpoints.
753
+ * Project is resolved server-side from the key. No orgSlug needed.
754
+ * 2. Public/orgSlug flow (legacy): Uses /sync/public/:org/* endpoints. No auth.
748
755
  */
749
756
 
750
757
  /**
751
- * Fetch public booking types for an organization
758
+ * Fetch booking types.
759
+ * - With apiKey → GET /sync/widget/types
760
+ * - With orgSlug → GET /sync/public/:org/types
752
761
  */
753
- declare function fetchBookingTypes(orgSlug: string, apiUrl?: string): Promise<BookingType[]>;
762
+ declare function fetchBookingTypes(orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType[]>;
754
763
  /**
755
764
  * Fetch booking type details
756
765
  */
757
- declare function fetchBookingTypeDetails(orgSlug: string, typeSlug: string, apiUrl?: string): Promise<BookingType>;
766
+ declare function fetchBookingTypeDetails(typeSlug: string, orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType>;
758
767
  /**
759
768
  * Fetch available time slots for a specific date
760
769
  */
761
- declare function fetchAvailability(orgSlug: string, typeSlug: string, date: string, // YYYY-MM-DD format
762
- apiUrl?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
770
+ declare function fetchAvailability(typeSlug: string, date: string, // YYYY-MM-DD format
771
+ orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
763
772
  /**
764
773
  * Hold a time slot temporarily (5-10 minutes)
765
774
  */
766
- declare function createSlotHold(bookingTypeId: string, startTime: string, hostId: string | undefined, guestTimezone: string, apiUrl?: string): Promise<SlotHold>;
775
+ declare function createSlotHold(holdData: {
776
+ bookingType: string;
777
+ slotStart: string;
778
+ slotEnd: string;
779
+ hostId: string;
780
+ sessionId: string;
781
+ guestEmail?: string;
782
+ }, apiUrl?: string, apiKey?: string): Promise<SlotHold>;
767
783
  /**
768
784
  * Release a slot hold
769
785
  */
770
- declare function releaseSlotHold(holdId: string, apiUrl?: string): Promise<void>;
786
+ declare function releaseSlotHold(holdId: string, apiUrl?: string, apiKey?: string): Promise<void>;
771
787
  /**
772
788
  * Create a booking
773
789
  */
774
- declare function createBooking(bookingTypeId: string, startTime: string, guest: GuestInfo, timezone: string, hostId?: string, holdId?: string, apiUrl?: string): Promise<BookingResult>;
790
+ declare function createBooking(bookingData: {
791
+ bookingType: string;
792
+ scheduledAt: string;
793
+ hostId: string;
794
+ name: string;
795
+ email: string;
796
+ phone?: string;
797
+ company?: string;
798
+ message?: string;
799
+ source: string;
800
+ timezone?: string;
801
+ holdId?: string;
802
+ sessionId?: string;
803
+ sourceUrl?: string;
804
+ }, apiUrl?: string, apiKey?: string): Promise<BookingResult>;
775
805
  /**
776
806
  * Get available dates for a month (helper for calendar view)
777
807
  * Returns dates that have at least one available slot
778
808
  */
779
- declare function fetchAvailableDates(orgSlug: string, typeSlug: string, startDate: string, // YYYY-MM-DD
809
+ declare function fetchAvailableDates(typeSlug: string, startDate: string, // YYYY-MM-DD
780
810
  endDate: string, // YYYY-MM-DD
781
- apiUrl?: string, timezone?: string): Promise<string[]>;
811
+ orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string): Promise<string[]>;
782
812
  /**
783
813
  * Detect user's timezone
784
814
  */
package/dist/index.d.ts CHANGED
@@ -704,8 +704,10 @@ interface BookingResult {
704
704
  };
705
705
  }
706
706
  interface BookingWidgetProps {
707
- /** Organization slug (e.g., 'heinrich-law') */
708
- orgSlug: string;
707
+ /** Organization slug – required for public (unauthenticated) mode, optional with apiKey */
708
+ orgSlug?: string;
709
+ /** API key – when provided, uses authenticated /sync/widget/* endpoints (no orgSlug needed) */
710
+ apiKey?: string;
709
711
  /** API base URL - defaults to https://api.uptrademedia.com */
710
712
  apiUrl?: string;
711
713
  /** Specific booking type slug to show (optional - shows all if not provided) */
@@ -741,44 +743,72 @@ interface SyncWidgetConfig {
741
743
  timezone: string;
742
744
  }
743
745
 
744
- declare function BookingWidget({ orgSlug, apiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
746
+ declare function BookingWidget({ orgSlug, apiKey: propApiKey, apiUrl: propApiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
745
747
 
746
748
  /**
747
749
  * Sync API Functions - Client-side API calls for booking widget
750
+ *
751
+ * Two modes:
752
+ * 1. API-key flow (preferred): Uses x-api-key header → /sync/widget/* endpoints.
753
+ * Project is resolved server-side from the key. No orgSlug needed.
754
+ * 2. Public/orgSlug flow (legacy): Uses /sync/public/:org/* endpoints. No auth.
748
755
  */
749
756
 
750
757
  /**
751
- * Fetch public booking types for an organization
758
+ * Fetch booking types.
759
+ * - With apiKey → GET /sync/widget/types
760
+ * - With orgSlug → GET /sync/public/:org/types
752
761
  */
753
- declare function fetchBookingTypes(orgSlug: string, apiUrl?: string): Promise<BookingType[]>;
762
+ declare function fetchBookingTypes(orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType[]>;
754
763
  /**
755
764
  * Fetch booking type details
756
765
  */
757
- declare function fetchBookingTypeDetails(orgSlug: string, typeSlug: string, apiUrl?: string): Promise<BookingType>;
766
+ declare function fetchBookingTypeDetails(typeSlug: string, orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType>;
758
767
  /**
759
768
  * Fetch available time slots for a specific date
760
769
  */
761
- declare function fetchAvailability(orgSlug: string, typeSlug: string, date: string, // YYYY-MM-DD format
762
- apiUrl?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
770
+ declare function fetchAvailability(typeSlug: string, date: string, // YYYY-MM-DD format
771
+ orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
763
772
  /**
764
773
  * Hold a time slot temporarily (5-10 minutes)
765
774
  */
766
- declare function createSlotHold(bookingTypeId: string, startTime: string, hostId: string | undefined, guestTimezone: string, apiUrl?: string): Promise<SlotHold>;
775
+ declare function createSlotHold(holdData: {
776
+ bookingType: string;
777
+ slotStart: string;
778
+ slotEnd: string;
779
+ hostId: string;
780
+ sessionId: string;
781
+ guestEmail?: string;
782
+ }, apiUrl?: string, apiKey?: string): Promise<SlotHold>;
767
783
  /**
768
784
  * Release a slot hold
769
785
  */
770
- declare function releaseSlotHold(holdId: string, apiUrl?: string): Promise<void>;
786
+ declare function releaseSlotHold(holdId: string, apiUrl?: string, apiKey?: string): Promise<void>;
771
787
  /**
772
788
  * Create a booking
773
789
  */
774
- declare function createBooking(bookingTypeId: string, startTime: string, guest: GuestInfo, timezone: string, hostId?: string, holdId?: string, apiUrl?: string): Promise<BookingResult>;
790
+ declare function createBooking(bookingData: {
791
+ bookingType: string;
792
+ scheduledAt: string;
793
+ hostId: string;
794
+ name: string;
795
+ email: string;
796
+ phone?: string;
797
+ company?: string;
798
+ message?: string;
799
+ source: string;
800
+ timezone?: string;
801
+ holdId?: string;
802
+ sessionId?: string;
803
+ sourceUrl?: string;
804
+ }, apiUrl?: string, apiKey?: string): Promise<BookingResult>;
775
805
  /**
776
806
  * Get available dates for a month (helper for calendar view)
777
807
  * Returns dates that have at least one available slot
778
808
  */
779
- declare function fetchAvailableDates(orgSlug: string, typeSlug: string, startDate: string, // YYYY-MM-DD
809
+ declare function fetchAvailableDates(typeSlug: string, startDate: string, // YYYY-MM-DD
780
810
  endDate: string, // YYYY-MM-DD
781
- apiUrl?: string, timezone?: string): Promise<string[]>;
811
+ orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string): Promise<string[]>;
782
812
  /**
783
813
  * Detect user's timezone
784
814
  */