@mdxui/cockpit 0.2.0 → 6.0.1
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/README.md +207 -8
- package/dist/auth/auth-layout.js +13 -53
- package/dist/auth/auth-layout.js.map +1 -1
- package/dist/auth/index.js +13 -54
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/login-page.js +13 -53
- package/dist/auth/login-page.js.map +1 -1
- package/dist/auth/otp-page.js +13 -53
- package/dist/auth/otp-page.js.map +1 -1
- package/dist/auth/password-reset-page.js +13 -53
- package/dist/auth/password-reset-page.js.map +1 -1
- package/dist/auth/signup-page.js +13 -53
- package/dist/auth/signup-page.js.map +1 -1
- package/dist/developer/index.d.ts +525 -11
- package/dist/developer/index.js +1053 -767
- package/dist/developer/index.js.map +1 -1
- package/dist/developer/themes/index.d.ts +1 -1
- package/dist/developer/themes/index.js +38 -1
- package/dist/developer/themes/index.js.map +1 -1
- package/dist/index.d.ts +35 -2
- package/dist/index.js +1111 -831
- package/dist/index.js.map +1 -1
- package/package.json +28 -17
package/dist/index.js
CHANGED
|
@@ -1,73 +1,17 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
|
-
var __copyProps = (to, from, except, desc) => {
|
|
35
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
36
|
-
for (let key of __getOwnPropNames(from))
|
|
37
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
38
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
39
|
-
}
|
|
40
|
-
return to;
|
|
41
|
-
};
|
|
42
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
43
|
-
var __async = (__this, __arguments, generator) => {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
var fulfilled = (value) => {
|
|
46
|
-
try {
|
|
47
|
-
step(generator.next(value));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
reject(e);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var rejected = (value) => {
|
|
53
|
-
try {
|
|
54
|
-
step(generator.throw(value));
|
|
55
|
-
} catch (e) {
|
|
56
|
-
reject(e);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
60
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
1
|
// src/developer/index.ts
|
|
65
|
-
import { useAuth as
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
2
|
+
import { useAuth as useAuth9 } from "@mdxui/auth";
|
|
3
|
+
import {
|
|
4
|
+
themePresets,
|
|
5
|
+
themeNames,
|
|
6
|
+
isThemePreset,
|
|
7
|
+
useThemeStore,
|
|
8
|
+
applyThemeToElement as applyThemeToElement3,
|
|
9
|
+
getThemeCSS,
|
|
10
|
+
themeCSS,
|
|
11
|
+
ThemeScript,
|
|
12
|
+
getThemeScriptContent,
|
|
13
|
+
getResolvedMode
|
|
14
|
+
} from "@mdxui/themes";
|
|
71
15
|
|
|
72
16
|
// src/developer/components/dashboard/activity-feed.tsx
|
|
73
17
|
import { Avatar, AvatarFallback, AvatarImage } from "@mdxui/primitives/avatar";
|
|
@@ -188,7 +132,7 @@ function AreaChart({
|
|
|
188
132
|
}
|
|
189
133
|
),
|
|
190
134
|
/* @__PURE__ */ jsx2(ChartTooltip, { content: /* @__PURE__ */ jsx2(ChartTooltipContent, {}) }),
|
|
191
|
-
yAxisKeys.map((key
|
|
135
|
+
yAxisKeys.map((key) => /* @__PURE__ */ jsx2(
|
|
192
136
|
Area,
|
|
193
137
|
{
|
|
194
138
|
type: "monotone",
|
|
@@ -469,7 +413,6 @@ function DataTable({
|
|
|
469
413
|
className,
|
|
470
414
|
emptyMessage = "No results found."
|
|
471
415
|
}) {
|
|
472
|
-
var _a, _b, _c;
|
|
473
416
|
const [sorting, setSorting] = useState2([]);
|
|
474
417
|
const [columnFilters, setColumnFilters] = useState2([]);
|
|
475
418
|
const [columnVisibility, setColumnVisibility] = useState2({});
|
|
@@ -502,11 +445,8 @@ function DataTable({
|
|
|
502
445
|
Input,
|
|
503
446
|
{
|
|
504
447
|
placeholder: searchPlaceholder,
|
|
505
|
-
value:
|
|
506
|
-
onChange: (event) =>
|
|
507
|
-
var _a2;
|
|
508
|
-
return (_a2 = table.getColumn(searchColumn)) == null ? void 0 : _a2.setFilterValue(event.target.value);
|
|
509
|
-
},
|
|
448
|
+
value: table.getColumn(searchColumn)?.getFilterValue() ?? "",
|
|
449
|
+
onChange: (event) => table.getColumn(searchColumn)?.setFilterValue(event.target.value),
|
|
510
450
|
className: "max-w-sm"
|
|
511
451
|
}
|
|
512
452
|
) }),
|
|
@@ -514,7 +454,7 @@ function DataTable({
|
|
|
514
454
|
/* @__PURE__ */ jsx6(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx6(TableRow, { children: headerGroup.headers.map((header) => {
|
|
515
455
|
return /* @__PURE__ */ jsx6(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
516
456
|
}) }, headerGroup.id)) }),
|
|
517
|
-
/* @__PURE__ */ jsx6(TableBody, { children:
|
|
457
|
+
/* @__PURE__ */ jsx6(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx6(TableRow, { "data-state": row.getIsSelected() && "selected", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx6(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsx6(TableRow, { children: /* @__PURE__ */ jsx6(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: emptyMessage }) }) })
|
|
518
458
|
] }) }),
|
|
519
459
|
paginated && /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-2", children: [
|
|
520
460
|
/* @__PURE__ */ jsx6("div", { className: "flex-1 text-sm text-muted-foreground", children: table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxs5("span", { children: [
|
|
@@ -729,8 +669,8 @@ function LineChart({
|
|
|
729
669
|
}
|
|
730
670
|
|
|
731
671
|
// src/developer/components/layout/dashboard-layout.tsx
|
|
672
|
+
import { useAuth as useAuth2 } from "@mdxui/auth";
|
|
732
673
|
import { DashboardShell } from "@mdxui/primitives/dashboard-shell";
|
|
733
|
-
import { useAuth as useAuth2 } from "@workos-inc/authkit-react";
|
|
734
674
|
import {
|
|
735
675
|
Activity,
|
|
736
676
|
BarChart3,
|
|
@@ -751,6 +691,7 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
751
691
|
// src/developer/hooks/use-theme-loader.ts
|
|
752
692
|
import { useTheme } from "next-themes";
|
|
753
693
|
import { useEffect as useEffect2, useRef } from "react";
|
|
694
|
+
import { applyThemeToElement } from "@mdxui/themes";
|
|
754
695
|
function useThemeLoader(preset) {
|
|
755
696
|
const { resolvedTheme } = useTheme();
|
|
756
697
|
const currentPresetRef = useRef(void 0);
|
|
@@ -759,7 +700,7 @@ function useThemeLoader(preset) {
|
|
|
759
700
|
if (!preset || !resolvedTheme) return;
|
|
760
701
|
if (preset === currentPresetRef.current && resolvedTheme === currentModeRef.current) return;
|
|
761
702
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
762
|
-
|
|
703
|
+
applyThemeToElement(document.documentElement, preset, mode);
|
|
763
704
|
currentPresetRef.current = preset;
|
|
764
705
|
currentModeRef.current = resolvedTheme;
|
|
765
706
|
}, [preset, resolvedTheme]);
|
|
@@ -813,6 +754,7 @@ var defaultConfig = {
|
|
|
813
754
|
logo: void 0
|
|
814
755
|
},
|
|
815
756
|
routes: defaultRoutes,
|
|
757
|
+
customRoutes: [],
|
|
816
758
|
theme: {
|
|
817
759
|
preset: "cyan",
|
|
818
760
|
mode: "system",
|
|
@@ -825,15 +767,19 @@ import { jsx as jsx9 } from "react/jsx-runtime";
|
|
|
825
767
|
var DashboardContext = createContext(null);
|
|
826
768
|
function DashboardProvider({ config, children }) {
|
|
827
769
|
const value = useMemo(() => {
|
|
828
|
-
const mergedConfig =
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
770
|
+
const mergedConfig = {
|
|
771
|
+
...defaultConfig,
|
|
772
|
+
...config,
|
|
773
|
+
branding: { ...defaultConfig.branding, ...config.branding },
|
|
774
|
+
routes: { ...defaultRoutes, ...config.routes },
|
|
775
|
+
customRoutes: config.customRoutes ?? [],
|
|
776
|
+
theme: { ...defaultConfig.theme, ...config.theme },
|
|
777
|
+
identity: { ...defaultIdentity, ...config.identity }
|
|
778
|
+
};
|
|
834
779
|
return {
|
|
835
780
|
config: mergedConfig,
|
|
836
781
|
routes: mergedConfig.routes,
|
|
782
|
+
customRoutes: mergedConfig.customRoutes,
|
|
837
783
|
basePath: mergedConfig.basePath
|
|
838
784
|
};
|
|
839
785
|
}, [config]);
|
|
@@ -852,6 +798,10 @@ function useRoutes() {
|
|
|
852
798
|
const { routes } = useDashboard();
|
|
853
799
|
return routes;
|
|
854
800
|
}
|
|
801
|
+
function useCustomRoutes() {
|
|
802
|
+
const { customRoutes } = useDashboard();
|
|
803
|
+
return customRoutes;
|
|
804
|
+
}
|
|
855
805
|
|
|
856
806
|
// src/developer/components/ui/sidebar-ad.tsx
|
|
857
807
|
import { useSidebar } from "@mdxui/primitives/sidebar";
|
|
@@ -866,7 +816,7 @@ function SidebarAd({ headline, description, ctaText, ctaHref, onCtaClick, dismis
|
|
|
866
816
|
if (state === "collapsed") return null;
|
|
867
817
|
const handleDismiss = () => {
|
|
868
818
|
setIsDismissed(true);
|
|
869
|
-
onDismiss
|
|
819
|
+
onDismiss?.();
|
|
870
820
|
};
|
|
871
821
|
const handleCtaClick = () => {
|
|
872
822
|
if (onCtaClick) {
|
|
@@ -905,9 +855,8 @@ function SidebarAd({ headline, description, ctaText, ctaHref, onCtaClick, dismis
|
|
|
905
855
|
}
|
|
906
856
|
|
|
907
857
|
// src/developer/components/widgets/team-switcher.tsx
|
|
858
|
+
import { OrganizationSwitcher, useAuth } from "@mdxui/auth";
|
|
908
859
|
import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "@mdxui/primitives/sidebar";
|
|
909
|
-
import { useAuth } from "@workos-inc/authkit-react";
|
|
910
|
-
import { OrganizationSwitcher } from "@workos-inc/widgets";
|
|
911
860
|
import { Building2 } from "lucide-react";
|
|
912
861
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
913
862
|
function TeamSwitcher() {
|
|
@@ -915,7 +864,16 @@ function TeamSwitcher() {
|
|
|
915
864
|
if (!organizationId) {
|
|
916
865
|
return /* @__PURE__ */ jsx11(TeamSwitcherNone, {});
|
|
917
866
|
}
|
|
918
|
-
|
|
867
|
+
const handleSwitchOrganization = ({ organizationId: organizationId2 }) => {
|
|
868
|
+
return switchToOrganization({ organizationId: organizationId2 });
|
|
869
|
+
};
|
|
870
|
+
return /* @__PURE__ */ jsx11(SidebarMenu, { children: /* @__PURE__ */ jsx11(SidebarMenuItem, { children: /* @__PURE__ */ jsx11("div", { className: "organization-switcher-wrapper", children: /* @__PURE__ */ jsx11(
|
|
871
|
+
OrganizationSwitcher,
|
|
872
|
+
{
|
|
873
|
+
authToken: getAccessToken,
|
|
874
|
+
switchToOrganization: handleSwitchOrganization
|
|
875
|
+
}
|
|
876
|
+
) }) }) });
|
|
919
877
|
}
|
|
920
878
|
function TeamSwitcherNone() {
|
|
921
879
|
return /* @__PURE__ */ jsx11(SidebarMenu, { children: /* @__PURE__ */ jsx11(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(SidebarMenuButton, { size: "lg", className: "pointer-events-none", children: [
|
|
@@ -971,8 +929,19 @@ function NavUser({ user, onSignOut }) {
|
|
|
971
929
|
// src/developer/components/layout/dashboard-layout.tsx
|
|
972
930
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
973
931
|
function useNavItems() {
|
|
974
|
-
const { routes } = useDashboard();
|
|
932
|
+
const { routes, customRoutes } = useDashboard();
|
|
975
933
|
const items = [];
|
|
934
|
+
const customRouteToNavItem = (route) => ({
|
|
935
|
+
title: route.label,
|
|
936
|
+
url: route.path.startsWith("/") ? route.path : `/${route.path}`,
|
|
937
|
+
icon: route.icon
|
|
938
|
+
});
|
|
939
|
+
const sortedCustomRoutes = [...customRoutes].sort((a, b) => {
|
|
940
|
+
return (a.order ?? 100) - (b.order ?? 100);
|
|
941
|
+
});
|
|
942
|
+
const mainRoutes = sortedCustomRoutes.filter((r) => r.group === "main" || r.group === void 0);
|
|
943
|
+
const secondaryRoutes = sortedCustomRoutes.filter((r) => r.group === "secondary");
|
|
944
|
+
const adminRoutes = sortedCustomRoutes.filter((r) => r.group === "admin");
|
|
976
945
|
if (routes.overview) {
|
|
977
946
|
items.push({
|
|
978
947
|
title: "Overview",
|
|
@@ -1012,7 +981,13 @@ function useNavItems() {
|
|
|
1012
981
|
items.push({
|
|
1013
982
|
title: "Webhooks",
|
|
1014
983
|
url: "/webhooks",
|
|
1015
|
-
icon: Webhook
|
|
984
|
+
icon: Webhook,
|
|
985
|
+
items: [
|
|
986
|
+
{ title: "Endpoints", url: "/webhooks/endpoints" },
|
|
987
|
+
{ title: "Activity", url: "/webhooks/activity" },
|
|
988
|
+
{ title: "Logs", url: "/webhooks/logs" },
|
|
989
|
+
{ title: "Event Catalog", url: "/webhooks/event-catalog" }
|
|
990
|
+
]
|
|
1016
991
|
});
|
|
1017
992
|
}
|
|
1018
993
|
if (routes.database) {
|
|
@@ -1036,24 +1011,37 @@ function useNavItems() {
|
|
|
1036
1011
|
icon: Lock
|
|
1037
1012
|
});
|
|
1038
1013
|
}
|
|
1014
|
+
for (const route of mainRoutes) {
|
|
1015
|
+
items.push(customRouteToNavItem(route));
|
|
1016
|
+
}
|
|
1017
|
+
for (const route of secondaryRoutes) {
|
|
1018
|
+
items.push(customRouteToNavItem(route));
|
|
1019
|
+
}
|
|
1039
1020
|
if (routes.settings) {
|
|
1040
1021
|
items.push({
|
|
1041
1022
|
title: "Settings",
|
|
1042
1023
|
url: "/settings",
|
|
1043
|
-
icon: Settings
|
|
1024
|
+
icon: Settings,
|
|
1025
|
+
items: [
|
|
1026
|
+
{ title: "Profile", url: "/settings/profile" },
|
|
1027
|
+
{ title: "Security", url: "/settings/security" },
|
|
1028
|
+
{ title: "Sessions", url: "/settings/sessions" }
|
|
1029
|
+
]
|
|
1044
1030
|
});
|
|
1045
1031
|
}
|
|
1032
|
+
for (const route of adminRoutes) {
|
|
1033
|
+
items.push(customRouteToNavItem(route));
|
|
1034
|
+
}
|
|
1046
1035
|
return items;
|
|
1047
1036
|
}
|
|
1048
1037
|
function DashboardLayout() {
|
|
1049
|
-
var _a;
|
|
1050
1038
|
const { user, signOut } = useAuth2();
|
|
1051
1039
|
const navItems = useNavItems();
|
|
1052
1040
|
const navUser = user ? {
|
|
1053
1041
|
id: user.id,
|
|
1054
1042
|
name: user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : user.email,
|
|
1055
1043
|
email: user.email,
|
|
1056
|
-
avatar:
|
|
1044
|
+
avatar: user.profilePictureUrl ?? void 0
|
|
1057
1045
|
} : null;
|
|
1058
1046
|
return /* @__PURE__ */ jsx14(
|
|
1059
1047
|
DashboardShell,
|
|
@@ -1079,8 +1067,8 @@ function DashboardLayout() {
|
|
|
1079
1067
|
}
|
|
1080
1068
|
|
|
1081
1069
|
// src/developer/components/layout/landing-page.tsx
|
|
1070
|
+
import { useAuth as useAuth3 } from "@mdxui/auth";
|
|
1082
1071
|
import { Button as Button2 } from "@mdxui/primitives/button";
|
|
1083
|
-
import { useAuth as useAuth3 } from "@workos-inc/authkit-react";
|
|
1084
1072
|
import { ArrowRight, BarChart3 as BarChart32, Key as Key2, Shield, Users as Users2 } from "lucide-react";
|
|
1085
1073
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1086
1074
|
function FeatureCard({ icon, title, description }) {
|
|
@@ -1091,14 +1079,13 @@ function FeatureCard({ icon, title, description }) {
|
|
|
1091
1079
|
] });
|
|
1092
1080
|
}
|
|
1093
1081
|
function LandingPage() {
|
|
1094
|
-
var _a, _b, _c;
|
|
1095
1082
|
const { signIn } = useAuth3();
|
|
1096
1083
|
const { config } = useDashboard();
|
|
1097
|
-
const brandName =
|
|
1084
|
+
const brandName = config.branding?.name ?? "Dashboard";
|
|
1098
1085
|
return /* @__PURE__ */ jsxs11("div", { className: "min-h-screen bg-background flex flex-col", children: [
|
|
1099
1086
|
/* @__PURE__ */ jsx15("header", { className: "border-b", children: /* @__PURE__ */ jsxs11("div", { className: "container mx-auto px-4 h-16 flex items-center justify-between", children: [
|
|
1100
1087
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
1101
|
-
|
|
1088
|
+
config.branding?.logo,
|
|
1102
1089
|
/* @__PURE__ */ jsx15("span", { className: "font-semibold text-lg", children: brandName })
|
|
1103
1090
|
] }),
|
|
1104
1091
|
/* @__PURE__ */ jsxs11(Button2, { onClick: () => signIn(), children: [
|
|
@@ -1182,11 +1169,11 @@ function JsonViewer({ data, className }) {
|
|
|
1182
1169
|
theme
|
|
1183
1170
|
}).then(setHtml);
|
|
1184
1171
|
}, [jsonString, resolvedTheme]);
|
|
1185
|
-
const handleCopy = () =>
|
|
1186
|
-
|
|
1172
|
+
const handleCopy = async () => {
|
|
1173
|
+
await navigator.clipboard.writeText(jsonString);
|
|
1187
1174
|
setCopied(true);
|
|
1188
1175
|
setTimeout(() => setCopied(false), 2e3);
|
|
1189
|
-
}
|
|
1176
|
+
};
|
|
1190
1177
|
return /* @__PURE__ */ jsxs12("div", { className: cn5("relative rounded-md border bg-muted", className), children: [
|
|
1191
1178
|
/* @__PURE__ */ jsx16(
|
|
1192
1179
|
"button",
|
|
@@ -1322,11 +1309,11 @@ function VaultInputModal({
|
|
|
1322
1309
|
}) {
|
|
1323
1310
|
const [values, setValues] = useState5({});
|
|
1324
1311
|
const [loading, setLoading] = useState5(false);
|
|
1325
|
-
const handleSubmit = (e) =>
|
|
1312
|
+
const handleSubmit = async (e) => {
|
|
1326
1313
|
e.preventDefault();
|
|
1327
1314
|
setLoading(true);
|
|
1328
1315
|
try {
|
|
1329
|
-
|
|
1316
|
+
await onSave(values);
|
|
1330
1317
|
setValues({});
|
|
1331
1318
|
onClose();
|
|
1332
1319
|
} catch (error) {
|
|
@@ -1334,16 +1321,13 @@ function VaultInputModal({
|
|
|
1334
1321
|
} finally {
|
|
1335
1322
|
setLoading(false);
|
|
1336
1323
|
}
|
|
1337
|
-
}
|
|
1324
|
+
};
|
|
1338
1325
|
const handleClose = () => {
|
|
1339
1326
|
setValues({});
|
|
1340
1327
|
onClose();
|
|
1341
1328
|
};
|
|
1342
1329
|
if (!integration) return null;
|
|
1343
|
-
const isValid = integration.fields.filter((f) => f.required).every((f) =>
|
|
1344
|
-
var _a;
|
|
1345
|
-
return (_a = values[f.key]) == null ? void 0 : _a.trim();
|
|
1346
|
-
});
|
|
1330
|
+
const isValid = integration.fields.filter((f) => f.required).every((f) => values[f.key]?.trim());
|
|
1347
1331
|
return /* @__PURE__ */ jsx20(Dialog3, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs16(DialogContent3, { children: [
|
|
1348
1332
|
/* @__PURE__ */ jsx20(DialogHeader2, { children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3", children: [
|
|
1349
1333
|
/* @__PURE__ */ jsx20("div", { className: "flex h-10 w-10 items-center justify-center rounded-md bg-white overflow-hidden p-1 border border-border", children: integration.logoUrl ? /* @__PURE__ */ jsx20(
|
|
@@ -1376,7 +1360,8 @@ function VaultInputModal({
|
|
|
1376
1360
|
type: field.type,
|
|
1377
1361
|
placeholder: field.placeholder,
|
|
1378
1362
|
value: values[field.key] || "",
|
|
1379
|
-
onChange: (e) => setValues((prev) =>
|
|
1363
|
+
onChange: (e) => setValues((prev) => ({
|
|
1364
|
+
...prev,
|
|
1380
1365
|
[field.key]: e.target.value
|
|
1381
1366
|
})),
|
|
1382
1367
|
required: field.required
|
|
@@ -1557,19 +1542,19 @@ function VaultList({ items, onRotate, onDelete, onOpenAddModal }) {
|
|
|
1557
1542
|
setSelectedItem(item);
|
|
1558
1543
|
setDeleteDialogOpen(true);
|
|
1559
1544
|
};
|
|
1560
|
-
const handleConfirmDelete = () =>
|
|
1545
|
+
const handleConfirmDelete = async () => {
|
|
1561
1546
|
if (!selectedItem) return;
|
|
1562
|
-
|
|
1547
|
+
await onDelete(selectedItem.id);
|
|
1563
1548
|
setDeleteDialogOpen(false);
|
|
1564
1549
|
setSelectedItem(null);
|
|
1565
|
-
}
|
|
1566
|
-
const handleSave = (credentials) =>
|
|
1550
|
+
};
|
|
1551
|
+
const handleSave = async (credentials) => {
|
|
1567
1552
|
if (modalMode === "rotate" && selectedItem) {
|
|
1568
|
-
|
|
1553
|
+
await onRotate(selectedItem.id, credentials);
|
|
1569
1554
|
}
|
|
1570
1555
|
setInputModalOpen(false);
|
|
1571
1556
|
setSelectedItem(null);
|
|
1572
|
-
}
|
|
1557
|
+
};
|
|
1573
1558
|
const getIntegrationForModal = () => {
|
|
1574
1559
|
if (!selectedItem) return void 0;
|
|
1575
1560
|
const fields = integrationFields[selectedItem.integrationId] || integrationFields.default;
|
|
@@ -1605,7 +1590,7 @@ function VaultList({ items, onRotate, onDelete, onOpenAddModal }) {
|
|
|
1605
1590
|
setDeleteDialogOpen(false);
|
|
1606
1591
|
setSelectedItem(null);
|
|
1607
1592
|
},
|
|
1608
|
-
itemName:
|
|
1593
|
+
itemName: selectedItem?.name || "",
|
|
1609
1594
|
onConfirm: handleConfirmDelete
|
|
1610
1595
|
}
|
|
1611
1596
|
),
|
|
@@ -1636,9 +1621,9 @@ import { Table as Table2, TableBody as TableBody2, TableCell as TableCell2, Tabl
|
|
|
1636
1621
|
import { Mail, MoreHorizontal, Plus, Shield as Shield2, User } from "lucide-react";
|
|
1637
1622
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1638
1623
|
var mockUsers = [
|
|
1639
|
-
{ id: "1", name: "John Doe", email: "john@example.com", role: "Admin", avatar: "", status: "Active" },
|
|
1640
|
-
{ id: "2", name: "Jane Smith", email: "jane@example.com", role: "Member", avatar: "", status: "Active" },
|
|
1641
|
-
{ id: "3", name: "Bob Johnson", email: "bob@example.com", role: "Member", avatar: "", status: "Pending" }
|
|
1624
|
+
{ id: "1", name: "John Doe", email: "john@example.com.ai", role: "Admin", avatar: "", status: "Active" },
|
|
1625
|
+
{ id: "2", name: "Jane Smith", email: "jane@example.com.ai", role: "Member", avatar: "", status: "Active" },
|
|
1626
|
+
{ id: "3", name: "Bob Johnson", email: "bob@example.com.ai", role: "Member", avatar: "", status: "Pending" }
|
|
1642
1627
|
];
|
|
1643
1628
|
var mockSessions = [
|
|
1644
1629
|
{ id: "1", device: "Chrome on macOS", location: "San Francisco, CA", lastActive: "Now", current: true },
|
|
@@ -1712,7 +1697,7 @@ function MockUserProfile() {
|
|
|
1712
1697
|
] }),
|
|
1713
1698
|
/* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
|
|
1714
1699
|
/* @__PURE__ */ jsx23(Label2, { htmlFor: "email", children: "Email" }),
|
|
1715
|
-
/* @__PURE__ */ jsx23(Input3, { id: "email", type: "email", defaultValue: "john@example.com", disabled: true })
|
|
1700
|
+
/* @__PURE__ */ jsx23(Input3, { id: "email", type: "email", defaultValue: "john@example.com.ai", disabled: true })
|
|
1716
1701
|
] }),
|
|
1717
1702
|
/* @__PURE__ */ jsx23(Button7, { children: "Save Changes" })
|
|
1718
1703
|
] })
|
|
@@ -1837,20 +1822,14 @@ function SettingsPage({ sections, children }) {
|
|
|
1837
1822
|
] }),
|
|
1838
1823
|
/* @__PURE__ */ jsx24(Separator, {}),
|
|
1839
1824
|
/* @__PURE__ */ jsxs20(Tabs, { value: activeTab, onValueChange: (value) => setActiveTab(value), className: "space-y-6", children: [
|
|
1840
|
-
/* @__PURE__ */ jsx24(TabsList, { className: "grid w-full grid-cols-2 sm:grid-cols-3 lg:grid-cols-7 gap-2", children: activeSections.map((section) => {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
/* @__PURE__ */ jsx24(CardTitle7, { children: ((_a = sectionMeta[section]) == null ? void 0 : _a.title) || section }),
|
|
1849
|
-
/* @__PURE__ */ jsx24(CardDescription6, { children: ((_b = sectionMeta[section]) == null ? void 0 : _b.description) || `Manage your ${section} settings` })
|
|
1850
|
-
] }),
|
|
1851
|
-
/* @__PURE__ */ jsx24(CardContent7, { children: React.Children.toArray(children)[index] || /* @__PURE__ */ jsx24("div", { className: "text-center text-sm text-muted-foreground py-8", children: "No content provided for this section" }) })
|
|
1852
|
-
] }) }, section);
|
|
1853
|
-
})
|
|
1825
|
+
/* @__PURE__ */ jsx24(TabsList, { className: "grid w-full grid-cols-2 sm:grid-cols-3 lg:grid-cols-7 gap-2", children: activeSections.map((section) => /* @__PURE__ */ jsx24(TabsTrigger, { value: section, children: sectionMeta[section]?.title || section }, section)) }),
|
|
1826
|
+
activeSections.map((section, index) => /* @__PURE__ */ jsx24(TabsContent, { value: section, className: "space-y-6", children: /* @__PURE__ */ jsxs20(Card8, { children: [
|
|
1827
|
+
/* @__PURE__ */ jsxs20(CardHeader7, { children: [
|
|
1828
|
+
/* @__PURE__ */ jsx24(CardTitle7, { children: sectionMeta[section]?.title || section }),
|
|
1829
|
+
/* @__PURE__ */ jsx24(CardDescription6, { children: sectionMeta[section]?.description || `Manage your ${section} settings` })
|
|
1830
|
+
] }),
|
|
1831
|
+
/* @__PURE__ */ jsx24(CardContent7, { children: React.Children.toArray(children)[index] || /* @__PURE__ */ jsx24("div", { className: "text-center text-sm text-muted-foreground py-8", children: "No content provided for this section" }) })
|
|
1832
|
+
] }) }, section))
|
|
1854
1833
|
] })
|
|
1855
1834
|
] });
|
|
1856
1835
|
}
|
|
@@ -1865,19 +1844,18 @@ import { Label as Label3 } from "@mdxui/primitives/label";
|
|
|
1865
1844
|
import { User as User2, Mail as Mail2, Upload } from "lucide-react";
|
|
1866
1845
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1867
1846
|
function UserProfile({ user, onUpdate, readonly = false }) {
|
|
1868
|
-
var _a, _b;
|
|
1869
1847
|
const [formData, setFormData] = React2.useState({
|
|
1870
|
-
firstName:
|
|
1871
|
-
lastName:
|
|
1872
|
-
email:
|
|
1873
|
-
avatar:
|
|
1848
|
+
firstName: user?.firstName || user?.name?.split(" ")[0] || "",
|
|
1849
|
+
lastName: user?.lastName || user?.name?.split(" ").slice(1).join(" ") || "",
|
|
1850
|
+
email: user?.email || "",
|
|
1851
|
+
avatar: user?.avatar || ""
|
|
1874
1852
|
});
|
|
1875
1853
|
const handleSubmit = (e) => {
|
|
1876
1854
|
e.preventDefault();
|
|
1877
|
-
onUpdate
|
|
1855
|
+
onUpdate?.(formData);
|
|
1878
1856
|
};
|
|
1879
1857
|
const handleChange = (field, value) => {
|
|
1880
|
-
setFormData((prev) =>
|
|
1858
|
+
setFormData((prev) => ({ ...prev, [field]: value }));
|
|
1881
1859
|
};
|
|
1882
1860
|
const getInitials = () => {
|
|
1883
1861
|
const first = formData.firstName[0] || "";
|
|
@@ -1946,7 +1924,7 @@ function UserProfile({ user, onUpdate, readonly = false }) {
|
|
|
1946
1924
|
type: "email",
|
|
1947
1925
|
value: formData.email,
|
|
1948
1926
|
onChange: (e) => handleChange("email", e.target.value),
|
|
1949
|
-
placeholder: "john@example.com",
|
|
1927
|
+
placeholder: "john@example.com.ai",
|
|
1950
1928
|
disabled: true
|
|
1951
1929
|
}
|
|
1952
1930
|
),
|
|
@@ -2030,14 +2008,14 @@ function APIKeyManager({
|
|
|
2030
2008
|
return next;
|
|
2031
2009
|
});
|
|
2032
2010
|
};
|
|
2033
|
-
const copyToClipboard = (text, label) =>
|
|
2011
|
+
const copyToClipboard = async (text, label) => {
|
|
2034
2012
|
try {
|
|
2035
|
-
|
|
2013
|
+
await navigator.clipboard.writeText(text);
|
|
2036
2014
|
toast.success(`${label} copied to clipboard`);
|
|
2037
2015
|
} catch (err) {
|
|
2038
2016
|
toast.error("Failed to copy to clipboard");
|
|
2039
2017
|
}
|
|
2040
|
-
}
|
|
2018
|
+
};
|
|
2041
2019
|
const handleCreateKey = () => {
|
|
2042
2020
|
if (!newKeyName.trim()) {
|
|
2043
2021
|
toast.error("Please enter a key name");
|
|
@@ -2067,7 +2045,7 @@ function APIKeyManager({
|
|
|
2067
2045
|
year: "numeric"
|
|
2068
2046
|
}).format(date);
|
|
2069
2047
|
};
|
|
2070
|
-
const maskKey2 = (
|
|
2048
|
+
const maskKey2 = (_key, prefix) => {
|
|
2071
2049
|
return `${prefix}${"\u2022".repeat(20)}`;
|
|
2072
2050
|
};
|
|
2073
2051
|
return /* @__PURE__ */ jsx26("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs22(Card10, { children: [
|
|
@@ -2249,7 +2227,7 @@ function TeamManager({
|
|
|
2249
2227
|
{
|
|
2250
2228
|
id: "1",
|
|
2251
2229
|
name: "John Doe",
|
|
2252
|
-
email: "john@example.com",
|
|
2230
|
+
email: "john@example.com.ai",
|
|
2253
2231
|
role: "owner",
|
|
2254
2232
|
avatar: "",
|
|
2255
2233
|
status: "active",
|
|
@@ -2258,7 +2236,7 @@ function TeamManager({
|
|
|
2258
2236
|
{
|
|
2259
2237
|
id: "2",
|
|
2260
2238
|
name: "Jane Smith",
|
|
2261
|
-
email: "jane@example.com",
|
|
2239
|
+
email: "jane@example.com.ai",
|
|
2262
2240
|
role: "admin",
|
|
2263
2241
|
avatar: "",
|
|
2264
2242
|
status: "active",
|
|
@@ -2267,7 +2245,7 @@ function TeamManager({
|
|
|
2267
2245
|
{
|
|
2268
2246
|
id: "3",
|
|
2269
2247
|
name: "Bob Johnson",
|
|
2270
|
-
email: "bob@example.com",
|
|
2248
|
+
email: "bob@example.com.ai",
|
|
2271
2249
|
role: "member",
|
|
2272
2250
|
avatar: "",
|
|
2273
2251
|
status: "pending",
|
|
@@ -2300,14 +2278,14 @@ function TeamManager({
|
|
|
2300
2278
|
const handleRoleChange = (memberId, newRole) => {
|
|
2301
2279
|
setMembers(
|
|
2302
2280
|
members.map(
|
|
2303
|
-
(m) => m.id === memberId ?
|
|
2281
|
+
(m) => m.id === memberId ? { ...m, role: newRole } : m
|
|
2304
2282
|
)
|
|
2305
2283
|
);
|
|
2306
2284
|
toast2.success("Member role updated");
|
|
2307
2285
|
};
|
|
2308
2286
|
const handleRemoveMember = (memberId) => {
|
|
2309
2287
|
const member = members.find((m) => m.id === memberId);
|
|
2310
|
-
if (
|
|
2288
|
+
if (member?.role === "owner") {
|
|
2311
2289
|
toast2.error("Cannot remove the workspace owner");
|
|
2312
2290
|
return;
|
|
2313
2291
|
}
|
|
@@ -2376,7 +2354,7 @@ function TeamManager({
|
|
|
2376
2354
|
type: "email",
|
|
2377
2355
|
value: inviteEmail,
|
|
2378
2356
|
onChange: (e) => setInviteEmail(e.target.value),
|
|
2379
|
-
placeholder: "colleague@example.com"
|
|
2357
|
+
placeholder: "colleague@example.com.ai"
|
|
2380
2358
|
}
|
|
2381
2359
|
)
|
|
2382
2360
|
] }),
|
|
@@ -2597,7 +2575,7 @@ function Billing({
|
|
|
2597
2575
|
};
|
|
2598
2576
|
const handleRemovePaymentMethod = (methodId) => {
|
|
2599
2577
|
const method = paymentMethods.find((pm) => pm.id === methodId);
|
|
2600
|
-
if (method
|
|
2578
|
+
if (method?.isDefault) {
|
|
2601
2579
|
toast3.error("Cannot remove default payment method");
|
|
2602
2580
|
return;
|
|
2603
2581
|
}
|
|
@@ -2606,7 +2584,8 @@ function Billing({
|
|
|
2606
2584
|
};
|
|
2607
2585
|
const handleSetDefaultPaymentMethod = (methodId) => {
|
|
2608
2586
|
setPaymentMethods(
|
|
2609
|
-
paymentMethods.map((pm) =>
|
|
2587
|
+
paymentMethods.map((pm) => ({
|
|
2588
|
+
...pm,
|
|
2610
2589
|
isDefault: pm.id === methodId
|
|
2611
2590
|
}))
|
|
2612
2591
|
);
|
|
@@ -2822,9 +2801,32 @@ function Billing({
|
|
|
2822
2801
|
] });
|
|
2823
2802
|
}
|
|
2824
2803
|
|
|
2804
|
+
// src/developer/lib/icons.ts
|
|
2805
|
+
import * as LucideIcons from "lucide-react";
|
|
2806
|
+
function getIconByName(name) {
|
|
2807
|
+
const icons = LucideIcons;
|
|
2808
|
+
const icon = icons[name];
|
|
2809
|
+
if (icon && typeof icon === "function") {
|
|
2810
|
+
return icon;
|
|
2811
|
+
}
|
|
2812
|
+
return void 0;
|
|
2813
|
+
}
|
|
2814
|
+
var dashboardIcons = {
|
|
2815
|
+
overview: "BarChart3",
|
|
2816
|
+
requests: "Activity",
|
|
2817
|
+
keys: "Key",
|
|
2818
|
+
team: "Users",
|
|
2819
|
+
billing: "CreditCard",
|
|
2820
|
+
settings: "Settings",
|
|
2821
|
+
webhooks: "Webhook",
|
|
2822
|
+
database: "Database",
|
|
2823
|
+
integrations: "Puzzle",
|
|
2824
|
+
vault: "Lock"
|
|
2825
|
+
};
|
|
2826
|
+
|
|
2825
2827
|
// src/developer/providers/app-providers.tsx
|
|
2826
2828
|
import { ThemeProvider } from "next-themes";
|
|
2827
|
-
import { useEffect as
|
|
2829
|
+
import { useEffect as useEffect5 } from "react";
|
|
2828
2830
|
|
|
2829
2831
|
// src/developer/lib/platform.ts
|
|
2830
2832
|
import { createSDK } from "platform.do";
|
|
@@ -2891,7 +2893,6 @@ function clearAuth() {
|
|
|
2891
2893
|
}
|
|
2892
2894
|
var apiBaseUrl = "/api";
|
|
2893
2895
|
function getDebugStatus() {
|
|
2894
|
-
var _a;
|
|
2895
2896
|
const effectiveToken = getEffectiveToken();
|
|
2896
2897
|
return {
|
|
2897
2898
|
isAuthenticated: currentToken !== null,
|
|
@@ -2899,30 +2900,28 @@ function getDebugStatus() {
|
|
|
2899
2900
|
hasEffectiveToken: effectiveToken !== null,
|
|
2900
2901
|
hasSDK: sdkInstance !== null,
|
|
2901
2902
|
tokenSource: currentToken ? "auth" : devToken ? "dev" : "none",
|
|
2902
|
-
tokenLength:
|
|
2903
|
+
tokenLength: effectiveToken?.length ?? 0,
|
|
2903
2904
|
tokenPreview: effectiveToken ? `${effectiveToken.slice(0, 20)}...${effectiveToken.slice(-10)}` : null,
|
|
2904
2905
|
debugMode,
|
|
2905
2906
|
apiBaseUrl
|
|
2906
2907
|
};
|
|
2907
2908
|
}
|
|
2908
|
-
function testSDKConnection() {
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
}
|
|
2925
|
-
});
|
|
2909
|
+
async function testSDKConnection() {
|
|
2910
|
+
const status = getDebugStatus();
|
|
2911
|
+
console.log("[Platform SDK] Testing connection...", status);
|
|
2912
|
+
if (!sdkInstance) {
|
|
2913
|
+
console.error("[Platform SDK] No SDK instance - not authenticated and no dev token");
|
|
2914
|
+
return { success: false, error: "No SDK instance", status };
|
|
2915
|
+
}
|
|
2916
|
+
try {
|
|
2917
|
+
console.log("[Platform SDK] Calling api.APIKeys.list()...");
|
|
2918
|
+
const result = await sdkInstance.api.APIKeys.list();
|
|
2919
|
+
console.log("[Platform SDK] Connection successful!", { result });
|
|
2920
|
+
return { success: true, result, status };
|
|
2921
|
+
} catch (error) {
|
|
2922
|
+
console.error("[Platform SDK] Connection failed:", error);
|
|
2923
|
+
return { success: false, error, status };
|
|
2924
|
+
}
|
|
2926
2925
|
}
|
|
2927
2926
|
if (typeof window !== "undefined") {
|
|
2928
2927
|
;
|
|
@@ -2939,56 +2938,12 @@ if (typeof window !== "undefined") {
|
|
|
2939
2938
|
}
|
|
2940
2939
|
|
|
2941
2940
|
// src/developer/providers/identity-provider.tsx
|
|
2942
|
-
import {
|
|
2943
|
-
import { WorkOsWidgets } from "@workos-inc/widgets";
|
|
2944
|
-
import { useEffect as useEffect4, useState as useState12 } from "react";
|
|
2941
|
+
import { IdentityProvider as AuthIdentityProvider, WidgetsProvider } from "@mdxui/auth";
|
|
2945
2942
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2946
|
-
function IdentityWidgetsWrapper({ children }) {
|
|
2947
|
-
const [mounted, setMounted] = useState12(false);
|
|
2948
|
-
const [isDark, setIsDark] = useState12(false);
|
|
2949
|
-
useEffect4(() => {
|
|
2950
|
-
setMounted(true);
|
|
2951
|
-
const checkDarkMode = () => {
|
|
2952
|
-
const isDarkClass = document.documentElement.classList.contains("dark");
|
|
2953
|
-
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2954
|
-
setIsDark(isDarkClass || !document.documentElement.classList.contains("light") && prefersDark);
|
|
2955
|
-
};
|
|
2956
|
-
checkDarkMode();
|
|
2957
|
-
const observer = new MutationObserver(checkDarkMode);
|
|
2958
|
-
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
2959
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2960
|
-
mediaQuery.addEventListener("change", checkDarkMode);
|
|
2961
|
-
return () => {
|
|
2962
|
-
observer.disconnect();
|
|
2963
|
-
mediaQuery.removeEventListener("change", checkDarkMode);
|
|
2964
|
-
};
|
|
2965
|
-
}, []);
|
|
2966
|
-
const appearance = mounted ? isDark ? "dark" : "light" : "inherit";
|
|
2967
|
-
return /* @__PURE__ */ jsx29(
|
|
2968
|
-
WorkOsWidgets,
|
|
2969
|
-
{
|
|
2970
|
-
theme: {
|
|
2971
|
-
appearance,
|
|
2972
|
-
radius: "medium",
|
|
2973
|
-
scaling: "100%"
|
|
2974
|
-
},
|
|
2975
|
-
elements: {
|
|
2976
|
-
primaryButton: {
|
|
2977
|
-
variant: "solid"
|
|
2978
|
-
},
|
|
2979
|
-
secondaryButton: {
|
|
2980
|
-
variant: "outline"
|
|
2981
|
-
}
|
|
2982
|
-
},
|
|
2983
|
-
children
|
|
2984
|
-
}
|
|
2985
|
-
);
|
|
2986
|
-
}
|
|
2987
2943
|
function IdentityProvider({ children }) {
|
|
2988
|
-
var _a, _b;
|
|
2989
2944
|
const { config } = useDashboard();
|
|
2990
2945
|
const { identity } = config;
|
|
2991
|
-
const redirectUri =
|
|
2946
|
+
const redirectUri = identity.redirectUri ?? (typeof window !== "undefined" ? `${window.location.origin}${config.basePath ?? "/"}` : void 0);
|
|
2992
2947
|
const onRedirectCallback = () => {
|
|
2993
2948
|
if (typeof window !== "undefined") {
|
|
2994
2949
|
const url = new URL(window.location.href);
|
|
@@ -2998,23 +2953,23 @@ function IdentityProvider({ children }) {
|
|
|
2998
2953
|
}
|
|
2999
2954
|
};
|
|
3000
2955
|
return /* @__PURE__ */ jsx29(
|
|
3001
|
-
|
|
2956
|
+
AuthIdentityProvider,
|
|
3002
2957
|
{
|
|
3003
2958
|
clientId: identity.clientId,
|
|
3004
2959
|
apiHostname: identity.apiHostname,
|
|
3005
2960
|
devMode: identity.devMode,
|
|
3006
2961
|
redirectUri,
|
|
3007
2962
|
onRedirectCallback,
|
|
3008
|
-
children
|
|
2963
|
+
children
|
|
3009
2964
|
}
|
|
3010
2965
|
);
|
|
3011
2966
|
}
|
|
3012
2967
|
|
|
3013
2968
|
// src/developer/providers/query-provider.tsx
|
|
2969
|
+
import { useAuth as useAuth4 } from "@mdxui/auth";
|
|
3014
2970
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
3015
2971
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
3016
|
-
import {
|
|
3017
|
-
import { useEffect as useEffect5 } from "react";
|
|
2972
|
+
import { useEffect as useEffect4 } from "react";
|
|
3018
2973
|
|
|
3019
2974
|
// src/developer/lib/query-client.ts
|
|
3020
2975
|
import { QueryClient } from "@tanstack/react-query";
|
|
@@ -3035,21 +2990,19 @@ var queryClient = new QueryClient({
|
|
|
3035
2990
|
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3036
2991
|
function AuthSync({ children }) {
|
|
3037
2992
|
const { user, getAccessToken } = useAuth4();
|
|
3038
|
-
|
|
3039
|
-
function syncToken() {
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
} catch (e) {
|
|
3046
|
-
clearAuth();
|
|
3047
|
-
}
|
|
3048
|
-
} else {
|
|
2993
|
+
useEffect4(() => {
|
|
2994
|
+
async function syncToken() {
|
|
2995
|
+
if (user) {
|
|
2996
|
+
try {
|
|
2997
|
+
const token = await getAccessToken();
|
|
2998
|
+
setAuthToken(token);
|
|
2999
|
+
} catch {
|
|
3049
3000
|
clearAuth();
|
|
3050
|
-
queryClient.clear();
|
|
3051
3001
|
}
|
|
3052
|
-
}
|
|
3002
|
+
} else {
|
|
3003
|
+
clearAuth();
|
|
3004
|
+
queryClient.clear();
|
|
3005
|
+
}
|
|
3053
3006
|
}
|
|
3054
3007
|
syncToken();
|
|
3055
3008
|
}, [user, getAccessToken]);
|
|
@@ -3065,7 +3018,7 @@ function QueryProvider({ children }) {
|
|
|
3065
3018
|
// src/developer/providers/app-providers.tsx
|
|
3066
3019
|
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3067
3020
|
function SDKInitializer({ config }) {
|
|
3068
|
-
|
|
3021
|
+
useEffect5(() => {
|
|
3069
3022
|
if (config.debug) {
|
|
3070
3023
|
setDebugMode(true);
|
|
3071
3024
|
}
|
|
@@ -3076,8 +3029,7 @@ function SDKInitializer({ config }) {
|
|
|
3076
3029
|
return null;
|
|
3077
3030
|
}
|
|
3078
3031
|
function AppProviders({ config, children }) {
|
|
3079
|
-
|
|
3080
|
-
const themeMode = (_b = (_a = config.theme) == null ? void 0 : _a.mode) != null ? _b : "system";
|
|
3032
|
+
const themeMode = config.theme?.mode ?? "system";
|
|
3081
3033
|
return /* @__PURE__ */ jsx31(
|
|
3082
3034
|
ThemeProvider,
|
|
3083
3035
|
{
|
|
@@ -3094,43 +3046,25 @@ function AppProviders({ config, children }) {
|
|
|
3094
3046
|
}
|
|
3095
3047
|
|
|
3096
3048
|
// src/developer/providers/auth-gate.tsx
|
|
3097
|
-
import {
|
|
3098
|
-
import {
|
|
3049
|
+
import { AuthGate as AuthAuthGate } from "@mdxui/auth";
|
|
3050
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3099
3051
|
function AuthGate({ children }) {
|
|
3100
|
-
var _a, _b;
|
|
3101
3052
|
const { config } = useDashboard();
|
|
3102
|
-
const { user, isLoading } = useAuth5();
|
|
3103
3053
|
const { identity } = config;
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
}
|
|
3115
|
-
if (user) {
|
|
3116
|
-
return /* @__PURE__ */ jsx32(Fragment6, { children });
|
|
3117
|
-
}
|
|
3118
|
-
switch (onUnauthenticated) {
|
|
3119
|
-
case "redirect":
|
|
3120
|
-
if (identity.unauthenticatedRedirectUrl && typeof window !== "undefined") {
|
|
3121
|
-
window.location.href = identity.unauthenticatedRedirectUrl;
|
|
3122
|
-
return /* @__PURE__ */ jsx32("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsx32("p", { className: "text-sm text-muted-foreground", children: "Redirecting..." }) });
|
|
3123
|
-
}
|
|
3124
|
-
return identity.landingComponent ? identity.landingComponent : /* @__PURE__ */ jsx32(LandingPage, {});
|
|
3125
|
-
case "allow":
|
|
3126
|
-
return /* @__PURE__ */ jsx32(Fragment6, { children });
|
|
3127
|
-
case "landing":
|
|
3128
|
-
return identity.landingComponent ? identity.landingComponent : /* @__PURE__ */ jsx32(LandingPage, {});
|
|
3129
|
-
}
|
|
3054
|
+
return /* @__PURE__ */ jsx32(
|
|
3055
|
+
AuthAuthGate,
|
|
3056
|
+
{
|
|
3057
|
+
required: identity.required ?? true,
|
|
3058
|
+
onUnauthenticated: identity.onUnauthenticated ?? "landing",
|
|
3059
|
+
redirectUrl: identity.unauthenticatedRedirectUrl,
|
|
3060
|
+
landingComponent: identity.landingComponent ?? /* @__PURE__ */ jsx32(LandingPage, {}),
|
|
3061
|
+
children
|
|
3062
|
+
}
|
|
3063
|
+
);
|
|
3130
3064
|
}
|
|
3131
3065
|
|
|
3132
3066
|
// src/developer/router.tsx
|
|
3133
|
-
import { useEffect as
|
|
3067
|
+
import { useEffect as useEffect8 } from "react";
|
|
3134
3068
|
import { BrowserRouter, MemoryRouter, Navigate, Route, Routes, useLocation as useLocation2 } from "react-router-dom";
|
|
3135
3069
|
|
|
3136
3070
|
// src/developer/pages/billing.tsx
|
|
@@ -3145,7 +3079,7 @@ import { SidebarTrigger } from "@mdxui/primitives/sidebar";
|
|
|
3145
3079
|
import { Switch } from "@mdxui/primitives/switch";
|
|
3146
3080
|
import { Table as Table6, TableBody as TableBody6, TableCell as TableCell6, TableHead as TableHead6, TableHeader as TableHeader6, TableRow as TableRow6 } from "@mdxui/primitives/table";
|
|
3147
3081
|
import { Bell, Check as Check2, CreditCard as CreditCard3, Download as Download2, FileText as FileText2, Receipt } from "lucide-react";
|
|
3148
|
-
import { useState as
|
|
3082
|
+
import { useState as useState12 } from "react";
|
|
3149
3083
|
import { toast as toast4 } from "sonner";
|
|
3150
3084
|
|
|
3151
3085
|
// src/developer/lib/mock-data.ts
|
|
@@ -3715,7 +3649,7 @@ var mockWebhookActivity = {
|
|
|
3715
3649
|
};
|
|
3716
3650
|
|
|
3717
3651
|
// src/developer/pages/billing.tsx
|
|
3718
|
-
import { Fragment as
|
|
3652
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3719
3653
|
function formatRelativeDate(dateString) {
|
|
3720
3654
|
const date = new Date(dateString);
|
|
3721
3655
|
return date.toLocaleDateString("en-US", {
|
|
@@ -3738,95 +3672,145 @@ function getUsageColor(percentage) {
|
|
|
3738
3672
|
if (percentage >= 75) return "bg-yellow-500";
|
|
3739
3673
|
return "";
|
|
3740
3674
|
}
|
|
3741
|
-
function BillingPage(
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3675
|
+
function BillingPage({
|
|
3676
|
+
billingData: initialBillingData,
|
|
3677
|
+
onManagePlan,
|
|
3678
|
+
onUpdatePaymentMethod,
|
|
3679
|
+
onDownloadInvoice,
|
|
3680
|
+
onToggleAlerts,
|
|
3681
|
+
hideHeader = false,
|
|
3682
|
+
className
|
|
3683
|
+
} = {}) {
|
|
3684
|
+
const billingData = initialBillingData ?? mockBillingData;
|
|
3685
|
+
const [alertsEnabled, setAlertsEnabled] = useState12(billingData.billingAlerts.enabled);
|
|
3686
|
+
const handleManagePlan = async () => {
|
|
3687
|
+
if (onManagePlan) {
|
|
3688
|
+
try {
|
|
3689
|
+
await onManagePlan();
|
|
3690
|
+
} catch {
|
|
3691
|
+
toast4.error("Failed to open plan management");
|
|
3692
|
+
}
|
|
3693
|
+
} else {
|
|
3694
|
+
toast4.info("Plan management would open here");
|
|
3695
|
+
}
|
|
3747
3696
|
};
|
|
3748
|
-
const
|
|
3697
|
+
const handleUpdatePaymentMethod = async () => {
|
|
3698
|
+
if (onUpdatePaymentMethod) {
|
|
3699
|
+
try {
|
|
3700
|
+
await onUpdatePaymentMethod();
|
|
3701
|
+
} catch {
|
|
3702
|
+
toast4.error("Failed to update payment method");
|
|
3703
|
+
}
|
|
3704
|
+
} else {
|
|
3705
|
+
toast4.info("Payment method update would open here");
|
|
3706
|
+
}
|
|
3707
|
+
};
|
|
3708
|
+
const handleDownloadInvoice = async (invoiceId, invoiceNumber) => {
|
|
3709
|
+
if (onDownloadInvoice) {
|
|
3710
|
+
try {
|
|
3711
|
+
await onDownloadInvoice(invoiceId);
|
|
3712
|
+
toast4.success("Invoice downloaded", {
|
|
3713
|
+
description: `${invoiceNumber} has been downloaded.`
|
|
3714
|
+
});
|
|
3715
|
+
} catch {
|
|
3716
|
+
toast4.error("Failed to download invoice");
|
|
3717
|
+
}
|
|
3718
|
+
} else {
|
|
3719
|
+
toast4.success("Invoice downloaded", {
|
|
3720
|
+
description: `${invoiceNumber} has been downloaded.`
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
};
|
|
3724
|
+
const handleAlertsToggle = async (enabled) => {
|
|
3725
|
+
if (onToggleAlerts) {
|
|
3726
|
+
try {
|
|
3727
|
+
await onToggleAlerts(enabled);
|
|
3728
|
+
} catch {
|
|
3729
|
+
toast4.error("Failed to update alert settings");
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3749
3733
|
setAlertsEnabled(enabled);
|
|
3750
3734
|
toast4.success(enabled ? "Billing alerts enabled" : "Billing alerts disabled", {
|
|
3751
|
-
description: enabled ? `You'll be notified when usage reaches ${
|
|
3735
|
+
description: enabled ? `You'll be notified when usage reaches ${billingData.billingAlerts.threshold}%.` : "You won't receive usage alerts."
|
|
3752
3736
|
});
|
|
3753
3737
|
};
|
|
3754
|
-
return /* @__PURE__ */
|
|
3755
|
-
/* @__PURE__ */ jsx33("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
3738
|
+
return /* @__PURE__ */ jsxs27(Fragment6, { children: [
|
|
3739
|
+
!hideHeader && /* @__PURE__ */ jsx33("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 px-4", children: [
|
|
3756
3740
|
/* @__PURE__ */ jsx33(SidebarTrigger, { className: "-ml-1" }),
|
|
3757
3741
|
/* @__PURE__ */ jsx33(Separator3, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
3758
3742
|
/* @__PURE__ */ jsx33(Breadcrumb, { children: /* @__PURE__ */ jsx33(BreadcrumbList, { children: /* @__PURE__ */ jsx33(BreadcrumbItem, { children: /* @__PURE__ */ jsx33(BreadcrumbPage, { children: "Billing" }) }) }) })
|
|
3759
3743
|
] }) }),
|
|
3760
|
-
/* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */ jsx33("div", { className: "flex items-center justify-between", children: /* @__PURE__ */
|
|
3744
|
+
/* @__PURE__ */ jsxs27("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
3745
|
+
/* @__PURE__ */ jsx33("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs27("div", { children: [
|
|
3762
3746
|
/* @__PURE__ */ jsx33("h1", { className: "text-2xl font-bold", children: "Billing" }),
|
|
3763
3747
|
/* @__PURE__ */ jsx33("p", { className: "text-muted-foreground", children: "Manage your subscription and billing information." })
|
|
3764
3748
|
] }) }),
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3768
|
-
/* @__PURE__ */
|
|
3749
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
3750
|
+
/* @__PURE__ */ jsxs27(Card13, { children: [
|
|
3751
|
+
/* @__PURE__ */ jsxs27(CardHeader12, { children: [
|
|
3752
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
3769
3753
|
/* @__PURE__ */ jsx33(CardTitle12, { children: "Current Plan" }),
|
|
3770
|
-
/* @__PURE__ */ jsx33(Badge6, { variant:
|
|
3754
|
+
/* @__PURE__ */ jsx33(Badge6, { variant: billingData.status === "active" ? "default" : "secondary", children: billingData.status })
|
|
3771
3755
|
] }),
|
|
3772
|
-
/* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsxs27(CardDescription11, { children: [
|
|
3773
3757
|
"Renews",
|
|
3774
3758
|
" ",
|
|
3775
|
-
new Date(
|
|
3759
|
+
new Date(billingData.renewalDate).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })
|
|
3776
3760
|
] })
|
|
3777
3761
|
] }),
|
|
3778
|
-
/* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
3780
|
-
/* @__PURE__ */ jsx33("p", { className: "text-3xl font-bold", children:
|
|
3781
|
-
/* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ jsxs27(CardContent12, { className: "space-y-4", children: [
|
|
3763
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-baseline gap-2", children: [
|
|
3764
|
+
/* @__PURE__ */ jsx33("p", { className: "text-3xl font-bold", children: billingData.plan }),
|
|
3765
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-lg text-muted-foreground", children: [
|
|
3782
3766
|
"$",
|
|
3783
|
-
|
|
3767
|
+
billingData.planPrice.toFixed(0),
|
|
3784
3768
|
"/mo"
|
|
3785
3769
|
] })
|
|
3786
3770
|
] }),
|
|
3787
|
-
/* @__PURE__ */ jsx33("div", { className: "space-y-2", children:
|
|
3771
|
+
/* @__PURE__ */ jsx33("div", { className: "space-y-2", children: billingData.planFeatures.map((feature) => /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3788
3772
|
/* @__PURE__ */ jsx33(Check2, { className: "h-4 w-4 text-primary" }),
|
|
3789
3773
|
feature
|
|
3790
3774
|
] }, feature)) }),
|
|
3791
|
-
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", children: "Manage Plan" })
|
|
3775
|
+
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", onClick: handleManagePlan, children: "Manage Plan" })
|
|
3792
3776
|
] })
|
|
3793
3777
|
] }),
|
|
3794
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ jsxs27(Card13, { children: [
|
|
3795
3779
|
/* @__PURE__ */ jsx33(CardHeader12, { children: /* @__PURE__ */ jsx33(CardTitle12, { children: "Total Spend" }) }),
|
|
3796
|
-
/* @__PURE__ */
|
|
3797
|
-
/* @__PURE__ */
|
|
3780
|
+
/* @__PURE__ */ jsxs27(CardContent12, { className: "space-y-1", children: [
|
|
3781
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-3xl font-bold", children: [
|
|
3798
3782
|
"$",
|
|
3799
|
-
|
|
3783
|
+
billingData.totalSpend.toFixed(2)
|
|
3800
3784
|
] }),
|
|
3801
3785
|
/* @__PURE__ */ jsx33("p", { className: "text-sm text-muted-foreground", children: "This billing period" })
|
|
3802
3786
|
] })
|
|
3803
3787
|
] })
|
|
3804
3788
|
] }),
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
/* @__PURE__ */
|
|
3807
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
3790
|
+
/* @__PURE__ */ jsxs27(Card13, { className: "md:row-span-2", children: [
|
|
3791
|
+
/* @__PURE__ */ jsxs27(CardHeader12, { children: [
|
|
3808
3792
|
/* @__PURE__ */ jsx33(CardTitle12, { children: "Usage Breakdown" }),
|
|
3809
3793
|
/* @__PURE__ */ jsx33(CardDescription11, { children: "Resource usage for the current billing period" })
|
|
3810
3794
|
] }),
|
|
3811
|
-
/* @__PURE__ */ jsx33(CardContent12, { className: "space-y-6", children:
|
|
3795
|
+
/* @__PURE__ */ jsx33(CardContent12, { className: "space-y-6", children: billingData.usageBreakdown.map((item) => {
|
|
3812
3796
|
const percentage = getUsagePercentage(item.usage, item.limit);
|
|
3813
3797
|
const colorClass = getUsageColor(percentage);
|
|
3814
|
-
return /* @__PURE__ */
|
|
3815
|
-
/* @__PURE__ */
|
|
3816
|
-
/* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ jsxs27("div", { className: "space-y-2", children: [
|
|
3799
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
3800
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
3817
3801
|
/* @__PURE__ */ jsx33("p", { className: "font-medium", children: item.resource }),
|
|
3818
|
-
/* @__PURE__ */
|
|
3802
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-sm text-muted-foreground", children: [
|
|
3819
3803
|
formatUsage(item.usage, item.unit),
|
|
3820
3804
|
" of ",
|
|
3821
3805
|
formatUsage(item.limit, item.unit)
|
|
3822
3806
|
] })
|
|
3823
3807
|
] }),
|
|
3824
|
-
/* @__PURE__ */
|
|
3825
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsxs27("div", { className: "text-right", children: [
|
|
3809
|
+
/* @__PURE__ */ jsxs27("p", { className: "font-medium", children: [
|
|
3826
3810
|
"$",
|
|
3827
3811
|
item.cost.toFixed(2)
|
|
3828
3812
|
] }),
|
|
3829
|
-
/* @__PURE__ */
|
|
3813
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-sm text-muted-foreground", children: [
|
|
3830
3814
|
percentage.toFixed(0),
|
|
3831
3815
|
"% used"
|
|
3832
3816
|
] })
|
|
@@ -3836,44 +3820,44 @@ function BillingPage() {
|
|
|
3836
3820
|
] }, item.resource);
|
|
3837
3821
|
}) })
|
|
3838
3822
|
] }),
|
|
3839
|
-
/* @__PURE__ */
|
|
3840
|
-
/* @__PURE__ */ jsx33(CardHeader12, { className: "pb-3", children: /* @__PURE__ */
|
|
3823
|
+
/* @__PURE__ */ jsxs27(Card13, { children: [
|
|
3824
|
+
/* @__PURE__ */ jsx33(CardHeader12, { className: "pb-3", children: /* @__PURE__ */ jsxs27(CardTitle12, { className: "flex items-center gap-2 text-base", children: [
|
|
3841
3825
|
/* @__PURE__ */ jsx33(CreditCard3, { className: "h-4 w-4" }),
|
|
3842
3826
|
"Payment Method"
|
|
3843
3827
|
] }) }),
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3847
|
-
/* @__PURE__ */ jsx33("div", { className: "h-8 w-12 bg-muted rounded flex items-center justify-center text-xs font-medium", children:
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
3828
|
+
/* @__PURE__ */ jsxs27(CardContent12, { className: "space-y-3", children: [
|
|
3829
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between p-3 border rounded-md", children: [
|
|
3830
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-3", children: [
|
|
3831
|
+
/* @__PURE__ */ jsx33("div", { className: "h-8 w-12 bg-muted rounded flex items-center justify-center text-xs font-medium", children: billingData.paymentMethod.brand }),
|
|
3832
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
3833
|
+
/* @__PURE__ */ jsxs27("p", { className: "font-medium text-sm", children: [
|
|
3850
3834
|
"\u2022\u2022\u2022\u2022 ",
|
|
3851
|
-
|
|
3835
|
+
billingData.paymentMethod.last4
|
|
3852
3836
|
] }),
|
|
3853
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-xs text-muted-foreground", children: [
|
|
3854
3838
|
"Expires ",
|
|
3855
|
-
|
|
3839
|
+
billingData.paymentMethod.expiryMonth,
|
|
3856
3840
|
"/",
|
|
3857
|
-
|
|
3841
|
+
billingData.paymentMethod.expiryYear
|
|
3858
3842
|
] })
|
|
3859
3843
|
] })
|
|
3860
3844
|
] }),
|
|
3861
3845
|
/* @__PURE__ */ jsx33(Badge6, { variant: "secondary", className: "text-xs", children: "Default" })
|
|
3862
3846
|
] }),
|
|
3863
|
-
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", children: "Update" })
|
|
3847
|
+
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", onClick: handleUpdatePaymentMethod, children: "Update" })
|
|
3864
3848
|
] })
|
|
3865
3849
|
] }),
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */ jsx33(CardHeader12, { className: "pb-3", children: /* @__PURE__ */
|
|
3850
|
+
/* @__PURE__ */ jsxs27(Card13, { children: [
|
|
3851
|
+
/* @__PURE__ */ jsx33(CardHeader12, { className: "pb-3", children: /* @__PURE__ */ jsxs27(CardTitle12, { className: "flex items-center gap-2 text-base", children: [
|
|
3868
3852
|
/* @__PURE__ */ jsx33(Bell, { className: "h-4 w-4" }),
|
|
3869
3853
|
"Billing Alerts"
|
|
3870
3854
|
] }) }),
|
|
3871
|
-
/* @__PURE__ */ jsx33(CardContent12, { children: /* @__PURE__ */
|
|
3872
|
-
/* @__PURE__ */
|
|
3855
|
+
/* @__PURE__ */ jsx33(CardContent12, { children: /* @__PURE__ */ jsxs27("div", { className: "flex items-start justify-between gap-4", children: [
|
|
3856
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
3873
3857
|
/* @__PURE__ */ jsx33(Label7, { htmlFor: "alerts", className: "text-sm", children: "Usage alerts" }),
|
|
3874
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-xs text-muted-foreground", children: [
|
|
3875
3859
|
"Notify at ",
|
|
3876
|
-
|
|
3860
|
+
billingData.billingAlerts.threshold,
|
|
3877
3861
|
"% usage"
|
|
3878
3862
|
] })
|
|
3879
3863
|
] }),
|
|
@@ -3881,32 +3865,32 @@ function BillingPage() {
|
|
|
3881
3865
|
] }) })
|
|
3882
3866
|
] })
|
|
3883
3867
|
] }),
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */ jsx33(CardHeader12, { children: /* @__PURE__ */
|
|
3868
|
+
/* @__PURE__ */ jsxs27(Card13, { children: [
|
|
3869
|
+
/* @__PURE__ */ jsx33(CardHeader12, { children: /* @__PURE__ */ jsxs27(CardTitle12, { className: "flex items-center gap-2", children: [
|
|
3886
3870
|
/* @__PURE__ */ jsx33(Receipt, { className: "h-5 w-5" }),
|
|
3887
3871
|
"Invoice History"
|
|
3888
3872
|
] }) }),
|
|
3889
|
-
/* @__PURE__ */ jsx33(CardContent12, { children:
|
|
3890
|
-
/* @__PURE__ */ jsx33(TableHeader6, { children: /* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx33(CardContent12, { children: billingData.invoices.length > 0 ? /* @__PURE__ */ jsxs27(Table6, { children: [
|
|
3874
|
+
/* @__PURE__ */ jsx33(TableHeader6, { children: /* @__PURE__ */ jsxs27(TableRow6, { children: [
|
|
3891
3875
|
/* @__PURE__ */ jsx33(TableHead6, { className: "pl-4", children: "Invoice" }),
|
|
3892
3876
|
/* @__PURE__ */ jsx33(TableHead6, { children: "Date" }),
|
|
3893
3877
|
/* @__PURE__ */ jsx33(TableHead6, { children: "Amount" }),
|
|
3894
3878
|
/* @__PURE__ */ jsx33(TableHead6, { children: "Status" }),
|
|
3895
3879
|
/* @__PURE__ */ jsx33(TableHead6, { className: "w-[80px]" })
|
|
3896
3880
|
] }) }),
|
|
3897
|
-
/* @__PURE__ */ jsx33(TableBody6, { children:
|
|
3881
|
+
/* @__PURE__ */ jsx33(TableBody6, { children: billingData.invoices.map((invoice) => /* @__PURE__ */ jsxs27(TableRow6, { children: [
|
|
3898
3882
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4 pl-4 font-mono text-sm", children: invoice.invoiceNumber }),
|
|
3899
3883
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4", children: formatRelativeDate(invoice.date) }),
|
|
3900
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsxs27(TableCell6, { className: "py-4 font-medium", children: [
|
|
3901
3885
|
"$",
|
|
3902
3886
|
invoice.amount.toFixed(2)
|
|
3903
3887
|
] }),
|
|
3904
3888
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4", children: /* @__PURE__ */ jsx33(Badge6, { variant: invoice.status === "paid" ? "default" : "secondary", children: invoice.status }) }),
|
|
3905
|
-
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4 pr-4", children: /* @__PURE__ */ jsx33(Button12, { variant: "ghost", size: "icon", onClick: () => handleDownloadInvoice(invoice.invoiceNumber), children: /* @__PURE__ */ jsx33(Download2, { className: "h-4 w-4" }) }) })
|
|
3889
|
+
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4 pr-4", children: /* @__PURE__ */ jsx33(Button12, { variant: "ghost", size: "icon", onClick: () => handleDownloadInvoice(invoice.id, invoice.invoiceNumber), children: /* @__PURE__ */ jsx33(Download2, { className: "h-4 w-4" }) }) })
|
|
3906
3890
|
] }, invoice.id)) })
|
|
3907
|
-
] }) : /* @__PURE__ */
|
|
3891
|
+
] }) : /* @__PURE__ */ jsxs27("div", { className: "flex flex-col items-center justify-center gap-4 py-16 text-center", children: [
|
|
3908
3892
|
/* @__PURE__ */ jsx33("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx33(FileText2, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
3909
|
-
/* @__PURE__ */
|
|
3893
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
3910
3894
|
/* @__PURE__ */ jsx33("p", { className: "font-medium", children: "No invoices yet" }),
|
|
3911
3895
|
/* @__PURE__ */ jsx33("p", { className: "text-sm text-muted-foreground mt-1", children: "Your invoices will appear here after your first billing cycle." })
|
|
3912
3896
|
] })
|
|
@@ -3922,22 +3906,22 @@ import { Card as Card14, CardContent as CardContent13 } from "@mdxui/primitives/
|
|
|
3922
3906
|
import { Separator as Separator4 } from "@mdxui/primitives/separator";
|
|
3923
3907
|
import { SidebarTrigger as SidebarTrigger2 } from "@mdxui/primitives/sidebar";
|
|
3924
3908
|
import { Database as Database2 } from "lucide-react";
|
|
3925
|
-
import { Fragment as
|
|
3909
|
+
import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3926
3910
|
function DatabasePage() {
|
|
3927
|
-
return /* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */ jsx34("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
3911
|
+
return /* @__PURE__ */ jsxs28(Fragment7, { children: [
|
|
3912
|
+
/* @__PURE__ */ jsx34("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 px-4", children: [
|
|
3929
3913
|
/* @__PURE__ */ jsx34(SidebarTrigger2, { className: "-ml-1" }),
|
|
3930
3914
|
/* @__PURE__ */ jsx34(Separator4, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
3931
3915
|
/* @__PURE__ */ jsx34(Breadcrumb2, { children: /* @__PURE__ */ jsx34(BreadcrumbList2, { children: /* @__PURE__ */ jsx34(BreadcrumbItem2, { children: /* @__PURE__ */ jsx34(BreadcrumbPage2, { children: "Database" }) }) }) })
|
|
3932
3916
|
] }) }),
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
3918
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
3935
3919
|
/* @__PURE__ */ jsx34("h1", { className: "text-2xl font-bold", children: "Database" }),
|
|
3936
3920
|
/* @__PURE__ */ jsx34("p", { className: "text-muted-foreground", children: "Browse and manage your database." })
|
|
3937
3921
|
] }),
|
|
3938
|
-
/* @__PURE__ */ jsx34(Card14, { children: /* @__PURE__ */ jsx34(CardContent13, { className: "py-16", children: /* @__PURE__ */
|
|
3922
|
+
/* @__PURE__ */ jsx34(Card14, { children: /* @__PURE__ */ jsx34(CardContent13, { className: "py-16", children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
3939
3923
|
/* @__PURE__ */ jsx34("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx34(Database2, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
3940
|
-
/* @__PURE__ */
|
|
3924
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
3941
3925
|
/* @__PURE__ */ jsx34("p", { className: "font-medium", children: "Coming soon" }),
|
|
3942
3926
|
/* @__PURE__ */ jsx34("p", { className: "text-sm text-muted-foreground mt-1", children: "Database management tools will be available here." })
|
|
3943
3927
|
] })
|
|
@@ -3951,22 +3935,28 @@ import { Breadcrumb as Breadcrumb3, BreadcrumbItem as BreadcrumbItem3, Breadcrum
|
|
|
3951
3935
|
import { Separator as Separator5 } from "@mdxui/primitives/separator";
|
|
3952
3936
|
import { SidebarTrigger as SidebarTrigger3 } from "@mdxui/primitives/sidebar";
|
|
3953
3937
|
import { Plug as Plug2 } from "lucide-react";
|
|
3954
|
-
import { Fragment as
|
|
3938
|
+
import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3955
3939
|
function IntegrationsPage() {
|
|
3956
|
-
return /* @__PURE__ */
|
|
3957
|
-
/* @__PURE__ */ jsx35("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
3940
|
+
return /* @__PURE__ */ jsxs29(Fragment8, { children: [
|
|
3941
|
+
/* @__PURE__ */ jsx35("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2 px-4", children: [
|
|
3958
3942
|
/* @__PURE__ */ jsx35(SidebarTrigger3, { className: "-ml-1" }),
|
|
3959
|
-
/* @__PURE__ */ jsx35(
|
|
3943
|
+
/* @__PURE__ */ jsx35(
|
|
3944
|
+
Separator5,
|
|
3945
|
+
{
|
|
3946
|
+
orientation: "vertical",
|
|
3947
|
+
className: "mr-2 data-[orientation=vertical]:h-4"
|
|
3948
|
+
}
|
|
3949
|
+
),
|
|
3960
3950
|
/* @__PURE__ */ jsx35(Breadcrumb3, { children: /* @__PURE__ */ jsx35(BreadcrumbList3, { children: /* @__PURE__ */ jsx35(BreadcrumbItem3, { children: /* @__PURE__ */ jsx35(BreadcrumbPage3, { children: "Integrations" }) }) }) })
|
|
3961
3951
|
] }) }),
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3952
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
3953
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
3964
3954
|
/* @__PURE__ */ jsx35("h1", { className: "text-2xl font-bold", children: "Integrations" }),
|
|
3965
3955
|
/* @__PURE__ */ jsx35("p", { className: "text-muted-foreground", children: "Connect third-party services." })
|
|
3966
3956
|
] }),
|
|
3967
|
-
/* @__PURE__ */
|
|
3957
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col items-center justify-center rounded-md border border-dashed py-24 gap-4", children: [
|
|
3968
3958
|
/* @__PURE__ */ jsx35("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx35(Plug2, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
3969
|
-
/* @__PURE__ */
|
|
3959
|
+
/* @__PURE__ */ jsxs29("div", { className: "text-center", children: [
|
|
3970
3960
|
/* @__PURE__ */ jsx35("p", { className: "font-medium", children: "Coming Soon" }),
|
|
3971
3961
|
/* @__PURE__ */ jsx35("p", { className: "text-muted-foreground text-sm max-w-md mt-1", children: "Connect services like GitHub, Slack, Google, Salesforce, and more." })
|
|
3972
3962
|
] })
|
|
@@ -3986,9 +3976,9 @@ import { Separator as Separator6 } from "@mdxui/primitives/separator";
|
|
|
3986
3976
|
import { SidebarTrigger as SidebarTrigger4 } from "@mdxui/primitives/sidebar";
|
|
3987
3977
|
import { Table as Table7, TableBody as TableBody7, TableCell as TableCell7, TableHead as TableHead7, TableHeader as TableHeader7, TableRow as TableRow7 } from "@mdxui/primitives/table";
|
|
3988
3978
|
import { AlertTriangle, BarChart3 as BarChart33, Check as Check3, Copy as Copy3, Key as Key6, MoreHorizontal as MoreHorizontal4, Pencil, Plus as Plus5, Trash2 as Trash24 } from "lucide-react";
|
|
3989
|
-
import { useState as
|
|
3979
|
+
import { useState as useState13 } from "react";
|
|
3990
3980
|
import { toast as toast5 } from "sonner";
|
|
3991
|
-
import { Fragment as
|
|
3981
|
+
import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3992
3982
|
function maskKey(key) {
|
|
3993
3983
|
const prefix = key.substring(0, 8);
|
|
3994
3984
|
return `${prefix}${"\u2022".repeat(16)}`;
|
|
@@ -4022,40 +4012,76 @@ function StatusIndicator({ status }) {
|
|
|
4022
4012
|
}
|
|
4023
4013
|
};
|
|
4024
4014
|
const { color, label } = config[status];
|
|
4025
|
-
return /* @__PURE__ */
|
|
4015
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
4026
4016
|
/* @__PURE__ */ jsx36("span", { className: `h-2 w-2 rounded-full ${color}` }),
|
|
4027
4017
|
/* @__PURE__ */ jsx36("span", { className: "text-sm", children: label })
|
|
4028
4018
|
] });
|
|
4029
4019
|
}
|
|
4030
|
-
function KeysPage(
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
const [
|
|
4039
|
-
const [
|
|
4040
|
-
const [
|
|
4041
|
-
const [
|
|
4042
|
-
const
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4020
|
+
function KeysPage({
|
|
4021
|
+
keys: initialKeys,
|
|
4022
|
+
onCreateKey,
|
|
4023
|
+
onRevokeKey,
|
|
4024
|
+
onRenameKey,
|
|
4025
|
+
hideHeader = false,
|
|
4026
|
+
className
|
|
4027
|
+
} = {}) {
|
|
4028
|
+
const [keys, setKeys] = useState13(initialKeys ?? mockApiKeys);
|
|
4029
|
+
const [newKeyName, setNewKeyName] = useState13("");
|
|
4030
|
+
const [newlyCreatedKey, setNewlyCreatedKey] = useState13(null);
|
|
4031
|
+
const [createDialogOpen, setCreateDialogOpen] = useState13(false);
|
|
4032
|
+
const [revokeDialogOpen, setRevokeDialogOpen] = useState13(false);
|
|
4033
|
+
const [renameDialogOpen, setRenameDialogOpen] = useState13(false);
|
|
4034
|
+
const [keyToRevoke, setKeyToRevoke] = useState13(null);
|
|
4035
|
+
const [keyToRename, setKeyToRename] = useState13(null);
|
|
4036
|
+
const [renameValue, setRenameValue] = useState13("");
|
|
4037
|
+
const [copiedKeyId, setCopiedKeyId] = useState13(null);
|
|
4038
|
+
const [newKeyCopied, setNewKeyCopied] = useState13(false);
|
|
4039
|
+
const handleCreateKey = async () => {
|
|
4040
|
+
const name = newKeyName || "Untitled Key";
|
|
4041
|
+
if (onCreateKey) {
|
|
4042
|
+
try {
|
|
4043
|
+
const result = await onCreateKey(name);
|
|
4044
|
+
const newKey = {
|
|
4045
|
+
id: result.id,
|
|
4046
|
+
name,
|
|
4047
|
+
key: result.key,
|
|
4048
|
+
created: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
4049
|
+
lastUsed: null,
|
|
4050
|
+
status: "never_used"
|
|
4051
|
+
};
|
|
4052
|
+
setKeys([...keys, newKey]);
|
|
4053
|
+
setNewlyCreatedKey(result.key);
|
|
4054
|
+
} catch {
|
|
4055
|
+
toast5.error("Failed to create API key");
|
|
4056
|
+
return;
|
|
4057
|
+
}
|
|
4058
|
+
} else {
|
|
4059
|
+
const newKey = {
|
|
4060
|
+
id: String(Date.now()),
|
|
4061
|
+
name,
|
|
4062
|
+
key: `sk_live_${Math.random().toString(36).substring(2, 15)}${Math.random().toString(36).substring(2, 15)}`,
|
|
4063
|
+
created: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
4064
|
+
lastUsed: null,
|
|
4065
|
+
status: "never_used"
|
|
4066
|
+
};
|
|
4067
|
+
setKeys([...keys, newKey]);
|
|
4068
|
+
setNewlyCreatedKey(newKey.key);
|
|
4069
|
+
}
|
|
4053
4070
|
setNewKeyName("");
|
|
4054
4071
|
};
|
|
4055
|
-
const handleRevokeKey = () => {
|
|
4072
|
+
const handleRevokeKey = async () => {
|
|
4056
4073
|
if (keyToRevoke) {
|
|
4057
4074
|
const keyName = keyToRevoke.name;
|
|
4058
|
-
|
|
4075
|
+
const keyId = keyToRevoke.id;
|
|
4076
|
+
if (onRevokeKey) {
|
|
4077
|
+
try {
|
|
4078
|
+
await onRevokeKey(keyId);
|
|
4079
|
+
} catch {
|
|
4080
|
+
toast5.error("Failed to revoke API key");
|
|
4081
|
+
return;
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
setKeys(keys.filter((k) => k.id !== keyId));
|
|
4059
4085
|
setKeyToRevoke(null);
|
|
4060
4086
|
setRevokeDialogOpen(false);
|
|
4061
4087
|
toast5.success("API key revoked", {
|
|
@@ -4063,10 +4089,19 @@ function KeysPage() {
|
|
|
4063
4089
|
});
|
|
4064
4090
|
}
|
|
4065
4091
|
};
|
|
4066
|
-
const handleRenameKey = () => {
|
|
4092
|
+
const handleRenameKey = async () => {
|
|
4067
4093
|
if (keyToRename && renameValue.trim()) {
|
|
4068
4094
|
const newName = renameValue.trim();
|
|
4069
|
-
|
|
4095
|
+
const keyId = keyToRename.id;
|
|
4096
|
+
if (onRenameKey) {
|
|
4097
|
+
try {
|
|
4098
|
+
await onRenameKey(keyId, newName);
|
|
4099
|
+
} catch {
|
|
4100
|
+
toast5.error("Failed to rename API key");
|
|
4101
|
+
return;
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
setKeys(keys.map((k) => k.id === keyId ? { ...k, name: newName } : k));
|
|
4070
4105
|
setKeyToRename(null);
|
|
4071
4106
|
setRenameDialogOpen(false);
|
|
4072
4107
|
setRenameValue("");
|
|
@@ -4075,15 +4110,15 @@ function KeysPage() {
|
|
|
4075
4110
|
});
|
|
4076
4111
|
}
|
|
4077
4112
|
};
|
|
4078
|
-
const handleCopyNewKey = () =>
|
|
4113
|
+
const handleCopyNewKey = async () => {
|
|
4079
4114
|
if (newlyCreatedKey) {
|
|
4080
|
-
|
|
4115
|
+
await navigator.clipboard.writeText(newlyCreatedKey);
|
|
4081
4116
|
setNewKeyCopied(true);
|
|
4082
4117
|
setCopiedKeyId("new");
|
|
4083
4118
|
setTimeout(() => setCopiedKeyId(null), 2e3);
|
|
4084
4119
|
toast5.success("API key copied to clipboard");
|
|
4085
4120
|
}
|
|
4086
|
-
}
|
|
4121
|
+
};
|
|
4087
4122
|
const closeCreateDialog = () => {
|
|
4088
4123
|
setCreateDialogOpen(false);
|
|
4089
4124
|
setNewlyCreatedKey(null);
|
|
@@ -4099,52 +4134,52 @@ function KeysPage() {
|
|
|
4099
4134
|
setKeyToRevoke(apiKey);
|
|
4100
4135
|
setRevokeDialogOpen(true);
|
|
4101
4136
|
};
|
|
4102
|
-
return /* @__PURE__ */
|
|
4103
|
-
/* @__PURE__ */ jsx36("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4137
|
+
return /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
4138
|
+
!hideHeader && /* @__PURE__ */ jsx36("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4104
4139
|
/* @__PURE__ */ jsx36(SidebarTrigger4, { className: "-ml-1" }),
|
|
4105
4140
|
/* @__PURE__ */ jsx36(Separator6, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4106
4141
|
/* @__PURE__ */ jsx36(Breadcrumb4, { children: /* @__PURE__ */ jsx36(BreadcrumbList4, { children: /* @__PURE__ */ jsx36(BreadcrumbItem4, { children: /* @__PURE__ */ jsx36(BreadcrumbPage4, { children: "API Keys" }) }) }) })
|
|
4107
4142
|
] }) }),
|
|
4108
|
-
/* @__PURE__ */
|
|
4109
|
-
/* @__PURE__ */
|
|
4110
|
-
/* @__PURE__ */
|
|
4143
|
+
/* @__PURE__ */ jsxs30("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
4144
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between", children: [
|
|
4145
|
+
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4111
4146
|
/* @__PURE__ */ jsx36("h1", { className: "text-2xl font-bold", children: "API Keys" }),
|
|
4112
4147
|
/* @__PURE__ */ jsx36("p", { className: "text-muted-foreground", children: "Manage your API keys for accessing the API." })
|
|
4113
4148
|
] }),
|
|
4114
|
-
/* @__PURE__ */
|
|
4115
|
-
/* @__PURE__ */ jsx36(DialogTrigger4, { asChild: true, children: /* @__PURE__ */
|
|
4149
|
+
/* @__PURE__ */ jsxs30(Dialog7, { open: createDialogOpen, onOpenChange: setCreateDialogOpen, children: [
|
|
4150
|
+
/* @__PURE__ */ jsx36(DialogTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs30(Button13, { children: [
|
|
4116
4151
|
/* @__PURE__ */ jsx36(Plus5, { className: "h-4 w-4" }),
|
|
4117
4152
|
"Create Key"
|
|
4118
4153
|
] }) }),
|
|
4119
|
-
/* @__PURE__ */ jsx36(DialogContent7, { children: newlyCreatedKey ? /* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
4154
|
+
/* @__PURE__ */ jsx36(DialogContent7, { children: newlyCreatedKey ? /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
4155
|
+
/* @__PURE__ */ jsxs30(DialogHeader6, { children: [
|
|
4121
4156
|
/* @__PURE__ */ jsx36(DialogTitle6, { children: "API Key Created" }),
|
|
4122
4157
|
/* @__PURE__ */ jsx36(DialogDescription5, { children: "Your new API key has been created successfully." })
|
|
4123
4158
|
] }),
|
|
4124
|
-
/* @__PURE__ */
|
|
4159
|
+
/* @__PURE__ */ jsxs30(Alert, { variant: "warning", children: [
|
|
4125
4160
|
/* @__PURE__ */ jsx36(AlertTriangle, { className: "h-4 w-4" }),
|
|
4126
4161
|
/* @__PURE__ */ jsx36(AlertDescription, { children: "Copy your API key now. You won't be able to see it again." })
|
|
4127
4162
|
] }),
|
|
4128
|
-
/* @__PURE__ */
|
|
4163
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
4129
4164
|
/* @__PURE__ */ jsx36(Input8, { value: newlyCreatedKey, readOnly: true, className: "font-mono text-sm" }),
|
|
4130
4165
|
/* @__PURE__ */ jsx36(Button13, { variant: "outline", size: "icon", onClick: handleCopyNewKey, children: copiedKeyId === "new" ? /* @__PURE__ */ jsx36(Check3, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx36(Copy3, { className: "h-4 w-4" }) })
|
|
4131
4166
|
] }),
|
|
4132
4167
|
/* @__PURE__ */ jsx36(DialogFooter6, { children: /* @__PURE__ */ jsx36(Button13, { onClick: closeCreateDialog, disabled: !newKeyCopied, children: "Done" }) })
|
|
4133
|
-
] }) : /* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4168
|
+
] }) : /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
4169
|
+
/* @__PURE__ */ jsxs30(DialogHeader6, { children: [
|
|
4135
4170
|
/* @__PURE__ */ jsx36(DialogTitle6, { children: "Create API Key" }),
|
|
4136
4171
|
/* @__PURE__ */ jsx36(DialogDescription5, { children: "Give your API key a name to help you identify it later." })
|
|
4137
4172
|
] }),
|
|
4138
4173
|
/* @__PURE__ */ jsx36(Input8, { placeholder: "Key name (optional)", value: newKeyName, onChange: (e) => setNewKeyName(e.target.value) }),
|
|
4139
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ jsxs30(DialogFooter6, { children: [
|
|
4140
4175
|
/* @__PURE__ */ jsx36(Button13, { variant: "outline", onClick: closeCreateDialog, children: "Cancel" }),
|
|
4141
4176
|
/* @__PURE__ */ jsx36(Button13, { onClick: handleCreateKey, children: "Create" })
|
|
4142
4177
|
] })
|
|
4143
4178
|
] }) })
|
|
4144
4179
|
] })
|
|
4145
4180
|
] }),
|
|
4146
|
-
/* @__PURE__ */ jsx36("div", { className: "rounded-md border", children: /* @__PURE__ */
|
|
4147
|
-
/* @__PURE__ */ jsx36(TableHeader7, { children: /* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ jsx36("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs30(Table7, { children: [
|
|
4182
|
+
/* @__PURE__ */ jsx36(TableHeader7, { children: /* @__PURE__ */ jsxs30(TableRow7, { children: [
|
|
4148
4183
|
/* @__PURE__ */ jsx36(TableHead7, { className: "pl-4", children: "Name" }),
|
|
4149
4184
|
/* @__PURE__ */ jsx36(TableHead7, { children: "Key" }),
|
|
4150
4185
|
/* @__PURE__ */ jsx36(TableHead7, { children: "Status" }),
|
|
@@ -4152,39 +4187,39 @@ function KeysPage() {
|
|
|
4152
4187
|
/* @__PURE__ */ jsx36(TableHead7, { children: "Last Used" }),
|
|
4153
4188
|
/* @__PURE__ */ jsx36(TableHead7, { className: "w-[60px]" })
|
|
4154
4189
|
] }) }),
|
|
4155
|
-
/* @__PURE__ */
|
|
4156
|
-
keys.map((apiKey) => /* @__PURE__ */
|
|
4190
|
+
/* @__PURE__ */ jsxs30(TableBody7, { children: [
|
|
4191
|
+
keys.map((apiKey) => /* @__PURE__ */ jsxs30(TableRow7, { children: [
|
|
4157
4192
|
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4 pl-4 font-medium", children: apiKey.name }),
|
|
4158
4193
|
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4 font-mono text-sm text-muted-foreground", children: maskKey(apiKey.key) }),
|
|
4159
4194
|
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4", children: /* @__PURE__ */ jsx36(StatusIndicator, { status: apiKey.status }) }),
|
|
4160
4195
|
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4", children: apiKey.created }),
|
|
4161
4196
|
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4 text-muted-foreground", children: getRelativeTime(apiKey.lastUsed) }),
|
|
4162
|
-
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4 pr-4", children: /* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ jsx36(TableCell7, { className: "py-4 pr-4", children: /* @__PURE__ */ jsxs30(DropdownMenu4, { children: [
|
|
4163
4198
|
/* @__PURE__ */ jsx36(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsx36(Button13, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx36(MoreHorizontal4, { className: "h-4 w-4" }) }) }),
|
|
4164
|
-
/* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4199
|
+
/* @__PURE__ */ jsxs30(DropdownMenuContent4, { align: "end", children: [
|
|
4200
|
+
/* @__PURE__ */ jsxs30(DropdownMenuItem4, { onClick: () => openRenameDialog(apiKey), children: [
|
|
4166
4201
|
/* @__PURE__ */ jsx36(Pencil, { className: "h-4 w-4" }),
|
|
4167
4202
|
"Rename"
|
|
4168
4203
|
] }),
|
|
4169
|
-
/* @__PURE__ */
|
|
4204
|
+
/* @__PURE__ */ jsxs30(DropdownMenuItem4, { children: [
|
|
4170
4205
|
/* @__PURE__ */ jsx36(BarChart33, { className: "h-4 w-4" }),
|
|
4171
4206
|
"View Usage"
|
|
4172
4207
|
] }),
|
|
4173
4208
|
/* @__PURE__ */ jsx36(DropdownMenuSeparator2, {}),
|
|
4174
|
-
/* @__PURE__ */
|
|
4209
|
+
/* @__PURE__ */ jsxs30(DropdownMenuItem4, { className: "text-destructive focus:text-destructive", onClick: () => openRevokeDialog(apiKey), children: [
|
|
4175
4210
|
/* @__PURE__ */ jsx36(Trash24, { className: "h-4 w-4" }),
|
|
4176
4211
|
"Revoke"
|
|
4177
4212
|
] })
|
|
4178
4213
|
] })
|
|
4179
4214
|
] }) })
|
|
4180
4215
|
] }, apiKey.id)),
|
|
4181
|
-
keys.length === 0 && /* @__PURE__ */ jsx36(TableRow7, { children: /* @__PURE__ */ jsx36(TableCell7, { colSpan: 6, className: "py-16", children: /* @__PURE__ */
|
|
4216
|
+
keys.length === 0 && /* @__PURE__ */ jsx36(TableRow7, { children: /* @__PURE__ */ jsx36(TableCell7, { colSpan: 6, className: "py-16", children: /* @__PURE__ */ jsxs30("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
4182
4217
|
/* @__PURE__ */ jsx36("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx36(Key6, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
4183
|
-
/* @__PURE__ */
|
|
4218
|
+
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4184
4219
|
/* @__PURE__ */ jsx36("p", { className: "font-medium", children: "No API keys yet" }),
|
|
4185
4220
|
/* @__PURE__ */ jsx36("p", { className: "text-sm text-muted-foreground mt-1", children: "Create your first API key to start making requests." })
|
|
4186
4221
|
] }),
|
|
4187
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsxs30(Button13, { onClick: () => setCreateDialogOpen(true), className: "mt-2", children: [
|
|
4188
4223
|
/* @__PURE__ */ jsx36(Plus5, { className: "h-4 w-4" }),
|
|
4189
4224
|
"Create Your First Key"
|
|
4190
4225
|
] })
|
|
@@ -4192,13 +4227,13 @@ function KeysPage() {
|
|
|
4192
4227
|
] })
|
|
4193
4228
|
] }) })
|
|
4194
4229
|
] }),
|
|
4195
|
-
/* @__PURE__ */ jsx36(Dialog7, { open: renameDialogOpen, onOpenChange: setRenameDialogOpen, children: /* @__PURE__ */
|
|
4196
|
-
/* @__PURE__ */
|
|
4230
|
+
/* @__PURE__ */ jsx36(Dialog7, { open: renameDialogOpen, onOpenChange: setRenameDialogOpen, children: /* @__PURE__ */ jsxs30(DialogContent7, { children: [
|
|
4231
|
+
/* @__PURE__ */ jsxs30(DialogHeader6, { children: [
|
|
4197
4232
|
/* @__PURE__ */ jsx36(DialogTitle6, { children: "Rename API Key" }),
|
|
4198
4233
|
/* @__PURE__ */ jsx36(DialogDescription5, { children: "Enter a new name for this API key." })
|
|
4199
4234
|
] }),
|
|
4200
4235
|
/* @__PURE__ */ jsx36(Input8, { placeholder: "Key name", value: renameValue, onChange: (e) => setRenameValue(e.target.value) }),
|
|
4201
|
-
/* @__PURE__ */
|
|
4236
|
+
/* @__PURE__ */ jsxs30(DialogFooter6, { children: [
|
|
4202
4237
|
/* @__PURE__ */ jsx36(
|
|
4203
4238
|
Button13,
|
|
4204
4239
|
{
|
|
@@ -4214,16 +4249,16 @@ function KeysPage() {
|
|
|
4214
4249
|
/* @__PURE__ */ jsx36(Button13, { onClick: handleRenameKey, disabled: !renameValue.trim(), children: "Rename" })
|
|
4215
4250
|
] })
|
|
4216
4251
|
] }) }),
|
|
4217
|
-
/* @__PURE__ */ jsx36(Dialog7, { open: revokeDialogOpen, onOpenChange: setRevokeDialogOpen, children: /* @__PURE__ */
|
|
4218
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx36(Dialog7, { open: revokeDialogOpen, onOpenChange: setRevokeDialogOpen, children: /* @__PURE__ */ jsxs30(DialogContent7, { children: [
|
|
4253
|
+
/* @__PURE__ */ jsxs30(DialogHeader6, { children: [
|
|
4219
4254
|
/* @__PURE__ */ jsx36(DialogTitle6, { children: "Revoke API Key" }),
|
|
4220
|
-
/* @__PURE__ */
|
|
4255
|
+
/* @__PURE__ */ jsxs30(DialogDescription5, { children: [
|
|
4221
4256
|
'Are you sure you want to revoke "',
|
|
4222
|
-
keyToRevoke
|
|
4257
|
+
keyToRevoke?.name,
|
|
4223
4258
|
'"? This action cannot be undone.'
|
|
4224
4259
|
] })
|
|
4225
4260
|
] }),
|
|
4226
|
-
/* @__PURE__ */
|
|
4261
|
+
/* @__PURE__ */ jsxs30(DialogFooter6, { children: [
|
|
4227
4262
|
/* @__PURE__ */ jsx36(
|
|
4228
4263
|
Button13,
|
|
4229
4264
|
{
|
|
@@ -4251,10 +4286,10 @@ import { Separator as Separator7 } from "@mdxui/primitives/separator";
|
|
|
4251
4286
|
import { SidebarTrigger as SidebarTrigger5 } from "@mdxui/primitives/sidebar";
|
|
4252
4287
|
import { Skeleton } from "@mdxui/primitives/skeleton";
|
|
4253
4288
|
import { Activity as Activity2, AlertTriangle as AlertTriangle2, BarChart3 as BarChart34, ChevronDown, DollarSign as DollarSign2 } from "lucide-react";
|
|
4254
|
-
import { useEffect as
|
|
4289
|
+
import { useEffect as useEffect6, useState as useState14 } from "react";
|
|
4255
4290
|
import { Link as Link3 } from "react-router-dom";
|
|
4256
4291
|
import { Area as Area3, AreaChart as AreaChart3, Bar as Bar2, BarChart as BarChart2, ReferenceLine as ReferenceLine2, XAxis as XAxis4, YAxis as YAxis4 } from "recharts";
|
|
4257
|
-
import { Fragment as
|
|
4292
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4258
4293
|
var chartConfig = {
|
|
4259
4294
|
requests: {
|
|
4260
4295
|
label: "Requests",
|
|
@@ -4265,12 +4300,12 @@ function Sparkline({ data, color }) {
|
|
|
4265
4300
|
return /* @__PURE__ */ jsx37("div", { className: "h-8 w-20", children: /* @__PURE__ */ jsx37(AreaChart3, { data, width: 80, height: 32, margin: { top: 2, right: 0, bottom: 0, left: 0 }, children: /* @__PURE__ */ jsx37(Area3, { type: "monotone", dataKey: "value", stroke: color, fill: color, fillOpacity: 0.2, strokeWidth: 1.5 }) }) });
|
|
4266
4301
|
}
|
|
4267
4302
|
function StatCardSkeleton() {
|
|
4268
|
-
return /* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4303
|
+
return /* @__PURE__ */ jsxs31(Card15, { children: [
|
|
4304
|
+
/* @__PURE__ */ jsxs31(CardHeader13, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4270
4305
|
/* @__PURE__ */ jsx37(Skeleton, { className: "h-4 w-24" }),
|
|
4271
4306
|
/* @__PURE__ */ jsx37(Skeleton, { className: "h-4 w-4" })
|
|
4272
4307
|
] }),
|
|
4273
|
-
/* @__PURE__ */
|
|
4308
|
+
/* @__PURE__ */ jsxs31(CardContent14, { children: [
|
|
4274
4309
|
/* @__PURE__ */ jsx37(Skeleton, { className: "h-8 w-20 mb-1" }),
|
|
4275
4310
|
/* @__PURE__ */ jsx37(Skeleton, { className: "h-3 w-32" })
|
|
4276
4311
|
] })
|
|
@@ -4281,19 +4316,18 @@ function ChartSkeleton() {
|
|
|
4281
4316
|
return /* @__PURE__ */ jsx37("div", { className: "h-[500px] w-full flex items-end justify-around gap-2 px-8", children: SKELETON_HEIGHTS.map((height, i) => /* @__PURE__ */ jsx37(Skeleton, { className: "w-full", style: { height: `${height}%` } }, i.toString())) });
|
|
4282
4317
|
}
|
|
4283
4318
|
function EmptyState() {
|
|
4284
|
-
return /* @__PURE__ */
|
|
4319
|
+
return /* @__PURE__ */ jsxs31("div", { className: "h-[500px] w-full flex flex-col items-center justify-center text-muted-foreground", children: [
|
|
4285
4320
|
/* @__PURE__ */ jsx37(BarChart34, { className: "h-12 w-12 mb-4 opacity-50" }),
|
|
4286
4321
|
/* @__PURE__ */ jsx37("p", { className: "text-lg font-medium", children: "No data available" }),
|
|
4287
4322
|
/* @__PURE__ */ jsx37("p", { className: "text-sm", children: "There's no usage data for this time period." })
|
|
4288
4323
|
] });
|
|
4289
4324
|
}
|
|
4290
4325
|
function OverviewPage() {
|
|
4291
|
-
|
|
4292
|
-
const [
|
|
4293
|
-
const [
|
|
4294
|
-
const [
|
|
4295
|
-
|
|
4296
|
-
useEffect7(() => {
|
|
4326
|
+
const [selectedPeriod, setSelectedPeriod] = useState14("30d");
|
|
4327
|
+
const [isLoading, setIsLoading] = useState14(true);
|
|
4328
|
+
const [stats, setStats] = useState14(null);
|
|
4329
|
+
const [usageData, setUsageData] = useState14([]);
|
|
4330
|
+
useEffect6(() => {
|
|
4297
4331
|
let cancelled = false;
|
|
4298
4332
|
const timer = setTimeout(() => {
|
|
4299
4333
|
if (!cancelled) {
|
|
@@ -4311,66 +4345,66 @@ function OverviewPage() {
|
|
|
4311
4345
|
setIsLoading(true);
|
|
4312
4346
|
setSelectedPeriod(period);
|
|
4313
4347
|
};
|
|
4314
|
-
const selectedLabel =
|
|
4315
|
-
return /* @__PURE__ */
|
|
4316
|
-
/* @__PURE__ */ jsx37("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4348
|
+
const selectedLabel = timePeriodOptions.find((opt) => opt.value === selectedPeriod)?.label;
|
|
4349
|
+
return /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4350
|
+
/* @__PURE__ */ jsx37("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4317
4351
|
/* @__PURE__ */ jsx37(SidebarTrigger5, { className: "-ml-1" }),
|
|
4318
4352
|
/* @__PURE__ */ jsx37(Separator7, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4319
4353
|
/* @__PURE__ */ jsx37(Breadcrumb5, { children: /* @__PURE__ */ jsx37(BreadcrumbList5, { children: /* @__PURE__ */ jsx37(BreadcrumbItem5, { children: /* @__PURE__ */ jsx37(BreadcrumbPage5, { children: "Overview" }) }) }) })
|
|
4320
4354
|
] }) }),
|
|
4321
|
-
/* @__PURE__ */
|
|
4322
|
-
/* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-1 flex-col gap-4 px-16 py-4 pt-0", children: [
|
|
4356
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
4323
4357
|
/* @__PURE__ */ jsx37("h1", { className: "text-2xl font-semibold", children: "Usage" }),
|
|
4324
|
-
/* @__PURE__ */
|
|
4325
|
-
/* @__PURE__ */ jsx37(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */
|
|
4358
|
+
/* @__PURE__ */ jsxs31(DropdownMenu5, { children: [
|
|
4359
|
+
/* @__PURE__ */ jsx37(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs31(Button14, { variant: "outline", className: "w-[140px] justify-between", children: [
|
|
4326
4360
|
selectedLabel,
|
|
4327
4361
|
/* @__PURE__ */ jsx37(ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
4328
4362
|
] }) }),
|
|
4329
4363
|
/* @__PURE__ */ jsx37(DropdownMenuContent5, { align: "end", className: "w-[140px]", children: timePeriodOptions.map((option) => /* @__PURE__ */ jsx37(DropdownMenuItem5, { onClick: () => handlePeriodChange(option.value), children: option.label }, option.value)) })
|
|
4330
4364
|
] })
|
|
4331
4365
|
] }),
|
|
4332
|
-
/* @__PURE__ */ jsx37("div", { className: "grid auto-rows-min gap-4 md:grid-cols-3", children: isLoading ? /* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx37("div", { className: "grid auto-rows-min gap-4 md:grid-cols-3", children: isLoading ? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4333
4367
|
/* @__PURE__ */ jsx37(StatCardSkeleton, {}),
|
|
4334
4368
|
/* @__PURE__ */ jsx37(StatCardSkeleton, {}),
|
|
4335
4369
|
/* @__PURE__ */ jsx37(StatCardSkeleton, {})
|
|
4336
|
-
] }) : /* @__PURE__ */
|
|
4337
|
-
/* @__PURE__ */ jsx37(Link3, { to: "/requests", className: "block", children: /* @__PURE__ */
|
|
4338
|
-
/* @__PURE__ */
|
|
4370
|
+
] }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4371
|
+
/* @__PURE__ */ jsx37(Link3, { to: "/requests", className: "block", children: /* @__PURE__ */ jsxs31(Card15, { className: "transition-colors hover:bg-muted/50 cursor-pointer", children: [
|
|
4372
|
+
/* @__PURE__ */ jsxs31(CardHeader13, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4339
4373
|
/* @__PURE__ */ jsx37(CardTitle13, { className: "text-sm font-medium", children: "Total Requests" }),
|
|
4340
4374
|
/* @__PURE__ */ jsx37(Activity2, { className: "h-4 w-4 text-muted-foreground" })
|
|
4341
4375
|
] }),
|
|
4342
|
-
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */
|
|
4343
|
-
/* @__PURE__ */
|
|
4344
|
-
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children:
|
|
4376
|
+
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */ jsxs31("div", { className: "flex items-end justify-between", children: [
|
|
4377
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
4378
|
+
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children: stats?.totalRequests.toLocaleString() ?? "\u2014" }),
|
|
4345
4379
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: selectedLabel })
|
|
4346
4380
|
] }),
|
|
4347
4381
|
/* @__PURE__ */ jsx37(Sparkline, { data: usageData.slice(-7).map((d) => ({ value: d.requests })), color: "var(--chart-1)" })
|
|
4348
4382
|
] }) })
|
|
4349
4383
|
] }) }),
|
|
4350
|
-
/* @__PURE__ */ jsx37(Link3, { to: "/requests", className: "block", children: /* @__PURE__ */
|
|
4351
|
-
/* @__PURE__ */
|
|
4384
|
+
/* @__PURE__ */ jsx37(Link3, { to: "/requests", className: "block", children: /* @__PURE__ */ jsxs31(Card15, { className: "transition-colors hover:bg-muted/50 cursor-pointer", children: [
|
|
4385
|
+
/* @__PURE__ */ jsxs31(CardHeader13, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4352
4386
|
/* @__PURE__ */ jsx37(CardTitle13, { className: "text-sm font-medium", children: "Total Cost" }),
|
|
4353
4387
|
/* @__PURE__ */ jsx37(DollarSign2, { className: "h-4 w-4 text-muted-foreground" })
|
|
4354
4388
|
] }),
|
|
4355
|
-
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */
|
|
4356
|
-
/* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4389
|
+
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */ jsxs31("div", { className: "flex items-end justify-between", children: [
|
|
4390
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
4391
|
+
/* @__PURE__ */ jsxs31("div", { className: "text-2xl font-bold", children: [
|
|
4358
4392
|
"$",
|
|
4359
|
-
|
|
4393
|
+
stats?.totalCost.toFixed(2) ?? "\u2014"
|
|
4360
4394
|
] }),
|
|
4361
4395
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: selectedLabel })
|
|
4362
4396
|
] }),
|
|
4363
4397
|
/* @__PURE__ */ jsx37(Sparkline, { data: usageData.slice(-7).map((d) => ({ value: d.requests * 0.02 })), color: "var(--chart-2)" })
|
|
4364
4398
|
] }) })
|
|
4365
4399
|
] }) }),
|
|
4366
|
-
/* @__PURE__ */ jsx37(Link3, { to: "/requests?status=error", className: "block", children: /* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4400
|
+
/* @__PURE__ */ jsx37(Link3, { to: "/requests?status=error", className: "block", children: /* @__PURE__ */ jsxs31(Card15, { className: "transition-colors hover:bg-muted/50 cursor-pointer", children: [
|
|
4401
|
+
/* @__PURE__ */ jsxs31(CardHeader13, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4368
4402
|
/* @__PURE__ */ jsx37(CardTitle13, { className: "text-sm font-medium", children: "Error Count" }),
|
|
4369
4403
|
/* @__PURE__ */ jsx37(AlertTriangle2, { className: "h-4 w-4 text-muted-foreground" })
|
|
4370
4404
|
] }),
|
|
4371
|
-
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */
|
|
4372
|
-
/* @__PURE__ */
|
|
4373
|
-
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children:
|
|
4405
|
+
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */ jsxs31("div", { className: "flex items-end justify-between", children: [
|
|
4406
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
4407
|
+
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children: stats?.errorCount ?? "\u2014" }),
|
|
4374
4408
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: "Failed requests" })
|
|
4375
4409
|
] }),
|
|
4376
4410
|
/* @__PURE__ */ jsx37(
|
|
@@ -4385,13 +4419,13 @@ function OverviewPage() {
|
|
|
4385
4419
|
] }) })
|
|
4386
4420
|
] }) })
|
|
4387
4421
|
] }) }),
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */ jsx37(CardHeader13, { children: /* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsxs31(Card15, { className: "flex-1", children: [
|
|
4423
|
+
/* @__PURE__ */ jsx37(CardHeader13, { children: /* @__PURE__ */ jsxs31(CardTitle13, { children: [
|
|
4390
4424
|
"API Usage (",
|
|
4391
4425
|
selectedLabel,
|
|
4392
4426
|
")"
|
|
4393
4427
|
] }) }),
|
|
4394
|
-
/* @__PURE__ */ jsx37(CardContent14, { children: isLoading ? /* @__PURE__ */ jsx37(ChartSkeleton, {}) : usageData.length === 0 ? /* @__PURE__ */ jsx37(EmptyState, {}) : /* @__PURE__ */ jsx37(ChartContainer4, { config: chartConfig, className: "h-[500px] w-full", children: /* @__PURE__ */
|
|
4428
|
+
/* @__PURE__ */ jsx37(CardContent14, { children: isLoading ? /* @__PURE__ */ jsx37(ChartSkeleton, {}) : usageData.length === 0 ? /* @__PURE__ */ jsx37(EmptyState, {}) : /* @__PURE__ */ jsx37(ChartContainer4, { config: chartConfig, className: "h-[500px] w-full", children: /* @__PURE__ */ jsxs31(BarChart2, { data: usageData, children: [
|
|
4395
4429
|
/* @__PURE__ */ jsx37(
|
|
4396
4430
|
XAxis4,
|
|
4397
4431
|
{
|
|
@@ -4441,8 +4475,8 @@ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "
|
|
|
4441
4475
|
import { SidebarTrigger as SidebarTrigger6 } from "@mdxui/primitives/sidebar";
|
|
4442
4476
|
import { Table as Table8, TableBody as TableBody8, TableCell as TableCell8, TableHead as TableHead8, TableHeader as TableHeader8, TableRow as TableRow8 } from "@mdxui/primitives/table";
|
|
4443
4477
|
import { Activity as Activity3, ChevronDown as ChevronDown2 } from "lucide-react";
|
|
4444
|
-
import { useState as
|
|
4445
|
-
import { Fragment as
|
|
4478
|
+
import { useState as useState15 } from "react";
|
|
4479
|
+
import { Fragment as Fragment11, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4446
4480
|
var statusFilterOptions = [
|
|
4447
4481
|
{ value: "all", label: "All Status" },
|
|
4448
4482
|
{ value: "success", label: "Success (2xx)" },
|
|
@@ -4476,10 +4510,9 @@ function formatCost(cost) {
|
|
|
4476
4510
|
return `$${cost.toFixed(3)}`;
|
|
4477
4511
|
}
|
|
4478
4512
|
function RequestsPage() {
|
|
4479
|
-
|
|
4480
|
-
const [
|
|
4481
|
-
const [
|
|
4482
|
-
const [sheetOpen, setSheetOpen] = useState16(false);
|
|
4513
|
+
const [statusFilter, setStatusFilter] = useState15("all");
|
|
4514
|
+
const [selectedRequest, setSelectedRequest] = useState15(null);
|
|
4515
|
+
const [sheetOpen, setSheetOpen] = useState15(false);
|
|
4483
4516
|
const filteredRequests = mockRequests.filter((request) => {
|
|
4484
4517
|
if (statusFilter === "all") return true;
|
|
4485
4518
|
if (statusFilter === "success") return request.statusCode >= 200 && request.statusCode < 300;
|
|
@@ -4491,28 +4524,28 @@ function RequestsPage() {
|
|
|
4491
4524
|
setSelectedRequest(request);
|
|
4492
4525
|
setSheetOpen(true);
|
|
4493
4526
|
};
|
|
4494
|
-
return /* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */ jsx38("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4527
|
+
return /* @__PURE__ */ jsxs32(Fragment11, { children: [
|
|
4528
|
+
/* @__PURE__ */ jsx38("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4496
4529
|
/* @__PURE__ */ jsx38(SidebarTrigger6, { className: "-ml-1" }),
|
|
4497
4530
|
/* @__PURE__ */ jsx38(Separator8, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4498
4531
|
/* @__PURE__ */ jsx38(Breadcrumb6, { children: /* @__PURE__ */ jsx38(BreadcrumbList6, { children: /* @__PURE__ */ jsx38(BreadcrumbItem6, { children: /* @__PURE__ */ jsx38(BreadcrumbPage6, { children: "Requests" }) }) }) })
|
|
4499
4532
|
] }) }),
|
|
4500
|
-
/* @__PURE__ */
|
|
4501
|
-
/* @__PURE__ */
|
|
4502
|
-
/* @__PURE__ */
|
|
4533
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4534
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
|
|
4535
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4503
4536
|
/* @__PURE__ */ jsx38("h1", { className: "text-2xl font-bold", children: "Requests" }),
|
|
4504
4537
|
/* @__PURE__ */ jsx38("p", { className: "text-muted-foreground", children: "Monitor and debug your API request logs." })
|
|
4505
4538
|
] }),
|
|
4506
|
-
/* @__PURE__ */
|
|
4507
|
-
/* @__PURE__ */ jsx38(DropdownMenuTrigger6, { asChild: true, children: /* @__PURE__ */
|
|
4508
|
-
|
|
4539
|
+
/* @__PURE__ */ jsxs32(DropdownMenu6, { children: [
|
|
4540
|
+
/* @__PURE__ */ jsx38(DropdownMenuTrigger6, { asChild: true, children: /* @__PURE__ */ jsxs32(Button15, { variant: "outline", className: "w-[160px] justify-between", children: [
|
|
4541
|
+
statusFilterOptions.find((o) => o.value === statusFilter)?.label,
|
|
4509
4542
|
/* @__PURE__ */ jsx38(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
4510
4543
|
] }) }),
|
|
4511
4544
|
/* @__PURE__ */ jsx38(DropdownMenuContent6, { align: "end", className: "w-[160px]", children: statusFilterOptions.map((option) => /* @__PURE__ */ jsx38(DropdownMenuItem6, { onClick: () => setStatusFilter(option.value), children: option.label }, option.value)) })
|
|
4512
4545
|
] })
|
|
4513
4546
|
] }),
|
|
4514
|
-
/* @__PURE__ */ jsx38("div", { className: "rounded-md border", children: /* @__PURE__ */
|
|
4515
|
-
/* @__PURE__ */ jsx38(TableHeader8, { children: /* @__PURE__ */
|
|
4547
|
+
/* @__PURE__ */ jsx38("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs32(Table8, { children: [
|
|
4548
|
+
/* @__PURE__ */ jsx38(TableHeader8, { children: /* @__PURE__ */ jsxs32(TableRow8, { children: [
|
|
4516
4549
|
/* @__PURE__ */ jsx38(TableHead8, { className: "pl-4", children: "Timestamp" }),
|
|
4517
4550
|
/* @__PURE__ */ jsx38(TableHead8, { children: "Method" }),
|
|
4518
4551
|
/* @__PURE__ */ jsx38(TableHead8, { children: "Endpoint" }),
|
|
@@ -4520,8 +4553,8 @@ function RequestsPage() {
|
|
|
4520
4553
|
/* @__PURE__ */ jsx38(TableHead8, { children: "Latency" }),
|
|
4521
4554
|
/* @__PURE__ */ jsx38(TableHead8, { children: "Cost" })
|
|
4522
4555
|
] }) }),
|
|
4523
|
-
/* @__PURE__ */
|
|
4524
|
-
filteredRequests.map((request) => /* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsxs32(TableBody8, { children: [
|
|
4557
|
+
filteredRequests.map((request) => /* @__PURE__ */ jsxs32(TableRow8, { className: "cursor-pointer hover:bg-muted/50", onClick: () => handleRowClick(request), children: [
|
|
4525
4558
|
/* @__PURE__ */ jsx38(TableCell8, { className: "py-3 pl-4 text-muted-foreground", children: formatTimestamp(request.timestamp) }),
|
|
4526
4559
|
/* @__PURE__ */ jsx38(TableCell8, { className: "py-3", children: /* @__PURE__ */ jsx38("span", { className: `font-mono text-sm font-medium ${methodColors[request.method] || ""}`, children: request.method }) }),
|
|
4527
4560
|
/* @__PURE__ */ jsx38(TableCell8, { className: "py-3 font-mono text-sm", children: request.endpoint }),
|
|
@@ -4529,9 +4562,9 @@ function RequestsPage() {
|
|
|
4529
4562
|
/* @__PURE__ */ jsx38(TableCell8, { className: "py-3 text-muted-foreground", children: formatLatency(request.latency) }),
|
|
4530
4563
|
/* @__PURE__ */ jsx38(TableCell8, { className: "py-3 text-muted-foreground", children: formatCost(request.cost) })
|
|
4531
4564
|
] }, request.id)),
|
|
4532
|
-
filteredRequests.length === 0 && /* @__PURE__ */ jsx38(TableRow8, { children: /* @__PURE__ */ jsx38(TableCell8, { colSpan: 6, className: "py-16", children: /* @__PURE__ */
|
|
4565
|
+
filteredRequests.length === 0 && /* @__PURE__ */ jsx38(TableRow8, { children: /* @__PURE__ */ jsx38(TableCell8, { colSpan: 6, className: "py-16", children: /* @__PURE__ */ jsxs32("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
4533
4566
|
/* @__PURE__ */ jsx38("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx38(Activity3, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
4534
|
-
/* @__PURE__ */
|
|
4567
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4535
4568
|
/* @__PURE__ */ jsx38("p", { className: "font-medium", children: "No requests found" }),
|
|
4536
4569
|
/* @__PURE__ */ jsx38("p", { className: "text-sm text-muted-foreground mt-1", children: "No requests match the current filter." })
|
|
4537
4570
|
] })
|
|
@@ -4539,17 +4572,17 @@ function RequestsPage() {
|
|
|
4539
4572
|
] })
|
|
4540
4573
|
] }) })
|
|
4541
4574
|
] }),
|
|
4542
|
-
/* @__PURE__ */ jsx38(Sheet, { open: sheetOpen, onOpenChange: setSheetOpen, children: /* @__PURE__ */ jsx38(SheetContent, { className: "w-full sm:max-w-lg overflow-y-auto", children: selectedRequest && /* @__PURE__ */
|
|
4543
|
-
/* @__PURE__ */
|
|
4544
|
-
/* @__PURE__ */
|
|
4575
|
+
/* @__PURE__ */ jsx38(Sheet, { open: sheetOpen, onOpenChange: setSheetOpen, children: /* @__PURE__ */ jsx38(SheetContent, { className: "w-full sm:max-w-lg overflow-y-auto", children: selectedRequest && /* @__PURE__ */ jsxs32(Fragment11, { children: [
|
|
4576
|
+
/* @__PURE__ */ jsxs32(SheetHeader, { children: [
|
|
4577
|
+
/* @__PURE__ */ jsxs32(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
4545
4578
|
/* @__PURE__ */ jsx38("span", { className: `font-mono ${methodColors[selectedRequest.method] || ""}`, children: selectedRequest.method }),
|
|
4546
4579
|
/* @__PURE__ */ jsx38("span", { className: "font-mono text-muted-foreground font-normal", children: selectedRequest.endpoint })
|
|
4547
4580
|
] }),
|
|
4548
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsxs32(SheetDescription, { className: "flex items-center gap-2 text-sm", children: [
|
|
4549
4582
|
/* @__PURE__ */ jsx38(StatusBadge, { status: selectedRequest.statusCode }),
|
|
4550
4583
|
/* @__PURE__ */ jsx38("span", { className: "text-muted-foreground", children: "\u2022" }),
|
|
4551
4584
|
/* @__PURE__ */ jsx38("span", { children: formatLatency(selectedRequest.latency) }),
|
|
4552
|
-
selectedRequest.cost > 0 && /* @__PURE__ */
|
|
4585
|
+
selectedRequest.cost > 0 && /* @__PURE__ */ jsxs32(Fragment11, { children: [
|
|
4553
4586
|
/* @__PURE__ */ jsx38("span", { className: "text-muted-foreground", children: "\u2022" }),
|
|
4554
4587
|
/* @__PURE__ */ jsx38("span", { children: formatCost(selectedRequest.cost) })
|
|
4555
4588
|
] }),
|
|
@@ -4557,12 +4590,12 @@ function RequestsPage() {
|
|
|
4557
4590
|
/* @__PURE__ */ jsx38("span", { children: formatTimestamp(selectedRequest.timestamp) })
|
|
4558
4591
|
] })
|
|
4559
4592
|
] }),
|
|
4560
|
-
/* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4593
|
+
/* @__PURE__ */ jsxs32("div", { className: "mt-6 space-y-6 px-4", children: [
|
|
4594
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4562
4595
|
/* @__PURE__ */ jsx38("h4", { className: "text-sm font-semibold mb-2", children: "Request" }),
|
|
4563
4596
|
/* @__PURE__ */ jsx38(JsonViewer, { data: selectedRequest.requestPayload })
|
|
4564
4597
|
] }),
|
|
4565
|
-
/* @__PURE__ */
|
|
4598
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4566
4599
|
/* @__PURE__ */ jsx38("h4", { className: "text-sm font-semibold mb-2", children: "Response" }),
|
|
4567
4600
|
/* @__PURE__ */ jsx38(JsonViewer, { data: selectedRequest.responsePayload })
|
|
4568
4601
|
] })
|
|
@@ -4572,30 +4605,28 @@ function RequestsPage() {
|
|
|
4572
4605
|
}
|
|
4573
4606
|
|
|
4574
4607
|
// src/developer/pages/settings/profile.tsx
|
|
4608
|
+
import { useAuth as useAuth5, UserProfile as UserProfile2 } from "@mdxui/auth";
|
|
4575
4609
|
import { Breadcrumb as Breadcrumb7, BreadcrumbItem as BreadcrumbItem7, BreadcrumbLink, BreadcrumbList as BreadcrumbList7, BreadcrumbPage as BreadcrumbPage7, BreadcrumbSeparator } from "@mdxui/primitives/breadcrumb";
|
|
4576
4610
|
import { Separator as Separator9 } from "@mdxui/primitives/separator";
|
|
4577
4611
|
import { SidebarTrigger as SidebarTrigger7 } from "@mdxui/primitives/sidebar";
|
|
4578
|
-
import { useAuth as useAuth6 } from "@workos-inc/authkit-react";
|
|
4579
|
-
import { UserProfile as UserProfile2 } from "@workos-inc/widgets";
|
|
4580
4612
|
import { Link as Link4 } from "react-router-dom";
|
|
4581
|
-
import { Fragment as
|
|
4613
|
+
import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4582
4614
|
function SettingsProfilePage() {
|
|
4583
|
-
var _a, _b;
|
|
4584
4615
|
const { config } = useDashboard();
|
|
4585
|
-
const useMockWidgets =
|
|
4586
|
-
const { user, getAccessToken, isLoading } =
|
|
4587
|
-
return /* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */ jsx39("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4616
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4617
|
+
const { user, getAccessToken, isLoading } = useAuth5();
|
|
4618
|
+
return /* @__PURE__ */ jsxs33(Fragment12, { children: [
|
|
4619
|
+
/* @__PURE__ */ jsx39("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4589
4620
|
/* @__PURE__ */ jsx39(SidebarTrigger7, { className: "-ml-1" }),
|
|
4590
4621
|
/* @__PURE__ */ jsx39(Separator9, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4591
|
-
/* @__PURE__ */ jsx39(Breadcrumb7, { children: /* @__PURE__ */
|
|
4622
|
+
/* @__PURE__ */ jsx39(Breadcrumb7, { children: /* @__PURE__ */ jsxs33(BreadcrumbList7, { children: [
|
|
4592
4623
|
/* @__PURE__ */ jsx39(BreadcrumbItem7, { className: "hidden md:block", children: /* @__PURE__ */ jsx39(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsx39(Link4, { to: "/settings/profile", children: "Settings" }) }) }),
|
|
4593
4624
|
/* @__PURE__ */ jsx39(BreadcrumbSeparator, { className: "hidden md:block" }),
|
|
4594
4625
|
/* @__PURE__ */ jsx39(BreadcrumbItem7, { children: /* @__PURE__ */ jsx39(BreadcrumbPage7, { children: "Profile" }) })
|
|
4595
4626
|
] }) })
|
|
4596
4627
|
] }) }),
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4628
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4629
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
4599
4630
|
/* @__PURE__ */ jsx39("h1", { className: "text-2xl font-bold", children: "Profile" }),
|
|
4600
4631
|
/* @__PURE__ */ jsx39("p", { className: "text-muted-foreground", children: "Manage your personal information and preferences." })
|
|
4601
4632
|
] }),
|
|
@@ -4605,27 +4636,24 @@ function SettingsProfilePage() {
|
|
|
4605
4636
|
}
|
|
4606
4637
|
|
|
4607
4638
|
// src/developer/pages/settings/security.tsx
|
|
4639
|
+
import { useAuth as useAuth6, UserSecurity } from "@mdxui/auth";
|
|
4608
4640
|
import { Breadcrumb as Breadcrumb8, BreadcrumbItem as BreadcrumbItem8, BreadcrumbLink as BreadcrumbLink2, BreadcrumbList as BreadcrumbList8, BreadcrumbPage as BreadcrumbPage8, BreadcrumbSeparator as BreadcrumbSeparator2 } from "@mdxui/primitives/breadcrumb";
|
|
4609
4641
|
import { Separator as Separator10 } from "@mdxui/primitives/separator";
|
|
4610
4642
|
import { SidebarTrigger as SidebarTrigger8 } from "@mdxui/primitives/sidebar";
|
|
4611
|
-
import {
|
|
4612
|
-
import { UserSecurity } from "@workos-inc/widgets";
|
|
4613
|
-
import { useEffect as useEffect8, useRef as useRef2, useState as useState17 } from "react";
|
|
4643
|
+
import { useEffect as useEffect7, useRef as useRef2, useState as useState16 } from "react";
|
|
4614
4644
|
import { Link as Link5 } from "react-router-dom";
|
|
4615
|
-
import { Fragment as
|
|
4645
|
+
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4616
4646
|
function SettingsSecurityPage() {
|
|
4617
|
-
var _a, _b;
|
|
4618
4647
|
const { config } = useDashboard();
|
|
4619
|
-
const useMockWidgets =
|
|
4620
|
-
const { user, getAccessToken, isLoading } =
|
|
4621
|
-
const [isEmpty, setIsEmpty] =
|
|
4648
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4649
|
+
const { user, getAccessToken, isLoading } = useAuth6();
|
|
4650
|
+
const [isEmpty, setIsEmpty] = useState16(false);
|
|
4622
4651
|
const containerRef = useRef2(null);
|
|
4623
|
-
|
|
4652
|
+
useEffect7(() => {
|
|
4624
4653
|
if (useMockWidgets || isLoading || !user) return;
|
|
4625
4654
|
const timer = setTimeout(() => {
|
|
4626
|
-
var _a2;
|
|
4627
4655
|
if (containerRef.current) {
|
|
4628
|
-
const content =
|
|
4656
|
+
const content = containerRef.current.textContent?.trim();
|
|
4629
4657
|
const hasVisibleContent = containerRef.current.querySelector('button, input, [role="button"]');
|
|
4630
4658
|
if (!content && !hasVisibleContent) {
|
|
4631
4659
|
setIsEmpty(true);
|
|
@@ -4634,18 +4662,18 @@ function SettingsSecurityPage() {
|
|
|
4634
4662
|
}, 1e3);
|
|
4635
4663
|
return () => clearTimeout(timer);
|
|
4636
4664
|
}, [isLoading, user, useMockWidgets]);
|
|
4637
|
-
return /* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */ jsx40("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4665
|
+
return /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4666
|
+
/* @__PURE__ */ jsx40("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4639
4667
|
/* @__PURE__ */ jsx40(SidebarTrigger8, { className: "-ml-1" }),
|
|
4640
4668
|
/* @__PURE__ */ jsx40(Separator10, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4641
|
-
/* @__PURE__ */ jsx40(Breadcrumb8, { children: /* @__PURE__ */
|
|
4669
|
+
/* @__PURE__ */ jsx40(Breadcrumb8, { children: /* @__PURE__ */ jsxs34(BreadcrumbList8, { children: [
|
|
4642
4670
|
/* @__PURE__ */ jsx40(BreadcrumbItem8, { className: "hidden md:block", children: /* @__PURE__ */ jsx40(BreadcrumbLink2, { asChild: true, children: /* @__PURE__ */ jsx40(Link5, { to: "/settings/profile", children: "Settings" }) }) }),
|
|
4643
4671
|
/* @__PURE__ */ jsx40(BreadcrumbSeparator2, { className: "hidden md:block" }),
|
|
4644
4672
|
/* @__PURE__ */ jsx40(BreadcrumbItem8, { children: /* @__PURE__ */ jsx40(BreadcrumbPage8, { children: "Security" }) })
|
|
4645
4673
|
] }) })
|
|
4646
4674
|
] }) }),
|
|
4647
|
-
/* @__PURE__ */
|
|
4648
|
-
/* @__PURE__ */
|
|
4675
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4676
|
+
/* @__PURE__ */ jsxs34("div", { children: [
|
|
4649
4677
|
/* @__PURE__ */ jsx40("h1", { className: "text-2xl font-bold", children: "Security" }),
|
|
4650
4678
|
/* @__PURE__ */ jsx40("p", { className: "text-muted-foreground", children: "Manage your password, two-factor authentication, and recovery codes." })
|
|
4651
4679
|
] }),
|
|
@@ -4655,30 +4683,28 @@ function SettingsSecurityPage() {
|
|
|
4655
4683
|
}
|
|
4656
4684
|
|
|
4657
4685
|
// src/developer/pages/settings/sessions.tsx
|
|
4686
|
+
import { useAuth as useAuth7, UserSessions } from "@mdxui/auth";
|
|
4658
4687
|
import { Breadcrumb as Breadcrumb9, BreadcrumbItem as BreadcrumbItem9, BreadcrumbLink as BreadcrumbLink3, BreadcrumbList as BreadcrumbList9, BreadcrumbPage as BreadcrumbPage9, BreadcrumbSeparator as BreadcrumbSeparator3 } from "@mdxui/primitives/breadcrumb";
|
|
4659
4688
|
import { Separator as Separator11 } from "@mdxui/primitives/separator";
|
|
4660
4689
|
import { SidebarTrigger as SidebarTrigger9 } from "@mdxui/primitives/sidebar";
|
|
4661
|
-
import { useAuth as useAuth8 } from "@workos-inc/authkit-react";
|
|
4662
|
-
import { UserSessions } from "@workos-inc/widgets";
|
|
4663
4690
|
import { Link as Link6 } from "react-router-dom";
|
|
4664
|
-
import { Fragment as
|
|
4691
|
+
import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4665
4692
|
function SettingsSessionsPage() {
|
|
4666
|
-
var _a, _b;
|
|
4667
4693
|
const { config } = useDashboard();
|
|
4668
|
-
const useMockWidgets =
|
|
4669
|
-
const { user, getAccessToken, isLoading } =
|
|
4670
|
-
return /* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */ jsx41("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4694
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4695
|
+
const { user, getAccessToken, isLoading } = useAuth7();
|
|
4696
|
+
return /* @__PURE__ */ jsxs35(Fragment14, { children: [
|
|
4697
|
+
/* @__PURE__ */ jsx41("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4672
4698
|
/* @__PURE__ */ jsx41(SidebarTrigger9, { className: "-ml-1" }),
|
|
4673
4699
|
/* @__PURE__ */ jsx41(Separator11, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4674
|
-
/* @__PURE__ */ jsx41(Breadcrumb9, { children: /* @__PURE__ */
|
|
4700
|
+
/* @__PURE__ */ jsx41(Breadcrumb9, { children: /* @__PURE__ */ jsxs35(BreadcrumbList9, { children: [
|
|
4675
4701
|
/* @__PURE__ */ jsx41(BreadcrumbItem9, { className: "hidden md:block", children: /* @__PURE__ */ jsx41(BreadcrumbLink3, { asChild: true, children: /* @__PURE__ */ jsx41(Link6, { to: "/settings/profile", children: "Settings" }) }) }),
|
|
4676
4702
|
/* @__PURE__ */ jsx41(BreadcrumbSeparator3, { className: "hidden md:block" }),
|
|
4677
4703
|
/* @__PURE__ */ jsx41(BreadcrumbItem9, { children: /* @__PURE__ */ jsx41(BreadcrumbPage9, { children: "Sessions" }) })
|
|
4678
4704
|
] }) })
|
|
4679
4705
|
] }) }),
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4707
|
+
/* @__PURE__ */ jsxs35("div", { children: [
|
|
4682
4708
|
/* @__PURE__ */ jsx41("h1", { className: "text-2xl font-bold", children: "Sessions" }),
|
|
4683
4709
|
/* @__PURE__ */ jsx41("p", { className: "text-muted-foreground", children: "View and manage your active sessions across devices." })
|
|
4684
4710
|
] }),
|
|
@@ -4688,35 +4714,72 @@ function SettingsSessionsPage() {
|
|
|
4688
4714
|
}
|
|
4689
4715
|
|
|
4690
4716
|
// src/developer/pages/team.tsx
|
|
4691
|
-
import {
|
|
4717
|
+
import { UsersManagement, useAuth as useAuth8 } from "@mdxui/auth";
|
|
4718
|
+
import {
|
|
4719
|
+
Breadcrumb as Breadcrumb10,
|
|
4720
|
+
BreadcrumbItem as BreadcrumbItem10,
|
|
4721
|
+
BreadcrumbList as BreadcrumbList10,
|
|
4722
|
+
BreadcrumbPage as BreadcrumbPage10
|
|
4723
|
+
} from "@mdxui/primitives/breadcrumb";
|
|
4692
4724
|
import { Separator as Separator12 } from "@mdxui/primitives/separator";
|
|
4693
4725
|
import { SidebarTrigger as SidebarTrigger10 } from "@mdxui/primitives/sidebar";
|
|
4694
|
-
import {
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4726
|
+
import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4727
|
+
function TeamPage({
|
|
4728
|
+
useMockWidgets: useMockWidgetsProp,
|
|
4729
|
+
hideHeader = false,
|
|
4730
|
+
className
|
|
4731
|
+
} = {}) {
|
|
4699
4732
|
const { config } = useDashboard();
|
|
4700
|
-
const useMockWidgets =
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
const canManageTeam = hasOrganization && (permissions == null ? void 0 : permissions.includes("widgets:users-table:manage"));
|
|
4704
|
-
const loading = !useMockWidgets && isLoading;
|
|
4705
|
-
return /* @__PURE__ */ jsxs37(Fragment16, { children: [
|
|
4706
|
-
/* @__PURE__ */ jsx42("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4733
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? useMockWidgetsProp ?? false;
|
|
4734
|
+
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
4735
|
+
!hideHeader && /* @__PURE__ */ jsx42("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4707
4736
|
/* @__PURE__ */ jsx42(SidebarTrigger10, { className: "-ml-1" }),
|
|
4708
|
-
/* @__PURE__ */ jsx42(
|
|
4737
|
+
/* @__PURE__ */ jsx42(
|
|
4738
|
+
Separator12,
|
|
4739
|
+
{
|
|
4740
|
+
orientation: "vertical",
|
|
4741
|
+
className: "mr-2 data-[orientation=vertical]:h-4"
|
|
4742
|
+
}
|
|
4743
|
+
),
|
|
4709
4744
|
/* @__PURE__ */ jsx42(Breadcrumb10, { children: /* @__PURE__ */ jsx42(BreadcrumbList10, { children: /* @__PURE__ */ jsx42(BreadcrumbItem10, { children: /* @__PURE__ */ jsx42(BreadcrumbPage10, { children: "Team" }) }) }) })
|
|
4710
4745
|
] }) }),
|
|
4711
|
-
/* @__PURE__ */
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4746
|
+
/* @__PURE__ */ jsxs36(
|
|
4747
|
+
"div",
|
|
4748
|
+
{
|
|
4749
|
+
className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`,
|
|
4750
|
+
children: [
|
|
4751
|
+
/* @__PURE__ */ jsxs36("div", { children: [
|
|
4752
|
+
/* @__PURE__ */ jsx42("h1", { className: "text-2xl font-bold", children: "Team" }),
|
|
4753
|
+
/* @__PURE__ */ jsx42("p", { className: "text-muted-foreground", children: "Manage your team members and their permissions." })
|
|
4754
|
+
] }),
|
|
4755
|
+
/* @__PURE__ */ jsx42(TeamPageContent, { useMockWidgets })
|
|
4756
|
+
]
|
|
4757
|
+
}
|
|
4758
|
+
)
|
|
4718
4759
|
] });
|
|
4719
4760
|
}
|
|
4761
|
+
function TeamPageContent({ useMockWidgets }) {
|
|
4762
|
+
const { user, getAccessToken, isLoading, organizationId, permissions } = useAuth8();
|
|
4763
|
+
const hasOrganization = !!organizationId;
|
|
4764
|
+
const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
|
|
4765
|
+
const loading = !useMockWidgets && isLoading;
|
|
4766
|
+
if (loading) {
|
|
4767
|
+
return /* @__PURE__ */ jsx42("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
4768
|
+
}
|
|
4769
|
+
if (!user) {
|
|
4770
|
+
return /* @__PURE__ */ jsx42("div", { className: "flex items-center justify-center rounded-md border border-dashed py-24", children: /* @__PURE__ */ jsx42("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your team." }) });
|
|
4771
|
+
}
|
|
4772
|
+
if (!hasOrganization) {
|
|
4773
|
+
return /* @__PURE__ */ jsx42("div", { className: "flex items-center justify-center rounded-md border border-dashed py-24", children: /* @__PURE__ */ jsx42("p", { className: "text-muted-foreground text-sm", children: "You need to be part of an organization to manage team members." }) });
|
|
4774
|
+
}
|
|
4775
|
+
if (!canManageTeam) {
|
|
4776
|
+
return /* @__PURE__ */ jsx42("div", { className: "flex items-center justify-center rounded-md border border-dashed py-24", children: /* @__PURE__ */ jsx42("p", { className: "text-muted-foreground text-sm", children: "You need admin permissions to manage team members." }) });
|
|
4777
|
+
}
|
|
4778
|
+
if (useMockWidgets) {
|
|
4779
|
+
return /* @__PURE__ */ jsx42(MockUsersManagement, {});
|
|
4780
|
+
}
|
|
4781
|
+
return /* @__PURE__ */ jsx42(UsersManagement, { authToken: getAccessToken });
|
|
4782
|
+
}
|
|
4720
4783
|
|
|
4721
4784
|
// src/developer/pages/vault.tsx
|
|
4722
4785
|
import { Breadcrumb as Breadcrumb11, BreadcrumbItem as BreadcrumbItem11, BreadcrumbList as BreadcrumbList11, BreadcrumbPage as BreadcrumbPage11 } from "@mdxui/primitives/breadcrumb";
|
|
@@ -4724,9 +4787,9 @@ import { Button as Button16 } from "@mdxui/primitives/button";
|
|
|
4724
4787
|
import { Separator as Separator13 } from "@mdxui/primitives/separator";
|
|
4725
4788
|
import { SidebarTrigger as SidebarTrigger11 } from "@mdxui/primitives/sidebar";
|
|
4726
4789
|
import { Plus as Plus6 } from "lucide-react";
|
|
4727
|
-
import { useState as
|
|
4790
|
+
import { useState as useState17 } from "react";
|
|
4728
4791
|
import { toast as toast6 } from "sonner";
|
|
4729
|
-
import { Fragment as
|
|
4792
|
+
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4730
4793
|
var pendingCredentialRequest = {
|
|
4731
4794
|
id: "stripe",
|
|
4732
4795
|
name: "Stripe",
|
|
@@ -4737,14 +4800,14 @@ var pendingCredentialRequest = {
|
|
|
4737
4800
|
]
|
|
4738
4801
|
};
|
|
4739
4802
|
function VaultPage() {
|
|
4740
|
-
const [items, setItems] =
|
|
4741
|
-
const [addModalOpen, setAddModalOpen] =
|
|
4742
|
-
const [pendingIntegration, setPendingIntegration] =
|
|
4803
|
+
const [items, setItems] = useState17(mockVaultItems);
|
|
4804
|
+
const [addModalOpen, setAddModalOpen] = useState17(false);
|
|
4805
|
+
const [pendingIntegration, setPendingIntegration] = useState17(null);
|
|
4743
4806
|
const handleOpenAddModal = () => {
|
|
4744
4807
|
setPendingIntegration(pendingCredentialRequest);
|
|
4745
4808
|
setAddModalOpen(true);
|
|
4746
4809
|
};
|
|
4747
|
-
const handleAdd = (
|
|
4810
|
+
const handleAdd = async (_credentials) => {
|
|
4748
4811
|
if (!pendingIntegration) return;
|
|
4749
4812
|
const newItem = {
|
|
4750
4813
|
id: Date.now().toString(),
|
|
@@ -4756,34 +4819,34 @@ function VaultPage() {
|
|
|
4756
4819
|
};
|
|
4757
4820
|
setItems((prev) => [...prev, newItem]);
|
|
4758
4821
|
toast6.success(`${pendingIntegration.name} credentials added successfully`);
|
|
4759
|
-
}
|
|
4822
|
+
};
|
|
4760
4823
|
const handleCloseAddModal = () => {
|
|
4761
4824
|
setAddModalOpen(false);
|
|
4762
4825
|
setPendingIntegration(null);
|
|
4763
4826
|
};
|
|
4764
|
-
const handleRotate = (id,
|
|
4827
|
+
const handleRotate = async (id, _credentials) => {
|
|
4765
4828
|
const item = items.find((i) => i.id === id);
|
|
4766
|
-
setItems((prev) => prev.map((i) => i.id === id ?
|
|
4767
|
-
toast6.success(`${
|
|
4768
|
-
}
|
|
4769
|
-
const handleDelete = (id) =>
|
|
4829
|
+
setItems((prev) => prev.map((i) => i.id === id ? { ...i, updatedAt: /* @__PURE__ */ new Date() } : i));
|
|
4830
|
+
toast6.success(`${item?.name || "Credentials"} rotated successfully`);
|
|
4831
|
+
};
|
|
4832
|
+
const handleDelete = async (id) => {
|
|
4770
4833
|
const item = items.find((i) => i.id === id);
|
|
4771
4834
|
setItems((prev) => prev.filter((i) => i.id !== id));
|
|
4772
|
-
toast6.success(`${
|
|
4773
|
-
}
|
|
4774
|
-
return /* @__PURE__ */
|
|
4775
|
-
/* @__PURE__ */ jsx43("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4835
|
+
toast6.success(`${item?.name || "Credentials"} deleted successfully`);
|
|
4836
|
+
};
|
|
4837
|
+
return /* @__PURE__ */ jsxs37(Fragment16, { children: [
|
|
4838
|
+
/* @__PURE__ */ jsx43("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4776
4839
|
/* @__PURE__ */ jsx43(SidebarTrigger11, { className: "-ml-1" }),
|
|
4777
4840
|
/* @__PURE__ */ jsx43(Separator13, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4778
4841
|
/* @__PURE__ */ jsx43(Breadcrumb11, { children: /* @__PURE__ */ jsx43(BreadcrumbList11, { children: /* @__PURE__ */ jsx43(BreadcrumbItem11, { children: /* @__PURE__ */ jsx43(BreadcrumbPage11, { children: "Vault" }) }) }) })
|
|
4779
4842
|
] }) }),
|
|
4780
|
-
/* @__PURE__ */
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4844
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between", children: [
|
|
4845
|
+
/* @__PURE__ */ jsxs37("div", { children: [
|
|
4783
4846
|
/* @__PURE__ */ jsx43("h1", { className: "text-2xl font-bold", children: "Vault" }),
|
|
4784
4847
|
/* @__PURE__ */ jsx43("p", { className: "text-muted-foreground", children: "Securely stored credentials for your agents." })
|
|
4785
4848
|
] }),
|
|
4786
|
-
items.length > 0 && /* @__PURE__ */
|
|
4849
|
+
items.length > 0 && /* @__PURE__ */ jsxs37(Button16, { onClick: handleOpenAddModal, children: [
|
|
4787
4850
|
/* @__PURE__ */ jsx43(Plus6, { className: "h-4 w-4" }),
|
|
4788
4851
|
"Add Credential"
|
|
4789
4852
|
] })
|
|
@@ -4833,9 +4896,9 @@ import { Progress as Progress2 } from "@mdxui/primitives/progress";
|
|
|
4833
4896
|
import { Separator as Separator14 } from "@mdxui/primitives/separator";
|
|
4834
4897
|
import { SidebarTrigger as SidebarTrigger12 } from "@mdxui/primitives/sidebar";
|
|
4835
4898
|
import { Activity as Activity4, AlertTriangle as AlertTriangle3, CheckCircle2 as CheckCircle22, ChevronDown as ChevronDown3, Clock, XCircle } from "lucide-react";
|
|
4836
|
-
import { useState as
|
|
4899
|
+
import { useState as useState18 } from "react";
|
|
4837
4900
|
import { Link as Link7 } from "react-router-dom";
|
|
4838
|
-
import { Fragment as
|
|
4901
|
+
import { Fragment as Fragment17, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4839
4902
|
var periodOptions = [
|
|
4840
4903
|
{ value: "7d", label: "Last 7 days" },
|
|
4841
4904
|
{ value: "24h", label: "Last 24 hours" },
|
|
@@ -4847,93 +4910,93 @@ var periodMultipliers = {
|
|
|
4847
4910
|
"30d": 30
|
|
4848
4911
|
};
|
|
4849
4912
|
function WebhooksActivityPage() {
|
|
4850
|
-
|
|
4851
|
-
const [period, setPeriod] = useState19("7d");
|
|
4913
|
+
const [period, setPeriod] = useState18("7d");
|
|
4852
4914
|
const multiplier = periodMultipliers[period];
|
|
4853
4915
|
const activity = {
|
|
4854
4916
|
delivered: Math.round(mockWebhookActivity.delivered * multiplier),
|
|
4855
4917
|
failed: Math.round(mockWebhookActivity.failed * multiplier),
|
|
4856
4918
|
pending: mockWebhookActivity.pending,
|
|
4857
4919
|
successRate: mockWebhookActivity.successRate,
|
|
4858
|
-
endpointsWithIssues: mockWebhookActivity.endpointsWithIssues.map((ep) =>
|
|
4920
|
+
endpointsWithIssues: mockWebhookActivity.endpointsWithIssues.map((ep) => ({
|
|
4921
|
+
...ep,
|
|
4859
4922
|
failures: Math.round(ep.failures * multiplier)
|
|
4860
4923
|
}))
|
|
4861
4924
|
};
|
|
4862
4925
|
const total = activity.delivered + activity.failed + activity.pending;
|
|
4863
|
-
return /* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */ jsx44("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
4926
|
+
return /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
4927
|
+
/* @__PURE__ */ jsx44("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4865
4928
|
/* @__PURE__ */ jsx44(SidebarTrigger12, { className: "-ml-1" }),
|
|
4866
4929
|
/* @__PURE__ */ jsx44(Separator14, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4867
|
-
/* @__PURE__ */ jsx44(Breadcrumb12, { children: /* @__PURE__ */
|
|
4930
|
+
/* @__PURE__ */ jsx44(Breadcrumb12, { children: /* @__PURE__ */ jsxs38(BreadcrumbList12, { children: [
|
|
4868
4931
|
/* @__PURE__ */ jsx44(BreadcrumbItem12, { children: /* @__PURE__ */ jsx44(BreadcrumbLink4, { asChild: true, children: /* @__PURE__ */ jsx44(Link7, { to: "/webhooks", children: "Webhooks" }) }) }),
|
|
4869
4932
|
/* @__PURE__ */ jsx44(BreadcrumbSeparator4, {}),
|
|
4870
4933
|
/* @__PURE__ */ jsx44(BreadcrumbItem12, { children: /* @__PURE__ */ jsx44(BreadcrumbPage12, { children: "Activity" }) })
|
|
4871
4934
|
] }) })
|
|
4872
4935
|
] }) }),
|
|
4873
|
-
/* @__PURE__ */
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4936
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
4937
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between", children: [
|
|
4938
|
+
/* @__PURE__ */ jsxs38("div", { children: [
|
|
4876
4939
|
/* @__PURE__ */ jsx44("h1", { className: "text-2xl font-bold", children: "Webhook Activity" }),
|
|
4877
4940
|
/* @__PURE__ */ jsx44("p", { className: "text-muted-foreground", children: "Monitor webhook health and delivery status." })
|
|
4878
4941
|
] }),
|
|
4879
|
-
/* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */ jsx44(DropdownMenuTrigger7, { asChild: true, children: /* @__PURE__ */
|
|
4881
|
-
|
|
4942
|
+
/* @__PURE__ */ jsxs38(DropdownMenu7, { children: [
|
|
4943
|
+
/* @__PURE__ */ jsx44(DropdownMenuTrigger7, { asChild: true, children: /* @__PURE__ */ jsxs38(Button17, { variant: "outline", className: "w-[160px] justify-between", children: [
|
|
4944
|
+
periodOptions.find((o) => o.value === period)?.label,
|
|
4882
4945
|
/* @__PURE__ */ jsx44(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
4883
4946
|
] }) }),
|
|
4884
4947
|
/* @__PURE__ */ jsx44(DropdownMenuContent7, { align: "end", className: "w-[160px]", children: periodOptions.map((option) => /* @__PURE__ */ jsx44(DropdownMenuItem7, { onClick: () => setPeriod(option.value), children: option.label }, option.value)) })
|
|
4885
4948
|
] })
|
|
4886
4949
|
] }),
|
|
4887
|
-
total === 0 ? /* @__PURE__ */ jsx44(Card16, { children: /* @__PURE__ */ jsx44(CardContent15, { className: "py-16", children: /* @__PURE__ */
|
|
4950
|
+
total === 0 ? /* @__PURE__ */ jsx44(Card16, { children: /* @__PURE__ */ jsx44(CardContent15, { className: "py-16", children: /* @__PURE__ */ jsxs38("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
4888
4951
|
/* @__PURE__ */ jsx44("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx44(Activity4, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
4889
|
-
/* @__PURE__ */
|
|
4952
|
+
/* @__PURE__ */ jsxs38("div", { children: [
|
|
4890
4953
|
/* @__PURE__ */ jsx44("p", { className: "font-medium", children: "No activity yet" }),
|
|
4891
4954
|
/* @__PURE__ */ jsx44("p", { className: "text-sm text-muted-foreground mt-1", children: "Webhook activity will appear here once you start receiving events." })
|
|
4892
4955
|
] })
|
|
4893
|
-
] }) }) }) : /* @__PURE__ */
|
|
4894
|
-
/* @__PURE__ */
|
|
4895
|
-
/* @__PURE__ */
|
|
4896
|
-
/* @__PURE__ */
|
|
4956
|
+
] }) }) }) : /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
4957
|
+
/* @__PURE__ */ jsxs38("div", { className: "grid gap-4 md:grid-cols-3", children: [
|
|
4958
|
+
/* @__PURE__ */ jsxs38(Card16, { children: [
|
|
4959
|
+
/* @__PURE__ */ jsxs38(CardHeader14, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4897
4960
|
/* @__PURE__ */ jsx44(CardTitle14, { className: "text-sm font-medium", children: "Delivered" }),
|
|
4898
4961
|
/* @__PURE__ */ jsx44(CheckCircle22, { className: "h-4 w-4 text-success" })
|
|
4899
4962
|
] }),
|
|
4900
|
-
/* @__PURE__ */
|
|
4963
|
+
/* @__PURE__ */ jsxs38(CardContent15, { children: [
|
|
4901
4964
|
/* @__PURE__ */ jsx44("div", { className: "text-2xl font-bold", children: activity.delivered.toLocaleString() }),
|
|
4902
|
-
/* @__PURE__ */
|
|
4965
|
+
/* @__PURE__ */ jsxs38("p", { className: "text-xs text-muted-foreground", children: [
|
|
4903
4966
|
(activity.delivered / total * 100).toFixed(1),
|
|
4904
4967
|
"% of total"
|
|
4905
4968
|
] })
|
|
4906
4969
|
] })
|
|
4907
4970
|
] }),
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
/* @__PURE__ */
|
|
4971
|
+
/* @__PURE__ */ jsxs38(Card16, { children: [
|
|
4972
|
+
/* @__PURE__ */ jsxs38(CardHeader14, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4910
4973
|
/* @__PURE__ */ jsx44(CardTitle14, { className: "text-sm font-medium", children: "Failed" }),
|
|
4911
4974
|
/* @__PURE__ */ jsx44(XCircle, { className: "h-4 w-4 text-destructive" })
|
|
4912
4975
|
] }),
|
|
4913
|
-
/* @__PURE__ */
|
|
4976
|
+
/* @__PURE__ */ jsxs38(CardContent15, { children: [
|
|
4914
4977
|
/* @__PURE__ */ jsx44("div", { className: "text-2xl font-bold", children: activity.failed.toLocaleString() }),
|
|
4915
|
-
/* @__PURE__ */
|
|
4978
|
+
/* @__PURE__ */ jsxs38("p", { className: "text-xs text-muted-foreground", children: [
|
|
4916
4979
|
(activity.failed / total * 100).toFixed(1),
|
|
4917
4980
|
"% of total"
|
|
4918
4981
|
] })
|
|
4919
4982
|
] })
|
|
4920
4983
|
] }),
|
|
4921
|
-
/* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4984
|
+
/* @__PURE__ */ jsxs38(Card16, { children: [
|
|
4985
|
+
/* @__PURE__ */ jsxs38(CardHeader14, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
4923
4986
|
/* @__PURE__ */ jsx44(CardTitle14, { className: "text-sm font-medium", children: "Pending" }),
|
|
4924
4987
|
/* @__PURE__ */ jsx44(Clock, { className: "h-4 w-4 text-warning" })
|
|
4925
4988
|
] }),
|
|
4926
|
-
/* @__PURE__ */
|
|
4989
|
+
/* @__PURE__ */ jsxs38(CardContent15, { children: [
|
|
4927
4990
|
/* @__PURE__ */ jsx44("div", { className: "text-2xl font-bold", children: activity.pending.toLocaleString() }),
|
|
4928
4991
|
/* @__PURE__ */ jsx44("p", { className: "text-xs text-muted-foreground", children: "Waiting for delivery" })
|
|
4929
4992
|
] })
|
|
4930
4993
|
] })
|
|
4931
4994
|
] }),
|
|
4932
|
-
/* @__PURE__ */
|
|
4995
|
+
/* @__PURE__ */ jsxs38(Card16, { children: [
|
|
4933
4996
|
/* @__PURE__ */ jsx44(CardHeader14, { children: /* @__PURE__ */ jsx44(CardTitle14, { className: "text-sm font-medium", children: "Delivery Success Rate" }) }),
|
|
4934
|
-
/* @__PURE__ */
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4997
|
+
/* @__PURE__ */ jsxs38(CardContent15, { children: [
|
|
4998
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-4", children: [
|
|
4999
|
+
/* @__PURE__ */ jsxs38(
|
|
4937
5000
|
"div",
|
|
4938
5001
|
{
|
|
4939
5002
|
className: cn7(
|
|
@@ -4957,7 +5020,7 @@ function WebhooksActivityPage() {
|
|
|
4957
5020
|
}
|
|
4958
5021
|
) })
|
|
4959
5022
|
] }),
|
|
4960
|
-
/* @__PURE__ */
|
|
5023
|
+
/* @__PURE__ */ jsxs38("p", { className: "text-sm text-muted-foreground mt-2", children: [
|
|
4961
5024
|
activity.delivered.toLocaleString(),
|
|
4962
5025
|
" of ",
|
|
4963
5026
|
total.toLocaleString(),
|
|
@@ -4965,19 +5028,19 @@ function WebhooksActivityPage() {
|
|
|
4965
5028
|
] })
|
|
4966
5029
|
] })
|
|
4967
5030
|
] }),
|
|
4968
|
-
activity.endpointsWithIssues.length > 0 && /* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */ jsx44(CardHeader14, { children: /* @__PURE__ */
|
|
5031
|
+
activity.endpointsWithIssues.length > 0 && /* @__PURE__ */ jsxs38(Card16, { children: [
|
|
5032
|
+
/* @__PURE__ */ jsx44(CardHeader14, { children: /* @__PURE__ */ jsxs38(CardTitle14, { className: "text-sm font-medium flex items-center gap-2", children: [
|
|
4970
5033
|
/* @__PURE__ */ jsx44(AlertTriangle3, { className: "h-4 w-4 text-warning" }),
|
|
4971
5034
|
"Endpoints with Issues"
|
|
4972
5035
|
] }) }),
|
|
4973
|
-
/* @__PURE__ */ jsx44(CardContent15, { children: /* @__PURE__ */ jsx44("div", { className: "space-y-3", children: activity.endpointsWithIssues.map((endpoint) => /* @__PURE__ */
|
|
5036
|
+
/* @__PURE__ */ jsx44(CardContent15, { children: /* @__PURE__ */ jsx44("div", { className: "space-y-3", children: activity.endpointsWithIssues.map((endpoint) => /* @__PURE__ */ jsxs38(
|
|
4974
5037
|
"div",
|
|
4975
5038
|
{
|
|
4976
5039
|
className: "flex items-center justify-between p-3 rounded-md bg-muted/50",
|
|
4977
5040
|
children: [
|
|
4978
5041
|
/* @__PURE__ */ jsx44("span", { className: "font-mono text-sm truncate flex-1", children: endpoint.url }),
|
|
4979
|
-
/* @__PURE__ */
|
|
4980
|
-
/* @__PURE__ */
|
|
5042
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-4 ml-4", children: [
|
|
5043
|
+
/* @__PURE__ */ jsxs38("span", { className: "text-sm text-destructive font-medium", children: [
|
|
4981
5044
|
endpoint.failures,
|
|
4982
5045
|
" failures"
|
|
4983
5046
|
] }),
|
|
@@ -5014,10 +5077,10 @@ import { Separator as Separator15 } from "@mdxui/primitives/separator";
|
|
|
5014
5077
|
import { SidebarTrigger as SidebarTrigger13 } from "@mdxui/primitives/sidebar";
|
|
5015
5078
|
import { Switch as Switch2 } from "@mdxui/primitives/switch";
|
|
5016
5079
|
import { Check as Check4, Circle, Copy as Copy4, Link2 as Link22, MoreHorizontal as MoreHorizontal5, Pencil as Pencil2, Plus as Plus7, RefreshCw, Trash2 as Trash25 } from "lucide-react";
|
|
5017
|
-
import { useState as
|
|
5080
|
+
import { useState as useState19 } from "react";
|
|
5018
5081
|
import { Link as Link8 } from "react-router-dom";
|
|
5019
5082
|
import { toast as toast7 } from "sonner";
|
|
5020
|
-
import { Fragment as
|
|
5083
|
+
import { Fragment as Fragment18, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
5021
5084
|
function formatRelativeTime(timestamp) {
|
|
5022
5085
|
if (!timestamp) return "Never";
|
|
5023
5086
|
const date = new Date(timestamp);
|
|
@@ -5038,44 +5101,79 @@ var eventsByCategory = mockWebhookEvents.reduce((acc, event) => {
|
|
|
5038
5101
|
acc[event.category].push(event);
|
|
5039
5102
|
return acc;
|
|
5040
5103
|
}, {});
|
|
5041
|
-
function WebhooksEndpointsPage(
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
const [
|
|
5050
|
-
const [
|
|
5104
|
+
function WebhooksEndpointsPage({
|
|
5105
|
+
endpoints: initialEndpoints,
|
|
5106
|
+
onCreateEndpoint,
|
|
5107
|
+
onUpdateEndpoint,
|
|
5108
|
+
onDeleteEndpoint,
|
|
5109
|
+
hideHeader = false,
|
|
5110
|
+
className
|
|
5111
|
+
} = {}) {
|
|
5112
|
+
const [endpoints, setEndpoints] = useState19(initialEndpoints ?? mockWebhookEndpoints);
|
|
5113
|
+
const [createDialogOpen, setCreateDialogOpen] = useState19(false);
|
|
5114
|
+
const [editDialogOpen, setEditDialogOpen] = useState19(false);
|
|
5115
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState19(false);
|
|
5116
|
+
const [selectedEndpoint, setSelectedEndpoint] = useState19(null);
|
|
5117
|
+
const [copiedSecret, setCopiedSecret] = useState19(null);
|
|
5118
|
+
const [formUrl, setFormUrl] = useState19("");
|
|
5119
|
+
const [formEvents, setFormEvents] = useState19([]);
|
|
5120
|
+
const [formEnabled, setFormEnabled] = useState19(true);
|
|
5051
5121
|
const resetForm = () => {
|
|
5052
5122
|
setFormUrl("");
|
|
5053
5123
|
setFormEvents([]);
|
|
5054
5124
|
setFormEnabled(true);
|
|
5055
5125
|
};
|
|
5056
|
-
const handleCreate = () => {
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5126
|
+
const handleCreate = async () => {
|
|
5127
|
+
if (onCreateEndpoint) {
|
|
5128
|
+
try {
|
|
5129
|
+
const result = await onCreateEndpoint({ url: formUrl, events: formEvents, enabled: formEnabled });
|
|
5130
|
+
const newEndpoint = {
|
|
5131
|
+
id: result.id,
|
|
5132
|
+
url: formUrl,
|
|
5133
|
+
events: formEvents,
|
|
5134
|
+
lastDelivery: null,
|
|
5135
|
+
status: formEnabled ? "active" : "disabled",
|
|
5136
|
+
secret: result.secret,
|
|
5137
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5138
|
+
failureCount: 0
|
|
5139
|
+
};
|
|
5140
|
+
setEndpoints([...endpoints, newEndpoint]);
|
|
5141
|
+
} catch {
|
|
5142
|
+
toast7.error("Failed to create endpoint");
|
|
5143
|
+
return;
|
|
5144
|
+
}
|
|
5145
|
+
} else {
|
|
5146
|
+
const newEndpoint = {
|
|
5147
|
+
id: `ep_${Date.now()}`,
|
|
5148
|
+
url: formUrl,
|
|
5149
|
+
events: formEvents,
|
|
5150
|
+
lastDelivery: null,
|
|
5151
|
+
status: formEnabled ? "active" : "disabled",
|
|
5152
|
+
secret: `whsec_${Math.random().toString(36).substring(2, 15)}`,
|
|
5153
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5154
|
+
failureCount: 0
|
|
5155
|
+
};
|
|
5156
|
+
setEndpoints([...endpoints, newEndpoint]);
|
|
5157
|
+
}
|
|
5068
5158
|
setCreateDialogOpen(false);
|
|
5069
5159
|
resetForm();
|
|
5070
5160
|
toast7.success("Endpoint created", {
|
|
5071
5161
|
description: "Your webhook endpoint has been created successfully."
|
|
5072
5162
|
});
|
|
5073
5163
|
};
|
|
5074
|
-
const handleEdit = () => {
|
|
5164
|
+
const handleEdit = async () => {
|
|
5075
5165
|
if (!selectedEndpoint) return;
|
|
5166
|
+
if (onUpdateEndpoint) {
|
|
5167
|
+
try {
|
|
5168
|
+
await onUpdateEndpoint(selectedEndpoint.id, { url: formUrl, events: formEvents, enabled: formEnabled });
|
|
5169
|
+
} catch {
|
|
5170
|
+
toast7.error("Failed to update endpoint");
|
|
5171
|
+
return;
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5076
5174
|
setEndpoints(
|
|
5077
5175
|
endpoints.map(
|
|
5078
|
-
(ep) => ep.id === selectedEndpoint.id ?
|
|
5176
|
+
(ep) => ep.id === selectedEndpoint.id ? { ...ep, url: formUrl, events: formEvents, status: formEnabled ? "active" : "disabled" } : ep
|
|
5079
5177
|
)
|
|
5080
5178
|
);
|
|
5081
5179
|
setEditDialogOpen(false);
|
|
@@ -5085,8 +5183,16 @@ function WebhooksEndpointsPage() {
|
|
|
5085
5183
|
description: "Your webhook endpoint has been updated successfully."
|
|
5086
5184
|
});
|
|
5087
5185
|
};
|
|
5088
|
-
const handleDelete = () => {
|
|
5186
|
+
const handleDelete = async () => {
|
|
5089
5187
|
if (!selectedEndpoint) return;
|
|
5188
|
+
if (onDeleteEndpoint) {
|
|
5189
|
+
try {
|
|
5190
|
+
await onDeleteEndpoint(selectedEndpoint.id);
|
|
5191
|
+
} catch {
|
|
5192
|
+
toast7.error("Failed to delete endpoint");
|
|
5193
|
+
return;
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5090
5196
|
setEndpoints(endpoints.filter((ep) => ep.id !== selectedEndpoint.id));
|
|
5091
5197
|
setDeleteDialogOpen(false);
|
|
5092
5198
|
setSelectedEndpoint(null);
|
|
@@ -5105,12 +5211,12 @@ function WebhooksEndpointsPage() {
|
|
|
5105
5211
|
setSelectedEndpoint(endpoint);
|
|
5106
5212
|
setDeleteDialogOpen(true);
|
|
5107
5213
|
};
|
|
5108
|
-
const handleCopySecret = (endpoint) =>
|
|
5109
|
-
|
|
5214
|
+
const handleCopySecret = async (endpoint) => {
|
|
5215
|
+
await navigator.clipboard.writeText(endpoint.secret);
|
|
5110
5216
|
setCopiedSecret(endpoint.id);
|
|
5111
5217
|
setTimeout(() => setCopiedSecret(null), 2e3);
|
|
5112
5218
|
toast7.success("Secret copied to clipboard");
|
|
5113
|
-
}
|
|
5219
|
+
};
|
|
5114
5220
|
const toggleEvent = (eventName) => {
|
|
5115
5221
|
if (formEvents.includes(eventName)) {
|
|
5116
5222
|
setFormEvents(formEvents.filter((e) => e !== eventName));
|
|
@@ -5118,55 +5224,55 @@ function WebhooksEndpointsPage() {
|
|
|
5118
5224
|
setFormEvents([...formEvents, eventName]);
|
|
5119
5225
|
}
|
|
5120
5226
|
};
|
|
5121
|
-
return /* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */ jsx45("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
5227
|
+
return /* @__PURE__ */ jsxs39(Fragment18, { children: [
|
|
5228
|
+
!hideHeader && /* @__PURE__ */ jsx45("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2 px-4", children: [
|
|
5123
5229
|
/* @__PURE__ */ jsx45(SidebarTrigger13, { className: "-ml-1" }),
|
|
5124
5230
|
/* @__PURE__ */ jsx45(Separator15, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
5125
|
-
/* @__PURE__ */ jsx45(Breadcrumb13, { children: /* @__PURE__ */
|
|
5231
|
+
/* @__PURE__ */ jsx45(Breadcrumb13, { children: /* @__PURE__ */ jsxs39(BreadcrumbList13, { children: [
|
|
5126
5232
|
/* @__PURE__ */ jsx45(BreadcrumbItem13, { children: /* @__PURE__ */ jsx45(BreadcrumbLink5, { asChild: true, children: /* @__PURE__ */ jsx45(Link8, { to: "/webhooks", children: "Webhooks" }) }) }),
|
|
5127
5233
|
/* @__PURE__ */ jsx45(BreadcrumbSeparator5, {}),
|
|
5128
5234
|
/* @__PURE__ */ jsx45(BreadcrumbItem13, { children: /* @__PURE__ */ jsx45(BreadcrumbPage13, { children: "Endpoints" }) })
|
|
5129
5235
|
] }) })
|
|
5130
5236
|
] }) }),
|
|
5131
|
-
/* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5237
|
+
/* @__PURE__ */ jsxs39("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
5238
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between", children: [
|
|
5239
|
+
/* @__PURE__ */ jsxs39("div", { children: [
|
|
5134
5240
|
/* @__PURE__ */ jsx45("h1", { className: "text-2xl font-bold", children: "Endpoints" }),
|
|
5135
5241
|
/* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: "Manage your webhook subscription endpoints." })
|
|
5136
5242
|
] }),
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
/* @__PURE__ */ jsx45(DialogTrigger5, { asChild: true, children: /* @__PURE__ */
|
|
5243
|
+
/* @__PURE__ */ jsxs39(Dialog8, { open: createDialogOpen, onOpenChange: setCreateDialogOpen, children: [
|
|
5244
|
+
/* @__PURE__ */ jsx45(DialogTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs39(Button18, { onClick: resetForm, children: [
|
|
5139
5245
|
/* @__PURE__ */ jsx45(Plus7, { className: "h-4 w-4" }),
|
|
5140
5246
|
"Add Endpoint"
|
|
5141
5247
|
] }) }),
|
|
5142
|
-
/* @__PURE__ */
|
|
5143
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsxs39(DialogContent8, { className: "sm:max-w-xl", children: [
|
|
5249
|
+
/* @__PURE__ */ jsxs39(DialogHeader7, { children: [
|
|
5144
5250
|
/* @__PURE__ */ jsx45(DialogTitle7, { children: "Add Webhook Endpoint" }),
|
|
5145
5251
|
/* @__PURE__ */ jsx45(DialogDescription6, { children: "Configure a new endpoint to receive webhook events." })
|
|
5146
5252
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5149
|
-
/* @__PURE__ */
|
|
5253
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-6", children: [
|
|
5254
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-4", children: [
|
|
5255
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-2", children: [
|
|
5150
5256
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: "url", children: "Endpoint URL" }),
|
|
5151
5257
|
/* @__PURE__ */ jsx45(
|
|
5152
5258
|
Input9,
|
|
5153
5259
|
{
|
|
5154
5260
|
id: "url",
|
|
5155
|
-
placeholder: "https://api.example.com/webhooks",
|
|
5261
|
+
placeholder: "https://api.example.com.ai/webhooks",
|
|
5156
5262
|
value: formUrl,
|
|
5157
5263
|
onChange: (e) => setFormUrl(e.target.value)
|
|
5158
5264
|
}
|
|
5159
5265
|
)
|
|
5160
5266
|
] }),
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
/* @__PURE__ */
|
|
5267
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [
|
|
5268
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-0.5", children: [
|
|
5163
5269
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: "enabled", className: "text-sm font-medium", children: "Active" }),
|
|
5164
5270
|
/* @__PURE__ */ jsx45("p", { className: "text-xs text-muted-foreground", children: "Enable this endpoint to receive events" })
|
|
5165
5271
|
] }),
|
|
5166
5272
|
/* @__PURE__ */ jsx45(Switch2, { id: "enabled", checked: formEnabled, onCheckedChange: setFormEnabled })
|
|
5167
5273
|
] })
|
|
5168
5274
|
] }),
|
|
5169
|
-
/* @__PURE__ */
|
|
5275
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-3", children: [
|
|
5170
5276
|
/* @__PURE__ */ jsx45(Label8, { children: "Events to subscribe" }),
|
|
5171
5277
|
/* @__PURE__ */ jsx45("div", { className: "rounded-lg border divide-y", children: Object.entries(eventsByCategory).map(([category, events]) => {
|
|
5172
5278
|
const categoryEvents = events.map((e) => e.name);
|
|
@@ -5179,8 +5285,8 @@ function WebhooksEndpointsPage() {
|
|
|
5179
5285
|
setFormEvents([.../* @__PURE__ */ new Set([...formEvents, ...categoryEvents])]);
|
|
5180
5286
|
}
|
|
5181
5287
|
};
|
|
5182
|
-
return /* @__PURE__ */
|
|
5183
|
-
/* @__PURE__ */
|
|
5288
|
+
return /* @__PURE__ */ jsxs39("div", { className: "p-3 space-y-2", children: [
|
|
5289
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
5184
5290
|
/* @__PURE__ */ jsx45(
|
|
5185
5291
|
Checkbox,
|
|
5186
5292
|
{
|
|
@@ -5192,7 +5298,7 @@ function WebhooksEndpointsPage() {
|
|
|
5192
5298
|
),
|
|
5193
5299
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: `category-${category}`, className: "text-sm font-medium cursor-pointer", children: category })
|
|
5194
5300
|
] }),
|
|
5195
|
-
/* @__PURE__ */ jsx45("div", { className: "ml-6 space-y-1.5", children: events.map((event) => /* @__PURE__ */
|
|
5301
|
+
/* @__PURE__ */ jsx45("div", { className: "ml-6 space-y-1.5", children: events.map((event) => /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
5196
5302
|
/* @__PURE__ */ jsx45(
|
|
5197
5303
|
Checkbox,
|
|
5198
5304
|
{
|
|
@@ -5205,7 +5311,7 @@ function WebhooksEndpointsPage() {
|
|
|
5205
5311
|
] }, event.name)) })
|
|
5206
5312
|
] }, category);
|
|
5207
5313
|
}) }),
|
|
5208
|
-
/* @__PURE__ */
|
|
5314
|
+
/* @__PURE__ */ jsxs39("p", { className: "text-xs text-muted-foreground", children: [
|
|
5209
5315
|
formEvents.length,
|
|
5210
5316
|
" event",
|
|
5211
5317
|
formEvents.length !== 1 ? "s" : "",
|
|
@@ -5213,19 +5319,19 @@ function WebhooksEndpointsPage() {
|
|
|
5213
5319
|
] })
|
|
5214
5320
|
] })
|
|
5215
5321
|
] }),
|
|
5216
|
-
/* @__PURE__ */
|
|
5322
|
+
/* @__PURE__ */ jsxs39(DialogFooter7, { children: [
|
|
5217
5323
|
/* @__PURE__ */ jsx45(Button18, { variant: "outline", onClick: () => setCreateDialogOpen(false), children: "Cancel" }),
|
|
5218
5324
|
/* @__PURE__ */ jsx45(Button18, { onClick: handleCreate, disabled: !formUrl || formEvents.length === 0, children: "Create Endpoint" })
|
|
5219
5325
|
] })
|
|
5220
5326
|
] })
|
|
5221
5327
|
] })
|
|
5222
5328
|
] }),
|
|
5223
|
-
/* @__PURE__ */
|
|
5329
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-3", children: [
|
|
5224
5330
|
endpoints.map((endpoint) => {
|
|
5225
5331
|
const hasIssues = endpoint.failureCount > 0;
|
|
5226
|
-
return /* @__PURE__ */ jsx45(Card17, { children: /* @__PURE__ */ jsx45(CardContent16, { className: "p-4 py-0", children: /* @__PURE__ */
|
|
5227
|
-
/* @__PURE__ */
|
|
5228
|
-
/* @__PURE__ */
|
|
5332
|
+
return /* @__PURE__ */ jsx45(Card17, { children: /* @__PURE__ */ jsx45(CardContent16, { className: "p-4 py-0", children: /* @__PURE__ */ jsxs39("div", { className: "flex items-start justify-between gap-4", children: [
|
|
5333
|
+
/* @__PURE__ */ jsxs39("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
5334
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
5229
5335
|
/* @__PURE__ */ jsx45(
|
|
5230
5336
|
Circle,
|
|
5231
5337
|
{
|
|
@@ -5235,20 +5341,20 @@ function WebhooksEndpointsPage() {
|
|
|
5235
5341
|
/* @__PURE__ */ jsx45("span", { className: "font-mono text-sm truncate", children: endpoint.url }),
|
|
5236
5342
|
endpoint.status === "disabled" && /* @__PURE__ */ jsx45(Badge7, { variant: "secondary", className: "shrink-0", children: "Disabled" })
|
|
5237
5343
|
] }),
|
|
5238
|
-
/* @__PURE__ */
|
|
5239
|
-
/* @__PURE__ */
|
|
5344
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1 text-sm text-muted-foreground ml-4", children: [
|
|
5345
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
5240
5346
|
endpoint.events.length,
|
|
5241
5347
|
" event",
|
|
5242
5348
|
endpoint.events.length !== 1 ? "s" : ""
|
|
5243
5349
|
] }),
|
|
5244
5350
|
/* @__PURE__ */ jsx45("span", { children: "\xB7" }),
|
|
5245
|
-
/* @__PURE__ */
|
|
5351
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
5246
5352
|
"Last delivery ",
|
|
5247
5353
|
formatRelativeTime(endpoint.lastDelivery).toLowerCase()
|
|
5248
5354
|
] }),
|
|
5249
|
-
endpoint.failureCount > 0 && /* @__PURE__ */
|
|
5355
|
+
endpoint.failureCount > 0 && /* @__PURE__ */ jsxs39(Fragment18, { children: [
|
|
5250
5356
|
/* @__PURE__ */ jsx45("span", { children: "\xB7" }),
|
|
5251
|
-
/* @__PURE__ */
|
|
5357
|
+
/* @__PURE__ */ jsxs39("span", { className: "text-destructive", children: [
|
|
5252
5358
|
endpoint.failureCount,
|
|
5253
5359
|
" failure",
|
|
5254
5360
|
endpoint.failureCount !== 1 ? "s" : ""
|
|
@@ -5256,23 +5362,23 @@ function WebhooksEndpointsPage() {
|
|
|
5256
5362
|
] })
|
|
5257
5363
|
] })
|
|
5258
5364
|
] }),
|
|
5259
|
-
/* @__PURE__ */
|
|
5365
|
+
/* @__PURE__ */ jsxs39(DropdownMenu8, { children: [
|
|
5260
5366
|
/* @__PURE__ */ jsx45(DropdownMenuTrigger8, { asChild: true, children: /* @__PURE__ */ jsx45(Button18, { variant: "ghost", size: "icon", className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ jsx45(MoreHorizontal5, { className: "h-4 w-4" }) }) }),
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5367
|
+
/* @__PURE__ */ jsxs39(DropdownMenuContent8, { align: "end", children: [
|
|
5368
|
+
/* @__PURE__ */ jsxs39(DropdownMenuItem8, { onClick: () => openEditDialog(endpoint), children: [
|
|
5263
5369
|
/* @__PURE__ */ jsx45(Pencil2, { className: "h-4 w-4" }),
|
|
5264
5370
|
"Edit"
|
|
5265
5371
|
] }),
|
|
5266
|
-
/* @__PURE__ */
|
|
5372
|
+
/* @__PURE__ */ jsxs39(DropdownMenuItem8, { onClick: () => handleCopySecret(endpoint), children: [
|
|
5267
5373
|
copiedSecret === endpoint.id ? /* @__PURE__ */ jsx45(Check4, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx45(Copy4, { className: "h-4 w-4" }),
|
|
5268
5374
|
"Copy Secret"
|
|
5269
5375
|
] }),
|
|
5270
|
-
/* @__PURE__ */
|
|
5376
|
+
/* @__PURE__ */ jsxs39(DropdownMenuItem8, { children: [
|
|
5271
5377
|
/* @__PURE__ */ jsx45(RefreshCw, { className: "h-4 w-4" }),
|
|
5272
5378
|
"Regenerate Secret"
|
|
5273
5379
|
] }),
|
|
5274
5380
|
/* @__PURE__ */ jsx45(DropdownMenuSeparator3, {}),
|
|
5275
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsxs39(DropdownMenuItem8, { className: "text-destructive focus:text-destructive", onClick: () => openDeleteDialog(endpoint), children: [
|
|
5276
5382
|
/* @__PURE__ */ jsx45(Trash25, { className: "h-4 w-4" }),
|
|
5277
5383
|
"Delete"
|
|
5278
5384
|
] })
|
|
@@ -5280,47 +5386,47 @@ function WebhooksEndpointsPage() {
|
|
|
5280
5386
|
] })
|
|
5281
5387
|
] }) }) }, endpoint.id);
|
|
5282
5388
|
}),
|
|
5283
|
-
endpoints.length === 0 && /* @__PURE__ */ jsx45(Card17, { children: /* @__PURE__ */ jsx45(CardContent16, { className: "py-16", children: /* @__PURE__ */
|
|
5389
|
+
endpoints.length === 0 && /* @__PURE__ */ jsx45(Card17, { children: /* @__PURE__ */ jsx45(CardContent16, { className: "py-16", children: /* @__PURE__ */ jsxs39("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
5284
5390
|
/* @__PURE__ */ jsx45("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx45(Link22, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
5285
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsxs39("div", { children: [
|
|
5286
5392
|
/* @__PURE__ */ jsx45("p", { className: "font-medium", children: "No endpoints configured" }),
|
|
5287
5393
|
/* @__PURE__ */ jsx45("p", { className: "text-sm text-muted-foreground mt-1", children: "Add your first endpoint to start receiving webhook events." })
|
|
5288
5394
|
] }),
|
|
5289
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsxs39(Button18, { onClick: () => setCreateDialogOpen(true), className: "mt-2", children: [
|
|
5290
5396
|
/* @__PURE__ */ jsx45(Plus7, { className: "h-4 w-4" }),
|
|
5291
5397
|
"Add Your First Endpoint"
|
|
5292
5398
|
] })
|
|
5293
5399
|
] }) }) })
|
|
5294
5400
|
] })
|
|
5295
5401
|
] }),
|
|
5296
|
-
/* @__PURE__ */ jsx45(Dialog8, { open: editDialogOpen, onOpenChange: setEditDialogOpen, children: /* @__PURE__ */
|
|
5297
|
-
/* @__PURE__ */
|
|
5402
|
+
/* @__PURE__ */ jsx45(Dialog8, { open: editDialogOpen, onOpenChange: setEditDialogOpen, children: /* @__PURE__ */ jsxs39(DialogContent8, { className: "sm:max-w-xl", children: [
|
|
5403
|
+
/* @__PURE__ */ jsxs39(DialogHeader7, { children: [
|
|
5298
5404
|
/* @__PURE__ */ jsx45(DialogTitle7, { children: "Edit Endpoint" }),
|
|
5299
5405
|
/* @__PURE__ */ jsx45(DialogDescription6, { children: "Update your webhook endpoint configuration." })
|
|
5300
5406
|
] }),
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5303
|
-
/* @__PURE__ */
|
|
5407
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-6", children: [
|
|
5408
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-4", children: [
|
|
5409
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-2", children: [
|
|
5304
5410
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: "edit-url", children: "Endpoint URL" }),
|
|
5305
5411
|
/* @__PURE__ */ jsx45(
|
|
5306
5412
|
Input9,
|
|
5307
5413
|
{
|
|
5308
5414
|
id: "edit-url",
|
|
5309
|
-
placeholder: "https://api.example.com/webhooks",
|
|
5415
|
+
placeholder: "https://api.example.com.ai/webhooks",
|
|
5310
5416
|
value: formUrl,
|
|
5311
5417
|
onChange: (e) => setFormUrl(e.target.value)
|
|
5312
5418
|
}
|
|
5313
5419
|
)
|
|
5314
5420
|
] }),
|
|
5315
|
-
/* @__PURE__ */
|
|
5316
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [
|
|
5422
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-0.5", children: [
|
|
5317
5423
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: "edit-enabled", className: "text-sm font-medium", children: "Active" }),
|
|
5318
5424
|
/* @__PURE__ */ jsx45("p", { className: "text-xs text-muted-foreground", children: "Enable this endpoint to receive events" })
|
|
5319
5425
|
] }),
|
|
5320
5426
|
/* @__PURE__ */ jsx45(Switch2, { id: "edit-enabled", checked: formEnabled, onCheckedChange: setFormEnabled })
|
|
5321
5427
|
] })
|
|
5322
5428
|
] }),
|
|
5323
|
-
/* @__PURE__ */
|
|
5429
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-3", children: [
|
|
5324
5430
|
/* @__PURE__ */ jsx45(Label8, { children: "Events to subscribe" }),
|
|
5325
5431
|
/* @__PURE__ */ jsx45("div", { className: "rounded-lg border divide-y", children: Object.entries(eventsByCategory).map(([category, events]) => {
|
|
5326
5432
|
const categoryEvents = events.map((e) => e.name);
|
|
@@ -5333,8 +5439,8 @@ function WebhooksEndpointsPage() {
|
|
|
5333
5439
|
setFormEvents([.../* @__PURE__ */ new Set([...formEvents, ...categoryEvents])]);
|
|
5334
5440
|
}
|
|
5335
5441
|
};
|
|
5336
|
-
return /* @__PURE__ */
|
|
5337
|
-
/* @__PURE__ */
|
|
5442
|
+
return /* @__PURE__ */ jsxs39("div", { className: "p-3 space-y-2", children: [
|
|
5443
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
5338
5444
|
/* @__PURE__ */ jsx45(
|
|
5339
5445
|
Checkbox,
|
|
5340
5446
|
{
|
|
@@ -5346,7 +5452,7 @@ function WebhooksEndpointsPage() {
|
|
|
5346
5452
|
),
|
|
5347
5453
|
/* @__PURE__ */ jsx45(Label8, { htmlFor: `edit-category-${category}`, className: "text-sm font-medium cursor-pointer", children: category })
|
|
5348
5454
|
] }),
|
|
5349
|
-
/* @__PURE__ */ jsx45("div", { className: "ml-6 space-y-1.5", children: events.map((event) => /* @__PURE__ */
|
|
5455
|
+
/* @__PURE__ */ jsx45("div", { className: "ml-6 space-y-1.5", children: events.map((event) => /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
5350
5456
|
/* @__PURE__ */ jsx45(
|
|
5351
5457
|
Checkbox,
|
|
5352
5458
|
{
|
|
@@ -5359,7 +5465,7 @@ function WebhooksEndpointsPage() {
|
|
|
5359
5465
|
] }, event.name)) })
|
|
5360
5466
|
] }, category);
|
|
5361
5467
|
}) }),
|
|
5362
|
-
/* @__PURE__ */
|
|
5468
|
+
/* @__PURE__ */ jsxs39("p", { className: "text-xs text-muted-foreground", children: [
|
|
5363
5469
|
formEvents.length,
|
|
5364
5470
|
" event",
|
|
5365
5471
|
formEvents.length !== 1 ? "s" : "",
|
|
@@ -5367,18 +5473,18 @@ function WebhooksEndpointsPage() {
|
|
|
5367
5473
|
] })
|
|
5368
5474
|
] })
|
|
5369
5475
|
] }),
|
|
5370
|
-
/* @__PURE__ */
|
|
5476
|
+
/* @__PURE__ */ jsxs39(DialogFooter7, { children: [
|
|
5371
5477
|
/* @__PURE__ */ jsx45(Button18, { variant: "outline", onClick: () => setEditDialogOpen(false), children: "Cancel" }),
|
|
5372
5478
|
/* @__PURE__ */ jsx45(Button18, { onClick: handleEdit, disabled: !formUrl || formEvents.length === 0, children: "Save Changes" })
|
|
5373
5479
|
] })
|
|
5374
5480
|
] }) }),
|
|
5375
|
-
/* @__PURE__ */ jsx45(Dialog8, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ jsx45(Dialog8, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs39(DialogContent8, { children: [
|
|
5482
|
+
/* @__PURE__ */ jsxs39(DialogHeader7, { children: [
|
|
5377
5483
|
/* @__PURE__ */ jsx45(DialogTitle7, { children: "Delete Endpoint" }),
|
|
5378
5484
|
/* @__PURE__ */ jsx45(DialogDescription6, { children: "Are you sure you want to delete this endpoint? This action cannot be undone." })
|
|
5379
5485
|
] }),
|
|
5380
5486
|
selectedEndpoint && /* @__PURE__ */ jsx45("div", { className: "rounded-md bg-muted p-3", children: /* @__PURE__ */ jsx45("p", { className: "font-mono text-sm truncate", children: selectedEndpoint.url }) }),
|
|
5381
|
-
/* @__PURE__ */
|
|
5487
|
+
/* @__PURE__ */ jsxs39(DialogFooter7, { children: [
|
|
5382
5488
|
/* @__PURE__ */ jsx45(Button18, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
5383
5489
|
/* @__PURE__ */ jsx45(Button18, { variant: "destructive", onClick: handleDelete, children: "Delete" })
|
|
5384
5490
|
] })
|
|
@@ -5394,12 +5500,12 @@ import { Input as Input10 } from "@mdxui/primitives/input";
|
|
|
5394
5500
|
import { Separator as Separator16 } from "@mdxui/primitives/separator";
|
|
5395
5501
|
import { SidebarTrigger as SidebarTrigger14 } from "@mdxui/primitives/sidebar";
|
|
5396
5502
|
import { BookOpen, ChevronRight as ChevronRight2, Search as Search2 } from "lucide-react";
|
|
5397
|
-
import { useState as
|
|
5503
|
+
import { useState as useState20 } from "react";
|
|
5398
5504
|
import { Link as Link9 } from "react-router-dom";
|
|
5399
|
-
import { Fragment as
|
|
5505
|
+
import { Fragment as Fragment19, jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5400
5506
|
function WebhooksEventCatalogPage() {
|
|
5401
|
-
const [searchQuery, setSearchQuery] =
|
|
5402
|
-
const [expandedEvents, setExpandedEvents] =
|
|
5507
|
+
const [searchQuery, setSearchQuery] = useState20("");
|
|
5508
|
+
const [expandedEvents, setExpandedEvents] = useState20(/* @__PURE__ */ new Set());
|
|
5403
5509
|
const filteredEvents = mockWebhookEvents.filter(
|
|
5404
5510
|
(event) => event.name.toLowerCase().includes(searchQuery.toLowerCase()) || event.description.toLowerCase().includes(searchQuery.toLowerCase()) || event.category.toLowerCase().includes(searchQuery.toLowerCase())
|
|
5405
5511
|
);
|
|
@@ -5419,23 +5525,23 @@ function WebhooksEventCatalogPage() {
|
|
|
5419
5525
|
}
|
|
5420
5526
|
setExpandedEvents(newExpanded);
|
|
5421
5527
|
};
|
|
5422
|
-
return /* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */ jsx46("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
5528
|
+
return /* @__PURE__ */ jsxs40(Fragment19, { children: [
|
|
5529
|
+
/* @__PURE__ */ jsx46("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2 px-4", children: [
|
|
5424
5530
|
/* @__PURE__ */ jsx46(SidebarTrigger14, { className: "-ml-1" }),
|
|
5425
5531
|
/* @__PURE__ */ jsx46(Separator16, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
5426
|
-
/* @__PURE__ */ jsx46(Breadcrumb14, { children: /* @__PURE__ */
|
|
5532
|
+
/* @__PURE__ */ jsx46(Breadcrumb14, { children: /* @__PURE__ */ jsxs40(BreadcrumbList14, { children: [
|
|
5427
5533
|
/* @__PURE__ */ jsx46(BreadcrumbItem14, { children: /* @__PURE__ */ jsx46(BreadcrumbLink6, { asChild: true, children: /* @__PURE__ */ jsx46(Link9, { to: "/webhooks", children: "Webhooks" }) }) }),
|
|
5428
5534
|
/* @__PURE__ */ jsx46(BreadcrumbSeparator6, {}),
|
|
5429
5535
|
/* @__PURE__ */ jsx46(BreadcrumbItem14, { children: /* @__PURE__ */ jsx46(BreadcrumbPage14, { children: "Event Catalog" }) })
|
|
5430
5536
|
] }) })
|
|
5431
5537
|
] }) }),
|
|
5432
|
-
/* @__PURE__ */
|
|
5433
|
-
/* @__PURE__ */
|
|
5434
|
-
/* @__PURE__ */
|
|
5538
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
5539
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between", children: [
|
|
5540
|
+
/* @__PURE__ */ jsxs40("div", { children: [
|
|
5435
5541
|
/* @__PURE__ */ jsx46("h1", { className: "text-2xl font-bold", children: "Event Catalog" }),
|
|
5436
5542
|
/* @__PURE__ */ jsx46("p", { className: "text-muted-foreground", children: "Browse and search available webhook events." })
|
|
5437
5543
|
] }),
|
|
5438
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsxs40("div", { className: "relative", children: [
|
|
5439
5545
|
/* @__PURE__ */ jsx46(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
5440
5546
|
/* @__PURE__ */ jsx46(
|
|
5441
5547
|
Input10,
|
|
@@ -5448,18 +5554,18 @@ function WebhooksEventCatalogPage() {
|
|
|
5448
5554
|
)
|
|
5449
5555
|
] })
|
|
5450
5556
|
] }),
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
Object.entries(groupedEvents).map(([category, events]) => /* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsxs40("div", { className: "space-y-6", children: [
|
|
5558
|
+
Object.entries(groupedEvents).map(([category, events]) => /* @__PURE__ */ jsxs40("div", { children: [
|
|
5453
5559
|
/* @__PURE__ */ jsx46("h2", { className: "text-sm font-semibold text-muted-foreground mb-3 pt-2", children: category }),
|
|
5454
|
-
/* @__PURE__ */ jsx46("div", { className: "space-y-2", children: events.map((event) => /* @__PURE__ */ jsx46(Card18, { noPadding: true, children: /* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */ jsx46(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(CardContent17, { className: "p-4 cursor-pointer hover:bg-muted/50 transition-colors", children: /* @__PURE__ */
|
|
5560
|
+
/* @__PURE__ */ jsx46("div", { className: "space-y-2", children: events.map((event) => /* @__PURE__ */ jsx46(Card18, { noPadding: true, children: /* @__PURE__ */ jsxs40(Collapsible, { open: expandedEvents.has(event.id), onOpenChange: () => toggleEvent(event.id), children: [
|
|
5561
|
+
/* @__PURE__ */ jsx46(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(CardContent17, { className: "p-4 cursor-pointer hover:bg-muted/50 transition-colors", children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3", children: [
|
|
5456
5562
|
/* @__PURE__ */ jsx46(
|
|
5457
5563
|
ChevronRight2,
|
|
5458
5564
|
{
|
|
5459
5565
|
className: `h-4 w-4 text-muted-foreground transition-transform ${expandedEvents.has(event.id) ? "rotate-90" : ""}`
|
|
5460
5566
|
}
|
|
5461
5567
|
),
|
|
5462
|
-
/* @__PURE__ */
|
|
5568
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex-1 min-w-0", children: [
|
|
5463
5569
|
/* @__PURE__ */ jsx46("p", { className: "font-mono text-sm font-medium", children: event.name }),
|
|
5464
5570
|
/* @__PURE__ */ jsx46("p", { className: "text-sm text-muted-foreground truncate", children: event.description })
|
|
5465
5571
|
] })
|
|
@@ -5467,9 +5573,9 @@ function WebhooksEventCatalogPage() {
|
|
|
5467
5573
|
/* @__PURE__ */ jsx46(CollapsibleContent, { children: /* @__PURE__ */ jsx46("div", { className: "px-4 pb-4 ml-7 mr-7", children: /* @__PURE__ */ jsx46(JsonViewer, { data: event.payloadSchema }) }) })
|
|
5468
5574
|
] }) }, event.id)) })
|
|
5469
5575
|
] }, category)),
|
|
5470
|
-
Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ jsx46(Card18, { children: /* @__PURE__ */ jsx46(CardContent17, { className: "py-16", children: /* @__PURE__ */
|
|
5576
|
+
Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ jsx46(Card18, { children: /* @__PURE__ */ jsx46(CardContent17, { className: "py-16", children: /* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
5471
5577
|
/* @__PURE__ */ jsx46("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx46(BookOpen, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
5472
|
-
/* @__PURE__ */
|
|
5578
|
+
/* @__PURE__ */ jsxs40("div", { children: [
|
|
5473
5579
|
/* @__PURE__ */ jsx46("p", { className: "font-medium", children: "No events found" }),
|
|
5474
5580
|
/* @__PURE__ */ jsx46("p", { className: "text-sm text-muted-foreground mt-1", children: "Try adjusting your search query." })
|
|
5475
5581
|
] })
|
|
@@ -5488,10 +5594,10 @@ import { Sheet as Sheet2, SheetContent as SheetContent2, SheetDescription as She
|
|
|
5488
5594
|
import { SidebarTrigger as SidebarTrigger15 } from "@mdxui/primitives/sidebar";
|
|
5489
5595
|
import { Table as Table9, TableBody as TableBody9, TableCell as TableCell9, TableHead as TableHead9, TableHeader as TableHeader9, TableRow as TableRow9 } from "@mdxui/primitives/table";
|
|
5490
5596
|
import { Check as Check5, ChevronDown as ChevronDown4, Copy as Copy5, RefreshCw as RefreshCw2, ScrollText } from "lucide-react";
|
|
5491
|
-
import { useState as
|
|
5597
|
+
import { useState as useState21 } from "react";
|
|
5492
5598
|
import { Link as Link10 } from "react-router-dom";
|
|
5493
5599
|
import { toast as toast8 } from "sonner";
|
|
5494
|
-
import { Fragment as
|
|
5600
|
+
import { Fragment as Fragment20, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5495
5601
|
var statusFilterOptions2 = [
|
|
5496
5602
|
{ value: "all", label: "All Status" },
|
|
5497
5603
|
{ value: "success", label: "Success" },
|
|
@@ -5524,11 +5630,10 @@ function formatLatency2(ms) {
|
|
|
5524
5630
|
return `${ms}ms`;
|
|
5525
5631
|
}
|
|
5526
5632
|
function WebhooksLogsPage() {
|
|
5527
|
-
|
|
5528
|
-
const [
|
|
5529
|
-
const [
|
|
5530
|
-
const [
|
|
5531
|
-
const [copiedUrl, setCopiedUrl] = useState22(false);
|
|
5633
|
+
const [statusFilter, setStatusFilter] = useState21("all");
|
|
5634
|
+
const [selectedLog, setSelectedLog] = useState21(null);
|
|
5635
|
+
const [sheetOpen, setSheetOpen] = useState21(false);
|
|
5636
|
+
const [copiedUrl, setCopiedUrl] = useState21(false);
|
|
5532
5637
|
const filteredLogs = mockWebhookLogs.filter((log) => {
|
|
5533
5638
|
if (statusFilter === "all") return true;
|
|
5534
5639
|
if (statusFilter === "success") return log.statusCode >= 200 && log.statusCode < 300;
|
|
@@ -5539,43 +5644,43 @@ function WebhooksLogsPage() {
|
|
|
5539
5644
|
setSheetOpen(true);
|
|
5540
5645
|
setCopiedUrl(false);
|
|
5541
5646
|
};
|
|
5542
|
-
const handleCopyUrl = (url) =>
|
|
5543
|
-
|
|
5647
|
+
const handleCopyUrl = async (url) => {
|
|
5648
|
+
await navigator.clipboard.writeText(url);
|
|
5544
5649
|
setCopiedUrl(true);
|
|
5545
5650
|
setTimeout(() => setCopiedUrl(false), 2e3);
|
|
5546
|
-
}
|
|
5651
|
+
};
|
|
5547
5652
|
const handleRetry = () => {
|
|
5548
5653
|
toast8.success("Webhook retry triggered", {
|
|
5549
5654
|
description: "The webhook delivery will be retried shortly."
|
|
5550
5655
|
});
|
|
5551
5656
|
setSheetOpen(false);
|
|
5552
5657
|
};
|
|
5553
|
-
return /* @__PURE__ */
|
|
5554
|
-
/* @__PURE__ */ jsx47("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */
|
|
5658
|
+
return /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
5659
|
+
/* @__PURE__ */ jsx47("header", { className: "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2 px-4", children: [
|
|
5555
5660
|
/* @__PURE__ */ jsx47(SidebarTrigger15, { className: "-ml-1" }),
|
|
5556
5661
|
/* @__PURE__ */ jsx47(Separator17, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
5557
|
-
/* @__PURE__ */ jsx47(Breadcrumb15, { children: /* @__PURE__ */
|
|
5662
|
+
/* @__PURE__ */ jsx47(Breadcrumb15, { children: /* @__PURE__ */ jsxs41(BreadcrumbList15, { children: [
|
|
5558
5663
|
/* @__PURE__ */ jsx47(BreadcrumbItem15, { children: /* @__PURE__ */ jsx47(BreadcrumbLink7, { asChild: true, children: /* @__PURE__ */ jsx47(Link10, { to: "/webhooks", children: "Webhooks" }) }) }),
|
|
5559
5664
|
/* @__PURE__ */ jsx47(BreadcrumbSeparator7, {}),
|
|
5560
5665
|
/* @__PURE__ */ jsx47(BreadcrumbItem15, { children: /* @__PURE__ */ jsx47(BreadcrumbPage15, { children: "Logs" }) })
|
|
5561
5666
|
] }) })
|
|
5562
5667
|
] }) }),
|
|
5563
|
-
/* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
5668
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 pt-0", children: [
|
|
5669
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between", children: [
|
|
5670
|
+
/* @__PURE__ */ jsxs41("div", { children: [
|
|
5566
5671
|
/* @__PURE__ */ jsx47("h1", { className: "text-2xl font-bold", children: "Webhook Logs" }),
|
|
5567
5672
|
/* @__PURE__ */ jsx47("p", { className: "text-muted-foreground", children: "View webhook delivery history and debug issues." })
|
|
5568
5673
|
] }),
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
/* @__PURE__ */ jsx47(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */
|
|
5571
|
-
|
|
5674
|
+
/* @__PURE__ */ jsxs41(DropdownMenu9, { children: [
|
|
5675
|
+
/* @__PURE__ */ jsx47(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs41(Button19, { variant: "outline", className: "w-[140px] justify-between", children: [
|
|
5676
|
+
statusFilterOptions2.find((o) => o.value === statusFilter)?.label,
|
|
5572
5677
|
/* @__PURE__ */ jsx47(ChevronDown4, { className: "h-4 w-4 opacity-50" })
|
|
5573
5678
|
] }) }),
|
|
5574
5679
|
/* @__PURE__ */ jsx47(DropdownMenuContent9, { align: "end", className: "w-[140px]", children: statusFilterOptions2.map((option) => /* @__PURE__ */ jsx47(DropdownMenuItem9, { onClick: () => setStatusFilter(option.value), children: option.label }, option.value)) })
|
|
5575
5680
|
] })
|
|
5576
5681
|
] }),
|
|
5577
|
-
/* @__PURE__ */ jsx47("div", { className: "rounded-md border", children: /* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */ jsx47(TableHeader9, { children: /* @__PURE__ */
|
|
5682
|
+
/* @__PURE__ */ jsx47("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs41(Table9, { children: [
|
|
5683
|
+
/* @__PURE__ */ jsx47(TableHeader9, { children: /* @__PURE__ */ jsxs41(TableRow9, { children: [
|
|
5579
5684
|
/* @__PURE__ */ jsx47(TableHead9, { className: "w-[40px] pl-4" }),
|
|
5580
5685
|
/* @__PURE__ */ jsx47(TableHead9, { children: "Timestamp" }),
|
|
5581
5686
|
/* @__PURE__ */ jsx47(TableHead9, { children: "Event" }),
|
|
@@ -5583,8 +5688,8 @@ function WebhooksLogsPage() {
|
|
|
5583
5688
|
/* @__PURE__ */ jsx47(TableHead9, { children: "Status" }),
|
|
5584
5689
|
/* @__PURE__ */ jsx47(TableHead9, { children: "Latency" })
|
|
5585
5690
|
] }) }),
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
filteredLogs.map((log) => /* @__PURE__ */
|
|
5691
|
+
/* @__PURE__ */ jsxs41(TableBody9, { children: [
|
|
5692
|
+
filteredLogs.map((log) => /* @__PURE__ */ jsxs41(TableRow9, { className: "cursor-pointer hover:bg-muted/50", onClick: () => handleRowClick(log), children: [
|
|
5588
5693
|
/* @__PURE__ */ jsx47(TableCell9, { className: "py-3 pl-4", children: /* @__PURE__ */ jsx47(StatusDot, { status: log.statusCode }) }),
|
|
5589
5694
|
/* @__PURE__ */ jsx47(TableCell9, { className: "py-3 text-muted-foreground", children: formatTimestamp2(log.timestamp) }),
|
|
5590
5695
|
/* @__PURE__ */ jsx47(TableCell9, { className: "py-3 font-mono text-sm", children: log.eventName }),
|
|
@@ -5592,9 +5697,9 @@ function WebhooksLogsPage() {
|
|
|
5592
5697
|
/* @__PURE__ */ jsx47(TableCell9, { className: "py-3", children: /* @__PURE__ */ jsx47(StatusBadge, { status: log.statusCode }) }),
|
|
5593
5698
|
/* @__PURE__ */ jsx47(TableCell9, { className: "py-3 text-muted-foreground", children: formatLatency2(log.latency) })
|
|
5594
5699
|
] }, log.id)),
|
|
5595
|
-
filteredLogs.length === 0 && /* @__PURE__ */ jsx47(TableRow9, { children: /* @__PURE__ */ jsx47(TableCell9, { colSpan: 6, className: "py-16", children: /* @__PURE__ */
|
|
5700
|
+
filteredLogs.length === 0 && /* @__PURE__ */ jsx47(TableRow9, { children: /* @__PURE__ */ jsx47(TableCell9, { colSpan: 6, className: "py-16", children: /* @__PURE__ */ jsxs41("div", { className: "flex flex-col items-center justify-center gap-4 text-center", children: [
|
|
5596
5701
|
/* @__PURE__ */ jsx47("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx47(ScrollText, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
5597
|
-
/* @__PURE__ */
|
|
5702
|
+
/* @__PURE__ */ jsxs41("div", { children: [
|
|
5598
5703
|
/* @__PURE__ */ jsx47("p", { className: "font-medium", children: "No logs found" }),
|
|
5599
5704
|
/* @__PURE__ */ jsx47("p", { className: "text-sm text-muted-foreground mt-1", children: "No webhook deliveries match the current filter." })
|
|
5600
5705
|
] })
|
|
@@ -5602,19 +5707,19 @@ function WebhooksLogsPage() {
|
|
|
5602
5707
|
] })
|
|
5603
5708
|
] }) })
|
|
5604
5709
|
] }),
|
|
5605
|
-
/* @__PURE__ */ jsx47(Sheet2, { open: sheetOpen, onOpenChange: setSheetOpen, children: /* @__PURE__ */ jsx47(SheetContent2, { className: "w-full sm:max-w-lg overflow-y-auto", children: selectedLog && /* @__PURE__ */
|
|
5606
|
-
/* @__PURE__ */
|
|
5710
|
+
/* @__PURE__ */ jsx47(Sheet2, { open: sheetOpen, onOpenChange: setSheetOpen, children: /* @__PURE__ */ jsx47(SheetContent2, { className: "w-full sm:max-w-lg overflow-y-auto", children: selectedLog && /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
5711
|
+
/* @__PURE__ */ jsxs41(SheetHeader2, { children: [
|
|
5607
5712
|
/* @__PURE__ */ jsx47(SheetTitle2, { className: "font-mono text-sm", children: selectedLog.eventName }),
|
|
5608
|
-
/* @__PURE__ */
|
|
5713
|
+
/* @__PURE__ */ jsxs41(SheetDescription2, { className: "flex items-center gap-2 text-sm", children: [
|
|
5609
5714
|
/* @__PURE__ */ jsx47(StatusBadge, { status: selectedLog.statusCode }),
|
|
5610
5715
|
/* @__PURE__ */ jsx47("span", { children: "\u2022" }),
|
|
5611
5716
|
/* @__PURE__ */ jsx47("span", { children: formatLatency2(selectedLog.latency) })
|
|
5612
5717
|
] })
|
|
5613
5718
|
] }),
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5719
|
+
/* @__PURE__ */ jsxs41("div", { className: "mt-6 space-y-6 px-4", children: [
|
|
5720
|
+
/* @__PURE__ */ jsxs41("div", { className: "space-y-1 text-sm text-muted-foreground", children: [
|
|
5616
5721
|
/* @__PURE__ */ jsx47("p", { children: formatFullTimestamp(selectedLog.timestamp) }),
|
|
5617
|
-
/* @__PURE__ */
|
|
5722
|
+
/* @__PURE__ */ jsxs41(
|
|
5618
5723
|
"button",
|
|
5619
5724
|
{
|
|
5620
5725
|
type: "button",
|
|
@@ -5627,15 +5732,15 @@ function WebhooksLogsPage() {
|
|
|
5627
5732
|
}
|
|
5628
5733
|
)
|
|
5629
5734
|
] }),
|
|
5630
|
-
/* @__PURE__ */
|
|
5735
|
+
/* @__PURE__ */ jsxs41("div", { children: [
|
|
5631
5736
|
/* @__PURE__ */ jsx47("h4", { className: "text-sm font-semibold mb-2", children: "Request Payload" }),
|
|
5632
5737
|
/* @__PURE__ */ jsx47(JsonViewer, { data: selectedLog.requestPayload })
|
|
5633
5738
|
] }),
|
|
5634
|
-
/* @__PURE__ */
|
|
5739
|
+
/* @__PURE__ */ jsxs41("div", { children: [
|
|
5635
5740
|
/* @__PURE__ */ jsx47("h4", { className: "text-sm font-semibold mb-2", children: "Response" }),
|
|
5636
5741
|
selectedLog.responseBody ? /* @__PURE__ */ jsx47("div", { className: "rounded-md border bg-muted p-4 text-sm font-mono", children: selectedLog.responseBody }) : /* @__PURE__ */ jsx47("p", { className: "text-sm text-muted-foreground", children: "No response received" })
|
|
5637
5742
|
] }),
|
|
5638
|
-
selectedLog.statusCode >= 400 && /* @__PURE__ */
|
|
5743
|
+
selectedLog.statusCode >= 400 && /* @__PURE__ */ jsxs41(Button19, { onClick: handleRetry, children: [
|
|
5639
5744
|
/* @__PURE__ */ jsx47(RefreshCw2, { className: "h-4 w-4" }),
|
|
5640
5745
|
"Retry Delivery"
|
|
5641
5746
|
] })
|
|
@@ -5645,14 +5750,14 @@ function WebhooksLogsPage() {
|
|
|
5645
5750
|
}
|
|
5646
5751
|
|
|
5647
5752
|
// src/developer/router.tsx
|
|
5648
|
-
import { Fragment as
|
|
5753
|
+
import { Fragment as Fragment21, jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5649
5754
|
function isNextJs() {
|
|
5650
5755
|
if (typeof window === "undefined") return false;
|
|
5651
5756
|
return "__NEXT_DATA__" in window;
|
|
5652
5757
|
}
|
|
5653
5758
|
function UrlSync({ basePath }) {
|
|
5654
5759
|
const location = useLocation2();
|
|
5655
|
-
|
|
5760
|
+
useEffect8(() => {
|
|
5656
5761
|
const normalizedBase = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
5657
5762
|
const path = location.pathname === "/" ? "" : location.pathname;
|
|
5658
5763
|
const fullPath = `${normalizedBase}${path}${location.search}${location.hash}`;
|
|
@@ -5676,7 +5781,7 @@ function DashboardRouter({ basePath = "/", children }) {
|
|
|
5676
5781
|
const useMemoryRouter = isNextJs();
|
|
5677
5782
|
const initialPath = getInitialPathFromUrl(basePath);
|
|
5678
5783
|
if (useMemoryRouter) {
|
|
5679
|
-
return /* @__PURE__ */
|
|
5784
|
+
return /* @__PURE__ */ jsxs42(MemoryRouter, { initialEntries: [initialPath], children: [
|
|
5680
5785
|
/* @__PURE__ */ jsx48(UrlSync, { basePath }),
|
|
5681
5786
|
children
|
|
5682
5787
|
] });
|
|
@@ -5685,19 +5790,20 @@ function DashboardRouter({ basePath = "/", children }) {
|
|
|
5685
5790
|
}
|
|
5686
5791
|
function DashboardRoutes() {
|
|
5687
5792
|
const routes = useRoutes();
|
|
5688
|
-
|
|
5793
|
+
const customRoutes = useCustomRoutes();
|
|
5794
|
+
return /* @__PURE__ */ jsx48(Routes, { children: /* @__PURE__ */ jsxs42(Route, { element: /* @__PURE__ */ jsx48(DashboardLayout, {}), children: [
|
|
5689
5795
|
routes.overview && /* @__PURE__ */ jsx48(Route, { index: true, element: /* @__PURE__ */ jsx48(OverviewPage, {}) }),
|
|
5690
5796
|
routes.requests && /* @__PURE__ */ jsx48(Route, { path: "requests", element: /* @__PURE__ */ jsx48(RequestsPage, {}) }),
|
|
5691
5797
|
routes.keys && /* @__PURE__ */ jsx48(Route, { path: "keys", element: /* @__PURE__ */ jsx48(KeysPage, {}) }),
|
|
5692
5798
|
routes.team && /* @__PURE__ */ jsx48(Route, { path: "team", element: /* @__PURE__ */ jsx48(TeamPage, {}) }),
|
|
5693
5799
|
routes.billing && /* @__PURE__ */ jsx48(Route, { path: "billing", element: /* @__PURE__ */ jsx48(BillingPage, {}) }),
|
|
5694
|
-
routes.settings && /* @__PURE__ */
|
|
5800
|
+
routes.settings && /* @__PURE__ */ jsxs42(Fragment21, { children: [
|
|
5695
5801
|
/* @__PURE__ */ jsx48(Route, { path: "settings", element: /* @__PURE__ */ jsx48(Navigate, { to: "settings/profile", replace: true }) }),
|
|
5696
5802
|
/* @__PURE__ */ jsx48(Route, { path: "settings/profile", element: /* @__PURE__ */ jsx48(SettingsProfilePage, {}) }),
|
|
5697
5803
|
/* @__PURE__ */ jsx48(Route, { path: "settings/security", element: /* @__PURE__ */ jsx48(SettingsSecurityPage, {}) }),
|
|
5698
5804
|
/* @__PURE__ */ jsx48(Route, { path: "settings/sessions", element: /* @__PURE__ */ jsx48(SettingsSessionsPage, {}) })
|
|
5699
5805
|
] }),
|
|
5700
|
-
routes.webhooks && /* @__PURE__ */
|
|
5806
|
+
routes.webhooks && /* @__PURE__ */ jsxs42(Fragment21, { children: [
|
|
5701
5807
|
/* @__PURE__ */ jsx48(Route, { path: "webhooks", element: /* @__PURE__ */ jsx48(Navigate, { to: "webhooks/endpoints", replace: true }) }),
|
|
5702
5808
|
/* @__PURE__ */ jsx48(Route, { path: "webhooks/endpoints", element: /* @__PURE__ */ jsx48(WebhooksEndpointsPage, {}) }),
|
|
5703
5809
|
/* @__PURE__ */ jsx48(Route, { path: "webhooks/activity", element: /* @__PURE__ */ jsx48(WebhooksActivityPage, {}) }),
|
|
@@ -5707,49 +5813,210 @@ function DashboardRoutes() {
|
|
|
5707
5813
|
routes.database && /* @__PURE__ */ jsx48(Route, { path: "database", element: /* @__PURE__ */ jsx48(DatabasePage, {}) }),
|
|
5708
5814
|
routes.integrations && /* @__PURE__ */ jsx48(Route, { path: "integrations", element: /* @__PURE__ */ jsx48(IntegrationsPage, {}) }),
|
|
5709
5815
|
routes.vault && /* @__PURE__ */ jsx48(Route, { path: "vault", element: /* @__PURE__ */ jsx48(VaultPage, {}) }),
|
|
5710
|
-
|
|
5816
|
+
customRoutes.map((route) => /* @__PURE__ */ jsx48(
|
|
5817
|
+
Route,
|
|
5818
|
+
{
|
|
5819
|
+
path: route.path.startsWith("/") ? route.path.slice(1) : route.path,
|
|
5820
|
+
index: route.index,
|
|
5821
|
+
element: route.element
|
|
5822
|
+
},
|
|
5823
|
+
route.path
|
|
5824
|
+
)),
|
|
5825
|
+
(() => {
|
|
5826
|
+
const indexRoute = customRoutes.find((r) => r.index);
|
|
5827
|
+
const fallbackPath = indexRoute?.path || customRoutes[0]?.path || "/";
|
|
5828
|
+
return /* @__PURE__ */ jsx48(Route, { path: "*", element: /* @__PURE__ */ jsx48(Navigate, { to: fallbackPath, replace: true }) });
|
|
5829
|
+
})()
|
|
5711
5830
|
] }) });
|
|
5712
5831
|
}
|
|
5713
5832
|
|
|
5714
5833
|
// src/developer/developer-dashboard.tsx
|
|
5715
5834
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
5716
|
-
function
|
|
5835
|
+
function propsToConfig(props) {
|
|
5836
|
+
const routes = {
|
|
5837
|
+
overview: props.routes?.overview ?? true,
|
|
5838
|
+
requests: props.routes?.requests ?? props.showLogs ?? props.showUsage ?? true,
|
|
5839
|
+
keys: props.routes?.keys ?? props.showAPIKeys ?? true,
|
|
5840
|
+
team: props.routes?.team ?? true,
|
|
5841
|
+
billing: props.routes?.billing ?? true,
|
|
5842
|
+
settings: props.routes?.settings ?? true,
|
|
5843
|
+
webhooks: props.routes?.webhooks ?? props.showWebhooks ?? false,
|
|
5844
|
+
database: props.routes?.database ?? false,
|
|
5845
|
+
integrations: props.routes?.integrations ?? false,
|
|
5846
|
+
vault: props.routes?.vault ?? false
|
|
5847
|
+
};
|
|
5848
|
+
const customRoutes = props.customRoutes?.map((route) => ({
|
|
5849
|
+
path: route.path,
|
|
5850
|
+
label: route.label,
|
|
5851
|
+
icon: route.icon ? getIconByName(route.icon) : void 0,
|
|
5852
|
+
element: route.element,
|
|
5853
|
+
group: route.group,
|
|
5854
|
+
order: route.order,
|
|
5855
|
+
index: route.index
|
|
5856
|
+
}));
|
|
5857
|
+
const identity = props.identity ?? {
|
|
5858
|
+
clientId: "demo",
|
|
5859
|
+
useMockWidgets: true,
|
|
5860
|
+
required: false,
|
|
5861
|
+
onUnauthenticated: "allow"
|
|
5862
|
+
};
|
|
5863
|
+
return {
|
|
5864
|
+
basePath: props.basePath ?? "/",
|
|
5865
|
+
branding: props.branding,
|
|
5866
|
+
routes,
|
|
5867
|
+
customRoutes,
|
|
5868
|
+
theme: props.theme,
|
|
5869
|
+
identity,
|
|
5870
|
+
devToken: props.devToken,
|
|
5871
|
+
debug: props.debug
|
|
5872
|
+
};
|
|
5873
|
+
}
|
|
5874
|
+
function isLegacyConfig(props) {
|
|
5875
|
+
return "config" in props && props.config !== void 0;
|
|
5876
|
+
}
|
|
5877
|
+
function DeveloperDashboard(props) {
|
|
5878
|
+
const config = isLegacyConfig(props) ? props.config : propsToConfig(props);
|
|
5717
5879
|
return /* @__PURE__ */ jsx49(AppProviders, { config, children: /* @__PURE__ */ jsx49(AuthGate, { children: /* @__PURE__ */ jsx49(DashboardRouter, { basePath: config.basePath, children: /* @__PURE__ */ jsx49(DashboardRoutes, {}) }) }) });
|
|
5718
5880
|
}
|
|
5719
5881
|
|
|
5882
|
+
// src/developer/standalone/provider.tsx
|
|
5883
|
+
import { ThemeProvider as ThemeProvider2 } from "next-themes";
|
|
5884
|
+
import { applyThemeToElement as applyThemeToElement2 } from "@mdxui/themes";
|
|
5885
|
+
import { useEffect as useEffect9, useRef as useRef3 } from "react";
|
|
5886
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5887
|
+
function StandaloneProvider({ config, children }) {
|
|
5888
|
+
const themeMode = config?.theme?.mode ?? "system";
|
|
5889
|
+
const containerRef = useRef3(null);
|
|
5890
|
+
useEffect9(() => {
|
|
5891
|
+
if (containerRef.current && config?.theme?.preset) {
|
|
5892
|
+
const resolvedMode = config.theme.mode === "system" ? "light" : config.theme.mode ?? "light";
|
|
5893
|
+
applyThemeToElement2(containerRef.current, config.theme.preset, resolvedMode);
|
|
5894
|
+
}
|
|
5895
|
+
}, [config?.theme]);
|
|
5896
|
+
return /* @__PURE__ */ jsx50(
|
|
5897
|
+
ThemeProvider2,
|
|
5898
|
+
{
|
|
5899
|
+
attribute: "class",
|
|
5900
|
+
defaultTheme: themeMode,
|
|
5901
|
+
enableSystem: themeMode === "system",
|
|
5902
|
+
disableTransitionOnChange: true,
|
|
5903
|
+
children: /* @__PURE__ */ jsx50("div", { ref: containerRef, className: "standalone-provider", children })
|
|
5904
|
+
}
|
|
5905
|
+
);
|
|
5906
|
+
}
|
|
5907
|
+
|
|
5908
|
+
// src/developer/standalone/api-keys.tsx
|
|
5909
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
5910
|
+
function StandaloneAPIKeys({
|
|
5911
|
+
keys,
|
|
5912
|
+
onCreateKey,
|
|
5913
|
+
onRevokeKey,
|
|
5914
|
+
onRenameKey,
|
|
5915
|
+
hideHeader = true,
|
|
5916
|
+
className
|
|
5917
|
+
}) {
|
|
5918
|
+
return /* @__PURE__ */ jsx51(
|
|
5919
|
+
KeysPage,
|
|
5920
|
+
{
|
|
5921
|
+
keys,
|
|
5922
|
+
onCreateKey,
|
|
5923
|
+
onRevokeKey,
|
|
5924
|
+
onRenameKey,
|
|
5925
|
+
hideHeader,
|
|
5926
|
+
className
|
|
5927
|
+
}
|
|
5928
|
+
);
|
|
5929
|
+
}
|
|
5930
|
+
|
|
5931
|
+
// src/developer/standalone/webhooks.tsx
|
|
5932
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
5933
|
+
function StandaloneWebhooks({
|
|
5934
|
+
endpoints,
|
|
5935
|
+
onCreateEndpoint,
|
|
5936
|
+
onUpdateEndpoint,
|
|
5937
|
+
onDeleteEndpoint,
|
|
5938
|
+
hideHeader = true,
|
|
5939
|
+
className
|
|
5940
|
+
}) {
|
|
5941
|
+
return /* @__PURE__ */ jsx52(
|
|
5942
|
+
WebhooksEndpointsPage,
|
|
5943
|
+
{
|
|
5944
|
+
endpoints,
|
|
5945
|
+
onCreateEndpoint,
|
|
5946
|
+
onUpdateEndpoint,
|
|
5947
|
+
onDeleteEndpoint,
|
|
5948
|
+
hideHeader,
|
|
5949
|
+
className
|
|
5950
|
+
}
|
|
5951
|
+
);
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
// src/developer/standalone/billing.tsx
|
|
5955
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
5956
|
+
function StandaloneBilling({
|
|
5957
|
+
billingData,
|
|
5958
|
+
onManagePlan,
|
|
5959
|
+
onUpdatePaymentMethod,
|
|
5960
|
+
onDownloadInvoice,
|
|
5961
|
+
onToggleAlerts,
|
|
5962
|
+
hideHeader = true,
|
|
5963
|
+
className
|
|
5964
|
+
}) {
|
|
5965
|
+
return /* @__PURE__ */ jsx53(
|
|
5966
|
+
BillingPage,
|
|
5967
|
+
{
|
|
5968
|
+
billingData,
|
|
5969
|
+
onManagePlan,
|
|
5970
|
+
onUpdatePaymentMethod,
|
|
5971
|
+
onDownloadInvoice,
|
|
5972
|
+
onToggleAlerts,
|
|
5973
|
+
hideHeader,
|
|
5974
|
+
className
|
|
5975
|
+
}
|
|
5976
|
+
);
|
|
5977
|
+
}
|
|
5978
|
+
|
|
5979
|
+
// src/developer/standalone/team.tsx
|
|
5980
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
5981
|
+
function StandaloneTeam({
|
|
5982
|
+
useMockWidgets,
|
|
5983
|
+
hideHeader = true,
|
|
5984
|
+
className
|
|
5985
|
+
}) {
|
|
5986
|
+
return /* @__PURE__ */ jsx54(
|
|
5987
|
+
TeamPage,
|
|
5988
|
+
{
|
|
5989
|
+
useMockWidgets,
|
|
5990
|
+
hideHeader,
|
|
5991
|
+
className
|
|
5992
|
+
}
|
|
5993
|
+
);
|
|
5994
|
+
}
|
|
5995
|
+
|
|
5720
5996
|
// src/auth/auth-layout.tsx
|
|
5721
5997
|
import { cn as cn8 } from "@mdxui/primitives/lib/utils";
|
|
5722
|
-
import { jsx as
|
|
5723
|
-
function AuthLayout(
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
"children",
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
"showTestimonial",
|
|
5741
|
-
"testimonial"
|
|
5742
|
-
]);
|
|
5743
|
-
return /* @__PURE__ */ jsxs44("div", __spreadProps(__spreadValues({ className: cn8("min-h-screen w-full lg:grid lg:grid-cols-2", className) }, props), { children: [
|
|
5744
|
-
/* @__PURE__ */ jsx50("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxs44("div", { className: "mx-auto w-full max-w-[400px] space-y-8 px-4", children: [
|
|
5745
|
-
logo && /* @__PURE__ */ jsx50("div", { className: "flex justify-center", children: logo }),
|
|
5746
|
-
(title || subtitle) && /* @__PURE__ */ jsxs44("div", { className: "space-y-2 text-center", children: [
|
|
5747
|
-
title && /* @__PURE__ */ jsx50("h1", { className: "text-3xl font-bold tracking-tight", children: title }),
|
|
5748
|
-
subtitle && /* @__PURE__ */ jsx50("p", { className: "text-muted-foreground text-sm", children: subtitle })
|
|
5998
|
+
import { jsx as jsx55, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5999
|
+
function AuthLayout({
|
|
6000
|
+
className,
|
|
6001
|
+
children,
|
|
6002
|
+
title,
|
|
6003
|
+
subtitle,
|
|
6004
|
+
logo,
|
|
6005
|
+
backgroundImage,
|
|
6006
|
+
showTestimonial = false,
|
|
6007
|
+
testimonial,
|
|
6008
|
+
...props
|
|
6009
|
+
}) {
|
|
6010
|
+
return /* @__PURE__ */ jsxs43("div", { className: cn8("min-h-screen w-full lg:grid lg:grid-cols-2", className), ...props, children: [
|
|
6011
|
+
/* @__PURE__ */ jsx55("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxs43("div", { className: "mx-auto w-full max-w-[400px] space-y-8 px-4", children: [
|
|
6012
|
+
logo && /* @__PURE__ */ jsx55("div", { className: "flex justify-center", children: logo }),
|
|
6013
|
+
(title || subtitle) && /* @__PURE__ */ jsxs43("div", { className: "space-y-2 text-center", children: [
|
|
6014
|
+
title && /* @__PURE__ */ jsx55("h1", { className: "text-3xl font-bold tracking-tight", children: title }),
|
|
6015
|
+
subtitle && /* @__PURE__ */ jsx55("p", { className: "text-muted-foreground text-sm", children: subtitle })
|
|
5749
6016
|
] }),
|
|
5750
|
-
/* @__PURE__ */
|
|
6017
|
+
/* @__PURE__ */ jsx55("div", { children })
|
|
5751
6018
|
] }) }),
|
|
5752
|
-
/* @__PURE__ */
|
|
6019
|
+
/* @__PURE__ */ jsx55(
|
|
5753
6020
|
"div",
|
|
5754
6021
|
{
|
|
5755
6022
|
className: "bg-muted hidden lg:block",
|
|
@@ -5758,14 +6025,14 @@ function AuthLayout(_a) {
|
|
|
5758
6025
|
backgroundSize: "cover",
|
|
5759
6026
|
backgroundPosition: "center"
|
|
5760
6027
|
} : void 0,
|
|
5761
|
-
children: showTestimonial && testimonial && !backgroundImage && /* @__PURE__ */
|
|
5762
|
-
/* @__PURE__ */
|
|
6028
|
+
children: showTestimonial && testimonial && !backgroundImage && /* @__PURE__ */ jsx55("div", { className: "flex h-full items-center justify-center p-12", children: /* @__PURE__ */ jsx55("div", { className: "max-w-md space-y-6", children: /* @__PURE__ */ jsxs43("blockquote", { className: "space-y-4", children: [
|
|
6029
|
+
/* @__PURE__ */ jsxs43("p", { className: "text-lg font-medium leading-relaxed", children: [
|
|
5763
6030
|
'"',
|
|
5764
6031
|
testimonial.quote,
|
|
5765
6032
|
'"'
|
|
5766
6033
|
] }),
|
|
5767
|
-
/* @__PURE__ */
|
|
5768
|
-
testimonial.avatar && /* @__PURE__ */
|
|
6034
|
+
/* @__PURE__ */ jsxs43("footer", { className: "flex items-center gap-3", children: [
|
|
6035
|
+
testimonial.avatar && /* @__PURE__ */ jsx55(
|
|
5769
6036
|
"img",
|
|
5770
6037
|
{
|
|
5771
6038
|
src: testimonial.avatar,
|
|
@@ -5773,20 +6040,20 @@ function AuthLayout(_a) {
|
|
|
5773
6040
|
className: "size-10 rounded-full"
|
|
5774
6041
|
}
|
|
5775
6042
|
),
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
/* @__PURE__ */
|
|
5778
|
-
/* @__PURE__ */
|
|
6043
|
+
/* @__PURE__ */ jsxs43("div", { children: [
|
|
6044
|
+
/* @__PURE__ */ jsx55("div", { className: "font-semibold", children: testimonial.author }),
|
|
6045
|
+
/* @__PURE__ */ jsx55("div", { className: "text-muted-foreground text-sm", children: testimonial.role })
|
|
5779
6046
|
] })
|
|
5780
6047
|
] })
|
|
5781
6048
|
] }) }) })
|
|
5782
6049
|
}
|
|
5783
6050
|
)
|
|
5784
|
-
] })
|
|
6051
|
+
] });
|
|
5785
6052
|
}
|
|
5786
6053
|
|
|
5787
6054
|
// src/auth/login-page.tsx
|
|
5788
6055
|
import { LoginForm } from "@mdxui/primitives/auth/login-form";
|
|
5789
|
-
import { jsx as
|
|
6056
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
5790
6057
|
function LoginPage({
|
|
5791
6058
|
onSubmit,
|
|
5792
6059
|
onOAuthClick,
|
|
@@ -5805,7 +6072,7 @@ function LoginPage({
|
|
|
5805
6072
|
showTestimonial = false,
|
|
5806
6073
|
testimonial
|
|
5807
6074
|
}) {
|
|
5808
|
-
return /* @__PURE__ */
|
|
6075
|
+
return /* @__PURE__ */ jsx56(
|
|
5809
6076
|
AuthLayout,
|
|
5810
6077
|
{
|
|
5811
6078
|
logo,
|
|
@@ -5814,7 +6081,7 @@ function LoginPage({
|
|
|
5814
6081
|
backgroundImage,
|
|
5815
6082
|
showTestimonial,
|
|
5816
6083
|
testimonial,
|
|
5817
|
-
children: /* @__PURE__ */
|
|
6084
|
+
children: /* @__PURE__ */ jsx56(
|
|
5818
6085
|
LoginForm,
|
|
5819
6086
|
{
|
|
5820
6087
|
onSubmit,
|
|
@@ -5835,7 +6102,7 @@ function LoginPage({
|
|
|
5835
6102
|
|
|
5836
6103
|
// src/auth/signup-page.tsx
|
|
5837
6104
|
import { SignupForm } from "@mdxui/primitives/auth/signup-form";
|
|
5838
|
-
import { jsx as
|
|
6105
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
5839
6106
|
function SignupPage({
|
|
5840
6107
|
onSubmit,
|
|
5841
6108
|
onOAuthClick,
|
|
@@ -5852,7 +6119,7 @@ function SignupPage({
|
|
|
5852
6119
|
showTestimonial = false,
|
|
5853
6120
|
testimonial
|
|
5854
6121
|
}) {
|
|
5855
|
-
return /* @__PURE__ */
|
|
6122
|
+
return /* @__PURE__ */ jsx57(
|
|
5856
6123
|
AuthLayout,
|
|
5857
6124
|
{
|
|
5858
6125
|
logo,
|
|
@@ -5861,7 +6128,7 @@ function SignupPage({
|
|
|
5861
6128
|
backgroundImage,
|
|
5862
6129
|
showTestimonial,
|
|
5863
6130
|
testimonial,
|
|
5864
|
-
children: /* @__PURE__ */
|
|
6131
|
+
children: /* @__PURE__ */ jsx57(
|
|
5865
6132
|
SignupForm,
|
|
5866
6133
|
{
|
|
5867
6134
|
onSubmit,
|
|
@@ -5880,7 +6147,7 @@ function SignupPage({
|
|
|
5880
6147
|
|
|
5881
6148
|
// src/auth/password-reset-page.tsx
|
|
5882
6149
|
import { PasswordResetForm } from "@mdxui/primitives/auth/password-reset-form";
|
|
5883
|
-
import { jsx as
|
|
6150
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
5884
6151
|
function PasswordResetPage({
|
|
5885
6152
|
mode = "request",
|
|
5886
6153
|
onRequestSubmit,
|
|
@@ -5896,14 +6163,14 @@ function PasswordResetPage({
|
|
|
5896
6163
|
}) {
|
|
5897
6164
|
const defaultTitle = mode === "request" ? "Reset your password" : "Create new password";
|
|
5898
6165
|
const defaultSubtitle = mode === "request" ? "We'll send you a link to reset your password" : "Enter your new password below";
|
|
5899
|
-
return /* @__PURE__ */
|
|
6166
|
+
return /* @__PURE__ */ jsx58(
|
|
5900
6167
|
AuthLayout,
|
|
5901
6168
|
{
|
|
5902
6169
|
logo,
|
|
5903
6170
|
title: title || defaultTitle,
|
|
5904
6171
|
subtitle: subtitle || defaultSubtitle,
|
|
5905
6172
|
backgroundImage,
|
|
5906
|
-
children: /* @__PURE__ */
|
|
6173
|
+
children: /* @__PURE__ */ jsx58(
|
|
5907
6174
|
PasswordResetForm,
|
|
5908
6175
|
{
|
|
5909
6176
|
mode,
|
|
@@ -5921,7 +6188,7 @@ function PasswordResetPage({
|
|
|
5921
6188
|
|
|
5922
6189
|
// src/auth/otp-page.tsx
|
|
5923
6190
|
import { OTPInputForm } from "@mdxui/primitives/auth/otp-input";
|
|
5924
|
-
import { jsx as
|
|
6191
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
5925
6192
|
function OTPPage({
|
|
5926
6193
|
onSubmit,
|
|
5927
6194
|
onResend,
|
|
@@ -5935,7 +6202,7 @@ function OTPPage({
|
|
|
5935
6202
|
description,
|
|
5936
6203
|
backgroundImage
|
|
5937
6204
|
}) {
|
|
5938
|
-
return /* @__PURE__ */
|
|
6205
|
+
return /* @__PURE__ */ jsx59(AuthLayout, { logo, backgroundImage, children: /* @__PURE__ */ jsx59(
|
|
5939
6206
|
OTPInputForm,
|
|
5940
6207
|
{
|
|
5941
6208
|
onSubmit,
|
|
@@ -5953,7 +6220,7 @@ function OTPPage({
|
|
|
5953
6220
|
// src/auth/onboarding-page.tsx
|
|
5954
6221
|
import { OnboardingWizard } from "@mdxui/primitives/auth/onboarding-wizard";
|
|
5955
6222
|
import { cn as cn9 } from "@mdxui/primitives/lib/utils";
|
|
5956
|
-
import { jsx as
|
|
6223
|
+
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5957
6224
|
function OnboardingPage({
|
|
5958
6225
|
steps,
|
|
5959
6226
|
onComplete,
|
|
@@ -5966,9 +6233,9 @@ function OnboardingPage({
|
|
|
5966
6233
|
showProgress = true,
|
|
5967
6234
|
className
|
|
5968
6235
|
}) {
|
|
5969
|
-
return /* @__PURE__ */
|
|
5970
|
-
logo && /* @__PURE__ */
|
|
5971
|
-
/* @__PURE__ */
|
|
6236
|
+
return /* @__PURE__ */ jsx60("div", { className: cn9("flex min-h-screen items-center justify-center p-4", className), children: /* @__PURE__ */ jsxs44("div", { className: "w-full space-y-8", children: [
|
|
6237
|
+
logo && /* @__PURE__ */ jsx60("div", { className: "flex justify-center", children: logo }),
|
|
6238
|
+
/* @__PURE__ */ jsx60(
|
|
5972
6239
|
OnboardingWizard,
|
|
5973
6240
|
{
|
|
5974
6241
|
steps,
|
|
@@ -5983,16 +6250,20 @@ function OnboardingPage({
|
|
|
5983
6250
|
)
|
|
5984
6251
|
] }) });
|
|
5985
6252
|
}
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
var
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
6253
|
+
|
|
6254
|
+
// src/index.ts
|
|
6255
|
+
var components = {
|
|
6256
|
+
// Layout Components
|
|
6257
|
+
App: DeveloperDashboard,
|
|
6258
|
+
Shell: DashboardLayout,
|
|
6259
|
+
Dashboard: OverviewPage,
|
|
6260
|
+
Settings: SettingsPage,
|
|
6261
|
+
// Pre-built Features
|
|
6262
|
+
DeveloperDashboard,
|
|
6263
|
+
APIKeys: APIKeyManager,
|
|
6264
|
+
Team: TeamManager,
|
|
6265
|
+
Billing
|
|
6266
|
+
};
|
|
5996
6267
|
export {
|
|
5997
6268
|
APIKeyManager,
|
|
5998
6269
|
ActivityFeed,
|
|
@@ -6034,12 +6305,17 @@ export {
|
|
|
6034
6305
|
SidebarAd,
|
|
6035
6306
|
SignupPage,
|
|
6036
6307
|
SortableHeader,
|
|
6308
|
+
StandaloneAPIKeys,
|
|
6309
|
+
StandaloneBilling,
|
|
6310
|
+
StandaloneProvider,
|
|
6311
|
+
StandaloneTeam,
|
|
6312
|
+
StandaloneWebhooks,
|
|
6037
6313
|
StatusBadge,
|
|
6038
6314
|
StatusDot,
|
|
6039
6315
|
TeamManager,
|
|
6040
6316
|
TeamPage,
|
|
6041
6317
|
TeamSwitcher,
|
|
6042
|
-
|
|
6318
|
+
ThemeScript,
|
|
6043
6319
|
UserProfile,
|
|
6044
6320
|
VaultDeleteDialog,
|
|
6045
6321
|
VaultEmptyState,
|
|
@@ -6051,27 +6327,31 @@ export {
|
|
|
6051
6327
|
WebhooksEndpointsPage,
|
|
6052
6328
|
WebhooksEventCatalogPage,
|
|
6053
6329
|
WebhooksLogsPage,
|
|
6054
|
-
|
|
6330
|
+
applyThemeToElement3 as applyThemeToElement,
|
|
6331
|
+
components,
|
|
6332
|
+
dashboardIcons,
|
|
6055
6333
|
getAuthToken,
|
|
6056
6334
|
getDebugStatus,
|
|
6057
6335
|
getEffectiveToken,
|
|
6058
|
-
|
|
6336
|
+
getIconByName,
|
|
6337
|
+
getResolvedMode,
|
|
6059
6338
|
getSDK,
|
|
6060
|
-
|
|
6061
|
-
|
|
6339
|
+
getThemeCSS,
|
|
6340
|
+
getThemeScriptContent,
|
|
6062
6341
|
isAuthenticated,
|
|
6063
6342
|
isDebugMode,
|
|
6064
|
-
|
|
6343
|
+
isThemePreset,
|
|
6065
6344
|
setDebugMode,
|
|
6066
6345
|
setDevToken,
|
|
6067
6346
|
testSDKConnection,
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6347
|
+
themeCSS,
|
|
6348
|
+
themeNames,
|
|
6349
|
+
themePresets,
|
|
6350
|
+
useAuth9 as useAuth,
|
|
6072
6351
|
useCommandPalette,
|
|
6352
|
+
useCustomRoutes,
|
|
6073
6353
|
useDashboard,
|
|
6074
6354
|
useRoutes,
|
|
6075
|
-
|
|
6355
|
+
useThemeStore
|
|
6076
6356
|
};
|
|
6077
6357
|
//# sourceMappingURL=index.js.map
|