@movmo_app/types 1.16.0 → 1.18.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
@@ -24,40 +24,45 @@ pnpm add @movmo_app/types
24
24
  Import the types you need in your TypeScript files:
25
25
 
26
26
  ```typescript
27
- import { FlightOffer, DataSource, BookingStatus } from '@movmo_app/types';
28
-
29
- // Example usage
30
- const offer: FlightOffer = {
31
- // ...
32
- };
33
-
34
- const dataSource: DataSource = "amadeus";
35
-
36
- const status: BookingStatus = "CONFIRMED";
27
+ import {
28
+ MovmoFlightOffer,
29
+ FlightOfferDataSource,
30
+ MovmoFrameMessageType,
31
+ isTrustedOrigin,
32
+ } from '@movmo_app/types';
33
+
34
+ const dataSource: FlightOfferDataSource = FlightOfferDataSource.Amadeus;
37
35
  ```
38
36
 
39
- ## Available Types
40
-
41
- ### Core Types
42
-
43
- - `FlightOffer`: Represents a flight offer from a data source
44
- - `BookingData`: Contains booking details
45
- - `PassengerInfo`: Passenger information
46
- - `PricingInfo`: Flight pricing details
47
-
48
- ### Enums
49
-
50
- - `DataSource`: Available data sources (e.g., "amadeus", "sabre")
51
- - `BookingStatus`: Status of a booking (e.g., "PENDING", "CONFIRMED", "CANCELLED")
52
- - `PaymentMethod`: Available payment methods
53
- - `FlightClass`: Flight class types (e.g., "ECONOMY", "BUSINESS", "FIRST")
54
-
55
- ### API Request/Response Types
56
-
57
- - `FlightOfferRequest`: Request format for retrieving flight offers
58
- - `FlightOfferResponse`: Response format for flight offers
59
- - `BookingRequest`: Request format for creating a booking
60
- - `BookingResponse`: Response format for booking creation
37
+ Field names are **snake_case** to match the Go backend's JSON — with one deliberate exception: the
38
+ cross-frame `postMessage` payloads in `postmessage_contracts` are camelCase (browser convention).
39
+
40
+ ## Available Modules
41
+
42
+ Everything below is re-exported from the package root (see `src/index.ts`):
43
+
44
+ - `movmo_flight_offer` — `MovmoFlightOffer` and its slice/segment/fare structures (the canonical offer model; the bare `FlightOffer` in `booking` is legacy)
45
+ - `booking` — booking DTOs and the legacy `FlightOffer` model
46
+ - `booking_passenger` — passenger records attached to bookings
47
+ - `users` / `customers` / `auth` / `sessions` — user, customer, auth, and session DTOs
48
+ - `payments` — payment method DTOs
49
+ - `identity_documents` — passport / KTN document types
50
+ - `loyalty_programs` — loyalty program membership types
51
+ - `travel_preferences` / `locale_preferences` — preference DTOs
52
+ - `trip_summary` — trip summary structures
53
+ - `referrals` — referral types
54
+ - `identity` — identity-partner directory types (`IdentityPartner`, `mapIdentityPartners`)
55
+ - `scope_copy` — shared OAuth scope display copy (one source of truth for consent-screen wording)
56
+ - `postmessage_contracts` — the cross-frame `postMessage` contract shared by flights-ui and the
57
+ `@movmo/express-checkout-button` / `@movmo/connect-button` embeds: `MovmoFrameMessageType`
58
+ (READY/INIT handshake, booking outcomes, `RECOGNITION_STATE`/`RECOGNITION_TOKEN`/
59
+ `RECOGNITION_RESIZE`/`RECOGNITION_CONNECT`/`RECOGNITION_ERROR`), the per-message payload
60
+ interfaces, the origin allowlists, and `isTrustedOrigin`
61
+ - `types` — small shared helpers
62
+
63
+ Conventions: `type` for DTOs, `interface` for extensible contracts, `enum` for fixed value sets
64
+ (e.g. `FlightOfferDataSource`, `TravelerType`), and `Create*Payload` / `Update*Payload` for API
65
+ request bodies.
61
66
 
62
67
  ## Development
63
68
 
@@ -14,6 +14,7 @@ export interface IdentityPartner {
14
14
  airlineName: string;
15
15
  airlineDomain: string;
16
16
  providerId: string;
17
+ supportedScopes: string[];
17
18
  }
18
19
  /**
19
20
  * Wire shape of a single entry in `GET /v1/identity/partners`'s `partners`
@@ -24,6 +25,7 @@ export interface IdentityPartnerWire {
24
25
  airline_name: string;
25
26
  airline_domain: string;
26
27
  provider_id: string;
28
+ supported_scopes?: string[];
27
29
  }
28
30
  /**
29
31
  * Wire shape of the `GET /v1/identity/partners` response envelope.
package/dist/identity.js CHANGED
@@ -9,10 +9,14 @@ exports.mapIdentityPartners = mapIdentityPartners;
9
9
  */
10
10
  function mapIdentityPartners(response) {
11
11
  var _a;
12
- return ((_a = response === null || response === void 0 ? void 0 : response.partners) !== null && _a !== void 0 ? _a : []).map((partner) => ({
13
- clientId: partner.client_id,
14
- airlineName: partner.airline_name,
15
- airlineDomain: partner.airline_domain,
16
- providerId: partner.provider_id,
17
- }));
12
+ return ((_a = response === null || response === void 0 ? void 0 : response.partners) !== null && _a !== void 0 ? _a : []).map((partner) => {
13
+ var _a;
14
+ return ({
15
+ clientId: partner.client_id,
16
+ airlineName: partner.airline_name,
17
+ airlineDomain: partner.airline_domain,
18
+ providerId: partner.provider_id,
19
+ supportedScopes: (_a = partner.supported_scopes) !== null && _a !== void 0 ? _a : [],
20
+ });
21
+ });
18
22
  }
