@coinflowlabs/react 5.20.0 → 5.21.1
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 +4 -10
- package/build/cjs/CoinflowIFrame.js +4 -0
- package/build/cjs/CoinflowIFrame.js.map +1 -1
- package/build/cjs/MobileWalletButton.js +3 -1
- package/build/cjs/MobileWalletButton.js.map +1 -1
- package/build/cjs/card-form/CoinflowCardFormV2.js +87 -10
- package/build/cjs/card-form/CoinflowCardFormV2.js.map +1 -1
- package/build/cjs/common/CoinflowTypes.d.ts +26 -3
- package/build/cjs/common/CoinflowTypes.js +1 -0
- package/build/cjs/common/CoinflowTypes.js.map +1 -1
- package/build/cjs/common/CoinflowUtils.d.ts +1 -1
- package/build/cjs/common/CoinflowUtils.js +5 -1
- package/build/cjs/common/CoinflowUtils.js.map +1 -1
- package/build/cjs/common/card-form/cardEntryLayout.d.ts +88 -0
- package/build/cjs/common/card-form/cardEntryLayout.js +185 -0
- package/build/cjs/common/card-form/cardEntryLayout.js.map +1 -0
- package/build/cjs/common/card-form/cardFormSkeleton.d.ts +104 -0
- package/build/cjs/common/card-form/cardFormSkeleton.js +190 -0
- package/build/cjs/common/card-form/cardFormSkeleton.js.map +1 -0
- package/build/cjs/common/index.d.ts +6 -0
- package/build/cjs/common/index.js +6 -0
- package/build/cjs/common/index.js.map +1 -1
- package/build/cjs/common/types/flightTicketCartItem.d.ts +49 -0
- package/build/cjs/common/types/flightTicketCartItem.js +3 -0
- package/build/cjs/common/types/flightTicketCartItem.js.map +1 -0
- package/build/cjs/common/types/flightUpgradeCartItem.d.ts +49 -0
- package/build/cjs/common/types/flightUpgradeCartItem.js +3 -0
- package/build/cjs/common/types/flightUpgradeCartItem.js.map +1 -0
- package/build/cjs/common/types/lodgingCartItem.d.ts +37 -0
- package/build/cjs/common/types/lodgingCartItem.js +3 -0
- package/build/cjs/common/types/lodgingCartItem.js.map +1 -0
- package/build/cjs/common/types/travelCartItem.d.ts +212 -0
- package/build/cjs/common/types/travelCartItem.js +3 -0
- package/build/cjs/common/types/travelCartItem.js.map +1 -0
- package/build/esm/CoinflowIFrame.js +4 -0
- package/build/esm/CoinflowIFrame.js.map +1 -1
- package/build/esm/MobileWalletButton.js +3 -1
- package/build/esm/MobileWalletButton.js.map +1 -1
- package/build/esm/card-form/CoinflowCardFormV2.js +88 -11
- package/build/esm/card-form/CoinflowCardFormV2.js.map +1 -1
- package/build/esm/common/CoinflowTypes.d.ts +26 -3
- package/build/esm/common/CoinflowTypes.js +1 -0
- package/build/esm/common/CoinflowTypes.js.map +1 -1
- package/build/esm/common/CoinflowUtils.d.ts +1 -1
- package/build/esm/common/CoinflowUtils.js +5 -1
- package/build/esm/common/CoinflowUtils.js.map +1 -1
- package/build/esm/common/card-form/cardEntryLayout.d.ts +88 -0
- package/build/esm/common/card-form/cardEntryLayout.js +180 -0
- package/build/esm/common/card-form/cardEntryLayout.js.map +1 -0
- package/build/esm/common/card-form/cardFormSkeleton.d.ts +104 -0
- package/build/esm/common/card-form/cardFormSkeleton.js +181 -0
- package/build/esm/common/card-form/cardFormSkeleton.js.map +1 -0
- package/build/esm/common/index.d.ts +6 -0
- package/build/esm/common/index.js +6 -0
- package/build/esm/common/index.js.map +1 -1
- package/build/esm/common/types/flightTicketCartItem.d.ts +49 -0
- package/build/esm/common/types/flightTicketCartItem.js +2 -0
- package/build/esm/common/types/flightTicketCartItem.js.map +1 -0
- package/build/esm/common/types/flightUpgradeCartItem.d.ts +49 -0
- package/build/esm/common/types/flightUpgradeCartItem.js +2 -0
- package/build/esm/common/types/flightUpgradeCartItem.js.map +1 -0
- package/build/esm/common/types/lodgingCartItem.d.ts +37 -0
- package/build/esm/common/types/lodgingCartItem.js +2 -0
- package/build/esm/common/types/lodgingCartItem.js.map +1 -0
- package/build/esm/common/types/travelCartItem.d.ts +212 -0
- package/build/esm/common/types/travelCartItem.js +2 -0
- package/build/esm/common/types/travelCartItem.js.map +1 -0
- package/build/tsconfig.cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Single source of truth for the card-entry responsive layout.
|
|
4
|
+
*
|
|
5
|
+
* The real card-entry form (`UnifiedCardEntry` in the core-flows app) and the
|
|
6
|
+
* React/Vue/Angular skeleton loaders all render the same grid. Historically the
|
|
7
|
+
* form drove the inline↔two-row switch from JS (a ResizeObserver toggling React
|
|
8
|
+
* state) while the skeletons hard-coded their own guesses, so the two drifted.
|
|
9
|
+
*
|
|
10
|
+
* This module defines the grid templates and the breakpoint ONCE, as pure data
|
|
11
|
+
* plus a CSS builder, so every consumer reflows at exactly the same width via a
|
|
12
|
+
* CSS container query — no JS width measurement, nothing to keep in sync.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CARD_ENTRY_MARGIN_PX = exports.CARD_ENTRY_BORDER_PX = exports.CARD_ENTRY_DIVIDER_PX = exports.CARD_ENTRY_ROW_HEIGHT_PX = exports.CARD_ENTRY_ROW_HEIGHT = exports.CARD_ENTRY_SLOT_GAP_PX = exports.CARD_ENTRY_MIN_WIDTHS = void 0;
|
|
16
|
+
exports.buildCardEntryLayout = buildCardEntryLayout;
|
|
17
|
+
exports.buildCardEntryGridCss = buildCardEntryGridCss;
|
|
18
|
+
/**
|
|
19
|
+
* Minimum width (px) each field needs before the row is too cramped and the
|
|
20
|
+
* layout drops to two rows. Mirrors the real form's field sizing.
|
|
21
|
+
*/
|
|
22
|
+
exports.CARD_ENTRY_MIN_WIDTHS = {
|
|
23
|
+
'card-number': 180,
|
|
24
|
+
expiration: 96,
|
|
25
|
+
cvv: 80,
|
|
26
|
+
};
|
|
27
|
+
/** Notional gap (px) between fields, summed into the reflow breakpoint. */
|
|
28
|
+
exports.CARD_ENTRY_SLOT_GAP_PX = 8;
|
|
29
|
+
/** Field row height — matches the real form's `3rem` grid rows. */
|
|
30
|
+
exports.CARD_ENTRY_ROW_HEIGHT = '3rem';
|
|
31
|
+
exports.CARD_ENTRY_ROW_HEIGHT_PX = 48;
|
|
32
|
+
/** 1px accent line between rows / between exp & cvv in the two-row layout. */
|
|
33
|
+
exports.CARD_ENTRY_DIVIDER_PX = 1;
|
|
34
|
+
/**
|
|
35
|
+
* The form draws its fields inside a 1px border, so the query container (the
|
|
36
|
+
* full iframe width) is 2px wider than the field row that `minRowWidth`
|
|
37
|
+
* describes. The breakpoint bakes this in so form and skeleton flip together.
|
|
38
|
+
*/
|
|
39
|
+
exports.CARD_ENTRY_BORDER_PX = 1;
|
|
40
|
+
/**
|
|
41
|
+
* The form insets its box by this much on every side (Tailwind `m-0.5`) so the
|
|
42
|
+
* focus ring has room and isn't clipped at the iframe edge. It adds to the box's
|
|
43
|
+
* rendered height, so the skeleton's height guess includes it to avoid a jump
|
|
44
|
+
* when the loaded form replaces the skeleton.
|
|
45
|
+
*/
|
|
46
|
+
exports.CARD_ENTRY_MARGIN_PX = 2;
|
|
47
|
+
/** Inline (wide-layout) track width for each field. */
|
|
48
|
+
const INLINE_SLOT_WIDTH = {
|
|
49
|
+
'card-number': '1fr',
|
|
50
|
+
expiration: '96px',
|
|
51
|
+
cvv: '80px',
|
|
52
|
+
};
|
|
53
|
+
/** grid-area name a field occupies. */
|
|
54
|
+
const FIELD_AREA = {
|
|
55
|
+
'card-number': 'card',
|
|
56
|
+
expiration: 'exp',
|
|
57
|
+
cvv: 'cvv',
|
|
58
|
+
};
|
|
59
|
+
function has(inputs, name) {
|
|
60
|
+
return inputs.includes(name);
|
|
61
|
+
}
|
|
62
|
+
/** The reflow breakpoint on the field row, before adding the form border. */
|
|
63
|
+
function minRowWidthPx(inputs) {
|
|
64
|
+
const fields = inputs.reduce((sum, name) => sum + exports.CARD_ENTRY_MIN_WIDTHS[name], 0);
|
|
65
|
+
const gaps = Math.max(0, inputs.length - 1) * exports.CARD_ENTRY_SLOT_GAP_PX;
|
|
66
|
+
return fields + gaps;
|
|
67
|
+
}
|
|
68
|
+
/** grid-template for the single-row inline layout. */
|
|
69
|
+
function inlineTemplate({ inputs, hasIcon, }) {
|
|
70
|
+
const areas = [];
|
|
71
|
+
const cols = [];
|
|
72
|
+
const pushSlot = (area, width) => {
|
|
73
|
+
if (areas.length > 0) {
|
|
74
|
+
areas.push(`d${area.toUpperCase()}`);
|
|
75
|
+
cols.push('1px');
|
|
76
|
+
}
|
|
77
|
+
areas.push(area);
|
|
78
|
+
cols.push(width);
|
|
79
|
+
};
|
|
80
|
+
if (hasIcon && has(inputs, 'card-number'))
|
|
81
|
+
pushSlot('icon', 'auto');
|
|
82
|
+
for (const name of inputs)
|
|
83
|
+
pushSlot(FIELD_AREA[name], INLINE_SLOT_WIDTH[name]);
|
|
84
|
+
return `"${areas.join(' ')}" ${exports.CARD_ENTRY_ROW_HEIGHT} / ${cols.join(' ')}`;
|
|
85
|
+
}
|
|
86
|
+
/** grid-template + dividers for the two-row layout (PAN on top). */
|
|
87
|
+
function twoRowTemplate({ inputs, hasIcon, }) {
|
|
88
|
+
const showsCard = has(inputs, 'card-number');
|
|
89
|
+
const showsExp = has(inputs, 'expiration');
|
|
90
|
+
const showsCvv = has(inputs, 'cvv');
|
|
91
|
+
if (!showsCard || (!showsExp && !showsCvv))
|
|
92
|
+
return null;
|
|
93
|
+
const rows = `${exports.CARD_ENTRY_ROW_HEIGHT} ${exports.CARD_ENTRY_DIVIDER_PX}px ${exports.CARD_ENTRY_ROW_HEIGHT}`;
|
|
94
|
+
if (showsExp && showsCvv) {
|
|
95
|
+
const areas = hasIcon
|
|
96
|
+
? '"icon card card card" "dHR dHR dHR dHR" "exp exp dEV cvv"'
|
|
97
|
+
: '"card card card" "dHR dHR dHR" "exp dEV cvv"';
|
|
98
|
+
const cols = hasIcon
|
|
99
|
+
? 'auto minmax(0, 1fr) 1px minmax(0, 1fr)'
|
|
100
|
+
: 'minmax(0, 1fr) 1px minmax(0, 1fr)';
|
|
101
|
+
return {
|
|
102
|
+
template: gridShorthand(areas, rows, cols),
|
|
103
|
+
dividers: [
|
|
104
|
+
{ area: 'dHR', orientation: 'h' },
|
|
105
|
+
{ area: 'dEV', orientation: 'v' },
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const onlyBottom = showsExp ? 'exp' : 'cvv';
|
|
110
|
+
const areas = hasIcon
|
|
111
|
+
? `"icon card" "dHR dHR" "${onlyBottom} ${onlyBottom}"`
|
|
112
|
+
: `"card" "dHR" "${onlyBottom}"`;
|
|
113
|
+
const cols = hasIcon ? 'auto minmax(0, 1fr)' : 'minmax(0, 1fr)';
|
|
114
|
+
return {
|
|
115
|
+
template: gridShorthand(areas, rows, cols),
|
|
116
|
+
dividers: [{ area: 'dHR', orientation: 'h' }],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Compose a `grid-template` shorthand from a multi-row areas string, a matching
|
|
121
|
+
* row-size list, and the column list — e.g. `"a" "b" 3rem 1px / 1fr`.
|
|
122
|
+
*/
|
|
123
|
+
function gridShorthand(areas, rows, cols) {
|
|
124
|
+
const areaRows = areas.match(/"[^"]*"/g) ?? [];
|
|
125
|
+
const rowSizes = rows.split(/\s+/);
|
|
126
|
+
const withRowSizes = areaRows
|
|
127
|
+
.map((row, i) => `${row} ${rowSizes[i] ?? ''}`.trim())
|
|
128
|
+
.join(' ');
|
|
129
|
+
return `${withRowSizes} / ${cols}`;
|
|
130
|
+
}
|
|
131
|
+
/** Resolve the full layout (templates + breakpoint + areas) for a config. */
|
|
132
|
+
function buildCardEntryLayout({ inputs, hasIcon = false, allowTwoRow = true, }) {
|
|
133
|
+
const fieldAreas = inputs.map(name => FIELD_AREA[name]);
|
|
134
|
+
// A lone field fills the width and never reflows (matches the real form's
|
|
135
|
+
// single-input case — the fixed slot width and the icon are ignored).
|
|
136
|
+
if (inputs.length === 1) {
|
|
137
|
+
return {
|
|
138
|
+
inline: `"${fieldAreas[0]}" ${exports.CARD_ENTRY_ROW_HEIGHT} / 1fr`,
|
|
139
|
+
twoRow: null,
|
|
140
|
+
breakpointPx: null,
|
|
141
|
+
fieldAreas,
|
|
142
|
+
hasIconArea: false,
|
|
143
|
+
twoRowDividers: [],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const hasIconArea = hasIcon && has(inputs, 'card-number');
|
|
147
|
+
const inline = inlineTemplate({ inputs, hasIcon: hasIconArea });
|
|
148
|
+
const twoRow = allowTwoRow
|
|
149
|
+
? twoRowTemplate({ inputs, hasIcon: hasIconArea })
|
|
150
|
+
: null;
|
|
151
|
+
return {
|
|
152
|
+
inline,
|
|
153
|
+
twoRow: twoRow?.template ?? null,
|
|
154
|
+
breakpointPx: twoRow
|
|
155
|
+
? minRowWidthPx(inputs) + 2 * exports.CARD_ENTRY_BORDER_PX
|
|
156
|
+
: null,
|
|
157
|
+
fieldAreas,
|
|
158
|
+
hasIconArea,
|
|
159
|
+
twoRowDividers: twoRow?.dividers ?? [],
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Container-query CSS that switches `gridSelector` between the inline and
|
|
164
|
+
* two-row templates at the layout's breakpoint. The element matched by
|
|
165
|
+
* `gridSelector` must be a descendant of a `container-type: inline-size`
|
|
166
|
+
* ancestor named `containerName`.
|
|
167
|
+
*
|
|
168
|
+
* `extraBaseRules` are emitted before the `@container` block (e.g. the default
|
|
169
|
+
* hidden state of two-row-only dividers); `extraCompactRules` are emitted inside
|
|
170
|
+
* it (e.g. revealing those dividers / hiding wide-only chrome). Keeping the base
|
|
171
|
+
* state first ensures the compact rules win when the query matches.
|
|
172
|
+
*/
|
|
173
|
+
function buildCardEntryGridCss({ gridSelector, layout, containerName, extraBaseRules = '', extraCompactRules = '', }) {
|
|
174
|
+
const base = `${gridSelector} { display: grid; grid-template: ${layout.inline}; }
|
|
175
|
+
${extraBaseRules}`;
|
|
176
|
+
if (!layout.twoRow || layout.breakpointPx === null)
|
|
177
|
+
return base;
|
|
178
|
+
const container = containerName ? `${containerName} ` : '';
|
|
179
|
+
return `${base}
|
|
180
|
+
@container ${container}(width < ${layout.breakpointPx}px) {
|
|
181
|
+
${gridSelector} { grid-template: ${layout.twoRow}; }
|
|
182
|
+
${extraCompactRules}
|
|
183
|
+
}`;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=cardEntryLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardEntryLayout.js","sourceRoot":"","sources":["../../../../src/common/card-form/cardEntryLayout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;AAIH;;;GAGG;AACU,QAAA,qBAAqB,GAAuC;IACvE,aAAa,EAAE,GAAG;IAClB,UAAU,EAAE,EAAE;IACd,GAAG,EAAE,EAAE;CACR,CAAC;AAEF,2EAA2E;AAC9D,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAExC,mEAAmE;AACtD,QAAA,qBAAqB,GAAG,MAAM,CAAC;AAC/B,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAC3C,8EAA8E;AACjE,QAAA,qBAAqB,GAAG,CAAC,CAAC;AACvC;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,CAAC,CAAC;AACtC;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,CAAC,CAAC;AAEtC,uDAAuD;AACvD,MAAM,iBAAiB,GAAuC;IAC5D,aAAa,EAAE,KAAK;IACpB,UAAU,EAAE,MAAM;IAClB,GAAG,EAAE,MAAM;CACZ,CAAC;AAEF,uCAAuC;AACvC,MAAM,UAAU,GAAuC;IACrD,aAAa,EAAE,MAAM;IACrB,UAAU,EAAE,KAAK;IACjB,GAAG,EAAE,KAAK;CACX,CAAC;AAgCF,SAAS,GAAG,CAAC,MAA4B,EAAE,IAAwB;IACjE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,6EAA6E;AAC7E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raries all render the same skeleton while the
|
|
5
|
+
* card-form iframe loads. The grid templates and breakpoint come from the shared
|
|
6
|
+
* {@link buildCardEntryLayout} — the SAME source of truth the real form uses —
|
|
7
|
+
* so the skeleton reflows at exactly the width the loaded form does. Only the
|
|
8
|
+
* box styling and per-framework wiring live here.
|
|
9
|
+
*/
|
|
10
|
+
export type CardFormVariant = 'card-form' | 'card-number-form' | 'cvv-form';
|
|
11
|
+
export declare const INLINE_SKELETON_HEIGHT_PX: number;
|
|
12
|
+
/** Two-row layouts are a second field row plus the 1px divider taller. */
|
|
13
|
+
export declare const COMPACT_SKELETON_HEIGHT_PX: number;
|
|
14
|
+
export type SkeletonLayout = {
|
|
15
|
+
/** Single-row grid used at the iframe's default (wide) width. */
|
|
16
|
+
inline: string;
|
|
17
|
+
/** Two-row grid applied below `compactMaxWidthPx`; omitted when it never reflows. */
|
|
18
|
+
compact?: string;
|
|
19
|
+
/** Container width (px) below which the two-row grid applies. */
|
|
20
|
+
compactMaxWidthPx?: number;
|
|
21
|
+
/** grid-area names to render one skeleton box for, in DOM order (same in both layouts). */
|
|
22
|
+
areas: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare const SKELETON_LAYOUTS: Record<CardFormVariant, SkeletonLayout>;
|
|
25
|
+
/** Name of the shared pulse keyframes; referenced by the box `animation`. */
|
|
26
|
+
export declare const SKELETON_PULSE_ANIMATION_NAME = "coinflow-card-form-skeleton-pulse";
|
|
27
|
+
/**
|
|
28
|
+
* Duration (ms) of the skeleton's opacity fade-out. Matches the `opacity 300ms`
|
|
29
|
+
* transition each renderer applies. Renderers unmount the skeleton on
|
|
30
|
+
* `transitionend`, but that event can be skipped (reduced-motion, an ancestor
|
|
31
|
+
* `display:none`, or opacity already 0) — so they also use this as a fallback
|
|
32
|
+
* timeout to force the unmount and avoid a stuck (invisible) skeleton.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SKELETON_FADE_MS = 300;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the given container width would trigger the variant's two-row layout.
|
|
37
|
+
* Mirrors the real form's container query (`width < breakpoint`). Variants
|
|
38
|
+
* without a two-row layout never reflow.
|
|
39
|
+
*/
|
|
40
|
+
export declare function shouldStackSkeleton({ variant, width, }: {
|
|
41
|
+
variant: CardFormVariant;
|
|
42
|
+
width: number;
|
|
43
|
+
}): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Height to guess before the iframe reports its real height. The two-row layout
|
|
46
|
+
* is a field row plus divider taller than the inline one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function guessSkeletonHeightPx({ variant, width, }: {
|
|
49
|
+
variant: CardFormVariant;
|
|
50
|
+
width: number;
|
|
51
|
+
}): number;
|
|
52
|
+
/**
|
|
53
|
+
* The `grid-template` to apply for the given container width. Frameworks that
|
|
54
|
+
* drive the layout from JS (Vue, Angular) call this from their resize observer;
|
|
55
|
+
* React instead injects a CSS container query via {@link buildSkeletonCss}.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getSkeletonGridTemplate({ variant, width, }: {
|
|
58
|
+
variant: CardFormVariant;
|
|
59
|
+
width: number;
|
|
60
|
+
}): string;
|
|
61
|
+
/** Stable class name for a variant's skeleton grid element. */
|
|
62
|
+
export declare function getSkeletonGridClass(variant: CardFormVariant): string;
|
|
63
|
+
/**
|
|
64
|
+
* CSS (keyframes + grid + container-query breakpoint) for the container-query
|
|
65
|
+
* driven renderer used by React, where the skeleton root is a query container.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildSkeletonCss(variant: CardFormVariant): string;
|
|
68
|
+
/**
|
|
69
|
+
* Padding (px) to inset the skeleton grid by, applied on the skeleton root. It
|
|
70
|
+
* equals the form's own chrome — its `m-0.5` margin plus 1px border — so the
|
|
71
|
+
* boxes land in the same area the real fields will, and the grid fills the root
|
|
72
|
+
* exactly (no dead space that would make the boxes look too short).
|
|
73
|
+
*/
|
|
74
|
+
export declare const SKELETON_ROOT_PADDING_PX: number;
|
|
75
|
+
/**
|
|
76
|
+
* Inline style for each skeleton box, MINUS the `background` — the fill color is
|
|
77
|
+
* theme-dependent (see {@link getSkeletonColors}) so each renderer merges it in.
|
|
78
|
+
* A hairline margin keeps a subtle gap between boxes while letting them fill
|
|
79
|
+
* nearly the full field height (the root padding handles the outer inset). Uses
|
|
80
|
+
* string units so it renders identically in React, Vue, and Angular.
|
|
81
|
+
*/
|
|
82
|
+
export declare const SKELETON_BOX_STYLE: {
|
|
83
|
+
readonly minWidth: '0';
|
|
84
|
+
readonly margin: '1px';
|
|
85
|
+
readonly borderRadius: '4px';
|
|
86
|
+
readonly opacity: '1';
|
|
87
|
+
readonly animation: "coinflow-card-form-skeleton-pulse 1.5s ease-in-out infinite";
|
|
88
|
+
};
|
|
89
|
+
export type SkeletonColors = {
|
|
90
|
+
/** Faint backdrop behind the boxes. */
|
|
91
|
+
backdrop: string;
|
|
92
|
+
/** Box fill. */
|
|
93
|
+
box: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Best-effort skeleton palette. The skeleton renders in the SDK (parent), so it
|
|
97
|
+
* can't see the form's resolved colors — it only has the optional `theme` the
|
|
98
|
+
* integrator passed. When `theme.background` is a parseable color we tint the
|
|
99
|
+
* skeleton light-on-dark or dark-on-light to match; otherwise we fall back to a
|
|
100
|
+
* neutral mid-grey that stays visible on any surface.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getSkeletonColors(theme?: {
|
|
103
|
+
background?: string;
|
|
104
|
+
}): SkeletonColors;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic definitions for the V2 card-form skeleton loader.
|
|
4
|
+
*
|
|
5
|
+
* The React, Vue, and Angular libraries all render the same skeleton while the
|
|
6
|
+
* card-form iframe loads. The grid templates and breakpoint come from the shared
|
|
7
|
+
* {@link buildCardEntryLayout} — the SAME source of truth the real form uses —
|
|
8
|
+
* so the skeleton reflows at exactly the width the loaded form does. Only the
|
|
9
|
+
* box styling and per-framework wiring live here.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SKELETON_BOX_STYLE = exports.SKELETON_ROOT_PADDING_PX = exports.SKELETON_FADE_MS = exports.SKELETON_PULSE_ANIMATION_NAME = exports.SKELETON_LAYOUTS = exports.COMPACT_SKELETON_HEIGHT_PX = exports.INLINE_SKELETON_HEIGHT_PX = void 0;
|
|
13
|
+
exports.shouldStackSkeleton = shouldStackSkeleton;
|
|
14
|
+
exports.guessSkeletonHeightPx = guessSkeletonHeightPx;
|
|
15
|
+
exports.getSkeletonGridTemplate = getSkeletonGridTemplate;
|
|
16
|
+
exports.getSkeletonGridClass = getSkeletonGridClass;
|
|
17
|
+
exports.buildSkeletonCss = buildSkeletonCss;
|
|
18
|
+
exports.getSkeletonColors = getSkeletonColors;
|
|
19
|
+
const cardEntryLayout_1 = require("./cardEntryLayout");
|
|
20
|
+
/** Which fields each iframe variant mounts. */
|
|
21
|
+
const VARIANT_INPUTS = {
|
|
22
|
+
'card-form': ['card-number', 'expiration', 'cvv'],
|
|
23
|
+
'card-number-form': ['card-number', 'expiration'],
|
|
24
|
+
'cvv-form': ['cvv'],
|
|
25
|
+
};
|
|
26
|
+
// The iframe skeletons render without the optional card-brand icon.
|
|
27
|
+
const CARD_ENTRY_LAYOUTS = {
|
|
28
|
+
'card-form': (0, cardEntryLayout_1.buildCardEntryLayout)({ inputs: VARIANT_INPUTS['card-form'] }),
|
|
29
|
+
'card-number-form': (0, cardEntryLayout_1.buildCardEntryLayout)({
|
|
30
|
+
inputs: VARIANT_INPUTS['card-number-form'],
|
|
31
|
+
}),
|
|
32
|
+
'cvv-form': (0, cardEntryLayout_1.buildCardEntryLayout)({ inputs: VARIANT_INPUTS['cvv-form'] }),
|
|
33
|
+
};
|
|
34
|
+
// Iframe height (px) to guess before it reports its real height. Matches the
|
|
35
|
+
// form's rendered height so the skeleton→form swap doesn't jump: field row(s) +
|
|
36
|
+
// the 1px border and the box's `m-0.5` margin on top and bottom.
|
|
37
|
+
const CARD_ENTRY_VERTICAL_CHROME_PX = 2 * cardEntryLayout_1.CARD_ENTRY_BORDER_PX + 2 * cardEntryLayout_1.CARD_ENTRY_MARGIN_PX;
|
|
38
|
+
exports.INLINE_SKELETON_HEIGHT_PX = cardEntryLayout_1.CARD_ENTRY_ROW_HEIGHT_PX + CARD_ENTRY_VERTICAL_CHROME_PX;
|
|
39
|
+
/** Two-row layouts are a second field row plus the 1px divider taller. */
|
|
40
|
+
exports.COMPACT_SKELETON_HEIGHT_PX = 2 * cardEntryLayout_1.CARD_ENTRY_ROW_HEIGHT_PX +
|
|
41
|
+
cardEntryLayout_1.CARD_ENTRY_DIVIDER_PX +
|
|
42
|
+
CARD_ENTRY_VERTICAL_CHROME_PX;
|
|
43
|
+
function toSkeletonLayout(layout) {
|
|
44
|
+
return {
|
|
45
|
+
inline: layout.inline,
|
|
46
|
+
compact: layout.twoRow ?? undefined,
|
|
47
|
+
compactMaxWidthPx: layout.breakpointPx ?? undefined,
|
|
48
|
+
areas: layout.fieldAreas,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.SKELETON_LAYOUTS = {
|
|
52
|
+
'card-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['card-form']),
|
|
53
|
+
'card-number-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['card-number-form']),
|
|
54
|
+
'cvv-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['cvv-form']),
|
|
55
|
+
};
|
|
56
|
+
/** Name of the shared pulse keyframes; referenced by the box `animation`. */
|
|
57
|
+
exports.SKELETON_PULSE_ANIMATION_NAME = 'coinflow-card-form-skeleton-pulse';
|
|
58
|
+
/**
|
|
59
|
+
* Duration (ms) of the skeleton's opacity fade-out. Matches the `opacity 300ms`
|
|
60
|
+
* transition each renderer applies. Renderers unmount the skeleton on
|
|
61
|
+
* `transitionend`, but that event can be skipped (reduced-motion, an ancestor
|
|
62
|
+
* `display:none`, or opacity already 0) — so they also use this as a fallback
|
|
63
|
+
* timeout to force the unmount and avoid a stuck (invisible) skeleton.
|
|
64
|
+
*/
|
|
65
|
+
exports.SKELETON_FADE_MS = 300;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the given container width would trigger the variant's two-row layout.
|
|
68
|
+
* Mirrors the real form's container query (`width < breakpoint`). Variants
|
|
69
|
+
* without a two-row layout never reflow.
|
|
70
|
+
*/
|
|
71
|
+
function shouldStackSkeleton({ variant, width, }) {
|
|
72
|
+
const { compact, compactMaxWidthPx } = exports.SKELETON_LAYOUTS[variant];
|
|
73
|
+
return (compact !== undefined &&
|
|
74
|
+
compactMaxWidthPx !== undefined &&
|
|
75
|
+
width > 0 &&
|
|
76
|
+
width < compactMaxWidthPx);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Height to guess before the iframe reports its real height. The two-row layout
|
|
80
|
+
* is a field row plus divider taller than the inline one.
|
|
81
|
+
*/
|
|
82
|
+
function guessSkeletonHeightPx({ variant, width, }) {
|
|
83
|
+
return shouldStackSkeleton({ variant, width })
|
|
84
|
+
? exports.COMPACT_SKELETON_HEIGHT_PX
|
|
85
|
+
: exports.INLINE_SKELETON_HEIGHT_PX;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The `grid-template` to apply for the given container width. Frameworks that
|
|
89
|
+
* drive the layout from JS (Vue, Angular) call this from their resize observer;
|
|
90
|
+
* React instead injects a CSS container query via {@link buildSkeletonCss}.
|
|
91
|
+
*/
|
|
92
|
+
function getSkeletonGridTemplate({ variant, width, }) {
|
|
93
|
+
const { inline, compact } = exports.SKELETON_LAYOUTS[variant];
|
|
94
|
+
if (compact && shouldStackSkeleton({ variant, width }))
|
|
95
|
+
return compact;
|
|
96
|
+
return inline;
|
|
97
|
+
}
|
|
98
|
+
/** Stable class name for a variant's skeleton grid element. */
|
|
99
|
+
function getSkeletonGridClass(variant) {
|
|
100
|
+
return `coinflow-card-form-skeleton-grid--${variant}`;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* CSS (keyframes + grid + container-query breakpoint) for the container-query
|
|
104
|
+
* driven renderer used by React, where the skeleton root is a query container.
|
|
105
|
+
*/
|
|
106
|
+
function buildSkeletonCss(variant) {
|
|
107
|
+
const gridClass = getSkeletonGridClass(variant);
|
|
108
|
+
const grid = (0, cardEntryLayout_1.buildCardEntryGridCss)({
|
|
109
|
+
gridSelector: `.${gridClass}`,
|
|
110
|
+
layout: CARD_ENTRY_LAYOUTS[variant],
|
|
111
|
+
extraBaseRules: `.${gridClass} { gap: 0; flex: 1; }`,
|
|
112
|
+
});
|
|
113
|
+
return `@keyframes ${exports.SKELETON_PULSE_ANIMATION_NAME} {0%,100%{opacity:1}50%{opacity:0.4}}
|
|
114
|
+
${grid}`;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Padding (px) to inset the skeleton grid by, applied on the skeleton root. It
|
|
118
|
+
* equals the form's own chrome — its `m-0.5` margin plus 1px border — so the
|
|
119
|
+
* boxes land in the same area the real fields will, and the grid fills the root
|
|
120
|
+
* exactly (no dead space that would make the boxes look too short).
|
|
121
|
+
*/
|
|
122
|
+
exports.SKELETON_ROOT_PADDING_PX = cardEntryLayout_1.CARD_ENTRY_MARGIN_PX + cardEntryLayout_1.CARD_ENTRY_BORDER_PX;
|
|
123
|
+
/**
|
|
124
|
+
* Inline style for each skeleton box, MINUS the `background` — the fill color is
|
|
125
|
+
* theme-dependent (see {@link getSkeletonColors}) so each renderer merges it in.
|
|
126
|
+
* A hairline margin keeps a subtle gap between boxes while letting them fill
|
|
127
|
+
* nearly the full field height (the root padding handles the outer inset). Uses
|
|
128
|
+
* string units so it renders identically in React, Vue, and Angular.
|
|
129
|
+
*/
|
|
130
|
+
exports.SKELETON_BOX_STYLE = {
|
|
131
|
+
minWidth: '0',
|
|
132
|
+
margin: '1px',
|
|
133
|
+
borderRadius: '4px',
|
|
134
|
+
opacity: '1',
|
|
135
|
+
animation: `${exports.SKELETON_PULSE_ANIMATION_NAME} 1.5s ease-in-out infinite`,
|
|
136
|
+
};
|
|
137
|
+
// Dark surface → light skeleton; light surface → dark skeleton (the original
|
|
138
|
+
// look); unknown → a neutral mid-grey that reads on either.
|
|
139
|
+
const DARK_SURFACE_COLORS = {
|
|
140
|
+
backdrop: 'rgba(255, 255, 255, 0.05)',
|
|
141
|
+
box: 'rgba(255, 255, 255, 0.30)',
|
|
142
|
+
};
|
|
143
|
+
const LIGHT_SURFACE_COLORS = {
|
|
144
|
+
backdrop: 'rgba(0, 0, 0, 0.04)',
|
|
145
|
+
box: 'rgba(0, 0, 0, 0.30)',
|
|
146
|
+
};
|
|
147
|
+
const NEUTRAL_COLORS = {
|
|
148
|
+
backdrop: 'rgba(128, 128, 128, 0.08)',
|
|
149
|
+
box: 'rgba(128, 128, 128, 0.38)',
|
|
150
|
+
};
|
|
151
|
+
/** Parse a hex (#rgb/#rrggbb/#rrggbbaa) or rgb()/rgba() string to [r,g,b]. */
|
|
152
|
+
function parseRgb(color) {
|
|
153
|
+
const c = color.trim().toLowerCase();
|
|
154
|
+
let hex = c.startsWith('#') ? c.slice(1) : '';
|
|
155
|
+
if (hex && /^[0-9a-f]+$/.test(hex)) {
|
|
156
|
+
if (hex.length === 3)
|
|
157
|
+
hex = hex
|
|
158
|
+
.split('')
|
|
159
|
+
.map(x => x + x)
|
|
160
|
+
.join('');
|
|
161
|
+
if (hex.length === 8)
|
|
162
|
+
hex = hex.slice(0, 6);
|
|
163
|
+
if (hex.length === 6)
|
|
164
|
+
return [
|
|
165
|
+
parseInt(hex.slice(0, 2), 16),
|
|
166
|
+
parseInt(hex.slice(2, 4), 16),
|
|
167
|
+
parseInt(hex.slice(4, 6), 16),
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
const m = c.match(/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/);
|
|
171
|
+
if (m)
|
|
172
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Best-effort skeleton palette. The skeleton renders in the SDK (parent), so it
|
|
177
|
+
* can't see the form's resolved colors — it only has the optional `theme` the
|
|
178
|
+
* integrator passed. When `theme.background` is a parseable color we tint the
|
|
179
|
+
* skeleton light-on-dark or dark-on-light to match; otherwise we fall back to a
|
|
180
|
+
* neutral mid-grey that stays visible on any surface.
|
|
181
|
+
*/
|
|
182
|
+
function getSkeletonColors(theme) {
|
|
183
|
+
const rgb = theme?.background ? parseRgb(theme.background) : null;
|
|
184
|
+
if (!rgb)
|
|
185
|
+
return NEUTRAL_COLORS;
|
|
186
|
+
const [r, g, b] = rgb;
|
|
187
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
188
|
+
return luminance < 0.5 ? DARK_SURFACE_COLORS : LIGHT_SURFACE_COLORS;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=cardFormSkeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardFormSkeleton.js","sourceRoot":"","sources":["../../../../src/common/card-form/cardFormSkeleton.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;AAEH,uDAS2B;AAI3B,+CAA+C;AAC/C,MAAM,cAAc,GAAkD;IACpE,WAAW,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC;IACjD,kBAAkB,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC;IACjD,UAAU,EAAE,CAAC,KAAK,CAAC;CACpB,CAAC;AAEF,oEAAoE;AACpE,MAAM,kBAAkB,GAA6C;IACnE,WAAW,EAAE,IAAA,sCAAoB,EAAC,EAAC,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,EAAC,CAAC;IACxE,kBAAkB,EAAE,IAAA,sCAAoB,EAAC;QACvC,MAAM,EAAE,cAAc,CAAC,kBAAkB,CAAC;KAC3C,CAAC;IACF,UAAU,EAAE,IAAA,sC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B,CAAC;IACN,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,IAAI,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,2BAAkC,KAEjC;IACC,MAAM,GAAG,GAAG,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,IAAI,CAAC,GAAG;QAAE,OAAO,cAAc,CAAC;IAChC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;IACtB,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC5D,OAAO,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oBAAoB,CAAC;AACtE,CAAC"}
|
|
@@ -4,11 +4,17 @@ export * from './CoinflowLibMessageHandlers';
|
|
|
4
4
|
export * from './EventBus';
|
|
5
5
|
export * from './card-form/TokenEx';
|
|
6
6
|
export * from './card-form/tokenexHelpers';
|
|
7
|
+
export * from './card-form/cardEntryLayout';
|
|
8
|
+
export * from './card-form/cardFormSkeleton';
|
|
7
9
|
export * from './types/Subtotal';
|
|
8
10
|
export * from './types/AnyObject';
|
|
9
11
|
export * from './types/giftCardCartItem';
|
|
10
12
|
export * from './types/nftCartItem';
|
|
11
13
|
export * from './types/cryptoCartItem';
|
|
14
|
+
export * from './types/travelCartItem';
|
|
15
|
+
export * from './types/flightTicketCartItem';
|
|
16
|
+
export * from './types/flightUpgradeCartItem';
|
|
17
|
+
export * from './types/lodgingCartItem';
|
|
12
18
|
export * from './CoinflowPurchaseProtectionHeaders';
|
|
13
19
|
export * from './CoinflowProtectionInit';
|
|
14
20
|
export { default as getForterToken, captureForterToken, awaitForterToken, } from './Forter';
|
|
@@ -8,11 +8,17 @@ tslib_1.__exportStar(require("./CoinflowLibMessageHandlers"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./EventBus"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./card-form/TokenEx"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./card-form/tokenexHelpers"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./card-form/cardEntryLayout"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./card-form/cardFormSkeleton"), exports);
|
|
11
13
|
tslib_1.__exportStar(require("./types/Subtotal"), exports);
|
|
12
14
|
tslib_1.__exportStar(require("./types/AnyObject"), exports);
|
|
13
15
|
tslib_1.__exportStar(require("./types/giftCardCartItem"), exports);
|
|
14
16
|
tslib_1.__exportStar(require("./types/nftCartItem"), exports);
|
|
15
17
|
tslib_1.__exportStar(require("./types/cryptoCartItem"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./types/travelCartItem"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./types/flightTicketCartItem"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./types/flightUpgradeCartItem"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./types/lodgingCartItem"), exports);
|
|
16
22
|
tslib_1.__exportStar(require("./CoinflowPurchaseProtectionHeaders"), exports);
|
|
17
23
|
tslib_1.__exportStar(require("./CoinflowProtectionInit"), exports);
|
|
18
24
|
var Forter_1 = require("./Forter");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":";;;;AAAA,0DAAgC;AAChC,0DAAgC;AAChC,uEAA6C;AAC7C,qDAA2B;AAC3B,8DAAoC;AACpC,qEAA2C;AAC3C,2DAAiC;AACjC,4DAAkC;AAClC,mEAAyC;AACzC,8DAAoC;AACpC,iEAAuC;AACvC,8EAAoD;AACpD,mEAAyC;AACzC,mCAIkB;AAHhB,iIAAA,OAAO,OAAkB;AACzB,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":";;;;AAAA,0DAAgC;AAChC,0DAAgC;AAChC,uEAA6C;AAC7C,qDAA2B;AAC3B,8DAAoC;AACpC,qEAA2C;AAC3C,sEAA4C;AAC5C,uEAA6C;AAC7C,2DAAiC;AACjC,4DAAkC;AAClC,mEAAyC;AACzC,8DAAoC;AACpC,iEAAuC;AACvC,iEAAuC;AACvC,uEAA6C;AAC7C,wEAA8C;AAC9C,kEAAwC;AACxC,8EAAoD;AACpD,mEAAyC;AACzC,mCAIkB;AAHhB,iIAAA,OAAO,OAAkB;AACzB,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CurrencyAmount, RecipientInfo } from './CartitemCommon';
|
|
2
|
+
import { AnyObject } from './AnyObject';
|
|
3
|
+
import { TravelFirstFlight, TravelTrip } from './travelCartItem';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a flight ticket item in a shopping cart
|
|
6
|
+
*/
|
|
7
|
+
export interface FlightTicketCartItem {
|
|
8
|
+
/**
|
|
9
|
+
* Denotes the cart item class. The item schema is chosen based on this value.
|
|
10
|
+
* Allowed value: flightTicket
|
|
11
|
+
* Example: flightTicket
|
|
12
|
+
*/
|
|
13
|
+
itemClass: 'flightTicket';
|
|
14
|
+
/**
|
|
15
|
+
* The cart items's unique ID
|
|
16
|
+
* Example: 5de33332-546a-4171-8988-2a43d2bfe9c6
|
|
17
|
+
*/
|
|
18
|
+
id?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Any additional product data which can be provided, e.g. description, link to image, etc
|
|
21
|
+
* Example: {"any":"data","description":"This is the product description"}
|
|
22
|
+
*/
|
|
23
|
+
rawProductData?: AnyObject;
|
|
24
|
+
/**
|
|
25
|
+
* The item's selling price
|
|
26
|
+
*/
|
|
27
|
+
sellingPrice: CurrencyAmount;
|
|
28
|
+
/**
|
|
29
|
+
* The item's list price
|
|
30
|
+
*/
|
|
31
|
+
listPrice?: CurrencyAmount;
|
|
32
|
+
/**
|
|
33
|
+
* The user's personal info
|
|
34
|
+
*/
|
|
35
|
+
recipientInfo?: RecipientInfo;
|
|
36
|
+
/**
|
|
37
|
+
* The flight ticket's PNR code
|
|
38
|
+
* Example: X36Q9C
|
|
39
|
+
*/
|
|
40
|
+
pnr: string;
|
|
41
|
+
/**
|
|
42
|
+
* The trip details of the flight ticket
|
|
43
|
+
*/
|
|
44
|
+
trip: TravelTrip;
|
|
45
|
+
/**
|
|
46
|
+
* The first flight details of the trip
|
|
47
|
+
*/
|
|
48
|
+
firstFlight: TravelFirstFlight;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flightTicketCartItem.js","sourceRoot":"","sources":["../../../../src/common/types/flightTicketCartItem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CurrencyAmount, RecipientInfo } from './CartitemCommon';
|
|
2
|
+
import { AnyObject } from './AnyObject';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a flight upgrade item in a shopping cart
|
|
5
|
+
*/
|
|
6
|
+
export interface FlightUpgradeCartItem {
|
|
7
|
+
/**
|
|
8
|
+
* Denotes the cart item class. The item schema is chosen based on this value.
|
|
9
|
+
* Allowed value: flightUpgrade
|
|
10
|
+
* Example: flightUpgrade
|
|
11
|
+
*/
|
|
12
|
+
itemClass: 'flightUpgrade';
|
|
13
|
+
/**
|
|
14
|
+
* The cart items's unique ID
|
|
15
|
+
* Example: 5de33332-546a-4171-8988-2a43d2bfe9c6
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Any additional product data which can be provided, e.g. description, link to image, etc
|
|
20
|
+
* Example: {"any":"data","description":"This is the product description"}
|
|
21
|
+
*/
|
|
22
|
+
rawProductData?: AnyObject;
|
|
23
|
+
/**
|
|
24
|
+
* The item's selling price
|
|
25
|
+
*/
|
|
26
|
+
sellingPrice: CurrencyAmount;
|
|
27
|
+
/**
|
|
28
|
+
* The item's list price
|
|
29
|
+
*/
|
|
30
|
+
listPrice?: CurrencyAmount;
|
|
31
|
+
/**
|
|
32
|
+
* The user's personal info
|
|
33
|
+
*/
|
|
34
|
+
recipientInfo?: RecipientInfo;
|
|
35
|
+
/**
|
|
36
|
+
* The flight ticket's PNR code
|
|
37
|
+
* Example: X36Q9C
|
|
38
|
+
*/
|
|
39
|
+
pnr?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The type of upgrade
|
|
42
|
+
* Example: changes
|
|
43
|
+
*/
|
|
44
|
+
upgradeType: 'changes' | 'fareIncrease' | 'baggage' | 'seats' | 'insurance' | 'other';
|
|
45
|
+
/**
|
|
46
|
+
* The upgrade description, required when the upgrade type is `other`
|
|
47
|
+
*/
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flightUpgradeCartItem.js","sourceRoot":"","sources":["../../../../src/common/types/flightUpgradeCartItem.ts"],"names":[],"mappings":""}
|