@movmo_app/types 1.15.0 → 1.17.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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/postmessage_contracts.d.ts +26 -2
- package/dist/postmessage_contracts.js +13 -0
- package/dist/scope_copy.d.ts +47 -0
- package/dist/scope_copy.js +108 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -31,3 +31,4 @@ __exportStar(require("./movmo_flight_offer"), exports);
|
|
|
31
31
|
__exportStar(require("./locale_preferences"), exports);
|
|
32
32
|
__exportStar(require("./postmessage_contracts"), exports);
|
|
33
33
|
__exportStar(require("./identity"), exports);
|
|
34
|
+
__exportStar(require("./scope_copy"), exports);
|
|
@@ -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
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized OAuth scope display copy (MOVMO-455). Single shared source of
|
|
3
|
+
* truth for the plain-language copy shown on consent surfaces — the auth-ui
|
|
4
|
+
* consent screen and accounts-ui's Connected Apps page previously hand-kept
|
|
5
|
+
* two copies of this file in sync (MOVMO-407/408); this package replaces
|
|
6
|
+
* both.
|
|
7
|
+
*
|
|
8
|
+
* Source of truth for the canonical scope *values* is go-services-core/scopes;
|
|
9
|
+
* the copy here matches the approved Figma reference table (MOVMO-441 mock
|
|
10
|
+
* file, page MOVMO-407). Raw scope values are never rendered to the user —
|
|
11
|
+
* GDPR informed consent wants plain language; identifiers live in the OAuth
|
|
12
|
+
* request and the consent record.
|
|
13
|
+
*/
|
|
14
|
+
export interface ScopeCopy {
|
|
15
|
+
label: string;
|
|
16
|
+
detail?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const SCOPE_COPY: Record<string, ScopeCopy>;
|
|
19
|
+
/**
|
|
20
|
+
* When a client requests both `.read` and `.write` of a domain, the UI
|
|
21
|
+
* collapses them into ONE "View and manage" row — both scopes are still
|
|
22
|
+
* granted and recorded individually (write does NOT imply read in the RBAC
|
|
23
|
+
* mapping). `bookings` is the exception: viewing trip history and booking
|
|
24
|
+
* flights are distinct enough to always show separately.
|
|
25
|
+
*/
|
|
26
|
+
export declare const PAIR_COPY: Record<string, ScopeCopy>;
|
|
27
|
+
/**
|
|
28
|
+
* A single row a consent/scope-management UI renders. `key` is a stable
|
|
29
|
+
* identifier for the row (e.g. `"profile"` for a collapsed pair, or the raw
|
|
30
|
+
* scope value itself for an unpaired/unknown scope) — use it as a React
|
|
31
|
+
* `key` or as the id a toggle/checkbox binds to. `scopes` is the underlying
|
|
32
|
+
* raw scope value(s) this row represents, so granular per-scope UIs (MOVMO-455)
|
|
33
|
+
* know exactly which scopes to grant or withhold when the row is
|
|
34
|
+
* toggled — a collapsed read+write pair carries both raw scopes, an unpaired
|
|
35
|
+
* or unknown scope carries just itself.
|
|
36
|
+
*/
|
|
37
|
+
export interface ScopeDisplayRow extends ScopeCopy {
|
|
38
|
+
key: string;
|
|
39
|
+
scopes: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* displayRows converts a scope list into the rows a consent/scope-management
|
|
43
|
+
* UI renders, collapsing read+write pairs (except bookings) and preserving
|
|
44
|
+
* first-appearance order. Unknown scopes fall back to their raw value so a
|
|
45
|
+
* newer backend scope never renders as an empty row.
|
|
46
|
+
*/
|
|
47
|
+
export declare function displayRows(scopes: string[]): ScopeDisplayRow[];
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Centralized OAuth scope display copy (MOVMO-455). Single shared source of
|
|
4
|
+
* truth for the plain-language copy shown on consent surfaces — the auth-ui
|
|
5
|
+
* consent screen and accounts-ui's Connected Apps page previously hand-kept
|
|
6
|
+
* two copies of this file in sync (MOVMO-407/408); this package replaces
|
|
7
|
+
* both.
|
|
8
|
+
*
|
|
9
|
+
* Source of truth for the canonical scope *values* is go-services-core/scopes;
|
|
10
|
+
* the copy here matches the approved Figma reference table (MOVMO-441 mock
|
|
11
|
+
* file, page MOVMO-407). Raw scope values are never rendered to the user —
|
|
12
|
+
* GDPR informed consent wants plain language; identifiers live in the OAuth
|
|
13
|
+
* request and the consent record.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PAIR_COPY = exports.SCOPE_COPY = void 0;
|
|
17
|
+
exports.displayRows = displayRows;
|
|
18
|
+
exports.SCOPE_COPY = {
|
|
19
|
+
'profile.read': {
|
|
20
|
+
label: 'View your profile',
|
|
21
|
+
detail: 'Name and contact details',
|
|
22
|
+
},
|
|
23
|
+
'profile.write': {
|
|
24
|
+
label: 'Update your profile',
|
|
25
|
+
detail: 'Including your profile photo',
|
|
26
|
+
},
|
|
27
|
+
'preferences.read': {
|
|
28
|
+
label: 'View your travel preferences',
|
|
29
|
+
detail: 'Seat, meal, and assistance preferences; language and currency',
|
|
30
|
+
},
|
|
31
|
+
'preferences.write': {
|
|
32
|
+
label: 'Update your travel preferences',
|
|
33
|
+
},
|
|
34
|
+
'passengers.read': {
|
|
35
|
+
label: 'View your saved travelers',
|
|
36
|
+
detail: 'Including travel document details',
|
|
37
|
+
},
|
|
38
|
+
'passengers.write': {
|
|
39
|
+
label: 'Add, update, and remove saved travelers',
|
|
40
|
+
},
|
|
41
|
+
'payments.read': {
|
|
42
|
+
label: 'View saved payment methods',
|
|
43
|
+
detail: 'Card brand and last 4 digits only — never full numbers',
|
|
44
|
+
},
|
|
45
|
+
'payments.write': {
|
|
46
|
+
label: 'Update or remove saved payment methods',
|
|
47
|
+
detail: 'Cannot add new cards',
|
|
48
|
+
},
|
|
49
|
+
'bookings.read': {
|
|
50
|
+
label: 'View your bookings and trip history',
|
|
51
|
+
},
|
|
52
|
+
'bookings.write': {
|
|
53
|
+
label: 'Search and book flights',
|
|
54
|
+
detail: 'Bookings are charged to a saved payment method',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* When a client requests both `.read` and `.write` of a domain, the UI
|
|
59
|
+
* collapses them into ONE "View and manage" row — both scopes are still
|
|
60
|
+
* granted and recorded individually (write does NOT imply read in the RBAC
|
|
61
|
+
* mapping). `bookings` is the exception: viewing trip history and booking
|
|
62
|
+
* flights are distinct enough to always show separately.
|
|
63
|
+
*/
|
|
64
|
+
exports.PAIR_COPY = {
|
|
65
|
+
profile: {
|
|
66
|
+
label: 'View and manage your profile',
|
|
67
|
+
detail: 'Name, contact details, and profile photo',
|
|
68
|
+
},
|
|
69
|
+
preferences: {
|
|
70
|
+
label: 'View and manage your travel preferences',
|
|
71
|
+
detail: 'Update seat, meal, and assistance preferences you’ve saved',
|
|
72
|
+
},
|
|
73
|
+
passengers: {
|
|
74
|
+
label: 'View and manage saved travelers',
|
|
75
|
+
detail: 'Add, update, and remove travelers — including travel document details',
|
|
76
|
+
},
|
|
77
|
+
payments: {
|
|
78
|
+
label: 'View and manage saved payment methods',
|
|
79
|
+
detail: 'Card brand and last 4 digits only — never full numbers. Can’t add new cards.',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* displayRows converts a scope list into the rows a consent/scope-management
|
|
84
|
+
* UI renders, collapsing read+write pairs (except bookings) and preserving
|
|
85
|
+
* first-appearance order. Unknown scopes fall back to their raw value so a
|
|
86
|
+
* newer backend scope never renders as an empty row.
|
|
87
|
+
*/
|
|
88
|
+
function displayRows(scopes) {
|
|
89
|
+
const set = new Set(scopes);
|
|
90
|
+
const emittedDomains = new Set();
|
|
91
|
+
const rows = [];
|
|
92
|
+
for (const scope of scopes) {
|
|
93
|
+
const [domain] = scope.split('.');
|
|
94
|
+
const pair = exports.PAIR_COPY[domain];
|
|
95
|
+
const hasBoth = set.has(`${domain}.read`) && set.has(`${domain}.write`);
|
|
96
|
+
if (pair && hasBoth) {
|
|
97
|
+
if (!emittedDomains.has(domain)) {
|
|
98
|
+
emittedDomains.add(domain);
|
|
99
|
+
rows.push(Object.assign(Object.assign({}, pair), { key: domain, scopes: [`${domain}.read`, `${domain}.write`] }));
|
|
100
|
+
}
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const copy = exports.SCOPE_COPY[scope];
|
|
104
|
+
rows.push(copy
|
|
105
|
+
? Object.assign(Object.assign({}, copy), { key: scope, scopes: [scope] }) : { label: scope, key: scope, scopes: [scope] });
|
|
106
|
+
}
|
|
107
|
+
return rows;
|
|
108
|
+
}
|