@oondemand/oon-core-front 0.4.15 → 0.4.16
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.d.ts +6 -1
- package/dist/index.js +970 -819
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5060,8 +5060,153 @@ function CorePage2({ page, registry }) {
|
|
|
5060
5060
|
] }) });
|
|
5061
5061
|
}
|
|
5062
5062
|
|
|
5063
|
+
// src/components/CoreTransactionalEmail.tsx
|
|
5064
|
+
import { useState as useState18 } from "react";
|
|
5065
|
+
import { Badge as Badge5, Box as Box22, Button as Button16, Flex as Flex15, Heading as Heading13, Input as Input10, Stack as Stack9, Text as Text23, Textarea as Textarea3 } from "@chakra-ui/react";
|
|
5066
|
+
import { useMutation as useMutation5, useQuery as useQuery11, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
5067
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5068
|
+
function errorMessage(error) {
|
|
5069
|
+
return error?.response?.data?.message || error?.message || "N\xE3o foi poss\xEDvel concluir a opera\xE7\xE3o.";
|
|
5070
|
+
}
|
|
5071
|
+
function color(status) {
|
|
5072
|
+
if (["active", "provider_accepted"].includes(String(status))) return "green";
|
|
5073
|
+
if (["degraded", "failed", "dead_letter"].includes(String(status))) return "red";
|
|
5074
|
+
return "yellow";
|
|
5075
|
+
}
|
|
5076
|
+
function CoreTransactionalEmail() {
|
|
5077
|
+
const { http } = useOonApi();
|
|
5078
|
+
const cache = useQueryClient7();
|
|
5079
|
+
const [tab, setTab] = useState18("config");
|
|
5080
|
+
const [draft, setDraft] = useState18({ apiKey: "", senderEmail: "", senderName: "", replyTo: "", testRecipient: "" });
|
|
5081
|
+
const [error, setError] = useState18("");
|
|
5082
|
+
const [templateDraft, setTemplateDraft] = useState18({ code: "", name: "", subject: "", htmlContent: "", textContent: "", variablesSchema: '{\n "type": "object",\n "additionalProperties": false\n}', locale: "pt-BR" });
|
|
5083
|
+
const [templateTest, setTemplateTest] = useState18({ code: "", to: "", variables: "{}" });
|
|
5084
|
+
const health = useQuery11({ queryKey: ["transactional-email", "health"], queryFn: async () => (await http.get("/core/transactional-email/health")).data });
|
|
5085
|
+
const configuration = useQuery11({ queryKey: ["transactional-email", "configuration"], queryFn: async () => (await http.get("/core/transactional-email/configuration")).data.configuration });
|
|
5086
|
+
const templates = useQuery11({ queryKey: ["transactional-email", "templates"], queryFn: async () => (await http.get("/core/transactional-email/templates")).data.results, enabled: tab === "templates" });
|
|
5087
|
+
const dispatches = useQuery11({ queryKey: ["transactional-email", "dispatches"], queryFn: async () => (await http.get("/core/transactional-email/dispatches")).data.results, enabled: tab === "dispatches", refetchInterval: 1e4 });
|
|
5088
|
+
const save = useMutation5({ mutationFn: async () => (await http.put("/core/transactional-email/configuration", { ...draft, enabled: true })).data, onSuccess: () => {
|
|
5089
|
+
setDraft((value3) => ({ ...value3, apiKey: "" }));
|
|
5090
|
+
setError("");
|
|
5091
|
+
cache.invalidateQueries({ queryKey: ["transactional-email"] });
|
|
5092
|
+
}, onError: (reason) => setError(errorMessage(reason)) });
|
|
5093
|
+
const retry = useMutation5({ mutationFn: async (id) => http.post(`/core/transactional-email/dispatches/${id}/retry`), onSuccess: () => cache.invalidateQueries({ queryKey: ["transactional-email", "dispatches"] }), onError: (reason) => setError(errorMessage(reason)) });
|
|
5094
|
+
const createVersion = useMutation5({ mutationFn: async () => http.post(`/core/transactional-email/templates/${templateDraft.code}/versions`, { ...templateDraft, variablesSchema: JSON.parse(templateDraft.variablesSchema), attachmentsPolicy: { allowed: false } }), onSuccess: () => {
|
|
5095
|
+
setError("");
|
|
5096
|
+
cache.invalidateQueries({ queryKey: ["transactional-email", "templates"] });
|
|
5097
|
+
}, onError: (reason) => setError(errorMessage(reason)) });
|
|
5098
|
+
const activate = useMutation5({ mutationFn: async (item) => http.post(`/core/transactional-email/templates/${item.code}/versions/${item.version}/activate`), onSuccess: () => cache.invalidateQueries({ queryKey: ["transactional-email", "templates"] }), onError: (reason) => setError(errorMessage(reason)) });
|
|
5099
|
+
const testTemplate = useMutation5({ mutationFn: async () => http.post(`/core/transactional-email/templates/${templateTest.code}/test`, { to: templateTest.to, variables: JSON.parse(templateTest.variables) }), onSuccess: () => {
|
|
5100
|
+
setError("");
|
|
5101
|
+
cache.invalidateQueries({ queryKey: ["transactional-email", "dispatches"] });
|
|
5102
|
+
}, onError: (reason) => setError(errorMessage(reason)) });
|
|
5103
|
+
const config = configuration.data;
|
|
5104
|
+
return /* @__PURE__ */ jsxs23(Stack9, { gap: 5, children: [
|
|
5105
|
+
/* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", align: "center", wrap: "wrap", gap: 3, children: [
|
|
5106
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5107
|
+
/* @__PURE__ */ jsx31(Heading13, { size: "lg", children: "E-mail transacional" }),
|
|
5108
|
+
/* @__PURE__ */ jsx31(Text23, { color: "gray.600", children: "Configura\xE7\xE3o, templates e fila de envio deste App." })
|
|
5109
|
+
] }),
|
|
5110
|
+
/* @__PURE__ */ jsx31(Badge5, { colorPalette: color(health.data?.status), children: health.data?.status || "carregando" })
|
|
5111
|
+
] }),
|
|
5112
|
+
/* @__PURE__ */ jsx31(Flex15, { gap: 2, children: [["config", "Configura\xE7\xE3o"], ["templates", "Templates"], ["dispatches", "Envios"]].map(([id, label]) => /* @__PURE__ */ jsx31(Button16, { size: "sm", variant: tab === id ? "solid" : "outline", onClick: () => setTab(id), children: label }, id)) }),
|
|
5113
|
+
error ? /* @__PURE__ */ jsx31(Box22, { borderWidth: "1px", borderColor: "red.200", bg: "red.50", p: 3, borderRadius: "md", children: /* @__PURE__ */ jsx31(Text23, { color: "red.700", children: error }) }) : null,
|
|
5114
|
+
tab === "config" ? /* @__PURE__ */ jsx31(Box22, { borderWidth: "1px", borderRadius: "lg", p: 5, children: /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
|
|
5115
|
+
/* @__PURE__ */ jsxs23(Flex15, { gap: 2, wrap: "wrap", children: [
|
|
5116
|
+
/* @__PURE__ */ jsx31(Badge5, { colorPalette: config?.credentialConfigured ? "green" : "yellow", children: config?.credentialConfigured ? `Chave ${config.apiKeyMasked}` : "Chave pendente" }),
|
|
5117
|
+
/* @__PURE__ */ jsx31(Badge5, { children: config?.connectionStatus || "n\xE3o testada" })
|
|
5118
|
+
] }),
|
|
5119
|
+
/* @__PURE__ */ jsx31(Input10, { type: "password", autoComplete: "new-password", placeholder: "Nova API key SendGrid (write-only)", value: draft.apiKey, onChange: (event) => setDraft({ ...draft, apiKey: event.target.value }) }),
|
|
5120
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: config?.senderEmail || "Remetente", value: draft.senderEmail, onChange: (event) => setDraft({ ...draft, senderEmail: event.target.value }) }),
|
|
5121
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: config?.senderName || "Nome do remetente", value: draft.senderName, onChange: (event) => setDraft({ ...draft, senderName: event.target.value }) }),
|
|
5122
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: config?.replyTo || "Reply-to", value: draft.replyTo, onChange: (event) => setDraft({ ...draft, replyTo: event.target.value }) }),
|
|
5123
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: "Destinat\xE1rio do envio de teste", value: draft.testRecipient, onChange: (event) => setDraft({ ...draft, testRecipient: event.target.value }) }),
|
|
5124
|
+
/* @__PURE__ */ jsx31(Button16, { alignSelf: "start", loading: save.isPending, onClick: () => save.mutate(), children: "Validar e ativar" })
|
|
5125
|
+
] }) }) : null,
|
|
5126
|
+
tab === "templates" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
|
|
5127
|
+
/* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: 5, children: [
|
|
5128
|
+
/* @__PURE__ */ jsx31(Heading13, { size: "sm", mb: 3, children: "Nova vers\xE3o em rascunho" }),
|
|
5129
|
+
/* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
|
|
5130
|
+
/* @__PURE__ */ jsxs23(Flex15, { gap: 3, wrap: "wrap", children: [
|
|
5131
|
+
/* @__PURE__ */ jsx31(Input10, { flex: "1", minW: "180px", placeholder: "C\xF3digo declarado", value: templateDraft.code, onChange: (event) => setTemplateDraft({ ...templateDraft, code: event.target.value }) }),
|
|
5132
|
+
/* @__PURE__ */ jsx31(Input10, { flex: "2", minW: "220px", placeholder: "Nome", value: templateDraft.name, onChange: (event) => setTemplateDraft({ ...templateDraft, name: event.target.value }) })
|
|
5133
|
+
] }),
|
|
5134
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: "Assunto Handlebars", value: templateDraft.subject, onChange: (event) => setTemplateDraft({ ...templateDraft, subject: event.target.value }) }),
|
|
5135
|
+
/* @__PURE__ */ jsx31(Textarea3, { placeholder: "HTML", value: templateDraft.htmlContent, onChange: (event) => setTemplateDraft({ ...templateDraft, htmlContent: event.target.value }) }),
|
|
5136
|
+
/* @__PURE__ */ jsx31(Textarea3, { placeholder: "Texto simples", value: templateDraft.textContent, onChange: (event) => setTemplateDraft({ ...templateDraft, textContent: event.target.value }) }),
|
|
5137
|
+
/* @__PURE__ */ jsx31(Textarea3, { "aria-label": "JSON Schema das vari\xE1veis", value: templateDraft.variablesSchema, onChange: (event) => setTemplateDraft({ ...templateDraft, variablesSchema: event.target.value }) }),
|
|
5138
|
+
/* @__PURE__ */ jsx31(Button16, { alignSelf: "start", loading: createVersion.isPending, onClick: () => {
|
|
5139
|
+
try {
|
|
5140
|
+
JSON.parse(templateDraft.variablesSchema);
|
|
5141
|
+
createVersion.mutate();
|
|
5142
|
+
} catch {
|
|
5143
|
+
setError("JSON Schema inv\xE1lido.");
|
|
5144
|
+
}
|
|
5145
|
+
}, children: "Salvar rascunho" })
|
|
5146
|
+
] })
|
|
5147
|
+
] }),
|
|
5148
|
+
templates.data?.map((item) => /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: 4, children: [
|
|
5149
|
+
/* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", gap: 3, children: [
|
|
5150
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5151
|
+
/* @__PURE__ */ jsx31(Text23, { fontWeight: "semibold", children: item.name }),
|
|
5152
|
+
/* @__PURE__ */ jsxs23(Text23, { fontSize: "sm", color: "gray.600", children: [
|
|
5153
|
+
item.code,
|
|
5154
|
+
" \xB7 vers\xE3o ",
|
|
5155
|
+
item.version,
|
|
5156
|
+
" \xB7 origem ",
|
|
5157
|
+
item.origin
|
|
5158
|
+
] })
|
|
5159
|
+
] }),
|
|
5160
|
+
/* @__PURE__ */ jsxs23(Stack9, { align: "end", children: [
|
|
5161
|
+
/* @__PURE__ */ jsx31(Badge5, { colorPalette: color(item.status), children: item.status }),
|
|
5162
|
+
item.status !== "active" ? /* @__PURE__ */ jsx31(Button16, { size: "xs", loading: activate.isPending, onClick: () => activate.mutate(item), children: item.status === "archived" ? "Reverter para esta vers\xE3o" : "Ativar" }) : null
|
|
5163
|
+
] })
|
|
5164
|
+
] }),
|
|
5165
|
+
/* @__PURE__ */ jsx31(Text23, { mt: 2, fontSize: "sm", children: item.subject })
|
|
5166
|
+
] }, item._id)),
|
|
5167
|
+
!templates.isLoading && !templates.data?.length ? /* @__PURE__ */ jsx31(Text23, { children: "Nenhum template declarado." }) : null,
|
|
5168
|
+
/* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: 5, children: [
|
|
5169
|
+
/* @__PURE__ */ jsx31(Heading13, { size: "sm", mb: 3, children: "Envio de teste" }),
|
|
5170
|
+
/* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
|
|
5171
|
+
/* @__PURE__ */ jsx31(Input10, { placeholder: "C\xF3digo do template ativo", value: templateTest.code, onChange: (event) => setTemplateTest({ ...templateTest, code: event.target.value }) }),
|
|
5172
|
+
/* @__PURE__ */ jsx31(Input10, { type: "email", placeholder: "Destinat\xE1rio", value: templateTest.to, onChange: (event) => setTemplateTest({ ...templateTest, to: event.target.value }) }),
|
|
5173
|
+
/* @__PURE__ */ jsx31(Textarea3, { "aria-label": "Vari\xE1veis do teste", value: templateTest.variables, onChange: (event) => setTemplateTest({ ...templateTest, variables: event.target.value }) }),
|
|
5174
|
+
/* @__PURE__ */ jsx31(Button16, { alignSelf: "start", loading: testTemplate.isPending, onClick: () => {
|
|
5175
|
+
try {
|
|
5176
|
+
JSON.parse(templateTest.variables);
|
|
5177
|
+
testTemplate.mutate();
|
|
5178
|
+
} catch {
|
|
5179
|
+
setError("JSON de vari\xE1veis inv\xE1lido.");
|
|
5180
|
+
}
|
|
5181
|
+
}, children: "Enfileirar teste" })
|
|
5182
|
+
] })
|
|
5183
|
+
] })
|
|
5184
|
+
] }) : null,
|
|
5185
|
+
tab === "dispatches" ? /* @__PURE__ */ jsx31(Stack9, { gap: 3, children: dispatches.data?.map((item) => /* @__PURE__ */ jsx31(Box22, { borderWidth: "1px", borderRadius: "lg", p: 4, children: /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", gap: 3, align: "start", children: [
|
|
5186
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5187
|
+
/* @__PURE__ */ jsx31(Text23, { fontWeight: "semibold", children: item.templateCode }),
|
|
5188
|
+
/* @__PURE__ */ jsxs23(Text23, { fontSize: "sm", color: "gray.600", children: [
|
|
5189
|
+
item.correlationId,
|
|
5190
|
+
" \xB7 ",
|
|
5191
|
+
item.attempts,
|
|
5192
|
+
" tentativa(s)"
|
|
5193
|
+
] }),
|
|
5194
|
+
item.lastError?.message ? /* @__PURE__ */ jsxs23(Text23, { color: "red.600", fontSize: "sm", children: [
|
|
5195
|
+
item.lastError.code,
|
|
5196
|
+
": ",
|
|
5197
|
+
item.lastError.message
|
|
5198
|
+
] }) : null
|
|
5199
|
+
] }),
|
|
5200
|
+
/* @__PURE__ */ jsxs23(Stack9, { align: "end", children: [
|
|
5201
|
+
/* @__PURE__ */ jsx31(Badge5, { colorPalette: color(item.status), children: item.status }),
|
|
5202
|
+
item.status === "dead_letter" ? /* @__PURE__ */ jsx31(Button16, { size: "xs", loading: retry.isPending, onClick: () => retry.mutate(item._id), children: "Reprocessar" }) : null
|
|
5203
|
+
] })
|
|
5204
|
+
] }) }, item._id)) }) : null
|
|
5205
|
+
] });
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5063
5208
|
// src/app/moduleRegistry.tsx
|
|
5064
|
-
import { jsx as
|
|
5209
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5065
5210
|
function slug2(value3) {
|
|
5066
5211
|
return value3.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5067
5212
|
}
|
|
@@ -5099,19 +5244,19 @@ function renderView(view, registry) {
|
|
|
5099
5244
|
switch (view.type) {
|
|
5100
5245
|
case "collection": {
|
|
5101
5246
|
const v = view;
|
|
5102
|
-
return /* @__PURE__ */
|
|
5247
|
+
return /* @__PURE__ */ jsx32(CoreCollection, { model: v.model, mode: v.mode, columns: v.columns, form: v.form, label: viewLabel(v), section: v.section, importExport: v.importExport, list: v.list, relations: v.relations, detailModal: v.detailModal, cellRenderers: registry?.cellRenderers, registry });
|
|
5103
5248
|
}
|
|
5104
5249
|
case "document": {
|
|
5105
5250
|
const v = view;
|
|
5106
|
-
return /* @__PURE__ */
|
|
5251
|
+
return /* @__PURE__ */ jsx32(CoreDocument, { model: v.model, label: viewLabel(v), endpoint: v.endpoint, approval: v.approval, attachments: v.attachments, display: v.display, categoryField: v.categoryField, titleField: v.titleField, descriptionField: v.descriptionField, contentField: v.contentField, statusField: v.statusField, updatedAtField: v.updatedAtField });
|
|
5107
5252
|
}
|
|
5108
5253
|
case "pipeline": {
|
|
5109
5254
|
const v = view;
|
|
5110
|
-
return /* @__PURE__ */
|
|
5255
|
+
return /* @__PURE__ */ jsx32(CorePipeline, { model: v.model, label: viewLabel(v), stageField: v.stageField, stages: v.stages, titleField: v.titleField, form: v.form, relations: v.relations, ticketModal: v.ticketModal, filters: v.filters, create: v.create, viewModes: v.viewModes, defaultView: v.defaultView, list: v.list, defaultActions: v.defaultActions, ticketActions: v.ticketActions, registry });
|
|
5111
5256
|
}
|
|
5112
5257
|
case "dashboard": {
|
|
5113
5258
|
const v = view;
|
|
5114
|
-
return /* @__PURE__ */
|
|
5259
|
+
return /* @__PURE__ */ jsx32(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
|
|
5115
5260
|
}
|
|
5116
5261
|
default:
|
|
5117
5262
|
return null;
|
|
@@ -5121,7 +5266,7 @@ function viewToRoute(view, registry) {
|
|
|
5121
5266
|
return { path: viewPath(view), element: renderView(view, registry), permissions: requiredPermissions(view), capabilities: "capabilities" in view ? view.capabilities : void 0 };
|
|
5122
5267
|
}
|
|
5123
5268
|
function pageToRoute(page, registry) {
|
|
5124
|
-
return { path: page.path, element: /* @__PURE__ */
|
|
5269
|
+
return { path: page.path, element: /* @__PURE__ */ jsx32(CorePage2, { page, registry }), permissions: requiredPermissions(page), capabilities: page.capabilities };
|
|
5125
5270
|
}
|
|
5126
5271
|
function pageToMenu(page) {
|
|
5127
5272
|
if (!page.label) return null;
|
|
@@ -5154,9 +5299,13 @@ function resolveRegistry(config) {
|
|
|
5154
5299
|
}
|
|
5155
5300
|
}
|
|
5156
5301
|
if (["root-central", "member-central"].includes(String(config.app.kind || ""))) {
|
|
5157
|
-
pushRoute({ path: "/usuarios-acessos", element: /* @__PURE__ */
|
|
5302
|
+
pushRoute({ path: "/usuarios-acessos", element: /* @__PURE__ */ jsx32(CoreUsersAccess, {}), permissions: ["users.read"] });
|
|
5158
5303
|
pushMenu({ label: "Usu\xE1rios e Acessos", href: "/usuarios-acessos", section: "Configura\xE7\xF5es", order: 900, permissions: ["users.read"] });
|
|
5159
5304
|
}
|
|
5305
|
+
if (declaredAppCapabilities(config)?.includes("core.transactional-email")) {
|
|
5306
|
+
pushRoute({ path: "/configuracoes/email-transacional", element: /* @__PURE__ */ jsx32(CoreTransactionalEmail, {}), permissions: ["transactionalEmail.config.read"], capabilities: ["core.transactional-email"] });
|
|
5307
|
+
pushMenu({ label: "E-mail transacional", href: "/configuracoes/email-transacional", section: "Configura\xE7\xF5es", order: 910, permissions: ["transactionalEmail.config.read"], capabilities: ["core.transactional-email"] });
|
|
5308
|
+
}
|
|
5160
5309
|
const navMode = config.ui?.navigation?.mode ?? "auto";
|
|
5161
5310
|
const includeAuto = navMode === "auto" || navMode === "mixed";
|
|
5162
5311
|
const includeManual = navMode === "manual" || navMode === "mixed";
|
|
@@ -5183,13 +5332,13 @@ import {
|
|
|
5183
5332
|
} from "react-router-dom";
|
|
5184
5333
|
|
|
5185
5334
|
// src/shell/DefaultShell.tsx
|
|
5186
|
-
import { Box as
|
|
5335
|
+
import { Box as Box24, Button as Button17, Flex as Flex17, Spacer as Spacer2, Text as Text25 } from "@chakra-ui/react";
|
|
5187
5336
|
import { Outlet, useNavigate as useNavigate2 } from "react-router-dom";
|
|
5188
5337
|
|
|
5189
5338
|
// src/shell/Sidebar.tsx
|
|
5190
|
-
import { Box as
|
|
5339
|
+
import { Box as Box23, Flex as Flex16, Image, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
5191
5340
|
import { NavLink } from "react-router-dom";
|
|
5192
|
-
import { jsx as
|
|
5341
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5193
5342
|
function groupBySection(items) {
|
|
5194
5343
|
const groups = /* @__PURE__ */ new Map();
|
|
5195
5344
|
for (const item of items) {
|
|
@@ -5202,8 +5351,8 @@ function groupBySection(items) {
|
|
|
5202
5351
|
function Sidebar({ app, menu, registry }) {
|
|
5203
5352
|
const { hasPermission } = useOonAuth();
|
|
5204
5353
|
const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
|
|
5205
|
-
return /* @__PURE__ */
|
|
5206
|
-
|
|
5354
|
+
return /* @__PURE__ */ jsxs24(
|
|
5355
|
+
Box23,
|
|
5207
5356
|
{
|
|
5208
5357
|
as: "nav",
|
|
5209
5358
|
w: { base: "76px", lg: "248px" },
|
|
@@ -5218,9 +5367,9 @@ function Sidebar({ app, menu, registry }) {
|
|
|
5218
5367
|
alignSelf: "flex-start",
|
|
5219
5368
|
overflowY: "auto",
|
|
5220
5369
|
children: [
|
|
5221
|
-
/* @__PURE__ */
|
|
5222
|
-
app.logo ? /* @__PURE__ */
|
|
5223
|
-
|
|
5370
|
+
/* @__PURE__ */ jsxs24(Flex16, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
|
|
5371
|
+
app.logo ? /* @__PURE__ */ jsx33(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx33(
|
|
5372
|
+
Flex16,
|
|
5224
5373
|
{
|
|
5225
5374
|
w: "38px",
|
|
5226
5375
|
h: "38px",
|
|
@@ -5235,14 +5384,14 @@ function Sidebar({ app, menu, registry }) {
|
|
|
5235
5384
|
children: "O"
|
|
5236
5385
|
}
|
|
5237
5386
|
),
|
|
5238
|
-
/* @__PURE__ */
|
|
5239
|
-
/* @__PURE__ */
|
|
5240
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsxs24(Box23, { display: { base: "none", lg: "block" }, minW: 0, children: [
|
|
5388
|
+
/* @__PURE__ */ jsx33(Text24, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
|
|
5389
|
+
/* @__PURE__ */ jsx33(Text24, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
|
|
5241
5390
|
] })
|
|
5242
5391
|
] }),
|
|
5243
|
-
/* @__PURE__ */
|
|
5244
|
-
/* @__PURE__ */
|
|
5245
|
-
|
|
5392
|
+
/* @__PURE__ */ jsx33(Stack10, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs24(Stack10, { gap: 1, children: [
|
|
5393
|
+
/* @__PURE__ */ jsx33(
|
|
5394
|
+
Text24,
|
|
5246
5395
|
{
|
|
5247
5396
|
display: { base: "none", lg: "block" },
|
|
5248
5397
|
fontSize: "10px",
|
|
@@ -5257,9 +5406,9 @@ function Sidebar({ app, menu, registry }) {
|
|
|
5257
5406
|
),
|
|
5258
5407
|
items.map((item) => {
|
|
5259
5408
|
const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
|
|
5260
|
-
if (CustomMenuItem) return /* @__PURE__ */
|
|
5261
|
-
return /* @__PURE__ */
|
|
5262
|
-
|
|
5409
|
+
if (CustomMenuItem) return /* @__PURE__ */ jsx33(CustomMenuItem, { item }, item.href);
|
|
5410
|
+
return /* @__PURE__ */ jsx33(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs24(
|
|
5411
|
+
Flex16,
|
|
5263
5412
|
{
|
|
5264
5413
|
align: "center",
|
|
5265
5414
|
justify: { base: "center", lg: "flex-start" },
|
|
@@ -5276,8 +5425,8 @@ function Sidebar({ app, menu, registry }) {
|
|
|
5276
5425
|
transition: "all 0.15s ease",
|
|
5277
5426
|
_hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
|
|
5278
5427
|
children: [
|
|
5279
|
-
item.icon ? /* @__PURE__ */
|
|
5280
|
-
/* @__PURE__ */
|
|
5428
|
+
item.icon ? /* @__PURE__ */ jsx33(Box23, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx33(Box23, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
|
|
5429
|
+
/* @__PURE__ */ jsx33(Text24, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
|
|
5281
5430
|
]
|
|
5282
5431
|
}
|
|
5283
5432
|
) }, item.href);
|
|
@@ -5291,7 +5440,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
5291
5440
|
// package.json
|
|
5292
5441
|
var package_default = {
|
|
5293
5442
|
name: "@oondemand/oon-core-front",
|
|
5294
|
-
version: "0.4.
|
|
5443
|
+
version: "0.4.16",
|
|
5295
5444
|
repository: {
|
|
5296
5445
|
type: "git",
|
|
5297
5446
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -5410,9 +5559,9 @@ function shortCommit(commit) {
|
|
|
5410
5559
|
}
|
|
5411
5560
|
|
|
5412
5561
|
// src/shell/DefaultShell.tsx
|
|
5413
|
-
import { jsx as
|
|
5562
|
+
import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5414
5563
|
function SettingsIcon() {
|
|
5415
|
-
return /* @__PURE__ */
|
|
5564
|
+
return /* @__PURE__ */ jsxs25(
|
|
5416
5565
|
"svg",
|
|
5417
5566
|
{
|
|
5418
5567
|
"aria-hidden": "true",
|
|
@@ -5422,7 +5571,7 @@ function SettingsIcon() {
|
|
|
5422
5571
|
fill: "none",
|
|
5423
5572
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5424
5573
|
children: [
|
|
5425
|
-
/* @__PURE__ */
|
|
5574
|
+
/* @__PURE__ */ jsx34(
|
|
5426
5575
|
"path",
|
|
5427
5576
|
{
|
|
5428
5577
|
d: "M12 15.25a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5Z",
|
|
@@ -5430,7 +5579,7 @@ function SettingsIcon() {
|
|
|
5430
5579
|
strokeWidth: "1.8"
|
|
5431
5580
|
}
|
|
5432
5581
|
),
|
|
5433
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsx34(
|
|
5434
5583
|
"path",
|
|
5435
5584
|
{
|
|
5436
5585
|
d: "M19.43 12.98c.04-.32.07-.65.07-.98s-.03-.66-.08-.98l2.12-1.66-2-3.46-2.5 1a7.64 7.64 0 0 0-1.7-.98L15 3.25h-4l-.35 2.67c-.61.25-1.18.58-1.7.98l-2.5-1-2 3.46 2.12 1.66c-.04.32-.07.65-.07.98s.03.66.08.98l-2.12 1.66 2 3.46 2.5-1c.52.4 1.09.73 1.7.98l.34 2.67h4l.35-2.67a7.64 7.64 0 0 0 1.7-.98l2.5 1 2-3.46-2.12-1.66Z",
|
|
@@ -5480,8 +5629,8 @@ function CoreTopbar({ app, menu }) {
|
|
|
5480
5629
|
);
|
|
5481
5630
|
const tenant = user?.tenant;
|
|
5482
5631
|
const tenantLabel = String(tenant?.nome || tenant?.slug || "").trim();
|
|
5483
|
-
return /* @__PURE__ */
|
|
5484
|
-
|
|
5632
|
+
return /* @__PURE__ */ jsxs25(
|
|
5633
|
+
Flex17,
|
|
5485
5634
|
{
|
|
5486
5635
|
as: "header",
|
|
5487
5636
|
align: "center",
|
|
@@ -5496,9 +5645,9 @@ function CoreTopbar({ app, menu }) {
|
|
|
5496
5645
|
top: 0,
|
|
5497
5646
|
zIndex: 10,
|
|
5498
5647
|
children: [
|
|
5499
|
-
/* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
5501
|
-
|
|
5648
|
+
/* @__PURE__ */ jsxs25(Box24, { minW: 0, title: details, children: [
|
|
5649
|
+
/* @__PURE__ */ jsx34(
|
|
5650
|
+
Text25,
|
|
5502
5651
|
{
|
|
5503
5652
|
fontSize: "xs",
|
|
5504
5653
|
fontWeight: "600",
|
|
@@ -5508,12 +5657,12 @@ function CoreTopbar({ app, menu }) {
|
|
|
5508
5657
|
children: "Central Oon"
|
|
5509
5658
|
}
|
|
5510
5659
|
),
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
tenantLabel ? /* @__PURE__ */
|
|
5660
|
+
/* @__PURE__ */ jsx34(Text25, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name }),
|
|
5661
|
+
tenantLabel ? /* @__PURE__ */ jsxs25(Text25, { fontSize: "xs", fontWeight: "600", color: "brand.600", lineHeight: "1.4", children: [
|
|
5513
5662
|
"Tenant: ",
|
|
5514
5663
|
tenantLabel
|
|
5515
5664
|
] }) : null,
|
|
5516
|
-
/* @__PURE__ */
|
|
5665
|
+
/* @__PURE__ */ jsxs25(Text25, { fontSize: "10px", color: "gray.600", lineHeight: "1.35", children: [
|
|
5517
5666
|
"Central ",
|
|
5518
5667
|
centralVersion,
|
|
5519
5668
|
" \xB7 Front ",
|
|
@@ -5521,16 +5670,16 @@ function CoreTopbar({ app, menu }) {
|
|
|
5521
5670
|
" \xB7 Back ",
|
|
5522
5671
|
backendVersion
|
|
5523
5672
|
] }),
|
|
5524
|
-
publicationParts.length ? /* @__PURE__ */
|
|
5673
|
+
publicationParts.length ? /* @__PURE__ */ jsx34(Text25, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
|
|
5525
5674
|
] }),
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
user ? /* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
user.email ? /* @__PURE__ */
|
|
5675
|
+
/* @__PURE__ */ jsx34(Spacer2, {}),
|
|
5676
|
+
user ? /* @__PURE__ */ jsxs25(Flex17, { align: "center", gap: 3, children: [
|
|
5677
|
+
/* @__PURE__ */ jsxs25(Box24, { textAlign: "right", display: { base: "none", md: "block" }, children: [
|
|
5678
|
+
/* @__PURE__ */ jsx34(Text25, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
|
|
5679
|
+
user.email ? /* @__PURE__ */ jsx34(Text25, { fontSize: "xs", color: "gray.500", children: user.email }) : null
|
|
5531
5680
|
] }),
|
|
5532
|
-
settingsHref ? /* @__PURE__ */
|
|
5533
|
-
|
|
5681
|
+
settingsHref ? /* @__PURE__ */ jsx34(
|
|
5682
|
+
Button17,
|
|
5534
5683
|
{
|
|
5535
5684
|
size: "sm",
|
|
5536
5685
|
variant: "outline",
|
|
@@ -5541,11 +5690,11 @@ function CoreTopbar({ app, menu }) {
|
|
|
5541
5690
|
"aria-label": "Abrir configura\xE7\xF5es",
|
|
5542
5691
|
title: "Configura\xE7\xF5es",
|
|
5543
5692
|
onClick: () => navigate(settingsHref),
|
|
5544
|
-
children: /* @__PURE__ */
|
|
5693
|
+
children: /* @__PURE__ */ jsx34(SettingsIcon, {})
|
|
5545
5694
|
}
|
|
5546
5695
|
) : null,
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
|
|
5696
|
+
/* @__PURE__ */ jsx34(
|
|
5697
|
+
Button17,
|
|
5549
5698
|
{
|
|
5550
5699
|
size: "sm",
|
|
5551
5700
|
variant: "outline",
|
|
@@ -5570,12 +5719,12 @@ function Slot({
|
|
|
5570
5719
|
if (slot === "none") return null;
|
|
5571
5720
|
if (slot?.startsWith("custom:")) {
|
|
5572
5721
|
const Component = resolveComponent(registry, slot, "layoutSlots");
|
|
5573
|
-
return Component ? /* @__PURE__ */
|
|
5722
|
+
return Component ? /* @__PURE__ */ jsx34(Component, { app, menu }) : /* @__PURE__ */ jsx34(MissingRenderer, { renderer: slot });
|
|
5574
5723
|
}
|
|
5575
|
-
if (name === "sidebar") return /* @__PURE__ */
|
|
5576
|
-
if (name === "topbar") return /* @__PURE__ */
|
|
5724
|
+
if (name === "sidebar") return /* @__PURE__ */ jsx34(Sidebar, { app, menu, registry });
|
|
5725
|
+
if (name === "topbar") return /* @__PURE__ */ jsx34(CoreTopbar, { app, menu });
|
|
5577
5726
|
if (name === "footer" && slot === "core") {
|
|
5578
|
-
return /* @__PURE__ */
|
|
5727
|
+
return /* @__PURE__ */ jsx34(Box24, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
|
|
5579
5728
|
}
|
|
5580
5729
|
return null;
|
|
5581
5730
|
}
|
|
@@ -5587,8 +5736,8 @@ function DefaultShell({
|
|
|
5587
5736
|
}) {
|
|
5588
5737
|
const portal = layout?.shell === "portal" || layout?.shell === "content-only";
|
|
5589
5738
|
const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
|
|
5590
|
-
return /* @__PURE__ */
|
|
5591
|
-
/* @__PURE__ */
|
|
5739
|
+
return /* @__PURE__ */ jsxs25(Flex17, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
|
|
5740
|
+
/* @__PURE__ */ jsx34(
|
|
5592
5741
|
Slot,
|
|
5593
5742
|
{
|
|
5594
5743
|
name: "sidebar",
|
|
@@ -5598,8 +5747,8 @@ function DefaultShell({
|
|
|
5598
5747
|
menu
|
|
5599
5748
|
}
|
|
5600
5749
|
),
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5750
|
+
/* @__PURE__ */ jsxs25(Flex17, { direction: "column", flex: "1", minW: 0, children: [
|
|
5751
|
+
/* @__PURE__ */ jsx34(
|
|
5603
5752
|
Slot,
|
|
5604
5753
|
{
|
|
5605
5754
|
name: "topbar",
|
|
@@ -5609,9 +5758,9 @@ function DefaultShell({
|
|
|
5609
5758
|
menu
|
|
5610
5759
|
}
|
|
5611
5760
|
),
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5761
|
+
/* @__PURE__ */ jsx34(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
|
|
5762
|
+
/* @__PURE__ */ jsx34(Box24, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx34(Box24, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx34(Outlet, {}) }) }),
|
|
5763
|
+
/* @__PURE__ */ jsx34(
|
|
5615
5764
|
Slot,
|
|
5616
5765
|
{
|
|
5617
5766
|
name: "footer",
|
|
@@ -5625,24 +5774,24 @@ function DefaultShell({
|
|
|
5625
5774
|
] });
|
|
5626
5775
|
}
|
|
5627
5776
|
function PortalShell(props) {
|
|
5628
|
-
return /* @__PURE__ */
|
|
5777
|
+
return /* @__PURE__ */ jsx34(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
|
|
5629
5778
|
}
|
|
5630
5779
|
|
|
5631
5780
|
// src/shell/AuthenticatedLayout.tsx
|
|
5632
|
-
import { jsx as
|
|
5781
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5633
5782
|
function AuthenticatedLayout({ app, menu, layout, registry }) {
|
|
5634
5783
|
if (layout?.shell?.startsWith("custom:")) {
|
|
5635
5784
|
const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
|
|
5636
|
-
return CustomShell ? /* @__PURE__ */
|
|
5785
|
+
return CustomShell ? /* @__PURE__ */ jsx35(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx35(MissingRenderer, { renderer: layout.shell });
|
|
5637
5786
|
}
|
|
5638
|
-
if (layout?.shell === "portal") return /* @__PURE__ */
|
|
5639
|
-
return /* @__PURE__ */
|
|
5787
|
+
if (layout?.shell === "portal") return /* @__PURE__ */ jsx35(PortalShell, { app, menu, layout, registry });
|
|
5788
|
+
return /* @__PURE__ */ jsx35(DefaultShell, { app, menu, layout, registry });
|
|
5640
5789
|
}
|
|
5641
5790
|
|
|
5642
5791
|
// src/security/AccessDeniedPage.tsx
|
|
5643
|
-
import { Box as
|
|
5792
|
+
import { Box as Box25, Button as Button18, Flex as Flex18, Heading as Heading14, Text as Text26, VStack as VStack4 } from "@chakra-ui/react";
|
|
5644
5793
|
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
5645
|
-
import { jsx as
|
|
5794
|
+
import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5646
5795
|
function AccessDeniedPage({ app }) {
|
|
5647
5796
|
const { logout } = useOonAuth();
|
|
5648
5797
|
const navigate = useNavigate3();
|
|
@@ -5650,8 +5799,8 @@ function AccessDeniedPage({ app }) {
|
|
|
5650
5799
|
logout();
|
|
5651
5800
|
navigate("/login", { replace: true });
|
|
5652
5801
|
}
|
|
5653
|
-
return /* @__PURE__ */
|
|
5654
|
-
|
|
5802
|
+
return /* @__PURE__ */ jsx36(Flex18, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx36(
|
|
5803
|
+
Box25,
|
|
5655
5804
|
{
|
|
5656
5805
|
width: "100%",
|
|
5657
5806
|
maxW: "560px",
|
|
@@ -5661,9 +5810,9 @@ function AccessDeniedPage({ app }) {
|
|
|
5661
5810
|
borderRadius: "18px",
|
|
5662
5811
|
boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
|
|
5663
5812
|
p: { base: 6, md: 10 },
|
|
5664
|
-
children: /* @__PURE__ */
|
|
5665
|
-
/* @__PURE__ */
|
|
5666
|
-
|
|
5813
|
+
children: /* @__PURE__ */ jsxs26(VStack4, { align: "stretch", gap: 6, children: [
|
|
5814
|
+
/* @__PURE__ */ jsx36(
|
|
5815
|
+
Box25,
|
|
5667
5816
|
{
|
|
5668
5817
|
width: "56px",
|
|
5669
5818
|
height: "56px",
|
|
@@ -5679,9 +5828,9 @@ function AccessDeniedPage({ app }) {
|
|
|
5679
5828
|
children: "!"
|
|
5680
5829
|
}
|
|
5681
5830
|
),
|
|
5682
|
-
/* @__PURE__ */
|
|
5683
|
-
/* @__PURE__ */
|
|
5684
|
-
|
|
5831
|
+
/* @__PURE__ */ jsxs26(Box25, { children: [
|
|
5832
|
+
/* @__PURE__ */ jsx36(
|
|
5833
|
+
Text26,
|
|
5685
5834
|
{
|
|
5686
5835
|
color: "#39BFED",
|
|
5687
5836
|
fontSize: "xs",
|
|
@@ -5691,15 +5840,15 @@ function AccessDeniedPage({ app }) {
|
|
|
5691
5840
|
children: "Acesso negado"
|
|
5692
5841
|
}
|
|
5693
5842
|
),
|
|
5694
|
-
/* @__PURE__ */
|
|
5695
|
-
/* @__PURE__ */
|
|
5843
|
+
/* @__PURE__ */ jsx36(Heading14, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
|
|
5844
|
+
/* @__PURE__ */ jsxs26(Text26, { mt: 3, color: "gray.600", children: [
|
|
5696
5845
|
"Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
|
|
5697
5846
|
app.title ?? app.name,
|
|
5698
5847
|
". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
|
|
5699
5848
|
] })
|
|
5700
5849
|
] }),
|
|
5701
|
-
/* @__PURE__ */
|
|
5702
|
-
|
|
5850
|
+
/* @__PURE__ */ jsx36(
|
|
5851
|
+
Button18,
|
|
5703
5852
|
{
|
|
5704
5853
|
alignSelf: "flex-start",
|
|
5705
5854
|
bg: "#07262E",
|
|
@@ -5716,7 +5865,7 @@ function AccessDeniedPage({ app }) {
|
|
|
5716
5865
|
|
|
5717
5866
|
// src/security/AppAccessGuard.tsx
|
|
5718
5867
|
import { Navigate, useLocation as useLocation3 } from "react-router-dom";
|
|
5719
|
-
import { Fragment as Fragment5, jsx as
|
|
5868
|
+
import { Fragment as Fragment5, jsx as jsx37 } from "react/jsx-runtime";
|
|
5720
5869
|
function loginRedirect(pathname, search) {
|
|
5721
5870
|
const destination = `${pathname}${search}`;
|
|
5722
5871
|
return `/login?redirect=${encodeURIComponent(destination)}`;
|
|
@@ -5724,14 +5873,14 @@ function loginRedirect(pathname, search) {
|
|
|
5724
5873
|
function AppAccessGuard({ children }) {
|
|
5725
5874
|
const { status, retry } = useOonAuth();
|
|
5726
5875
|
const location = useLocation3();
|
|
5727
|
-
if (status === "loading") return /* @__PURE__ */
|
|
5876
|
+
if (status === "loading") return /* @__PURE__ */ jsx37(LoadingScreen, {});
|
|
5728
5877
|
if (status === "unauthenticated") {
|
|
5729
|
-
return /* @__PURE__ */
|
|
5878
|
+
return /* @__PURE__ */ jsx37(Navigate, { to: loginRedirect(location.pathname, location.search), replace: true });
|
|
5730
5879
|
}
|
|
5731
|
-
if (status === "first-access") return /* @__PURE__ */
|
|
5732
|
-
if (status === "forbidden") return /* @__PURE__ */
|
|
5880
|
+
if (status === "first-access") return /* @__PURE__ */ jsx37(Navigate, { to: "/first-access", replace: true });
|
|
5881
|
+
if (status === "forbidden") return /* @__PURE__ */ jsx37(Navigate, { to: "/acesso-negado", replace: true });
|
|
5733
5882
|
if (status === "error") {
|
|
5734
|
-
return /* @__PURE__ */
|
|
5883
|
+
return /* @__PURE__ */ jsx37(
|
|
5735
5884
|
LoadingScreen,
|
|
5736
5885
|
{
|
|
5737
5886
|
message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
|
|
@@ -5742,14 +5891,14 @@ function AppAccessGuard({ children }) {
|
|
|
5742
5891
|
}
|
|
5743
5892
|
);
|
|
5744
5893
|
}
|
|
5745
|
-
return /* @__PURE__ */
|
|
5894
|
+
return /* @__PURE__ */ jsx37(Fragment5, { children });
|
|
5746
5895
|
}
|
|
5747
5896
|
|
|
5748
5897
|
// src/security/LoginPage.tsx
|
|
5749
|
-
import { useState as
|
|
5750
|
-
import { Box as
|
|
5898
|
+
import { useState as useState19 } from "react";
|
|
5899
|
+
import { Box as Box26, Button as Button19, Flex as Flex19, Heading as Heading15, Input as Input11, SimpleGrid as SimpleGrid6, Text as Text27, VStack as VStack5 } from "@chakra-ui/react";
|
|
5751
5900
|
import { Link as Link3, Navigate as Navigate2, useLocation as useLocation4 } from "react-router-dom";
|
|
5752
|
-
import { jsx as
|
|
5901
|
+
import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5753
5902
|
function tenantOptions(error) {
|
|
5754
5903
|
const details = error.details;
|
|
5755
5904
|
if (!details || typeof details !== "object" || Array.isArray(details)) return [];
|
|
@@ -5777,16 +5926,16 @@ function tenantUrl(path, tenantId) {
|
|
|
5777
5926
|
function LoginPage({ app, onboardingEnabled = false }) {
|
|
5778
5927
|
const { status, login } = useOonAuth();
|
|
5779
5928
|
const location = useLocation4();
|
|
5780
|
-
const [email, setEmail] =
|
|
5781
|
-
const [password, setPassword] =
|
|
5782
|
-
const [submitting, setSubmitting] =
|
|
5783
|
-
const [message, setMessage] =
|
|
5784
|
-
const [tenants, setTenants] =
|
|
5785
|
-
const [selectorMode, setSelectorMode] =
|
|
5786
|
-
const [openingTenant, setOpeningTenant] =
|
|
5929
|
+
const [email, setEmail] = useState19("");
|
|
5930
|
+
const [password, setPassword] = useState19("");
|
|
5931
|
+
const [submitting, setSubmitting] = useState19(false);
|
|
5932
|
+
const [message, setMessage] = useState19(null);
|
|
5933
|
+
const [tenants, setTenants] = useState19([]);
|
|
5934
|
+
const [selectorMode, setSelectorMode] = useState19(false);
|
|
5935
|
+
const [openingTenant, setOpeningTenant] = useState19(null);
|
|
5787
5936
|
const redirect = safeRedirect(location.search);
|
|
5788
|
-
if (status === "authenticated" && !selectorMode) return /* @__PURE__ */
|
|
5789
|
-
if (status === "forbidden") return /* @__PURE__ */
|
|
5937
|
+
if (status === "authenticated" && !selectorMode) return /* @__PURE__ */ jsx38(Navigate2, { to: redirect, replace: true });
|
|
5938
|
+
if (status === "forbidden") return /* @__PURE__ */ jsx38(Navigate2, { to: "/acesso-negado", replace: true });
|
|
5790
5939
|
async function handleSubmit(event) {
|
|
5791
5940
|
event.preventDefault();
|
|
5792
5941
|
if (tenants.length > 1) return;
|
|
@@ -5834,56 +5983,56 @@ function LoginPage({ app, onboardingEnabled = false }) {
|
|
|
5834
5983
|
setOpeningTenant(null);
|
|
5835
5984
|
}
|
|
5836
5985
|
}
|
|
5837
|
-
return /* @__PURE__ */
|
|
5838
|
-
/* @__PURE__ */
|
|
5839
|
-
/* @__PURE__ */
|
|
5840
|
-
/* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
5986
|
+
return /* @__PURE__ */ jsx38(Flex19, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx38(Box26, { width: "100%", maxW: tenants.length > 1 ? "760px" : "440px", bg: "white", borderWidth: "1px", borderColor: "#E4EBEF", borderRadius: "18px", boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)", p: { base: 6, md: 9 }, children: /* @__PURE__ */ jsx38("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs27(VStack5, { align: "stretch", gap: 6, children: [
|
|
5987
|
+
/* @__PURE__ */ jsxs27(Box26, { children: [
|
|
5988
|
+
/* @__PURE__ */ jsx38(Text27, { color: "#39BFED", fontSize: "xs", fontWeight: "700", letterSpacing: "0.12em", textTransform: "uppercase", children: "Central Oon" }),
|
|
5989
|
+
/* @__PURE__ */ jsx38(Heading15, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
|
|
5990
|
+
/* @__PURE__ */ jsx38(Text27, { mt: 2, color: "gray.600", fontSize: "sm", children: tenants.length > 1 ? "Abra uma ou mais organiza\xE7\xF5es para trabalhar em contextos separados." : "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
|
|
5842
5991
|
] }),
|
|
5843
|
-
tenants.length <= 1 ? /* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
5992
|
+
tenants.length <= 1 ? /* @__PURE__ */ jsxs27(VStack5, { align: "stretch", gap: 4, children: [
|
|
5993
|
+
/* @__PURE__ */ jsxs27(Box26, { children: [
|
|
5994
|
+
/* @__PURE__ */ jsx38(Text27, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
|
|
5995
|
+
/* @__PURE__ */ jsx38(Input11, { type: "email", value: email, onChange: (event) => {
|
|
5847
5996
|
setEmail(event.target.value);
|
|
5848
5997
|
setTenants([]);
|
|
5849
5998
|
setSelectorMode(false);
|
|
5850
5999
|
}, autoComplete: "email", placeholder: "voce@empresa.com.br", required: true })
|
|
5851
6000
|
] }),
|
|
5852
|
-
/* @__PURE__ */
|
|
5853
|
-
/* @__PURE__ */
|
|
5854
|
-
/* @__PURE__ */
|
|
6001
|
+
/* @__PURE__ */ jsxs27(Box26, { children: [
|
|
6002
|
+
/* @__PURE__ */ jsx38(Text27, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
|
|
6003
|
+
/* @__PURE__ */ jsx38(Input11, { type: "password", value: password, onChange: (event) => setPassword(event.target.value), autoComplete: "current-password", placeholder: "Sua senha", required: true })
|
|
5855
6004
|
] })
|
|
5856
|
-
] }) : /* @__PURE__ */
|
|
5857
|
-
/* @__PURE__ */
|
|
5858
|
-
/* @__PURE__ */
|
|
5859
|
-
/* @__PURE__ */
|
|
5860
|
-
/* @__PURE__ */
|
|
5861
|
-
/* @__PURE__ */
|
|
6005
|
+
] }) : /* @__PURE__ */ jsxs27(Box26, { children: [
|
|
6006
|
+
/* @__PURE__ */ jsx38(Text27, { mb: 3, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Escolha o tenant para acessar" }),
|
|
6007
|
+
/* @__PURE__ */ jsx38(SimpleGrid6, { columns: { base: 1, md: 2 }, gap: 3, children: tenants.map((tenant) => /* @__PURE__ */ jsx38(Button19, { type: "button", variant: "outline", height: "auto", minH: "104px", justifyContent: "flex-start", whiteSpace: "normal", textAlign: "left", borderWidth: "2px", borderColor: "#D9E2E7", bg: "white", color: "#24323A", disabled: Boolean(openingTenant), "aria-label": `Abrir ${tenant.nome} em nova aba`, onClick: () => void openTenant(tenant), _hover: { borderColor: "#39BFED", bg: "#F6FCFE" }, children: /* @__PURE__ */ jsxs27(VStack5, { align: "start", gap: 1, py: 3, children: [
|
|
6008
|
+
/* @__PURE__ */ jsx38(Text27, { fontWeight: "700", children: tenant.nome }),
|
|
6009
|
+
/* @__PURE__ */ jsx38(Text27, { fontSize: "xs", color: "gray.500", children: [tenant.slug, tenant.tipo, tenant.status].filter(Boolean).join(" \xB7 ") }),
|
|
6010
|
+
/* @__PURE__ */ jsx38(Text27, { fontSize: "xs", color: "#168EB9", children: openingTenant === tenant.id ? "Abrindo..." : "Abrir em nova aba" })
|
|
5862
6011
|
] }) }, tenant.id)) })
|
|
5863
6012
|
] }),
|
|
5864
|
-
message ? /* @__PURE__ */
|
|
5865
|
-
tenants.length <= 1 ? /* @__PURE__ */
|
|
5866
|
-
app.kind === "portal-cockpit" && onboardingEnabled && tenants.length <= 1 ? /* @__PURE__ */
|
|
6013
|
+
message ? /* @__PURE__ */ jsx38(Box26, { role: "status", borderRadius: "10px", bg: "blue.50", color: "blue.800", px: 4, py: 3, fontSize: "sm", children: message }) : null,
|
|
6014
|
+
tenants.length <= 1 ? /* @__PURE__ */ jsx38(Button19, { type: "submit", bg: "#07262E", color: "white", _hover: { bg: "#0B3843" }, disabled: submitting || !email.trim() || !password, children: submitting ? "Validando acesso..." : "Entrar" }) : null,
|
|
6015
|
+
app.kind === "portal-cockpit" && onboardingEnabled && tenants.length <= 1 ? /* @__PURE__ */ jsxs27(Text27, { textAlign: "center", fontSize: "sm", color: "gray.600", children: [
|
|
5867
6016
|
"Ainda n\xE3o possui acesso? ",
|
|
5868
|
-
/* @__PURE__ */
|
|
6017
|
+
/* @__PURE__ */ jsx38(Link3, { to: "/cadastro", children: "Criar conta" })
|
|
5869
6018
|
] }) : null
|
|
5870
6019
|
] }) }) }) });
|
|
5871
6020
|
}
|
|
5872
6021
|
|
|
5873
6022
|
// src/security/FirstAccessPage.tsx
|
|
5874
|
-
import { useState as
|
|
5875
|
-
import { Box as
|
|
6023
|
+
import { useState as useState20 } from "react";
|
|
6024
|
+
import { Box as Box27, Button as Button20, Flex as Flex20, Heading as Heading16, Input as Input12, Text as Text28, VStack as VStack6 } from "@chakra-ui/react";
|
|
5876
6025
|
import { Navigate as Navigate3 } from "react-router-dom";
|
|
5877
|
-
import { jsx as
|
|
6026
|
+
import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5878
6027
|
function FirstAccessPage() {
|
|
5879
6028
|
const { status, completeFirstAccess } = useOonAuth();
|
|
5880
|
-
const [password, setPassword] =
|
|
5881
|
-
const [confirm, setConfirm] =
|
|
5882
|
-
const [submitting, setSubmitting] =
|
|
5883
|
-
const [message, setMessage] =
|
|
5884
|
-
if (status === "authenticated") return /* @__PURE__ */
|
|
5885
|
-
if (status === "unauthenticated") return /* @__PURE__ */
|
|
5886
|
-
if (status === "forbidden") return /* @__PURE__ */
|
|
6029
|
+
const [password, setPassword] = useState20("");
|
|
6030
|
+
const [confirm, setConfirm] = useState20("");
|
|
6031
|
+
const [submitting, setSubmitting] = useState20(false);
|
|
6032
|
+
const [message, setMessage] = useState20(null);
|
|
6033
|
+
if (status === "authenticated") return /* @__PURE__ */ jsx39(Navigate3, { to: "/", replace: true });
|
|
6034
|
+
if (status === "unauthenticated") return /* @__PURE__ */ jsx39(Navigate3, { to: "/login", replace: true });
|
|
6035
|
+
if (status === "forbidden") return /* @__PURE__ */ jsx39(Navigate3, { to: "/acesso-negado", replace: true });
|
|
5887
6036
|
async function submit(event) {
|
|
5888
6037
|
event.preventDefault();
|
|
5889
6038
|
setMessage(null);
|
|
@@ -5904,29 +6053,29 @@ function FirstAccessPage() {
|
|
|
5904
6053
|
setSubmitting(false);
|
|
5905
6054
|
}
|
|
5906
6055
|
}
|
|
5907
|
-
return /* @__PURE__ */
|
|
5908
|
-
/* @__PURE__ */
|
|
5909
|
-
/* @__PURE__ */
|
|
5910
|
-
/* @__PURE__ */
|
|
5911
|
-
/* @__PURE__ */
|
|
6056
|
+
return /* @__PURE__ */ jsx39(Flex20, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx39(Box27, { width: "100%", maxW: "460px", bg: "white", borderWidth: "1px", borderRadius: "18px", p: { base: 6, md: 9 }, children: /* @__PURE__ */ jsx39("form", { onSubmit: (event) => void submit(event), children: /* @__PURE__ */ jsxs28(VStack6, { align: "stretch", gap: 5, children: [
|
|
6057
|
+
/* @__PURE__ */ jsxs28(Box27, { children: [
|
|
6058
|
+
/* @__PURE__ */ jsx39(Text28, { color: "#39BFED", fontSize: "xs", fontWeight: "700", textTransform: "uppercase", children: "Primeiro acesso" }),
|
|
6059
|
+
/* @__PURE__ */ jsx39(Heading16, { mt: 2, size: "lg", children: "Defina sua nova senha" }),
|
|
6060
|
+
/* @__PURE__ */ jsx39(Text28, { mt: 2, fontSize: "sm", color: "gray.600", children: "O acesso \xE0 Central s\xF3 ser\xE1 liberado depois desta etapa." })
|
|
5912
6061
|
] }),
|
|
5913
|
-
/* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
/* @__PURE__ */
|
|
6062
|
+
/* @__PURE__ */ jsxs28(Box27, { children: [
|
|
6063
|
+
/* @__PURE__ */ jsx39(Text28, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Nova senha" }),
|
|
6064
|
+
/* @__PURE__ */ jsx39(Input12, { type: "password", autoComplete: "new-password", value: password, onChange: (event) => setPassword(event.target.value), required: true })
|
|
5916
6065
|
] }),
|
|
5917
|
-
/* @__PURE__ */
|
|
5918
|
-
/* @__PURE__ */
|
|
5919
|
-
/* @__PURE__ */
|
|
6066
|
+
/* @__PURE__ */ jsxs28(Box27, { children: [
|
|
6067
|
+
/* @__PURE__ */ jsx39(Text28, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Confirmar senha" }),
|
|
6068
|
+
/* @__PURE__ */ jsx39(Input12, { type: "password", autoComplete: "new-password", value: confirm, onChange: (event) => setConfirm(event.target.value), required: true })
|
|
5920
6069
|
] }),
|
|
5921
|
-
message ? /* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
6070
|
+
message ? /* @__PURE__ */ jsx39(Box27, { role: "alert", bg: "red.50", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsx39(Text28, { fontSize: "sm", children: message }) }) : null,
|
|
6071
|
+
/* @__PURE__ */ jsx39(Button20, { type: "submit", disabled: submitting, children: submitting ? "Salvando\u2026" : "Definir nova senha" })
|
|
5923
6072
|
] }) }) }) });
|
|
5924
6073
|
}
|
|
5925
6074
|
|
|
5926
6075
|
// src/security/ActivationPage.tsx
|
|
5927
|
-
import { useEffect as useEffect11, useState as
|
|
5928
|
-
import { Box as
|
|
5929
|
-
import { Fragment as Fragment6, jsx as
|
|
6076
|
+
import { useEffect as useEffect11, useState as useState21 } from "react";
|
|
6077
|
+
import { Box as Box28, Button as Button21, Heading as Heading17, Input as Input13, Text as Text29, VStack as VStack7 } from "@chakra-ui/react";
|
|
6078
|
+
import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5930
6079
|
function encodeBasicCredentials2(email, password) {
|
|
5931
6080
|
const bytes = new TextEncoder().encode(`${email}:${password}`);
|
|
5932
6081
|
let binary = "";
|
|
@@ -5936,21 +6085,21 @@ function encodeBasicCredentials2(email, password) {
|
|
|
5936
6085
|
function ActivationPage() {
|
|
5937
6086
|
const { http } = useOonApi();
|
|
5938
6087
|
const activation = useActivation();
|
|
5939
|
-
const [step, setStep] =
|
|
5940
|
-
const [config, setConfig] =
|
|
5941
|
-
const [code, setCode] =
|
|
5942
|
-
const [preview, setPreview] =
|
|
5943
|
-
const [global, setGlobal] =
|
|
5944
|
-
const [app, setApp] =
|
|
5945
|
-
const [rootEmail, setRootEmail] =
|
|
5946
|
-
const [rootPassword, setRootPassword] =
|
|
5947
|
-
const [devName, setDevName] =
|
|
5948
|
-
const [devEmail, setDevEmail] =
|
|
5949
|
-
const [devPassword, setDevPassword] =
|
|
5950
|
-
const [showCodeFlow, setShowCodeFlow] =
|
|
5951
|
-
const [devResult, setDevResult] =
|
|
5952
|
-
const [error, setError] =
|
|
5953
|
-
const [submitting, setSubmitting] =
|
|
6088
|
+
const [step, setStep] = useState21(1);
|
|
6089
|
+
const [config, setConfig] = useState21(null);
|
|
6090
|
+
const [code, setCode] = useState21("");
|
|
6091
|
+
const [preview, setPreview] = useState21(null);
|
|
6092
|
+
const [global, setGlobal] = useState21({});
|
|
6093
|
+
const [app, setApp] = useState21({});
|
|
6094
|
+
const [rootEmail, setRootEmail] = useState21("");
|
|
6095
|
+
const [rootPassword, setRootPassword] = useState21("");
|
|
6096
|
+
const [devName, setDevName] = useState21("");
|
|
6097
|
+
const [devEmail, setDevEmail] = useState21("");
|
|
6098
|
+
const [devPassword, setDevPassword] = useState21("");
|
|
6099
|
+
const [showCodeFlow, setShowCodeFlow] = useState21(false);
|
|
6100
|
+
const [devResult, setDevResult] = useState21(null);
|
|
6101
|
+
const [error, setError] = useState21(null);
|
|
6102
|
+
const [submitting, setSubmitting] = useState21(false);
|
|
5954
6103
|
useEffect11(() => {
|
|
5955
6104
|
http.get("/ativacao/configuracao").then((response) => {
|
|
5956
6105
|
setConfig(response.data);
|
|
@@ -6060,13 +6209,13 @@ function ActivationPage() {
|
|
|
6060
6209
|
}
|
|
6061
6210
|
}
|
|
6062
6211
|
function renderField(field, values, setValues) {
|
|
6063
|
-
return /* @__PURE__ */
|
|
6064
|
-
/* @__PURE__ */
|
|
6212
|
+
return /* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6213
|
+
/* @__PURE__ */ jsxs29(Text29, { fontWeight: "medium", children: [
|
|
6065
6214
|
field.label,
|
|
6066
6215
|
field.required ? " *" : ""
|
|
6067
6216
|
] }),
|
|
6068
|
-
/* @__PURE__ */
|
|
6069
|
-
|
|
6217
|
+
/* @__PURE__ */ jsx40(
|
|
6218
|
+
Input13,
|
|
6070
6219
|
{
|
|
6071
6220
|
type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
|
|
6072
6221
|
value: String(values[field.name] ?? field.defaultValue ?? ""),
|
|
@@ -6077,16 +6226,16 @@ function ActivationPage() {
|
|
|
6077
6226
|
onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
|
|
6078
6227
|
}
|
|
6079
6228
|
),
|
|
6080
|
-
field.helpText ? /* @__PURE__ */
|
|
6229
|
+
field.helpText ? /* @__PURE__ */ jsx40(Text29, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
|
|
6081
6230
|
] }, field.name);
|
|
6082
6231
|
}
|
|
6083
6232
|
function renderDevLocalActivation() {
|
|
6084
|
-
return /* @__PURE__ */
|
|
6085
|
-
/* @__PURE__ */
|
|
6086
|
-
/* @__PURE__ */
|
|
6087
|
-
/* @__PURE__ */
|
|
6088
|
-
/* @__PURE__ */
|
|
6089
|
-
|
|
6233
|
+
return /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6234
|
+
/* @__PURE__ */ jsx40(Text29, { 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." }),
|
|
6235
|
+
/* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6236
|
+
/* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
|
|
6237
|
+
/* @__PURE__ */ jsx40(
|
|
6238
|
+
Input13,
|
|
6090
6239
|
{
|
|
6091
6240
|
value: devName,
|
|
6092
6241
|
onChange: (event) => setDevName(event.target.value),
|
|
@@ -6095,10 +6244,10 @@ function ActivationPage() {
|
|
|
6095
6244
|
}
|
|
6096
6245
|
)
|
|
6097
6246
|
] }),
|
|
6098
|
-
/* @__PURE__ */
|
|
6099
|
-
/* @__PURE__ */
|
|
6100
|
-
/* @__PURE__ */
|
|
6101
|
-
|
|
6247
|
+
/* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6248
|
+
/* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "E-mail *" }),
|
|
6249
|
+
/* @__PURE__ */ jsx40(
|
|
6250
|
+
Input13,
|
|
6102
6251
|
{
|
|
6103
6252
|
type: "email",
|
|
6104
6253
|
value: devEmail,
|
|
@@ -6108,10 +6257,10 @@ function ActivationPage() {
|
|
|
6108
6257
|
}
|
|
6109
6258
|
)
|
|
6110
6259
|
] }),
|
|
6111
|
-
/* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6114
|
-
|
|
6260
|
+
/* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6261
|
+
/* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "Senha *" }),
|
|
6262
|
+
/* @__PURE__ */ jsx40(
|
|
6263
|
+
Input13,
|
|
6115
6264
|
{
|
|
6116
6265
|
type: "password",
|
|
6117
6266
|
value: devPassword,
|
|
@@ -6122,8 +6271,8 @@ function ActivationPage() {
|
|
|
6122
6271
|
}
|
|
6123
6272
|
)
|
|
6124
6273
|
] }),
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
|
|
6274
|
+
/* @__PURE__ */ jsx40(
|
|
6275
|
+
Button21,
|
|
6127
6276
|
{
|
|
6128
6277
|
colorPalette: "blue",
|
|
6129
6278
|
onClick: activateDevLocal,
|
|
@@ -6132,8 +6281,8 @@ function ActivationPage() {
|
|
|
6132
6281
|
children: "Ativar ambiente de desenvolvimento"
|
|
6133
6282
|
}
|
|
6134
6283
|
),
|
|
6135
|
-
/* @__PURE__ */
|
|
6136
|
-
|
|
6284
|
+
/* @__PURE__ */ jsx40(
|
|
6285
|
+
Button21,
|
|
6137
6286
|
{
|
|
6138
6287
|
variant: "outline",
|
|
6139
6288
|
onClick: () => setShowCodeFlow(true),
|
|
@@ -6146,7 +6295,7 @@ function ActivationPage() {
|
|
|
6146
6295
|
const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
|
|
6147
6296
|
const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
|
|
6148
6297
|
if (activation.status === "loading" || !config) {
|
|
6149
|
-
return /* @__PURE__ */
|
|
6298
|
+
return /* @__PURE__ */ jsx40(Box28, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs29(
|
|
6150
6299
|
VStack7,
|
|
6151
6300
|
{
|
|
6152
6301
|
maxW: "760px",
|
|
@@ -6157,14 +6306,14 @@ function ActivationPage() {
|
|
|
6157
6306
|
align: "stretch",
|
|
6158
6307
|
gap: 5,
|
|
6159
6308
|
children: [
|
|
6160
|
-
/* @__PURE__ */
|
|
6161
|
-
error ? /* @__PURE__ */
|
|
6309
|
+
/* @__PURE__ */ jsx40(Heading17, { children: "Preparando ativa\xE7\xE3o..." }),
|
|
6310
|
+
error ? /* @__PURE__ */ jsx40(Text29, { color: "red.600", children: error }) : null
|
|
6162
6311
|
]
|
|
6163
6312
|
}
|
|
6164
6313
|
) });
|
|
6165
6314
|
}
|
|
6166
6315
|
if (rootMode) {
|
|
6167
|
-
return /* @__PURE__ */
|
|
6316
|
+
return /* @__PURE__ */ jsx40(Box28, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs29(
|
|
6168
6317
|
VStack7,
|
|
6169
6318
|
{
|
|
6170
6319
|
maxW: "560px",
|
|
@@ -6175,21 +6324,21 @@ function ActivationPage() {
|
|
|
6175
6324
|
align: "stretch",
|
|
6176
6325
|
gap: 5,
|
|
6177
6326
|
children: [
|
|
6178
|
-
/* @__PURE__ */
|
|
6179
|
-
/* @__PURE__ */
|
|
6180
|
-
/* @__PURE__ */
|
|
6327
|
+
/* @__PURE__ */ jsx40(Heading17, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
|
|
6328
|
+
/* @__PURE__ */ jsx40(Text29, { 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." }),
|
|
6329
|
+
/* @__PURE__ */ jsxs29(Text29, { fontSize: "sm", color: "gray.500", children: [
|
|
6181
6330
|
"App: ",
|
|
6182
6331
|
config.technical.appCode,
|
|
6183
6332
|
" \xB7 Ambiente:",
|
|
6184
6333
|
" ",
|
|
6185
6334
|
config.technical.ambiente
|
|
6186
6335
|
] }),
|
|
6187
|
-
error ? /* @__PURE__ */
|
|
6188
|
-
step !== 6 ? /* @__PURE__ */
|
|
6189
|
-
/* @__PURE__ */
|
|
6190
|
-
/* @__PURE__ */
|
|
6191
|
-
/* @__PURE__ */
|
|
6192
|
-
|
|
6336
|
+
error ? /* @__PURE__ */ jsx40(Text29, { color: "red.600", children: error }) : null,
|
|
6337
|
+
step !== 6 ? /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6338
|
+
/* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6339
|
+
/* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "E-mail do administrador *" }),
|
|
6340
|
+
/* @__PURE__ */ jsx40(
|
|
6341
|
+
Input13,
|
|
6193
6342
|
{
|
|
6194
6343
|
type: "email",
|
|
6195
6344
|
autoComplete: "email",
|
|
@@ -6199,10 +6348,10 @@ function ActivationPage() {
|
|
|
6199
6348
|
}
|
|
6200
6349
|
)
|
|
6201
6350
|
] }),
|
|
6202
|
-
/* @__PURE__ */
|
|
6203
|
-
/* @__PURE__ */
|
|
6204
|
-
/* @__PURE__ */
|
|
6205
|
-
|
|
6351
|
+
/* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
|
|
6352
|
+
/* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "Senha *" }),
|
|
6353
|
+
/* @__PURE__ */ jsx40(
|
|
6354
|
+
Input13,
|
|
6206
6355
|
{
|
|
6207
6356
|
type: "password",
|
|
6208
6357
|
minLength: 8,
|
|
@@ -6213,8 +6362,8 @@ function ActivationPage() {
|
|
|
6213
6362
|
}
|
|
6214
6363
|
)
|
|
6215
6364
|
] }),
|
|
6216
|
-
/* @__PURE__ */
|
|
6217
|
-
|
|
6365
|
+
/* @__PURE__ */ jsx40(
|
|
6366
|
+
Button21,
|
|
6218
6367
|
{
|
|
6219
6368
|
colorPalette: "blue",
|
|
6220
6369
|
onClick: activateRoot,
|
|
@@ -6223,15 +6372,15 @@ function ActivationPage() {
|
|
|
6223
6372
|
children: "Criar ecossistema e ativar"
|
|
6224
6373
|
}
|
|
6225
6374
|
)
|
|
6226
|
-
] }) : /* @__PURE__ */
|
|
6227
|
-
/* @__PURE__ */
|
|
6228
|
-
/* @__PURE__ */
|
|
6375
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6376
|
+
/* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
6377
|
+
/* @__PURE__ */ jsx40(Text29, { children: "Usu\xE1rio, acesso do sistema e aplicativo root foram preparados. Redirecionando para o primeiro login..." })
|
|
6229
6378
|
] })
|
|
6230
6379
|
]
|
|
6231
6380
|
}
|
|
6232
6381
|
) });
|
|
6233
6382
|
}
|
|
6234
|
-
return /* @__PURE__ */
|
|
6383
|
+
return /* @__PURE__ */ jsx40(Box28, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs29(
|
|
6235
6384
|
VStack7,
|
|
6236
6385
|
{
|
|
6237
6386
|
maxW: "760px",
|
|
@@ -6242,8 +6391,8 @@ function ActivationPage() {
|
|
|
6242
6391
|
align: "stretch",
|
|
6243
6392
|
gap: 5,
|
|
6244
6393
|
children: [
|
|
6245
|
-
/* @__PURE__ */
|
|
6246
|
-
/* @__PURE__ */
|
|
6394
|
+
/* @__PURE__ */ jsx40(Heading17, { children: "Ativa\xE7\xE3o da Central Oon" }),
|
|
6395
|
+
/* @__PURE__ */ jsxs29(Text29, { children: [
|
|
6247
6396
|
"App: ",
|
|
6248
6397
|
config.technical.appCode,
|
|
6249
6398
|
" \xB7 Ambiente:",
|
|
@@ -6253,12 +6402,12 @@ function ActivationPage() {
|
|
|
6253
6402
|
" ",
|
|
6254
6403
|
config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
|
|
6255
6404
|
] }),
|
|
6256
|
-
error ? /* @__PURE__ */
|
|
6405
|
+
error ? /* @__PURE__ */ jsx40(Text29, { color: "red.600", children: error }) : null,
|
|
6257
6406
|
step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
|
|
6258
|
-
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
|
|
6407
|
+
step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6408
|
+
/* @__PURE__ */ jsx40(Text29, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar Tenant, App, Entitlement e Deployment. A licen\xE7a ser\xE1 validada somente para Apps comerciais." }),
|
|
6409
|
+
/* @__PURE__ */ jsx40(
|
|
6410
|
+
Input13,
|
|
6262
6411
|
{
|
|
6263
6412
|
"aria-label": "C\xF3digo de ativa\xE7\xE3o",
|
|
6264
6413
|
value: code,
|
|
@@ -6266,8 +6415,8 @@ function ActivationPage() {
|
|
|
6266
6415
|
placeholder: "OON-XXXX"
|
|
6267
6416
|
}
|
|
6268
6417
|
),
|
|
6269
|
-
/* @__PURE__ */
|
|
6270
|
-
|
|
6418
|
+
/* @__PURE__ */ jsx40(
|
|
6419
|
+
Button21,
|
|
6271
6420
|
{
|
|
6272
6421
|
onClick: validateCode,
|
|
6273
6422
|
loading: submitting,
|
|
@@ -6275,8 +6424,8 @@ function ActivationPage() {
|
|
|
6275
6424
|
children: "Validar c\xF3digo"
|
|
6276
6425
|
}
|
|
6277
6426
|
),
|
|
6278
|
-
isDevelopmentMember ? /* @__PURE__ */
|
|
6279
|
-
|
|
6427
|
+
isDevelopmentMember ? /* @__PURE__ */ jsx40(
|
|
6428
|
+
Button21,
|
|
6280
6429
|
{
|
|
6281
6430
|
variant: "outline",
|
|
6282
6431
|
onClick: () => setShowCodeFlow(false),
|
|
@@ -6285,25 +6434,25 @@ function ActivationPage() {
|
|
|
6285
6434
|
}
|
|
6286
6435
|
) : null
|
|
6287
6436
|
] }),
|
|
6288
|
-
step === 2 && /* @__PURE__ */
|
|
6289
|
-
/* @__PURE__ */
|
|
6290
|
-
/* @__PURE__ */
|
|
6291
|
-
/* @__PURE__ */
|
|
6437
|
+
step === 2 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6438
|
+
/* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Confirma\xE7\xE3o" }),
|
|
6439
|
+
/* @__PURE__ */ jsx40("pre", { children: JSON.stringify(preview, null, 2) }),
|
|
6440
|
+
/* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(3), children: "Continuar" })
|
|
6292
6441
|
] }),
|
|
6293
|
-
step === 3 && /* @__PURE__ */
|
|
6442
|
+
step === 3 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6294
6443
|
config.globalFields.map(
|
|
6295
6444
|
(field) => renderField(field, global, setGlobal)
|
|
6296
6445
|
),
|
|
6297
|
-
/* @__PURE__ */
|
|
6446
|
+
/* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(4), children: "Continuar" })
|
|
6298
6447
|
] }),
|
|
6299
|
-
step === 4 && /* @__PURE__ */
|
|
6300
|
-
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6448
|
+
step === 4 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6449
|
+
config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx40(Text29, { children: "Nenhum par\xE2metro adicional declarado." }),
|
|
6450
|
+
/* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(5), children: "Revisar" })
|
|
6302
6451
|
] }),
|
|
6303
|
-
step === 5 && /* @__PURE__ */
|
|
6304
|
-
/* @__PURE__ */
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
|
|
6452
|
+
step === 5 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6453
|
+
/* @__PURE__ */ jsx40(Text29, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e este runtime ser\xE1 vinculado ao Deployment do Ecossistema Oon." }),
|
|
6454
|
+
/* @__PURE__ */ jsx40(
|
|
6455
|
+
Button21,
|
|
6307
6456
|
{
|
|
6308
6457
|
colorPalette: "blue",
|
|
6309
6458
|
onClick: completeMemberActivation,
|
|
@@ -6313,14 +6462,14 @@ function ActivationPage() {
|
|
|
6313
6462
|
}
|
|
6314
6463
|
)
|
|
6315
6464
|
] }),
|
|
6316
|
-
step === 6 && /* @__PURE__ */
|
|
6317
|
-
/* @__PURE__ */
|
|
6318
|
-
devResult?.appCode ? /* @__PURE__ */
|
|
6465
|
+
step === 6 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
6466
|
+
/* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
|
|
6467
|
+
devResult?.appCode ? /* @__PURE__ */ jsxs29(Text29, { children: [
|
|
6319
6468
|
"C\xF3digo do app: ",
|
|
6320
6469
|
devResult.appCode,
|
|
6321
6470
|
". Redirecionando para a Central em desenvolvimento..."
|
|
6322
|
-
] }) : /* @__PURE__ */
|
|
6323
|
-
devResult?.instrucoes?.env ? /* @__PURE__ */
|
|
6471
|
+
] }) : /* @__PURE__ */ jsx40(Text29, { children: "Redirecionando para o login..." }),
|
|
6472
|
+
devResult?.instrucoes?.env ? /* @__PURE__ */ jsx40(Text29, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
|
|
6324
6473
|
] })
|
|
6325
6474
|
]
|
|
6326
6475
|
}
|
|
@@ -6330,96 +6479,96 @@ function InstanceBlockedPage({
|
|
|
6330
6479
|
title,
|
|
6331
6480
|
message
|
|
6332
6481
|
}) {
|
|
6333
|
-
return /* @__PURE__ */
|
|
6334
|
-
/* @__PURE__ */
|
|
6335
|
-
/* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsxs29(Box28, { p: 8, children: [
|
|
6483
|
+
/* @__PURE__ */ jsx40(Heading17, { children: title }),
|
|
6484
|
+
/* @__PURE__ */ jsx40(Text29, { children: message })
|
|
6336
6485
|
] });
|
|
6337
6486
|
}
|
|
6338
6487
|
|
|
6339
6488
|
// src/security/RouteGuard.tsx
|
|
6340
|
-
import { Fragment as Fragment7, jsx as
|
|
6489
|
+
import { Fragment as Fragment7, jsx as jsx41 } from "react/jsx-runtime";
|
|
6341
6490
|
function RouteGuard({
|
|
6342
6491
|
permission,
|
|
6343
6492
|
children
|
|
6344
6493
|
}) {
|
|
6345
6494
|
const { status, hasPermission } = useOonAuth();
|
|
6346
|
-
if (status === "loading") return /* @__PURE__ */
|
|
6347
|
-
if (status === "unauthenticated") return /* @__PURE__ */
|
|
6495
|
+
if (status === "loading") return /* @__PURE__ */ jsx41(LoadingScreen, {});
|
|
6496
|
+
if (status === "unauthenticated") return /* @__PURE__ */ jsx41(LoadingScreen, { message: "Redirecionando para o login..." });
|
|
6348
6497
|
if (!hasPermission(permission)) {
|
|
6349
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ jsx41(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
|
|
6350
6499
|
}
|
|
6351
|
-
return /* @__PURE__ */
|
|
6500
|
+
return /* @__PURE__ */ jsx41(Fragment7, { children });
|
|
6352
6501
|
}
|
|
6353
6502
|
|
|
6354
6503
|
// src/security/ActivationGuard.tsx
|
|
6355
6504
|
import { Navigate as Navigate4 } from "react-router-dom";
|
|
6356
|
-
import { jsx as
|
|
6505
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6357
6506
|
function ActivationGuard({ children }) {
|
|
6358
6507
|
const { status } = useActivation();
|
|
6359
6508
|
if (status === "loading") return null;
|
|
6360
|
-
if (status === "suspended") return /* @__PURE__ */
|
|
6361
|
-
if (status === "revoked") return /* @__PURE__ */
|
|
6362
|
-
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */
|
|
6509
|
+
if (status === "suspended") return /* @__PURE__ */ jsx42(Navigate4, { to: "/instancia-suspensa", replace: true });
|
|
6510
|
+
if (status === "revoked") return /* @__PURE__ */ jsx42(Navigate4, { to: "/instancia-revogada", replace: true });
|
|
6511
|
+
if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx42(Navigate4, { to: "/ativacao", replace: true });
|
|
6363
6512
|
return children;
|
|
6364
6513
|
}
|
|
6365
6514
|
|
|
6366
6515
|
// src/app/createOonRouter.tsx
|
|
6367
|
-
import { jsx as
|
|
6516
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
6368
6517
|
function createOonRouter({ app, menu, routes, onboardingEnabled, security, layout, registry }) {
|
|
6369
6518
|
const guardEnabled = security?.enableRouteGuard !== false;
|
|
6370
6519
|
const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
|
|
6371
6520
|
const privateSource = routes.filter((route) => !route.public);
|
|
6372
6521
|
const privateRoutes = privateSource.map((route) => {
|
|
6373
|
-
const element = guardEnabled ? /* @__PURE__ */
|
|
6522
|
+
const element = guardEnabled ? /* @__PURE__ */ jsx43(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
|
|
6374
6523
|
return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
|
|
6375
6524
|
});
|
|
6376
6525
|
const hasIndexRoute = privateSource.some((route) => route.path === "/");
|
|
6377
6526
|
const firstRoute = privateSource.find((route) => route.path !== "/");
|
|
6378
6527
|
if (!hasIndexRoute && firstRoute) {
|
|
6379
|
-
privateRoutes.unshift({ index: true, element: /* @__PURE__ */
|
|
6528
|
+
privateRoutes.unshift({ index: true, element: /* @__PURE__ */ jsx43(Navigate5, { to: firstRoute.path, replace: true }) });
|
|
6380
6529
|
}
|
|
6381
6530
|
const customPaths = new Set(publicRoutes.map((route) => route.path));
|
|
6382
6531
|
const builtInPublicRoutes = [];
|
|
6383
6532
|
if (!customPaths.has("/login")) {
|
|
6384
6533
|
builtInPublicRoutes.push({
|
|
6385
6534
|
path: "/login",
|
|
6386
|
-
element: /* @__PURE__ */
|
|
6535
|
+
element: /* @__PURE__ */ jsx43(ActivationGuard, { children: /* @__PURE__ */ jsx43(LoginPage, { app, onboardingEnabled }) })
|
|
6387
6536
|
});
|
|
6388
6537
|
}
|
|
6389
6538
|
if (!customPaths.has("/accept-invite")) {
|
|
6390
6539
|
builtInPublicRoutes.push({
|
|
6391
6540
|
path: "/accept-invite",
|
|
6392
|
-
element: /* @__PURE__ */
|
|
6541
|
+
element: /* @__PURE__ */ jsx43(ActivationGuard, { children: /* @__PURE__ */ jsx43(AcceptInvitePage, {}) })
|
|
6393
6542
|
});
|
|
6394
6543
|
}
|
|
6395
6544
|
if (!customPaths.has("/first-access")) {
|
|
6396
6545
|
builtInPublicRoutes.push({
|
|
6397
6546
|
path: "/first-access",
|
|
6398
|
-
element: /* @__PURE__ */
|
|
6547
|
+
element: /* @__PURE__ */ jsx43(ActivationGuard, { children: /* @__PURE__ */ jsx43(FirstAccessPage, {}) })
|
|
6399
6548
|
});
|
|
6400
6549
|
}
|
|
6401
|
-
if (!customPaths.has("/ativacao")) builtInPublicRoutes.push({ path: "/ativacao", element: /* @__PURE__ */
|
|
6550
|
+
if (!customPaths.has("/ativacao")) builtInPublicRoutes.push({ path: "/ativacao", element: /* @__PURE__ */ jsx43(ActivationPage, {}) });
|
|
6402
6551
|
if (!customPaths.has("/instancia-suspensa")) {
|
|
6403
6552
|
builtInPublicRoutes.push({
|
|
6404
6553
|
path: "/instancia-suspensa",
|
|
6405
|
-
element: /* @__PURE__ */
|
|
6554
|
+
element: /* @__PURE__ */ jsx43(InstanceBlockedPage, { title: "Inst\xE2ncia suspensa", message: "Esta Central est\xE1 suspensa." })
|
|
6406
6555
|
});
|
|
6407
6556
|
}
|
|
6408
6557
|
if (!customPaths.has("/instancia-revogada")) {
|
|
6409
6558
|
builtInPublicRoutes.push({
|
|
6410
6559
|
path: "/instancia-revogada",
|
|
6411
|
-
element: /* @__PURE__ */
|
|
6560
|
+
element: /* @__PURE__ */ jsx43(InstanceBlockedPage, { title: "Inst\xE2ncia revogada", message: "Esta Central foi revogada." })
|
|
6412
6561
|
});
|
|
6413
6562
|
}
|
|
6414
6563
|
if (!customPaths.has("/acesso-negado")) {
|
|
6415
|
-
builtInPublicRoutes.push({ path: "/acesso-negado", element: /* @__PURE__ */
|
|
6564
|
+
builtInPublicRoutes.push({ path: "/acesso-negado", element: /* @__PURE__ */ jsx43(AccessDeniedPage, { app }) });
|
|
6416
6565
|
}
|
|
6417
6566
|
const tree = [
|
|
6418
6567
|
...builtInPublicRoutes,
|
|
6419
6568
|
...publicRoutes,
|
|
6420
6569
|
{
|
|
6421
6570
|
path: "/",
|
|
6422
|
-
element: /* @__PURE__ */
|
|
6571
|
+
element: /* @__PURE__ */ jsx43(ActivationGuard, { children: /* @__PURE__ */ jsx43(AppAccessGuard, { children: /* @__PURE__ */ jsx43(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
|
|
6423
6572
|
children: privateRoutes
|
|
6424
6573
|
}
|
|
6425
6574
|
];
|
|
@@ -6427,7 +6576,7 @@ function createOonRouter({ app, menu, routes, onboardingEnabled, security, layou
|
|
|
6427
6576
|
}
|
|
6428
6577
|
|
|
6429
6578
|
// src/app/OonApp.tsx
|
|
6430
|
-
import { jsx as
|
|
6579
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
6431
6580
|
function localLoginUrl() {
|
|
6432
6581
|
const current = `${window.location.pathname}${window.location.search}`;
|
|
6433
6582
|
return `/login?redirect=${encodeURIComponent(current)}`;
|
|
@@ -6459,12 +6608,12 @@ function OonApp({ config }) {
|
|
|
6459
6608
|
routes.push({
|
|
6460
6609
|
path: "/accept-invite",
|
|
6461
6610
|
public: true,
|
|
6462
|
-
element: /* @__PURE__ */
|
|
6611
|
+
element: /* @__PURE__ */ jsx44(AcceptInviteCentralPage, {})
|
|
6463
6612
|
});
|
|
6464
6613
|
}
|
|
6465
6614
|
if (config.api.onboardingBaseUrl) {
|
|
6466
|
-
routes.push({ path: "/cadastro", public: true, element: /* @__PURE__ */
|
|
6467
|
-
routes.push({ path: "/confirmar-email", public: true, element: /* @__PURE__ */
|
|
6615
|
+
routes.push({ path: "/cadastro", public: true, element: /* @__PURE__ */ jsx44(OnboardingPage, { baseUrl: config.api.onboardingBaseUrl, mode: "register" }) });
|
|
6616
|
+
routes.push({ path: "/confirmar-email", public: true, element: /* @__PURE__ */ jsx44(OnboardingPage, { baseUrl: config.api.onboardingBaseUrl, mode: "confirm" }) });
|
|
6468
6617
|
}
|
|
6469
6618
|
const router2 = createOonRouter({
|
|
6470
6619
|
app: config.app,
|
|
@@ -6477,14 +6626,14 @@ function OonApp({ config }) {
|
|
|
6477
6626
|
});
|
|
6478
6627
|
return { http: http2, storage: storage2, tenantStorage: tenantStorage2, router: router2 };
|
|
6479
6628
|
}, [config]);
|
|
6480
|
-
return /* @__PURE__ */
|
|
6629
|
+
return /* @__PURE__ */ jsx44(
|
|
6481
6630
|
OonProviders,
|
|
6482
6631
|
{
|
|
6483
6632
|
config,
|
|
6484
6633
|
http,
|
|
6485
6634
|
storage,
|
|
6486
6635
|
tenantStorage,
|
|
6487
|
-
children: /* @__PURE__ */
|
|
6636
|
+
children: /* @__PURE__ */ jsx44(RouterProvider, { router })
|
|
6488
6637
|
}
|
|
6489
6638
|
);
|
|
6490
6639
|
}
|
|
@@ -6544,7 +6693,7 @@ function installPipelineBoardLayoutStyles(targetDocument = document) {
|
|
|
6544
6693
|
}
|
|
6545
6694
|
|
|
6546
6695
|
// src/start.tsx
|
|
6547
|
-
import { jsx as
|
|
6696
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6548
6697
|
function validateConfig(config) {
|
|
6549
6698
|
if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
|
|
6550
6699
|
if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
|
|
@@ -6579,7 +6728,7 @@ function start(config) {
|
|
|
6579
6728
|
const el = document.getElementById(rootId);
|
|
6580
6729
|
if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
|
|
6581
6730
|
createRoot(el).render(
|
|
6582
|
-
/* @__PURE__ */
|
|
6731
|
+
/* @__PURE__ */ jsx45(StrictMode, { children: /* @__PURE__ */ jsx45(OonApp, { config }) })
|
|
6583
6732
|
);
|
|
6584
6733
|
}
|
|
6585
6734
|
var oonCoreFront = { start };
|
|
@@ -6720,13 +6869,13 @@ function startFromManifest(manifest, runtime) {
|
|
|
6720
6869
|
}
|
|
6721
6870
|
|
|
6722
6871
|
// src/modules/integrations.tsx
|
|
6723
|
-
import { Stack as
|
|
6872
|
+
import { Stack as Stack16 } from "@chakra-ui/react";
|
|
6724
6873
|
|
|
6725
6874
|
// src/components/CoreIntegration.tsx
|
|
6726
|
-
import { useEffect as useEffect12, useState as
|
|
6727
|
-
import { Badge as
|
|
6728
|
-
import { useMutation as
|
|
6729
|
-
import { jsx as
|
|
6875
|
+
import { useEffect as useEffect12, useState as useState22 } from "react";
|
|
6876
|
+
import { Badge as Badge6, Box as Box29, Button as Button22, Flex as Flex21, Heading as Heading18, Input as Input14, Stack as Stack11, Text as Text30 } from "@chakra-ui/react";
|
|
6877
|
+
import { useMutation as useMutation6, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
6878
|
+
import { jsx as jsx46, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6730
6879
|
function dateTime(value3) {
|
|
6731
6880
|
if (!value3) return "\u2014";
|
|
6732
6881
|
const date = new Date(value3);
|
|
@@ -6794,14 +6943,14 @@ function JsonDiagnosticDetails({
|
|
|
6794
6943
|
}) {
|
|
6795
6944
|
const hasValue = Array.isArray(value3) ? value3.length > 0 : isRecord(value3) ? Object.keys(value3).length > 0 : value3 !== void 0 && value3 !== null && value3 !== "";
|
|
6796
6945
|
if (!hasValue) return null;
|
|
6797
|
-
return /* @__PURE__ */
|
|
6798
|
-
/* @__PURE__ */
|
|
6946
|
+
return /* @__PURE__ */ jsxs30("details", { style: { borderTop: "1px solid #e2e8f0", paddingTop: "10px" }, children: [
|
|
6947
|
+
/* @__PURE__ */ jsxs30("summary", { style: { cursor: "pointer", fontWeight: 600, fontSize: "13px" }, children: [
|
|
6799
6948
|
label,
|
|
6800
6949
|
count !== void 0 ? ` (${count})` : "",
|
|
6801
6950
|
limited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
|
|
6802
6951
|
] }),
|
|
6803
|
-
/* @__PURE__ */
|
|
6804
|
-
|
|
6952
|
+
/* @__PURE__ */ jsx46(
|
|
6953
|
+
Box29,
|
|
6805
6954
|
{
|
|
6806
6955
|
as: "pre",
|
|
6807
6956
|
mt: 2,
|
|
@@ -6822,11 +6971,11 @@ function ExecutionDetails({ execution }) {
|
|
|
6822
6971
|
const diagnostics = executionDiagnostics(execution);
|
|
6823
6972
|
const summary = isRecord(execution.summary) ? execution.summary : {};
|
|
6824
6973
|
const summaryEntries = Object.entries(summary).filter(([, value3]) => value3 === null || ["string", "number", "boolean"].includes(typeof value3));
|
|
6825
|
-
return /* @__PURE__ */
|
|
6826
|
-
summaryEntries.length ? /* @__PURE__ */
|
|
6827
|
-
/* @__PURE__ */
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
|
|
6974
|
+
return /* @__PURE__ */ jsx46(Box29, { mt: 3, pt: 3, borderTopWidth: "1px", borderColor: "gray.100", children: /* @__PURE__ */ jsxs30(Stack11, { gap: 3, children: [
|
|
6975
|
+
summaryEntries.length ? /* @__PURE__ */ jsxs30(Box29, { children: [
|
|
6976
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "sm", fontWeight: "semibold", mb: 2, children: "Resumo da execu\xE7\xE3o" }),
|
|
6977
|
+
/* @__PURE__ */ jsx46(Flex21, { gap: 2, wrap: "wrap", children: summaryEntries.map(([key, value3]) => /* @__PURE__ */ jsxs30(
|
|
6978
|
+
Badge6,
|
|
6830
6979
|
{
|
|
6831
6980
|
variant: "outline",
|
|
6832
6981
|
colorPalette: key === "errors" && Number(value3 ?? 0) > 0 ? "red" : "gray",
|
|
@@ -6839,17 +6988,17 @@ function ExecutionDetails({ execution }) {
|
|
|
6839
6988
|
key
|
|
6840
6989
|
)) })
|
|
6841
6990
|
] }) : null,
|
|
6842
|
-
diagnostics.length ? /* @__PURE__ */
|
|
6843
|
-
/* @__PURE__ */
|
|
6844
|
-
/* @__PURE__ */
|
|
6845
|
-
/* @__PURE__ */
|
|
6991
|
+
diagnostics.length ? /* @__PURE__ */ jsxs30(Box29, { children: [
|
|
6992
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 2, mb: 2, wrap: "wrap", children: [
|
|
6993
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "sm", fontWeight: "semibold", children: "Erros por registro" }),
|
|
6994
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "xs", color: "gray.500", children: [
|
|
6846
6995
|
execution.errorCount ?? diagnostics.length,
|
|
6847
6996
|
" erro(s)",
|
|
6848
6997
|
execution.errorsLimited ? " \xB7 lista limitada" : ""
|
|
6849
6998
|
] })
|
|
6850
6999
|
] }),
|
|
6851
|
-
/* @__PURE__ */
|
|
6852
|
-
|
|
7000
|
+
/* @__PURE__ */ jsx46(Stack11, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs30(
|
|
7001
|
+
Box29,
|
|
6853
7002
|
{
|
|
6854
7003
|
p: 3,
|
|
6855
7004
|
borderWidth: "1px",
|
|
@@ -6857,15 +7006,15 @@ function ExecutionDetails({ execution }) {
|
|
|
6857
7006
|
borderRadius: "md",
|
|
6858
7007
|
bg: "red.50",
|
|
6859
7008
|
children: [
|
|
6860
|
-
/* @__PURE__ */
|
|
6861
|
-
/* @__PURE__ */
|
|
6862
|
-
diagnostic.error?.details ? /* @__PURE__ */
|
|
7009
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.600", fontWeight: "semibold", children: diagnosticIdentity(diagnostic, index) }),
|
|
7010
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.700", children: diagnosticMessage(diagnostic) }),
|
|
7011
|
+
diagnostic.error?.details ? /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.600", mt: 1, children: primitiveText2(diagnostic.error.details) }) : null
|
|
6863
7012
|
]
|
|
6864
7013
|
},
|
|
6865
7014
|
`${diagnostic.index ?? index}:${diagnosticMessage(diagnostic)}`
|
|
6866
7015
|
)) })
|
|
6867
|
-
] }) : execution.status.toLowerCase().includes("erro") ? /* @__PURE__ */
|
|
6868
|
-
/* @__PURE__ */
|
|
7016
|
+
] }) : execution.status.toLowerCase().includes("erro") ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: execution.message || execution.error?.message || "A execu\xE7\xE3o terminou com erro, mas n\xE3o registrou detalhes adicionais." }) : null,
|
|
7017
|
+
/* @__PURE__ */ jsx46(
|
|
6869
7018
|
JsonDiagnosticDetails,
|
|
6870
7019
|
{
|
|
6871
7020
|
label: "Itens processados",
|
|
@@ -6874,7 +7023,7 @@ function ExecutionDetails({ execution }) {
|
|
|
6874
7023
|
limited: execution.itemsLimited
|
|
6875
7024
|
}
|
|
6876
7025
|
),
|
|
6877
|
-
/* @__PURE__ */
|
|
7026
|
+
/* @__PURE__ */ jsx46(
|
|
6878
7027
|
JsonDiagnosticDetails,
|
|
6879
7028
|
{
|
|
6880
7029
|
label: "Chamadas sanitizadas",
|
|
@@ -6883,12 +7032,12 @@ function ExecutionDetails({ execution }) {
|
|
|
6883
7032
|
limited: execution.requestsLimited
|
|
6884
7033
|
}
|
|
6885
7034
|
),
|
|
6886
|
-
/* @__PURE__ */
|
|
7035
|
+
/* @__PURE__ */ jsx46(JsonDiagnosticDetails, { label: "Metadados", value: execution.metadata })
|
|
6887
7036
|
] }) });
|
|
6888
7037
|
}
|
|
6889
7038
|
function ProviderConfigurationPanel({ provider }) {
|
|
6890
7039
|
const { http } = useOonApi();
|
|
6891
|
-
const [draft, setDraft] =
|
|
7040
|
+
const [draft, setDraft] = useState22({
|
|
6892
7041
|
instanceId: "default",
|
|
6893
7042
|
label: provider.label,
|
|
6894
7043
|
active: true,
|
|
@@ -6898,11 +7047,11 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6898
7047
|
appSecret: "",
|
|
6899
7048
|
webhookToken: ""
|
|
6900
7049
|
});
|
|
6901
|
-
const configuration =
|
|
7050
|
+
const configuration = useQuery12({
|
|
6902
7051
|
queryKey: ["core-integrations", provider.key, "configuration"],
|
|
6903
7052
|
queryFn: async () => (await http.get(`/integrations/providers/${provider.key}/configuration`)).data?.instances ?? []
|
|
6904
7053
|
});
|
|
6905
|
-
const mappings =
|
|
7054
|
+
const mappings = useQuery12({
|
|
6906
7055
|
queryKey: ["core-integrations", provider.key, "mappings"],
|
|
6907
7056
|
queryFn: async () => (await http.get(`/integrations/providers/${provider.key}/mappings`)).data
|
|
6908
7057
|
});
|
|
@@ -6921,7 +7070,7 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6921
7070
|
webhookToken: ""
|
|
6922
7071
|
}));
|
|
6923
7072
|
}, [provider.label, selected?.instanceId, selected?.updatedAt]);
|
|
6924
|
-
const save =
|
|
7073
|
+
const save = useMutation6({
|
|
6925
7074
|
mutationFn: async () => http.put(
|
|
6926
7075
|
`/integrations/providers/${provider.key}/configuration/${draft.instanceId}`,
|
|
6927
7076
|
{
|
|
@@ -6940,7 +7089,7 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6940
7089
|
await configuration.refetch();
|
|
6941
7090
|
}
|
|
6942
7091
|
});
|
|
6943
|
-
const testConnection =
|
|
7092
|
+
const testConnection = useMutation6({
|
|
6944
7093
|
mutationFn: async () => http.post(
|
|
6945
7094
|
`/integrations/providers/${provider.key}/configuration/${draft.instanceId}/test`,
|
|
6946
7095
|
{},
|
|
@@ -6954,32 +7103,32 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6954
7103
|
listas: mappings.data?.lists?.length ?? 0,
|
|
6955
7104
|
webhooks: mappings.data?.webhooks?.length ?? 0
|
|
6956
7105
|
};
|
|
6957
|
-
return /* @__PURE__ */
|
|
6958
|
-
/* @__PURE__ */
|
|
6959
|
-
/* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
/* @__PURE__ */
|
|
7106
|
+
return /* @__PURE__ */ jsx46(Box29, { borderTopWidth: "1px", borderColor: "gray.100", pt: 4, children: /* @__PURE__ */ jsxs30(Stack11, { gap: 3, children: [
|
|
7107
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7108
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7109
|
+
/* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", children: "Configura\xE7\xE3o" }),
|
|
7110
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. Segredos gravados nunca s\xE3o devolvidos ao navegador." })
|
|
6962
7111
|
] }),
|
|
6963
|
-
/* @__PURE__ */
|
|
6964
|
-
/* @__PURE__ */
|
|
7112
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 2, wrap: "wrap", children: [
|
|
7113
|
+
/* @__PURE__ */ jsxs30(Badge6, { variant: "outline", children: [
|
|
6965
7114
|
mappingCounts.chamadas,
|
|
6966
7115
|
" chamadas"
|
|
6967
7116
|
] }),
|
|
6968
|
-
/* @__PURE__ */
|
|
7117
|
+
/* @__PURE__ */ jsxs30(Badge6, { variant: "outline", children: [
|
|
6969
7118
|
mappingCounts.listas,
|
|
6970
7119
|
" listas"
|
|
6971
7120
|
] }),
|
|
6972
|
-
/* @__PURE__ */
|
|
7121
|
+
/* @__PURE__ */ jsxs30(Badge6, { variant: "outline", children: [
|
|
6973
7122
|
mappingCounts.webhooks,
|
|
6974
7123
|
" webhooks"
|
|
6975
7124
|
] })
|
|
6976
7125
|
] })
|
|
6977
7126
|
] }),
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
6980
|
-
/* @__PURE__ */
|
|
6981
|
-
/* @__PURE__ */
|
|
6982
|
-
|
|
7127
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 3, wrap: "wrap", children: [
|
|
7128
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "180px", flex: "1", children: [
|
|
7129
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
|
|
7130
|
+
/* @__PURE__ */ jsx46(
|
|
7131
|
+
Input14,
|
|
6983
7132
|
{
|
|
6984
7133
|
size: "sm",
|
|
6985
7134
|
value: draft.instanceId,
|
|
@@ -6988,10 +7137,10 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6988
7137
|
}
|
|
6989
7138
|
)
|
|
6990
7139
|
] }),
|
|
6991
|
-
/* @__PURE__ */
|
|
6992
|
-
/* @__PURE__ */
|
|
6993
|
-
/* @__PURE__ */
|
|
6994
|
-
|
|
7140
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "220px", flex: "2", children: [
|
|
7141
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
|
|
7142
|
+
/* @__PURE__ */ jsx46(
|
|
7143
|
+
Input14,
|
|
6995
7144
|
{
|
|
6996
7145
|
size: "sm",
|
|
6997
7146
|
value: draft.label,
|
|
@@ -6999,9 +7148,9 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6999
7148
|
}
|
|
7000
7149
|
)
|
|
7001
7150
|
] }),
|
|
7002
|
-
/* @__PURE__ */
|
|
7003
|
-
/* @__PURE__ */
|
|
7004
|
-
/* @__PURE__ */
|
|
7151
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "180px", flex: "1", children: [
|
|
7152
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
|
|
7153
|
+
/* @__PURE__ */ jsxs30(
|
|
7005
7154
|
"select",
|
|
7006
7155
|
{
|
|
7007
7156
|
style: {
|
|
@@ -7018,17 +7167,17 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7018
7167
|
environment: event.currentTarget.value
|
|
7019
7168
|
})),
|
|
7020
7169
|
children: [
|
|
7021
|
-
/* @__PURE__ */
|
|
7022
|
-
/* @__PURE__ */
|
|
7170
|
+
/* @__PURE__ */ jsx46("option", { value: "production", children: "Produ\xE7\xE3o" }),
|
|
7171
|
+
/* @__PURE__ */ jsx46("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
|
|
7023
7172
|
]
|
|
7024
7173
|
}
|
|
7025
7174
|
)
|
|
7026
7175
|
] })
|
|
7027
7176
|
] }),
|
|
7028
|
-
/* @__PURE__ */
|
|
7029
|
-
/* @__PURE__ */
|
|
7030
|
-
/* @__PURE__ */
|
|
7031
|
-
|
|
7177
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7178
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
|
|
7179
|
+
/* @__PURE__ */ jsx46(
|
|
7180
|
+
Input14,
|
|
7032
7181
|
{
|
|
7033
7182
|
size: "sm",
|
|
7034
7183
|
value: draft.baseUrl,
|
|
@@ -7037,14 +7186,14 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7037
7186
|
}
|
|
7038
7187
|
)
|
|
7039
7188
|
] }),
|
|
7040
|
-
/* @__PURE__ */
|
|
7041
|
-
/* @__PURE__ */
|
|
7042
|
-
/* @__PURE__ */
|
|
7189
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 3, wrap: "wrap", children: [
|
|
7190
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "220px", flex: "1", children: [
|
|
7191
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: [
|
|
7043
7192
|
"App Key ",
|
|
7044
7193
|
selected?.appKeyMasked ? `(${selected.appKeyMasked})` : ""
|
|
7045
7194
|
] }),
|
|
7046
|
-
/* @__PURE__ */
|
|
7047
|
-
|
|
7195
|
+
/* @__PURE__ */ jsx46(
|
|
7196
|
+
Input14,
|
|
7048
7197
|
{
|
|
7049
7198
|
size: "sm",
|
|
7050
7199
|
type: "password",
|
|
@@ -7054,10 +7203,10 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7054
7203
|
}
|
|
7055
7204
|
)
|
|
7056
7205
|
] }),
|
|
7057
|
-
/* @__PURE__ */
|
|
7058
|
-
/* @__PURE__ */
|
|
7059
|
-
/* @__PURE__ */
|
|
7060
|
-
|
|
7206
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "220px", flex: "1", children: [
|
|
7207
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
|
|
7208
|
+
/* @__PURE__ */ jsx46(
|
|
7209
|
+
Input14,
|
|
7061
7210
|
{
|
|
7062
7211
|
size: "sm",
|
|
7063
7212
|
type: "password",
|
|
@@ -7067,10 +7216,10 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7067
7216
|
}
|
|
7068
7217
|
)
|
|
7069
7218
|
] }),
|
|
7070
|
-
/* @__PURE__ */
|
|
7071
|
-
/* @__PURE__ */
|
|
7072
|
-
/* @__PURE__ */
|
|
7073
|
-
|
|
7219
|
+
/* @__PURE__ */ jsxs30(Box29, { minW: "220px", flex: "1", children: [
|
|
7220
|
+
/* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Token do webhook" }),
|
|
7221
|
+
/* @__PURE__ */ jsx46(
|
|
7222
|
+
Input14,
|
|
7074
7223
|
{
|
|
7075
7224
|
size: "sm",
|
|
7076
7225
|
type: "password",
|
|
@@ -7081,10 +7230,10 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7081
7230
|
)
|
|
7082
7231
|
] })
|
|
7083
7232
|
] }),
|
|
7084
|
-
/* @__PURE__ */
|
|
7085
|
-
/* @__PURE__ */
|
|
7086
|
-
/* @__PURE__ */
|
|
7087
|
-
/* @__PURE__ */
|
|
7233
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7234
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
7235
|
+
/* @__PURE__ */ jsxs30("label", { children: [
|
|
7236
|
+
/* @__PURE__ */ jsx46(
|
|
7088
7237
|
"input",
|
|
7089
7238
|
{
|
|
7090
7239
|
type: "checkbox",
|
|
@@ -7095,43 +7244,43 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
7095
7244
|
" ",
|
|
7096
7245
|
"Integra\xE7\xE3o ativa"
|
|
7097
7246
|
] }),
|
|
7098
|
-
/* @__PURE__ */
|
|
7247
|
+
/* @__PURE__ */ jsxs30(Badge6, { colorPalette: statusPalette(selected?.connectionStatus), children: [
|
|
7099
7248
|
"Conex\xE3o: ",
|
|
7100
7249
|
selected?.connectionStatus ?? "n\xE3o testada"
|
|
7101
7250
|
] }),
|
|
7102
|
-
/* @__PURE__ */
|
|
7251
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "xs", color: "gray.500", children: [
|
|
7103
7252
|
"\xDAltimo teste: ",
|
|
7104
7253
|
dateTime(selected?.lastConnectionTestAt)
|
|
7105
7254
|
] })
|
|
7106
7255
|
] }),
|
|
7107
|
-
/* @__PURE__ */
|
|
7108
|
-
/* @__PURE__ */
|
|
7109
|
-
/* @__PURE__ */
|
|
7256
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 2, children: [
|
|
7257
|
+
/* @__PURE__ */ jsx46(Button22, { size: "xs", variant: "outline", loading: testConnection.isPending, onClick: () => testConnection.mutate(), children: "Testar conex\xE3o" }),
|
|
7258
|
+
/* @__PURE__ */ jsx46(Button22, { size: "xs", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xE3o" })
|
|
7110
7259
|
] })
|
|
7111
7260
|
] }),
|
|
7112
|
-
selected?.lastConnectionError ? /* @__PURE__ */
|
|
7113
|
-
error ? /* @__PURE__ */
|
|
7261
|
+
selected?.lastConnectionError ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: selected.lastConnectionError }) : null,
|
|
7262
|
+
error ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: integrationErrorMessage(error) }) : null
|
|
7114
7263
|
] }) });
|
|
7115
7264
|
}
|
|
7116
7265
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
7117
7266
|
const { http } = useOonApi();
|
|
7118
|
-
const [expandedExecutionId, setExpandedExecutionId] =
|
|
7119
|
-
const providers =
|
|
7267
|
+
const [expandedExecutionId, setExpandedExecutionId] = useState22(null);
|
|
7268
|
+
const providers = useQuery12({
|
|
7120
7269
|
queryKey: ["core-integrations", "health"],
|
|
7121
7270
|
queryFn: async () => (await http.get("/integrations/health")).data?.results ?? []
|
|
7122
7271
|
});
|
|
7123
|
-
const queue =
|
|
7272
|
+
const queue = useQuery12({
|
|
7124
7273
|
queryKey: ["core-integrations", "queue"],
|
|
7125
7274
|
queryFn: async () => (await http.get("/integrations/queue", { params: { limit: 20 } })).data?.results ?? []
|
|
7126
7275
|
});
|
|
7127
|
-
const history =
|
|
7276
|
+
const history = useQuery12({
|
|
7128
7277
|
queryKey: ["core-integrations", "history"],
|
|
7129
7278
|
queryFn: async () => (await http.get("/integrations/history", { params: { limit: 10 } })).data?.results ?? []
|
|
7130
7279
|
});
|
|
7131
7280
|
const refresh = async () => {
|
|
7132
7281
|
await Promise.all([providers.refetch(), queue.refetch(), history.refetch()]);
|
|
7133
7282
|
};
|
|
7134
|
-
const process =
|
|
7283
|
+
const process = useMutation6({
|
|
7135
7284
|
mutationFn: () => http.post(
|
|
7136
7285
|
"/integrations/actions/process-active",
|
|
7137
7286
|
{},
|
|
@@ -7139,7 +7288,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7139
7288
|
),
|
|
7140
7289
|
onSuccess: refresh
|
|
7141
7290
|
});
|
|
7142
|
-
const syncAll =
|
|
7291
|
+
const syncAll = useMutation6({
|
|
7143
7292
|
mutationFn: (provider) => http.post(
|
|
7144
7293
|
`/integrations/providers/${provider}/sync-all`,
|
|
7145
7294
|
{},
|
|
@@ -7147,7 +7296,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7147
7296
|
),
|
|
7148
7297
|
onSuccess: refresh
|
|
7149
7298
|
});
|
|
7150
|
-
const syncResource =
|
|
7299
|
+
const syncResource = useMutation6({
|
|
7151
7300
|
mutationFn: ({ provider, resource }) => http.post(
|
|
7152
7301
|
`/integrations/providers/${provider}/resources/${resource}/sync`,
|
|
7153
7302
|
{},
|
|
@@ -7155,7 +7304,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7155
7304
|
),
|
|
7156
7305
|
onSuccess: refresh
|
|
7157
7306
|
});
|
|
7158
|
-
const reprocess =
|
|
7307
|
+
const reprocess = useMutation6({
|
|
7159
7308
|
mutationFn: (id) => http.post(
|
|
7160
7309
|
`/integrations/queue/${id}/reprocess`,
|
|
7161
7310
|
{},
|
|
@@ -7163,7 +7312,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7163
7312
|
),
|
|
7164
7313
|
onSuccess: refresh
|
|
7165
7314
|
});
|
|
7166
|
-
const archive =
|
|
7315
|
+
const archive = useMutation6({
|
|
7167
7316
|
mutationFn: (id) => http.post(
|
|
7168
7317
|
`/integrations/queue/${id}/archive`,
|
|
7169
7318
|
{},
|
|
@@ -7171,48 +7320,48 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7171
7320
|
),
|
|
7172
7321
|
onSuccess: refresh
|
|
7173
7322
|
});
|
|
7174
|
-
if (providers.isLoading || queue.isLoading || history.isLoading) return /* @__PURE__ */
|
|
7323
|
+
if (providers.isLoading || queue.isLoading || history.isLoading) return /* @__PURE__ */ jsx46(LoadingScreen, {});
|
|
7175
7324
|
const error = providers.error || queue.error || history.error;
|
|
7176
|
-
if (error) return /* @__PURE__ */
|
|
7177
|
-
return /* @__PURE__ */
|
|
7178
|
-
/* @__PURE__ */
|
|
7179
|
-
/* @__PURE__ */
|
|
7180
|
-
/* @__PURE__ */
|
|
7181
|
-
/* @__PURE__ */
|
|
7325
|
+
if (error) return /* @__PURE__ */ jsx46(ErrorState, { error });
|
|
7326
|
+
return /* @__PURE__ */ jsxs30(Stack11, { gap: 6, children: [
|
|
7327
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 4, wrap: "wrap", children: [
|
|
7328
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7329
|
+
/* @__PURE__ */ jsx46(Heading18, { size: "lg", children: label }),
|
|
7330
|
+
/* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Configura\xE7\xE3o, sa\xFAde, filas, eventos e diagn\xF3stico sanitizado por provedor." })
|
|
7182
7331
|
] }),
|
|
7183
|
-
/* @__PURE__ */
|
|
7332
|
+
/* @__PURE__ */ jsx46(Button22, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" })
|
|
7184
7333
|
] }),
|
|
7185
|
-
/* @__PURE__ */
|
|
7186
|
-
/* @__PURE__ */
|
|
7187
|
-
/* @__PURE__ */
|
|
7188
|
-
/* @__PURE__ */
|
|
7189
|
-
/* @__PURE__ */
|
|
7190
|
-
/* @__PURE__ */
|
|
7334
|
+
/* @__PURE__ */ jsx46(Stack11, { gap: 3, children: (providers.data ?? []).length === 0 ? /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhum provedor registrado." }) : providers.data?.map((provider) => /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs30(Stack11, { gap: 3, children: [
|
|
7335
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7336
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7337
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", gap: 2, children: [
|
|
7338
|
+
/* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", children: provider.label }),
|
|
7339
|
+
/* @__PURE__ */ jsx46(Badge6, { colorPalette: statusPalette(provider.status), children: provider.status ?? "\u2014" })
|
|
7191
7340
|
] }),
|
|
7192
|
-
provider.description ? /* @__PURE__ */
|
|
7341
|
+
provider.description ? /* @__PURE__ */ jsx46(Text30, { color: "gray.500", fontSize: "sm", children: provider.description }) : null
|
|
7193
7342
|
] }),
|
|
7194
|
-
/* @__PURE__ */
|
|
7343
|
+
/* @__PURE__ */ jsx46(Button22, { size: "xs", variant: "outline", loading: syncAll.isPending, onClick: () => syncAll.mutate(provider.key), children: "Sincronizar tudo" })
|
|
7195
7344
|
] }),
|
|
7196
|
-
/* @__PURE__ */
|
|
7197
|
-
/* @__PURE__ */
|
|
7345
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 3, wrap: "wrap", children: [
|
|
7346
|
+
/* @__PURE__ */ jsxs30(Badge6, { colorPalette: countActive(provider.queue) ? "yellow" : "green", children: [
|
|
7198
7347
|
"Fila ativa: ",
|
|
7199
7348
|
countActive(provider.queue)
|
|
7200
7349
|
] }),
|
|
7201
|
-
/* @__PURE__ */
|
|
7350
|
+
/* @__PURE__ */ jsxs30(Badge6, { colorPalette: countActive(provider.inbox) ? "yellow" : "green", children: [
|
|
7202
7351
|
"Eventos ativos: ",
|
|
7203
7352
|
countActive(provider.inbox)
|
|
7204
7353
|
] }),
|
|
7205
|
-
/* @__PURE__ */
|
|
7354
|
+
/* @__PURE__ */ jsxs30(Badge6, { colorPalette: statusPalette(provider.lastExecution?.status), children: [
|
|
7206
7355
|
"\xDAltima execu\xE7\xE3o: ",
|
|
7207
7356
|
provider.lastExecution?.status ?? "sem hist\xF3rico"
|
|
7208
7357
|
] })
|
|
7209
7358
|
] }),
|
|
7210
|
-
/* @__PURE__ */
|
|
7359
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
|
|
7211
7360
|
"Pend\xEAncia mais antiga: ",
|
|
7212
7361
|
dateTime(provider.oldestPendingAt)
|
|
7213
7362
|
] }),
|
|
7214
|
-
/* @__PURE__ */
|
|
7215
|
-
|
|
7363
|
+
/* @__PURE__ */ jsx46(Flex21, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx46(
|
|
7364
|
+
Button22,
|
|
7216
7365
|
{
|
|
7217
7366
|
size: "xs",
|
|
7218
7367
|
variant: "outline",
|
|
@@ -7222,42 +7371,42 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7222
7371
|
},
|
|
7223
7372
|
resource.key
|
|
7224
7373
|
)) }),
|
|
7225
|
-
provider.configuration?.enabled ? /* @__PURE__ */
|
|
7374
|
+
provider.configuration?.enabled ? /* @__PURE__ */ jsx46(ProviderConfigurationPanel, { provider }) : null
|
|
7226
7375
|
] }) }, provider.key)) }),
|
|
7227
|
-
/* @__PURE__ */
|
|
7228
|
-
/* @__PURE__ */
|
|
7229
|
-
/* @__PURE__ */
|
|
7230
|
-
/* @__PURE__ */
|
|
7231
|
-
/* @__PURE__ */
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7234
|
-
/* @__PURE__ */
|
|
7376
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7377
|
+
/* @__PURE__ */ jsx46(Heading18, { size: "md", mb: 3, children: "Fila recente" }),
|
|
7378
|
+
/* @__PURE__ */ jsx46(Stack11, { gap: 2, children: (queue.data ?? []).length === 0 ? /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhum ticket de integra\xE7\xE3o." }) : queue.data?.map((ticket) => /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7379
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7380
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
7381
|
+
/* @__PURE__ */ jsx46(Text30, { fontWeight: "medium", children: ticket.handler }),
|
|
7382
|
+
/* @__PURE__ */ jsx46(Badge6, { colorPalette: statusPalette(ticket.status), children: ticket.status }),
|
|
7383
|
+
/* @__PURE__ */ jsx46(Badge6, { variant: "outline", children: ticket.provider })
|
|
7235
7384
|
] }),
|
|
7236
|
-
/* @__PURE__ */
|
|
7385
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
|
|
7237
7386
|
ticket.resource || "sem recurso",
|
|
7238
7387
|
" \xB7 tentativas ",
|
|
7239
7388
|
ticket.attempts,
|
|
7240
7389
|
" \xB7 pr\xF3xima ",
|
|
7241
7390
|
dateTime(ticket.nextAttemptAt)
|
|
7242
7391
|
] }),
|
|
7243
|
-
ticket.lastError?.message ? /* @__PURE__ */
|
|
7392
|
+
ticket.lastError?.message ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
|
|
7244
7393
|
] }),
|
|
7245
|
-
/* @__PURE__ */
|
|
7246
|
-
["Erro tempor\xE1rio", "Erro definitivo", "Arquivado"].includes(ticket.status) ? /* @__PURE__ */
|
|
7247
|
-
["Erro tempor\xE1rio", "Erro definitivo"].includes(ticket.status) ? /* @__PURE__ */
|
|
7394
|
+
/* @__PURE__ */ jsxs30(Flex21, { gap: 2, children: [
|
|
7395
|
+
["Erro tempor\xE1rio", "Erro definitivo", "Arquivado"].includes(ticket.status) ? /* @__PURE__ */ jsx46(Button22, { size: "xs", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(ticket._id), children: "Reprocessar" }) : null,
|
|
7396
|
+
["Erro tempor\xE1rio", "Erro definitivo"].includes(ticket.status) ? /* @__PURE__ */ jsx46(Button22, { size: "xs", variant: "outline", loading: archive.isPending, onClick: () => archive.mutate(ticket._id), children: "Arquivar" }) : null
|
|
7248
7397
|
] })
|
|
7249
7398
|
] }) }, ticket._id)) })
|
|
7250
7399
|
] }),
|
|
7251
|
-
/* @__PURE__ */
|
|
7252
|
-
/* @__PURE__ */
|
|
7253
|
-
/* @__PURE__ */
|
|
7400
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7401
|
+
/* @__PURE__ */ jsx46(Heading18, { size: "md", mb: 3, children: "Hist\xF3rico" }),
|
|
7402
|
+
/* @__PURE__ */ jsx46(Stack11, { gap: 2, children: (history.data ?? []).length === 0 ? /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o registrada." }) : history.data?.map((execution) => {
|
|
7254
7403
|
const expanded = expandedExecutionId === execution._id;
|
|
7255
7404
|
const diagnosticCount = execution.errorCount ?? execution.errors?.length ?? (execution.error?.message ? 1 : 0);
|
|
7256
|
-
return /* @__PURE__ */
|
|
7257
|
-
/* @__PURE__ */
|
|
7258
|
-
/* @__PURE__ */
|
|
7259
|
-
/* @__PURE__ */
|
|
7260
|
-
/* @__PURE__ */
|
|
7405
|
+
return /* @__PURE__ */ jsxs30(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: [
|
|
7406
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7407
|
+
/* @__PURE__ */ jsxs30(Box29, { children: [
|
|
7408
|
+
/* @__PURE__ */ jsx46(Text30, { fontWeight: "medium", children: execution.title }),
|
|
7409
|
+
/* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
|
|
7261
7410
|
execution.provider,
|
|
7262
7411
|
" \xB7 ",
|
|
7263
7412
|
execution.resource || "sem recurso",
|
|
@@ -7267,16 +7416,16 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7267
7416
|
execution.durationMs ?? 0,
|
|
7268
7417
|
" ms"
|
|
7269
7418
|
] }),
|
|
7270
|
-
execution.error?.message ? /* @__PURE__ */
|
|
7419
|
+
execution.error?.message ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: execution.error.message }) : null
|
|
7271
7420
|
] }),
|
|
7272
|
-
/* @__PURE__ */
|
|
7273
|
-
diagnosticCount > 0 ? /* @__PURE__ */
|
|
7421
|
+
/* @__PURE__ */ jsxs30(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
7422
|
+
diagnosticCount > 0 ? /* @__PURE__ */ jsxs30(Badge6, { colorPalette: "red", children: [
|
|
7274
7423
|
diagnosticCount,
|
|
7275
7424
|
" erro(s)"
|
|
7276
7425
|
] }) : null,
|
|
7277
|
-
/* @__PURE__ */
|
|
7278
|
-
/* @__PURE__ */
|
|
7279
|
-
|
|
7426
|
+
/* @__PURE__ */ jsx46(Badge6, { colorPalette: statusPalette(execution.status), children: execution.status }),
|
|
7427
|
+
/* @__PURE__ */ jsx46(
|
|
7428
|
+
Button22,
|
|
7280
7429
|
{
|
|
7281
7430
|
size: "xs",
|
|
7282
7431
|
variant: "outline",
|
|
@@ -7287,7 +7436,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7287
7436
|
)
|
|
7288
7437
|
] })
|
|
7289
7438
|
] }),
|
|
7290
|
-
expanded ? /* @__PURE__ */
|
|
7439
|
+
expanded ? /* @__PURE__ */ jsx46(ExecutionDetails, { execution }) : null
|
|
7291
7440
|
] }, execution._id);
|
|
7292
7441
|
}) })
|
|
7293
7442
|
] })
|
|
@@ -7295,9 +7444,9 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
7295
7444
|
}
|
|
7296
7445
|
|
|
7297
7446
|
// src/components/CoreIntegrationMappings.tsx
|
|
7298
|
-
import { Badge as
|
|
7299
|
-
import { useQuery as
|
|
7300
|
-
import { jsx as
|
|
7447
|
+
import { Badge as Badge7, Box as Box30, Flex as Flex22, Heading as Heading19, Stack as Stack12, Text as Text31 } from "@chakra-ui/react";
|
|
7448
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
7449
|
+
import { jsx as jsx47, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7301
7450
|
function dateTime2(value3) {
|
|
7302
7451
|
if (!value3) return "sem execu\xE7\xE3o";
|
|
7303
7452
|
const date = new Date(value3);
|
|
@@ -7305,12 +7454,12 @@ function dateTime2(value3) {
|
|
|
7305
7454
|
}
|
|
7306
7455
|
function CoreIntegrationMappings() {
|
|
7307
7456
|
const { http } = useOonApi();
|
|
7308
|
-
const providers =
|
|
7457
|
+
const providers = useQuery13({
|
|
7309
7458
|
queryKey: ["core-integrations", "providers"],
|
|
7310
7459
|
queryFn: async () => (await http.get("/integrations/providers")).data?.results ?? []
|
|
7311
7460
|
});
|
|
7312
7461
|
const providerKeys = (providers.data ?? []).map((provider) => provider.key).join(",");
|
|
7313
|
-
const summaries =
|
|
7462
|
+
const summaries = useQuery13({
|
|
7314
7463
|
queryKey: ["core-integrations", "mapping-summaries", providerKeys],
|
|
7315
7464
|
enabled: providers.isSuccess && providerKeys.length > 0,
|
|
7316
7465
|
queryFn: async () => Promise.all((providers.data ?? []).map(async (provider) => ({
|
|
@@ -7319,34 +7468,34 @@ function CoreIntegrationMappings() {
|
|
|
7319
7468
|
})))
|
|
7320
7469
|
});
|
|
7321
7470
|
if (providers.isLoading || summaries.isLoading) {
|
|
7322
|
-
return /* @__PURE__ */
|
|
7471
|
+
return /* @__PURE__ */ jsx47(Text31, { color: "gray.500", children: "Carregando contratos declarados\u2026" });
|
|
7323
7472
|
}
|
|
7324
7473
|
if (providers.error || summaries.error) {
|
|
7325
|
-
return /* @__PURE__ */
|
|
7474
|
+
return /* @__PURE__ */ jsx47(Text31, { color: "red.600", children: "N\xE3o foi poss\xEDvel carregar os contratos declarados." });
|
|
7326
7475
|
}
|
|
7327
7476
|
if (!(summaries.data ?? []).length) return null;
|
|
7328
|
-
return /* @__PURE__ */
|
|
7329
|
-
/* @__PURE__ */
|
|
7330
|
-
/* @__PURE__ */
|
|
7331
|
-
/* @__PURE__ */
|
|
7332
|
-
/* @__PURE__ */
|
|
7333
|
-
/* @__PURE__ */
|
|
7334
|
-
/* @__PURE__ */
|
|
7335
|
-
/* @__PURE__ */
|
|
7477
|
+
return /* @__PURE__ */ jsxs31(Box30, { children: [
|
|
7478
|
+
/* @__PURE__ */ jsx47(Heading19, { size: "md", mb: 1, children: "Contratos declarados" }),
|
|
7479
|
+
/* @__PURE__ */ jsx47(Text31, { color: "gray.500", mb: 3, children: "Chamadas, listas e mappings pertencem \xE0 Central; o Core exibe somente metadados sanitizados." }),
|
|
7480
|
+
/* @__PURE__ */ jsx47(Stack12, { gap: 3, children: summaries.data?.map(({ provider, mappings }) => /* @__PURE__ */ jsx47(Box30, { borderWidth: "1px", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs31(Stack12, { gap: 4, children: [
|
|
7481
|
+
/* @__PURE__ */ jsx47(Heading19, { size: "sm", children: provider.label }),
|
|
7482
|
+
/* @__PURE__ */ jsxs31(Box30, { children: [
|
|
7483
|
+
/* @__PURE__ */ jsx47(Text31, { fontWeight: "semibold", mb: 2, children: "Chamadas Omie" }),
|
|
7484
|
+
/* @__PURE__ */ jsx47(Flex22, { gap: 2, wrap: "wrap", children: (mappings.calls ?? []).length ? mappings.calls?.map((call) => /* @__PURE__ */ jsxs31(Badge7, { variant: "outline", children: [
|
|
7336
7485
|
call.label || call.key,
|
|
7337
7486
|
" \xB7 ",
|
|
7338
7487
|
call.call || "opera\xE7\xE3o",
|
|
7339
7488
|
call.paginated ? " \xB7 paginada" : ""
|
|
7340
|
-
] }, call.key)) : /* @__PURE__ */
|
|
7489
|
+
] }, call.key)) : /* @__PURE__ */ jsx47(Text31, { fontSize: "sm", color: "gray.400", children: "Nenhuma chamada declarada." }) })
|
|
7341
7490
|
] }),
|
|
7342
|
-
/* @__PURE__ */
|
|
7343
|
-
/* @__PURE__ */
|
|
7344
|
-
/* @__PURE__ */
|
|
7491
|
+
/* @__PURE__ */ jsxs31(Box30, { children: [
|
|
7492
|
+
/* @__PURE__ */ jsx47(Text31, { fontWeight: "semibold", mb: 2, children: "Listas Omie" }),
|
|
7493
|
+
/* @__PURE__ */ jsx47(Stack12, { gap: 2, children: (mappings.lists ?? []).length ? mappings.lists?.map((list) => {
|
|
7345
7494
|
const latest = list.executions?.[0];
|
|
7346
|
-
return /* @__PURE__ */
|
|
7347
|
-
/* @__PURE__ */
|
|
7348
|
-
/* @__PURE__ */
|
|
7349
|
-
/* @__PURE__ */
|
|
7495
|
+
return /* @__PURE__ */ jsx47(Box30, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs31(Flex22, { align: "center", justify: "space-between", gap: 2, wrap: "wrap", children: [
|
|
7496
|
+
/* @__PURE__ */ jsxs31(Box30, { children: [
|
|
7497
|
+
/* @__PURE__ */ jsx47(Text31, { fontSize: "sm", fontWeight: "medium", children: list.label || list.key }),
|
|
7498
|
+
/* @__PURE__ */ jsxs31(Text31, { fontSize: "xs", color: "gray.500", children: [
|
|
7350
7499
|
list.mode || "modo padr\xE3o",
|
|
7351
7500
|
" \xB7 ",
|
|
7352
7501
|
list.direction || "dire\xE7\xE3o padr\xE3o",
|
|
@@ -7354,30 +7503,30 @@ function CoreIntegrationMappings() {
|
|
|
7354
7503
|
list.targetModel || "destino declarado"
|
|
7355
7504
|
] })
|
|
7356
7505
|
] }),
|
|
7357
|
-
/* @__PURE__ */
|
|
7358
|
-
/* @__PURE__ */
|
|
7359
|
-
/* @__PURE__ */
|
|
7506
|
+
/* @__PURE__ */ jsxs31(Flex22, { gap: 2, wrap: "wrap", children: [
|
|
7507
|
+
/* @__PURE__ */ jsx47(Badge7, { variant: "outline", children: latest?.status || "n\xE3o executada" }),
|
|
7508
|
+
/* @__PURE__ */ jsx47(Badge7, { variant: "outline", children: dateTime2(latest?.lastCompletedAt) })
|
|
7360
7509
|
] })
|
|
7361
7510
|
] }) }, list.key);
|
|
7362
|
-
}) : /* @__PURE__ */
|
|
7511
|
+
}) : /* @__PURE__ */ jsx47(Text31, { fontSize: "sm", color: "gray.400", children: "Nenhuma lista declarada." }) })
|
|
7363
7512
|
] }),
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
/* @__PURE__ */
|
|
7366
|
-
/* @__PURE__ */
|
|
7513
|
+
/* @__PURE__ */ jsxs31(Box30, { children: [
|
|
7514
|
+
/* @__PURE__ */ jsx47(Text31, { fontWeight: "semibold", mb: 2, children: "Mappings de webhook" }),
|
|
7515
|
+
/* @__PURE__ */ jsx47(Stack12, { gap: 1, children: (mappings.webhooks ?? []).length ? mappings.webhooks?.map((webhook) => /* @__PURE__ */ jsxs31(Text31, { fontSize: "sm", color: "gray.600", children: [
|
|
7367
7516
|
webhook.eventType,
|
|
7368
7517
|
" \u2192 ",
|
|
7369
7518
|
(webhook.actions ?? []).map((action) => action.handler).filter(Boolean).join(", ") || "sem a\xE7\xE3o declarada"
|
|
7370
|
-
] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */
|
|
7519
|
+
] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx47(Text31, { fontSize: "sm", color: "gray.400", children: "Nenhum mapping de webhook declarado." }) })
|
|
7371
7520
|
] })
|
|
7372
7521
|
] }) }, provider.key)) })
|
|
7373
7522
|
] });
|
|
7374
7523
|
}
|
|
7375
7524
|
|
|
7376
7525
|
// src/components/CoreIntegrationTickets.tsx
|
|
7377
|
-
import { useEffect as useEffect13, useMemo as useMemo12, useState as
|
|
7378
|
-
import { Badge as
|
|
7379
|
-
import { useMutation as
|
|
7380
|
-
import { jsx as
|
|
7526
|
+
import { useEffect as useEffect13, useMemo as useMemo12, useState as useState23 } from "react";
|
|
7527
|
+
import { Badge as Badge8, Box as Box31, Button as Button23, Flex as Flex23, Heading as Heading20, Input as Input15, Stack as Stack13, Text as Text32 } from "@chakra-ui/react";
|
|
7528
|
+
import { useMutation as useMutation7, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
7529
|
+
import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7381
7530
|
var TICKET_STATUSES = [
|
|
7382
7531
|
"Pendente",
|
|
7383
7532
|
"Processando",
|
|
@@ -7425,7 +7574,7 @@ function NativeSelect5({
|
|
|
7425
7574
|
children,
|
|
7426
7575
|
ariaLabel
|
|
7427
7576
|
}) {
|
|
7428
|
-
return /* @__PURE__ */
|
|
7577
|
+
return /* @__PURE__ */ jsx48(
|
|
7429
7578
|
"select",
|
|
7430
7579
|
{
|
|
7431
7580
|
"aria-label": ariaLabel,
|
|
@@ -7446,10 +7595,10 @@ function NativeSelect5({
|
|
|
7446
7595
|
function JsonDetails({ label, value: value3 }) {
|
|
7447
7596
|
if (value3 === void 0 || value3 === null) return null;
|
|
7448
7597
|
if (typeof value3 === "object" && !Array.isArray(value3) && !Object.keys(value3).length) return null;
|
|
7449
|
-
return /* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7451
|
-
/* @__PURE__ */
|
|
7452
|
-
|
|
7598
|
+
return /* @__PURE__ */ jsxs32("details", { children: [
|
|
7599
|
+
/* @__PURE__ */ jsx48("summary", { style: { cursor: "pointer", fontWeight: 600 }, children: label }),
|
|
7600
|
+
/* @__PURE__ */ jsx48(
|
|
7601
|
+
Box31,
|
|
7453
7602
|
{
|
|
7454
7603
|
as: "pre",
|
|
7455
7604
|
mt: 2,
|
|
@@ -7466,56 +7615,56 @@ function JsonDetails({ label, value: value3 }) {
|
|
|
7466
7615
|
}
|
|
7467
7616
|
function TicketDetails({ ticket }) {
|
|
7468
7617
|
const error = diagnosticMessage2(ticket.lastError);
|
|
7469
|
-
return /* @__PURE__ */
|
|
7470
|
-
/* @__PURE__ */
|
|
7471
|
-
/* @__PURE__ */
|
|
7472
|
-
/* @__PURE__ */
|
|
7473
|
-
/* @__PURE__ */
|
|
7618
|
+
return /* @__PURE__ */ jsxs32(Stack13, { gap: 3, pt: 3, mt: 3, borderTopWidth: "1px", children: [
|
|
7619
|
+
/* @__PURE__ */ jsxs32(Box31, { display: "grid", gridTemplateColumns: { base: "1fr", md: "repeat(3, minmax(0, 1fr))" }, gap: 3, children: [
|
|
7620
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7621
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "ID completo" }),
|
|
7622
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", wordBreak: "break-all", children: ticket._id })
|
|
7474
7623
|
] }),
|
|
7475
|
-
/* @__PURE__ */
|
|
7476
|
-
/* @__PURE__ */
|
|
7477
|
-
/* @__PURE__ */
|
|
7624
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7625
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Chave de idempot\xEAncia" }),
|
|
7626
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", wordBreak: "break-all", children: ticket.idempotencyKey || "\u2014" })
|
|
7478
7627
|
] }),
|
|
7479
|
-
/* @__PURE__ */
|
|
7480
|
-
/* @__PURE__ */
|
|
7481
|
-
/* @__PURE__ */
|
|
7628
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7629
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Status anterior" }),
|
|
7630
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: ticket.previousStatus || "\u2014" })
|
|
7482
7631
|
] }),
|
|
7483
|
-
/* @__PURE__ */
|
|
7484
|
-
/* @__PURE__ */
|
|
7485
|
-
/* @__PURE__ */
|
|
7632
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7633
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Criado" }),
|
|
7634
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: dateTime3(ticket.createdAt) })
|
|
7486
7635
|
] }),
|
|
7487
|
-
/* @__PURE__ */
|
|
7488
|
-
/* @__PURE__ */
|
|
7489
|
-
/* @__PURE__ */
|
|
7636
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7637
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Atualizado" }),
|
|
7638
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: dateTime3(ticket.updatedAt) })
|
|
7490
7639
|
] }),
|
|
7491
|
-
/* @__PURE__ */
|
|
7492
|
-
/* @__PURE__ */
|
|
7493
|
-
/* @__PURE__ */
|
|
7640
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7641
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Conclu\xEDdo" }),
|
|
7642
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: dateTime3(ticket.completedAt) })
|
|
7494
7643
|
] }),
|
|
7495
|
-
/* @__PURE__ */
|
|
7496
|
-
/* @__PURE__ */
|
|
7497
|
-
/* @__PURE__ */
|
|
7644
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7645
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Worker" }),
|
|
7646
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: ticket.lockedBy || "\u2014" })
|
|
7498
7647
|
] }),
|
|
7499
|
-
/* @__PURE__ */
|
|
7500
|
-
/* @__PURE__ */
|
|
7501
|
-
/* @__PURE__ */
|
|
7648
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7649
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Lease expira" }),
|
|
7650
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: dateTime3(ticket.leaseExpiresAt) })
|
|
7502
7651
|
] }),
|
|
7503
|
-
/* @__PURE__ */
|
|
7504
|
-
/* @__PURE__ */
|
|
7505
|
-
/* @__PURE__ */
|
|
7652
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7653
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Heartbeat" }),
|
|
7654
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: dateTime3(ticket.heartbeatAt) })
|
|
7506
7655
|
] })
|
|
7507
7656
|
] }),
|
|
7508
|
-
error ? /* @__PURE__ */
|
|
7509
|
-
/* @__PURE__ */
|
|
7510
|
-
/* @__PURE__ */
|
|
7657
|
+
error ? /* @__PURE__ */ jsxs32(Box31, { borderWidth: "1px", borderColor: "red.100", borderRadius: "md", bg: "red.50", p: 3, children: [
|
|
7658
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.600", children: "\xDAltimo erro" }),
|
|
7659
|
+
/* @__PURE__ */ jsx48(Text32, { color: "red.700", children: error })
|
|
7511
7660
|
] }) : null,
|
|
7512
|
-
ticket.archiveReason ? /* @__PURE__ */
|
|
7513
|
-
/* @__PURE__ */
|
|
7514
|
-
/* @__PURE__ */
|
|
7661
|
+
ticket.archiveReason ? /* @__PURE__ */ jsxs32(Box31, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
|
|
7662
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: "Motivo do arquivamento" }),
|
|
7663
|
+
/* @__PURE__ */ jsx48(Text32, { children: ticket.archiveReason })
|
|
7515
7664
|
] }) : null,
|
|
7516
|
-
/* @__PURE__ */
|
|
7517
|
-
/* @__PURE__ */
|
|
7518
|
-
/* @__PURE__ */
|
|
7665
|
+
/* @__PURE__ */ jsx48(JsonDetails, { label: "Payload sanitizado", value: ticket.payload }),
|
|
7666
|
+
/* @__PURE__ */ jsx48(JsonDetails, { label: "Resposta sanitizada", value: ticket.responseSummary }),
|
|
7667
|
+
/* @__PURE__ */ jsx48(JsonDetails, { label: "Erro sanitizado", value: ticket.lastError })
|
|
7519
7668
|
] });
|
|
7520
7669
|
}
|
|
7521
7670
|
function canReprocess(status) {
|
|
@@ -7531,10 +7680,10 @@ function TicketActions({
|
|
|
7531
7680
|
expanded
|
|
7532
7681
|
}) {
|
|
7533
7682
|
const pending = mutation.isPending && mutation.variables?.id === ticket._id;
|
|
7534
|
-
return /* @__PURE__ */
|
|
7535
|
-
/* @__PURE__ */
|
|
7536
|
-
canReprocess(ticket.status) ? /* @__PURE__ */
|
|
7537
|
-
|
|
7683
|
+
return /* @__PURE__ */ jsxs32(Flex23, { gap: 2, wrap: "wrap", justify: "flex-end", children: [
|
|
7684
|
+
/* @__PURE__ */ jsx48(Button23, { size: "xs", variant: "outline", onClick: onToggle, "aria-expanded": expanded, children: expanded ? "Ocultar" : "Detalhes" }),
|
|
7685
|
+
canReprocess(ticket.status) ? /* @__PURE__ */ jsx48(
|
|
7686
|
+
Button23,
|
|
7538
7687
|
{
|
|
7539
7688
|
size: "xs",
|
|
7540
7689
|
variant: "outline",
|
|
@@ -7543,8 +7692,8 @@ function TicketActions({
|
|
|
7543
7692
|
children: "Reprocessar"
|
|
7544
7693
|
}
|
|
7545
7694
|
) : null,
|
|
7546
|
-
canArchive(ticket.status) ? /* @__PURE__ */
|
|
7547
|
-
|
|
7695
|
+
canArchive(ticket.status) ? /* @__PURE__ */ jsx48(
|
|
7696
|
+
Button23,
|
|
7548
7697
|
{
|
|
7549
7698
|
size: "xs",
|
|
7550
7699
|
variant: "outline",
|
|
@@ -7563,49 +7712,49 @@ function TicketCard({
|
|
|
7563
7712
|
mutation
|
|
7564
7713
|
}) {
|
|
7565
7714
|
const error = diagnosticMessage2(ticket.lastError);
|
|
7566
|
-
return /* @__PURE__ */
|
|
7567
|
-
/* @__PURE__ */
|
|
7568
|
-
/* @__PURE__ */
|
|
7569
|
-
/* @__PURE__ */
|
|
7715
|
+
return /* @__PURE__ */ jsxs32(Box31, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: [
|
|
7716
|
+
/* @__PURE__ */ jsxs32(Flex23, { align: "start", justify: "space-between", gap: 2, children: [
|
|
7717
|
+
/* @__PURE__ */ jsxs32(Box31, { minW: 0, children: [
|
|
7718
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", color: "gray.500", title: ticket._id, children: [
|
|
7570
7719
|
"#",
|
|
7571
7720
|
shortId(ticket._id)
|
|
7572
7721
|
] }),
|
|
7573
|
-
/* @__PURE__ */
|
|
7722
|
+
/* @__PURE__ */ jsx48(Text32, { fontWeight: "semibold", wordBreak: "break-word", children: ticket.handler })
|
|
7574
7723
|
] }),
|
|
7575
|
-
/* @__PURE__ */
|
|
7724
|
+
/* @__PURE__ */ jsx48(Badge8, { colorPalette: statusPalette2(ticket.status), children: ticket.status })
|
|
7576
7725
|
] }),
|
|
7577
|
-
/* @__PURE__ */
|
|
7726
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "sm", color: "gray.600", mt: 2, children: [
|
|
7578
7727
|
ticket.resource || "sem recurso",
|
|
7579
7728
|
" \xB7 ",
|
|
7580
7729
|
ticket.operation || "execute"
|
|
7581
7730
|
] }),
|
|
7582
|
-
/* @__PURE__ */
|
|
7731
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", color: "gray.500", mt: 1, wordBreak: "break-word", children: [
|
|
7583
7732
|
ticket.aggregateType || "sem agregado",
|
|
7584
7733
|
ticket.aggregateId ? ` \xB7 ${ticket.aggregateId}` : ""
|
|
7585
7734
|
] }),
|
|
7586
|
-
/* @__PURE__ */
|
|
7587
|
-
/* @__PURE__ */
|
|
7735
|
+
/* @__PURE__ */ jsxs32(Flex23, { gap: 2, mt: 2, wrap: "wrap", children: [
|
|
7736
|
+
/* @__PURE__ */ jsxs32(Badge8, { variant: "outline", children: [
|
|
7588
7737
|
"Tentativas: ",
|
|
7589
7738
|
ticket.attempts ?? 0
|
|
7590
7739
|
] }),
|
|
7591
|
-
/* @__PURE__ */
|
|
7740
|
+
/* @__PURE__ */ jsxs32(Badge8, { variant: "outline", children: [
|
|
7592
7741
|
"Criado: ",
|
|
7593
7742
|
dateTime3(ticket.createdAt)
|
|
7594
7743
|
] })
|
|
7595
7744
|
] }),
|
|
7596
|
-
error ? /* @__PURE__ */
|
|
7597
|
-
/* @__PURE__ */
|
|
7598
|
-
expanded ? /* @__PURE__ */
|
|
7745
|
+
error ? /* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "red.600", mt: 2, children: error }) : null,
|
|
7746
|
+
/* @__PURE__ */ jsx48(Box31, { mt: 3, children: /* @__PURE__ */ jsx48(TicketActions, { ticket, mutation, onToggle, expanded }) }),
|
|
7747
|
+
expanded ? /* @__PURE__ */ jsx48(TicketDetails, { ticket }) : null
|
|
7599
7748
|
] });
|
|
7600
7749
|
}
|
|
7601
7750
|
function CoreIntegrationTickets({ provider = "omie" }) {
|
|
7602
7751
|
const { http } = useOonApi();
|
|
7603
|
-
const [view, setView] =
|
|
7604
|
-
const [status, setStatus] =
|
|
7605
|
-
const [searchInput, setSearchInput] =
|
|
7606
|
-
const [search, setSearch] =
|
|
7607
|
-
const [page, setPage] =
|
|
7608
|
-
const [expandedId, setExpandedId] =
|
|
7752
|
+
const [view, setView] = useState23("list");
|
|
7753
|
+
const [status, setStatus] = useState23("");
|
|
7754
|
+
const [searchInput, setSearchInput] = useState23("");
|
|
7755
|
+
const [search, setSearch] = useState23("");
|
|
7756
|
+
const [page, setPage] = useState23(1);
|
|
7757
|
+
const [expandedId, setExpandedId] = useState23(null);
|
|
7609
7758
|
const limit = view === "board" ? 200 : 25;
|
|
7610
7759
|
useEffect13(() => {
|
|
7611
7760
|
const timeout = window.setTimeout(() => {
|
|
@@ -7614,7 +7763,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7614
7763
|
}, 350);
|
|
7615
7764
|
return () => window.clearTimeout(timeout);
|
|
7616
7765
|
}, [searchInput]);
|
|
7617
|
-
const queue =
|
|
7766
|
+
const queue = useQuery14({
|
|
7618
7767
|
queryKey: ["core-integration-tickets", provider, view, status, search, page],
|
|
7619
7768
|
queryFn: async () => (await http.get("/integrations/queue", {
|
|
7620
7769
|
params: {
|
|
@@ -7626,7 +7775,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7626
7775
|
}
|
|
7627
7776
|
})).data
|
|
7628
7777
|
});
|
|
7629
|
-
const action =
|
|
7778
|
+
const action = useMutation7({
|
|
7630
7779
|
mutationFn: async ({ id, action: ticketAction }) => {
|
|
7631
7780
|
const body = ticketAction === "archive" ? { reason: "Arquivado manualmente pela vis\xE3o de tickets." } : {};
|
|
7632
7781
|
return http.post(
|
|
@@ -7640,7 +7789,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7640
7789
|
await queue.refetch();
|
|
7641
7790
|
}
|
|
7642
7791
|
});
|
|
7643
|
-
const processPending =
|
|
7792
|
+
const processPending = useMutation7({
|
|
7644
7793
|
mutationFn: async () => http.post(
|
|
7645
7794
|
"/integrations/queue/process",
|
|
7646
7795
|
{ provider, limit: 100 },
|
|
@@ -7658,30 +7807,30 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7658
7807
|
const grouped = useMemo12(() => Object.fromEntries(
|
|
7659
7808
|
TICKET_STATUSES.map((ticketStatus) => [ticketStatus, tickets.filter((ticket) => ticket.status === ticketStatus)])
|
|
7660
7809
|
), [tickets]);
|
|
7661
|
-
if (queue.isLoading) return /* @__PURE__ */
|
|
7662
|
-
if (queue.error && !queue.data) return /* @__PURE__ */
|
|
7810
|
+
if (queue.isLoading) return /* @__PURE__ */ jsx48(LoadingScreen, {});
|
|
7811
|
+
if (queue.error && !queue.data) return /* @__PURE__ */ jsx48(ErrorState, { error: queue.error });
|
|
7663
7812
|
const pagination = queue.data?.pagination;
|
|
7664
7813
|
const totalPages = Math.max(1, pagination?.totalPages ?? 1);
|
|
7665
7814
|
const totalItems = pagination?.totalItems ?? 0;
|
|
7666
7815
|
const statuses = queue.data?.summary?.statuses ?? {};
|
|
7667
7816
|
const operationError = action.error || processPending.error || queue.error;
|
|
7668
|
-
return /* @__PURE__ */
|
|
7669
|
-
/* @__PURE__ */
|
|
7670
|
-
/* @__PURE__ */
|
|
7671
|
-
/* @__PURE__ */
|
|
7672
|
-
/* @__PURE__ */
|
|
7817
|
+
return /* @__PURE__ */ jsxs32(Stack13, { gap: 5, children: [
|
|
7818
|
+
/* @__PURE__ */ jsxs32(Flex23, { align: "start", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7819
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7820
|
+
/* @__PURE__ */ jsx48(Heading20, { size: "md", children: "Tickets de integra\xE7\xE3o" }),
|
|
7821
|
+
/* @__PURE__ */ jsx48(Text32, { color: "gray.500", children: "Acompanhe cada opera\xE7\xE3o da fila, seus par\xE2metros sanitizados, tentativas, erros e resultado." })
|
|
7673
7822
|
] }),
|
|
7674
|
-
/* @__PURE__ */
|
|
7675
|
-
/* @__PURE__ */
|
|
7823
|
+
/* @__PURE__ */ jsxs32(Flex23, { gap: 2, children: [
|
|
7824
|
+
/* @__PURE__ */ jsx48(Button23, { size: "sm", variant: view === "list" ? "solid" : "outline", onClick: () => {
|
|
7676
7825
|
setView("list");
|
|
7677
7826
|
setPage(1);
|
|
7678
7827
|
}, children: "Lista" }),
|
|
7679
|
-
/* @__PURE__ */
|
|
7828
|
+
/* @__PURE__ */ jsx48(Button23, { size: "sm", variant: view === "board" ? "solid" : "outline", onClick: () => {
|
|
7680
7829
|
setView("board");
|
|
7681
7830
|
setPage(1);
|
|
7682
7831
|
}, children: "Quadro" }),
|
|
7683
|
-
/* @__PURE__ */
|
|
7684
|
-
|
|
7832
|
+
/* @__PURE__ */ jsx48(
|
|
7833
|
+
Button23,
|
|
7685
7834
|
{
|
|
7686
7835
|
size: "sm",
|
|
7687
7836
|
colorPalette: "blue",
|
|
@@ -7691,13 +7840,13 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7691
7840
|
children: "Processar pendentes"
|
|
7692
7841
|
}
|
|
7693
7842
|
),
|
|
7694
|
-
/* @__PURE__ */
|
|
7843
|
+
/* @__PURE__ */ jsx48(Button23, { size: "sm", variant: "outline", loading: queue.isFetching, onClick: () => queue.refetch(), children: "Atualizar" })
|
|
7695
7844
|
] })
|
|
7696
7845
|
] }),
|
|
7697
|
-
/* @__PURE__ */
|
|
7698
|
-
/* @__PURE__ */
|
|
7699
|
-
/* @__PURE__ */
|
|
7700
|
-
|
|
7846
|
+
/* @__PURE__ */ jsxs32(Box31, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
|
|
7847
|
+
/* @__PURE__ */ jsxs32(Flex23, { gap: 3, align: "center", wrap: "wrap", children: [
|
|
7848
|
+
/* @__PURE__ */ jsx48(
|
|
7849
|
+
Input15,
|
|
7701
7850
|
{
|
|
7702
7851
|
size: "sm",
|
|
7703
7852
|
value: searchInput,
|
|
@@ -7707,7 +7856,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7707
7856
|
minW: "280px"
|
|
7708
7857
|
}
|
|
7709
7858
|
),
|
|
7710
|
-
/* @__PURE__ */
|
|
7859
|
+
/* @__PURE__ */ jsxs32(
|
|
7711
7860
|
NativeSelect5,
|
|
7712
7861
|
{
|
|
7713
7862
|
ariaLabel: "Filtrar tickets por status",
|
|
@@ -7717,18 +7866,18 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7717
7866
|
setPage(1);
|
|
7718
7867
|
},
|
|
7719
7868
|
children: [
|
|
7720
|
-
/* @__PURE__ */
|
|
7721
|
-
TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */
|
|
7869
|
+
/* @__PURE__ */ jsx48("option", { value: "", children: "Todos os status" }),
|
|
7870
|
+
TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsx48("option", { value: ticketStatus, children: ticketStatus }, ticketStatus))
|
|
7722
7871
|
]
|
|
7723
7872
|
}
|
|
7724
7873
|
),
|
|
7725
|
-
/* @__PURE__ */
|
|
7874
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "sm", color: "gray.500", children: [
|
|
7726
7875
|
totalItems,
|
|
7727
7876
|
" ticket(s)"
|
|
7728
7877
|
] })
|
|
7729
7878
|
] }),
|
|
7730
|
-
/* @__PURE__ */
|
|
7731
|
-
|
|
7879
|
+
/* @__PURE__ */ jsx48(Flex23, { gap: 2, wrap: "wrap", mt: 3, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs32(
|
|
7880
|
+
Button23,
|
|
7732
7881
|
{
|
|
7733
7882
|
size: "xs",
|
|
7734
7883
|
variant: status === ticketStatus ? "solid" : "outline",
|
|
@@ -7746,9 +7895,9 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7746
7895
|
ticketStatus
|
|
7747
7896
|
)) })
|
|
7748
7897
|
] }),
|
|
7749
|
-
view === "list" ? /* @__PURE__ */
|
|
7750
|
-
/* @__PURE__ */
|
|
7751
|
-
|
|
7898
|
+
view === "list" ? /* @__PURE__ */ jsx48(Box31, { borderWidth: "1px", borderRadius: "md", overflowX: "auto", children: /* @__PURE__ */ jsxs32(Box31, { minW: "1080px", children: [
|
|
7899
|
+
/* @__PURE__ */ jsx48(
|
|
7900
|
+
Box31,
|
|
7752
7901
|
{
|
|
7753
7902
|
display: "grid",
|
|
7754
7903
|
gridTemplateColumns: "1.25fr 1.5fr 1.15fr .75fr 1.15fr .9fr 1.3fr",
|
|
@@ -7757,64 +7906,64 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7757
7906
|
py: 2,
|
|
7758
7907
|
bg: "gray.50",
|
|
7759
7908
|
borderBottomWidth: "1px",
|
|
7760
|
-
children: ["Ticket", "Opera\xE7\xE3o", "Agregado", "Tentativas", "Datas", "Status", "A\xE7\xF5es"].map((label) => /* @__PURE__ */
|
|
7909
|
+
children: ["Ticket", "Opera\xE7\xE3o", "Agregado", "Tentativas", "Datas", "Status", "A\xE7\xF5es"].map((label) => /* @__PURE__ */ jsx48(Text32, { fontSize: "xs", fontWeight: "semibold", color: "gray.600", children: label }, label))
|
|
7761
7910
|
}
|
|
7762
7911
|
),
|
|
7763
7912
|
tickets.length ? tickets.map((ticket) => {
|
|
7764
7913
|
const expanded = expandedId === ticket._id;
|
|
7765
7914
|
const error = diagnosticMessage2(ticket.lastError);
|
|
7766
|
-
return /* @__PURE__ */
|
|
7767
|
-
/* @__PURE__ */
|
|
7768
|
-
|
|
7915
|
+
return /* @__PURE__ */ jsxs32(Box31, { px: 3, py: 3, borderBottomWidth: "1px", _last: { borderBottomWidth: 0 }, children: [
|
|
7916
|
+
/* @__PURE__ */ jsxs32(
|
|
7917
|
+
Box31,
|
|
7769
7918
|
{
|
|
7770
7919
|
display: "grid",
|
|
7771
7920
|
gridTemplateColumns: "1.25fr 1.5fr 1.15fr .75fr 1.15fr .9fr 1.3fr",
|
|
7772
7921
|
gap: 3,
|
|
7773
7922
|
alignItems: "start",
|
|
7774
7923
|
children: [
|
|
7775
|
-
/* @__PURE__ */
|
|
7776
|
-
/* @__PURE__ */
|
|
7924
|
+
/* @__PURE__ */ jsxs32(Box31, { minW: 0, children: [
|
|
7925
|
+
/* @__PURE__ */ jsxs32(Text32, { fontWeight: "semibold", title: ticket._id, children: [
|
|
7777
7926
|
"#",
|
|
7778
7927
|
shortId(ticket._id)
|
|
7779
7928
|
] }),
|
|
7780
|
-
/* @__PURE__ */
|
|
7929
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: ticket.provider })
|
|
7781
7930
|
] }),
|
|
7782
|
-
/* @__PURE__ */
|
|
7783
|
-
/* @__PURE__ */
|
|
7784
|
-
/* @__PURE__ */
|
|
7931
|
+
/* @__PURE__ */ jsxs32(Box31, { minW: 0, children: [
|
|
7932
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", fontWeight: "medium", wordBreak: "break-word", children: ticket.handler }),
|
|
7933
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", color: "gray.500", children: [
|
|
7785
7934
|
ticket.resource || "\u2014",
|
|
7786
7935
|
" \xB7 ",
|
|
7787
7936
|
ticket.operation || "execute"
|
|
7788
7937
|
] }),
|
|
7789
|
-
error ? /* @__PURE__ */
|
|
7938
|
+
error ? /* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "red.600", mt: 1, children: error }) : null
|
|
7790
7939
|
] }),
|
|
7791
|
-
/* @__PURE__ */
|
|
7792
|
-
/* @__PURE__ */
|
|
7793
|
-
/* @__PURE__ */
|
|
7940
|
+
/* @__PURE__ */ jsxs32(Box31, { minW: 0, children: [
|
|
7941
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: ticket.aggregateType || "\u2014" }),
|
|
7942
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", wordBreak: "break-all", children: ticket.aggregateId || "\u2014" })
|
|
7794
7943
|
] }),
|
|
7795
|
-
/* @__PURE__ */
|
|
7796
|
-
/* @__PURE__ */
|
|
7797
|
-
/* @__PURE__ */
|
|
7944
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7945
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "sm", children: ticket.attempts ?? 0 }),
|
|
7946
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", color: "gray.500", children: [
|
|
7798
7947
|
"Pr\xF3xima: ",
|
|
7799
7948
|
dateTime3(ticket.nextAttemptAt)
|
|
7800
7949
|
] })
|
|
7801
7950
|
] }),
|
|
7802
|
-
/* @__PURE__ */
|
|
7803
|
-
/* @__PURE__ */
|
|
7951
|
+
/* @__PURE__ */ jsxs32(Box31, { children: [
|
|
7952
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", children: [
|
|
7804
7953
|
"Criado: ",
|
|
7805
7954
|
dateTime3(ticket.createdAt)
|
|
7806
7955
|
] }),
|
|
7807
|
-
/* @__PURE__ */
|
|
7956
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", children: [
|
|
7808
7957
|
"Atualizado: ",
|
|
7809
7958
|
dateTime3(ticket.updatedAt)
|
|
7810
7959
|
] }),
|
|
7811
|
-
/* @__PURE__ */
|
|
7960
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "xs", children: [
|
|
7812
7961
|
"Conclu\xEDdo: ",
|
|
7813
7962
|
dateTime3(ticket.completedAt)
|
|
7814
7963
|
] })
|
|
7815
7964
|
] }),
|
|
7816
|
-
/* @__PURE__ */
|
|
7817
|
-
/* @__PURE__ */
|
|
7965
|
+
/* @__PURE__ */ jsx48(Badge8, { colorPalette: statusPalette2(ticket.status), width: "fit-content", children: ticket.status }),
|
|
7966
|
+
/* @__PURE__ */ jsx48(
|
|
7818
7967
|
TicketActions,
|
|
7819
7968
|
{
|
|
7820
7969
|
ticket,
|
|
@@ -7826,15 +7975,15 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7826
7975
|
]
|
|
7827
7976
|
}
|
|
7828
7977
|
),
|
|
7829
|
-
expanded ? /* @__PURE__ */
|
|
7978
|
+
expanded ? /* @__PURE__ */ jsx48(TicketDetails, { ticket }) : null
|
|
7830
7979
|
] }, ticket._id);
|
|
7831
|
-
}) : /* @__PURE__ */
|
|
7832
|
-
] }) }) : /* @__PURE__ */
|
|
7833
|
-
/* @__PURE__ */
|
|
7834
|
-
/* @__PURE__ */
|
|
7835
|
-
/* @__PURE__ */
|
|
7980
|
+
}) : /* @__PURE__ */ jsx48(Text32, { p: 5, color: "gray.400", children: "Nenhum ticket encontrado com os filtros informados." })
|
|
7981
|
+
] }) }) : /* @__PURE__ */ jsx48(Box31, { overflowX: "auto", pb: 2, children: /* @__PURE__ */ jsx48(Flex23, { align: "start", gap: 3, minW: `${TICKET_STATUSES.length * 290}px`, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs32(Box31, { width: "280px", flex: "0 0 280px", bg: "gray.50", borderRadius: "md", p: 2, children: [
|
|
7982
|
+
/* @__PURE__ */ jsxs32(Flex23, { align: "center", justify: "space-between", mb: 2, children: [
|
|
7983
|
+
/* @__PURE__ */ jsx48(Badge8, { colorPalette: statusPalette2(ticketStatus), children: ticketStatus }),
|
|
7984
|
+
/* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.500", children: statuses[ticketStatus] ?? 0 })
|
|
7836
7985
|
] }),
|
|
7837
|
-
/* @__PURE__ */
|
|
7986
|
+
/* @__PURE__ */ jsx48(Stack13, { gap: 2, children: grouped[ticketStatus].length ? grouped[ticketStatus].map((ticket) => /* @__PURE__ */ jsx48(
|
|
7838
7987
|
TicketCard,
|
|
7839
7988
|
{
|
|
7840
7989
|
ticket,
|
|
@@ -7843,10 +7992,10 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7843
7992
|
onToggle: () => setExpandedId((current) => current === ticket._id ? null : ticket._id)
|
|
7844
7993
|
},
|
|
7845
7994
|
ticket._id
|
|
7846
|
-
)) : /* @__PURE__ */
|
|
7995
|
+
)) : /* @__PURE__ */ jsx48(Text32, { fontSize: "xs", color: "gray.400", p: 2, children: "Nenhum ticket nesta p\xE1gina." }) })
|
|
7847
7996
|
] }, ticketStatus)) }) }),
|
|
7848
|
-
/* @__PURE__ */
|
|
7849
|
-
/* @__PURE__ */
|
|
7997
|
+
/* @__PURE__ */ jsxs32(Flex23, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
7998
|
+
/* @__PURE__ */ jsxs32(Text32, { fontSize: "sm", color: "gray.500", children: [
|
|
7850
7999
|
"P\xE1gina ",
|
|
7851
8000
|
pagination?.currentPage ?? page,
|
|
7852
8001
|
" de ",
|
|
@@ -7856,24 +8005,24 @@ function CoreIntegrationTickets({ provider = "omie" }) {
|
|
|
7856
8005
|
" por p\xE1gina",
|
|
7857
8006
|
view === "board" && totalItems > limit ? " \xB7 o quadro \xE9 paginado" : ""
|
|
7858
8007
|
] }),
|
|
7859
|
-
/* @__PURE__ */
|
|
7860
|
-
/* @__PURE__ */
|
|
7861
|
-
/* @__PURE__ */
|
|
8008
|
+
/* @__PURE__ */ jsxs32(Flex23, { gap: 2, children: [
|
|
8009
|
+
/* @__PURE__ */ jsx48(Button23, { size: "sm", variant: "outline", disabled: page <= 1, onClick: () => setPage((current) => Math.max(1, current - 1)), children: "Anterior" }),
|
|
8010
|
+
/* @__PURE__ */ jsx48(Button23, { size: "sm", variant: "outline", disabled: page >= totalPages, onClick: () => setPage((current) => Math.min(totalPages, current + 1)), children: "Pr\xF3xima" })
|
|
7862
8011
|
] })
|
|
7863
8012
|
] }),
|
|
7864
|
-
operationError ? /* @__PURE__ */
|
|
8013
|
+
operationError ? /* @__PURE__ */ jsx48(Text32, { color: "red.600", children: integrationErrorMessage2(operationError) }) : null
|
|
7865
8014
|
] });
|
|
7866
8015
|
}
|
|
7867
8016
|
|
|
7868
8017
|
// src/components/CoreOmieIntegrationWorkspace.tsx
|
|
7869
|
-
import { useState as
|
|
7870
|
-
import { Button as
|
|
8018
|
+
import { useState as useState25 } from "react";
|
|
8019
|
+
import { Button as Button25, Flex as Flex25, Stack as Stack15 } from "@chakra-ui/react";
|
|
7871
8020
|
|
|
7872
8021
|
// src/components/CoreOmieIntegration.tsx
|
|
7873
|
-
import { useEffect as useEffect14, useState as
|
|
7874
|
-
import { Badge as
|
|
7875
|
-
import { useMutation as
|
|
7876
|
-
import { jsx as
|
|
8022
|
+
import { useEffect as useEffect14, useState as useState24 } from "react";
|
|
8023
|
+
import { Badge as Badge9, Box as Box32, Button as Button24, Flex as Flex24, Heading as Heading21, Input as Input16, Stack as Stack14, Text as Text33 } from "@chakra-ui/react";
|
|
8024
|
+
import { useMutation as useMutation8, useQuery as useQuery15 } from "@tanstack/react-query";
|
|
8025
|
+
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7877
8026
|
function dateTime4(value3) {
|
|
7878
8027
|
if (!value3) return "\u2014";
|
|
7879
8028
|
const date = new Date(value3);
|
|
@@ -7919,7 +8068,7 @@ function NativeSelect6({
|
|
|
7919
8068
|
onChange,
|
|
7920
8069
|
children
|
|
7921
8070
|
}) {
|
|
7922
|
-
return /* @__PURE__ */
|
|
8071
|
+
return /* @__PURE__ */ jsx49(
|
|
7923
8072
|
"select",
|
|
7924
8073
|
{
|
|
7925
8074
|
style: {
|
|
@@ -7938,11 +8087,11 @@ function NativeSelect6({
|
|
|
7938
8087
|
}
|
|
7939
8088
|
function OmieConfigurationTab() {
|
|
7940
8089
|
const { http } = useOonApi();
|
|
7941
|
-
const configuration =
|
|
8090
|
+
const configuration = useQuery15({
|
|
7942
8091
|
queryKey: ["core-omie", "configuration"],
|
|
7943
8092
|
queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
|
|
7944
8093
|
});
|
|
7945
|
-
const [draft, setDraft] =
|
|
8094
|
+
const [draft, setDraft] = useState24({
|
|
7946
8095
|
instanceId: "default",
|
|
7947
8096
|
label: "Omie",
|
|
7948
8097
|
active: true,
|
|
@@ -7965,7 +8114,7 @@ function OmieConfigurationTab() {
|
|
|
7965
8114
|
appSecret: ""
|
|
7966
8115
|
}));
|
|
7967
8116
|
}, [selected?.instanceId, selected?.updatedAt]);
|
|
7968
|
-
const save =
|
|
8117
|
+
const save = useMutation8({
|
|
7969
8118
|
mutationFn: () => http.put(
|
|
7970
8119
|
`/integrations/providers/omie/configuration/${draft.instanceId}`,
|
|
7971
8120
|
{
|
|
@@ -7983,7 +8132,7 @@ function OmieConfigurationTab() {
|
|
|
7983
8132
|
await configuration.refetch();
|
|
7984
8133
|
}
|
|
7985
8134
|
});
|
|
7986
|
-
const testConnection =
|
|
8135
|
+
const testConnection = useMutation8({
|
|
7987
8136
|
mutationFn: () => http.post(
|
|
7988
8137
|
`/integrations/providers/omie/configuration/${draft.instanceId}/test`,
|
|
7989
8138
|
{},
|
|
@@ -7991,30 +8140,30 @@ function OmieConfigurationTab() {
|
|
|
7991
8140
|
),
|
|
7992
8141
|
onSuccess: () => configuration.refetch()
|
|
7993
8142
|
});
|
|
7994
|
-
if (configuration.isLoading) return /* @__PURE__ */
|
|
7995
|
-
if (configuration.error) return /* @__PURE__ */
|
|
8143
|
+
if (configuration.isLoading) return /* @__PURE__ */ jsx49(LoadingScreen, {});
|
|
8144
|
+
if (configuration.error) return /* @__PURE__ */ jsx49(ErrorState, { error: configuration.error });
|
|
7996
8145
|
const error = save.error || testConnection.error;
|
|
7997
|
-
return /* @__PURE__ */
|
|
7998
|
-
/* @__PURE__ */
|
|
7999
|
-
/* @__PURE__ */
|
|
8000
|
-
/* @__PURE__ */
|
|
8146
|
+
return /* @__PURE__ */ jsxs33(Stack14, { gap: 4, children: [
|
|
8147
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8148
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "md", children: "Configura\xE7\xF5es" }),
|
|
8149
|
+
/* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. O token do webhook \xE9 gerado e administrado automaticamente." })
|
|
8001
8150
|
] }),
|
|
8002
|
-
/* @__PURE__ */
|
|
8003
|
-
/* @__PURE__ */
|
|
8004
|
-
/* @__PURE__ */
|
|
8005
|
-
/* @__PURE__ */
|
|
8151
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 3, wrap: "wrap", children: [
|
|
8152
|
+
/* @__PURE__ */ jsxs33(Box32, { minW: "180px", flex: "1", children: [
|
|
8153
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
|
|
8154
|
+
/* @__PURE__ */ jsx49(
|
|
8006
8155
|
NativeSelect6,
|
|
8007
8156
|
{
|
|
8008
8157
|
value: draft.instanceId,
|
|
8009
8158
|
onChange: (instanceId) => setDraft((current) => ({ ...current, instanceId })),
|
|
8010
|
-
children: (configuration.data ?? []).map((instance) => /* @__PURE__ */
|
|
8159
|
+
children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx49("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId))
|
|
8011
8160
|
}
|
|
8012
8161
|
)
|
|
8013
8162
|
] }),
|
|
8014
|
-
/* @__PURE__ */
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
/* @__PURE__ */
|
|
8017
|
-
|
|
8163
|
+
/* @__PURE__ */ jsxs33(Box32, { minW: "240px", flex: "2", children: [
|
|
8164
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
|
|
8165
|
+
/* @__PURE__ */ jsx49(
|
|
8166
|
+
Input16,
|
|
8018
8167
|
{
|
|
8019
8168
|
size: "sm",
|
|
8020
8169
|
value: draft.label,
|
|
@@ -8022,25 +8171,25 @@ function OmieConfigurationTab() {
|
|
|
8022
8171
|
}
|
|
8023
8172
|
)
|
|
8024
8173
|
] }),
|
|
8025
|
-
/* @__PURE__ */
|
|
8026
|
-
/* @__PURE__ */
|
|
8027
|
-
/* @__PURE__ */
|
|
8174
|
+
/* @__PURE__ */ jsxs33(Box32, { minW: "180px", flex: "1", children: [
|
|
8175
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
|
|
8176
|
+
/* @__PURE__ */ jsxs33(
|
|
8028
8177
|
NativeSelect6,
|
|
8029
8178
|
{
|
|
8030
8179
|
value: draft.environment,
|
|
8031
8180
|
onChange: (environment) => setDraft((current) => ({ ...current, environment })),
|
|
8032
8181
|
children: [
|
|
8033
|
-
/* @__PURE__ */
|
|
8034
|
-
/* @__PURE__ */
|
|
8182
|
+
/* @__PURE__ */ jsx49("option", { value: "production", children: "Produ\xE7\xE3o" }),
|
|
8183
|
+
/* @__PURE__ */ jsx49("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
|
|
8035
8184
|
]
|
|
8036
8185
|
}
|
|
8037
8186
|
)
|
|
8038
8187
|
] })
|
|
8039
8188
|
] }),
|
|
8040
|
-
/* @__PURE__ */
|
|
8041
|
-
/* @__PURE__ */
|
|
8042
|
-
/* @__PURE__ */
|
|
8043
|
-
|
|
8189
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8190
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
|
|
8191
|
+
/* @__PURE__ */ jsx49(
|
|
8192
|
+
Input16,
|
|
8044
8193
|
{
|
|
8045
8194
|
size: "sm",
|
|
8046
8195
|
value: draft.baseUrl,
|
|
@@ -8048,14 +8197,14 @@ function OmieConfigurationTab() {
|
|
|
8048
8197
|
}
|
|
8049
8198
|
)
|
|
8050
8199
|
] }),
|
|
8051
|
-
/* @__PURE__ */
|
|
8052
|
-
/* @__PURE__ */
|
|
8053
|
-
/* @__PURE__ */
|
|
8200
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 3, wrap: "wrap", children: [
|
|
8201
|
+
/* @__PURE__ */ jsxs33(Box32, { minW: "260px", flex: "1", children: [
|
|
8202
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: [
|
|
8054
8203
|
"App Key ",
|
|
8055
8204
|
selected?.appKeyMasked ? `(${selected.appKeyMasked})` : ""
|
|
8056
8205
|
] }),
|
|
8057
|
-
/* @__PURE__ */
|
|
8058
|
-
|
|
8206
|
+
/* @__PURE__ */ jsx49(
|
|
8207
|
+
Input16,
|
|
8059
8208
|
{
|
|
8060
8209
|
size: "sm",
|
|
8061
8210
|
type: "password",
|
|
@@ -8065,10 +8214,10 @@ function OmieConfigurationTab() {
|
|
|
8065
8214
|
}
|
|
8066
8215
|
)
|
|
8067
8216
|
] }),
|
|
8068
|
-
/* @__PURE__ */
|
|
8069
|
-
/* @__PURE__ */
|
|
8070
|
-
/* @__PURE__ */
|
|
8071
|
-
|
|
8217
|
+
/* @__PURE__ */ jsxs33(Box32, { minW: "260px", flex: "1", children: [
|
|
8218
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
|
|
8219
|
+
/* @__PURE__ */ jsx49(
|
|
8220
|
+
Input16,
|
|
8072
8221
|
{
|
|
8073
8222
|
size: "sm",
|
|
8074
8223
|
type: "password",
|
|
@@ -8079,10 +8228,10 @@ function OmieConfigurationTab() {
|
|
|
8079
8228
|
)
|
|
8080
8229
|
] })
|
|
8081
8230
|
] }),
|
|
8082
|
-
/* @__PURE__ */
|
|
8083
|
-
/* @__PURE__ */
|
|
8084
|
-
/* @__PURE__ */
|
|
8085
|
-
/* @__PURE__ */
|
|
8231
|
+
/* @__PURE__ */ jsxs33(Flex24, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8232
|
+
/* @__PURE__ */ jsxs33(Flex24, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
8233
|
+
/* @__PURE__ */ jsxs33("label", { children: [
|
|
8234
|
+
/* @__PURE__ */ jsx49(
|
|
8086
8235
|
"input",
|
|
8087
8236
|
{
|
|
8088
8237
|
type: "checkbox",
|
|
@@ -8093,22 +8242,22 @@ function OmieConfigurationTab() {
|
|
|
8093
8242
|
" ",
|
|
8094
8243
|
"Integra\xE7\xE3o ativa"
|
|
8095
8244
|
] }),
|
|
8096
|
-
/* @__PURE__ */
|
|
8245
|
+
/* @__PURE__ */ jsxs33(Badge9, { colorPalette: statusPalette3(selected?.connectionStatus), children: [
|
|
8097
8246
|
"Conex\xE3o: ",
|
|
8098
8247
|
selected?.connectionStatus ?? "n\xE3o testada"
|
|
8099
8248
|
] }),
|
|
8100
|
-
/* @__PURE__ */
|
|
8249
|
+
/* @__PURE__ */ jsxs33(Badge9, { colorPalette: selected?.webhookConfigured ? "green" : "yellow", children: [
|
|
8101
8250
|
"Webhook: ",
|
|
8102
8251
|
selected?.webhookConfigured ? "configurado" : "ser\xE1 gerado"
|
|
8103
8252
|
] }),
|
|
8104
|
-
/* @__PURE__ */
|
|
8253
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "xs", color: "gray.500", children: [
|
|
8105
8254
|
"\xDAltimo teste: ",
|
|
8106
8255
|
dateTime4(selected?.lastConnectionTestAt)
|
|
8107
8256
|
] })
|
|
8108
8257
|
] }),
|
|
8109
|
-
/* @__PURE__ */
|
|
8110
|
-
/* @__PURE__ */
|
|
8111
|
-
|
|
8258
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 2, children: [
|
|
8259
|
+
/* @__PURE__ */ jsx49(
|
|
8260
|
+
Button24,
|
|
8112
8261
|
{
|
|
8113
8262
|
size: "sm",
|
|
8114
8263
|
variant: "outline",
|
|
@@ -8117,34 +8266,34 @@ function OmieConfigurationTab() {
|
|
|
8117
8266
|
children: "Testar conex\xE3o"
|
|
8118
8267
|
}
|
|
8119
8268
|
),
|
|
8120
|
-
/* @__PURE__ */
|
|
8269
|
+
/* @__PURE__ */ jsx49(Button24, { size: "sm", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xF5es" })
|
|
8121
8270
|
] })
|
|
8122
8271
|
] }),
|
|
8123
|
-
selected?.lastConnectionError ? /* @__PURE__ */
|
|
8124
|
-
error ? /* @__PURE__ */
|
|
8272
|
+
selected?.lastConnectionError ? /* @__PURE__ */ jsx49(Text33, { color: "red.600", children: selected.lastConnectionError }) : null,
|
|
8273
|
+
error ? /* @__PURE__ */ jsx49(Text33, { color: "red.600", children: integrationErrorMessage3(error) }) : null
|
|
8125
8274
|
] });
|
|
8126
8275
|
}
|
|
8127
8276
|
function OmieSynchronizationTab() {
|
|
8128
8277
|
const { http } = useOonApi();
|
|
8129
|
-
const health =
|
|
8278
|
+
const health = useQuery15({
|
|
8130
8279
|
queryKey: ["core-omie", "health"],
|
|
8131
8280
|
queryFn: async () => {
|
|
8132
8281
|
const providers = (await http.get("/integrations/health")).data?.results ?? [];
|
|
8133
8282
|
return providers.find((provider2) => provider2.key === "omie") ?? null;
|
|
8134
8283
|
}
|
|
8135
8284
|
});
|
|
8136
|
-
const mappings =
|
|
8285
|
+
const mappings = useQuery15({
|
|
8137
8286
|
queryKey: ["core-omie", "mappings"],
|
|
8138
8287
|
queryFn: async () => (await http.get("/integrations/providers/omie/mappings")).data
|
|
8139
8288
|
});
|
|
8140
|
-
const queue =
|
|
8289
|
+
const queue = useQuery15({
|
|
8141
8290
|
queryKey: ["core-omie", "queue"],
|
|
8142
8291
|
queryFn: async () => (await http.get("/integrations/queue", {
|
|
8143
8292
|
params: { provider: "omie", limit: 20 }
|
|
8144
8293
|
})).data?.results ?? []
|
|
8145
8294
|
});
|
|
8146
8295
|
const refresh = () => Promise.all([health.refetch(), mappings.refetch(), queue.refetch()]);
|
|
8147
|
-
const syncAll =
|
|
8296
|
+
const syncAll = useMutation8({
|
|
8148
8297
|
mutationFn: () => http.post(
|
|
8149
8298
|
"/integrations/providers/omie/sync-all",
|
|
8150
8299
|
{},
|
|
@@ -8152,7 +8301,7 @@ function OmieSynchronizationTab() {
|
|
|
8152
8301
|
),
|
|
8153
8302
|
onSuccess: refresh
|
|
8154
8303
|
});
|
|
8155
|
-
const syncResource =
|
|
8304
|
+
const syncResource = useMutation8({
|
|
8156
8305
|
mutationFn: (resource) => http.post(
|
|
8157
8306
|
`/integrations/providers/omie/resources/${resource}/sync`,
|
|
8158
8307
|
{},
|
|
@@ -8160,7 +8309,7 @@ function OmieSynchronizationTab() {
|
|
|
8160
8309
|
),
|
|
8161
8310
|
onSuccess: refresh
|
|
8162
8311
|
});
|
|
8163
|
-
const process =
|
|
8312
|
+
const process = useMutation8({
|
|
8164
8313
|
mutationFn: () => http.post(
|
|
8165
8314
|
"/integrations/actions/process-active",
|
|
8166
8315
|
{ provider: "omie" },
|
|
@@ -8168,43 +8317,43 @@ function OmieSynchronizationTab() {
|
|
|
8168
8317
|
),
|
|
8169
8318
|
onSuccess: refresh
|
|
8170
8319
|
});
|
|
8171
|
-
if (health.isLoading || mappings.isLoading || queue.isLoading) return /* @__PURE__ */
|
|
8320
|
+
if (health.isLoading || mappings.isLoading || queue.isLoading) return /* @__PURE__ */ jsx49(LoadingScreen, {});
|
|
8172
8321
|
const error = health.error || mappings.error || queue.error || syncAll.error || syncResource.error || process.error;
|
|
8173
|
-
if ((health.error || mappings.error || queue.error) && !health.data) return /* @__PURE__ */
|
|
8322
|
+
if ((health.error || mappings.error || queue.error) && !health.data) return /* @__PURE__ */ jsx49(ErrorState, { error });
|
|
8174
8323
|
const provider = health.data;
|
|
8175
|
-
return /* @__PURE__ */
|
|
8176
|
-
/* @__PURE__ */
|
|
8177
|
-
/* @__PURE__ */
|
|
8178
|
-
/* @__PURE__ */
|
|
8179
|
-
/* @__PURE__ */
|
|
8324
|
+
return /* @__PURE__ */ jsxs33(Stack14, { gap: 5, children: [
|
|
8325
|
+
/* @__PURE__ */ jsxs33(Flex24, { align: "start", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8326
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8327
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "md", children: "Sincroniza\xE7\xE3o" }),
|
|
8328
|
+
/* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Execute listas declaradas e acompanhe o processamento da fila Omie." })
|
|
8180
8329
|
] }),
|
|
8181
|
-
/* @__PURE__ */
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
/* @__PURE__ */
|
|
8330
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 2, children: [
|
|
8331
|
+
/* @__PURE__ */ jsx49(Button24, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" }),
|
|
8332
|
+
/* @__PURE__ */ jsx49(Button24, { size: "sm", loading: syncAll.isPending, onClick: () => syncAll.mutate(), children: "Sincronizar tudo" })
|
|
8184
8333
|
] })
|
|
8185
8334
|
] }),
|
|
8186
|
-
provider ? /* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8188
|
-
/* @__PURE__ */
|
|
8189
|
-
/* @__PURE__ */
|
|
8335
|
+
provider ? /* @__PURE__ */ jsxs33(Box32, { borderWidth: "1px", borderRadius: "md", p: 4, children: [
|
|
8336
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 2, wrap: "wrap", mb: 3, children: [
|
|
8337
|
+
/* @__PURE__ */ jsx49(Badge9, { colorPalette: statusPalette3(provider.status), children: provider.status || "\u2014" }),
|
|
8338
|
+
/* @__PURE__ */ jsxs33(Badge9, { colorPalette: countActive2(provider.queue) ? "yellow" : "green", children: [
|
|
8190
8339
|
"Fila ativa: ",
|
|
8191
8340
|
countActive2(provider.queue)
|
|
8192
8341
|
] }),
|
|
8193
|
-
/* @__PURE__ */
|
|
8342
|
+
/* @__PURE__ */ jsxs33(Badge9, { colorPalette: countActive2(provider.inbox) ? "yellow" : "green", children: [
|
|
8194
8343
|
"Eventos ativos: ",
|
|
8195
8344
|
countActive2(provider.inbox)
|
|
8196
8345
|
] }),
|
|
8197
|
-
/* @__PURE__ */
|
|
8346
|
+
/* @__PURE__ */ jsxs33(Badge9, { colorPalette: statusPalette3(provider.lastExecution?.status), children: [
|
|
8198
8347
|
"\xDAltima execu\xE7\xE3o: ",
|
|
8199
8348
|
provider.lastExecution?.status || "sem hist\xF3rico"
|
|
8200
8349
|
] })
|
|
8201
8350
|
] }),
|
|
8202
|
-
/* @__PURE__ */
|
|
8351
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", mb: 3, children: [
|
|
8203
8352
|
"Pend\xEAncia mais antiga: ",
|
|
8204
8353
|
dateTime4(provider.oldestPendingAt)
|
|
8205
8354
|
] }),
|
|
8206
|
-
/* @__PURE__ */
|
|
8207
|
-
|
|
8355
|
+
/* @__PURE__ */ jsx49(Flex24, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx49(
|
|
8356
|
+
Button24,
|
|
8208
8357
|
{
|
|
8209
8358
|
size: "sm",
|
|
8210
8359
|
variant: "outline",
|
|
@@ -8214,15 +8363,15 @@ function OmieSynchronizationTab() {
|
|
|
8214
8363
|
},
|
|
8215
8364
|
resource.key
|
|
8216
8365
|
)) })
|
|
8217
|
-
] }) : /* @__PURE__ */
|
|
8218
|
-
/* @__PURE__ */
|
|
8219
|
-
/* @__PURE__ */
|
|
8220
|
-
/* @__PURE__ */
|
|
8366
|
+
] }) : /* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Provider Omie n\xE3o registrado." }),
|
|
8367
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8368
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "sm", mb: 3, children: "Listas declaradas" }),
|
|
8369
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: (mappings.data?.lists ?? []).map((list) => {
|
|
8221
8370
|
const latest = list.executions?.[0];
|
|
8222
|
-
return /* @__PURE__ */
|
|
8223
|
-
/* @__PURE__ */
|
|
8224
|
-
/* @__PURE__ */
|
|
8225
|
-
/* @__PURE__ */
|
|
8371
|
+
return /* @__PURE__ */ jsx49(Box32, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs33(Flex24, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8372
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8373
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "semibold", children: list.label || list.key }),
|
|
8374
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", children: [
|
|
8226
8375
|
list.mode || "modo padr\xE3o",
|
|
8227
8376
|
" \xB7 ",
|
|
8228
8377
|
list.direction || "dire\xE7\xE3o padr\xE3o",
|
|
@@ -8230,59 +8379,59 @@ function OmieSynchronizationTab() {
|
|
|
8230
8379
|
list.targetModel || "destino declarado"
|
|
8231
8380
|
] })
|
|
8232
8381
|
] }),
|
|
8233
|
-
/* @__PURE__ */
|
|
8234
|
-
/* @__PURE__ */
|
|
8235
|
-
/* @__PURE__ */
|
|
8382
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 2, wrap: "wrap", children: [
|
|
8383
|
+
/* @__PURE__ */ jsx49(Badge9, { colorPalette: statusPalette3(latest?.status), children: latest?.status || "n\xE3o executada" }),
|
|
8384
|
+
/* @__PURE__ */ jsx49(Badge9, { variant: "outline", children: dateTime4(latest?.lastCompletedAt) })
|
|
8236
8385
|
] })
|
|
8237
8386
|
] }) }, list.key);
|
|
8238
8387
|
}) })
|
|
8239
8388
|
] }),
|
|
8240
|
-
/* @__PURE__ */
|
|
8241
|
-
/* @__PURE__ */
|
|
8242
|
-
/* @__PURE__ */
|
|
8243
|
-
/* @__PURE__ */
|
|
8244
|
-
/* @__PURE__ */
|
|
8245
|
-
/* @__PURE__ */
|
|
8389
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8390
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "sm", mb: 3, children: "Fila recente" }),
|
|
8391
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: (queue.data ?? []).length ? queue.data?.map((ticket) => /* @__PURE__ */ jsx49(Box32, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs33(Flex24, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8392
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8393
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "medium", children: ticket.handler }),
|
|
8394
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", children: [
|
|
8246
8395
|
ticket.resource || "sem recurso",
|
|
8247
8396
|
" \xB7 tentativas ",
|
|
8248
8397
|
ticket.attempts ?? 0,
|
|
8249
8398
|
" \xB7 pr\xF3xima ",
|
|
8250
8399
|
dateTime4(ticket.nextAttemptAt)
|
|
8251
8400
|
] }),
|
|
8252
|
-
ticket.lastError?.message ? /* @__PURE__ */
|
|
8401
|
+
ticket.lastError?.message ? /* @__PURE__ */ jsx49(Text33, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
|
|
8253
8402
|
] }),
|
|
8254
|
-
/* @__PURE__ */
|
|
8255
|
-
] }) }, ticket._id)) : /* @__PURE__ */
|
|
8403
|
+
/* @__PURE__ */ jsx49(Badge9, { colorPalette: statusPalette3(ticket.status), children: ticket.status })
|
|
8404
|
+
] }) }, ticket._id)) : /* @__PURE__ */ jsx49(Text33, { color: "gray.400", children: "Nenhuma pend\xEAncia Omie." }) })
|
|
8256
8405
|
] }),
|
|
8257
|
-
error ? /* @__PURE__ */
|
|
8406
|
+
error ? /* @__PURE__ */ jsx49(Text33, { color: "red.600", children: integrationErrorMessage3(error) }) : null
|
|
8258
8407
|
] });
|
|
8259
8408
|
}
|
|
8260
8409
|
function OmieWebhooksTab() {
|
|
8261
8410
|
const { http } = useOonApi();
|
|
8262
|
-
const [instanceId, setInstanceId] =
|
|
8263
|
-
const [copied, setCopied] =
|
|
8264
|
-
const configuration =
|
|
8411
|
+
const [instanceId, setInstanceId] = useState24("default");
|
|
8412
|
+
const [copied, setCopied] = useState24(false);
|
|
8413
|
+
const configuration = useQuery15({
|
|
8265
8414
|
queryKey: ["core-omie", "configuration"],
|
|
8266
8415
|
queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
|
|
8267
8416
|
});
|
|
8268
|
-
const access =
|
|
8417
|
+
const access = useQuery15({
|
|
8269
8418
|
queryKey: ["core-omie", "webhook-access", instanceId],
|
|
8270
8419
|
enabled: Boolean(instanceId),
|
|
8271
8420
|
queryFn: async () => (await http.get(
|
|
8272
8421
|
`/integrations/providers/omie/configuration/${instanceId}/webhook`
|
|
8273
8422
|
)).data
|
|
8274
8423
|
});
|
|
8275
|
-
const mappings =
|
|
8424
|
+
const mappings = useQuery15({
|
|
8276
8425
|
queryKey: ["core-omie", "mappings"],
|
|
8277
8426
|
queryFn: async () => (await http.get("/integrations/providers/omie/mappings")).data
|
|
8278
8427
|
});
|
|
8279
|
-
const events =
|
|
8428
|
+
const events = useQuery15({
|
|
8280
8429
|
queryKey: ["core-omie", "events"],
|
|
8281
8430
|
queryFn: async () => (await http.get("/integrations/events", {
|
|
8282
8431
|
params: { provider: "omie", limit: 20 }
|
|
8283
8432
|
})).data?.results ?? []
|
|
8284
8433
|
});
|
|
8285
|
-
const rotate =
|
|
8434
|
+
const rotate = useMutation8({
|
|
8286
8435
|
mutationFn: () => http.post(
|
|
8287
8436
|
`/integrations/providers/omie/configuration/${instanceId}/webhook/rotate`,
|
|
8288
8437
|
{},
|
|
@@ -8297,26 +8446,26 @@ function OmieWebhooksTab() {
|
|
|
8297
8446
|
const first = configuration.data?.[0]?.instanceId;
|
|
8298
8447
|
if (first && !configuration.data?.some((item) => item.instanceId === instanceId)) setInstanceId(first);
|
|
8299
8448
|
}, [configuration.data, instanceId]);
|
|
8300
|
-
if (configuration.isLoading || mappings.isLoading || events.isLoading) return /* @__PURE__ */
|
|
8449
|
+
if (configuration.isLoading || mappings.isLoading || events.isLoading) return /* @__PURE__ */ jsx49(LoadingScreen, {});
|
|
8301
8450
|
const blockingError = configuration.error || mappings.error || events.error;
|
|
8302
|
-
if (blockingError) return /* @__PURE__ */
|
|
8451
|
+
if (blockingError) return /* @__PURE__ */ jsx49(ErrorState, { error: blockingError });
|
|
8303
8452
|
const url = absoluteWebhookUrl(access.data?.webhookPath);
|
|
8304
8453
|
const operationError = access.error || rotate.error;
|
|
8305
|
-
return /* @__PURE__ */
|
|
8306
|
-
/* @__PURE__ */
|
|
8307
|
-
/* @__PURE__ */
|
|
8308
|
-
/* @__PURE__ */
|
|
8454
|
+
return /* @__PURE__ */ jsxs33(Stack14, { gap: 5, children: [
|
|
8455
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8456
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "md", children: "Webhooks e gatilhos" }),
|
|
8457
|
+
/* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Copie a URL completa para o cadastro de webhook no Omie. O token \xE9 gerado automaticamente e pode ser rotacionado." })
|
|
8309
8458
|
] }),
|
|
8310
|
-
/* @__PURE__ */
|
|
8311
|
-
/* @__PURE__ */
|
|
8312
|
-
/* @__PURE__ */
|
|
8313
|
-
/* @__PURE__ */
|
|
8459
|
+
/* @__PURE__ */ jsx49(Box32, { borderWidth: "1px", borderRadius: "md", p: 4, children: /* @__PURE__ */ jsxs33(Stack14, { gap: 3, children: [
|
|
8460
|
+
/* @__PURE__ */ jsxs33(Box32, { maxW: "360px", children: [
|
|
8461
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
|
|
8462
|
+
/* @__PURE__ */ jsx49(NativeSelect6, { value: instanceId, onChange: setInstanceId, children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx49("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId)) })
|
|
8314
8463
|
] }),
|
|
8315
|
-
/* @__PURE__ */
|
|
8316
|
-
/* @__PURE__ */
|
|
8317
|
-
/* @__PURE__ */
|
|
8318
|
-
/* @__PURE__ */
|
|
8319
|
-
|
|
8464
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8465
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL do webhook" }),
|
|
8466
|
+
/* @__PURE__ */ jsxs33(Flex24, { gap: 2, align: "center", wrap: "wrap", children: [
|
|
8467
|
+
/* @__PURE__ */ jsx49(
|
|
8468
|
+
Input16,
|
|
8320
8469
|
{
|
|
8321
8470
|
size: "sm",
|
|
8322
8471
|
value: url,
|
|
@@ -8326,8 +8475,8 @@ function OmieWebhooksTab() {
|
|
|
8326
8475
|
placeholder: access.isLoading ? "Gerando URL segura\u2026" : "URL indispon\xEDvel"
|
|
8327
8476
|
}
|
|
8328
8477
|
),
|
|
8329
|
-
/* @__PURE__ */
|
|
8330
|
-
|
|
8478
|
+
/* @__PURE__ */ jsx49(
|
|
8479
|
+
Button24,
|
|
8331
8480
|
{
|
|
8332
8481
|
size: "sm",
|
|
8333
8482
|
variant: "outline",
|
|
@@ -8339,8 +8488,8 @@ function OmieWebhooksTab() {
|
|
|
8339
8488
|
children: copied ? "Link copiado" : "Copiar link"
|
|
8340
8489
|
}
|
|
8341
8490
|
),
|
|
8342
|
-
/* @__PURE__ */
|
|
8343
|
-
|
|
8491
|
+
/* @__PURE__ */ jsx49(
|
|
8492
|
+
Button24,
|
|
8344
8493
|
{
|
|
8345
8494
|
size: "sm",
|
|
8346
8495
|
colorPalette: "red",
|
|
@@ -8355,38 +8504,38 @@ function OmieWebhooksTab() {
|
|
|
8355
8504
|
}
|
|
8356
8505
|
)
|
|
8357
8506
|
] }),
|
|
8358
|
-
/* @__PURE__ */
|
|
8507
|
+
/* @__PURE__ */ jsx49(Text33, { fontSize: "xs", color: "gray.500", mt: 2, children: "A rota\xE7\xE3o invalida imediatamente a URL anterior. Atualize o cadastro no Omie ap\xF3s gerar um novo token." })
|
|
8359
8508
|
] })
|
|
8360
8509
|
] }) }),
|
|
8361
|
-
/* @__PURE__ */
|
|
8362
|
-
/* @__PURE__ */
|
|
8363
|
-
/* @__PURE__ */
|
|
8364
|
-
/* @__PURE__ */
|
|
8365
|
-
/* @__PURE__ */
|
|
8510
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8511
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "sm", mb: 3, children: "Gatilhos declarados" }),
|
|
8512
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: (mappings.data?.webhooks ?? []).length ? mappings.data?.webhooks?.map((webhook) => /* @__PURE__ */ jsxs33(Box32, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
|
|
8513
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "semibold", children: webhook.eventType }),
|
|
8514
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", children: [
|
|
8366
8515
|
webhook.resource || "recurso gen\xE9rico",
|
|
8367
8516
|
" \u2192 ",
|
|
8368
8517
|
(webhook.actions ?? []).map((action) => action.handler).filter(Boolean).join(", ") || "sem a\xE7\xE3o declarada"
|
|
8369
8518
|
] })
|
|
8370
|
-
] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */
|
|
8519
|
+
] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx49(Text33, { color: "gray.400", children: "Nenhum gatilho declarado pela Central." }) })
|
|
8371
8520
|
] }),
|
|
8372
|
-
/* @__PURE__ */
|
|
8373
|
-
/* @__PURE__ */
|
|
8374
|
-
/* @__PURE__ */
|
|
8375
|
-
/* @__PURE__ */
|
|
8376
|
-
/* @__PURE__ */
|
|
8377
|
-
/* @__PURE__ */
|
|
8521
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8522
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "sm", mb: 3, children: "Eventos recebidos" }),
|
|
8523
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: (events.data ?? []).length ? events.data?.map((event) => /* @__PURE__ */ jsx49(Box32, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs33(Flex24, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8524
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8525
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "medium", children: event.eventType || "Evento Omie" }),
|
|
8526
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", children: [
|
|
8378
8527
|
event.resource || "sem recurso",
|
|
8379
8528
|
" \xB7 recebido em ",
|
|
8380
8529
|
dateTime4(event.receivedAt),
|
|
8381
8530
|
" \xB7 tentativas ",
|
|
8382
8531
|
event.attempts ?? 0
|
|
8383
8532
|
] }),
|
|
8384
|
-
event.lastError?.message ? /* @__PURE__ */
|
|
8533
|
+
event.lastError?.message ? /* @__PURE__ */ jsx49(Text33, { fontSize: "sm", color: "red.600", children: event.lastError.message }) : null
|
|
8385
8534
|
] }),
|
|
8386
|
-
/* @__PURE__ */
|
|
8387
|
-
] }) }, event._id)) : /* @__PURE__ */
|
|
8535
|
+
/* @__PURE__ */ jsx49(Badge9, { colorPalette: statusPalette3(event.status), children: event.status })
|
|
8536
|
+
] }) }, event._id)) : /* @__PURE__ */ jsx49(Text33, { color: "gray.400", children: "Nenhum webhook recebido." }) })
|
|
8388
8537
|
] }),
|
|
8389
|
-
operationError ? /* @__PURE__ */
|
|
8538
|
+
operationError ? /* @__PURE__ */ jsx49(Text33, { color: "red.600", children: integrationErrorMessage3(operationError) }) : null
|
|
8390
8539
|
] });
|
|
8391
8540
|
}
|
|
8392
8541
|
function diagnosticMessage3(value3) {
|
|
@@ -8394,31 +8543,31 @@ function diagnosticMessage3(value3) {
|
|
|
8394
8543
|
}
|
|
8395
8544
|
function OmieHistoryTab() {
|
|
8396
8545
|
const { http } = useOonApi();
|
|
8397
|
-
const [expandedId, setExpandedId] =
|
|
8398
|
-
const history =
|
|
8546
|
+
const [expandedId, setExpandedId] = useState24(null);
|
|
8547
|
+
const history = useQuery15({
|
|
8399
8548
|
queryKey: ["core-omie", "history"],
|
|
8400
8549
|
queryFn: async () => (await http.get("/integrations/history", {
|
|
8401
8550
|
params: { provider: "omie", limit: 30 }
|
|
8402
8551
|
})).data?.results ?? []
|
|
8403
8552
|
});
|
|
8404
|
-
if (history.isLoading) return /* @__PURE__ */
|
|
8405
|
-
if (history.error) return /* @__PURE__ */
|
|
8406
|
-
return /* @__PURE__ */
|
|
8407
|
-
/* @__PURE__ */
|
|
8408
|
-
/* @__PURE__ */
|
|
8409
|
-
/* @__PURE__ */
|
|
8553
|
+
if (history.isLoading) return /* @__PURE__ */ jsx49(LoadingScreen, {});
|
|
8554
|
+
if (history.error) return /* @__PURE__ */ jsx49(ErrorState, { error: history.error });
|
|
8555
|
+
return /* @__PURE__ */ jsxs33(Stack14, { gap: 4, children: [
|
|
8556
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8557
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "md", children: "Hist\xF3rico" }),
|
|
8558
|
+
/* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Execu\xE7\xF5es, erros por registro e diagn\xF3stico t\xE9cnico sanitizado." })
|
|
8410
8559
|
] }),
|
|
8411
|
-
/* @__PURE__ */
|
|
8560
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: (history.data ?? []).length ? history.data?.map((execution) => {
|
|
8412
8561
|
const expanded = expandedId === execution._id;
|
|
8413
8562
|
const diagnostics = [...execution.errors ?? []];
|
|
8414
8563
|
if (execution.error?.message && !diagnostics.some((item) => diagnosticMessage3(item) === execution.error?.message)) {
|
|
8415
8564
|
diagnostics.push({ error: execution.error });
|
|
8416
8565
|
}
|
|
8417
|
-
return /* @__PURE__ */
|
|
8418
|
-
/* @__PURE__ */
|
|
8419
|
-
/* @__PURE__ */
|
|
8420
|
-
/* @__PURE__ */
|
|
8421
|
-
/* @__PURE__ */
|
|
8566
|
+
return /* @__PURE__ */ jsxs33(Box32, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
|
|
8567
|
+
/* @__PURE__ */ jsxs33(Flex24, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
8568
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8569
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "semibold", children: execution.title }),
|
|
8570
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "sm", color: "gray.500", children: [
|
|
8422
8571
|
execution.resource || "sem recurso",
|
|
8423
8572
|
" \xB7 ",
|
|
8424
8573
|
dateTime4(execution.startedAt),
|
|
@@ -8427,14 +8576,14 @@ function OmieHistoryTab() {
|
|
|
8427
8576
|
" ms"
|
|
8428
8577
|
] })
|
|
8429
8578
|
] }),
|
|
8430
|
-
/* @__PURE__ */
|
|
8431
|
-
(execution.errorCount ?? diagnostics.length) > 0 ? /* @__PURE__ */
|
|
8579
|
+
/* @__PURE__ */ jsxs33(Flex24, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
8580
|
+
(execution.errorCount ?? diagnostics.length) > 0 ? /* @__PURE__ */ jsxs33(Badge9, { colorPalette: "red", children: [
|
|
8432
8581
|
execution.errorCount ?? diagnostics.length,
|
|
8433
8582
|
" erro(s)"
|
|
8434
8583
|
] }) : null,
|
|
8435
|
-
/* @__PURE__ */
|
|
8436
|
-
/* @__PURE__ */
|
|
8437
|
-
|
|
8584
|
+
/* @__PURE__ */ jsx49(Badge9, { colorPalette: statusPalette3(execution.status), children: execution.status }),
|
|
8585
|
+
/* @__PURE__ */ jsx49(
|
|
8586
|
+
Button24,
|
|
8438
8587
|
{
|
|
8439
8588
|
size: "sm",
|
|
8440
8589
|
variant: "outline",
|
|
@@ -8445,22 +8594,22 @@ function OmieHistoryTab() {
|
|
|
8445
8594
|
)
|
|
8446
8595
|
] })
|
|
8447
8596
|
] }),
|
|
8448
|
-
expanded ? /* @__PURE__ */
|
|
8449
|
-
execution.summary && Object.keys(execution.summary).length ? /* @__PURE__ */
|
|
8450
|
-
/* @__PURE__ */
|
|
8451
|
-
/* @__PURE__ */
|
|
8597
|
+
expanded ? /* @__PURE__ */ jsxs33(Stack14, { gap: 3, mt: 3, pt: 3, borderTopWidth: "1px", children: [
|
|
8598
|
+
execution.summary && Object.keys(execution.summary).length ? /* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8599
|
+
/* @__PURE__ */ jsx49(Text33, { fontWeight: "semibold", fontSize: "sm", mb: 2, children: "Resumo" }),
|
|
8600
|
+
/* @__PURE__ */ jsx49(Flex24, { gap: 2, wrap: "wrap", children: Object.entries(execution.summary).map(([key, value3]) => /* @__PURE__ */ jsxs33(Badge9, { variant: "outline", children: [
|
|
8452
8601
|
key,
|
|
8453
8602
|
": ",
|
|
8454
8603
|
String(value3 ?? "\u2014")
|
|
8455
8604
|
] }, key)) })
|
|
8456
8605
|
] }) : null,
|
|
8457
|
-
diagnostics.length ? /* @__PURE__ */
|
|
8458
|
-
/* @__PURE__ */
|
|
8606
|
+
diagnostics.length ? /* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8607
|
+
/* @__PURE__ */ jsxs33(Text33, { fontWeight: "semibold", fontSize: "sm", mb: 2, children: [
|
|
8459
8608
|
"Erros por registro",
|
|
8460
8609
|
execution.errorsLimited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
|
|
8461
8610
|
] }),
|
|
8462
|
-
/* @__PURE__ */
|
|
8463
|
-
|
|
8611
|
+
/* @__PURE__ */ jsx49(Stack14, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs33(
|
|
8612
|
+
Box32,
|
|
8464
8613
|
{
|
|
8465
8614
|
borderWidth: "1px",
|
|
8466
8615
|
borderColor: "red.100",
|
|
@@ -8468,13 +8617,13 @@ function OmieHistoryTab() {
|
|
|
8468
8617
|
bg: "red.50",
|
|
8469
8618
|
p: 3,
|
|
8470
8619
|
children: [
|
|
8471
|
-
/* @__PURE__ */
|
|
8620
|
+
/* @__PURE__ */ jsxs33(Text33, { fontSize: "xs", color: "gray.600", children: [
|
|
8472
8621
|
"Registro ",
|
|
8473
8622
|
diagnostic.index !== void 0 ? diagnostic.index + 1 : index + 1,
|
|
8474
8623
|
diagnostic.externalKey !== void 0 ? ` \xB7 chave ${String(diagnostic.externalKey)}` : "",
|
|
8475
8624
|
diagnostic.error?.code || diagnostic.code || diagnostic.error?.statusCode || diagnostic.statusCode ? ` \xB7 c\xF3digo ${String(diagnostic.error?.code || diagnostic.code || diagnostic.error?.statusCode || diagnostic.statusCode)}` : ""
|
|
8476
8625
|
] }),
|
|
8477
|
-
/* @__PURE__ */
|
|
8626
|
+
/* @__PURE__ */ jsx49(Text33, { color: "red.700", children: diagnosticMessage3(diagnostic) })
|
|
8478
8627
|
]
|
|
8479
8628
|
},
|
|
8480
8629
|
`${diagnostic.index ?? index}:${diagnosticMessage3(diagnostic)}`
|
|
@@ -8484,14 +8633,14 @@ function OmieHistoryTab() {
|
|
|
8484
8633
|
["Itens processados", execution.items, execution.itemCount, execution.itemsLimited],
|
|
8485
8634
|
["Chamadas sanitizadas", execution.requests, execution.requestCount, execution.requestsLimited],
|
|
8486
8635
|
["Metadados", execution.metadata, void 0, false]
|
|
8487
|
-
].map(([label, value3, count, limited]) => value3 ? /* @__PURE__ */
|
|
8488
|
-
/* @__PURE__ */
|
|
8636
|
+
].map(([label, value3, count, limited]) => value3 ? /* @__PURE__ */ jsxs33("details", { children: [
|
|
8637
|
+
/* @__PURE__ */ jsxs33("summary", { style: { cursor: "pointer", fontWeight: 600 }, children: [
|
|
8489
8638
|
String(label),
|
|
8490
8639
|
typeof count === "number" ? ` (${count})` : "",
|
|
8491
8640
|
limited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
|
|
8492
8641
|
] }),
|
|
8493
|
-
/* @__PURE__ */
|
|
8494
|
-
|
|
8642
|
+
/* @__PURE__ */ jsx49(
|
|
8643
|
+
Box32,
|
|
8495
8644
|
{
|
|
8496
8645
|
as: "pre",
|
|
8497
8646
|
mt: 2,
|
|
@@ -8507,7 +8656,7 @@ function OmieHistoryTab() {
|
|
|
8507
8656
|
] }, String(label)) : null)
|
|
8508
8657
|
] }) : null
|
|
8509
8658
|
] }, execution._id);
|
|
8510
|
-
}) : /* @__PURE__ */
|
|
8659
|
+
}) : /* @__PURE__ */ jsx49(Text33, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o Omie registrada." }) })
|
|
8511
8660
|
] });
|
|
8512
8661
|
}
|
|
8513
8662
|
var TABS = [
|
|
@@ -8517,14 +8666,14 @@ var TABS = [
|
|
|
8517
8666
|
{ id: "history", label: "Hist\xF3rico" }
|
|
8518
8667
|
];
|
|
8519
8668
|
function CoreOmieIntegration() {
|
|
8520
|
-
const [tab, setTab] =
|
|
8521
|
-
return /* @__PURE__ */
|
|
8522
|
-
/* @__PURE__ */
|
|
8523
|
-
/* @__PURE__ */
|
|
8524
|
-
/* @__PURE__ */
|
|
8669
|
+
const [tab, setTab] = useState24("configuration");
|
|
8670
|
+
return /* @__PURE__ */ jsxs33(Stack14, { gap: 5, children: [
|
|
8671
|
+
/* @__PURE__ */ jsxs33(Box32, { children: [
|
|
8672
|
+
/* @__PURE__ */ jsx49(Heading21, { size: "lg", children: "Integra\xE7\xE3o Omie" }),
|
|
8673
|
+
/* @__PURE__ */ jsx49(Text33, { color: "gray.500", children: "Configure credenciais, sincroniza\xE7\xF5es, webhooks, gatilhos e diagn\xF3sticos da inst\xE2ncia Omie." })
|
|
8525
8674
|
] }),
|
|
8526
|
-
/* @__PURE__ */
|
|
8527
|
-
|
|
8675
|
+
/* @__PURE__ */ jsx49(Flex24, { gap: 2, wrap: "wrap", borderBottomWidth: "1px", pb: 2, children: TABS.map((item) => /* @__PURE__ */ jsx49(
|
|
8676
|
+
Button24,
|
|
8528
8677
|
{
|
|
8529
8678
|
size: "sm",
|
|
8530
8679
|
variant: tab === item.id ? "solid" : "ghost",
|
|
@@ -8533,21 +8682,21 @@ function CoreOmieIntegration() {
|
|
|
8533
8682
|
},
|
|
8534
8683
|
item.id
|
|
8535
8684
|
)) }),
|
|
8536
|
-
tab === "configuration" ? /* @__PURE__ */
|
|
8537
|
-
tab === "synchronization" ? /* @__PURE__ */
|
|
8538
|
-
tab === "webhooks" ? /* @__PURE__ */
|
|
8539
|
-
tab === "history" ? /* @__PURE__ */
|
|
8685
|
+
tab === "configuration" ? /* @__PURE__ */ jsx49(OmieConfigurationTab, {}) : null,
|
|
8686
|
+
tab === "synchronization" ? /* @__PURE__ */ jsx49(OmieSynchronizationTab, {}) : null,
|
|
8687
|
+
tab === "webhooks" ? /* @__PURE__ */ jsx49(OmieWebhooksTab, {}) : null,
|
|
8688
|
+
tab === "history" ? /* @__PURE__ */ jsx49(OmieHistoryTab, {}) : null
|
|
8540
8689
|
] });
|
|
8541
8690
|
}
|
|
8542
8691
|
|
|
8543
8692
|
// src/components/CoreOmieIntegrationWorkspace.tsx
|
|
8544
|
-
import { jsx as
|
|
8693
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8545
8694
|
function CoreOmieIntegrationWorkspace() {
|
|
8546
|
-
const [view, setView] =
|
|
8547
|
-
return /* @__PURE__ */
|
|
8548
|
-
/* @__PURE__ */
|
|
8549
|
-
/* @__PURE__ */
|
|
8550
|
-
|
|
8695
|
+
const [view, setView] = useState25("integration");
|
|
8696
|
+
return /* @__PURE__ */ jsxs34(Stack15, { gap: 4, children: [
|
|
8697
|
+
/* @__PURE__ */ jsxs34(Flex25, { gap: 2, wrap: "wrap", borderBottomWidth: "1px", pb: 2, children: [
|
|
8698
|
+
/* @__PURE__ */ jsx50(
|
|
8699
|
+
Button25,
|
|
8551
8700
|
{
|
|
8552
8701
|
size: "sm",
|
|
8553
8702
|
variant: view === "integration" ? "solid" : "ghost",
|
|
@@ -8555,8 +8704,8 @@ function CoreOmieIntegrationWorkspace() {
|
|
|
8555
8704
|
children: "Integra\xE7\xE3o Omie"
|
|
8556
8705
|
}
|
|
8557
8706
|
),
|
|
8558
|
-
/* @__PURE__ */
|
|
8559
|
-
|
|
8707
|
+
/* @__PURE__ */ jsx50(
|
|
8708
|
+
Button25,
|
|
8560
8709
|
{
|
|
8561
8710
|
size: "sm",
|
|
8562
8711
|
variant: view === "tickets" ? "solid" : "ghost",
|
|
@@ -8565,17 +8714,17 @@ function CoreOmieIntegrationWorkspace() {
|
|
|
8565
8714
|
}
|
|
8566
8715
|
)
|
|
8567
8716
|
] }),
|
|
8568
|
-
view === "integration" ? /* @__PURE__ */
|
|
8569
|
-
view === "tickets" ? /* @__PURE__ */
|
|
8717
|
+
view === "integration" ? /* @__PURE__ */ jsx50(CoreOmieIntegration, {}) : null,
|
|
8718
|
+
view === "tickets" ? /* @__PURE__ */ jsx50(CoreIntegrationTickets, { provider: "omie" }) : null
|
|
8570
8719
|
] });
|
|
8571
8720
|
}
|
|
8572
8721
|
|
|
8573
8722
|
// src/modules/integrations.tsx
|
|
8574
|
-
import { jsx as
|
|
8723
|
+
import { jsx as jsx51, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8575
8724
|
function CoreIntegrationPage() {
|
|
8576
|
-
return /* @__PURE__ */
|
|
8577
|
-
/* @__PURE__ */
|
|
8578
|
-
/* @__PURE__ */
|
|
8725
|
+
return /* @__PURE__ */ jsxs35(Stack16, { gap: 8, children: [
|
|
8726
|
+
/* @__PURE__ */ jsx51(CoreIntegration, {}),
|
|
8727
|
+
/* @__PURE__ */ jsx51(CoreIntegrationMappings, {})
|
|
8579
8728
|
] });
|
|
8580
8729
|
}
|
|
8581
8730
|
function createIntegrationModule() {
|
|
@@ -8585,17 +8734,17 @@ function createIntegrationModule() {
|
|
|
8585
8734
|
routes: [
|
|
8586
8735
|
{
|
|
8587
8736
|
path: "/integracoes",
|
|
8588
|
-
element: /* @__PURE__ */
|
|
8737
|
+
element: /* @__PURE__ */ jsx51(CoreIntegrationPage, {}),
|
|
8589
8738
|
capabilities: ["core.integrations"]
|
|
8590
8739
|
},
|
|
8591
8740
|
{
|
|
8592
8741
|
path: "/configuracoes/integracao-omie",
|
|
8593
|
-
element: /* @__PURE__ */
|
|
8742
|
+
element: /* @__PURE__ */ jsx51(CoreOmieIntegrationWorkspace, {}),
|
|
8594
8743
|
capabilities: ["core.integrations", "core.integrations.omie"]
|
|
8595
8744
|
},
|
|
8596
8745
|
{
|
|
8597
8746
|
path: "/configuracoes/integracao-omie/tickets",
|
|
8598
|
-
element: /* @__PURE__ */
|
|
8747
|
+
element: /* @__PURE__ */ jsx51(CoreIntegrationTickets, { provider: "omie" }),
|
|
8599
8748
|
capabilities: ["core.integrations", "core.integrations.omie"]
|
|
8600
8749
|
}
|
|
8601
8750
|
],
|
|
@@ -8626,6 +8775,7 @@ function startCentralFromManifest(manifest, runtime) {
|
|
|
8626
8775
|
app.schemaVersion = manifest.app.schemaVersion;
|
|
8627
8776
|
app.modules = manifest.app.modules;
|
|
8628
8777
|
app.capabilities = manifest.app.capabilities;
|
|
8778
|
+
app.capabilitySettings = manifest.app.capabilitySettings;
|
|
8629
8779
|
app.compatibility = manifest.app.compatibility;
|
|
8630
8780
|
start(config);
|
|
8631
8781
|
return config;
|
|
@@ -8649,36 +8799,36 @@ function defineOonModule(mod) {
|
|
|
8649
8799
|
}
|
|
8650
8800
|
|
|
8651
8801
|
// src/components/CoreCurrency.tsx
|
|
8652
|
-
import { Button as
|
|
8653
|
-
import { useMutation as
|
|
8654
|
-
import { jsx as
|
|
8802
|
+
import { Button as Button26, Flex as Flex26, Heading as Heading22, Stack as Stack17, Text as Text34 } from "@chakra-ui/react";
|
|
8803
|
+
import { useMutation as useMutation9, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
8804
|
+
import { jsx as jsx52, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8655
8805
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
8656
8806
|
const { http } = useOonApi();
|
|
8657
|
-
const queryClient =
|
|
8658
|
-
const updateRates =
|
|
8807
|
+
const queryClient = useQueryClient8();
|
|
8808
|
+
const updateRates = useMutation9({
|
|
8659
8809
|
mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
|
|
8660
8810
|
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
|
|
8661
8811
|
});
|
|
8662
|
-
return /* @__PURE__ */
|
|
8663
|
-
/* @__PURE__ */
|
|
8664
|
-
/* @__PURE__ */
|
|
8665
|
-
/* @__PURE__ */
|
|
8812
|
+
return /* @__PURE__ */ jsxs36(Stack17, { gap: 6, children: [
|
|
8813
|
+
/* @__PURE__ */ jsxs36(Flex26, { align: "center", justify: "space-between", children: [
|
|
8814
|
+
/* @__PURE__ */ jsx52(Heading22, { size: "lg", children: label }),
|
|
8815
|
+
/* @__PURE__ */ jsx52(Button26, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
8666
8816
|
] }),
|
|
8667
|
-
updateRates.isError ? /* @__PURE__ */
|
|
8668
|
-
/* @__PURE__ */
|
|
8817
|
+
updateRates.isError ? /* @__PURE__ */ jsx52(Text34, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
8818
|
+
/* @__PURE__ */ jsx52(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
8669
8819
|
] });
|
|
8670
8820
|
}
|
|
8671
8821
|
|
|
8672
8822
|
// src/components/CoreAssistant.tsx
|
|
8673
|
-
import { useState as
|
|
8674
|
-
import { Box as
|
|
8675
|
-
import { useMutation as
|
|
8676
|
-
import { jsx as
|
|
8823
|
+
import { useState as useState26 } from "react";
|
|
8824
|
+
import { Box as Box33, Button as Button27, Flex as Flex27, Heading as Heading23, Input as Input17, Stack as Stack18, Text as Text35 } from "@chakra-ui/react";
|
|
8825
|
+
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
8826
|
+
import { jsx as jsx53, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8677
8827
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
8678
8828
|
const { http } = useOonApi();
|
|
8679
|
-
const [messages, setMessages] =
|
|
8680
|
-
const [input, setInput] =
|
|
8681
|
-
const ask =
|
|
8829
|
+
const [messages, setMessages] = useState26([]);
|
|
8830
|
+
const [input, setInput] = useState26("");
|
|
8831
|
+
const ask = useMutation10({
|
|
8682
8832
|
mutationFn: async (message) => {
|
|
8683
8833
|
const { data } = await http.post(
|
|
8684
8834
|
endpoint,
|
|
@@ -8702,11 +8852,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
8702
8852
|
setInput("");
|
|
8703
8853
|
ask.mutate(text);
|
|
8704
8854
|
};
|
|
8705
|
-
return /* @__PURE__ */
|
|
8706
|
-
/* @__PURE__ */
|
|
8707
|
-
/* @__PURE__ */
|
|
8708
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
8709
|
-
|
|
8855
|
+
return /* @__PURE__ */ jsxs37(Stack18, { gap: 4, maxW: "560px", children: [
|
|
8856
|
+
/* @__PURE__ */ jsx53(Heading23, { size: "md", children: label }),
|
|
8857
|
+
/* @__PURE__ */ jsx53(Box33, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs37(Stack18, { gap: 3, children: [
|
|
8858
|
+
messages.length === 0 ? /* @__PURE__ */ jsx53(Text35, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx53(Flex27, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx53(
|
|
8859
|
+
Box33,
|
|
8710
8860
|
{
|
|
8711
8861
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
8712
8862
|
color: m.role === "user" ? "white" : "gray.800",
|
|
@@ -8718,12 +8868,12 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
8718
8868
|
children: m.content
|
|
8719
8869
|
}
|
|
8720
8870
|
) }, idx)),
|
|
8721
|
-
ask.isPending ? /* @__PURE__ */
|
|
8722
|
-
ask.isError ? /* @__PURE__ */
|
|
8871
|
+
ask.isPending ? /* @__PURE__ */ jsx53(Text35, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
|
|
8872
|
+
ask.isError ? /* @__PURE__ */ jsx53(Text35, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
|
|
8723
8873
|
] }) }),
|
|
8724
|
-
/* @__PURE__ */
|
|
8725
|
-
/* @__PURE__ */
|
|
8726
|
-
|
|
8874
|
+
/* @__PURE__ */ jsxs37(Flex27, { gap: 2, children: [
|
|
8875
|
+
/* @__PURE__ */ jsx53(
|
|
8876
|
+
Input17,
|
|
8727
8877
|
{
|
|
8728
8878
|
size: "sm",
|
|
8729
8879
|
value: input,
|
|
@@ -8734,7 +8884,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
8734
8884
|
}
|
|
8735
8885
|
}
|
|
8736
8886
|
),
|
|
8737
|
-
/* @__PURE__ */
|
|
8887
|
+
/* @__PURE__ */ jsx53(Button27, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
|
|
8738
8888
|
] })
|
|
8739
8889
|
] });
|
|
8740
8890
|
}
|
|
@@ -8758,6 +8908,7 @@ export {
|
|
|
8758
8908
|
CorePipeline,
|
|
8759
8909
|
CoreRelationField,
|
|
8760
8910
|
CoreToolbar,
|
|
8911
|
+
CoreTransactionalEmail,
|
|
8761
8912
|
CoreUsersAccess,
|
|
8762
8913
|
DomainExpressionError,
|
|
8763
8914
|
PermissionGate,
|