@oondemand/oon-core-front 0.3.62 → 0.3.64
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 +53 -13
- package/dist/index.js +109 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -692,10 +692,28 @@ interface CentralFormFieldDef extends OonFormFieldDef {
|
|
|
692
692
|
/** Mantém somente opções em que estes campos estejam vazios/nulos. */
|
|
693
693
|
referenceEmptyFields?: string[];
|
|
694
694
|
}
|
|
695
|
+
type DashboardFilterPrimitive$1 = string | number | boolean | null;
|
|
696
|
+
type DashboardFilterValue$1 = DashboardFilterPrimitive$1 | {
|
|
697
|
+
eq?: DashboardFilterPrimitive$1;
|
|
698
|
+
ne?: DashboardFilterPrimitive$1;
|
|
699
|
+
in?: DashboardFilterPrimitive$1[];
|
|
700
|
+
nin?: DashboardFilterPrimitive$1[];
|
|
701
|
+
gt?: DashboardFilterPrimitive$1;
|
|
702
|
+
gte?: DashboardFilterPrimitive$1;
|
|
703
|
+
lt?: DashboardFilterPrimitive$1;
|
|
704
|
+
lte?: DashboardFilterPrimitive$1;
|
|
705
|
+
exists?: boolean;
|
|
706
|
+
};
|
|
707
|
+
type CentralDashboardWidget = Omit<DashboardWidgetDef, "kind"> & {
|
|
708
|
+
description?: string;
|
|
709
|
+
kind?: "count" | "sum" | "groupCount" | "groupSum" | "custom";
|
|
710
|
+
groupBy?: string;
|
|
711
|
+
filters?: Record<string, DashboardFilterValue$1>;
|
|
712
|
+
format?: "number" | "currency";
|
|
713
|
+
};
|
|
695
714
|
/**
|
|
696
|
-
* Schema do `central.ui.json` (Seção 9
|
|
697
|
-
*
|
|
698
|
-
* código de UI. O Core converte isto em `OonCoreFrontConfig`.
|
|
715
|
+
* Schema do `central.ui.json` (Seção 9). É o que o frontend consumidor
|
|
716
|
+
* carrega; a Central declara UI e o Core converte para rotas e componentes.
|
|
699
717
|
*/
|
|
700
718
|
interface CentralUiManifest {
|
|
701
719
|
name: string;
|
|
@@ -712,6 +730,15 @@ interface CentralUiManifest {
|
|
|
712
730
|
registry?: OonComponentRegistry;
|
|
713
731
|
navigation?: OonNavigationConfig;
|
|
714
732
|
pages?: OonPageDef[];
|
|
733
|
+
dashboards?: Array<{
|
|
734
|
+
id?: string;
|
|
735
|
+
label?: string;
|
|
736
|
+
path?: string;
|
|
737
|
+
section?: string;
|
|
738
|
+
hidden?: boolean;
|
|
739
|
+
order?: number;
|
|
740
|
+
widgets?: CentralDashboardWidget[];
|
|
741
|
+
}>;
|
|
715
742
|
collections?: Array<{
|
|
716
743
|
model: string;
|
|
717
744
|
mode?: CollectionMode;
|
|
@@ -783,11 +810,8 @@ interface ManifestRuntime {
|
|
|
783
810
|
/** Converte o manifesto declarativo + runtime em config do Core. */
|
|
784
811
|
declare function manifestToConfig(manifest: CentralUiManifest, runtime: ManifestRuntime): OonCoreFrontConfig;
|
|
785
812
|
/**
|
|
786
|
-
* Bootstrap a partir do `central.ui.json`. É a única linha que o
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
* import manifest from "../central.ui.json";
|
|
790
|
-
* startFromManifest(manifest, { apiBaseUrl: import.meta.env.VITE_API_URL });
|
|
813
|
+
* Bootstrap a partir do `central.ui.json`. É a única linha que o frontend
|
|
814
|
+
* consumidor precisa para carregar o manifesto da Central.
|
|
791
815
|
*/
|
|
792
816
|
declare function startFromManifest(manifest: CentralUiManifest, runtime: ManifestRuntime): void;
|
|
793
817
|
|
|
@@ -980,14 +1004,30 @@ interface CoreAssistantProps {
|
|
|
980
1004
|
*/
|
|
981
1005
|
declare function CoreAssistant({ assistantCode, label, entity, endpoint }: CoreAssistantProps): react.JSX.Element;
|
|
982
1006
|
|
|
1007
|
+
type DashboardFilterPrimitive = string | number | boolean | null;
|
|
1008
|
+
type DashboardFilterValue = DashboardFilterPrimitive | {
|
|
1009
|
+
eq?: DashboardFilterPrimitive;
|
|
1010
|
+
ne?: DashboardFilterPrimitive;
|
|
1011
|
+
in?: DashboardFilterPrimitive[];
|
|
1012
|
+
nin?: DashboardFilterPrimitive[];
|
|
1013
|
+
gt?: DashboardFilterPrimitive;
|
|
1014
|
+
gte?: DashboardFilterPrimitive;
|
|
1015
|
+
lt?: DashboardFilterPrimitive;
|
|
1016
|
+
lte?: DashboardFilterPrimitive;
|
|
1017
|
+
exists?: boolean;
|
|
1018
|
+
};
|
|
1019
|
+
type CoreDashboardWidget = Omit<DashboardWidgetDef, "kind"> & {
|
|
1020
|
+
description?: string;
|
|
1021
|
+
kind?: "count" | "sum" | "groupCount" | "groupSum" | "custom";
|
|
1022
|
+
groupBy?: string;
|
|
1023
|
+
filters?: Record<string, DashboardFilterValue>;
|
|
1024
|
+
format?: "number" | "currency";
|
|
1025
|
+
};
|
|
983
1026
|
interface CoreDashboardProps {
|
|
984
1027
|
label?: string;
|
|
985
|
-
widgets?:
|
|
1028
|
+
widgets?: CoreDashboardWidget[];
|
|
986
1029
|
}
|
|
987
|
-
/**
|
|
988
|
-
* Dashboard do Core: renderiza widgets registrados (count/sum por model ou
|
|
989
|
-
* render custom). Cache, loading e erro ficam no Core; a Central só declara.
|
|
990
|
-
*/
|
|
1030
|
+
/** Dashboard declarativo com agregações executadas integralmente no backend. */
|
|
991
1031
|
declare function CoreDashboard({ label, widgets }: CoreDashboardProps): react.JSX.Element;
|
|
992
1032
|
|
|
993
1033
|
declare function CorePage({ page, registry }: {
|
package/dist/index.js
CHANGED
|
@@ -4029,46 +4029,81 @@ function CorePipeline({
|
|
|
4029
4029
|
|
|
4030
4030
|
// src/components/CoreDashboard.tsx
|
|
4031
4031
|
import { Box as Box13, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text14 } from "@chakra-ui/react";
|
|
4032
|
-
import {
|
|
4032
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
4033
4033
|
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4034
|
+
function metricFormat(widget) {
|
|
4035
|
+
if (widget.format) return widget.format;
|
|
4036
|
+
return ["sum", "groupSum"].includes(widget.kind || "") ? "currency" : "number";
|
|
4037
|
+
}
|
|
4038
|
+
function formatMetric(value2, format2) {
|
|
4039
|
+
if (value2 == null || !Number.isFinite(Number(value2))) return "\u2014";
|
|
4040
|
+
if (format2 === "currency") {
|
|
4041
|
+
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2));
|
|
4042
|
+
}
|
|
4043
|
+
return new Intl.NumberFormat("pt-BR", { maximumFractionDigits: 2 }).format(Number(value2));
|
|
4044
|
+
}
|
|
4034
4045
|
function CoreDashboard({ label = "Dashboard", widgets = [] }) {
|
|
4035
|
-
const {
|
|
4036
|
-
const
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
}
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4046
|
+
const { http } = useOonApi();
|
|
4047
|
+
const remoteWidgets = widgets.filter((widget) => widget.kind !== "custom" && widget.model);
|
|
4048
|
+
const metricsQuery = useQuery8({
|
|
4049
|
+
queryKey: ["oon", "dashboard", remoteWidgets],
|
|
4050
|
+
enabled: remoteWidgets.length > 0,
|
|
4051
|
+
staleTime: 60 * 1e3,
|
|
4052
|
+
queryFn: async () => {
|
|
4053
|
+
const response = await http.post("/core/dashboard/query", {
|
|
4054
|
+
queries: remoteWidgets.map(({ id, model, kind, field, groupBy, filters }) => ({
|
|
4055
|
+
id,
|
|
4056
|
+
model,
|
|
4057
|
+
kind: kind || "count",
|
|
4058
|
+
field,
|
|
4059
|
+
groupBy,
|
|
4060
|
+
filters
|
|
4061
|
+
}))
|
|
4062
|
+
});
|
|
4063
|
+
return response.data?.results ?? [];
|
|
4064
|
+
}
|
|
4048
4065
|
});
|
|
4049
|
-
|
|
4066
|
+
const results = new Map((metricsQuery.data ?? []).map((result) => [result.id, result]));
|
|
4050
4067
|
return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
|
|
4051
|
-
/* @__PURE__ */
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4068
|
+
/* @__PURE__ */ jsxs14(Box13, { children: [
|
|
4069
|
+
/* @__PURE__ */ jsx20(Text14, { fontSize: "xs", fontWeight: "600", color: "brand.600", textTransform: "uppercase", letterSpacing: "0.08em", children: "Vis\xE3o geral" }),
|
|
4070
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "lg", children: label })
|
|
4071
|
+
] }),
|
|
4072
|
+
!widgets.length ? /* @__PURE__ */ jsx20(Text14, { color: "gray.500", children: "Nenhum indicador declarado." }) : null,
|
|
4073
|
+
/* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((widget) => {
|
|
4074
|
+
if (widget.kind === "custom" && widget.render) {
|
|
4075
|
+
return /* @__PURE__ */ jsx20(Box13, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "lg", bg: "white", p: 5, children: widget.render() }, widget.id);
|
|
4055
4076
|
}
|
|
4056
|
-
const
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4077
|
+
const result = results.get(widget.id);
|
|
4078
|
+
const grouped = ["groupCount", "groupSum"].includes(widget.kind || "");
|
|
4079
|
+
const format2 = metricFormat(widget);
|
|
4080
|
+
return /* @__PURE__ */ jsxs14(
|
|
4081
|
+
Box13,
|
|
4082
|
+
{
|
|
4083
|
+
gridColumn: grouped ? "1 / -1" : void 0,
|
|
4084
|
+
borderWidth: "1px",
|
|
4085
|
+
borderColor: "gray.200",
|
|
4086
|
+
borderRadius: "lg",
|
|
4087
|
+
bg: "white",
|
|
4088
|
+
p: 5,
|
|
4089
|
+
minH: grouped ? void 0 : "126px",
|
|
4090
|
+
children: [
|
|
4091
|
+
/* @__PURE__ */ jsx20(Text14, { fontSize: "sm", color: "gray.500", children: widget.label }),
|
|
4092
|
+
widget.description ? /* @__PURE__ */ jsx20(Text14, { fontSize: "xs", color: "gray.400", mt: 1, children: widget.description }) : null,
|
|
4093
|
+
metricsQuery.isLoading ? /* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 2, children: "\u2026" }) : null,
|
|
4094
|
+
metricsQuery.isError ? /* @__PURE__ */ jsx20(Text14, { color: "red.600", mt: 3, children: "N\xE3o foi poss\xEDvel carregar este indicador." }) : null,
|
|
4095
|
+
!metricsQuery.isLoading && !metricsQuery.isError && grouped ? /* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 3, mt: 4, children: (result?.groups ?? []).length ? result?.groups?.map((group) => /* @__PURE__ */ jsxs14(Box13, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: [
|
|
4096
|
+
/* @__PURE__ */ jsx20(Text14, { fontSize: "xs", color: "gray.500", children: group.key }),
|
|
4097
|
+
/* @__PURE__ */ jsx20(Heading6, { size: "md", mt: 1, children: formatMetric(group.value, format2) })
|
|
4098
|
+
] }, group.key)) : /* @__PURE__ */ jsx20(Text14, { color: "gray.500", children: "Nenhum ticket encontrado." }) }) : null,
|
|
4099
|
+
!metricsQuery.isLoading && !metricsQuery.isError && !grouped ? /* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 2, children: formatMetric(result?.value, format2) }) : null
|
|
4100
|
+
]
|
|
4101
|
+
},
|
|
4102
|
+
widget.id
|
|
4103
|
+
);
|
|
4062
4104
|
}) })
|
|
4063
4105
|
] });
|
|
4064
4106
|
}
|
|
4065
|
-
function formatWidget(value2, kind, field) {
|
|
4066
|
-
if (value2 == null) return "\u2014";
|
|
4067
|
-
if (kind === "sum" && field?.toLowerCase().includes("valor") || kind === "sum") {
|
|
4068
|
-
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2));
|
|
4069
|
-
}
|
|
4070
|
-
return String(value2);
|
|
4071
|
-
}
|
|
4072
4107
|
|
|
4073
4108
|
// src/components/ui-v2/CorePage.tsx
|
|
4074
4109
|
import { Box as Box16, Button as Button11, Flex as Flex10, Heading as Heading8, Stack as Stack7, Text as Text17 } from "@chakra-ui/react";
|
|
@@ -4359,7 +4394,7 @@ function pageToRoute(page, registry) {
|
|
|
4359
4394
|
};
|
|
4360
4395
|
}
|
|
4361
4396
|
function pageToMenu(page) {
|
|
4362
|
-
if (
|
|
4397
|
+
if (!page.label) return null;
|
|
4363
4398
|
return {
|
|
4364
4399
|
label: page.label,
|
|
4365
4400
|
href: page.path,
|
|
@@ -4367,18 +4402,21 @@ function pageToMenu(page) {
|
|
|
4367
4402
|
section: page.section,
|
|
4368
4403
|
permissions: requiredPermissions(page),
|
|
4369
4404
|
capabilities: page.capabilities,
|
|
4405
|
+
hidden: page.hidden,
|
|
4370
4406
|
order: page.order
|
|
4371
4407
|
};
|
|
4372
4408
|
}
|
|
4373
4409
|
function viewToMenu(view) {
|
|
4374
|
-
|
|
4410
|
+
const extended = view;
|
|
4375
4411
|
return {
|
|
4376
4412
|
label: viewLabel(view),
|
|
4377
4413
|
href: viewPath(view),
|
|
4378
4414
|
icon: view.icon,
|
|
4379
4415
|
section: view.section,
|
|
4380
4416
|
permissions: requiredPermissions(view),
|
|
4381
|
-
capabilities: "capabilities" in view ? view.capabilities : void 0
|
|
4417
|
+
capabilities: "capabilities" in view ? view.capabilities : void 0,
|
|
4418
|
+
hidden: extended.hidden,
|
|
4419
|
+
order: extended.order
|
|
4382
4420
|
};
|
|
4383
4421
|
}
|
|
4384
4422
|
function resolveRegistry(config) {
|
|
@@ -4400,8 +4438,7 @@ function resolveRegistry(config) {
|
|
|
4400
4438
|
for (const item of mod.menu ?? []) pushMenu(item);
|
|
4401
4439
|
for (const view of mod.views ?? []) {
|
|
4402
4440
|
pushRoute(viewToRoute(view, componentRegistry));
|
|
4403
|
-
|
|
4404
|
-
if (item) pushMenu(item);
|
|
4441
|
+
pushMenu(viewToMenu(view));
|
|
4405
4442
|
}
|
|
4406
4443
|
}
|
|
4407
4444
|
const navMode = config.ui?.navigation?.mode ?? "auto";
|
|
@@ -4410,8 +4447,7 @@ function resolveRegistry(config) {
|
|
|
4410
4447
|
if (includeAuto) {
|
|
4411
4448
|
for (const view of config.ui?.views ?? []) {
|
|
4412
4449
|
pushRoute(viewToRoute(view, componentRegistry));
|
|
4413
|
-
|
|
4414
|
-
if (item) pushMenu(item);
|
|
4450
|
+
pushMenu(viewToMenu(view));
|
|
4415
4451
|
}
|
|
4416
4452
|
for (const page of config.ui?.pages ?? []) {
|
|
4417
4453
|
pushRoute(pageToRoute(page, componentRegistry));
|
|
@@ -4541,7 +4577,7 @@ function Sidebar({ app, menu, registry }) {
|
|
|
4541
4577
|
// package.json
|
|
4542
4578
|
var package_default = {
|
|
4543
4579
|
name: "@oondemand/oon-core-front",
|
|
4544
|
-
version: "0.3.
|
|
4580
|
+
version: "0.3.64",
|
|
4545
4581
|
repository: {
|
|
4546
4582
|
type: "git",
|
|
4547
4583
|
url: "git+https://github.com/oondemand/oon-platform.git",
|
|
@@ -4726,7 +4762,7 @@ function CoreTopbar({ app, menu }) {
|
|
|
4726
4762
|
runtime.startedAt ? `Backend iniciado ${formatRuntimeDate(runtime.startedAt)}` : void 0
|
|
4727
4763
|
].filter(Boolean).join(" \xB7 ");
|
|
4728
4764
|
const settingsHref = resolveSettingsHref(
|
|
4729
|
-
menu.filter((item) =>
|
|
4765
|
+
menu.filter((item) => hasPermission(item.permissions))
|
|
4730
4766
|
);
|
|
4731
4767
|
return /* @__PURE__ */ jsxs19(
|
|
4732
4768
|
Flex12,
|
|
@@ -5796,6 +5832,19 @@ function mergeRegistry(manifestRegistry, runtimeRegistry, customComponents) {
|
|
|
5796
5832
|
}
|
|
5797
5833
|
function manifestToConfig(manifest, runtime) {
|
|
5798
5834
|
const views = [];
|
|
5835
|
+
for (const dashboard of manifest.dashboards ?? []) {
|
|
5836
|
+
const view = {
|
|
5837
|
+
type: "dashboard",
|
|
5838
|
+
id: dashboard.id,
|
|
5839
|
+
label: dashboard.label,
|
|
5840
|
+
path: dashboard.path,
|
|
5841
|
+
section: dashboard.section,
|
|
5842
|
+
hidden: dashboard.hidden,
|
|
5843
|
+
order: dashboard.order,
|
|
5844
|
+
widgets: dashboard.widgets
|
|
5845
|
+
};
|
|
5846
|
+
views.push(view);
|
|
5847
|
+
}
|
|
5799
5848
|
for (const c of manifest.collections ?? []) {
|
|
5800
5849
|
const view = {
|
|
5801
5850
|
type: "collection",
|
|
@@ -5898,7 +5947,7 @@ import { Stack as Stack12 } from "@chakra-ui/react";
|
|
|
5898
5947
|
// src/components/CoreIntegration.tsx
|
|
5899
5948
|
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
5900
5949
|
import { Badge as Badge5, Box as Box22, Button as Button16, Flex as Flex15, Heading as Heading12, Input as Input8, Stack as Stack9, Text as Text23 } from "@chakra-ui/react";
|
|
5901
|
-
import { useMutation as useMutation4, useQuery as
|
|
5950
|
+
import { useMutation as useMutation4, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
5902
5951
|
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5903
5952
|
function dateTime(value2) {
|
|
5904
5953
|
if (!value2) return "\u2014";
|
|
@@ -6071,11 +6120,11 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6071
6120
|
appSecret: "",
|
|
6072
6121
|
webhookToken: ""
|
|
6073
6122
|
});
|
|
6074
|
-
const configuration =
|
|
6123
|
+
const configuration = useQuery9({
|
|
6075
6124
|
queryKey: ["core-integrations", provider.key, "configuration"],
|
|
6076
6125
|
queryFn: async () => (await http.get(`/integrations/providers/${provider.key}/configuration`)).data?.instances ?? []
|
|
6077
6126
|
});
|
|
6078
|
-
const mappings =
|
|
6127
|
+
const mappings = useQuery9({
|
|
6079
6128
|
queryKey: ["core-integrations", provider.key, "mappings"],
|
|
6080
6129
|
queryFn: async () => (await http.get(`/integrations/providers/${provider.key}/mappings`)).data
|
|
6081
6130
|
});
|
|
@@ -6289,15 +6338,15 @@ function ProviderConfigurationPanel({ provider }) {
|
|
|
6289
6338
|
function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
6290
6339
|
const { http } = useOonApi();
|
|
6291
6340
|
const [expandedExecutionId, setExpandedExecutionId] = useState14(null);
|
|
6292
|
-
const providers =
|
|
6341
|
+
const providers = useQuery9({
|
|
6293
6342
|
queryKey: ["core-integrations", "health"],
|
|
6294
6343
|
queryFn: async () => (await http.get("/integrations/health")).data?.results ?? []
|
|
6295
6344
|
});
|
|
6296
|
-
const queue =
|
|
6345
|
+
const queue = useQuery9({
|
|
6297
6346
|
queryKey: ["core-integrations", "queue"],
|
|
6298
6347
|
queryFn: async () => (await http.get("/integrations/queue", { params: { limit: 20 } })).data?.results ?? []
|
|
6299
6348
|
});
|
|
6300
|
-
const history =
|
|
6349
|
+
const history = useQuery9({
|
|
6301
6350
|
queryKey: ["core-integrations", "history"],
|
|
6302
6351
|
queryFn: async () => (await http.get("/integrations/history", { params: { limit: 10 } })).data?.results ?? []
|
|
6303
6352
|
});
|
|
@@ -6469,7 +6518,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
|
|
|
6469
6518
|
|
|
6470
6519
|
// src/components/CoreIntegrationMappings.tsx
|
|
6471
6520
|
import { Badge as Badge6, Box as Box23, Flex as Flex16, Heading as Heading13, Stack as Stack10, Text as Text24 } from "@chakra-ui/react";
|
|
6472
|
-
import { useQuery as
|
|
6521
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
6473
6522
|
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6474
6523
|
function dateTime2(value2) {
|
|
6475
6524
|
if (!value2) return "sem execu\xE7\xE3o";
|
|
@@ -6478,12 +6527,12 @@ function dateTime2(value2) {
|
|
|
6478
6527
|
}
|
|
6479
6528
|
function CoreIntegrationMappings() {
|
|
6480
6529
|
const { http } = useOonApi();
|
|
6481
|
-
const providers =
|
|
6530
|
+
const providers = useQuery10({
|
|
6482
6531
|
queryKey: ["core-integrations", "providers"],
|
|
6483
6532
|
queryFn: async () => (await http.get("/integrations/providers")).data?.results ?? []
|
|
6484
6533
|
});
|
|
6485
6534
|
const providerKeys = (providers.data ?? []).map((provider) => provider.key).join(",");
|
|
6486
|
-
const summaries =
|
|
6535
|
+
const summaries = useQuery10({
|
|
6487
6536
|
queryKey: ["core-integrations", "mapping-summaries", providerKeys],
|
|
6488
6537
|
enabled: providers.isSuccess && providerKeys.length > 0,
|
|
6489
6538
|
queryFn: async () => Promise.all((providers.data ?? []).map(async (provider) => ({
|
|
@@ -6549,7 +6598,7 @@ function CoreIntegrationMappings() {
|
|
|
6549
6598
|
// src/components/CoreOmieIntegration.tsx
|
|
6550
6599
|
import { useEffect as useEffect10, useState as useState15 } from "react";
|
|
6551
6600
|
import { Badge as Badge7, Box as Box24, Button as Button17, Flex as Flex17, Heading as Heading14, Input as Input9, Stack as Stack11, Text as Text25 } from "@chakra-ui/react";
|
|
6552
|
-
import { useMutation as useMutation5, useQuery as
|
|
6601
|
+
import { useMutation as useMutation5, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
6553
6602
|
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6554
6603
|
function dateTime3(value2) {
|
|
6555
6604
|
if (!value2) return "\u2014";
|
|
@@ -6615,7 +6664,7 @@ function NativeSelect5({
|
|
|
6615
6664
|
}
|
|
6616
6665
|
function OmieConfigurationTab() {
|
|
6617
6666
|
const { http } = useOonApi();
|
|
6618
|
-
const configuration =
|
|
6667
|
+
const configuration = useQuery11({
|
|
6619
6668
|
queryKey: ["core-omie", "configuration"],
|
|
6620
6669
|
queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
|
|
6621
6670
|
});
|
|
@@ -6803,18 +6852,18 @@ function OmieConfigurationTab() {
|
|
|
6803
6852
|
}
|
|
6804
6853
|
function OmieSynchronizationTab() {
|
|
6805
6854
|
const { http } = useOonApi();
|
|
6806
|
-
const health =
|
|
6855
|
+
const health = useQuery11({
|
|
6807
6856
|
queryKey: ["core-omie", "health"],
|
|
6808
6857
|
queryFn: async () => {
|
|
6809
6858
|
const providers = (await http.get("/integrations/health")).data?.results ?? [];
|
|
6810
6859
|
return providers.find((provider2) => provider2.key === "omie") ?? null;
|
|
6811
6860
|
}
|
|
6812
6861
|
});
|
|
6813
|
-
const mappings =
|
|
6862
|
+
const mappings = useQuery11({
|
|
6814
6863
|
queryKey: ["core-omie", "mappings"],
|
|
6815
6864
|
queryFn: async () => (await http.get("/integrations/providers/omie/mappings")).data
|
|
6816
6865
|
});
|
|
6817
|
-
const queue =
|
|
6866
|
+
const queue = useQuery11({
|
|
6818
6867
|
queryKey: ["core-omie", "queue"],
|
|
6819
6868
|
queryFn: async () => (await http.get("/integrations/queue", {
|
|
6820
6869
|
params: { provider: "omie", limit: 20 }
|
|
@@ -6938,22 +6987,22 @@ function OmieWebhooksTab() {
|
|
|
6938
6987
|
const { http } = useOonApi();
|
|
6939
6988
|
const [instanceId, setInstanceId] = useState15("default");
|
|
6940
6989
|
const [copied, setCopied] = useState15(false);
|
|
6941
|
-
const configuration =
|
|
6990
|
+
const configuration = useQuery11({
|
|
6942
6991
|
queryKey: ["core-omie", "configuration"],
|
|
6943
6992
|
queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
|
|
6944
6993
|
});
|
|
6945
|
-
const access =
|
|
6994
|
+
const access = useQuery11({
|
|
6946
6995
|
queryKey: ["core-omie", "webhook-access", instanceId],
|
|
6947
6996
|
enabled: Boolean(instanceId),
|
|
6948
6997
|
queryFn: async () => (await http.get(
|
|
6949
6998
|
`/integrations/providers/omie/configuration/${instanceId}/webhook`
|
|
6950
6999
|
)).data
|
|
6951
7000
|
});
|
|
6952
|
-
const mappings =
|
|
7001
|
+
const mappings = useQuery11({
|
|
6953
7002
|
queryKey: ["core-omie", "mappings"],
|
|
6954
7003
|
queryFn: async () => (await http.get("/integrations/providers/omie/mappings")).data
|
|
6955
7004
|
});
|
|
6956
|
-
const events =
|
|
7005
|
+
const events = useQuery11({
|
|
6957
7006
|
queryKey: ["core-omie", "events"],
|
|
6958
7007
|
queryFn: async () => (await http.get("/integrations/events", {
|
|
6959
7008
|
params: { provider: "omie", limit: 20 }
|
|
@@ -7072,7 +7121,7 @@ function diagnosticMessage2(value2) {
|
|
|
7072
7121
|
function OmieHistoryTab() {
|
|
7073
7122
|
const { http } = useOonApi();
|
|
7074
7123
|
const [expandedId, setExpandedId] = useState15(null);
|
|
7075
|
-
const history =
|
|
7124
|
+
const history = useQuery11({
|
|
7076
7125
|
queryKey: ["core-omie", "history"],
|
|
7077
7126
|
queryFn: async () => (await http.get("/integrations/history", {
|
|
7078
7127
|
params: { provider: "omie", limit: 30 }
|