@forgebuild/sidon-booking-widget 1.3.0 → 2.0.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.
- package/README.md +622 -580
- package/dist/astro-proxy.js +1 -1
- package/dist/elements.d.ts +124 -119
- package/dist/sidon-berth-map.js +7 -6
- package/dist/sidon-booking-widget.js +1896 -1259
- package/package.json +1 -1
package/dist/astro-proxy.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
const GUEST_PREFIX = '/api/marina/guest/';
|
|
14
14
|
// Vercel's function body limit; OTA's own upload cap (4 MiB) is stricter.
|
|
15
15
|
const MAX_BODY_BYTES = 4_500_000;
|
|
16
|
-
const REQUEST_HEADERS = ['content-type', 'x-file-name', 'x-booking-token', 'user-agent'];
|
|
16
|
+
const REQUEST_HEADERS = ['content-type', 'x-file-name', 'x-booking-token', 'x-sailor-token', 'user-agent'];
|
|
17
17
|
// Never content-encoding/content-length: Node's fetch has already decoded
|
|
18
18
|
// the body but keeps those headers. Never set-cookie or location.
|
|
19
19
|
const RESPONSE_HEADERS = ['content-type', 'cache-control', 'retry-after', 'ratelimit'];
|
package/dist/elements.d.ts
CHANGED
|
@@ -1,119 +1,124 @@
|
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export interface
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
marina
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/** OTA
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
'sidon-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
'sidon-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
+
/** Dates are `YYYY-MM-DD`; `berth` is a berth label. */
|
|
36
|
+
export interface SidonQuickbookSubmitDetail { from: string | null; to: string | null; length: number; berth: string | null }
|
|
37
|
+
|
|
38
|
+
// Element properties mirror the attributes, camelCased; optional like them.
|
|
39
|
+
export interface SidonBookingWidgetElement extends HTMLElement {
|
|
40
|
+
/** OTA marina slug. */
|
|
41
|
+
marina?: string;
|
|
42
|
+
/** '' (default) = this page's origin, where the forwarder route lives. */
|
|
43
|
+
apiOrigin?: string;
|
|
44
|
+
from?: string;
|
|
45
|
+
to?: string;
|
|
46
|
+
length?: number;
|
|
47
|
+
berth?: string;
|
|
48
|
+
/** en/it/fr/es (first two letters). Unset: the wizard is English and the
|
|
49
|
+
booking page follows the booking's own locale. */
|
|
50
|
+
locale?: string;
|
|
51
|
+
currencySymbol?: string;
|
|
52
|
+
variant?: 'navy' | 'dark';
|
|
53
|
+
/** Present (even empty) = booking-page mode; a value overrides `?booking=`. */
|
|
54
|
+
bookingId?: string | null;
|
|
55
|
+
mapsApiKey?: string;
|
|
56
|
+
mapStyle?: 'chart' | 'coastal';
|
|
57
|
+
mapHeight?: string;
|
|
58
|
+
mapWidth?: string;
|
|
59
|
+
mapGap?: string;
|
|
60
|
+
width?: string;
|
|
61
|
+
layout?: 'stacked' | 'overlay';
|
|
62
|
+
logoMark?: string | null;
|
|
63
|
+
marinaName?: string;
|
|
64
|
+
otherMarinas?: OtherMarina[];
|
|
65
|
+
/** The site's own Clerk publishable key (Sidon sign-in on the Documents step). */
|
|
66
|
+
clerkPublishableKey?: string;
|
|
67
|
+
/** Origin serving OTA's /api/sailor/documents; '' (default) = this page's origin. */
|
|
68
|
+
sailorApiOrigin?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface SidonBerthMapElement extends HTMLElement {
|
|
72
|
+
/** OTA marina slug. */
|
|
73
|
+
marina?: string;
|
|
74
|
+
mapsApiKey?: string;
|
|
75
|
+
/** '' (default) = this page's origin, where the forwarder route lives. */
|
|
76
|
+
apiOrigin?: string;
|
|
77
|
+
mapStyle?: 'chart' | 'coastal';
|
|
78
|
+
locale?: string;
|
|
79
|
+
currencySymbol?: string;
|
|
80
|
+
from?: string;
|
|
81
|
+
to?: string;
|
|
82
|
+
length?: number;
|
|
83
|
+
berth?: string;
|
|
84
|
+
/** 'staff' (the OTA dashboard): every listed berth is clickable and fires
|
|
85
|
+
sidon-berth-selected, occupied berths are painted for [from, to), and
|
|
86
|
+
from/to follow their attributes. No card, availability or boat-length
|
|
87
|
+
checks. Default 'guest'. */
|
|
88
|
+
mode?: 'guest' | 'staff';
|
|
89
|
+
/** Re-reads the map payload. Undefined until the element has mounted
|
|
90
|
+
(a microtask after it is connected), so call `el.refresh?.()`. */
|
|
91
|
+
readonly refresh?: () => void;
|
|
92
|
+
bookPath?: string;
|
|
93
|
+
logoMark?: string | null;
|
|
94
|
+
marinaName?: string;
|
|
95
|
+
otherMarinas?: OtherMarina[];
|
|
96
|
+
mapHeight?: string;
|
|
97
|
+
showWeather?: boolean;
|
|
98
|
+
eyebrow?: string;
|
|
99
|
+
cardTitle?: string;
|
|
100
|
+
intro?: string;
|
|
101
|
+
rangeLabel?: string;
|
|
102
|
+
rangePlaceholder?: string;
|
|
103
|
+
lengthLabel?: string;
|
|
104
|
+
selectedLabel?: string;
|
|
105
|
+
selectedPlaceholder?: string;
|
|
106
|
+
ctaLabel?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare global {
|
|
110
|
+
interface HTMLElementTagNameMap {
|
|
111
|
+
'sidon-booking-widget': SidonBookingWidgetElement;
|
|
112
|
+
'sidon-berth-map': SidonBerthMapElement;
|
|
113
|
+
}
|
|
114
|
+
// Dispatched with bubbles + composed, so listeners on any ancestor
|
|
115
|
+
// element get the typed detail too.
|
|
116
|
+
interface HTMLElementEventMap {
|
|
117
|
+
'sidon-step-change': CustomEvent<SidonStepChangeDetail>;
|
|
118
|
+
'sidon-loa-change': CustomEvent<SidonLoaChangeDetail>;
|
|
119
|
+
'sidon-booked': CustomEvent<SidonBookedDetail>;
|
|
120
|
+
'sidon-booking-status': CustomEvent<SidonBookingStatusDetail>;
|
|
121
|
+
'sidon-berth-selected': CustomEvent<SidonBerthSelectedDetail>;
|
|
122
|
+
'sidon-quickbook-submit': CustomEvent<SidonQuickbookSubmitDetail>;
|
|
123
|
+
}
|
|
124
|
+
}
|
package/dist/sidon-berth-map.js
CHANGED
|
@@ -4874,18 +4874,19 @@ var Ga = class extends Error {
|
|
|
4874
4874
|
super(e), this.status = t;
|
|
4875
4875
|
}
|
|
4876
4876
|
};
|
|
4877
|
-
async function Ka(e, t, n) {
|
|
4878
|
-
let
|
|
4877
|
+
async function Ka(e, t, n, r = !1) {
|
|
4878
|
+
let i;
|
|
4879
4879
|
try {
|
|
4880
|
-
|
|
4880
|
+
i = await fetch(e, n);
|
|
4881
4881
|
} catch {
|
|
4882
4882
|
throw new Ga(t, 0);
|
|
4883
4883
|
}
|
|
4884
|
-
if (!
|
|
4884
|
+
if (!i.ok) throw new Ga(await ji(i, t), i.status);
|
|
4885
|
+
if (r) return null;
|
|
4885
4886
|
try {
|
|
4886
|
-
return await
|
|
4887
|
+
return await i.json();
|
|
4887
4888
|
} catch {
|
|
4888
|
-
throw new Ga(t,
|
|
4889
|
+
throw new Ga(t, i.status);
|
|
4889
4890
|
}
|
|
4890
4891
|
}
|
|
4891
4892
|
async function qa(e, t, n) {
|