@gomusdev/web-components 4.11.0 → 4.12.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.
@@ -6,12 +6,38 @@ export type CalendarDates = {
6
6
  export type CalendarDatesDepthAvailabilityStatus = {
7
7
  [key: string]: 'unavailable' | 'available' | 'fully_booked';
8
8
  };
9
+ /**
10
+ * How a single date is offered, as seen by an integrator.
11
+ *
12
+ * - `available` — bookable, the date is clickable.
13
+ * - `sold_out` — on sale but no capacity left (the backend's `fully_booked`).
14
+ * - `unavailable` — nothing sellable that date, so it is blocked.
15
+ */
16
+ export type GoAvailability = 'available' | 'sold_out' | 'unavailable';
17
+ /**
18
+ * Per-date override supplied by the integrator, either as
19
+ * `<go-calendar availability-override="fnName">` or as a property
20
+ * (`element.availabilityOverride = fn`). Returning `'pass_through'` defers to gomus. Called for
21
+ * every rendered cell on every render, so it must be synchronous and cheap.
22
+ */
23
+ export type GoAvailabilityOverride = (date: string, defaultAvailability: GoAvailability) => GoAvailability | 'pass_through';
9
24
  export declare class Calendar {
25
+ #private;
10
26
  details: TicketSelectionDetails | undefined;
11
27
  startAt: CalendarDate;
12
28
  selected: CalendarDate | undefined;
29
+ /**
30
+ * Integrator override for each date's availability: either the callback itself
31
+ * (`element.availabilityOverride = fn`) or the name of a global one
32
+ * (`<go-calendar availability-override="fnName">`).
33
+ */
34
+ availabilityOverride: string | GoAvailabilityOverride | undefined;
13
35
  get endpoint(): 'tickets' | 'events' | null;
14
36
  get dates(): CalendarDatesDepthAvailabilityStatus | undefined;
37
+ /** What gomus makes of a date on its own, ignoring any integrator override. */
38
+ defaultAvailability(date: DateValue): GoAvailability;
39
+ /** The gomus default, with the integrator's override given the last word. */
40
+ availability(date: DateValue): GoAvailability;
15
41
  isDateDisabled(date: DateValue): boolean;
16
42
  isDateUnavailable(date: DateValue): boolean;
17
43
  get apiFilters(): (string | undefined)[] | undefined;
@@ -34,8 +60,8 @@ export declare class Calendar {
34
60
  depth?: string;
35
61
  } | undefined;
36
62
  fetchPeriod(): CalendarDate[];
37
- eventsDates(): {};
38
- ticketsDates(): {};
63
+ eventsDates(): CalendarDatesDepthAvailabilityStatus;
64
+ ticketsDates(): CalendarDatesDepthAvailabilityStatus;
39
65
  }
40
66
  export declare class StaticCalendar extends Calendar {
41
67
  #private;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "4.11.0",
7
+ "version": "4.12.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",