@autobusal/providers 1.21.0 → 1.22.0

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.22.0
4
+
5
+ **Flexible Ticket, and the `policies` rename.**
6
+
7
+ - `PolicyData` is now `InformationData`, and its field `policies` is `information` — the route's free-text box is luggage, pets, boarding and ID, and never was cancellation terms. Calling it Policies invited operators to type terms into it that would then contradict the terms actually sold.
8
+ - `RouteData.policies_en|sq` → `information_en|sq`.
9
+ - `RouteData` gains `refund_hours` / `reschedule_hours`: the operator's own notice windows, in hours before departure. **Internal** — they reach the operator's route form and the admin, never a public payload. `null` means "not offered on this line", which is why they are nullable rather than 0.
10
+ - New `FlexOffer`, the response of `GET /api/orders/flex`. Its hours are already resolved to the **stricter** leg of a return trip, so they are the numbers that will be enforced. Either may be null on its own — an operator who will reschedule but not refund is a real case.
11
+
3
12
  All notable changes to `@autobusal/providers` are documented here. This project
4
13
  adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
14
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/types/routes.ts CHANGED
@@ -31,8 +31,16 @@ export interface RouteData {
31
31
  language: string
32
32
  template: string
33
33
  searchable: number
34
- policies_en: string
35
- policies_sq: string
34
+ information_en: string
35
+ information_sq: string
36
+
37
+ // Edited: Ferjolt Ozuni - Date: 2026-08-03
38
+ // The operator's own notice windows, in hours before departure, for
39
+ // Flexible Ticket. INTERNAL - they reach the operator's own route form and
40
+ // the admin, never a public payload. `null` is "not offered on this line",
41
+ // which is why they are nullable rather than 0.
42
+ refund_hours: number | null
43
+ reschedule_hours: number | null
36
44
  }
37
45
 
38
46
  export interface AvailableData {
@@ -93,9 +101,27 @@ export interface FeatureData {
93
101
  image?: string[]
94
102
  }
95
103
 
96
- export interface PolicyData {
104
+ export interface InformationData {
97
105
  id: number
98
- policies: string
106
+ information: string
107
+ }
108
+
109
+ /**
110
+ * The Flexible Ticket offer for one booking (GET /api/orders/flex).
111
+ *
112
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
113
+ *
114
+ * The hours here are already resolved to the STRICTER leg of a return trip,
115
+ * so they are the numbers that will actually be enforced. Either may be null
116
+ * on its own: an operator who will reschedule but not refund is a real case,
117
+ * and the checkout has to be able to say so rather than imply both.
118
+ */
119
+ export interface FlexOffer {
120
+ available: boolean
121
+ price?: number
122
+ price_display?: string
123
+ refund_hours?: number | null
124
+ reschedule_hours?: number | null
99
125
  }
100
126
 
101
127
  export interface FoundData extends Omit<RouteData, 'locations' | 'id'> {