@wix/vibe-bookings-plugin 0.16.0 → 0.18.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/index.cjs CHANGED
@@ -2949,22 +2949,6 @@ function createDedent(options) {
2949
2949
  }
2950
2950
 
2951
2951
  // src/services/instructions.service.ts
2952
- var getBookingsProviderLayout = () => {
2953
- return dedent_default`
2954
- import { Booking } from '@wix/bookings/components';
2955
-
2956
- const config = {
2957
- // your bookings service config
2958
- };
2959
-
2960
- export const BookingsProviderLayout = ({ children }: { children: React.ReactNode }) => {
2961
- return (
2962
- <Booking.Root bookingServiceConfig={config}>
2963
- {children}
2964
- </Booking.Root>
2965
- );
2966
- };`;
2967
- };
2968
2952
  var getRouterFileContent = () => {
2969
2953
  return dedent_default`
2970
2954
  import {
@@ -2975,124 +2959,56 @@ var getRouterFileContent = () => {
2975
2959
  } from 'react-router-dom';
2976
2960
 
2977
2961
  // Import route components and loaders
2962
+ import {
2963
+ ServiceListPageRoute,
2964
+ serviceListPageRouteLoader,
2965
+ } from './bookings/routes/service-list-route';
2966
+ import {
2967
+ TimeSlotListPageRoute,
2968
+ } from './bookings/routes/time-slot-list-route';
2969
+ import {
2970
+ BookingFormPageRoute,
2971
+ } from './bookings/routes/booking-form-route';
2972
+ import {
2973
+ LocationSelectorPageRoute,
2974
+ LocationSelectorPageRouteLoader,
2975
+ } from './bookings/routes/location-selector-route';
2976
+ import { Booking } from '@wix/bookings/components';
2978
2977
  import { rootRouteLoader, WixServicesProvider } from '@/wix-verticals/react-pages/react-router/routes/root';
2979
- import { ServiceListWrapper } from '@/components/bookings/pages/ServiceListPage';
2980
- import { ServiceDetails } from '@/components/bookings/components/service-page/ServiceDetails';
2981
- import { TimeSlotListPage } from '@/components/bookings/pages/TimeSlotListPage';
2982
- import { BookingFormPage } from '@/components/bookings/pages/BookingFormPage';
2983
- import { LocationSelectorPage } from '@/components/bookings/pages/LocationSelectorPage';
2984
- import { loadServiceListServiceInitialData } from '@wix/bookings/services';
2985
- import { useLoaderData } from 'react-router-dom';
2986
-
2987
- // Service list route component
2988
- function ServiceListRoute() {
2989
- const { servicesListConfig } = useLoaderData<typeof serviceListLoader>();
2990
- return <ServiceListWrapper servicesListConfig={servicesListConfig} servicePageRoute="/book-online/service" />;
2991
- }
2992
-
2993
- // Service details route component
2994
- function ServiceDetailsRoute() {
2995
- const { service, timeSlotListConfig, bookingFormId } = useLoaderData<typeof serviceDetailsLoader>();
2996
- return <ServiceDetails
2997
- service={service}
2998
- timeSlotListConfig={timeSlotListConfig}
2999
- bookingFormId={bookingFormId}
3000
- />;
3001
- }
3002
-
3003
- // Loader for service details route
3004
- async function serviceDetailsLoader({ params }: { params: { serviceId: string } }) {
3005
- // Note: Load service data by serviceId and pass to ServiceDetails
3006
- // ServiceDetails requires a service object from @wix/auto_sdk_bookings_services
3007
- // Optionally load timeSlotListConfig and bookingFormId if needed
3008
- const service = {/* load service by serviceId from params.serviceId */};
3009
- const timeSlotListConfig = {/* optional: load time slot list config */};
3010
- const bookingFormId = {/* optional: booking form ID */};
3011
- return { service, timeSlotListConfig, bookingFormId };
3012
- }
3013
-
3014
- // Time slot list route component
3015
- function TimeSlotListRoute() {
3016
- const { timeSlotListConfig } = useLoaderData<typeof timeSlotListLoader>();
3017
- return <TimeSlotListPage config={timeSlotListConfig} />;
3018
- }
3019
-
3020
- // Booking form route component
3021
- function BookingFormRoute() {
3022
- const { formId, additionalMetadata } = useLoaderData<typeof bookingFormLoader>();
3023
- return <BookingFormPage formId={formId} additionalMetadata={additionalMetadata} />;
3024
- }
3025
-
3026
- // Location selector route component
3027
- function LocationSelectorRoute() {
3028
- const { service } = useLoaderData<typeof locationListLoader>();
3029
- return <LocationSelectorPage service={service} />;
3030
- }
3031
-
3032
- // Loader for service list route
3033
- async function serviceListLoader() {
3034
- const servicesListConfig = await loadServiceListServiceInitialData({});
3035
- return { servicesListConfig };
3036
- }
3037
-
3038
- // Loader for time slot list route
3039
- async function timeSlotListLoader({ params }: { params: { serviceId: string } }) {
3040
- // Note: Load time slot list config based on service or other criteria
3041
- const timeSlotListConfig = {/* load time slot list config using params.serviceId */};
3042
- return { timeSlotListConfig };
3043
- }
3044
-
3045
- // Loader for booking form route
3046
- async function bookingFormLoader() {
3047
- // Note: Get form ID from route params, context, or config
3048
- // The booking form route doesn't have serviceId in the path, so load from context or booking service
3049
- const formId = {/* get form ID from context or booking service */};
3050
- const additionalMetadata = {/* optional: additional metadata */};
3051
- return { formId, additionalMetadata };
3052
- }
3053
-
3054
- // Loader for location selector route
3055
- async function locationListLoader({ params }: { params: { serviceId?: string } }) {
3056
- // Note: Load service data by serviceId - LocationSelectorPage uses Service.Locations
3057
- // which gets locations from the service object
3058
- // If serviceId is not in route, load from context or booking service
3059
- const service = {/* load service by serviceId from params or context */};
3060
- return { service };
3061
- }
3062
2978
 
3063
2979
  const router = createBrowserRouter(
3064
2980
  [
3065
2981
  {
3066
2982
  path: '/',
3067
- element: <Navigate to="/book-online" />,
2983
+ element: <Navigate to="/booking/locations" />,
3068
2984
  },
3069
2985
  {
2986
+ path: '/booking',
3070
2987
  element: (
3071
2988
  <WixServicesProvider>
3072
- <Outlet />
2989
+ <Booking.Root bookingServiceConfig={{}}>
2990
+ <Outlet />
2991
+ </Booking.Root>
3073
2992
  </WixServicesProvider>
3074
2993
  ),
3075
2994
  loader: rootRouteLoader,
3076
2995
  children: [
3077
2996
  {
3078
- path: '/book-online',
3079
- element: <ServiceListRoute />,
3080
- },
3081
- {
3082
- path: '/book-online/locations',
3083
- element: <LocationSelectorRoute />,
2997
+ path: 'locations',
2998
+ element: <LocationSelectorPageRoute servicesPagePath="/booking/services" />,
2999
+ loader: LocationSelectorPageRouteLoader,
3084
3000
  },
3085
3001
  {
3086
- path: '/book-online/service/:serviceId',
3087
- element: <ServiceDetailsRoute />,
3002
+ path: 'services',
3003
+ element: <ServiceListPageRoute slotsPagePath="/booking/slots" />,
3088
3004
  },
3089
3005
  {
3090
- path: '/book-online/time-selection/:serviceId',
3091
- element: <TimeSlotListRoute />,
3006
+ path: 'slots/:serviceSlug',
3007
+ element: <TimeSlotListPageRoute formPagePath="/booking/form" />,
3092
3008
  },
3093
3009
  {
3094
- path: '/book-online/booking-form',
3095
- element: <BookingFormRoute />,
3010
+ path: 'form',
3011
+ element: <BookingFormPageRoute />,
3096
3012
  },
3097
3013
  ],
3098
3014
  },
@@ -3116,42 +3032,38 @@ Your tasks for implementing and integrating the Bookings features of the site ar
3116
3032
 
3117
3033
  Integrate the bookings routes into the existing router of the app. There is an example router file. You should not import it directly, but rather use the content of the file as reference for how to implement the router in the app.
3118
3034
 
3119
- ## Example Bookings Router File
3120
-
3121
- \`\`\`tsx
3122
- ${getRouterFileContent()}
3123
- \`\`\`
3124
3035
 
3125
3036
  it includes the following routes:
3126
- - /book-online - a service list page displaying all available booking services (uses ServiceList component via ServiceListWrapper)
3127
- - /book-online/service/:serviceId - a service details page for a specific booking service (uses Service, TimeSlotList, and BookingForm components via ServiceDetails)
3128
- - /book-online/locations - a location selection page (uses Service.Locations and Location components via LocationSelectorPage)
3129
- - /book-online/time-selection/:serviceId - a dedicated time slot selection page (uses TimeSlotList component via TimeSlotListPage)
3130
- - /book-online/booking-form - a dedicated booking form page (uses BookingForm component via BookingFormPage)
3037
+ - /booking/locations - a location selection page for choosing the business location (uses Booking.Locations and Location components via LocationSelectorPageRoute)
3038
+ - /booking/services - a service list page displaying all available booking services (uses ServiceList component via ServiceListPageRoute)
3039
+ - /booking/slots/:serviceSlug - a dedicated time slot selection page (uses TimeSlotList component via TimeSlotListPageRoute)
3040
+ - /booking/form - a dedicated booking form page (uses BookingForm component via BookingFormPageRoute)
3131
3041
 
3132
3042
  The routes in the example router file are wrapped with:
3133
3043
 
3134
3044
  \`\`\`tsx
3135
3045
  <WixServicesProvider>
3136
- ...
3137
- <Outlet />
3046
+ <Booking.Root bookingServiceConfig={{}}>
3047
+ ...
3048
+ <Outlet />
3049
+ </Booking.Root>
3138
3050
  </WixServicesProvider>
3139
3051
  \`\`\`\
3140
3052
 
3141
3053
  <important_router_notes>
3142
3054
  <strong>MAKE SURE TO WRAP ALL THE ROUTES WITH THE PROVIDERS IN THE ABOVE EXAMPLE ROUTER</strong>
3143
- <strong>WRAP THE MAIN LAYOUT WITH <code><WixServicesProvider>...</WixServicesProvider></code> not only the bookings routes.</strong>
3144
- - Use <code><WixServicesProvider></code> only in the top level router and only once, the same component tree should not include more than one <code><WixServicesProvider></code>.
3055
+ <strong>WRAP THE MAIN LAYOUT WITH <code><WixServicesProvider></code> and <code><Booking.Root></code> not only the bookings routes.</strong>
3056
+ - Use <code><Booking.Root></code> only in the top level router and only once, the same component tree should not include more than one <code><Booking.Root></code>.
3145
3057
  <strong>ALWAYS IMPLEMENT THE LAYOUT COMPONENTS OF THE SITE, AS A LAYOUT FOR THE SITE, AND WRAP ALL THE ROUTES WITH THAT LAYOUT (INCLUDING THE BOOKINGS ROUTES).</strong>
3146
3058
  </important_router_notes>
3147
3059
 
3148
- The booking components already include proper padding and layout. The \`ServiceListWrapper\` component accepts a \`title\` prop for the page title, and \`ServiceDetails\` includes proper spacing and layout internally.
3060
+ The booking components already include proper padding and layout. The \`ServiceListWrapper\` component accepts a \`title\` prop for the page title.
3149
3061
 
3150
3062
  # Layout changes
3151
3063
  The bookings system provides a provider that must be integrated into the site layout.
3152
3064
 
3153
3065
  \`\`\`tsx
3154
- ${getBookingsProviderLayout()}
3066
+ ${getRouterFileContent()}
3155
3067
  \`\`\`
3156
3068
 
3157
3069
  # Available Bookings Components
@@ -3160,53 +3072,45 @@ The bookings system provides the following components from \`@wix/bookings/compo
3160
3072
 
3161
3073
  1. **ServiceList** - Used for displaying a list of booking services
3162
3074
  - Import: \`import { ServiceList } from '@wix/bookings/components';\`
3163
- - Used in: Service list page (\`/book-online\` route) via \`ServiceListWrapper\`
3075
+ - Used in: Service list page (\`/booking/services\` route) via \`ServiceListPageRoute\`
3164
3076
  - Pattern: \`<ServiceList.Root>\` → \`<ServiceList.Services>\` → \`<ServiceList.ServiceRepeater>\`
3165
3077
  - Example: \`<ServiceList.Root serviceListConfig={config}>\` with \`<ServiceList.ServiceRepeater>\` containing \`<Service.Name>\`, \`<Service.Description>\`, \`<Service.Price>\`
3166
3078
 
3167
- 2. **Service** - Used for displaying individual service details
3168
- - Import: \`import { Service } from '@wix/bookings/components';\`
3169
- - Used in: Service details page (\`/book-online/service/:serviceId\` route) via \`ServiceDetails\`
3170
- - Pattern: \`<Service.Root service={service}>\` wrapping service components
3171
- - Example: \`<Service.Name>\`, \`<Service.Description>\`, \`<Service.Price>\`, \`<Service.Raw>\`, \`<Service.Locations>\`
3172
-
3173
- 3. **TimeSlotList** - Used for displaying and selecting available time slots for booking
3079
+ 2. **TimeSlotList** - Used for displaying and selecting available time slots for booking
3174
3080
  - Import: \`import { TimeSlotList } from '@wix/bookings/components';\`
3175
- - Used in: Service details page for time slot selection
3081
+ - Used in: Time selection page (\`/booking/slots/:serviceSlug\` route) via \`TimeSlotListPageRoute\`
3176
3082
  - Pattern: \`<TimeSlotList.Root config={config}>\` → \`<TimeSlotList.TimeSlots>\` → \`<TimeSlotList.TimeSlotRepeater>\`
3177
3083
  - Example: \`<TimeSlotList.TimeSlot.StartDate>\`, \`<TimeSlotList.TimeSlot.Actions.Select>\`
3178
3084
 
3179
- 4. **Location** - Used for displaying and selecting booking locations
3085
+ 3. **Location** - Used for displaying and selecting booking locations
3180
3086
  - Import: \`import { Location } from '@wix/bookings/components';\`
3181
- - Used in: Location selector page (\`/book-online/locations\` route) via \`LocationSelectorPage\`
3182
- - Pattern: Used within \`<Service.Locations>\` → \`<Service.Locations.List>\` → \`<Service.Locations.LocationRepeater>\`
3087
+ - Used in: Location selector page (\`/booking/locations\` route) via \`LocationSelectorPageRoute\`
3088
+ - Pattern: Used within \`<Booking.Locations>\` → \`<Booking.Locations.List>\` → \`<Booking.Locations.LocationRepeater>\`
3183
3089
  - Example: \`<Location.Name>\`, \`<Location.Address>\`, \`<Location.Phone>\`, \`<Location.Email>\`, \`<Location.Actions.Select>\`
3184
- - Note: Location components are used within Service.Locations.LocationRepeater, which automatically provides location context
3090
+ - Note: Location components are used within Booking.Locations.LocationRepeater, which automatically provides location context
3185
3091
 
3186
- 5. **BookingForm** - Used for the booking form to complete a reservation
3092
+ 4. **BookingForm** - Used for the booking form to complete a reservation
3187
3093
  - Import: \`import { BookingForm } from '@wix/bookings/components';\`
3188
- - Used in: Service details page for completing bookings
3094
+ - Used in: Booking form page (\`/booking/form\` route) via \`BookingFormPageRoute\`
3189
3095
  - Pattern: \`<BookingForm.Root formId={formId}>\` with automatic form rendering
3190
3096
  - Example: \`<BookingForm.Root formId="form-id" />\` - renders form fields automatically
3191
3097
 
3192
3098
  ## The flow
3193
3099
 
3194
3100
  The flow of the bookings system is as follows:
3195
- 1. The user clicks the book now button
3196
- 2. If the user has multiple locations, the user selects a location
3197
- 3. The user selects a service
3198
- 4. The user selects the staff member
3199
- 5. The user selects a time slot
3200
- 6. The user fills out the booking form
3201
- 7. The user confirms the booking
3202
- 8. The user is redirected to the checkout page
3101
+ 1. The user visits the location selection page (\`/booking/locations\`) and selects a business location.
3102
+ 2. The user is navigated to the service list page (\`/booking/services?locationId={id}\`) and clicks "Book" on a service.
3103
+ 3. The user is navigated to the time selection page (\`/booking/slots/:serviceSlug\`).
3104
+ 4. The user selects a time slot and is navigated to the booking form (\`/booking/form\`).
3105
+ 5. The user fills out the form and confirms the booking.
3106
+ 6. The user is redirected to the checkout/confirmation.
3203
3107
 
3204
3108
  <important_component_notes>
3205
3109
  <strong>ALL BOOKINGS COMPONENTS ARE ALREADY IMPLEMENTED IN SIMPLIFIED FORM FOLLOWING HEADLESS-COMPONENTS PATTERNS.</strong>
3206
3110
  <strong>DO NOT REIMPLEMENT THESE COMPONENTS - USE THE EXISTING BOOKINGS COMPONENTS AS PROVIDED.</strong>
3207
3111
  <strong>The components follow the 3-level pattern: Container → List → Repeater for list-based components.</strong>
3208
- <strong>ServiceListWrapper uses ServiceList.Root → ServiceList.Services → ServiceList.ServiceRepeater pattern.</strong>
3209
- <strong>ServiceDetails combines Service.Root, TimeSlotList.Root, and BookingForm.Root for the complete booking flow.</strong>
3112
+ <strong>ServiceListPageRoute uses ServiceList.Root → ServiceList.Services → ServiceList.ServiceRepeater pattern via ServiceListWrapper.</strong>
3113
+ <strong>TimeSlotListPageRoute uses TimeSlotList.Root TimeSlotList.TimeSlots TimeSlotList.TimeSlotRepeater pattern.</strong>
3210
3114
  <strong>All components use semantic color/font classes from the design system (bg-background, text-foreground, font-heading, font-paragraph).</strong>
3211
3115
  </important_component_notes>
3212
3116
 
@@ -3218,7 +3122,6 @@ IF AND ONLY IF THE USER ASKS FOR A NON ENGLISH LANGUAGE, YOU MUST TRANSLATE THE
3218
3122
  \`\`\`bash
3219
3123
  src/components/bookings/pages/
3220
3124
  ├── ServiceListPage.tsx
3221
- ├── ServicePage.tsx
3222
3125
  ├── LocationSelectorPage.tsx
3223
3126
  ├── TimeSlotListPage.tsx
3224
3127
  └── BookingFormPage.tsx
@@ -3237,7 +3140,7 @@ IF THE SITE IS IN ENGLISH OR THE LANGUAGE IS NOT SPECIFIED, YOU MUST NOT READ OR
3237
3140
  <strong>NEVER IMPLEMENT CMS-BASED PAGES LIKE "GALLERY" OR "GALLERY ITEM" OR ANY OTHER CMS BASED PAGES FOR BOOKINGS FEATURES LIKE SERVICES OR ANY OTHER BOOKING FEATURES - ONLY USE THE BOOKINGS ROUTES AND SERVICES TO IMPLEMENT THE BOOKINGS FEATURES !!!</strong>
3238
3141
  <strong>DO NOT IMPLEMENT A "FEATURED SERVICES" OR "FEATURED BOOKINGS" SECTIONS OR PAGES OR TRY TO LINK TO SPECIFIC SERVICES IN ANY PAGE - BECAUSE YOU DO NOT KNOW THE URL FOR THE SERVICES - JUST LINK TO THE BOOKINGS PAGE.</strong>
3239
3142
  <strong>DO NOT USE MOCK DATA FOR SERVICES OR ANY OTHER DATA IN THE HOME PAGE OR ANY OTHER PAGE. ALWAYS LINK TO THE BOOKINGS PAGE.</strong>
3240
- <strong>DO NOT TRY TO GUESS <code>book-online/service/:serviceId</code> OR OTHER BOOKING ROUTES, ONLY INCLUDE A MENU ITEM TO THE BOOKINGS PAGE <code>/book-online</code>.</strong>
3143
+ <strong>DO NOT TRY TO GUESS <code>booking/slots/:serviceSlug</code> OR OTHER BOOKING ROUTES, ONLY INCLUDE A MENU ITEM TO THE BOOKINGS PAGE <code>/booking/locations</code>.</strong>
3241
3144
  <strong>DO NOT IMPLEMENT BOOKINGS SEARCH YOURSELF - NO BOOKINGS SEARCH BAR OR ANY OTHER BOOKINGS SEARCH FEATURES</strong>
3242
3145
  <strong>DO NOT EDIT or READ ANY FILE in <code>./src/wix-verticals/</code> USE EVERYTHING AS IS, ONLY INTEGRATE THE ROUTER!! with the exception of non-english sites, in this case, you are allowed to change the static text to match the new language.</strong>
3243
3146
  </important_notes>
@@ -9778,7 +9681,7 @@ var onServiceCreated2 = createEventModule(onServiceCreated);
9778
9681
  var onServiceDeleted2 = createEventModule(onServiceDeleted);
9779
9682
  var onServiceUpdated2 = createEventModule(onServiceUpdated);
9780
9683
 
9781
- // node_modules/@wix/auto_sdk_bookings_staff-members/build/es/index.mjs
9684
+ // ../../../node_modules/@wix/auto_sdk_bookings_staff-members/build/es/index.mjs
9782
9685
  var es_exports2 = {};
9783
9686
  __export(es_exports2, {
9784
9687
  AggregationType: () => AggregationType2,