@jay-framework/wix-bookings 0.26.0 → 0.26.3

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.
@@ -46,7 +46,7 @@ No inspector result → fallback.
46
46
  | `K.services` (or `services` inside a `booking-flow` region) | `id` | service id |
47
47
 
48
48
  Use the first match. `slots` and `formFields` frames are **not** services — skip them and keep going outward.
49
- 2. **No match** — the click is on the slot picker, the booking form, or the selected service's name (`{K.selectedServiceName}`): there is **no service id** in the inspector result. Don't look one up by name. Use the services-list link and name the service from the visible text.
49
+ 2. **No match** — the click is on the slot picker, the booking form, or the selected service's name (`{K.selectedServiceName}`): there is **no service id** in the inspector result. Don't guess from markup alone. If the user **named** a service in chat, you may match `name` → `serviceId` in `agent-kit/references/wix-bookings/services.yaml` (from `jay-stack agent-kit`) and then build the single-service link; otherwise use the services-list link and name the service from the visible text.
50
50
  3. **Build the link** with `wix-server-client/getDashboardUrl`: service → `{ "path": "bookings/services/form/<serviceId>" }`. Run from the project root: `npx jay-stack-cli action wix-server-client/getDashboardUrl --input '{"path":"bookings/services/form/<serviceId>"}'`; the output's `url` is the link. Never read `config/.wix.yaml` or other credential files to build it.
