@asteby/metacore-runtime-react 53.9.0 → 53.10.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 +6 -0
- package/dist/setup/addon-config-surface.d.ts.map +1 -1
- package/dist/setup/addon-config-surface.js +76 -4
- package/dist/setup/messages.d.ts.map +1 -1
- package/dist/setup/messages.js +8 -0
- package/package.json +1 -1
- package/src/setup/addon-config-surface.tsx +123 -27
- package/src/setup/messages.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 53.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fd3b129: `AddonConfigSurface`: Guardar siempre disponible y refresco en el sitio. El pie del modal (fuera del scroll) lleva «Guardar» en TODOS los pasos del asistente (antes solo en el último; «Siguiente» queda como acción secundaria) y un estado «Sin cambios / Cambios sin guardar / Guardando… / Guardado» (aria-live). Tras guardar ya no se cierra: recarga en el sitio las credenciales guardadas (secretos en blanco, campos marcados como guardados), los ajustes y vuelve a listar los selects dependientes (series, entorno, régimen), sin perder paso, scroll ni foco; «Cancelar» pasa a «Cerrar» cuando no hay cambios. «Probar conexión» también refresca los selects dependientes tras persistir.
|
|
8
|
+
|
|
3
9
|
## 53.9.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;AASjC,MAAM,WAAW,eAAe;IAC9B,GAAG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,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChF,+BAA+B;IAC/B,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,uCAAuC;IACvC,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;;;;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,+BA+kCzB"}
|
|
@@ -190,6 +190,14 @@ function DynamicConnectorSelect({ field, value, provider, connected, onChange, }
|
|
|
190
190
|
void load();
|
|
191
191
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
192
192
|
}, [connected]);
|
|
193
|
+
// After a save the stored connection changed (series, environment, issuer…):
|
|
194
|
+
// re-list in place so the options are current without leaving the dialog.
|
|
195
|
+
const reloadNonce = form.reloadNonce ?? 0;
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
if (reloadNonce > 0)
|
|
198
|
+
void load(true);
|
|
199
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
200
|
+
}, [reloadNonce]);
|
|
193
201
|
// Scope the options to the kind (`tipo`) the host expects for this field,
|
|
194
202
|
// when the source reports one. The mapping is injected by the host
|
|
195
203
|
// (`expectedOptionKinds`); empty by default, so the SDK stays domain-agnostic.
|
|
@@ -251,6 +259,9 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
251
259
|
// credentials not saved yet (an action tests what is STORED: it saves first).
|
|
252
260
|
const [blockResults, setBlockResults] = useState({});
|
|
253
261
|
const [credDirty, setCredDirty] = useState(false);
|
|
262
|
+
// Bumped after a save (selects re-list) and the «Guardado» footer state.
|
|
263
|
+
const [reloadNonce, setReloadNonce] = useState(0);
|
|
264
|
+
const [justSaved, setJustSaved] = useState(false);
|
|
254
265
|
// Credential keys the backend already holds (non-secret values + secrets_set).
|
|
255
266
|
const [storedKeys, setStoredKeys] = useState(new Set());
|
|
256
267
|
// Credentials that differ between sandbox and production (served by /values) and
|
|
@@ -446,6 +457,49 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
446
457
|
const fallback = humanizeKey(f.key);
|
|
447
458
|
return f.label ? textOrFallback(t(f.label, { defaultValue: fallback }), f.label, fallback) : fallback;
|
|
448
459
|
};
|
|
460
|
+
// Re-reads what the backend now holds after «Guardar» WITHOUT resetting the
|
|
461
|
+
// step, the scroll or the focus: stored credentials (secrets blank again, the
|
|
462
|
+
// fields marked as stored), settings, and the dependent selects.
|
|
463
|
+
const refreshInPlace = async () => {
|
|
464
|
+
try {
|
|
465
|
+
if (canManageIssuer && connector?.provider && credFields.length > 0) {
|
|
466
|
+
const envQuery = envField && envValue ? `?environment=${encodeURIComponent(envValue)}` : '';
|
|
467
|
+
const res = await api.get(`/integrations/${connector.provider}/values${envQuery}`);
|
|
468
|
+
const stored = (res.data?.data?.values ?? {});
|
|
469
|
+
const secretsSet = (res.data?.data?.secrets_set ?? []);
|
|
470
|
+
envScoped.current = new Set((res.data?.data?.env_scoped ?? []));
|
|
471
|
+
if (envField)
|
|
472
|
+
loadedEnv.current = envValue || (stored[envField.key] ?? '');
|
|
473
|
+
setStoredKeys(new Set([...Object.keys(stored).filter((k) => stored[k] !== ''), ...secretsSet]));
|
|
474
|
+
setCredValues((prev) => {
|
|
475
|
+
const next = { ...prev };
|
|
476
|
+
for (const f of credFields) {
|
|
477
|
+
if (isSecretCredential(f))
|
|
478
|
+
next[f.key] = '';
|
|
479
|
+
else if (stored[f.key] != null && stored[f.key] !== '')
|
|
480
|
+
next[f.key] = stored[f.key];
|
|
481
|
+
}
|
|
482
|
+
return next;
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
catch {
|
|
487
|
+
/* keep what is on screen */
|
|
488
|
+
}
|
|
489
|
+
try {
|
|
490
|
+
const branchQuery = target === 'branch' && activeBranch ? `?branch_id=${encodeURIComponent(activeBranchId)}` : '';
|
|
491
|
+
const res = await api.get(`/addons/${addon.addon_key}/settings${branchQuery}`);
|
|
492
|
+
setSettingsValues(res.data?.data || {});
|
|
493
|
+
setOverrides(res.data?.overrides || {});
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
/* keep what is on screen */
|
|
497
|
+
}
|
|
498
|
+
setCredDirty(false);
|
|
499
|
+
setTouched(new Set());
|
|
500
|
+
setCleared(new Set());
|
|
501
|
+
setReloadNonce((n) => n + 1);
|
|
502
|
+
};
|
|
449
503
|
const saveMutation = useMutation({
|
|
450
504
|
mutationFn: async () => {
|
|
451
505
|
if (connector && canManageIssuer) {
|
|
@@ -486,9 +540,10 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
486
540
|
onSuccess: () => {
|
|
487
541
|
setFormError(null);
|
|
488
542
|
setFieldErrors({});
|
|
489
|
-
setCredDirty(false);
|
|
490
543
|
notify.success(st('installed_addons.config_saved'));
|
|
491
|
-
|
|
544
|
+
// Stay open: reload what was saved in place (no scroll/focus loss) so the
|
|
545
|
+
// operator sees the stored state and the dependent selects are current.
|
|
546
|
+
void refreshInPlace().finally(() => setJustSaved(true));
|
|
492
547
|
onSaved?.();
|
|
493
548
|
},
|
|
494
549
|
onError: (err) => {
|
|
@@ -576,6 +631,7 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
576
631
|
}
|
|
577
632
|
await api.post(`/integrations/${connector.provider}`, payload);
|
|
578
633
|
setCredDirty(false);
|
|
634
|
+
setReloadNonce((n) => n + 1);
|
|
579
635
|
onSaved?.();
|
|
580
636
|
return null;
|
|
581
637
|
};
|
|
@@ -759,10 +815,26 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
759
815
|
setFormError(null);
|
|
760
816
|
goToStep(stepIdx + 1);
|
|
761
817
|
};
|
|
818
|
+
const dirty = credDirty || touched.size > 0 || cleared.size > 0;
|
|
819
|
+
useEffect(() => {
|
|
820
|
+
if (dirty)
|
|
821
|
+
setJustSaved(false);
|
|
822
|
+
}, [dirty]);
|
|
823
|
+
useEffect(() => {
|
|
824
|
+
if (open)
|
|
825
|
+
setJustSaved(false);
|
|
826
|
+
}, [open]);
|
|
827
|
+
const saveStatus = saveMutation.isPending
|
|
828
|
+
? 'saving'
|
|
829
|
+
: dirty
|
|
830
|
+
? 'dirty'
|
|
831
|
+
: justSaved
|
|
832
|
+
? 'saved'
|
|
833
|
+
: 'clean';
|
|
762
834
|
const hasAnyBlocks = layoutSections.some((s) => (s.blocks?.length ?? 0) > 0) || extraBlocks.length > 0;
|
|
763
835
|
const nothingToConfigure = !hasCredentials && !hasSettings && !isOAuth && !hasAnyBlocks;
|
|
764
836
|
const nothingToSave = !hasCredentials && !hasSettings;
|
|
765
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: 'flex max-h-[85vh] flex-col max-sm:max-h-[calc(100dvh-1rem)] max-sm:gap-3 max-sm:p-4', children: _jsxs(ConnectorFormStateContext.Provider, { value: { fields: credFields, errors: fieldErrors, idPrefix, client: api, expectedOptionKinds }, children: [_jsxs(DialogHeader, { className: 'shrink-0 pe-8 text-start', children: [_jsx(DialogTitle, { className: 'leading-snug', children: st('installed_addons.configure_title', { name: displayName ?? addon.manifest.display_name ?? addon.manifest.name }) }), _jsx(DialogDescription, { children: st('installed_addons.configure_description') })] }), _jsx("div", { className: '-mr-2 flex min-h-0 flex-col gap-6 overflow-y-auto py-2 pr-2', children: loading ? (_jsx("div", { className: 'flex justify-center py-8', children: _jsx(Loader2, { className: 'h-5 w-5 animate-spin text-muted-foreground' }) })) : useStepper ? (_jsxs("div", { className: 'flex flex-col gap-5', children: [_jsxs("nav", { "aria-label": st('wizard.steps'), className: 'flex flex-col gap-2', children: [_jsx("ol", { className: 'flex items-center', children: wizardSteps.map((s, i) => {
|
|
837
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: 'flex max-h-[85vh] flex-col max-sm:max-h-[calc(100dvh-1rem)] max-sm:gap-3 max-sm:p-4', children: _jsxs(ConnectorFormStateContext.Provider, { value: { fields: credFields, errors: fieldErrors, idPrefix, client: api, expectedOptionKinds, reloadNonce }, children: [_jsxs(DialogHeader, { className: 'shrink-0 pe-8 text-start', children: [_jsx(DialogTitle, { className: 'leading-snug', children: st('installed_addons.configure_title', { name: displayName ?? addon.manifest.display_name ?? addon.manifest.name }) }), _jsx(DialogDescription, { children: st('installed_addons.configure_description') })] }), _jsx("div", { className: '-mr-2 flex min-h-0 flex-col gap-6 overflow-y-auto py-2 pr-2', children: loading ? (_jsx("div", { className: 'flex justify-center py-8', children: _jsx(Loader2, { className: 'h-5 w-5 animate-spin text-muted-foreground' }) })) : useStepper ? (_jsxs("div", { className: 'flex flex-col gap-5', children: [_jsxs("nav", { "aria-label": st('wizard.steps'), className: 'flex flex-col gap-2', children: [_jsx("ol", { className: 'flex items-center', children: wizardSteps.map((s, i) => {
|
|
766
838
|
const status = stepState(i);
|
|
767
839
|
const active = i === stepIdx;
|
|
768
840
|
const title = t(s.title ?? '', { defaultValue: humanizeKey(s.title) });
|
|
@@ -787,5 +859,5 @@ export function AddonConfigSurface({ addon, connector, open, onOpenChange, onSav
|
|
|
787
859
|
if (fields.length === 0 && (sec.blocks?.length ?? 0) === 0)
|
|
788
860
|
return null;
|
|
789
861
|
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));
|
|
790
|
-
})) : (_jsxs(_Fragment, { children: [requiredFields.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))), advancedFields.length > 0 && (_jsxs("details", { className: 'rounded-md border border-border/60 px-3 py-2', open: advancedFields.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: advancedFields.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: '
|
|
862
|
+
})) : (_jsxs(_Fragment, { children: [requiredFields.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))), advancedFields.length > 0 && (_jsxs("details", { className: 'rounded-md border border-border/60 px-3 py-2', open: advancedFields.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: advancedFields.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')] })] })] })) })] }) }) }));
|
|
791
863
|
}
|
|
@@ -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,IA2J/B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,IAwJ/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
|
@@ -152,6 +152,10 @@ export const SETUP_MESSAGES_ES = {
|
|
|
152
152
|
'common.cancel': 'Cancelar',
|
|
153
153
|
'common.save': 'Guardar',
|
|
154
154
|
'common.close': 'Cerrar',
|
|
155
|
+
'form.status_clean': 'Sin cambios',
|
|
156
|
+
'form.status_dirty': 'Cambios sin guardar',
|
|
157
|
+
'form.status_saved': 'Guardado',
|
|
158
|
+
'form.status_saving': 'Guardando…',
|
|
155
159
|
};
|
|
156
160
|
export const SETUP_MESSAGES_EN = {
|
|
157
161
|
'status.pending': 'Pending',
|
|
@@ -300,6 +304,10 @@ export const SETUP_MESSAGES_EN = {
|
|
|
300
304
|
'common.cancel': 'Cancel',
|
|
301
305
|
'common.save': 'Save',
|
|
302
306
|
'common.close': 'Close',
|
|
307
|
+
'form.status_clean': 'No changes',
|
|
308
|
+
'form.status_dirty': 'Unsaved changes',
|
|
309
|
+
'form.status_saved': 'Saved',
|
|
310
|
+
'form.status_saving': 'Saving…',
|
|
303
311
|
};
|
|
304
312
|
function interpolate(s, vars) {
|
|
305
313
|
if (!vars)
|
package/package.json
CHANGED
|
@@ -210,6 +210,8 @@ interface ConnectorFormState {
|
|
|
210
210
|
client?: ApiClient
|
|
211
211
|
/** Host-injected: credential key -> expected option `tipo`. */
|
|
212
212
|
expectedOptionKinds: Record<string, string>
|
|
213
|
+
/** Bumped after a save: dependent selects re-list their options in place. */
|
|
214
|
+
reloadNonce?: number
|
|
213
215
|
}
|
|
214
216
|
const ConnectorFormStateContext = createContext<ConnectorFormState>({
|
|
215
217
|
fields: [],
|
|
@@ -513,6 +515,14 @@ function DynamicConnectorSelect({
|
|
|
513
515
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
514
516
|
}, [connected])
|
|
515
517
|
|
|
518
|
+
// After a save the stored connection changed (series, environment, issuer…):
|
|
519
|
+
// re-list in place so the options are current without leaving the dialog.
|
|
520
|
+
const reloadNonce = form.reloadNonce ?? 0
|
|
521
|
+
useEffect(() => {
|
|
522
|
+
if (reloadNonce > 0) void load(true)
|
|
523
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
524
|
+
}, [reloadNonce])
|
|
525
|
+
|
|
516
526
|
// Scope the options to the kind (`tipo`) the host expects for this field,
|
|
517
527
|
// when the source reports one. The mapping is injected by the host
|
|
518
528
|
// (`expectedOptionKinds`); empty by default, so the SDK stays domain-agnostic.
|
|
@@ -637,6 +647,9 @@ export function AddonConfigSurface({
|
|
|
637
647
|
// credentials not saved yet (an action tests what is STORED: it saves first).
|
|
638
648
|
const [blockResults, setBlockResults] = useState<Record<string, BlockResult | undefined>>({})
|
|
639
649
|
const [credDirty, setCredDirty] = useState(false)
|
|
650
|
+
// Bumped after a save (selects re-list) and the «Guardado» footer state.
|
|
651
|
+
const [reloadNonce, setReloadNonce] = useState(0)
|
|
652
|
+
const [justSaved, setJustSaved] = useState(false)
|
|
640
653
|
// Credential keys the backend already holds (non-secret values + secrets_set).
|
|
641
654
|
const [storedKeys, setStoredKeys] = useState<Set<string>>(new Set())
|
|
642
655
|
// Credentials that differ between sandbox and production (served by /values) and
|
|
@@ -831,6 +844,46 @@ export function AddonConfigSurface({
|
|
|
831
844
|
return f.label ? textOrFallback(t(f.label, { defaultValue: fallback }), f.label, fallback) : fallback
|
|
832
845
|
}
|
|
833
846
|
|
|
847
|
+
// Re-reads what the backend now holds after «Guardar» WITHOUT resetting the
|
|
848
|
+
// step, the scroll or the focus: stored credentials (secrets blank again, the
|
|
849
|
+
// fields marked as stored), settings, and the dependent selects.
|
|
850
|
+
const refreshInPlace = async () => {
|
|
851
|
+
try {
|
|
852
|
+
if (canManageIssuer && connector?.provider && credFields.length > 0) {
|
|
853
|
+
const envQuery = envField && envValue ? `?environment=${encodeURIComponent(envValue)}` : ''
|
|
854
|
+
const res = await api.get(`/integrations/${connector.provider}/values${envQuery}`)
|
|
855
|
+
const stored = (res.data?.data?.values ?? {}) as Record<string, string>
|
|
856
|
+
const secretsSet = (res.data?.data?.secrets_set ?? []) as string[]
|
|
857
|
+
envScoped.current = new Set((res.data?.data?.env_scoped ?? []) as string[])
|
|
858
|
+
if (envField) loadedEnv.current = envValue || (stored[envField.key] ?? '')
|
|
859
|
+
setStoredKeys(new Set([...Object.keys(stored).filter((k) => stored[k] !== ''), ...secretsSet]))
|
|
860
|
+
setCredValues((prev) => {
|
|
861
|
+
const next = { ...prev }
|
|
862
|
+
for (const f of credFields) {
|
|
863
|
+
if (isSecretCredential(f)) next[f.key] = ''
|
|
864
|
+
else if (stored[f.key] != null && stored[f.key] !== '') next[f.key] = stored[f.key]
|
|
865
|
+
}
|
|
866
|
+
return next
|
|
867
|
+
})
|
|
868
|
+
}
|
|
869
|
+
} catch {
|
|
870
|
+
/* keep what is on screen */
|
|
871
|
+
}
|
|
872
|
+
try {
|
|
873
|
+
const branchQuery =
|
|
874
|
+
target === 'branch' && activeBranch ? `?branch_id=${encodeURIComponent(activeBranchId)}` : ''
|
|
875
|
+
const res = await api.get(`/addons/${addon.addon_key}/settings${branchQuery}`)
|
|
876
|
+
setSettingsValues(res.data?.data || {})
|
|
877
|
+
setOverrides(res.data?.overrides || {})
|
|
878
|
+
} catch {
|
|
879
|
+
/* keep what is on screen */
|
|
880
|
+
}
|
|
881
|
+
setCredDirty(false)
|
|
882
|
+
setTouched(new Set())
|
|
883
|
+
setCleared(new Set())
|
|
884
|
+
setReloadNonce((n) => n + 1)
|
|
885
|
+
}
|
|
886
|
+
|
|
834
887
|
const saveMutation = useMutation({
|
|
835
888
|
mutationFn: async () => {
|
|
836
889
|
if (connector && canManageIssuer) {
|
|
@@ -869,9 +922,10 @@ export function AddonConfigSurface({
|
|
|
869
922
|
onSuccess: () => {
|
|
870
923
|
setFormError(null)
|
|
871
924
|
setFieldErrors({})
|
|
872
|
-
setCredDirty(false)
|
|
873
925
|
notify.success(st('installed_addons.config_saved'))
|
|
874
|
-
|
|
926
|
+
// Stay open: reload what was saved in place (no scroll/focus loss) so the
|
|
927
|
+
// operator sees the stored state and the dependent selects are current.
|
|
928
|
+
void refreshInPlace().finally(() => setJustSaved(true))
|
|
875
929
|
onSaved?.()
|
|
876
930
|
},
|
|
877
931
|
onError: (err: unknown) => {
|
|
@@ -960,6 +1014,7 @@ export function AddonConfigSurface({
|
|
|
960
1014
|
}
|
|
961
1015
|
await api.post(`/integrations/${connector.provider}`, payload)
|
|
962
1016
|
setCredDirty(false)
|
|
1017
|
+
setReloadNonce((n) => n + 1)
|
|
963
1018
|
onSaved?.()
|
|
964
1019
|
return null
|
|
965
1020
|
}
|
|
@@ -1324,6 +1379,21 @@ export function AddonConfigSurface({
|
|
|
1324
1379
|
goToStep(stepIdx + 1)
|
|
1325
1380
|
}
|
|
1326
1381
|
|
|
1382
|
+
const dirty = credDirty || touched.size > 0 || cleared.size > 0
|
|
1383
|
+
useEffect(() => {
|
|
1384
|
+
if (dirty) setJustSaved(false)
|
|
1385
|
+
}, [dirty])
|
|
1386
|
+
useEffect(() => {
|
|
1387
|
+
if (open) setJustSaved(false)
|
|
1388
|
+
}, [open])
|
|
1389
|
+
const saveStatus: 'saving' | 'dirty' | 'saved' | 'clean' = saveMutation.isPending
|
|
1390
|
+
? 'saving'
|
|
1391
|
+
: dirty
|
|
1392
|
+
? 'dirty'
|
|
1393
|
+
: justSaved
|
|
1394
|
+
? 'saved'
|
|
1395
|
+
: 'clean'
|
|
1396
|
+
|
|
1327
1397
|
const hasAnyBlocks = layoutSections.some((s) => (s.blocks?.length ?? 0) > 0) || extraBlocks.length > 0
|
|
1328
1398
|
const nothingToConfigure = !hasCredentials && !hasSettings && !isOAuth && !hasAnyBlocks
|
|
1329
1399
|
const nothingToSave = !hasCredentials && !hasSettings
|
|
@@ -1332,7 +1402,7 @@ export function AddonConfigSurface({
|
|
|
1332
1402
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
1333
1403
|
<DialogContent className='flex max-h-[85vh] flex-col max-sm:max-h-[calc(100dvh-1rem)] max-sm:gap-3 max-sm:p-4'>
|
|
1334
1404
|
<ConnectorFormStateContext.Provider
|
|
1335
|
-
value={{ fields: credFields, errors: fieldErrors, idPrefix, client: api, expectedOptionKinds }}
|
|
1405
|
+
value={{ fields: credFields, errors: fieldErrors, idPrefix, client: api, expectedOptionKinds, reloadNonce }}
|
|
1336
1406
|
>
|
|
1337
1407
|
<DialogHeader className='shrink-0 pe-8 text-start'>
|
|
1338
1408
|
<DialogTitle className='leading-snug'>
|
|
@@ -1576,40 +1646,66 @@ export function AddonConfigSurface({
|
|
|
1576
1646
|
</div>
|
|
1577
1647
|
) : null}
|
|
1578
1648
|
|
|
1579
|
-
{/* Footer:
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
Verifications live inside the steps, not here. */}
|
|
1649
|
+
{/* Footer: ALWAYS visible (outside the scroll) and Guardar is ALWAYS in
|
|
1650
|
+
it, on every step and at any scroll position. Left: the save state
|
|
1651
|
+
(aria-live). Right: Cancelar/Cerrar, Atrás, Siguiente (steps) and the
|
|
1652
|
+
primary Guardar. Verifications live inside the steps, not here. */}
|
|
1583
1653
|
<DialogFooter
|
|
1584
1654
|
data-wizard-footer=''
|
|
1585
|
-
className='
|
|
1655
|
+
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'
|
|
1586
1656
|
>
|
|
1587
1657
|
{nothingToSave ? (
|
|
1588
|
-
<Button className='
|
|
1658
|
+
<Button className='h-11 w-full sm:ml-auto sm:h-9 sm:w-auto' onClick={() => onOpenChange(false)}>
|
|
1589
1659
|
{st('common.close')}
|
|
1590
1660
|
</Button>
|
|
1591
1661
|
) : (
|
|
1592
1662
|
<>
|
|
1593
|
-
<
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1663
|
+
<p
|
|
1664
|
+
role='status'
|
|
1665
|
+
aria-live='polite'
|
|
1666
|
+
data-save-status={saveStatus}
|
|
1667
|
+
className={cn(
|
|
1668
|
+
'flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs',
|
|
1669
|
+
saveStatus === 'dirty' ? 'font-medium text-amber-600 dark:text-amber-400' : 'text-muted-foreground',
|
|
1670
|
+
saveStatus === 'saved' && 'text-emerald-600 dark:text-emerald-400',
|
|
1671
|
+
)}
|
|
1597
1672
|
>
|
|
1598
|
-
{
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1673
|
+
{saveStatus === 'saving' ? (
|
|
1674
|
+
<Loader2 className='h-3.5 w-3.5 animate-spin' />
|
|
1675
|
+
) : saveStatus === 'saved' ? (
|
|
1676
|
+
<Check className='h-3.5 w-3.5' />
|
|
1677
|
+
) : (
|
|
1678
|
+
<span
|
|
1679
|
+
aria-hidden
|
|
1680
|
+
className={cn('h-2 w-2 rounded-full', saveStatus === 'dirty' ? 'bg-amber-500' : 'bg-muted-foreground/40')}
|
|
1681
|
+
/>
|
|
1682
|
+
)}
|
|
1683
|
+
{st(`form.status_${saveStatus}`)}
|
|
1684
|
+
</p>
|
|
1685
|
+
<div className='flex flex-wrap items-center gap-2 sm:ml-auto sm:flex-nowrap sm:justify-end'>
|
|
1686
|
+
<Button variant='ghost' className='h-11 px-3 sm:h-9' onClick={() => onOpenChange(false)}>
|
|
1687
|
+
{dirty ? st('common.cancel') : st('common.close')}
|
|
1604
1688
|
</Button>
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1689
|
+
{useStepper && stepIdx > 0 && (
|
|
1690
|
+
<Button variant='outline' className='h-11 sm:h-9' onClick={() => goToStep(Math.max(0, stepIdx - 1))}>
|
|
1691
|
+
{st('common.back')}
|
|
1692
|
+
</Button>
|
|
1693
|
+
)}
|
|
1694
|
+
{useStepper && !isLastStep && (
|
|
1695
|
+
<Button variant='outline' className='h-11 sm:h-9' onClick={handleNext}>
|
|
1696
|
+
{st('common.next')}
|
|
1697
|
+
</Button>
|
|
1698
|
+
)}
|
|
1699
|
+
<Button
|
|
1700
|
+
className='h-11 flex-1 sm:h-9 sm:flex-none'
|
|
1701
|
+
onClick={handleSave}
|
|
1702
|
+
disabled={saveMutation.isPending || loading}
|
|
1703
|
+
data-testid='config-save'
|
|
1704
|
+
>
|
|
1705
|
+
{saveMutation.isPending && <Loader2 className='mr-2 h-4 w-4 animate-spin' />}
|
|
1706
|
+
{st('common.save')}
|
|
1707
|
+
</Button>
|
|
1708
|
+
</div>
|
|
1613
1709
|
</>
|
|
1614
1710
|
)}
|
|
1615
1711
|
</DialogFooter>
|
package/src/setup/messages.ts
CHANGED
|
@@ -157,6 +157,10 @@ export const SETUP_MESSAGES_ES: Dict = {
|
|
|
157
157
|
'common.cancel': 'Cancelar',
|
|
158
158
|
'common.save': 'Guardar',
|
|
159
159
|
'common.close': 'Cerrar',
|
|
160
|
+
'form.status_clean': 'Sin cambios',
|
|
161
|
+
'form.status_dirty': 'Cambios sin guardar',
|
|
162
|
+
'form.status_saved': 'Guardado',
|
|
163
|
+
'form.status_saving': 'Guardando…',
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
export const SETUP_MESSAGES_EN: Dict = {
|
|
@@ -307,6 +311,10 @@ export const SETUP_MESSAGES_EN: Dict = {
|
|
|
307
311
|
'common.cancel': 'Cancel',
|
|
308
312
|
'common.save': 'Save',
|
|
309
313
|
'common.close': 'Close',
|
|
314
|
+
'form.status_clean': 'No changes',
|
|
315
|
+
'form.status_dirty': 'Unsaved changes',
|
|
316
|
+
'form.status_saved': 'Saved',
|
|
317
|
+
'form.status_saving': 'Saving…',
|
|
310
318
|
}
|
|
311
319
|
|
|
312
320
|
export type TFn = (key: string, vars?: Record<string, unknown>) => string
|