@movmo_app/types 1.24.0 → 1.26.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/dist/auth.d.ts CHANGED
@@ -20,6 +20,12 @@ export type MovmoPasskeyFlow = {
20
20
  code_length: number;
21
21
  expires_in: number;
22
22
  };
23
+ /** POST /v1/auth/login body. */
24
+ export type MovmoLoginRequest = {
25
+ email: string;
26
+ locale?: string;
27
+ time_zone?: string;
28
+ };
23
29
  export type MovmoLoginResponse = MovmoCodeFlow | MovmoPasskeyFlow;
24
30
  export type PasskeyOptionsResponse = {
25
31
  flow_id: string;
@@ -1,25 +1,22 @@
1
1
  /**
2
- * postMessage contract shared by the Express Checkout iframe (flights-ui) and the
3
- * embedding parent page (`@movmo/express-checkout-button`).
2
+ * postMessage contract between the Movmo recognition iframe (flights-ui `/recognize`) and the
3
+ * embedding parent page (`@movmo/connect-button`). Checkout no longer runs in a frame: there
4
+ * are no checkout messages here, only the handshake and the recognition messages.
4
5
  *
5
6
  * Both sides SHOULD coordinate exclusively via `window.postMessage` — no direct
6
7
  * cross-frame DOM access — validating every message against a strict origin allowlist in
7
8
  * both directions:
8
9
  *
9
10
  * - The PARENT should validate inbound messages against {@link MOVMO_FLIGHTS_ORIGINS}
10
- * ("is this really the Movmo checkout iframe I embedded?").
11
+ * ("is this really the Movmo iframe I embedded?").
11
12
  * - The IFRAME should validate the inbound handshake against {@link MOVMO_PARTNER_ORIGINS}
12
- * ("is this parent page allowed to embed me and receive booking messages?").
13
+ * ("is this parent page allowed to embed me?").
13
14
  *
14
15
  * Handshake: on load the iframe posts {@link MovmoFrameMessageType.READY} (content-free)
15
16
  * to `"*"`; the parent replies with {@link MovmoFrameMessageType.INIT} carrying its own
16
17
  * origin, targeted at the iframe's origin. The iframe captures that origin so every
17
18
  * subsequent message goes to a specific origin instead of `"*"`.
18
19
  *
19
- * Adoption: both flights-ui (iframe) and `@movmo/express-checkout-button` (parent, as of
20
- * v1.4.0) consume this contract. Parent versions before v1.4.0 use their own hardcoded
21
- * origin list and perform no handshake.
22
- *
23
20
  * Note: payload field names are camelCase (browser `postMessage` data), a deliberate
24
21
  * departure from the snake_case Go-DTO convention used elsewhere in this package. Keep
25
22
  * them camelCase — the cross-repo consumers read these exact keys off the wire.
@@ -30,10 +27,6 @@ export declare enum MovmoFrameMessageType {
30
27
  /** parent → iframe: handshake reply carrying the parent's origin so the iframe can
31
28
  * target subsequent messages instead of using `"*"`. */
32
29
  INIT = "MOVMO_INIT",
33
- /** iframe → parent: a booking finished successfully. */
34
- BOOKING_COMPLETE = "MOVMO_BOOKING_COMPLETE",
35
- /** iframe → parent: a booking failed in a non-retryable way. */
36
- BOOKING_FAILED = "MOVMO_BOOKING_FAILED",
37
30
  /**
38
31
  * iframe → parent: the recognition surface's current state. Carries NO identity data by
39
32
  * design — PII and the durable GUID never cross the browser. Parents use this purely to
@@ -86,45 +79,14 @@ export interface MovmoInitMessage {
86
79
  /** Origin of the embedding parent page; the iframe targets this for outbound messages. */
87
80
  parentOrigin: string;
88
81
  }
89
- export interface MovmoBookingCompleteMessage {
90
- type: MovmoFrameMessageType.BOOKING_COMPLETE;
91
- bookingId: string;
92
- /** Airline IATA / company code the booking was made under — NOT the PNR. */
93
- airlineRef?: string;
94
- providerId?: string;
95
- /**
96
- * Record locator (PNR) in the airline's own reservation system — what the traveler
97
- * quotes to the airline. Absent when the provider returned none, and from flights-ui
98
- * builds older than types 1.20.0.
99
- */
100
- airlinePnr?: string;
101
- }
102
82
  /**
103
- * Why the iframe is handing control back to the airline page (MOVMO-474).
104
- * Rides on BOOKING_FAILED rather than a new message type so that parents
105
- * built before v1.6.0 — which already close the overlay on BOOKING_FAILED —
106
- * keep working when a newer flights-ui sends an exit they don't understand.
83
+ * Why the checkout handed control back to the airline page (MOVMO-474). Part of the SDK
84
+ * return contract (`onExit`), not a postMessage.
107
85
  *
108
- * 'booking_confirmed' (MOVMO-521) is the success-path exit: the traveler
109
- * clicked "Return to {airline}" on the booking confirmation. Despite riding
110
- * on BOOKING_FAILED, the booking itself succeeded — a BOOKING_COMPLETE was
111
- * already sent for it.
86
+ * 'booking_confirmed' (MOVMO-521) is the success-path exit: the traveler clicked
87
+ * "Return to {airline}" on the booking confirmation.
112
88
  */
