@seatlayer/core 0.56.0 → 0.58.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.d.cts CHANGED
@@ -1052,14 +1052,12 @@ interface PickerTransport {
1052
1052
  interface PickerCallbacks extends RendererCallbacks {
1053
1053
  /** Selection changed (manual clicks or a server best-available pick). */
1054
1054
  onSelectionChange?: (seats: PickerSeat[]) => void;
1055
- /**
1056
- * Exact-selection validity changed. Emitted only when
1057
- * `numberOfPlacesToSelect` is configured, after `onSelectionChange`.
1058
- */
1055
+ /** Selection validity changed. Emitted after `onSelectionChange` whenever
1056
+ * exact quantity or `selectionValidators` is configured. */
1059
1057
  onSelectionValidityChange?: (state: PickerSelectionValidity) => void;
1060
- /** The configured exact selection count has just been reached. */
1058
+ /** The configured selection rules have just become valid. */
1061
1059
  onSelectionValid?: (seats: PickerSeat[]) => void;
1062
- /** The current selection does not yet match the configured exact count. */
1060
+ /** The configured selection rules have just become invalid. */
1063
1061
  onSelectionInvalid?: (state: PickerSelectionValidity) => void;
1064
1062
  /** A grouped table was selected and needs buyer confirmation/guest quantity. */
1065
1063
  onTableSelectionRequest?: (table: TableSelectionDetails) => void;
@@ -1113,6 +1111,9 @@ interface PickerOptions extends PickerCallbacks {
1113
1111
  * selection cap when `maxSelection` is omitted.
1114
1112
  */
1115
1113
  numberOfPlacesToSelect?: number;
1114
+ /** Buyer selection rules evaluated locally after every change and enforced
1115
+ * again before a hold. The array is additive to `numberOfPlacesToSelect`. */
1116
+ selectionValidators?: PickerSelectionValidator[];
1116
1117
  /** Renderer confirm-card mode (host shows a confirm popover instead of instant cart add). */
1117
1118
  confirmSelection?: boolean;
1118
1119
  /** ISO 4217 currency for on-map prices (default from money.DEFAULT_CURRENCY). */
@@ -1139,13 +1140,27 @@ interface PickerOptions extends PickerCallbacks {
1139
1140
  */
1140
1141
  mapTheme?: PickerMapTheme | null;
1141
1142
  }
1142
- /** Exact-count state shared by the bare chart, full picker, and wrappers. */
1143
+ /** Supported buyer selection rules. Unknown rules fail at construction so a
1144
+ * typo cannot silently disable a sale guard. */
1145
+ type PickerSelectionValidator = {
1146
+ type: 'minimumSelectedPlaces';
1147
+ minimum: number;
1148
+ } | {
1149
+ type: 'consecutiveSeats';
1150
+ } | {
1151
+ type: 'noOrphanSeats';
1152
+ };
1153
+ type PickerSelectionViolation = 'numberOfPlacesToSelect' | PickerSelectionValidator['type'];
1154
+ /** Selection-rule state shared by the bare chart, full picker, and wrappers.
1155
+ * Existing exact-count consumers retain every original field; `violations` is
1156
+ * additive and empty when the selection is valid. */
1143
1157
  interface PickerSelectionValidity {
1144
1158
  isValid: boolean;
1145
1159
  count: number;
1146
1160
  required: number;
1147
1161
  remaining: number;
1148
1162
  seats: PickerSeat[];
1163
+ violations: PickerSelectionViolation[];
1149
1164
  }
1150
1165
  /** Privacy-safe timings for one buyer-map load. Values are milliseconds and
1151
1166
  * contain no chart, seat, hold, buyer, or URL data. Hosts may aggregate these
@@ -1193,6 +1208,7 @@ declare class PickerController {
1193
1208
  private readonly key;
1194
1209
  private maxSelection;
1195
1210
  private readonly numberOfPlacesToSelect;
1211
+ private readonly selectionValidators;
1196
1212
  private selectableObjectRefs;
1197
1213
  private selectableSeatIds;
1198
1214
  private lastSelectionValidity;
@@ -1342,7 +1358,8 @@ declare class PickerController {
1342
1358
  deselectCategories(categoryKeys: string[]): void;
1343
1359
  /** Replace the buyer-selectable object allow-list without rebuilding. */
1344
1360
  setSelectableObjects(references: string[] | null): void;
1345
- getSelectionValidity(): PickerSelectionValidity | null;
1361
+ getSelectionValidity(countOverride?: number): PickerSelectionValidity | null;
1362
+ private hasOrphanedSelection;
1346
1363
  private rebuildSelectableSeatIds;
1347
1364
  private isSelectableByPolicy;
1348
1365
  /** Confirm/update the guest quantity for a selected variable table. */
@@ -1821,4 +1838,4 @@ declare function formatMinor(minor: number, currency?: string, locale?: string):
1821
1838
  /** Bare symbol for input adornments ("€", "$", "₹"). */
1822
1839
  declare function currencySymbol(currency?: string): string;
1823
1840
 
1824
- export { AccessibilityType, CURRENCY_CHOICES, CategoryTier, ChartDoc, DEFAULT_CURRENCY, type Dict, ExpandedSeat, type HoldConflict, type HoldInfo, type HoldSelectionRequest, type HoldServerItem, ISeatmapRenderer, type Locale, LodRung, type MoneyFormatOptions, type PanoramaResult, type PickerCallbacks, PickerController, type PickerGAArea, type PickerMapTheme, type PickerOptions, type PickerRealtimeConnection, type PickerRealtimeSink, type PickerRenderPerformanceProfile, type PickerSeat, PickerSelectionError, type PickerSelectionValidity, type PickerStatusChange, type PickerTransport, Point, RendererCallbacks, RendererMinimapSnapshot, RendererOptions, RendererQualityEvidence, RendererViewMode, SUPPORTED_LOCALES, SeatCommercialAttributes, type SeatHoverDetails, SeatStatus, SeatmapRenderer, type SectionCategory, type SectionSummary, type TableSelectionDetails, createRenderer, currencyExponent, currencySymbol, formatDate, formatMinor, formatMoney, fromMinorUnits, generateSeatPanorama, generateSeatThumb, getLocale, loadLocale, resolveLocale, setLocale, setMoneyLocale, setStringOverrides, t, tCount };
1841
+ export { AccessibilityType, CURRENCY_CHOICES, CategoryTier, ChartDoc, DEFAULT_CURRENCY, type Dict, ExpandedSeat, type HoldConflict, type HoldInfo, type HoldSelectionRequest, type HoldServerItem, ISeatmapRenderer, type Locale, LodRung, type MoneyFormatOptions, type PanoramaResult, type PickerCallbacks, PickerController, type PickerGAArea, type PickerMapTheme, type PickerOptions, type PickerRealtimeConnection, type PickerRealtimeSink, type PickerRenderPerformanceProfile, type PickerSeat, PickerSelectionError, type PickerSelectionValidator, type PickerSelectionValidity, type PickerSelectionViolation, type PickerStatusChange, type PickerTransport, Point, RendererCallbacks, RendererMinimapSnapshot, RendererOptions, RendererQualityEvidence, RendererViewMode, SUPPORTED_LOCALES, SeatCommercialAttributes, type SeatHoverDetails, SeatStatus, SeatmapRenderer, type SectionCategory, type SectionSummary, type TableSelectionDetails, createRenderer, currencyExponent, currencySymbol, formatDate, formatMinor, formatMoney, fromMinorUnits, generateSeatPanorama, generateSeatThumb, getLocale, loadLocale, resolveLocale, setLocale, setMoneyLocale, setStringOverrides, t, tCount };
package/dist/index.d.ts CHANGED
@@ -1052,14 +1052,12 @@ interface PickerTransport {
1052
1052
  interface PickerCallbacks extends RendererCallbacks {
1053
1053
  /** Selection changed (manual clicks or a server best-available pick). */
1054
1054
  onSelectionChange?: (seats: PickerSeat[]) => void;
1055
- /**
1056
- * Exact-selection validity changed. Emitted only when
1057
- * `numberOfPlacesToSelect` is configured, after `onSelectionChange`.
1058
- */
1055
+ /** Selection validity changed. Emitted after `onSelectionChange` whenever
1056
+ * exact quantity or `selectionValidators` is configured. */
1059
1057
  onSelectionValidityChange?: (state: PickerSelectionValidity) => void;
1060
- /** The configured exact selection count has just been reached. */
1058
+ /** The configured selection rules have just become valid. */
1061
1059
  onSelectionValid?: (seats: PickerSeat[]) => void;
1062
- /** The current selection does not yet match the configured exact count. */
1060
+ /** The configured selection rules have just become invalid. */
1063
1061
  onSelectionInvalid?: (state: PickerSelectionValidity) => void;
1064
1062
  /** A grouped table was selected and needs buyer confirmation/guest quantity. */
1065
1063
  onTableSelectionRequest?: (table: TableSelectionDetails) => void;
@@ -1113,6 +1111,9 @@ interface PickerOptions extends PickerCallbacks {
1113
1111
  * selection cap when `maxSelection` is omitted.
1114
1112
  */
1115
1113
  numberOfPlacesToSelect?: number;
1114
+ /** Buyer selection rules evaluated locally after every change and enforced
1115
+ * again before a hold. The array is additive to `numberOfPlacesToSelect`. */
1116
+ selectionValidators?: PickerSelectionValidator[];
1116
1117
  /** Renderer confirm-card mode (host shows a confirm popover instead of instant cart add). */
1117
1118
  confirmSelection?: boolean;
1118
1119
  /** ISO 4217 currency for on-map prices (default from money.DEFAULT_CURRENCY). */
@@ -1139,13 +1140,27 @@ interface PickerOptions extends PickerCallbacks {
1139
1140
  */
1140
1141
  mapTheme?: PickerMapTheme | null;
1141
1142
  }
1142
- /** Exact-count state shared by the bare chart, full picker, and wrappers. */
1143
+ /** Supported buyer selection rules. Unknown rules fail at construction so a
1144
+ * typo cannot silently disable a sale guard. */
1145
+ type PickerSelectionValidator = {
1146
+ type: 'minimumSelectedPlaces';
1147
+ minimum: number;
1148
+ } | {
1149
+ type: 'consecutiveSeats';
1150
+ } | {
1151
+ type: 'noOrphanSeats';
1152
+ };
1153
+ type PickerSelectionViolation = 'numberOfPlacesToSelect' | PickerSelectionValidator['type'];
1154
+ /** Selection-rule state shared by the bare chart, full picker, and wrappers.
1155
+ * Existing exact-count consumers retain every original field; `violations` is
1156
+ * additive and empty when the selection is valid. */
1143
1157
  interface PickerSelectionValidity {
1144
1158
  isValid: boolean;
1145
1159
  count: number;
1146
1160
  required: number;
1147
1161
  remaining: number;
1148
1162
  seats: PickerSeat[];
1163
+ violations: PickerSelectionViolation[];
1149
1164
  }
1150
1165
  /** Privacy-safe timings for one buyer-map load. Values are milliseconds and
1151
1166
  * contain no chart, seat, hold, buyer, or URL data. Hosts may aggregate these
@@ -1193,6 +1208,7 @@ declare class PickerController {
1193
1208
  private readonly key;
1194
1209
  private maxSelection;
1195
1210
  private readonly numberOfPlacesToSelect;
1211
+ private readonly selectionValidators;
1196
1212
  private selectableObjectRefs;
1197
1213
  private selectableSeatIds;
1198
1214
  private lastSelectionValidity;
@@ -1342,7 +1358,8 @@ declare class PickerController {
1342
1358
  deselectCategories(categoryKeys: string[]): void;
1343
1359
  /** Replace the buyer-selectable object allow-list without rebuilding. */
1344
1360
  setSelectableObjects(references: string[] | null): void;
1345
- getSelectionValidity(): PickerSelectionValidity | null;
1361
+ getSelectionValidity(countOverride?: number): PickerSelectionValidity | null;
1362
+ private hasOrphanedSelection;
1346
1363
  private rebuildSelectableSeatIds;
1347
1364
  private isSelectableByPolicy;
1348
1365
  /** Confirm/update the guest quantity for a selected variable table. */
@@ -1821,4 +1838,4 @@ declare function formatMinor(minor: number, currency?: string, locale?: string):
1821
1838
  /** Bare symbol for input adornments ("€", "$", "₹"). */
1822
1839
  declare function currencySymbol(currency?: string): string;
1823
1840
 
1824
- export { AccessibilityType, CURRENCY_CHOICES, CategoryTier, ChartDoc, DEFAULT_CURRENCY, type Dict, ExpandedSeat, type HoldConflict, type HoldInfo, type HoldSelectionRequest, type HoldServerItem, ISeatmapRenderer, type Locale, LodRung, type MoneyFormatOptions, type PanoramaResult, type PickerCallbacks, PickerController, type PickerGAArea, type PickerMapTheme, type PickerOptions, type PickerRealtimeConnection, type PickerRealtimeSink, type PickerRenderPerformanceProfile, type PickerSeat, PickerSelectionError, type PickerSelectionValidity, type PickerStatusChange, type PickerTransport, Point, RendererCallbacks, RendererMinimapSnapshot, RendererOptions, RendererQualityEvidence, RendererViewMode, SUPPORTED_LOCALES, SeatCommercialAttributes, type SeatHoverDetails, SeatStatus, SeatmapRenderer, type SectionCategory, type SectionSummary, type TableSelectionDetails, createRenderer, currencyExponent, currencySymbol, formatDate, formatMinor, formatMoney, fromMinorUnits, generateSeatPanorama, generateSeatThumb, getLocale, loadLocale, resolveLocale, setLocale, setMoneyLocale, setStringOverrides, t, tCount };
1841
+ export { AccessibilityType, CURRENCY_CHOICES, CategoryTier, ChartDoc, DEFAULT_CURRENCY, type Dict, ExpandedSeat, type HoldConflict, type HoldInfo, type HoldSelectionRequest, type HoldServerItem, ISeatmapRenderer, type Locale, LodRung, type MoneyFormatOptions, type PanoramaResult, type PickerCallbacks, PickerController, type PickerGAArea, type PickerMapTheme, type PickerOptions, type PickerRealtimeConnection, type PickerRealtimeSink, type PickerRenderPerformanceProfile, type PickerSeat, PickerSelectionError, type PickerSelectionValidator, type PickerSelectionValidity, type PickerSelectionViolation, type PickerStatusChange, type PickerTransport, Point, RendererCallbacks, RendererMinimapSnapshot, RendererOptions, RendererQualityEvidence, RendererViewMode, SUPPORTED_LOCALES, SeatCommercialAttributes, type SeatHoverDetails, SeatStatus, SeatmapRenderer, type SectionCategory, type SectionSummary, type TableSelectionDetails, createRenderer, currencyExponent, currencySymbol, formatDate, formatMinor, formatMoney, fromMinorUnits, generateSeatPanorama, generateSeatThumb, getLocale, loadLocale, resolveLocale, setLocale, setMoneyLocale, setStringOverrides, t, tCount };