@autobusal/admin-agents 1.2.1 → 1.2.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/package.json +5 -2
- package/services.ts +15 -5
- package/CHANGELOG.md +0 -56
package/package.json
CHANGED
package/services.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseMutationResult, UseQueryResult, UseSuspenseQueryResult, useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|
1
|
+
import { UseMutationResult, UseQueryResult, UseSuspenseQueryResult, useMutation, useQuery, useSuspenseQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { apiClient } from '@autobusal/providers';
|
|
3
3
|
import { PaginationData } from '@autobusal/providers/types/pagination';
|
|
4
4
|
import { AgentData } from '@autobusal/providers/types/agents';
|
|
@@ -36,9 +36,19 @@ export const useGetAgent = (id: number): UseSuspenseQueryResult<AgentData> => (
|
|
|
36
36
|
})
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
export const usePostAgent = (id: number): UseMutationResult<void, Error, AgentData, unknown> =>
|
|
40
|
-
|
|
39
|
+
export const usePostAgent = (id: number): UseMutationResult<void, Error, AgentData, unknown> => {
|
|
40
|
+
const queryClient = useQueryClient();
|
|
41
|
+
|
|
42
|
+
return useMutation({
|
|
41
43
|
mutationKey: ['admin-agents-save', { id }],
|
|
44
|
+
// Claude - 2026-09-06: re-read the record after a save. With Save & Stay
|
|
45
|
+
// the page stays on stale data, and the one field that only the server
|
|
46
|
+
// can fill in - the URL of an image just uploaded - never appeared
|
|
47
|
+
// until a reload. The list is refreshed too, for the same reason.
|
|
48
|
+
onSuccess: () => {
|
|
49
|
+
queryClient.invalidateQueries({ queryKey: ['admin-agents-manage', { id }] });
|
|
50
|
+
queryClient.invalidateQueries({ queryKey: ['admin-agents'] });
|
|
51
|
+
},
|
|
42
52
|
mutationFn: async (data: AgentData) => {
|
|
43
53
|
const formData = new FormData();
|
|
44
54
|
|
|
@@ -69,8 +79,8 @@ export const usePostAgent = (id: number): UseMutationResult<void, Error, AgentDa
|
|
|
69
79
|
response.data
|
|
70
80
|
));
|
|
71
81
|
}
|
|
72
|
-
})
|
|
73
|
-
|
|
82
|
+
});
|
|
83
|
+
};
|
|
74
84
|
|
|
75
85
|
export const useDeleteAgent = (): UseMutationResult<void, Error, number, unknown> => (
|
|
76
86
|
useMutation({
|
package/CHANGELOG.md
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 1.2.1 - 2026-08-29
|
|
4
|
-
|
|
5
|
-
- The heading names the ACCOUNT as well as the company (audit A4-09). This screen is addressed by `agents`.`id` while /account/funds/manage is addressed by `users`.`id`, so the same number opens two different agencies - and company names are not unique either (three agencies are registered as "API Company"), so the name alone could not say which record was open.
|
|
6
|
-
|
|
7
|
-
## 1.2.0 (2026-08-29)
|
|
8
|
-
|
|
9
|
-
- Editors offer Save & Close alongside Save & Stay, so correcting a record no longer bounces you back to its list every time (opt-in per page, editing only).
|
|
10
|
-
|
|
11
|
-
## 1.1.7 (2026-08-28)
|
|
12
|
-
|
|
13
|
-
- Company minimum length 2, matching the server rule - two-letter brand names can be saved (sweep #56).
|
|
14
|
-
|
|
15
|
-
## 1.1.6
|
|
16
|
-
|
|
17
|
-
### Fixed
|
|
18
|
-
|
|
19
|
-
- **License No. is optional on the manage form.** The agent sign-up stopped collecting it on 2026-08-07 and the column is nullable server-side, but the form's required rule made approving a self-registered agency impossible without inventing a number. (Audit AUTH-02b.)
|
|
20
|
-
|
|
21
|
-
## 1.1.5
|
|
22
|
-
|
|
23
|
-
### Added
|
|
24
|
-
|
|
25
|
-
- **Credit limit on the agent form.** Ordinary website agents can now sell
|
|
26
|
-
postpaid: obtapi's funds gate measures the balance's resting position -
|
|
27
|
-
funds minus (amount less commission) - against `-credit_limit` instead of
|
|
28
|
-
refusing anything below the gross total. 0 keeps the historic prepaid
|
|
29
|
-
behaviour; a positive number lets the balance run down to -that-much,
|
|
30
|
-
restored when an admin records the agent's payment on the funds screen.
|
|
31
|
-
|
|
32
|
-
## [1.1.4] - 2026-08-07
|
|
33
|
-
|
|
34
|
-
### Fixed
|
|
35
|
-
|
|
36
|
-
- **Country select no longer defaults to Afghanistan.** `value` was `?? 0`,
|
|
37
|
-
which matches no country, so opening an agent with none on file and
|
|
38
|
-
pressing save filed them in Afghanistan.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## 1.1.3
|
|
42
|
-
|
|
43
|
-
### Changed
|
|
44
|
-
|
|
45
|
-
- **Address is a single-line input, not a textarea**, matching the other
|
|
46
|
-
address fields across the apps.
|
|
47
|
-
|
|
48
|
-
All notable changes to this package are documented here. This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
|
|
49
|
-
|
|
50
|
-
## [1.1.2] - 2026-07-19
|
|
51
|
-
|
|
52
|
-
### Fixed
|
|
53
|
-
|
|
54
|
-
- `Manage.tsx`: the agent edit form's email field is now hydrated with the existing value (`value: data?.user.email`). Previously the email `<input>` rendered empty when editing an agent, so the field appeared blank and a save could overwrite the stored email with an empty value.
|
|
55
|
-
|
|
56
|
-
Authored by Ferjolt Ozuni. Consolidated from the magus and alvavel whitelabel patch sets into canonical @autobusal source (eliminates per-repo patch-package divergence).
|