@carlonicora/nextjs-jsonapi 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssistantInterface-DMh-zApr.d.mts +34 -0
- package/dist/AssistantInterface-DwdBzS9f.d.ts +34 -0
- package/dist/{BlockNoteEditor-4224DOTR.js → BlockNoteEditor-C5CYCS3I.js} +22 -20
- package/dist/BlockNoteEditor-C5CYCS3I.js.map +1 -0
- package/dist/{BlockNoteEditor-7NVXRTVR.mjs → BlockNoteEditor-NXDUGMP7.mjs} +7 -5
- package/dist/BlockNoteEditor-NXDUGMP7.mjs.map +1 -0
- package/dist/{BlockNoteViewer-UW5VZ5UF.js → BlockNoteViewer-6N2GQWTI.js} +4 -2
- package/dist/BlockNoteViewer-6N2GQWTI.js.map +1 -0
- package/dist/{BlockNoteViewer-OPSCTHKJ.mjs → BlockNoteViewer-IBQRJ3WM.mjs} +4 -2
- package/dist/BlockNoteViewer-IBQRJ3WM.mjs.map +1 -0
- package/dist/billing/index.js +357 -357
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-DS4IBFWA.js → chunk-6YIZX26T.js} +185 -33
- package/dist/chunk-6YIZX26T.js.map +1 -0
- package/dist/{chunk-TESVH5PV.mjs → chunk-A7AGXKZX.mjs} +1100 -738
- package/dist/chunk-A7AGXKZX.mjs.map +1 -0
- package/dist/{chunk-QS5Y6ZBF.js → chunk-I3GHIU4Y.js} +1258 -896
- package/dist/chunk-I3GHIU4Y.js.map +1 -0
- package/dist/{chunk-UXJAS6C5.js → chunk-JG7MCYCW.js} +7 -7
- package/dist/{chunk-UXJAS6C5.js.map → chunk-JG7MCYCW.js.map} +1 -1
- package/dist/{chunk-HN5ED7OF.mjs → chunk-MAWTFEY3.mjs} +2 -2
- package/dist/{chunk-BIL2WQEV.mjs → chunk-P5TMD7GK.mjs} +158 -6
- package/dist/chunk-P5TMD7GK.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +102 -11
- package/dist/components/index.d.ts +102 -11
- package/dist/components/index.js +12 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -3
- package/dist/contexts/index.d.mts +29 -3
- package/dist/contexts/index.d.ts +29 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +99 -2
- package/dist/core/index.d.ts +99 -2
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +71 -71
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +5 -1
- package/src/components/editors/BlockNoteEditorSuggestionMenuController.tsx +14 -2
- package/src/components/index.ts +1 -0
- package/src/components/viewers/BlockNoteViewer.tsx +5 -1
- package/src/core/index.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +1 -0
- package/src/features/assistant/components/containers/AssistantPageContainer.tsx +123 -0
- package/src/features/assistant/components/index.ts +2 -0
- package/src/features/assistant/components/parts/AssistantBlockNoteComposer.tsx +135 -0
- package/src/features/assistant/components/parts/AssistantThread.tsx +4 -1
- package/src/features/assistant/contexts/AssistantContext.tsx +60 -13
- package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +81 -0
- package/src/features/assistant/data/Assistant.ts +29 -1
- package/src/features/assistant/data/AssistantInterface.ts +15 -0
- package/src/features/assistant/data/AssistantService.ts +19 -2
- package/src/features/assistant/data/__tests__/Assistant.scope.spec.ts +64 -0
- package/src/features/assistant-action/AssistantActionModule.ts +13 -0
- package/src/features/assistant-action/components/ApprovalActionCard.tsx +127 -0
- package/src/features/assistant-action/components/AssistantContainerWithApprovals.tsx +34 -0
- package/src/features/assistant-action/components/index.ts +2 -0
- package/src/features/assistant-action/data/AssistantAction.ts +58 -0
- package/src/features/assistant-action/data/AssistantActionInterface.ts +24 -0
- package/src/features/assistant-action/data/AssistantActionService.ts +51 -0
- package/src/features/assistant-action/data/__tests__/AssistantAction.spec.ts +171 -0
- package/src/features/assistant-action/data/index.ts +3 -0
- package/src/features/assistant-action/index.ts +2 -0
- package/src/features/assistant-message/components/MessageItem.tsx +57 -6
- package/src/features/assistant-message/components/MessageList.tsx +11 -2
- package/src/features/assistant-message/components/__tests__/MessageItem.mentions.spec.tsx +34 -0
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +30 -13
- package/src/features/assistant-message/components/parts/tabs/CitationsTab.tsx +23 -5
- package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +3 -1
- package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +4 -1
- package/src/features/assistant-message/components/parts/tabs/useEntityLabel.ts +35 -0
- package/src/features/assistant-message/data/AssistantMessage.ts +11 -2
- package/src/features/company/components/details/TokenStatusIndicator.tsx +19 -14
- package/src/features/index.ts +1 -0
- package/dist/AssistantInterface-B56qznuH.d.mts +0 -16
- package/dist/AssistantInterface-CHiJIYDY.d.ts +0 -16
- package/dist/BlockNoteEditor-4224DOTR.js.map +0 -1
- package/dist/BlockNoteEditor-7NVXRTVR.mjs.map +0 -1
- package/dist/BlockNoteViewer-OPSCTHKJ.mjs.map +0 -1
- package/dist/BlockNoteViewer-UW5VZ5UF.js.map +0 -1
- package/dist/chunk-BIL2WQEV.mjs.map +0 -1
- package/dist/chunk-DS4IBFWA.js.map +0 -1
- package/dist/chunk-QS5Y6ZBF.js.map +0 -1
- package/dist/chunk-TESVH5PV.mjs.map +0 -1
- /package/dist/{chunk-HN5ED7OF.mjs.map → chunk-MAWTFEY3.mjs.map} +0 -0
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
useI18nLocale,
|
|
21
21
|
useI18nRouter,
|
|
22
22
|
useI18nTranslations
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MAWTFEY3.mjs";
|
|
24
24
|
import {
|
|
25
25
|
AVAILABLE_OAUTH_SCOPES,
|
|
26
|
+
AssistantActionService,
|
|
26
27
|
AssistantMessage,
|
|
27
28
|
AssistantMessageService,
|
|
28
29
|
AssistantService,
|
|
@@ -67,7 +68,7 @@ import {
|
|
|
67
68
|
useIsMobile,
|
|
68
69
|
validateItalianTaxCode,
|
|
69
70
|
validatePartitaIva
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-P5TMD7GK.mjs";
|
|
71
72
|
import {
|
|
72
73
|
JsonApiContext
|
|
73
74
|
} from "./chunk-VOXD3ZLY.mjs";
|
|
@@ -10164,7 +10165,7 @@ import { useRef as useRef17 } from "react";
|
|
|
10164
10165
|
import dynamic from "next/dynamic";
|
|
10165
10166
|
import React17 from "react";
|
|
10166
10167
|
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
10167
|
-
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-
|
|
10168
|
+
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-NXDUGMP7.mjs"), {
|
|
10168
10169
|
ssr: false
|
|
10169
10170
|
});
|
|
10170
10171
|
var BlockNoteEditorContainer = React17.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
|
|
@@ -12259,21 +12260,21 @@ function TokenStatusIndicator({ className, size = "md", showExtraPages = true })
|
|
|
12259
12260
|
] })
|
|
12260
12261
|
] });
|
|
12261
12262
|
return /* @__PURE__ */ jsxs75(Tooltip2, { children: [
|
|
12262
|
-
/* @__PURE__ */
|
|
12263
|
-
|
|
12263
|
+
/* @__PURE__ */ jsxs75(
|
|
12264
|
+
TooltipTrigger,
|
|
12264
12265
|
{
|
|
12265
12266
|
className: cn("inline-flex items-center gap-1.5 cursor-default", className),
|
|
12266
12267
|
"aria-label": t("billing.tokens.status", { defaultValue: "Page Status" }),
|
|
12267
12268
|
children: [
|
|
12268
12269
|
getBatteryIcon(),
|
|
12269
|
-
/* @__PURE__ */ jsx127("span", { className: cn(textSize, "text-muted-foreground font-medium"), children: availableMonthlyCredits }),
|
|
12270
|
-
showExtraPages && availableExtraCredits > 0 && /* @__PURE__ */ jsxs75("
|
|
12270
|
+
/* @__PURE__ */ jsx127("span", { className: cn(textSize, "text-muted-foreground font-medium leading-none"), children: availableMonthlyCredits }),
|
|
12271
|
+
showExtraPages && availableExtraCredits > 0 && /* @__PURE__ */ jsxs75("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
12271
12272
|
/* @__PURE__ */ jsx127(PlusCircle, { className: cn(smallIconSize, "text-blue-500") }),
|
|
12272
|
-
/* @__PURE__ */ jsx127("span", { className: cn(textSize, "text-blue-500 font-medium"), children: availableExtraCredits })
|
|
12273
|
+
/* @__PURE__ */ jsx127("span", { className: cn(textSize, "text-blue-500 font-medium leading-none"), children: availableExtraCredits })
|
|
12273
12274
|
] })
|
|
12274
12275
|
]
|
|
12275
12276
|
}
|
|
12276
|
-
)
|
|
12277
|
+
),
|
|
12277
12278
|
/* @__PURE__ */ jsx127(TooltipContent, { side: "top", className: "max-w-xs", children: tooltipContent })
|
|
12278
12279
|
] });
|
|
12279
12280
|
}
|
|
@@ -13924,9 +13925,22 @@ function withPatchedTitle(source, title) {
|
|
|
13924
13925
|
});
|
|
13925
13926
|
}
|
|
13926
13927
|
__name(withPatchedTitle, "withPatchedTitle");
|
|
13927
|
-
function AssistantProvider({
|
|
13928
|
+
function AssistantProvider({
|
|
13929
|
+
children,
|
|
13930
|
+
dehydratedAssistant,
|
|
13931
|
+
dehydratedMessages,
|
|
13932
|
+
manageUrl = true,
|
|
13933
|
+
titleOverride,
|
|
13934
|
+
breadcrumbsOverride,
|
|
13935
|
+
scope,
|
|
13936
|
+
threadUrl
|
|
13937
|
+
}) {
|
|
13928
13938
|
const t = useTranslations48();
|
|
13929
13939
|
const generateUrl = usePageUrlGenerator();
|
|
13940
|
+
const resolveThreadUrl = useCallback26(
|
|
13941
|
+
(id) => threadUrl ? threadUrl(id) : id ? `/assistants/${id}` : "/assistants",
|
|
13942
|
+
[threadUrl]
|
|
13943
|
+
);
|
|
13930
13944
|
const [assistant, setAssistant] = useState44(
|
|
13931
13945
|
() => dehydratedAssistant ? rehydrate(Modules.Assistant, dehydratedAssistant) : void 0
|
|
13932
13946
|
);
|
|
@@ -13964,7 +13978,9 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
13964
13978
|
const input = {
|
|
13965
13979
|
firstMessage: trimmed,
|
|
13966
13980
|
howToMode: opts?.howToMode,
|
|
13967
|
-
limitToHowToId: opts?.limitToHowToId
|
|
13981
|
+
limitToHowToId: opts?.limitToHowToId,
|
|
13982
|
+
contentBlocks: opts?.contentBlocks,
|
|
13983
|
+
boundContent: scope
|
|
13968
13984
|
};
|
|
13969
13985
|
const created = operatorMode ? await AssistantService.createOperator(input) : await AssistantService.create(input);
|
|
13970
13986
|
const msgs = await AssistantMessageService.findByAssistant({ assistantId: created.id });
|
|
@@ -13972,17 +13988,19 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
13972
13988
|
setMessages(msgs);
|
|
13973
13989
|
setThreads((prev) => [created, ...prev]);
|
|
13974
13990
|
if (manageUrl && typeof window !== "undefined") {
|
|
13975
|
-
window.history.replaceState(null, "",
|
|
13991
|
+
window.history.replaceState(null, "", resolveThreadUrl(created.id));
|
|
13976
13992
|
}
|
|
13977
13993
|
} else {
|
|
13978
13994
|
const result = operatorMode ? await AssistantService.appendMessageOperator({
|
|
13979
13995
|
assistantId: assistant.id,
|
|
13980
|
-
content: trimmed
|
|
13996
|
+
content: trimmed,
|
|
13997
|
+
contentBlocks: opts?.contentBlocks
|
|
13981
13998
|
}) : await AssistantService.appendMessage({
|
|
13982
13999
|
assistantId: assistant.id,
|
|
13983
14000
|
content: trimmed,
|
|
13984
14001
|
howToMode: opts?.howToMode,
|
|
13985
|
-
limitToHowToId: opts?.limitToHowToId
|
|
14002
|
+
limitToHowToId: opts?.limitToHowToId,
|
|
14003
|
+
contentBlocks: opts?.contentBlocks
|
|
13986
14004
|
});
|
|
13987
14005
|
setMessages((prev) => [...stripOptimistic(prev), ...result]);
|
|
13988
14006
|
}
|
|
@@ -13998,7 +14016,7 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
13998
14016
|
setStatus(void 0);
|
|
13999
14017
|
}
|
|
14000
14018
|
},
|
|
14001
|
-
[assistant, messages, socket, operatorMode]
|
|
14019
|
+
[assistant, messages, socket, operatorMode, scope, manageUrl, resolveThreadUrl]
|
|
14002
14020
|
);
|
|
14003
14021
|
const appendResolvedMessage = useCallback26((message) => {
|
|
14004
14022
|
setMessages((prev) => prev.some((m) => m.id === message.id) ? prev : [...prev, message]);
|
|
@@ -14028,10 +14046,10 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
14028
14046
|
setMessages(msgs);
|
|
14029
14047
|
setOperatorMode(target.engine === "operator");
|
|
14030
14048
|
if (manageUrl && typeof window !== "undefined") {
|
|
14031
|
-
window.history.replaceState(null, "",
|
|
14049
|
+
window.history.replaceState(null, "", resolveThreadUrl(id));
|
|
14032
14050
|
}
|
|
14033
14051
|
},
|
|
14034
|
-
[manageUrl]
|
|
14052
|
+
[manageUrl, resolveThreadUrl]
|
|
14035
14053
|
);
|
|
14036
14054
|
const renameThread = useCallback26(async (id, title2) => {
|
|
14037
14055
|
await AssistantService.rename({ id, title: title2 });
|
|
@@ -14044,9 +14062,9 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
14044
14062
|
setFailedMessageIds(/* @__PURE__ */ new Set());
|
|
14045
14063
|
setOperatorMode(false);
|
|
14046
14064
|
if (manageUrl && typeof window !== "undefined") {
|
|
14047
|
-
window.history.replaceState(null, "",
|
|
14065
|
+
window.history.replaceState(null, "", resolveThreadUrl());
|
|
14048
14066
|
}
|
|
14049
|
-
}, [manageUrl]);
|
|
14067
|
+
}, [manageUrl, resolveThreadUrl]);
|
|
14050
14068
|
const deleteThread = useCallback26(async (id) => {
|
|
14051
14069
|
await AssistantService.delete({ id });
|
|
14052
14070
|
setThreads((prev) => prev.filter((t2) => t2.id !== id));
|
|
@@ -14063,7 +14081,7 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
14063
14081
|
(async () => {
|
|
14064
14082
|
setThreadsLoading(true);
|
|
14065
14083
|
try {
|
|
14066
|
-
const loaded = await AssistantService.findMany();
|
|
14084
|
+
const loaded = await AssistantService.findMany({ boundType: scope?.type, boundId: scope?.id });
|
|
14067
14085
|
if (!cancelled) setThreads(loaded);
|
|
14068
14086
|
} finally {
|
|
14069
14087
|
if (!cancelled) setThreadsLoading(false);
|
|
@@ -14072,7 +14090,7 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
14072
14090
|
return () => {
|
|
14073
14091
|
cancelled = true;
|
|
14074
14092
|
};
|
|
14075
|
-
}, []);
|
|
14093
|
+
}, [scope?.type, scope?.id]);
|
|
14076
14094
|
const value = useMemo20(
|
|
14077
14095
|
() => ({
|
|
14078
14096
|
assistant,
|
|
@@ -14110,14 +14128,14 @@ function AssistantProvider({ children, dehydratedAssistant, dehydratedMessages,
|
|
|
14110
14128
|
appendResolvedMessage
|
|
14111
14129
|
]
|
|
14112
14130
|
);
|
|
14113
|
-
const breadcrumbs = [
|
|
14131
|
+
const breadcrumbs = breadcrumbsOverride ?? [
|
|
14114
14132
|
{
|
|
14115
14133
|
name: t("entities.assistants", { count: 2 }),
|
|
14116
14134
|
href: generateUrl({ page: Modules.Assistant })
|
|
14117
14135
|
}
|
|
14118
14136
|
];
|
|
14119
14137
|
const title = {
|
|
14120
|
-
type: t("entities.
|
|
14138
|
+
type: titleOverride ?? t("entities.assistants", { count: 2 })
|
|
14121
14139
|
};
|
|
14122
14140
|
return /* @__PURE__ */ jsx147(AssistantContext.Provider, { value, children: /* @__PURE__ */ jsx147(SharedProvider, { value: { breadcrumbs, title }, children }) });
|
|
14123
14141
|
}
|
|
@@ -15553,6 +15571,8 @@ function BlockNoteEditorMentionSuggestionMenu({
|
|
|
15553
15571
|
async (query) => {
|
|
15554
15572
|
const results = await mentionSearchFn(query, mentionSearchParams);
|
|
15555
15573
|
const items = results.map((item) => ({
|
|
15574
|
+
id: item.id,
|
|
15575
|
+
entityType: item.entityType,
|
|
15556
15576
|
title: item.name,
|
|
15557
15577
|
subtext: item.entityType,
|
|
15558
15578
|
icon: item.icon,
|
|
@@ -15571,7 +15591,7 @@ function BlockNoteEditorMentionSuggestionMenu({
|
|
|
15571
15591
|
}, "onItemClick")
|
|
15572
15592
|
}));
|
|
15573
15593
|
if (items.length === 0) {
|
|
15574
|
-
items.push({ title: KEEP_OPEN_SENTINEL_TITLE, onItemClick: /* @__PURE__ */ __name(() => {
|
|
15594
|
+
items.push({ id: KEEP_OPEN_SENTINEL_TITLE, title: KEEP_OPEN_SENTINEL_TITLE, onItemClick: /* @__PURE__ */ __name(() => {
|
|
15575
15595
|
}, "onItemClick") });
|
|
15576
15596
|
}
|
|
15577
15597
|
return items;
|
|
@@ -15621,7 +15641,7 @@ __name(BlockNoteEditorMentionSuggestionMenu, "BlockNoteEditorMentionSuggestionMe
|
|
|
15621
15641
|
import dynamic2 from "next/dynamic";
|
|
15622
15642
|
import React28 from "react";
|
|
15623
15643
|
import { jsx as jsx167 } from "react/jsx-runtime";
|
|
15624
|
-
var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-
|
|
15644
|
+
var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-IBQRJ3WM.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
|
|
15625
15645
|
var BlockNoteViewerContainer = React28.memo(/* @__PURE__ */ __name(function ViewerContainer(props) {
|
|
15626
15646
|
return /* @__PURE__ */ jsx167(BlockNoteViewer, { ...props });
|
|
15627
15647
|
}, "ViewerContainer"));
|
|
@@ -19973,9 +19993,10 @@ __name(AssistantThreadHeader, "AssistantThreadHeader");
|
|
|
19973
19993
|
import { useEffect as useEffect65, useRef as useRef36 } from "react";
|
|
19974
19994
|
|
|
19975
19995
|
// src/features/assistant-message/components/MessageItem.tsx
|
|
19976
|
-
import { useTranslations as
|
|
19996
|
+
import { useTranslations as useTranslations96 } from "next-intl";
|
|
19977
19997
|
import { Sparkles as Sparkles2, AlertCircle } from "lucide-react";
|
|
19978
|
-
import
|
|
19998
|
+
import { useMemo as useMemo37 } from "react";
|
|
19999
|
+
import ReactMarkdown3, { defaultUrlTransform } from "react-markdown";
|
|
19979
20000
|
import remarkGfm3 from "remark-gfm";
|
|
19980
20001
|
|
|
19981
20002
|
// src/features/assistant-message/components/parts/MessageSourcesContainer.tsx
|
|
@@ -19983,16 +20004,39 @@ import { useEffect as useEffect64, useMemo as useMemo36, useState as useState87
|
|
|
19983
20004
|
|
|
19984
20005
|
// src/features/assistant-message/components/parts/MessageSourcesPanel.tsx
|
|
19985
20006
|
import { useMemo as useMemo35, useState as useState86 } from "react";
|
|
19986
|
-
import { useTranslations as
|
|
20007
|
+
import { useTranslations as useTranslations95 } from "next-intl";
|
|
19987
20008
|
import { ChevronDown as ChevronDown4, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
19988
20009
|
|
|
19989
20010
|
// src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx
|
|
19990
|
-
import { useTranslations as
|
|
20011
|
+
import { useTranslations as useTranslations91 } from "next-intl";
|
|
19991
20012
|
import Link4 from "next/link";
|
|
20013
|
+
|
|
20014
|
+
// src/features/assistant-message/components/parts/tabs/useEntityLabel.ts
|
|
20015
|
+
import { useTranslations as useTranslations90 } from "next-intl";
|
|
20016
|
+
import { useCallback as useCallback40 } from "react";
|
|
20017
|
+
function useEntityLabel() {
|
|
20018
|
+
const t = useTranslations90();
|
|
20019
|
+
return useCallback40(
|
|
20020
|
+
(type) => {
|
|
20021
|
+
const key = `entities.${type}`;
|
|
20022
|
+
if (typeof t.has === "function" && !t.has(key)) return type;
|
|
20023
|
+
try {
|
|
20024
|
+
return t(key, { count: 1 });
|
|
20025
|
+
} catch {
|
|
20026
|
+
return type;
|
|
20027
|
+
}
|
|
20028
|
+
},
|
|
20029
|
+
[t]
|
|
20030
|
+
);
|
|
20031
|
+
}
|
|
20032
|
+
__name(useEntityLabel, "useEntityLabel");
|
|
20033
|
+
|
|
20034
|
+
// src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx
|
|
19992
20035
|
import { jsx as jsx227, jsxs as jsxs135 } from "react/jsx-runtime";
|
|
19993
20036
|
function ReferencesTab({ references }) {
|
|
19994
|
-
const t =
|
|
20037
|
+
const t = useTranslations91();
|
|
19995
20038
|
const generate = usePageUrlGenerator();
|
|
20039
|
+
const entityLabel = useEntityLabel();
|
|
19996
20040
|
if (references.length === 0) return null;
|
|
19997
20041
|
return /* @__PURE__ */ jsxs135(Table, { children: [
|
|
19998
20042
|
/* @__PURE__ */ jsx227(TableHeader, { children: /* @__PURE__ */ jsxs135(TableRow, { children: [
|
|
@@ -20011,7 +20055,7 @@ function ReferencesTab({ references }) {
|
|
|
20011
20055
|
const href = howToType && slug ? `/help/${howToType}/${slug}` : generate({ page: module, id: ref.id });
|
|
20012
20056
|
return /* @__PURE__ */ jsxs135(TableRow, { children: [
|
|
20013
20057
|
/* @__PURE__ */ jsx227(TableCell, { children: /* @__PURE__ */ jsx227(Link4, { href, target: "_blank", rel: "noopener noreferrer", className: "font-medium", children: ref.identifier }) }),
|
|
20014
|
-
/* @__PURE__ */ jsx227(TableCell, { className: "text-muted-foreground text-xs", children: module.name })
|
|
20058
|
+
/* @__PURE__ */ jsx227(TableCell, { className: "text-muted-foreground text-xs", children: entityLabel(module.name) })
|
|
20015
20059
|
] }, `${ref.type}/${ref.id}`);
|
|
20016
20060
|
}) })
|
|
20017
20061
|
] });
|
|
@@ -20020,7 +20064,7 @@ __name(ReferencesTab, "ReferencesTab");
|
|
|
20020
20064
|
|
|
20021
20065
|
// src/features/assistant-message/components/parts/tabs/CitationsTab.tsx
|
|
20022
20066
|
import { Fragment as Fragment46, useState as useState85 } from "react";
|
|
20023
|
-
import { useTranslations as
|
|
20067
|
+
import { useTranslations as useTranslations92 } from "next-intl";
|
|
20024
20068
|
import { ChevronDown as ChevronDown3, HelpCircle } from "lucide-react";
|
|
20025
20069
|
import ReactMarkdown2 from "react-markdown";
|
|
20026
20070
|
import remarkGfm2 from "remark-gfm";
|
|
@@ -20057,7 +20101,8 @@ __name(RelevanceMeter, "RelevanceMeter");
|
|
|
20057
20101
|
// src/features/assistant-message/components/parts/tabs/CitationsTab.tsx
|
|
20058
20102
|
import { jsx as jsx229, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
20059
20103
|
function CitationsTab({ citations, sources }) {
|
|
20060
|
-
const t =
|
|
20104
|
+
const t = useTranslations92();
|
|
20105
|
+
const entityLabel = useEntityLabel();
|
|
20061
20106
|
const [expanded, setExpanded] = useState85(/* @__PURE__ */ new Set());
|
|
20062
20107
|
if (citations.length === 0) return null;
|
|
20063
20108
|
const sorted = [...citations].sort((a, b) => (b.relevance ?? 0) - (a.relevance ?? 0));
|
|
@@ -20077,7 +20122,8 @@ function CitationsTab({ citations, sources }) {
|
|
|
20077
20122
|
/* @__PURE__ */ jsx229(TableBody, { children: sorted.map((chunk) => {
|
|
20078
20123
|
const isOpen = expanded.has(chunk.id);
|
|
20079
20124
|
const resolved = chunk.nodeId ? sources?.get(chunk.nodeId) : void 0;
|
|
20080
|
-
const
|
|
20125
|
+
const typeLabel = chunk.nodeType ? entityLabel(chunk.nodeType) : t("features.assistant.message.sources.source");
|
|
20126
|
+
const fallbackName = chunk.nodeId ? `${typeLabel} ${chunk.nodeId.slice(0, 8)}` : typeLabel;
|
|
20081
20127
|
const sourceName = resolved?.name ?? fallbackName;
|
|
20082
20128
|
return /* @__PURE__ */ jsxs137(Fragment46, { children: [
|
|
20083
20129
|
/* @__PURE__ */ jsxs137(TableRow, { children: [
|
|
@@ -20107,7 +20153,7 @@ function CitationsTab({ citations, sources }) {
|
|
|
20107
20153
|
) }),
|
|
20108
20154
|
/* @__PURE__ */ jsx229(TableCell, { className: "text-center", children: /* @__PURE__ */ jsx229(RelevanceMeter, { value: chunk.relevance ?? 0 }) })
|
|
20109
20155
|
] }),
|
|
20110
|
-
isOpen && /* @__PURE__ */ jsx229(TableRow, { children: /* @__PURE__ */ jsx229(TableCell, { colSpan: 2, className: "border-t-0 p-4", children: /* @__PURE__ */ jsx229("div", { className: "bg-card w-full
|
|
20156
|
+
isOpen && /* @__PURE__ */ jsx229(TableRow, { children: /* @__PURE__ */ jsx229(TableCell, { colSpan: 2, className: "w-full max-w-0 border-t-0 p-4", children: /* @__PURE__ */ jsx229("div", { className: "bg-card w-full min-w-0 rounded border p-4 text-sm break-words whitespace-pre-wrap [overflow-wrap:anywhere] [&_pre]:overflow-x-auto [&_table]:block [&_table]:overflow-x-auto", children: /* @__PURE__ */ jsx229(ReactMarkdown2, { remarkPlugins: [remarkGfm2], children: chunk.content }) }) }) })
|
|
20111
20157
|
] }, chunk.id);
|
|
20112
20158
|
}) })
|
|
20113
20159
|
] });
|
|
@@ -20115,11 +20161,12 @@ function CitationsTab({ citations, sources }) {
|
|
|
20115
20161
|
__name(CitationsTab, "CitationsTab");
|
|
20116
20162
|
|
|
20117
20163
|
// src/features/assistant-message/components/parts/tabs/ContentsTab.tsx
|
|
20118
|
-
import { useTranslations as
|
|
20164
|
+
import { useTranslations as useTranslations93 } from "next-intl";
|
|
20119
20165
|
import Link5 from "next/link";
|
|
20120
20166
|
import { jsx as jsx230, jsxs as jsxs138 } from "react/jsx-runtime";
|
|
20121
20167
|
function ContentsTab({ citations, sources }) {
|
|
20122
|
-
const t =
|
|
20168
|
+
const t = useTranslations93();
|
|
20169
|
+
const entityLabel = useEntityLabel();
|
|
20123
20170
|
const generate = usePageUrlGenerator();
|
|
20124
20171
|
const map = /* @__PURE__ */ new Map();
|
|
20125
20172
|
for (const c of citations) {
|
|
@@ -20163,7 +20210,7 @@ function ContentsTab({ citations, sources }) {
|
|
|
20163
20210
|
count: citationCount
|
|
20164
20211
|
}) })
|
|
20165
20212
|
] }) }),
|
|
20166
|
-
/* @__PURE__ */ jsx230(TableCell, { className: "text-muted-foreground text-xs", children: module.name })
|
|
20213
|
+
/* @__PURE__ */ jsx230(TableCell, { className: "text-muted-foreground text-xs", children: entityLabel(module.name) })
|
|
20167
20214
|
] }, `${source.type}/${source.id}`);
|
|
20168
20215
|
}) })
|
|
20169
20216
|
] });
|
|
@@ -20171,7 +20218,7 @@ function ContentsTab({ citations, sources }) {
|
|
|
20171
20218
|
__name(ContentsTab, "ContentsTab");
|
|
20172
20219
|
|
|
20173
20220
|
// src/features/assistant-message/components/parts/tabs/UsersTab.tsx
|
|
20174
|
-
import { useTranslations as
|
|
20221
|
+
import { useTranslations as useTranslations94 } from "next-intl";
|
|
20175
20222
|
import Link6 from "next/link";
|
|
20176
20223
|
import { jsx as jsx231, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
20177
20224
|
function getInitials2(name) {
|
|
@@ -20188,7 +20235,7 @@ function readAuthor(source) {
|
|
|
20188
20235
|
}
|
|
20189
20236
|
__name(readAuthor, "readAuthor");
|
|
20190
20237
|
function UsersTab({ users, citations, sources }) {
|
|
20191
|
-
const t =
|
|
20238
|
+
const t = useTranslations94();
|
|
20192
20239
|
const generate = usePageUrlGenerator();
|
|
20193
20240
|
const userMap = /* @__PURE__ */ new Map();
|
|
20194
20241
|
for (const u of users) {
|
|
@@ -20274,7 +20321,7 @@ __name(SuggestedQuestionsTab, "SuggestedQuestionsTab");
|
|
|
20274
20321
|
// src/features/assistant-message/components/parts/MessageSourcesPanel.tsx
|
|
20275
20322
|
import { jsx as jsx233, jsxs as jsxs140 } from "react/jsx-runtime";
|
|
20276
20323
|
function MessageSourcesPanel({ message, isLatestAssistant, onSelectFollowUp, sources, users }) {
|
|
20277
|
-
const t =
|
|
20324
|
+
const t = useTranslations95();
|
|
20278
20325
|
const visibleReferences = useMemo35(
|
|
20279
20326
|
() => message.references.filter((ref) => {
|
|
20280
20327
|
try {
|
|
@@ -20354,16 +20401,19 @@ var SourcesFetcher = class extends ClientAbstractService {
|
|
|
20354
20401
|
__name(this, "SourcesFetcher");
|
|
20355
20402
|
}
|
|
20356
20403
|
static async findManyByIds(params) {
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20404
|
+
return this.findEachById(params);
|
|
20405
|
+
}
|
|
20406
|
+
static async findEachById(params) {
|
|
20407
|
+
const settled = await Promise.allSettled(
|
|
20408
|
+
params.ids.map(
|
|
20409
|
+
(id) => this.callApi({
|
|
20410
|
+
type: params.module,
|
|
20411
|
+
method: "GET" /* GET */,
|
|
20412
|
+
endpoint: new EndpointCreator({ endpoint: params.module, id }).generate()
|
|
20413
|
+
})
|
|
20414
|
+
)
|
|
20415
|
+
);
|
|
20416
|
+
return settled.filter((r) => r.status === "fulfilled" && !!r.value).map((r) => r.value);
|
|
20367
20417
|
}
|
|
20368
20418
|
};
|
|
20369
20419
|
function MessageSourcesContainer({ message, isLatestAssistant, onSelectFollowUp }) {
|
|
@@ -20455,21 +20505,37 @@ function MessageSourcesContainer({ message, isLatestAssistant, onSelectFollowUp
|
|
|
20455
20505
|
__name(MessageSourcesContainer, "MessageSourcesContainer");
|
|
20456
20506
|
|
|
20457
20507
|
// src/features/assistant-message/components/MessageItem.tsx
|
|
20458
|
-
import { jsx as jsx235, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
20508
|
+
import { Fragment as Fragment47, jsx as jsx235, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
20509
|
+
var MENTION_HREF = /^mention:\/\/([^/]+)\/(.+)$/;
|
|
20510
|
+
function mentionUrlTransform(url) {
|
|
20511
|
+
return MENTION_HREF.test(url) ? url : defaultUrlTransform(url);
|
|
20512
|
+
}
|
|
20513
|
+
__name(mentionUrlTransform, "mentionUrlTransform");
|
|
20459
20514
|
function MessageItem({
|
|
20460
20515
|
message,
|
|
20461
20516
|
isLatestAssistant,
|
|
20462
20517
|
onSelectFollowUp,
|
|
20463
20518
|
failedMessageIds,
|
|
20464
20519
|
onRetry,
|
|
20465
|
-
renderApprovalAction
|
|
20520
|
+
renderApprovalAction,
|
|
20521
|
+
renderMention
|
|
20466
20522
|
}) {
|
|
20467
|
-
const t =
|
|
20523
|
+
const t = useTranslations96();
|
|
20468
20524
|
const isUser = message.role === "user";
|
|
20469
20525
|
const isFailed = isUser && !!failedMessageIds?.has(message.id);
|
|
20526
|
+
const markdownComponents = useMemo37(
|
|
20527
|
+
() => ({
|
|
20528
|
+
a: /* @__PURE__ */ __name(({ href, children }) => {
|
|
20529
|
+
const match = href ? MENTION_HREF.exec(href) : null;
|
|
20530
|
+
if (!match || !renderMention) return /* @__PURE__ */ jsx235("a", { href, children });
|
|
20531
|
+
return /* @__PURE__ */ jsx235(Fragment47, { children: renderMention({ type: match[1], id: match[2], alias: String(children ?? "") }) });
|
|
20532
|
+
}, "a")
|
|
20533
|
+
}),
|
|
20534
|
+
[renderMention]
|
|
20535
|
+
);
|
|
20470
20536
|
if (isUser) {
|
|
20471
20537
|
return /* @__PURE__ */ jsxs141("div", { className: "flex flex-col items-end gap-1", children: [
|
|
20472
|
-
/* @__PURE__ */ jsx235("div", { className: "bg-primary text-primary-foreground max-w-[72%] rounded-2xl rounded-br-sm px-3.5 py-2 text-sm", children: message.content }),
|
|
20538
|
+
/* @__PURE__ */ jsx235("div", { className: "bg-primary text-primary-foreground max-w-[72%] rounded-2xl rounded-br-sm px-3.5 py-2 text-sm [&_a]:text-primary-foreground [&_a]:font-semibold [&_p]:m-0", children: /* @__PURE__ */ jsx235(ReactMarkdown3, { remarkPlugins: [remarkGfm3], urlTransform: mentionUrlTransform, components: markdownComponents, children: message.content }) }),
|
|
20473
20539
|
isFailed && /* @__PURE__ */ jsxs141("div", { className: "text-destructive flex items-center gap-2 text-xs", children: [
|
|
20474
20540
|
/* @__PURE__ */ jsx235(AlertCircle, { className: "h-3.5 w-3.5" }),
|
|
20475
20541
|
/* @__PURE__ */ jsx235("span", { children: t("features.assistant.send_failed") }),
|
|
@@ -20483,7 +20549,13 @@ function MessageItem({
|
|
|
20483
20549
|
/* @__PURE__ */ jsx235("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-gradient-to-br from-blue-400 to-violet-500 text-white", children: /* @__PURE__ */ jsx235(Sparkles2, { className: "h-2.5 w-2.5" }) }),
|
|
20484
20550
|
/* @__PURE__ */ jsx235("span", { children: t("features.assistant.agent_name") })
|
|
20485
20551
|
] }),
|
|
20486
|
-
isApprovalRequest ? renderApprovalAction(message) :
|
|
20552
|
+
isApprovalRequest ? renderApprovalAction(message) : (
|
|
20553
|
+
// Markdown blocks arrive unstyled under Tailwind preflight (all margins
|
|
20554
|
+
// zeroed): restore flow spacing between sibling blocks and give
|
|
20555
|
+
// blockquotes a callout treatment — assistant answers use them for
|
|
20556
|
+
// proposals and asides that must stand apart from factual prose.
|
|
20557
|
+
/* @__PURE__ */ jsx235("div", { className: "bg-muted text-foreground rounded-2xl rounded-bl-sm px-3.5 py-2.5 text-sm leading-relaxed [&>*+*]:mt-3 [&_blockquote]:border-l-2 [&_blockquote]:border-primary/50 [&_blockquote]:bg-primary/5 [&_blockquote]:rounded-md [&_blockquote]:px-3 [&_blockquote]:py-1.5", children: /* @__PURE__ */ jsx235(ReactMarkdown3, { remarkPlugins: [remarkGfm3], components: markdownComponents, urlTransform: mentionUrlTransform, children: message.content }) })
|
|
20558
|
+
),
|
|
20487
20559
|
/* @__PURE__ */ jsx235(
|
|
20488
20560
|
MessageSourcesContainer,
|
|
20489
20561
|
{
|
|
@@ -20498,7 +20570,14 @@ __name(MessageItem, "MessageItem");
|
|
|
20498
20570
|
|
|
20499
20571
|
// src/features/assistant-message/components/MessageList.tsx
|
|
20500
20572
|
import { jsx as jsx236 } from "react/jsx-runtime";
|
|
20501
|
-
function MessageList({
|
|
20573
|
+
function MessageList({
|
|
20574
|
+
messages,
|
|
20575
|
+
onSelectFollowUp,
|
|
20576
|
+
failedMessageIds,
|
|
20577
|
+
onRetry,
|
|
20578
|
+
renderApprovalAction,
|
|
20579
|
+
renderMention
|
|
20580
|
+
}) {
|
|
20502
20581
|
const ordered = [...messages].sort((a, b) => a.position - b.position);
|
|
20503
20582
|
let lastAssistantIndex = -1;
|
|
20504
20583
|
for (let i = ordered.length - 1; i >= 0; i--) {
|
|
@@ -20515,7 +20594,8 @@ function MessageList({ messages, onSelectFollowUp, failedMessageIds, onRetry, re
|
|
|
20515
20594
|
onSelectFollowUp,
|
|
20516
20595
|
failedMessageIds,
|
|
20517
20596
|
onRetry,
|
|
20518
|
-
renderApprovalAction
|
|
20597
|
+
renderApprovalAction,
|
|
20598
|
+
renderMention
|
|
20519
20599
|
},
|
|
20520
20600
|
m.id
|
|
20521
20601
|
)) });
|
|
@@ -20523,11 +20603,11 @@ function MessageList({ messages, onSelectFollowUp, failedMessageIds, onRetry, re
|
|
|
20523
20603
|
__name(MessageList, "MessageList");
|
|
20524
20604
|
|
|
20525
20605
|
// src/features/assistant/components/parts/AssistantStatusLine.tsx
|
|
20526
|
-
import { useTranslations as
|
|
20606
|
+
import { useTranslations as useTranslations97 } from "next-intl";
|
|
20527
20607
|
import { Loader2 as Loader25 } from "lucide-react";
|
|
20528
20608
|
import { jsx as jsx237, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
20529
20609
|
function AssistantStatusLine({ status }) {
|
|
20530
|
-
const t =
|
|
20610
|
+
const t = useTranslations97();
|
|
20531
20611
|
const text = status ?? t("features.assistant.thinking");
|
|
20532
20612
|
return /* @__PURE__ */ jsxs142("div", { className: "text-muted-foreground flex items-center gap-2 px-4 py-2 text-sm", children: [
|
|
20533
20613
|
/* @__PURE__ */ jsx237(Loader25, { className: "h-4 w-4 animate-spin" }),
|
|
@@ -20545,7 +20625,8 @@ function AssistantThread({
|
|
|
20545
20625
|
onSelectFollowUp,
|
|
20546
20626
|
failedMessageIds,
|
|
20547
20627
|
onRetry,
|
|
20548
|
-
renderApprovalAction
|
|
20628
|
+
renderApprovalAction,
|
|
20629
|
+
renderMention
|
|
20549
20630
|
}) {
|
|
20550
20631
|
const endRef = useRef36(null);
|
|
20551
20632
|
useEffect65(() => {
|
|
@@ -20559,7 +20640,8 @@ function AssistantThread({
|
|
|
20559
20640
|
onSelectFollowUp,
|
|
20560
20641
|
failedMessageIds,
|
|
20561
20642
|
onRetry,
|
|
20562
|
-
renderApprovalAction
|
|
20643
|
+
renderApprovalAction,
|
|
20644
|
+
renderMention
|
|
20563
20645
|
}
|
|
20564
20646
|
),
|
|
20565
20647
|
sending && /* @__PURE__ */ jsx238(AssistantStatusLine, { status }),
|
|
@@ -20569,7 +20651,7 @@ function AssistantThread({
|
|
|
20569
20651
|
__name(AssistantThread, "AssistantThread");
|
|
20570
20652
|
|
|
20571
20653
|
// src/features/assistant/components/containers/AssistantContainer.tsx
|
|
20572
|
-
import { Fragment as
|
|
20654
|
+
import { Fragment as Fragment48, jsx as jsx239, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
20573
20655
|
function AssistantContainer({ renderApprovalAction } = {}) {
|
|
20574
20656
|
const ctx = useAssistantContext();
|
|
20575
20657
|
const showThread = !!ctx.assistant || ctx.sending || ctx.messages.length > 0;
|
|
@@ -20590,7 +20672,7 @@ function AssistantContainer({ renderApprovalAction } = {}) {
|
|
|
20590
20672
|
operatorMode: ctx.operatorMode,
|
|
20591
20673
|
onOperatorModeChange: ctx.setOperatorMode
|
|
20592
20674
|
}
|
|
20593
|
-
) : /* @__PURE__ */ jsxs144(
|
|
20675
|
+
) : /* @__PURE__ */ jsxs144(Fragment48, { children: [
|
|
20594
20676
|
ctx.assistant ? /* @__PURE__ */ jsx239(
|
|
20595
20677
|
AssistantThreadHeader,
|
|
20596
20678
|
{
|
|
@@ -20617,9 +20699,285 @@ function AssistantContainer({ renderApprovalAction } = {}) {
|
|
|
20617
20699
|
}
|
|
20618
20700
|
__name(AssistantContainer, "AssistantContainer");
|
|
20619
20701
|
|
|
20702
|
+
// src/features/assistant/components/containers/AssistantPageContainer.tsx
|
|
20703
|
+
import { Sparkles as Sparkles3 } from "lucide-react";
|
|
20704
|
+
import { useTranslations as useTranslations99 } from "next-intl";
|
|
20705
|
+
|
|
20706
|
+
// src/features/assistant/components/parts/AssistantBlockNoteComposer.tsx
|
|
20707
|
+
import { ArrowUp as ArrowUp2 } from "lucide-react";
|
|
20708
|
+
import { useTranslations as useTranslations98 } from "next-intl";
|
|
20709
|
+
import { useCallback as useCallback41, useId as useId3, useState as useState88 } from "react";
|
|
20710
|
+
import { jsx as jsx240, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
20711
|
+
function flattenBlocks(blocks) {
|
|
20712
|
+
const lines = [];
|
|
20713
|
+
const readInline = /* @__PURE__ */ __name((inline) => {
|
|
20714
|
+
if (typeof inline === "string") return inline;
|
|
20715
|
+
if (!inline || typeof inline !== "object") return "";
|
|
20716
|
+
const node = inline;
|
|
20717
|
+
if (node.type === "mention") return node.props?.alias ?? "";
|
|
20718
|
+
if (typeof node.text === "string") return node.text;
|
|
20719
|
+
if (Array.isArray(node.content)) return node.content.map(readInline).join("");
|
|
20720
|
+
return "";
|
|
20721
|
+
}, "readInline");
|
|
20722
|
+
const readBlock = /* @__PURE__ */ __name((block) => {
|
|
20723
|
+
if (!block || typeof block !== "object") return;
|
|
20724
|
+
const node = block;
|
|
20725
|
+
if (Array.isArray(node.content)) {
|
|
20726
|
+
const line = node.content.map(readInline).join("").trim();
|
|
20727
|
+
if (line) lines.push(line);
|
|
20728
|
+
} else if (typeof node.content === "string" && node.content.trim()) {
|
|
20729
|
+
lines.push(node.content.trim());
|
|
20730
|
+
}
|
|
20731
|
+
if (Array.isArray(node.children)) node.children.forEach(readBlock);
|
|
20732
|
+
}, "readBlock");
|
|
20733
|
+
blocks.forEach(readBlock);
|
|
20734
|
+
return lines.join("\n");
|
|
20735
|
+
}
|
|
20736
|
+
__name(flattenBlocks, "flattenBlocks");
|
|
20737
|
+
function AssistantBlockNoteComposer({
|
|
20738
|
+
onSend,
|
|
20739
|
+
disabled,
|
|
20740
|
+
mentionSearchFn,
|
|
20741
|
+
mentionSearchParams,
|
|
20742
|
+
mentionResolveFn,
|
|
20743
|
+
suggestionMenuComponent
|
|
20744
|
+
}) {
|
|
20745
|
+
const t = useTranslations98();
|
|
20746
|
+
const editorId = useId3().replace(/[^a-zA-Z0-9]/g, "");
|
|
20747
|
+
const [blocks, setBlocks] = useState88([]);
|
|
20748
|
+
const [isEmpty, setIsEmpty] = useState88(true);
|
|
20749
|
+
const [resetKey, setResetKey] = useState88(0);
|
|
20750
|
+
const canSend = !isEmpty && !disabled;
|
|
20751
|
+
const submit = useCallback41(async () => {
|
|
20752
|
+
if (isEmpty || disabled) return;
|
|
20753
|
+
const payload = blocks;
|
|
20754
|
+
const plainText = flattenBlocks(payload);
|
|
20755
|
+
setBlocks([]);
|
|
20756
|
+
setIsEmpty(true);
|
|
20757
|
+
setResetKey((previous) => previous + 1);
|
|
20758
|
+
await onSend(plainText, { contentBlocks: payload });
|
|
20759
|
+
}, [blocks, disabled, isEmpty, onSend]);
|
|
20760
|
+
const handleKeyDownCapture = useCallback41(
|
|
20761
|
+
(event) => {
|
|
20762
|
+
if (event.key !== "Enter" || event.shiftKey) return;
|
|
20763
|
+
if (typeof document !== "undefined" && document.querySelector(".bn-suggestion-menu")) return;
|
|
20764
|
+
event.preventDefault();
|
|
20765
|
+
void submit();
|
|
20766
|
+
},
|
|
20767
|
+
[submit]
|
|
20768
|
+
);
|
|
20769
|
+
return /* @__PURE__ */ jsxs145("div", { className: "flex flex-col gap-1 border-t p-4", children: [
|
|
20770
|
+
/* @__PURE__ */ jsxs145("div", { className: "bg-muted/30 flex items-end gap-2 rounded-lg border p-2", children: [
|
|
20771
|
+
/* @__PURE__ */ jsx240("div", { className: "max-h-40 min-w-0 flex-1 overflow-y-auto", onKeyDownCapture: handleKeyDownCapture, children: /* @__PURE__ */ jsx240(
|
|
20772
|
+
BlockNoteEditorContainer,
|
|
20773
|
+
{
|
|
20774
|
+
id: editorId,
|
|
20775
|
+
type: "assistants",
|
|
20776
|
+
placeholder: t("features.assistant.composer_placeholder"),
|
|
20777
|
+
enableMentions: true,
|
|
20778
|
+
mentionSearchFn,
|
|
20779
|
+
mentionSearchParams,
|
|
20780
|
+
mentionResolveFn,
|
|
20781
|
+
suggestionMenuComponent,
|
|
20782
|
+
onChange: (content, empty) => {
|
|
20783
|
+
setBlocks(Array.isArray(content) ? content : []);
|
|
20784
|
+
setIsEmpty(empty);
|
|
20785
|
+
},
|
|
20786
|
+
className: "[&_.bn-container]:!p-0"
|
|
20787
|
+
},
|
|
20788
|
+
resetKey
|
|
20789
|
+
) }),
|
|
20790
|
+
/* @__PURE__ */ jsxs145(Button, { onClick: submit, disabled: !canSend, size: "sm", className: "h-8", children: [
|
|
20791
|
+
/* @__PURE__ */ jsx240(ArrowUp2, { className: "mr-1 h-4 w-4" }),
|
|
20792
|
+
" ",
|
|
20793
|
+
t("features.assistant.send")
|
|
20794
|
+
] })
|
|
20795
|
+
] }),
|
|
20796
|
+
/* @__PURE__ */ jsx240("div", { className: "text-muted-foreground text-right text-xs", children: t("features.assistant.keyboard_hint") })
|
|
20797
|
+
] });
|
|
20798
|
+
}
|
|
20799
|
+
__name(AssistantBlockNoteComposer, "AssistantBlockNoteComposer");
|
|
20800
|
+
|
|
20801
|
+
// src/features/assistant/components/containers/AssistantPageContainer.tsx
|
|
20802
|
+
import { Fragment as Fragment49, jsx as jsx241, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
20803
|
+
function AssistantPageContainer({
|
|
20804
|
+
renderApprovalAction,
|
|
20805
|
+
renderMention,
|
|
20806
|
+
mentionSearchFn,
|
|
20807
|
+
mentionSearchParams,
|
|
20808
|
+
mentionResolveFn,
|
|
20809
|
+
suggestionMenuComponent,
|
|
20810
|
+
detailsTitle,
|
|
20811
|
+
detailsIcon
|
|
20812
|
+
}) {
|
|
20813
|
+
const t = useTranslations99();
|
|
20814
|
+
const ctx = useAssistantContext();
|
|
20815
|
+
const showThread = !!ctx.assistant || ctx.sending || ctx.messages.length > 0;
|
|
20816
|
+
return /* @__PURE__ */ jsx241(
|
|
20817
|
+
RoundPageContainer,
|
|
20818
|
+
{
|
|
20819
|
+
module: Modules.Assistant,
|
|
20820
|
+
fullWidth: true,
|
|
20821
|
+
forceHeader: true,
|
|
20822
|
+
defaultDetailsOpen: true,
|
|
20823
|
+
detailsTitle,
|
|
20824
|
+
detailsIcon,
|
|
20825
|
+
details: (
|
|
20826
|
+
// The panel supplies its own padding and border; cancel both so the
|
|
20827
|
+
// sidebar reads as the panel body rather than a card inside it.
|
|
20828
|
+
/* @__PURE__ */ jsx241("div", { className: "-m-4 flex h-full min-h-0 [&>aside]:w-full [&>aside]:border-r-0 [&>aside]:bg-transparent", children: /* @__PURE__ */ jsx241(
|
|
20829
|
+
AssistantSidebar,
|
|
20830
|
+
{
|
|
20831
|
+
threads: ctx.threads,
|
|
20832
|
+
activeId: ctx.assistant?.id,
|
|
20833
|
+
onSelect: ctx.selectThread,
|
|
20834
|
+
onNew: ctx.startNew
|
|
20835
|
+
}
|
|
20836
|
+
) })
|
|
20837
|
+
),
|
|
20838
|
+
children: /* @__PURE__ */ jsxs146("div", { className: "bg-background flex h-full w-full flex-col overflow-hidden rounded-lg border", children: [
|
|
20839
|
+
showThread ? /* @__PURE__ */ jsxs146(Fragment49, { children: [
|
|
20840
|
+
ctx.assistant ? /* @__PURE__ */ jsx241(
|
|
20841
|
+
AssistantThreadHeader,
|
|
20842
|
+
{
|
|
20843
|
+
assistant: ctx.assistant,
|
|
20844
|
+
onRename: (title) => ctx.renameThread(ctx.assistant.id, title),
|
|
20845
|
+
onDelete: () => ctx.deleteThread(ctx.assistant.id)
|
|
20846
|
+
}
|
|
20847
|
+
) : /* @__PURE__ */ jsx241("div", { className: "flex items-center justify-between border-b px-5 py-3", "aria-hidden": true, children: /* @__PURE__ */ jsx241("div", { className: "h-5" }) }),
|
|
20848
|
+
/* @__PURE__ */ jsx241(
|
|
20849
|
+
AssistantThread,
|
|
20850
|
+
{
|
|
20851
|
+
messages: ctx.messages,
|
|
20852
|
+
sending: ctx.sending,
|
|
20853
|
+
status: ctx.status,
|
|
20854
|
+
onSelectFollowUp: ctx.sendMessage,
|
|
20855
|
+
failedMessageIds: ctx.failedMessageIds,
|
|
20856
|
+
onRetry: ctx.retrySend,
|
|
20857
|
+
renderApprovalAction,
|
|
20858
|
+
renderMention
|
|
20859
|
+
}
|
|
20860
|
+
)
|
|
20861
|
+
] }) : /* @__PURE__ */ jsx241("div", { className: "flex flex-1 items-center justify-center p-10", children: /* @__PURE__ */ jsxs146("div", { className: "flex max-w-2xl flex-col items-center text-center", children: [
|
|
20862
|
+
/* @__PURE__ */ jsx241("span", { className: "mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-blue-400 to-violet-500 text-white", children: /* @__PURE__ */ jsx241(Sparkles3, { className: "h-5 w-5" }) }),
|
|
20863
|
+
/* @__PURE__ */ jsx241(SectionHeader, { children: t("features.assistant.empty_state.title") }),
|
|
20864
|
+
/* @__PURE__ */ jsx241("p", { className: "text-muted-foreground mt-1 text-sm", children: t("features.assistant.empty_state.subtitle") })
|
|
20865
|
+
] }) }),
|
|
20866
|
+
/* @__PURE__ */ jsx241(
|
|
20867
|
+
AssistantBlockNoteComposer,
|
|
20868
|
+
{
|
|
20869
|
+
onSend: (content, opts) => ctx.sendMessage(content, { contentBlocks: opts.contentBlocks }),
|
|
20870
|
+
disabled: ctx.sending,
|
|
20871
|
+
mentionSearchFn,
|
|
20872
|
+
mentionSearchParams,
|
|
20873
|
+
mentionResolveFn,
|
|
20874
|
+
suggestionMenuComponent
|
|
20875
|
+
}
|
|
20876
|
+
)
|
|
20877
|
+
] })
|
|
20878
|
+
}
|
|
20879
|
+
);
|
|
20880
|
+
}
|
|
20881
|
+
__name(AssistantPageContainer, "AssistantPageContainer");
|
|
20882
|
+
|
|
20883
|
+
// src/features/assistant-action/components/ApprovalActionCard.tsx
|
|
20884
|
+
import { ShieldAlert as ShieldAlert2 } from "lucide-react";
|
|
20885
|
+
import { useTranslations as useTranslations100 } from "next-intl";
|
|
20886
|
+
import { useEffect as useEffect66, useState as useState89 } from "react";
|
|
20887
|
+
import { jsx as jsx242, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
20888
|
+
var STATUS_VARIANT = {
|
|
20889
|
+
pending: "softBlue",
|
|
20890
|
+
approved: "softBlue",
|
|
20891
|
+
executed: "softGreen",
|
|
20892
|
+
denied: "softRed",
|
|
20893
|
+
failed: "softRed",
|
|
20894
|
+
expired: "softGray"
|
|
20895
|
+
};
|
|
20896
|
+
var STATUS_LABEL_KEY = {
|
|
20897
|
+
pending: "features.assistant.approval.status.pending",
|
|
20898
|
+
approved: "features.assistant.approval.status.approved",
|
|
20899
|
+
executed: "features.assistant.approval.status.executed",
|
|
20900
|
+
denied: "features.assistant.approval.status.denied",
|
|
20901
|
+
failed: "features.assistant.approval.status.failed",
|
|
20902
|
+
expired: "features.assistant.approval.status.expired"
|
|
20903
|
+
};
|
|
20904
|
+
function ApprovalActionCard({ actionId, summary, onResolved }) {
|
|
20905
|
+
const t = useTranslations100();
|
|
20906
|
+
const [status, setStatus] = useState89(void 0);
|
|
20907
|
+
const [actionSummary, setActionSummary] = useState89(void 0);
|
|
20908
|
+
const [busy, setBusy] = useState89(false);
|
|
20909
|
+
const [failed, setFailed] = useState89(false);
|
|
20910
|
+
useEffect66(() => {
|
|
20911
|
+
let cancelled = false;
|
|
20912
|
+
(async () => {
|
|
20913
|
+
try {
|
|
20914
|
+
const action = await AssistantActionService.findOne({ id: actionId });
|
|
20915
|
+
if (cancelled || !action) return;
|
|
20916
|
+
setStatus(action.status);
|
|
20917
|
+
setActionSummary(action.summary);
|
|
20918
|
+
} catch (error) {
|
|
20919
|
+
console.error(`ApprovalActionCard: failed to fetch assistant action ${actionId}`, error);
|
|
20920
|
+
if (!cancelled) setFailed(true);
|
|
20921
|
+
}
|
|
20922
|
+
})();
|
|
20923
|
+
return () => {
|
|
20924
|
+
cancelled = true;
|
|
20925
|
+
};
|
|
20926
|
+
}, [actionId]);
|
|
20927
|
+
const actionable = status === "pending" && !busy && !failed;
|
|
20928
|
+
const resolve = /* @__PURE__ */ __name(async (kind) => {
|
|
20929
|
+
if (!actionable) return;
|
|
20930
|
+
setBusy(true);
|
|
20931
|
+
try {
|
|
20932
|
+
const message = kind === "approve" ? await AssistantActionService.approve({ id: actionId }) : await AssistantActionService.deny({ id: actionId });
|
|
20933
|
+
setStatus(kind === "approve" ? "executed" : "denied");
|
|
20934
|
+
if (message) onResolved?.(message);
|
|
20935
|
+
} catch (error) {
|
|
20936
|
+
console.error(`ApprovalActionCard: failed to ${kind} assistant action ${actionId}`, error);
|
|
20937
|
+
setFailed(true);
|
|
20938
|
+
} finally {
|
|
20939
|
+
setBusy(false);
|
|
20940
|
+
}
|
|
20941
|
+
}, "resolve");
|
|
20942
|
+
return /* @__PURE__ */ jsxs147("div", { className: "border-border bg-muted/30 flex flex-col gap-2 rounded-xl border p-3.5", children: [
|
|
20943
|
+
/* @__PURE__ */ jsxs147(MicroLabel, { className: "flex items-center gap-2", children: [
|
|
20944
|
+
/* @__PURE__ */ jsx242(ShieldAlert2, { className: "text-warning h-3.5 w-3.5" }),
|
|
20945
|
+
/* @__PURE__ */ jsx242("span", { children: t("features.assistant.approval.title") }),
|
|
20946
|
+
status && status !== "pending" && /* @__PURE__ */ jsx242(Badge, { variant: STATUS_VARIANT[status], className: "ml-auto tracking-normal normal-case", children: t(STATUS_LABEL_KEY[status]) })
|
|
20947
|
+
] }),
|
|
20948
|
+
/* @__PURE__ */ jsx242("div", { className: "text-foreground text-sm leading-relaxed", children: actionSummary ?? summary }),
|
|
20949
|
+
failed && /* @__PURE__ */ jsx242("div", { role: "alert", className: "text-destructive text-xs/relaxed", children: t("features.assistant.approval.error") }),
|
|
20950
|
+
/* @__PURE__ */ jsxs147("div", { className: "flex items-center gap-2 pt-1", children: [
|
|
20951
|
+
/* @__PURE__ */ jsx242(Button, { size: "sm", disabled: !actionable, onClick: () => void resolve("approve"), children: t("features.assistant.approval.approve") }),
|
|
20952
|
+
/* @__PURE__ */ jsx242(Button, { size: "sm", variant: "outline", disabled: !actionable, onClick: () => void resolve("deny"), children: t("features.assistant.approval.deny") })
|
|
20953
|
+
] })
|
|
20954
|
+
] });
|
|
20955
|
+
}
|
|
20956
|
+
__name(ApprovalActionCard, "ApprovalActionCard");
|
|
20957
|
+
|
|
20958
|
+
// src/features/assistant-action/components/AssistantContainerWithApprovals.tsx
|
|
20959
|
+
import { jsx as jsx243 } from "react/jsx-runtime";
|
|
20960
|
+
function AssistantContainerWithApprovals() {
|
|
20961
|
+
const ctx = useAssistantContext();
|
|
20962
|
+
return /* @__PURE__ */ jsx243(
|
|
20963
|
+
AssistantContainer,
|
|
20964
|
+
{
|
|
20965
|
+
renderApprovalAction: (message) => message.actionId ? /* @__PURE__ */ jsx243(
|
|
20966
|
+
ApprovalActionCard,
|
|
20967
|
+
{
|
|
20968
|
+
actionId: message.actionId,
|
|
20969
|
+
summary: message.content,
|
|
20970
|
+
onResolved: ctx.appendResolvedMessage
|
|
20971
|
+
}
|
|
20972
|
+
) : /* @__PURE__ */ jsx243("div", { className: "bg-muted text-foreground rounded-2xl rounded-bl-sm px-3.5 py-2.5 text-sm leading-relaxed", children: message.content })
|
|
20973
|
+
}
|
|
20974
|
+
);
|
|
20975
|
+
}
|
|
20976
|
+
__name(AssistantContainerWithApprovals, "AssistantContainerWithApprovals");
|
|
20977
|
+
|
|
20620
20978
|
// src/features/notification/components/common/NotificationErrorBoundary.tsx
|
|
20621
20979
|
import { Component } from "react";
|
|
20622
|
-
import { jsx as
|
|
20980
|
+
import { jsx as jsx244, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
20623
20981
|
var NotificationErrorBoundary = class extends Component {
|
|
20624
20982
|
static {
|
|
20625
20983
|
__name(this, "NotificationErrorBoundary");
|
|
@@ -20636,9 +20994,9 @@ var NotificationErrorBoundary = class extends Component {
|
|
|
20636
20994
|
}
|
|
20637
20995
|
render() {
|
|
20638
20996
|
if (this.state.hasError) {
|
|
20639
|
-
return this.props.fallback || /* @__PURE__ */
|
|
20640
|
-
/* @__PURE__ */
|
|
20641
|
-
/* @__PURE__ */
|
|
20997
|
+
return this.props.fallback || /* @__PURE__ */ jsx244("div", { className: "flex items-center justify-center p-4 text-center", children: /* @__PURE__ */ jsxs148("div", { className: "text-muted-foreground text-sm", children: [
|
|
20998
|
+
/* @__PURE__ */ jsx244("p", { children: "Something went wrong with notifications." }),
|
|
20999
|
+
/* @__PURE__ */ jsx244("button", { onClick: () => this.setState({ hasError: false }), className: "text-primary mt-2", children: "Try again" })
|
|
20642
21000
|
] }) });
|
|
20643
21001
|
}
|
|
20644
21002
|
return this.props.children;
|
|
@@ -20646,14 +21004,14 @@ var NotificationErrorBoundary = class extends Component {
|
|
|
20646
21004
|
};
|
|
20647
21005
|
|
|
20648
21006
|
// src/features/notification/components/containers/NotificationsListContainer.tsx
|
|
20649
|
-
import { useTranslations as
|
|
21007
|
+
import { useTranslations as useTranslations102 } from "next-intl";
|
|
20650
21008
|
|
|
20651
21009
|
// src/features/notification/components/lists/NotificationsList.tsx
|
|
20652
21010
|
import { ArchiveIcon } from "lucide-react";
|
|
20653
|
-
import { useTranslations as
|
|
20654
|
-
import { Fragment as
|
|
21011
|
+
import { useTranslations as useTranslations101 } from "next-intl";
|
|
21012
|
+
import { Fragment as Fragment50, jsx as jsx245, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
20655
21013
|
function NotificationsList({ archived }) {
|
|
20656
|
-
const t =
|
|
21014
|
+
const t = useTranslations101();
|
|
20657
21015
|
const generateUrl = usePageUrlGenerator();
|
|
20658
21016
|
const data = useDataListRetriever({
|
|
20659
21017
|
retriever: /* @__PURE__ */ __name((params) => NotificationService.findMany(params), "retriever"),
|
|
@@ -20664,30 +21022,30 @@ function NotificationsList({ archived }) {
|
|
|
20664
21022
|
await NotificationService.archive({ id: notification.id });
|
|
20665
21023
|
data.removeElement(notification);
|
|
20666
21024
|
}, "archiveNotification");
|
|
20667
|
-
const LoadingSkeleton = /* @__PURE__ */ __name(() => /* @__PURE__ */
|
|
20668
|
-
/* @__PURE__ */
|
|
20669
|
-
/* @__PURE__ */
|
|
20670
|
-
/* @__PURE__ */
|
|
20671
|
-
/* @__PURE__ */
|
|
21025
|
+
const LoadingSkeleton = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx245("div", { className: "space-y-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx245(Card, { children: /* @__PURE__ */ jsx245(CardContent, { className: "p-2", children: /* @__PURE__ */ jsxs149("div", { className: "flex w-full flex-row items-center", children: [
|
|
21026
|
+
/* @__PURE__ */ jsx245(Skeleton, { className: "mr-4 h-8 w-8 rounded-full" }),
|
|
21027
|
+
/* @__PURE__ */ jsxs149("div", { className: "flex-1 space-y-2", children: [
|
|
21028
|
+
/* @__PURE__ */ jsx245(Skeleton, { className: "h-4 w-3/4" }),
|
|
21029
|
+
/* @__PURE__ */ jsx245(Skeleton, { className: "h-3 w-1/2" })
|
|
20672
21030
|
] }),
|
|
20673
|
-
/* @__PURE__ */
|
|
21031
|
+
/* @__PURE__ */ jsx245(Skeleton, { className: "h-8 w-20" })
|
|
20674
21032
|
] }) }) }, i)) }), "LoadingSkeleton");
|
|
20675
|
-
return /* @__PURE__ */
|
|
21033
|
+
return /* @__PURE__ */ jsx245("div", { className: "space-y-4", children: data.isLoaded ? data.data?.map((notification) => {
|
|
20676
21034
|
const notificationData = generateNotificationData({ notification, generateUrl });
|
|
20677
|
-
return /* @__PURE__ */
|
|
20678
|
-
notificationData.actor ? /* @__PURE__ */
|
|
20679
|
-
/* @__PURE__ */
|
|
20680
|
-
/* @__PURE__ */
|
|
20681
|
-
strong: /* @__PURE__ */ __name((chunks) => /* @__PURE__ */
|
|
21035
|
+
return /* @__PURE__ */ jsx245(Card, { children: /* @__PURE__ */ jsx245(CardContent, { className: "p-0", children: /* @__PURE__ */ jsxs149("div", { className: `flex w-full flex-row items-center p-2`, children: [
|
|
21036
|
+
notificationData.actor ? /* @__PURE__ */ jsx245("div", { className: "flex w-12 max-w-12 px-2", children: /* @__PURE__ */ jsx245(Link, { href: generateUrl({ page: Modules.User, id: notificationData.actor.id }), children: /* @__PURE__ */ jsx245(UserAvatar, { user: notificationData.actor, className: "h-8 w-8" }) }) }) : /* @__PURE__ */ jsx245("div", { className: "flex w-14 max-w-14 px-2" }),
|
|
21037
|
+
/* @__PURE__ */ jsxs149("div", { className: "flex w-full flex-col", children: [
|
|
21038
|
+
/* @__PURE__ */ jsx245("p", { className: "text-sm", children: t.rich(`notification.${notification.notificationType}.description`, {
|
|
21039
|
+
strong: /* @__PURE__ */ __name((chunks) => /* @__PURE__ */ jsx245("strong", { children: chunks }), "strong"),
|
|
20682
21040
|
actor: notificationData.actor?.name ?? "",
|
|
20683
21041
|
title: notificationData.title
|
|
20684
21042
|
}) }),
|
|
20685
|
-
/* @__PURE__ */
|
|
21043
|
+
/* @__PURE__ */ jsx245("div", { className: "text-muted-foreground mt-1 w-full text-xs", children: new Date(notification.createdAt).toLocaleString() })
|
|
20686
21044
|
] }),
|
|
20687
|
-
/* @__PURE__ */
|
|
20688
|
-
notificationData.url ? /* @__PURE__ */
|
|
20689
|
-
!archived && /* @__PURE__ */
|
|
20690
|
-
/* @__PURE__ */
|
|
21045
|
+
/* @__PURE__ */ jsxs149("div", { className: "flex flex-row items-center", children: [
|
|
21046
|
+
notificationData.url ? /* @__PURE__ */ jsx245(Link, { href: notificationData.url, children: /* @__PURE__ */ jsx245(Button, { variant: `outline`, size: `sm`, onClick: (e) => e.stopPropagation(), children: t(`notification.${notification.notificationType}.buttons.action`) }) }) : /* @__PURE__ */ jsx245(Fragment50, {}),
|
|
21047
|
+
!archived && /* @__PURE__ */ jsxs149(Tooltip2, { children: [
|
|
21048
|
+
/* @__PURE__ */ jsx245(TooltipTrigger, { children: /* @__PURE__ */ jsx245(
|
|
20691
21049
|
Button,
|
|
20692
21050
|
{
|
|
20693
21051
|
variant: `link`,
|
|
@@ -20697,54 +21055,54 @@ function NotificationsList({ archived }) {
|
|
|
20697
21055
|
archiveNotification(notification);
|
|
20698
21056
|
},
|
|
20699
21057
|
className: "text-muted-foreground hover:text-destructive ml-2",
|
|
20700
|
-
children: /* @__PURE__ */
|
|
21058
|
+
children: /* @__PURE__ */ jsx245(ArchiveIcon, { className: "h-4 w-4 cursor-pointer" })
|
|
20701
21059
|
}
|
|
20702
21060
|
) }),
|
|
20703
|
-
/* @__PURE__ */
|
|
21061
|
+
/* @__PURE__ */ jsx245(TooltipContent, { children: t(`notification.buttons.archive`) })
|
|
20704
21062
|
] })
|
|
20705
21063
|
] })
|
|
20706
21064
|
] }) }) }, notification.id);
|
|
20707
|
-
}) : /* @__PURE__ */
|
|
21065
|
+
}) : /* @__PURE__ */ jsx245(LoadingSkeleton, {}) });
|
|
20708
21066
|
}
|
|
20709
21067
|
__name(NotificationsList, "NotificationsList");
|
|
20710
21068
|
|
|
20711
21069
|
// src/features/notification/components/containers/NotificationsListContainer.tsx
|
|
20712
|
-
import { jsx as
|
|
21070
|
+
import { jsx as jsx246, jsxs as jsxs150 } from "react/jsx-runtime";
|
|
20713
21071
|
function NotificationsListContainerContent() {
|
|
20714
|
-
const t =
|
|
21072
|
+
const t = useTranslations102();
|
|
20715
21073
|
const { notifications: _notifications, isLoading: _isLoading, error } = useNotificationContext();
|
|
20716
21074
|
if (error) {
|
|
20717
|
-
return /* @__PURE__ */
|
|
20718
|
-
/* @__PURE__ */
|
|
21075
|
+
return /* @__PURE__ */ jsx246("div", { className: "flex items-center justify-center p-8 text-center", children: /* @__PURE__ */ jsxs150("div", { className: "text-destructive text-xs/relaxed", children: [
|
|
21076
|
+
/* @__PURE__ */ jsxs150("p", { children: [
|
|
20719
21077
|
"Error loading notifications: ",
|
|
20720
21078
|
error
|
|
20721
21079
|
] }),
|
|
20722
|
-
/* @__PURE__ */
|
|
21080
|
+
/* @__PURE__ */ jsx246("p", { className: "text-muted-foreground mt-2", children: "Please try refreshing the page." })
|
|
20723
21081
|
] }) });
|
|
20724
21082
|
}
|
|
20725
21083
|
const tabs = [
|
|
20726
21084
|
{
|
|
20727
21085
|
label: t(`notification.inbox`),
|
|
20728
|
-
content: /* @__PURE__ */
|
|
21086
|
+
content: /* @__PURE__ */ jsx246(NotificationsList, { archived: false })
|
|
20729
21087
|
},
|
|
20730
21088
|
{
|
|
20731
21089
|
label: t(`notification.archived`),
|
|
20732
|
-
content: /* @__PURE__ */
|
|
21090
|
+
content: /* @__PURE__ */ jsx246(NotificationsList, { archived: true })
|
|
20733
21091
|
}
|
|
20734
21092
|
];
|
|
20735
|
-
return /* @__PURE__ */
|
|
21093
|
+
return /* @__PURE__ */ jsx246(TabsContainer, { tabs });
|
|
20736
21094
|
}
|
|
20737
21095
|
__name(NotificationsListContainerContent, "NotificationsListContainerContent");
|
|
20738
21096
|
function NotificationsListContainer() {
|
|
20739
|
-
return /* @__PURE__ */
|
|
21097
|
+
return /* @__PURE__ */ jsx246(NotificationErrorBoundary, { children: /* @__PURE__ */ jsx246(NotificationsListContainerContent, {}) });
|
|
20740
21098
|
}
|
|
20741
21099
|
__name(NotificationsListContainer, "NotificationsListContainer");
|
|
20742
21100
|
|
|
20743
21101
|
// src/features/notification/components/modals/NotificationModal.tsx
|
|
20744
21102
|
import { BellIcon } from "lucide-react";
|
|
20745
|
-
import { useTranslations as
|
|
20746
|
-
import { Fragment as
|
|
20747
|
-
import { jsx as
|
|
21103
|
+
import { useTranslations as useTranslations103 } from "next-intl";
|
|
21104
|
+
import { Fragment as Fragment51, useCallback as useCallback42, useEffect as useEffect67, useMemo as useMemo38, useRef as useRef37, useState as useState90 } from "react";
|
|
21105
|
+
import { jsx as jsx247, jsxs as jsxs151 } from "react/jsx-runtime";
|
|
20748
21106
|
function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
20749
21107
|
const _instanceId = useRef37(Math.random().toString(36).substr(2, 9));
|
|
20750
21108
|
const {
|
|
@@ -20763,16 +21121,16 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
|
20763
21121
|
removeSocketNotification: _removeSocketNotification,
|
|
20764
21122
|
clearSocketNotifications
|
|
20765
21123
|
} = useSocketContext();
|
|
20766
|
-
const t =
|
|
21124
|
+
const t = useTranslations103();
|
|
20767
21125
|
const generateUrl = usePageUrlGenerator();
|
|
20768
|
-
const [newNotifications, setNewNotifications] =
|
|
21126
|
+
const [newNotifications, setNewNotifications] = useState90(false);
|
|
20769
21127
|
const preventAutoClose = useRef37(false);
|
|
20770
21128
|
const circuitBreakerRef = useRef37({
|
|
20771
21129
|
count: 0,
|
|
20772
21130
|
resetTime: 0,
|
|
20773
21131
|
isOpen: false
|
|
20774
21132
|
});
|
|
20775
|
-
const checkCircuitBreaker =
|
|
21133
|
+
const checkCircuitBreaker = useCallback42(() => {
|
|
20776
21134
|
const now = Date.now();
|
|
20777
21135
|
const breaker = circuitBreakerRef.current;
|
|
20778
21136
|
if (now > breaker.resetTime) {
|
|
@@ -20787,18 +21145,18 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
|
20787
21145
|
}
|
|
20788
21146
|
return !breaker.isOpen;
|
|
20789
21147
|
}, []);
|
|
20790
|
-
const { unreadCount, unreadIds } =
|
|
21148
|
+
const { unreadCount, unreadIds } = useMemo38(() => {
|
|
20791
21149
|
const unreadNotifications2 = notifications.filter((notif) => !notif.isRead);
|
|
20792
21150
|
return {
|
|
20793
21151
|
unreadCount: unreadNotifications2.length,
|
|
20794
21152
|
unreadIds: unreadNotifications2.map((notif) => notif.id)
|
|
20795
21153
|
};
|
|
20796
21154
|
}, [notifications]);
|
|
20797
|
-
|
|
21155
|
+
useEffect67(() => {
|
|
20798
21156
|
setNewNotifications(unreadCount > 0);
|
|
20799
21157
|
}, [unreadCount]);
|
|
20800
21158
|
const processSocketNotificationsRef = useRef37(null);
|
|
20801
|
-
const processSocketNotifications =
|
|
21159
|
+
const processSocketNotifications = useCallback42(() => {
|
|
20802
21160
|
if (socketNotifications.length === 0) {
|
|
20803
21161
|
return;
|
|
20804
21162
|
}
|
|
@@ -20837,7 +21195,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
|
20837
21195
|
generateUrl,
|
|
20838
21196
|
checkCircuitBreaker
|
|
20839
21197
|
]);
|
|
20840
|
-
|
|
21198
|
+
useEffect67(() => {
|
|
20841
21199
|
if (processSocketNotificationsRef.current) {
|
|
20842
21200
|
clearTimeout(processSocketNotificationsRef.current);
|
|
20843
21201
|
}
|
|
@@ -20874,9 +21232,9 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
|
20874
21232
|
}
|
|
20875
21233
|
}, "handleOpenChange");
|
|
20876
21234
|
const unreadNotifications = newNotifications && unreadCount > 0;
|
|
20877
|
-
return /* @__PURE__ */
|
|
20878
|
-
/* @__PURE__ */
|
|
20879
|
-
/* @__PURE__ */
|
|
21235
|
+
return /* @__PURE__ */ jsxs151(Popover, { open: isOpen, onOpenChange: handleOpenChange, "data-testid": `sidebar-notification button`, children: [
|
|
21236
|
+
/* @__PURE__ */ jsx247(PopoverTrigger, { children: /* @__PURE__ */ jsxs151(SidebarMenuButton, { render: /* @__PURE__ */ jsx247("div", {}), className: "text-muted-foreground h-6", disabled: isLoading, children: [
|
|
21237
|
+
/* @__PURE__ */ jsx247(
|
|
20880
21238
|
BellIcon,
|
|
20881
21239
|
{
|
|
20882
21240
|
className: `h-5 w-5 cursor-pointer ${unreadNotifications ? "text-destructive" : ""} ${isLoading ? "animate-pulse" : ""}`
|
|
@@ -20884,37 +21242,37 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
|
|
|
20884
21242
|
),
|
|
20885
21243
|
t(`entities.notifications`, { count: 2 })
|
|
20886
21244
|
] }) }),
|
|
20887
|
-
/* @__PURE__ */
|
|
20888
|
-
/* @__PURE__ */
|
|
20889
|
-
/* @__PURE__ */
|
|
20890
|
-
isLoading && /* @__PURE__ */
|
|
20891
|
-
error && /* @__PURE__ */
|
|
21245
|
+
/* @__PURE__ */ jsx247(PopoverContent, { className: "relative left-10 w-80 border-0 p-0 shadow-none", children: /* @__PURE__ */ jsxs151(Card, { children: [
|
|
21246
|
+
/* @__PURE__ */ jsxs151(CardHeader, { className: "p-4", children: [
|
|
21247
|
+
/* @__PURE__ */ jsx247(CardTitle, { children: t(`entities.notifications`, { count: 2 }) }),
|
|
21248
|
+
isLoading && /* @__PURE__ */ jsx247("div", { className: "text-muted-foreground text-xs", children: "Loading..." }),
|
|
21249
|
+
error && /* @__PURE__ */ jsxs151("div", { className: "text-destructive text-xs/relaxed", children: [
|
|
20892
21250
|
"Error: ",
|
|
20893
21251
|
error
|
|
20894
21252
|
] })
|
|
20895
21253
|
] }),
|
|
20896
|
-
/* @__PURE__ */
|
|
20897
|
-
/* @__PURE__ */
|
|
21254
|
+
/* @__PURE__ */ jsx247(Separator, {}),
|
|
21255
|
+
/* @__PURE__ */ jsx247(ScrollArea, { className: "h-96", children: notifications.length > 0 ? notifications.map((notification) => /* @__PURE__ */ jsx247(Fragment51, { children: generateNotification(notification, () => setIsOpen(false)) }, notification.id)) : /* @__PURE__ */ jsx247("div", { className: "text-muted-foreground p-4 text-center text-sm", children: t(`notification.empty`) }) })
|
|
20898
21256
|
] }) })
|
|
20899
21257
|
] });
|
|
20900
21258
|
}
|
|
20901
21259
|
__name(NotificationModalContent, "NotificationModalContent");
|
|
20902
21260
|
function NotificationModal(props) {
|
|
20903
|
-
return /* @__PURE__ */
|
|
21261
|
+
return /* @__PURE__ */ jsx247(NotificationErrorBoundary, { children: /* @__PURE__ */ jsx247(NotificationModalContent, { ...props }) });
|
|
20904
21262
|
}
|
|
20905
21263
|
__name(NotificationModal, "NotificationModal");
|
|
20906
21264
|
|
|
20907
21265
|
// src/features/notification/components/notifications/PushNotificationProvider.tsx
|
|
20908
|
-
import { Fragment as
|
|
21266
|
+
import { Fragment as Fragment52, jsx as jsx248 } from "react/jsx-runtime";
|
|
20909
21267
|
function PushNotificationProvider({ children }) {
|
|
20910
21268
|
usePushNotifications();
|
|
20911
|
-
return /* @__PURE__ */
|
|
21269
|
+
return /* @__PURE__ */ jsx248(Fragment52, { children });
|
|
20912
21270
|
}
|
|
20913
21271
|
__name(PushNotificationProvider, "PushNotificationProvider");
|
|
20914
21272
|
|
|
20915
21273
|
// src/features/referral/components/ReferralCodeCapture.tsx
|
|
20916
21274
|
import { useSearchParams as useSearchParams5 } from "next/navigation";
|
|
20917
|
-
import { useEffect as
|
|
21275
|
+
import { useEffect as useEffect68 } from "react";
|
|
20918
21276
|
|
|
20919
21277
|
// src/features/referral/utils/referral-cookie.ts
|
|
20920
21278
|
function setReferralCode(code) {
|
|
@@ -20939,7 +21297,7 @@ __name(getReferralCode2, "getReferralCode");
|
|
|
20939
21297
|
// src/features/referral/components/ReferralCodeCapture.tsx
|
|
20940
21298
|
function ReferralCodeCapture() {
|
|
20941
21299
|
const searchParams = useSearchParams5();
|
|
20942
|
-
|
|
21300
|
+
useEffect68(() => {
|
|
20943
21301
|
if (!isReferralEnabled()) {
|
|
20944
21302
|
return;
|
|
20945
21303
|
}
|
|
@@ -20958,14 +21316,14 @@ __name(ReferralCodeCapture, "ReferralCodeCapture");
|
|
|
20958
21316
|
|
|
20959
21317
|
// src/features/referral/components/ReferralWidget.tsx
|
|
20960
21318
|
import { Copy as Copy2, Loader2 as Loader26, Mail, Users } from "lucide-react";
|
|
20961
|
-
import { useCallback as
|
|
21319
|
+
import { useCallback as useCallback43, useRef as useRef38, useState as useState93 } from "react";
|
|
20962
21320
|
|
|
20963
21321
|
// src/features/referral/hooks/useReferralInvite.ts
|
|
20964
|
-
import { useState as
|
|
21322
|
+
import { useState as useState91 } from "react";
|
|
20965
21323
|
function useReferralInvite() {
|
|
20966
|
-
const [sending, setSending] =
|
|
20967
|
-
const [error, setError] =
|
|
20968
|
-
const [success, setSuccess] =
|
|
21324
|
+
const [sending, setSending] = useState91(false);
|
|
21325
|
+
const [error, setError] = useState91(null);
|
|
21326
|
+
const [success, setSuccess] = useState91(false);
|
|
20969
21327
|
const sendInvite = /* @__PURE__ */ __name(async (email) => {
|
|
20970
21328
|
if (!isReferralEnabled()) {
|
|
20971
21329
|
return;
|
|
@@ -20987,12 +21345,12 @@ function useReferralInvite() {
|
|
|
20987
21345
|
__name(useReferralInvite, "useReferralInvite");
|
|
20988
21346
|
|
|
20989
21347
|
// src/features/referral/hooks/useReferralStats.ts
|
|
20990
|
-
import { useEffect as
|
|
21348
|
+
import { useEffect as useEffect69, useState as useState92 } from "react";
|
|
20991
21349
|
function useReferralStats() {
|
|
20992
|
-
const [stats, setStats] =
|
|
20993
|
-
const [loading, setLoading] =
|
|
20994
|
-
const [error, setError] =
|
|
20995
|
-
|
|
21350
|
+
const [stats, setStats] = useState92(null);
|
|
21351
|
+
const [loading, setLoading] = useState92(true);
|
|
21352
|
+
const [error, setError] = useState92(null);
|
|
21353
|
+
useEffect69(() => {
|
|
20996
21354
|
if (!isReferralEnabled()) {
|
|
20997
21355
|
setLoading(false);
|
|
20998
21356
|
return;
|
|
@@ -21004,7 +21362,7 @@ function useReferralStats() {
|
|
|
21004
21362
|
__name(useReferralStats, "useReferralStats");
|
|
21005
21363
|
|
|
21006
21364
|
// src/features/referral/components/ReferralWidget.tsx
|
|
21007
|
-
import { jsx as
|
|
21365
|
+
import { jsx as jsx249, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
21008
21366
|
var DEFAULT_TRANSLATIONS = {
|
|
21009
21367
|
title: "Invite Friends",
|
|
21010
21368
|
description: "Share your referral link and earn rewards when your friends subscribe.",
|
|
@@ -21062,8 +21420,8 @@ function ReferralWidget({
|
|
|
21062
21420
|
const t = { ...DEFAULT_TRANSLATIONS, ...translations };
|
|
21063
21421
|
const { stats, loading, error } = useReferralStats();
|
|
21064
21422
|
const { sendInvite, sending } = useReferralInvite();
|
|
21065
|
-
const [email, setEmail] =
|
|
21066
|
-
const [copied, setCopied] =
|
|
21423
|
+
const [email, setEmail] = useState93("");
|
|
21424
|
+
const [copied, setCopied] = useState93(false);
|
|
21067
21425
|
const linkInputRef = useRef38(null);
|
|
21068
21426
|
const config = getReferralConfig();
|
|
21069
21427
|
const baseUrl = config.referralUrlBase || (typeof window !== "undefined" ? window.location.origin : "");
|
|
@@ -21071,7 +21429,7 @@ function ReferralWidget({
|
|
|
21071
21429
|
if (!isReferralEnabled()) {
|
|
21072
21430
|
return null;
|
|
21073
21431
|
}
|
|
21074
|
-
const handleCopyLink =
|
|
21432
|
+
const handleCopyLink = useCallback43(async () => {
|
|
21075
21433
|
if (!referralUrl) return;
|
|
21076
21434
|
const success = await copyToClipboard(referralUrl);
|
|
21077
21435
|
if (success) {
|
|
@@ -21083,7 +21441,7 @@ function ReferralWidget({
|
|
|
21083
21441
|
showError(t.copyError);
|
|
21084
21442
|
}
|
|
21085
21443
|
}, [referralUrl, t.copiedMessage, t.copyError, onLinkCopied]);
|
|
21086
|
-
const handleSendInvite =
|
|
21444
|
+
const handleSendInvite = useCallback43(async () => {
|
|
21087
21445
|
if (!email || !email.includes("@")) {
|
|
21088
21446
|
showError(t.invalidEmail);
|
|
21089
21447
|
return;
|
|
@@ -21099,7 +21457,7 @@ function ReferralWidget({
|
|
|
21099
21457
|
onInviteError?.(error2);
|
|
21100
21458
|
}
|
|
21101
21459
|
}, [email, sendInvite, t.inviteSent, t.inviteError, t.invalidEmail, onInviteSent, onInviteError]);
|
|
21102
|
-
const handleEmailKeyDown =
|
|
21460
|
+
const handleEmailKeyDown = useCallback43(
|
|
21103
21461
|
(e) => {
|
|
21104
21462
|
if (e.key === "Enter" && !sending) {
|
|
21105
21463
|
e.preventDefault();
|
|
@@ -21110,30 +21468,30 @@ function ReferralWidget({
|
|
|
21110
21468
|
);
|
|
21111
21469
|
if (loading) {
|
|
21112
21470
|
if (isDialog) {
|
|
21113
|
-
return /* @__PURE__ */
|
|
21471
|
+
return /* @__PURE__ */ jsx249("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx249(Loader26, { className: "text-muted-foreground h-6 w-6 animate-spin" }) });
|
|
21114
21472
|
}
|
|
21115
|
-
return /* @__PURE__ */
|
|
21473
|
+
return /* @__PURE__ */ jsx249(Card, { className: `p-6 ${className ?? ""}`, children: /* @__PURE__ */ jsx249("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx249(Loader26, { className: "text-muted-foreground h-6 w-6 animate-spin" }) }) });
|
|
21116
21474
|
}
|
|
21117
21475
|
if (error) {
|
|
21118
21476
|
const errorMessage = error instanceof Error ? error.message : "Failed to load referral data";
|
|
21119
21477
|
if (isDialog) {
|
|
21120
|
-
return /* @__PURE__ */
|
|
21478
|
+
return /* @__PURE__ */ jsx249("div", { className: "text-destructive text-center text-sm", children: errorMessage });
|
|
21121
21479
|
}
|
|
21122
|
-
return /* @__PURE__ */
|
|
21480
|
+
return /* @__PURE__ */ jsx249(Card, { className: `p-6 ${className ?? ""}`, children: /* @__PURE__ */ jsx249("div", { className: "text-destructive text-center text-sm", children: errorMessage }) });
|
|
21123
21481
|
}
|
|
21124
|
-
const content = /* @__PURE__ */
|
|
21125
|
-
!isDialog && /* @__PURE__ */
|
|
21126
|
-
/* @__PURE__ */
|
|
21127
|
-
/* @__PURE__ */
|
|
21128
|
-
/* @__PURE__ */
|
|
21129
|
-
/* @__PURE__ */
|
|
21482
|
+
const content = /* @__PURE__ */ jsxs152("div", { className: "flex flex-col gap-4", children: [
|
|
21483
|
+
!isDialog && /* @__PURE__ */ jsxs152("div", { className: "flex items-start gap-3", children: [
|
|
21484
|
+
/* @__PURE__ */ jsx249("div", { className: "bg-primary/10 rounded-full p-2", children: /* @__PURE__ */ jsx249(Users, { className: "text-primary h-5 w-5" }) }),
|
|
21485
|
+
/* @__PURE__ */ jsxs152("div", { className: "flex flex-col gap-1", children: [
|
|
21486
|
+
/* @__PURE__ */ jsx249(SectionHeader, { children: t.title }),
|
|
21487
|
+
/* @__PURE__ */ jsx249("p", { className: "text-muted-foreground text-sm", children: t.description })
|
|
21130
21488
|
] })
|
|
21131
21489
|
] }),
|
|
21132
|
-
/* @__PURE__ */
|
|
21133
|
-
/* @__PURE__ */
|
|
21134
|
-
/* @__PURE__ */
|
|
21135
|
-
/* @__PURE__ */
|
|
21136
|
-
/* @__PURE__ */
|
|
21490
|
+
/* @__PURE__ */ jsxs152("div", { className: "flex flex-col gap-2", children: [
|
|
21491
|
+
/* @__PURE__ */ jsx249(Label, { children: t.yourLink }),
|
|
21492
|
+
/* @__PURE__ */ jsxs152("div", { className: "flex gap-2", children: [
|
|
21493
|
+
/* @__PURE__ */ jsx249(Input, { ref: linkInputRef, value: referralUrl, readOnly: true, className: "tabular-nums text-sm" }),
|
|
21494
|
+
/* @__PURE__ */ jsx249(
|
|
21137
21495
|
Button,
|
|
21138
21496
|
{
|
|
21139
21497
|
type: "button",
|
|
@@ -21142,16 +21500,16 @@ function ReferralWidget({
|
|
|
21142
21500
|
onClick: handleCopyLink,
|
|
21143
21501
|
disabled: !referralUrl,
|
|
21144
21502
|
"aria-label": t.copyButton,
|
|
21145
|
-
children: /* @__PURE__ */
|
|
21503
|
+
children: /* @__PURE__ */ jsx249(Copy2, { className: `h-4 w-4 ${copied ? "text-success" : ""}` })
|
|
21146
21504
|
}
|
|
21147
21505
|
)
|
|
21148
21506
|
] })
|
|
21149
21507
|
] }),
|
|
21150
|
-
/* @__PURE__ */
|
|
21151
|
-
/* @__PURE__ */
|
|
21152
|
-
/* @__PURE__ */
|
|
21153
|
-
/* @__PURE__ */
|
|
21154
|
-
/* @__PURE__ */
|
|
21508
|
+
/* @__PURE__ */ jsxs152("div", { className: "flex flex-col gap-2", children: [
|
|
21509
|
+
/* @__PURE__ */ jsx249(Label, { children: t.inviteTitle }),
|
|
21510
|
+
/* @__PURE__ */ jsx249("p", { className: "text-muted-foreground text-xs/relaxed", children: t.inviteDescription }),
|
|
21511
|
+
/* @__PURE__ */ jsxs152("div", { className: "flex gap-2", children: [
|
|
21512
|
+
/* @__PURE__ */ jsx249(
|
|
21155
21513
|
Input,
|
|
21156
21514
|
{
|
|
21157
21515
|
type: "email",
|
|
@@ -21162,7 +21520,7 @@ function ReferralWidget({
|
|
|
21162
21520
|
disabled: sending
|
|
21163
21521
|
}
|
|
21164
21522
|
),
|
|
21165
|
-
/* @__PURE__ */
|
|
21523
|
+
/* @__PURE__ */ jsx249(
|
|
21166
21524
|
Button,
|
|
21167
21525
|
{
|
|
21168
21526
|
type: "button",
|
|
@@ -21171,12 +21529,12 @@ function ReferralWidget({
|
|
|
21171
21529
|
onClick: handleSendInvite,
|
|
21172
21530
|
disabled: sending || !email,
|
|
21173
21531
|
"aria-label": sending ? t.sendingButton : t.sendButton,
|
|
21174
|
-
children: sending ? /* @__PURE__ */
|
|
21532
|
+
children: sending ? /* @__PURE__ */ jsx249(Loader26, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx249(Mail, { className: "h-4 w-4" })
|
|
21175
21533
|
}
|
|
21176
21534
|
)
|
|
21177
21535
|
] })
|
|
21178
21536
|
] }),
|
|
21179
|
-
stats && stats.completedReferrals > 0 && /* @__PURE__ */
|
|
21537
|
+
stats && stats.completedReferrals > 0 && /* @__PURE__ */ jsx249("div", { className: "border-border border-t pt-3", children: /* @__PURE__ */ jsxs152("p", { className: "text-muted-foreground text-sm", children: [
|
|
21180
21538
|
t.completedLabel,
|
|
21181
21539
|
": ",
|
|
21182
21540
|
stats.completedReferrals
|
|
@@ -21185,12 +21543,12 @@ function ReferralWidget({
|
|
|
21185
21543
|
if (isDialog) {
|
|
21186
21544
|
return content;
|
|
21187
21545
|
}
|
|
21188
|
-
return /* @__PURE__ */
|
|
21546
|
+
return /* @__PURE__ */ jsx249(Card, { className: `p-6 ${className ?? ""}`, children: content });
|
|
21189
21547
|
}
|
|
21190
21548
|
__name(ReferralWidget, "ReferralWidget");
|
|
21191
21549
|
|
|
21192
21550
|
// src/features/referral/components/ReferralDialog.tsx
|
|
21193
|
-
import { jsx as
|
|
21551
|
+
import { jsx as jsx250, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
21194
21552
|
var DEFAULT_DIALOG_TRANSLATIONS = {
|
|
21195
21553
|
dialogTitle: "Invite Friends",
|
|
21196
21554
|
dialogDescription: "Share your referral link and earn rewards when your friends subscribe."
|
|
@@ -21206,49 +21564,49 @@ function ReferralDialog({
|
|
|
21206
21564
|
return null;
|
|
21207
21565
|
}
|
|
21208
21566
|
const t = { ...DEFAULT_DIALOG_TRANSLATIONS, ...translations };
|
|
21209
|
-
return /* @__PURE__ */
|
|
21210
|
-
/* @__PURE__ */
|
|
21211
|
-
/* @__PURE__ */
|
|
21212
|
-
/* @__PURE__ */
|
|
21567
|
+
return /* @__PURE__ */ jsx250(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs153(DialogContent, { className: dialogClassName ?? "max-w-md", children: [
|
|
21568
|
+
/* @__PURE__ */ jsxs153(DialogHeader, { children: [
|
|
21569
|
+
/* @__PURE__ */ jsx250(DialogTitle, { children: t.dialogTitle }),
|
|
21570
|
+
/* @__PURE__ */ jsx250(DialogDescription, { children: t.dialogDescription })
|
|
21213
21571
|
] }),
|
|
21214
|
-
/* @__PURE__ */
|
|
21572
|
+
/* @__PURE__ */ jsx250(ReferralWidget, { ...widgetProps, translations, isDialog: true })
|
|
21215
21573
|
] }) });
|
|
21216
21574
|
}
|
|
21217
21575
|
__name(ReferralDialog, "ReferralDialog");
|
|
21218
21576
|
|
|
21219
21577
|
// src/features/role/components/details/RoleDetails.tsx
|
|
21220
|
-
import { useTranslations as
|
|
21221
|
-
import { jsx as
|
|
21578
|
+
import { useTranslations as useTranslations104 } from "next-intl";
|
|
21579
|
+
import { jsx as jsx251 } from "react/jsx-runtime";
|
|
21222
21580
|
function RoleDetails() {
|
|
21223
21581
|
const { role } = useRoleContext();
|
|
21224
|
-
const t =
|
|
21582
|
+
const t = useTranslations104();
|
|
21225
21583
|
if (!role) return null;
|
|
21226
|
-
return /* @__PURE__ */
|
|
21584
|
+
return /* @__PURE__ */ jsx251(Card, { className: "w-full", children: /* @__PURE__ */ jsx251(CardContent, { className: "p-4", children: /* @__PURE__ */ jsx251(AttributeElement, { title: t(`role.fields.description.label`), value: role.description }) }) });
|
|
21227
21585
|
}
|
|
21228
21586
|
__name(RoleDetails, "RoleDetails");
|
|
21229
21587
|
|
|
21230
21588
|
// src/features/role/components/containers/RoleContainer.tsx
|
|
21231
|
-
import { Fragment as
|
|
21589
|
+
import { Fragment as Fragment53, jsx as jsx252, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
21232
21590
|
function RoleContainer() {
|
|
21233
21591
|
const { role } = useRoleContext();
|
|
21234
21592
|
if (!role) return null;
|
|
21235
|
-
return /* @__PURE__ */
|
|
21236
|
-
/* @__PURE__ */
|
|
21237
|
-
/* @__PURE__ */
|
|
21593
|
+
return /* @__PURE__ */ jsxs154(Fragment53, { children: [
|
|
21594
|
+
/* @__PURE__ */ jsx252(RoleDetails, {}),
|
|
21595
|
+
/* @__PURE__ */ jsx252(RoleUsersList, { role })
|
|
21238
21596
|
] });
|
|
21239
21597
|
}
|
|
21240
21598
|
__name(RoleContainer, "RoleContainer");
|
|
21241
21599
|
|
|
21242
21600
|
// src/features/role/components/forms/FormRoles.tsx
|
|
21243
|
-
import { useTranslations as
|
|
21244
|
-
import { jsx as
|
|
21601
|
+
import { useTranslations as useTranslations105 } from "next-intl";
|
|
21602
|
+
import { jsx as jsx253, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
21245
21603
|
function FormRoles({ form, id, name, roles }) {
|
|
21246
|
-
const t =
|
|
21604
|
+
const t = useTranslations105();
|
|
21247
21605
|
const { hasAccesToFeature } = useCurrentUserContext();
|
|
21248
|
-
return /* @__PURE__ */
|
|
21606
|
+
return /* @__PURE__ */ jsx253("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx253(FormFieldWrapper, { form, name: id, label: name, children: (field) => /* @__PURE__ */ jsx253("div", { className: "flex w-full flex-col gap-y-1", children: roles.filter((role) => role.isSelectable).sort((a, b) => a.name.localeCompare(b.name)).map((role) => {
|
|
21249
21607
|
if (role.requiredFeature && !hasAccesToFeature(role.requiredFeature.id)) return null;
|
|
21250
|
-
return /* @__PURE__ */
|
|
21251
|
-
/* @__PURE__ */
|
|
21608
|
+
return /* @__PURE__ */ jsxs155("div", { className: "flex w-full items-center", children: [
|
|
21609
|
+
/* @__PURE__ */ jsx253(
|
|
21252
21610
|
Checkbox,
|
|
21253
21611
|
{
|
|
21254
21612
|
id: `role-${role.id}`,
|
|
@@ -21265,9 +21623,9 @@ function FormRoles({ form, id, name, roles }) {
|
|
|
21265
21623
|
}
|
|
21266
21624
|
}
|
|
21267
21625
|
),
|
|
21268
|
-
/* @__PURE__ */
|
|
21269
|
-
/* @__PURE__ */
|
|
21270
|
-
/* @__PURE__ */
|
|
21626
|
+
/* @__PURE__ */ jsxs155(Tooltip2, { children: [
|
|
21627
|
+
/* @__PURE__ */ jsx253(TooltipTrigger, { children: /* @__PURE__ */ jsx253(FieldLabel, { htmlFor: `role-${role.id}`, className: "ml-3 cursor-pointer font-normal", children: t(`role.roles`, { role: role.id.replaceAll(`-`, ``) }) }) }),
|
|
21628
|
+
/* @__PURE__ */ jsx253(TooltipContent, { children: t(`role.roles_descriptions`, { role: role.id.replaceAll(`-`, ``) }) })
|
|
21271
21629
|
] })
|
|
21272
21630
|
] }, role.id);
|
|
21273
21631
|
}) }) }) });
|
|
@@ -21275,14 +21633,14 @@ function FormRoles({ form, id, name, roles }) {
|
|
|
21275
21633
|
__name(FormRoles, "FormRoles");
|
|
21276
21634
|
|
|
21277
21635
|
// src/features/role/components/forms/RemoveUserFromRole.tsx
|
|
21278
|
-
import { useTranslations as
|
|
21279
|
-
import { useEffect as
|
|
21280
|
-
import { Fragment as
|
|
21636
|
+
import { useTranslations as useTranslations106 } from "next-intl";
|
|
21637
|
+
import { useEffect as useEffect70, useState as useState94 } from "react";
|
|
21638
|
+
import { Fragment as Fragment54, jsx as jsx254, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
21281
21639
|
function RemoveUserFromRole({ role, user, refresh }) {
|
|
21282
|
-
const [open, setOpen] =
|
|
21283
|
-
const [canRemove, setCanRemove] =
|
|
21284
|
-
const t =
|
|
21285
|
-
|
|
21640
|
+
const [open, setOpen] = useState94(false);
|
|
21641
|
+
const [canRemove, setCanRemove] = useState94(false);
|
|
21642
|
+
const t = useTranslations106();
|
|
21643
|
+
useEffect70(() => {
|
|
21286
21644
|
async function checkCompanyAdminDeletability() {
|
|
21287
21645
|
const roleUsers = await UserService.findAllUsersByRole({
|
|
21288
21646
|
roleId: role.id
|
|
@@ -21309,8 +21667,8 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
21309
21667
|
}
|
|
21310
21668
|
}, "remove");
|
|
21311
21669
|
const roleName = t(`role.roles`, { role: role.id.replaceAll(`-`, ``) });
|
|
21312
|
-
return /* @__PURE__ */
|
|
21313
|
-
/* @__PURE__ */
|
|
21670
|
+
return /* @__PURE__ */ jsxs156(Dialog, { open, onOpenChange: setOpen, children: [
|
|
21671
|
+
/* @__PURE__ */ jsx254(
|
|
21314
21672
|
DialogTrigger,
|
|
21315
21673
|
{
|
|
21316
21674
|
onClick: (e) => {
|
|
@@ -21318,19 +21676,19 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
21318
21676
|
e.preventDefault();
|
|
21319
21677
|
setOpen(true);
|
|
21320
21678
|
},
|
|
21321
|
-
children: /* @__PURE__ */
|
|
21679
|
+
children: /* @__PURE__ */ jsx254("span", { className: "hover:text-destructive cursor-pointer", children: t(`role.remove_user.title`) })
|
|
21322
21680
|
}
|
|
21323
21681
|
),
|
|
21324
|
-
/* @__PURE__ */
|
|
21325
|
-
/* @__PURE__ */
|
|
21326
|
-
/* @__PURE__ */
|
|
21327
|
-
/* @__PURE__ */
|
|
21682
|
+
/* @__PURE__ */ jsxs156(DialogContent, { className: `flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`, children: [
|
|
21683
|
+
/* @__PURE__ */ jsxs156(DialogHeader, { children: [
|
|
21684
|
+
/* @__PURE__ */ jsx254(DialogTitle, { children: t(`role.remove_user.title`) }),
|
|
21685
|
+
/* @__PURE__ */ jsx254(DialogDescription, { children: canRemove ? t(`role.remove_user.subtitle_allowed`) : t(`role.remove_user.subtitle_not_allowed`) })
|
|
21328
21686
|
] }),
|
|
21329
|
-
canRemove ? /* @__PURE__ */
|
|
21687
|
+
canRemove ? /* @__PURE__ */ jsxs156(Fragment54, { children: [
|
|
21330
21688
|
t(`role.remove_user.description_allowed`, { role: roleName, user: user.name }),
|
|
21331
|
-
/* @__PURE__ */
|
|
21332
|
-
/* @__PURE__ */
|
|
21333
|
-
/* @__PURE__ */
|
|
21689
|
+
/* @__PURE__ */ jsxs156("div", { className: "flex justify-end", children: [
|
|
21690
|
+
/* @__PURE__ */ jsx254(Button, { className: "mr-2", variant: "outline", type: `button`, onClick: () => setOpen(false), children: t(`ui.buttons.cancel`) }),
|
|
21691
|
+
/* @__PURE__ */ jsx254(
|
|
21334
21692
|
Button,
|
|
21335
21693
|
{
|
|
21336
21694
|
type: "submit",
|
|
@@ -21343,7 +21701,7 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
21343
21701
|
}
|
|
21344
21702
|
)
|
|
21345
21703
|
] })
|
|
21346
|
-
] }) : /* @__PURE__ */
|
|
21704
|
+
] }) : /* @__PURE__ */ jsx254(Fragment54, { children: t(`role.remove_user.description_not_allowed`, { role: roleName, user: user.name }) })
|
|
21347
21705
|
] })
|
|
21348
21706
|
] });
|
|
21349
21707
|
}
|
|
@@ -21351,15 +21709,15 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
|
|
|
21351
21709
|
|
|
21352
21710
|
// src/features/role/components/forms/UserRoleAdd.tsx
|
|
21353
21711
|
import { PlusCircle as PlusCircle2 } from "lucide-react";
|
|
21354
|
-
import { useTranslations as
|
|
21355
|
-
import { useCallback as
|
|
21356
|
-
import { Fragment as
|
|
21712
|
+
import { useTranslations as useTranslations107 } from "next-intl";
|
|
21713
|
+
import { useCallback as useCallback44, useEffect as useEffect71, useRef as useRef39, useState as useState95 } from "react";
|
|
21714
|
+
import { Fragment as Fragment55, jsx as jsx255, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
21357
21715
|
function UserRoleAdd({ user, refresh }) {
|
|
21358
|
-
const [open, setOpen] =
|
|
21716
|
+
const [open, setOpen] = useState95(false);
|
|
21359
21717
|
const inputRef = useRef39(null);
|
|
21360
|
-
const [searchTerm, setSearchTerm] =
|
|
21361
|
-
const [roles, setRoles] =
|
|
21362
|
-
const t =
|
|
21718
|
+
const [searchTerm, setSearchTerm] = useState95("");
|
|
21719
|
+
const [roles, setRoles] = useState95([]);
|
|
21720
|
+
const t = useTranslations107();
|
|
21363
21721
|
const addUserToRole = /* @__PURE__ */ __name(async (role) => {
|
|
21364
21722
|
await RoleService.addUserToRole({
|
|
21365
21723
|
roleId: role.id,
|
|
@@ -21382,7 +21740,7 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
21382
21740
|
);
|
|
21383
21741
|
refresh();
|
|
21384
21742
|
}, "addUserToRole");
|
|
21385
|
-
const searchRoles =
|
|
21743
|
+
const searchRoles = useCallback44(
|
|
21386
21744
|
async (term) => {
|
|
21387
21745
|
setRoles(
|
|
21388
21746
|
await RoleService.findAllRolesUserNotIn({
|
|
@@ -21394,32 +21752,32 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
21394
21752
|
[searchTerm, user]
|
|
21395
21753
|
);
|
|
21396
21754
|
const updateSearchTerm = useDebounce2(searchRoles, 500);
|
|
21397
|
-
|
|
21755
|
+
useEffect71(() => {
|
|
21398
21756
|
if (open) updateSearchTerm(searchTerm);
|
|
21399
21757
|
}, [open, searchTerm]);
|
|
21400
|
-
|
|
21758
|
+
useEffect71(() => {
|
|
21401
21759
|
if (open) searchRoles("");
|
|
21402
21760
|
}, [open]);
|
|
21403
|
-
return /* @__PURE__ */
|
|
21404
|
-
/* @__PURE__ */
|
|
21405
|
-
/* @__PURE__ */
|
|
21761
|
+
return /* @__PURE__ */ jsxs157(Fragment55, { children: [
|
|
21762
|
+
/* @__PURE__ */ jsxs157(Button, { size: "sm", onClick: () => setOpen(true), children: [
|
|
21763
|
+
/* @__PURE__ */ jsx255(PlusCircle2, { className: "mr-3 h-3.5 w-3.5" }),
|
|
21406
21764
|
t(`common.association.label`, {
|
|
21407
21765
|
source: t(`entities.roles`, { count: 1 }),
|
|
21408
21766
|
destination: t(`entities.users`, { count: 1 })
|
|
21409
21767
|
})
|
|
21410
21768
|
] }),
|
|
21411
|
-
/* @__PURE__ */
|
|
21412
|
-
/* @__PURE__ */
|
|
21769
|
+
/* @__PURE__ */ jsxs157(CommandDialog, { open, onOpenChange: setOpen, children: [
|
|
21770
|
+
/* @__PURE__ */ jsx255(DialogTitle, { children: t(`common.association.label`, {
|
|
21413
21771
|
source: t(`entities.roles`, { count: 1 }),
|
|
21414
21772
|
destination: t(`entities.users`, { count: 1 })
|
|
21415
21773
|
}) }),
|
|
21416
|
-
/* @__PURE__ */
|
|
21774
|
+
/* @__PURE__ */ jsx255(DialogDescription, { children: t(`common.association.description`, {
|
|
21417
21775
|
source: t(`entities.roles`, { count: 1 }),
|
|
21418
21776
|
destination: t(`entities.users`, { count: 1 }),
|
|
21419
21777
|
destination_name: user.name
|
|
21420
21778
|
}) }),
|
|
21421
|
-
/* @__PURE__ */
|
|
21422
|
-
/* @__PURE__ */
|
|
21779
|
+
/* @__PURE__ */ jsxs157(Command, { shouldFilter: false, children: [
|
|
21780
|
+
/* @__PURE__ */ jsx255(
|
|
21423
21781
|
CommandInput,
|
|
21424
21782
|
{
|
|
21425
21783
|
placeholder: t(`ui.search.placeholder`, { type: t(`entities.roles`, { count: 1 }) }),
|
|
@@ -21428,9 +21786,9 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
21428
21786
|
ref: inputRef
|
|
21429
21787
|
}
|
|
21430
21788
|
),
|
|
21431
|
-
/* @__PURE__ */
|
|
21432
|
-
/* @__PURE__ */
|
|
21433
|
-
roles.map((role) => /* @__PURE__ */
|
|
21789
|
+
/* @__PURE__ */ jsxs157(CommandList, { className: "mt-3 h-auto max-h-96 min-h-96 max-w-full overflow-x-hidden overflow-y-auto", children: [
|
|
21790
|
+
/* @__PURE__ */ jsx255(CommandEmpty, { children: t(`ui.search.no_results`, { type: t(`entities.roles`, { count: 1 }) }) }),
|
|
21791
|
+
roles.map((role) => /* @__PURE__ */ jsx255(
|
|
21434
21792
|
CommandItem,
|
|
21435
21793
|
{
|
|
21436
21794
|
className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
|
|
@@ -21448,16 +21806,16 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
21448
21806
|
__name(UserRoleAdd, "UserRoleAdd");
|
|
21449
21807
|
|
|
21450
21808
|
// src/features/role/components/lists/RolesList.tsx
|
|
21451
|
-
import { useTranslations as
|
|
21452
|
-
import { jsx as
|
|
21809
|
+
import { useTranslations as useTranslations108 } from "next-intl";
|
|
21810
|
+
import { jsx as jsx256 } from "react/jsx-runtime";
|
|
21453
21811
|
function RolesList() {
|
|
21454
|
-
const t =
|
|
21812
|
+
const t = useTranslations108();
|
|
21455
21813
|
const data = useDataListRetriever({
|
|
21456
21814
|
retriever: /* @__PURE__ */ __name((params) => RoleService.findAllRoles(params), "retriever"),
|
|
21457
21815
|
retrieverParams: {},
|
|
21458
21816
|
module: Modules.Role
|
|
21459
21817
|
});
|
|
21460
|
-
return /* @__PURE__ */
|
|
21818
|
+
return /* @__PURE__ */ jsx256(
|
|
21461
21819
|
ContentListTable,
|
|
21462
21820
|
{
|
|
21463
21821
|
data,
|
|
@@ -21470,16 +21828,16 @@ function RolesList() {
|
|
|
21470
21828
|
__name(RolesList, "RolesList");
|
|
21471
21829
|
|
|
21472
21830
|
// src/features/role/components/lists/UserRolesList.tsx
|
|
21473
|
-
import { useTranslations as
|
|
21474
|
-
import { jsx as
|
|
21831
|
+
import { useTranslations as useTranslations109 } from "next-intl";
|
|
21832
|
+
import { jsx as jsx257 } from "react/jsx-runtime";
|
|
21475
21833
|
function UserRolesList({ user }) {
|
|
21476
|
-
const t =
|
|
21834
|
+
const t = useTranslations109();
|
|
21477
21835
|
const data = useDataListRetriever({
|
|
21478
21836
|
retriever: /* @__PURE__ */ __name((params) => RoleService.findAllRolesByUser(params), "retriever"),
|
|
21479
21837
|
retrieverParams: { userId: user.id },
|
|
21480
21838
|
module: Modules.Role
|
|
21481
21839
|
});
|
|
21482
|
-
return /* @__PURE__ */
|
|
21840
|
+
return /* @__PURE__ */ jsx257(
|
|
21483
21841
|
ContentListTable,
|
|
21484
21842
|
{
|
|
21485
21843
|
data,
|
|
@@ -21492,9 +21850,9 @@ function UserRolesList({ user }) {
|
|
|
21492
21850
|
__name(UserRolesList, "UserRolesList");
|
|
21493
21851
|
|
|
21494
21852
|
// src/features/oauth/components/OAuthRedirectUriInput.tsx
|
|
21495
|
-
import { useCallback as
|
|
21853
|
+
import { useCallback as useCallback45 } from "react";
|
|
21496
21854
|
import { Plus as Plus3, Trash2 as Trash23 } from "lucide-react";
|
|
21497
|
-
import { jsx as
|
|
21855
|
+
import { jsx as jsx258, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
21498
21856
|
function isValidRedirectUri(uri) {
|
|
21499
21857
|
if (!uri.trim()) return false;
|
|
21500
21858
|
if (uri.startsWith("http://localhost") || uri.startsWith("http://127.0.0.1")) {
|
|
@@ -21522,17 +21880,17 @@ function OAuthRedirectUriInput({
|
|
|
21522
21880
|
disabled = false,
|
|
21523
21881
|
label = "Redirect URIs"
|
|
21524
21882
|
}) {
|
|
21525
|
-
const handleAdd =
|
|
21883
|
+
const handleAdd = useCallback45(() => {
|
|
21526
21884
|
onChange([...value, ""]);
|
|
21527
21885
|
}, [value, onChange]);
|
|
21528
|
-
const handleRemove =
|
|
21886
|
+
const handleRemove = useCallback45(
|
|
21529
21887
|
(index) => {
|
|
21530
21888
|
const newUris = value.filter((_, i) => i !== index);
|
|
21531
21889
|
onChange(newUris.length > 0 ? newUris : [""]);
|
|
21532
21890
|
},
|
|
21533
21891
|
[value, onChange]
|
|
21534
21892
|
);
|
|
21535
|
-
const handleChange =
|
|
21893
|
+
const handleChange = useCallback45(
|
|
21536
21894
|
(index, newValue) => {
|
|
21537
21895
|
const newUris = [...value];
|
|
21538
21896
|
newUris[index] = newValue;
|
|
@@ -21540,17 +21898,17 @@ function OAuthRedirectUriInput({
|
|
|
21540
21898
|
},
|
|
21541
21899
|
[value, onChange]
|
|
21542
21900
|
);
|
|
21543
|
-
return /* @__PURE__ */
|
|
21544
|
-
/* @__PURE__ */
|
|
21901
|
+
return /* @__PURE__ */ jsxs158("div", { className: "space-y-2", children: [
|
|
21902
|
+
/* @__PURE__ */ jsxs158(Label, { children: [
|
|
21545
21903
|
label,
|
|
21546
21904
|
" *"
|
|
21547
21905
|
] }),
|
|
21548
|
-
/* @__PURE__ */
|
|
21549
|
-
/* @__PURE__ */
|
|
21906
|
+
/* @__PURE__ */ jsx258("p", { className: "text-sm text-muted-foreground", children: "Enter the URIs where users will be redirected after authorization. Use https:// for production, or custom schemes for mobile apps." }),
|
|
21907
|
+
/* @__PURE__ */ jsx258("div", { className: "space-y-2", children: value.map((uri, index) => {
|
|
21550
21908
|
const isValid3 = !uri || isValidRedirectUri(uri);
|
|
21551
|
-
return /* @__PURE__ */
|
|
21552
|
-
/* @__PURE__ */
|
|
21553
|
-
/* @__PURE__ */
|
|
21909
|
+
return /* @__PURE__ */ jsxs158("div", { className: "flex gap-2", children: [
|
|
21910
|
+
/* @__PURE__ */ jsxs158("div", { className: "flex-1", children: [
|
|
21911
|
+
/* @__PURE__ */ jsx258(
|
|
21554
21912
|
Input,
|
|
21555
21913
|
{
|
|
21556
21914
|
value: uri,
|
|
@@ -21560,9 +21918,9 @@ function OAuthRedirectUriInput({
|
|
|
21560
21918
|
className: !isValid3 ? "border-destructive" : ""
|
|
21561
21919
|
}
|
|
21562
21920
|
),
|
|
21563
|
-
!isValid3 && /* @__PURE__ */
|
|
21921
|
+
!isValid3 && /* @__PURE__ */ jsx258("p", { className: "text-xs text-destructive mt-1", children: "Must be https://, http://localhost, or a custom scheme (app://)" })
|
|
21564
21922
|
] }),
|
|
21565
|
-
/* @__PURE__ */
|
|
21923
|
+
/* @__PURE__ */ jsx258(
|
|
21566
21924
|
Button,
|
|
21567
21925
|
{
|
|
21568
21926
|
type: "button",
|
|
@@ -21571,23 +21929,23 @@ function OAuthRedirectUriInput({
|
|
|
21571
21929
|
onClick: () => handleRemove(index),
|
|
21572
21930
|
disabled: disabled || value.length === 1,
|
|
21573
21931
|
title: "Remove URI",
|
|
21574
|
-
children: /* @__PURE__ */
|
|
21932
|
+
children: /* @__PURE__ */ jsx258(Trash23, { className: "h-4 w-4" })
|
|
21575
21933
|
}
|
|
21576
21934
|
)
|
|
21577
21935
|
] }, index);
|
|
21578
21936
|
}) }),
|
|
21579
|
-
/* @__PURE__ */
|
|
21580
|
-
/* @__PURE__ */
|
|
21937
|
+
/* @__PURE__ */ jsxs158(Button, { type: "button", variant: "outline", size: "sm", onClick: handleAdd, disabled, className: "mt-2", children: [
|
|
21938
|
+
/* @__PURE__ */ jsx258(Plus3, { className: "h-4 w-4 mr-2" }),
|
|
21581
21939
|
"Add Redirect URI"
|
|
21582
21940
|
] }),
|
|
21583
|
-
error && /* @__PURE__ */
|
|
21941
|
+
error && /* @__PURE__ */ jsx258("p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
21584
21942
|
] });
|
|
21585
21943
|
}
|
|
21586
21944
|
__name(OAuthRedirectUriInput, "OAuthRedirectUriInput");
|
|
21587
21945
|
|
|
21588
21946
|
// src/features/oauth/components/OAuthScopeSelector.tsx
|
|
21589
|
-
import { useCallback as
|
|
21590
|
-
import { jsx as
|
|
21947
|
+
import { useCallback as useCallback46 } from "react";
|
|
21948
|
+
import { jsx as jsx259, jsxs as jsxs159 } from "react/jsx-runtime";
|
|
21591
21949
|
function OAuthScopeSelector({
|
|
21592
21950
|
value,
|
|
21593
21951
|
onChange,
|
|
@@ -21596,7 +21954,7 @@ function OAuthScopeSelector({
|
|
|
21596
21954
|
error,
|
|
21597
21955
|
label = "Allowed Scopes"
|
|
21598
21956
|
}) {
|
|
21599
|
-
const handleToggle =
|
|
21957
|
+
const handleToggle = useCallback46(
|
|
21600
21958
|
(scope, checked) => {
|
|
21601
21959
|
if (checked) {
|
|
21602
21960
|
onChange([...value, scope]);
|
|
@@ -21618,25 +21976,25 @@ function OAuthScopeSelector({
|
|
|
21618
21976
|
},
|
|
21619
21977
|
{}
|
|
21620
21978
|
);
|
|
21621
|
-
return /* @__PURE__ */
|
|
21622
|
-
/* @__PURE__ */
|
|
21623
|
-
/* @__PURE__ */
|
|
21979
|
+
return /* @__PURE__ */ jsxs159("div", { className: "space-y-4", children: [
|
|
21980
|
+
/* @__PURE__ */ jsxs159("div", { children: [
|
|
21981
|
+
/* @__PURE__ */ jsxs159(Label, { children: [
|
|
21624
21982
|
label,
|
|
21625
21983
|
" *"
|
|
21626
21984
|
] }),
|
|
21627
|
-
/* @__PURE__ */
|
|
21985
|
+
/* @__PURE__ */ jsx259("p", { className: "text-sm text-muted-foreground", children: "Select the permissions your application needs." })
|
|
21628
21986
|
] }),
|
|
21629
|
-
/* @__PURE__ */
|
|
21630
|
-
/* @__PURE__ */
|
|
21631
|
-
/* @__PURE__ */
|
|
21987
|
+
/* @__PURE__ */ jsx259("div", { className: "space-y-4", children: Object.entries(groupedScopes).map(([groupName, scopes]) => /* @__PURE__ */ jsxs159("div", { className: "space-y-2", children: [
|
|
21988
|
+
/* @__PURE__ */ jsx259("h4", { className: "text-sm font-medium capitalize", children: groupName }),
|
|
21989
|
+
/* @__PURE__ */ jsx259("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2 pl-2", children: scopes.map((scopeInfo) => {
|
|
21632
21990
|
const isChecked = value.includes(scopeInfo.scope);
|
|
21633
21991
|
const isAdmin = scopeInfo.scope === "admin";
|
|
21634
|
-
return /* @__PURE__ */
|
|
21992
|
+
return /* @__PURE__ */ jsxs159(
|
|
21635
21993
|
"div",
|
|
21636
21994
|
{
|
|
21637
21995
|
className: `flex items-start space-x-3 p-2 rounded-md border ${isChecked ? "bg-primary/5 border-primary/20" : "border-transparent"} ${isAdmin ? "bg-destructive/5" : ""}`,
|
|
21638
21996
|
children: [
|
|
21639
|
-
/* @__PURE__ */
|
|
21997
|
+
/* @__PURE__ */ jsx259(
|
|
21640
21998
|
Checkbox,
|
|
21641
21999
|
{
|
|
21642
22000
|
id: `scope-${scopeInfo.scope}`,
|
|
@@ -21645,12 +22003,12 @@ function OAuthScopeSelector({
|
|
|
21645
22003
|
disabled
|
|
21646
22004
|
}
|
|
21647
22005
|
),
|
|
21648
|
-
/* @__PURE__ */
|
|
21649
|
-
/* @__PURE__ */
|
|
22006
|
+
/* @__PURE__ */ jsxs159("div", { className: "flex-1", children: [
|
|
22007
|
+
/* @__PURE__ */ jsxs159(Label, { htmlFor: `scope-${scopeInfo.scope}`, className: "cursor-pointer", children: [
|
|
21650
22008
|
scopeInfo.name,
|
|
21651
|
-
isAdmin && /* @__PURE__ */
|
|
22009
|
+
isAdmin && /* @__PURE__ */ jsx259("span", { className: "ml-2 text-xs text-destructive", children: "(Dangerous)" })
|
|
21652
22010
|
] }),
|
|
21653
|
-
/* @__PURE__ */
|
|
22011
|
+
/* @__PURE__ */ jsx259("p", { className: "text-xs text-muted-foreground", children: scopeInfo.description })
|
|
21654
22012
|
] })
|
|
21655
22013
|
]
|
|
21656
22014
|
},
|
|
@@ -21658,18 +22016,18 @@ function OAuthScopeSelector({
|
|
|
21658
22016
|
);
|
|
21659
22017
|
}) })
|
|
21660
22018
|
] }, groupName)) }),
|
|
21661
|
-
error && /* @__PURE__ */
|
|
22019
|
+
error && /* @__PURE__ */ jsx259("p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
21662
22020
|
] });
|
|
21663
22021
|
}
|
|
21664
22022
|
__name(OAuthScopeSelector, "OAuthScopeSelector");
|
|
21665
22023
|
|
|
21666
22024
|
// src/features/oauth/components/OAuthClientSecretDisplay.tsx
|
|
21667
|
-
import { useState as
|
|
22025
|
+
import { useState as useState96, useCallback as useCallback47 } from "react";
|
|
21668
22026
|
import { Copy as Copy3, Check, AlertTriangle } from "lucide-react";
|
|
21669
|
-
import { jsx as
|
|
22027
|
+
import { jsx as jsx260, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
21670
22028
|
function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
21671
|
-
const [copied, setCopied] =
|
|
21672
|
-
const handleCopy =
|
|
22029
|
+
const [copied, setCopied] = useState96(false);
|
|
22030
|
+
const handleCopy = useCallback47(async () => {
|
|
21673
22031
|
try {
|
|
21674
22032
|
await navigator.clipboard.writeText(secret);
|
|
21675
22033
|
setCopied(true);
|
|
@@ -21678,29 +22036,29 @@ function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
|
21678
22036
|
console.error("Failed to copy to clipboard:", err);
|
|
21679
22037
|
}
|
|
21680
22038
|
}, [secret]);
|
|
21681
|
-
const handleDismiss =
|
|
22039
|
+
const handleDismiss = useCallback47(() => {
|
|
21682
22040
|
setCopied(false);
|
|
21683
22041
|
onDismiss();
|
|
21684
22042
|
}, [onDismiss]);
|
|
21685
|
-
return /* @__PURE__ */
|
|
21686
|
-
/* @__PURE__ */
|
|
21687
|
-
/* @__PURE__ */
|
|
21688
|
-
/* @__PURE__ */
|
|
22043
|
+
return /* @__PURE__ */ jsx260(Dialog, { open, onOpenChange: (isOpen) => !isOpen && handleDismiss(), children: /* @__PURE__ */ jsxs160(DialogContent, { className: "sm:max-w-md", children: [
|
|
22044
|
+
/* @__PURE__ */ jsxs160(DialogHeader, { children: [
|
|
22045
|
+
/* @__PURE__ */ jsxs160(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
22046
|
+
/* @__PURE__ */ jsx260(AlertTriangle, { className: "h-5 w-5 text-warning" }),
|
|
21689
22047
|
"Save Your Client Secret"
|
|
21690
22048
|
] }),
|
|
21691
|
-
/* @__PURE__ */
|
|
22049
|
+
/* @__PURE__ */ jsx260(DialogDescription, { children: clientName ? `Your client secret for "${clientName}" is shown below.` : "Your client secret is shown below." })
|
|
21692
22050
|
] }),
|
|
21693
|
-
/* @__PURE__ */
|
|
21694
|
-
/* @__PURE__ */
|
|
21695
|
-
/* @__PURE__ */
|
|
21696
|
-
/* @__PURE__ */
|
|
21697
|
-
/* @__PURE__ */
|
|
22051
|
+
/* @__PURE__ */ jsxs160(Alert, { variant: "destructive", className: "my-4", children: [
|
|
22052
|
+
/* @__PURE__ */ jsx260(AlertTriangle, { className: "h-4 w-4" }),
|
|
22053
|
+
/* @__PURE__ */ jsxs160(AlertDescription, { children: [
|
|
22054
|
+
/* @__PURE__ */ jsx260("strong", { children: "This is the only time your client secret will be displayed." }),
|
|
22055
|
+
/* @__PURE__ */ jsx260("br", {}),
|
|
21698
22056
|
"Copy it now and store it securely. You will not be able to retrieve it later."
|
|
21699
22057
|
] })
|
|
21700
22058
|
] }),
|
|
21701
|
-
/* @__PURE__ */
|
|
21702
|
-
/* @__PURE__ */
|
|
21703
|
-
/* @__PURE__ */
|
|
22059
|
+
/* @__PURE__ */ jsxs160("div", { className: "flex items-center space-x-2", children: [
|
|
22060
|
+
/* @__PURE__ */ jsx260("div", { className: "flex-1", children: /* @__PURE__ */ jsx260(Input, { value: secret, readOnly: true, className: "tabular-nums text-sm", onClick: (e) => e.currentTarget.select() }) }),
|
|
22061
|
+
/* @__PURE__ */ jsx260(
|
|
21704
22062
|
Button,
|
|
21705
22063
|
{
|
|
21706
22064
|
type: "button",
|
|
@@ -21708,12 +22066,12 @@ function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
|
21708
22066
|
size: "icon",
|
|
21709
22067
|
onClick: handleCopy,
|
|
21710
22068
|
title: copied ? "Copied!" : "Copy to clipboard",
|
|
21711
|
-
children: copied ? /* @__PURE__ */
|
|
22069
|
+
children: copied ? /* @__PURE__ */ jsx260(Check, { className: "text-success h-4 w-4" }) : /* @__PURE__ */ jsx260(Copy3, { className: "h-4 w-4" })
|
|
21712
22070
|
}
|
|
21713
22071
|
)
|
|
21714
22072
|
] }),
|
|
21715
|
-
copied && /* @__PURE__ */
|
|
21716
|
-
/* @__PURE__ */
|
|
22073
|
+
copied && /* @__PURE__ */ jsx260("p", { className: "text-success text-center text-sm", children: "Copied to clipboard!" }),
|
|
22074
|
+
/* @__PURE__ */ jsx260(DialogFooter, { className: "mt-4", children: /* @__PURE__ */ jsx260(Button, { onClick: handleDismiss, className: "w-full", children: "I've Saved My Secret" }) })
|
|
21717
22075
|
] }) });
|
|
21718
22076
|
}
|
|
21719
22077
|
__name(OAuthClientSecretDisplay, "OAuthClientSecretDisplay");
|
|
@@ -21721,28 +22079,28 @@ __name(OAuthClientSecretDisplay, "OAuthClientSecretDisplay");
|
|
|
21721
22079
|
// src/features/oauth/components/OAuthClientCard.tsx
|
|
21722
22080
|
import { formatDistanceToNow } from "date-fns";
|
|
21723
22081
|
import { Key as Key2, MoreVertical, Pencil, Trash2 as Trash24 } from "lucide-react";
|
|
21724
|
-
import { jsx as
|
|
22082
|
+
import { jsx as jsx261, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
21725
22083
|
function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
21726
22084
|
const truncatedId = client.clientId.length > 12 ? `${client.clientId.slice(0, 8)}...${client.clientId.slice(-4)}` : client.clientId;
|
|
21727
22085
|
const createdAgo = client.createdAt ? formatDistanceToNow(new Date(client.createdAt), { addSuffix: true }) : "Unknown";
|
|
21728
|
-
return /* @__PURE__ */
|
|
22086
|
+
return /* @__PURE__ */ jsxs161(
|
|
21729
22087
|
Card,
|
|
21730
22088
|
{
|
|
21731
22089
|
className: `cursor-pointer transition-colors hover:bg-accent/50 ${!client.isActive ? "opacity-60" : ""}`,
|
|
21732
22090
|
onClick,
|
|
21733
22091
|
children: [
|
|
21734
|
-
/* @__PURE__ */
|
|
21735
|
-
/* @__PURE__ */
|
|
21736
|
-
/* @__PURE__ */
|
|
21737
|
-
/* @__PURE__ */
|
|
21738
|
-
/* @__PURE__ */
|
|
22092
|
+
/* @__PURE__ */ jsxs161(CardHeader, { className: "pb-2", children: [
|
|
22093
|
+
/* @__PURE__ */ jsxs161("div", { className: "flex items-start justify-between", children: [
|
|
22094
|
+
/* @__PURE__ */ jsxs161("div", { className: "flex items-center gap-2", children: [
|
|
22095
|
+
/* @__PURE__ */ jsx261(Key2, { className: "h-5 w-5 text-muted-foreground" }),
|
|
22096
|
+
/* @__PURE__ */ jsx261(CardTitle, { className: "text-lg", children: client.name })
|
|
21739
22097
|
] }),
|
|
21740
|
-
/* @__PURE__ */
|
|
21741
|
-
/* @__PURE__ */
|
|
21742
|
-
(onEdit || onDelete) && /* @__PURE__ */
|
|
21743
|
-
/* @__PURE__ */
|
|
21744
|
-
/* @__PURE__ */
|
|
21745
|
-
onEdit && /* @__PURE__ */
|
|
22098
|
+
/* @__PURE__ */ jsxs161("div", { className: "flex items-center gap-2", children: [
|
|
22099
|
+
/* @__PURE__ */ jsx261(Badge, { variant: client.isActive ? "default" : "secondary", children: client.isActive ? "Active" : "Inactive" }),
|
|
22100
|
+
(onEdit || onDelete) && /* @__PURE__ */ jsxs161(DropdownMenu, { children: [
|
|
22101
|
+
/* @__PURE__ */ jsx261(DropdownMenuTrigger, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx261(Button, { render: /* @__PURE__ */ jsx261("div", {}), nativeButton: false, variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx261(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
22102
|
+
/* @__PURE__ */ jsxs161(DropdownMenuContent, { align: "end", children: [
|
|
22103
|
+
onEdit && /* @__PURE__ */ jsxs161(
|
|
21746
22104
|
DropdownMenuItem,
|
|
21747
22105
|
{
|
|
21748
22106
|
onClick: (e) => {
|
|
@@ -21750,12 +22108,12 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
21750
22108
|
onEdit();
|
|
21751
22109
|
},
|
|
21752
22110
|
children: [
|
|
21753
|
-
/* @__PURE__ */
|
|
22111
|
+
/* @__PURE__ */ jsx261(Pencil, { className: "h-4 w-4 mr-2" }),
|
|
21754
22112
|
"Edit"
|
|
21755
22113
|
]
|
|
21756
22114
|
}
|
|
21757
22115
|
),
|
|
21758
|
-
onDelete && /* @__PURE__ */
|
|
22116
|
+
onDelete && /* @__PURE__ */ jsxs161(
|
|
21759
22117
|
DropdownMenuItem,
|
|
21760
22118
|
{
|
|
21761
22119
|
onClick: (e) => {
|
|
@@ -21764,7 +22122,7 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
21764
22122
|
},
|
|
21765
22123
|
className: "text-destructive",
|
|
21766
22124
|
children: [
|
|
21767
|
-
/* @__PURE__ */
|
|
22125
|
+
/* @__PURE__ */ jsx261(Trash24, { className: "h-4 w-4 mr-2" }),
|
|
21768
22126
|
"Delete"
|
|
21769
22127
|
]
|
|
21770
22128
|
}
|
|
@@ -21773,15 +22131,15 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
21773
22131
|
] })
|
|
21774
22132
|
] })
|
|
21775
22133
|
] }),
|
|
21776
|
-
client.description && /* @__PURE__ */
|
|
22134
|
+
client.description && /* @__PURE__ */ jsx261(CardDescription, { className: "line-clamp-2", children: client.description })
|
|
21777
22135
|
] }),
|
|
21778
|
-
/* @__PURE__ */
|
|
21779
|
-
/* @__PURE__ */
|
|
21780
|
-
/* @__PURE__ */
|
|
22136
|
+
/* @__PURE__ */ jsx261(CardContent, { children: /* @__PURE__ */ jsxs161("div", { className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground", children: [
|
|
22137
|
+
/* @__PURE__ */ jsx261("span", { className: "tabular-nums", children: truncatedId }),
|
|
22138
|
+
/* @__PURE__ */ jsxs161("span", { children: [
|
|
21781
22139
|
"Created ",
|
|
21782
22140
|
createdAgo
|
|
21783
22141
|
] }),
|
|
21784
|
-
/* @__PURE__ */
|
|
22142
|
+
/* @__PURE__ */ jsx261("span", { children: client.isConfidential ? "Confidential" : "Public" })
|
|
21785
22143
|
] }) })
|
|
21786
22144
|
]
|
|
21787
22145
|
}
|
|
@@ -21791,7 +22149,7 @@ __name(OAuthClientCard, "OAuthClientCard");
|
|
|
21791
22149
|
|
|
21792
22150
|
// src/features/oauth/components/OAuthClientList.tsx
|
|
21793
22151
|
import { Plus as Plus4, Key as Key3 } from "lucide-react";
|
|
21794
|
-
import { jsx as
|
|
22152
|
+
import { jsx as jsx262, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
21795
22153
|
function OAuthClientList({
|
|
21796
22154
|
clients,
|
|
21797
22155
|
isLoading = false,
|
|
@@ -21804,49 +22162,49 @@ function OAuthClientList({
|
|
|
21804
22162
|
title = "OAuth Applications"
|
|
21805
22163
|
}) {
|
|
21806
22164
|
if (isLoading && clients.length === 0) {
|
|
21807
|
-
return /* @__PURE__ */
|
|
21808
|
-
/* @__PURE__ */
|
|
21809
|
-
/* @__PURE__ */
|
|
21810
|
-
/* @__PURE__ */
|
|
22165
|
+
return /* @__PURE__ */ jsxs162("div", { className: "space-y-4", children: [
|
|
22166
|
+
/* @__PURE__ */ jsxs162("div", { className: "flex items-center justify-between", children: [
|
|
22167
|
+
/* @__PURE__ */ jsx262(SectionHeader, { level: 2, children: title }),
|
|
22168
|
+
/* @__PURE__ */ jsx262(Skeleton, { className: "h-10 w-32" })
|
|
21811
22169
|
] }),
|
|
21812
|
-
/* @__PURE__ */
|
|
22170
|
+
/* @__PURE__ */ jsx262("div", { className: "space-y-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx262(Skeleton, { className: "h-32 w-full" }, i)) })
|
|
21813
22171
|
] });
|
|
21814
22172
|
}
|
|
21815
22173
|
if (error) {
|
|
21816
|
-
return /* @__PURE__ */
|
|
21817
|
-
/* @__PURE__ */
|
|
21818
|
-
/* @__PURE__ */
|
|
22174
|
+
return /* @__PURE__ */ jsxs162("div", { className: "space-y-4", children: [
|
|
22175
|
+
/* @__PURE__ */ jsx262("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx262(SectionHeader, { level: 2, children: title }) }),
|
|
22176
|
+
/* @__PURE__ */ jsx262("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-6 text-center", children: /* @__PURE__ */ jsx262("p", { className: "text-destructive", children: error.message }) })
|
|
21819
22177
|
] });
|
|
21820
22178
|
}
|
|
21821
22179
|
if (clients.length === 0) {
|
|
21822
|
-
return /* @__PURE__ */
|
|
21823
|
-
/* @__PURE__ */
|
|
21824
|
-
/* @__PURE__ */
|
|
21825
|
-
onCreateClick && /* @__PURE__ */
|
|
21826
|
-
/* @__PURE__ */
|
|
22180
|
+
return /* @__PURE__ */ jsxs162("div", { className: "space-y-4", children: [
|
|
22181
|
+
/* @__PURE__ */ jsxs162("div", { className: "flex items-center justify-between", children: [
|
|
22182
|
+
/* @__PURE__ */ jsx262(SectionHeader, { level: 2, children: title }),
|
|
22183
|
+
onCreateClick && /* @__PURE__ */ jsxs162(Button, { onClick: onCreateClick, children: [
|
|
22184
|
+
/* @__PURE__ */ jsx262(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
21827
22185
|
"New App"
|
|
21828
22186
|
] })
|
|
21829
22187
|
] }),
|
|
21830
|
-
/* @__PURE__ */
|
|
21831
|
-
/* @__PURE__ */
|
|
21832
|
-
/* @__PURE__ */
|
|
21833
|
-
/* @__PURE__ */
|
|
21834
|
-
onCreateClick && /* @__PURE__ */
|
|
21835
|
-
/* @__PURE__ */
|
|
22188
|
+
/* @__PURE__ */ jsxs162("div", { className: "rounded-lg border border-dashed p-12 text-center", children: [
|
|
22189
|
+
/* @__PURE__ */ jsx262(Key3, { className: "h-12 w-12 mx-auto text-muted-foreground mb-4" }),
|
|
22190
|
+
/* @__PURE__ */ jsx262("h3", { className: "text-lg font-medium mb-2", children: "No OAuth Applications" }),
|
|
22191
|
+
/* @__PURE__ */ jsx262("p", { className: "text-muted-foreground mb-4", children: emptyStateMessage }),
|
|
22192
|
+
onCreateClick && /* @__PURE__ */ jsxs162(Button, { onClick: onCreateClick, children: [
|
|
22193
|
+
/* @__PURE__ */ jsx262(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
21836
22194
|
"Create Application"
|
|
21837
22195
|
] })
|
|
21838
22196
|
] })
|
|
21839
22197
|
] });
|
|
21840
22198
|
}
|
|
21841
|
-
return /* @__PURE__ */
|
|
21842
|
-
/* @__PURE__ */
|
|
21843
|
-
/* @__PURE__ */
|
|
21844
|
-
onCreateClick && /* @__PURE__ */
|
|
21845
|
-
/* @__PURE__ */
|
|
22199
|
+
return /* @__PURE__ */ jsxs162("div", { className: "space-y-4", children: [
|
|
22200
|
+
/* @__PURE__ */ jsxs162("div", { className: "flex items-center justify-between", children: [
|
|
22201
|
+
/* @__PURE__ */ jsx262(SectionHeader, { level: 2, children: title }),
|
|
22202
|
+
onCreateClick && /* @__PURE__ */ jsxs162(Button, { onClick: onCreateClick, children: [
|
|
22203
|
+
/* @__PURE__ */ jsx262(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
21846
22204
|
"New App"
|
|
21847
22205
|
] })
|
|
21848
22206
|
] }),
|
|
21849
|
-
/* @__PURE__ */
|
|
22207
|
+
/* @__PURE__ */ jsx262("div", { className: "space-y-3", children: clients.map((client) => /* @__PURE__ */ jsx262(
|
|
21850
22208
|
OAuthClientCard,
|
|
21851
22209
|
{
|
|
21852
22210
|
client,
|
|
@@ -21861,19 +22219,19 @@ function OAuthClientList({
|
|
|
21861
22219
|
__name(OAuthClientList, "OAuthClientList");
|
|
21862
22220
|
|
|
21863
22221
|
// src/features/oauth/components/OAuthClientForm.tsx
|
|
21864
|
-
import { useState as
|
|
21865
|
-
import { jsx as
|
|
22222
|
+
import { useState as useState97, useCallback as useCallback48 } from "react";
|
|
22223
|
+
import { jsx as jsx263, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
21866
22224
|
function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
21867
22225
|
const isEditMode = !!client;
|
|
21868
|
-
const [formState, setFormState] =
|
|
22226
|
+
const [formState, setFormState] = useState97({
|
|
21869
22227
|
name: client?.name || "",
|
|
21870
22228
|
description: client?.description || "",
|
|
21871
22229
|
redirectUris: client?.redirectUris?.length ? client.redirectUris : [""],
|
|
21872
22230
|
allowedScopes: client?.allowedScopes || [],
|
|
21873
22231
|
isConfidential: client?.isConfidential ?? true
|
|
21874
22232
|
});
|
|
21875
|
-
const [errors, setErrors] =
|
|
21876
|
-
const validate =
|
|
22233
|
+
const [errors, setErrors] = useState97({});
|
|
22234
|
+
const validate = useCallback48(() => {
|
|
21877
22235
|
const newErrors = {};
|
|
21878
22236
|
if (!formState.name.trim()) {
|
|
21879
22237
|
newErrors.name = "Application name is required";
|
|
@@ -21888,7 +22246,7 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21888
22246
|
setErrors(newErrors);
|
|
21889
22247
|
return Object.keys(newErrors).length === 0;
|
|
21890
22248
|
}, [formState]);
|
|
21891
|
-
const handleSubmit =
|
|
22249
|
+
const handleSubmit = useCallback48(
|
|
21892
22250
|
async (e) => {
|
|
21893
22251
|
e.preventDefault();
|
|
21894
22252
|
if (!validate()) return;
|
|
@@ -21904,15 +22262,15 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21904
22262
|
},
|
|
21905
22263
|
[formState, validate, onSubmit]
|
|
21906
22264
|
);
|
|
21907
|
-
return /* @__PURE__ */
|
|
21908
|
-
/* @__PURE__ */
|
|
21909
|
-
/* @__PURE__ */
|
|
21910
|
-
/* @__PURE__ */
|
|
22265
|
+
return /* @__PURE__ */ jsx263(Card, { children: /* @__PURE__ */ jsxs163("form", { onSubmit: handleSubmit, children: [
|
|
22266
|
+
/* @__PURE__ */ jsxs163(CardHeader, { children: [
|
|
22267
|
+
/* @__PURE__ */ jsx263(CardTitle, { children: isEditMode ? "Edit Application" : "Create OAuth Application" }),
|
|
22268
|
+
/* @__PURE__ */ jsx263(CardDescription, { children: isEditMode ? "Update your OAuth application settings." : "Register a new application to access the API." })
|
|
21911
22269
|
] }),
|
|
21912
|
-
/* @__PURE__ */
|
|
21913
|
-
/* @__PURE__ */
|
|
21914
|
-
/* @__PURE__ */
|
|
21915
|
-
/* @__PURE__ */
|
|
22270
|
+
/* @__PURE__ */ jsxs163(CardContent, { className: "space-y-6", children: [
|
|
22271
|
+
/* @__PURE__ */ jsxs163("div", { className: "space-y-2", children: [
|
|
22272
|
+
/* @__PURE__ */ jsx263(Label, { htmlFor: "name", children: "Application Name *" }),
|
|
22273
|
+
/* @__PURE__ */ jsx263(
|
|
21916
22274
|
Input,
|
|
21917
22275
|
{
|
|
21918
22276
|
id: "name",
|
|
@@ -21923,11 +22281,11 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21923
22281
|
className: errors.name ? "border-destructive" : ""
|
|
21924
22282
|
}
|
|
21925
22283
|
),
|
|
21926
|
-
errors.name && /* @__PURE__ */
|
|
22284
|
+
errors.name && /* @__PURE__ */ jsx263("p", { className: "text-destructive text-xs/relaxed", children: errors.name })
|
|
21927
22285
|
] }),
|
|
21928
|
-
/* @__PURE__ */
|
|
21929
|
-
/* @__PURE__ */
|
|
21930
|
-
/* @__PURE__ */
|
|
22286
|
+
/* @__PURE__ */ jsxs163("div", { className: "space-y-2", children: [
|
|
22287
|
+
/* @__PURE__ */ jsx263(Label, { htmlFor: "description", children: "Description" }),
|
|
22288
|
+
/* @__PURE__ */ jsx263(
|
|
21931
22289
|
Textarea,
|
|
21932
22290
|
{
|
|
21933
22291
|
id: "description",
|
|
@@ -21939,7 +22297,7 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21939
22297
|
}
|
|
21940
22298
|
)
|
|
21941
22299
|
] }),
|
|
21942
|
-
/* @__PURE__ */
|
|
22300
|
+
/* @__PURE__ */ jsx263(
|
|
21943
22301
|
OAuthRedirectUriInput,
|
|
21944
22302
|
{
|
|
21945
22303
|
value: formState.redirectUris,
|
|
@@ -21948,7 +22306,7 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21948
22306
|
disabled: isLoading
|
|
21949
22307
|
}
|
|
21950
22308
|
),
|
|
21951
|
-
/* @__PURE__ */
|
|
22309
|
+
/* @__PURE__ */ jsx263(
|
|
21952
22310
|
OAuthScopeSelector,
|
|
21953
22311
|
{
|
|
21954
22312
|
value: formState.allowedScopes,
|
|
@@ -21957,48 +22315,48 @@ function OAuthClientForm({ client, onSubmit, onCancel, isLoading = false }) {
|
|
|
21957
22315
|
disabled: isLoading
|
|
21958
22316
|
}
|
|
21959
22317
|
),
|
|
21960
|
-
/* @__PURE__ */
|
|
21961
|
-
/* @__PURE__ */
|
|
21962
|
-
/* @__PURE__ */
|
|
22318
|
+
/* @__PURE__ */ jsxs163("div", { className: "space-y-3", children: [
|
|
22319
|
+
/* @__PURE__ */ jsx263(Label, { children: "Client Type" }),
|
|
22320
|
+
/* @__PURE__ */ jsxs163(
|
|
21963
22321
|
RadioGroup,
|
|
21964
22322
|
{
|
|
21965
22323
|
value: formState.isConfidential ? "confidential" : "public",
|
|
21966
22324
|
onValueChange: (v) => setFormState((s) => ({ ...s, isConfidential: v === "confidential" })),
|
|
21967
22325
|
disabled: isLoading || isEditMode,
|
|
21968
22326
|
children: [
|
|
21969
|
-
/* @__PURE__ */
|
|
21970
|
-
/* @__PURE__ */
|
|
21971
|
-
/* @__PURE__ */
|
|
21972
|
-
/* @__PURE__ */
|
|
21973
|
-
/* @__PURE__ */
|
|
22327
|
+
/* @__PURE__ */ jsxs163("div", { className: "flex items-start space-x-3 p-3 rounded-md border", children: [
|
|
22328
|
+
/* @__PURE__ */ jsx263(RadioGroupItem, { value: "confidential", id: "confidential", className: "mt-1" }),
|
|
22329
|
+
/* @__PURE__ */ jsxs163("div", { children: [
|
|
22330
|
+
/* @__PURE__ */ jsx263(Label, { htmlFor: "confidential", className: "cursor-pointer", children: "Confidential" }),
|
|
22331
|
+
/* @__PURE__ */ jsx263("p", { className: "text-sm text-muted-foreground", children: "Server-side application that can securely store the client secret." })
|
|
21974
22332
|
] })
|
|
21975
22333
|
] }),
|
|
21976
|
-
/* @__PURE__ */
|
|
21977
|
-
/* @__PURE__ */
|
|
21978
|
-
/* @__PURE__ */
|
|
21979
|
-
/* @__PURE__ */
|
|
21980
|
-
/* @__PURE__ */
|
|
22334
|
+
/* @__PURE__ */ jsxs163("div", { className: "flex items-start space-x-3 p-3 rounded-md border", children: [
|
|
22335
|
+
/* @__PURE__ */ jsx263(RadioGroupItem, { value: "public", id: "public", className: "mt-1" }),
|
|
22336
|
+
/* @__PURE__ */ jsxs163("div", { children: [
|
|
22337
|
+
/* @__PURE__ */ jsx263(Label, { htmlFor: "public", className: "cursor-pointer", children: "Public" }),
|
|
22338
|
+
/* @__PURE__ */ jsx263("p", { className: "text-sm text-muted-foreground", children: "Mobile or desktop application. Requires PKCE for authorization." })
|
|
21981
22339
|
] })
|
|
21982
22340
|
] })
|
|
21983
22341
|
]
|
|
21984
22342
|
}
|
|
21985
22343
|
),
|
|
21986
|
-
isEditMode && /* @__PURE__ */
|
|
22344
|
+
isEditMode && /* @__PURE__ */ jsx263("p", { className: "text-sm text-muted-foreground", children: "Client type cannot be changed after creation." })
|
|
21987
22345
|
] })
|
|
21988
22346
|
] }),
|
|
21989
|
-
/* @__PURE__ */
|
|
21990
|
-
/* @__PURE__ */
|
|
21991
|
-
/* @__PURE__ */
|
|
22347
|
+
/* @__PURE__ */ jsxs163(CardFooter, { className: "flex justify-end gap-3", children: [
|
|
22348
|
+
/* @__PURE__ */ jsx263(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
22349
|
+
/* @__PURE__ */ jsx263(Button, { type: "submit", disabled: isLoading, children: isLoading ? "Saving..." : isEditMode ? "Save Changes" : "Create Application" })
|
|
21992
22350
|
] })
|
|
21993
22351
|
] }) });
|
|
21994
22352
|
}
|
|
21995
22353
|
__name(OAuthClientForm, "OAuthClientForm");
|
|
21996
22354
|
|
|
21997
22355
|
// src/features/oauth/components/OAuthClientDetail.tsx
|
|
21998
|
-
import { useState as
|
|
22356
|
+
import { useState as useState98, useCallback as useCallback49 } from "react";
|
|
21999
22357
|
import { format as format2 } from "date-fns";
|
|
22000
22358
|
import { Copy as Copy4, Check as Check2, RefreshCw as RefreshCw3, Pencil as Pencil2, Trash2 as Trash25, ExternalLink } from "lucide-react";
|
|
22001
|
-
import { Fragment as
|
|
22359
|
+
import { Fragment as Fragment56, jsx as jsx264, jsxs as jsxs164 } from "react/jsx-runtime";
|
|
22002
22360
|
function OAuthClientDetail({
|
|
22003
22361
|
client,
|
|
22004
22362
|
isLoading = false,
|
|
@@ -22006,12 +22364,12 @@ function OAuthClientDetail({
|
|
|
22006
22364
|
onDelete,
|
|
22007
22365
|
onRegenerateSecret
|
|
22008
22366
|
}) {
|
|
22009
|
-
const [copiedField, setCopiedField] =
|
|
22010
|
-
const [showDeleteConfirm, setShowDeleteConfirm] =
|
|
22011
|
-
const [showRegenerateConfirm, setShowRegenerateConfirm] =
|
|
22012
|
-
const [isDeleting, setIsDeleting] =
|
|
22013
|
-
const [isRegenerating, setIsRegenerating] =
|
|
22014
|
-
const copyToClipboard2 =
|
|
22367
|
+
const [copiedField, setCopiedField] = useState98(null);
|
|
22368
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = useState98(false);
|
|
22369
|
+
const [showRegenerateConfirm, setShowRegenerateConfirm] = useState98(false);
|
|
22370
|
+
const [isDeleting, setIsDeleting] = useState98(false);
|
|
22371
|
+
const [isRegenerating, setIsRegenerating] = useState98(false);
|
|
22372
|
+
const copyToClipboard2 = useCallback49(async (text, field) => {
|
|
22015
22373
|
try {
|
|
22016
22374
|
await navigator.clipboard.writeText(text);
|
|
22017
22375
|
setCopiedField(field);
|
|
@@ -22020,7 +22378,7 @@ function OAuthClientDetail({
|
|
|
22020
22378
|
console.error("Failed to copy:", err);
|
|
22021
22379
|
}
|
|
22022
22380
|
}, []);
|
|
22023
|
-
const handleDelete =
|
|
22381
|
+
const handleDelete = useCallback49(async () => {
|
|
22024
22382
|
if (!onDelete) return;
|
|
22025
22383
|
setIsDeleting(true);
|
|
22026
22384
|
try {
|
|
@@ -22030,7 +22388,7 @@ function OAuthClientDetail({
|
|
|
22030
22388
|
setShowDeleteConfirm(false);
|
|
22031
22389
|
}
|
|
22032
22390
|
}, [onDelete]);
|
|
22033
|
-
const handleRegenerateSecret =
|
|
22391
|
+
const handleRegenerateSecret = useCallback49(async () => {
|
|
22034
22392
|
if (!onRegenerateSecret) return;
|
|
22035
22393
|
setIsRegenerating(true);
|
|
22036
22394
|
try {
|
|
@@ -22041,40 +22399,40 @@ function OAuthClientDetail({
|
|
|
22041
22399
|
}
|
|
22042
22400
|
}, [onRegenerateSecret]);
|
|
22043
22401
|
const createdDate = client.createdAt ? format2(new Date(client.createdAt), "MMMM d, yyyy") : "Unknown";
|
|
22044
|
-
return /* @__PURE__ */
|
|
22045
|
-
/* @__PURE__ */
|
|
22046
|
-
/* @__PURE__ */
|
|
22047
|
-
/* @__PURE__ */
|
|
22048
|
-
/* @__PURE__ */
|
|
22049
|
-
client.description && /* @__PURE__ */
|
|
22402
|
+
return /* @__PURE__ */ jsxs164(Fragment56, { children: [
|
|
22403
|
+
/* @__PURE__ */ jsxs164(Card, { children: [
|
|
22404
|
+
/* @__PURE__ */ jsx264(CardHeader, { children: /* @__PURE__ */ jsxs164("div", { className: "flex items-start justify-between", children: [
|
|
22405
|
+
/* @__PURE__ */ jsxs164("div", { children: [
|
|
22406
|
+
/* @__PURE__ */ jsx264(CardTitle, { children: client.name }),
|
|
22407
|
+
client.description && /* @__PURE__ */ jsx264(CardDescription, { className: "mt-1", children: client.description })
|
|
22050
22408
|
] }),
|
|
22051
|
-
/* @__PURE__ */
|
|
22052
|
-
/* @__PURE__ */
|
|
22053
|
-
/* @__PURE__ */
|
|
22409
|
+
/* @__PURE__ */ jsxs164("div", { className: "flex items-center gap-2", children: [
|
|
22410
|
+
/* @__PURE__ */ jsx264(Badge, { variant: client.isActive ? "default" : "secondary", children: client.isActive ? "Active" : "Inactive" }),
|
|
22411
|
+
/* @__PURE__ */ jsx264(Badge, { variant: "outline", children: client.isConfidential ? "Confidential" : "Public" })
|
|
22054
22412
|
] })
|
|
22055
22413
|
] }) }),
|
|
22056
|
-
/* @__PURE__ */
|
|
22057
|
-
/* @__PURE__ */
|
|
22058
|
-
/* @__PURE__ */
|
|
22059
|
-
/* @__PURE__ */
|
|
22060
|
-
/* @__PURE__ */
|
|
22061
|
-
/* @__PURE__ */
|
|
22414
|
+
/* @__PURE__ */ jsxs164(CardContent, { className: "space-y-6", children: [
|
|
22415
|
+
/* @__PURE__ */ jsxs164("div", { className: "space-y-2", children: [
|
|
22416
|
+
/* @__PURE__ */ jsx264(Label, { children: "Client ID" }),
|
|
22417
|
+
/* @__PURE__ */ jsxs164("div", { className: "flex gap-2", children: [
|
|
22418
|
+
/* @__PURE__ */ jsx264(Input, { value: client.clientId, readOnly: true, className: "tabular-nums" }),
|
|
22419
|
+
/* @__PURE__ */ jsx264(
|
|
22062
22420
|
Button,
|
|
22063
22421
|
{
|
|
22064
22422
|
variant: "outline",
|
|
22065
22423
|
size: "icon",
|
|
22066
22424
|
onClick: () => copyToClipboard2(client.clientId, "clientId"),
|
|
22067
22425
|
title: "Copy Client ID",
|
|
22068
|
-
children: copiedField === "clientId" ? /* @__PURE__ */
|
|
22426
|
+
children: copiedField === "clientId" ? /* @__PURE__ */ jsx264(Check2, { className: "text-success h-4 w-4" }) : /* @__PURE__ */ jsx264(Copy4, { className: "h-4 w-4" })
|
|
22069
22427
|
}
|
|
22070
22428
|
)
|
|
22071
22429
|
] })
|
|
22072
22430
|
] }),
|
|
22073
|
-
/* @__PURE__ */
|
|
22074
|
-
/* @__PURE__ */
|
|
22075
|
-
/* @__PURE__ */
|
|
22076
|
-
/* @__PURE__ */
|
|
22077
|
-
onRegenerateSecret && /* @__PURE__ */
|
|
22431
|
+
/* @__PURE__ */ jsxs164("div", { className: "space-y-2", children: [
|
|
22432
|
+
/* @__PURE__ */ jsx264(Label, { children: "Client Secret" }),
|
|
22433
|
+
/* @__PURE__ */ jsxs164("div", { className: "flex gap-2", children: [
|
|
22434
|
+
/* @__PURE__ */ jsx264(Input, { value: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", readOnly: true, className: "tabular-nums" }),
|
|
22435
|
+
onRegenerateSecret && /* @__PURE__ */ jsx264(
|
|
22078
22436
|
Button,
|
|
22079
22437
|
{
|
|
22080
22438
|
variant: "outline",
|
|
@@ -22082,57 +22440,57 @@ function OAuthClientDetail({
|
|
|
22082
22440
|
onClick: () => setShowRegenerateConfirm(true),
|
|
22083
22441
|
title: "Regenerate Secret",
|
|
22084
22442
|
disabled: isLoading,
|
|
22085
|
-
children: /* @__PURE__ */
|
|
22443
|
+
children: /* @__PURE__ */ jsx264(RefreshCw3, { className: "h-4 w-4" })
|
|
22086
22444
|
}
|
|
22087
22445
|
)
|
|
22088
22446
|
] }),
|
|
22089
|
-
/* @__PURE__ */
|
|
22447
|
+
/* @__PURE__ */ jsx264("p", { className: "text-xs text-muted-foreground", children: "Regenerating will invalidate the current secret and all existing tokens." })
|
|
22090
22448
|
] }),
|
|
22091
|
-
/* @__PURE__ */
|
|
22092
|
-
/* @__PURE__ */
|
|
22093
|
-
/* @__PURE__ */
|
|
22094
|
-
/* @__PURE__ */
|
|
22095
|
-
/* @__PURE__ */
|
|
22449
|
+
/* @__PURE__ */ jsx264(Separator, {}),
|
|
22450
|
+
/* @__PURE__ */ jsxs164("div", { className: "space-y-2", children: [
|
|
22451
|
+
/* @__PURE__ */ jsx264(Label, { children: "Redirect URIs" }),
|
|
22452
|
+
/* @__PURE__ */ jsx264("ul", { className: "space-y-1", children: client.redirectUris.map((uri, index) => /* @__PURE__ */ jsxs164("li", { className: "flex items-center gap-2 text-sm tabular-nums", children: [
|
|
22453
|
+
/* @__PURE__ */ jsx264(ExternalLink, { className: "h-3 w-3 text-muted-foreground" }),
|
|
22096
22454
|
uri
|
|
22097
22455
|
] }, index)) })
|
|
22098
22456
|
] }),
|
|
22099
|
-
/* @__PURE__ */
|
|
22100
|
-
/* @__PURE__ */
|
|
22101
|
-
/* @__PURE__ */
|
|
22457
|
+
/* @__PURE__ */ jsxs164("div", { className: "space-y-2", children: [
|
|
22458
|
+
/* @__PURE__ */ jsx264(Label, { children: "Allowed Scopes" }),
|
|
22459
|
+
/* @__PURE__ */ jsx264("div", { className: "flex flex-wrap gap-2", children: client.allowedScopes.map((scope) => /* @__PURE__ */ jsx264(Badge, { variant: "secondary", children: OAUTH_SCOPE_DISPLAY[scope]?.name || scope }, scope)) })
|
|
22102
22460
|
] }),
|
|
22103
|
-
/* @__PURE__ */
|
|
22104
|
-
/* @__PURE__ */
|
|
22105
|
-
/* @__PURE__ */
|
|
22461
|
+
/* @__PURE__ */ jsxs164("div", { className: "space-y-2", children: [
|
|
22462
|
+
/* @__PURE__ */ jsx264(Label, { children: "Grant Types" }),
|
|
22463
|
+
/* @__PURE__ */ jsx264("div", { className: "flex flex-wrap gap-2", children: client.allowedGrantTypes.map((grant) => /* @__PURE__ */ jsx264(Badge, { variant: "outline", children: grant.replace(/_/g, " ") }, grant)) })
|
|
22106
22464
|
] }),
|
|
22107
|
-
/* @__PURE__ */
|
|
22108
|
-
/* @__PURE__ */
|
|
22465
|
+
/* @__PURE__ */ jsx264(Separator, {}),
|
|
22466
|
+
/* @__PURE__ */ jsx264("div", { className: "flex flex-wrap gap-x-6 gap-y-2 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxs164("span", { children: [
|
|
22109
22467
|
"Created: ",
|
|
22110
22468
|
createdDate
|
|
22111
22469
|
] }) }),
|
|
22112
|
-
/* @__PURE__ */
|
|
22113
|
-
onEdit && /* @__PURE__ */
|
|
22114
|
-
/* @__PURE__ */
|
|
22470
|
+
/* @__PURE__ */ jsxs164("div", { className: "flex gap-3 pt-4", children: [
|
|
22471
|
+
onEdit && /* @__PURE__ */ jsxs164(Button, { variant: "outline", onClick: onEdit, disabled: isLoading, children: [
|
|
22472
|
+
/* @__PURE__ */ jsx264(Pencil2, { className: "h-4 w-4 mr-2" }),
|
|
22115
22473
|
"Edit"
|
|
22116
22474
|
] }),
|
|
22117
|
-
onDelete && /* @__PURE__ */
|
|
22118
|
-
/* @__PURE__ */
|
|
22475
|
+
onDelete && /* @__PURE__ */ jsxs164(Button, { variant: "destructive", onClick: () => setShowDeleteConfirm(true), disabled: isLoading, children: [
|
|
22476
|
+
/* @__PURE__ */ jsx264(Trash25, { className: "h-4 w-4 mr-2" }),
|
|
22119
22477
|
"Delete"
|
|
22120
22478
|
] })
|
|
22121
22479
|
] })
|
|
22122
22480
|
] })
|
|
22123
22481
|
] }),
|
|
22124
|
-
/* @__PURE__ */
|
|
22125
|
-
/* @__PURE__ */
|
|
22126
|
-
/* @__PURE__ */
|
|
22127
|
-
/* @__PURE__ */
|
|
22482
|
+
/* @__PURE__ */ jsx264(AlertDialog, { open: showDeleteConfirm, onOpenChange: setShowDeleteConfirm, children: /* @__PURE__ */ jsxs164(AlertDialogContent, { children: [
|
|
22483
|
+
/* @__PURE__ */ jsxs164(AlertDialogHeader, { children: [
|
|
22484
|
+
/* @__PURE__ */ jsx264(AlertDialogTitle, { children: "Delete OAuth Application?" }),
|
|
22485
|
+
/* @__PURE__ */ jsxs164(AlertDialogDescription, { children: [
|
|
22128
22486
|
'This will permanently delete "',
|
|
22129
22487
|
client.name,
|
|
22130
22488
|
'" and revoke all access tokens. This action cannot be undone.'
|
|
22131
22489
|
] })
|
|
22132
22490
|
] }),
|
|
22133
|
-
/* @__PURE__ */
|
|
22134
|
-
/* @__PURE__ */
|
|
22135
|
-
/* @__PURE__ */
|
|
22491
|
+
/* @__PURE__ */ jsxs164(AlertDialogFooter, { children: [
|
|
22492
|
+
/* @__PURE__ */ jsx264(AlertDialogCancel, { disabled: isDeleting, children: "Cancel" }),
|
|
22493
|
+
/* @__PURE__ */ jsx264(
|
|
22136
22494
|
AlertDialogAction,
|
|
22137
22495
|
{
|
|
22138
22496
|
onClick: handleDelete,
|
|
@@ -22143,14 +22501,14 @@ function OAuthClientDetail({
|
|
|
22143
22501
|
)
|
|
22144
22502
|
] })
|
|
22145
22503
|
] }) }),
|
|
22146
|
-
/* @__PURE__ */
|
|
22147
|
-
/* @__PURE__ */
|
|
22148
|
-
/* @__PURE__ */
|
|
22149
|
-
/* @__PURE__ */
|
|
22504
|
+
/* @__PURE__ */ jsx264(AlertDialog, { open: showRegenerateConfirm, onOpenChange: setShowRegenerateConfirm, children: /* @__PURE__ */ jsxs164(AlertDialogContent, { children: [
|
|
22505
|
+
/* @__PURE__ */ jsxs164(AlertDialogHeader, { children: [
|
|
22506
|
+
/* @__PURE__ */ jsx264(AlertDialogTitle, { children: "Regenerate Client Secret?" }),
|
|
22507
|
+
/* @__PURE__ */ jsx264(AlertDialogDescription, { children: "This will generate a new client secret and invalidate the old one. All existing tokens will be revoked. You will need to update your application with the new secret." })
|
|
22150
22508
|
] }),
|
|
22151
|
-
/* @__PURE__ */
|
|
22152
|
-
/* @__PURE__ */
|
|
22153
|
-
/* @__PURE__ */
|
|
22509
|
+
/* @__PURE__ */ jsxs164(AlertDialogFooter, { children: [
|
|
22510
|
+
/* @__PURE__ */ jsx264(AlertDialogCancel, { disabled: isRegenerating, children: "Cancel" }),
|
|
22511
|
+
/* @__PURE__ */ jsx264(AlertDialogAction, { onClick: handleRegenerateSecret, disabled: isRegenerating, children: isRegenerating ? "Regenerating..." : "Regenerate" })
|
|
22154
22512
|
] })
|
|
22155
22513
|
] }) })
|
|
22156
22514
|
] });
|
|
@@ -22159,17 +22517,17 @@ __name(OAuthClientDetail, "OAuthClientDetail");
|
|
|
22159
22517
|
|
|
22160
22518
|
// src/features/oauth/components/consent/OAuthConsentHeader.tsx
|
|
22161
22519
|
import { Shield } from "lucide-react";
|
|
22162
|
-
import { jsx as
|
|
22520
|
+
import { jsx as jsx265, jsxs as jsxs165 } from "react/jsx-runtime";
|
|
22163
22521
|
function OAuthConsentHeader({ client, logoUrl, appName = "Only35" }) {
|
|
22164
|
-
return /* @__PURE__ */
|
|
22165
|
-
/* @__PURE__ */
|
|
22166
|
-
/* @__PURE__ */
|
|
22167
|
-
/* @__PURE__ */
|
|
22522
|
+
return /* @__PURE__ */ jsxs165("div", { className: "text-center space-y-4", children: [
|
|
22523
|
+
/* @__PURE__ */ jsx265("div", { className: "flex justify-center", children: logoUrl ? /* @__PURE__ */ jsx265("img", { src: logoUrl, alt: appName, className: "h-12 w-auto" }) : /* @__PURE__ */ jsx265("div", { className: "h-12 w-12 rounded-full bg-primary flex items-center justify-center", children: /* @__PURE__ */ jsx265(Shield, { className: "h-6 w-6 text-primary-foreground" }) }) }),
|
|
22524
|
+
/* @__PURE__ */ jsxs165("div", { className: "space-y-2", children: [
|
|
22525
|
+
/* @__PURE__ */ jsxs165("h1", { className: "text-primary text-3xl font-semibold", children: [
|
|
22168
22526
|
"Authorize ",
|
|
22169
22527
|
client.name
|
|
22170
22528
|
] }),
|
|
22171
|
-
/* @__PURE__ */
|
|
22172
|
-
/* @__PURE__ */
|
|
22529
|
+
/* @__PURE__ */ jsxs165("p", { className: "text-muted-foreground", children: [
|
|
22530
|
+
/* @__PURE__ */ jsx265("span", { className: "font-medium text-foreground", children: client.name }),
|
|
22173
22531
|
" wants to access your ",
|
|
22174
22532
|
appName,
|
|
22175
22533
|
" account"
|
|
@@ -22181,7 +22539,7 @@ __name(OAuthConsentHeader, "OAuthConsentHeader");
|
|
|
22181
22539
|
|
|
22182
22540
|
// src/features/oauth/components/consent/OAuthScopeList.tsx
|
|
22183
22541
|
import { Eye, Pencil as Pencil3, Image as Image15, Upload, Film, FolderPlus, User, Shield as Shield2 } from "lucide-react";
|
|
22184
|
-
import { jsx as
|
|
22542
|
+
import { jsx as jsx266, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
22185
22543
|
var SCOPE_ICONS = {
|
|
22186
22544
|
eye: Eye,
|
|
22187
22545
|
pencil: Pencil3,
|
|
@@ -22196,15 +22554,15 @@ function OAuthScopeList({ scopes }) {
|
|
|
22196
22554
|
if (scopes.length === 0) {
|
|
22197
22555
|
return null;
|
|
22198
22556
|
}
|
|
22199
|
-
return /* @__PURE__ */
|
|
22200
|
-
/* @__PURE__ */
|
|
22201
|
-
/* @__PURE__ */
|
|
22557
|
+
return /* @__PURE__ */ jsxs166("div", { className: "space-y-3", children: [
|
|
22558
|
+
/* @__PURE__ */ jsx266(MicroLabel, { as: "h3", children: "This will allow the application to:" }),
|
|
22559
|
+
/* @__PURE__ */ jsx266("ul", { className: "space-y-3", children: scopes.map((scope) => {
|
|
22202
22560
|
const IconComponent = scope.icon ? SCOPE_ICONS[scope.icon] : Eye;
|
|
22203
|
-
return /* @__PURE__ */
|
|
22204
|
-
/* @__PURE__ */
|
|
22205
|
-
/* @__PURE__ */
|
|
22206
|
-
/* @__PURE__ */
|
|
22207
|
-
/* @__PURE__ */
|
|
22561
|
+
return /* @__PURE__ */ jsxs166("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
22562
|
+
/* @__PURE__ */ jsx266("div", { className: "flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsx266("div", { className: "h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center", children: IconComponent && /* @__PURE__ */ jsx266(IconComponent, { className: "h-4 w-4 text-primary" }) }) }),
|
|
22563
|
+
/* @__PURE__ */ jsxs166("div", { className: "flex-1", children: [
|
|
22564
|
+
/* @__PURE__ */ jsx266("p", { className: "font-medium", children: scope.name }),
|
|
22565
|
+
/* @__PURE__ */ jsx266("p", { className: "text-sm text-muted-foreground", children: scope.description })
|
|
22208
22566
|
] })
|
|
22209
22567
|
] }, scope.scope);
|
|
22210
22568
|
}) })
|
|
@@ -22213,18 +22571,18 @@ function OAuthScopeList({ scopes }) {
|
|
|
22213
22571
|
__name(OAuthScopeList, "OAuthScopeList");
|
|
22214
22572
|
|
|
22215
22573
|
// src/features/oauth/components/consent/OAuthConsentActions.tsx
|
|
22216
|
-
import { jsx as
|
|
22574
|
+
import { jsx as jsx267, jsxs as jsxs167 } from "react/jsx-runtime";
|
|
22217
22575
|
function OAuthConsentActions({ onApprove, onDeny, isLoading = false }) {
|
|
22218
|
-
return /* @__PURE__ */
|
|
22219
|
-
/* @__PURE__ */
|
|
22220
|
-
/* @__PURE__ */
|
|
22576
|
+
return /* @__PURE__ */ jsxs167("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
22577
|
+
/* @__PURE__ */ jsx267(Button, { variant: "outline", onClick: onDeny, disabled: isLoading, className: "flex-1", children: "Deny" }),
|
|
22578
|
+
/* @__PURE__ */ jsx267(Button, { onClick: onApprove, disabled: isLoading, className: "flex-1", children: isLoading ? "Authorizing..." : "Authorize" })
|
|
22221
22579
|
] });
|
|
22222
22580
|
}
|
|
22223
22581
|
__name(OAuthConsentActions, "OAuthConsentActions");
|
|
22224
22582
|
|
|
22225
22583
|
// src/features/oauth/components/consent/OAuthConsentScreen.tsx
|
|
22226
22584
|
import { ExternalLink as ExternalLink2, AlertTriangle as AlertTriangle2, Loader2 as Loader27 } from "lucide-react";
|
|
22227
|
-
import { jsx as
|
|
22585
|
+
import { jsx as jsx268, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
22228
22586
|
function OAuthConsentScreen({
|
|
22229
22587
|
params,
|
|
22230
22588
|
logoUrl,
|
|
@@ -22234,41 +22592,41 @@ function OAuthConsentScreen({
|
|
|
22234
22592
|
}) {
|
|
22235
22593
|
const { clientInfo, isLoading, error, approve, deny, isSubmitting } = useOAuthConsent(params);
|
|
22236
22594
|
if (isLoading) {
|
|
22237
|
-
return /* @__PURE__ */
|
|
22238
|
-
/* @__PURE__ */
|
|
22239
|
-
/* @__PURE__ */
|
|
22595
|
+
return /* @__PURE__ */ jsx268("div", { className: "min-h-dvh flex items-center justify-center p-4", children: /* @__PURE__ */ jsx268(Card, { className: "w-full max-w-md", children: /* @__PURE__ */ jsxs168(CardContent, { className: "flex flex-col items-center justify-center py-12", children: [
|
|
22596
|
+
/* @__PURE__ */ jsx268(Loader27, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
|
|
22597
|
+
/* @__PURE__ */ jsx268("p", { className: "mt-4 text-muted-foreground", children: "Loading authorization request..." })
|
|
22240
22598
|
] }) }) });
|
|
22241
22599
|
}
|
|
22242
22600
|
if (error || !clientInfo) {
|
|
22243
|
-
return /* @__PURE__ */
|
|
22244
|
-
/* @__PURE__ */
|
|
22245
|
-
/* @__PURE__ */
|
|
22601
|
+
return /* @__PURE__ */ jsx268("div", { className: "min-h-dvh flex items-center justify-center p-4", children: /* @__PURE__ */ jsx268(Card, { className: "w-full max-w-md", children: /* @__PURE__ */ jsx268(CardContent, { className: "py-8", children: /* @__PURE__ */ jsxs168(Alert, { variant: "destructive", children: [
|
|
22602
|
+
/* @__PURE__ */ jsx268(AlertTriangle2, { className: "h-4 w-4" }),
|
|
22603
|
+
/* @__PURE__ */ jsx268(AlertDescription, { children: error?.message || "Invalid authorization request. Please try again." })
|
|
22246
22604
|
] }) }) }) });
|
|
22247
22605
|
}
|
|
22248
22606
|
const { client, scopes } = clientInfo;
|
|
22249
|
-
return /* @__PURE__ */
|
|
22250
|
-
/* @__PURE__ */
|
|
22251
|
-
/* @__PURE__ */
|
|
22252
|
-
/* @__PURE__ */
|
|
22253
|
-
/* @__PURE__ */
|
|
22254
|
-
/* @__PURE__ */
|
|
22255
|
-
/* @__PURE__ */
|
|
22256
|
-
/* @__PURE__ */
|
|
22257
|
-
/* @__PURE__ */
|
|
22258
|
-
/* @__PURE__ */
|
|
22259
|
-
/* @__PURE__ */
|
|
22607
|
+
return /* @__PURE__ */ jsx268("div", { className: "min-h-dvh flex items-center justify-center p-4 bg-muted/30", children: /* @__PURE__ */ jsxs168(Card, { className: "w-full max-w-md", children: [
|
|
22608
|
+
/* @__PURE__ */ jsxs168(CardContent, { className: "pt-6 space-y-6", children: [
|
|
22609
|
+
/* @__PURE__ */ jsx268(OAuthConsentHeader, { client, logoUrl, appName }),
|
|
22610
|
+
/* @__PURE__ */ jsx268(Separator, {}),
|
|
22611
|
+
/* @__PURE__ */ jsx268(OAuthScopeList, { scopes }),
|
|
22612
|
+
/* @__PURE__ */ jsx268(Separator, {}),
|
|
22613
|
+
/* @__PURE__ */ jsxs168("div", { className: "flex items-start gap-2 text-sm text-muted-foreground", children: [
|
|
22614
|
+
/* @__PURE__ */ jsx268(ExternalLink2, { className: "h-4 w-4 mt-0.5 flex-shrink-0" }),
|
|
22615
|
+
/* @__PURE__ */ jsxs168("div", { children: [
|
|
22616
|
+
/* @__PURE__ */ jsx268("span", { children: "Authorizing will redirect you to:" }),
|
|
22617
|
+
/* @__PURE__ */ jsx268("p", { className: "tabular-nums text-xs mt-1 break-all", children: params.redirectUri })
|
|
22260
22618
|
] })
|
|
22261
22619
|
] }),
|
|
22262
|
-
/* @__PURE__ */
|
|
22620
|
+
/* @__PURE__ */ jsx268(OAuthConsentActions, { onApprove: approve, onDeny: deny, isLoading: isSubmitting })
|
|
22263
22621
|
] }),
|
|
22264
|
-
/* @__PURE__ */
|
|
22622
|
+
/* @__PURE__ */ jsx268(CardFooter, { className: "justify-center", children: /* @__PURE__ */ jsxs168("p", { className: "text-xs text-center text-muted-foreground", children: [
|
|
22265
22623
|
"By authorizing, you agree to the app's",
|
|
22266
22624
|
" ",
|
|
22267
|
-
/* @__PURE__ */
|
|
22625
|
+
/* @__PURE__ */ jsx268("a", { href: termsUrl, className: "hover:text-foreground", target: "_blank", rel: "noopener", children: "Terms of Service" }),
|
|
22268
22626
|
" ",
|
|
22269
22627
|
"and",
|
|
22270
22628
|
" ",
|
|
22271
|
-
/* @__PURE__ */
|
|
22629
|
+
/* @__PURE__ */ jsx268("a", { href: privacyUrl, className: "hover:text-foreground", target: "_blank", rel: "noopener", children: "Privacy Policy" }),
|
|
22272
22630
|
"."
|
|
22273
22631
|
] }) })
|
|
22274
22632
|
] }) });
|
|
@@ -22278,14 +22636,14 @@ __name(OAuthConsentScreen, "OAuthConsentScreen");
|
|
|
22278
22636
|
// src/features/waitlist/components/forms/WaitlistForm.tsx
|
|
22279
22637
|
import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
|
|
22280
22638
|
import { CheckCircle, Mail as Mail2 } from "lucide-react";
|
|
22281
|
-
import { useTranslations as
|
|
22282
|
-
import { useState as
|
|
22639
|
+
import { useTranslations as useTranslations110 } from "next-intl";
|
|
22640
|
+
import { useState as useState99 } from "react";
|
|
22283
22641
|
import { useForm as useForm10 } from "react-hook-form";
|
|
22284
22642
|
import { v4 as v411 } from "uuid";
|
|
22285
22643
|
import { z as z10 } from "zod";
|
|
22286
22644
|
|
|
22287
22645
|
// src/features/waitlist/components/forms/WaitlistQuestionnaireRenderer.tsx
|
|
22288
|
-
import { jsx as
|
|
22646
|
+
import { jsx as jsx269, jsxs as jsxs169 } from "react/jsx-runtime";
|
|
22289
22647
|
function WaitlistQuestionnaireRenderer({
|
|
22290
22648
|
form,
|
|
22291
22649
|
fields,
|
|
@@ -22294,11 +22652,11 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22294
22652
|
if (!fields || fields.length === 0) {
|
|
22295
22653
|
return null;
|
|
22296
22654
|
}
|
|
22297
|
-
return /* @__PURE__ */
|
|
22655
|
+
return /* @__PURE__ */ jsx269("div", { className: "space-y-4", children: fields.map((field) => {
|
|
22298
22656
|
const fieldId = `${fieldPrefix}.${field.id}`;
|
|
22299
22657
|
switch (field.type) {
|
|
22300
22658
|
case "text":
|
|
22301
|
-
return /* @__PURE__ */
|
|
22659
|
+
return /* @__PURE__ */ jsx269(
|
|
22302
22660
|
FormInput,
|
|
22303
22661
|
{
|
|
22304
22662
|
form,
|
|
@@ -22310,7 +22668,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22310
22668
|
field.id
|
|
22311
22669
|
);
|
|
22312
22670
|
case "textarea":
|
|
22313
|
-
return /* @__PURE__ */
|
|
22671
|
+
return /* @__PURE__ */ jsx269(
|
|
22314
22672
|
FormTextarea,
|
|
22315
22673
|
{
|
|
22316
22674
|
form,
|
|
@@ -22325,7 +22683,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22325
22683
|
if (!field.options || field.options.length === 0) {
|
|
22326
22684
|
return null;
|
|
22327
22685
|
}
|
|
22328
|
-
return /* @__PURE__ */
|
|
22686
|
+
return /* @__PURE__ */ jsx269(
|
|
22329
22687
|
FormSelect,
|
|
22330
22688
|
{
|
|
22331
22689
|
form,
|
|
@@ -22340,7 +22698,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22340
22698
|
);
|
|
22341
22699
|
case "checkbox":
|
|
22342
22700
|
if (!field.options || field.options.length === 0) {
|
|
22343
|
-
return /* @__PURE__ */
|
|
22701
|
+
return /* @__PURE__ */ jsx269(
|
|
22344
22702
|
FormCheckbox,
|
|
22345
22703
|
{
|
|
22346
22704
|
form,
|
|
@@ -22352,13 +22710,13 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22352
22710
|
field.id
|
|
22353
22711
|
);
|
|
22354
22712
|
}
|
|
22355
|
-
return /* @__PURE__ */
|
|
22356
|
-
/* @__PURE__ */
|
|
22713
|
+
return /* @__PURE__ */ jsxs169("div", { className: "space-y-2", children: [
|
|
22714
|
+
/* @__PURE__ */ jsxs169("span", { className: "text-sm font-medium", children: [
|
|
22357
22715
|
field.label,
|
|
22358
|
-
field.required && /* @__PURE__ */
|
|
22716
|
+
field.required && /* @__PURE__ */ jsx269("span", { className: "ml-1 text-destructive", children: "*" })
|
|
22359
22717
|
] }),
|
|
22360
|
-
field.description && /* @__PURE__ */
|
|
22361
|
-
/* @__PURE__ */
|
|
22718
|
+
field.description && /* @__PURE__ */ jsx269("p", { className: "text-muted-foreground text-xs", children: field.description }),
|
|
22719
|
+
/* @__PURE__ */ jsx269("div", { className: "space-y-2", children: field.options.map((option) => /* @__PURE__ */ jsx269(
|
|
22362
22720
|
FormCheckbox,
|
|
22363
22721
|
{
|
|
22364
22722
|
form,
|
|
@@ -22377,11 +22735,11 @@ function WaitlistQuestionnaireRenderer({
|
|
|
22377
22735
|
__name(WaitlistQuestionnaireRenderer, "WaitlistQuestionnaireRenderer");
|
|
22378
22736
|
|
|
22379
22737
|
// src/features/waitlist/components/forms/WaitlistForm.tsx
|
|
22380
|
-
import { Fragment as
|
|
22738
|
+
import { Fragment as Fragment57, jsx as jsx270, jsxs as jsxs170 } from "react/jsx-runtime";
|
|
22381
22739
|
function WaitlistForm({ onSuccess }) {
|
|
22382
|
-
const t =
|
|
22383
|
-
const [isSubmitting, setIsSubmitting] =
|
|
22384
|
-
const [isSuccess, setIsSuccess] =
|
|
22740
|
+
const t = useTranslations110();
|
|
22741
|
+
const [isSubmitting, setIsSubmitting] = useState99(false);
|
|
22742
|
+
const [isSuccess, setIsSuccess] = useState99(false);
|
|
22385
22743
|
const config = getWaitlistConfig();
|
|
22386
22744
|
const questionnaireFields = config.questionnaire ?? [];
|
|
22387
22745
|
const questionnaireSchema = questionnaireFields.reduce(
|
|
@@ -22466,20 +22824,20 @@ function WaitlistForm({ onSuccess }) {
|
|
|
22466
22824
|
}
|
|
22467
22825
|
}, "onSubmit");
|
|
22468
22826
|
if (isSuccess) {
|
|
22469
|
-
return /* @__PURE__ */
|
|
22470
|
-
/* @__PURE__ */
|
|
22471
|
-
/* @__PURE__ */
|
|
22472
|
-
/* @__PURE__ */
|
|
22473
|
-
/* @__PURE__ */
|
|
22827
|
+
return /* @__PURE__ */ jsxs170("div", { className: "space-y-6 text-center", children: [
|
|
22828
|
+
/* @__PURE__ */ jsx270("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-green-100", children: /* @__PURE__ */ jsx270(CheckCircle, { className: "text-success h-8 w-8" }) }),
|
|
22829
|
+
/* @__PURE__ */ jsxs170("div", { className: "space-y-2", children: [
|
|
22830
|
+
/* @__PURE__ */ jsx270(SectionHeader, { children: t("waitlist.success.title") }),
|
|
22831
|
+
/* @__PURE__ */ jsx270("p", { className: "text-muted-foreground", children: t("waitlist.success.description") })
|
|
22474
22832
|
] }),
|
|
22475
|
-
/* @__PURE__ */
|
|
22476
|
-
/* @__PURE__ */
|
|
22477
|
-
/* @__PURE__ */
|
|
22833
|
+
/* @__PURE__ */ jsxs170("div", { className: "flex items-center justify-center gap-2 text-muted-foreground text-sm", children: [
|
|
22834
|
+
/* @__PURE__ */ jsx270(Mail2, { className: "h-4 w-4" }),
|
|
22835
|
+
/* @__PURE__ */ jsx270("span", { children: t("waitlist.success.hint") })
|
|
22478
22836
|
] })
|
|
22479
22837
|
] });
|
|
22480
22838
|
}
|
|
22481
|
-
return /* @__PURE__ */
|
|
22482
|
-
/* @__PURE__ */
|
|
22839
|
+
return /* @__PURE__ */ jsx270(Form, { ...form, children: /* @__PURE__ */ jsxs170("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
22840
|
+
/* @__PURE__ */ jsx270(
|
|
22483
22841
|
FormInput,
|
|
22484
22842
|
{
|
|
22485
22843
|
isRequired: true,
|
|
@@ -22489,23 +22847,23 @@ function WaitlistForm({ onSuccess }) {
|
|
|
22489
22847
|
placeholder: t("common.fields.email.placeholder")
|
|
22490
22848
|
}
|
|
22491
22849
|
),
|
|
22492
|
-
questionnaireFields.length > 0 && /* @__PURE__ */
|
|
22493
|
-
/* @__PURE__ */
|
|
22494
|
-
/* @__PURE__ */
|
|
22850
|
+
questionnaireFields.length > 0 && /* @__PURE__ */ jsx270(WaitlistQuestionnaireRenderer, { form, fields: questionnaireFields }),
|
|
22851
|
+
/* @__PURE__ */ jsxs170("div", { className: "space-y-4 py-4", children: [
|
|
22852
|
+
/* @__PURE__ */ jsx270(
|
|
22495
22853
|
GdprConsentCheckbox,
|
|
22496
22854
|
{
|
|
22497
22855
|
form,
|
|
22498
22856
|
id: "gdprConsent",
|
|
22499
|
-
label: /* @__PURE__ */
|
|
22857
|
+
label: /* @__PURE__ */ jsxs170(Fragment57, { children: [
|
|
22500
22858
|
t("auth.gdpr.terms_prefix"),
|
|
22501
|
-
/* @__PURE__ */
|
|
22859
|
+
/* @__PURE__ */ jsx270(Link, { href: "/terms", target: "_blank", rel: "noopener", children: t("auth.gdpr.terms_of_service") }),
|
|
22502
22860
|
t("auth.gdpr.and"),
|
|
22503
|
-
/* @__PURE__ */
|
|
22861
|
+
/* @__PURE__ */ jsx270(Link, { href: "/privacy", target: "_blank", rel: "noopener", children: t("auth.gdpr.privacy_policy") })
|
|
22504
22862
|
] }),
|
|
22505
22863
|
required: true
|
|
22506
22864
|
}
|
|
22507
22865
|
),
|
|
22508
|
-
/* @__PURE__ */
|
|
22866
|
+
/* @__PURE__ */ jsx270(
|
|
22509
22867
|
GdprConsentCheckbox,
|
|
22510
22868
|
{
|
|
22511
22869
|
form,
|
|
@@ -22515,58 +22873,58 @@ function WaitlistForm({ onSuccess }) {
|
|
|
22515
22873
|
}
|
|
22516
22874
|
)
|
|
22517
22875
|
] }),
|
|
22518
|
-
/* @__PURE__ */
|
|
22876
|
+
/* @__PURE__ */ jsx270(Button, { type: "submit", className: "w-full", disabled: isSubmitting, children: isSubmitting ? t("common.actions.submitting") : t("waitlist.buttons.join") })
|
|
22519
22877
|
] }) });
|
|
22520
22878
|
}
|
|
22521
22879
|
__name(WaitlistForm, "WaitlistForm");
|
|
22522
22880
|
|
|
22523
22881
|
// src/features/waitlist/components/sections/WaitlistHeroSection.tsx
|
|
22524
22882
|
import { CheckCircle as CheckCircle2 } from "lucide-react";
|
|
22525
|
-
import { jsx as
|
|
22883
|
+
import { jsx as jsx271, jsxs as jsxs171 } from "react/jsx-runtime";
|
|
22526
22884
|
function WaitlistHeroSection() {
|
|
22527
22885
|
const config = getWaitlistConfig();
|
|
22528
|
-
return /* @__PURE__ */
|
|
22529
|
-
/* @__PURE__ */
|
|
22530
|
-
/* @__PURE__ */
|
|
22531
|
-
config.heroTitle && /* @__PURE__ */
|
|
22532
|
-
config.heroSubtitle && /* @__PURE__ */
|
|
22533
|
-
config.heroDescription && /* @__PURE__ */
|
|
22886
|
+
return /* @__PURE__ */ jsx271("section", { className: "relative overflow-hidden py-16 md:py-24", children: /* @__PURE__ */ jsx271("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxs171("div", { className: "grid gap-12 lg:grid-cols-2 lg:items-center", children: [
|
|
22887
|
+
/* @__PURE__ */ jsxs171("div", { className: "space-y-8", children: [
|
|
22888
|
+
/* @__PURE__ */ jsxs171("div", { className: "space-y-4", children: [
|
|
22889
|
+
config.heroTitle && /* @__PURE__ */ jsx271("h1", { className: "text-4xl font-bold tracking-tight md:text-5xl lg:text-6xl", children: config.heroTitle }),
|
|
22890
|
+
config.heroSubtitle && /* @__PURE__ */ jsx271("p", { className: "text-muted-foreground text-xl md:text-2xl", children: config.heroSubtitle }),
|
|
22891
|
+
config.heroDescription && /* @__PURE__ */ jsx271("p", { className: "text-muted-foreground", children: config.heroDescription })
|
|
22534
22892
|
] }),
|
|
22535
|
-
config.benefits && config.benefits.length > 0 && /* @__PURE__ */
|
|
22536
|
-
/* @__PURE__ */
|
|
22537
|
-
/* @__PURE__ */
|
|
22893
|
+
config.benefits && config.benefits.length > 0 && /* @__PURE__ */ jsx271("ul", { className: "space-y-3", children: config.benefits.map((benefit, index) => /* @__PURE__ */ jsxs171("li", { className: "flex items-start gap-3", children: [
|
|
22894
|
+
/* @__PURE__ */ jsx271(CheckCircle2, { className: "text-primary mt-0.5 h-5 w-5 shrink-0" }),
|
|
22895
|
+
/* @__PURE__ */ jsx271("span", { children: benefit })
|
|
22538
22896
|
] }, index)) })
|
|
22539
22897
|
] }),
|
|
22540
|
-
/* @__PURE__ */
|
|
22898
|
+
/* @__PURE__ */ jsx271("div", { className: "lg:pl-8", children: /* @__PURE__ */ jsx271("div", { className: "bg-card rounded-lg border p-6 shadow-lg md:p-8", children: /* @__PURE__ */ jsx271(WaitlistForm, {}) }) })
|
|
22541
22899
|
] }) }) });
|
|
22542
22900
|
}
|
|
22543
22901
|
__name(WaitlistHeroSection, "WaitlistHeroSection");
|
|
22544
22902
|
|
|
22545
22903
|
// src/features/waitlist/components/sections/WaitlistSuccessState.tsx
|
|
22546
22904
|
import { CheckCircle as CheckCircle3 } from "lucide-react";
|
|
22547
|
-
import { useTranslations as
|
|
22548
|
-
import { jsx as
|
|
22905
|
+
import { useTranslations as useTranslations111 } from "next-intl";
|
|
22906
|
+
import { jsx as jsx272, jsxs as jsxs172 } from "react/jsx-runtime";
|
|
22549
22907
|
function WaitlistSuccessState() {
|
|
22550
|
-
const t =
|
|
22551
|
-
return /* @__PURE__ */
|
|
22552
|
-
/* @__PURE__ */
|
|
22553
|
-
/* @__PURE__ */
|
|
22554
|
-
/* @__PURE__ */
|
|
22555
|
-
/* @__PURE__ */
|
|
22908
|
+
const t = useTranslations111();
|
|
22909
|
+
return /* @__PURE__ */ jsxs172("div", { className: "flex flex-col items-center justify-center space-y-4 py-8 text-center", children: [
|
|
22910
|
+
/* @__PURE__ */ jsx272("div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ jsx272(CheckCircle3, { className: "text-primary h-12 w-12" }) }),
|
|
22911
|
+
/* @__PURE__ */ jsx272(SectionHeader, { level: 2, children: t("waitlist.success.title") }),
|
|
22912
|
+
/* @__PURE__ */ jsx272("p", { className: "text-muted-foreground max-w-md", children: t("waitlist.success.description") }),
|
|
22913
|
+
/* @__PURE__ */ jsx272("p", { className: "text-muted-foreground text-sm", children: t("waitlist.success.hint") })
|
|
22556
22914
|
] });
|
|
22557
22915
|
}
|
|
22558
22916
|
__name(WaitlistSuccessState, "WaitlistSuccessState");
|
|
22559
22917
|
|
|
22560
22918
|
// src/features/waitlist/components/sections/WaitlistConfirmation.tsx
|
|
22561
22919
|
import { CheckCircle as CheckCircle4, Loader2 as Loader28, XCircle as XCircle2 } from "lucide-react";
|
|
22562
|
-
import { useTranslations as
|
|
22563
|
-
import { useEffect as
|
|
22564
|
-
import { jsx as
|
|
22920
|
+
import { useTranslations as useTranslations112 } from "next-intl";
|
|
22921
|
+
import { useEffect as useEffect72, useState as useState100 } from "react";
|
|
22922
|
+
import { jsx as jsx273, jsxs as jsxs173 } from "react/jsx-runtime";
|
|
22565
22923
|
function WaitlistConfirmation({ code }) {
|
|
22566
|
-
const t =
|
|
22567
|
-
const [state, setState] =
|
|
22568
|
-
const [errorMessage, setErrorMessage] =
|
|
22569
|
-
|
|
22924
|
+
const t = useTranslations112();
|
|
22925
|
+
const [state, setState] = useState100("loading");
|
|
22926
|
+
const [errorMessage, setErrorMessage] = useState100("");
|
|
22927
|
+
useEffect72(() => {
|
|
22570
22928
|
async function confirmEmail() {
|
|
22571
22929
|
try {
|
|
22572
22930
|
await WaitlistService.confirm(code);
|
|
@@ -22580,24 +22938,24 @@ function WaitlistConfirmation({ code }) {
|
|
|
22580
22938
|
confirmEmail();
|
|
22581
22939
|
}, [code, t]);
|
|
22582
22940
|
if (state === "loading") {
|
|
22583
|
-
return /* @__PURE__ */
|
|
22584
|
-
/* @__PURE__ */
|
|
22585
|
-
/* @__PURE__ */
|
|
22941
|
+
return /* @__PURE__ */ jsxs173("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
22942
|
+
/* @__PURE__ */ jsx273(Loader28, { className: "text-primary h-12 w-12 animate-spin" }),
|
|
22943
|
+
/* @__PURE__ */ jsx273("p", { className: "text-muted-foreground", children: t("waitlist.confirmation.loading") })
|
|
22586
22944
|
] });
|
|
22587
22945
|
}
|
|
22588
22946
|
if (state === "error") {
|
|
22589
|
-
return /* @__PURE__ */
|
|
22590
|
-
/* @__PURE__ */
|
|
22591
|
-
/* @__PURE__ */
|
|
22592
|
-
/* @__PURE__ */
|
|
22593
|
-
/* @__PURE__ */
|
|
22947
|
+
return /* @__PURE__ */ jsxs173("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
22948
|
+
/* @__PURE__ */ jsx273("div", { className: "bg-destructive/10 rounded-full p-4", children: /* @__PURE__ */ jsx273(XCircle2, { className: "text-destructive h-12 w-12" }) }),
|
|
22949
|
+
/* @__PURE__ */ jsx273(SectionHeader, { level: 2, children: t("waitlist.confirmation.error_title") }),
|
|
22950
|
+
/* @__PURE__ */ jsx273("p", { className: "text-muted-foreground max-w-md", children: errorMessage }),
|
|
22951
|
+
/* @__PURE__ */ jsx273(Link, { href: "/waitlist", className: buttonVariants({ variant: "outline" }), children: t("waitlist.buttons.return") })
|
|
22594
22952
|
] });
|
|
22595
22953
|
}
|
|
22596
|
-
return /* @__PURE__ */
|
|
22597
|
-
/* @__PURE__ */
|
|
22598
|
-
/* @__PURE__ */
|
|
22599
|
-
/* @__PURE__ */
|
|
22600
|
-
/* @__PURE__ */
|
|
22954
|
+
return /* @__PURE__ */ jsxs173("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
22955
|
+
/* @__PURE__ */ jsx273("div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ jsx273(CheckCircle4, { className: "text-primary h-12 w-12" }) }),
|
|
22956
|
+
/* @__PURE__ */ jsx273(SectionHeader, { level: 2, children: t("waitlist.confirmation.success_title") }),
|
|
22957
|
+
/* @__PURE__ */ jsx273("p", { className: "text-muted-foreground max-w-md", children: t("waitlist.confirmation.success_description") }),
|
|
22958
|
+
/* @__PURE__ */ jsx273("p", { className: "text-muted-foreground text-sm", children: t("waitlist.confirmation.success_hint") })
|
|
22601
22959
|
] });
|
|
22602
22960
|
}
|
|
22603
22961
|
__name(WaitlistConfirmation, "WaitlistConfirmation");
|
|
@@ -22605,13 +22963,13 @@ __name(WaitlistConfirmation, "WaitlistConfirmation");
|
|
|
22605
22963
|
// src/features/waitlist/components/lists/WaitlistList.tsx
|
|
22606
22964
|
import { flexRender as flexRender2, getCoreRowModel as getCoreRowModel2, useReactTable as useReactTable2 } from "@tanstack/react-table";
|
|
22607
22965
|
import { RefreshCw as RefreshCw4, Users as Users2 } from "lucide-react";
|
|
22608
|
-
import { useTranslations as
|
|
22609
|
-
import { useCallback as
|
|
22966
|
+
import { useTranslations as useTranslations114 } from "next-intl";
|
|
22967
|
+
import { useCallback as useCallback50, useEffect as useEffect73, useMemo as useMemo39, useState as useState101 } from "react";
|
|
22610
22968
|
|
|
22611
22969
|
// src/features/waitlist/hooks/useWaitlistTableStructure.tsx
|
|
22612
22970
|
import { Send } from "lucide-react";
|
|
22613
|
-
import { useTranslations as
|
|
22614
|
-
import { jsx as
|
|
22971
|
+
import { useTranslations as useTranslations113 } from "next-intl";
|
|
22972
|
+
import { jsx as jsx274, jsxs as jsxs174 } from "react/jsx-runtime";
|
|
22615
22973
|
function parseQuestionnaire(questionnaire) {
|
|
22616
22974
|
if (!questionnaire) return null;
|
|
22617
22975
|
try {
|
|
@@ -22624,7 +22982,7 @@ __name(parseQuestionnaire, "parseQuestionnaire");
|
|
|
22624
22982
|
function useWaitlistTableStructure({
|
|
22625
22983
|
onInvite
|
|
22626
22984
|
}) {
|
|
22627
|
-
const t =
|
|
22985
|
+
const t = useTranslations113();
|
|
22628
22986
|
const getStatusBadge = /* @__PURE__ */ __name((status) => {
|
|
22629
22987
|
const variants = {
|
|
22630
22988
|
pending: { variant: "secondary" },
|
|
@@ -22633,13 +22991,13 @@ function useWaitlistTableStructure({
|
|
|
22633
22991
|
registered: { variant: "default" }
|
|
22634
22992
|
};
|
|
22635
22993
|
const config = variants[status];
|
|
22636
|
-
return /* @__PURE__ */
|
|
22994
|
+
return /* @__PURE__ */ jsx274(Badge, { variant: config.variant, children: t(`waitlist.admin.status.${status}`) });
|
|
22637
22995
|
}, "getStatusBadge");
|
|
22638
22996
|
return [
|
|
22639
22997
|
{
|
|
22640
22998
|
accessorKey: "email",
|
|
22641
22999
|
header: t("waitlist.admin.columns.email"),
|
|
22642
|
-
cell: /* @__PURE__ */ __name(({ row }) => /* @__PURE__ */
|
|
23000
|
+
cell: /* @__PURE__ */ __name(({ row }) => /* @__PURE__ */ jsx274("span", { className: "font-medium", children: row.original.email }), "cell")
|
|
22643
23001
|
},
|
|
22644
23002
|
{
|
|
22645
23003
|
accessorKey: "status",
|
|
@@ -22660,17 +23018,17 @@ function useWaitlistTableStructure({
|
|
|
22660
23018
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
22661
23019
|
const questionnaire = parseQuestionnaire(row.original.questionnaire);
|
|
22662
23020
|
if (!questionnaire || Object.keys(questionnaire).length === 0) {
|
|
22663
|
-
return /* @__PURE__ */
|
|
23021
|
+
return /* @__PURE__ */ jsx274("span", { className: "text-muted-foreground", children: "-" });
|
|
22664
23022
|
}
|
|
22665
|
-
return /* @__PURE__ */
|
|
22666
|
-
/* @__PURE__ */
|
|
22667
|
-
/* @__PURE__ */
|
|
22668
|
-
/* @__PURE__ */
|
|
23023
|
+
return /* @__PURE__ */ jsxs174("details", { className: "cursor-pointer", children: [
|
|
23024
|
+
/* @__PURE__ */ jsx274("summary", { className: "text-primary text-sm", children: t("waitlist.admin.questionnaire.view_answers") }),
|
|
23025
|
+
/* @__PURE__ */ jsx274("div", { className: "bg-muted mt-2 rounded p-2 text-sm", children: Object.entries(questionnaire).map(([key, value]) => /* @__PURE__ */ jsxs174("div", { className: "mb-1", children: [
|
|
23026
|
+
/* @__PURE__ */ jsxs174("span", { className: "font-medium", children: [
|
|
22669
23027
|
key,
|
|
22670
23028
|
":"
|
|
22671
23029
|
] }),
|
|
22672
23030
|
" ",
|
|
22673
|
-
/* @__PURE__ */
|
|
23031
|
+
/* @__PURE__ */ jsx274("span", { className: "text-muted-foreground", children: Array.isArray(value) ? value.join(", ") : String(value) })
|
|
22674
23032
|
] }, key)) })
|
|
22675
23033
|
] });
|
|
22676
23034
|
}, "cell")
|
|
@@ -22681,18 +23039,18 @@ function useWaitlistTableStructure({
|
|
|
22681
23039
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
22682
23040
|
const entry = row.original;
|
|
22683
23041
|
if (entry.status === "confirmed") {
|
|
22684
|
-
return /* @__PURE__ */
|
|
22685
|
-
/* @__PURE__ */
|
|
23042
|
+
return /* @__PURE__ */ jsxs174(Button, { size: "sm", variant: "outline", onClick: () => onInvite(entry), children: [
|
|
23043
|
+
/* @__PURE__ */ jsx274(Send, { className: "mr-2 h-4 w-4" }),
|
|
22686
23044
|
t("waitlist.admin.actions.invite")
|
|
22687
23045
|
] });
|
|
22688
23046
|
}
|
|
22689
23047
|
if (entry.status === "invited" && entry.invitedAt) {
|
|
22690
|
-
return /* @__PURE__ */
|
|
23048
|
+
return /* @__PURE__ */ jsx274("span", { className: "text-muted-foreground text-xs", children: t("waitlist.admin.actions.invited_on", { date: new Date(entry.invitedAt).toLocaleDateString() }) });
|
|
22691
23049
|
}
|
|
22692
23050
|
if (entry.status === "registered") {
|
|
22693
|
-
return /* @__PURE__ */
|
|
23051
|
+
return /* @__PURE__ */ jsx274("span", { className: "text-muted-foreground text-sm", children: t("waitlist.admin.actions.registered") });
|
|
22694
23052
|
}
|
|
22695
|
-
return /* @__PURE__ */
|
|
23053
|
+
return /* @__PURE__ */ jsx274("span", { className: "text-muted-foreground text-sm", children: t("waitlist.admin.actions.awaiting_confirmation") });
|
|
22696
23054
|
}, "cell")
|
|
22697
23055
|
}
|
|
22698
23056
|
];
|
|
@@ -22700,14 +23058,14 @@ function useWaitlistTableStructure({
|
|
|
22700
23058
|
__name(useWaitlistTableStructure, "useWaitlistTableStructure");
|
|
22701
23059
|
|
|
22702
23060
|
// src/features/waitlist/components/lists/WaitlistList.tsx
|
|
22703
|
-
import { jsx as
|
|
23061
|
+
import { jsx as jsx275, jsxs as jsxs175 } from "react/jsx-runtime";
|
|
22704
23062
|
function WaitlistList() {
|
|
22705
|
-
const t =
|
|
22706
|
-
const [entries, setEntries] =
|
|
22707
|
-
const [total, setTotal] =
|
|
22708
|
-
const [isLoading, setIsLoading] =
|
|
22709
|
-
const [statusFilter, setStatusFilter] =
|
|
22710
|
-
const loadEntries =
|
|
23063
|
+
const t = useTranslations114();
|
|
23064
|
+
const [entries, setEntries] = useState101([]);
|
|
23065
|
+
const [total, setTotal] = useState101(0);
|
|
23066
|
+
const [isLoading, setIsLoading] = useState101(true);
|
|
23067
|
+
const [statusFilter, setStatusFilter] = useState101("all");
|
|
23068
|
+
const loadEntries = useCallback50(async () => {
|
|
22711
23069
|
setIsLoading(true);
|
|
22712
23070
|
try {
|
|
22713
23071
|
const result = await WaitlistService.findMany({
|
|
@@ -22722,7 +23080,7 @@ function WaitlistList() {
|
|
|
22722
23080
|
setIsLoading(false);
|
|
22723
23081
|
}
|
|
22724
23082
|
}, [statusFilter]);
|
|
22725
|
-
|
|
23083
|
+
useEffect73(() => {
|
|
22726
23084
|
loadEntries();
|
|
22727
23085
|
}, [loadEntries]);
|
|
22728
23086
|
const handleInvite = /* @__PURE__ */ __name(async (entry) => {
|
|
@@ -22735,7 +23093,7 @@ function WaitlistList() {
|
|
|
22735
23093
|
}
|
|
22736
23094
|
}, "handleInvite");
|
|
22737
23095
|
const columns = useWaitlistTableStructure({ onInvite: handleInvite });
|
|
22738
|
-
const statusItems =
|
|
23096
|
+
const statusItems = useMemo39(
|
|
22739
23097
|
() => ({
|
|
22740
23098
|
all: t("waitlist.admin.all_statuses"),
|
|
22741
23099
|
pending: t("waitlist.admin.status.pending"),
|
|
@@ -22750,34 +23108,34 @@ function WaitlistList() {
|
|
|
22750
23108
|
columns,
|
|
22751
23109
|
getCoreRowModel: getCoreRowModel2()
|
|
22752
23110
|
});
|
|
22753
|
-
return /* @__PURE__ */
|
|
22754
|
-
/* @__PURE__ */
|
|
22755
|
-
/* @__PURE__ */
|
|
22756
|
-
/* @__PURE__ */
|
|
22757
|
-
/* @__PURE__ */
|
|
22758
|
-
/* @__PURE__ */
|
|
23111
|
+
return /* @__PURE__ */ jsxs175("div", { className: "space-y-4", children: [
|
|
23112
|
+
/* @__PURE__ */ jsxs175("div", { className: "flex items-center justify-between", children: [
|
|
23113
|
+
/* @__PURE__ */ jsxs175("div", { className: "flex items-center gap-2", children: [
|
|
23114
|
+
/* @__PURE__ */ jsx275(Users2, { className: "h-5 w-5" }),
|
|
23115
|
+
/* @__PURE__ */ jsx275(SectionHeader, { level: 2, children: t("waitlist.admin.title") }),
|
|
23116
|
+
/* @__PURE__ */ jsxs175("span", { className: "text-muted-foreground", children: [
|
|
22759
23117
|
"(",
|
|
22760
23118
|
t("waitlist.admin.entries_count", { count: total }),
|
|
22761
23119
|
")"
|
|
22762
23120
|
] })
|
|
22763
23121
|
] }),
|
|
22764
|
-
/* @__PURE__ */
|
|
22765
|
-
/* @__PURE__ */
|
|
22766
|
-
/* @__PURE__ */
|
|
22767
|
-
/* @__PURE__ */
|
|
22768
|
-
/* @__PURE__ */
|
|
22769
|
-
/* @__PURE__ */
|
|
22770
|
-
/* @__PURE__ */
|
|
22771
|
-
/* @__PURE__ */
|
|
22772
|
-
/* @__PURE__ */
|
|
23122
|
+
/* @__PURE__ */ jsxs175("div", { className: "flex items-center gap-4", children: [
|
|
23123
|
+
/* @__PURE__ */ jsxs175(Select, { items: statusItems, value: statusFilter, onValueChange: (value) => setStatusFilter(value ?? "all"), children: [
|
|
23124
|
+
/* @__PURE__ */ jsx275(SelectTrigger, { className: "w-40", children: /* @__PURE__ */ jsx275(SelectValue, { placeholder: t("waitlist.admin.filter_placeholder") }) }),
|
|
23125
|
+
/* @__PURE__ */ jsxs175(SelectContent, { children: [
|
|
23126
|
+
/* @__PURE__ */ jsx275(SelectItem, { value: "all", children: t("waitlist.admin.all_statuses") }),
|
|
23127
|
+
/* @__PURE__ */ jsx275(SelectItem, { value: "pending", children: t("waitlist.admin.status.pending") }),
|
|
23128
|
+
/* @__PURE__ */ jsx275(SelectItem, { value: "confirmed", children: t("waitlist.admin.status.confirmed") }),
|
|
23129
|
+
/* @__PURE__ */ jsx275(SelectItem, { value: "invited", children: t("waitlist.admin.status.invited") }),
|
|
23130
|
+
/* @__PURE__ */ jsx275(SelectItem, { value: "registered", children: t("waitlist.admin.status.registered") })
|
|
22773
23131
|
] })
|
|
22774
23132
|
] }),
|
|
22775
|
-
/* @__PURE__ */
|
|
23133
|
+
/* @__PURE__ */ jsx275(Button, { variant: "outline", size: "icon", onClick: loadEntries, disabled: isLoading, children: /* @__PURE__ */ jsx275(RefreshCw4, { className: `h-4 w-4 ${isLoading ? "animate-spin" : ""}` }) })
|
|
22776
23134
|
] })
|
|
22777
23135
|
] }),
|
|
22778
|
-
/* @__PURE__ */
|
|
22779
|
-
/* @__PURE__ */
|
|
22780
|
-
/* @__PURE__ */
|
|
23136
|
+
/* @__PURE__ */ jsx275("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs175(Table, { children: [
|
|
23137
|
+
/* @__PURE__ */ jsx275(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx275(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx275(TableHead, { children: header.isPlaceholder ? null : flexRender2(header.column.columnDef.header, header.getContext()) }, header.id)) }, headerGroup.id)) }),
|
|
23138
|
+
/* @__PURE__ */ jsx275(TableBody, { children: isLoading ? /* @__PURE__ */ jsx275(TableRow, { children: /* @__PURE__ */ jsx275(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: t("waitlist.admin.loading") }) }) : entries.length === 0 ? /* @__PURE__ */ jsx275(TableRow, { children: /* @__PURE__ */ jsx275(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: t("waitlist.admin.empty") }) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx275(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx275(TableCell, { children: flexRender2(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
|
|
22781
23139
|
] }) })
|
|
22782
23140
|
] });
|
|
22783
23141
|
}
|
|
@@ -22785,12 +23143,12 @@ __name(WaitlistList, "WaitlistList");
|
|
|
22785
23143
|
|
|
22786
23144
|
// src/features/rbac/components/RbacContainer.tsx
|
|
22787
23145
|
import { Loader2Icon as Loader2Icon4 } from "lucide-react";
|
|
22788
|
-
import { useTranslations as
|
|
22789
|
-
import { memo as memo2, useCallback as
|
|
23146
|
+
import { useTranslations as useTranslations116 } from "next-intl";
|
|
23147
|
+
import { memo as memo2, useCallback as useCallback52, useEffect as useEffect75, useMemo as useMemo40, useRef as useRef40, useState as useState103 } from "react";
|
|
22790
23148
|
|
|
22791
23149
|
// src/features/rbac/components/RbacPermissionCell.tsx
|
|
22792
23150
|
import { CheckIcon as CheckIcon9, MinusIcon as MinusIcon2, XIcon as XIcon12 } from "lucide-react";
|
|
22793
|
-
import { jsx as
|
|
23151
|
+
import { jsx as jsx276, jsxs as jsxs176 } from "react/jsx-runtime";
|
|
22794
23152
|
function RbacPermissionCell({
|
|
22795
23153
|
value,
|
|
22796
23154
|
originalValue,
|
|
@@ -22799,7 +23157,7 @@ function RbacPermissionCell({
|
|
|
22799
23157
|
}) {
|
|
22800
23158
|
const isDirty = originalValue !== void 0 && value !== originalValue;
|
|
22801
23159
|
if (isRoleColumn && (value === null || value === void 0)) {
|
|
22802
|
-
return /* @__PURE__ */
|
|
23160
|
+
return /* @__PURE__ */ jsx276(
|
|
22803
23161
|
"div",
|
|
22804
23162
|
{
|
|
22805
23163
|
onClick,
|
|
@@ -22807,12 +23165,12 @@ function RbacPermissionCell({
|
|
|
22807
23165
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
22808
23166
|
isDirty && "ring-2 ring-amber-400/50"
|
|
22809
23167
|
),
|
|
22810
|
-
children: /* @__PURE__ */
|
|
23168
|
+
children: /* @__PURE__ */ jsx276(MinusIcon2, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
22811
23169
|
}
|
|
22812
23170
|
);
|
|
22813
23171
|
}
|
|
22814
23172
|
if (value === true) {
|
|
22815
|
-
return /* @__PURE__ */
|
|
23173
|
+
return /* @__PURE__ */ jsx276(
|
|
22816
23174
|
"div",
|
|
22817
23175
|
{
|
|
22818
23176
|
onClick,
|
|
@@ -22820,15 +23178,15 @@ function RbacPermissionCell({
|
|
|
22820
23178
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
22821
23179
|
isDirty && "ring-2 ring-amber-400/50"
|
|
22822
23180
|
),
|
|
22823
|
-
children: /* @__PURE__ */
|
|
22824
|
-
/* @__PURE__ */
|
|
22825
|
-
/* @__PURE__ */
|
|
23181
|
+
children: /* @__PURE__ */ jsxs176(Badge, { variant: "default", className: "bg-emerald-600 hover:bg-emerald-700 gap-1 text-xs", children: [
|
|
23182
|
+
/* @__PURE__ */ jsx276(CheckIcon9, { className: "h-3 w-3" }),
|
|
23183
|
+
/* @__PURE__ */ jsx276("span", { children: "true" })
|
|
22826
23184
|
] })
|
|
22827
23185
|
}
|
|
22828
23186
|
);
|
|
22829
23187
|
}
|
|
22830
23188
|
if (value === false) {
|
|
22831
|
-
return /* @__PURE__ */
|
|
23189
|
+
return /* @__PURE__ */ jsx276(
|
|
22832
23190
|
"div",
|
|
22833
23191
|
{
|
|
22834
23192
|
onClick,
|
|
@@ -22836,17 +23194,17 @@ function RbacPermissionCell({
|
|
|
22836
23194
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
22837
23195
|
isDirty && "ring-2 ring-amber-400/50"
|
|
22838
23196
|
),
|
|
22839
|
-
children: /* @__PURE__ */
|
|
22840
|
-
/* @__PURE__ */
|
|
22841
|
-
/* @__PURE__ */
|
|
23197
|
+
children: /* @__PURE__ */ jsxs176(Badge, { variant: "destructive", className: "gap-1 text-xs", children: [
|
|
23198
|
+
/* @__PURE__ */ jsx276(XIcon12, { className: "h-3 w-3" }),
|
|
23199
|
+
/* @__PURE__ */ jsx276("span", { children: "false" })
|
|
22842
23200
|
] })
|
|
22843
23201
|
}
|
|
22844
23202
|
);
|
|
22845
23203
|
}
|
|
22846
23204
|
const displayValue = typeof value === "string" ? value : String(value);
|
|
22847
23205
|
const truncated = displayValue.length > 20 ? displayValue.substring(0, 18) + "..." : displayValue;
|
|
22848
|
-
return /* @__PURE__ */
|
|
22849
|
-
/* @__PURE__ */
|
|
23206
|
+
return /* @__PURE__ */ jsxs176(Tooltip2, { children: [
|
|
23207
|
+
/* @__PURE__ */ jsx276(
|
|
22850
23208
|
TooltipTrigger,
|
|
22851
23209
|
{
|
|
22852
23210
|
onClick,
|
|
@@ -22854,11 +23212,11 @@ function RbacPermissionCell({
|
|
|
22854
23212
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
22855
23213
|
isDirty && "ring-2 ring-amber-400/50"
|
|
22856
23214
|
),
|
|
22857
|
-
render: /* @__PURE__ */
|
|
22858
|
-
children: /* @__PURE__ */
|
|
23215
|
+
render: /* @__PURE__ */ jsx276("div", {}),
|
|
23216
|
+
children: /* @__PURE__ */ jsx276(Badge, { variant: "outline", className: "max-w-full truncate text-xs tabular-nums", children: truncated })
|
|
22859
23217
|
}
|
|
22860
23218
|
),
|
|
22861
|
-
/* @__PURE__ */
|
|
23219
|
+
/* @__PURE__ */ jsx276(TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ jsx276("p", { className: "tabular-nums text-xs break-all", children: displayValue }) })
|
|
22862
23220
|
] });
|
|
22863
23221
|
}
|
|
22864
23222
|
__name(RbacPermissionCell, "RbacPermissionCell");
|
|
@@ -22866,9 +23224,9 @@ __name(RbacPermissionCell, "RbacPermissionCell");
|
|
|
22866
23224
|
// src/features/rbac/components/RbacPermissionPicker.tsx
|
|
22867
23225
|
import { Popover as PopoverPrimitive2 } from "@base-ui/react/popover";
|
|
22868
23226
|
import { CheckIcon as CheckIcon10, MinusIcon as MinusIcon3, XIcon as XIcon13 } from "lucide-react";
|
|
22869
|
-
import { useTranslations as
|
|
22870
|
-
import { useCallback as
|
|
22871
|
-
import { Fragment as
|
|
23227
|
+
import { useTranslations as useTranslations115 } from "next-intl";
|
|
23228
|
+
import { useCallback as useCallback51, useEffect as useEffect74, useState as useState102 } from "react";
|
|
23229
|
+
import { Fragment as Fragment58, jsx as jsx277, jsxs as jsxs177 } from "react/jsx-runtime";
|
|
22872
23230
|
function RbacPermissionPicker({
|
|
22873
23231
|
open,
|
|
22874
23232
|
anchor,
|
|
@@ -22879,13 +23237,13 @@ function RbacPermissionPicker({
|
|
|
22879
23237
|
onClear,
|
|
22880
23238
|
onClose
|
|
22881
23239
|
}) {
|
|
22882
|
-
const t =
|
|
22883
|
-
const [customSegment, setCustomSegment] =
|
|
22884
|
-
|
|
23240
|
+
const t = useTranslations115();
|
|
23241
|
+
const [customSegment, setCustomSegment] = useState102("");
|
|
23242
|
+
useEffect74(() => {
|
|
22885
23243
|
if (!open) setCustomSegment("");
|
|
22886
23244
|
}, [open]);
|
|
22887
23245
|
const currentSegments = typeof value === "string" ? value.split("|").filter(Boolean) : [];
|
|
22888
|
-
const toggleSegment =
|
|
23246
|
+
const toggleSegment = useCallback51(
|
|
22889
23247
|
(segment) => {
|
|
22890
23248
|
const next = currentSegments.includes(segment) ? currentSegments.filter((s) => s !== segment) : [...currentSegments, segment];
|
|
22891
23249
|
if (next.length === 0) onSetValue(false);
|
|
@@ -22893,7 +23251,7 @@ function RbacPermissionPicker({
|
|
|
22893
23251
|
},
|
|
22894
23252
|
[currentSegments, onSetValue]
|
|
22895
23253
|
);
|
|
22896
|
-
const addCustomSegment =
|
|
23254
|
+
const addCustomSegment = useCallback51(() => {
|
|
22897
23255
|
const segment = customSegment.trim();
|
|
22898
23256
|
if (!segment) return;
|
|
22899
23257
|
if (!currentSegments.includes(segment)) {
|
|
@@ -22901,14 +23259,14 @@ function RbacPermissionPicker({
|
|
|
22901
23259
|
}
|
|
22902
23260
|
setCustomSegment("");
|
|
22903
23261
|
}, [customSegment, currentSegments, onSetValue]);
|
|
22904
|
-
return /* @__PURE__ */
|
|
23262
|
+
return /* @__PURE__ */ jsx277(
|
|
22905
23263
|
PopoverPrimitive2.Root,
|
|
22906
23264
|
{
|
|
22907
23265
|
open,
|
|
22908
23266
|
onOpenChange: (next) => {
|
|
22909
23267
|
if (!next) onClose();
|
|
22910
23268
|
},
|
|
22911
|
-
children: /* @__PURE__ */
|
|
23269
|
+
children: /* @__PURE__ */ jsx277(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx277(
|
|
22912
23270
|
PopoverPrimitive2.Positioner,
|
|
22913
23271
|
{
|
|
22914
23272
|
anchor: anchor ?? void 0,
|
|
@@ -22916,11 +23274,11 @@ function RbacPermissionPicker({
|
|
|
22916
23274
|
align: "center",
|
|
22917
23275
|
sideOffset: 4,
|
|
22918
23276
|
className: "isolate z-50",
|
|
22919
|
-
children: /* @__PURE__ */
|
|
22920
|
-
/* @__PURE__ */
|
|
22921
|
-
/* @__PURE__ */
|
|
22922
|
-
/* @__PURE__ */
|
|
22923
|
-
/* @__PURE__ */
|
|
23277
|
+
children: /* @__PURE__ */ jsxs177(PopoverPrimitive2.Popup, { className: "bg-popover text-popover-foreground ring-foreground/10 z-50 flex w-96 flex-col gap-3 rounded-lg p-3 text-xs shadow-md outline-hidden ring-1 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 duration-100", children: [
|
|
23278
|
+
/* @__PURE__ */ jsxs177("div", { children: [
|
|
23279
|
+
/* @__PURE__ */ jsx277("p", { className: "text-muted-foreground mb-2 text-xs font-medium", children: t("rbac.quick_value") }),
|
|
23280
|
+
/* @__PURE__ */ jsxs177("div", { className: "flex gap-2", children: [
|
|
23281
|
+
/* @__PURE__ */ jsxs177(
|
|
22924
23282
|
Button,
|
|
22925
23283
|
{
|
|
22926
23284
|
size: "sm",
|
|
@@ -22931,12 +23289,12 @@ function RbacPermissionPicker({
|
|
|
22931
23289
|
onClose();
|
|
22932
23290
|
},
|
|
22933
23291
|
children: [
|
|
22934
|
-
/* @__PURE__ */
|
|
22935
|
-
/* @__PURE__ */
|
|
23292
|
+
/* @__PURE__ */ jsx277(CheckIcon10, { className: "h-3 w-3" }),
|
|
23293
|
+
/* @__PURE__ */ jsx277("span", { children: "true" })
|
|
22936
23294
|
]
|
|
22937
23295
|
}
|
|
22938
23296
|
),
|
|
22939
|
-
/* @__PURE__ */
|
|
23297
|
+
/* @__PURE__ */ jsxs177(
|
|
22940
23298
|
Button,
|
|
22941
23299
|
{
|
|
22942
23300
|
size: "sm",
|
|
@@ -22947,16 +23305,16 @@ function RbacPermissionPicker({
|
|
|
22947
23305
|
onClose();
|
|
22948
23306
|
},
|
|
22949
23307
|
children: [
|
|
22950
|
-
/* @__PURE__ */
|
|
22951
|
-
/* @__PURE__ */
|
|
23308
|
+
/* @__PURE__ */ jsx277(XIcon13, { className: "h-3 w-3" }),
|
|
23309
|
+
/* @__PURE__ */ jsx277("span", { children: "false" })
|
|
22952
23310
|
]
|
|
22953
23311
|
}
|
|
22954
23312
|
)
|
|
22955
23313
|
] })
|
|
22956
23314
|
] }),
|
|
22957
|
-
isRoleColumn && onClear && /* @__PURE__ */
|
|
22958
|
-
/* @__PURE__ */
|
|
22959
|
-
/* @__PURE__ */
|
|
23315
|
+
isRoleColumn && onClear && /* @__PURE__ */ jsxs177(Fragment58, { children: [
|
|
23316
|
+
/* @__PURE__ */ jsx277(Separator, {}),
|
|
23317
|
+
/* @__PURE__ */ jsxs177(
|
|
22960
23318
|
Button,
|
|
22961
23319
|
{
|
|
22962
23320
|
size: "sm",
|
|
@@ -22967,34 +23325,34 @@ function RbacPermissionPicker({
|
|
|
22967
23325
|
onClose();
|
|
22968
23326
|
},
|
|
22969
23327
|
children: [
|
|
22970
|
-
/* @__PURE__ */
|
|
23328
|
+
/* @__PURE__ */ jsx277(MinusIcon3, { className: "h-3 w-3" }),
|
|
22971
23329
|
t("rbac.inherit_from_defaults")
|
|
22972
23330
|
]
|
|
22973
23331
|
}
|
|
22974
23332
|
)
|
|
22975
23333
|
] }),
|
|
22976
|
-
/* @__PURE__ */
|
|
22977
|
-
/* @__PURE__ */
|
|
22978
|
-
/* @__PURE__ */
|
|
22979
|
-
knownSegments.length > 0 && /* @__PURE__ */
|
|
23334
|
+
/* @__PURE__ */ jsx277(Separator, {}),
|
|
23335
|
+
/* @__PURE__ */ jsxs177("div", { children: [
|
|
23336
|
+
/* @__PURE__ */ jsx277("p", { className: "text-muted-foreground mb-2 text-xs font-medium", children: t("rbac.relationships") }),
|
|
23337
|
+
knownSegments.length > 0 && /* @__PURE__ */ jsx277("div", { className: "max-h-40 space-y-1 overflow-y-auto", children: knownSegments.map((segment) => /* @__PURE__ */ jsxs177(
|
|
22980
23338
|
"label",
|
|
22981
23339
|
{
|
|
22982
23340
|
className: "hover:bg-muted flex cursor-pointer items-center gap-2 rounded px-1 py-0.5 text-sm",
|
|
22983
23341
|
children: [
|
|
22984
|
-
/* @__PURE__ */
|
|
23342
|
+
/* @__PURE__ */ jsx277(
|
|
22985
23343
|
Checkbox,
|
|
22986
23344
|
{
|
|
22987
23345
|
checked: currentSegments.includes(segment),
|
|
22988
23346
|
onCheckedChange: () => toggleSegment(segment)
|
|
22989
23347
|
}
|
|
22990
23348
|
),
|
|
22991
|
-
/* @__PURE__ */
|
|
23349
|
+
/* @__PURE__ */ jsx277("span", { className: "tabular-nums text-xs", children: segment })
|
|
22992
23350
|
]
|
|
22993
23351
|
},
|
|
22994
23352
|
segment
|
|
22995
23353
|
)) }),
|
|
22996
|
-
/* @__PURE__ */
|
|
22997
|
-
/* @__PURE__ */
|
|
23354
|
+
/* @__PURE__ */ jsxs177("div", { className: "mt-2 flex gap-1", children: [
|
|
23355
|
+
/* @__PURE__ */ jsx277(
|
|
22998
23356
|
Input,
|
|
22999
23357
|
{
|
|
23000
23358
|
value: customSegment,
|
|
@@ -23009,7 +23367,7 @@ function RbacPermissionPicker({
|
|
|
23009
23367
|
}
|
|
23010
23368
|
}
|
|
23011
23369
|
),
|
|
23012
|
-
/* @__PURE__ */
|
|
23370
|
+
/* @__PURE__ */ jsx277(
|
|
23013
23371
|
Button,
|
|
23014
23372
|
{
|
|
23015
23373
|
size: "sm",
|
|
@@ -23021,9 +23379,9 @@ function RbacPermissionPicker({
|
|
|
23021
23379
|
}
|
|
23022
23380
|
)
|
|
23023
23381
|
] }),
|
|
23024
|
-
currentSegments.length > 0 && /* @__PURE__ */
|
|
23025
|
-
/* @__PURE__ */
|
|
23026
|
-
/* @__PURE__ */
|
|
23382
|
+
currentSegments.length > 0 && /* @__PURE__ */ jsxs177("div", { className: "bg-muted mt-2 rounded p-2", children: [
|
|
23383
|
+
/* @__PURE__ */ jsx277("p", { className: "text-muted-foreground mb-1 text-xs", children: t("rbac.preview") }),
|
|
23384
|
+
/* @__PURE__ */ jsx277("p", { className: "tabular-nums text-xs break-all", children: currentSegments.join("|") })
|
|
23027
23385
|
] })
|
|
23028
23386
|
] })
|
|
23029
23387
|
] })
|
|
@@ -23035,7 +23393,7 @@ function RbacPermissionPicker({
|
|
|
23035
23393
|
__name(RbacPermissionPicker, "RbacPermissionPicker");
|
|
23036
23394
|
|
|
23037
23395
|
// src/features/rbac/components/RbacContainer.tsx
|
|
23038
|
-
import { jsx as
|
|
23396
|
+
import { jsx as jsx278, jsxs as jsxs178 } from "react/jsx-runtime";
|
|
23039
23397
|
function findToken(tokens, action) {
|
|
23040
23398
|
if (!tokens) return void 0;
|
|
23041
23399
|
return tokens.find((t) => t.action === action);
|
|
@@ -23057,11 +23415,11 @@ var CellButton = memo2(/* @__PURE__ */ __name(function CellButton2({
|
|
|
23057
23415
|
}) {
|
|
23058
23416
|
const ref = useRef40(null);
|
|
23059
23417
|
const value = cellValue(tokens, action);
|
|
23060
|
-
const handleClick =
|
|
23418
|
+
const handleClick = useCallback52(() => {
|
|
23061
23419
|
if (!ref.current) return;
|
|
23062
23420
|
onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
|
|
23063
23421
|
}, [onOpen, moduleId, rowKey, action, isRoleColumn]);
|
|
23064
|
-
return /* @__PURE__ */
|
|
23422
|
+
return /* @__PURE__ */ jsx278("div", { ref, children: /* @__PURE__ */ jsx278(RbacPermissionCell, { value, isRoleColumn, onClick: handleClick }) });
|
|
23065
23423
|
}, "CellButton"));
|
|
23066
23424
|
var ACTION_LABELS = {
|
|
23067
23425
|
read: "Read",
|
|
@@ -23077,22 +23435,22 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
23077
23435
|
roleNames,
|
|
23078
23436
|
onOpenPicker
|
|
23079
23437
|
}) {
|
|
23080
|
-
const t =
|
|
23438
|
+
const t = useTranslations116();
|
|
23081
23439
|
const defaultTokens = block.default ?? [];
|
|
23082
|
-
return /* @__PURE__ */
|
|
23083
|
-
/* @__PURE__ */
|
|
23084
|
-
/* @__PURE__ */
|
|
23085
|
-
/* @__PURE__ */
|
|
23440
|
+
return /* @__PURE__ */ jsxs178("div", { className: "rounded-lg border border-accent bg-card", children: [
|
|
23441
|
+
/* @__PURE__ */ jsxs178("div", { className: "flex items-center justify-between border-b px-4 py-2", children: [
|
|
23442
|
+
/* @__PURE__ */ jsx278("h4", { className: "text-sm font-medium", children: moduleLabel }),
|
|
23443
|
+
/* @__PURE__ */ jsx278("span", { className: "text-muted-foreground tabular-nums text-xs", children: moduleId })
|
|
23086
23444
|
] }),
|
|
23087
|
-
/* @__PURE__ */
|
|
23088
|
-
/* @__PURE__ */
|
|
23089
|
-
/* @__PURE__ */
|
|
23090
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23445
|
+
/* @__PURE__ */ jsx278("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs178("table", { className: "w-full text-sm", children: [
|
|
23446
|
+
/* @__PURE__ */ jsx278("thead", { children: /* @__PURE__ */ jsxs178("tr", { className: "border-b bg-muted/50", children: [
|
|
23447
|
+
/* @__PURE__ */ jsx278("th", { className: "w-40 px-4 py-2 text-left text-xs font-medium text-muted-foreground", children: t("rbac.role") }),
|
|
23448
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx278("th", { className: "min-w-28 px-2 py-2 text-center text-xs font-medium text-muted-foreground", children: ACTION_LABELS[action] }, action))
|
|
23091
23449
|
] }) }),
|
|
23092
|
-
/* @__PURE__ */
|
|
23093
|
-
/* @__PURE__ */
|
|
23094
|
-
/* @__PURE__ */
|
|
23095
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23450
|
+
/* @__PURE__ */ jsxs178("tbody", { children: [
|
|
23451
|
+
/* @__PURE__ */ jsxs178("tr", { className: cn("border-b bg-muted/30"), children: [
|
|
23452
|
+
/* @__PURE__ */ jsx278("td", { className: "px-4 py-1 text-xs font-bold text-muted-foreground", children: t("rbac.defaults") }),
|
|
23453
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx278("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx278(
|
|
23096
23454
|
CellButton,
|
|
23097
23455
|
{
|
|
23098
23456
|
moduleId,
|
|
@@ -23107,9 +23465,9 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
23107
23465
|
roleIds.map((roleId) => {
|
|
23108
23466
|
const roleTokens = block[roleId];
|
|
23109
23467
|
const roleLabel = roleNames?.[roleId] ?? roleId;
|
|
23110
|
-
return /* @__PURE__ */
|
|
23111
|
-
/* @__PURE__ */
|
|
23112
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23468
|
+
return /* @__PURE__ */ jsxs178("tr", { className: "border-b last:border-b-0", children: [
|
|
23469
|
+
/* @__PURE__ */ jsx278("td", { className: "px-4 py-1 text-xs font-medium text-muted-foreground", children: roleLabel }),
|
|
23470
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx278("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx278(
|
|
23113
23471
|
CellButton,
|
|
23114
23472
|
{
|
|
23115
23473
|
moduleId,
|
|
@@ -23127,25 +23485,25 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
23127
23485
|
] });
|
|
23128
23486
|
}, "ModuleEditor"));
|
|
23129
23487
|
function RbacContainer() {
|
|
23130
|
-
const t =
|
|
23488
|
+
const t = useTranslations116();
|
|
23131
23489
|
const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
|
|
23132
|
-
const [selectedModuleId, setSelectedModuleId] =
|
|
23133
|
-
const [activePicker, setActivePicker] =
|
|
23134
|
-
const openPicker =
|
|
23490
|
+
const [selectedModuleId, setSelectedModuleId] = useState103(null);
|
|
23491
|
+
const [activePicker, setActivePicker] = useState103(null);
|
|
23492
|
+
const openPicker = useCallback52((picker) => {
|
|
23135
23493
|
setActivePicker(picker);
|
|
23136
23494
|
}, []);
|
|
23137
|
-
const closePicker =
|
|
23495
|
+
const closePicker = useCallback52(() => {
|
|
23138
23496
|
setActivePicker(null);
|
|
23139
23497
|
}, []);
|
|
23140
|
-
const handleSelectModule =
|
|
23498
|
+
const handleSelectModule = useCallback52((id) => {
|
|
23141
23499
|
setSelectedModuleId(id);
|
|
23142
23500
|
setActivePicker(null);
|
|
23143
23501
|
}, []);
|
|
23144
|
-
const sortedModuleIds =
|
|
23502
|
+
const sortedModuleIds = useMemo40(() => {
|
|
23145
23503
|
if (!matrix) return [];
|
|
23146
23504
|
return Object.keys(matrix).sort((a, b) => (moduleNames?.[a] ?? a).localeCompare(moduleNames?.[b] ?? b));
|
|
23147
23505
|
}, [matrix, moduleNames]);
|
|
23148
|
-
const roleIds =
|
|
23506
|
+
const roleIds = useMemo40(() => {
|
|
23149
23507
|
if (roleNames) {
|
|
23150
23508
|
return Object.keys(roleNames).sort((a, b) => (roleNames[a] ?? a).localeCompare(roleNames[b] ?? b));
|
|
23151
23509
|
}
|
|
@@ -23158,44 +23516,44 @@ function RbacContainer() {
|
|
|
23158
23516
|
}
|
|
23159
23517
|
return Array.from(set).sort();
|
|
23160
23518
|
}, [matrix, roleNames]);
|
|
23161
|
-
|
|
23519
|
+
useEffect75(() => {
|
|
23162
23520
|
if (!selectedModuleId && sortedModuleIds.length > 0) {
|
|
23163
23521
|
setSelectedModuleId(sortedModuleIds[0]);
|
|
23164
23522
|
}
|
|
23165
23523
|
}, [selectedModuleId, sortedModuleIds]);
|
|
23166
|
-
const activeValue =
|
|
23524
|
+
const activeValue = useMemo40(() => {
|
|
23167
23525
|
if (!activePicker || !matrix) return void 0;
|
|
23168
23526
|
const block = matrix[activePicker.moduleId];
|
|
23169
23527
|
if (!block) return void 0;
|
|
23170
23528
|
const tokens = activePicker.rowKey === "default" ? block.default : block[activePicker.rowKey];
|
|
23171
23529
|
return cellValue(tokens, activePicker.action);
|
|
23172
23530
|
}, [activePicker, matrix]);
|
|
23173
|
-
const activeSegments =
|
|
23531
|
+
const activeSegments = useMemo40(() => {
|
|
23174
23532
|
if (!activePicker) return [];
|
|
23175
23533
|
return modulePaths[activePicker.moduleId] ?? [];
|
|
23176
23534
|
}, [activePicker, modulePaths]);
|
|
23177
|
-
const handleSetValue =
|
|
23535
|
+
const handleSetValue = useCallback52(
|
|
23178
23536
|
(value) => {
|
|
23179
23537
|
if (!activePicker) return;
|
|
23180
23538
|
updateCell(activePicker.moduleId, activePicker.rowKey, activePicker.action, value);
|
|
23181
23539
|
},
|
|
23182
23540
|
[activePicker, updateCell]
|
|
23183
23541
|
);
|
|
23184
|
-
const handleClear =
|
|
23542
|
+
const handleClear = useCallback52(() => {
|
|
23185
23543
|
if (!activePicker || !activePicker.isRoleColumn) return;
|
|
23186
23544
|
clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
|
|
23187
23545
|
}, [activePicker, clearCell]);
|
|
23188
23546
|
if (loading) {
|
|
23189
|
-
return /* @__PURE__ */
|
|
23547
|
+
return /* @__PURE__ */ jsx278(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx278("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx278(Loader2Icon4, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) });
|
|
23190
23548
|
}
|
|
23191
23549
|
if (error) {
|
|
23192
|
-
return /* @__PURE__ */
|
|
23550
|
+
return /* @__PURE__ */ jsx278(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx278("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx278("p", { className: "text-destructive", children: error }) }) });
|
|
23193
23551
|
}
|
|
23194
23552
|
if (!matrix) return null;
|
|
23195
23553
|
const selectedBlock = selectedModuleId ? matrix[selectedModuleId] : void 0;
|
|
23196
|
-
return /* @__PURE__ */
|
|
23197
|
-
/* @__PURE__ */
|
|
23198
|
-
/* @__PURE__ */
|
|
23554
|
+
return /* @__PURE__ */ jsxs178(RoundPageContainer, { fullWidth: true, forceHeader: true, children: [
|
|
23555
|
+
/* @__PURE__ */ jsxs178("div", { className: "flex h-full w-full", children: [
|
|
23556
|
+
/* @__PURE__ */ jsx278("aside", { className: "w-60 shrink-0 overflow-y-auto border-r bg-muted/20", children: /* @__PURE__ */ jsx278("ul", { className: "py-1", children: sortedModuleIds.map((id) => /* @__PURE__ */ jsx278("li", { children: /* @__PURE__ */ jsx278(
|
|
23199
23557
|
"button",
|
|
23200
23558
|
{
|
|
23201
23559
|
type: "button",
|
|
@@ -23209,7 +23567,7 @@ function RbacContainer() {
|
|
|
23209
23567
|
children: moduleNames?.[id] ?? id
|
|
23210
23568
|
}
|
|
23211
23569
|
) }, id)) }) }),
|
|
23212
|
-
/* @__PURE__ */
|
|
23570
|
+
/* @__PURE__ */ jsx278("section", { className: "flex-1 overflow-y-auto p-4", children: selectedModuleId && selectedBlock ? /* @__PURE__ */ jsx278(
|
|
23213
23571
|
ModuleEditor,
|
|
23214
23572
|
{
|
|
23215
23573
|
moduleId: selectedModuleId,
|
|
@@ -23219,9 +23577,9 @@ function RbacContainer() {
|
|
|
23219
23577
|
roleNames,
|
|
23220
23578
|
onOpenPicker: openPicker
|
|
23221
23579
|
}
|
|
23222
|
-
) : /* @__PURE__ */
|
|
23580
|
+
) : /* @__PURE__ */ jsx278("p", { className: "text-muted-foreground text-sm", children: t("rbac.select_module_prompt") }) })
|
|
23223
23581
|
] }),
|
|
23224
|
-
/* @__PURE__ */
|
|
23582
|
+
/* @__PURE__ */ jsx278(
|
|
23225
23583
|
RbacPermissionPicker,
|
|
23226
23584
|
{
|
|
23227
23585
|
open: !!activePicker,
|
|
@@ -23240,9 +23598,9 @@ __name(RbacContainer, "RbacContainer");
|
|
|
23240
23598
|
|
|
23241
23599
|
// src/features/rbac/components/RbacByRoleContainer.tsx
|
|
23242
23600
|
import { Loader2Icon as Loader2Icon5 } from "lucide-react";
|
|
23243
|
-
import { useTranslations as
|
|
23244
|
-
import { Fragment as
|
|
23245
|
-
import { jsx as
|
|
23601
|
+
import { useTranslations as useTranslations117 } from "next-intl";
|
|
23602
|
+
import { Fragment as Fragment59, memo as memo3, useCallback as useCallback53, useEffect as useEffect76, useMemo as useMemo41, useRef as useRef41, useState as useState104 } from "react";
|
|
23603
|
+
import { jsx as jsx279, jsxs as jsxs179 } from "react/jsx-runtime";
|
|
23246
23604
|
function findToken2(tokens, action) {
|
|
23247
23605
|
if (!tokens) return void 0;
|
|
23248
23606
|
return tokens.find((t) => t.action === action);
|
|
@@ -23264,11 +23622,11 @@ var CellButton3 = memo3(/* @__PURE__ */ __name(function CellButton4({
|
|
|
23264
23622
|
}) {
|
|
23265
23623
|
const ref = useRef41(null);
|
|
23266
23624
|
const value = cellValue2(tokens, action);
|
|
23267
|
-
const handleClick =
|
|
23625
|
+
const handleClick = useCallback53(() => {
|
|
23268
23626
|
if (!ref.current) return;
|
|
23269
23627
|
onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
|
|
23270
23628
|
}, [onOpen, moduleId, rowKey, action, isRoleColumn]);
|
|
23271
|
-
return /* @__PURE__ */
|
|
23629
|
+
return /* @__PURE__ */ jsx279("div", { ref, children: /* @__PURE__ */ jsx279(RbacPermissionCell, { value, isRoleColumn, onClick: handleClick }) });
|
|
23272
23630
|
}, "CellButton"));
|
|
23273
23631
|
var ACTION_LABELS2 = {
|
|
23274
23632
|
read: "Read",
|
|
@@ -23277,65 +23635,65 @@ var ACTION_LABELS2 = {
|
|
|
23277
23635
|
delete: "Delete"
|
|
23278
23636
|
};
|
|
23279
23637
|
function RbacByRoleContainer() {
|
|
23280
|
-
const t =
|
|
23638
|
+
const t = useTranslations117();
|
|
23281
23639
|
const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
|
|
23282
|
-
const [selectedRoleId, setSelectedRoleId] =
|
|
23283
|
-
const [activePicker, setActivePicker] =
|
|
23284
|
-
const openPicker =
|
|
23640
|
+
const [selectedRoleId, setSelectedRoleId] = useState104(null);
|
|
23641
|
+
const [activePicker, setActivePicker] = useState104(null);
|
|
23642
|
+
const openPicker = useCallback53((picker) => {
|
|
23285
23643
|
setActivePicker(picker);
|
|
23286
23644
|
}, []);
|
|
23287
|
-
const closePicker =
|
|
23645
|
+
const closePicker = useCallback53(() => {
|
|
23288
23646
|
setActivePicker(null);
|
|
23289
23647
|
}, []);
|
|
23290
|
-
const handleSelectRole =
|
|
23648
|
+
const handleSelectRole = useCallback53((id) => {
|
|
23291
23649
|
setSelectedRoleId(id);
|
|
23292
23650
|
setActivePicker(null);
|
|
23293
23651
|
}, []);
|
|
23294
|
-
const sortedRoleIds =
|
|
23652
|
+
const sortedRoleIds = useMemo41(() => {
|
|
23295
23653
|
if (!roleNames) return [];
|
|
23296
23654
|
return Object.keys(roleNames).sort((a, b) => (roleNames[a] ?? a).localeCompare(roleNames[b] ?? b));
|
|
23297
23655
|
}, [roleNames]);
|
|
23298
|
-
const sortedModuleIds =
|
|
23656
|
+
const sortedModuleIds = useMemo41(() => {
|
|
23299
23657
|
if (!matrix) return [];
|
|
23300
23658
|
return Object.keys(matrix).sort((a, b) => (moduleNames?.[a] ?? a).localeCompare(moduleNames?.[b] ?? b));
|
|
23301
23659
|
}, [matrix, moduleNames]);
|
|
23302
|
-
|
|
23660
|
+
useEffect76(() => {
|
|
23303
23661
|
if (!selectedRoleId && sortedRoleIds.length > 0) {
|
|
23304
23662
|
setSelectedRoleId(sortedRoleIds[0]);
|
|
23305
23663
|
}
|
|
23306
23664
|
}, [selectedRoleId, sortedRoleIds]);
|
|
23307
|
-
const activeValue =
|
|
23665
|
+
const activeValue = useMemo41(() => {
|
|
23308
23666
|
if (!activePicker || !matrix) return void 0;
|
|
23309
23667
|
const block = matrix[activePicker.moduleId];
|
|
23310
23668
|
if (!block) return void 0;
|
|
23311
23669
|
const tokens = activePicker.rowKey === "default" ? block.default : block[activePicker.rowKey];
|
|
23312
23670
|
return cellValue2(tokens, activePicker.action);
|
|
23313
23671
|
}, [activePicker, matrix]);
|
|
23314
|
-
const activeSegments =
|
|
23672
|
+
const activeSegments = useMemo41(() => {
|
|
23315
23673
|
if (!activePicker) return [];
|
|
23316
23674
|
return modulePaths[activePicker.moduleId] ?? [];
|
|
23317
23675
|
}, [activePicker, modulePaths]);
|
|
23318
|
-
const handleSetValue =
|
|
23676
|
+
const handleSetValue = useCallback53(
|
|
23319
23677
|
(value) => {
|
|
23320
23678
|
if (!activePicker) return;
|
|
23321
23679
|
updateCell(activePicker.moduleId, activePicker.rowKey, activePicker.action, value);
|
|
23322
23680
|
},
|
|
23323
23681
|
[activePicker, updateCell]
|
|
23324
23682
|
);
|
|
23325
|
-
const handleClear =
|
|
23683
|
+
const handleClear = useCallback53(() => {
|
|
23326
23684
|
if (!activePicker || !activePicker.isRoleColumn) return;
|
|
23327
23685
|
clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
|
|
23328
23686
|
}, [activePicker, clearCell]);
|
|
23329
23687
|
if (loading) {
|
|
23330
|
-
return /* @__PURE__ */
|
|
23688
|
+
return /* @__PURE__ */ jsx279(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx279("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx279(Loader2Icon5, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) });
|
|
23331
23689
|
}
|
|
23332
23690
|
if (error) {
|
|
23333
|
-
return /* @__PURE__ */
|
|
23691
|
+
return /* @__PURE__ */ jsx279(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx279("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx279("p", { className: "text-destructive", children: error }) }) });
|
|
23334
23692
|
}
|
|
23335
23693
|
if (!matrix || !selectedRoleId) return null;
|
|
23336
|
-
return /* @__PURE__ */
|
|
23337
|
-
/* @__PURE__ */
|
|
23338
|
-
/* @__PURE__ */
|
|
23694
|
+
return /* @__PURE__ */ jsxs179(RoundPageContainer, { fullWidth: true, forceHeader: true, children: [
|
|
23695
|
+
/* @__PURE__ */ jsxs179("div", { className: "flex h-full w-full", children: [
|
|
23696
|
+
/* @__PURE__ */ jsx279("aside", { className: "w-60 shrink-0 overflow-y-auto border-r bg-muted/20", children: /* @__PURE__ */ jsx279("ul", { className: "py-1", children: sortedRoleIds.map((id) => /* @__PURE__ */ jsx279("li", { children: /* @__PURE__ */ jsx279(
|
|
23339
23697
|
"button",
|
|
23340
23698
|
{
|
|
23341
23699
|
type: "button",
|
|
@@ -23349,10 +23707,10 @@ function RbacByRoleContainer() {
|
|
|
23349
23707
|
children: roleNames?.[id] ?? id
|
|
23350
23708
|
}
|
|
23351
23709
|
) }, id)) }) }),
|
|
23352
|
-
/* @__PURE__ */
|
|
23353
|
-
/* @__PURE__ */
|
|
23354
|
-
/* @__PURE__ */
|
|
23355
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23710
|
+
/* @__PURE__ */ jsx279("section", { className: "flex-1 overflow-y-auto p-4", children: sortedModuleIds.length > 0 ? /* @__PURE__ */ jsx279("div", { className: "rounded-lg border border-accent bg-card", children: /* @__PURE__ */ jsx279("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs179("table", { className: "w-full text-sm", children: [
|
|
23711
|
+
/* @__PURE__ */ jsx279("thead", { className: "sticky top-0 z-10", children: /* @__PURE__ */ jsxs179("tr", { className: "border-b bg-muted/80 backdrop-blur-sm", children: [
|
|
23712
|
+
/* @__PURE__ */ jsx279("th", { className: "w-40 px-4 py-2 text-left text-xs font-medium text-muted-foreground", children: t("rbac.module") }),
|
|
23713
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx279(
|
|
23356
23714
|
"th",
|
|
23357
23715
|
{
|
|
23358
23716
|
className: "min-w-28 px-2 py-2 text-center text-xs font-medium text-muted-foreground",
|
|
@@ -23361,14 +23719,14 @@ function RbacByRoleContainer() {
|
|
|
23361
23719
|
action
|
|
23362
23720
|
))
|
|
23363
23721
|
] }) }),
|
|
23364
|
-
/* @__PURE__ */
|
|
23722
|
+
/* @__PURE__ */ jsx279("tbody", { children: sortedModuleIds.map((moduleId) => {
|
|
23365
23723
|
const block = matrix[moduleId];
|
|
23366
23724
|
if (!block) return null;
|
|
23367
23725
|
const defaultTokens = block.default ?? [];
|
|
23368
23726
|
const roleTokens = block[selectedRoleId];
|
|
23369
23727
|
const moduleLabel = moduleNames?.[moduleId] ?? moduleId;
|
|
23370
|
-
return /* @__PURE__ */
|
|
23371
|
-
/* @__PURE__ */
|
|
23728
|
+
return /* @__PURE__ */ jsxs179(Fragment59, { children: [
|
|
23729
|
+
/* @__PURE__ */ jsx279("tr", { className: "border-b bg-muted/40", children: /* @__PURE__ */ jsx279(
|
|
23372
23730
|
"td",
|
|
23373
23731
|
{
|
|
23374
23732
|
colSpan: ACTION_TYPES.length + 1,
|
|
@@ -23376,13 +23734,13 @@ function RbacByRoleContainer() {
|
|
|
23376
23734
|
children: moduleLabel
|
|
23377
23735
|
}
|
|
23378
23736
|
) }),
|
|
23379
|
-
/* @__PURE__ */
|
|
23380
|
-
/* @__PURE__ */
|
|
23381
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23737
|
+
/* @__PURE__ */ jsxs179("tr", { className: "border-b bg-muted/20", children: [
|
|
23738
|
+
/* @__PURE__ */ jsx279("td", { className: "px-4 py-1 text-xs text-muted-foreground", children: t("rbac.defaults") }),
|
|
23739
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx279("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx279(RbacPermissionCell, { value: cellValue2(defaultTokens, action) }) }, action))
|
|
23382
23740
|
] }),
|
|
23383
|
-
/* @__PURE__ */
|
|
23384
|
-
/* @__PURE__ */
|
|
23385
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
23741
|
+
/* @__PURE__ */ jsxs179("tr", { className: "border-b last:border-b-0", children: [
|
|
23742
|
+
/* @__PURE__ */ jsx279("td", { className: "px-4 py-1 text-xs font-medium text-muted-foreground", children: roleNames?.[selectedRoleId] ?? selectedRoleId }),
|
|
23743
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx279("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx279(
|
|
23386
23744
|
CellButton3,
|
|
23387
23745
|
{
|
|
23388
23746
|
moduleId,
|
|
@@ -23396,9 +23754,9 @@ function RbacByRoleContainer() {
|
|
|
23396
23754
|
] })
|
|
23397
23755
|
] }, moduleId);
|
|
23398
23756
|
}) })
|
|
23399
|
-
] }) }) }) : /* @__PURE__ */
|
|
23757
|
+
] }) }) }) : /* @__PURE__ */ jsx279("p", { className: "text-muted-foreground text-sm", children: t("rbac.select_role_prompt") }) })
|
|
23400
23758
|
] }),
|
|
23401
|
-
/* @__PURE__ */
|
|
23759
|
+
/* @__PURE__ */ jsx279(
|
|
23402
23760
|
RbacPermissionPicker,
|
|
23403
23761
|
{
|
|
23404
23762
|
open: !!activePicker,
|
|
@@ -23890,6 +24248,10 @@ export {
|
|
|
23890
24248
|
MessageList,
|
|
23891
24249
|
AssistantThread,
|
|
23892
24250
|
AssistantContainer,
|
|
24251
|
+
AssistantBlockNoteComposer,
|
|
24252
|
+
AssistantPageContainer,
|
|
24253
|
+
ApprovalActionCard,
|
|
24254
|
+
AssistantContainerWithApprovals,
|
|
23893
24255
|
NotificationErrorBoundary,
|
|
23894
24256
|
generateNotificationData,
|
|
23895
24257
|
NotificationToast,
|
|
@@ -23964,4 +24326,4 @@ export {
|
|
|
23964
24326
|
useOAuthClients,
|
|
23965
24327
|
useOAuthClient
|
|
23966
24328
|
};
|
|
23967
|
-
//# sourceMappingURL=chunk-
|
|
24329
|
+
//# sourceMappingURL=chunk-A7AGXKZX.mjs.map
|