@forgebuild/sidon-booking-widget 2.0.0 → 3.0.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
@@ -215,12 +215,14 @@ an HTML tag. Without a bundler, load `dist/sidon-booking-widget.js` with `<scrip
215
215
  The wizard has four steps:
216
216
 
217
217
  1. **Documents**: the sailor's documents, held once for all marinas. The guest signs in with Sidon
218
- (Clerk), and the step shows which of the marina's requirements are met and lets them upload
218
+ (a popup on Sidon's site), and the step shows which of the marina's requirements are met and lets them upload
219
219
  what's missing. Uploads go straight to OTA, not through your forwarder. *Next* unlocks once
220
220
  OTA says the requirements pass for the stay's dates.
221
221
  - It applies only where OTA has switched on the marina's `sailor_documents`. Other marinas keep
222
- the per-booking upload on [the booking page](#the-booking-page).
223
- - It needs `clerk-publishable-key`; see [Documents setup](#documents-setup).
222
+ the per-booking upload on [the booking page](#the-booking-page), and the wizard skips this
223
+ step: it opens on Details and the stepper shows 1 Details, 2 Payment, 3 Booking. Events
224
+ still carry the step numbers below (Details is `2`).
225
+ - It needs `sailor-api-origin`; see [Documents setup](#documents-setup).
224
226
  2. **Details**: dates, boat length and berth (with an optional map), then the guest's contact and
225
227
  boat details. *Next* puts a 30-minute hold on the berth.
226
228
  3. **Payment**: Stripe's Payment Element. The card is authorised at this step and captured when the
@@ -247,7 +249,7 @@ shows the booking view again, with a *Start a new booking* action.
247
249
  | `currency-symbol` | `''` | When empty, amounts are formatted in the marina's currency with `Intl.NumberFormat`. Set it, to `$` for example, to show that fixed symbol before amounts instead. |
248
250
  | `variant` | `navy` | `navy` or `dark`; see [Theming](#theming). |
249
251
  | `booking-id` | absent | When present, the element is in [booking-page mode](#the-booking-page). A value overrides the booking id in the URL. |
250
- | `clerk-publishable-key` | `''` | The site's own Clerk publishable key (`pk_…`), for the Documents step's sign-in. Each site has its own Clerk application; see [Documents setup](#documents-setup). Clerk loads from that application's Frontend API. |
252
+ | `sidon-origin` | `https://marina.sidonmarine.uk` | Where the Documents step's *Sign in with Sidon* popup opens; see [Documents setup](#documents-setup). Override only to test against another Sidon. |
251
253
  | `sailor-api-origin` | `''` | OTA's origin, where the Documents step uploads to (`/api/sailor/documents`). Uploads don't go through the forwarder. |
252
254
  | `maps-api-key` | | Google Maps JS API key. The map renders only when this is set. It never renders on step 4 or in booking-page mode. |
253
255
  | `map-style` | `chart` | `chart` (buoy circles) or `coastal` (SVG pontoon overlays). |
@@ -275,18 +277,21 @@ root and can be caught anywhere on the page:
275
277
 
276
278
  ### Documents setup
277
279
 
280
+ Sign-in is Sidon's, not the site's: *Sign in with Sidon* opens a popup on Sidon's `/connect` page,
281
+ and the sailor signs in (or signs up) with their Sidon account there. The popup hands the widget a
282
+ sailor token, which it keeps for the browser tab. The site has no auth setup of its own.
283
+
278
284
  Per site:
279
285
 
280
- 1. Create a Clerk application for the site and add the site's domain to it.
281
- 2. Add that application's secret key to OTA's `SAILOR_CLERK_SECRET_KEYS` (a comma-separated list).
282
- 3. Upgrade the widget and the forwarder, then set `clerk-publishable-key` and `sailor-api-origin`
283
- on the element. `sailor-api-origin` is required whenever the key is set. Sign-in now works as
284
- an optional step.
285
- 4. On OTA, switch on the marina's `sailor_documents`, last, and only once every site booking that
286
- marina runs the new widget. Switching it on earlier shows guests "Sign-in is unavailable" and
287
- gives 1.x sites a raw "Sign in required".
286
+ 1. Ask Sidon to add the site's origin (e.g. `https://www.example.com`) to `CONNECT_ORIGINS`. The
287
+ popup refuses any other origin.
288
+ 2. Upgrade the widget and the forwarder, then set `sailor-api-origin` on the element.
289
+ 3. On OTA, switch on the marina's `sailor_documents`, last, and only once every site booking that
290
+ marina runs the new widget. 1.x sites get a raw "Sign in required" once it's on.
288
291
 
289
- The site's Clerk application must require an email address.
292
+ `sidon-origin` points the popup at another Sidon (a local or staging one); leave it unset in
293
+ production. Sidon's Clerk instance needs the `ota` JWT template (claims `email` and `name`), and
294
+ OTA's `SAILOR_CLERK_SECRET_KEYS` must hold that instance's secret key.
290
295
 
291
296
  The forwarder forwards the `X-Sailor-Token` header, so update `@forgebuild/sidon-booking-widget`
292
297
  in the forwarder's project too.
@@ -526,7 +531,7 @@ between two styles:
526
531
  The wizard gained a first step, so the step numbers moved: 1 Documents, 2 Details, 3 Payment,
527
532
  4 Booking. **This breaks hosts listening to `sidon-step-change`** (and anything keyed on step 3
528
533
  being the booking), so it ships as a major version. Update those listeners, and set
529
- `clerk-publishable-key` and `sailor-api-origin` ([Documents setup](#documents-setup)). On
534
+ `sailor-api-origin` ([Documents setup](#documents-setup)). On
530
535
  [the booking page](#the-booking-page), marinas on sailor documents no longer show the per-booking
531
536
  upload.
532
537
 
@@ -62,8 +62,8 @@ export interface SidonBookingWidgetElement extends HTMLElement {
62
62
  logoMark?: string | null;
63
63
  marinaName?: string;
64
64
  otherMarinas?: OtherMarina[];
65
- /** The site's own Clerk publishable key (Sidon sign-in on the Documents step). */
66
- clerkPublishableKey?: string;
65
+ /** Sidon's origin for the Documents step's sign-in popup; defaults to https://marina.sidonmarine.uk. */
66
+ sidonOrigin?: string;
67
67
  /** Origin serving OTA's /api/sailor/documents; '' (default) = this page's origin. */
68
68
  sailorApiOrigin?: string;
69
69
  }