@autobusal/providers 1.41.2 → 1.41.4
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/package.json +1 -1
- package/services.ts +25 -1
- package/types/routes.ts +24 -0
- package/types/settings.ts +20 -0
- package/types/users.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 1.41.4 - 2026-08-29
|
|
2
|
+
|
|
3
|
+
- useGetMenu SUBSCRIBES to the language rather than only keying on it (audit A6-73). `i18next.language` was read during render and nothing re-rendered on a switch, so the i18n strings changed instantly while the admin-managed menu labels stayed in the previous language until a full reload.
|
|
4
|
+
|
|
5
|
+
- SettingsData.preferences gains `legal` (company, address, city, VAT number) for the footer, and FoundData gains `stops` - the itinerary between the searched cities, with midnight offsets.
|
|
6
|
+
|
|
7
|
+
## 1.41.3 - 2026-08-29
|
|
8
|
+
|
|
9
|
+
- UserData gains shipping_enabled (published by Auth\Export for operator/employee accounts) so menus can hide the Shipments module honestly (audit A1-37).
|
|
10
|
+
|
|
1
11
|
# Changelog
|
|
2
12
|
|
|
3
13
|
## 1.41.0 (2026-08-29)
|
package/package.json
CHANGED
package/services.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useSuspenseQuery, UseSuspenseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import i18next from 'i18next';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import apiClient from './Queries/apiClient';
|
|
4
5
|
import { SettingsData, MenuData } from './types/settings';
|
|
5
6
|
import useMenuStore from './stores/menu';
|
|
@@ -31,8 +32,31 @@ export const useGetMenu = (): UseSuspenseQueryResult<MenuData> => {
|
|
|
31
32
|
* a later switch never refetched it. Keying on the active language makes a
|
|
32
33
|
* switch load - and cache - that language's labels.
|
|
33
34
|
*/
|
|
35
|
+
/*
|
|
36
|
+
* Claude - 2026-08-29 (audit A6-73, low)
|
|
37
|
+
*
|
|
38
|
+
* SUBSCRIBED to the language, not merely keyed on it.
|
|
39
|
+
*
|
|
40
|
+
* The key above was right and could do nothing on its own:
|
|
41
|
+
* `i18next.language` is read during render, and nothing here re-rendered
|
|
42
|
+
* when it changed - so after switching to Albanian the i18n-file strings
|
|
43
|
+
* changed instantly while the admin-managed menu labels stayed in English
|
|
44
|
+
* until the next full page load. A visibly half-translated header after
|
|
45
|
+
* every switch, which is worse than either language on its own.
|
|
46
|
+
*
|
|
47
|
+
* useTranslation re-renders its component on i18next's `languageChanged`,
|
|
48
|
+
* which is what makes the key take a new value and the query refetch. The
|
|
49
|
+
* `t` it returns is deliberately unused; the subscription is the point.
|
|
50
|
+
*
|
|
51
|
+
* `resolvedLanguage` rather than `language`: a switch to a regional code
|
|
52
|
+
* ("en-GB") resolves to the base language that is actually loaded, and
|
|
53
|
+
* keying on the unresolved one would refetch identical labels under a
|
|
54
|
+
* second key.
|
|
55
|
+
*/
|
|
56
|
+
const { i18n } = useTranslation();
|
|
57
|
+
|
|
34
58
|
return useSuspenseQuery({
|
|
35
|
-
queryKey: ['get-menu', i18next.language],
|
|
59
|
+
queryKey: ['get-menu', i18n.resolvedLanguage ?? i18next.language],
|
|
36
60
|
queryFn: async () => (
|
|
37
61
|
await apiClient
|
|
38
62
|
.get('/api/menus/get')
|
package/types/routes.ts
CHANGED
|
@@ -147,6 +147,30 @@ export interface FoundData extends Omit<RouteData, 'locations' | 'id'> {
|
|
|
147
147
|
// Optional because external-provider offers don't report one; a filter
|
|
148
148
|
// must read "missing" as unknown, never as direct.
|
|
149
149
|
stops_count?: number
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Claude - 2026-08-29 (audit A3-02h)
|
|
153
|
+
*
|
|
154
|
+
* The calls this service makes between the searched cities, boarding stop
|
|
155
|
+
* first and destination last - so the card can DRAW the itinerary rather
|
|
156
|
+
* than only count it. `day` is how many midnights have passed by the time
|
|
157
|
+
* the coach reaches that stop (0 at boarding, always), which is what lets
|
|
158
|
+
* an overnight timetable be read without its clock times appearing to run
|
|
159
|
+
* backwards.
|
|
160
|
+
*
|
|
161
|
+
* Optional: an external-provider offer reports no itinerary and an older
|
|
162
|
+
* obtapi sends none, so the card must draw nothing rather than an empty
|
|
163
|
+
* list.
|
|
164
|
+
*/
|
|
165
|
+
stops?: {
|
|
166
|
+
city: string
|
|
167
|
+
stop: string | null
|
|
168
|
+
arrival: string
|
|
169
|
+
departure: string
|
|
170
|
+
day: number
|
|
171
|
+
douane: boolean
|
|
172
|
+
}[]
|
|
173
|
+
|
|
150
174
|
// Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
151
175
|
// Edited: Ferjolt Ozuni - Date: 2026-08-03
|
|
152
176
|
// Minutes until this coach leaves, for TODAY's searches only - null on
|
package/types/settings.ts
CHANGED
|
@@ -108,6 +108,26 @@ export interface SettingsData {
|
|
|
108
108
|
|
|
109
109
|
operatorId?: number
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Who legally operates this site.
|
|
113
|
+
*
|
|
114
|
+
* Claude - 2026-08-29 (audit A6-71). The trading name in `company` is not
|
|
115
|
+
* the entity: the footer read "© BusMagus 2026 Albania" and the public
|
|
116
|
+
* site named no company, address or tax number anywhere, though all
|
|
117
|
+
* three are on every invoice. Exactly four fields, chosen server-side -
|
|
118
|
+
* the same settings column holds the fiscal signing secrets and is never
|
|
119
|
+
* passed through whole (see Settings\ViewController).
|
|
120
|
+
*
|
|
121
|
+
* Optional, and each field optional within it: a brand that has not
|
|
122
|
+
* filled its legal block in shows what it has and nothing more.
|
|
123
|
+
*/
|
|
124
|
+
legal?: {
|
|
125
|
+
company?: string
|
|
126
|
+
address?: string
|
|
127
|
+
city?: string
|
|
128
|
+
nipt?: string
|
|
129
|
+
}
|
|
130
|
+
|
|
111
131
|
languages: {
|
|
112
132
|
available: string[]
|
|
113
133
|
default: string
|
package/types/users.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface UserData {
|
|
|
15
15
|
status: number
|
|
16
16
|
funds: string
|
|
17
17
|
documents: boolean
|
|
18
|
+
// Claude - 2026-08-29 (audit A1-37): published by Auth\Export for
|
|
19
|
+
// operator/employee accounts - whether the company's Shipments module is
|
|
20
|
+
// on, so menus can hide the link instead of advertising a 403.
|
|
21
|
+
shipping_enabled?: boolean | null
|
|
18
22
|
comissions: ComissionData
|
|
19
23
|
subscription: SubscribedData
|
|
20
24
|
api: ApiData
|