@autobusal/utilities 1.4.0 → 1.5.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,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Added
6
+
7
+ - **`GetStatus` knows status 4, "awaiting approval"** - distinct from 3
8
+ (pending, waiting on the account to finish its own form) and from 2
9
+ (suspended, a decision already taken against it).
10
+
11
+
12
+ ## 1.4.1
13
+
14
+ ### Changed
15
+
16
+ - **Gender can be "not declared".** `getOptionsSex` gains it as the first
17
+ option and `getSex` reports it, instead of treating everything that is not
18
+ `1` as male — which is what three existing rows with no value were already
19
+ rendering as.
20
+
21
+ Carried by `null`: the `visitors`.`sex` column has always been nullable, so
22
+ nothing migrated. The option's id is `''`, which Laravel's
23
+ `ConvertEmptyStringsToNull` turns into a real null on the way in, so "not
24
+ declared" is the *absence* of a value at every layer rather than a magic
25
+ number each one has to learn.
26
+
27
+ Deliberately not shared with the checkout passenger forms — those build
28
+ their own field, and gender there is a per-route requirement a carrier can
29
+ insist on. A profile is the person; a passenger record is what a carrier
30
+ demands in order to board them.
31
+
3
32
  ## 1.4.0
4
33
 
5
34
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/utilities",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/passengers.ts CHANGED
@@ -1,15 +1,45 @@
1
1
  import { TFunction } from 'i18next';
2
2
 
3
- export const getSex = (value: number): string => (
4
- value === 1 ? 'female' : 'male'
5
- );
3
+ /**
4
+ * Edited: Ferjolt Ozuni - Date: 2026-08-06
5
+ *
6
+ * Gender is OPTIONAL on a profile, and "not declared" is a real answer
7
+ * rather than a missing one.
8
+ *
9
+ * `null` carries it - `visitors`.`sex` has always been nullable and already
10
+ * held rows with no value, so nothing needed migrating. What was missing was
11
+ * any way to SAY it: the select offered Male and Female, the profile form
12
+ * defaulted to Male, and anybody who never touched the field was recorded as
13
+ * male. Three such rows existed already and rendered as "male" here, because
14
+ * this treated everything that was not 1 as male.
15
+ *
16
+ * Deliberately NOT shared with the passenger forms at checkout: those build
17
+ * their own field (routes-order's Gender), and gender there is a per-route
18
+ * requirement a carrier can insist on. A profile is the person; a passenger
19
+ * record is what a carrier demands in order to board them, and those are
20
+ * different questions.
21
+ */
22
+ export const getSex = (value?: number | null): string => {
23
+ if (value === null || value === undefined) {
24
+ return 'undeclared';
25
+ }
26
+
27
+ return value === 1 ? 'female' : 'male';
28
+ };
6
29
 
7
30
  export const getOptionsSex = (t: TFunction<'common'>) => ([
8
31
  {
32
+ // Empty rather than a third numeric code: Laravel's
33
+ // ConvertEmptyStringsToNull turns it into a real null on the way in, so
34
+ // "not declared" is the ABSENCE of a value at every layer rather than a
35
+ // magic number each of them has to learn.
36
+ id: '',
37
+ name: t('data.gender.undeclared', { ns: 'common' })
38
+ }, {
9
39
  id: 0,
10
40
  name: t('data.gender.male', { ns: 'common' })
11
41
  }, {
12
42
  id: 1,
13
43
  name: t('data.gender.female', { ns: 'common' })
14
44
  }
15
- ]);
45
+ ]);
package/users.tsx CHANGED
@@ -19,6 +19,15 @@ export const GetStatus = (t: TFunction<'common'>) => ([
19
19
  }, {
20
20
  id: 3,
21
21
  name: t('data.statuses.pending', { ns: 'common' })
22
+ }, {
23
+ /*
24
+ * Edited: Ferjolt Ozuni - Date: 2026-08-07
25
+ * Complete and waiting on a decision. Distinct from 3 (pending), which
26
+ * is waiting on the ACCOUNT to finish its own form, and from 2, which
27
+ * is a decision already taken against it.
28
+ */
29
+ id: 4,
30
+ name: t('data.statuses.awaiting', { ns: 'common' })
22
31
  }
23
32
  ]);
24
33