@oondemand/oon-core-front 0.3.37 → 0.3.38
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/dist/index.js +340 -318
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2031,8 +2031,27 @@ function interpolateEndpoint(endpoint, row, parent) {
|
|
|
2031
2031
|
});
|
|
2032
2032
|
}
|
|
2033
2033
|
|
|
2034
|
+
// src/components/internal/DetailRecordContext.tsx
|
|
2035
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2036
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2037
|
+
var DetailRecordContext = createContext4(null);
|
|
2038
|
+
function DetailRecordProvider({
|
|
2039
|
+
record,
|
|
2040
|
+
setRecord,
|
|
2041
|
+
children
|
|
2042
|
+
}) {
|
|
2043
|
+
return /* @__PURE__ */ jsx12(DetailRecordContext.Provider, { value: { record, setRecord }, children });
|
|
2044
|
+
}
|
|
2045
|
+
function useDetailRecord() {
|
|
2046
|
+
return useContext4(DetailRecordContext);
|
|
2047
|
+
}
|
|
2048
|
+
function mergeDetailRecord(current, saved, changes = {}) {
|
|
2049
|
+
const savedRecord = saved && typeof saved === "object" ? saved : {};
|
|
2050
|
+
return { ...current, ...savedRecord, ...changes };
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2034
2053
|
// src/components/internal/CoreRowAction.tsx
|
|
2035
|
-
import { jsx as
|
|
2054
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2036
2055
|
var ACTION_TONES = {
|
|
2037
2056
|
success: { bg: "#DCFCE7", color: "#166534", border: "#BBF7D0", hover: "#D1FAE5" },
|
|
2038
2057
|
danger: { bg: "#FEE2E2", color: "#991B1B", border: "#FECACA", hover: "#FDE2E2" },
|
|
@@ -2054,8 +2073,8 @@ function ActionErrorMessage({ error }) {
|
|
|
2054
2073
|
borderColor: "#FECDCA",
|
|
2055
2074
|
borderRadius: "6px",
|
|
2056
2075
|
children: [
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
description.context ? /* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ jsx13(Text7, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
|
|
2077
|
+
description.context ? /* @__PURE__ */ jsx13(Text7, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
|
|
2059
2078
|
]
|
|
2060
2079
|
}
|
|
2061
2080
|
);
|
|
@@ -2088,6 +2107,8 @@ function emitOperationalEvent(action, row, changes) {
|
|
|
2088
2107
|
}
|
|
2089
2108
|
function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate }) {
|
|
2090
2109
|
const { http } = useOonApi();
|
|
2110
|
+
const detailRecord = useDetailRecord();
|
|
2111
|
+
const effectiveRow = detailRecord?.record ?? row;
|
|
2091
2112
|
const [loading, setLoading] = useState6(false);
|
|
2092
2113
|
const [error, setError] = useState6(null);
|
|
2093
2114
|
const [formOpen, setFormOpen] = useState6(false);
|
|
@@ -2095,16 +2116,16 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2095
2116
|
const pipelineAction = action;
|
|
2096
2117
|
const tone = pipelineAction.tone ? ACTION_TONES[pipelineAction.tone] : void 0;
|
|
2097
2118
|
const isWorkStatus = pipelineAction.group === "workStatus";
|
|
2098
|
-
const isSelected = isWorkStatus && !!pipelineAction.field &&
|
|
2099
|
-
if (evaluateCondition(action.hiddenWhen,
|
|
2100
|
-
const disabled = evaluateCondition(action.disabledWhen,
|
|
2119
|
+
const isSelected = isWorkStatus && !!pipelineAction.field && effectiveRow[pipelineAction.field] === pipelineAction.value;
|
|
2120
|
+
if (evaluateCondition(action.hiddenWhen, effectiveRow)) return null;
|
|
2121
|
+
const disabled = evaluateCondition(action.disabledWhen, effectiveRow) || loading;
|
|
2101
2122
|
const confirmAction = () => action.confirm ? window.confirm(action.confirm.description ?? action.confirm.title ?? `Executar ${action.label}?`) : true;
|
|
2102
2123
|
const run = async () => {
|
|
2103
2124
|
setError(null);
|
|
2104
|
-
if (action.type === "openDetailModal") return onOpenDetail?.(
|
|
2125
|
+
if (action.type === "openDetailModal") return onOpenDetail?.(effectiveRow, action.initialTab);
|
|
2105
2126
|
if (action.type === "navigate") {
|
|
2106
2127
|
const href = action.href ?? action.endpoint;
|
|
2107
|
-
if (href) window.location.assign(interpolateEndpoint(href,
|
|
2128
|
+
if (href) window.location.assign(interpolateEndpoint(href, effectiveRow, parent));
|
|
2108
2129
|
return;
|
|
2109
2130
|
}
|
|
2110
2131
|
if (pipelineAction.type === "formAction") {
|
|
@@ -2113,7 +2134,7 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2113
2134
|
try {
|
|
2114
2135
|
let loaded = {};
|
|
2115
2136
|
if (pipelineAction.loadEndpoint) {
|
|
2116
|
-
const url = interpolateEndpoint(pipelineAction.loadEndpoint,
|
|
2137
|
+
const url = interpolateEndpoint(pipelineAction.loadEndpoint, effectiveRow, parent);
|
|
2117
2138
|
loaded = unwrap2(await http.request({ url, method: "GET" }));
|
|
2118
2139
|
}
|
|
2119
2140
|
setFormInitialValues({ ...pipelineAction.initialValues ?? {}, ...loaded });
|
|
@@ -2130,8 +2151,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2130
2151
|
setLoading(true);
|
|
2131
2152
|
try {
|
|
2132
2153
|
const changes = { [pipelineAction.field]: pipelineAction.value };
|
|
2133
|
-
await onUpdate(changes);
|
|
2134
|
-
|
|
2154
|
+
const saved = await onUpdate(changes);
|
|
2155
|
+
detailRecord?.setRecord(mergeDetailRecord(effectiveRow, saved, changes));
|
|
2156
|
+
emitOperationalEvent(pipelineAction, effectiveRow, changes);
|
|
2135
2157
|
onRefresh?.(pipelineAction.refresh);
|
|
2136
2158
|
} catch (err) {
|
|
2137
2159
|
setError(err);
|
|
@@ -2143,9 +2165,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2143
2165
|
if (action.type !== "apiAction" || !action.endpoint || !confirmAction()) return;
|
|
2144
2166
|
setLoading(true);
|
|
2145
2167
|
try {
|
|
2146
|
-
const url = interpolateEndpoint(action.endpoint,
|
|
2168
|
+
const url = interpolateEndpoint(action.endpoint, effectiveRow, parent);
|
|
2147
2169
|
await http.request({ url, method: action.method ?? "POST" });
|
|
2148
|
-
emitOperationalEvent(pipelineAction,
|
|
2170
|
+
emitOperationalEvent(pipelineAction, effectiveRow);
|
|
2149
2171
|
onRefresh?.(action.refresh);
|
|
2150
2172
|
} catch (err) {
|
|
2151
2173
|
setError(err);
|
|
@@ -2177,13 +2199,13 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2177
2199
|
_hover: tone ? { bg: tone.hover, borderColor: tone.border } : void 0,
|
|
2178
2200
|
_disabled: tone ? { opacity: isSelected ? 1 : 0.55, cursor: "not-allowed" } : void 0,
|
|
2179
2201
|
children: [
|
|
2180
|
-
isWorkStatus ? /* @__PURE__ */
|
|
2202
|
+
isWorkStatus ? /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", style: { width: 8, height: 8, display: "inline-block", marginRight: 7, borderRadius: "999px", background: tone?.color ?? "#64748B", boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,.9)" : "none" } }) : null,
|
|
2181
2203
|
action.label
|
|
2182
2204
|
]
|
|
2183
2205
|
}
|
|
2184
2206
|
),
|
|
2185
|
-
error ? /* @__PURE__ */
|
|
2186
|
-
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */
|
|
2207
|
+
error ? /* @__PURE__ */ jsx13(ActionErrorMessage, { error }) : null,
|
|
2208
|
+
formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx13(
|
|
2187
2209
|
DynamicForm,
|
|
2188
2210
|
{
|
|
2189
2211
|
title: pipelineAction.title ?? pipelineAction.label,
|
|
@@ -2197,9 +2219,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2197
2219
|
setLoading(true);
|
|
2198
2220
|
setError(null);
|
|
2199
2221
|
try {
|
|
2200
|
-
const url = interpolateEndpoint(pipelineAction.endpoint,
|
|
2222
|
+
const url = interpolateEndpoint(pipelineAction.endpoint, effectiveRow, parent);
|
|
2201
2223
|
await http.request({ url, method: pipelineAction.method ?? "POST", data: values });
|
|
2202
|
-
emitOperationalEvent(pipelineAction,
|
|
2224
|
+
emitOperationalEvent(pipelineAction, effectiveRow, values);
|
|
2203
2225
|
setFormOpen(false);
|
|
2204
2226
|
onRefresh?.(pipelineAction.refresh);
|
|
2205
2227
|
} catch (err) {
|
|
@@ -2218,7 +2240,7 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
|
|
|
2218
2240
|
}
|
|
2219
2241
|
|
|
2220
2242
|
// src/components/internal/CoreRelatedGrid.tsx
|
|
2221
|
-
import { Fragment as Fragment2, jsx as
|
|
2243
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2222
2244
|
function CoreRelatedGrid({
|
|
2223
2245
|
tab: rawTab,
|
|
2224
2246
|
parent,
|
|
@@ -2276,8 +2298,8 @@ function CoreRelatedGrid({
|
|
|
2276
2298
|
mutationFn: (id) => resource.delete(id),
|
|
2277
2299
|
onSuccess: invalidate
|
|
2278
2300
|
});
|
|
2279
|
-
if (!relation) return /* @__PURE__ */
|
|
2280
|
-
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */
|
|
2301
|
+
if (!relation) return /* @__PURE__ */ jsx14(Text8, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
|
|
2302
|
+
if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx14(Text8, { color: "#667085", children: "Carregando..." });
|
|
2281
2303
|
const rows = query.data?.results ?? [];
|
|
2282
2304
|
const setDraft = (id, field, value) => setDrafts((current) => ({
|
|
2283
2305
|
...current,
|
|
@@ -2285,14 +2307,14 @@ function CoreRelatedGrid({
|
|
|
2285
2307
|
}));
|
|
2286
2308
|
const createFields = tab.create?.fields?.length ? tab.create.fields : formFieldsFromMeta(schema?.fields ?? []).filter((field) => ![relation.foreignKey, "_id", "createdAt", "updatedAt"].includes(field.field));
|
|
2287
2309
|
return /* @__PURE__ */ jsxs9(Box7, { children: [
|
|
2288
|
-
canCreate ? /* @__PURE__ */
|
|
2310
|
+
canCreate ? /* @__PURE__ */ jsx14(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx14(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
|
|
2289
2311
|
setCreateError(null);
|
|
2290
2312
|
setCreating(true);
|
|
2291
2313
|
}, children: tab.create?.label ?? "Novo registro" }) }) : null,
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
columns.map((column) => /* @__PURE__ */
|
|
2295
|
-
hasActions ? /* @__PURE__ */
|
|
2314
|
+
/* @__PURE__ */ jsx14(Box7, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
|
|
2315
|
+
/* @__PURE__ */ jsx14(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
|
|
2316
|
+
columns.map((column) => /* @__PURE__ */ jsx14(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
|
|
2317
|
+
hasActions ? /* @__PURE__ */ jsx14(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
|
|
2296
2318
|
] }) }),
|
|
2297
2319
|
/* @__PURE__ */ jsxs9(Table2.Body, { children: [
|
|
2298
2320
|
rows.map((row, index) => {
|
|
@@ -2304,11 +2326,11 @@ function CoreRelatedGrid({
|
|
|
2304
2326
|
const value = column.field in draft ? draft[column.field] : row[column.field];
|
|
2305
2327
|
const meta = schema?.fields.find((field) => field.name === column.field);
|
|
2306
2328
|
const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
|
|
2307
|
-
return /* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ jsx14(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx14(CoreInlineEditableCell, { column, meta, value, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx14(Badge3, { colorPalette: value ? "green" : "gray", children: value ? "Sim" : "N\xE3o" }) : formatCell(value, column.kind) }, column.field);
|
|
2308
2330
|
}),
|
|
2309
|
-
hasActions ? /* @__PURE__ */
|
|
2331
|
+
hasActions ? /* @__PURE__ */ jsx14(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
|
|
2310
2332
|
dirty ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2311
|
-
/* @__PURE__ */
|
|
2333
|
+
/* @__PURE__ */ jsx14(
|
|
2312
2334
|
Button6,
|
|
2313
2335
|
{
|
|
2314
2336
|
size: "xs",
|
|
@@ -2327,14 +2349,14 @@ function CoreRelatedGrid({
|
|
|
2327
2349
|
children: "Salvar"
|
|
2328
2350
|
}
|
|
2329
2351
|
),
|
|
2330
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ jsx14(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
|
|
2331
2353
|
const next = { ...current };
|
|
2332
2354
|
delete next[id];
|
|
2333
2355
|
return next;
|
|
2334
2356
|
}), children: "Cancelar" })
|
|
2335
2357
|
] }) : null,
|
|
2336
|
-
tab.rowActions?.map((action) => /* @__PURE__ */
|
|
2337
|
-
canDelete ? /* @__PURE__ */
|
|
2358
|
+
tab.rowActions?.map((action) => /* @__PURE__ */ jsx14(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
|
|
2359
|
+
canDelete ? /* @__PURE__ */ jsx14(
|
|
2338
2360
|
Button6,
|
|
2339
2361
|
{
|
|
2340
2362
|
size: "xs",
|
|
@@ -2347,14 +2369,14 @@ function CoreRelatedGrid({
|
|
|
2347
2369
|
children: "Excluir"
|
|
2348
2370
|
}
|
|
2349
2371
|
) : null,
|
|
2350
|
-
errors[id] ? /* @__PURE__ */
|
|
2372
|
+
errors[id] ? /* @__PURE__ */ jsx14(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
|
|
2351
2373
|
] }) }) : null
|
|
2352
2374
|
] }, id);
|
|
2353
2375
|
}),
|
|
2354
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
2376
|
+
rows.length === 0 ? /* @__PURE__ */ jsx14(Table2.Row, { children: /* @__PURE__ */ jsx14(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx14(Text8, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
|
|
2355
2377
|
] })
|
|
2356
2378
|
] }) }),
|
|
2357
|
-
creating ? /* @__PURE__ */
|
|
2379
|
+
creating ? /* @__PURE__ */ jsx14(
|
|
2358
2380
|
DynamicForm,
|
|
2359
2381
|
{
|
|
2360
2382
|
title: tab.create?.label ?? `Novo ${schema?.singular ?? relation.model}`,
|
|
@@ -2374,7 +2396,7 @@ function CoreRelatedGrid({
|
|
|
2374
2396
|
}
|
|
2375
2397
|
|
|
2376
2398
|
// src/components/internal/CoreTabbedDetail.tsx
|
|
2377
|
-
import { jsx as
|
|
2399
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2378
2400
|
function coerce2(value, kind) {
|
|
2379
2401
|
if (value === "") return void 0;
|
|
2380
2402
|
if (["number", "currency", "currencyConverted"].includes(kind ?? "")) return Number(value);
|
|
@@ -2461,13 +2483,13 @@ function resolveReference2(field, values) {
|
|
|
2461
2483
|
}
|
|
2462
2484
|
function FieldLabel({ field, htmlFor }) {
|
|
2463
2485
|
const label = fieldLabel({ name: field.field, label: field.label });
|
|
2464
|
-
return /* @__PURE__ */
|
|
2486
|
+
return /* @__PURE__ */ jsx15("label", { htmlFor, children: /* @__PURE__ */ jsxs10(Text9, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
|
|
2465
2487
|
label,
|
|
2466
|
-
field.required ? /* @__PURE__ */
|
|
2488
|
+
field.required ? /* @__PURE__ */ jsx15(Text9, { as: "span", color: "#DC2626", children: " *" }) : null
|
|
2467
2489
|
] }) });
|
|
2468
2490
|
}
|
|
2469
2491
|
function ErrorText2({ id, message }) {
|
|
2470
|
-
return message ? /* @__PURE__ */
|
|
2492
|
+
return message ? /* @__PURE__ */ jsx15(Text9, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
|
|
2471
2493
|
}
|
|
2472
2494
|
function FieldControl({
|
|
2473
2495
|
field,
|
|
@@ -2507,7 +2529,7 @@ function FieldControl({
|
|
|
2507
2529
|
borderRadius: "7px",
|
|
2508
2530
|
cursor: "pointer",
|
|
2509
2531
|
children: [
|
|
2510
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ jsx15(
|
|
2511
2533
|
"input",
|
|
2512
2534
|
{
|
|
2513
2535
|
id: inputId,
|
|
@@ -2519,18 +2541,18 @@ function FieldControl({
|
|
|
2519
2541
|
onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
|
|
2520
2542
|
}
|
|
2521
2543
|
),
|
|
2522
|
-
/* @__PURE__ */
|
|
2544
|
+
/* @__PURE__ */ jsx15(Text9, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
|
|
2523
2545
|
]
|
|
2524
2546
|
}
|
|
2525
2547
|
),
|
|
2526
|
-
/* @__PURE__ */
|
|
2548
|
+
/* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
|
|
2527
2549
|
] });
|
|
2528
2550
|
}
|
|
2529
2551
|
if (field.kind === "ref" && field.ref) {
|
|
2530
2552
|
const reference = resolveReference2(field, values);
|
|
2531
2553
|
return /* @__PURE__ */ jsxs10(Box8, { children: [
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2554
|
+
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2555
|
+
/* @__PURE__ */ jsx15(
|
|
2534
2556
|
ReferenceSelect,
|
|
2535
2557
|
{
|
|
2536
2558
|
field: field.field,
|
|
@@ -2555,18 +2577,18 @@ function FieldControl({
|
|
|
2555
2577
|
const mask = resolveInputMask(field);
|
|
2556
2578
|
const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
|
|
2557
2579
|
/* @__PURE__ */ jsxs10(NativeSelect4.Field, { id: inputId, value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
field.options.map((option) => /* @__PURE__ */
|
|
2580
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2581
|
+
field.options.map((option) => /* @__PURE__ */ jsx15("option", { value: option, children: option }, option))
|
|
2560
2582
|
] }),
|
|
2561
|
-
/* @__PURE__ */
|
|
2583
|
+
/* @__PURE__ */ jsx15(NativeSelect4.Indicator, {})
|
|
2562
2584
|
] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
|
|
2563
2585
|
/* @__PURE__ */ jsxs10(NativeSelect4.Field, { id: inputId, value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
|
|
2587
|
+
/* @__PURE__ */ jsx15("option", { value: "true", children: "Sim" }),
|
|
2588
|
+
/* @__PURE__ */ jsx15("option", { value: "false", children: "N\xE3o" })
|
|
2567
2589
|
] }),
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
] }) : isMultiline2(field) ? /* @__PURE__ */
|
|
2590
|
+
/* @__PURE__ */ jsx15(NativeSelect4.Indicator, {})
|
|
2591
|
+
] }) : isMultiline2(field) ? /* @__PURE__ */ jsx15(Textarea3, { id: inputId, rows: 4, resize: "vertical", value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx15(
|
|
2570
2592
|
Input5,
|
|
2571
2593
|
{
|
|
2572
2594
|
id: inputId,
|
|
@@ -2581,9 +2603,9 @@ function FieldControl({
|
|
|
2581
2603
|
}
|
|
2582
2604
|
);
|
|
2583
2605
|
return /* @__PURE__ */ jsxs10(Box8, { children: [
|
|
2584
|
-
/* @__PURE__ */
|
|
2606
|
+
/* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
|
|
2585
2607
|
control,
|
|
2586
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
|
|
2587
2609
|
] });
|
|
2588
2610
|
}
|
|
2589
2611
|
function GroupSection({
|
|
@@ -2597,9 +2619,9 @@ function GroupSection({
|
|
|
2597
2619
|
if (!fields.length) return null;
|
|
2598
2620
|
const columns = group.columns ?? 2;
|
|
2599
2621
|
return /* @__PURE__ */ jsxs10(Box8, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
group.description ? /* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2622
|
+
/* @__PURE__ */ jsx15(Text9, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
|
|
2623
|
+
group.description ? /* @__PURE__ */ jsx15(Text9, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx15(Box8, { h: "10px" }),
|
|
2624
|
+
/* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
|
|
2603
2625
|
FieldControl,
|
|
2604
2626
|
{
|
|
2605
2627
|
field,
|
|
@@ -2655,7 +2677,7 @@ function InlineParentForm({
|
|
|
2655
2677
|
};
|
|
2656
2678
|
const renderFields = () => {
|
|
2657
2679
|
if (groups?.length) {
|
|
2658
|
-
return /* @__PURE__ */
|
|
2680
|
+
return /* @__PURE__ */ jsx15(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx15(
|
|
2659
2681
|
GroupSection,
|
|
2660
2682
|
{
|
|
2661
2683
|
group,
|
|
@@ -2668,7 +2690,7 @@ function InlineParentForm({
|
|
|
2668
2690
|
`${group.label}-${group.fields.join("-")}`
|
|
2669
2691
|
)) });
|
|
2670
2692
|
}
|
|
2671
|
-
return /* @__PURE__ */
|
|
2693
|
+
return /* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
|
|
2672
2694
|
FieldControl,
|
|
2673
2695
|
{
|
|
2674
2696
|
field,
|
|
@@ -2681,7 +2703,7 @@ function InlineParentForm({
|
|
|
2681
2703
|
field.field
|
|
2682
2704
|
)) });
|
|
2683
2705
|
};
|
|
2684
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsx15(
|
|
2685
2707
|
"form",
|
|
2686
2708
|
{
|
|
2687
2709
|
id: formId,
|
|
@@ -2711,9 +2733,9 @@ function InlineParentForm({
|
|
|
2711
2733
|
}
|
|
2712
2734
|
},
|
|
2713
2735
|
children: /* @__PURE__ */ jsxs10(Stack3, { gap: "16px", children: [
|
|
2714
|
-
error ? /* @__PURE__ */
|
|
2736
|
+
error ? /* @__PURE__ */ jsx15(Box8, { role: "alert", p: "10px 12px", color: "#B42318", bg: "#FEF3F2", borderWidth: "1px", borderColor: "#FECDCA", borderRadius: "7px", fontSize: "11px", children: messageOf2(error) }) : null,
|
|
2715
2737
|
renderFields(),
|
|
2716
|
-
!externalSubmit ? /* @__PURE__ */
|
|
2738
|
+
!externalSubmit ? /* @__PURE__ */ jsx15(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx15(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
|
|
2717
2739
|
] })
|
|
2718
2740
|
}
|
|
2719
2741
|
);
|
|
@@ -2734,9 +2756,9 @@ function CoreTabbedDetail({
|
|
|
2734
2756
|
}) {
|
|
2735
2757
|
const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
|
|
2736
2758
|
return /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
|
|
2737
|
-
/* @__PURE__ */
|
|
2759
|
+
/* @__PURE__ */ jsx15(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
|
|
2738
2760
|
const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
|
|
2739
|
-
return /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ jsx15(
|
|
2740
2762
|
Button7,
|
|
2741
2763
|
{
|
|
2742
2764
|
type: "button",
|
|
@@ -2749,7 +2771,7 @@ function CoreTabbedDetail({
|
|
|
2749
2771
|
tab.id
|
|
2750
2772
|
);
|
|
2751
2773
|
}) }),
|
|
2752
|
-
/* @__PURE__ */
|
|
2774
|
+
/* @__PURE__ */ jsx15(Box8, { children: !active ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx15(CoreSummaryCards, { cards: active.cards, parent, relations }) : active.type === "form" ? /* @__PURE__ */ jsx15(
|
|
2753
2775
|
InlineParentForm,
|
|
2754
2776
|
{
|
|
2755
2777
|
fields: fieldsForTab(formFields, active.fields ?? active.groups?.flatMap((group) => group.fields)),
|
|
@@ -2760,7 +2782,7 @@ function CoreTabbedDetail({
|
|
|
2760
2782
|
formId,
|
|
2761
2783
|
externalSubmit
|
|
2762
2784
|
}
|
|
2763
|
-
) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */
|
|
2785
|
+
) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx15(
|
|
2764
2786
|
CoreRelatedGrid,
|
|
2765
2787
|
{
|
|
2766
2788
|
tab: active,
|
|
@@ -2772,12 +2794,12 @@ function CoreTabbedDetail({
|
|
|
2772
2794
|
) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text9, { color: "#667085", children: [
|
|
2773
2795
|
"Componente customizado: ",
|
|
2774
2796
|
active.component
|
|
2775
|
-
] }) : /* @__PURE__ */
|
|
2797
|
+
] }) : /* @__PURE__ */ jsx15(Text9, { color: "#667085", children: "Salve o registro principal para liberar esta aba." }) })
|
|
2776
2798
|
] });
|
|
2777
2799
|
}
|
|
2778
2800
|
|
|
2779
2801
|
// src/components/internal/CoreDetailModal.tsx
|
|
2780
|
-
import { jsx as
|
|
2802
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2781
2803
|
function CoreDetailModal({
|
|
2782
2804
|
model,
|
|
2783
2805
|
title,
|
|
@@ -2835,15 +2857,15 @@ function CoreDetailModal({
|
|
|
2835
2857
|
const displayTitle = parent?.[config.titleField ?? ""] ? String(parent[config.titleField ?? ""]) : title;
|
|
2836
2858
|
const activeIsForm = (config.tabs.find((tab) => tab.id === activeTab) ?? config.tabs[0])?.type === "form";
|
|
2837
2859
|
const formId = `oon-detail-form-${model.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
2838
|
-
return /* @__PURE__ */
|
|
2860
|
+
return /* @__PURE__ */ jsx16(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsx16(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: /* @__PURE__ */ jsxs11(Box9, { role: "dialog", "aria-modal": "true", display: "flex", flexDirection: "column", w: `min(${width}, 98vw)`, h: "94vh", maxH: "94vh", overflow: "hidden", bg: "white", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
|
|
2839
2861
|
/* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
|
|
2840
2862
|
/* @__PURE__ */ jsxs11(Box9, { minW: "160px", children: [
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2863
|
+
/* @__PURE__ */ jsx16(Text10, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
|
|
2864
|
+
/* @__PURE__ */ jsx16(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
|
|
2843
2865
|
] }),
|
|
2844
2866
|
/* @__PURE__ */ jsxs11(Flex7, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
|
|
2845
2867
|
recordId ? topActions : null,
|
|
2846
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ jsx16(
|
|
2847
2869
|
IconButton,
|
|
2848
2870
|
{
|
|
2849
2871
|
"aria-label": "Fechar",
|
|
@@ -2864,7 +2886,7 @@ function CoreDetailModal({
|
|
|
2864
2886
|
)
|
|
2865
2887
|
] })
|
|
2866
2888
|
] }),
|
|
2867
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx16(Box9, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx16(Text10, { children: "Carregando..." }) : /* @__PURE__ */ jsx16(
|
|
2868
2890
|
CoreTabbedDetail,
|
|
2869
2891
|
{
|
|
2870
2892
|
tabs: config.tabs,
|
|
@@ -2900,16 +2922,16 @@ function CoreDetailModal({
|
|
|
2900
2922
|
borderColor: "#E5E9ED",
|
|
2901
2923
|
boxShadow: "0 -8px 24px rgba(15,23,42,.06)",
|
|
2902
2924
|
children: [
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsx16(Box9, { children: recordId ? bottomActions : null }),
|
|
2926
|
+
/* @__PURE__ */ jsx16(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !activeIsForm || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
|
|
2905
2927
|
]
|
|
2906
2928
|
}
|
|
2907
2929
|
)
|
|
2908
|
-
] }) });
|
|
2930
|
+
] }) }) });
|
|
2909
2931
|
}
|
|
2910
2932
|
|
|
2911
2933
|
// src/components/CoreCollection.tsx
|
|
2912
|
-
import { jsx as
|
|
2934
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2913
2935
|
function mergeFormFields(metadataFields, overrides) {
|
|
2914
2936
|
if (!overrides?.length) return metadataFields;
|
|
2915
2937
|
const byField = new Map(overrides.map((field) => [field.field, field]));
|
|
@@ -2951,16 +2973,16 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
2951
2973
|
mutationFn: (row) => resource.delete(row._id),
|
|
2952
2974
|
onSuccess: invalidate
|
|
2953
2975
|
});
|
|
2954
|
-
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */
|
|
2955
|
-
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */
|
|
2976
|
+
if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx17(LoadingScreen, {});
|
|
2977
|
+
if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx17(ErrorState, { error: schemaQuery.error });
|
|
2956
2978
|
const title = label ?? schema?.name ?? model;
|
|
2957
2979
|
return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
|
|
2958
2980
|
/* @__PURE__ */ jsxs12(Box10, { children: [
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2981
|
+
/* @__PURE__ */ jsx17(Text11, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
|
|
2982
|
+
/* @__PURE__ */ jsx17(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
|
|
2983
|
+
/* @__PURE__ */ jsx17(Text11, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
|
|
2962
2984
|
] }),
|
|
2963
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ jsx17(
|
|
2964
2986
|
DataGrid,
|
|
2965
2987
|
{
|
|
2966
2988
|
resource,
|
|
@@ -2981,7 +3003,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
2981
3003
|
onDelete: (row) => {
|
|
2982
3004
|
if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
|
|
2983
3005
|
},
|
|
2984
|
-
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */
|
|
3006
|
+
renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx17(
|
|
2985
3007
|
CoreRowAction,
|
|
2986
3008
|
{
|
|
2987
3009
|
action,
|
|
@@ -2993,7 +3015,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
2993
3015
|
)) : void 0
|
|
2994
3016
|
}
|
|
2995
3017
|
),
|
|
2996
|
-
formState.open ? /* @__PURE__ */
|
|
3018
|
+
formState.open ? /* @__PURE__ */ jsx17(
|
|
2997
3019
|
DynamicForm,
|
|
2998
3020
|
{
|
|
2999
3021
|
title: formState.row ? `Editar ${title}` : `Novo ${title}`,
|
|
@@ -3014,7 +3036,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3014
3036
|
}
|
|
3015
3037
|
) : null,
|
|
3016
3038
|
importExport ? null : null,
|
|
3017
|
-
detailState.open && detailModal?.enabled ? /* @__PURE__ */
|
|
3039
|
+
detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx17(
|
|
3018
3040
|
CoreDetailModal,
|
|
3019
3041
|
{
|
|
3020
3042
|
model,
|
|
@@ -3033,9 +3055,9 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
|
|
|
3033
3055
|
}
|
|
3034
3056
|
|
|
3035
3057
|
// src/components/CoreDocument.tsx
|
|
3036
|
-
import { jsx as
|
|
3058
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3037
3059
|
function CoreDocument({ model, label, endpoint, columns, form }) {
|
|
3038
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ jsx18(
|
|
3039
3061
|
CoreCollection,
|
|
3040
3062
|
{
|
|
3041
3063
|
model,
|
|
@@ -3192,7 +3214,7 @@ function pipelineBoardScrollStep(clientWidth) {
|
|
|
3192
3214
|
}
|
|
3193
3215
|
|
|
3194
3216
|
// src/components/CorePipeline.tsx
|
|
3195
|
-
import { jsx as
|
|
3217
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3196
3218
|
function ticketId(row) {
|
|
3197
3219
|
const id = row._id ?? row.id;
|
|
3198
3220
|
return id == null ? void 0 : String(id);
|
|
@@ -3216,7 +3238,7 @@ function workStatusColor(value) {
|
|
|
3216
3238
|
}
|
|
3217
3239
|
function PipelineArrowIcon({ direction }) {
|
|
3218
3240
|
const path = direction === "left" ? "M12.5 5 7.5 10l5 5" : "m7.5 5 5 5-5 5";
|
|
3219
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3220
3242
|
}
|
|
3221
3243
|
function PipelineFilterControl({
|
|
3222
3244
|
filter,
|
|
@@ -3225,7 +3247,7 @@ function PipelineFilterControl({
|
|
|
3225
3247
|
onChange
|
|
3226
3248
|
}) {
|
|
3227
3249
|
if (filter.type === "ref" && meta?.ref) {
|
|
3228
|
-
return /* @__PURE__ */
|
|
3250
|
+
return /* @__PURE__ */ jsx19(Box11, { w: "220px", children: /* @__PURE__ */ jsx19(
|
|
3229
3251
|
ReferenceSelect,
|
|
3230
3252
|
{
|
|
3231
3253
|
field: filter.field,
|
|
@@ -3244,11 +3266,11 @@ function PipelineFilterControl({
|
|
|
3244
3266
|
}
|
|
3245
3267
|
if (filter.type === "select") {
|
|
3246
3268
|
return /* @__PURE__ */ jsxs13(NativeSelect5.Root, { size: "sm", w: "190px", children: [
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3269
|
+
/* @__PURE__ */ jsx19(NativeSelect5.Field, { value: String(value ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx19("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
|
|
3270
|
+
/* @__PURE__ */ jsx19(NativeSelect5.Indicator, {})
|
|
3249
3271
|
] });
|
|
3250
3272
|
}
|
|
3251
|
-
return /* @__PURE__ */
|
|
3273
|
+
return /* @__PURE__ */ jsx19(
|
|
3252
3274
|
Input6,
|
|
3253
3275
|
{
|
|
3254
3276
|
w: "190px",
|
|
@@ -3339,9 +3361,9 @@ function CorePipeline({
|
|
|
3339
3361
|
},
|
|
3340
3362
|
onError: (error) => setFormError(error)
|
|
3341
3363
|
});
|
|
3342
|
-
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */
|
|
3343
|
-
if (schemaQuery.isError) return /* @__PURE__ */
|
|
3344
|
-
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */
|
|
3364
|
+
if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx19(LoadingScreen, {});
|
|
3365
|
+
if (schemaQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: schemaQuery.error });
|
|
3366
|
+
if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: listQuery.error });
|
|
3345
3367
|
const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
|
|
3346
3368
|
const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
|
|
3347
3369
|
const defaultActionsConfig = defaultActions === false ? void 0 : defaultActions;
|
|
@@ -3382,7 +3404,7 @@ function CorePipeline({
|
|
|
3382
3404
|
const step = pipelineBoardScrollStep(board.clientWidth);
|
|
3383
3405
|
board.scrollBy({ left: direction === "left" ? -step : step, behavior: "smooth" });
|
|
3384
3406
|
};
|
|
3385
|
-
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */
|
|
3407
|
+
const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx19(
|
|
3386
3408
|
CoreRowAction,
|
|
3387
3409
|
{
|
|
3388
3410
|
action,
|
|
@@ -3401,29 +3423,29 @@ function CorePipeline({
|
|
|
3401
3423
|
},
|
|
3402
3424
|
action.id ?? `${action.label}-${index}`
|
|
3403
3425
|
) : null;
|
|
3404
|
-
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */
|
|
3426
|
+
const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
|
|
3405
3427
|
const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3406
|
-
groupedTicketActions.approval.length ? /* @__PURE__ */
|
|
3407
|
-
groupedTicketActions.custom.length ? /* @__PURE__ */
|
|
3428
|
+
groupedTicketActions.approval.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
|
|
3429
|
+
groupedTicketActions.custom.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
|
|
3408
3430
|
] }) : null;
|
|
3409
3431
|
return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
|
|
3410
3432
|
/* @__PURE__ */ jsxs13(Flex8, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
|
|
3411
3433
|
/* @__PURE__ */ jsxs13(Box11, { children: [
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ jsx19(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
|
|
3435
|
+
/* @__PURE__ */ jsx19(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
|
|
3436
|
+
/* @__PURE__ */ jsx19(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
|
|
3415
3437
|
] }),
|
|
3416
3438
|
/* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
|
|
3417
|
-
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */
|
|
3418
|
-
create?.enabled ? /* @__PURE__ */
|
|
3439
|
+
allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx19(Button9, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
|
|
3440
|
+
create?.enabled ? /* @__PURE__ */ jsx19(Button9, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
|
|
3419
3441
|
] })
|
|
3420
3442
|
] }),
|
|
3421
3443
|
filters.length ? /* @__PURE__ */ jsxs13(Flex8, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
|
|
3422
3444
|
filters.map((filter) => {
|
|
3423
3445
|
const meta = schema?.fields.find((field) => field.name === filter.field);
|
|
3424
3446
|
return /* @__PURE__ */ jsxs13(Box11, { children: [
|
|
3425
|
-
/* @__PURE__ */
|
|
3426
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ jsx19(Text12, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
|
|
3448
|
+
/* @__PURE__ */ jsx19(
|
|
3427
3449
|
PipelineFilterControl,
|
|
3428
3450
|
{
|
|
3429
3451
|
filter,
|
|
@@ -3434,7 +3456,7 @@ function CorePipeline({
|
|
|
3434
3456
|
)
|
|
3435
3457
|
] }, filter.field);
|
|
3436
3458
|
}),
|
|
3437
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsx19(
|
|
3438
3460
|
Button9,
|
|
3439
3461
|
{
|
|
3440
3462
|
size: "sm",
|
|
@@ -3444,7 +3466,7 @@ function CorePipeline({
|
|
|
3444
3466
|
}
|
|
3445
3467
|
)
|
|
3446
3468
|
] }) : null,
|
|
3447
|
-
viewMode === "list" ? /* @__PURE__ */
|
|
3469
|
+
viewMode === "list" ? /* @__PURE__ */ jsx19(
|
|
3448
3470
|
DataGrid,
|
|
3449
3471
|
{
|
|
3450
3472
|
resource,
|
|
@@ -3458,7 +3480,7 @@ function CorePipeline({
|
|
|
3458
3480
|
}
|
|
3459
3481
|
}
|
|
3460
3482
|
) : /* @__PURE__ */ jsxs13(Box11, { position: "relative", children: [
|
|
3461
|
-
/* @__PURE__ */
|
|
3483
|
+
/* @__PURE__ */ jsx19(
|
|
3462
3484
|
Flex8,
|
|
3463
3485
|
{
|
|
3464
3486
|
ref: boardRef,
|
|
@@ -3478,10 +3500,10 @@ function CorePipeline({
|
|
|
3478
3500
|
const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
|
|
3479
3501
|
return /* @__PURE__ */ jsxs13(Box11, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
|
|
3480
3502
|
/* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
|
|
3481
|
-
/* @__PURE__ */
|
|
3482
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsx19(Text12, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
|
|
3504
|
+
/* @__PURE__ */ jsx19(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
|
|
3483
3505
|
] }),
|
|
3484
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsx19(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx19(Box11, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx19(Text12, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
|
|
3485
3507
|
const ticketTitle = formatCell(row[resolvedTitleField], "string");
|
|
3486
3508
|
return /* @__PURE__ */ jsxs13(
|
|
3487
3509
|
Button9,
|
|
@@ -3509,8 +3531,8 @@ function CorePipeline({
|
|
|
3509
3531
|
_hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
|
|
3510
3532
|
children: [
|
|
3511
3533
|
/* @__PURE__ */ jsxs13(Flex8, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx19(Text12, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
|
|
3535
|
+
/* @__PURE__ */ jsx19(
|
|
3514
3536
|
Box11,
|
|
3515
3537
|
{
|
|
3516
3538
|
as: "span",
|
|
@@ -3526,9 +3548,9 @@ function CorePipeline({
|
|
|
3526
3548
|
}
|
|
3527
3549
|
)
|
|
3528
3550
|
] }),
|
|
3529
|
-
/* @__PURE__ */
|
|
3530
|
-
/* @__PURE__ */
|
|
3531
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsx19(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
|
|
3552
|
+
/* @__PURE__ */ jsx19(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
|
|
3553
|
+
/* @__PURE__ */ jsx19(Text12, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
|
|
3532
3554
|
] }, field.name)) })
|
|
3533
3555
|
]
|
|
3534
3556
|
},
|
|
@@ -3539,7 +3561,7 @@ function CorePipeline({
|
|
|
3539
3561
|
})
|
|
3540
3562
|
}
|
|
3541
3563
|
),
|
|
3542
|
-
/* @__PURE__ */
|
|
3564
|
+
/* @__PURE__ */ jsx19(
|
|
3543
3565
|
Button9,
|
|
3544
3566
|
{
|
|
3545
3567
|
type: "button",
|
|
@@ -3563,10 +3585,10 @@ function CorePipeline({
|
|
|
3563
3585
|
onClick: () => scrollBoard("left"),
|
|
3564
3586
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3565
3587
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3566
|
-
children: /* @__PURE__ */
|
|
3588
|
+
children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "left" })
|
|
3567
3589
|
}
|
|
3568
3590
|
),
|
|
3569
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx19(
|
|
3570
3592
|
Button9,
|
|
3571
3593
|
{
|
|
3572
3594
|
type: "button",
|
|
@@ -3590,11 +3612,11 @@ function CorePipeline({
|
|
|
3590
3612
|
onClick: () => scrollBoard("right"),
|
|
3591
3613
|
_hover: { bg: "white", borderColor: "brand.400" },
|
|
3592
3614
|
_disabled: { opacity: 0.25, cursor: "not-allowed" },
|
|
3593
|
-
children: /* @__PURE__ */
|
|
3615
|
+
children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "right" })
|
|
3594
3616
|
}
|
|
3595
3617
|
)
|
|
3596
3618
|
] }),
|
|
3597
|
-
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */
|
|
3619
|
+
selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx19(
|
|
3598
3620
|
CoreDetailModal,
|
|
3599
3621
|
{
|
|
3600
3622
|
model,
|
|
@@ -3620,7 +3642,7 @@ function CorePipeline({
|
|
|
3620
3642
|
}
|
|
3621
3643
|
}
|
|
3622
3644
|
}
|
|
3623
|
-
) : selectedTicket ? /* @__PURE__ */
|
|
3645
|
+
) : selectedTicket ? /* @__PURE__ */ jsx19(
|
|
3624
3646
|
DynamicForm,
|
|
3625
3647
|
{
|
|
3626
3648
|
title: `${creating ? "Novo" : "Editar"} ${schema?.singular ?? label ?? model}`,
|
|
@@ -3649,7 +3671,7 @@ function CorePipeline({
|
|
|
3649
3671
|
// src/components/CoreDashboard.tsx
|
|
3650
3672
|
import { Box as Box12, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text13 } from "@chakra-ui/react";
|
|
3651
3673
|
import { useQueries } from "@tanstack/react-query";
|
|
3652
|
-
import { jsx as
|
|
3674
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3653
3675
|
function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
3654
3676
|
const { resource } = useOonApi();
|
|
3655
3677
|
const queries = useQueries({
|
|
@@ -3667,16 +3689,16 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
|
3667
3689
|
});
|
|
3668
3690
|
let queryIdx = 0;
|
|
3669
3691
|
return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
|
|
3670
|
-
/* @__PURE__ */
|
|
3671
|
-
/* @__PURE__ */
|
|
3692
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "lg", children: label }),
|
|
3693
|
+
/* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
|
|
3672
3694
|
if (w.kind === "custom" && w.render) {
|
|
3673
|
-
return /* @__PURE__ */
|
|
3695
|
+
return /* @__PURE__ */ jsx20(Box12, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
|
|
3674
3696
|
}
|
|
3675
3697
|
const q = queries[queryIdx++];
|
|
3676
3698
|
const value = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
|
|
3677
3699
|
return /* @__PURE__ */ jsxs14(Box12, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
|
|
3678
|
-
/* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3700
|
+
/* @__PURE__ */ jsx20(Text13, { fontSize: "sm", color: "gray.500", children: w.label }),
|
|
3701
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 1, children: value })
|
|
3680
3702
|
] }, w.id);
|
|
3681
3703
|
}) })
|
|
3682
3704
|
] });
|
|
@@ -3693,19 +3715,19 @@ function formatWidget(value, kind, field) {
|
|
|
3693
3715
|
import { Box as Box15, Heading as Heading8, Stack as Stack7, Text as Text16 } from "@chakra-ui/react";
|
|
3694
3716
|
|
|
3695
3717
|
// src/security/PermissionGate.tsx
|
|
3696
|
-
import { Fragment as Fragment3, jsx as
|
|
3718
|
+
import { Fragment as Fragment3, jsx as jsx21 } from "react/jsx-runtime";
|
|
3697
3719
|
function PermissionGate({
|
|
3698
3720
|
permission,
|
|
3699
3721
|
fallback = null,
|
|
3700
3722
|
children
|
|
3701
3723
|
}) {
|
|
3702
3724
|
const { hasPermission } = useOonAuth();
|
|
3703
|
-
return /* @__PURE__ */
|
|
3725
|
+
return /* @__PURE__ */ jsx21(Fragment3, { children: hasPermission(permission) ? children : fallback });
|
|
3704
3726
|
}
|
|
3705
3727
|
|
|
3706
3728
|
// src/app/componentRegistry.tsx
|
|
3707
3729
|
import { Box as Box13, Text as Text14 } from "@chakra-ui/react";
|
|
3708
|
-
import { Fragment as Fragment4, jsx as
|
|
3730
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3709
3731
|
var PREFIX_BUCKETS = {
|
|
3710
3732
|
"custom": "pageComponents",
|
|
3711
3733
|
"fields": "fieldRenderers",
|
|
@@ -3725,12 +3747,12 @@ function resolveComponent(registry, key, bucket) {
|
|
|
3725
3747
|
return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
|
|
3726
3748
|
}
|
|
3727
3749
|
function MissingRenderer({ renderer, children }) {
|
|
3728
|
-
if (import.meta.env?.MODE === "production") return /* @__PURE__ */
|
|
3750
|
+
if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx22(Fragment4, { children: children ?? null });
|
|
3729
3751
|
return /* @__PURE__ */ jsxs15(Box13, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
|
|
3730
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsx22(Text14, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
|
|
3731
3753
|
/* @__PURE__ */ jsxs15(Text14, { fontSize: "xs", children: [
|
|
3732
3754
|
"Registre a chave ",
|
|
3733
|
-
renderer ? /* @__PURE__ */
|
|
3755
|
+
renderer ? /* @__PURE__ */ jsx22("code", { children: renderer }) : "solicitada",
|
|
3734
3756
|
" no registry da UI."
|
|
3735
3757
|
] }),
|
|
3736
3758
|
children
|
|
@@ -3739,60 +3761,60 @@ function MissingRenderer({ renderer, children }) {
|
|
|
3739
3761
|
|
|
3740
3762
|
// src/components/ui-v2/CorePrimitives.tsx
|
|
3741
3763
|
import { Box as Box14, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text15 } from "@chakra-ui/react";
|
|
3742
|
-
import { jsx as
|
|
3764
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3743
3765
|
function CorePage({ children }) {
|
|
3744
|
-
return /* @__PURE__ */
|
|
3766
|
+
return /* @__PURE__ */ jsx23(Box14, { children });
|
|
3745
3767
|
}
|
|
3746
3768
|
function CorePageHeader({ title, description, actions }) {
|
|
3747
3769
|
return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
|
|
3748
3770
|
/* @__PURE__ */ jsxs16(Box14, { children: [
|
|
3749
|
-
title ? /* @__PURE__ */
|
|
3750
|
-
description ? /* @__PURE__ */
|
|
3771
|
+
title ? /* @__PURE__ */ jsx23(Heading7, { size: "lg", children: title }) : null,
|
|
3772
|
+
description ? /* @__PURE__ */ jsx23(Text15, { color: "gray.600", mt: 1, children: description }) : null
|
|
3751
3773
|
] }),
|
|
3752
3774
|
actions
|
|
3753
3775
|
] });
|
|
3754
3776
|
}
|
|
3755
3777
|
function CoreToolbar({ children }) {
|
|
3756
|
-
return /* @__PURE__ */
|
|
3778
|
+
return /* @__PURE__ */ jsx23(Flex9, { align: "center", gap: 2, mb: 4, children });
|
|
3757
3779
|
}
|
|
3758
3780
|
function CoreDataGrid(props) {
|
|
3759
|
-
return /* @__PURE__ */
|
|
3781
|
+
return /* @__PURE__ */ jsx23(CoreCollection, { ...props });
|
|
3760
3782
|
}
|
|
3761
3783
|
function CoreCards(props) {
|
|
3762
|
-
return /* @__PURE__ */
|
|
3784
|
+
return /* @__PURE__ */ jsx23(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
|
|
3763
3785
|
}
|
|
3764
3786
|
function CoreForm(props) {
|
|
3765
|
-
return /* @__PURE__ */
|
|
3787
|
+
return /* @__PURE__ */ jsx23(Box14, { children: props.children });
|
|
3766
3788
|
}
|
|
3767
3789
|
function CoreField({ label, children }) {
|
|
3768
3790
|
return /* @__PURE__ */ jsxs16(Box14, { children: [
|
|
3769
|
-
/* @__PURE__ */
|
|
3791
|
+
/* @__PURE__ */ jsx23(Text15, { fontSize: "sm", fontWeight: "600", children: label }),
|
|
3770
3792
|
children
|
|
3771
3793
|
] });
|
|
3772
3794
|
}
|
|
3773
3795
|
function CoreRelationField(props) {
|
|
3774
|
-
return /* @__PURE__ */
|
|
3796
|
+
return /* @__PURE__ */ jsx23(CoreField, { ...props });
|
|
3775
3797
|
}
|
|
3776
3798
|
function CoreActions({ children }) {
|
|
3777
|
-
return /* @__PURE__ */
|
|
3799
|
+
return /* @__PURE__ */ jsx23(Flex9, { gap: 2, children });
|
|
3778
3800
|
}
|
|
3779
3801
|
function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
|
|
3780
3802
|
return /* @__PURE__ */ jsxs16(Box14, { textAlign: "center", py: 10, children: [
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
actionLabel ? /* @__PURE__ */
|
|
3803
|
+
/* @__PURE__ */ jsx23(Text15, { children: title }),
|
|
3804
|
+
actionLabel ? /* @__PURE__ */ jsx23(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
|
|
3783
3805
|
] });
|
|
3784
3806
|
}
|
|
3785
3807
|
function CoreLoadingState({ label = "Carregando..." }) {
|
|
3786
3808
|
return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
|
|
3787
|
-
/* @__PURE__ */
|
|
3788
|
-
/* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ jsx23(Spinner3, { size: "sm" }),
|
|
3810
|
+
/* @__PURE__ */ jsx23(Text15, { children: label })
|
|
3789
3811
|
] });
|
|
3790
3812
|
}
|
|
3791
3813
|
|
|
3792
3814
|
// src/components/ui-v2/CorePage.tsx
|
|
3793
|
-
import { jsx as
|
|
3815
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3794
3816
|
function renderMarkdown(content) {
|
|
3795
|
-
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */
|
|
3817
|
+
return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx24(Text16, { whiteSpace: "pre-wrap", children: paragraph }, index));
|
|
3796
3818
|
}
|
|
3797
3819
|
function requiredAccess(source) {
|
|
3798
3820
|
const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
|
|
@@ -3804,38 +3826,38 @@ function CoreBlock({ block, registry }) {
|
|
|
3804
3826
|
switch (block.type) {
|
|
3805
3827
|
case "custom": {
|
|
3806
3828
|
const Component = resolveComponent(registry, block.component, "pageComponents");
|
|
3807
|
-
return Component ? /* @__PURE__ */
|
|
3829
|
+
return Component ? /* @__PURE__ */ jsx24(Component, { block, ...block.props }) : /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.component });
|
|
3808
3830
|
}
|
|
3809
3831
|
case "collection.datagrid":
|
|
3810
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ jsx24(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
|
|
3811
3833
|
case "collection.cards": {
|
|
3812
3834
|
const Component = resolveComponent(registry, block.renderer, "cardRenderers");
|
|
3813
|
-
return Component ? /* @__PURE__ */
|
|
3835
|
+
return Component ? /* @__PURE__ */ jsx24(Component, { block, model: block.model }) : /* @__PURE__ */ jsx24(CoreCards, { model: block.model, renderer: block.renderer });
|
|
3814
3836
|
}
|
|
3815
3837
|
case "section":
|
|
3816
3838
|
return /* @__PURE__ */ jsxs17(Box15, { children: [
|
|
3817
|
-
/* @__PURE__ */
|
|
3818
|
-
block.description ? /* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsx24(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
|
|
3840
|
+
block.description ? /* @__PURE__ */ jsx24(Text16, { color: "gray.600", mb: 4, children: block.description }) : null,
|
|
3841
|
+
/* @__PURE__ */ jsx24(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx24(CoreBlock, { block: child, registry }, child.id ?? index)) })
|
|
3820
3842
|
] });
|
|
3821
3843
|
case "markdown":
|
|
3822
|
-
return /* @__PURE__ */
|
|
3844
|
+
return /* @__PURE__ */ jsx24(Stack7, { gap: 2, children: renderMarkdown(block.content) });
|
|
3823
3845
|
default:
|
|
3824
|
-
return /* @__PURE__ */
|
|
3846
|
+
return /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.type });
|
|
3825
3847
|
}
|
|
3826
3848
|
})();
|
|
3827
|
-
return /* @__PURE__ */
|
|
3849
|
+
return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(block), children: content });
|
|
3828
3850
|
}
|
|
3829
3851
|
function CorePage2({ page, registry }) {
|
|
3830
3852
|
const Component = resolveComponent(registry, page.component, "pageComponents");
|
|
3831
|
-
return /* @__PURE__ */
|
|
3832
|
-
/* @__PURE__ */
|
|
3833
|
-
/* @__PURE__ */
|
|
3853
|
+
return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx24(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
|
|
3854
|
+
/* @__PURE__ */ jsx24(CorePageHeader, { title: page.title ?? page.label }),
|
|
3855
|
+
/* @__PURE__ */ jsx24(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx24(CoreBlock, { block, registry }, block.id ?? index)) })
|
|
3834
3856
|
] }) });
|
|
3835
3857
|
}
|
|
3836
3858
|
|
|
3837
3859
|
// src/app/moduleRegistry.tsx
|
|
3838
|
-
import { jsx as
|
|
3860
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3839
3861
|
function slug2(value) {
|
|
3840
3862
|
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3841
3863
|
}
|
|
@@ -3862,7 +3884,7 @@ function renderView(view, registry) {
|
|
|
3862
3884
|
switch (view.type) {
|
|
3863
3885
|
case "collection": {
|
|
3864
3886
|
const v = view;
|
|
3865
|
-
return /* @__PURE__ */
|
|
3887
|
+
return /* @__PURE__ */ jsx25(
|
|
3866
3888
|
CoreCollection,
|
|
3867
3889
|
{
|
|
3868
3890
|
model: v.model,
|
|
@@ -3881,11 +3903,11 @@ function renderView(view, registry) {
|
|
|
3881
3903
|
}
|
|
3882
3904
|
case "document": {
|
|
3883
3905
|
const v = view;
|
|
3884
|
-
return /* @__PURE__ */
|
|
3906
|
+
return /* @__PURE__ */ jsx25(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
|
|
3885
3907
|
}
|
|
3886
3908
|
case "pipeline": {
|
|
3887
3909
|
const v = view;
|
|
3888
|
-
return /* @__PURE__ */
|
|
3910
|
+
return /* @__PURE__ */ jsx25(
|
|
3889
3911
|
CorePipeline,
|
|
3890
3912
|
{
|
|
3891
3913
|
model: v.model,
|
|
@@ -3908,7 +3930,7 @@ function renderView(view, registry) {
|
|
|
3908
3930
|
}
|
|
3909
3931
|
case "dashboard": {
|
|
3910
3932
|
const v = view;
|
|
3911
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ jsx25(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
|
|
3912
3934
|
}
|
|
3913
3935
|
default:
|
|
3914
3936
|
return null;
|
|
@@ -3922,7 +3944,7 @@ function viewToRoute(view, registry) {
|
|
|
3922
3944
|
};
|
|
3923
3945
|
}
|
|
3924
3946
|
function pageToRoute(page, registry) {
|
|
3925
|
-
return { path: page.path, element: /* @__PURE__ */
|
|
3947
|
+
return { path: page.path, element: /* @__PURE__ */ jsx25(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
|
|
3926
3948
|
}
|
|
3927
3949
|
function pageToMenu(page) {
|
|
3928
3950
|
if (page.hidden || !page.label) return null;
|
|
@@ -3990,7 +4012,7 @@ import { Outlet } from "react-router-dom";
|
|
|
3990
4012
|
// src/shell/Sidebar.tsx
|
|
3991
4013
|
import { Box as Box16, Flex as Flex10, Image, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
|
|
3992
4014
|
import { NavLink } from "react-router-dom";
|
|
3993
|
-
import { jsx as
|
|
4015
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3994
4016
|
function groupBySection(items) {
|
|
3995
4017
|
const groups = /* @__PURE__ */ new Map();
|
|
3996
4018
|
for (const item of items) {
|
|
@@ -4020,7 +4042,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4020
4042
|
overflowY: "auto",
|
|
4021
4043
|
children: [
|
|
4022
4044
|
/* @__PURE__ */ jsxs18(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
|
|
4023
|
-
app.logo ? /* @__PURE__ */
|
|
4045
|
+
app.logo ? /* @__PURE__ */ jsx26(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx26(
|
|
4024
4046
|
Flex10,
|
|
4025
4047
|
{
|
|
4026
4048
|
w: "38px",
|
|
@@ -4037,12 +4059,12 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4037
4059
|
}
|
|
4038
4060
|
),
|
|
4039
4061
|
/* @__PURE__ */ jsxs18(Box16, { display: { base: "none", lg: "block" }, minW: 0, children: [
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4062
|
+
/* @__PURE__ */ jsx26(Text17, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
|
|
4063
|
+
/* @__PURE__ */ jsx26(Text17, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
|
|
4042
4064
|
] })
|
|
4043
4065
|
] }),
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4066
|
+
/* @__PURE__ */ jsx26(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
|
|
4067
|
+
/* @__PURE__ */ jsx26(
|
|
4046
4068
|
Text17,
|
|
4047
4069
|
{
|
|
4048
4070
|
display: { base: "none", lg: "block" },
|
|
@@ -4058,8 +4080,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4058
4080
|
),
|
|
4059
4081
|
items.map((item) => {
|
|
4060
4082
|
const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
|
|
4061
|
-
if (CustomMenuItem) return /* @__PURE__ */
|
|
4062
|
-
return /* @__PURE__ */
|
|
4083
|
+
if (CustomMenuItem) return /* @__PURE__ */ jsx26(CustomMenuItem, { item }, item.href);
|
|
4084
|
+
return /* @__PURE__ */ jsx26(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
|
|
4063
4085
|
Flex10,
|
|
4064
4086
|
{
|
|
4065
4087
|
align: "center",
|
|
@@ -4077,8 +4099,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4077
4099
|
transition: "all 0.15s ease",
|
|
4078
4100
|
_hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
|
|
4079
4101
|
children: [
|
|
4080
|
-
item.icon ? /* @__PURE__ */
|
|
4081
|
-
/* @__PURE__ */
|
|
4102
|
+
item.icon ? /* @__PURE__ */ jsx26(Box16, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx26(Box16, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
|
|
4103
|
+
/* @__PURE__ */ jsx26(Text17, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
|
|
4082
4104
|
]
|
|
4083
4105
|
}
|
|
4084
4106
|
) }, item.href);
|
|
@@ -4090,21 +4112,21 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4090
4112
|
}
|
|
4091
4113
|
|
|
4092
4114
|
// src/shell/DefaultShell.tsx
|
|
4093
|
-
import { jsx as
|
|
4115
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4094
4116
|
function CoreTopbar({ app }) {
|
|
4095
4117
|
const { user, logout } = useOonAuth();
|
|
4096
4118
|
return /* @__PURE__ */ jsxs19(Flex11, { as: "header", align: "center", minH: "64px", px: { base: 4, lg: 6 }, py: 3, borderBottomWidth: "1px", borderColor: "#E8ECEF", bg: "rgba(255, 255, 255, 0.96)", backdropFilter: "blur(10px)", position: "sticky", top: 0, zIndex: 10, children: [
|
|
4097
4119
|
/* @__PURE__ */ jsxs19(Box17, { children: [
|
|
4098
|
-
/* @__PURE__ */
|
|
4099
|
-
/* @__PURE__ */
|
|
4120
|
+
/* @__PURE__ */ jsx27(Text18, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
|
|
4121
|
+
/* @__PURE__ */ jsx27(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
|
|
4100
4122
|
] }),
|
|
4101
|
-
/* @__PURE__ */
|
|
4123
|
+
/* @__PURE__ */ jsx27(Spacer2, {}),
|
|
4102
4124
|
user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
|
|
4103
4125
|
/* @__PURE__ */ jsxs19(Box17, { textAlign: "right", display: { base: "none", md: "block" }, children: [
|
|
4104
|
-
/* @__PURE__ */
|
|
4105
|
-
user.email ? /* @__PURE__ */
|
|
4126
|
+
/* @__PURE__ */ jsx27(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
|
|
4127
|
+
user.email ? /* @__PURE__ */ jsx27(Text18, { fontSize: "xs", color: "gray.500", children: user.email }) : null
|
|
4106
4128
|
] }),
|
|
4107
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsx27(Button11, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
|
|
4108
4130
|
] }) : null
|
|
4109
4131
|
] });
|
|
4110
4132
|
}
|
|
@@ -4112,45 +4134,45 @@ function Slot({ name, slot, registry, app, menu }) {
|
|
|
4112
4134
|
if (slot === "none") return null;
|
|
4113
4135
|
if (slot?.startsWith("custom:")) {
|
|
4114
4136
|
const C = resolveComponent(registry, slot, "layoutSlots");
|
|
4115
|
-
return C ? /* @__PURE__ */
|
|
4137
|
+
return C ? /* @__PURE__ */ jsx27(C, { app, menu }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: slot });
|
|
4116
4138
|
}
|
|
4117
|
-
if (name === "sidebar") return /* @__PURE__ */
|
|
4118
|
-
if (name === "topbar") return /* @__PURE__ */
|
|
4119
|
-
if (name === "footer" && slot === "core") return /* @__PURE__ */
|
|
4139
|
+
if (name === "sidebar") return /* @__PURE__ */ jsx27(Sidebar, { app, menu, registry });
|
|
4140
|
+
if (name === "topbar") return /* @__PURE__ */ jsx27(CoreTopbar, { app });
|
|
4141
|
+
if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx27(Box17, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
|
|
4120
4142
|
return null;
|
|
4121
4143
|
}
|
|
4122
4144
|
function DefaultShell({ app, menu, layout, registry }) {
|
|
4123
4145
|
const portal = layout?.shell === "portal" || layout?.shell === "content-only";
|
|
4124
4146
|
const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
|
|
4125
4147
|
return /* @__PURE__ */ jsxs19(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
|
|
4126
|
-
/* @__PURE__ */
|
|
4148
|
+
/* @__PURE__ */ jsx27(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
|
|
4127
4149
|
/* @__PURE__ */ jsxs19(Flex11, { direction: "column", flex: "1", minW: 0, children: [
|
|
4128
|
-
/* @__PURE__ */
|
|
4129
|
-
/* @__PURE__ */
|
|
4130
|
-
/* @__PURE__ */
|
|
4131
|
-
/* @__PURE__ */
|
|
4150
|
+
/* @__PURE__ */ jsx27(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
|
|
4151
|
+
/* @__PURE__ */ jsx27(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
|
|
4152
|
+
/* @__PURE__ */ jsx27(Box17, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx27(Box17, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx27(Outlet, {}) }) }),
|
|
4153
|
+
/* @__PURE__ */ jsx27(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
|
|
4132
4154
|
] })
|
|
4133
4155
|
] });
|
|
4134
4156
|
}
|
|
4135
4157
|
function PortalShell(props) {
|
|
4136
|
-
return /* @__PURE__ */
|
|
4158
|
+
return /* @__PURE__ */ jsx27(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
|
|
4137
4159
|
}
|
|
4138
4160
|
|
|
4139
4161
|
// src/shell/AuthenticatedLayout.tsx
|
|
4140
|
-
import { jsx as
|
|
4162
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4141
4163
|
function AuthenticatedLayout({ app, menu, layout, registry }) {
|
|
4142
4164
|
if (layout?.shell?.startsWith("custom:")) {
|
|
4143
4165
|
const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
|
|
4144
|
-
return CustomShell ? /* @__PURE__ */
|
|
4166
|
+
return CustomShell ? /* @__PURE__ */ jsx28(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx28(MissingRenderer, { renderer: layout.shell });
|
|
4145
4167
|
}
|
|
4146
|
-
if (layout?.shell === "portal") return /* @__PURE__ */
|
|
4147
|
-
return /* @__PURE__ */
|
|
4168
|
+
if (layout?.shell === "portal") return /* @__PURE__ */ jsx28(PortalShell, { app, menu, layout, registry });
|
|
4169
|
+
return /* @__PURE__ */ jsx28(DefaultShell, { app, menu, layout, registry });
|
|
4148
4170
|
}
|
|
4149
4171
|
|
|
4150
4172
|
// src/security/AccessDeniedPage.tsx
|
|
4151
4173
|
import { Box as Box18, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text19, VStack } from "@chakra-ui/react";
|
|
4152
4174
|
import { useNavigate } from "react-router-dom";
|
|
4153
|
-
import { jsx as
|
|
4175
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4154
4176
|
function AccessDeniedPage({ app }) {
|
|
4155
4177
|
const { logout } = useOonAuth();
|
|
4156
4178
|
const navigate = useNavigate();
|
|
@@ -4158,7 +4180,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4158
4180
|
logout();
|
|
4159
4181
|
navigate("/login", { replace: true });
|
|
4160
4182
|
}
|
|
4161
|
-
return /* @__PURE__ */
|
|
4183
|
+
return /* @__PURE__ */ jsx29(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx29(
|
|
4162
4184
|
Box18,
|
|
4163
4185
|
{
|
|
4164
4186
|
width: "100%",
|
|
@@ -4170,7 +4192,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4170
4192
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4171
4193
|
p: { base: 6, md: 10 },
|
|
4172
4194
|
children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
|
|
4173
|
-
/* @__PURE__ */
|
|
4195
|
+
/* @__PURE__ */ jsx29(
|
|
4174
4196
|
Box18,
|
|
4175
4197
|
{
|
|
4176
4198
|
width: "56px",
|
|
@@ -4188,7 +4210,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4188
4210
|
}
|
|
4189
4211
|
),
|
|
4190
4212
|
/* @__PURE__ */ jsxs20(Box18, { children: [
|
|
4191
|
-
/* @__PURE__ */
|
|
4213
|
+
/* @__PURE__ */ jsx29(
|
|
4192
4214
|
Text19,
|
|
4193
4215
|
{
|
|
4194
4216
|
color: "#39BFED",
|
|
@@ -4199,14 +4221,14 @@ function AccessDeniedPage({ app }) {
|
|
|
4199
4221
|
children: "Acesso negado"
|
|
4200
4222
|
}
|
|
4201
4223
|
),
|
|
4202
|
-
/* @__PURE__ */
|
|
4224
|
+
/* @__PURE__ */ jsx29(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
|
|
4203
4225
|
/* @__PURE__ */ jsxs20(Text19, { mt: 3, color: "gray.600", children: [
|
|
4204
4226
|
"Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
|
|
4205
4227
|
app.title ?? app.name,
|
|
4206
4228
|
". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
|
|
4207
4229
|
] })
|
|
4208
4230
|
] }),
|
|
4209
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx29(
|
|
4210
4232
|
Button12,
|
|
4211
4233
|
{
|
|
4212
4234
|
alignSelf: "flex-start",
|
|
@@ -4224,7 +4246,7 @@ function AccessDeniedPage({ app }) {
|
|
|
4224
4246
|
|
|
4225
4247
|
// src/security/AppAccessGuard.tsx
|
|
4226
4248
|
import { Navigate, useLocation } from "react-router-dom";
|
|
4227
|
-
import { Fragment as Fragment5, jsx as
|
|
4249
|
+
import { Fragment as Fragment5, jsx as jsx30 } from "react/jsx-runtime";
|
|
4228
4250
|
function loginRedirect(pathname, search) {
|
|
4229
4251
|
const destination = `${pathname}${search}`;
|
|
4230
4252
|
return `/login?redirect=${encodeURIComponent(destination)}`;
|
|
@@ -4232,9 +4254,9 @@ function loginRedirect(pathname, search) {
|
|
|
4232
4254
|
function AppAccessGuard({ children }) {
|
|
4233
4255
|
const { status, retry } = useOonAuth();
|
|
4234
4256
|
const location = useLocation();
|
|
4235
|
-
if (status === "loading") return /* @__PURE__ */
|
|
4257
|
+
if (status === "loading") return /* @__PURE__ */ jsx30(LoadingScreen, {});
|
|
4236
4258
|
if (status === "unauthenticated") {
|
|
4237
|
-
return /* @__PURE__ */
|
|
4259
|
+
return /* @__PURE__ */ jsx30(
|
|
4238
4260
|
Navigate,
|
|
4239
4261
|
{
|
|
4240
4262
|
to: loginRedirect(location.pathname, location.search),
|
|
@@ -4243,10 +4265,10 @@ function AppAccessGuard({ children }) {
|
|
|
4243
4265
|
);
|
|
4244
4266
|
}
|
|
4245
4267
|
if (status === "forbidden") {
|
|
4246
|
-
return /* @__PURE__ */
|
|
4268
|
+
return /* @__PURE__ */ jsx30(Navigate, { to: "/acesso-negado", replace: true });
|
|
4247
4269
|
}
|
|
4248
4270
|
if (status === "error") {
|
|
4249
|
-
return /* @__PURE__ */
|
|
4271
|
+
return /* @__PURE__ */ jsx30(
|
|
4250
4272
|
LoadingScreen,
|
|
4251
4273
|
{
|
|
4252
4274
|
message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
|
|
@@ -4257,7 +4279,7 @@ function AppAccessGuard({ children }) {
|
|
|
4257
4279
|
}
|
|
4258
4280
|
);
|
|
4259
4281
|
}
|
|
4260
|
-
return /* @__PURE__ */
|
|
4282
|
+
return /* @__PURE__ */ jsx30(Fragment5, { children });
|
|
4261
4283
|
}
|
|
4262
4284
|
|
|
4263
4285
|
// src/security/LoginPage.tsx
|
|
@@ -4272,7 +4294,7 @@ import {
|
|
|
4272
4294
|
VStack as VStack2
|
|
4273
4295
|
} from "@chakra-ui/react";
|
|
4274
4296
|
import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
4275
|
-
import { jsx as
|
|
4297
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4276
4298
|
function safeRedirect(search) {
|
|
4277
4299
|
const value = new URLSearchParams(search).get("redirect") || "/";
|
|
4278
4300
|
if (!value.startsWith("/") || value.startsWith("//")) return "/";
|
|
@@ -4290,10 +4312,10 @@ function LoginPage({ app }) {
|
|
|
4290
4312
|
const [message, setMessage] = useState12(null);
|
|
4291
4313
|
const redirect = safeRedirect(location.search);
|
|
4292
4314
|
if (status === "authenticated") {
|
|
4293
|
-
return /* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ jsx31(Navigate2, { to: redirect, replace: true });
|
|
4294
4316
|
}
|
|
4295
4317
|
if (status === "forbidden") {
|
|
4296
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsx31(Navigate2, { to: "/acesso-negado", replace: true });
|
|
4297
4319
|
}
|
|
4298
4320
|
async function handleSubmit(event) {
|
|
4299
4321
|
event.preventDefault();
|
|
@@ -4311,7 +4333,7 @@ function LoginPage({ app }) {
|
|
|
4311
4333
|
setSubmitting(false);
|
|
4312
4334
|
}
|
|
4313
4335
|
}
|
|
4314
|
-
return /* @__PURE__ */
|
|
4336
|
+
return /* @__PURE__ */ jsx31(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx31(
|
|
4315
4337
|
Box19,
|
|
4316
4338
|
{
|
|
4317
4339
|
width: "100%",
|
|
@@ -4322,9 +4344,9 @@ function LoginPage({ app }) {
|
|
|
4322
4344
|
borderRadius: "18px",
|
|
4323
4345
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
4324
4346
|
p: { base: 6, md: 9 },
|
|
4325
|
-
children: /* @__PURE__ */
|
|
4347
|
+
children: /* @__PURE__ */ jsx31("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
|
|
4326
4348
|
/* @__PURE__ */ jsxs21(Box19, { children: [
|
|
4327
|
-
/* @__PURE__ */
|
|
4349
|
+
/* @__PURE__ */ jsx31(
|
|
4328
4350
|
Text20,
|
|
4329
4351
|
{
|
|
4330
4352
|
color: "#39BFED",
|
|
@@ -4335,13 +4357,13 @@ function LoginPage({ app }) {
|
|
|
4335
4357
|
children: "Central Oon"
|
|
4336
4358
|
}
|
|
4337
4359
|
),
|
|
4338
|
-
/* @__PURE__ */
|
|
4339
|
-
/* @__PURE__ */
|
|
4360
|
+
/* @__PURE__ */ jsx31(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
|
|
4361
|
+
/* @__PURE__ */ jsx31(Text20, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
|
|
4340
4362
|
] }),
|
|
4341
4363
|
/* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
|
|
4342
4364
|
/* @__PURE__ */ jsxs21(Box19, { children: [
|
|
4343
|
-
/* @__PURE__ */
|
|
4344
|
-
/* @__PURE__ */
|
|
4365
|
+
/* @__PURE__ */ jsx31(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
|
|
4366
|
+
/* @__PURE__ */ jsx31(
|
|
4345
4367
|
Input7,
|
|
4346
4368
|
{
|
|
4347
4369
|
type: "email",
|
|
@@ -4354,8 +4376,8 @@ function LoginPage({ app }) {
|
|
|
4354
4376
|
)
|
|
4355
4377
|
] }),
|
|
4356
4378
|
/* @__PURE__ */ jsxs21(Box19, { children: [
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsx31(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
|
|
4380
|
+
/* @__PURE__ */ jsx31(
|
|
4359
4381
|
Input7,
|
|
4360
4382
|
{
|
|
4361
4383
|
type: "password",
|
|
@@ -4368,7 +4390,7 @@ function LoginPage({ app }) {
|
|
|
4368
4390
|
)
|
|
4369
4391
|
] })
|
|
4370
4392
|
] }),
|
|
4371
|
-
message ? /* @__PURE__ */
|
|
4393
|
+
message ? /* @__PURE__ */ jsx31(
|
|
4372
4394
|
Box19,
|
|
4373
4395
|
{
|
|
4374
4396
|
role: "alert",
|
|
@@ -4381,7 +4403,7 @@ function LoginPage({ app }) {
|
|
|
4381
4403
|
children: message
|
|
4382
4404
|
}
|
|
4383
4405
|
) : null,
|
|
4384
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsx31(
|
|
4385
4407
|
Button13,
|
|
4386
4408
|
{
|
|
4387
4409
|
type: "submit",
|
|
@@ -4400,7 +4422,7 @@ function LoginPage({ app }) {
|
|
|
4400
4422
|
// src/security/ActivationPage.tsx
|
|
4401
4423
|
import { useEffect as useEffect8, useState as useState13 } from "react";
|
|
4402
4424
|
import { Box as Box20, Button as Button14, Heading as Heading11, Input as Input8, Text as Text21, VStack as VStack3 } from "@chakra-ui/react";
|
|
4403
|
-
import { Fragment as Fragment6, jsx as
|
|
4425
|
+
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4404
4426
|
function encodeBasicCredentials2(email, password) {
|
|
4405
4427
|
const bytes = new TextEncoder().encode(`${email}:${password}`);
|
|
4406
4428
|
let binary = "";
|
|
@@ -4539,7 +4561,7 @@ function ActivationPage() {
|
|
|
4539
4561
|
field.label,
|
|
4540
4562
|
field.required ? " *" : ""
|
|
4541
4563
|
] }),
|
|
4542
|
-
/* @__PURE__ */
|
|
4564
|
+
/* @__PURE__ */ jsx32(
|
|
4543
4565
|
Input8,
|
|
4544
4566
|
{
|
|
4545
4567
|
type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
|
|
@@ -4551,15 +4573,15 @@ function ActivationPage() {
|
|
|
4551
4573
|
onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
|
|
4552
4574
|
}
|
|
4553
4575
|
),
|
|
4554
|
-
field.helpText ? /* @__PURE__ */
|
|
4576
|
+
field.helpText ? /* @__PURE__ */ jsx32(Text21, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
|
|
4555
4577
|
] }, field.name);
|
|
4556
4578
|
}
|
|
4557
4579
|
function renderDevLocalActivation() {
|
|
4558
4580
|
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4559
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsx32(Text21, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
|
|
4560
4582
|
/* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
/* @__PURE__ */
|
|
4583
|
+
/* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
|
|
4584
|
+
/* @__PURE__ */ jsx32(
|
|
4563
4585
|
Input8,
|
|
4564
4586
|
{
|
|
4565
4587
|
value: devName,
|
|
@@ -4570,8 +4592,8 @@ function ActivationPage() {
|
|
|
4570
4592
|
)
|
|
4571
4593
|
] }),
|
|
4572
4594
|
/* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "E-mail *" }),
|
|
4596
|
+
/* @__PURE__ */ jsx32(
|
|
4575
4597
|
Input8,
|
|
4576
4598
|
{
|
|
4577
4599
|
type: "email",
|
|
@@ -4583,8 +4605,8 @@ function ActivationPage() {
|
|
|
4583
4605
|
)
|
|
4584
4606
|
] }),
|
|
4585
4607
|
/* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4608
|
+
/* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Senha *" }),
|
|
4609
|
+
/* @__PURE__ */ jsx32(
|
|
4588
4610
|
Input8,
|
|
4589
4611
|
{
|
|
4590
4612
|
type: "password",
|
|
@@ -4596,7 +4618,7 @@ function ActivationPage() {
|
|
|
4596
4618
|
}
|
|
4597
4619
|
)
|
|
4598
4620
|
] }),
|
|
4599
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsx32(
|
|
4600
4622
|
Button14,
|
|
4601
4623
|
{
|
|
4602
4624
|
colorPalette: "blue",
|
|
@@ -4606,7 +4628,7 @@ function ActivationPage() {
|
|
|
4606
4628
|
children: "Ativar ambiente de desenvolvimento"
|
|
4607
4629
|
}
|
|
4608
4630
|
),
|
|
4609
|
-
/* @__PURE__ */
|
|
4631
|
+
/* @__PURE__ */ jsx32(
|
|
4610
4632
|
Button14,
|
|
4611
4633
|
{
|
|
4612
4634
|
variant: "outline",
|
|
@@ -4620,7 +4642,7 @@ function ActivationPage() {
|
|
|
4620
4642
|
const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
|
|
4621
4643
|
const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
|
|
4622
4644
|
if (activation.status === "loading" || !config) {
|
|
4623
|
-
return /* @__PURE__ */
|
|
4645
|
+
return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
4624
4646
|
VStack3,
|
|
4625
4647
|
{
|
|
4626
4648
|
maxW: "760px",
|
|
@@ -4631,14 +4653,14 @@ function ActivationPage() {
|
|
|
4631
4653
|
align: "stretch",
|
|
4632
4654
|
gap: 5,
|
|
4633
4655
|
children: [
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
error ? /* @__PURE__ */
|
|
4656
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
|
|
4657
|
+
error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null
|
|
4636
4658
|
]
|
|
4637
4659
|
}
|
|
4638
4660
|
) });
|
|
4639
4661
|
}
|
|
4640
4662
|
if (rootMode) {
|
|
4641
|
-
return /* @__PURE__ */
|
|
4663
|
+
return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
4642
4664
|
VStack3,
|
|
4643
4665
|
{
|
|
4644
4666
|
maxW: "560px",
|
|
@@ -4649,8 +4671,8 @@ function ActivationPage() {
|
|
|
4649
4671
|
align: "stretch",
|
|
4650
4672
|
gap: 5,
|
|
4651
4673
|
children: [
|
|
4652
|
-
/* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
|
|
4675
|
+
/* @__PURE__ */ jsx32(Text21, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
|
|
4654
4676
|
/* @__PURE__ */ jsxs22(Text21, { fontSize: "sm", color: "gray.500", children: [
|
|
4655
4677
|
"App: ",
|
|
4656
4678
|
config.technical.appCode,
|
|
@@ -4658,11 +4680,11 @@ function ActivationPage() {
|
|
|
4658
4680
|
" ",
|
|
4659
4681
|
config.technical.ambiente
|
|
4660
4682
|
] }),
|
|
4661
|
-
error ? /* @__PURE__ */
|
|
4683
|
+
error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null,
|
|
4662
4684
|
step !== 6 ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4663
4685
|
/* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4686
|
+
/* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "E-mail do administrador *" }),
|
|
4687
|
+
/* @__PURE__ */ jsx32(
|
|
4666
4688
|
Input8,
|
|
4667
4689
|
{
|
|
4668
4690
|
type: "email",
|
|
@@ -4674,8 +4696,8 @@ function ActivationPage() {
|
|
|
4674
4696
|
)
|
|
4675
4697
|
] }),
|
|
4676
4698
|
/* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4699
|
+
/* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Senha *" }),
|
|
4700
|
+
/* @__PURE__ */ jsx32(
|
|
4679
4701
|
Input8,
|
|
4680
4702
|
{
|
|
4681
4703
|
type: "password",
|
|
@@ -4687,7 +4709,7 @@ function ActivationPage() {
|
|
|
4687
4709
|
}
|
|
4688
4710
|
)
|
|
4689
4711
|
] }),
|
|
4690
|
-
/* @__PURE__ */
|
|
4712
|
+
/* @__PURE__ */ jsx32(
|
|
4691
4713
|
Button14,
|
|
4692
4714
|
{
|
|
4693
4715
|
colorPalette: "blue",
|
|
@@ -4698,14 +4720,14 @@ function ActivationPage() {
|
|
|
4698
4720
|
}
|
|
4699
4721
|
)
|
|
4700
4722
|
] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4723
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
4724
|
+
/* @__PURE__ */ jsx32(Text21, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
|
|
4703
4725
|
] })
|
|
4704
4726
|
]
|
|
4705
4727
|
}
|
|
4706
4728
|
) });
|
|
4707
4729
|
}
|
|
4708
|
-
return /* @__PURE__ */
|
|
4730
|
+
return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
|
|
4709
4731
|
VStack3,
|
|
4710
4732
|
{
|
|
4711
4733
|
maxW: "760px",
|
|
@@ -4716,7 +4738,7 @@ function ActivationPage() {
|
|
|
4716
4738
|
align: "stretch",
|
|
4717
4739
|
gap: 5,
|
|
4718
4740
|
children: [
|
|
4719
|
-
/* @__PURE__ */
|
|
4741
|
+
/* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
|
|
4720
4742
|
/* @__PURE__ */ jsxs22(Text21, { children: [
|
|
4721
4743
|
"App: ",
|
|
4722
4744
|
config.technical.appCode,
|
|
@@ -4727,11 +4749,11 @@ function ActivationPage() {
|
|
|
4727
4749
|
" ",
|
|
4728
4750
|
config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
|
|
4729
4751
|
] }),
|
|
4730
|
-
error ? /* @__PURE__ */
|
|
4752
|
+
error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null,
|
|
4731
4753
|
step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
|
|
4732
4754
|
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4733
|
-
/* @__PURE__ */
|
|
4734
|
-
/* @__PURE__ */
|
|
4755
|
+
/* @__PURE__ */ jsx32(Text21, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
|
|
4756
|
+
/* @__PURE__ */ jsx32(
|
|
4735
4757
|
Input8,
|
|
4736
4758
|
{
|
|
4737
4759
|
"aria-label": "C\xF3digo de ativa\xE7\xE3o",
|
|
@@ -4740,7 +4762,7 @@ function ActivationPage() {
|
|
|
4740
4762
|
placeholder: "OON-XXXX"
|
|
4741
4763
|
}
|
|
4742
4764
|
),
|
|
4743
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ jsx32(
|
|
4744
4766
|
Button14,
|
|
4745
4767
|
{
|
|
4746
4768
|
onClick: validateCode,
|
|
@@ -4749,7 +4771,7 @@ function ActivationPage() {
|
|
|
4749
4771
|
children: "Validar c\xF3digo"
|
|
4750
4772
|
}
|
|
4751
4773
|
),
|
|
4752
|
-
isDevelopmentMember ? /* @__PURE__ */
|
|
4774
|
+
isDevelopmentMember ? /* @__PURE__ */ jsx32(
|
|
4753
4775
|
Button14,
|
|
4754
4776
|
{
|
|
4755
4777
|
variant: "outline",
|
|
@@ -4760,23 +4782,23 @@ function ActivationPage() {
|
|
|
4760
4782
|
) : null
|
|
4761
4783
|
] }),
|
|
4762
4784
|
step === 2 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4763
|
-
/* @__PURE__ */
|
|
4764
|
-
/* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
|
|
4786
|
+
/* @__PURE__ */ jsx32("pre", { children: JSON.stringify(preview, null, 2) }),
|
|
4787
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(3), children: "Continuar" })
|
|
4766
4788
|
] }),
|
|
4767
4789
|
step === 3 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4768
4790
|
config.globalFields.map(
|
|
4769
4791
|
(field) => renderField(field, global, setGlobal)
|
|
4770
4792
|
),
|
|
4771
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(4), children: "Continuar" })
|
|
4772
4794
|
] }),
|
|
4773
4795
|
step === 4 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4774
|
-
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */
|
|
4775
|
-
/* @__PURE__ */
|
|
4796
|
+
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx32(Text21, { children: "Nenhum par\xE2metro adicional declarado." }),
|
|
4797
|
+
/* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(5), children: "Revisar" })
|
|
4776
4798
|
] }),
|
|
4777
4799
|
step === 5 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4800
|
+
/* @__PURE__ */ jsx32(Text21, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
|
|
4801
|
+
/* @__PURE__ */ jsx32(
|
|
4780
4802
|
Button14,
|
|
4781
4803
|
{
|
|
4782
4804
|
colorPalette: "blue",
|
|
@@ -4788,13 +4810,13 @@ function ActivationPage() {
|
|
|
4788
4810
|
)
|
|
4789
4811
|
] }),
|
|
4790
4812
|
step === 6 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4791
|
-
/* @__PURE__ */
|
|
4813
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
4792
4814
|
devResult?.appCode ? /* @__PURE__ */ jsxs22(Text21, { children: [
|
|
4793
4815
|
"C\xF3digo do app: ",
|
|
4794
4816
|
devResult.appCode,
|
|
4795
4817
|
". Redirecionando para a Central em desenvolvimento..."
|
|
4796
|
-
] }) : /* @__PURE__ */
|
|
4797
|
-
devResult?.instrucoes?.env ? /* @__PURE__ */
|
|
4818
|
+
] }) : /* @__PURE__ */ jsx32(Text21, { children: "Redirecionando para o login..." }),
|
|
4819
|
+
devResult?.instrucoes?.env ? /* @__PURE__ */ jsx32(Text21, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
|
|
4798
4820
|
] })
|
|
4799
4821
|
]
|
|
4800
4822
|
}
|
|
@@ -4805,46 +4827,46 @@ function InstanceBlockedPage({
|
|
|
4805
4827
|
message
|
|
4806
4828
|
}) {
|
|
4807
4829
|
return /* @__PURE__ */ jsxs22(Box20, { p: 8, children: [
|
|
4808
|
-
/* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
4830
|
+
/* @__PURE__ */ jsx32(Heading11, { children: title }),
|
|
4831
|
+
/* @__PURE__ */ jsx32(Text21, { children: message })
|
|
4810
4832
|
] });
|
|
4811
4833
|
}
|
|
4812
4834
|
|
|
4813
4835
|
// src/security/RouteGuard.tsx
|
|
4814
|
-
import { Fragment as Fragment7, jsx as
|
|
4836
|
+
import { Fragment as Fragment7, jsx as jsx33 } from "react/jsx-runtime";
|
|
4815
4837
|
function RouteGuard({
|
|
4816
4838
|
permission,
|
|
4817
4839
|
children
|
|
4818
4840
|
}) {
|
|
4819
4841
|
const { status, hasPermission } = useOonAuth();
|
|
4820
|
-
if (status === "loading") return /* @__PURE__ */
|
|
4821
|
-
if (status === "unauthenticated") return /* @__PURE__ */
|
|
4842
|
+
if (status === "loading") return /* @__PURE__ */ jsx33(LoadingScreen, {});
|
|
4843
|
+
if (status === "unauthenticated") return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Redirecionando para o login..." });
|
|
4822
4844
|
if (!hasPermission(permission)) {
|
|
4823
|
-
return /* @__PURE__ */
|
|
4845
|
+
return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
|
|
4824
4846
|
}
|
|
4825
|
-
return /* @__PURE__ */
|
|
4847
|
+
return /* @__PURE__ */ jsx33(Fragment7, { children });
|
|
4826
4848
|
}
|
|
4827
4849
|
|
|
4828
4850
|
// src/security/ActivationGuard.tsx
|
|
4829
4851
|
import { Navigate as Navigate3 } from "react-router-dom";
|
|
4830
|
-
import { jsx as
|
|
4852
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4831
4853
|
function ActivationGuard({ children }) {
|
|
4832
4854
|
const { status } = useActivation();
|
|
4833
4855
|
if (status === "loading") return null;
|
|
4834
|
-
if (status === "suspended") return /* @__PURE__ */
|
|
4835
|
-
if (status === "revoked") return /* @__PURE__ */
|
|
4836
|
-
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */
|
|
4856
|
+
if (status === "suspended") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-suspensa", replace: true });
|
|
4857
|
+
if (status === "revoked") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-revogada", replace: true });
|
|
4858
|
+
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx34(Navigate3, { to: "/ativacao", replace: true });
|
|
4837
4859
|
return children;
|
|
4838
4860
|
}
|
|
4839
4861
|
|
|
4840
4862
|
// src/app/createOonRouter.tsx
|
|
4841
|
-
import { jsx as
|
|
4863
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4842
4864
|
function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
4843
4865
|
const guardEnabled = security?.enableRouteGuard !== false;
|
|
4844
4866
|
const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
|
|
4845
4867
|
const privateSource = routes.filter((route) => !route.public);
|
|
4846
4868
|
const privateRoutes = privateSource.map((route) => {
|
|
4847
|
-
const element = guardEnabled ? /* @__PURE__ */
|
|
4869
|
+
const element = guardEnabled ? /* @__PURE__ */ jsx35(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
|
|
4848
4870
|
return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
|
|
4849
4871
|
});
|
|
4850
4872
|
const hasIndexRoute = privateSource.some((route) => route.path === "/");
|
|
@@ -4852,7 +4874,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4852
4874
|
if (!hasIndexRoute && firstRoute) {
|
|
4853
4875
|
privateRoutes.unshift({
|
|
4854
4876
|
index: true,
|
|
4855
|
-
element: /* @__PURE__ */
|
|
4877
|
+
element: /* @__PURE__ */ jsx35(Navigate4, { to: firstRoute.path, replace: true })
|
|
4856
4878
|
});
|
|
4857
4879
|
}
|
|
4858
4880
|
const customPaths = new Set(publicRoutes.map((route) => route.path));
|
|
@@ -4860,19 +4882,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4860
4882
|
if (!customPaths.has("/login")) {
|
|
4861
4883
|
builtInPublicRoutes.push({
|
|
4862
4884
|
path: "/login",
|
|
4863
|
-
element: /* @__PURE__ */
|
|
4885
|
+
element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(LoginPage, { app }) })
|
|
4864
4886
|
});
|
|
4865
4887
|
}
|
|
4866
4888
|
if (!customPaths.has("/ativacao")) {
|
|
4867
4889
|
builtInPublicRoutes.push({
|
|
4868
4890
|
path: "/ativacao",
|
|
4869
|
-
element: /* @__PURE__ */
|
|
4891
|
+
element: /* @__PURE__ */ jsx35(ActivationPage, {})
|
|
4870
4892
|
});
|
|
4871
4893
|
}
|
|
4872
4894
|
if (!customPaths.has("/instancia-suspensa")) {
|
|
4873
4895
|
builtInPublicRoutes.push({
|
|
4874
4896
|
path: "/instancia-suspensa",
|
|
4875
|
-
element: /* @__PURE__ */
|
|
4897
|
+
element: /* @__PURE__ */ jsx35(
|
|
4876
4898
|
InstanceBlockedPage,
|
|
4877
4899
|
{
|
|
4878
4900
|
title: "Inst\xE2ncia suspensa",
|
|
@@ -4884,7 +4906,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4884
4906
|
if (!customPaths.has("/instancia-revogada")) {
|
|
4885
4907
|
builtInPublicRoutes.push({
|
|
4886
4908
|
path: "/instancia-revogada",
|
|
4887
|
-
element: /* @__PURE__ */
|
|
4909
|
+
element: /* @__PURE__ */ jsx35(
|
|
4888
4910
|
InstanceBlockedPage,
|
|
4889
4911
|
{
|
|
4890
4912
|
title: "Inst\xE2ncia revogada",
|
|
@@ -4896,7 +4918,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4896
4918
|
if (!customPaths.has("/acesso-negado")) {
|
|
4897
4919
|
builtInPublicRoutes.push({
|
|
4898
4920
|
path: "/acesso-negado",
|
|
4899
|
-
element: /* @__PURE__ */
|
|
4921
|
+
element: /* @__PURE__ */ jsx35(AccessDeniedPage, { app })
|
|
4900
4922
|
});
|
|
4901
4923
|
}
|
|
4902
4924
|
const tree = [
|
|
@@ -4904,7 +4926,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4904
4926
|
...publicRoutes,
|
|
4905
4927
|
{
|
|
4906
4928
|
path: "/",
|
|
4907
|
-
element: /* @__PURE__ */
|
|
4929
|
+
element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(AppAccessGuard, { children: /* @__PURE__ */ jsx35(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
|
|
4908
4930
|
children: privateRoutes
|
|
4909
4931
|
}
|
|
4910
4932
|
];
|
|
@@ -4912,7 +4934,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
|
|
|
4912
4934
|
}
|
|
4913
4935
|
|
|
4914
4936
|
// src/app/OonApp.tsx
|
|
4915
|
-
import { jsx as
|
|
4937
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
4916
4938
|
function localLoginUrl() {
|
|
4917
4939
|
const current = `${window.location.pathname}${window.location.search}`;
|
|
4918
4940
|
return `/login?redirect=${encodeURIComponent(current)}`;
|
|
@@ -4947,11 +4969,11 @@ function OonApp({ config }) {
|
|
|
4947
4969
|
});
|
|
4948
4970
|
return { http: http2, storage: storage2, router: router2 };
|
|
4949
4971
|
}, [config]);
|
|
4950
|
-
return /* @__PURE__ */
|
|
4972
|
+
return /* @__PURE__ */ jsx36(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx36(RouterProvider, { router }) });
|
|
4951
4973
|
}
|
|
4952
4974
|
|
|
4953
4975
|
// src/start.tsx
|
|
4954
|
-
import { jsx as
|
|
4976
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
4955
4977
|
function validateConfig(config) {
|
|
4956
4978
|
if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
|
|
4957
4979
|
if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
|
|
@@ -4985,7 +5007,7 @@ function start(config) {
|
|
|
4985
5007
|
const el = document.getElementById(rootId);
|
|
4986
5008
|
if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
|
|
4987
5009
|
createRoot(el).render(
|
|
4988
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsx37(StrictMode, { children: /* @__PURE__ */ jsx37(OonApp, { config }) })
|
|
4989
5011
|
);
|
|
4990
5012
|
}
|
|
4991
5013
|
var oonCoreFront = { start };
|
|
@@ -5120,22 +5142,22 @@ function defineOonModule(mod) {
|
|
|
5120
5142
|
// src/components/CoreIntegration.tsx
|
|
5121
5143
|
import { Badge as Badge5, Box as Box21, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text22 } from "@chakra-ui/react";
|
|
5122
5144
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5123
|
-
import { jsx as
|
|
5145
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5124
5146
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
5125
5147
|
const { http } = useOonApi();
|
|
5126
5148
|
const metadata = useCoreMetadata();
|
|
5127
5149
|
const reprocess = useMutation4({
|
|
5128
5150
|
mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
|
|
5129
5151
|
});
|
|
5130
|
-
if (metadata.isLoading) return /* @__PURE__ */
|
|
5131
|
-
if (metadata.isError) return /* @__PURE__ */
|
|
5152
|
+
if (metadata.isLoading) return /* @__PURE__ */ jsx38(LoadingScreen, {});
|
|
5153
|
+
if (metadata.isError) return /* @__PURE__ */ jsx38(ErrorState, { error: metadata.error });
|
|
5132
5154
|
const integrations = metadata.data?.integrations ?? [];
|
|
5133
5155
|
return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
|
|
5134
5156
|
/* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5135
|
-
/* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
|
|
5158
|
+
/* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
|
|
5137
5159
|
] }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5160
|
+
/* @__PURE__ */ jsx38(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx38(Text22, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx38(
|
|
5139
5161
|
Box21,
|
|
5140
5162
|
{
|
|
5141
5163
|
borderWidth: "1px",
|
|
@@ -5144,8 +5166,8 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5144
5166
|
bg: "white",
|
|
5145
5167
|
p: 4,
|
|
5146
5168
|
children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5147
|
-
/* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5169
|
+
/* @__PURE__ */ jsx38(Text22, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
|
|
5170
|
+
/* @__PURE__ */ jsx38(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
|
|
5149
5171
|
] })
|
|
5150
5172
|
},
|
|
5151
5173
|
it.id ?? it.name ?? idx
|
|
@@ -5156,7 +5178,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
5156
5178
|
// src/components/CoreCurrency.tsx
|
|
5157
5179
|
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text23 } from "@chakra-ui/react";
|
|
5158
5180
|
import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
5159
|
-
import { jsx as
|
|
5181
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5160
5182
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
5161
5183
|
const { http } = useOonApi();
|
|
5162
5184
|
const queryClient = useQueryClient5();
|
|
@@ -5166,11 +5188,11 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5166
5188
|
});
|
|
5167
5189
|
return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
|
|
5168
5190
|
/* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
|
|
5169
|
-
/* @__PURE__ */
|
|
5170
|
-
/* @__PURE__ */
|
|
5191
|
+
/* @__PURE__ */ jsx39(Heading13, { size: "lg", children: label }),
|
|
5192
|
+
/* @__PURE__ */ jsx39(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
5171
5193
|
] }),
|
|
5172
|
-
updateRates.isError ? /* @__PURE__ */
|
|
5173
|
-
/* @__PURE__ */
|
|
5194
|
+
updateRates.isError ? /* @__PURE__ */ jsx39(Text23, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
5195
|
+
/* @__PURE__ */ jsx39(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
5174
5196
|
] });
|
|
5175
5197
|
}
|
|
5176
5198
|
|
|
@@ -5178,7 +5200,7 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5178
5200
|
import { useState as useState14 } from "react";
|
|
5179
5201
|
import { Box as Box22, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input9, Stack as Stack11, Text as Text24 } from "@chakra-ui/react";
|
|
5180
5202
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5181
|
-
import { jsx as
|
|
5203
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5182
5204
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
5183
5205
|
const { http } = useOonApi();
|
|
5184
5206
|
const [messages, setMessages] = useState14([]);
|
|
@@ -5208,9 +5230,9 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5208
5230
|
ask.mutate(text);
|
|
5209
5231
|
};
|
|
5210
5232
|
return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
|
|
5211
|
-
/* @__PURE__ */
|
|
5212
|
-
/* @__PURE__ */
|
|
5213
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
5233
|
+
/* @__PURE__ */ jsx40(Heading14, { size: "md", children: label }),
|
|
5234
|
+
/* @__PURE__ */ jsx40(Box22, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
|
|
5235
|
+
messages.length === 0 ? /* @__PURE__ */ jsx40(Text24, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx40(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx40(
|
|
5214
5236
|
Box22,
|
|
5215
5237
|
{
|
|
5216
5238
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
@@ -5223,11 +5245,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5223
5245
|
children: m.content
|
|
5224
5246
|
}
|
|
5225
5247
|
) }, idx)),
|
|
5226
|
-
ask.isPending ? /* @__PURE__ */
|
|
5227
|
-
ask.isError ? /* @__PURE__ */
|
|
5248
|
+
ask.isPending ? /* @__PURE__ */ jsx40(Text24, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
|
|
5249
|
+
ask.isError ? /* @__PURE__ */ jsx40(Text24, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
|
|
5228
5250
|
] }) }),
|
|
5229
5251
|
/* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
|
|
5230
|
-
/* @__PURE__ */
|
|
5252
|
+
/* @__PURE__ */ jsx40(
|
|
5231
5253
|
Input9,
|
|
5232
5254
|
{
|
|
5233
5255
|
size: "sm",
|
|
@@ -5239,7 +5261,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5239
5261
|
}
|
|
5240
5262
|
}
|
|
5241
5263
|
),
|
|
5242
|
-
/* @__PURE__ */
|
|
5264
|
+
/* @__PURE__ */ jsx40(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
|
|
5243
5265
|
] })
|
|
5244
5266
|
] });
|
|
5245
5267
|
}
|