113
89
  export type MovmoExitReason = 'search_again' | 'offer_unavailable' | 'booking_confirmed';
114
- export interface MovmoBookingFailedMessage {
115
- type: MovmoFrameMessageType.BOOKING_FAILED;
116
- /**
117
- * @deprecated Legacy constant no handler reads; kept so pre-1.6.0 parent
118
- * typings keep compiling against this interface. Use `reason` instead.
119
- */
120
- action: 'search_again';
121
- /**
122
- * Optional so the field is additive: parents ≤1.5.0 ignore it and still
123
- * close the overlay; parents ≥1.6.0 pass it to the airline's onExit
124
- * callback. Absent means 'search_again' (messages from older flights-ui).
125
- */
126
- reason?: MovmoExitReason;
127
- }
128
90
  export interface MovmoRecognitionStateMessage {
129
91
  type: MovmoFrameMessageType.RECOGNITION_STATE;
130
92
  state: 'recognized' | 'anonymous' | 'none';
@@ -156,7 +118,7 @@ export interface MovmoRecognitionSignedOutMessage {
156
118
  type: MovmoFrameMessageType.RECOGNITION_SIGNED_OUT;
157
119
  }
158
120
  /** Discriminated union of every message exchanged across the frame boundary. */
159
- export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage | MovmoBookingCompleteMessage | MovmoBookingFailedMessage | MovmoRecognitionStateMessage | MovmoRecognitionTokenMessage | MovmoRecognitionResizeMessage | MovmoRecognitionConnectMessage | MovmoRecognitionErrorMessage | MovmoRecognitionSignedOutMessage;
121
+ export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage | MovmoRecognitionStateMessage | MovmoRecognitionTokenMessage | MovmoRecognitionResizeMessage | MovmoRecognitionConnectMessage | MovmoRecognitionErrorMessage | MovmoRecognitionSignedOutMessage;
160
122
  /** A per-environment origin allowlist (production vs. everything else). */
161
123
  export interface MovmoOriginAllowlist {
162
124
  prod: readonly string[];
@@ -1,26 +1,23 @@
1
1
  "use strict";
2
2
  /**
3
- * postMessage contract shared by the Express Checkout iframe (flights-ui) and the
4
- * embedding parent page (`@movmo/express-checkout-button`).
3
+ * postMessage contract between the Movmo recognition iframe (flights-ui `/recognize`) and the
4
+ * embedding parent page (`@movmo/connect-button`). Checkout no longer runs in a frame: there
5
+ * are no checkout messages here, only the handshake and the recognition messages.
5
6
  *
6
7
  * Both sides SHOULD coordinate exclusively via `window.postMessage` — no direct
7
8
  * cross-frame DOM access — validating every message against a strict origin allowlist in
8
9
  * both directions:
9
10
  *
10
11
  * - The PARENT should validate inbound messages against {@link MOVMO_FLIGHTS_ORIGINS}
11
- * ("is this really the Movmo checkout iframe I embedded?").
12
+ * ("is this really the Movmo iframe I embedded?").
12
13
  * - The IFRAME should validate the inbound handshake against {@link MOVMO_PARTNER_ORIGINS}
13
- * ("is this parent page allowed to embed me and receive booking messages?").
14
+ * ("is this parent page allowed to embed me?").
14
15
  *
15
16
  * Handshake: on load the iframe posts {@link MovmoFrameMessageType.READY} (content-free)
16
17
  * to `"*"`; the parent replies with {@link MovmoFrameMessageType.INIT} carrying its own
17
18
  * origin, targeted at the iframe's origin. The iframe captures that origin so every
18
19
  * subsequent message goes to a specific origin instead of `"*"`.
19
20
  *
20
- * Adoption: both flights-ui (iframe) and `@movmo/express-checkout-button` (parent, as of
21
- * v1.4.0) consume this contract. Parent versions before v1.4.0 use their own hardcoded
22
- * origin list and perform no handshake.
23
- *
24
21
  * Note: payload field names are camelCase (browser `postMessage` data), a deliberate
25
22
  * departure from the snake_case Go-DTO convention used elsewhere in this package. Keep
26
23
  * them camelCase — the cross-repo consumers read these exact keys off the wire.
@@ -35,10 +32,6 @@ var MovmoFrameMessageType;
35
32
  /** parent → iframe: handshake reply carrying the parent's origin so the iframe can
36
33
  * target subsequent messages instead of using `"*"`. */
37
34
  MovmoFrameMessageType["INIT"] = "MOVMO_INIT";
38
- /** iframe → parent: a booking finished successfully. */
39
- MovmoFrameMessageType["BOOKING_COMPLETE"] = "MOVMO_BOOKING_COMPLETE";
40
- /** iframe → parent: a booking failed in a non-retryable way. */
41
- MovmoFrameMessageType["BOOKING_FAILED"] = "MOVMO_BOOKING_FAILED";
42
35
  /**
43
36
  * iframe → parent: the recognition surface's current state. Carries NO identity data by
44
37
  * design — PII and the durable GUID never cross the browser. Parents use this purely to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movmo_app/types",
3
- "version": "1.24.0",
3
+ "version": "1.26.0",
4
4
  "description": "A collection of Movmo's types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",