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