@wix/vibe-bookings-plugin 0.15.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,98 +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/ServiceListPage';
2980
- import { ServiceDetails } from '@/components/bookings/ServiceDetails';
2981
- import { TimeSlotListPage } from '@/components/bookings/TimeSlotListPage';
2982
- import { BookingFormPage } from '@/components/bookings/BookingFormPage';
2983
- import { loadServiceListServiceInitialData } from '@wix/bookings/services';
2984
- import { useLoaderData, useParams } from 'react-router-dom';
2985
-
2986
- // Service list route component
2987
- function ServiceListRoute() {
2988
- const { servicesListConfig } = useLoaderData<typeof serviceListLoader>();
2989
- return <ServiceListWrapper servicesListConfig={servicesListConfig} servicePageRoute="/bookings" />;
2990
- }
2991
-
2992
- // Service details route component
2993
- function ServiceDetailsRoute() {
2994
- const { serviceId } = useParams<{ serviceId: string }>();
2995
- // Note: Load service data by serviceId and pass to ServiceDetails
2996
- // ServiceDetails requires a service object from @wix/auto_sdk_bookings_services
2997
- // Optionally load timeSlotListConfig and bookingFormId if needed
2998
- return <ServiceDetails
2999
- service={/* load service by serviceId */}
3000
- timeSlotListConfig={/* optional: load time slot list config */}
3001
- bookingFormId={/* optional: booking form ID */}
3002
- />;
3003
- }
3004
-
3005
- // Time slot list route component
3006
- function TimeSlotListRoute() {
3007
- const { timeSlotListConfig } = useLoaderData<typeof timeSlotListLoader>();
3008
- return <TimeSlotListPage config={timeSlotListConfig} />;
3009
- }
3010
-
3011
- // Booking form route component
3012
- function BookingFormRoute() {
3013
- const { formId, additionalMetadata } = useLoaderData<typeof bookingFormLoader>();
3014
- return <BookingFormPage formId={formId} additionalMetadata={additionalMetadata} />;
3015
- }
3016
-
3017
- // Loader for service list route
3018
- async function serviceListLoader() {
3019
- const servicesListConfig = await loadServiceListServiceInitialData({});
3020
- return { servicesListConfig };
3021
- }
3022
-
3023
- // Loader for time slot list route
3024
- async function timeSlotListLoader() {
3025
- // Note: Load time slot list config based on service or other criteria
3026
- const timeSlotListConfig = {/* load time slot list config */};
3027
- return { timeSlotListConfig };
3028
- }
3029
-
3030
- // Loader for booking form route
3031
- async function bookingFormLoader() {
3032
- // Note: Get form ID from route params or config
3033
- const formId = {/* get form ID */};
3034
- const additionalMetadata = {/* optional: additional metadata */};
3035
- return { formId, additionalMetadata };
3036
- }
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';
3037
2977
 
