@autobusal/providers 1.6.3 → 1.6.5
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 +20 -0
- package/Queries/apiClient.ts +19 -0
- package/package.json +1 -1
- package/types/locations.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ All notable changes to `@autobusal/providers` are documented here. This project
|
|
|
4
4
|
adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.6.5] - 2026-07-31
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`Queries/apiClient.ts` sends `Content-Language`** on every request,
|
|
12
|
+
reflecting the live active i18next language. The API's
|
|
13
|
+
ChangeApiLanguage middleware/Languaged trait expect this to localize
|
|
14
|
+
city/country/article/... names, but the frontend never sent it -
|
|
15
|
+
those names always rendered in the API's own default locale
|
|
16
|
+
regardless of the UI's actual language. Requires obtapi's
|
|
17
|
+
Traits\Languaged fix (falls back safely for the 13 UI languages the
|
|
18
|
+
database has no columns for) and @autobusal/bff 1.2.0 (forwards the
|
|
19
|
+
header upstream in bff mode) to actually take effect end-to-end.
|
|
20
|
+
|
|
21
|
+
## [1.6.4] - 2026-07-30
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **`types/locations.ts` `CityStats`/`CityDestination` types + `CityData.stats`/`.destinations`** - real route/operator/destination-count/price stats and reachable-destinations list from obtapi's new `cities/view` endpoint, for city hub landing pages.
|
|
26
|
+
|
|
7
27
|
## [1.6.3] - 2026-07-30
|
|
8
28
|
|
|
9
29
|
### Added
|
package/Queries/apiClient.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import i18next from 'i18next';
|
|
2
3
|
import languages from '@lang/errors';
|
|
3
4
|
import { getLanguage } from '../Setup/languages';
|
|
4
5
|
import { error as systemError } from '@autobusal/utilities';
|
|
@@ -37,6 +38,24 @@ if (!isBffMode) {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
// The API localizes city/country/article/... names off this header
|
|
42
|
+
// (ChangeApiLanguage middleware) - was never sent at all, so every one of
|
|
43
|
+
// those names always rendered in the API's own default locale regardless
|
|
44
|
+
// of the UI's actual language. i18next.language reflects the live active
|
|
45
|
+
// language (kept in sync by Setup/languages.ts on every change), read
|
|
46
|
+
// fresh per request rather than closed over once, so a language switch
|
|
47
|
+
// takes effect on the very next call with no extra wiring anywhere else.
|
|
48
|
+
// In bff mode this also needs public/bff/index.php's api() to forward it
|
|
49
|
+
// upstream (see @autobusal/bff) - both sides had to change, only one of
|
|
50
|
+
// them silently doing nothing would look identical to neither working.
|
|
51
|
+
apiClient.interceptors.request.use(config => {
|
|
52
|
+
if (i18next.language) {
|
|
53
|
+
config.headers['Content-Language'] = i18next.language;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return config;
|
|
57
|
+
});
|
|
58
|
+
|
|
40
59
|
apiClient.interceptors.response.use(response => (
|
|
41
60
|
response
|
|
42
61
|
), async (error) => {
|
package/package.json
CHANGED
package/types/locations.ts
CHANGED
|
@@ -27,6 +27,23 @@ export interface CountryData {
|
|
|
27
27
|
stats?: CountryStats
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export interface CityStats {
|
|
31
|
+
routes: number
|
|
32
|
+
operators: number
|
|
33
|
+
destinations: number
|
|
34
|
+
price_from: string | null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The lightweight shape Cities\BrowseController::view() nests under
|
|
38
|
+
// `destinations` (other cities reachable from this one) - not a full
|
|
39
|
+
// CityData (no `location`, only what a destination link needs).
|
|
40
|
+
export interface CityDestination {
|
|
41
|
+
id: number
|
|
42
|
+
name: string
|
|
43
|
+
slug: string
|
|
44
|
+
image_url?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
30
47
|
export interface CityData {
|
|
31
48
|
id: number
|
|
32
49
|
name: string
|
|
@@ -43,6 +60,8 @@ export interface CityData {
|
|
|
43
60
|
front?: number
|
|
44
61
|
front_order?: number
|
|
45
62
|
image?: string[]
|
|
63
|
+
stats?: CityStats
|
|
64
|
+
destinations?: CityDestination[]
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
export interface StopData {
|