@autobusal/routes-order 1.4.1 → 1.4.2

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 ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here. This project follows
4
+ [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [1.4.2] - 2026-07-19
7
+
8
+ ### Added
9
+
10
+ - `Found/Route/Route.tsx`: added a neutral inline SVG data-URI `LOGO_FALLBACK`.
11
+ The operator logo `<img>` now falls back to it when `logo_url` is empty
12
+ (`data.operator.logo_url || LOGO_FALLBACK`) and via an `onError` handler
13
+ (which nulls `onerror` first to avoid a loop), so a missing or broken operator
14
+ logo no longer renders the browser's broken-image icon in route results.
15
+
16
+ ### Fixed
17
+
18
+ - `Found/Orders/Orders.tsx`: the not-found branch now triggers on
19
+ `data === undefined || data.length === 0` instead of only `data?.length == 0`.
20
+ An `undefined` result means the search errored (e.g. same origin and
21
+ destination), and it now shows the not-found message instead of an empty
22
+ shell.
23
+ - `Found/Booking/Booking.tsx`: the Booking.com logo `<img>` now has an
24
+ `alt="Booking.com"` attribute, giving the image an accessible name.
25
+ - `Found/Route/Route.tsx`: the operator logo `<img>` now has an `alt` attribute
26
+ set to the operator company name.
27
+
28
+ ### Security
29
+
30
+ - `Found/Booking/Booking.tsx`: the `LinkBooking` external link
31
+ (`target="_blank"`) now includes `rel="noopener noreferrer"`, closing the
32
+ reverse-tabnabbing / `window.opener` leak.
33
+ - `Found/Route/Route.tsx`: the operator `LinkCompany` and route `LinkRoute`
34
+ external links (`target="_blank"`) now include `rel="noopener noreferrer"` for
35
+ the same tabnabbing protection.
36
+
37
+ Authored by Ferjolt Ozuni. Consolidated from the magus and alvavel whitelabel patch sets into canonical @autobusal source (eliminates per-repo patch-package divergence).
@@ -39,10 +39,10 @@ const Booking = ({ data, step1, t }: Props): (JSX.Element | null) => {
39
39
  <Container>
40
40
  <About>
41
41
  { t('routes_order.step2.booking.title', { location: destination.city.name }) }
42
- <img src="https://s-ec.bstatic.com/static/img/b26logo/booking_logo_retina/22615963add19ac6b6d715a97c8d477e8b95b7ea.png" />
42
+ <img src="https://s-ec.bstatic.com/static/img/b26logo/booking_logo_retina/22615963add19ac6b6d715a97c8d477e8b95b7ea.png" alt="Booking.com" />
43
43
  </About>
44
44
 
45
- <LinkBooking to={ location } target="_blank">{ t('routes_order.step2.booking.search') }</LinkBooking>
45
+ <LinkBooking to={ location } target="_blank" rel="noopener noreferrer">{ t('routes_order.step2.booking.search') }</LinkBooking>
46
46
  </Container>
47
47
  );
48
48
  };
@@ -23,7 +23,9 @@ const Orders = ({ loading, data, type, preferredStop, t, onSave }: Props): JSX.E
23
23
  );
24
24
  }
25
25
 
26
- if (data?.length == 0) {
26
+ // undefined means the search errored (e.g. same origin and destination) -
27
+ // show the not-found message instead of an empty shell
28
+ if (data === undefined || data.length === 0) {
27
29
  return (
28
30
  <ContainerNotFound className="box">{ t('routes_order.step2.not_found') }</ContainerNotFound>
29
31
  );
@@ -6,6 +6,10 @@ import { Button, RouteFeature, Policy } from '@autobusal/common';
6
6
  import { Container, SpecialOffer, FavoriteStop, Trip, Company, Location, Time, Price, LinkCompany, Details, Detail, ButtonPolicy, TitleDetail, LinkRoute, Features, TitleFeatures, FeaturesItems } from './styles';
7
7
  import { FoundData } from '@autobusal/providers/types/routes';
8
8
 
9
+ // neutral placeholder so a missing/broken operator logo doesn't render the
10
+ // browser's broken-image icon in the route results
11
+ const LOGO_FALLBACK = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60' viewBox='0 0 120 60'%3E%3Crect width='120' height='60' rx='6' fill='%23e5e7eb'/%3E%3Cpath d='M42 22h36v14a2 2 0 0 1-2 2h-2a3 3 0 0 1-6 0H52a3 3 0 0 1-6 0h-2a2 2 0 0 1-2-2z' fill='%239ca3af'/%3E%3C/svg%3E";
12
+
9
13
  interface Props {
10
14
  data: FoundData
11
15
  type: 'favorite' | 'normal'
@@ -30,7 +34,7 @@ const Route = ({ data, type, t, onSave }: Props): JSX.Element => {
30
34
 
31
35
  <Trip>
32
36
  <Company>
33
- <LinkCompany to={ data.operator.link } target="_blank" title={ data.operator.company }><img src={ data.operator.logo_url } /></LinkCompany>
37
+ <LinkCompany to={ data.operator.link } target="_blank" rel="noopener noreferrer" title={ data.operator.company }><img src={ data.operator.logo_url || LOGO_FALLBACK } onError={ (e) => { e.currentTarget.onerror = null; e.currentTarget.src = LOGO_FALLBACK; } } alt={ data.operator.company } /></LinkCompany>
34
38
  </Company>
35
39
 
36
40
  <Location>
@@ -69,7 +73,7 @@ const Route = ({ data, type, t, onSave }: Props): JSX.Element => {
69
73
  <Details>
70
74
  <Detail>
71
75
  <TitleDetail>{ t('routes_order.step2.route.name') }</TitleDetail>
72
- <LinkRoute to={ data.link } target="_blank">{ data.code }</LinkRoute>
76
+ <LinkRoute to={ data.link } target="_blank" rel="noopener noreferrer">{ data.code }</LinkRoute>
73
77
  </Detail>
74
78
 
75
79
  { customs && (
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
+ "author": "Ferjolt Ozuni",
4
5
  "type": "module",
5
6
  "main": "index.ts"
6
7
  }