@seatlayer/js 0.56.0 → 0.57.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/README.md CHANGED
@@ -225,6 +225,7 @@ designer.mount();
225
225
  `new SeatingChart(options)` — options: `container` (selector or element, required),
226
226
  `event` (key, required), `apiBase?`, `maxSelection?` (default 10),
227
227
  `selectedObjects?`, `selectableObjects?`, `numberOfPlacesToSelect?`,
228
+ `selectionValidators?`,
228
229
  `onSelectionChange?`, `onSelectionValidityChange?`, `onHold?`,
229
230
  `onHoldRestored?`, `onError?`.
230
231
 
@@ -232,6 +233,33 @@ Selection methods: `getSelection()`, `selectObjects()`, `deselectObjects()`,
232
233
  `clearSelection()`, `selectCategories()`, `deselectCategories()`,
233
234
  `setSelectableObjects()`, `setMaxSelection()`, `getSelectionValidity()`.
234
235
 
236
+ Selection validators are local buyer guidance and a pre-hold guard. They do not
237
+ replace the server's authoritative availability, ticket-option, or companion
238
+ checks:
239
+
240
+ ```js
241
+ new SeatPicker({
242
+ container: '#seats',
243
+ event: 'ev_xxx',
244
+ selectionValidators: [
245
+ { type: 'minimumSelectedPlaces', minimum: 2 },
246
+ { type: 'consecutiveSeats' },
247
+ { type: 'noOrphanSeats' },
248
+ ],
249
+ onSelectionValidityChange: ({ isValid, violations }) => {
250
+ checkoutButton.disabled = !isValid;
251
+ warning.textContent = violations.join(', ');
252
+ },
253
+ });
254
+ ```
255
+
256
+ `consecutiveSeats` means one uninterrupted run in the same row and category.
257
+ `noOrphanSeats` rejects a choice that strands one free seat between unavailable
258
+ neighbours. The full `SeatPicker` disables checkout and shows localized advice;
259
+ bare `SeatingChart.hold()` rejects an invalid selection with
260
+ `code: 'selection_invalid'`. Exact-count failures keep the existing
261
+ `selection_count_mismatch` code.
262
+
235
263
  Lifecycle/hold methods: `render()`, `hold()`, `bestAvailable(qty, categoryKey?)`,
236
264
  `resumeHold(holdId)`, `getCurrentHold()`, `releaseLabels(labels)`, `release()`,
237
265
  `destroy()`.