@movmo_app/types 1.25.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 +0 -5
- package/dist/postmessage_contracts.d.ts +10 -52
- package/dist/postmessage_contracts.js +5 -12
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -25,11 +25,6 @@ export type MovmoLoginRequest = {
|
|
|
25
25
|
email: string;
|
|
26
26
|
locale?: string;
|
|
27
27
|
time_zone?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Create the flow without sending a code for an unenrolled email; `/v1/auth/code` releases the
|
|
30
|
-
* first send. Used by the partner iframe.
|
|
31
|
-
*/
|
|
32
|
-
defer_code?: boolean;
|
|
33
28
|
};
|
|
34
29
|
export type MovmoLoginResponse = MovmoCodeFlow | MovmoPasskeyFlow;
|
|
35
30
|
export type PasskeyOptionsResponse = {
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* postMessage contract
|
|
3
|
-
* embedding parent page (`@movmo/
|
|
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
|
|
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
|
|
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
|
|
@@ -85,50 +78,15 @@ export interface MovmoInitMessage {
|
|
|
85
78
|
type: MovmoFrameMessageType.INIT;
|
|
86
79
|
/** Origin of the embedding parent page; the iframe targets this for outbound messages. */
|
|
87
80
|
parentOrigin: string;
|
|
88
|
-
/** Set by SDKs that put `publickey-credentials-get` in the iframe `allow` attribute (MOVMO-686). */
|
|
89
|
-
capabilities?: {
|
|
90
|
-
passkeys?: boolean;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export interface MovmoBookingCompleteMessage {
|
|
94
|
-
type: MovmoFrameMessageType.BOOKING_COMPLETE;
|
|
95
|
-
bookingId: string;
|
|
96
|
-
/** Airline IATA / company code the booking was made under — NOT the PNR. */
|
|
97
|
-
airlineRef?: string;
|
|
98
|
-
providerId?: string;
|
|
99
|
-
/**
|
|
100
|
-
* Record locator (PNR) in the airline's own reservation system — what the traveler
|
|
101
|
-
* quotes to the airline. Absent when the provider returned none, and from flights-ui
|
|
102
|
-
* builds older than types 1.20.0.
|
|
103
|
-
*/
|
|
104
|
-
airlinePnr?: string;
|
|
105
81
|
}
|
|
106
82
|
/**
|
|
107
|
-
* Why the
|
|
108
|
-
*
|
|
109
|
-
* built before v1.6.0 — which already close the overlay on BOOKING_FAILED —
|
|
110
|
-
* 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.
|
|
111
85
|
*
|
|
112
|
-
* 'booking_confirmed' (MOVMO-521) is the success-path exit: the traveler
|
|
113
|
-
*
|
|
114
|
-
* on BOOKING_FAILED, the booking itself succeeded — a BOOKING_COMPLETE was
|
|
115
|
-
* 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.
|
|
116
88
|
*/
|
|
117
89
|
export type MovmoExitReason = 'search_again' | 'offer_unavailable' | 'booking_confirmed';
|
|
118
|
-
export interface MovmoBookingFailedMessage {
|
|
119
|
-
type: MovmoFrameMessageType.BOOKING_FAILED;
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated Legacy constant no handler reads; kept so pre-1.6.0 parent
|
|
122
|
-
* typings keep compiling against this interface. Use `reason` instead.
|
|
123
|
-
*/
|
|
124
|
-
action: 'search_again';
|
|
125
|
-
/**
|
|
126
|
-
* Optional so the field is additive: parents ≤1.5.0 ignore it and still
|
|
127
|
-
* close the overlay; parents ≥1.6.0 pass it to the airline's onExit
|
|
128
|
-
* callback. Absent means 'search_again' (messages from older flights-ui).
|
|
129
|
-
*/
|
|
130
|
-
reason?: MovmoExitReason;
|
|
131
|
-
}
|
|
132
90
|
export interface MovmoRecognitionStateMessage {
|
|
133
91
|
type: MovmoFrameMessageType.RECOGNITION_STATE;
|
|
134
92
|
state: 'recognized' | 'anonymous' | 'none';
|
|
@@ -160,7 +118,7 @@ export interface MovmoRecognitionSignedOutMessage {
|
|
|
160
118
|
type: MovmoFrameMessageType.RECOGNITION_SIGNED_OUT;
|
|
161
119
|
}
|
|
162
120
|
/** Discriminated union of every message exchanged across the frame boundary. */
|
|
163
|
-
export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage |
|
|
121
|
+
export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage | MovmoRecognitionStateMessage | MovmoRecognitionTokenMessage | MovmoRecognitionResizeMessage | MovmoRecognitionConnectMessage | MovmoRecognitionErrorMessage | MovmoRecognitionSignedOutMessage;
|
|
164
122
|
/** A per-environment origin allowlist (production vs. everything else). */
|
|
165
123
|
export interface MovmoOriginAllowlist {
|
|
166
124
|
prod: readonly string[];
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* postMessage contract
|
|
4
|
-
* embedding parent page (`@movmo/
|
|
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
|
|
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
|
|
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
|