@autobusal/admin-agents 1.3.0 → 1.4.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/Manage.tsx +24 -12
- package/package.json +1 -1
package/Manage.tsx
CHANGED
|
@@ -5,7 +5,8 @@ import { Meta, BackWithTitle, Viewer, Box, IpLogs, ApiDetails } from '@autobusal
|
|
|
5
5
|
import { usePage, useBreadcrumbs, useSubscriptions, useCountries, useOperators } from '@autobusal/hooks';
|
|
6
6
|
import { GetStatus, getAllowed, success } from '@autobusal/utilities';
|
|
7
7
|
import { AgentData } from '@autobusal/providers/types/agents';
|
|
8
|
-
import { PartnerApi, TokenRevealModal } from '@autobusal/admin-api-consumers';
|
|
8
|
+
import { PartnerApi, TokenRevealModal, WelcomeModal } from '@autobusal/admin-api-consumers';
|
|
9
|
+
import { KeyReveal } from '@autobusal/admin-api-consumers/types';
|
|
9
10
|
import { useGetAgent, usePostAgent, useDeleteAgent } from './services';
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
@@ -35,7 +36,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
35
36
|
// in the panel: the panel sits inside Viewer, which swaps its form for a
|
|
36
37
|
// loading box while the record refetches after the key is issued - taking
|
|
37
38
|
// the panel, and any modal it opened, with it.
|
|
38
|
-
const [ revealToken, setRevealToken ] = useState<
|
|
39
|
+
const [ revealToken, setRevealToken ] = useState<KeyReveal | null>(null);
|
|
39
40
|
|
|
40
41
|
/*
|
|
41
42
|
* Claude - 2026-08-29 (audit A4-09, low)
|
|
@@ -221,28 +222,33 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
221
222
|
label: t('admin_agents.manage.departure', { ns: 'common' }),
|
|
222
223
|
name: 'departure',
|
|
223
224
|
type: 'text',
|
|
224
|
-
value: data?.user.comissions?.departure_edit
|
|
225
|
+
value: data?.user.comissions?.departure_edit,
|
|
226
|
+
notice: t('admin_agents.manage.departure_notice', { ns: 'common' })
|
|
225
227
|
}, {
|
|
226
228
|
label: t('admin_agents.manage.departure_self', { ns: 'common' }),
|
|
227
229
|
name: 'departure_self',
|
|
228
230
|
type: 'text',
|
|
229
|
-
value: data?.user.comissions?.departure_self_edit
|
|
231
|
+
value: data?.user.comissions?.departure_self_edit,
|
|
232
|
+
notice: t('admin_agents.manage.departure_self_notice', { ns: 'common' })
|
|
230
233
|
}, {}, {
|
|
231
234
|
label: t('admin_agents.manage.return', { ns: 'common' }),
|
|
232
235
|
name: 'return',
|
|
233
236
|
type: 'text',
|
|
234
|
-
value: data?.user.comissions?.return_edit
|
|
237
|
+
value: data?.user.comissions?.return_edit,
|
|
238
|
+
notice: t('admin_agents.manage.return_notice', { ns: 'common' })
|
|
235
239
|
}, {
|
|
236
240
|
label: t('admin_agents.manage.return_self', { ns: 'common' }),
|
|
237
241
|
name: 'return_self',
|
|
238
242
|
type: 'text',
|
|
239
|
-
value: data?.user.comissions?.return_self_edit
|
|
243
|
+
value: data?.user.comissions?.return_self_edit,
|
|
244
|
+
notice: t('admin_agents.manage.return_self_notice', { ns: 'common' })
|
|
240
245
|
}, {}, {
|
|
241
246
|
label: t('admin_agents.manage.unique', { ns: 'common' }),
|
|
242
247
|
name: 'unique',
|
|
243
248
|
type: 'select',
|
|
244
249
|
value: data?.user.comissions?.unique ?? 0,
|
|
245
|
-
values: getAllowed(t)
|
|
250
|
+
values: getAllowed(t),
|
|
251
|
+
notice: t('admin_agents.manage.unique_notice', { ns: 'common' })
|
|
246
252
|
}, {
|
|
247
253
|
// Claude - 2026-08-22: the floor of the agent's funds balance
|
|
248
254
|
// for website sales - 0 = prepaid (the historic behaviour),
|
|
@@ -252,7 +258,8 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
252
258
|
name: 'credit_limit',
|
|
253
259
|
type: 'text',
|
|
254
260
|
value: data?.credit_limit ?? 0,
|
|
255
|
-
rules: 'required|numeric'
|
|
261
|
+
rules: 'required|numeric',
|
|
262
|
+
notice: t('admin_agents.manage.credit_limit_notice', { ns: 'common' })
|
|
256
263
|
}, ...(id > 0 ? [{
|
|
257
264
|
/*
|
|
258
265
|
* Claude - 2026-09-24 (Ferjolt: one API login type). The old
|
|
@@ -306,7 +313,8 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
306
313
|
name: 'external',
|
|
307
314
|
type: 'select',
|
|
308
315
|
value: data?.user.comissions?.external ?? 0,
|
|
309
|
-
values: getAllowed(t)
|
|
316
|
+
values: getAllowed(t),
|
|
317
|
+
notice: t('admin_agents.manage.external_notice', { ns: 'common' })
|
|
310
318
|
}, {
|
|
311
319
|
label: t('admin_agents.manage.devpos_settings', { ns: 'common' }),
|
|
312
320
|
name: 'devpos_settings',
|
|
@@ -348,9 +356,13 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
348
356
|
onDelete={ onDelete }
|
|
349
357
|
/>
|
|
350
358
|
|
|
351
|
-
{
|
|
352
|
-
|
|
353
|
-
|
|
359
|
+
{ /* Claude - 2026-09-24: enabling drafts the welcome email too, for the
|
|
360
|
+
admin to read and send or drop; a regenerated key shows alone */ }
|
|
361
|
+
{ revealToken && (revealToken.welcome ? (
|
|
362
|
+
<WelcomeModal agentId={ id } token={ revealToken.token } draft={ revealToken.welcome } t={ t } onClose={ () => setRevealToken(null) } />
|
|
363
|
+
) : (
|
|
364
|
+
<TokenRevealModal token={ revealToken.token } t={ t } onClose={ () => setRevealToken(null) } />
|
|
365
|
+
)) }
|
|
354
366
|
</Meta>
|
|
355
367
|
);
|
|
356
368
|
};
|