@movmo/express-checkout-button 2.0.0 → 2.0.2
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 +2 -1
- package/dist/dts/returnHandler.d.ts +2 -1
- package/dist/dts/urlScrub.d.ts +8 -0
- package/dist/express-checkout.umd.js +5 -5
- package/dist/express-checkout.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,8 +136,9 @@ export default MyBookingPage;
|
|
|
136
136
|
| Step | What happens |
|
|
137
137
|
| ---- | ------------ |
|
|
138
138
|
| Click | The button saves the offer (if you passed `flightOffer`), stores a one-time `state` nonce in `sessionStorage['movmo:checkout:pending']`, then runs `location.assign('https://flights.movmo.io/booking?offerId=…&returnUrl=…&state=…')`. No `/movmo/checkout` route and no `frame-src` CSP entry are needed. |
|
|
139
|
+
| Pending | From the click until the Movmo page loads, the button is disabled and shows a spinner with "Opening Movmo…"; it resets if the offer save fails, the offer is missing, or the traveler returns with Back. |
|
|
139
140
|
| Return | Movmo navigates to your `returnUrl` with `movmo_exit` (`search_again`, `offer_unavailable`, `booking_confirmed`), `movmo_state` (echo of your nonce) and, when booked, `movmo_booking_id`. The airline PNR is in the URL **fragment** only: `#movmo_pnr=ABC123`, or inside your hash route (`#/checkout?movmo_pnr=ABC123`, `#/r?a=1&movmo_pnr=ABC123`). |
|
|
140
|
-
| Consume | On mount the button reads those params. If `movmo_state` matches the stored nonce it calls `onBookingComplete` (confirmed bookings only), then `onExit`, and clears the nonce. A mismatch or missing nonce logs a warning and calls nothing.
|
|
141
|
+
| Consume | On mount the button reads those params. If `movmo_state` matches the stored nonce it calls `onBookingComplete` (confirmed bookings only), then `onExit`, and clears the nonce. A mismatch or missing nonce logs a warning and calls nothing. Only this SDK's own params (`movmo_exit`, `movmo_state`, `movmo_booking_id` in the query, `movmo_pnr` in the hash) are removed from the address bar with `history.replaceState` on every call (also when there is no return, for leftovers); everything else, including `@movmo/connect-button`'s `movmo_signed_out` and `movmo_logout_state`, and your own query and hash, stays byte for byte. A pending record is single-use and expires after 24 hours. With two buttons on one page, the return is held for the button whose airline, provider and offer match the click, and the URL is scrubbed immediately. |
|
|
141
142
|
|
|
142
143
|
The callbacks fire on whichever page loads at `returnUrl`, so mount the button there, or call
|
|
143
144
|
`consumeMovmoCheckoutReturn` (ESM) / `window.MovmoExpressCheckout.consumeReturn` (script tag) on
|
|
@@ -41,7 +41,8 @@ export declare function __resetForTests(): void;
|
|
|
41
41
|
* and this instance matches the button that started the checkout. These are unauthenticated
|
|
42
42
|
* browser signals (the traveler can edit the URL): never fulfil or award anything from them.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
44
|
+
* Only this SDK's own params are scrubbed from the URL (never connect-button's
|
|
45
|
+
* `movmo_signed_out` / `movmo_logout_state`), on the first call, with or without a return. Call
|
|
45
46
|
* it as early as possible, before analytics or session-replay scripts read the URL.
|
|
46
47
|
*/
|
|
47
48
|
export declare function consumeMovmoCheckoutReturn(options?: MovmoCheckoutReturnOptions): boolean;
|
package/dist/dts/urlScrub.d.ts
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** Remove every `movmo_*` key from a `?query` string; returns '' when nothing is left. */
|
|
6
6
|
export declare function scrubQuery(search: string): string;
|
|
7
|
+
/** The query params Movmo's checkout return carries; the only ones the return handler removes. */
|
|
8
|
+
export declare const RETURN_QUERY_KEYS: readonly string[];
|
|
9
|
+
/**
|
|
10
|
+
* Remove ONLY the named keys from a `?query` string (decoded-name match), leaving every other
|
|
11
|
+
* segment, including other `movmo_*` keys such as connect-button's `movmo_signed_out` /
|
|
12
|
+
* `movmo_logout_state`, byte for byte. Returns '' when nothing is left.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scrubQueryKeys(search: string, keys: readonly string[]): string;
|
|
7
15
|
/**
|
|
8
16
|
* Remove every `movmo_pnr=` segment from a `#fragment`, whatever delimiter (`?` or `&`)
|
|
9
17
|
* precedes it: `#movmo_pnr=A&movmo_pnr=B`, `#movmo_pnr=OLD?movmo_pnr=NEW`, `#/r?a=1&movmo_pnr=X`.
|