@wix/vibe-bookings-plugin 0.16.0 → 0.17.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,54 @@ var getRouterFileContent = () => {
2975
2959
  } from 'react-router-dom';
2976
2960
 
2977
2961
  // Import route components and loaders
2978
- 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
- }
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
+ } from './bookings/routes/location-selector-route';
2975
+ import { Booking } from '@wix/bookings/components';
2976
+ import { WixServicesProvider } from '@/wix-verticals/react-pages/react-router/routes/root';
3062
2977
 
3063
2978
  const router = createBrowserRouter(
3064
2979
  [
3065
2980
  {
3066
2981
  path: '/',
3067
- element: <Navigate to="/book-online" />,
2982
+ element: <Navigate to="/booking/locations" />,
3068
2983
  },
3069
2984
  {
2985
+ path: '/booking',
3070
2986
  element: (
3071
2987
  <WixServicesProvider>
3072
- <Outlet />
2988
+ <Booking.Root bookingServiceConfig={{}}>
2989
+ <Outlet />
2990
+ </Booking.Root>
3073
2991
  </WixServicesProvider>
3074
2992
  ),
3075
- loader: rootRouteLoader,
3076
2993
  children: [
3077
2994
  {
3078
- path: '/book-online',
3079
- element: <ServiceListRoute />,
3080
- },
3081
- {
3082
- path: '/book-online/locations',
3083
- element: <LocationSelectorRoute />,
2995
+ path: 'locations',
2996
+ element: <LocationSelectorPageRoute servicesPagePath="/booking/services" />,
3084
2997
  },
3085
2998
  {
3086
- path: '/book-online/service/:serviceId',
3087
- element: <ServiceDetailsRoute />,
2999
+ path: 'services',
3000
+ element: <ServiceListPageRoute slotsPagePath="/booking/slots" />,
3001
+ loader: serviceListPageRouteLoader,
3088
3002
  },
3089
3003
  {
3090
- path: '/book-online/time-selection/:serviceId',
3091
- element: <TimeSlotListRoute />,
3004
+ path: 'slots/:serviceSlug',
3005
+ element: <TimeSlotListPageRoute formPagePath="/booking/form" />,
3092
3006
  },
3093
3007
  {
3094
- path: '/book-online/booking-form',
3095
- element: <BookingFormRoute />,
3008
+ path: 'form',
3009
+ element: <BookingFormPageRoute />,
3096
3010
  },
3097
3011
  ],
3098
3012
  },
@@ -3116,42 +3030,38 @@ Your tasks for implementing and integrating the Bookings features of the site ar
3116
3030
 
3117
3031
  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
3032
 
3119
- ## Example Bookings Router File
3120
-
3121
- \`\`\`tsx
3122
- ${getRouterFileContent()}
3123
- \`\`\`
3124
3033
 
3125
3034
  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)
3035
+ - /booking/locations - a location selection page for choosing the business location (uses Booking.Locations and Location components via LocationSelectorPageRoute)
3036
+ - /booking/services - a service list page displaying all available booking services (uses ServiceList component via ServiceListPageRoute)
3037
+ - /booking/slots/:serviceSlug - a dedicated time slot selection page (uses TimeSlotList component via TimeSlotListPageRoute)
3038
+ - /booking/form - a dedicated booking form page (uses BookingForm component via BookingFormPageRoute)
3131
3039
 
3132
3040
  The routes in the example router file are wrapped with:
3133
3041
 
3134
3042
  \`\`\`tsx
3135
3043
  <WixServicesProvider>
3136
- ...
3137
- <Outlet />
3044
+ <Booking.Root bookingServiceConfig={{}}>
3045
+ ...
3046
+ <Outlet />
3047
+ </Booking.Root>
3138
3048
  </WixServicesProvider>
3139
3049
  \`\`\`\
3140
3050
 
3141
3051
  <important_router_notes>
3142
3052
  <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>.
3053
+ <strong>WRAP THE MAIN LAYOUT WITH <code><WixServicesProvider></code> and <code><Booking.Root></code> not only the bookings routes.</strong>
3054
+ - 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
3055
  <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
3056
  </important_router_notes>
3147
3057
 
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.
3058
+ The booking components already include proper padding and layout. The \`ServiceListWrapper\` component accepts a \`title\` prop for the page title.
3149
3059
 
3150
3060
  # Layout changes
3151
3061
  The bookings system provides a provider that must be integrated into the site layout.
3152
3062
 
3153
3063
  \`\`\`tsx
3154
- ${getBookingsProviderLayout()}
3064
+ ${getRouterFileContent()}
3155
3065
  \`\`\`
3156
3066
 
3157
3067
  # Available Bookings Components
@@ -3160,53 +3070,45 @@ The bookings system provides the following components from \`@wix/bookings/compo
3160
3070
 
3161
3071
  1. **ServiceList** - Used for displaying a list of booking services
3162
3072
  - Import: \`import { ServiceList } from '@wix/bookings/components';\`
3163
- - Used in: Service list page (\`/book-online\` route) via \`ServiceListWrapper\`
3073
+ - Used in: Service list page (\`/booking/services\` route) via \`ServiceListPageRoute\`
3164
3074
  - Pattern: \`<ServiceList.Root>\` → \`<ServiceList.Services>\` → \`<ServiceList.ServiceRepeater>\`
3165
3075
  - Example: \`<ServiceList.Root serviceListConfig={config}>\` with \`<ServiceList.ServiceRepeater>\` containing \`<Service.Name>\`, \`<Service.Description>\`, \`<Service.Price>\`
3166
3076
 
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
3077
+ 2. **TimeSlotList** - Used for displaying and selecting available time slots for booking
3174
3078
  - Import: \`import { TimeSlotList } from '@wix/bookings/components';\`
3175
- - Used in: Service details page for time slot selection
3079
+ - Used in: Time selection page (\`/booking/slots/:serviceSlug\` route) via \`TimeSlotListPageRoute\`
3176
3080
  - Pattern: \`<TimeSlotList.Root config={config}>\` → \`<TimeSlotList.TimeSlots>\` → \`<TimeSlotList.TimeSlotRepeater>\`
3177
3081
  - Example: \`<TimeSlotList.TimeSlot.StartDate>\`, \`<TimeSlotList.TimeSlot.Actions.Select>\`
3178
3082
 
3179
- 4. **Location** - Used for displaying and selecting booking locations
3083
+ 3. **Location** - Used for displaying and selecting booking locations
3180
3084
  - 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>\`
3085
+ - Used in: Location selector page (\`/booking/locations\` route) via \`LocationSelectorPageRoute\`
3086
+ - Pattern: Used within \`<Booking.Locations>\` → \`<Booking.Locations.List>\` → \`<Booking.Locations.LocationRepeater>\`
3183
3087
  - 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
3088
+ - Note: Location components are used within Booking.Locations.LocationRepeater, which automatically provides location context
3185
3089
 
3186
- 5. **BookingForm** - Used for the booking form to complete a reservation
3090
+ 4. **BookingForm** - Used for the booking form to complete a reservation
3187
3091
  - Import: \`import { BookingForm } from '@wix/bookings/components';\`
3188
- - Used in: Service details page for completing bookings
3092
+ - Used in: Booking form page (\`/booking/form\` route) via \`BookingFormPageRoute\`
3189
3093
  - Pattern: \`<BookingForm.Root formId={formId}>\` with automatic form rendering
3190
3094
  - Example: \`<BookingForm.Root formId="form-id" />\` - renders form fields automatically
3191
3095
 
3192
3096
  ## The flow
3193
3097
 
3194
3098
  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
3099
+ 1. The user visits the location selection page (\`/booking/locations\`) and selects a business location.
3100
+ 2. The user is navigated to the service list page (\`/booking/services?locationId={id}\`) and clicks "Book" on a service.
3101
+ 3. The user is navigated to the time selection page (\`/booking/slots/:serviceSlug\`).
3102
+ 4. The user selects a time slot and is navigated to the booking form (\`/booking/form\`).
3103
+ 5. The user fills out the form and confirms the booking.
3104
+ 6. The user is redirected to the checkout/confirmation.
3203
3105
 
3204
3106
  <important_component_notes>
3205
3107
  <strong>ALL BOOKINGS COMPONENTS ARE ALREADY IMPLEMENTED IN SIMPLIFIED FORM FOLLOWING HEADLESS-COMPONENTS PATTERNS.</strong>
3206
3108
  <strong>DO NOT REIMPLEMENT THESE COMPONENTS - USE THE EXISTING BOOKINGS COMPONENTS AS PROVIDED.</strong>
3207
3109
  <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>
3110
+ <strong>ServiceListPageRoute uses ServiceList.Root → ServiceList.Services → ServiceList.ServiceRepeater pattern via ServiceListWrapper.</strong>
3111
+ <strong>TimeSlotListPageRoute uses TimeSlotList.Root TimeSlotList.TimeSlots TimeSlotList.TimeSlotRepeater pattern.</strong>
3210
3112
  <strong>All components use semantic color/font classes from the design system (bg-background, text-foreground, font-heading, font-paragraph).</strong>
3211
3113
  </important_component_notes>
3212
3114
 
@@ -3218,7 +3120,6 @@ IF AND ONLY IF THE USER ASKS FOR A NON ENGLISH LANGUAGE, YOU MUST TRANSLATE THE
3218
3120
  \`\`\`bash
3219
3121
  src/components/bookings/pages/
3220
3122
  ├── ServiceListPage.tsx
3221
- ├── ServicePage.tsx
3222
3123
  ├── LocationSelectorPage.tsx
3223
3124
  ├── TimeSlotListPage.tsx
3224
3125
  └── BookingFormPage.tsx
@@ -3237,7 +3138,7 @@ IF THE SITE IS IN ENGLISH OR THE LANGUAGE IS NOT SPECIFIED, YOU MUST NOT READ OR
3237
3138
  <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
3139
  <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
3140
  <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>
3141
+ <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
3142
  <strong>DO NOT IMPLEMENT BOOKINGS SEARCH YOURSELF - NO BOOKINGS SEARCH BAR OR ANY OTHER BOOKINGS SEARCH FEATURES</strong>
3242
3143
  <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
3144
  </important_notes>