@jay-framework/wix-bookings 0.26.4 → 0.26.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog — @jay-framework/wix-bookings
2
+
3
+ ## Unreleased
4
+
5
+ ### Breaking
6
+
7
+ 1. **Booking pages must add the address markup** (see `wix-bookings-setup.md` → Address). A
8
+ participant form with a Multi-line address (the default booking form has a required one) now
9
+ renders through the new `address` tag of `booking-flow` instead of disabling booking with
10
+ `FORM_UNSUPPORTED`. A page without the address inputs cannot book such a service, so the new
11
+ `wix-bookings-address-bindings` validator **errors** on a `booking-flow` page with no address refs
12
+ when `services.yaml` says a service asks for an address (`BOOKINGS-ADDRESS-UNBOUND`; a warning when
13
+ it cannot tell). A page that only offers address-free services can suppress it with
14
+ `wix-bookings: { allow-unbound-address: true }` in its jay-validations block.
15
+ 2. **`ParticipantFormValue` now includes an address object** (`string | boolean | AddressValue`);
16
+ `createBooking`'s `invalid` outcome may carry `<target>/<part>` keys, `fieldOptions`,
17
+ `revealedParts` and `factsCountry`.
18
+ 3. **Requires the `@jay-framework/wix-forms` release that ships address fields** (release both packages together).
19
+
20
+ ### Behaviour changes
21
+
22
+ - **Participant phones are sent as E.164** (DL #58, kept on the Get Form path): checked with the
23
+ `wixForm` phone rules in the browser and in `createBooking`; a local number uses the Phone
24
+ field's default country, else `defaultPhoneCountry`; with neither it is refused with "Please
25
+ include the country code, starting with +.".
26
+
27
+ ### Features
28
+
29
+ - `createBooking` returns a Create Booking 400 with form violations as `invalid` (located part
30
+ errors) instead of an `UNKNOWN` failure.
31
+ - `services.yaml` gains `participantFormHasAddress` per service.
32
+
33
+ ### Fixes
34
+
35
+ - **A participant phone field made through the Form Schemas API was unsupported.** A
36
+ `TEXT_INPUT` field with format `PHONE` is now a `PHONE` participant field (phone checks, E.164,
37
+ config `defaultPhoneCountry`), so a required one no longer disables booking with
38
+ `FORM_UNSUPPORTED` (wix-forms DL #51 addendum).
@@ -2,17 +2,18 @@ Wix Bookings plugin setup — service list, slot picker, participant form, and c
2
2
 
3
3
  ## What wix-bookings provides
4
4
 
5
- One headless contract and three server actions:
5
+ One headless contract and four server actions:
6
6
 
7
7
  - **booking-flow** — full booking UI (services → slots → form → checkout)
8
8
  - **listServices** — query available booking services
9
9
  - **listSlots** — query availability for a selected service
10
- - **createBooking** — create booking, handle paid (redirect) or free (place-order) checkout
10
+ - **getParticipantForm** — the service's participant form (Wix Get Form, real `required` flags)
11
+ - **createBooking** — re-validate the participant values, create the booking, handle paid (redirect) or free (place-order) checkout
11
12
 
12
13
  ## Prerequisites
13
14
 
14
15
  1. `@jay-framework/wix-server-client` configured (`config/.wix.yaml`)
15
- 2. `@jay-framework/wix-forms` for participant field schema (`getFormSummary`)
16
+ 2. `@jay-framework/wix-forms` for the participant form schema (`wixBookings.getParticipantForm` reads it through `WixFormsService.getRawForm`)
16
17
  3. Wix site with Bookings app enabled and published
17
18
 
18
19
  ## Setup steps
@@ -102,6 +103,44 @@ The Wix site must be **published** — hosted checkout uses the published site.
102
103
  </jay:booking-flow>
103
104
  ```
104
105
 
106
+ ### 6. Address
107
+
108
+ A participant form with a **Multi-line address** (the default booking form has a required one) renders through the `address` tag, **not** through `formFields`. Every country shows its own parts (Israel: street name and house number; the US: a State select; Italy: a region code), so the page binds **all eight parts**, each under `if="<key>.address.<part>.shown"`:
109
+
110
+ ```html
111
+ <div if="flow.address.present" style="display: flex; flex-direction: column">
112
+ <label>{flow.address.country.label}
113
+ <select ref="flow.address.country.input" autocomplete="country">
114
+ <option forEach="flow.address.country.options" trackBy="value" value="{value}">{label}</option>
115
+ </select></label>
116
+ <label if="flow.address.streetName.shown" style="order: {flow.address.streetName.order}">{flow.address.streetName.label}<input ref="flow.address.streetName.input" /></label>
117
+ <label if="flow.address.streetNumber.shown" style="order: {flow.address.streetNumber.order}">{flow.address.streetNumber.label}<input ref="flow.address.streetNumber.input" /></label>
118
+ <label if="flow.address.addressLine.shown" style="order: {flow.address.addressLine.order}">{flow.address.addressLine.label}<input ref="flow.address.addressLine.input" autocomplete="address-line1" /></label>
119
+ <label if="flow.address.addressLine2.shown" style="order: {flow.address.addressLine2.order}">{flow.address.addressLine2.label}<input ref="flow.address.addressLine2.input" autocomplete="address-line2" /></label>
120
+ <label if="flow.address.city.shown" style="order: {flow.address.city.order}">{flow.address.city.label}<input ref="flow.address.city.input" autocomplete="address-level2" /></label>
121
+ <label if="flow.address.subdivision.shown" style="order: {flow.address.subdivision.order}">{flow.address.subdivision.label}
122
+ <select if="flow.address.subdivision.listed" ref="flow.address.subdivision.input" autocomplete="address-level1">
123
+ <option forEach="flow.address.subdivision.options" trackBy="value" value="{value}">{label}</option>
124
+ </select>
125
+ <input if="!flow.address.subdivision.listed" ref="flow.address.subdivision.text" autocomplete="address-level1" /></label>
126
+ <label if="flow.address.postalCode.shown" style="order: {flow.address.postalCode.order}">{flow.address.postalCode.label}<input ref="flow.address.postalCode.input" autocomplete="postal-code" /></label>
127
+ </div>
128
+ ```
129
+
130
+ - Each part has `shown`, `required`, `order`, `label`, `value`, `error`, `invalid` and `input`; `order` is the part's position in the country's layout (Germany puts the postal code before the city, Japan starts with it; 0 when hidden), so bind `style="order: {…order}"` inside a flex container as above; `subdivision` also has `listed`, `options` and the free-text `text` input. `address.error` is the first part error.
131
+ - ❌ Binding the address as a `formFields` input. ❌ Leaving out `streetName` / `streetNumber` (an Israeli visitor gets "Street name is required." with no input). ❌ Binding only one of `subdivision.input` / `subdivision.text`. ❌ `autocomplete="address-line1"` on the street parts: they have no standard token.
132
+ - `createBooking` returns part errors keyed `address/<part>` (`invalid` outcome). When Wix teaches a region list (Italy) or requires a hidden part, the plugin switches that part for you; the page does nothing extra.
133
+ - **Validator** (`wix-bookings-address-bindings`): an unknown part ref or an unbound part input is an **error**. A `booking-flow` page that binds **no** address ref is an error (`BOOKINGS-ADDRESS-UNBOUND`) when a service in `agent-kit/references/wix-bookings/services.yaml` has `participantFormHasAddress: true`, nothing when every service has `false`, and a warning when the file or the flag is missing (re-run `jay-stack agent-kit`). A page that deliberately offers only address-free services silences that one finding:
134
+
135
+ ```html
136
+ <script type="application/jay-validations">
137
+ wix-bookings:
138
+ allow-unbound-address: true
139
+ </script>
140
+ ```
141
+
142
+ - Country names, part labels and region names come from `config/.wix-forms.yaml` `address` (see the wix-forms setup guide): the booking flow resolves addresses through the forms service.
143
+
105
144
  ## Outcomes — write your own copy
106
145
 
107
146
  The plugin reports **what happened** through enum variants; the string tags are English **defaults**. For your own wording or another language, branch on the variant and write the text in jay-html. Never detect an outcome by testing or matching a string.
@@ -111,12 +150,15 @@ The plugin reports **what happened** through enum variants; the string tags are
111
150
  | `servicesFailure` | `NONE`, `PERMISSION` (Bookings API 403), `UNKNOWN` | `servicesError` |
112
151
  | `slotsFailure` | `NONE`, `UNKNOWN` (loading availability failed) | `slotsMessage` |
113
152
  | `bookingState` | `IDLE`, `BOOKING`, `CONFIRMED`, `FAILED` | `bookingStatus` (on `CONFIRMED`) |
114
- | `bookingFailure` | `NONE`, `VALIDATION`, `FORM_UNAVAILABLE`, `CHECKOUT_PERMISSION`, `CHECKOUT_REDIRECT_REJECTED`, `SITE_NOT_PUBLISHED`, `UNKNOWN` | `bookingError` |
153
+ | `bookingFailure` | `NONE`, `VALIDATION`, `FORM_UNAVAILABLE`, `CHECKOUT_PERMISSION`, `CHECKOUT_REDIRECT_REJECTED`, `SITE_NOT_PUBLISHED`, `UNKNOWN`, `FORM_UNSUPPORTED` | `bookingError` |
115
154
 
116
155
  - **No available times** is not a failure: `!hasSlots` with `slotsFailure === NONE` (and `!slotsLoading`).
117
- - `VALIDATION`: the participant form failed a check; `bookingError` names the field (English template, Wix label).
156
+ - `VALIDATION`: the participant form failed a check, in the browser or on the server; `bookingError` names the field (English template, Wix label).
157
+ - `FORM_UNSUPPORTED`: the service's form has a **required** field this version cannot show (for example a file upload, or a second address). Booking stays off for that service until the site is updated (make the field optional in Wix, or upgrade); the form is hidden. Show a "please call us" line, not "try again".
158
+ - `FORM_UNAVAILABLE`: the participant form could not be loaded (Wix error, the address layouts could not be fetched, or the service has no form). Retrying may help.
159
+ - Participant fields (`formFields`): `type` is `STRING`, `EMAIL`, `PHONE`, `URL`, or `BOOLEAN` (the address is in `address`, §6) (a single checkbox: render `<input type="checkbox">` for it; the plugin reads `.checked`).
118
160
 
119
- > **Participant validation is not the `wixForm` pipeline.** The booking flow checks each participant field with `validateFormSummaryField` from `@jay-framework/wix-forms`: required, plus simple email / URL / phone / number patterns on the trimmed value. The `wixForm` phone pipeline (international `+972…` numbers, `defaultPhoneCountry`, `PHONE_COUNTRY`) and the submit hook (`HOOK` errors, `onSubmitStart`) do **not** apply here: phones go to `createBooking` as typed. There is no per-field `errorRule`; branch on `bookingFailure`. For comparison, see `rich-forms.md` §3 in the wix-forms guides.
161
+ > **Participant validation is not the `wixForm` pipeline.** The booking flow checks each participant field with `validateFormField` from `@jay-framework/wix-forms` (DL #51): required, length and pattern from the Wix schema, and the email / URL / phone format rules. Phones use the same `checkPhone` rules as `wixForm`: the visitor may type spaces or dashes, the number is sent to `createBooking` as E.164 (`+1 202-555-0123` → `+12025550123`), and a number without a country code uses the Phone field's default country in Wix, else `defaultPhoneCountry` in `config/.wix-forms.yaml`; with neither, it is refused ("Please include the country code, starting with +."). The submit hook (`HOOK` errors, `onSubmitStart`) does **not** apply here. There is no per-field `errorRule`; branch on `bookingFailure`. For comparison, see `rich-forms.md` §3 in the wix-forms guides.
120
162
  - `CHECKOUT_PERMISSION`, `CHECKOUT_REDIRECT_REJECTED`, `SITE_NOT_PUBLISHED` are **setup** problems (see the troubleshooting guide). Show visitors a neutral line; the default text is a hint for the site owner.
121
163
 
122
164
  ```html
@@ -132,7 +174,7 @@ With a page-script import (`key="booking"`), prefix the tags: `booking.bookingSt
132
174
  ## Server flow
133
175
 
134
176
  ```
135
- listServices → listSlots → getFormSummary (wix-forms) → createBooking
177
+ listServices → listSlots → getParticipantForm (Get Form via wix-forms) → createBooking (re-validates)
136
178
  → POST /bookings/v2/bookings
137
179
  → POST /ecom/v2/carts
138
180
  → POST /ecom/v2/carts/{id}/calculate
@@ -37,27 +37,53 @@ For local smoke tests, **All site permissions** is acceptable temporarily.
37
37
 
38
38
  ## Participant form fields empty
39
39
 
40
- Bookings loads participant fields via `getFormSummary` from `@jay-framework/wix-forms`:
40
+ Bookings loads participant fields via `wixBookings.getParticipantForm` (Wix Get Form):
41
41
 
42
42
  - Ensure `wix-forms` is set up and API key has **Wix Forms** permission
43
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
+ (`00000000-0000-0000-0000-000000000000`) is the site default "Booking form", read like any form;
45
+ `services.yaml` lists it as the service's `formId`. A required field it cannot show gives
46
+ `FORM_UNSUPPORTED`
47
+ - Changed a service or form in the dashboard and the page still shows the old data: the services
48
+ list is slow-rendered and the participant form is cached, both for 10 minutes. Restart the dev
49
+ server, or wait, before re-testing
50
+ - `required` is Wix's real flag (Get Form). Wix's `createBooking` does not enforce it — QA
51
+ 2026-11-10 booked a form with a required Address and got 200 without one — so the plugin's
52
+ `createBooking` re-validates every field on the server and refuses a missing required value
53
+ (`bookingFailure === VALIDATION`)
54
+ - **`FORM_UNSUPPORTED`:** a **required** field uses a kind this version cannot show (dropdown,
55
+ date picker, checkbox group, file upload, number, a second address, …): booking is disabled for that
56
+ service, and `bookingError` names the field. Make the field optional in the Wix dashboard (or
57
+ remove it), or upgrade the plugin. An **optional** field of such a kind is left out of the
58
+ participant form with a server warning (`[wix-bookings] …`), and never sent
59
+ - Shown kinds: text, long text, email, phone, URL, a Multi-line address (the `address` tag, see
60
+ setup §6), and a single checkbox (`type === BOOLEAN`, bind
61
+ it to `<input type="checkbox">`). Hidden fields are ignored with a server warning
62
+
63
+ ## Address problems
64
+
65
+ - **"Country/Region is required." and the page has no address control:** the page binds no
66
+ address refs. Add the address markup (setup §6). The `BOOKINGS-ADDRESS-UNBOUND` validator
67
+ finding reports this at build time.
68
+ - **`FORM_UNAVAILABLE` / "Could not load the address layouts":** the plugin could not fetch the
69
+ address layouts from Wix (List Form Templates): a network or API-key problem, retried after 30 s.
70
+ If the QA-only `WIX_FORMS_ADDRESS_TEMPLATES_ORIGIN` environment variable is set, unset it and
71
+ restart.
72
+ - **"This address cannot be accepted for <country>. Please contact us.":** Wix requires an address
73
+ part outside the eight the plugin knows. Run the L-drift probe (`scripts/address-map-probe.mjs`
74
+ in `@jay-framework/wix-forms`) and report the country, part and rule.
75
+ - **`[wix-forms] address drift: …` in the server log:** Wix answered differently from the plugin's
76
+ country layout map. See "Address drift" in the `@jay-framework/wix-forms`
77
+ `docs/01-setup-and-troubleshooting.md`.
78
+ - **`BOOKINGS-ADDRESS-UNBOUND`:** add the address markup; or re-run `jay-stack agent-kit` if
79
+ `services.yaml` is stale; or, on a page that only offers address-free services, suppress it with
80
+ `wix-bookings: { allow-unbound-address: true }` in the page's jay-validations block.
81
+ - **Italy (and other countries) show region codes, not names:** name them in
82
+ `config/.wix-forms.yaml` `address.labels.subdivisions` (wix-forms setup guide).
57
83
 
58
84
  ## Phone / validation behaves differently from a `wixForm` page
59
85
 
60
- Expected, not a bug. Booking participant fields are checked with `validateFormSummaryField` (required + simple patterns on the trimmed value). The `wixForm` phone rules (international numbers, `defaultPhoneCountry`, `PHONE_COUNTRY`), `HOOK` errors and `onSubmitStart` do not apply to the booking flow, and phones are sent to `createBooking` as typed. Failures surface as `bookingFailure === VALIDATION`, not per-field `errorRule`.
86
+ Expected, not a bug. Booking participant fields are checked with `validateFormField` (the Wix schema's required, length and pattern, plus the format rules), in the browser and again in `createBooking`. Phones use the same `checkPhone` as `wixForm`: a spaced or dashed number such as `+1 202-555-0123` is sent to Wix as E.164 (`+12025550123`), and a number with no country code uses the Phone field's default country, else `defaultPhoneCountry` in `config/.wix-forms.yaml`; with neither it is refused ("Please include the country code, starting with +."). `HOOK` errors and `onSubmitStart` do not apply to the booking flow. Failures surface as `bookingFailure === VALIDATION`, not per-field `errorRule`.
61
87
 
62
88
  ## Do not assume success from redirect alone
63
89
 
@@ -1,5 +1,8 @@
1
1
  name: createBooking
2
- description: Create a booking and complete free checkout or return a paid checkout redirect URL.
2
+ description: >-
3
+ Re-validate the participant values against the service's form, then create a booking and complete
4
+ free checkout or return a paid checkout redirect URL. Form problems are returned as outcomes:
5
+ invalid (fieldErrors by field target) or formUnavailable (FORM_UNSUPPORTED never succeeds on retry).
3
6
 
4
7
  inputSchema:
5
8
  serviceId: string
@@ -15,5 +18,12 @@ inputSchema:
15
18
  paymentPreference?: enum(ONLINE | OFFLINE)
16
19
 
17
20
  outputSchema:
18
- outcome: enum(confirmed | redirect)
21
+ outcome: enum(confirmed | redirect | invalid | formUnavailable)
22
+ orderId?: string
19
23
  redirectUrl?: string
24
+ fieldErrors?: object # by target, or <target>/<part> for an address part (DL #52)
25
+ fieldOptions?: object # <target>/subdivision → the codes Wix accepts, learned from this 400 (DL #52)
26
+ revealedParts?: object # target → parts Wix required that the layout hid (DL #52)
27
+ factsCountry?: object # target → the submitted country the learned facts belong to (DL #52)
28
+ failure?: enum(FORM_UNSUPPORTED | FORM_UNAVAILABLE)
29
+ message?: string
@@ -0,0 +1,28 @@
1
+ name: getParticipantForm
2
+ description: >-
3
+ Load a booking service's participant form (Wix Get Form) in layout order. Fields bookings cannot
4
+ show are listed in unsupportedFields; a required one disables booking (FORM_UNSUPPORTED).
5
+
6
+ inputSchema:
7
+ serviceId: string
8
+
9
+ outputSchema:
10
+ fields:
11
+ - target: string
12
+ label: string
13
+ type: enum(STRING | EMAIL | PHONE | URL | BOOLEAN | ADDRESS)
14
+ required: boolean
15
+ longText: boolean
16
+ placeholder: string
17
+ minLength?: number
18
+ maxLength?: number
19
+ pattern?: string
20
+ options:
21
+ - value: string
22
+ label: string
23
+ address?: object # ADDRESS only: the resolved spec (countries, layouts, learned facts), DL #52
24
+ unsupportedFields:
25
+ - target: string
26
+ label: string
27
+ wixKind: string
28
+ required: boolean
@@ -104,9 +104,127 @@ tags:
104
104
  tags:
105
105
  - { tag: target, type: data, dataType: string }
106
106
  - { tag: label, type: data, dataType: string }
107
- - { tag: type, type: data, dataType: string }
107
+ - { tag: type, type: data, dataType: string, description: "STRING | EMAIL | PHONE | URL | BOOLEAN (a single checkbox: bind it to an input type=checkbox). The address is not here: bind the address tag" }
108
108
  - { tag: required, type: data, dataType: boolean }
109
- - { tag: formInputs, type: interactive, elementType: HTMLInputElement, description: Participant form field }
109
+ - { tag: formInputs, type: interactive, elementType: HTMLInputElement, description: Participant form field (a checkbox for BOOLEAN) }
110
+
111
+ - tag: address
112
+ type: sub-contract
113
+ phase: fast+interactive
114
+ description: "The participant address (DL #52); bind every part, each country shows its own."
115
+ tags:
116
+ - { tag: present, type: variant, dataType: boolean, description: The participant form has an address field }
117
+ - { tag: label, type: data, dataType: string }
118
+ - { tag: required, type: variant, dataType: boolean }
119
+ - { tag: error, type: data, dataType: string }
120
+ - { tag: invalid, type: variant, dataType: boolean }
121
+ - tag: country
122
+ type: sub-contract
123
+ tags:
124
+ - { tag: label, type: data, dataType: string }
125
+ - { tag: value, type: data, dataType: string }
126
+ - { tag: error, type: data, dataType: string }
127
+ - { tag: invalid, type: variant, dataType: boolean }
128
+ - { tag: input, type: interactive, elementType: HTMLSelectElement }
129
+ - tag: options
130
+ type: sub-contract
131
+ repeated: true
132
+ trackBy: value
133
+ tags:
134
+ - { tag: value, type: data, dataType: string }
135
+ - { tag: label, type: data, dataType: string }
136
+ - tag: addressLine
137
+ type: sub-contract
138
+ tags:
139
+ - { tag: shown, type: variant, dataType: boolean }
140
+ - { tag: required, type: variant, dataType: boolean }
141
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
142
+ - { tag: label, type: data, dataType: string }
143
+ - { tag: value, type: data, dataType: string }
144
+ - { tag: error, type: data, dataType: string }
145
+ - { tag: invalid, type: variant, dataType: boolean }
146
+ - { tag: maxLength, type: data, dataType: number }
147
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
148
+ - tag: addressLine2
149
+ type: sub-contract
150
+ tags:
151
+ - { tag: shown, type: variant, dataType: boolean }
152
+ - { tag: required, type: variant, dataType: boolean }
153
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
154
+ - { tag: label, type: data, dataType: string }
155
+ - { tag: value, type: data, dataType: string }
156
+ - { tag: error, type: data, dataType: string }
157
+ - { tag: invalid, type: variant, dataType: boolean }
158
+ - { tag: maxLength, type: data, dataType: number }
159
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
160
+ - tag: streetName
161
+ type: sub-contract
162
+ tags:
163
+ - { tag: shown, type: variant, dataType: boolean }
164
+ - { tag: required, type: variant, dataType: boolean }
165
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
166
+ - { tag: label, type: data, dataType: string }
167
+ - { tag: value, type: data, dataType: string }
168
+ - { tag: error, type: data, dataType: string }
169
+ - { tag: invalid, type: variant, dataType: boolean }
170
+ - { tag: maxLength, type: data, dataType: number }
171
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
172
+ - tag: streetNumber
173
+ type: sub-contract
174
+ tags:
175
+ - { tag: shown, type: variant, dataType: boolean }
176
+ - { tag: required, type: variant, dataType: boolean }
177
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
178
+ - { tag: label, type: data, dataType: string }
179
+ - { tag: value, type: data, dataType: string }
180
+ - { tag: error, type: data, dataType: string }
181
+ - { tag: invalid, type: variant, dataType: boolean }
182
+ - { tag: maxLength, type: data, dataType: number }
183
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
184
+ - tag: city
185
+ type: sub-contract
186
+ tags:
187
+ - { tag: shown, type: variant, dataType: boolean }
188
+ - { tag: required, type: variant, dataType: boolean }
189
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
190
+ - { tag: label, type: data, dataType: string }
191
+ - { tag: value, type: data, dataType: string }
192
+ - { tag: error, type: data, dataType: string }
193
+ - { tag: invalid, type: variant, dataType: boolean }
194
+ - { tag: maxLength, type: data, dataType: number }
195
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
196
+ - tag: subdivision
197
+ type: sub-contract
198
+ tags:
199
+ - { tag: shown, type: variant, dataType: boolean }
200
+ - { tag: listed, type: variant, dataType: boolean }
201
+ - { tag: required, type: variant, dataType: boolean }
202
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
203
+ - { tag: label, type: data, dataType: string }
204
+ - { tag: value, type: data, dataType: string }
205
+ - { tag: error, type: data, dataType: string }
206
+ - { tag: invalid, type: variant, dataType: boolean }
207
+ - { tag: input, type: interactive, elementType: HTMLSelectElement }
208
+ - { tag: text, type: interactive, elementType: HTMLInputElement }
209
+ - tag: options
210
+ type: sub-contract
211
+ repeated: true
212
+ trackBy: value
213
+ tags:
214
+ - { tag: value, type: data, dataType: string }
215
+ - { tag: label, type: data, dataType: string }
216
+ - tag: postalCode
217
+ type: sub-contract
218
+ tags:
219
+ - { tag: shown, type: variant, dataType: boolean }
220
+ - { tag: required, type: variant, dataType: boolean }
221
+ - { tag: order, type: data, dataType: number } # template layout position, 0 when hidden
222
+ - { tag: label, type: data, dataType: string }
223
+ - { tag: value, type: data, dataType: string }
224
+ - { tag: error, type: data, dataType: string }
225
+ - { tag: invalid, type: variant, dataType: boolean }
226
+ - { tag: maxLength, type: data, dataType: number }
227
+ - { tag: input, type: interactive, elementType: HTMLInputElement }
110
228
 
111
229
  - tag: formLoading
112
230
  type: variant
@@ -137,9 +255,9 @@ tags:
137
255
 
138
256
  - tag: bookingFailure
139
257
  type: variant
140
- dataType: enum (NONE | VALIDATION | FORM_UNAVAILABLE | CHECKOUT_PERMISSION | CHECKOUT_REDIRECT_REJECTED | SITE_NOT_PUBLISHED | UNKNOWN)
258
+ dataType: enum (NONE | VALIDATION | FORM_UNAVAILABLE | CHECKOUT_PERMISSION | CHECKOUT_REDIRECT_REJECTED | SITE_NOT_PUBLISHED | UNKNOWN | FORM_UNSUPPORTED)
141
259
  phase: fast+interactive
142
- description: Why the participant form or the booking failed (NONE when it did not)
260
+ description: Why the participant form or the booking failed (NONE when it did not). FORM_UNSUPPORTED = the form has a required field this site cannot show; booking stays off until the site is updated
143
261
 
144
262
  - tag: bookButton
145
263
  type: interactive
@@ -38,6 +38,118 @@ export interface FormFieldOfBookingFlowViewState {
38
38
  required: boolean
39
39
  }
40
40
 
41
+ export interface OptionOfCountryOfAddressOfBookingFlowViewState {
42
+ value: string,
43
+ label: string
44
+ }
45
+
46
+ export interface CountryOfAddressOfBookingFlowViewState {
47
+ label: string,
48
+ value: string,
49
+ error: string,
50
+ invalid: boolean,
51
+ options: Array<OptionOfCountryOfAddressOfBookingFlowViewState>
52
+ }
53
+
54
+ export interface AddressLineOfAddressOfBookingFlowViewState {
55
+ shown: boolean,
56
+ required: boolean,
57
+ order: number,
58
+ label: string,
59
+ value: string,
60
+ error: string,
61
+ invalid: boolean,
62
+ maxLength: number
63
+ }
64
+
65
+ export interface AddressLine2OfAddressOfBookingFlowViewState {
66
+ shown: boolean,
67
+ required: boolean,
68
+ order: number,
69
+ label: string,
70
+ value: string,
71
+ error: string,
72
+ invalid: boolean,
73
+ maxLength: number
74
+ }
75
+
76
+ export interface StreetNameOfAddressOfBookingFlowViewState {
77
+ shown: boolean,
78
+ required: boolean,
79
+ order: number,
80
+ label: string,
81
+ value: string,
82
+ error: string,
83
+ invalid: boolean,
84
+ maxLength: number
85
+ }
86
+
87
+ export interface StreetNumberOfAddressOfBookingFlowViewState {
88
+ shown: boolean,
89
+ required: boolean,
90
+ order: number,
91
+ label: string,
92
+ value: string,
93
+ error: string,
94
+ invalid: boolean,
95
+ maxLength: number
96
+ }
97
+
98
+ export interface CityOfAddressOfBookingFlowViewState {
99
+ shown: boolean,
100
+ required: boolean,
101
+ order: number,
102
+ label: string,
103
+ value: string,
104
+ error: string,
105
+ invalid: boolean,
106
+ maxLength: number
107
+ }
108
+
109
+ export interface OptionOfSubdivisionOfAddressOfBookingFlowViewState {
110
+ value: string,
111
+ label: string
112
+ }
113
+
114
+ export interface SubdivisionOfAddressOfBookingFlowViewState {
115
+ shown: boolean,
116
+ listed: boolean,
117
+ required: boolean,
118
+ order: number,
119
+ label: string,
120
+ value: string,
121
+ error: string,
122
+ invalid: boolean,
123
+ options: Array<OptionOfSubdivisionOfAddressOfBookingFlowViewState>
124
+ }
125
+
126
+ export interface PostalCodeOfAddressOfBookingFlowViewState {
127
+ shown: boolean,
128
+ required: boolean,
129
+ order: number,
130
+ label: string,
131
+ value: string,
132
+ error: string,
133
+ invalid: boolean,
134
+ maxLength: number
135
+ }
136
+
137
+ export interface AddressOfBookingFlowViewState {
138
+ present: boolean,
139
+ label: string,
140
+ required: boolean,
141
+ error: string,
142
+ invalid: boolean,
143
+ country: CountryOfAddressOfBookingFlowViewState,
144
+ addressLine: AddressLineOfAddressOfBookingFlowViewState,
145
+ addressLine2: AddressLine2OfAddressOfBookingFlowViewState,
146
+ streetName: StreetNameOfAddressOfBookingFlowViewState,
147
+ streetNumber: StreetNumberOfAddressOfBookingFlowViewState,
148
+ city: CityOfAddressOfBookingFlowViewState,
149
+ subdivision: SubdivisionOfAddressOfBookingFlowViewState,
150
+ postalCode: PostalCodeOfAddressOfBookingFlowViewState
151
+ }
152
+
41
153
  export enum BookingState {
42
154
  IDLE,
43
155
  BOOKING,
@@ -52,7 +164,8 @@ export enum BookingFailure {
52
164
  CHECKOUT_PERMISSION,
53
165
  CHECKOUT_REDIRECT_REJECTED,
54
166
  SITE_NOT_PUBLISHED,
55
- UNKNOWN
167
+ UNKNOWN,
168
+ FORM_UNSUPPORTED
56
169
  }
57
170
 
58
171
  export interface BookingFlowViewState {
@@ -71,6 +184,7 @@ export interface BookingFlowViewState {
71
184
  slotsMessage: string,
72
185
  slotsFailure: SlotsFailure,
73
186
  formFields: Array<FormFieldOfBookingFlowViewState>,
187
+ address: AddressOfBookingFlowViewState,
74
188
  formLoading: boolean,
75
189
  isBooking: boolean,
76
190
  bookingStatus: string,
@@ -85,12 +199,14 @@ export type BookingFlowFastViewState = Pick<BookingFlowViewState, 'servicesLoadi
85
199
  services: Array<BookingFlowViewState['services'][number]>;
86
200
  slots: Array<BookingFlowViewState['slots'][number]>;
87
201
  formFields: Array<BookingFlowViewState['formFields'][number]>;
202
+ address: BookingFlowViewState['address'];
88
203
  };
89
204
 
90
205
  export type BookingFlowInteractiveViewState = Pick<BookingFlowViewState, 'servicesLoading' | 'showNoServices' | 'hasSlots' | 'servicesError' | 'servicesFailure' | 'showServices' | 'showSlots' | 'showForm' | 'selectedServiceName' | 'slotsLoading' | 'slotsMessage' | 'slotsFailure' | 'formLoading' | 'isBooking' | 'bookingStatus' | 'bookingError' | 'bookingState' | 'bookingFailure'> & {
91
206
  services: Array<BookingFlowViewState['services'][number]>;
92
207
  slots: Array<BookingFlowViewState['slots'][number]>;
93
208
  formFields: Array<BookingFlowViewState['formFields'][number]>;
209
+ address: BookingFlowViewState['address'];
94
210
  };
95
211
 
96
212
 
@@ -105,6 +221,33 @@ export interface BookingFlowRefs {
105
221
  },
106
222
  formFields: {
107
223
  formInputs: HTMLElementCollectionProxy<FormFieldOfBookingFlowViewState, HTMLInputElement>
224
+ },
225
+ address: {
226
+ country: {
227
+ input: HTMLElementProxy<CountryOfAddressOfBookingFlowViewState, HTMLSelectElement>
228
+ },
229
+ addressLine: {
230
+ input: HTMLElementProxy<AddressLineOfAddressOfBookingFlowViewState, HTMLInputElement>
231
+ },
232
+ addressLine2: {
233
+ input: HTMLElementProxy<AddressLine2OfAddressOfBookingFlowViewState, HTMLInputElement>
234
+ },
235
+ streetName: {
236
+ input: HTMLElementProxy<StreetNameOfAddressOfBookingFlowViewState, HTMLInputElement>
237
+ },
238
+ streetNumber: {
239
+ input: HTMLElementProxy<StreetNumberOfAddressOfBookingFlowViewState, HTMLInputElement>
240
+ },
241
+ city: {
242
+ input: HTMLElementProxy<CityOfAddressOfBookingFlowViewState, HTMLInputElement>
243
+ },
244
+ subdivision: {
245
+ input: HTMLElementProxy<SubdivisionOfAddressOfBookingFlowViewState, HTMLSelectElement>,
246
+ text: HTMLElementProxy<SubdivisionOfAddressOfBookingFlowViewState, HTMLInputElement>
247
+ },
248
+ postalCode: {
249
+ input: HTMLElementProxy<PostalCodeOfAddressOfBookingFlowViewState, HTMLInputElement>
250
+ }
108
251
  }
109
252
  }
110
253
 
@@ -120,6 +263,33 @@ export interface BookingFlowRepeatedRefs {
120
263
  },
121
264
  formFields: {
122
265
  formInputs: HTMLElementCollectionProxy<FormFieldOfBookingFlowViewState, HTMLInputElement>
266
+ },
267
+ address: {
268
+ country: {
269
+ input: HTMLElementCollectionProxy<CountryOfAddressOfBookingFlowViewState, HTMLSelectElement>
270
+ },
271
+ addressLine: {
272
+ input: HTMLElementCollectionProxy<AddressLineOfAddressOfBookingFlowViewState, HTMLInputElement>
273
+ },
274
+ addressLine2: {
275
+ input: HTMLElementCollectionProxy<AddressLine2OfAddressOfBookingFlowViewState, HTMLInputElement>
276
+ },
277
+ streetName: {
278
+ input: HTMLElementCollectionProxy<StreetNameOfAddressOfBookingFlowViewState, HTMLInputElement>
279
+ },
280
+ streetNumber: {
281
+ input: HTMLElementCollectionProxy<StreetNumberOfAddressOfBookingFlowViewState, HTMLInputElement>
282
+ },
283
+ city: {
284
+ input: HTMLElementCollectionProxy<CityOfAddressOfBookingFlowViewState, HTMLInputElement>
285
+ },
286
+ subdivision: {
287
+ input: HTMLElementCollectionProxy<SubdivisionOfAddressOfBookingFlowViewState, HTMLSelectElement>,
288
+ text: HTMLElementCollectionProxy<SubdivisionOfAddressOfBookingFlowViewState, HTMLInputElement>
289
+ },
290
+ postalCode: {
291
+ input: HTMLElementCollectionProxy<PostalCodeOfAddressOfBookingFlowViewState, HTMLInputElement>
292
+ }
123
293
  }
124
294
  }
125
295