@autobusal/admin-agents 1.4.0 → 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'
@@ -359,10 +360,10 @@ const Manage = ({ url, t }: Props): JSX.Element => {
359
360
  { /* Claude - 2026-09-24: enabling drafts the welcome email too, for the
360
361
  admin to read and send or drop; a regenerated key shows alone */ }
361
362
  { revealToken && (revealToken.welcome ? (
362
- <WelcomeModal agentId={ id } token={ revealToken.token } draft={ revealToken.welcome } t={ t } onClose={ () => setRevealToken(null) } />
363
- ) : (
363
+ <WelcomeModal agentId={ id } kind={ revealToken.kind } token={ revealToken.token } draft={ revealToken.welcome } t={ t } onClose={ () => setRevealToken(null) } />
364
+ ) : revealToken.token ? (
364
365
  <TokenRevealModal token={ revealToken.token } t={ t } onClose={ () => setRevealToken(null) } />
365
- )) }
366
+ ) : null) }
366
367
  </Meta>
367
368
  );
368
369
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/admin-agents",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",