@autobusal/providers 1.37.10 → 1.37.11

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.37.11
4
+
5
+ ### Added
6
+
7
+ - Saved-passenger types and the account query, shared by the checkout chooser and the account manager so both read one shape.
8
+
3
9
  ## 1.37.10
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.37.10",
3
+ "version": "1.37.11",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/types/persons.ts CHANGED
@@ -14,4 +14,68 @@ export interface BillingData {
14
14
  bill_nipt: string
15
15
  comments: string
16
16
  terms: string
17
- }
17
+ }
18
+ /**
19
+ * A traveller this account has asked us to remember.
20
+ *
21
+ * Edited: Claude - Date: 2026-08-20
22
+ *
23
+ * Here rather than in either package that uses it, because BOTH do: the
24
+ * checkout chooser (@autobusal/routes-order) and the account manager
25
+ * (@autobusal/account-passengers) read the same rows from the same
26
+ * endpoints, and two copies of this shape would be free to disagree about
27
+ * the one field that matters most - which of them carries a passport number.
28
+ *
29
+ * THE LIST NEVER CARRIES THE NUMBER. `passport_masked` is the last few
30
+ * characters, enough to tell two of your own documents apart;
31
+ * `has_passport` is the yes/no. The raw value exists only on
32
+ * SavedPassengerRecord, which is what /get answers with - see obtapi's
33
+ * Account\PassengersController for why the split is there.
34
+ */
35
+ export interface SavedPassenger {
36
+ id: number
37
+
38
+ first_name: string
39
+ last_name: string
40
+ /** d/m/Y, the format every date field in this app is typed in */
41
+ dob: string
42
+
43
+ /** what this person was last ticketed as - a record, never a price */
44
+ type: string | null
45
+ /** the fare band they fall into TODAY, derived from `dob` by the server */
46
+ age_type: 'adult' | 'child' | 'baby'
47
+
48
+ sex: number | null
49
+
50
+ passport_masked: string | null
51
+ has_passport: boolean
52
+
53
+ phone: string | null
54
+ whatsapp: string | null
55
+ telegram: string | null
56
+ email: string | null
57
+
58
+ /**
59
+ * What the journey being booked would still have to ask for - the option
60
+ * keys of routes_trip.passenger_fields (sex, passport, phone, whatsapp,
61
+ * telegram).
62
+ *
63
+ * ABSENT, not empty, when no journey was named: the account page asks for
64
+ * the list with no price ids and gets no `missing` at all, and reading
65
+ * that as "nothing missing" would be a promise about a route nobody has
66
+ * chosen yet. Hence optional, and hence every reader tests for an array
67
+ * rather than for length.
68
+ */
69
+ missing?: string[]
70
+ }
71
+
72
+ /** One traveller, passport included - the answer /get alone gives */
73
+ export interface SavedPassengerRecord extends SavedPassenger {
74
+ passport: string | null
75
+ }
76
+
77
+ export interface SavedPassengersData {
78
+ data: SavedPassenger[]
79
+ /** how many one account may keep, so a UI can say so before refusing */
80
+ max: number
81
+ }