@resira/ui 0.3.1 → 0.4.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/README.md +5 -3
- package/dist/index.cjs +264 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -6
- package/dist/index.d.ts +61 -6
- package/dist/index.js +264 -103
- package/dist/index.js.map +1 -1
- package/dist/styles.css +232 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -234,6 +234,28 @@ interface ResiraClassNames {
|
|
|
234
234
|
/** Price preview panel. */
|
|
235
235
|
pricePreview?: string;
|
|
236
236
|
}
|
|
237
|
+
/** Pre-filled selection data for deeplink integration. */
|
|
238
|
+
interface DeeplinkSelection {
|
|
239
|
+
/** Pre-selected product/service ID. */
|
|
240
|
+
productId?: string;
|
|
241
|
+
/** Pre-selected date (YYYY-MM-DD). */
|
|
242
|
+
date?: string;
|
|
243
|
+
/** Pre-selected party size. */
|
|
244
|
+
partySize?: number;
|
|
245
|
+
/** Pre-selected duration in minutes. */
|
|
246
|
+
duration?: number;
|
|
247
|
+
}
|
|
248
|
+
/** Pre-filled guest data for deeplink integration. */
|
|
249
|
+
interface DeeplinkGuest {
|
|
250
|
+
/** Guest name. */
|
|
251
|
+
name?: string;
|
|
252
|
+
/** Guest email. */
|
|
253
|
+
email?: string;
|
|
254
|
+
/** Guest phone. */
|
|
255
|
+
phone?: string;
|
|
256
|
+
/** Notes. */
|
|
257
|
+
notes?: string;
|
|
258
|
+
}
|
|
237
259
|
/** Configuration passed to ResiraProvider. */
|
|
238
260
|
interface ResiraProviderConfig {
|
|
239
261
|
/** Theme overrides. */
|
|
@@ -270,6 +292,23 @@ interface ResiraProviderConfig {
|
|
|
270
292
|
showRemainingSpots?: boolean;
|
|
271
293
|
/** Percentage of total to charge upfront (0-100). Default 100. */
|
|
272
294
|
depositPercent?: number;
|
|
295
|
+
/** Whether to show the step indicator bar. @default true */
|
|
296
|
+
showStepIndicator?: boolean;
|
|
297
|
+
/** Pre-fill booking data for deeplink integration. */
|
|
298
|
+
deeplink?: DeeplinkSelection;
|
|
299
|
+
/** Pre-fill guest information. */
|
|
300
|
+
deeplinkGuest?: DeeplinkGuest;
|
|
301
|
+
/** Called when the booking step changes. */
|
|
302
|
+
onStepChange?: (step: BookingStep) => void;
|
|
303
|
+
/** Called when a booking is successfully completed. */
|
|
304
|
+
onBookingComplete?: (data: {
|
|
305
|
+
reservationId?: string;
|
|
306
|
+
product?: Product;
|
|
307
|
+
selection: BookingSelection;
|
|
308
|
+
guest: GuestFormValues;
|
|
309
|
+
}) => void;
|
|
310
|
+
/** Called when an error occurs during the booking flow. */
|
|
311
|
+
onError?: (code: string, message: string) => void;
|
|
273
312
|
}
|
|
274
313
|
/** Props for the ResiraProvider component. */
|
|
275
314
|
interface ResiraProviderProps {
|
|
@@ -336,6 +375,23 @@ interface ResiraContextValue {
|
|
|
336
375
|
groupServicesByCategory: boolean;
|
|
337
376
|
/** Custom render function for service cards. */
|
|
338
377
|
renderServiceCard?: (product: Product, selected: boolean) => React.ReactNode;
|
|
378
|
+
/** Whether the step indicator bar is visible. */
|
|
379
|
+
showStepIndicator: boolean;
|
|
380
|
+
/** Pre-fill booking data for deeplink integration. */
|
|
381
|
+
deeplink?: DeeplinkSelection;
|
|
382
|
+
/** Pre-fill guest information. */
|
|
383
|
+
deeplinkGuest?: DeeplinkGuest;
|
|
384
|
+
/** Called when the booking step changes. */
|
|
385
|
+
onStepChange?: (step: BookingStep) => void;
|
|
386
|
+
/** Called when a booking is successfully completed. */
|
|
387
|
+
onBookingComplete?: (data: {
|
|
388
|
+
reservationId?: string;
|
|
389
|
+
product?: Product;
|
|
390
|
+
selection: BookingSelection;
|
|
391
|
+
guest: GuestFormValues;
|
|
392
|
+
}) => void;
|
|
393
|
+
/** Called when an error occurs during the booking flow. */
|
|
394
|
+
onError?: (code: string, message: string) => void;
|
|
339
395
|
}
|
|
340
396
|
/** Steps in the booking flow. */
|
|
341
397
|
type BookingStep = "resource" | "availability" | "details" | "terms" | "payment" | "confirmation";
|
|
@@ -465,14 +521,13 @@ interface ProductSelectorProps {
|
|
|
465
521
|
onSelect: (product: Product) => void;
|
|
466
522
|
loading?: boolean;
|
|
467
523
|
error?: string | null;
|
|
468
|
-
/** Override layout from provider. */
|
|
469
524
|
layout?: ServiceLayout;
|
|
470
|
-
/** Override visible count from provider. */
|
|
471
525
|
visibleCount?: number;
|
|
472
|
-
/** Override category grouping from provider. @default true */
|
|
473
526
|
groupByCategory?: boolean;
|
|
527
|
+
/** Pre-select a specific category to show (skip category tiles). */
|
|
528
|
+
initialCategory?: string;
|
|
474
529
|
}
|
|
475
|
-
declare function ProductSelector({ products, resources, selectedId, onSelect, loading, error, layout: layoutProp, visibleCount: visibleCountProp, groupByCategory: groupByCategoryProp, }: ProductSelectorProps): react_jsx_runtime.JSX.Element;
|
|
530
|
+
declare function ProductSelector({ products, resources, selectedId, onSelect, loading, error, layout: layoutProp, visibleCount: visibleCountProp, groupByCategory: groupByCategoryProp, initialCategory, }: ProductSelectorProps): react_jsx_runtime.JSX.Element;
|
|
476
531
|
|
|
477
532
|
/**
|
|
478
533
|
* Validate the guest form. Returns an errors object (empty = valid).
|
|
@@ -703,7 +758,7 @@ interface UseDishesReturn {
|
|
|
703
758
|
* const { dishes, loading, error } = useDishes();
|
|
704
759
|
* ```
|
|
705
760
|
*/
|
|
706
|
-
declare function useDishes(): UseDishesReturn;
|
|
761
|
+
declare function useDishes(enabled?: boolean): UseDishesReturn;
|
|
707
762
|
|
|
708
763
|
/** Default theme values. */
|
|
709
764
|
declare const DEFAULT_THEME: Required<ResiraTheme>;
|
|
@@ -743,4 +798,4 @@ declare function TagIcon({ size, className }: IconProps): react_jsx_runtime.JSX.
|
|
|
743
798
|
declare function CubeIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
744
799
|
declare function ViewfinderIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
745
800
|
|
|
746
|
-
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, 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, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|
|
801
|
+
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, 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, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -234,6 +234,28 @@ interface ResiraClassNames {
|
|
|
234
234
|
/** Price preview panel. */
|
|
235
235
|
pricePreview?: string;
|
|
236
236
|
}
|
|
237
|
+
/** Pre-filled selection data for deeplink integration. */
|
|
238
|
+
interface DeeplinkSelection {
|
|
239
|
+
/** Pre-selected product/service ID. */
|
|
240
|
+
productId?: string;
|
|
241
|
+
/** Pre-selected date (YYYY-MM-DD). */
|
|
242
|
+
date?: string;
|
|
243
|
+
/** Pre-selected party size. */
|
|
244
|
+
partySize?: number;
|
|
245
|
+
/** Pre-selected duration in minutes. */
|
|
246
|
+
duration?: number;
|
|
247
|
+
}
|
|
248
|
+
/** Pre-filled guest data for deeplink integration. */
|
|
249
|
+
interface DeeplinkGuest {
|
|
250
|
+
/** Guest name. */
|
|
251
|
+
name?: string;
|
|
252
|
+
/** Guest email. */
|
|
253
|
+
email?: string;
|
|
254
|
+
/** Guest phone. */
|
|
255
|
+
phone?: string;
|
|
256
|
+
/** Notes. */
|
|
257
|
+
notes?: string;
|
|
258
|
+
}
|
|
237
259
|
/** Configuration passed to ResiraProvider. */
|
|
238
260
|
interface ResiraProviderConfig {
|
|
239
261
|
/** Theme overrides. */
|
|
@@ -270,6 +292,23 @@ interface ResiraProviderConfig {
|
|
|
270
292
|
showRemainingSpots?: boolean;
|
|
271
293
|
/** Percentage of total to charge upfront (0-100). Default 100. */
|
|
272
294
|
depositPercent?: number;
|
|
295
|
+
/** Whether to show the step indicator bar. @default true */
|
|
296
|
+
showStepIndicator?: boolean;
|
|
297
|
+
/** Pre-fill booking data for deeplink integration. */
|
|
298
|
+
deeplink?: DeeplinkSelection;
|
|
299
|
+
/** Pre-fill guest information. */
|
|
300
|
+
deeplinkGuest?: DeeplinkGuest;
|
|
301
|
+
/** Called when the booking step changes. */
|
|
302
|
+
onStepChange?: (step: BookingStep) => void;
|
|
303
|
+
/** Called when a booking is successfully completed. */
|
|
304
|
+
onBookingComplete?: (data: {
|
|
305
|
+
reservationId?: string;
|
|
306
|
+
product?: Product;
|
|
307
|
+
selection: BookingSelection;
|
|
308
|
+
guest: GuestFormValues;
|
|
309
|
+
}) => void;
|
|
310
|
+
/** Called when an error occurs during the booking flow. */
|
|
311
|
+
onError?: (code: string, message: string) => void;
|
|
273
312
|
}
|
|
274
313
|
/** Props for the ResiraProvider component. */
|
|
275
314
|
interface ResiraProviderProps {
|
|
@@ -336,6 +375,23 @@ interface ResiraContextValue {
|
|
|
336
375
|
groupServicesByCategory: boolean;
|
|
337
376
|
/** Custom render function for service cards. */
|
|
338
377
|
renderServiceCard?: (product: Product, selected: boolean) => React.ReactNode;
|
|
378
|
+
/** Whether the step indicator bar is visible. */
|
|
379
|
+
showStepIndicator: boolean;
|
|
380
|
+
/** Pre-fill booking data for deeplink integration. */
|
|
381
|
+
deeplink?: DeeplinkSelection;
|
|
382
|
+
/** Pre-fill guest information. */
|
|
383
|
+
deeplinkGuest?: DeeplinkGuest;
|
|
384
|
+
/** Called when the booking step changes. */
|
|
385
|
+
onStepChange?: (step: BookingStep) => void;
|
|
386
|
+
/** Called when a booking is successfully completed. */
|
|
387
|
+
onBookingComplete?: (data: {
|
|
388
|
+
reservationId?: string;
|
|
389
|
+
product?: Product;
|
|
390
|
+
selection: BookingSelection;
|
|
391
|
+
guest: GuestFormValues;
|
|
392
|
+
}) => void;
|
|
393
|
+
/** Called when an error occurs during the booking flow. */
|
|
394
|
+
onError?: (code: string, message: string) => void;
|
|
339
395
|
}
|
|
340
396
|
/** Steps in the booking flow. */
|
|
341
397
|
type BookingStep = "resource" | "availability" | "details" | "terms" | "payment" | "confirmation";
|
|
@@ -465,14 +521,13 @@ interface ProductSelectorProps {
|
|
|
465
521
|
onSelect: (product: Product) => void;
|
|
466
522
|
loading?: boolean;
|
|
467
523
|
error?: string | null;
|
|
468
|
-
/** Override layout from provider. */
|
|
469
524
|
layout?: ServiceLayout;
|
|
470
|
-
/** Override visible count from provider. */
|
|
471
525
|
visibleCount?: number;
|
|
472
|
-
/** Override category grouping from provider. @default true */
|
|
473
526
|
groupByCategory?: boolean;
|
|
527
|
+
/** Pre-select a specific category to show (skip category tiles). */
|
|
528
|
+
initialCategory?: string;
|
|
474
529
|
}
|
|
475
|
-
declare function ProductSelector({ products, resources, selectedId, onSelect, loading, error, layout: layoutProp, visibleCount: visibleCountProp, groupByCategory: groupByCategoryProp, }: ProductSelectorProps): react_jsx_runtime.JSX.Element;
|
|
530
|
+
declare function ProductSelector({ products, resources, selectedId, onSelect, loading, error, layout: layoutProp, visibleCount: visibleCountProp, groupByCategory: groupByCategoryProp, initialCategory, }: ProductSelectorProps): react_jsx_runtime.JSX.Element;
|
|
476
531
|
|
|
477
532
|
/**
|
|
478
533
|
* Validate the guest form. Returns an errors object (empty = valid).
|
|
@@ -703,7 +758,7 @@ interface UseDishesReturn {
|
|
|
703
758
|
* const { dishes, loading, error } = useDishes();
|
|
704
759
|
* ```
|
|
705
760
|
*/
|
|
706
|
-
declare function useDishes(): UseDishesReturn;
|
|
761
|
+
declare function useDishes(enabled?: boolean): UseDishesReturn;
|
|
707
762
|
|
|
708
763
|
/** Default theme values. */
|
|
709
764
|
declare const DEFAULT_THEME: Required<ResiraTheme>;
|
|
@@ -743,4 +798,4 @@ declare function TagIcon({ size, className }: IconProps): react_jsx_runtime.JSX.
|
|
|
743
798
|
declare function CubeIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
744
799
|
declare function ViewfinderIcon({ size, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
745
800
|
|
|
746
|
-
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon, ClockIcon, ConfirmationView, CreditCardIcon, CubeIcon, DEFAULT_LOCALE, DEFAULT_THEME, 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, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|
|
801
|
+
export { AlertCircleIcon, BookingCalendar, BookingModal, type BookingSelection, type BookingStep, CalendarIcon, CheckCircleIcon, CheckIcon, 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, useDish, useDishes, usePaymentIntent, useProducts, useReservation, useResira, useResources, validateGuestForm };
|