@admin-layout/gluestack-ui-mobile 12.2.5-alpha.22 → 12.2.5-alpha.30
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/CHANGELOG.md +10 -0
- package/lib/components/FlightCards/FlightCards.d.ts +9 -4
- package/lib/components/FlightCards/FlightCards.js +11 -7
- package/lib/components/FlightCards/FlightCards.js.map +1 -1
- package/lib/components/FlightCards/index.d.ts +2 -0
- package/lib/components/FlightCards/index.js +5 -0
- package/lib/components/FlightCards/index.js.map +1 -1
- package/lib/components/__tests__/FlightCards.test.d.ts +1 -0
- package/lib/components/__tests__/FlightCards.test.js +67 -0
- package/lib/components/__tests__/FlightCards.test.js.map +1 -0
- package/package.json +3 -3
- package/src/components/FlightCards/FlightCards.tsx +22 -9
- package/src/components/FlightCards/index.ts +11 -0
- package/src/components/__tests__/FlightCards.test.tsx +71 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [12.2.5-alpha.30](https://github.com/CDEBase/admin-layout/compare/v12.2.5-alpha.29...v12.2.5-alpha.30) (2026-11-03)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **flight-cards:** the mobile entry exports the flight model the chat checks ([95ded37](https://github.com/CDEBase/admin-layout/commit/95ded37c6df6c7bb44a2c18f8b2fc99f4fdd1d5e)), closes [#1702](https://github.com/CDEBase/admin-layout/issues/1702)
|
|
11
|
+
|
|
12
|
+
## [12.2.5-alpha.27](https://github.com/CDEBase/admin-layout/compare/v12.2.5-alpha.26...v12.2.5-alpha.27) (2026-10-24)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @admin-layout/gluestack-ui-mobile
|
|
15
|
+
|
|
6
16
|
## [12.2.5-alpha.22](https://github.com/CDEBase/admin-layout/compare/v12.2.5-alpha.21...v12.2.5-alpha.22) (2026-10-20)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @admin-layout/gluestack-ui-mobile
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { FlightCardView, FlightOfferSetLike } from '@admin-layout/client';
|
|
2
|
+
import type { FlightCardView, FlightOfferSetLike } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
3
3
|
/**
|
|
4
4
|
* Flight results for a mobile chat: the native twin of ai-chat-ext's web
|
|
5
5
|
* MessageFlights. Both render from @admin-layout/client's flight model, so a
|
|
@@ -25,7 +25,12 @@ export interface FlightCardRowProps {
|
|
|
25
25
|
onOpenOffer?: (url: string) => void;
|
|
26
26
|
/** Open the full result set. Also used by a card that has no seller link. */
|
|
27
27
|
onViewAll?: () => void;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Light or dark palette. Defaults to the system scheme; pass the app's own
|
|
30
|
+
* when it themes independently of the system setting.
|
|
31
|
+
*/
|
|
32
|
+
scheme?: 'light' | 'dark';
|
|
33
|
+
/** Override individual palette colors. */
|
|
29
34
|
colors?: Partial<FlightCardColors>;
|
|
30
35
|
}
|
|
31
36
|
export declare const FlightCard: React.NamedExoticComponent<{
|
|
@@ -35,6 +40,6 @@ export declare const FlightCard: React.NamedExoticComponent<{
|
|
|
35
40
|
onPress?: () => void;
|
|
36
41
|
}>;
|
|
37
42
|
/** A swipeable row of flight cards; the next card peeks in so the row reads as scrollable. */
|
|
38
|
-
export declare function FlightCardRow({ attachment, onOpenOffer, onViewAll, colors }: FlightCardRowProps): React.JSX.Element;
|
|
43
|
+
export declare function FlightCardRow({ attachment, onOpenOffer, onViewAll, scheme, colors }: FlightCardRowProps): React.JSX.Element;
|
|
39
44
|
/** Every flight as a full-width vertical list, for a results screen or sheet. */
|
|
40
|
-
export declare function FlightCardList({ attachment, onOpenOffer, onViewAll, colors }: FlightCardRowProps): React.JSX.Element;
|
|
45
|
+
export declare function FlightCardList({ attachment, onOpenOffer, onViewAll, scheme, colors }: FlightCardRowProps): React.JSX.Element;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { Pressable, ScrollView, StyleSheet, Text, View, useColorScheme, useWindowDimensions } from 'react-native';
|
|
3
3
|
import Svg, { Line, Path } from 'react-native-svg';
|
|
4
|
-
|
|
4
|
+
// The model file itself, not the client barrel: chat surfaces ship as Module
|
|
5
|
+
// Federation remotes, and the barrel (redux, graphql, settings) would be
|
|
6
|
+
// bundled into each of them as a private copy. This module has no imports.
|
|
7
|
+
import { toFlightCards } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
5
8
|
const LIGHT = {
|
|
6
9
|
card: '#ffffff',
|
|
7
10
|
border: '#e5e7eb',
|
|
@@ -67,13 +70,14 @@ export const FlightCard = memo(function FlightCard({ card, width, colors: c, onP
|
|
|
67
70
|
}
|
|
68
71
|
return (React.createElement(Pressable, { onPress: onPress, accessibilityRole: card.url ? 'link' : 'button', accessibilityLabel: card.accessibleLabel, style: ({ pressed }) => [...frame, pressed && styles.pressed], testID: "flight-card" }, body));
|
|
69
72
|
});
|
|
70
|
-
const usePalette = (overrides) => {
|
|
71
|
-
const
|
|
73
|
+
const usePalette = (scheme, overrides) => {
|
|
74
|
+
const system = useColorScheme();
|
|
75
|
+
const dark = (scheme ?? system) === 'dark';
|
|
72
76
|
return { ...(dark ? DARK : LIGHT), ...overrides };
|
|
73
77
|
};
|
|
74
78
|
/** A swipeable row of flight cards; the next card peeks in so the row reads as scrollable. */
|
|
75
|
-
export function FlightCardRow({ attachment, onOpenOffer, onViewAll, colors }) {
|
|
76
|
-
const c = usePalette(colors);
|
|
79
|
+
export function FlightCardRow({ attachment, onOpenOffer, onViewAll, scheme, colors }) {
|
|
80
|
+
const c = usePalette(scheme, colors);
|
|
77
81
|
const { width: screen } = useWindowDimensions();
|
|
78
82
|
const cards = toFlightCards(attachment);
|
|
79
83
|
if (cards.length === 0)
|
|
@@ -91,8 +95,8 @@ export function FlightCardRow({ attachment, onOpenOffer, onViewAll, colors }) {
|
|
|
91
95
|
" \u203A"))) : null));
|
|
92
96
|
}
|
|
93
97
|
/** Every flight as a full-width vertical list, for a results screen or sheet. */
|
|
94
|
-
export function FlightCardList({ attachment, onOpenOffer, onViewAll, colors }) {
|
|
95
|
-
const c = usePalette(colors);
|
|
98
|
+
export function FlightCardList({ attachment, onOpenOffer, onViewAll, scheme, colors }) {
|
|
99
|
+
const c = usePalette(scheme, colors);
|
|
96
100
|
const cards = toFlightCards(attachment);
|
|
97
101
|
if (cards.length === 0)
|
|
98
102
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlightCards.js","sourceRoot":"","sources":["../../../src/components/FlightCards/FlightCards.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClH,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FlightCards.js","sourceRoot":"","sources":["../../../src/components/FlightCards/FlightCards.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClH,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,6EAA6E;AAC7E,yEAAyE;AACzE,2EAA2E;AAC3E,O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E;CACnD,CAAC,CAAC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { FlightCard, FlightCardRow, FlightCardList } from './FlightCards';
|
|
2
2
|
export type { FlightCardRowProps, FlightCardColors } from './FlightCards';
|
|
3
|
+
export { isFlightAttachment, toFlightCards } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
4
|
+
export type { FlightOfferSetLike, FlightOfferLike, TravelFlightDetails, TravelFlightSlice, } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { FlightCard, FlightCardRow, FlightCardList } from './FlightCards';
|
|
2
|
+
// The model the cards render from, so a mobile host needs only this entry.
|
|
3
|
+
// Import this file directly (lib/components/FlightCards/index.js) from a chat
|
|
4
|
+
// that ships in a surface remote: it reaches only react-native, react-native-svg
|
|
5
|
+
// and the dependency-free model, not this package's root (layout, redux).
|
|
6
|
+
export { isFlightAttachment, toFlightCards } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
2
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FlightCards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FlightCards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1E,2EAA2E;AAC3E,8EAA8E;AAC9E,iFAAiF;AACjF,0EAA0E;AAC1E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flight-cards entry is what a mobile chat imports (lib/components/FlightCards/index.js),
|
|
3
|
+
* so it must carry the model the chat checks before drawing a card. Live 2026-11-03: the app
|
|
4
|
+
* imported isFlightAttachment from this entry, the entry did not export it, and every chat
|
|
5
|
+
* holding flight results opened to "undefined is not a function".
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { StyleSheet } from 'react-native';
|
|
9
|
+
import { render } from '@testing-library/react-native';
|
|
10
|
+
import * as entry from '../FlightCards';
|
|
11
|
+
jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({
|
|
12
|
+
__esModule: true,
|
|
13
|
+
default: () => 'light',
|
|
14
|
+
}));
|
|
15
|
+
jest.mock('react-native-svg', () => {
|
|
16
|
+
const { View } = jest.requireActual('react-native');
|
|
17
|
+
return { __esModule: true, default: View, Line: View, Path: View };
|
|
18
|
+
});
|
|
19
|
+
const flights = {
|
|
20
|
+
title: 'Flights ATL to JFK',
|
|
21
|
+
currency: 'USD',
|
|
22
|
+
properties: [
|
|
23
|
+
{
|
|
24
|
+
id: 'f1',
|
|
25
|
+
title: 'Delta',
|
|
26
|
+
price: 199,
|
|
27
|
+
url: 'https://example.com/offer/f1',
|
|
28
|
+
flight: {
|
|
29
|
+
airline: 'Delta',
|
|
30
|
+
seller: 'Example Travel',
|
|
31
|
+
slices: [
|
|
32
|
+
{
|
|
33
|
+
origin: 'ATL',
|
|
34
|
+
destination: 'JFK',
|
|
35
|
+
departAt: '2026-12-04T08:15',
|
|
36
|
+
arriveAt: '2026-12-04T10:25',
|
|
37
|
+
stops: 0,
|
|
38
|
+
durationMinutes: 130,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
const stays = { properties: [{ id: 's1', title: 'Hotel', price: 120 }] };
|
|
46
|
+
describe('flight cards entry', () => {
|
|
47
|
+
it('exports the model a chat checks before it draws a card', () => {
|
|
48
|
+
expect(typeof entry.isFlightAttachment).toBe('function');
|
|
49
|
+
expect(typeof entry.toFlightCards).toBe('function');
|
|
50
|
+
expect(entry.isFlightAttachment(flights)).toBe(true);
|
|
51
|
+
expect(entry.isFlightAttachment(stays)).toBe(false);
|
|
52
|
+
expect(entry.toFlightCards(flights)).toHaveLength(1);
|
|
53
|
+
});
|
|
54
|
+
it("draws the app's scheme, not the system's, when one is passed", () => {
|
|
55
|
+
const background = (scheme) => {
|
|
56
|
+
const { getByTestId, unmount } = render(React.createElement(entry.FlightCardRow, { attachment: flights, scheme: scheme }));
|
|
57
|
+
const style = StyleSheet.flatten(getByTestId('flight-card').props.style);
|
|
58
|
+
unmount();
|
|
59
|
+
return style.backgroundColor;
|
|
60
|
+
};
|
|
61
|
+
// The system says light (mocked above).
|
|
62
|
+
expect(background()).toBe('#ffffff');
|
|
63
|
+
expect(background('dark')).toBe('#1f2937');
|
|
64
|
+
expect(background('light')).toBe('#ffffff');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=FlightCards.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlightCards.test.js","sourceRoot":"","sources":["../../../src/components/__tests__/FlightCards.test.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,IAAI,CAAC,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE,CAAC,CAAC;IAChE,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;CACzB,CAAC,CAAC,CAAC;AACJ,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,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KAAK,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACpE,MAAM,UAAU,GAAG,CAAC,MAAyB,EAAE,EAAE;YAC7C,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,oBAAC,KAAK,CAAC,aAAa,IAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC;YACtG,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACzE,OAAO,EAAE,CAAC;YACV,OAAO,KAAK,CAAC,eAAe,CAAC;QACjC,CAAC,CAAC;QACF,wCAAwC;QACxC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/gluestack-ui-mobile",
|
|
3
|
-
"version": "12.2.5-alpha.
|
|
3
|
+
"version": "12.2.5-alpha.30",
|
|
4
4
|
"description": "Glustack-ui for mobile component layout",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"watch": "npm run build:lib:watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@admin-layout/client": "12.2.5-alpha.
|
|
26
|
+
"@admin-layout/client": "12.2.5-alpha.27",
|
|
27
27
|
"@gluestack-style/react": "^1.0.53",
|
|
28
28
|
"@gluestack-ui/config": "^1.1.18",
|
|
29
29
|
"@gluestack-ui/nativewind-utils": "^1.0.26",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"typescript": {
|
|
51
51
|
"definition": "lib/index.d.ts"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "98332dd507a6ef995a0a7f64cf492b160b9cd0f9"
|
|
54
54
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { Pressable, ScrollView, StyleSheet, Text, View, useColorScheme, useWindowDimensions } from 'react-native';
|
|
3
3
|
import Svg, { Line, Path } from 'react-native-svg';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// The model file itself, not the client barrel: chat surfaces ship as Module
|
|
5
|
+
// Federation remotes, and the barrel (redux, graphql, settings) would be
|
|
6
|
+
// bundled into each of them as a private copy. This module has no imports.
|
|
7
|
+
import { toFlightCards } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
8
|
+
import type {
|
|
9
|
+
FlightCardView,
|
|
10
|
+
FlightOfferSetLike,
|
|
11
|
+
FlightSliceView,
|
|
12
|
+
} from '@admin-layout/client/lib/utils/flightCards.js';
|
|
6
13
|
|
|
7
14
|
/**
|
|
8
15
|
* Flight results for a mobile chat: the native twin of ai-chat-ext's web
|
|
@@ -52,7 +59,12 @@ export interface FlightCardRowProps {
|
|
|
52
59
|
onOpenOffer?: (url: string) => void;
|
|
53
60
|
/** Open the full result set. Also used by a card that has no seller link. */
|
|
54
61
|
onViewAll?: () => void;
|
|
55
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Light or dark palette. Defaults to the system scheme; pass the app's own
|
|
64
|
+
* when it themes independently of the system setting.
|
|
65
|
+
*/
|
|
66
|
+
scheme?: 'light' | 'dark';
|
|
67
|
+
/** Override individual palette colors. */
|
|
56
68
|
colors?: Partial<FlightCardColors>;
|
|
57
69
|
}
|
|
58
70
|
|
|
@@ -172,14 +184,15 @@ export const FlightCard = memo(function FlightCard({
|
|
|
172
184
|
);
|
|
173
185
|
});
|
|
174
186
|
|
|
175
|
-
const usePalette = (overrides?: Partial<FlightCardColors>): FlightCardColors => {
|
|
176
|
-
const
|
|
187
|
+
const usePalette = (scheme?: 'light' | 'dark', overrides?: Partial<FlightCardColors>): FlightCardColors => {
|
|
188
|
+
const system = useColorScheme();
|
|
189
|
+
const dark = (scheme ?? system) === 'dark';
|
|
177
190
|
return { ...(dark ? DARK : LIGHT), ...overrides };
|
|
178
191
|
};
|
|
179
192
|
|
|
180
193
|
/** A swipeable row of flight cards; the next card peeks in so the row reads as scrollable. */
|
|
181
|
-
export function FlightCardRow({ attachment, onOpenOffer, onViewAll, colors }: FlightCardRowProps) {
|
|
182
|
-
const c = usePalette(colors);
|
|
194
|
+
export function FlightCardRow({ attachment, onOpenOffer, onViewAll, scheme, colors }: FlightCardRowProps) {
|
|
195
|
+
const c = usePalette(scheme, colors);
|
|
183
196
|
const { width: screen } = useWindowDimensions();
|
|
184
197
|
const cards = toFlightCards(attachment);
|
|
185
198
|
if (cards.length === 0) return null;
|
|
@@ -218,8 +231,8 @@ export function FlightCardRow({ attachment, onOpenOffer, onViewAll, colors }: Fl
|
|
|
218
231
|
}
|
|
219
232
|
|
|
220
233
|
/** Every flight as a full-width vertical list, for a results screen or sheet. */
|
|
221
|
-
export function FlightCardList({ attachment, onOpenOffer, onViewAll, colors }: FlightCardRowProps) {
|
|
222
|
-
const c = usePalette(colors);
|
|
234
|
+
export function FlightCardList({ attachment, onOpenOffer, onViewAll, scheme, colors }: FlightCardRowProps) {
|
|
235
|
+
const c = usePalette(scheme, colors);
|
|
223
236
|
const cards = toFlightCards(attachment);
|
|
224
237
|
if (cards.length === 0) return null;
|
|
225
238
|
return (
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
export { FlightCard, FlightCardRow, FlightCardList } from './FlightCards';
|
|
2
2
|
export type { FlightCardRowProps, FlightCardColors } from './FlightCards';
|
|
3
|
+
// The model the cards render from, so a mobile host needs only this entry.
|
|
4
|
+
// Import this file directly (lib/components/FlightCards/index.js) from a chat
|
|
5
|
+
// that ships in a surface remote: it reaches only react-native, react-native-svg
|
|
6
|
+
// and the dependency-free model, not this package's root (layout, redux).
|
|
7
|
+
export { isFlightAttachment, toFlightCards } from '@admin-layout/client/lib/utils/flightCards.js';
|
|
8
|
+
export type {
|
|
9
|
+
FlightOfferSetLike,
|
|
10
|
+
FlightOfferLike,
|
|
11
|
+
TravelFlightDetails,
|
|
12
|
+
TravelFlightSlice,
|
|
13
|
+
} from '@admin-layout/client/lib/utils/flightCards.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flight-cards entry is what a mobile chat imports (lib/components/FlightCards/index.js),
|
|
3
|
+
* so it must carry the model the chat checks before drawing a card. Live 2026-11-03: the app
|
|
4
|
+
* imported isFlightAttachment from this entry, the entry did not export it, and every chat
|
|
5
|
+
* holding flight results opened to "undefined is not a function".
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { StyleSheet } from 'react-native';
|
|
9
|
+
import { render } from '@testing-library/react-native';
|
|
10
|
+
import * as entry from '../FlightCards';
|
|
11
|
+
|
|
12
|
+
jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({
|
|
13
|
+
__esModule: true,
|
|
14
|
+
default: () => 'light',
|
|
15
|
+
}));
|
|
16
|
+
jest.mock('react-native-svg', () => {
|
|
17
|
+
const { View } = jest.requireActual('react-native');
|
|
18
|
+
return { __esModule: true, default: View, Line: View, Path: View };
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const flights: entry.FlightOfferSetLike = {
|
|
22
|
+
title: 'Flights ATL to JFK',
|
|
23
|
+
currency: 'USD',
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
id: 'f1',
|
|
27
|
+
title: 'Delta',
|
|
28
|
+
price: 199,
|
|
29
|
+
url: 'https://example.com/offer/f1',
|
|
30
|
+
flight: {
|
|
31
|
+
airline: 'Delta',
|
|
32
|
+
seller: 'Example Travel',
|
|
33
|
+
slices: [
|
|
34
|
+
{
|
|
35
|
+
origin: 'ATL',
|
|
36
|
+
destination: 'JFK',
|
|
37
|
+
departAt: '2026-12-04T08:15',
|
|
38
|
+
arriveAt: '2026-12-04T10:25',
|
|
39
|
+
stops: 0,
|
|
40
|
+
durationMinutes: 130,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const stays: entry.FlightOfferSetLike = { properties: [{ id: 's1', title: 'Hotel', price: 120 }] };
|
|
49
|
+
|
|
50
|
+
describe('flight cards entry', () => {
|
|
51
|
+
it('exports the model a chat checks before it draws a card', () => {
|
|
52
|
+
expect(typeof entry.isFlightAttachment).toBe('function');
|
|
53
|
+
expect(typeof entry.toFlightCards).toBe('function');
|
|
54
|
+
expect(entry.isFlightAttachment(flights)).toBe(true);
|
|
55
|
+
expect(entry.isFlightAttachment(stays)).toBe(false);
|
|
56
|
+
expect(entry.toFlightCards(flights)).toHaveLength(1);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("draws the app's scheme, not the system's, when one is passed", () => {
|
|
60
|
+
const background = (scheme?: 'light' | 'dark') => {
|
|
61
|
+
const { getByTestId, unmount } = render(<entry.FlightCardRow attachment={flights} scheme={scheme} />);
|
|
62
|
+
const style = StyleSheet.flatten(getByTestId('flight-card').props.style);
|
|
63
|
+
unmount();
|
|
64
|
+
return style.backgroundColor;
|
|
65
|
+
};
|
|
66
|
+
// The system says light (mocked above).
|
|
67
|
+
expect(background()).toBe('#ffffff');
|
|
68
|
+
expect(background('dark')).toBe('#1f2937');
|
|
69
|
+
expect(background('light')).toBe('#ffffff');
|
|
70
|
+
});
|
|
71
|
+
});
|