@oondemand/oon-core-front 0.3.56 → 0.3.57
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 +5 -5
- package/dist/index.js +201 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -927,12 +927,12 @@ declare function CorePipeline({ model, label, endpoint, stageField, stages, titl
|
|
|
927
927
|
interface CoreIntegrationProps {
|
|
928
928
|
label?: string;
|
|
929
929
|
}
|
|
930
|
-
/**
|
|
931
|
-
* Painel de integrações: lista o que o back declarou em /core/integrations e
|
|
932
|
-
* permite reprocessar via action RESTful (POST /integrations/actions/process-active).
|
|
933
|
-
*/
|
|
930
|
+
/** Painel operacional padrão da engine de integrações. */
|
|
934
931
|
declare function CoreIntegration({ label }: CoreIntegrationProps): react.JSX.Element;
|
|
935
932
|
|
|
933
|
+
/** Módulo operacional nativo habilitado por central.app.json.modules.integrations. */
|
|
934
|
+
declare function createIntegrationModule(): OonModule;
|
|
935
|
+
|
|
936
936
|
interface CoreCurrencyProps {
|
|
937
937
|
/** model das moedas. Default: "Moeda". */
|
|
938
938
|
model?: string;
|
|
@@ -1105,4 +1105,4 @@ declare function useCoreMetadata(): _tanstack_react_query.UseQueryResult<NoInfer
|
|
|
1105
1105
|
/** Descrição de uma model específica — base do modo "dynamic". */
|
|
1106
1106
|
declare function useModelSchema(name: string): _tanstack_react_query.UseQueryResult<NoInfer<ModelSummary>, Error>;
|
|
1107
1107
|
|
|
1108
|
-
export { type CentralAppManifest, type CentralFormFieldDef, type CentralManifestBundle, type CentralUiManifest, type CentralUiOnlyManifest, type CollectionMode, type CollectionViewDef, CoreActions, CoreAssistant, CoreCards, CoreCollection, CoreCurrency, CoreDashboard, CoreDataGrid, CoreDocument, CoreEmptyState, CoreField, CoreForm, CoreIntegration, CoreLoadingState, type CoreMetadata, CorePage, CorePageHeader, CorePipeline, CoreRelationField, CoreToolbar, type DashboardViewDef, type DashboardWidgetDef, type DocumentViewDef, DomainExpressionError, type FieldKind, type FieldMeta, type ListParams, type ManifestRuntime, type ModelSummary, type OonActionDef, type OonApiConfig, type OonAppConfig, type OonAppKind, type OonAuthConfig, type OonAuthMode, type OonBlockDef, type OonColumnDef, type OonComponentRegistry, type OonComputedFieldDefinition, type OonCoreFrontConfig, type OonDomainExpression, type OonDomainExpressionOperator, type OonError, type OonFormFieldDef, type OonLayoutConfig, type OonMenuItem, type OonModule, type OonNavigationConfig, type OonNavigationMode, type OonPageDef, type OonPipelineActionDef, type OonPipelineActionGroup, type OonPipelineActionTone, type OonPipelineDefaultActionsConfig, type OonPipelineDefaultActionsDef, type OonPipelineTicketModalConfig, type OonPipelineViewDef, type OonReactiveFormField, type OonRoute, type OonSchemaVersion, type OonSecurityConfig, type OonUiManifest, type OonUser, type OonViewDefinition, type PaginatedResult, type Pagination, PermissionGate, type PipelineViewDef, type ReactiveFormulaResult, applyReactiveFormulas, buildDomainMutationPayload, coerceDomainFormValue, defineCollectionView, defineDashboard, defineDocumentView, defineOonModule, definePipelineView, evaluateDomainExpression, manifestToConfig, oonCoreFront, start, startCentralFromManifest, startFromManifest, useCoreMetadata, useModelSchema, useOonApi, useOonAuth, useOonResource };
|
|
1108
|
+
export { type CentralAppManifest, type CentralFormFieldDef, type CentralManifestBundle, type CentralUiManifest, type CentralUiOnlyManifest, type CollectionMode, type CollectionViewDef, CoreActions, CoreAssistant, CoreCards, CoreCollection, CoreCurrency, CoreDashboard, CoreDataGrid, CoreDocument, CoreEmptyState, CoreField, CoreForm, CoreIntegration, CoreLoadingState, type CoreMetadata, CorePage, CorePageHeader, CorePipeline, CoreRelationField, CoreToolbar, type DashboardViewDef, type DashboardWidgetDef, type DocumentViewDef, DomainExpressionError, type FieldKind, type FieldMeta, type ListParams, type ManifestRuntime, type ModelSummary, type OonActionDef, type OonApiConfig, type OonAppConfig, type OonAppKind, type OonAuthConfig, type OonAuthMode, type OonBlockDef, type OonColumnDef, type OonComponentRegistry, type OonComputedFieldDefinition, type OonCoreFrontConfig, type OonDomainExpression, type OonDomainExpressionOperator, type OonError, type OonFormFieldDef, type OonLayoutConfig, type OonMenuItem, type OonModule, type OonNavigationConfig, type OonNavigationMode, type OonPageDef, type OonPipelineActionDef, type OonPipelineActionGroup, type OonPipelineActionTone, type OonPipelineDefaultActionsConfig, type OonPipelineDefaultActionsDef, type OonPipelineTicketModalConfig, type OonPipelineViewDef, type OonReactiveFormField, type OonRoute, type OonSchemaVersion, type OonSecurityConfig, type OonUiManifest, type OonUser, type OonViewDefinition, type PaginatedResult, type Pagination, PermissionGate, type PipelineViewDef, type ReactiveFormulaResult, applyReactiveFormulas, buildDomainMutationPayload, coerceDomainFormValue, createIntegrationModule, defineCollectionView, defineDashboard, defineDocumentView, defineOonModule, definePipelineView, evaluateDomainExpression, manifestToConfig, oonCoreFront, start, startCentralFromManifest, startFromManifest, useCoreMetadata, useModelSchema, useOonApi, useOonAuth, useOonResource };
|
package/dist/index.js
CHANGED
|
@@ -4473,7 +4473,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4473
4473
|
// package.json
|
|
4474
4474
|
var package_default = {
|
|
4475
4475
|
name: "@oondemand/oon-core-front",
|
|
4476
|
-
version: "0.3.
|
|
4476
|
+
version: "0.3.57",
|
|
4477
4477
|
repository: {
|
|
4478
4478
|
type: "git",
|
|
4479
4479
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -5763,6 +5763,189 @@ function startFromManifest(manifest, runtime) {
|
|
|
5763
5763
|
start(manifestToConfig(manifest, runtime));
|
|
5764
5764
|
}
|
|
5765
5765
|
|
|
5766
|
+
// src/components/CoreIntegration.tsx
|
|
5767
|
+
import { Badge as Badge5, Box as Box22, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text23 } from "@chakra-ui/react";
|
|
5768
|
+
import { useMutation as useMutation4, useQuery as useQuery8 } from "@tanstack/react-query";
|
|
5769
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5770
|
+
function dateTime(value2) {
|
|
5771
|
+
if (!value2) return "\u2014";
|
|
5772
|
+
const date = new Date(value2);
|
|
5773
|
+
return Number.isNaN(date.getTime()) ? value2 : date.toLocaleString("pt-BR");
|
|
5774
|
+
}
|
|
5775
|
+
function statusPalette(status) {
|
|
5776
|
+
const normalized2 = String(status || "").toLowerCase();
|
|
5777
|
+
if (normalized2.includes("erro") || normalized2.includes("inativo")) return "red";
|
|
5778
|
+
if (normalized2.includes("process") || normalized2.includes("tempor\xE1rio")) return "yellow";
|
|
5779
|
+
if (normalized2.includes("conclu\xEDdo") || normalized2.includes("ativo")) return "green";
|
|
5780
|
+
return "gray";
|
|
5781
|
+
}
|
|
5782
|
+
function countActive(values) {
|
|
5783
|
+
if (!values) return 0;
|
|
5784
|
+
return Object.entries(values).filter(([status]) => !["Conclu\xEDdo", "Arquivado"].includes(status)).reduce((sum, [, count]) => sum + Number(count || 0), 0);
|
|
5785
|
+
}
|
|
5786
|
+
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
5787
|
+
const { http } = useOonApi();
|
|
5788
|
+
const providers = useQuery8({
|
|
5789
|
+
queryKey: ["core-integrations", "health"],
|
|
5790
|
+
queryFn: async () => (await http.get("/integrations/health")).data?.results ?? []
|
|
5791
|
+
});
|
|
5792
|
+
const queue = useQuery8({
|
|
5793
|
+
queryKey: ["core-integrations", "queue"],
|
|
5794
|
+
queryFn: async () => (await http.get("/integrations/queue", { params: { limit: 20 } })).data?.results ?? []
|
|
5795
|
+
});
|
|
5796
|
+
const history = useQuery8({
|
|
5797
|
+
queryKey: ["core-integrations", "history"],
|
|
5798
|
+
queryFn: async () => (await http.get("/integrations/history", { params: { limit: 10 } })).data?.results ?? []
|
|
5799
|
+
});
|
|
5800
|
+
const refresh = async () => {
|
|
5801
|
+
await Promise.all([providers.refetch(), queue.refetch(), history.refetch()]);
|
|
5802
|
+
};
|
|
5803
|
+
const process = useMutation4({
|
|
5804
|
+
mutationFn: () => http.post(
|
|
5805
|
+
"/integrations/actions/process-active",
|
|
5806
|
+
{},
|
|
5807
|
+
{ headers: { "x-oon-origin": "integration" } }
|
|
5808
|
+
),
|
|
5809
|
+
onSuccess: refresh
|
|
5810
|
+
});
|
|
5811
|
+
const syncAll = useMutation4({
|
|
5812
|
+
mutationFn: (provider) => http.post(
|
|
5813
|
+
`/integrations/providers/${provider}/sync-all`,
|
|
5814
|
+
{},
|
|
5815
|
+
{ headers: { "x-oon-origin": "integration" } }
|
|
5816
|
+
),
|
|
5817
|
+
onSuccess: refresh
|
|
5818
|
+
});
|
|
5819
|
+
const reprocess = useMutation4({
|
|
5820
|
+
mutationFn: (id) => http.post(
|
|
5821
|
+
`/integrations/queue/${id}/reprocess`,
|
|
5822
|
+
{},
|
|
5823
|
+
{ headers: { "x-oon-origin": "integration" } }
|
|
5824
|
+
),
|
|
5825
|
+
onSuccess: refresh
|
|
5826
|
+
});
|
|
5827
|
+
const archive = useMutation4({
|
|
5828
|
+
mutationFn: (id) => http.post(
|
|
5829
|
+
`/integrations/queue/${id}/archive`,
|
|
5830
|
+
{},
|
|
5831
|
+
{ headers: { "x-oon-origin": "integration" } }
|
|
5832
|
+
),
|
|
5833
|
+
onSuccess: refresh
|
|
5834
|
+
});
|
|
5835
|
+
if (providers.isLoading || queue.isLoading || history.isLoading) return /* @__PURE__ */ jsx38(LoadingScreen, {});
|
|
5836
|
+
const error = providers.error || queue.error || history.error;
|
|
5837
|
+
if (error) return /* @__PURE__ */ jsx38(ErrorState, { error });
|
|
5838
|
+
return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
|
|
5839
|
+
/* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", gap: 4, wrap: "wrap", children: [
|
|
5840
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5841
|
+
/* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
|
|
5842
|
+
/* @__PURE__ */ jsx38(Text23, { color: "gray.500", children: "Sa\xFAde, filas, eventos e diagn\xF3stico sanitizado por provedor." })
|
|
5843
|
+
] }),
|
|
5844
|
+
/* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" })
|
|
5845
|
+
] }),
|
|
5846
|
+
/* @__PURE__ */ jsx38(Stack9, { gap: 3, children: (providers.data ?? []).length === 0 ? /* @__PURE__ */ jsx38(Text23, { color: "gray.400", children: "Nenhum provedor registrado." }) : providers.data?.map((provider) => /* @__PURE__ */ jsx38(Box22, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
|
|
5847
|
+
/* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
5848
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5849
|
+
/* @__PURE__ */ jsxs23(Flex14, { align: "center", gap: 2, children: [
|
|
5850
|
+
/* @__PURE__ */ jsx38(Text23, { fontWeight: "semibold", children: provider.label }),
|
|
5851
|
+
/* @__PURE__ */ jsx38(Badge5, { colorPalette: statusPalette(provider.status), children: provider.status ?? "\u2014" })
|
|
5852
|
+
] }),
|
|
5853
|
+
provider.description ? /* @__PURE__ */ jsx38(Text23, { color: "gray.500", fontSize: "sm", children: provider.description }) : null
|
|
5854
|
+
] }),
|
|
5855
|
+
/* @__PURE__ */ jsx38(Button15, { size: "xs", variant: "outline", loading: syncAll.isPending, onClick: () => syncAll.mutate(provider.key), children: "Sincronizar tudo" })
|
|
5856
|
+
] }),
|
|
5857
|
+
/* @__PURE__ */ jsxs23(Flex14, { gap: 3, wrap: "wrap", children: [
|
|
5858
|
+
/* @__PURE__ */ jsxs23(Badge5, { colorPalette: countActive(provider.queue) ? "yellow" : "green", children: [
|
|
5859
|
+
"Fila ativa: ",
|
|
5860
|
+
countActive(provider.queue)
|
|
5861
|
+
] }),
|
|
5862
|
+
/* @__PURE__ */ jsxs23(Badge5, { colorPalette: countActive(provider.inbox) ? "yellow" : "green", children: [
|
|
5863
|
+
"Eventos ativos: ",
|
|
5864
|
+
countActive(provider.inbox)
|
|
5865
|
+
] }),
|
|
5866
|
+
/* @__PURE__ */ jsxs23(Badge5, { colorPalette: statusPalette(provider.lastExecution?.status), children: [
|
|
5867
|
+
"\xDAltima execu\xE7\xE3o: ",
|
|
5868
|
+
provider.lastExecution?.status ?? "sem hist\xF3rico"
|
|
5869
|
+
] })
|
|
5870
|
+
] }),
|
|
5871
|
+
/* @__PURE__ */ jsxs23(Text23, { fontSize: "sm", color: "gray.500", children: [
|
|
5872
|
+
"Pend\xEAncia mais antiga: ",
|
|
5873
|
+
dateTime(provider.oldestPendingAt)
|
|
5874
|
+
] }),
|
|
5875
|
+
/* @__PURE__ */ jsx38(Flex14, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx38(Badge5, { variant: "outline", colorPalette: "blue", children: resource.label }, resource.key)) })
|
|
5876
|
+
] }) }, provider.key)) }),
|
|
5877
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5878
|
+
/* @__PURE__ */ jsx38(Heading12, { size: "md", mb: 3, children: "Fila recente" }),
|
|
5879
|
+
/* @__PURE__ */ jsx38(Stack9, { gap: 2, children: (queue.data ?? []).length === 0 ? /* @__PURE__ */ jsx38(Text23, { color: "gray.400", children: "Nenhum ticket de integra\xE7\xE3o." }) : queue.data?.map((ticket) => /* @__PURE__ */ jsx38(Box22, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
5880
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5881
|
+
/* @__PURE__ */ jsxs23(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
5882
|
+
/* @__PURE__ */ jsx38(Text23, { fontWeight: "medium", children: ticket.handler }),
|
|
5883
|
+
/* @__PURE__ */ jsx38(Badge5, { colorPalette: statusPalette(ticket.status), children: ticket.status }),
|
|
5884
|
+
/* @__PURE__ */ jsx38(Badge5, { variant: "outline", children: ticket.provider })
|
|
5885
|
+
] }),
|
|
5886
|
+
/* @__PURE__ */ jsxs23(Text23, { fontSize: "sm", color: "gray.500", children: [
|
|
5887
|
+
ticket.resource || "sem recurso",
|
|
5888
|
+
" \xB7 tentativas ",
|
|
5889
|
+
ticket.attempts,
|
|
5890
|
+
" \xB7 pr\xF3xima ",
|
|
5891
|
+
dateTime(ticket.nextAttemptAt)
|
|
5892
|
+
] }),
|
|
5893
|
+
ticket.lastError?.message ? /* @__PURE__ */ jsx38(Text23, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
|
|
5894
|
+
] }),
|
|
5895
|
+
/* @__PURE__ */ jsxs23(Flex14, { gap: 2, children: [
|
|
5896
|
+
["Erro tempor\xE1rio", "Erro definitivo", "Arquivado"].includes(ticket.status) ? /* @__PURE__ */ jsx38(Button15, { size: "xs", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(ticket._id), children: "Reprocessar" }) : null,
|
|
5897
|
+
["Erro tempor\xE1rio", "Erro definitivo"].includes(ticket.status) ? /* @__PURE__ */ jsx38(Button15, { size: "xs", variant: "outline", loading: archive.isPending, onClick: () => archive.mutate(ticket._id), children: "Arquivar" }) : null
|
|
5898
|
+
] })
|
|
5899
|
+
] }) }, ticket._id)) })
|
|
5900
|
+
] }),
|
|
5901
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5902
|
+
/* @__PURE__ */ jsx38(Heading12, { size: "md", mb: 3, children: "Hist\xF3rico" }),
|
|
5903
|
+
/* @__PURE__ */ jsx38(Stack9, { gap: 2, children: (history.data ?? []).length === 0 ? /* @__PURE__ */ jsx38(Text23, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o registrada." }) : history.data?.map((execution) => /* @__PURE__ */ jsx38(Box22, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
|
|
5904
|
+
/* @__PURE__ */ jsxs23(Box22, { children: [
|
|
5905
|
+
/* @__PURE__ */ jsx38(Text23, { fontWeight: "medium", children: execution.title }),
|
|
5906
|
+
/* @__PURE__ */ jsxs23(Text23, { fontSize: "sm", color: "gray.500", children: [
|
|
5907
|
+
execution.provider,
|
|
5908
|
+
" \xB7 ",
|
|
5909
|
+
execution.resource || "sem recurso",
|
|
5910
|
+
" \xB7 ",
|
|
5911
|
+
dateTime(execution.startedAt),
|
|
5912
|
+
" \xB7 ",
|
|
5913
|
+
execution.durationMs ?? 0,
|
|
5914
|
+
" ms"
|
|
5915
|
+
] }),
|
|
5916
|
+
execution.error?.message ? /* @__PURE__ */ jsx38(Text23, { fontSize: "sm", color: "red.600", children: execution.error.message }) : null
|
|
5917
|
+
] }),
|
|
5918
|
+
/* @__PURE__ */ jsx38(Badge5, { colorPalette: statusPalette(execution.status), children: execution.status })
|
|
5919
|
+
] }) }, execution._id)) })
|
|
5920
|
+
] })
|
|
5921
|
+
] });
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
// src/modules/integrations.tsx
|
|
5925
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5926
|
+
function createIntegrationModule() {
|
|
5927
|
+
return {
|
|
5928
|
+
id: "core.integrations",
|
|
5929
|
+
label: "Integra\xE7\xF5es",
|
|
5930
|
+
routes: [
|
|
5931
|
+
{
|
|
5932
|
+
path: "/integracoes",
|
|
5933
|
+
element: /* @__PURE__ */ jsx39(CoreIntegration, {}),
|
|
5934
|
+
capabilities: ["core.integrations"]
|
|
5935
|
+
}
|
|
5936
|
+
],
|
|
5937
|
+
menu: [
|
|
5938
|
+
{
|
|
5939
|
+
label: "Integra\xE7\xF5es",
|
|
5940
|
+
href: "/integracoes",
|
|
5941
|
+
section: "Integra\xE7\xF5es",
|
|
5942
|
+
order: 800,
|
|
5943
|
+
capabilities: ["core.integrations"]
|
|
5944
|
+
}
|
|
5945
|
+
]
|
|
5946
|
+
};
|
|
5947
|
+
}
|
|
5948
|
+
|
|
5766
5949
|
// src/appManifest.ts
|
|
5767
5950
|
function startCentralFromManifest(manifest, runtime) {
|
|
5768
5951
|
const legacyCompatibleUi = {
|
|
@@ -5772,6 +5955,9 @@ function startCentralFromManifest(manifest, runtime) {
|
|
|
5772
5955
|
appKind: manifest.app.appKind
|
|
5773
5956
|
};
|
|
5774
5957
|
const config = manifestToConfig(legacyCompatibleUi, runtime);
|
|
5958
|
+
if (manifest.app.modules.integrations) {
|
|
5959
|
+
config.modules = [...config.modules ?? [], createIntegrationModule()];
|
|
5960
|
+
}
|
|
5775
5961
|
config.app = {
|
|
5776
5962
|
...config.app,
|
|
5777
5963
|
id: manifest.app.id,
|
|
@@ -5805,46 +5991,10 @@ function defineOonModule(mod) {
|
|
|
5805
5991
|
return mod;
|
|
5806
5992
|
}
|
|
5807
5993
|
|
|
5808
|
-
// src/components/CoreIntegration.tsx
|
|
5809
|
-
import { Badge as Badge5, Box as Box22, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text23 } from "@chakra-ui/react";
|
|
5810
|
-
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
5811
|
-
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5812
|
-
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
5813
|
-
const { http } = useOonApi();
|
|
5814
|
-
const metadata = useCoreMetadata();
|
|
5815
|
-
const reprocess = useMutation4({
|
|
5816
|
-
mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
|
|
5817
|
-
});
|
|
5818
|
-
if (metadata.isLoading) return /* @__PURE__ */ jsx38(LoadingScreen, {});
|
|
5819
|
-
if (metadata.isError) return /* @__PURE__ */ jsx38(ErrorState, { error: metadata.error });
|
|
5820
|
-
const integrations = metadata.data?.integrations ?? [];
|
|
5821
|
-
return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
|
|
5822
|
-
/* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5823
|
-
/* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
|
|
5824
|
-
/* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
|
|
5825
|
-
] }),
|
|
5826
|
-
/* @__PURE__ */ jsx38(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx38(Text23, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx38(
|
|
5827
|
-
Box22,
|
|
5828
|
-
{
|
|
5829
|
-
borderWidth: "1px",
|
|
5830
|
-
borderColor: "gray.200",
|
|
5831
|
-
borderRadius: "md",
|
|
5832
|
-
bg: "white",
|
|
5833
|
-
p: 4,
|
|
5834
|
-
children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
|
|
5835
|
-
/* @__PURE__ */ jsx38(Text23, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
|
|
5836
|
-
/* @__PURE__ */ jsx38(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
|
|
5837
|
-
] })
|
|
5838
|
-
},
|
|
5839
|
-
it.id ?? it.name ?? idx
|
|
5840
|
-
)) })
|
|
5841
|
-
] });
|
|
5842
|
-
}
|
|
5843
|
-
|
|
5844
5994
|
// src/components/CoreCurrency.tsx
|
|
5845
5995
|
import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
5846
5996
|
import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
5847
|
-
import { jsx as
|
|
5997
|
+
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5848
5998
|
function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
|
|
5849
5999
|
const { http } = useOonApi();
|
|
5850
6000
|
const queryClient = useQueryClient5();
|
|
@@ -5854,11 +6004,11 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5854
6004
|
});
|
|
5855
6005
|
return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
|
|
5856
6006
|
/* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
|
|
5857
|
-
/* @__PURE__ */
|
|
5858
|
-
/* @__PURE__ */
|
|
6007
|
+
/* @__PURE__ */ jsx40(Heading13, { size: "lg", children: label }),
|
|
6008
|
+
/* @__PURE__ */ jsx40(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
|
|
5859
6009
|
] }),
|
|
5860
|
-
updateRates.isError ? /* @__PURE__ */
|
|
5861
|
-
/* @__PURE__ */
|
|
6010
|
+
updateRates.isError ? /* @__PURE__ */ jsx40(Text24, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
|
|
6011
|
+
/* @__PURE__ */ jsx40(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
|
|
5862
6012
|
] });
|
|
5863
6013
|
}
|
|
5864
6014
|
|
|
@@ -5866,7 +6016,7 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
|
|
|
5866
6016
|
import { useState as useState14 } from "react";
|
|
5867
6017
|
import { Box as Box23, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input8, Stack as Stack11, Text as Text25 } from "@chakra-ui/react";
|
|
5868
6018
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
5869
|
-
import { jsx as
|
|
6019
|
+
import { jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5870
6020
|
function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
|
|
5871
6021
|
const { http } = useOonApi();
|
|
5872
6022
|
const [messages, setMessages] = useState14([]);
|
|
@@ -5896,9 +6046,9 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5896
6046
|
ask.mutate(text);
|
|
5897
6047
|
};
|
|
5898
6048
|
return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
|
|
5899
|
-
/* @__PURE__ */
|
|
5900
|
-
/* @__PURE__ */
|
|
5901
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
6049
|
+
/* @__PURE__ */ jsx41(Heading14, { size: "md", children: label }),
|
|
6050
|
+
/* @__PURE__ */ jsx41(Box23, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
|
|
6051
|
+
messages.length === 0 ? /* @__PURE__ */ jsx41(Text25, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx41(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx41(
|
|
5902
6052
|
Box23,
|
|
5903
6053
|
{
|
|
5904
6054
|
bg: m.role === "user" ? "brand.500" : "gray.100",
|
|
@@ -5911,11 +6061,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5911
6061
|
children: m.content
|
|
5912
6062
|
}
|
|
5913
6063
|
) }, idx)),
|
|
5914
|
-
ask.isPending ? /* @__PURE__ */
|
|
5915
|
-
ask.isError ? /* @__PURE__ */
|
|
6064
|
+
ask.isPending ? /* @__PURE__ */ jsx41(Text25, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
|
|
6065
|
+
ask.isError ? /* @__PURE__ */ jsx41(Text25, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
|
|
5916
6066
|
] }) }),
|
|
5917
6067
|
/* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
|
|
5918
|
-
/* @__PURE__ */
|
|
6068
|
+
/* @__PURE__ */ jsx41(
|
|
5919
6069
|
Input8,
|
|
5920
6070
|
{
|
|
5921
6071
|
size: "sm",
|
|
@@ -5927,7 +6077,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
|
|
|
5927
6077
|
}
|
|
5928
6078
|
}
|
|
5929
6079
|
),
|
|
5930
|
-
/* @__PURE__ */
|
|
6080
|
+
/* @__PURE__ */ jsx41(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
|
|
5931
6081
|
] })
|
|
5932
6082
|
] });
|
|
5933
6083
|
}
|
|
@@ -5955,6 +6105,7 @@ export {
|
|
|
5955
6105
|
applyReactiveFormulas,
|
|
5956
6106
|
buildDomainMutationPayload,
|
|
5957
6107
|
coerceDomainFormValue,
|
|
6108
|
+
createIntegrationModule,
|
|
5958
6109
|
defineCollectionView,
|
|
5959
6110
|
defineDashboard,
|
|
5960
6111
|
defineDocumentView,
|