@forgebuild/sidon-booking-widget 4.3.0 → 4.3.1

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.
@@ -0,0 +1 @@
1
+ export * from './elements.js';
@@ -0,0 +1 @@
1
+ export * from './elements.js';
@@ -0,0 +1,142 @@
1
+ // Hand-written typings for <sidon-booking-widget> and <sidon-berth-map>.
2
+ // The entry modules only register the elements (side-effect imports), so
3
+ // generated declarations come out as an empty `export {}`. The build copies
4
+ // this file verbatim to dist/elements.d.ts and both entry .d.ts files
5
+ // re-export it (scripts/write-element-types.mjs), which is why it imports
6
+ // nothing: a relative import would dangle in dist/.
7
+ //
8
+ // Keep it in step with the `props` blocks in BookingWidget.svelte and
9
+ // BerthMap.svelte and the events they emit. `npm run check` skips .d.ts
10
+ // files (skipLibCheck), so check an edit with:
11
+ // npx tsc --ignoreConfig --noEmit --skipLibCheck false --lib es2023,dom src/elements.d.ts
12
+
13
+ /** Peer-marina logo pin. Mirrors OtherMarina in lib/types.ts. */
14
+ export interface OtherMarina {
15
+ name: string;
16
+ lat: number;
17
+ lng: number;
18
+ logoMark: string | null;
19
+ /** Always host-supplied: the package owns no site's routing. */
20
+ href: string | null;
21
+ }
22
+
23
+ /** OTA booking status. An expired booking reports `cancelled`. */
24
+ export type SidonBookingStatus = 'hold' | 'pending' | 'confirmed' | 'declined' | 'cancelled';
25
+
26
+ /** 1 Documents, 2 Details, 3 Payment, 4 Booking. */
27
+ export interface SidonStepChangeDetail { step: 1 | 2 | 3 | 4 }
28
+ /** The booking widget fires this from the wizard only, never in booking-page mode. */
29
+ export interface SidonLoaChangeDetail { loa: number }
30
+ /** `bookingId` is OTA's booking UUID, `marina` the marina slug. */
31
+ export interface SidonBookedDetail { bookingId: string; marina: string }
32
+ export interface SidonBookingStatusDetail { bookingId: string; status: SidonBookingStatus }
33
+ /** A berth label, or null when deselected. */
34
+ export interface SidonBerthSelectedDetail { berthId: string | null }
35
+ /** addToCart's argument. Mirrors CartPick in lib/types.ts. */
36
+ export interface SidonCartPick {
37
+ berth: string;
38
+ from: string;
39
+ to: string;
40
+ length: number;
41
+ beam: number | null;
42
+ draft: number | null;
43
+ boatName: string;
44
+ notes?: string;
45
+ price: number | null;
46
+ }
47
+ /** Dates are `YYYY-MM-DD`; `berth` is a berth label. */
48
+ export interface SidonQuickbookSubmitDetail { from: string | null; to: string | null; length: number; berth: string | null }
49
+
50
+ // Element properties mirror the attributes, camelCased; optional like them.
51
+ export interface SidonBookingWidgetElement extends HTMLElement {
52
+ /** OTA marina slug. */
53
+ marina?: string;
54
+ /** '' (default) = this page's origin, where the forwarder route lives. */
55
+ apiOrigin?: string;
56
+ from?: string;
57
+ to?: string;
58
+ length?: number;
59
+ berth?: string;
60
+ /** en/it/fr/es (first two letters). Unset: the wizard is English and the
61
+ booking page follows the booking's own locale. */
62
+ locale?: string;
63
+ currencySymbol?: string;
64
+ variant?: 'navy' | 'dark';
65
+ /** Present (even empty) = booking-page mode; a value overrides `?booking=`. */
66
+ bookingId?: string | null;
67
+ mapsApiKey?: string;
68
+ mapStyle?: 'chart' | 'coastal';
69
+ mapHeight?: string;
70
+ mapWidth?: string;
71
+ mapGap?: string;
72
+ width?: string;
73
+ layout?: 'stacked' | 'overlay';
74
+ logoMark?: string | null;
75
+ marinaName?: string;
76
+ otherMarinas?: OtherMarina[];
77
+ /** Sidon's origin for the Documents step's sign-in popup; defaults to https://sidonmarine.uk. */
78
+ sidonOrigin?: string;
79
+ /** Size in px of Sidon's sign-in window; default 480 x 720. */
80
+ signInWidth?: number;
81
+ signInHeight?: number;
82
+ /** Origin serving OTA's /api/sailor/documents; '' (default) = this page's origin. */
83
+ sailorApiOrigin?: string;
84
+ /** Property only. Set: Details asks only for the boat and Next calls this
85
+ instead of holding the berth; a string back shows as the error. */
86
+ addToCart?: ((pick: SidonCartPick) => Promise<boolean | string>) | null;
87
+ }
88
+
89
+ export interface SidonBerthMapElement extends HTMLElement {
90
+ /** OTA marina slug. */
91
+ marina?: string;
92
+ mapsApiKey?: string;
93
+ /** '' (default) = this page's origin, where the forwarder route lives. */
94
+ apiOrigin?: string;
95
+ mapStyle?: 'chart' | 'coastal';
96
+ locale?: string;
97
+ currencySymbol?: string;
98
+ from?: string;
99
+ to?: string;
100
+ length?: number;
101
+ berth?: string;
102
+ /** 'staff' (the OTA dashboard): every listed berth is clickable and fires
103
+ sidon-berth-selected, occupied berths are painted for [from, to), and
104
+ from/to follow their attributes. No card, availability or boat-length
105
+ checks. Default 'guest'. */
106
+ mode?: 'guest' | 'staff';
107
+ /** Re-reads the map payload. Undefined until the element has mounted
108
+ (a microtask after it is connected), so call `el.refresh?.()`. */
109
+ readonly refresh?: () => void;
110
+ bookPath?: string;
111
+ logoMark?: string | null;
112
+ marinaName?: string;
113
+ otherMarinas?: OtherMarina[];
114
+ mapHeight?: string;
115
+ showWeather?: boolean;
116
+ eyebrow?: string;
117
+ cardTitle?: string;
118
+ intro?: string;
119
+ rangeLabel?: string;
120
+ rangePlaceholder?: string;
121
+ lengthLabel?: string;
122
+ selectedLabel?: string;
123
+ selectedPlaceholder?: string;
124
+ ctaLabel?: string;
125
+ }
126
+
127
+ declare global {
128
+ interface HTMLElementTagNameMap {
129
+ 'sidon-booking-widget': SidonBookingWidgetElement;
130
+ 'sidon-berth-map': SidonBerthMapElement;
131
+ }
132
+ // Dispatched with bubbles + composed, so listeners on any ancestor
133
+ // element get the typed detail too.
134
+ interface HTMLElementEventMap {
135
+ 'sidon-step-change': CustomEvent<SidonStepChangeDetail>;
136
+ 'sidon-loa-change': CustomEvent<SidonLoaChangeDetail>;
137
+ 'sidon-booked': CustomEvent<SidonBookedDetail>;
138
+ 'sidon-booking-status': CustomEvent<SidonBookingStatusDetail>;
139
+ 'sidon-berth-selected': CustomEvent<SidonBerthSelectedDetail>;
140
+ 'sidon-quickbook-submit': CustomEvent<SidonQuickbookSubmitDetail>;
141
+ }
142
+ }