@autobusal/common 1.23.0 → 1.24.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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.24.0
4
+
5
+ **`Policy` is now `Information`.**
6
+
7
+ - `Policy` → `Information`, `useGetPolicy` → `useGetInformation`, and the endpoint behind it moves from `/api/routes/policy` to `/api/routes/information`. **Breaking**: update the import.
8
+ - `RouteItem`'s `ReadPolicy` → `ReadInformation`, reading `route_item.information`.
9
+ - Translation keys: `policy.title` → `information.title`, `route_item.policy` → `route_item.information`.
10
+
11
+ The rename follows the Flexible Ticket model, where what a ticket permits comes from the add-on and the operator's own windows — not from this box.
12
+
3
13
  All notable changes to `@autobusal/common` are documented here. This project follows
4
14
  [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
5
15
 
@@ -1,7 +1,7 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { sanitizeHtml } from '@autobusal/utilities';
3
3
  import Modal from '../Modal/Modal';
4
- import { useGetPolicy } from './services';
4
+ import { useGetInformation } from './services';
5
5
 
6
6
  interface Props {
7
7
  id: number
@@ -9,20 +9,20 @@ interface Props {
9
9
  onClose: () => void
10
10
  }
11
11
 
12
- const Policy = ({ id, t, onClose }: Props): JSX.Element => {
13
- const { data, isFetching } = useGetPolicy(id);
12
+ const Information = ({ id, t, onClose }: Props): JSX.Element => {
13
+ const { data, isFetching } = useGetInformation(id);
14
14
 
15
15
  return (
16
16
  <Modal
17
17
  loading={ isFetching }
18
18
  width={ 750 }
19
- title={ t('policy.title') }
19
+ title={ t('information.title') }
20
20
  content={
21
- <div dangerouslySetInnerHTML={{ __html: sanitizeHtml(data?.policies) }} />
21
+ <div dangerouslySetInnerHTML={{ __html: sanitizeHtml(data?.information) }} />
22
22
  }
23
23
  onClose={ onClose }
24
24
  />
25
25
  );
26
26
  };
27
27
 
28
- export default Policy;
28
+ export default Information;
@@ -1,13 +1,13 @@
1
1
  import { useQuery, UseQueryResult } from '@tanstack/react-query';
2
2
  import { apiClient } from '@autobusal/providers';
3
- import { PolicyData } from '@autobusal/providers/types/routes';
3
+ import { InformationData } from '@autobusal/providers/types/routes';
4
4
 
5
- export const useGetPolicy = (id: number): UseQueryResult<PolicyData> => (
5
+ export const useGetInformation = (id: number): UseQueryResult<InformationData> => (
6
6
  useQuery({
7
- queryKey: ['route-policy', { id }],
7
+ queryKey: ['route-information', { id }],
8
8
  queryFn: async () => (
9
9
  await apiClient
10
- .get('/api/routes/policy', {
10
+ .get('/api/routes/information', {
11
11
  params: { id }
12
12
  })
13
13
  .then(response => (
@@ -1,5 +1,5 @@
1
1
  import { TFunction } from 'i18next';
2
- import ReadPolicy from './ReadPolicy';
2
+ import ReadInformation from './ReadInformation';
3
3
  import Schedule from './Schedule';
4
4
  import Transiting from './Transiting';
5
5
  import Douane from './Douane';
@@ -25,7 +25,7 @@ const More = ({ route, t }: Props): JSX.Element => (
25
25
  </Details>
26
26
 
27
27
  <Policy>
28
- <ReadPolicy id={ route.id } t={ t } />
28
+ <ReadInformation id={ route.id } t={ t } />
29
29
  </Policy>
30
30
  </Container>
31
31
  );
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import { TFunction } from 'i18next';
3
3
  import { IoDocumentText } from 'react-icons/io5';
4
- import Policy from '../../Policy/Policy';
4
+ import Information from '../../Information/Information';
5
5
  import { ButtonPolicy } from './styles';
6
6
 
7
7
  interface Props {
@@ -9,19 +9,19 @@ interface Props {
9
9
  t: TFunction<'public'>
10
10
  }
11
11
 
12
- const ReadPolicy = ({ id, t }: Props): JSX.Element => {
12
+ const ReadInformation = ({ id, t }: Props): JSX.Element => {
13
13
  const [ view, setView ] = useState<boolean>(false);
14
14
 
15
15
  return (
16
16
  <>
17
17
  <ButtonPolicy type="button" onClick={ () => setView(!view) }>
18
18
  <IoDocumentText />
19
- { t('route_item.policy') }
19
+ { t('route_item.information') }
20
20
  </ButtonPolicy>
21
21
 
22
- { view && <Policy id={ id } t={ t } onClose={ () => setView(false) } /> }
22
+ { view && <Information id={ id } t={ t } onClose={ () => setView(false) } /> }
23
23
  </>
24
24
  );
25
25
  };
26
26
 
27
- export default ReadPolicy;
27
+ export default ReadInformation;
package/index.ts CHANGED
@@ -27,7 +27,7 @@ import Passengers from './Passengers/Passengers';
27
27
  import Password from './Password/Password';
28
28
  import Rating from './Rating/Rating';
29
29
  import { setServerToday } from './Calendar/utilities/settings';
30
- import Policy from './Policy/Policy';
30
+ import Information from './Information/Information';
31
31
  import Report from './Report/Report';
32
32
  import RouteFeature from './RouteFeature/RouteFeature';
33
33
  import Required from './Required/Required';
@@ -77,7 +77,7 @@ export {
77
77
  Password,
78
78
  Rating,
79
79
  setServerToday,
80
- Policy,
80
+ Information,
81
81
  Report,
82
82
  RouteFeature,
83
83
  Required,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"