@resira/ui 0.4.6 → 0.4.7
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/README.md +238 -238
- package/dist/index.cjs +4469 -4357
- package/dist/index.d.cts +114 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +4418 -4308
- package/dist/styles.css +2972 -2972
- package/package.json +59 -59
package/dist/index.d.cts
CHANGED
|
@@ -790,6 +790,119 @@ interface UseCheckoutSessionReturn {
|
|
|
790
790
|
* ```
|
|
791
791
|
*/
|
|
792
792
|
declare function useCheckoutSession(token: string | undefined): UseCheckoutSessionReturn;
|
|
793
|
+
/** A single duration/price option for a service. */
|
|
794
|
+
interface ServiceOption {
|
|
795
|
+
/** Duration in minutes. */
|
|
796
|
+
durationMinutes: number;
|
|
797
|
+
/** Human-readable duration label (e.g. "1h 30m"). */
|
|
798
|
+
durationLabel: string;
|
|
799
|
+
/** Price in minor units (cents). */
|
|
800
|
+
priceCents: number;
|
|
801
|
+
/** Formatted price string (e.g. "€50.00"). */
|
|
802
|
+
priceFormatted: string;
|
|
803
|
+
}
|
|
804
|
+
/** Enriched service data ready for display. */
|
|
805
|
+
interface Service {
|
|
806
|
+
/** Unique service ID. */
|
|
807
|
+
id: string;
|
|
808
|
+
/** Service name. */
|
|
809
|
+
name: string;
|
|
810
|
+
/** Optional description. */
|
|
811
|
+
description?: string;
|
|
812
|
+
/** Image URL. */
|
|
813
|
+
imageUrl?: string;
|
|
814
|
+
/** ISO 4217 currency code. */
|
|
815
|
+
currency: string;
|
|
816
|
+
/** Whether the service is active. */
|
|
817
|
+
active: boolean;
|
|
818
|
+
/** Pricing model: "per_session" | "per_person" | "per_rider". */
|
|
819
|
+
pricingModel: string;
|
|
820
|
+
/** Default/base price in minor units. */
|
|
821
|
+
priceCents: number;
|
|
822
|
+
/** Formatted base price (e.g. "€50.00"). */
|
|
823
|
+
priceFormatted: string;
|
|
824
|
+
/** Lowest price across all options (for "from €X" display). */
|
|
825
|
+
lowestPriceCents: number;
|
|
826
|
+
/** Formatted lowest price. */
|
|
827
|
+
lowestPriceFormatted: string;
|
|
828
|
+
/** Whether multiple duration/price options exist. */
|
|
829
|
+
hasMultipleOptions: boolean;
|
|
830
|
+
/** Default duration in minutes. */
|
|
831
|
+
durationMinutes: number;
|
|
832
|
+
/** Human-readable default duration (e.g. "2h"). */
|
|
833
|
+
durationLabel: string;
|
|
834
|
+
/** All available duration/price options. */
|
|
835
|
+
options: ServiceOption[];
|
|
836
|
+
/** Maximum party/group size. */
|
|
837
|
+
maxPartySize?: number;
|
|
838
|
+
/** IDs of linked equipment/resources. */
|
|
839
|
+
equipmentIds: string[];
|
|
840
|
+
/** Names of linked equipment/resources. */
|
|
841
|
+
equipmentNames?: string[];
|
|
842
|
+
/** Display color. */
|
|
843
|
+
serviceColor?: string;
|
|
844
|
+
/** Sort order. */
|
|
845
|
+
sortOrder?: number;
|
|
846
|
+
/** Raw product object from the API. */
|
|
847
|
+
raw: Product;
|
|
848
|
+
}
|
|
849
|
+
interface UseServicesReturn {
|
|
850
|
+
/** Enriched service list. */
|
|
851
|
+
services: Service[];
|
|
852
|
+
/** Whether loading. */
|
|
853
|
+
loading: boolean;
|
|
854
|
+
/** Error message. */
|
|
855
|
+
error: string | null;
|
|
856
|
+
/** Re-fetch services. */
|
|
857
|
+
refetch: () => void;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Fetch all services for the organisation with enriched display data.
|
|
861
|
+
*
|
|
862
|
+
* Returns formatted prices, duration labels, and "from €X" logic
|
|
863
|
+
* so you can render service cards with your own styling.
|
|
864
|
+
*
|
|
865
|
+
* Requires `<ResiraProvider>` ancestor.
|
|
866
|
+
*
|
|
867
|
+
* ```tsx
|
|
868
|
+
* const { services, loading, error } = useServices();
|
|
869
|
+
*
|
|
870
|
+
* return services.map(s => (
|
|
871
|
+
* <div key={s.id}>
|
|
872
|
+
* <h3>{s.name}</h3>
|
|
873
|
+
* <img src={s.imageUrl} alt={s.name} />
|
|
874
|
+
* <p>{s.hasMultipleOptions ? `from ${s.lowestPriceFormatted}` : s.priceFormatted}</p>
|
|
875
|
+
* <p>{s.durationLabel}</p>
|
|
876
|
+
* {s.options.map(opt => (
|
|
877
|
+
* <span key={opt.durationMinutes}>{opt.durationLabel} — {opt.priceFormatted}</span>
|
|
878
|
+
* ))}
|
|
879
|
+
* </div>
|
|
880
|
+
* ));
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
declare function useServices(): UseServicesReturn;
|
|
884
|
+
/**
|
|
885
|
+
* Fetch all services for an organisation — standalone, no React needed.
|
|
886
|
+
*
|
|
887
|
+
* Use this in non-React contexts, server components, scripts, or
|
|
888
|
+
* when you want full control over rendering.
|
|
889
|
+
*
|
|
890
|
+
* ```ts
|
|
891
|
+
* import { fetchServices } from "@resira/ui";
|
|
892
|
+
*
|
|
893
|
+
* const services = await fetchServices("your-api-key");
|
|
894
|
+
* services.forEach(s => {
|
|
895
|
+
* console.log(s.name, s.lowestPriceFormatted, s.options);
|
|
896
|
+
* });
|
|
897
|
+
* ```
|
|
898
|
+
*
|
|
899
|
+
* @param apiKey Your Resira public API key
|
|
900
|
+
* @param opts Optional: baseUrl override
|
|
901
|
+
* @returns Array of enriched Service objects
|
|
902
|
+
*/
|
|
903
|
+
declare function fetchServices(apiKey: string, opts?: {
|
|
904
|
+
baseUrl?: string;
|
|
905
|
+
}): Promise<Service[]>;
|
|
793
906
|
|
|
794
907
|
/** Default theme values. */
|
|
795
908
|
declare const DEFAULT_THEME: Required<ResiraTheme>;
|
|
@@ -829,4 +942,4 @@ declare function TagIcon({ size, className }: IconProps): react_jsx_runtime.JSX.
|
|
|
829
942
|
declare function CubeIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
830
943
|
declare function ViewfinderIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
831
944
|
|
|
832
|
-
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, type CheckoutSessionErrorCode, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, type DeeplinkGuest, type DeeplinkSelection, DishShowcase, type DishShowcaseProps, type DomainConfig, GuestForm, type GuestFormErrors, type GuestFormValues, LockIcon, MailIcon, MinusIcon, NoteIcon, PaymentForm, PhoneIcon, PlusIcon, ProductSelector, ResiraBookingWidget, type ResiraClassNames, type ResiraContextValue, type ResiraDomain, type ResiraLocale, ResiraProvider, type ResiraProviderConfig, type ResiraProviderProps, type ResiraTheme, ResourcePicker, type ServiceLayout, ShieldIcon, SummaryPreview, TagIcon, TimeSlotPicker, UserIcon, UsersIcon, ViewfinderIcon, WaiverConsent, XIcon, resolveTheme, themeToCSS, useAvailability, useCheckoutSession, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|
|
945
|
+
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, type CheckoutSessionErrorCode, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, type DeeplinkGuest, type DeeplinkSelection, DishShowcase, type DishShowcaseProps, type DomainConfig, GuestForm, type GuestFormErrors, type GuestFormValues, LockIcon, MailIcon, MinusIcon, NoteIcon, PaymentForm, PhoneIcon, PlusIcon, ProductSelector, ResiraBookingWidget, type ResiraClassNames, type ResiraContextValue, type ResiraDomain, type ResiraLocale, ResiraProvider, type ResiraProviderConfig, type ResiraProviderProps, type ResiraTheme, ResourcePicker, type Service, type ServiceLayout, type ServiceOption, ShieldIcon, SummaryPreview, TagIcon, TimeSlotPicker, type UseServicesReturn, UserIcon, UsersIcon, ViewfinderIcon, WaiverConsent, XIcon, fetchServices, resolveTheme, themeToCSS, useAvailability, useCheckoutSession, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, useServices, validateGuestForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -790,6 +790,119 @@ interface UseCheckoutSessionReturn {
|
|
|
790
790
|
* ```
|
|
791
791
|
*/
|
|
792
792
|
declare function useCheckoutSession(token: string | undefined): UseCheckoutSessionReturn;
|
|
793
|
+
/** A single duration/price option for a service. */
|
|
794
|
+
interface ServiceOption {
|
|
795
|
+
/** Duration in minutes. */
|
|
796
|
+
durationMinutes: number;
|
|
797
|
+
/** Human-readable duration label (e.g. "1h 30m"). */
|
|
798
|
+
durationLabel: string;
|
|
799
|
+
/** Price in minor units (cents). */
|
|
800
|
+
priceCents: number;
|
|
801
|
+
/** Formatted price string (e.g. "€50.00"). */
|
|
802
|
+
priceFormatted: string;
|
|
803
|
+
}
|
|
804
|
+
/** Enriched service data ready for display. */
|
|
805
|
+
interface Service {
|
|
806
|
+
/** Unique service ID. */
|
|
807
|
+
id: string;
|
|
808
|
+
/** Service name. */
|
|
809
|
+
name: string;
|
|
810
|
+
/** Optional description. */
|
|
811
|
+
description?: string;
|
|
812
|
+
/** Image URL. */
|
|
813
|
+
imageUrl?: string;
|
|
814
|
+
/** ISO 4217 currency code. */
|
|
815
|
+
currency: string;
|
|
816
|
+
/** Whether the service is active. */
|
|
817
|
+
active: boolean;
|
|
818
|
+
/** Pricing model: "per_session" | "per_person" | "per_rider". */
|
|
819
|
+
pricingModel: string;
|
|
820
|
+
/** Default/base price in minor units. */
|
|
821
|
+
priceCents: number;
|
|
822
|
+
/** Formatted base price (e.g. "€50.00"). */
|
|
823
|
+
priceFormatted: string;
|
|
824
|
+
/** Lowest price across all options (for "from €X" display). */
|
|
825
|
+
lowestPriceCents: number;
|
|
826
|
+
/** Formatted lowest price. */
|
|
827
|
+
lowestPriceFormatted: string;
|
|
828
|
+
/** Whether multiple duration/price options exist. */
|
|
829
|
+
hasMultipleOptions: boolean;
|
|
830
|
+
/** Default duration in minutes. */
|
|
831
|
+
durationMinutes: number;
|
|
832
|
+
/** Human-readable default duration (e.g. "2h"). */
|
|
833
|
+
durationLabel: string;
|
|
834
|
+
/** All available duration/price options. */
|
|
835
|
+
options: ServiceOption[];
|
|
836
|
+
/** Maximum party/group size. */
|
|
837
|
+
maxPartySize?: number;
|
|
838
|
+
/** IDs of linked equipment/resources. */
|
|
839
|
+
equipmentIds: string[];
|
|
840
|
+
/** Names of linked equipment/resources. */
|
|
841
|
+
equipmentNames?: string[];
|
|
842
|
+
/** Display color. */
|
|
843
|
+
serviceColor?: string;
|
|
844
|
+
/** Sort order. */
|
|
845
|
+
sortOrder?: number;
|
|
846
|
+
/** Raw product object from the API. */
|
|
847
|
+
raw: Product;
|
|
848
|
+
}
|
|
849
|
+
interface UseServicesReturn {
|
|
850
|
+
/** Enriched service list. */
|
|
851
|
+
services: Service[];
|
|
852
|
+
/** Whether loading. */
|
|
853
|
+
loading: boolean;
|
|
854
|
+
/** Error message. */
|
|
855
|
+
error: string | null;
|
|
856
|
+
/** Re-fetch services. */
|
|
857
|
+
refetch: () => void;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Fetch all services for the organisation with enriched display data.
|
|
861
|
+
*
|
|
862
|
+
* Returns formatted prices, duration labels, and "from €X" logic
|
|
863
|
+
* so you can render service cards with your own styling.
|
|
864
|
+
*
|
|
865
|
+
* Requires `<ResiraProvider>` ancestor.
|
|
866
|
+
*
|
|
867
|
+
* ```tsx
|
|
868
|
+
* const { services, loading, error } = useServices();
|
|
869
|
+
*
|
|
870
|
+
* return services.map(s => (
|
|
871
|
+
* <div key={s.id}>
|
|
872
|
+
* <h3>{s.name}</h3>
|
|
873
|
+
* <img src={s.imageUrl} alt={s.name} />
|
|
874
|
+
* <p>{s.hasMultipleOptions ? `from ${s.lowestPriceFormatted}` : s.priceFormatted}</p>
|
|
875
|
+
* <p>{s.durationLabel}</p>
|
|
876
|
+
* {s.options.map(opt => (
|
|
877
|
+
* <span key={opt.durationMinutes}>{opt.durationLabel} — {opt.priceFormatted}</span>
|
|
878
|
+
* ))}
|
|
879
|
+
* </div>
|
|
880
|
+
* ));
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
declare function useServices(): UseServicesReturn;
|
|
884
|
+
/**
|
|
885
|
+
* Fetch all services for an organisation — standalone, no React needed.
|
|
886
|
+
*
|
|
887
|
+
* Use this in non-React contexts, server components, scripts, or
|
|
888
|
+
* when you want full control over rendering.
|
|
889
|
+
*
|
|
890
|
+
* ```ts
|
|
891
|
+
* import { fetchServices } from "@resira/ui";
|
|
892
|
+
*
|
|
893
|
+
* const services = await fetchServices("your-api-key");
|
|
894
|
+
* services.forEach(s => {
|
|
895
|
+
* console.log(s.name, s.lowestPriceFormatted, s.options);
|
|
896
|
+
* });
|
|
897
|
+
* ```
|
|
898
|
+
*
|
|
899
|
+
* @param apiKey Your Resira public API key
|
|
900
|
+
* @param opts Optional: baseUrl override
|
|
901
|
+
* @returns Array of enriched Service objects
|
|
902
|
+
*/
|
|
903
|
+
declare function fetchServices(apiKey: string, opts?: {
|
|
904
|
+
baseUrl?: string;
|
|
905
|
+
}): Promise<Service[]>;
|
|
793
906
|
|
|
794
907
|
/** Default theme values. */
|
|
795
908
|
declare const DEFAULT_THEME: Required<ResiraTheme>;
|
|
@@ -829,4 +942,4 @@ declare function TagIcon({ size, className }: IconProps): react_jsx_runtime.JSX.
|
|
|
829
942
|
declare function CubeIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
830
943
|
declare function ViewfinderIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
831
944
|
|
|
832
|
-
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, type CheckoutSessionErrorCode, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, type DeeplinkGuest, type DeeplinkSelection, DishShowcase, type DishShowcaseProps, type DomainConfig, GuestForm, type GuestFormErrors, type GuestFormValues, LockIcon, MailIcon, MinusIcon, NoteIcon, PaymentForm, PhoneIcon, PlusIcon, ProductSelector, ResiraBookingWidget, type ResiraClassNames, type ResiraContextValue, type ResiraDomain, type ResiraLocale, ResiraProvider, type ResiraProviderConfig, type ResiraProviderProps, type ResiraTheme, ResourcePicker, type ServiceLayout, ShieldIcon, SummaryPreview, TagIcon, TimeSlotPicker, UserIcon, UsersIcon, ViewfinderIcon, WaiverConsent, XIcon, resolveTheme, themeToCSS, useAvailability, useCheckoutSession, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|
|
945
|
+
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, type CheckoutSessionErrorCode, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, type DeeplinkGuest, type DeeplinkSelection, DishShowcase, type DishShowcaseProps, type DomainConfig, GuestForm, type GuestFormErrors, type GuestFormValues, LockIcon, MailIcon, MinusIcon, NoteIcon, PaymentForm, PhoneIcon, PlusIcon, ProductSelector, ResiraBookingWidget, type ResiraClassNames, type ResiraContextValue, type ResiraDomain, type ResiraLocale, ResiraProvider, type ResiraProviderConfig, type ResiraProviderProps, type ResiraTheme, ResourcePicker, type Service, type ServiceLayout, type ServiceOption, ShieldIcon, SummaryPreview, TagIcon, TimeSlotPicker, type UseServicesReturn, UserIcon, UsersIcon, ViewfinderIcon, WaiverConsent, XIcon, fetchServices, resolveTheme, themeToCSS, useAvailability, useCheckoutSession, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, useServices, validateGuestForm };
|