@@ -53,7 +53,20 @@ export declare enum MovmoFrameMessageType {
53
53
  * iframe → parent: a user gesture requesting the parent start the Movmo OAuth (Flow A)
54
54
  * redirect.
55
55
  */
56
- RECOGNITION_CONNECT = "MOVMO_RECOGNITION_CONNECT"
56
+ RECOGNITION_CONNECT = "MOVMO_RECOGNITION_CONNECT",
57
+ /**
58
+ * iframe → parent: the recognition surface hit an internal failure (e.g. the
59
+ * recognition-token mint errored) and could not complete (MOVMO-547). Always
60
+ * accompanied by a RECOGNITION_STATE settling the surface (today: 'anonymous'),
61
+ * so parents that ignore this message still render a consistent state — it exists
62
+ * so the airline host can OBSERVE the failure (telemetry, fallback UX) instead of
63
+ * mistaking it for an ordinary anonymous visitor.
64
+ *
65
+ * Privacy invariant (see RECOGNITION_STATE): the payload carries NO identity data
66
+ * and the `code` is deliberately coarse — it must never reveal which internal call
67
+ * failed, since that could imply the visitor's Movmo auth state before consent.
68
+ */
69
+ RECOGNITION_ERROR = "MOVMO_RECOGNITION_ERROR"
57
70
  }
58
71
  export interface MovmoReadyMessage {
59
72
  type: MovmoFrameMessageType.READY;
@@ -112,8 +125,19 @@ export interface MovmoRecognitionResizeMessage {
112
125
  export interface MovmoRecognitionConnectMessage {
113
126
  type: MovmoFrameMessageType.RECOGNITION_CONNECT;
114
127
  }
128
+ export interface MovmoRecognitionErrorMessage {
129
+ type: MovmoFrameMessageType.RECOGNITION_ERROR;
130
+ /**
131
+ * Coarse machine-readable code. Known values: `recognition_failed` (the surface
132
+ * could not complete recognition due to a service error). Typed as `string` so
133
+ * older parents keep compiling/forwarding when newer iframes add codes.
134
+ */
135
+ code: string;
136
+ /** Human-readable detail for the airline's logs. Never identity data. */
137
+ message: string;
138
+ }
115
139
  /** Discriminated union of every message exchanged across the frame boundary. */
116
- export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage | MovmoBookingCompleteMessage | MovmoBookingFailedMessage | MovmoRecognitionStateMessage | MovmoRecognitionTokenMessage | MovmoRecognitionResizeMessage | MovmoRecognitionConnectMessage;
140
+ export type MovmoFrameMessage = MovmoReadyMessage | MovmoInitMessage | MovmoBookingCompleteMessage | MovmoBookingFailedMessage | MovmoRecognitionStateMessage | MovmoRecognitionTokenMessage | MovmoRecognitionResizeMessage | MovmoRecognitionConnectMessage | MovmoRecognitionErrorMessage;
117
141
  /** A per-environment origin allowlist (production vs. everything else). */
118
142
  export interface MovmoOriginAllowlist {
119
143
  prod: readonly string[];
@@ -59,6 +59,19 @@ var MovmoFrameMessageType;
59
59
  * redirect.
60
60
  */
61
61
  MovmoFrameMessageType["RECOGNITION_CONNECT"] = "MOVMO_RECOGNITION_CONNECT";
62
+ /**
63
+ * iframe → parent: the recognition surface hit an internal failure (e.g. the
64
+ * recognition-token mint errored) and could not complete (MOVMO-547). Always
65
+ * accompanied by a RECOGNITION_STATE settling the surface (today: 'anonymous'),
66
+ * so parents that ignore this message still render a consistent state — it exists
67
+ * so the airline host can OBSERVE the failure (telemetry, fallback UX) instead of
68
+ * mistaking it for an ordinary anonymous visitor.
69
+ *
70
+ * Privacy invariant (see RECOGNITION_STATE): the payload carries NO identity data
71
+ * and the `code` is deliberately coarse — it must never reveal which internal call
72
+ * failed, since that could imply the visitor's Movmo auth state before consent.
73
+ */
74
+ MovmoFrameMessageType["RECOGNITION_ERROR"] = "MOVMO_RECOGNITION_ERROR";
62
75
  })(MovmoFrameMessageType || (exports.MovmoFrameMessageType = MovmoFrameMessageType = {}));
63
76
  /**
64
77
  * Origins served by Movmo's flights-ui iframe. The PARENT
@@ -46,6 +46,10 @@ exports.SCOPE_COPY = {
46
46
  label: 'Update or remove saved payment methods',
47
47
  detail: 'Cannot add new cards',
48
48
  },
49
+ 'loyalty.read': {
50
+ label: 'View your loyalty status',
51
+ detail: 'Loyalty program status and membership with the airline and their alliance, if applicable',
52
+ },
49
53
  'bookings.read': {
50
54
  label: 'View your bookings and trip history',
51
55
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movmo_app/types",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "A collection of Movmo's types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",