@asteby/metacore-runtime-react 53.17.0 → 53.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @asteby/metacore-runtime-react
2
2
 
3
+ ## 53.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bfc9a99: AddonConfigSurface: un conector con `form_layout` en pasos ahora se dibuja como asistente aunque sus credenciales sean todas `auto` (generadas por el host) o el layout solo traiga bloques (URL a copiar, instrucciones). Las credenciales `auto` aparecen en el paso al que se enlazan con `section` (estado + Rotar). Antes caía al formulario plano y el asistente no se veía.
8
+
3
9
  ## 53.17.0
4
10
 
5
11
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"addon-config-surface.d.ts","sourceRoot":"","sources":["../../src/setup/addon-config-surface.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI3C,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAA;AAWjC,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC7C,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CA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onConfigSurface({ addon, connector, open, onOpenChange, onSav
264
264
  // A connector with a form_layout groups its credentials into titled sections
265
265
  // (a light wizard). Fall back to the required/advanced split when absent.
266
266
  const layoutSections = connector?.form_layout?.sections ?? [];
267
- const useLayout = layoutSections.length > 0 && credFields.some((f) => !!f.section);
267
+ const useLayout = layoutSections.length > 0 &&
268
+ (credFields.some((f) => !!f.section) ||
269
+ autoFields.some((f) => !!f.section) ||
270
+ layoutSections.some((sec) => (sec.blocks?.length ?? 0) > 0));
268
271
  // A form_layout with mode "steps" drives a real wizard (one section at a time
269
272
  // with Atrás/Siguiente), instead of stacked cards.
270
273
  const stepMode = useLayout && connector?.form_layout?.mode === 'steps';
@@ -850,6 +853,17 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
850
853
  setFormError(null);
851
854
  goToStep(stepIdx + 1);
852
855
  };
856
+ // Host-generated credential: state + Rotar, never an input. Shown in the flat form and inside the
857
+ // wizard step the credential binds to (credential.section).
858
+ const renderAutoCred = (f) => {
859
+ const state = autoStateOf(f.key);
860
+ const once = revealedOnce[f.key];
861
+ return (_jsxs("div", { className: 'flex flex-col gap-2 rounded-md border border-border/60 px-3 py-3', children: [_jsxs("div", { className: 'flex items-center justify-between gap-2', children: [_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("span", { className: 'text-sm font-medium', children: state === 'missing'
862
+ ? st('auto.needs_action')
863
+ : state === 'manual'
864
+ ? st('auto.manual')
865
+ : st('auto.connected') }), _jsx(HelpText, { text: st('auto.help') })] }), _jsxs(Button, { type: 'button', variant: 'outline', size: 'sm', disabled: rotating === f.key || !canManageIssuer, onClick: () => void rotateAuto(f.key), children: [rotating === f.key ? (_jsx(Loader2, { className: 'h-4 w-4 animate-spin' })) : (_jsx(RefreshCw, { className: 'h-4 w-4' })), state === 'missing' ? st('auto.generate') : st('auto.rotate')] })] }), once && (_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("code", { className: 'break-all rounded bg-muted px-2 py-1 text-xs', children: once }), _jsx(HelpText, { text: st('auto.show_once') })] }))] }, f.key));
866
+ };
853
867
  const dirty = credDirty || touched.size > 0 || cleared.size > 0;
854
868
  useEffect(() => {
855
869
  if (dirty)
@@ -887,20 +901,12 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
887
901
  : 'border-border text-muted-foreground'), children: !active && status === 'error' ? (_jsx(AlertCircle, { className: 'h-4 w-4' })) : !active && status === 'ok' ? (_jsx(Check, { className: 'h-4 w-4' })) : (i + 1) }) }), i < wizardSteps.length - 1 && (_jsx("span", { "aria-hidden": 'true', className: cn('mx-1 h-0.5 flex-1 rounded-full transition-colors', i < stepIdx ? 'bg-primary' : 'bg-border') }))] }, s.key));
