@mdxui/cockpit 0.2.0 → 2.1.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 +524 -10
- package/dist/developer/index.js +616 -308
- 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 +34 -1
- package/dist/index.js +670 -368
- package/dist/index.js.map +1 -1
- package/package.json +19 -7
package/dist/developer/index.js
CHANGED
|
@@ -1,61 +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 __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (let key of __getOwnPropNames(from))
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
-
}
|
|
28
|
-
return to;
|
|
29
|
-
};
|
|
30
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
31
|
-
var __async = (__this, __arguments, generator) => {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
var fulfilled = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.next(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var rejected = (value) => {
|
|
41
|
-
try {
|
|
42
|
-
step(generator.throw(value));
|
|
43
|
-
} catch (e) {
|
|
44
|
-
reject(e);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
48
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
1
|
// src/developer/index.ts
|
|
53
2
|
import { useAuth as useAuth10 } from "@workos-inc/authkit-react";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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";
|
|
59
15
|
|
|
60
16
|
// src/developer/components/dashboard/activity-feed.tsx
|
|
61
17
|
import { Avatar, AvatarFallback, AvatarImage } from "@mdxui/primitives/avatar";
|
|
@@ -457,7 +413,6 @@ function DataTable({
|
|
|
457
413
|
className,
|
|
458
414
|
emptyMessage = "No results found."
|
|
459
415
|
}) {
|
|
460
|
-
var _a, _b, _c;
|
|
461
416
|
const [sorting, setSorting] = useState2([]);
|
|
462
417
|
const [columnFilters, setColumnFilters] = useState2([]);
|
|
463
418
|
const [columnVisibility, setColumnVisibility] = useState2({});
|
|
@@ -490,11 +445,8 @@ function DataTable({
|
|
|
490
445
|
Input,
|
|
491
446
|
{
|
|
492
447
|
placeholder: searchPlaceholder,
|
|
493
|
-
value:
|
|
494
|
-
onChange: (event) =>
|
|
495
|
-
var _a2;
|
|
496
|
-
return (_a2 = table.getColumn(searchColumn)) == null ? void 0 : _a2.setFilterValue(event.target.value);
|
|
497
|
-
},
|
|
448
|
+
value: table.getColumn(searchColumn)?.getFilterValue() ?? "",
|
|
449
|
+
onChange: (event) => table.getColumn(searchColumn)?.setFilterValue(event.target.value),
|
|
498
450
|
className: "max-w-sm"
|
|
499
451
|
}
|
|
500
452
|
) }),
|
|
@@ -502,7 +454,7 @@ function DataTable({
|
|
|
502
454
|
/* @__PURE__ */ jsx6(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx6(TableRow, { children: headerGroup.headers.map((header) => {
|
|
503
455
|
return /* @__PURE__ */ jsx6(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
504
456
|
}) }, headerGroup.id)) }),
|
|
505
|
-
/* @__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 }) }) })
|
|
506
458
|
] }) }),
|
|
507
459
|
paginated && /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-2", children: [
|
|
508
460
|
/* @__PURE__ */ jsx6("div", { className: "flex-1 text-sm text-muted-foreground", children: table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxs5("span", { children: [
|
|
@@ -739,6 +691,7 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
739
691
|
// src/developer/hooks/use-theme-loader.ts
|
|
740
692
|
import { useTheme } from "next-themes";
|
|
741
693
|
import { useEffect as useEffect2, useRef } from "react";
|
|
694
|
+
import { applyThemeToElement } from "@mdxui/themes";
|
|
742
695
|
function useThemeLoader(preset) {
|
|
743
696
|
const { resolvedTheme } = useTheme();
|
|
744
697
|
const currentPresetRef = useRef(void 0);
|
|
@@ -747,7 +700,7 @@ function useThemeLoader(preset) {
|
|
|
747
700
|
if (!preset || !resolvedTheme) return;
|
|
748
701
|
if (preset === currentPresetRef.current && resolvedTheme === currentModeRef.current) return;
|
|
749
702
|
const mode = resolvedTheme === "dark" ? "dark" : "light";
|
|
750
|
-
|
|
703
|
+
applyThemeToElement(document.documentElement, preset, mode);
|
|
751
704
|
currentPresetRef.current = preset;
|
|
752
705
|
currentModeRef.current = resolvedTheme;
|
|
753
706
|
}, [preset, resolvedTheme]);
|
|
@@ -801,6 +754,7 @@ var defaultConfig = {
|
|
|
801
754
|
logo: void 0
|
|
802
755
|
},
|
|
803
756
|
routes: defaultRoutes,
|
|
757
|
+
customRoutes: [],
|
|
804
758
|
theme: {
|
|
805
759
|
preset: "cyan",
|
|
806
760
|
mode: "system",
|
|
@@ -813,15 +767,19 @@ import { jsx as jsx9 } from "react/jsx-runtime";
|
|
|
813
767
|
var DashboardContext = createContext(null);
|
|
814
768
|
function DashboardProvider({ config, children }) {
|
|
815
769
|
const value = useMemo(() => {
|
|
816
|
-
const mergedConfig =
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
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
|
+
};
|
|
822
779
|
return {
|
|
823
780
|
config: mergedConfig,
|
|
824
781
|
routes: mergedConfig.routes,
|
|
782
|
+
customRoutes: mergedConfig.customRoutes,
|
|
825
783
|
basePath: mergedConfig.basePath
|
|
826
784
|
};
|
|
827
785
|
}, [config]);
|
|
@@ -840,6 +798,10 @@ function useRoutes() {
|
|
|
840
798
|
const { routes } = useDashboard();
|
|
841
799
|
return routes;
|
|
842
800
|
}
|
|
801
|
+
function useCustomRoutes() {
|
|
802
|
+
const { customRoutes } = useDashboard();
|
|
803
|
+
return customRoutes;
|
|
804
|
+
}
|
|
843
805
|
|
|
844
806
|
// src/developer/components/ui/sidebar-ad.tsx
|
|
845
807
|
import { useSidebar } from "@mdxui/primitives/sidebar";
|
|
@@ -854,7 +816,7 @@ function SidebarAd({ headline, description, ctaText, ctaHref, onCtaClick, dismis
|
|
|
854
816
|
if (state === "collapsed") return null;
|
|
855
817
|
const handleDismiss = () => {
|
|
856
818
|
setIsDismissed(true);
|
|
857
|
-
onDismiss
|
|
819
|
+
onDismiss?.();
|
|
858
820
|
};
|
|
859
821
|
const handleCtaClick = () => {
|
|
860
822
|
if (onCtaClick) {
|
|
@@ -959,8 +921,19 @@ function NavUser({ user, onSignOut }) {
|
|
|
959
921
|
// src/developer/components/layout/dashboard-layout.tsx
|
|
960
922
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
961
923
|
function useNavItems() {
|
|
962
|
-
const { routes } = useDashboard();
|
|
924
|
+
const { routes, customRoutes } = useDashboard();
|
|
963
925
|
const items = [];
|
|
926
|
+
const customRouteToNavItem = (route) => ({
|
|
927
|
+
title: route.label,
|
|
928
|
+
url: route.path.startsWith("/") ? route.path : `/${route.path}`,
|
|
929
|
+
icon: route.icon
|
|
930
|
+
});
|
|
931
|
+
const sortedCustomRoutes = [...customRoutes].sort((a, b) => {
|
|
932
|
+
return (a.order ?? 100) - (b.order ?? 100);
|
|
933
|
+
});
|
|
934
|
+
const mainRoutes = sortedCustomRoutes.filter((r) => r.group === "main" || r.group === void 0);
|
|
935
|
+
const secondaryRoutes = sortedCustomRoutes.filter((r) => r.group === "secondary");
|
|
936
|
+
const adminRoutes = sortedCustomRoutes.filter((r) => r.group === "admin");
|
|
964
937
|
if (routes.overview) {
|
|
965
938
|
items.push({
|
|
966
939
|
title: "Overview",
|
|
@@ -1000,7 +973,13 @@ function useNavItems() {
|
|
|
1000
973
|
items.push({
|
|
1001
974
|
title: "Webhooks",
|
|
1002
975
|
url: "/webhooks",
|
|
1003
|
-
icon: Webhook
|
|
976
|
+
icon: Webhook,
|
|
977
|
+
items: [
|
|
978
|
+
{ title: "Endpoints", url: "/webhooks/endpoints" },
|
|
979
|
+
{ title: "Activity", url: "/webhooks/activity" },
|
|
980
|
+
{ title: "Logs", url: "/webhooks/logs" },
|
|
981
|
+
{ title: "Event Catalog", url: "/webhooks/event-catalog" }
|
|
982
|
+
]
|
|
1004
983
|
});
|
|
1005
984
|
}
|
|
1006
985
|
if (routes.database) {
|
|
@@ -1024,24 +1003,37 @@ function useNavItems() {
|
|
|
1024
1003
|
icon: Lock
|
|
1025
1004
|
});
|
|
1026
1005
|
}
|
|
1006
|
+
for (const route of mainRoutes) {
|
|
1007
|
+
items.push(customRouteToNavItem(route));
|
|
1008
|
+
}
|
|
1009
|
+
for (const route of secondaryRoutes) {
|
|
1010
|
+
items.push(customRouteToNavItem(route));
|
|
1011
|
+
}
|
|
1027
1012
|
if (routes.settings) {
|
|
1028
1013
|
items.push({
|
|
1029
1014
|
title: "Settings",
|
|
1030
1015
|
url: "/settings",
|
|
1031
|
-
icon: Settings
|
|
1016
|
+
icon: Settings,
|
|
1017
|
+
items: [
|
|
1018
|
+
{ title: "Profile", url: "/settings/profile" },
|
|
1019
|
+
{ title: "Security", url: "/settings/security" },
|
|
1020
|
+
{ title: "Sessions", url: "/settings/sessions" }
|
|
1021
|
+
]
|
|
1032
1022
|
});
|
|
1033
1023
|
}
|
|
1024
|
+
for (const route of adminRoutes) {
|
|
1025
|
+
items.push(customRouteToNavItem(route));
|
|
1026
|
+
}
|
|
1034
1027
|
return items;
|
|
1035
1028
|
}
|
|
1036
1029
|
function DashboardLayout() {
|
|
1037
|
-
var _a;
|
|
1038
1030
|
const { user, signOut } = useAuth2();
|
|
1039
1031
|
const navItems = useNavItems();
|
|
1040
1032
|
const navUser = user ? {
|
|
1041
1033
|
id: user.id,
|
|
1042
1034
|
name: user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : user.email,
|
|
1043
1035
|
email: user.email,
|
|
1044
|
-
avatar:
|
|
1036
|
+
avatar: user.profilePictureUrl ?? void 0
|
|
1045
1037
|
} : null;
|
|
1046
1038
|
return /* @__PURE__ */ jsx14(
|
|
1047
1039
|
DashboardShell,
|
|
@@ -1079,14 +1071,13 @@ function FeatureCard({ icon, title, description }) {
|
|
|
1079
1071
|
] });
|
|
1080
1072
|
}
|
|
1081
1073
|
function LandingPage() {
|
|
1082
|
-
var _a, _b, _c;
|
|
1083
1074
|
const { signIn } = useAuth3();
|
|
1084
1075
|
const { config } = useDashboard();
|
|
1085
|
-
const brandName =
|
|
1076
|
+
const brandName = config.branding?.name ?? "Dashboard";
|
|
1086
1077
|
return /* @__PURE__ */ jsxs11("div", { className: "min-h-screen bg-background flex flex-col", children: [
|
|
1087
1078
|
/* @__PURE__ */ jsx15("header", { className: "border-b", children: /* @__PURE__ */ jsxs11("div", { className: "container mx-auto px-4 h-16 flex items-center justify-between", children: [
|
|
1088
1079
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
1089
|
-
|
|
1080
|
+
config.branding?.logo,
|
|
1090
1081
|
/* @__PURE__ */ jsx15("span", { className: "font-semibold text-lg", children: brandName })
|
|
1091
1082
|
] }),
|
|
1092
1083
|
/* @__PURE__ */ jsxs11(Button2, { onClick: () => signIn(), children: [
|
|
@@ -1170,11 +1161,11 @@ function JsonViewer({ data, className }) {
|
|
|
1170
1161
|
theme
|
|
1171
1162
|
}).then(setHtml);
|
|
1172
1163
|
}, [jsonString, resolvedTheme]);
|
|
1173
|
-
const handleCopy = () =>
|
|
1174
|
-
|
|
1164
|
+
const handleCopy = async () => {
|
|
1165
|
+
await navigator.clipboard.writeText(jsonString);
|
|
1175
1166
|
setCopied(true);
|
|
1176
1167
|
setTimeout(() => setCopied(false), 2e3);
|
|
1177
|
-
}
|
|
1168
|
+
};
|
|
1178
1169
|
return /* @__PURE__ */ jsxs12("div", { className: cn5("relative rounded-md border bg-muted", className), children: [
|
|
1179
1170
|
/* @__PURE__ */ jsx16(
|
|
1180
1171
|
"button",
|
|
@@ -1310,11 +1301,11 @@ function VaultInputModal({
|
|
|
1310
1301
|
}) {
|
|
1311
1302
|
const [values, setValues] = useState5({});
|
|
1312
1303
|
const [loading, setLoading] = useState5(false);
|
|
1313
|
-
const handleSubmit = (e) =>
|
|
1304
|
+
const handleSubmit = async (e) => {
|
|
1314
1305
|
e.preventDefault();
|
|
1315
1306
|
setLoading(true);
|
|
1316
1307
|
try {
|
|
1317
|
-
|
|
1308
|
+
await onSave(values);
|
|
1318
1309
|
setValues({});
|
|
1319
1310
|
onClose();
|
|
1320
1311
|
} catch (error) {
|
|
@@ -1322,16 +1313,13 @@ function VaultInputModal({
|
|
|
1322
1313
|
} finally {
|
|
1323
1314
|
setLoading(false);
|
|
1324
1315
|
}
|
|
1325
|
-
}
|
|
1316
|
+
};
|
|
1326
1317
|
const handleClose = () => {
|
|
1327
1318
|
setValues({});
|
|
1328
1319
|
onClose();
|
|
1329
1320
|
};
|
|
1330
1321
|
if (!integration) return null;
|
|
1331
|
-
const isValid = integration.fields.filter((f) => f.required).every((f) =>
|
|
1332
|
-
var _a;
|
|
1333
|
-
return (_a = values[f.key]) == null ? void 0 : _a.trim();
|
|
1334
|
-
});
|
|
1322
|
+
const isValid = integration.fields.filter((f) => f.required).every((f) => values[f.key]?.trim());
|
|
1335
1323
|
return /* @__PURE__ */ jsx20(Dialog3, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs16(DialogContent3, { children: [
|
|
1336
1324
|
/* @__PURE__ */ jsx20(DialogHeader2, { children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3", children: [
|
|
1337
1325
|
/* @__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(
|
|
@@ -1364,7 +1352,8 @@ function VaultInputModal({
|
|
|
1364
1352
|
type: field.type,
|
|
1365
1353
|
placeholder: field.placeholder,
|
|
1366
1354
|
value: values[field.key] || "",
|
|
1367
|
-
onChange: (e) => setValues((prev) =>
|
|
1355
|
+
onChange: (e) => setValues((prev) => ({
|
|
1356
|
+
...prev,
|
|
1368
1357
|
[field.key]: e.target.value
|
|
1369
1358
|
})),
|
|
1370
1359
|
required: field.required
|
|
@@ -1545,19 +1534,19 @@ function VaultList({ items, onRotate, onDelete, onOpenAddModal }) {
|
|
|
1545
1534
|
setSelectedItem(item);
|
|
1546
1535
|
setDeleteDialogOpen(true);
|
|
1547
1536
|
};
|
|
1548
|
-
const handleConfirmDelete = () =>
|
|
1537
|
+
const handleConfirmDelete = async () => {
|
|
1549
1538
|
if (!selectedItem) return;
|
|
1550
|
-
|
|
1539
|
+
await onDelete(selectedItem.id);
|
|
1551
1540
|
setDeleteDialogOpen(false);
|
|
1552
1541
|
setSelectedItem(null);
|
|
1553
|
-
}
|
|
1554
|
-
const handleSave = (credentials) =>
|
|
1542
|
+
};
|
|
1543
|
+
const handleSave = async (credentials) => {
|
|
1555
1544
|
if (modalMode === "rotate" && selectedItem) {
|
|
1556
|
-
|
|
1545
|
+
await onRotate(selectedItem.id, credentials);
|
|
1557
1546
|
}
|
|
1558
1547
|
setInputModalOpen(false);
|
|
1559
1548
|
setSelectedItem(null);
|
|
1560
|
-
}
|
|
1549
|
+
};
|
|
1561
1550
|
const getIntegrationForModal = () => {
|
|
1562
1551
|
if (!selectedItem) return void 0;
|
|
1563
1552
|
const fields = integrationFields[selectedItem.integrationId] || integrationFields.default;
|
|
@@ -1593,7 +1582,7 @@ function VaultList({ items, onRotate, onDelete, onOpenAddModal }) {
|
|
|
1593
1582
|
setDeleteDialogOpen(false);
|
|
1594
1583
|
setSelectedItem(null);
|
|
1595
1584
|
},
|
|
1596
|
-
itemName:
|
|
1585
|
+
itemName: selectedItem?.name || "",
|
|
1597
1586
|
onConfirm: handleConfirmDelete
|
|
1598
1587
|
}
|
|
1599
1588
|
),
|
|
@@ -1624,9 +1613,9 @@ import { Table as Table2, TableBody as TableBody2, TableCell as TableCell2, Tabl
|
|
|
1624
1613
|
import { Mail, MoreHorizontal, Plus, Shield as Shield2, User } from "lucide-react";
|
|
1625
1614
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1626
1615
|
var mockUsers = [
|
|
1627
|
-
{ id: "1", name: "John Doe", email: "john@example.com", role: "Admin", avatar: "", status: "Active" },
|
|
1628
|
-
{ id: "2", name: "Jane Smith", email: "jane@example.com", role: "Member", avatar: "", status: "Active" },
|
|
1629
|
-
{ id: "3", name: "Bob Johnson", email: "bob@example.com", role: "Member", avatar: "", status: "Pending" }
|
|
1616
|
+
{ id: "1", name: "John Doe", email: "john@example.com.ai", role: "Admin", avatar: "", status: "Active" },
|
|
1617
|
+
{ id: "2", name: "Jane Smith", email: "jane@example.com.ai", role: "Member", avatar: "", status: "Active" },
|
|
1618
|
+
{ id: "3", name: "Bob Johnson", email: "bob@example.com.ai", role: "Member", avatar: "", status: "Pending" }
|
|
1630
1619
|
];
|
|
1631
1620
|
var mockSessions = [
|
|
1632
1621
|
{ id: "1", device: "Chrome on macOS", location: "San Francisco, CA", lastActive: "Now", current: true },
|
|
@@ -1700,7 +1689,7 @@ function MockUserProfile() {
|
|
|
1700
1689
|
] }),
|
|
1701
1690
|
/* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
|
|
1702
1691
|
/* @__PURE__ */ jsx23(Label2, { htmlFor: "email", children: "Email" }),
|
|
1703
|
-
/* @__PURE__ */ jsx23(Input3, { id: "email", type: "email", defaultValue: "john@example.com", disabled: true })
|
|
1692
|
+
/* @__PURE__ */ jsx23(Input3, { id: "email", type: "email", defaultValue: "john@example.com.ai", disabled: true })
|
|
1704
1693
|
] }),
|
|
1705
1694
|
/* @__PURE__ */ jsx23(Button7, { children: "Save Changes" })
|
|
1706
1695
|
] })
|
|
@@ -1825,20 +1814,14 @@ function SettingsPage({ sections, children }) {
|
|
|
1825
1814
|
] }),
|
|
1826
1815
|
/* @__PURE__ */ jsx24(Separator, {}),
|
|
1827
1816
|
/* @__PURE__ */ jsxs20(Tabs, { value: activeTab, onValueChange: (value) => setActiveTab(value), className: "space-y-6", children: [
|
|
1828
|
-
/* @__PURE__ */ jsx24(TabsList, { className: "grid w-full grid-cols-2 sm:grid-cols-3 lg:grid-cols-7 gap-2", children: activeSections.map((section) => {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
/* @__PURE__ */ jsx24(CardTitle7, { children: ((_a = sectionMeta[section]) == null ? void 0 : _a.title) || section }),
|
|
1837
|
-
/* @__PURE__ */ jsx24(CardDescription6, { children: ((_b = sectionMeta[section]) == null ? void 0 : _b.description) || `Manage your ${section} settings` })
|
|
1838
|
-
] }),
|
|
1839
|
-
/* @__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" }) })
|
|
1840
|
-
] }) }, section);
|
|
1841
|
-
})
|
|
1817
|
+
/* @__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)) }),
|
|
1818
|
+
activeSections.map((section, index) => /* @__PURE__ */ jsx24(TabsContent, { value: section, className: "space-y-6", children: /* @__PURE__ */ jsxs20(Card8, { children: [
|
|
1819
|
+
/* @__PURE__ */ jsxs20(CardHeader7, { children: [
|
|
1820
|
+
/* @__PURE__ */ jsx24(CardTitle7, { children: sectionMeta[section]?.title || section }),
|
|
1821
|
+
/* @__PURE__ */ jsx24(CardDescription6, { children: sectionMeta[section]?.description || `Manage your ${section} settings` })
|
|
1822
|
+
] }),
|
|
1823
|
+
/* @__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" }) })
|
|
1824
|
+
] }) }, section))
|
|
1842
1825
|
] })
|
|
1843
1826
|
] });
|
|
1844
1827
|
}
|
|
@@ -1853,19 +1836,18 @@ import { Label as Label3 } from "@mdxui/primitives/label";
|
|
|
1853
1836
|
import { User as User2, Mail as Mail2, Upload } from "lucide-react";
|
|
1854
1837
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1855
1838
|
function UserProfile({ user, onUpdate, readonly = false }) {
|
|
1856
|
-
var _a, _b;
|
|
1857
1839
|
const [formData, setFormData] = React2.useState({
|
|
1858
|
-
firstName:
|
|
1859
|
-
lastName:
|
|
1860
|
-
email:
|
|
1861
|
-
avatar:
|
|
1840
|
+
firstName: user?.firstName || user?.name?.split(" ")[0] || "",
|
|
1841
|
+
lastName: user?.lastName || user?.name?.split(" ").slice(1).join(" ") || "",
|
|
1842
|
+
email: user?.email || "",
|
|
1843
|
+
avatar: user?.avatar || ""
|
|
1862
1844
|
});
|
|
1863
1845
|
const handleSubmit = (e) => {
|
|
1864
1846
|
e.preventDefault();
|
|
1865
|
-
onUpdate
|
|
1847
|
+
onUpdate?.(formData);
|
|
1866
1848
|
};
|
|
1867
1849
|
const handleChange = (field, value) => {
|
|
1868
|
-
setFormData((prev) =>
|
|
1850
|
+
setFormData((prev) => ({ ...prev, [field]: value }));
|
|
1869
1851
|
};
|
|
1870
1852
|
const getInitials = () => {
|
|
1871
1853
|
const first = formData.firstName[0] || "";
|
|
@@ -1934,7 +1916,7 @@ function UserProfile({ user, onUpdate, readonly = false }) {
|
|
|
1934
1916
|
type: "email",
|
|
1935
1917
|
value: formData.email,
|
|
1936
1918
|
onChange: (e) => handleChange("email", e.target.value),
|
|
1937
|
-
placeholder: "john@example.com",
|
|
1919
|
+
placeholder: "john@example.com.ai",
|
|
1938
1920
|
disabled: true
|
|
1939
1921
|
}
|
|
1940
1922
|
),
|
|
@@ -2018,14 +2000,14 @@ function APIKeyManager({
|
|
|
2018
2000
|
return next;
|
|
2019
2001
|
});
|
|
2020
2002
|
};
|
|
2021
|
-
const copyToClipboard = (text, label) =>
|
|
2003
|
+
const copyToClipboard = async (text, label) => {
|
|
2022
2004
|
try {
|
|
2023
|
-
|
|
2005
|
+
await navigator.clipboard.writeText(text);
|
|
2024
2006
|
toast.success(`${label} copied to clipboard`);
|
|
2025
2007
|
} catch (err) {
|
|
2026
2008
|
toast.error("Failed to copy to clipboard");
|
|
2027
2009
|
}
|
|
2028
|
-
}
|
|
2010
|
+
};
|
|
2029
2011
|
const handleCreateKey = () => {
|
|
2030
2012
|
if (!newKeyName.trim()) {
|
|
2031
2013
|
toast.error("Please enter a key name");
|
|
@@ -2237,7 +2219,7 @@ function TeamManager({
|
|
|
2237
2219
|
{
|
|
2238
2220
|
id: "1",
|
|
2239
2221
|
name: "John Doe",
|
|
2240
|
-
email: "john@example.com",
|
|
2222
|
+
email: "john@example.com.ai",
|
|
2241
2223
|
role: "owner",
|
|
2242
2224
|
avatar: "",
|
|
2243
2225
|
status: "active",
|
|
@@ -2246,7 +2228,7 @@ function TeamManager({
|
|
|
2246
2228
|
{
|
|
2247
2229
|
id: "2",
|
|
2248
2230
|
name: "Jane Smith",
|
|
2249
|
-
email: "jane@example.com",
|
|
2231
|
+
email: "jane@example.com.ai",
|
|
2250
2232
|
role: "admin",
|
|
2251
2233
|
avatar: "",
|
|
2252
2234
|
status: "active",
|
|
@@ -2255,7 +2237,7 @@ function TeamManager({
|
|
|
2255
2237
|
{
|
|
2256
2238
|
id: "3",
|
|
2257
2239
|
name: "Bob Johnson",
|
|
2258
|
-
email: "bob@example.com",
|
|
2240
|
+
email: "bob@example.com.ai",
|
|
2259
2241
|
role: "member",
|
|
2260
2242
|
avatar: "",
|
|
2261
2243
|
status: "pending",
|
|
@@ -2288,14 +2270,14 @@ function TeamManager({
|
|
|
2288
2270
|
const handleRoleChange = (memberId, newRole) => {
|
|
2289
2271
|
setMembers(
|
|
2290
2272
|
members.map(
|
|
2291
|
-
(m) => m.id === memberId ?
|
|
2273
|
+
(m) => m.id === memberId ? { ...m, role: newRole } : m
|
|
2292
2274
|
)
|
|
2293
2275
|
);
|
|
2294
2276
|
toast2.success("Member role updated");
|
|
2295
2277
|
};
|
|
2296
2278
|
const handleRemoveMember = (memberId) => {
|
|
2297
2279
|
const member = members.find((m) => m.id === memberId);
|
|
2298
|
-
if (
|
|
2280
|
+
if (member?.role === "owner") {
|
|
2299
2281
|
toast2.error("Cannot remove the workspace owner");
|
|
2300
2282
|
return;
|
|
2301
2283
|
}
|
|
@@ -2364,7 +2346,7 @@ function TeamManager({
|
|
|
2364
2346
|
type: "email",
|
|
2365
2347
|
value: inviteEmail,
|
|
2366
2348
|
onChange: (e) => setInviteEmail(e.target.value),
|
|
2367
|
-
placeholder: "colleague@example.com"
|
|
2349
|
+
placeholder: "colleague@example.com.ai"
|
|
2368
2350
|
}
|
|
2369
2351
|
)
|
|
2370
2352
|
] }),
|
|
@@ -2585,7 +2567,7 @@ function Billing({
|
|
|
2585
2567
|
};
|
|
2586
2568
|
const handleRemovePaymentMethod = (methodId) => {
|
|
2587
2569
|
const method = paymentMethods.find((pm) => pm.id === methodId);
|
|
2588
|
-
if (method
|
|
2570
|
+
if (method?.isDefault) {
|
|
2589
2571
|
toast3.error("Cannot remove default payment method");
|
|
2590
2572
|
return;
|
|
2591
2573
|
}
|
|
@@ -2594,7 +2576,8 @@ function Billing({
|
|
|
2594
2576
|
};
|
|
2595
2577
|
const handleSetDefaultPaymentMethod = (methodId) => {
|
|
2596
2578
|
setPaymentMethods(
|
|
2597
|
-
paymentMethods.map((pm) =>
|
|
2579
|
+
paymentMethods.map((pm) => ({
|
|
2580
|
+
...pm,
|
|
2598
2581
|
isDefault: pm.id === methodId
|
|
2599
2582
|
}))
|
|
2600
2583
|
);
|
|
@@ -2810,6 +2793,29 @@ function Billing({
|
|
|
2810
2793
|
] });
|
|
2811
2794
|
}
|
|
2812
2795
|
|
|
2796
|
+
// src/developer/lib/icons.ts
|
|
2797
|
+
import * as LucideIcons from "lucide-react";
|
|
2798
|
+
function getIconByName(name) {
|
|
2799
|
+
const icons = LucideIcons;
|
|
2800
|
+
const icon = icons[name];
|
|
2801
|
+
if (icon && typeof icon === "function") {
|
|
2802
|
+
return icon;
|
|
2803
|
+
}
|
|
2804
|
+
return void 0;
|
|
2805
|
+
}
|
|
2806
|
+
var dashboardIcons = {
|
|
2807
|
+
overview: "BarChart3",
|
|
2808
|
+
requests: "Activity",
|
|
2809
|
+
keys: "Key",
|
|
2810
|
+
team: "Users",
|
|
2811
|
+
billing: "CreditCard",
|
|
2812
|
+
settings: "Settings",
|
|
2813
|
+
webhooks: "Webhook",
|
|
2814
|
+
database: "Database",
|
|
2815
|
+
integrations: "Puzzle",
|
|
2816
|
+
vault: "Lock"
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2813
2819
|
// src/developer/providers/app-providers.tsx
|
|
2814
2820
|
import { ThemeProvider } from "next-themes";
|
|
2815
2821
|
import { useEffect as useEffect6 } from "react";
|
|
@@ -2879,7 +2885,6 @@ function clearAuth() {
|
|
|
2879
2885
|
}
|
|
2880
2886
|
var apiBaseUrl = "/api";
|
|
2881
2887
|
function getDebugStatus() {
|
|
2882
|
-
var _a;
|
|
2883
2888
|
const effectiveToken = getEffectiveToken();
|
|
2884
2889
|
return {
|
|
2885
2890
|
isAuthenticated: currentToken !== null,
|
|
@@ -2887,30 +2892,28 @@ function getDebugStatus() {
|
|
|
2887
2892
|
hasEffectiveToken: effectiveToken !== null,
|
|
2888
2893
|
hasSDK: sdkInstance !== null,
|
|
2889
2894
|
tokenSource: currentToken ? "auth" : devToken ? "dev" : "none",
|
|
2890
|
-
tokenLength:
|
|
2895
|
+
tokenLength: effectiveToken?.length ?? 0,
|
|
2891
2896
|
tokenPreview: effectiveToken ? `${effectiveToken.slice(0, 20)}...${effectiveToken.slice(-10)}` : null,
|
|
2892
2897
|
debugMode,
|
|
2893
2898
|
apiBaseUrl
|
|
2894
2899
|
};
|
|
2895
2900
|
}
|
|
2896
|
-
function testSDKConnection() {
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
}
|
|
2913
|
-
});
|
|
2901
|
+
async function testSDKConnection() {
|
|
2902
|
+
const status = getDebugStatus();
|
|
2903
|
+
console.log("[Platform SDK] Testing connection...", status);
|
|
2904
|
+
if (!sdkInstance) {
|
|
2905
|
+
console.error("[Platform SDK] No SDK instance - not authenticated and no dev token");
|
|
2906
|
+
return { success: false, error: "No SDK instance", status };
|
|
2907
|
+
}
|
|
2908
|
+
try {
|
|
2909
|
+
console.log("[Platform SDK] Calling api.APIKeys.list()...");
|
|
2910
|
+
const result = await sdkInstance.api.APIKeys.list();
|
|
2911
|
+
console.log("[Platform SDK] Connection successful!", { result });
|
|
2912
|
+
return { success: true, result, status };
|
|
2913
|
+
} catch (error) {
|
|
2914
|
+
console.error("[Platform SDK] Connection failed:", error);
|
|
2915
|
+
return { success: false, error, status };
|
|
2916
|
+
}
|
|
2914
2917
|
}
|
|
2915
2918
|
if (typeof window !== "undefined") {
|
|
2916
2919
|
;
|
|
@@ -2973,10 +2976,9 @@ function IdentityWidgetsWrapper({ children }) {
|
|
|
2973
2976
|
);
|
|
2974
2977
|
}
|
|
2975
2978
|
function IdentityProvider({ children }) {
|
|
2976
|
-
var _a, _b;
|
|
2977
2979
|
const { config } = useDashboard();
|
|
2978
2980
|
const { identity } = config;
|
|
2979
|
-
const redirectUri =
|
|
2981
|
+
const redirectUri = identity.redirectUri ?? (typeof window !== "undefined" ? `${window.location.origin}${config.basePath ?? "/"}` : void 0);
|
|
2980
2982
|
const onRedirectCallback = () => {
|
|
2981
2983
|
if (typeof window !== "undefined") {
|
|
2982
2984
|
const url = new URL(window.location.href);
|
|
@@ -3024,20 +3026,18 @@ import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-r
|
|
|
3024
3026
|
function AuthSync({ children }) {
|
|
3025
3027
|
const { user, getAccessToken } = useAuth4();
|
|
3026
3028
|
useEffect5(() => {
|
|
3027
|
-
function syncToken() {
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
} catch (e) {
|
|
3034
|
-
clearAuth();
|
|
3035
|
-
}
|
|
3036
|
-
} else {
|
|
3029
|
+
async function syncToken() {
|
|
3030
|
+
if (user) {
|
|
3031
|
+
try {
|
|
3032
|
+
const token = await getAccessToken();
|
|
3033
|
+
setAuthToken(token);
|
|
3034
|
+
} catch {
|
|
3037
3035
|
clearAuth();
|
|
3038
|
-
queryClient.clear();
|
|
3039
3036
|
}
|
|
3040
|
-
}
|
|
3037
|
+
} else {
|
|
3038
|
+
clearAuth();
|
|
3039
|
+
queryClient.clear();
|
|
3040
|
+
}
|
|
3041
3041
|
}
|
|
3042
3042
|
syncToken();
|
|
3043
3043
|
}, [user, getAccessToken]);
|
|
@@ -3064,8 +3064,7 @@ function SDKInitializer({ config }) {
|
|
|
3064
3064
|
return null;
|
|
3065
3065
|
}
|
|
3066
3066
|
function AppProviders({ config, children }) {
|
|
3067
|
-
|
|
3068
|
-
const themeMode = (_b = (_a = config.theme) == null ? void 0 : _a.mode) != null ? _b : "system";
|
|
3067
|
+
const themeMode = config.theme?.mode ?? "system";
|
|
3069
3068
|
return /* @__PURE__ */ jsx31(
|
|
3070
3069
|
ThemeProvider,
|
|
3071
3070
|
{
|
|
@@ -3085,12 +3084,11 @@ function AppProviders({ config, children }) {
|
|
|
3085
3084
|
import { useAuth as useAuth5 } from "@workos-inc/authkit-react";
|
|
3086
3085
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3087
3086
|
function AuthGate({ children }) {
|
|
3088
|
-
var _a, _b;
|
|
3089
3087
|
const { config } = useDashboard();
|
|
3090
3088
|
const { user, isLoading } = useAuth5();
|
|
3091
3089
|
const { identity } = config;
|
|
3092
|
-
const required =
|
|
3093
|
-
const onUnauthenticated =
|
|
3090
|
+
const required = identity.required ?? true;
|
|
3091
|
+
const onUnauthenticated = identity.onUnauthenticated ?? "landing";
|
|
3094
3092
|
if (!required) {
|
|
3095
3093
|
return /* @__PURE__ */ jsx32(Fragment6, { children });
|
|
3096
3094
|
}
|
|
@@ -3726,26 +3724,76 @@ function getUsageColor(percentage) {
|
|
|
3726
3724
|
if (percentage >= 75) return "bg-yellow-500";
|
|
3727
3725
|
return "";
|
|
3728
3726
|
}
|
|
3729
|
-
function BillingPage(
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3727
|
+
function BillingPage({
|
|
3728
|
+
billingData: initialBillingData,
|
|
3729
|
+
onManagePlan,
|
|
3730
|
+
onUpdatePaymentMethod,
|
|
3731
|
+
onDownloadInvoice,
|
|
3732
|
+
onToggleAlerts,
|
|
3733
|
+
hideHeader = false,
|
|
3734
|
+
className
|
|
3735
|
+
} = {}) {
|
|
3736
|
+
const billingData = initialBillingData ?? mockBillingData;
|
|
3737
|
+
const [alertsEnabled, setAlertsEnabled] = useState13(billingData.billingAlerts.enabled);
|
|
3738
|
+
const handleManagePlan = async () => {
|
|
3739
|
+
if (onManagePlan) {
|
|
3740
|
+
try {
|
|
3741
|
+
await onManagePlan();
|
|
3742
|
+
} catch {
|
|
3743
|
+
toast4.error("Failed to open plan management");
|
|
3744
|
+
}
|
|
3745
|
+
} else {
|
|
3746
|
+
toast4.info("Plan management would open here");
|
|
3747
|
+
}
|
|
3735
3748
|
};
|
|
3736
|
-
const
|
|
3749
|
+
const handleUpdatePaymentMethod = async () => {
|
|
3750
|
+
if (onUpdatePaymentMethod) {
|
|
3751
|
+
try {
|
|
3752
|
+
await onUpdatePaymentMethod();
|
|
3753
|
+
} catch {
|
|
3754
|
+
toast4.error("Failed to update payment method");
|
|
3755
|
+
}
|
|
3756
|
+
} else {
|
|
3757
|
+
toast4.info("Payment method update would open here");
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
const handleDownloadInvoice = async (invoiceId, invoiceNumber) => {
|
|
3761
|
+
if (onDownloadInvoice) {
|
|
3762
|
+
try {
|
|
3763
|
+
await onDownloadInvoice(invoiceId);
|
|
3764
|
+
toast4.success("Invoice downloaded", {
|
|
3765
|
+
description: `${invoiceNumber} has been downloaded.`
|
|
3766
|
+
});
|
|
3767
|
+
} catch {
|
|
3768
|
+
toast4.error("Failed to download invoice");
|
|
3769
|
+
}
|
|
3770
|
+
} else {
|
|
3771
|
+
toast4.success("Invoice downloaded", {
|
|
3772
|
+
description: `${invoiceNumber} has been downloaded.`
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
};
|
|
3776
|
+
const handleAlertsToggle = async (enabled) => {
|
|
3777
|
+
if (onToggleAlerts) {
|
|
3778
|
+
try {
|
|
3779
|
+
await onToggleAlerts(enabled);
|
|
3780
|
+
} catch {
|
|
3781
|
+
toast4.error("Failed to update alert settings");
|
|
3782
|
+
return;
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3737
3785
|
setAlertsEnabled(enabled);
|
|
3738
3786
|
toast4.success(enabled ? "Billing alerts enabled" : "Billing alerts disabled", {
|
|
3739
|
-
description: enabled ? `You'll be notified when usage reaches ${
|
|
3787
|
+
description: enabled ? `You'll be notified when usage reaches ${billingData.billingAlerts.threshold}%.` : "You won't receive usage alerts."
|
|
3740
3788
|
});
|
|
3741
3789
|
};
|
|
3742
3790
|
return /* @__PURE__ */ jsxs28(Fragment7, { children: [
|
|
3743
|
-
/* @__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__ */ jsxs28("div", { className: "flex items-center gap-2 px-4", children: [
|
|
3791
|
+
!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__ */ jsxs28("div", { className: "flex items-center gap-2 px-4", children: [
|
|
3744
3792
|
/* @__PURE__ */ jsx33(SidebarTrigger, { className: "-ml-1" }),
|
|
3745
3793
|
/* @__PURE__ */ jsx33(Separator3, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
3746
3794
|
/* @__PURE__ */ jsx33(Breadcrumb, { children: /* @__PURE__ */ jsx33(BreadcrumbList, { children: /* @__PURE__ */ jsx33(BreadcrumbItem, { children: /* @__PURE__ */ jsx33(BreadcrumbPage, { children: "Billing" }) }) }) })
|
|
3747
3795
|
] }) }),
|
|
3748
|
-
/* @__PURE__ */ jsxs28("div", { className:
|
|
3796
|
+
/* @__PURE__ */ jsxs28("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
3749
3797
|
/* @__PURE__ */ jsx33("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs28("div", { children: [
|
|
3750
3798
|
/* @__PURE__ */ jsx33("h1", { className: "text-2xl font-bold", children: "Billing" }),
|
|
3751
3799
|
/* @__PURE__ */ jsx33("p", { className: "text-muted-foreground", children: "Manage your subscription and billing information." })
|
|
@@ -3755,28 +3803,28 @@ function BillingPage() {
|
|
|
3755
3803
|
/* @__PURE__ */ jsxs28(CardHeader12, { children: [
|
|
3756
3804
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
3757
3805
|
/* @__PURE__ */ jsx33(CardTitle12, { children: "Current Plan" }),
|
|
3758
|
-
/* @__PURE__ */ jsx33(Badge6, { variant:
|
|
3806
|
+
/* @__PURE__ */ jsx33(Badge6, { variant: billingData.status === "active" ? "default" : "secondary", children: billingData.status })
|
|
3759
3807
|
] }),
|
|
3760
3808
|
/* @__PURE__ */ jsxs28(CardDescription11, { children: [
|
|
3761
3809
|
"Renews",
|
|
3762
3810
|
" ",
|
|
3763
|
-
new Date(
|
|
3811
|
+
new Date(billingData.renewalDate).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })
|
|
3764
3812
|
] })
|
|
3765
3813
|
] }),
|
|
3766
3814
|
/* @__PURE__ */ jsxs28(CardContent12, { className: "space-y-4", children: [
|
|
3767
3815
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-baseline gap-2", children: [
|
|
3768
|
-
/* @__PURE__ */ jsx33("p", { className: "text-3xl font-bold", children:
|
|
3816
|
+
/* @__PURE__ */ jsx33("p", { className: "text-3xl font-bold", children: billingData.plan }),
|
|
3769
3817
|
/* @__PURE__ */ jsxs28("p", { className: "text-lg text-muted-foreground", children: [
|
|
3770
3818
|
"$",
|
|
3771
|
-
|
|
3819
|
+
billingData.planPrice.toFixed(0),
|
|
3772
3820
|
"/mo"
|
|
3773
3821
|
] })
|
|
3774
3822
|
] }),
|
|
3775
|
-
/* @__PURE__ */ jsx33("div", { className: "space-y-2", children:
|
|
3823
|
+
/* @__PURE__ */ jsx33("div", { className: "space-y-2", children: billingData.planFeatures.map((feature) => /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3776
3824
|
/* @__PURE__ */ jsx33(Check2, { className: "h-4 w-4 text-primary" }),
|
|
3777
3825
|
feature
|
|
3778
3826
|
] }, feature)) }),
|
|
3779
|
-
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", children: "Manage Plan" })
|
|
3827
|
+
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", onClick: handleManagePlan, children: "Manage Plan" })
|
|
3780
3828
|
] })
|
|
3781
3829
|
] }),
|
|
3782
3830
|
/* @__PURE__ */ jsxs28(Card13, { children: [
|
|
@@ -3784,7 +3832,7 @@ function BillingPage() {
|
|
|
3784
3832
|
/* @__PURE__ */ jsxs28(CardContent12, { className: "space-y-1", children: [
|
|
3785
3833
|
/* @__PURE__ */ jsxs28("p", { className: "text-3xl font-bold", children: [
|
|
3786
3834
|
"$",
|
|
3787
|
-
|
|
3835
|
+
billingData.totalSpend.toFixed(2)
|
|
3788
3836
|
] }),
|
|
3789
3837
|
/* @__PURE__ */ jsx33("p", { className: "text-sm text-muted-foreground", children: "This billing period" })
|
|
3790
3838
|
] })
|
|
@@ -3796,7 +3844,7 @@ function BillingPage() {
|
|
|
3796
3844
|
/* @__PURE__ */ jsx33(CardTitle12, { children: "Usage Breakdown" }),
|
|
3797
3845
|
/* @__PURE__ */ jsx33(CardDescription11, { children: "Resource usage for the current billing period" })
|
|
3798
3846
|
] }),
|
|
3799
|
-
/* @__PURE__ */ jsx33(CardContent12, { className: "space-y-6", children:
|
|
3847
|
+
/* @__PURE__ */ jsx33(CardContent12, { className: "space-y-6", children: billingData.usageBreakdown.map((item) => {
|
|
3800
3848
|
const percentage = getUsagePercentage(item.usage, item.limit);
|
|
3801
3849
|
const colorClass = getUsageColor(percentage);
|
|
3802
3850
|
return /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
|
|
@@ -3832,23 +3880,23 @@ function BillingPage() {
|
|
|
3832
3880
|
/* @__PURE__ */ jsxs28(CardContent12, { className: "space-y-3", children: [
|
|
3833
3881
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 border rounded-md", children: [
|
|
3834
3882
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-3", children: [
|
|
3835
|
-
/* @__PURE__ */ jsx33("div", { className: "h-8 w-12 bg-muted rounded flex items-center justify-center text-xs font-medium", children:
|
|
3883
|
+
/* @__PURE__ */ jsx33("div", { className: "h-8 w-12 bg-muted rounded flex items-center justify-center text-xs font-medium", children: billingData.paymentMethod.brand }),
|
|
3836
3884
|
/* @__PURE__ */ jsxs28("div", { children: [
|
|
3837
3885
|
/* @__PURE__ */ jsxs28("p", { className: "font-medium text-sm", children: [
|
|
3838
3886
|
"\u2022\u2022\u2022\u2022 ",
|
|
3839
|
-
|
|
3887
|
+
billingData.paymentMethod.last4
|
|
3840
3888
|
] }),
|
|
3841
3889
|
/* @__PURE__ */ jsxs28("p", { className: "text-xs text-muted-foreground", children: [
|
|
3842
3890
|
"Expires ",
|
|
3843
|
-
|
|
3891
|
+
billingData.paymentMethod.expiryMonth,
|
|
3844
3892
|
"/",
|
|
3845
|
-
|
|
3893
|
+
billingData.paymentMethod.expiryYear
|
|
3846
3894
|
] })
|
|
3847
3895
|
] })
|
|
3848
3896
|
] }),
|
|
3849
3897
|
/* @__PURE__ */ jsx33(Badge6, { variant: "secondary", className: "text-xs", children: "Default" })
|
|
3850
3898
|
] }),
|
|
3851
|
-
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", children: "Update" })
|
|
3899
|
+
/* @__PURE__ */ jsx33(Button12, { variant: "outline", size: "sm", className: "w-full", onClick: handleUpdatePaymentMethod, children: "Update" })
|
|
3852
3900
|
] })
|
|
3853
3901
|
] }),
|
|
3854
3902
|
/* @__PURE__ */ jsxs28(Card13, { children: [
|
|
@@ -3861,7 +3909,7 @@ function BillingPage() {
|
|
|
3861
3909
|
/* @__PURE__ */ jsx33(Label7, { htmlFor: "alerts", className: "text-sm", children: "Usage alerts" }),
|
|
3862
3910
|
/* @__PURE__ */ jsxs28("p", { className: "text-xs text-muted-foreground", children: [
|
|
3863
3911
|
"Notify at ",
|
|
3864
|
-
|
|
3912
|
+
billingData.billingAlerts.threshold,
|
|
3865
3913
|
"% usage"
|
|
3866
3914
|
] })
|
|
3867
3915
|
] }),
|
|
@@ -3874,7 +3922,7 @@ function BillingPage() {
|
|
|
3874
3922
|
/* @__PURE__ */ jsx33(Receipt, { className: "h-5 w-5" }),
|
|
3875
3923
|
"Invoice History"
|
|
3876
3924
|
] }) }),
|
|
3877
|
-
/* @__PURE__ */ jsx33(CardContent12, { children:
|
|
3925
|
+
/* @__PURE__ */ jsx33(CardContent12, { children: billingData.invoices.length > 0 ? /* @__PURE__ */ jsxs28(Table6, { children: [
|
|
3878
3926
|
/* @__PURE__ */ jsx33(TableHeader6, { children: /* @__PURE__ */ jsxs28(TableRow6, { children: [
|
|
3879
3927
|
/* @__PURE__ */ jsx33(TableHead6, { className: "pl-4", children: "Invoice" }),
|
|
3880
3928
|
/* @__PURE__ */ jsx33(TableHead6, { children: "Date" }),
|
|
@@ -3882,7 +3930,7 @@ function BillingPage() {
|
|
|
3882
3930
|
/* @__PURE__ */ jsx33(TableHead6, { children: "Status" }),
|
|
3883
3931
|
/* @__PURE__ */ jsx33(TableHead6, { className: "w-[80px]" })
|
|
3884
3932
|
] }) }),
|
|
3885
|
-
/* @__PURE__ */ jsx33(TableBody6, { children:
|
|
3933
|
+
/* @__PURE__ */ jsx33(TableBody6, { children: billingData.invoices.map((invoice) => /* @__PURE__ */ jsxs28(TableRow6, { children: [
|
|
3886
3934
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4 pl-4 font-mono text-sm", children: invoice.invoiceNumber }),
|
|
3887
3935
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4", children: formatRelativeDate(invoice.date) }),
|
|
3888
3936
|
/* @__PURE__ */ jsxs28(TableCell6, { className: "py-4 font-medium", children: [
|
|
@@ -3890,7 +3938,7 @@ function BillingPage() {
|
|
|
3890
3938
|
invoice.amount.toFixed(2)
|
|
3891
3939
|
] }),
|
|
3892
3940
|
/* @__PURE__ */ jsx33(TableCell6, { className: "py-4", children: /* @__PURE__ */ jsx33(Badge6, { variant: invoice.status === "paid" ? "default" : "secondary", children: invoice.status }) }),
|
|
3893
|
-
/* @__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" }) }) })
|
|
3941
|
+
/* @__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" }) }) })
|
|
3894
3942
|
] }, invoice.id)) })
|
|
3895
3943
|
] }) : /* @__PURE__ */ jsxs28("div", { className: "flex flex-col items-center justify-center gap-4 py-16 text-center", children: [
|
|
3896
3944
|
/* @__PURE__ */ jsx33("div", { className: "rounded-full bg-muted p-4", children: /* @__PURE__ */ jsx33(FileText2, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
@@ -4015,8 +4063,15 @@ function StatusIndicator({ status }) {
|
|
|
4015
4063
|
/* @__PURE__ */ jsx36("span", { className: "text-sm", children: label })
|
|
4016
4064
|
] });
|
|
4017
4065
|
}
|
|
4018
|
-
function KeysPage(
|
|
4019
|
-
|
|
4066
|
+
function KeysPage({
|
|
4067
|
+
keys: initialKeys,
|
|
4068
|
+
onCreateKey,
|
|
4069
|
+
onRevokeKey,
|
|
4070
|
+
onRenameKey,
|
|
4071
|
+
hideHeader = false,
|
|
4072
|
+
className
|
|
4073
|
+
} = {}) {
|
|
4074
|
+
const [keys, setKeys] = useState14(initialKeys ?? mockApiKeys);
|
|
4020
4075
|
const [newKeyName, setNewKeyName] = useState14("");
|
|
4021
4076
|
const [newlyCreatedKey, setNewlyCreatedKey] = useState14(null);
|
|
4022
4077
|
const [createDialogOpen, setCreateDialogOpen] = useState14(false);
|
|
@@ -4027,23 +4082,52 @@ function KeysPage() {
|
|
|
4027
4082
|
const [renameValue, setRenameValue] = useState14("");
|
|
4028
4083
|
const [copiedKeyId, setCopiedKeyId] = useState14(null);
|
|
4029
4084
|
const [newKeyCopied, setNewKeyCopied] = useState14(false);
|
|
4030
|
-
const handleCreateKey = () => {
|
|
4031
|
-
const
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4085
|
+
const handleCreateKey = async () => {
|
|
4086
|
+
const name = newKeyName || "Untitled Key";
|
|
4087
|
+
if (onCreateKey) {
|
|
4088
|
+
try {
|
|
4089
|
+
const result = await onCreateKey(name);
|
|
4090
|
+
const newKey = {
|
|
4091
|
+
id: result.id,
|
|
4092
|
+
name,
|
|
4093
|
+
key: result.key,
|
|
4094
|
+
created: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
4095
|
+
lastUsed: null,
|
|
4096
|
+
status: "never_used"
|
|
4097
|
+
};
|
|
4098
|
+
setKeys([...keys, newKey]);
|
|
4099
|
+
setNewlyCreatedKey(result.key);
|
|
4100
|
+
} catch {
|
|
4101
|
+
toast5.error("Failed to create API key");
|
|
4102
|
+
return;
|
|
4103
|
+
}
|
|
4104
|
+
} else {
|
|
4105
|
+
const newKey = {
|
|
4106
|
+
id: String(Date.now()),
|
|
4107
|
+
name,
|
|
4108
|
+
key: `sk_live_${Math.random().toString(36).substring(2, 15)}${Math.random().toString(36).substring(2, 15)}`,
|
|
4109
|
+
created: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
4110
|
+
lastUsed: null,
|
|
4111
|
+
status: "never_used"
|
|
4112
|
+
};
|
|
4113
|
+
setKeys([...keys, newKey]);
|
|
4114
|
+
setNewlyCreatedKey(newKey.key);
|
|
4115
|
+
}
|
|
4041
4116
|
setNewKeyName("");
|
|
4042
4117
|
};
|
|
4043
|
-
const handleRevokeKey = () => {
|
|
4118
|
+
const handleRevokeKey = async () => {
|
|
4044
4119
|
if (keyToRevoke) {
|
|
4045
4120
|
const keyName = keyToRevoke.name;
|
|
4046
|
-
|
|
4121
|
+
const keyId = keyToRevoke.id;
|
|
4122
|
+
if (onRevokeKey) {
|
|
4123
|
+
try {
|
|
4124
|
+
await onRevokeKey(keyId);
|
|
4125
|
+
} catch {
|
|
4126
|
+
toast5.error("Failed to revoke API key");
|
|
4127
|
+
return;
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
setKeys(keys.filter((k) => k.id !== keyId));
|
|
4047
4131
|
setKeyToRevoke(null);
|
|
4048
4132
|
setRevokeDialogOpen(false);
|
|
4049
4133
|
toast5.success("API key revoked", {
|
|
@@ -4051,10 +4135,19 @@ function KeysPage() {
|
|
|
4051
4135
|
});
|
|
4052
4136
|
}
|
|
4053
4137
|
};
|
|
4054
|
-
const handleRenameKey = () => {
|
|
4138
|
+
const handleRenameKey = async () => {
|
|
4055
4139
|
if (keyToRename && renameValue.trim()) {
|
|
4056
4140
|
const newName = renameValue.trim();
|
|
4057
|
-
|
|
4141
|
+
const keyId = keyToRename.id;
|
|
4142
|
+
if (onRenameKey) {
|
|
4143
|
+
try {
|
|
4144
|
+
await onRenameKey(keyId, newName);
|
|
4145
|
+
} catch {
|
|
4146
|
+
toast5.error("Failed to rename API key");
|
|
4147
|
+
return;
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
setKeys(keys.map((k) => k.id === keyId ? { ...k, name: newName } : k));
|
|
4058
4151
|
setKeyToRename(null);
|
|
4059
4152
|
setRenameDialogOpen(false);
|
|
4060
4153
|
setRenameValue("");
|
|
@@ -4063,15 +4156,15 @@ function KeysPage() {
|
|
|
4063
4156
|
});
|
|
4064
4157
|
}
|
|
4065
4158
|
};
|
|
4066
|
-
const handleCopyNewKey = () =>
|
|
4159
|
+
const handleCopyNewKey = async () => {
|
|
4067
4160
|
if (newlyCreatedKey) {
|
|
4068
|
-
|
|
4161
|
+
await navigator.clipboard.writeText(newlyCreatedKey);
|
|
4069
4162
|
setNewKeyCopied(true);
|
|
4070
4163
|
setCopiedKeyId("new");
|
|
4071
4164
|
setTimeout(() => setCopiedKeyId(null), 2e3);
|
|
4072
4165
|
toast5.success("API key copied to clipboard");
|
|
4073
4166
|
}
|
|
4074
|
-
}
|
|
4167
|
+
};
|
|
4075
4168
|
const closeCreateDialog = () => {
|
|
4076
4169
|
setCreateDialogOpen(false);
|
|
4077
4170
|
setNewlyCreatedKey(null);
|
|
@@ -4088,12 +4181,12 @@ function KeysPage() {
|
|
|
4088
4181
|
setRevokeDialogOpen(true);
|
|
4089
4182
|
};
|
|
4090
4183
|
return /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4091
|
-
/* @__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__ */ jsxs31("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4184
|
+
!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__ */ jsxs31("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4092
4185
|
/* @__PURE__ */ jsx36(SidebarTrigger4, { className: "-ml-1" }),
|
|
4093
4186
|
/* @__PURE__ */ jsx36(Separator6, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4094
4187
|
/* @__PURE__ */ jsx36(Breadcrumb4, { children: /* @__PURE__ */ jsx36(BreadcrumbList4, { children: /* @__PURE__ */ jsx36(BreadcrumbItem4, { children: /* @__PURE__ */ jsx36(BreadcrumbPage4, { children: "API Keys" }) }) }) })
|
|
4095
4188
|
] }) }),
|
|
4096
|
-
/* @__PURE__ */ jsxs31("div", { className:
|
|
4189
|
+
/* @__PURE__ */ jsxs31("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
4097
4190
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
4098
4191
|
/* @__PURE__ */ jsxs31("div", { children: [
|
|
4099
4192
|
/* @__PURE__ */ jsx36("h1", { className: "text-2xl font-bold", children: "API Keys" }),
|
|
@@ -4207,7 +4300,7 @@ function KeysPage() {
|
|
|
4207
4300
|
/* @__PURE__ */ jsx36(DialogTitle6, { children: "Revoke API Key" }),
|
|
4208
4301
|
/* @__PURE__ */ jsxs31(DialogDescription5, { children: [
|
|
4209
4302
|
'Are you sure you want to revoke "',
|
|
4210
|
-
keyToRevoke
|
|
4303
|
+
keyToRevoke?.name,
|
|
4211
4304
|
'"? This action cannot be undone.'
|
|
4212
4305
|
] })
|
|
4213
4306
|
] }),
|
|
@@ -4276,7 +4369,6 @@ function EmptyState() {
|
|
|
4276
4369
|
] });
|
|
4277
4370
|
}
|
|
4278
4371
|
function OverviewPage() {
|
|
4279
|
-
var _a, _b, _c, _d;
|
|
4280
4372
|
const [selectedPeriod, setSelectedPeriod] = useState15("30d");
|
|
4281
4373
|
const [isLoading, setIsLoading] = useState15(true);
|
|
4282
4374
|
const [stats, setStats] = useState15(null);
|
|
@@ -4299,7 +4391,7 @@ function OverviewPage() {
|
|
|
4299
4391
|
setIsLoading(true);
|
|
4300
4392
|
setSelectedPeriod(period);
|
|
4301
4393
|
};
|
|
4302
|
-
const selectedLabel =
|
|
4394
|
+
const selectedLabel = timePeriodOptions.find((opt) => opt.value === selectedPeriod)?.label;
|
|
4303
4395
|
return /* @__PURE__ */ jsxs32(Fragment11, { children: [
|
|
4304
4396
|
/* @__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__ */ jsxs32("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4305
4397
|
/* @__PURE__ */ jsx37(SidebarTrigger5, { className: "-ml-1" }),
|
|
@@ -4329,7 +4421,7 @@ function OverviewPage() {
|
|
|
4329
4421
|
] }),
|
|
4330
4422
|
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */ jsxs32("div", { className: "flex items-end justify-between", children: [
|
|
4331
4423
|
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4332
|
-
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children:
|
|
4424
|
+
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children: stats?.totalRequests.toLocaleString() ?? "\u2014" }),
|
|
4333
4425
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: selectedLabel })
|
|
4334
4426
|
] }),
|
|
4335
4427
|
/* @__PURE__ */ jsx37(Sparkline, { data: usageData.slice(-7).map((d) => ({ value: d.requests })), color: "var(--chart-1)" })
|
|
@@ -4344,7 +4436,7 @@ function OverviewPage() {
|
|
|
4344
4436
|
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4345
4437
|
/* @__PURE__ */ jsxs32("div", { className: "text-2xl font-bold", children: [
|
|
4346
4438
|
"$",
|
|
4347
|
-
|
|
4439
|
+
stats?.totalCost.toFixed(2) ?? "\u2014"
|
|
4348
4440
|
] }),
|
|
4349
4441
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: selectedLabel })
|
|
4350
4442
|
] }),
|
|
@@ -4358,7 +4450,7 @@ function OverviewPage() {
|
|
|
4358
4450
|
] }),
|
|
4359
4451
|
/* @__PURE__ */ jsx37(CardContent14, { children: /* @__PURE__ */ jsxs32("div", { className: "flex items-end justify-between", children: [
|
|
4360
4452
|
/* @__PURE__ */ jsxs32("div", { children: [
|
|
4361
|
-
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children:
|
|
4453
|
+
/* @__PURE__ */ jsx37("div", { className: "text-2xl font-bold", children: stats?.errorCount ?? "\u2014" }),
|
|
4362
4454
|
/* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: "Failed requests" })
|
|
4363
4455
|
] }),
|
|
4364
4456
|
/* @__PURE__ */ jsx37(
|
|
@@ -4464,7 +4556,6 @@ function formatCost(cost) {
|
|
|
4464
4556
|
return `$${cost.toFixed(3)}`;
|
|
4465
4557
|
}
|
|
4466
4558
|
function RequestsPage() {
|
|
4467
|
-
var _a;
|
|
4468
4559
|
const [statusFilter, setStatusFilter] = useState16("all");
|
|
4469
4560
|
const [selectedRequest, setSelectedRequest] = useState16(null);
|
|
4470
4561
|
const [sheetOpen, setSheetOpen] = useState16(false);
|
|
@@ -4493,7 +4584,7 @@ function RequestsPage() {
|
|
|
4493
4584
|
] }),
|
|
4494
4585
|
/* @__PURE__ */ jsxs33(DropdownMenu6, { children: [
|
|
4495
4586
|
/* @__PURE__ */ jsx38(DropdownMenuTrigger6, { asChild: true, children: /* @__PURE__ */ jsxs33(Button15, { variant: "outline", className: "w-[160px] justify-between", children: [
|
|
4496
|
-
|
|
4587
|
+
statusFilterOptions.find((o) => o.value === statusFilter)?.label,
|
|
4497
4588
|
/* @__PURE__ */ jsx38(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
4498
4589
|
] }) }),
|
|
4499
4590
|
/* @__PURE__ */ jsx38(DropdownMenuContent6, { align: "end", className: "w-[160px]", children: statusFilterOptions.map((option) => /* @__PURE__ */ jsx38(DropdownMenuItem6, { onClick: () => setStatusFilter(option.value), children: option.label }, option.value)) })
|
|
@@ -4568,9 +4659,8 @@ import { UserProfile as UserProfile2 } from "@workos-inc/widgets";
|
|
|
4568
4659
|
import { Link as Link4 } from "react-router-dom";
|
|
4569
4660
|
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4570
4661
|
function SettingsProfilePage() {
|
|
4571
|
-
var _a, _b;
|
|
4572
4662
|
const { config } = useDashboard();
|
|
4573
|
-
const useMockWidgets =
|
|
4663
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4574
4664
|
const { user, getAccessToken, isLoading } = useAuth6();
|
|
4575
4665
|
return /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4576
4666
|
/* @__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__ */ jsxs34("div", { className: "flex items-center gap-2 px-4", children: [
|
|
@@ -4602,18 +4692,16 @@ import { useEffect as useEffect8, useRef as useRef2, useState as useState17 } fr
|
|
|
4602
4692
|
import { Link as Link5 } from "react-router-dom";
|
|
4603
4693
|
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4604
4694
|
function SettingsSecurityPage() {
|
|
4605
|
-
var _a, _b;
|
|
4606
4695
|
const { config } = useDashboard();
|
|
4607
|
-
const useMockWidgets =
|
|
4696
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4608
4697
|
const { user, getAccessToken, isLoading } = useAuth7();
|
|
4609
4698
|
const [isEmpty, setIsEmpty] = useState17(false);
|
|
4610
4699
|
const containerRef = useRef2(null);
|
|
4611
4700
|
useEffect8(() => {
|
|
4612
4701
|
if (useMockWidgets || isLoading || !user) return;
|
|
4613
4702
|
const timer = setTimeout(() => {
|
|
4614
|
-
var _a2;
|
|
4615
4703
|
if (containerRef.current) {
|
|
4616
|
-
const content =
|
|
4704
|
+
const content = containerRef.current.textContent?.trim();
|
|
4617
4705
|
const hasVisibleContent = containerRef.current.querySelector('button, input, [role="button"]');
|
|
4618
4706
|
if (!content && !hasVisibleContent) {
|
|
4619
4707
|
setIsEmpty(true);
|
|
@@ -4651,9 +4739,8 @@ import { UserSessions } from "@workos-inc/widgets";
|
|
|
4651
4739
|
import { Link as Link6 } from "react-router-dom";
|
|
4652
4740
|
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4653
4741
|
function SettingsSessionsPage() {
|
|
4654
|
-
var _a, _b;
|
|
4655
4742
|
const { config } = useDashboard();
|
|
4656
|
-
const useMockWidgets =
|
|
4743
|
+
const useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4657
4744
|
const { user, getAccessToken, isLoading } = useAuth8();
|
|
4658
4745
|
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
4659
4746
|
/* @__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__ */ jsxs36("div", { className: "flex items-center gap-2 px-4", children: [
|
|
@@ -4682,21 +4769,31 @@ import { SidebarTrigger as SidebarTrigger10 } from "@mdxui/primitives/sidebar";
|
|
|
4682
4769
|
import { useAuth as useAuth9 } from "@workos-inc/authkit-react";
|
|
4683
4770
|
import { UsersManagement } from "@workos-inc/widgets";
|
|
4684
4771
|
import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4685
|
-
function TeamPage(
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4772
|
+
function TeamPage({
|
|
4773
|
+
useMockWidgets: useMockWidgetsProp,
|
|
4774
|
+
hideHeader = false,
|
|
4775
|
+
className
|
|
4776
|
+
} = {}) {
|
|
4777
|
+
let useMockWidgets = useMockWidgetsProp;
|
|
4778
|
+
try {
|
|
4779
|
+
const { config } = useDashboard();
|
|
4780
|
+
if (useMockWidgets === void 0) {
|
|
4781
|
+
useMockWidgets = config.identity?.useMockWidgets ?? false;
|
|
4782
|
+
}
|
|
4783
|
+
} catch {
|
|
4784
|
+
useMockWidgets = useMockWidgetsProp ?? false;
|
|
4785
|
+
}
|
|
4689
4786
|
const { user, getAccessToken, isLoading, organizationId, permissions } = useAuth9();
|
|
4690
4787
|
const hasOrganization = !!organizationId;
|
|
4691
|
-
const canManageTeam = hasOrganization &&
|
|
4788
|
+
const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
|
|
4692
4789
|
const loading = !useMockWidgets && isLoading;
|
|
4693
4790
|
return /* @__PURE__ */ jsxs37(Fragment16, { children: [
|
|
4694
|
-
/* @__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: [
|
|
4791
|
+
!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__ */ jsxs37("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4695
4792
|
/* @__PURE__ */ jsx42(SidebarTrigger10, { className: "-ml-1" }),
|
|
4696
4793
|
/* @__PURE__ */ jsx42(Separator12, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
4697
4794
|
/* @__PURE__ */ jsx42(Breadcrumb10, { children: /* @__PURE__ */ jsx42(BreadcrumbList10, { children: /* @__PURE__ */ jsx42(BreadcrumbItem10, { children: /* @__PURE__ */ jsx42(BreadcrumbPage10, { children: "Team" }) }) }) })
|
|
4698
4795
|
] }) }),
|
|
4699
|
-
/* @__PURE__ */ jsxs37("div", { className:
|
|
4796
|
+
/* @__PURE__ */ jsxs37("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
4700
4797
|
/* @__PURE__ */ jsxs37("div", { children: [
|
|
4701
4798
|
/* @__PURE__ */ jsx42("h1", { className: "text-2xl font-bold", children: "Team" }),
|
|
4702
4799
|
/* @__PURE__ */ jsx42("p", { className: "text-muted-foreground", children: "Manage your team members and their permissions." })
|
|
@@ -4732,7 +4829,7 @@ function VaultPage() {
|
|
|
4732
4829
|
setPendingIntegration(pendingCredentialRequest);
|
|
4733
4830
|
setAddModalOpen(true);
|
|
4734
4831
|
};
|
|
4735
|
-
const handleAdd = (credentials) =>
|
|
4832
|
+
const handleAdd = async (credentials) => {
|
|
4736
4833
|
if (!pendingIntegration) return;
|
|
4737
4834
|
const newItem = {
|
|
4738
4835
|
id: Date.now().toString(),
|
|
@@ -4744,21 +4841,21 @@ function VaultPage() {
|
|
|
4744
4841
|
};
|
|
4745
4842
|
setItems((prev) => [...prev, newItem]);
|
|
4746
4843
|
toast6.success(`${pendingIntegration.name} credentials added successfully`);
|
|
4747
|
-
}
|
|
4844
|
+
};
|
|
4748
4845
|
const handleCloseAddModal = () => {
|
|
4749
4846
|
setAddModalOpen(false);
|
|
4750
4847
|
setPendingIntegration(null);
|
|
4751
4848
|
};
|
|
4752
|
-
const handleRotate = (id, credentials) =>
|
|
4849
|
+
const handleRotate = async (id, credentials) => {
|
|
4753
4850
|
const item = items.find((i) => i.id === id);
|
|
4754
|
-
setItems((prev) => prev.map((i) => i.id === id ?
|
|
4755
|
-
toast6.success(`${
|
|
4756
|
-
}
|
|
4757
|
-
const handleDelete = (id) =>
|
|
4851
|
+
setItems((prev) => prev.map((i) => i.id === id ? { ...i, updatedAt: /* @__PURE__ */ new Date() } : i));
|
|
4852
|
+
toast6.success(`${item?.name || "Credentials"} rotated successfully`);
|
|
4853
|
+
};
|
|
4854
|
+
const handleDelete = async (id) => {
|
|
4758
4855
|
const item = items.find((i) => i.id === id);
|
|
4759
4856
|
setItems((prev) => prev.filter((i) => i.id !== id));
|
|
4760
|
-
toast6.success(`${
|
|
4761
|
-
}
|
|
4857
|
+
toast6.success(`${item?.name || "Credentials"} deleted successfully`);
|
|
4858
|
+
};
|
|
4762
4859
|
return /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
4763
4860
|
/* @__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__ */ jsxs38("div", { className: "flex items-center gap-2 px-4", children: [
|
|
4764
4861
|
/* @__PURE__ */ jsx43(SidebarTrigger11, { className: "-ml-1" }),
|
|
@@ -4835,7 +4932,6 @@ var periodMultipliers = {
|
|
|
4835
4932
|
"30d": 30
|
|
4836
4933
|
};
|
|
4837
4934
|
function WebhooksActivityPage() {
|
|
4838
|
-
var _a;
|
|
4839
4935
|
const [period, setPeriod] = useState19("7d");
|
|
4840
4936
|
const multiplier = periodMultipliers[period];
|
|
4841
4937
|
const activity = {
|
|
@@ -4843,7 +4939,8 @@ function WebhooksActivityPage() {
|
|
|
4843
4939
|
failed: Math.round(mockWebhookActivity.failed * multiplier),
|
|
4844
4940
|
pending: mockWebhookActivity.pending,
|
|
4845
4941
|
successRate: mockWebhookActivity.successRate,
|
|
4846
|
-
endpointsWithIssues: mockWebhookActivity.endpointsWithIssues.map((ep) =>
|
|
4942
|
+
endpointsWithIssues: mockWebhookActivity.endpointsWithIssues.map((ep) => ({
|
|
4943
|
+
...ep,
|
|
4847
4944
|
failures: Math.round(ep.failures * multiplier)
|
|
4848
4945
|
}))
|
|
4849
4946
|
};
|
|
@@ -4866,7 +4963,7 @@ function WebhooksActivityPage() {
|
|
|
4866
4963
|
] }),
|
|
4867
4964
|
/* @__PURE__ */ jsxs39(DropdownMenu7, { children: [
|
|
4868
4965
|
/* @__PURE__ */ jsx44(DropdownMenuTrigger7, { asChild: true, children: /* @__PURE__ */ jsxs39(Button17, { variant: "outline", className: "w-[160px] justify-between", children: [
|
|
4869
|
-
|
|
4966
|
+
periodOptions.find((o) => o.value === period)?.label,
|
|
4870
4967
|
/* @__PURE__ */ jsx44(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
4871
4968
|
] }) }),
|
|
4872
4969
|
/* @__PURE__ */ jsx44(DropdownMenuContent7, { align: "end", className: "w-[160px]", children: periodOptions.map((option) => /* @__PURE__ */ jsx44(DropdownMenuItem7, { onClick: () => setPeriod(option.value), children: option.label }, option.value)) })
|
|
@@ -5026,8 +5123,15 @@ var eventsByCategory = mockWebhookEvents.reduce((acc, event) => {
|
|
|
5026
5123
|
acc[event.category].push(event);
|
|
5027
5124
|
return acc;
|
|
5028
5125
|
}, {});
|
|
5029
|
-
function WebhooksEndpointsPage(
|
|
5030
|
-
|
|
5126
|
+
function WebhooksEndpointsPage({
|
|
5127
|
+
endpoints: initialEndpoints,
|
|
5128
|
+
onCreateEndpoint,
|
|
5129
|
+
onUpdateEndpoint,
|
|
5130
|
+
onDeleteEndpoint,
|
|
5131
|
+
hideHeader = false,
|
|
5132
|
+
className
|
|
5133
|
+
} = {}) {
|
|
5134
|
+
const [endpoints, setEndpoints] = useState20(initialEndpoints ?? mockWebhookEndpoints);
|
|
5031
5135
|
const [createDialogOpen, setCreateDialogOpen] = useState20(false);
|
|
5032
5136
|
const [editDialogOpen, setEditDialogOpen] = useState20(false);
|
|
5033
5137
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState20(false);
|
|
@@ -5041,29 +5145,57 @@ function WebhooksEndpointsPage() {
|
|
|
5041
5145
|
setFormEvents([]);
|
|
5042
5146
|
setFormEnabled(true);
|
|
5043
5147
|
};
|
|
5044
|
-
const handleCreate = () => {
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5148
|
+
const handleCreate = async () => {
|
|
5149
|
+
if (onCreateEndpoint) {
|
|
5150
|
+
try {
|
|
5151
|
+
const result = await onCreateEndpoint({ url: formUrl, events: formEvents, enabled: formEnabled });
|
|
5152
|
+
const newEndpoint = {
|
|
5153
|
+
id: result.id,
|
|
5154
|
+
url: formUrl,
|
|
5155
|
+
events: formEvents,
|
|
5156
|
+
lastDelivery: null,
|
|
5157
|
+
status: formEnabled ? "active" : "disabled",
|
|
5158
|
+
secret: result.secret,
|
|
5159
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5160
|
+
failureCount: 0
|
|
5161
|
+
};
|
|
5162
|
+
setEndpoints([...endpoints, newEndpoint]);
|
|
5163
|
+
} catch {
|
|
5164
|
+
toast7.error("Failed to create endpoint");
|
|
5165
|
+
return;
|
|
5166
|
+
}
|
|
5167
|
+
} else {
|
|
5168
|
+
const newEndpoint = {
|
|
5169
|
+
id: `ep_${Date.now()}`,
|
|
5170
|
+
url: formUrl,
|
|
5171
|
+
events: formEvents,
|
|
5172
|
+
lastDelivery: null,
|
|
5173
|
+
status: formEnabled ? "active" : "disabled",
|
|
5174
|
+
secret: `whsec_${Math.random().toString(36).substring(2, 15)}`,
|
|
5175
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5176
|
+
failureCount: 0
|
|
5177
|
+
};
|
|
5178
|
+
setEndpoints([...endpoints, newEndpoint]);
|
|
5179
|
+
}
|
|
5056
5180
|
setCreateDialogOpen(false);
|
|
5057
5181
|
resetForm();
|
|
5058
5182
|
toast7.success("Endpoint created", {
|
|
5059
5183
|
description: "Your webhook endpoint has been created successfully."
|
|
5060
5184
|
});
|
|
5061
5185
|
};
|
|
5062
|
-
const handleEdit = () => {
|
|
5186
|
+
const handleEdit = async () => {
|
|
5063
5187
|
if (!selectedEndpoint) return;
|
|
5188
|
+
if (onUpdateEndpoint) {
|
|
5189
|
+
try {
|
|
5190
|
+
await onUpdateEndpoint(selectedEndpoint.id, { url: formUrl, events: formEvents, enabled: formEnabled });
|
|
5191
|
+
} catch {
|
|
5192
|
+
toast7.error("Failed to update endpoint");
|
|
5193
|
+
return;
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5064
5196
|
setEndpoints(
|
|
5065
5197
|
endpoints.map(
|
|
5066
|
-
(ep) => ep.id === selectedEndpoint.id ?
|
|
5198
|
+
(ep) => ep.id === selectedEndpoint.id ? { ...ep, url: formUrl, events: formEvents, status: formEnabled ? "active" : "disabled" } : ep
|
|
5067
5199
|
)
|
|
5068
5200
|
);
|
|
5069
5201
|
setEditDialogOpen(false);
|
|
@@ -5073,8 +5205,16 @@ function WebhooksEndpointsPage() {
|
|
|
5073
5205
|
description: "Your webhook endpoint has been updated successfully."
|
|
5074
5206
|
});
|
|
5075
5207
|
};
|
|
5076
|
-
const handleDelete = () => {
|
|
5208
|
+
const handleDelete = async () => {
|
|
5077
5209
|
if (!selectedEndpoint) return;
|
|
5210
|
+
if (onDeleteEndpoint) {
|
|
5211
|
+
try {
|
|
5212
|
+
await onDeleteEndpoint(selectedEndpoint.id);
|
|
5213
|
+
} catch {
|
|
5214
|
+
toast7.error("Failed to delete endpoint");
|
|
5215
|
+
return;
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5078
5218
|
setEndpoints(endpoints.filter((ep) => ep.id !== selectedEndpoint.id));
|
|
5079
5219
|
setDeleteDialogOpen(false);
|
|
5080
5220
|
setSelectedEndpoint(null);
|
|
@@ -5093,12 +5233,12 @@ function WebhooksEndpointsPage() {
|
|
|
5093
5233
|
setSelectedEndpoint(endpoint);
|
|
5094
5234
|
setDeleteDialogOpen(true);
|
|
5095
5235
|
};
|
|
5096
|
-
const handleCopySecret = (endpoint) =>
|
|
5097
|
-
|
|
5236
|
+
const handleCopySecret = async (endpoint) => {
|
|
5237
|
+
await navigator.clipboard.writeText(endpoint.secret);
|
|
5098
5238
|
setCopiedSecret(endpoint.id);
|
|
5099
5239
|
setTimeout(() => setCopiedSecret(null), 2e3);
|
|
5100
5240
|
toast7.success("Secret copied to clipboard");
|
|
5101
|
-
}
|
|
5241
|
+
};
|
|
5102
5242
|
const toggleEvent = (eventName) => {
|
|
5103
5243
|
if (formEvents.includes(eventName)) {
|
|
5104
5244
|
setFormEvents(formEvents.filter((e) => e !== eventName));
|
|
@@ -5107,7 +5247,7 @@ function WebhooksEndpointsPage() {
|
|
|
5107
5247
|
}
|
|
5108
5248
|
};
|
|
5109
5249
|
return /* @__PURE__ */ jsxs40(Fragment19, { children: [
|
|
5110
|
-
/* @__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__ */ jsxs40("div", { className: "flex items-center gap-2 px-4", children: [
|
|
5250
|
+
!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__ */ jsxs40("div", { className: "flex items-center gap-2 px-4", children: [
|
|
5111
5251
|
/* @__PURE__ */ jsx45(SidebarTrigger13, { className: "-ml-1" }),
|
|
5112
5252
|
/* @__PURE__ */ jsx45(Separator15, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }),
|
|
5113
5253
|
/* @__PURE__ */ jsx45(Breadcrumb13, { children: /* @__PURE__ */ jsxs40(BreadcrumbList13, { children: [
|
|
@@ -5116,7 +5256,7 @@ function WebhooksEndpointsPage() {
|
|
|
5116
5256
|
/* @__PURE__ */ jsx45(BreadcrumbItem13, { children: /* @__PURE__ */ jsx45(BreadcrumbPage13, { children: "Endpoints" }) })
|
|
5117
5257
|
] }) })
|
|
5118
5258
|
] }) }),
|
|
5119
|
-
/* @__PURE__ */ jsxs40("div", { className:
|
|
5259
|
+
/* @__PURE__ */ jsxs40("div", { className: `flex flex-1 flex-col gap-4 px-4 sm:px-16 py-4 ${hideHeader ? "" : "pt-0"} ${className ?? ""}`, children: [
|
|
5120
5260
|
/* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between", children: [
|
|
5121
5261
|
/* @__PURE__ */ jsxs40("div", { children: [
|
|
5122
5262
|
/* @__PURE__ */ jsx45("h1", { className: "text-2xl font-bold", children: "Endpoints" }),
|
|
@@ -5140,7 +5280,7 @@ function WebhooksEndpointsPage() {
|
|
|
5140
5280
|
Input9,
|
|
5141
5281
|
{
|
|
5142
5282
|
id: "url",
|
|
5143
|
-
placeholder: "https://api.example.com/webhooks",
|
|
5283
|
+
placeholder: "https://api.example.com.ai/webhooks",
|
|
5144
5284
|
value: formUrl,
|
|
5145
5285
|
onChange: (e) => setFormUrl(e.target.value)
|
|
5146
5286
|
}
|
|
@@ -5294,7 +5434,7 @@ function WebhooksEndpointsPage() {
|
|
|
5294
5434
|
Input9,
|
|
5295
5435
|
{
|
|
5296
5436
|
id: "edit-url",
|
|
5297
|
-
placeholder: "https://api.example.com/webhooks",
|
|
5437
|
+
placeholder: "https://api.example.com.ai/webhooks",
|
|
5298
5438
|
value: formUrl,
|
|
5299
5439
|
onChange: (e) => setFormUrl(e.target.value)
|
|
5300
5440
|
}
|
|
@@ -5512,7 +5652,6 @@ function formatLatency2(ms) {
|
|
|
5512
5652
|
return `${ms}ms`;
|
|
5513
5653
|
}
|
|
5514
5654
|
function WebhooksLogsPage() {
|
|
5515
|
-
var _a;
|
|
5516
5655
|
const [statusFilter, setStatusFilter] = useState22("all");
|
|
5517
5656
|
const [selectedLog, setSelectedLog] = useState22(null);
|
|
5518
5657
|
const [sheetOpen, setSheetOpen] = useState22(false);
|
|
@@ -5527,11 +5666,11 @@ function WebhooksLogsPage() {
|
|
|
5527
5666
|
setSheetOpen(true);
|
|
5528
5667
|
setCopiedUrl(false);
|
|
5529
5668
|
};
|
|
5530
|
-
const handleCopyUrl = (url) =>
|
|
5531
|
-
|
|
5669
|
+
const handleCopyUrl = async (url) => {
|
|
5670
|
+
await navigator.clipboard.writeText(url);
|
|
5532
5671
|
setCopiedUrl(true);
|
|
5533
5672
|
setTimeout(() => setCopiedUrl(false), 2e3);
|
|
5534
|
-
}
|
|
5673
|
+
};
|
|
5535
5674
|
const handleRetry = () => {
|
|
5536
5675
|
toast8.success("Webhook retry triggered", {
|
|
5537
5676
|
description: "The webhook delivery will be retried shortly."
|
|
@@ -5556,7 +5695,7 @@ function WebhooksLogsPage() {
|
|
|
5556
5695
|
] }),
|
|
5557
5696
|
/* @__PURE__ */ jsxs42(DropdownMenu9, { children: [
|
|
5558
5697
|
/* @__PURE__ */ jsx47(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs42(Button19, { variant: "outline", className: "w-[140px] justify-between", children: [
|
|
5559
|
-
|
|
5698
|
+
statusFilterOptions2.find((o) => o.value === statusFilter)?.label,
|
|
5560
5699
|
/* @__PURE__ */ jsx47(ChevronDown4, { className: "h-4 w-4 opacity-50" })
|
|
5561
5700
|
] }) }),
|
|
5562
5701
|
/* @__PURE__ */ jsx47(DropdownMenuContent9, { align: "end", className: "w-[140px]", children: statusFilterOptions2.map((option) => /* @__PURE__ */ jsx47(DropdownMenuItem9, { onClick: () => setStatusFilter(option.value), children: option.label }, option.value)) })
|
|
@@ -5673,6 +5812,7 @@ function DashboardRouter({ basePath = "/", children }) {
|
|
|
5673
5812
|
}
|
|
5674
5813
|
function DashboardRoutes() {
|
|
5675
5814
|
const routes = useRoutes();
|
|
5815
|
+
const customRoutes = useCustomRoutes();
|
|
5676
5816
|
return /* @__PURE__ */ jsx48(Routes, { children: /* @__PURE__ */ jsxs43(Route, { element: /* @__PURE__ */ jsx48(DashboardLayout, {}), children: [
|
|
5677
5817
|
routes.overview && /* @__PURE__ */ jsx48(Route, { index: true, element: /* @__PURE__ */ jsx48(OverviewPage, {}) }),
|
|
5678
5818
|
routes.requests && /* @__PURE__ */ jsx48(Route, { path: "requests", element: /* @__PURE__ */ jsx48(RequestsPage, {}) }),
|
|
@@ -5695,25 +5835,185 @@ function DashboardRoutes() {
|
|
|
5695
5835
|
routes.database && /* @__PURE__ */ jsx48(Route, { path: "database", element: /* @__PURE__ */ jsx48(DatabasePage, {}) }),
|
|
5696
5836
|
routes.integrations && /* @__PURE__ */ jsx48(Route, { path: "integrations", element: /* @__PURE__ */ jsx48(IntegrationsPage, {}) }),
|
|
5697
5837
|
routes.vault && /* @__PURE__ */ jsx48(Route, { path: "vault", element: /* @__PURE__ */ jsx48(VaultPage, {}) }),
|
|
5698
|
-
|
|
5838
|
+
customRoutes.map((route) => /* @__PURE__ */ jsx48(
|
|
5839
|
+
Route,
|
|
5840
|
+
{
|
|
5841
|
+
path: route.path.startsWith("/") ? route.path.slice(1) : route.path,
|
|
5842
|
+
index: route.index,
|
|
5843
|
+
element: route.element
|
|
5844
|
+
},
|
|
5845
|
+
route.path
|
|
5846
|
+
)),
|
|
5847
|
+
(() => {
|
|
5848
|
+
const indexRoute = customRoutes.find((r) => r.index);
|
|
5849
|
+
const fallbackPath = indexRoute?.path || customRoutes[0]?.path || "/";
|
|
5850
|
+
return /* @__PURE__ */ jsx48(Route, { path: "*", element: /* @__PURE__ */ jsx48(Navigate, { to: fallbackPath, replace: true }) });
|
|
5851
|
+
})()
|
|
5699
5852
|
] }) });
|
|
5700
5853
|
}
|
|
5701
5854
|
|
|
5702
5855
|
// src/developer/developer-dashboard.tsx
|
|
5703
5856
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
5704
|
-
function
|
|
5857
|
+
function propsToConfig(props) {
|
|
5858
|
+
const routes = {
|
|
5859
|
+
overview: props.routes?.overview ?? true,
|
|
5860
|
+
requests: props.routes?.requests ?? props.showLogs ?? props.showUsage ?? true,
|
|
5861
|
+
keys: props.routes?.keys ?? props.showAPIKeys ?? true,
|
|
5862
|
+
team: props.routes?.team ?? true,
|
|
5863
|
+
billing: props.routes?.billing ?? true,
|
|
5864
|
+
settings: props.routes?.settings ?? true,
|
|
5865
|
+
webhooks: props.routes?.webhooks ?? props.showWebhooks ?? false,
|
|
5866
|
+
database: props.routes?.database ?? false,
|
|
5867
|
+
integrations: props.routes?.integrations ?? false,
|
|
5868
|
+
vault: props.routes?.vault ?? false
|
|
5869
|
+
};
|
|
5870
|
+
const customRoutes = props.customRoutes?.map((route) => ({
|
|
5871
|
+
path: route.path,
|
|
5872
|
+
label: route.label,
|
|
5873
|
+
icon: route.icon ? getIconByName(route.icon) : void 0,
|
|
5874
|
+
element: route.element,
|
|
5875
|
+
group: route.group,
|
|
5876
|
+
order: route.order,
|
|
5877
|
+
index: route.index
|
|
5878
|
+
}));
|
|
5879
|
+
const identity = props.identity ?? {
|
|
5880
|
+
clientId: "demo",
|
|
5881
|
+
useMockWidgets: true,
|
|
5882
|
+
required: false,
|
|
5883
|
+
onUnauthenticated: "allow"
|
|
5884
|
+
};
|
|
5885
|
+
return {
|
|
5886
|
+
basePath: props.basePath ?? "/",
|
|
5887
|
+
branding: props.branding,
|
|
5888
|
+
routes,
|
|
5889
|
+
customRoutes,
|
|
5890
|
+
theme: props.theme,
|
|
5891
|
+
identity,
|
|
5892
|
+
devToken: props.devToken,
|
|
5893
|
+
debug: props.debug
|
|
5894
|
+
};
|
|
5895
|
+
}
|
|
5896
|
+
function isLegacyConfig(props) {
|
|
5897
|
+
return "config" in props && props.config !== void 0;
|
|
5898
|
+
}
|
|
5899
|
+
function DeveloperDashboard(props) {
|
|
5900
|
+
const config = isLegacyConfig(props) ? props.config : propsToConfig(props);
|
|
5705
5901
|
return /* @__PURE__ */ jsx49(AppProviders, { config, children: /* @__PURE__ */ jsx49(AuthGate, { children: /* @__PURE__ */ jsx49(DashboardRouter, { basePath: config.basePath, children: /* @__PURE__ */ jsx49(DashboardRoutes, {}) }) }) });
|
|
5706
5902
|
}
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5903
|
+
|
|
5904
|
+
// src/developer/standalone/provider.tsx
|
|
5905
|
+
import { ThemeProvider as ThemeProvider2 } from "next-themes";
|
|
5906
|
+
import { applyThemeToElement as applyThemeToElement2 } from "@mdxui/themes";
|
|
5907
|
+
import { useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
5908
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5909
|
+
function StandaloneProvider({ config, children }) {
|
|
5910
|
+
const themeMode = config?.theme?.mode ?? "system";
|
|
5911
|
+
const containerRef = useRef3(null);
|
|
5912
|
+
useEffect10(() => {
|
|
5913
|
+
if (containerRef.current && config?.theme?.preset) {
|
|
5914
|
+
const resolvedMode = config.theme.mode === "system" ? "light" : config.theme.mode ?? "light";
|
|
5915
|
+
applyThemeToElement2(containerRef.current, config.theme.preset, resolvedMode);
|
|
5916
|
+
}
|
|
5917
|
+
}, [config?.theme]);
|
|
5918
|
+
return /* @__PURE__ */ jsx50(
|
|
5919
|
+
ThemeProvider2,
|
|
5920
|
+
{
|
|
5921
|
+
attribute: "class",
|
|
5922
|
+
defaultTheme: themeMode,
|
|
5923
|
+
enableSystem: themeMode === "system",
|
|
5924
|
+
disableTransitionOnChange: true,
|
|
5925
|
+
children: /* @__PURE__ */ jsx50("div", { ref: containerRef, className: "standalone-provider", children })
|
|
5926
|
+
}
|
|
5927
|
+
);
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5930
|
+
// src/developer/standalone/api-keys.tsx
|
|
5931
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
5932
|
+
function StandaloneAPIKeys({
|
|
5933
|
+
keys,
|
|
5934
|
+
onCreateKey,
|
|
5935
|
+
onRevokeKey,
|
|
5936
|
+
onRenameKey,
|
|
5937
|
+
hideHeader = true,
|
|
5938
|
+
className
|
|
5939
|
+
}) {
|
|
5940
|
+
return /* @__PURE__ */ jsx51(
|
|
5941
|
+
KeysPage,
|
|
5942
|
+
{
|
|
5943
|
+
keys,
|
|
5944
|
+
onCreateKey,
|
|
5945
|
+
onRevokeKey,
|
|
5946
|
+
onRenameKey,
|
|
5947
|
+
hideHeader,
|
|
5948
|
+
className
|
|
5949
|
+
}
|
|
5950
|
+
);
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5953
|
+
// src/developer/standalone/webhooks.tsx
|
|
5954
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
5955
|
+
function StandaloneWebhooks({
|
|
5956
|
+
endpoints,
|
|
5957
|
+
onCreateEndpoint,
|
|
5958
|
+
onUpdateEndpoint,
|
|
5959
|
+
onDeleteEndpoint,
|
|
5960
|
+
hideHeader = true,
|
|
5961
|
+
className
|
|
5962
|
+
}) {
|
|
5963
|
+
return /* @__PURE__ */ jsx52(
|
|
5964
|
+
WebhooksEndpointsPage,
|
|
5965
|
+
{
|
|
5966
|
+
endpoints,
|
|
5967
|
+
onCreateEndpoint,
|
|
5968
|
+
onUpdateEndpoint,
|
|
5969
|
+
onDeleteEndpoint,
|
|
5970
|
+
hideHeader,
|
|
5971
|
+
className
|
|
5972
|
+
}
|
|
5973
|
+
);
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
// src/developer/standalone/billing.tsx
|
|
5977
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
5978
|
+
function StandaloneBilling({
|
|
5979
|
+
billingData,
|
|
5980
|
+
onManagePlan,
|
|
5981
|
+
onUpdatePaymentMethod,
|
|
5982
|
+
onDownloadInvoice,
|
|
5983
|
+
onToggleAlerts,
|
|
5984
|
+
hideHeader = true,
|
|
5985
|
+
className
|
|
5986
|
+
}) {
|
|
5987
|
+
return /* @__PURE__ */ jsx53(
|
|
5988
|
+
BillingPage,
|
|
5989
|
+
{
|
|
5990
|
+
billingData,
|
|
5991
|
+
onManagePlan,
|
|
5992
|
+
onUpdatePaymentMethod,
|
|
5993
|
+
onDownloadInvoice,
|
|
5994
|
+
onToggleAlerts,
|
|
5995
|
+
hideHeader,
|
|
5996
|
+
className
|
|
5997
|
+
}
|
|
5998
|
+
);
|
|
5999
|
+
}
|
|
6000
|
+
|
|
6001
|
+
// src/developer/standalone/team.tsx
|
|
6002
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
6003
|
+
function StandaloneTeam({
|
|
6004
|
+
useMockWidgets,
|
|
6005
|
+
hideHeader = true,
|
|
6006
|
+
className
|
|
6007
|
+
}) {
|
|
6008
|
+
return /* @__PURE__ */ jsx54(
|
|
6009
|
+
TeamPage,
|
|
6010
|
+
{
|
|
6011
|
+
useMockWidgets,
|
|
6012
|
+
hideHeader,
|
|
6013
|
+
className
|
|
6014
|
+
}
|
|
6015
|
+
);
|
|
6016
|
+
}
|
|
5717
6017
|
export {
|
|
5718
6018
|
APIKeyManager,
|
|
5719
6019
|
ActivityFeed,
|
|
@@ -5748,12 +6048,17 @@ export {
|
|
|
5748
6048
|
SettingsSessionsPage,
|
|
5749
6049
|
SidebarAd,
|
|
5750
6050
|
SortableHeader,
|
|
6051
|
+
StandaloneAPIKeys,
|
|
6052
|
+
StandaloneBilling,
|
|
6053
|
+
StandaloneProvider,
|
|
6054
|
+
StandaloneTeam,
|
|
6055
|
+
StandaloneWebhooks,
|
|
5751
6056
|
StatusBadge,
|
|
5752
6057
|
StatusDot,
|
|
5753
6058
|
TeamManager,
|
|
5754
6059
|
TeamPage,
|
|
5755
6060
|
TeamSwitcher,
|
|
5756
|
-
|
|
6061
|
+
ThemeScript,
|
|
5757
6062
|
UserProfile,
|
|
5758
6063
|
VaultDeleteDialog,
|
|
5759
6064
|
VaultEmptyState,
|
|
@@ -5765,27 +6070,30 @@ export {
|
|
|
5765
6070
|
WebhooksEndpointsPage,
|
|
5766
6071
|
WebhooksEventCatalogPage,
|
|
5767
6072
|
WebhooksLogsPage,
|
|
5768
|
-
|
|
6073
|
+
applyThemeToElement3 as applyThemeToElement,
|
|
6074
|
+
dashboardIcons,
|
|
5769
6075
|
getAuthToken,
|
|
5770
6076
|
getDebugStatus,
|
|
5771
6077
|
getEffectiveToken,
|
|
5772
|
-
|
|
6078
|
+
getIconByName,
|
|
6079
|
+
getResolvedMode,
|
|
5773
6080
|
getSDK,
|
|
5774
|
-
|
|
5775
|
-
|
|
6081
|
+
getThemeCSS,
|
|
6082
|
+
getThemeScriptContent,
|
|
5776
6083
|
isAuthenticated,
|
|
5777
6084
|
isDebugMode,
|
|
5778
|
-
|
|
6085
|
+
isThemePreset,
|
|
5779
6086
|
setDebugMode,
|
|
5780
6087
|
setDevToken,
|
|
5781
6088
|
testSDKConnection,
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
6089
|
+
themeCSS,
|
|
6090
|
+
themeNames,
|
|
6091
|
+
themePresets,
|
|
5785
6092
|
useAuth10 as useAuth,
|
|
5786
6093
|
useCommandPalette,
|
|
6094
|
+
useCustomRoutes,
|
|
5787
6095
|
useDashboard,
|
|
5788
6096
|
useRoutes,
|
|
5789
|
-
|
|
6097
|
+
useThemeStore
|
|
5790
6098
|
};
|
|
5791
6099
|
//# sourceMappingURL=index.js.map
|