@autobusal/common 1.33.9 → 1.33.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/Autocomplete/Autocomplete.tsx +6 -3
- package/Autocomplete/fold.ts +27 -0
- package/Autocomplete/types.ts +17 -1
- package/CHANGELOG.md +6 -0
- package/ContactInfo/ContactInfo.tsx +4 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { UseFormRegister, UseFormSetValue } from 'react-hook-form';
|
|
|
4
4
|
import { useOutside } from '@autobusal/hooks';
|
|
5
5
|
import { Validate } from '@autobusal/utilities';
|
|
6
6
|
import Suggestions from './Suggestions';
|
|
7
|
+
import { fold } from './fold';
|
|
7
8
|
import { Container } from './styles';
|
|
8
9
|
import { AutocompleteData } from './types';
|
|
9
10
|
|
|
@@ -49,9 +50,11 @@ const Autocomplete = ({ name, label, defaultValue, data, validation, t, refs, on
|
|
|
49
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
51
|
}, [ data ]);
|
|
51
52
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const needle = fold(q);
|
|
54
|
+
|
|
55
|
+
const options = data.filter(item => (
|
|
56
|
+
[ item.name, ...(item.search ?? []) ].some(candidate => fold(candidate).includes(needle))
|
|
57
|
+
));
|
|
55
58
|
|
|
56
59
|
const onChange = (event: ChangeEvent<HTMLInputElement>): void => {
|
|
57
60
|
setQ(event.target.value);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Case- and accent-insensitive form of a string, for matching only.
|
|
3
|
+
*
|
|
4
|
+
* Claude - Date: 2026-08-21
|
|
5
|
+
*
|
|
6
|
+
* The search box compared raw lowercased strings, which quietly failed on
|
|
7
|
+
* this platform's most common names: in Albanian the cities are Korcë,
|
|
8
|
+
* Vlorë, Shkodër and Kukës, so typing "korce", "vlore", "shkoder" or
|
|
9
|
+
* "kukes" - which is how anybody without an Albanian keyboard layout types
|
|
10
|
+
* them, and how the ENGLISH spellings are written - matched nothing at all.
|
|
11
|
+
*
|
|
12
|
+
* The mobile app has always done this (src/lib/cities.ts); the web never
|
|
13
|
+
* got the same treatment.
|
|
14
|
+
*
|
|
15
|
+
* NFD splits an accented character into its base letter plus a combining
|
|
16
|
+
* mark, and the range below is the Unicode combining-diacritics block, so
|
|
17
|
+
* "ë" becomes "e" and "ç" becomes "c" without a per-language table. It is
|
|
18
|
+
* deliberately not a full transliteration: Cyrillic and Greek are left
|
|
19
|
+
* alone, because those are the scripts people type those names IN, and
|
|
20
|
+
* `search` carries the Latin spellings alongside them anyway.
|
|
21
|
+
*/
|
|
22
|
+
export const fold = (value: string): string => (
|
|
23
|
+
value
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
.normalize('NFD')
|
|
26
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
27
|
+
);
|
package/Autocomplete/types.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export interface AutocompleteData {
|
|
2
|
+
/** What the option shows - already in the visitor's language */
|
|
2
3
|
name: string
|
|
4
|
+
|
|
3
5
|
value: string
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Extra spellings this option should MATCH on but never display.
|
|
9
|
+
*
|
|
10
|
+
* Claude - Date: 2026-08-21
|
|
11
|
+
*
|
|
12
|
+
* Matching has to be language-blind even though display is not. A Greek
|
|
13
|
+
* typing "Θεσσαλονίκη", a Serb typing "Solun" and an Englishman typing
|
|
14
|
+
* "Thessaloniki" all mean the same city, and none of them should have to
|
|
15
|
+
* be browsing in the right language to find it. FlixBus behaves the same
|
|
16
|
+
* way - their autocomplete returns one city id for all three queries and
|
|
17
|
+
* only the LABEL changes with the interface language.
|
|
18
|
+
*/
|
|
19
|
+
search?: string[]
|
|
20
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.33.11
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **The "Add Funds" link in the Agents and Visitors lists 404'd.** It pointed at `/admin/funds/manage/:id`, a route that has never existed; the funds form lives at `/account/funds/manage/:id` (admin + financer). (Platform audit ADM-06g.)
|
|
8
|
+
|
|
3
9
|
## 1.33.9
|
|
4
10
|
|
|
5
11
|
### Fixed
|
|
@@ -24,7 +24,10 @@ const ContactInfo = ({ item, t }: Props): JSX.Element => {
|
|
|
24
24
|
</LinkMore>
|
|
25
25
|
) }
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
{ /* Claude - 2026-08-22 (audit ADM-06g): the funds form lives at
|
|
28
|
+
/account/funds/manage/:id (admin+financer guarded); /admin/funds/*
|
|
29
|
+
was never a route and 404'd from every Agents/Visitors list. */ }
|
|
30
|
+
<LinkMore to={ `/account/funds/manage/${ item.user.id }` } onClick={ (event) => onClick(event) }>
|
|
28
31
|
<RiMoneyEuroCircleFill />
|
|
29
32
|
{ t('contact_info.add_funds', { ns: 'common' }) }
|
|
30
33
|
</LinkMore>
|