888
902
  }) }), _jsxs("div", { className: 'flex items-start justify-between gap-3', children: [_jsx("h3", { ref: stepHeadingRef, tabIndex: -1, className: 'min-w-0 text-base leading-snug font-semibold break-words outline-none', children: t(activeStep?.title ?? '', {
889
903
  defaultValue: humanizeKey(activeStep?.title),
890
- }) }), _jsx("span", { className: 'mt-0.5 shrink-0 text-xs font-medium tabular-nums text-muted-foreground', children: st('flow.step_of', { n: stepIdx + 1, total: totalSteps }) })] })] }), _jsxs("div", { className: 'flex flex-col gap-4', children: [activeStep?.description && (_jsx(HelpText, { text: addonText(activeStep.description) })), activeStep?.kind === 'settings' ? (settingsBody) : !canManageIssuer ? (_jsxs(_Fragment, { children: [issuerAdminNote, renderBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks))] })) : (_jsxs(_Fragment, { children: [renderBlocks(leadBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks))), activeFields.filter((f) => f.section === activeStep?.key).map(renderCred), renderBlocks(trailBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks)))] }))] })] })) : (_jsxs(_Fragment, { children: [oauthPanel, autoFields.length > 0 && (_jsx("section", { className: 'flex flex-col gap-3', "data-testid": 'auto-credentials', children: autoFields.map((f) => {
891
- const state = autoStateOf(f.key);
892
- const once = revealedOnce[f.key];
893
- return (_jsxs("div", { className: 'flex flex-col gap-2 rounded-md border border-border/60 px-3 py-3', children: [_jsxs("div", { className: 'flex items-center justify-between gap-2', children: [_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("span", { className: 'text-sm font-medium', children: state === 'missing'
894
- ? st('auto.needs_action')
895
- : state === 'manual'
896
- ? st('auto.manual')
897
- : st('auto.connected') }), _jsx(HelpText, { text: st('auto.help') })] }), _jsxs(Button, { type: 'button', variant: 'outline', size: 'sm', disabled: rotating === f.key || !canManageIssuer, onClick: () => void rotateAuto(f.key), children: [rotating === f.key ? (_jsx(Loader2, { className: 'h-4 w-4 animate-spin' })) : (_jsx(RefreshCw, { className: 'h-4 w-4' })), state === 'missing' ? st('auto.generate') : st('auto.rotate')] })] }), once && (_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("code", { className: 'break-all rounded bg-muted px-2 py-1 text-xs', children: once }), _jsx(HelpText, { text: st('auto.show_once') })] }))] }, f.key));
898
- }) })), hasCredentials && (_jsxs("section", { className: 'flex flex-col gap-3', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Cable, { className: 'h-4 w-4 text-muted-foreground' }), _jsx("h3", { className: 'text-sm font-semibold', children: st('installed_addons.section_credentials') })] }), !canManageIssuer ? (issuerAdminNote) : useLayout ? (
904
+ }) }), _jsx("span", { className: 'mt-0.5 shrink-0 text-xs font-medium tabular-nums text-muted-foreground', children: st('flow.step_of', { n: stepIdx + 1, total: totalSteps }) })] })] }), _jsxs("div", { className: 'flex flex-col gap-4', children: [activeStep?.description && (_jsx(HelpText, { text: addonText(activeStep.description) })), activeStep?.kind === 'settings' ? (settingsBody) : !canManageIssuer ? (_jsxs(_Fragment, { children: [issuerAdminNote, renderBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks))] })) : (_jsxs(_Fragment, { children: [renderBlocks(leadBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks))), activeFields.filter((f) => f.section === activeStep?.key).map(renderCred), autoFields.filter((f) => f.section === activeStep?.key).map(renderAutoCred), renderBlocks(trailBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks)))] }))] })] })) : (_jsxs(_Fragment, { children: [oauthPanel, autoFields.length > 0 && (_jsx("section", { className: 'flex flex-col gap-3', "data-testid": 'auto-credentials', children: autoFields.map(renderAutoCred) })), hasCredentials && (_jsxs("section", { className: 'flex flex-col gap-3', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Cable, { className: 'h-4 w-4 text-muted-foreground' }), _jsx("h3", { className: 'text-sm font-semibold', children: st('installed_addons.section_credentials') })] }), !canManageIssuer ? (issuerAdminNote) : useLayout ? (
899
905
  // form_layout: one titled group per section, in declared order.
900
906
  activeSections.map((sec) => {
901
907
  const fields = activeFields.filter((f) => f.section === sec.key);
902
908
  if (fields.length === 0 && (sec.blocks?.length ?? 0) === 0)
903
909
  return null;
904
910
  return (_jsxs("div", { className: 'flex flex-col gap-3 rounded-md border border-border/60 px-3 py-3', children: [sec.title && (_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("h4", { className: 'text-sm font-medium', children: t(sec.title, { defaultValue: sec.title }) }), sec.description && (_jsx(HelpText, { text: addonText(sec.description) }))] })), renderBlocks(leadBlocks(sec.blocks)), fields.map((f) => (_jsx(ConnectorCredentialFieldControl, { field: f, connected: !!connector?.connected, provider: connector?.provider ?? '', ...storedProps(f.key), value: credValues[f.key] ?? '', onChange: (val) => setCred(f.key, val) }, f.key))), renderBlocks(trailBlocks(sec.blocks))] }, sec.key));
905
- })) : (_jsxs(_Fragment, { children: [activeFields.filter((f) => f.required).map((f) => (_jsx(ConnectorCredentialFieldControl, { field: f, connected: !!connector?.connected, provider: connector?.provider ?? '', ...storedProps(f.key), value: credValues[f.key] ?? '', onChange: (val) => setCred(f.key, val) }, f.key))), activeFields.some((f) => !f.required) && (_jsxs("details", { className: 'rounded-md border border-border/60 px-3 py-2', open: activeFields.filter((f) => !f.required).some((f) => !!fieldErrors[f.key]) || undefined, children: [_jsx("summary", { className: 'flex min-h-11 cursor-pointer items-center text-sm font-medium text-muted-foreground select-none sm:min-h-8', children: st('installed_addons.advanced') }), _jsx("div", { className: 'flex flex-col gap-3 pt-3', children: activeFields.filter((f) => !f.required).map((f) => (_jsx(ConnectorCredentialFieldControl, { field: f, connected: !!connector?.connected, provider: connector?.provider ?? '', ...storedProps(f.key), value: credValues[f.key] ?? '', onChange: (val) => setCred(f.key, val) }, f.key))) })] }))] }))] })), extraBlocks.length > 0 && renderBlocks(extraBlocks), hasSettings && (_jsxs("section", { className: 'flex flex-col gap-3', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Settings, { className: 'h-4 w-4 text-muted-foreground' }), _jsx("h3", { className: 'text-sm font-semibold', children: st('installed_addons.section_settings') })] }), targetPicker, shownDefs.map(renderSetting)] })), nothingToConfigure && (_jsxs("div", { className: 'flex flex-col items-start gap-1 rounded-lg border border-dashed p-4', children: [_jsx("p", { className: 'text-sm font-medium', children: st('empty.title') }), _jsx(HelpText, { text: st('empty.help') })] }))] })) }), formError ? (_jsx("div", { ref: errorRef, role: 'alert', className: 'max-h-40 shrink-0 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive', children: formError })) : null, _jsx(DialogFooter, { "data-wizard-footer": '', className: 'flex shrink-0 flex-col gap-2 border-t pt-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:space-x-0', children: nothingToSave ? (_jsx(Button, { className: 'h-11 w-full sm:ml-auto sm:h-9 sm:w-auto', onClick: () => onOpenChange(false), children: st('common.close') })) : (_jsxs(_Fragment, { children: [_jsxs("p", { role: 'status', "aria-live": 'polite', "data-save-status": saveStatus, className: cn('flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs', saveStatus === 'dirty' ? 'font-medium text-amber-600 dark:text-amber-400' : 'text-muted-foreground', saveStatus === 'saved' && 'text-emerald-600 dark:text-emerald-400'), children: [saveStatus === 'saving' ? (_jsx(Loader2, { className: 'h-3.5 w-3.5 animate-spin' })) : saveStatus === 'saved' ? (_jsx(Check, { className: 'h-3.5 w-3.5' })) : (_jsx("span", { "aria-hidden": true, className: cn('h-2 w-2 rounded-full', saveStatus === 'dirty' ? 'bg-amber-500' : 'bg-muted-foreground/40') })), st(`form.status_${saveStatus}`)] }), _jsxs("div", { className: 'flex flex-wrap items-center gap-2 sm:ml-auto sm:flex-nowrap sm:justify-end', children: [_jsx(Button, { variant: 'ghost', className: 'h-11 px-3 sm:h-9', onClick: () => onOpenChange(false), children: dirty ? st('common.cancel') : st('common.close') }), useStepper && stepIdx > 0 && (_jsx(Button, { variant: 'outline', className: 'h-11 sm:h-9', onClick: () => goToStep(Math.max(0, stepIdx - 1)), children: st('common.back') })), useStepper && !isLastStep && (_jsx(Button, { variant: 'outline', className: 'h-11 sm:h-9', onClick: handleNext, children: st('common.next') })), _jsxs(Button, { className: 'h-11 flex-1 sm:h-9 sm:flex-none', onClick: handleSave, disabled: saveMutation.isPending || loading, "data-testid": 'config-save', children: [saveMutation.isPending && _jsx(Loader2, { className: 'mr-2 h-4 w-4 animate-spin' }), st('common.save')] })] })] })) })] }) }) }));
911
+ })) : (_jsxs(_Fragment, { children: [activeFields.filter((f) => f.required).map((f) => (_jsx(ConnectorCredentialFieldControl, { field: f, connected: !!connector?.connected, provider: connector?.provider ?? '', ...storedProps(f.key), value: credValues[f.key] ?? '', onChange: (val) => setCred(f.key, val) }, f.key))), activeFields.some((f) => !f.required) && (_jsxs("details", { className: 'rounded-md border border-border/60 px-3 py-2', open: activeFields.filter((f) => !f.required).some((f) => !!fieldErrors[f.key]) || undefined, children: [_jsx("summary", { className: 'flex min-h-11 cursor-pointer items-center text-sm font-medium text-muted-foreground select-none sm:min-h-8', children: st('installed_addons.advanced') }), _jsx("div", { className: 'flex flex-col gap-3 pt-3', children: activeFields.filter((f) => !f.required).map((f) => (_jsx(ConnectorCredentialFieldControl, { field: f, connected: !!connector?.connected, provider: connector?.provider ?? '', ...storedProps(f.key), value: credValues[f.key] ?? '', onChange: (val) => setCred(f.key, val) }, f.key))) })] }))] }))] })), extraBlocks.length > 0 && renderBlocks(extraBlocks), hasSettings && (_jsxs("section", { className: 'flex flex-col gap-3', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Settings, { className: 'h-4 w-4 text-muted-foreground' }), _jsx("h3", { className: 'text-sm font-semibold', children: st('installed_addons.section_settings') })] }), targetPicker, shownDefs.map(renderSetting)] })), nothingToConfigure && (_jsxs("div", { className: 'flex flex-col items-start gap-1 rounded-lg border border-dashed p-4', children: [_jsx("p", { className: 'text-sm font-medium', children: st('empty.title') }), _jsx(HelpText, { text: st('empty.help') })] }))] })) }), formError ? (_jsx("div", { ref: errorRef, role: 'alert', className: 'max-h-40 shrink-0 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive', children: formError })) : null, _jsx(DialogFooter, { "data-wizard-footer": '', className: 'flex shrink-0 flex-col gap-2 border-t pt-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:space-x-0', children: nothingToSave && !useStepper ? (_jsx(Button, { className: 'h-11 w-full sm:ml-auto sm:h-9 sm:w-auto', onClick: () => onOpenChange(false), children: st('common.close') })) : (_jsxs(_Fragment, { children: [_jsxs("p", { role: 'status', "aria-live": 'polite', "data-save-status": saveStatus, className: cn('flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs', saveStatus === 'dirty' ? 'font-medium text-amber-600 dark:text-amber-400' : 'text-muted-foreground', saveStatus === 'saved' && 'text-emerald-600 dark:text-emerald-400'), children: [saveStatus === 'saving' ? (_jsx(Loader2, { className: 'h-3.5 w-3.5 animate-spin' })) : saveStatus === 'saved' ? (_jsx(Check, { className: 'h-3.5 w-3.5' })) : (_jsx("span", { "aria-hidden": true, className: cn('h-2 w-2 rounded-full', saveStatus === 'dirty' ? 'bg-amber-500' : 'bg-muted-foreground/40') })), st(`form.status_${saveStatus}`)] }), _jsxs("div", { className: 'flex flex-wrap items-center gap-2 sm:ml-auto sm:flex-nowrap sm:justify-end', children: [_jsx(Button, { variant: 'ghost', className: 'h-11 px-3 sm:h-9', onClick: () => onOpenChange(false), children: dirty ? st('common.cancel') : st('common.close') }), useStepper && stepIdx > 0 && (_jsx(Button, { variant: 'outline', className: 'h-11 sm:h-9', onClick: () => goToStep(Math.max(0, stepIdx - 1)), children: st('common.back') })), useStepper && !isLastStep && (_jsx(Button, { variant: 'outline', className: 'h-11 sm:h-9', onClick: handleNext, children: st('common.next') })), !nothingToSave && (_jsxs(Button, { className: 'h-11 flex-1 sm:h-9 sm:flex-none', onClick: handleSave, disabled: saveMutation.isPending || loading, "data-testid": 'config-save', children: [saveMutation.isPending && _jsx(Loader2, { className: 'mr-2 h-4 w-4 animate-spin' }), st('common.save')] }))] })] })) })] }) }) }));
906
912
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "53.17.0",
3
+ "version": "53.18.0",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -351,4 +351,40 @@ describe('host-generated (auto) credentials', () => {
351
351
  setup({ connector: { ...autoConnector, auto_credentials: { api_key: 'missing' } } })
352
352
  expect(await screen.findByText('Requiere acción')).toBeTruthy()
353
353
  })
