@asteby/metacore-runtime-react 53.4.1 → 53.6.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/README.md +73 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/setup/addon-config-surface.d.ts +119 -0
- package/dist/setup/addon-config-surface.d.ts.map +1 -0
- package/dist/setup/addon-config-surface.js +662 -0
- package/dist/setup/connector-blocks-model.d.ts +79 -0
- package/dist/setup/connector-blocks-model.d.ts.map +1 -0
- package/dist/setup/connector-blocks-model.js +96 -0
- package/dist/setup/connector-blocks.d.ts +48 -0
- package/dist/setup/connector-blocks.d.ts.map +1 -0
- package/dist/setup/connector-blocks.js +132 -0
- package/dist/setup/connector-form-model.d.ts +40 -0
- package/dist/setup/connector-form-model.d.ts.map +1 -0
- package/dist/setup/connector-form-model.js +76 -0
- package/dist/setup/flow-model.d.ts +49 -0
- package/dist/setup/flow-model.d.ts.map +1 -0
- package/dist/setup/flow-model.js +124 -0
- package/dist/setup/health-card.d.ts +25 -0
- package/dist/setup/health-card.d.ts.map +1 -0
- package/dist/setup/health-card.js +21 -0
- package/dist/setup/index.d.ts +13 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +15 -0
- package/dist/setup/messages.d.ts +15 -0
- package/dist/setup/messages.d.ts.map +1 -0
- package/dist/setup/messages.js +320 -0
- package/dist/setup/records-table.d.ts +24 -0
- package/dist/setup/records-table.d.ts.map +1 -0
- package/dist/setup/records-table.js +80 -0
- package/dist/setup/setup-flow.d.ts +30 -0
- package/dist/setup/setup-flow.d.ts.map +1 -0
- package/dist/setup/setup-flow.js +277 -0
- package/dist/setup/setup-form-step.d.ts +20 -0
- package/dist/setup/setup-form-step.d.ts.map +1 -0
- package/dist/setup/setup-form-step.js +173 -0
- package/dist/setup/step-status-badge.d.ts +12 -0
- package/dist/setup/step-status-badge.d.ts.map +1 -0
- package/dist/setup/step-status-badge.js +21 -0
- package/dist/setup/tone.d.ts +8 -0
- package/dist/setup/tone.d.ts.map +1 -0
- package/dist/setup/tone.js +33 -0
- package/dist/setup/types.d.ts +130 -0
- package/dist/setup/types.d.ts.map +1 -0
- package/dist/setup/types.js +1 -0
- package/package.json +9 -5
- package/src/__tests__/addon-config-surface.test.tsx +260 -0
- package/src/__tests__/connector-blocks.test.tsx +302 -0
- package/src/__tests__/setup-components.test.tsx +147 -0
- package/src/__tests__/setup-flow-model.test.ts +117 -0
- package/src/__tests__/setup-flow.test.tsx +424 -0
- package/src/index.ts +29 -0
- package/src/setup/addon-config-surface.tsx +1426 -0
- package/src/setup/connector-blocks-model.ts +163 -0
- package/src/setup/connector-blocks.tsx +341 -0
- package/src/setup/connector-form-model.ts +115 -0
- package/src/setup/flow-model.ts +156 -0
- package/src/setup/health-card.tsx +131 -0
- package/src/setup/index.ts +35 -0
- package/src/setup/messages.ts +334 -0
- package/src/setup/records-table.tsx +186 -0
- package/src/setup/setup-flow.tsx +562 -0
- package/src/setup/setup-form-step.tsx +342 -0
- package/src/setup/step-status-badge.tsx +47 -0
- package/src/setup/tone.ts +44 -0
- package/src/setup/types.ts +147 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const STEP_STATUSES = ['pending', 'running', 'ok', 'warn', 'error', 'blocked'];
|
|
2
|
+
/** Accepts the array or the by-key map the server may send. */
|
|
3
|
+
export function normalizeState(raw) {
|
|
4
|
+
const out = {};
|
|
5
|
+
const steps = raw?.steps;
|
|
6
|
+
if (!steps)
|
|
7
|
+
return out;
|
|
8
|
+
if (Array.isArray(steps)) {
|
|
9
|
+
for (const s of steps)
|
|
10
|
+
if (s?.key)
|
|
11
|
+
out[s.key] = s;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
for (const [k, s] of Object.entries(steps))
|
|
15
|
+
if (s)
|
|
16
|
+
out[k] = { ...s, key: s.key ?? k };
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
/** A step counts as satisfied (unblocks dependants) when ok, warn or skipped. */
|
|
21
|
+
export function isSatisfied(st) {
|
|
22
|
+
if (!st)
|
|
23
|
+
return false;
|
|
24
|
+
return st.status === 'ok' || st.status === 'warn' || st.skipped === true;
|
|
25
|
+
}
|
|
26
|
+
/** Steps this one waits on that are not satisfied yet. */
|
|
27
|
+
export function unmetDependencies(def, states) {
|
|
28
|
+
return (def.depends_on ?? []).filter((k) => !isSatisfied(states[k]));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Status shown for a step: the server's, except that a step whose
|
|
32
|
+
* dependencies are unmet is `blocked` (unless it is already running/ok, which
|
|
33
|
+
* the server decides). A skipped step reads as `ok`.
|
|
34
|
+
*/
|
|
35
|
+
export function effectiveStatus(def, states) {
|
|
36
|
+
const st = states[def.key];
|
|
37
|
+
if (st?.skipped)
|
|
38
|
+
return 'ok';
|
|
39
|
+
const own = st?.status ?? 'pending';
|
|
40
|
+
if (own === 'ok' || own === 'running')
|
|
41
|
+
return own;
|
|
42
|
+
if (unmetDependencies(def, states).length > 0)
|
|
43
|
+
return 'blocked';
|
|
44
|
+
return own === 'blocked' ? 'pending' : own;
|
|
45
|
+
}
|
|
46
|
+
/** First step that needs the person: not satisfied and not blocked; else the last. */
|
|
47
|
+
export function pickActiveStep(defs, states) {
|
|
48
|
+
if (defs.length === 0)
|
|
49
|
+
return undefined;
|
|
50
|
+
const open = defs.find((d) => {
|
|
51
|
+
const eff = effectiveStatus(d, states);
|
|
52
|
+
return eff !== 'blocked' && !isSatisfied(states[d.key]);
|
|
53
|
+
});
|
|
54
|
+
return (open ?? defs[defs.length - 1]).key;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Progress over the REQUIRED steps (optional ones do not hold completion
|
|
58
|
+
* back, but count as done when they are). The flow is complete when every
|
|
59
|
+
* required step is satisfied; an error step is never satisfied.
|
|
60
|
+
*/
|
|
61
|
+
export function flowProgress(defs, states, serverCompleted) {
|
|
62
|
+
const required = defs.filter((d) => !d.optional);
|
|
63
|
+
const total = required.length;
|
|
64
|
+
const done = required.filter((d) => isSatisfied(states[d.key])).length;
|
|
65
|
+
const complete = serverCompleted === true || (total > 0 && done === total);
|
|
66
|
+
const shown = serverCompleted === true ? total : done;
|
|
67
|
+
return {
|
|
68
|
+
done: shown,
|
|
69
|
+
total,
|
|
70
|
+
percent: total === 0 ? 100 : Math.round((shown / total) * 100),
|
|
71
|
+
complete,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Delay before the next poll. Without a hint: exponential from `baseMs`
|
|
76
|
+
* (2s, 3.2s, 5.1s…) capped at `maxMs` (30s). A server `retry_after_s` wins,
|
|
77
|
+
* but never below 1s nor above `maxRetryAfterMs` (5 min).
|
|
78
|
+
*/
|
|
79
|
+
export function nextPollDelayMs(attempt, retryAfterS, opts = {}) {
|
|
80
|
+
const { baseMs = 2000, factor = 1.6, maxMs = 30000, maxRetryAfterMs = 300000 } = opts;
|
|
81
|
+
if (typeof retryAfterS === 'number' && Number.isFinite(retryAfterS) && retryAfterS > 0) {
|
|
82
|
+
return Math.min(Math.max(retryAfterS * 1000, 1000), maxRetryAfterMs);
|
|
83
|
+
}
|
|
84
|
+
const n = Math.max(0, Math.floor(attempt));
|
|
85
|
+
return Math.min(Math.round(baseMs * Math.pow(factor, n)), maxMs);
|
|
86
|
+
}
|
|
87
|
+
/** Only http(s) and app-relative paths may be opened from a `fix.url`. */
|
|
88
|
+
export function safeUrl(url) {
|
|
89
|
+
if (!url)
|
|
90
|
+
return null;
|
|
91
|
+
const u = url.trim();
|
|
92
|
+
// Browsers strip tabs/newlines and treat `\` as `/`, so `/\evil.com` or
|
|
93
|
+
// `/<TAB>/evil.com` resolve to another host: reject control chars and
|
|
94
|
+
// backslashes outright, then require the resolved origin to be ours.
|
|
95
|
+
// eslint-disable-next-line no-control-regex
|
|
96
|
+
if (/[\\\u0000-\u001f\u007f]/.test(u))
|
|
97
|
+
return null;
|
|
98
|
+
if (u.startsWith('/')) {
|
|
99
|
+
if (u.startsWith('//'))
|
|
100
|
+
return null;
|
|
101
|
+
const origin = typeof location !== 'undefined' && location.origin ? location.origin : 'http://localhost';
|
|
102
|
+
try {
|
|
103
|
+
return new URL(u, origin).origin === origin ? u : null;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const p = new URL(u);
|
|
111
|
+
return p.protocol === 'https:' || p.protocol === 'http:' ? p.toString() : null;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Merges a runStep/skipStep answer (step or whole flow) into the local map. */
|
|
118
|
+
export function mergeAnswer(current, key, answer) {
|
|
119
|
+
if (!answer)
|
|
120
|
+
return { next: current, needsRefetch: true };
|
|
121
|
+
if ('steps' in answer)
|
|
122
|
+
return { next: normalizeState(answer), needsRefetch: false };
|
|
123
|
+
return { next: { ...current, [key]: { ...answer, key: answer.key ?? key } }, needsRefetch: false };
|
|
124
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HealthIssue, HealthMetric, HealthStatus, SetupFix } from './types';
|
|
2
|
+
export interface HealthCardProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
status: HealthStatus;
|
|
5
|
+
/** One line under the status. */
|
|
6
|
+
summary?: string;
|
|
7
|
+
metrics?: HealthMetric[];
|
|
8
|
+
issues?: HealthIssue[];
|
|
9
|
+
/** ISO date or preformatted text shown as "Checked …". */
|
|
10
|
+
checkedAt?: string;
|
|
11
|
+
/** Setup progress, for a card in the installed-addons list. */
|
|
12
|
+
progress?: {
|
|
13
|
+
done: number;
|
|
14
|
+
total: number;
|
|
15
|
+
};
|
|
16
|
+
onFix?: (fix: SetupFix, issue: HealthIssue) => void;
|
|
17
|
+
onRefresh?: () => void;
|
|
18
|
+
refreshing?: boolean;
|
|
19
|
+
/** Shows "Continue setup" (resumes the setup page). */
|
|
20
|
+
onContinue?: () => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Status + metrics (with tone) + issues (with fix) of an addon's health probe. */
|
|
24
|
+
export declare function HealthCard({ title, status, summary, metrics, issues, checkedAt, progress, onFix, onRefresh, refreshing, onContinue, className, }: HealthCardProps): import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=health-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-card.d.ts","sourceRoot":"","sources":["../../src/setup/health-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAsB,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAOpG,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;IACpB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,GACZ,EAAE,eAAe,+BAqFjB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle, CheckCircle2, HelpCircle, Info, RefreshCw, XCircle } from 'lucide-react';
|
|
3
|
+
import { Button } from '@asteby/metacore-ui/primitives';
|
|
4
|
+
import { cn } from '@asteby/metacore-ui/lib';
|
|
5
|
+
import { useSetupT } from './messages';
|
|
6
|
+
import { TONE_BADGE, TONE_TEXT, metricTone } from './tone';
|
|
7
|
+
const STATUS_TONE = { ok: 'good', warn: 'warn', error: 'bad', unknown: 'neutral' };
|
|
8
|
+
const STATUS_ICON = { ok: CheckCircle2, warn: AlertTriangle, error: XCircle, unknown: HelpCircle };
|
|
9
|
+
const SEVERITY_ICON = { info: Info, warn: AlertTriangle, error: XCircle };
|
|
10
|
+
const SEVERITY_TONE = { info: 'info', warn: 'warn', error: 'bad' };
|
|
11
|
+
/** Status + metrics (with tone) + issues (with fix) of an addon's health probe. */
|
|
12
|
+
export function HealthCard({ title, status, summary, metrics, issues, checkedAt, progress, onFix, onRefresh, refreshing, onContinue, className, }) {
|
|
13
|
+
const t = useSetupT();
|
|
14
|
+
const known = status in STATUS_TONE ? status : 'unknown';
|
|
15
|
+
const Icon = STATUS_ICON[known];
|
|
16
|
+
const pct = progress && progress.total > 0 ? Math.round((progress.done / progress.total) * 100) : null;
|
|
17
|
+
return (_jsxs("section", { className: cn('flex flex-col gap-4 rounded-lg border bg-card p-4 text-card-foreground', className), "aria-label": title ?? t('health.metrics'), children: [_jsxs("header", { className: 'flex flex-wrap items-start justify-between gap-3', children: [_jsxs("div", { className: 'min-w-0', children: [title ? _jsx("h3", { className: 'truncate text-sm font-semibold', children: title }) : null, _jsxs("div", { className: 'flex items-center gap-2 pt-1', children: [_jsxs("span", { "data-health-status": known, className: cn('inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium', TONE_BADGE[STATUS_TONE[known]]), children: [_jsx(Icon, { className: 'h-3.5 w-3.5', "aria-hidden": 'true' }), t(`health.status.${known}`)] }), checkedAt ? _jsx("span", { className: 'text-xs text-muted-foreground', children: t('health.checked_at', { when: checkedAt }) }) : null] }), summary ? _jsx("p", { className: 'pt-2 text-sm text-muted-foreground', children: summary }) : null] }), _jsxs("div", { className: 'flex items-center gap-2', children: [onRefresh ? (_jsxs(Button, { type: 'button', variant: 'outline', size: 'sm', onClick: onRefresh, disabled: refreshing, className: 'gap-2', children: [_jsx(RefreshCw, { className: cn('h-3.5 w-3.5', refreshing && 'animate-spin motion-reduce:animate-none'), "aria-hidden": 'true' }), t('health.refresh')] })) : null, onContinue ? (_jsx(Button, { type: 'button', size: 'sm', onClick: onContinue, children: t('health.continue') })) : null] })] }), pct !== null && progress ? (_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx("div", { role: 'progressbar', "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": pct, "aria-label": t('flow.progress'), className: 'h-1.5 w-full overflow-hidden rounded-full bg-muted', children: _jsx("div", { className: 'h-full rounded-full bg-primary transition-all motion-reduce:transition-none', style: { width: `${pct}%` } }) }), _jsx("span", { className: 'text-xs text-muted-foreground', children: t('health.progress', { done: progress.done, total: progress.total }) })] })) : null, metrics && metrics.length > 0 ? (_jsx("dl", { className: 'grid grid-cols-2 gap-3 sm:grid-cols-3', children: metrics.map((m) => (_jsxs("div", { className: 'min-w-0 rounded-md border px-3 py-2', "data-metric-tone": metricTone(m.tone), children: [_jsx("dt", { className: 'truncate text-xs text-muted-foreground', children: m.label }), _jsxs("dd", { className: cn('truncate text-lg font-semibold tabular-nums', TONE_TEXT[metricTone(m.tone)]), children: [m.value, m.unit ? _jsx("span", { className: 'pl-1 text-xs font-normal text-muted-foreground', children: m.unit }) : null] }), m.hint ? _jsx("p", { className: 'truncate text-xs text-muted-foreground', children: m.hint }) : null] }, m.key))) })) : null, issues && issues.length > 0 ? (_jsx("ul", { className: 'flex flex-col gap-2', "aria-label": t('health.issues'), children: issues.map((is, i) => {
|
|
18
|
+
const SevIcon = SEVERITY_ICON[is.severity] ?? Info;
|
|
19
|
+
return (_jsxs("li", { className: 'flex flex-wrap items-start justify-between gap-2 rounded-md border px-3 py-2', "data-severity": is.severity, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 items-start gap-2', children: [_jsx(SevIcon, { className: cn('mt-0.5 h-4 w-4 shrink-0', TONE_TEXT[SEVERITY_TONE[is.severity] ?? 'info']), "aria-hidden": 'true' }), _jsxs("p", { className: 'min-w-0 text-sm', children: [is.message, is.detail ? _jsx("span", { className: 'block break-words text-xs text-muted-foreground', children: is.detail }) : null] })] }), is.fix && onFix ? (_jsx(Button, { type: 'button', size: 'sm', variant: 'outline', className: 'h-7', onClick: () => onFix(is.fix, is), children: is.fix.label ?? t('flow.fix') })) : null] }, is.id ?? i));
|
|
20
|
+
}) })) : issues ? (_jsx("p", { className: 'text-sm text-muted-foreground', children: t('health.no_issues') })) : null] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './flow-model';
|
|
3
|
+
export { useSetupT, SETUP_MESSAGES_ES, SETUP_MESSAGES_EN } from './messages';
|
|
4
|
+
export { StepStatusBadge, type StepStatusBadgeProps } from './step-status-badge';
|
|
5
|
+
export { RecordsTable, copyText, type RecordsTableProps } from './records-table';
|
|
6
|
+
export { HealthCard, type HealthCardProps } from './health-card';
|
|
7
|
+
export { SetupFlow, type SetupFlowProps, type SetupCustomStepProps } from './setup-flow';
|
|
8
|
+
export { SetupFormStep, type SetupFormStepProps } from './setup-form-step';
|
|
9
|
+
export { AddonConfigSurface, clearConnectorLookupCache, type AddonConfigSurfaceProps, type AddonConfigAddon, type AddonConfigNotifier, type AddonSettingDef, type ConnectorEntry, type ConnectorCredentialField, type ConnectorFormLayout, } from './addon-config-surface';
|
|
10
|
+
export * from './connector-form-model';
|
|
11
|
+
export * from './connector-blocks-model';
|
|
12
|
+
export { ConnectorBlocks, WebhookUrlBlock, InstructionsBlock, ActionBlock, BlockResultView, HelpText, CopyValue, type ConnectorBlocksProps, type ActionBlockProps, } from './connector-blocks';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/setup/index.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EACH,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EACH,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,QAAQ,EACR,SAAS,EACT,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACxB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Setup flow + health components (kernel `contributions.setup` / `.health`) and
|
|
2
|
+
// the unified addon configuration surface. Import from the package root or from
|
|
3
|
+
// `@asteby/metacore-runtime-react/setup` to pull only this slice.
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './flow-model';
|
|
6
|
+
export { useSetupT, SETUP_MESSAGES_ES, SETUP_MESSAGES_EN } from './messages';
|
|
7
|
+
export { StepStatusBadge } from './step-status-badge';
|
|
8
|
+
export { RecordsTable, copyText } from './records-table';
|
|
9
|
+
export { HealthCard } from './health-card';
|
|
10
|
+
export { SetupFlow } from './setup-flow';
|
|
11
|
+
export { SetupFormStep } from './setup-form-step';
|
|
12
|
+
export { AddonConfigSurface, clearConnectorLookupCache, } from './addon-config-surface';
|
|
13
|
+
export * from './connector-form-model';
|
|
14
|
+
export * from './connector-blocks-model';
|
|
15
|
+
export { ConnectorBlocks, WebhookUrlBlock, InstructionsBlock, ActionBlock, BlockResultView, HelpText, CopyValue, } from './connector-blocks';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Dict = Record<string, string>;
|
|
2
|
+
export declare const SETUP_MESSAGES_ES: Dict;
|
|
3
|
+
export declare const SETUP_MESSAGES_EN: Dict;
|
|
4
|
+
export type TFn = (key: string, vars?: Record<string, unknown>) => string;
|
|
5
|
+
/** Resolves the bundled text for `lang` (es default; any `en*` → English). */
|
|
6
|
+
export declare function defaultMessage(key: string, lang?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Translator for the setup components. Keys that start with `setup.` (or are
|
|
9
|
+
* the shared `installed_addons.*` / `common.*` ones) go through i18next first,
|
|
10
|
+
* so a host can override; the bundled es/en text is the default value.
|
|
11
|
+
* Interpolation is done here too, so it works even without an i18next instance.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSetupT(): TFn;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +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,IAkJ/B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,IA+I/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"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
// i18n for the setup / health components. Every string resolves through
|
|
2
|
+
// react-i18next (`setup.*` keys, so a host can override any of them) with the
|
|
3
|
+
// bundled es/en text as the default. No bundle has to be registered.
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
export const SETUP_MESSAGES_ES = {
|
|
7
|
+
'status.pending': 'Pendiente',
|
|
8
|
+
'status.running': 'En curso',
|
|
9
|
+
'status.ok': 'Listo',
|
|
10
|
+
'status.warn': 'Con avisos',
|
|
11
|
+
'status.error': 'Con error',
|
|
12
|
+
'status.blocked': 'Bloqueado',
|
|
13
|
+
'status.skipped': 'Omitido',
|
|
14
|
+
'record.status.ok': 'Correcto',
|
|
15
|
+
'record.status.missing': 'No encontrado',
|
|
16
|
+
'record.status.wrong_value': 'Valor distinto',
|
|
17
|
+
'record.status.propagating': 'Propagando',
|
|
18
|
+
'record.status.pending': 'Sin verificar',
|
|
19
|
+
'record.status.error': 'Error',
|
|
20
|
+
'health.status.ok': 'Todo en orden',
|
|
21
|
+
'health.status.warn': 'Requiere atención',
|
|
22
|
+
'health.status.error': 'Con problemas',
|
|
23
|
+
'health.status.unknown': 'Sin datos',
|
|
24
|
+
'health.metrics': 'Métricas',
|
|
25
|
+
'health.issues': 'Avisos',
|
|
26
|
+
'health.no_issues': 'Sin avisos.',
|
|
27
|
+
'health.checked_at': 'Revisado {{when}}',
|
|
28
|
+
'health.refresh': 'Actualizar',
|
|
29
|
+
'health.continue': 'Continuar configuración',
|
|
30
|
+
'health.progress': '{{done}} de {{total}} pasos',
|
|
31
|
+
'records.type': 'Tipo',
|
|
32
|
+
'records.name': 'Nombre',
|
|
33
|
+
'records.value': 'Valor',
|
|
34
|
+
'records.status': 'Estado',
|
|
35
|
+
'records.copy': 'Copiar',
|
|
36
|
+
'records.copy_label': 'Copiar {{what}}',
|
|
37
|
+
'records.copied': 'Copiado',
|
|
38
|
+
'records.copy_failed': 'No se pudo copiar. Selecciona el texto y cópialo a mano.',
|
|
39
|
+
'records.empty': 'No hay registros por mostrar.',
|
|
40
|
+
'records.found': 'Encontrado: {{value}}',
|
|
41
|
+
'records.recheck': 'Verificar ahora',
|
|
42
|
+
'flow.steps': 'Pasos de configuración',
|
|
43
|
+
'flow.progress': 'Progreso de la configuración',
|
|
44
|
+
'flow.step_of': 'Paso {{n}} de {{total}}',
|
|
45
|
+
'flow.loading': 'Cargando configuración…',
|
|
46
|
+
'flow.load_error': 'No se pudo cargar el estado de la configuración.',
|
|
47
|
+
'flow.retry': 'Reintentar',
|
|
48
|
+
'flow.complete': 'La configuración está completa.',
|
|
49
|
+
'flow.optional': 'Opcional',
|
|
50
|
+
'flow.skip': 'Omitir este paso',
|
|
51
|
+
'flow.run': 'Ejecutar',
|
|
52
|
+
'flow.check': 'Verificar',
|
|
53
|
+
'flow.recheck': 'Volver a verificar',
|
|
54
|
+
'flow.refresh': 'Revisar ahora',
|
|
55
|
+
'flow.running': 'En curso…',
|
|
56
|
+
'flow.waiting_for': 'Antes completa: {{steps}}',
|
|
57
|
+
'flow.next_check': 'Próxima revisión en {{s}} s',
|
|
58
|
+
'flow.poll_stopped': 'Dejamos de revisar solo. Pulsa «Revisar ahora» para actualizar.',
|
|
59
|
+
'flow.step_failed': 'No se pudo ejecutar el paso.',
|
|
60
|
+
'flow.custom_missing': 'Este paso no tiene una pantalla disponible.',
|
|
61
|
+
'flow.fix': 'Arreglar',
|
|
62
|
+
'flow.go_to_step': 'Ir al paso',
|
|
63
|
+
'flow.open_link': 'Abrir',
|
|
64
|
+
'flow.status_changed': '{{step}}: {{status}}',
|
|
65
|
+
'form.continue': 'Guardar y continuar',
|
|
66
|
+
'form.back': 'Atrás',
|
|
67
|
+
'form.next': 'Siguiente',
|
|
68
|
+
'form.saving': 'Guardando…',
|
|
69
|
+
'form.saved': 'Guardado automáticamente',
|
|
70
|
+
'form.save_error': 'No se pudo guardar automáticamente.',
|
|
71
|
+
'form.missing': 'Faltan campos obligatorios: {{fields}}.',
|
|
72
|
+
'form.field_required': 'Falta completar este campo.',
|
|
73
|
+
'form.stored': 'Guardado. Escribe un valor nuevo solo si quieres cambiarlo.',
|
|
74
|
+
'form.choose': 'Elige una opción',
|
|
75
|
+
'form.step': 'Paso',
|
|
76
|
+
// Connector setup blocks + wizard
|
|
77
|
+
'blocks.more': 'Ver más',
|
|
78
|
+
'blocks.less': 'Ver menos',
|
|
79
|
+
'blocks.copy_label': 'Copiar {{what}}',
|
|
80
|
+
'blocks.value': 'Valor',
|
|
81
|
+
'blocks.webhook_title': 'URL del webhook',
|
|
82
|
+
'blocks.webhook_help': 'Pega esta URL en el panel del proveedor, en la sección de webhooks o notificaciones.',
|
|
83
|
+
'blocks.webhook_unavailable': 'El servidor todavía no informa la URL de este webhook. Actualiza OPS o pide ayuda a soporte.',
|
|
84
|
+
'blocks.run': 'Ejecutar prueba',
|
|
85
|
+
'blocks.running': 'Probando…',
|
|
86
|
+
'blocks.retry_with': 'Reintentar: {{label}}',
|
|
87
|
+
'blocks.open_link': 'Abrir enlace',
|
|
88
|
+
'blocks.save_first': 'Se guardarán tus cambios antes de probar.',
|
|
89
|
+
'blocks.failed': 'No se pudo completar la prueba.',
|
|
90
|
+
'blocks.result.ok': 'Correcto',
|
|
91
|
+
'blocks.result.warn': 'Con avisos',
|
|
92
|
+
'blocks.result.error': 'Falló',
|
|
93
|
+
'blocks.result.pending': 'Pendiente',
|
|
94
|
+
'blocks.result.running': 'En curso',
|
|
95
|
+
'blocks.result.blocked': 'Bloqueado',
|
|
96
|
+
'blocks.test_title': 'Verifica la conexión',
|
|
97
|
+
'blocks.test_help': 'Usa las credenciales guardadas para hacer una llamada de solo lectura al proveedor.',
|
|
98
|
+
'blocks.sync_title': 'Sincronización',
|
|
99
|
+
'wizard.steps': 'Pasos de la configuración',
|
|
100
|
+
'wizard.step_label': 'Paso {{n}} de {{total}}: {{title}} ({{status}})',
|
|
101
|
+
'wizard.save': 'Guardar',
|
|
102
|
+
'wizard.finish': 'Guardar y terminar',
|
|
103
|
+
'oauth.title': 'Cuenta conectada',
|
|
104
|
+
'oauth.connected': 'Conectado',
|
|
105
|
+
'oauth.not_connected': 'Sin conectar',
|
|
106
|
+
'oauth.help': 'Este addon se conecta con tu cuenta del proveedor. Te llevamos a su página para autorizarlo.',
|
|
107
|
+
'oauth.connect': 'Conectar cuenta',
|
|
108
|
+
'oauth.reconnect': 'Volver a conectar',
|
|
109
|
+
'empty.title': 'Nada que configurar',
|
|
110
|
+
'empty.help': 'Este addon funciona sin configuración. Si necesitas cambiar algo, revisa su documentación o abre el addon.',
|
|
111
|
+
// AddonConfigSurface (same keys the ops host already ships)
|
|
112
|
+
'installed_addons.configure_title': 'Configurar {{name}}',
|
|
113
|
+
'installed_addons.configure_description': 'Credenciales y ajustes del addon.',
|
|
114
|
+
'installed_addons.section_credentials': 'Credenciales',
|
|
115
|
+
'installed_addons.section_settings': 'Ajustes',
|
|
116
|
+
'installed_addons.advanced': 'Avanzado',
|
|
117
|
+
'installed_addons.no_settings': 'Este addon no tiene nada que configurar.',
|
|
118
|
+
'installed_addons.config_saved': 'Configuración guardada',
|
|
119
|
+
'installed_addons.settings_error': 'No se pudo guardar la configuración',
|
|
120
|
+
'installed_addons.test_connection': 'Probar conexión',
|
|
121
|
+
'installed_addons.test_ok': 'Conexión válida',
|
|
122
|
+
'installed_addons.test_failed': 'No se pudo conectar',
|
|
123
|
+
'installed_addons.sync_now': 'Sincronizar ahora',
|
|
124
|
+
'installed_addons.sync_skipped': 'Sincronización omitida',
|
|
125
|
+
'installed_addons.sync_done': 'Sincronizado: {{licenses}} licencias, {{instances}} instancias, {{accounts}} cuentas',
|
|
126
|
+
'installed_addons.sync_failed': 'No se pudo sincronizar',
|
|
127
|
+
'installed_addons.issuer_admin_only': 'Solo un administrador de la organización puede ver y guardar los datos del emisor y el certificado. Pide a un administrador que los configure.',
|
|
128
|
+
'installed_addons.field_required': 'Falta completar este campo.',
|
|
129
|
+
'installed_addons.missing_fields': 'Faltan campos obligatorios: {{fields}}.',
|
|
130
|
+
'installed_addons.shape_public_key': 'Este valor tiene forma de {{target}}. Pégalo en ese campo.',
|
|
131
|
+
'installed_addons.shape_secret_key': 'Este valor tiene forma de una clave secreta. Pégalo en {{target}}.',
|
|
132
|
+
'installed_addons.dynamic_select_error': 'No se pudieron listar las opciones. Guarda la conexión y vuelve a intentar.',
|
|
133
|
+
'installed_addons.dynamic_select_choose': 'Elige una opción',
|
|
134
|
+
'installed_addons.dynamic_select_placeholder': 'Guarda la conexión y actualiza para elegir',
|
|
135
|
+
'installed_addons.dynamic_select_refresh': 'Actualizar opciones',
|
|
136
|
+
'installed_addons.per_branch': 'Por sucursal',
|
|
137
|
+
'installed_addons.inherit_pending': 'Heredará de la organización al guardar',
|
|
138
|
+
'installed_addons.branch_own': 'Valor propio de esta sucursal',
|
|
139
|
+
'installed_addons.branch_inherited': 'Hereda de la organización',
|
|
140
|
+
'installed_addons.inherit': 'Heredar de la organización',
|
|
141
|
+
'installed_addons.applies_to': 'Los ajustes aplican a:',
|
|
142
|
+
'installed_addons.whole_org': 'Toda la organización',
|
|
143
|
+
'installed_addons.only_branch': 'Solo {{name}}',
|
|
144
|
+
'installed_addons.secret_stored': 'Hay un valor guardado. Déjalo vacío para conservarlo.',
|
|
145
|
+
'common.back': 'Atrás',
|
|
146
|
+
'common.next': 'Siguiente',
|
|
147
|
+
'common.cancel': 'Cancelar',
|
|
148
|
+
'common.save': 'Guardar',
|
|
149
|
+
'common.close': 'Cerrar',
|
|
150
|
+
};
|
|
151
|
+
export const SETUP_MESSAGES_EN = {
|
|
152
|
+
'status.pending': 'Pending',
|
|
153
|
+
'status.running': 'In progress',
|
|
154
|
+
'status.ok': 'Done',
|
|
155
|
+
'status.warn': 'Has warnings',
|
|
156
|
+
'status.error': 'Has errors',
|
|
157
|
+
'status.blocked': 'Blocked',
|
|
158
|
+
'status.skipped': 'Skipped',
|
|
159
|
+
'record.status.ok': 'Correct',
|
|
160
|
+
'record.status.missing': 'Not found',
|
|
161
|
+
'record.status.wrong_value': 'Different value',
|
|
162
|
+
'record.status.propagating': 'Propagating',
|
|
163
|
+
'record.status.pending': 'Not checked',
|
|
164
|
+
'record.status.error': 'Error',
|
|
165
|
+
'health.status.ok': 'All good',
|
|
166
|
+
'health.status.warn': 'Needs attention',
|
|
167
|
+
'health.status.error': 'Has problems',
|
|
168
|
+
'health.status.unknown': 'No data',
|
|
169
|
+
'health.metrics': 'Metrics',
|
|
170
|
+
'health.issues': 'Issues',
|
|
171
|
+
'health.no_issues': 'No issues.',
|
|
172
|
+
'health.checked_at': 'Checked {{when}}',
|
|
173
|
+
'health.refresh': 'Refresh',
|
|
174
|
+
'health.continue': 'Continue setup',
|
|
175
|
+
'health.progress': '{{done}} of {{total}} steps',
|
|
176
|
+
'records.type': 'Type',
|
|
177
|
+
'records.name': 'Name',
|
|
178
|
+
'records.value': 'Value',
|
|
179
|
+
'records.status': 'Status',
|
|
180
|
+
'records.copy': 'Copy',
|
|
181
|
+
'records.copy_label': 'Copy {{what}}',
|
|
182
|
+
'records.copied': 'Copied',
|
|
183
|
+
'records.copy_failed': 'Could not copy. Select the text and copy it by hand.',
|
|
184
|
+
'records.empty': 'No records to show.',
|
|
185
|
+
'records.found': 'Found: {{value}}',
|
|
186
|
+
'records.recheck': 'Check now',
|
|
187
|
+
'flow.steps': 'Setup steps',
|
|
188
|
+
'flow.progress': 'Setup progress',
|
|
189
|
+
'flow.step_of': 'Step {{n}} of {{total}}',
|
|
190
|
+
'flow.loading': 'Loading setup…',
|
|
191
|
+
'flow.load_error': 'Could not load the setup state.',
|
|
192
|
+
'flow.retry': 'Try again',
|
|
193
|
+
'flow.complete': 'Setup is complete.',
|
|
194
|
+
'flow.optional': 'Optional',
|
|
195
|
+
'flow.skip': 'Skip this step',
|
|
196
|
+
'flow.run': 'Run',
|
|
197
|
+
'flow.check': 'Check',
|
|
198
|
+
'flow.recheck': 'Check again',
|
|
199
|
+
'flow.refresh': 'Check now',
|
|
200
|
+
'flow.running': 'In progress…',
|
|
201
|
+
'flow.waiting_for': 'Finish first: {{steps}}',
|
|
202
|
+
'flow.next_check': 'Next check in {{s}} s',
|
|
203
|
+
'flow.poll_stopped': 'We stopped checking automatically. Press "Check now" to refresh.',
|
|
204
|
+
'flow.step_failed': 'The step could not be run.',
|
|
205
|
+
'flow.custom_missing': 'This step has no screen available.',
|
|
206
|
+
'flow.fix': 'Fix',
|
|
207
|
+
'flow.go_to_step': 'Go to step',
|
|
208
|
+
'flow.open_link': 'Open',
|
|
209
|
+
'flow.status_changed': '{{step}}: {{status}}',
|
|
210
|
+
'form.continue': 'Save and continue',
|
|
211
|
+
'form.back': 'Back',
|
|
212
|
+
'form.next': 'Next',
|
|
213
|
+
'form.saving': 'Saving…',
|
|
214
|
+
'form.saved': 'Saved automatically',
|
|
215
|
+
'form.save_error': 'Could not save automatically.',
|
|
216
|
+
'form.missing': 'Required fields are missing: {{fields}}.',
|
|
217
|
+
'form.field_required': 'This field is required.',
|
|
218
|
+
'form.stored': 'Saved. Type a new value only if you want to change it.',
|
|
219
|
+
'form.choose': 'Choose an option',
|
|
220
|
+
'form.step': 'Step',
|
|
221
|
+
'blocks.more': 'Show more',
|
|
222
|
+
'blocks.less': 'Show less',
|
|
223
|
+
'blocks.copy_label': 'Copy {{what}}',
|
|
224
|
+
'blocks.value': 'Value',
|
|
225
|
+
'blocks.webhook_title': 'Webhook URL',
|
|
226
|
+
'blocks.webhook_help': "Paste this URL in the provider's panel, in its webhooks or notifications section.",
|
|
227
|
+
'blocks.webhook_unavailable': 'The server does not report this webhook URL yet. Update OPS or ask support.',
|
|
228
|
+
'blocks.run': 'Run test',
|
|
229
|
+
'blocks.running': 'Testing…',
|
|
230
|
+
'blocks.retry_with': 'Retry: {{label}}',
|
|
231
|
+
'blocks.open_link': 'Open link',
|
|
232
|
+
'blocks.save_first': 'Your changes will be saved before testing.',
|
|
233
|
+
'blocks.failed': 'The test could not be completed.',
|
|
234
|
+
'blocks.result.ok': 'Passed',
|
|
235
|
+
'blocks.result.warn': 'Has warnings',
|
|
236
|
+
'blocks.result.error': 'Failed',
|
|
237
|
+
'blocks.result.pending': 'Pending',
|
|
238
|
+
'blocks.result.running': 'In progress',
|
|
239
|
+
'blocks.result.blocked': 'Blocked',
|
|
240
|
+
'blocks.test_title': 'Check the connection',
|
|
241
|
+
'blocks.test_help': 'Uses the saved credentials to make a read-only call to the provider.',
|
|
242
|
+
'blocks.sync_title': 'Sync',
|
|
243
|
+
'wizard.steps': 'Setup steps',
|
|
244
|
+
'wizard.step_label': 'Step {{n}} of {{total}}: {{title}} ({{status}})',
|
|
245
|
+
'wizard.save': 'Save',
|
|
246
|
+
'wizard.finish': 'Save and finish',
|
|
247
|
+
'oauth.title': 'Connected account',
|
|
248
|
+
'oauth.connected': 'Connected',
|
|
249
|
+
'oauth.not_connected': 'Not connected',
|
|
250
|
+
'oauth.help': "This addon connects to your provider account. We'll take you to its page to authorize it.",
|
|
251
|
+
'oauth.connect': 'Connect account',
|
|
252
|
+
'oauth.reconnect': 'Reconnect',
|
|
253
|
+
'empty.title': 'Nothing to configure',
|
|
254
|
+
'empty.help': 'This addon works without configuration. If you need to change something, check its documentation or open the addon.',
|
|
255
|
+
'installed_addons.configure_title': 'Configure {{name}}',
|
|
256
|
+
'installed_addons.configure_description': 'Credentials and settings for this addon.',
|
|
257
|
+
'installed_addons.section_credentials': 'Credentials',
|
|
258
|
+
'installed_addons.section_settings': 'Settings',
|
|
259
|
+
'installed_addons.advanced': 'Advanced',
|
|
260
|
+
'installed_addons.no_settings': 'This addon has nothing to configure.',
|
|
261
|
+
'installed_addons.config_saved': 'Configuration saved',
|
|
262
|
+
'installed_addons.settings_error': 'Could not save the configuration',
|
|
263
|
+
'installed_addons.test_connection': 'Test connection',
|
|
264
|
+
'installed_addons.test_ok': 'Connection is valid',
|
|
265
|
+
'installed_addons.test_failed': 'Could not connect',
|
|
266
|
+
'installed_addons.sync_now': 'Sync now',
|
|
267
|
+
'installed_addons.sync_skipped': 'Sync skipped',
|
|
268
|
+
'installed_addons.sync_done': 'Synced: {{licenses}} licenses, {{instances}} instances, {{accounts}} accounts',
|
|
269
|
+
'installed_addons.sync_failed': 'Could not sync',
|
|
270
|
+
'installed_addons.issuer_admin_only': 'Only an organization administrator can view and save the issuer and certificate data. Ask an administrator to set them up.',
|
|
271
|
+
'installed_addons.field_required': 'This field is required.',
|
|
272
|
+
'installed_addons.missing_fields': 'Required fields are missing: {{fields}}.',
|
|
273
|
+
'installed_addons.shape_public_key': 'This value looks like {{target}}. Paste it in that field.',
|
|
274
|
+
'installed_addons.shape_secret_key': 'This value looks like a secret key. Paste it in {{target}}.',
|
|
275
|
+
'installed_addons.dynamic_select_error': 'Could not list the options. Save the connection and try again.',
|
|
276
|
+
'installed_addons.dynamic_select_choose': 'Choose an option',
|
|
277
|
+
'installed_addons.dynamic_select_placeholder': 'Save the connection and refresh to choose',
|
|
278
|
+
'installed_addons.dynamic_select_refresh': 'Refresh options',
|
|
279
|
+
'installed_addons.per_branch': 'Per branch',
|
|
280
|
+
'installed_addons.inherit_pending': 'Will inherit from the organization on save',
|
|
281
|
+
'installed_addons.branch_own': "This branch's own value",
|
|
282
|
+
'installed_addons.branch_inherited': 'Inherits from the organization',
|
|
283
|
+
'installed_addons.inherit': 'Inherit from the organization',
|
|
284
|
+
'installed_addons.applies_to': 'Settings apply to:',
|
|
285
|
+
'installed_addons.whole_org': 'Whole organization',
|
|
286
|
+
'installed_addons.only_branch': 'Only {{name}}',
|
|
287
|
+
'installed_addons.secret_stored': 'A value is stored. Leave it empty to keep it.',
|
|
288
|
+
'common.back': 'Back',
|
|
289
|
+
'common.next': 'Next',
|
|
290
|
+
'common.cancel': 'Cancel',
|
|
291
|
+
'common.save': 'Save',
|
|
292
|
+
'common.close': 'Close',
|
|
293
|
+
};
|
|
294
|
+
function interpolate(s, vars) {
|
|
295
|
+
if (!vars)
|
|
296
|
+
return s;
|
|
297
|
+
return s.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, k) => (vars[k] == null ? '' : String(vars[k])));
|
|
298
|
+
}
|
|
299
|
+
/** Resolves the bundled text for `lang` (es default; any `en*` → English). */
|
|
300
|
+
export function defaultMessage(key, lang) {
|
|
301
|
+
const dict = lang && lang.toLowerCase().startsWith('en') ? SETUP_MESSAGES_EN : SETUP_MESSAGES_ES;
|
|
302
|
+
return dict[key] ?? SETUP_MESSAGES_ES[key] ?? key;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Translator for the setup components. Keys that start with `setup.` (or are
|
|
306
|
+
* the shared `installed_addons.*` / `common.*` ones) go through i18next first,
|
|
307
|
+
* so a host can override; the bundled es/en text is the default value.
|
|
308
|
+
* Interpolation is done here too, so it works even without an i18next instance.
|
|
309
|
+
*/
|
|
310
|
+
export function useSetupT() {
|
|
311
|
+
const { t, i18n } = useTranslation();
|
|
312
|
+
const lang = i18n?.language;
|
|
313
|
+
return useCallback((key, vars) => {
|
|
314
|
+
const hostKey = key.includes('.') && /^(installed_addons|common)\./.test(key) ? key : `setup.${key}`;
|
|
315
|
+
const fallback = defaultMessage(key, lang);
|
|
316
|
+
const out = t(hostKey, { ...(vars ?? {}), defaultValue: fallback });
|
|
317
|
+
// Mocked / minimal `t` implementations may ignore interpolation.
|
|
318
|
+
return interpolate(typeof out === 'string' ? out : fallback, vars);
|
|
319
|
+
}, [t, lang]);
|
|
320
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SetupFix, SetupRecord } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Copies text with a fallback: the async Clipboard API when the page may use
|
|
4
|
+
* it, otherwise a hidden textarea + `execCommand('copy')` (http pages, older
|
|
5
|
+
* webviews, denied permission). Resolves to whether something was copied.
|
|
6
|
+
*/
|
|
7
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
8
|
+
export interface RecordsTableProps {
|
|
9
|
+
records: SetupRecord[];
|
|
10
|
+
caption?: string;
|
|
11
|
+
/** Fix button of a row's diagnostic (`fix.action|url|step`). */
|
|
12
|
+
onFix?: (fix: SetupFix, record: SetupRecord) => void;
|
|
13
|
+
/** Shows a "check now" button above the table. */
|
|
14
|
+
onRecheck?: () => void;
|
|
15
|
+
rechecking?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Type / name / value table (DNS records and the like) with per-row copy,
|
|
20
|
+
* status and diagnostic. Scrolls horizontally on narrow screens instead of
|
|
21
|
+
* squeezing the values; values wrap (`break-all`) so a long DKIM key is readable.
|
|
22
|
+
*/
|
|
23
|
+
export declare function RecordsTable({ records, caption, onFix, onRecheck, rechecking, className }: RecordsTableProps): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=records-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records-table.d.ts","sourceRoot":"","sources":["../../src/setup/records-table.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiC,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEnF;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB7D;AA0CD,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACpD,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAuE5G"}
|