@autobusal/providers 1.43.10 → 1.44.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/package.json +1 -1
- package/types/promotions.ts +71 -0
- package/types/routes.ts +18 -0
- package/types/settings.ts +8 -0
package/package.json
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Promotions - the strip under the mobile app's search form.
|
|
3
|
+
*
|
|
4
|
+
* Claude - 2026-09-12. Two shapes, because the admin and the app want
|
|
5
|
+
* different things: the ADMIN edits every locale at once (`Record<string,
|
|
6
|
+
* string>`), while the app is sent one language, already resolved.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** One locale map, e.g. `{ en: "Summer sale", it: "Saldi estivi" }`. */
|
|
10
|
+
export type LocalizedField = Record<string, string>;
|
|
11
|
+
|
|
12
|
+
/** A row in the admin's list. */
|
|
13
|
+
export interface PromotionRowData {
|
|
14
|
+
id: number;
|
|
15
|
+
/** the English title, or empty when the promotion is only a picture */
|
|
16
|
+
title: string;
|
|
17
|
+
link: string | null;
|
|
18
|
+
image_url: string | null;
|
|
19
|
+
/** d/m/Y, or null for "from now" / "until I say" */
|
|
20
|
+
starts_at: string | null;
|
|
21
|
+
ends_at: string | null;
|
|
22
|
+
position: number;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
/** switched on AND inside its dates today - what the phone would show now */
|
|
25
|
+
live: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** One promotion as the form edits it. */
|
|
29
|
+
export interface PromotionData {
|
|
30
|
+
id: number;
|
|
31
|
+
title: LocalizedField;
|
|
32
|
+
text: LocalizedField;
|
|
33
|
+
cta: LocalizedField;
|
|
34
|
+
link: string | null;
|
|
35
|
+
image_url: string | null;
|
|
36
|
+
starts_at: string | null;
|
|
37
|
+
ends_at: string | null;
|
|
38
|
+
position: number;
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* What the form posts. The localized fields travel as ONE JSON-encoded
|
|
44
|
+
* object each - never bracket-notation array fields, which the brands' BFF
|
|
45
|
+
* proxy turns into the literal string "Array".
|
|
46
|
+
*/
|
|
47
|
+
export interface PromotionSaveData {
|
|
48
|
+
title: string;
|
|
49
|
+
text: string;
|
|
50
|
+
cta: string;
|
|
51
|
+
link: string;
|
|
52
|
+
starts_at: string;
|
|
53
|
+
ends_at: string;
|
|
54
|
+
position: string;
|
|
55
|
+
enabled: string;
|
|
56
|
+
image?: File;
|
|
57
|
+
image_remove?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* What the PUBLIC settings payload carries: already narrowed to the
|
|
62
|
+
* promotions live today, already in the reader's language.
|
|
63
|
+
*/
|
|
64
|
+
export interface PublicPromotion {
|
|
65
|
+
id: number;
|
|
66
|
+
image_url: string | null;
|
|
67
|
+
link: string | null;
|
|
68
|
+
title: string;
|
|
69
|
+
text: string;
|
|
70
|
+
cta: string;
|
|
71
|
+
}
|
package/types/routes.ts
CHANGED
|
@@ -148,6 +148,24 @@ export interface FoundData extends Omit<RouteData, 'locations' | 'id'> {
|
|
|
148
148
|
// must read "missing" as unknown, never as direct.
|
|
149
149
|
stops_count?: number
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* How many seats are still on sale on this departure.
|
|
153
|
+
*
|
|
154
|
+
* Edited: Claude - Date: 2026-09-16
|
|
155
|
+
*
|
|
156
|
+
* NOT `trip.available_seats`, which is the coach's CAPACITY - the search
|
|
157
|
+
* subtracts what every brand has sold and what the operator holds back
|
|
158
|
+
* before deciding whether to offer the departure at all, and this is that
|
|
159
|
+
* answer (Routes\Search\Buses::removeOccupied). Reading the capacity
|
|
160
|
+
* instead announced 49 free seats on a coach with 49 sold, which is the
|
|
161
|
+
* one number on a result card nobody would think to doubt.
|
|
162
|
+
*
|
|
163
|
+
* Optional: an external-provider offer has no seat count of ours, and an
|
|
164
|
+
* older API does not send this at all - in both cases the card shows
|
|
165
|
+
* nothing rather than guessing.
|
|
166
|
+
*/
|
|
167
|
+
seats_left?: number
|
|
168
|
+
|
|
151
169
|
/**
|
|
152
170
|
* Claude - 2026-08-29 (audit A3-02h)
|
|
153
171
|
*
|
package/types/settings.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PublicPromotion } from './promotions';
|
|
2
|
+
|
|
1
3
|
export interface SettingsData {
|
|
2
4
|
// Edited: Ferjolt Ozuni - Date: 2026-08-03
|
|
3
5
|
// The earliest bookable date as the SERVER reckons it, d/m/Y. The date
|
|
@@ -37,6 +39,12 @@ export interface SettingsData {
|
|
|
37
39
|
// the same public settings payload.
|
|
38
40
|
launch_artwork?: string | null
|
|
39
41
|
|
|
42
|
+
// Claude - 2026-09-12: the promotions under the app's search form, already
|
|
43
|
+
// narrowed to the ones live today and resolved to this request's language.
|
|
44
|
+
// Always present, possibly empty - an empty list means "fall back to the
|
|
45
|
+
// single `banner` below", which is how an older app build keeps working.
|
|
46
|
+
promotions?: PublicPromotion[]
|
|
47
|
+
|
|
40
48
|
// Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
41
49
|
// Present ONLY while the brand is under construction - obtapi omits it
|
|
42
50
|
// entirely on a live site, so its presence is the switch itself and there
|