354
+
355
+ it('a connector with ONLY auto credentials still renders its steps: URL block first, Rotar in the bound step', async () => {
356
+ const wizard: ConnectorEntry = {
357
+ ...autoConnector,
358
+ credentials: [{ key: 'api_key', type: 'secret', required: true, auto: 'webhook_signing', label: 'pay.token', section: 'secret' }],
359
+ form_layout: {
360
+ mode: 'steps',
361
+ sections: [
362
+ {
363
+ key: 'endpoint',
364
+ title: 'Direccion de entrada',
365
+ blocks: [
366
+ {
367
+ key: 'ingest_url',
368
+ kind: 'webhook_url',
369
+ webhook: 'fleet_instances',
370
+ title: 'URL de la organizacion',
371
+ value: 'https://ops.example/api/webhooks/org1/hub_fleet/fleet_instances',
372
+ },
373
+ ],
374
+ },
375
+ {
376
+ key: 'secret',
377
+ title: 'Secreto de firma',
378
+ blocks: [{ key: 'secret_howto', kind: 'instructions', title: 'Ops genera el secreto' }],
379
+ },
380
+ ],
381
+ },
382
+ }
383
+ setup({ connector: wizard })
384
+ expect(await screen.findByText('https://ops.example/api/webhooks/org1/hub_fleet/fleet_instances')).toBeTruthy()
385
+ expect(screen.queryByText('Rotar')).toBeNull()
386
+ fireEvent.click(screen.getByText('Siguiente'))
387
+ expect(await screen.findByText('Rotar')).toBeTruthy()
388
+ expect(screen.getByText('Conectada automáticamente')).toBeTruthy()
389
+ })
354
390
  })