3038
2978
  const router = createBrowserRouter(
3039
2979
  [
3040
2980
  {
3041
2981
  path: '/',
3042
- element: <Navigate to="/bookings" />,
2982
+ element: <Navigate to="/booking/locations" />,
3043
2983
  },
3044
2984
  {
2985
+ path: '/booking',
3045
2986
  element: (
3046
2987
  <WixServicesProvider>
3047
- <Outlet />
2988
+ <Booking.Root bookingServiceConfig={{}}>
2989
+ <Outlet />
2990
+ </Booking.Root>
3048
2991
  </WixServicesProvider>
3049
2992
  ),
3050
- loader: rootRouteLoader,
3051
2993
  children: [
3052
2994
  {
3053
- path: '/bookings',
3054
- element: <ServiceListRoute />,
3055
- loader: serviceListLoader,
2995
+ path: 'locations',
2996
+ element: <LocationSelectorPageRoute servicesPagePath="/booking/services" />,
3056
2997
  },
3057
2998
  {
3058
- path: '/bookings/:serviceId',
3059
- element: <ServiceDetailsRoute />,
2999
+ path: 'services',
3000
+ element: <ServiceListPageRoute slotsPagePath="/booking/slots" />,
3001
+ loader: serviceListPageRouteLoader,
3060
3002
  },
3061
3003
  {
3062
- path: '/bookings/:serviceId/time-slots',
3063
- element: <TimeSlotListRoute />,
3064
- loader: timeSlotListLoader,
3004
+ path: 'slots/:serviceSlug',
3005
+ element: <TimeSlotListPageRoute formPagePath="/booking/form" />,
3065
3006
  },
3066
3007
  {
3067
- path: '/bookings/:serviceId/booking-form',
3068
- element: <BookingFormRoute />,
3069
- loader: bookingFormLoader,
3008
+ path: 'form',
3009
+ element: <BookingFormPageRoute />,
3070
3010
  },
3071
3011
  ],
3072
3012
  },
@@ -3079,7 +3019,6 @@ var getRouterFileContent = () => {
3079
3019
  export default function ReactRouterApp() {
3080
3020
  return <RouterProvider router={router} />;
3081
3021
  }
3082
-
3083
3022
  `;
3084
3023
  };
3085
3024
  var getBookingsCodingInstructions = () => dedent_default`
@@ -3091,77 +3030,85 @@ Your tasks for implementing and integrating the Bookings features of the site ar
3091
3030
 
3092
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.
3093
3032
 
3094
- ## Example Bookings Router File
3095
-
3096
- \`\`\`tsx
3097
- ${getRouterFileContent()}
3098
- \`\`\`
3099
3033
 
3100
3034
  it includes the following routes:
3101
- - /bookings - a service list page displaying all available booking services (uses ServiceList component via ServiceListWrapper)
3102
- - /bookings/:serviceId - a service details page for a specific booking service (uses Service, TimeSlotList, and BookingForm components via ServiceDetails)
3103
- - /bookings/:serviceId/time-slots - a dedicated time slot selection page (uses TimeSlotList component via TimeSlotListPage)
3104
- - /bookings/:serviceId/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)
3105
3039
 
3106
3040
  The routes in the example router file are wrapped with:
3107
3041
 
3108
3042
  \`\`\`tsx
3109
3043
  <WixServicesProvider>
3110
- ...
3111
- <Outlet />
3044
+ <Booking.Root bookingServiceConfig={{}}>
3045
+ ...
3046
+ <Outlet />
3047
+ </Booking.Root>
3112
3048
  </WixServicesProvider>
3113
3049
  \`\`\`\
3114
3050
 
3115
3051
  <important_router_notes>
3116
3052
  <strong>MAKE SURE TO WRAP ALL THE ROUTES WITH THE PROVIDERS IN THE ABOVE EXAMPLE ROUTER</strong>
3117
- <strong>WRAP THE MAIN LAYOUT WITH <code><WixServicesProvider>...</WixServicesProvider></code> not only the bookings routes.</strong>
3118
- - 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>.
3119
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>
3120
3056
  </important_router_notes>
3121
3057
 
3122
- 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.
3123
3059
 
3124
3060
  # Layout changes
3125
3061
  The bookings system provides a provider that must be integrated into the site layout.
3126
3062
 
3127
3063
  \`\`\`tsx
3128
- ${getBookingsProviderLayout()}
3064
+ ${getRouterFileContent()}
3129
3065
  \`\`\`
3130
3066
 
3131
3067
  # Available Bookings Components
3132
3068
 
3133
- The bookings system provides the following components from \`@wix/headless-bookings/react\`:
3069
+ The bookings system provides the following components from \`@wix/bookings/components\`:
3134
3070
 
3135
3071
  1. **ServiceList** - Used for displaying a list of booking services
3136
3072
  - Import: \`import { ServiceList } from '@wix/bookings/components';\`
3137
- - Used in: Service list page (\`/bookings\` route) via \`ServiceListWrapper\`
3073
+ - Used in: Service list page (\`/booking/services\` route) via \`ServiceListPageRoute\`
3138
3074
  - Pattern: \`<ServiceList.Root>\` → \`<ServiceList.Services>\` → \`<ServiceList.ServiceRepeater>\`
3139
3075
  - Example: \`<ServiceList.Root serviceListConfig={config}>\` with \`<ServiceList.ServiceRepeater>\` containing \`<Service.Name>\`, \`<Service.Description>\`, \`<Service.Price>\`
3140
3076
 
3141
- 2. **Service** - Used for displaying individual service details
3142
- - Import: \`import { Service } from '@wix/headless-bookings/react';\`
3143
- - Used in: Service details page (\`/bookings/:serviceId\` route) via \`ServiceDetails\`
3144
- - Pattern: \`<Service.Root service={service}>\` wrapping service components
3145
- - Example: \`<Service.Name>\`, \`<Service.Description>\`, \`<Service.Price>\`, \`<Service.Raw>\`
3146
-
3147
- 3. **TimeSlotList** - Used for displaying and selecting available time slots for booking
3148
- - Import: \`import { TimeSlotList } from '@wix/headless-bookings/react';\`
3149
- - Used in: Service details page for time slot selection
3077
+ 2. **TimeSlotList** - Used for displaying and selecting available time slots for booking
3078
+ - Import: \`import { TimeSlotList } from '@wix/bookings/components';\`
3079
+ - Used in: Time selection page (\`/booking/slots/:serviceSlug\` route) via \`TimeSlotListPageRoute\`
3150
3080
  - Pattern: \`<TimeSlotList.Root config={config}>\` → \`<TimeSlotList.TimeSlots>\` → \`<TimeSlotList.TimeSlotRepeater>\`
3151
3081
  - Example: \`<TimeSlotList.TimeSlot.StartDate>\`, \`<TimeSlotList.TimeSlot.Actions.Select>\`
3152
3082
 
3083
+ 3. **Location** - Used for displaying and selecting booking locations
3084
+ - Import: \`import { Location } from '@wix/bookings/components';\`
3085
+ - Used in: Location selector page (\`/booking/locations\` route) via \`LocationSelectorPageRoute\`
3086
+ - Pattern: Used within \`<Booking.Locations>\` → \`<Booking.Locations.List>\` → \`<Booking.Locations.LocationRepeater>\`
3087
+ - Example: \`<Location.Name>\`, \`<Location.Address>\`, \`<Location.Phone>\`, \`<Location.Email>\`, \`<Location.Actions.Select>\`
3088
+ - Note: Location components are used within Booking.Locations.LocationRepeater, which automatically provides location context
3089
+
3153
3090
  4. **BookingForm** - Used for the booking form to complete a reservation
3154
- - Import: \`import { BookingForm } from '@wix/headless-bookings/react';\`
3155
- - Used in: Service details page for completing bookings
3091
+ - Import: \`import { BookingForm } from '@wix/bookings/components';\`
3092
+ - Used in: Booking form page (\`/booking/form\` route) via \`BookingFormPageRoute\`
3156
3093
  - Pattern: \`<BookingForm.Root formId={formId}>\` with automatic form rendering
3157
3094
  - Example: \`<BookingForm.Root formId="form-id" />\` - renders form fields automatically
3158
3095
 
3096
+ ## The flow
3097
+
3098
+ The flow of the bookings system is as follows:
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.
3105
+
3159
3106
  <important_component_notes>
3160
3107
  <strong>ALL BOOKINGS COMPONENTS ARE ALREADY IMPLEMENTED IN SIMPLIFIED FORM FOLLOWING HEADLESS-COMPONENTS PATTERNS.</strong>
3161
3108
  <strong>DO NOT REIMPLEMENT THESE COMPONENTS - USE THE EXISTING BOOKINGS COMPONENTS AS PROVIDED.</strong>
3162
3109
  <strong>The components follow the 3-level pattern: Container → List → Repeater for list-based components.</strong>
3163
- <strong>ServiceListWrapper uses ServiceList.Root → ServiceList.Services → ServiceList.ServiceRepeater pattern.</strong>
3164
- <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>
3165
3112
  <strong>All components use semantic color/font classes from the design system (bg-background, text-foreground, font-heading, font-paragraph).</strong>
3166
3113
  </important_component_notes>
3167
3114
 
@@ -3171,9 +3118,9 @@ The bookings system provides the following components from \`@wix/headless-booki
3171
3118
  IF AND ONLY IF THE USER ASKS FOR A NON ENGLISH LANGUAGE, YOU MUST TRANSLATE THE FOLLOWING COMPONENTS:
3172
3119
 
3173
3120
  \`\`\`bash
3174
- src/components/bookings/
3121
+ src/components/bookings/pages/
3175
3122
  ├── ServiceListPage.tsx
3176
- ├── ServiceDetails.tsx
3123
+ ├── LocationSelectorPage.tsx
3177
3124
  ├── TimeSlotListPage.tsx
3178
3125
  └── BookingFormPage.tsx
3179
3126
  \`\`\`
@@ -3185,12 +3132,13 @@ IF THE SITE IS IN ENGLISH OR THE LANGUAGE IS NOT SPECIFIED, YOU MUST NOT READ OR
3185
3132
  # THIRD TASK: CODE THE REST OF THE SITE PAGES
3186
3133
 
3187
3134
  <important_notes>
3135
+ <strong>IT IS OF UTMOST IMPORTANCE THAT THE BOOKINGS PROVIDER IS INTEGRATED INTO THE SITE LAYOUT.</strong>
3188
3136
  <strong>ALL BOOKINGS FEATURES ARE ALREADY IMPLEMENTED BY THE BOOKINGS ROUTES, THEY DO NOT INCLUDE HEADER FOOTER OR ANY OTHER LAYOUT COMPONENTS.</strong>
3189
3137
  <strong>THE REST OF THE SITE PAGES SHOULD BE IMPLEMENTED AS USUAL ACCORDING TO THE PLAN AND USER REQUESTS, FOLLOWING THE OTHER INSTRUCTIONS IN THE CONTEXT.</strong>
3190
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>
3191
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>
3192
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>
3193
- <strong>DO NOT TRY TO GUESS <code>bookings/:serviceId</code> ROUTES, ONLY INCLUDE A MENU ITEM TO THE BOOKINGS PAGE <code>/bookings</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>
3194
3142
  <strong>DO NOT IMPLEMENT BOOKINGS SEARCH YOURSELF - NO BOOKINGS SEARCH BAR OR ANY OTHER BOOKINGS SEARCH FEATURES</strong>
3195
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>
3196
3144
  </important_notes>
@@ -9731,7 +9679,7 @@ var onServiceCreated2 = createEventModule(onServiceCreated);
9731
9679
  var onServiceDeleted2 = createEventModule(onServiceDeleted);
9732
9680
  var onServiceUpdated2 = createEventModule(onServiceUpdated);
9733
9681
 
9734
- // ../../../node_modules/@wix/auto_sdk_bookings_staff-members/build/es/index.mjs
9682
+ // node_modules/@wix/auto_sdk_bookings_staff-members/build/es/index.mjs
9735
9683
  var es_exports2 = {};
9736
9684
  __export(es_exports2, {
9737
9685
  AggregationType: () => AggregationType2,