@asteby/metacore-runtime-react 53.17.0 → 53.19.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 +12 -0
- package/dist/setup/addon-config-surface.d.ts.map +1 -1
- package/dist/setup/addon-config-surface.js +18 -12
- package/dist/setup/messages.d.ts.map +1 -1
- package/dist/setup/messages.js +2 -0
- package/package.json +1 -1
- package/src/__tests__/addon-config-surface.test.tsx +37 -0
- package/src/setup/addon-config-surface.tsx +66 -55
- package/src/setup/messages.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 53.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 305fcf1: AddonConfigSurface: la clave que muestra «Rotar» (credencial `auto`) ahora se presenta como valor copiable con botón Copiar y un aviso de «se muestra una sola vez», en lugar de texto plano.
|
|
8
|
+
|
|
9
|
+
## 53.18.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
3
15
|
## 53.17.0
|
|
4
16
|
|
|
5
17
|
### 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,kB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B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAA;CACrD;AAmQD,6EAA6E;AAC7E,wBAAgB,yBAAyB,SAExC;AA0JD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,eAAsB,EACtB,gBAAwB,EACxB,YAAmB,EACnB,iBAAiB,EACjB,MAAc,EACd,MAAM,EACN,mBAAqC,EACrC,WAAW,EACX,cAAc,GACf,EAAE,uBAAuB,+BAwqCzB"}
|
|
@@ -24,7 +24,7 @@ import { useApi } from '../api-context';
|
|
|
24
24
|
import { evaluateVisibleWhen, getVisibleWhen } from '../dynamic-form-schema';
|
|
25
25
|
import { useSetupT } from './messages';
|
|
26
26
|
import { StepStatusBadge } from './step-status-badge';
|
|
27
|
-
import { ConnectorBlocks, HelpText } from './connector-blocks';
|
|
27
|
+
import { ConnectorBlocks, CopyValue, HelpText } from './connector-blocks';
|
|
28
28
|
import { buildWizardSteps, errorMessage, hasExplicitTest, normalizeBlockResult, stepStatus, } from './connector-blocks-model';
|
|
29
29
|
import { isSecretCredential, missingRequired, applicableFields, visibleSections, parseSaveError, shapeMismatch, textOrFallback, } from './connector-form-model';
|
|
30
30
|
// Empty write_only value (typed then erased) must not overwrite the stored secret.
|
|
@@ -264,7 +264,10 @@ export function AddonConfigSurface({ 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 &&
|
|
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-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-3', "data-testid": 'auto-once', children: [_jsx(CopyValue, { value: once, label: st('auto.once_label') }), _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((
|
|
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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/setup/messages.ts"],"names":[],"mappings":"AAMA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAElC,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/setup/messages.ts"],"names":[],"mappings":"AAMA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAElC,eAAO,MAAM,iBAAiB,EAAE,IAoK/B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,IAiK/B,CAAA;AAED,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAA;AAOzE,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,GAAG,CAa/B"}
|
package/dist/setup/messages.js
CHANGED
|
@@ -111,6 +111,7 @@ export const SETUP_MESSAGES_ES = {
|
|
|
111
111
|
'auto.needs_action': 'Requiere acción',
|
|
112
112
|
'auto.help': 'La clave la genera y guarda el sistema, cifrada. No hay nada que inventar ni pegar.',
|
|
113
113
|
'auto.rotate': 'Rotar',
|
|
114
|
+
'auto.once_label': 'Clave nueva',
|
|
114
115
|
'auto.generate': 'Generar',
|
|
115
116
|
'auto.show_once': 'Cópiala ahora: no se vuelve a mostrar. La anterior ya no funciona.',
|
|
116
117
|
'auto.rotate_failed': 'No se pudo rotar la clave',
|
|
@@ -277,6 +278,7 @@ export const SETUP_MESSAGES_EN = {
|
|
|
277
278
|
'auto.needs_action': 'Action required',
|
|
278
279
|
'auto.help': 'The system generates and stores the key, encrypted. Nothing to invent or paste.',
|
|
279
280
|
'auto.rotate': 'Rotate',
|
|
281
|
+
'auto.once_label': 'New key',
|
|
280
282
|
'auto.generate': 'Generate',
|
|
281
283
|
'auto.show_once': 'Copy it now: it is not shown again. The previous one no longer works.',
|
|
282
284
|
'auto.rotate_failed': 'Could not rotate the key',
|
package/package.json
CHANGED
|
@@ -344,6 +344,7 @@ describe('host-generated (auto) credentials', () => {
|
|
|
344
344
|
expect(screen.queryByLabelText(/Token/)).toBeNull()
|
|
345
345
|
fireEvent.click(screen.getByText('Rotar'))
|
|
346
346
|
await waitFor(() => expect(screen.getByText('mcs_NEWSECRET')).toBeTruthy())
|
|
347
|
+
expect(screen.getByTestId('auto-once').querySelector('button')).toBeTruthy()
|
|
347
348
|
expect(calls.some((c) => c.m === 'POST' && c.url === '/integrations/local_reviews/auto/api_key/rotate')).toBe(true)
|
|
348
349
|
})
|
|
349
350
|
|
|
@@ -351,4 +352,40 @@ describe('host-generated (auto) credentials', () => {
|
|
|
351
352
|
setup({ connector: { ...autoConnector, auto_credentials: { api_key: 'missing' } } })
|
|
352
353
|
expect(await screen.findByText('Requiere acción')).toBeTruthy()
|
|
353
354
|
})
|
|
355
|
+
|
|
356
|
+
it('a connector with ONLY auto credentials still renders its steps: URL block first, Rotar in the bound step', async () => {
|
|
357
|
+
const wizard: ConnectorEntry = {
|
|
358
|
+
...autoConnector,
|
|
359
|
+
credentials: [{ key: 'api_key', type: 'secret', required: true, auto: 'webhook_signing', label: 'pay.token', section: 'secret' }],
|
|
360
|
+
form_layout: {
|
|
361
|
+
mode: 'steps',
|
|
362
|
+
sections: [
|
|
363
|
+
{
|
|
364
|
+
key: 'endpoint',
|
|
365
|
+
title: 'Direccion de entrada',
|
|
366
|
+
blocks: [
|
|
367
|
+
{
|
|
368
|
+
key: 'ingest_url',
|
|
369
|
+
kind: 'webhook_url',
|
|
370
|
+
webhook: 'fleet_instances',
|
|
371
|
+
title: 'URL de la organizacion',
|
|
372
|
+
value: 'https://ops.example/api/webhooks/org1/hub_fleet/fleet_instances',
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
key: 'secret',
|
|
378
|
+
title: 'Secreto de firma',
|
|
379
|
+
blocks: [{ key: 'secret_howto', kind: 'instructions', title: 'Ops genera el secreto' }],
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
},
|
|
383
|
+
}
|
|
384
|
+
setup({ connector: wizard })
|
|
385
|
+
expect(await screen.findByText('https://ops.example/api/webhooks/org1/hub_fleet/fleet_instances')).toBeTruthy()
|
|
386
|
+
expect(screen.queryByText('Rotar')).toBeNull()
|
|
387
|
+
fireEvent.click(screen.getByText('Siguiente'))
|
|
388
|
+
expect(await screen.findByText('Rotar')).toBeTruthy()
|
|
389
|
+
expect(screen.getByText('Conectada automáticamente')).toBeTruthy()
|
|
390
|
+
})
|
|
354
391
|
})
|
|
@@ -41,7 +41,7 @@ import { evaluateVisibleWhen, getVisibleWhen } from '../dynamic-form-schema'
|
|
|
41
41
|
import type { VisibleWhen } from '../types'
|
|
42
42
|
import { useSetupT } from './messages'
|
|
43
43
|
import { StepStatusBadge } from './step-status-badge'
|
|
44
|
-
import { ConnectorBlocks, HelpText } from './connector-blocks'
|
|
44
|
+
import { ConnectorBlocks, CopyValue, HelpText } from './connector-blocks'
|
|
45
45
|
import {
|
|
46
46
|
buildWizardSteps,
|
|
47
47
|
errorMessage,
|
|
@@ -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 =
|
|
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-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-3' data-testid='auto-once'>
|
|
1468
|
+
<CopyValue value={once} label={st('auto.once_label')} />
|
|
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(
|
|
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
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
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
|
)}
|
package/src/setup/messages.ts
CHANGED
|
@@ -114,6 +114,7 @@ export const SETUP_MESSAGES_ES: Dict = {
|
|
|
114
114
|
'auto.needs_action': 'Requiere acción',
|
|
115
115
|
'auto.help': 'La clave la genera y guarda el sistema, cifrada. No hay nada que inventar ni pegar.',
|
|
116
116
|
'auto.rotate': 'Rotar',
|
|
117
|
+
'auto.once_label': 'Clave nueva',
|
|
117
118
|
'auto.generate': 'Generar',
|
|
118
119
|
'auto.show_once': 'Cópiala ahora: no se vuelve a mostrar. La anterior ya no funciona.',
|
|
119
120
|
'auto.rotate_failed': 'No se pudo rotar la clave',
|
|
@@ -283,6 +284,7 @@ export const SETUP_MESSAGES_EN: Dict = {
|
|
|
283
284
|
'auto.needs_action': 'Action required',
|
|
284
285
|
'auto.help': 'The system generates and stores the key, encrypted. Nothing to invent or paste.',
|
|
285
286
|
'auto.rotate': 'Rotate',
|
|
287
|
+
'auto.once_label': 'New key',
|
|
286
288
|
'auto.generate': 'Generate',
|
|
287
289
|
'auto.show_once': 'Copy it now: it is not shown again. The previous one no longer works.',
|
|
288
290
|
'auto.rotate_failed': 'Could not rotate the key',
|