@autobusal/admin-agents 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/Browse.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { useNavigate, useSearchParams } from 'react-router-dom';
3
- import { Meta, ContactInfo, Avatar, Table, Row } from '@autobusal/common';
3
+ import { Meta, ContactInfo, Avatar, Table, Row, useConfirm } from '@autobusal/common';
4
4
  import { usePage, useBreadcrumbs } from '@autobusal/hooks';
5
5
  import { DisplayStatus, getParams, success } from '@autobusal/utilities';
6
6
  import { useGetAgents, useDeleteAgent } from './services';
@@ -33,8 +33,11 @@ const Browse = ({ url, t }: Props): JSX.Element => {
33
33
  });
34
34
  };
35
35
 
36
- const onLoginAs = (id: number): void => {
37
- if (window.confirm(t('admin_agents.browse.confirm', { ns: 'common' }))) {
36
+ const confirm = useConfirm();
37
+
38
+ // Claude - 2026-11-03: the shared dialog (it was window.confirm)
39
+ const onLoginAs = async (id: number): Promise<void> => {
40
+ if (await confirm({ title: t('admin_agents.browse.confirm', { ns: 'common' }), confirmLabel: t('table.actions.custom.login_as', { ns: 'common' }) })) {
38
41
  const find = data?.data.find(item => item.id === id);
39
42
  navigate(`/account/login_as/${ find?.user.id }`);
40
43
  }
@@ -96,7 +99,7 @@ const Browse = ({ url, t }: Props): JSX.Element => {
96
99
  ] }
97
100
  handlers={ {
98
101
  delete: onDelete,
99
- login_as: onLoginAs
102
+ login_as: (id: number) => void onLoginAs(id)
100
103
  } }
101
104
  />
102
105
  </Meta>
package/Manage.tsx CHANGED
@@ -3,7 +3,7 @@ import { TFunction } from 'i18next';
3
3
  import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
4
4
  import { Meta, BackWithTitle, Viewer, Box, IpLogs, ApiDetails } from '@autobusal/common';
5
5
  import { usePage, useBreadcrumbs, useSubscriptions, useCountries, useOperators } from '@autobusal/hooks';
6
- import { GetStatus, getAllowed, success } from '@autobusal/utilities';
6
+ import { GetStatus, getAllowed, success, serverErrors } from '@autobusal/utilities';
7
7
  import { AgentData } from '@autobusal/providers/types/agents';
8
8
  import { PartnerApi, TokenRevealModal, WelcomeModal } from '@autobusal/admin-api-consumers';
9
9
  import { KeyReveal } from '@autobusal/admin-api-consumers/types';
@@ -55,7 +55,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
55
55
 
56
56
  useBreadcrumbs(title, [{ name: t('admin_agents.browse.title', { ns: 'common' }), url }]);
57
57
 
58
- const { mutate: Update, isPending: isPendingSave } = usePostAgent(id);
58
+ const { mutate: Update, isPending: isPendingSave, error: saveError } = usePostAgent(id);
59
59
 
60
60
  const { mutate: Delete, isPending: isPendingDelete } = useDeleteAgent();
61
61
 
@@ -348,6 +348,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
348
348
  }] }
349
349
  fetching={ isFetching }
350
350
  pending={ isPendingSave || isPendingDelete }
351
+ errors={ serverErrors(saveError) }
351
352
  t={ t }
352
353
  actions={ [
353
354
  'save', 'save_stay', 'delete'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/admin-agents",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",