@autobusal/operator-routes 1.1.2 → 1.3.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,7 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ **The operator's own notice windows.**
6
+
7
+ - `information_en|sq` replaces `policies_en|sq` on the route form.
8
+ - Two new fields: cancellation notice and reschedule notice, in hours before departure, with a note saying the two things an operator cannot guess from the labels — that **empty means "not offered on this line"** (not zero, which would be offering it right up until the coach pulls away), and that these numbers are **never shown to passengers**.
9
+
10
+ They decide whether Flexible Ticket may be sold on the line and what window it grants. A passenger only ever sees the resolved consequence.
11
+
3
12
  All notable changes to this package are documented here. This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
4
13
 
14
+ ## [1.2.0] - 2026-07-25
15
+
16
+ ### Added
17
+
18
+ - **"Required Passenger Details" checkbox list on the route form** (sex /
19
+ passport / phone / WhatsApp / Telegram), stored as
20
+ `routes_trip.passenger_fields`. A checked detail is shown AND required at
21
+ checkout; unchecked ones are hidden entirely.
22
+
5
23
  ## [1.1.2] - 2026-07-19
6
24
 
7
25
  ### Fixed
package/Manage.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react';
2
+ import styled from 'styled-components';
2
3
  import { TFunction } from 'i18next';
3
4
  import { useParams, useNavigate } from 'react-router-dom';
4
5
  import { RiMoneyEuroCircleLine } from 'react-icons/ri';
@@ -123,6 +124,21 @@ const Manage = ({ url, t }: Props): JSX.Element => {
123
124
  type: 'checkbox-list',
124
125
  selected: data?.trip?.features ?? [],
125
126
  values: features
127
+ }, {}, {
128
+ // Edited: Ferjolt Ozuni - Date: 2026-07-25
129
+ // which passenger details this route requires at checkout: a
130
+ // checked detail is shown AND required on the booking form, an
131
+ // unchecked one is hidden entirely (name + date of birth are
132
+ // always collected). Unsaved legacy routes default to
133
+ // sex + passport - the pre-feature behavior.
134
+ label: t('operator_routes.manage.passenger_fields.title', { ns: 'common' }),
135
+ name: 'passenger_fields',
136
+ type: 'checkbox-list',
137
+ selected: data?.trip?.passenger_fields ?? ['sex', 'passport'],
138
+ values: ['sex', 'passport', 'phone', 'whatsapp', 'telegram'].map(id => ({
139
+ id,
140
+ name: t(`operator_routes.manage.passenger_fields.${ id }`, { ns: 'common' })
141
+ }))
126
142
  }, {}, {
127
143
  label: t('operator_routes.manage.bags_no', { ns: 'common' }),
128
144
  name: 'bags_no',
@@ -194,15 +210,45 @@ const Manage = ({ url, t }: Props): JSX.Element => {
194
210
  type: 'checkbox',
195
211
  value: data?.searchable
196
212
  }, {}, {
197
- label: t('operator_routes.manage.policies_en', { ns: 'common' }),
198
- name: 'policies_en',
213
+ label: t('operator_routes.manage.information_en', { ns: 'common' }),
214
+ name: 'information_en',
199
215
  type: 'textarea-html',
200
- value: data?.policies_en
216
+ value: data?.information_en
201
217
  }, {}, {
202
- label: t('operator_routes.manage.policies_sq', { ns: 'common' }),
203
- name: 'policies_sq',
218
+ label: t('operator_routes.manage.information_sq', { ns: 'common' }),
219
+ name: 'information_sq',
204
220
  type: 'textarea-html',
205
- value: data?.policies_sq
221
+ value: data?.information_sq
222
+ }, {}, {
223
+ /*
224
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
225
+ *
226
+ * How much notice this operator needs on THIS line, in hours. Not
227
+ * published anywhere: it decides whether Flexible Ticket may be
228
+ * sold on the line and what window it grants, and a passenger only
229
+ * ever sees the consequence ("cancel up to 24 hours before
230
+ * departure").
231
+ *
232
+ * EMPTY MEANS "we do not offer it here", not zero - zero would be
233
+ * offering cancellation right up until the coach pulls away. That
234
+ * is why there is no `required` rule and no default of 0.
235
+ */
236
+ label: t('operator_routes.manage.refund_hours', { ns: 'common' }),
237
+ name: 'refund_hours',
238
+ type: 'number',
239
+ value: data?.refund_hours ?? '',
240
+ rules: 'min:0|max:720'
241
+ }, {
242
+ label: t('operator_routes.manage.reschedule_hours', { ns: 'common' }),
243
+ name: 'reschedule_hours',
244
+ type: 'number',
245
+ value: data?.reschedule_hours ?? '',
246
+ rules: 'min:0|max:720'
247
+ }, {
248
+ label: '',
249
+ type: 'component',
250
+ name: 'hours_help',
251
+ value: <Help>{ t('operator_routes.manage.hours_help', { ns: 'common' }) }</Help>
206
252
  }, {}, {
207
253
  label: t('operator_routes.manage.ticket.template', { ns: 'common' }),
208
254
  type: 'component',
@@ -229,4 +275,20 @@ const Manage = ({ url, t }: Props): JSX.Element => {
229
275
  );
230
276
  };
231
277
 
232
- export default Manage;
278
+
279
+ /**
280
+ * The note under the two notice-window fields.
281
+ *
282
+ * Edited: Ferjolt Ozuni - Date: 2026-08-03
283
+ * Says the two things an operator has to know and cannot guess from the
284
+ * labels: that empty means "not offered", and that these numbers are never
285
+ * shown to passengers.
286
+ */
287
+ const Help = styled.p`
288
+ margin: -10px 0 0;
289
+ font-size: 13px;
290
+ line-height: 1.5;
291
+ color: #6b7280;
292
+ `;
293
+
294
+ export default Manage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/operator-routes",
3
- "version": "1.1.2",
3
+ "version": "1.3.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/services.ts CHANGED
@@ -47,6 +47,7 @@ export const usePostRoute = (id: number, seating?: SeatingOptionsData): UseMutat
47
47
  id,
48
48
  ...seating,
49
49
  features: JSON.stringify(data.features),
50
+ passenger_fields: JSON.stringify(data.passenger_fields),
50
51
  drivers: JSON.stringify(data.drivers)
51
52
  })
52
53
  .then(response => (