51
51
  4. **Reply** (see [Agent behavior](#agent-behavior)): plain language only — e.g. “This service is set up in your Wix Bookings dashboard; you can change the name here: <url>” or “I updated the service name to …; you can review it here: <url>”.
52
52
 
@@ -30,12 +30,40 @@ postCheckoutUrl: "/book"
30
30
 
31
31
  | Field | Purpose |
32
32
  |-------|---------|
33
- | `bookingAppId` | Wix Bookings app ID on the site |
34
- | `staffResourceTypeId` | Resource type for `ANY_RESOURCE` staff selection |
33
+ | `bookingAppId` | Wix Bookings app ID on the site (empty = default Wix Bookings app) |
34
+ | `staffResourceTypeId` | Site-specific resource **typeId** for staff — required when slot queries use `ANY_RESOURCE` staff selection |
35
35
  | `slotWindowDays` | How far ahead to query slots (default 14) |
36
36
  | `postCheckoutUrl` | Relative path after paid checkout (e.g. `/book`) |
37
37
 
38
- ### 2. API key permissions
38
+ #### `staffResourceTypeId` — setup auto-fill
39
+
40
+ Each Wix site has its own staff resource type. `jay-stack setup wix-bookings` tries to fill an empty value from live Bookings data:
41
+
42
+ 1. `POST /bookings/v1/staff-members/query` — collect each service-provider staff member's `resourceId`
43
+ 2. `POST /bookings/v2/resources/query` — find a resource in that set and take its `typeId`
44
+
45
+ `POST /bookings/v2/resources/resource-types/query` is **not** used (it can return an empty list on a fresh site).
46
+
47
+ | Outcome | What to do |
48
+ |---------|------------|
49
+ | Setup writes `staffResourceTypeId` | Re-run `jay-stack setup` only when staff or resource types change on the site |
50
+ | Setup returns `needs-config` (no staff) | Add at least one staff member in the Wix Bookings dashboard, run setup again, **or** copy a staff resource's `typeId` from `POST /bookings/v2/resources/query` into `config/.wix-bookings.yaml` |
51
+ | Value already in YAML | Setup leaves it unchanged (no Wix calls) |
52
+
53
+ ### 2. Agent-kit references (`jay-stack agent-kit`)
54
+
55
+ After setup and a working API key, run `jay-stack agent-kit` to refresh:
56
+
57
+ | File | Contents |
58
+ |------|----------|
59
+ | `agent-kit/references/wix-bookings/services.yaml` | Visible services — `serviceId`, `name`, `type`, `formId`, `dashboardPath` (`bookings/services/form/<id>`) |
60
+ | `agent-kit/references/wix-bookings/site.yaml` | `staffResourceTypeId`, staff members (`id`, `resourceId`), config vs discovered type for troubleshooting |
61
+
62
+ Same pattern as `wix-forms` → `forms.yaml` and `wix-data` → `collections.yaml`: agents resolve **which service** or **which staff resource type** without guessing from page markup alone.
63
+
64
+ Staff and services are **not** edited in Jay — the index is for discovery and dashboard links. Service field changes stay in the Wix dashboard (see `wix-bookings-dashboard-content.md`).
65
+
66
+ ### 3. API key permissions
39
67
 
40
68
  Configure in [Wix API Keys Manager](https://manage.wix.com/account/api-keys). Each step needs its own permission; Wix returns **403** until the right scope is granted.
41
69
 
@@ -47,7 +75,7 @@ Configure in [Wix API Keys Manager](https://manage.wix.com/account/api-keys). Ea
47
75
 
48
76
  Also enable **Wix Forms** on the API key (via `wix-forms` plugin) for participant field schema.
49
77
 
50
- ### 3. Headless settings (not API key)
78
+ ### 4. Headless settings (not API key)
51
79
 
52
80
  Under **Dashboard → Settings → Development & integrations → Headless Settings → your client** (same `clientId` as `config/.wix.yaml`):
53
81
 
@@ -60,7 +88,7 @@ For local dev, add **`localhost:3000`** under **Allowed redirect domains** (doma
60
88
 
61
89
  The Wix site must be **published** — hosted checkout uses the published site.
62
90
 
63
- ### 4. Booking page
91
+ ### 5. Booking page
64
92
 
65
93
  ```html
66
94
  <script type="application/jay-headless"
@@ -40,7 +40,20 @@ For local smoke tests, **All site permissions** is acceptable temporarily.
40
40
  Bookings loads participant fields via `getFormSummary` from `@jay-framework/wix-forms`:
41
41
 
42
42
  - Ensure `wix-forms` is set up and API key has **Wix Forms** permission
43
- - Service must have a `form._id` in the Wix Bookings schema
43
+ - A service's participant form is `form.id` in the Wix Bookings service. The all-zero id
44
+ (`00000000-0000-0000-0000-000000000000`) means the site default form: the plugin then shows its
45
+ built-in First name / Last name / Email fields and does not call `getFormSummary`
46
+ - `formId` in `agent-kit/references/wix-bookings/services.yaml` is empty for those default-form services
47
+ - Changed a service in the dashboard (e.g. assigned a custom form) and the page still shows the old
48
+ data: the services list is slow-rendered and stays fresh for 10 minutes. Restart the dev server,
49
+ or wait, before re-testing
50
+ - Fields show `required: false` even when Wix requires them: the Form Summary API does not
51
+ carry `required`. **`createBooking` does not enforce it either** — QA 2026-11-10 booked a form
52
+ with a required Address and got 200 without one
53
+ - **Known gap — fields are dropped:** only text, email, phone, number and URL fields are shown.
54
+ Address (and other non-text fields) are silently left out of the participant form, even when
55
+ required. Wix checkout does not ask for them either, so the booking is confirmed without them.
56
+ Do not put address or other non-text fields on a booking form until this is fixed
44
57
 
45
58
  ## Do not assume success from redirect alone
46
59
 
@@ -50,6 +63,19 @@ Bookings loads participant fields via `getFormSummary` from `@jay-framework/wix-
50
63
 
51
64
  | Symptom | Check |
52
65
  |---------|-------|
53
- | No services | `bookingAppId` in `config/.wix-bookings.yaml` |
54
- | Slot query fails | `staffResourceTypeId` matches site resource type |
66
+ | No services | `bookingAppId` in `config/.wix-bookings.yaml`; API key **Wix Bookings** permission |
67
+ | Slot query fails / no availability | `staffResourceTypeId` in config — must be the staff resource's `typeId` on this site |
68
+ | Setup could not fill `staffResourceTypeId` | No staff on site — add staff in Bookings dashboard and re-run `jay-stack setup wix-bookings` |
69
+ | `staffResourceTypeId` looks wrong | Compare `staffResourceTypeIdFromConfig` vs `staffResourceTypeIdDiscovered` in `agent-kit/references/wix-bookings/site.yaml` after `jay-stack agent-kit` |
70
+ | Agent cannot name a service | Refresh `agent-kit/references/wix-bookings/services.yaml` (`jay-stack agent-kit`) |
55
71
  | Wrong return URL after checkout | `postCheckoutUrl` in config |
72
+
73
+ ### `staffResourceTypeId` manual recovery
74
+
75
+ When setup returns `needs-config` for staff:
76
+
77
+ 1. In Wix Bookings, ensure at least one **staff member** exists.
78
+ 2. Re-run `jay-stack setup wix-bookings`, **or**
79
+ 3. Call `POST /bookings/v2/resources/query`, find a resource linked to staff, and set `staffResourceTypeId` to that resource's `typeId` in `config/.wix-bookings.yaml`.
80
+
81
+ Runtime slot queries pass this value as `resourceTypeId` when the service allows any staff member (`ANY_RESOURCE`). An empty or wrong value causes Wix to reject the slot request.
@@ -238,6 +238,11 @@ declare const createBooking: _jay_framework_fullstack_component.JayAction<{
238
238
  paymentPreference?: "ONLINE" | "OFFLINE";
239
239
  }, CreateBookingOutcome, [WixBookingsService]>;
240
240
 
241
+ interface ServiceForm {
242
+ id?: string;
243
+ _id?: string;
244
+ }
245
+
241
246
  interface RawBookingService {
242
247
  _id?: string;
243
248
  id?: string;
@@ -262,9 +267,7 @@ interface RawBookingService {
262
267
  sessionDurations?: number[];
263
268
  };
264
269
  };
265
- form?: {
266
- _id?: string;
267
- };
270
+ form?: ServiceForm;
268
271
  }
269
272
 
270
273
  /**
@@ -1,4 +1,4 @@
1
- export { m as BookingFeatures, g as BookingFormFieldView, q as BookingOrder, B as BookingServiceView, f as BookingSlotView, n as BookingStep, C as CreateBookingOutcome, T as TimeSlot, o as TimeSlotsQuery, h as WIX_BOOKINGS_CONTEXT, p as WixBookingsContext, b as bookingFlow, j as canBookOnline, d as createBooking, k as createWixBookingsContext, i as init, l as listServices, c as listSlots } from './index.client-gTd3Cezm.js';
1
+ export { m as BookingFeatures, g as BookingFormFieldView, q as BookingOrder, B as BookingServiceView, f as BookingSlotView, n as BookingStep, C as CreateBookingOutcome, T as TimeSlot, o as TimeSlotsQuery, h as WIX_BOOKINGS_CONTEXT, p as WixBookingsContext, b as bookingFlow, j as canBookOnline, d as createBooking, k as createWixBookingsContext, i as init, l as listServices, c as listSlots } from './index.client-oaMPI34g.js';
2
2
  import '@jay-framework/fullstack-component';
3
3
  import '@jay-framework/component';
4
4
  import '@jay-framework/runtime';