@@ -661,7 +661,11 @@ export function AddonConfigSurface({
661
661
  // A connector with a form_layout groups its credentials into titled sections
662
662
  // (a light wizard). Fall back to the required/advanced split when absent.
663
663
  const layoutSections = connector?.form_layout?.sections ?? []
664
- const useLayout = layoutSections.length > 0 && credFields.some((f) => !!f.section)
664
+ const useLayout =
665
+ layoutSections.length > 0 &&
666
+ (credFields.some((f) => !!f.section) ||
667
+ autoFields.some((f) => !!f.section) ||
668
+ layoutSections.some((sec) => (sec.blocks?.length ?? 0) > 0))
665
669
 
666
670
  // A form_layout with mode "steps" drives a real wizard (one section at a time
667
671
  // with Atrás/Siguiente), instead of stacked cards.
@@ -1423,6 +1427,52 @@ export function AddonConfigSurface({
1423
1427
  goToStep(stepIdx + 1)
1424
1428
  }
1425
1429
 
1430
+ // Host-generated credential: state + Rotar, never an input. Shown in the flat form and inside the
1431
+ // wizard step the credential binds to (credential.section).
1432
+ const renderAutoCred = (f: (typeof autoFields)[number]) => {
1433
+ const state = autoStateOf(f.key)
1434
+ const once = revealedOnce[f.key]
1435
+ return (
1436
+ <div
1437
+ key={f.key}
1438
+ className='flex flex-col gap-2 rounded-md border border-border/60 px-3 py-3'
1439
+ >
1440
+ <div className='flex items-center justify-between gap-2'>
1441
+ <div className='flex flex-col gap-1'>
1442
+ <span className='text-sm font-medium'>
1443
+ {state === 'missing'
1444
+ ? st('auto.needs_action')
1445
+ : state === 'manual'
1446
+ ? st('auto.manual')
1447
+ : st('auto.connected')}
1448
+ </span>
1449
+ <HelpText text={st('auto.help')} />
1450
+ </div>
1451
+ <Button
1452
+ type='button'
1453
+ variant='outline'
1454
+ size='sm'
1455
+ disabled={rotating === f.key || !canManageIssuer}
1456
+ onClick={() => void rotateAuto(f.key)}
1457
+ >
1458
+ {rotating === f.key ? (
1459
+ <Loader2 className='h-4 w-4 animate-spin' />
1460
+ ) : (
1461
+ <RefreshCw className='h-4 w-4' />
1462
+ )}
1463
+ {state === 'missing' ? st('auto.generate') : st('auto.rotate')}
1464
+ </Button>
1465
+ </div>
1466
+ {once && (
1467
+ <div className='flex flex-col gap-1'>
1468
+ <code className='break-all rounded bg-muted px-2 py-1 text-xs'>{once}</code>
1469
+ <HelpText text={st('auto.show_once')} />
1470
+ </div>
1471
+ )}
1472
+ </div>
1473
+ )
1474
+ }
1475
+
1426
1476
  const dirty = credDirty || touched.size > 0 || cleared.size > 0
1427
1477
  useEffect(() => {
1428
1478
  if (dirty) setJustSaved(false)
@@ -1558,6 +1608,7 @@ export function AddonConfigSurface({
1558
1608
  <>
1559
1609
  {renderBlocks(leadBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks)))}
1560
1610
  {activeFields.filter((f) => f.section === activeStep?.key).map(renderCred)}
1611
+ {autoFields.filter((f) => f.section === activeStep?.key).map(renderAutoCred)}
1561
1612
  {renderBlocks(trailBlocks(blocksFor(activeStep?.key ?? '', activeStep?.blocks)))}
1562
1613
  </>
1563
1614
  )}
@@ -1569,49 +1620,7 @@ export function AddonConfigSurface({
1569
1620
  {/* Credenciales generadas por el host: estado + Rotar, nunca un campo */}
1570
1621
  {autoFields.length > 0 && (
1571
1622
  <section className='flex flex-col gap-3' data-testid='auto-credentials'>
1572
- {autoFields.map((f) => {
1573
- const state = autoStateOf(f.key)
1574
- const once = revealedOnce[f.key]
1575
- return (
1576
- <div
1577
- key={f.key}
1578
- className='flex flex-col gap-2 rounded-md border border-border/60 px-3 py-3'
1579
- >
1580
- <div className='flex items-center justify-between gap-2'>
1581
- <div className='flex flex-col gap-1'>
1582
- <span className='text-sm font-medium'>
1583
- {state === 'missing'
1584
- ? st('auto.needs_action')
1585
- : state === 'manual'
1586
- ? st('auto.manual')
1587
- : st('auto.connected')}
1588
- </span>
1589
- <HelpText text={st('auto.help')} />
1590
- </div>
1591
- <Button
1592
- type='button'
1593
- variant='outline'
1594
- size='sm'
1595
- disabled={rotating === f.key || !canManageIssuer}
1596
- onClick={() => void rotateAuto(f.key)}
1597
- >
1598
- {rotating === f.key ? (
1599
- <Loader2 className='h-4 w-4 animate-spin' />
1600
- ) : (
1601
- <RefreshCw className='h-4 w-4' />
1602
- )}
1603
- {state === 'missing' ? st('auto.generate') : st('auto.rotate')}
1604
- </Button>
1605
- </div>
1606
- {once && (
1607
- <div className='flex flex-col gap-1'>
1608
- <code className='break-all rounded bg-muted px-2 py-1 text-xs'>{once}</code>
1609
- <HelpText text={st('auto.show_once')} />
1610
- </div>
1611
- )}
1612
- </div>
1613
- )
1614
- })}
1623
+ {autoFields.map(renderAutoCred)}
1615
1624
  </section>
1616
1625
  )}
1617
1626
  {/* Credenciales */}
@@ -1747,7 +1756,7 @@ export function AddonConfigSurface({
1747
1756
  data-wizard-footer=''
1748
1757
  className='flex shrink-0 flex-col gap-2 border-t pt-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:space-x-0'
1749
1758
  >
1750
- {nothingToSave ? (
1759
+ {nothingToSave && !useStepper ? (
1751
1760
  <Button className='h-11 w-full sm:ml-auto sm:h-9 sm:w-auto' onClick={() => onOpenChange(false)}>
1752
1761
  {st('common.close')}
1753
1762
  </Button>
@@ -1789,15 +1798,17 @@ export function AddonConfigSurface({
1789
1798
  {st('common.next')}
1790
1799
  </Button>
1791
1800
  )}
1792
- <Button
1793
- className='h-11 flex-1 sm:h-9 sm:flex-none'
1794
- onClick={handleSave}
1795
- disabled={saveMutation.isPending || loading}
1796
- data-testid='config-save'
1797
- >
1798
- {saveMutation.isPending && <Loader2 className='mr-2 h-4 w-4 animate-spin' />}
1799
- {st('common.save')}
1800
- </Button>
1801
+ {!nothingToSave && (
1802
+ <Button
1803
+ className='h-11 flex-1 sm:h-9 sm:flex-none'
1804
+ onClick={handleSave}
1805
+ disabled={saveMutation.isPending || loading}
1806
+ data-testid='config-save'
1807
+ >
1808
+ {saveMutation.isPending && <Loader2 className='mr-2 h-4 w-4 animate-spin' />}
1809
+ {st('common.save')}
1810
+ </Button>
1811
+ )}
1801
1812
  </div>
1802
1813
  </>
1803
1814
  )}