@carlonicora/nextjs-jsonapi 6.10.2 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-LX7NMBV6.js → BlockNoteEditor-R2SLOYS6.js} +84 -43
- package/dist/BlockNoteEditor-R2SLOYS6.js.map +1 -0
- package/dist/{BlockNoteEditor-7GQWHXBC.mjs → BlockNoteEditor-ZJPGGUQQ.mjs} +61 -20
- package/dist/BlockNoteEditor-ZJPGGUQQ.mjs.map +1 -0
- package/dist/{BlockNoteViewer-NXV5PKR4.js → BlockNoteViewer-FLUHEXE6.js} +3 -3
- package/dist/{BlockNoteViewer-NXV5PKR4.js.map → BlockNoteViewer-FLUHEXE6.js.map} +1 -1
- package/dist/{BlockNoteViewer-D3Y4FUST.mjs → BlockNoteViewer-UCA3LV3N.mjs} +2 -2
- package/dist/billing/index.js +491 -491
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-QB2XU64X.mjs → chunk-6RLATJ2L.mjs} +2 -2
- package/dist/{chunk-62P4KIR2.mjs → chunk-BGLOFZ3K.mjs} +282 -2
- package/dist/chunk-BGLOFZ3K.mjs.map +1 -0
- package/dist/{chunk-3I5JCFPY.js → chunk-BXR36J25.js} +1647 -969
- package/dist/chunk-BXR36J25.js.map +1 -0
- package/dist/{chunk-62VVBUIL.js → chunk-FNPXCYHO.js} +8 -8
- package/dist/{chunk-62VVBUIL.js.map → chunk-FNPXCYHO.js.map} +1 -1
- package/dist/{chunk-TOPGUZSX.js → chunk-OHJSI6L2.js} +4 -4
- package/dist/{chunk-TOPGUZSX.js.map → chunk-OHJSI6L2.js.map} +1 -1
- package/dist/{chunk-LDUTS7SJ.mjs → chunk-SQUMPLNN.mjs} +1281 -603
- package/dist/chunk-SQUMPLNN.mjs.map +1 -0
- package/dist/{chunk-Z4OVEA3N.js → chunk-YGEOX2XX.js} +283 -3
- package/dist/chunk-YGEOX2XX.js.map +1 -0
- package/dist/{chunk-GHAZOQTT.mjs → chunk-YP6W4AB5.mjs} +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +88 -29
- package/dist/components/index.d.ts +88 -29
- package/dist/components/index.js +10 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +159 -3
- package/dist/core/index.d.ts +159 -3
- package/dist/core/index.js +14 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +13 -1
- package/dist/email-automations/index.js +93 -93
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.js +120 -122
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +7 -9
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +126 -128
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +14 -16
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -2
- package/dist/{HandbookSectionInterface-5I57rC1b.d.mts → referral-admin.interface-C87ApGMR.d.mts} +41 -1
- package/dist/{HandbookSectionInterface-IDYEzQMi.d.ts → referral-admin.interface-CMwl5NiV.d.ts} +41 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/messages/en.json +78 -1
- package/messages/it.json +78 -1
- package/package.json +8 -3
- package/src/components/editors/BlockNoteEditor.tsx +52 -20
- package/src/components/editors/__tests__/blocknote-editor-options.spec.ts +81 -0
- package/src/components/editors/blockNoteEditorOptions.ts +58 -0
- package/src/core/index.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +5 -0
- package/src/features/referral/__tests__/referral-admin-models.spec.ts +122 -0
- package/src/features/referral/__tests__/referral-admin-service.spec.ts +70 -0
- package/src/features/referral/__tests__/referral-code-capture.spec.tsx +105 -0
- package/src/features/referral/__tests__/referral-invite-errors.spec.tsx +82 -0
- package/src/features/referral/__tests__/referral-visit-service.spec.ts +47 -0
- package/src/features/referral/__tests__/referrals-admin-container.spec.tsx +230 -0
- package/src/features/referral/components/ReferralCodeCapture.tsx +3 -0
- package/src/features/referral/components/ReferralDialog.tsx +9 -13
- package/src/features/referral/components/ReferralWidget.tsx +75 -45
- package/src/features/referral/components/ReferralsAdminFunnel.tsx +74 -0
- package/src/features/referral/components/ReferralsAdminTiles.tsx +128 -0
- package/src/features/referral/components/containers/ReferralsAdminContainer.tsx +205 -0
- package/src/features/referral/components/index.ts +3 -0
- package/src/features/referral/data/ReferralAdminReferral.ts +65 -0
- package/src/features/referral/data/ReferralAdminReferrer.ts +65 -0
- package/src/features/referral/data/ReferralAdminService.ts +51 -0
- package/src/features/referral/data/ReferralAdminSummary.ts +60 -0
- package/src/features/referral/data/ReferralService.ts +20 -0
- package/src/features/referral/data/ReferralVisit.ts +23 -0
- package/src/features/referral/data/index.ts +5 -0
- package/src/features/referral/hooks/index.ts +2 -0
- package/src/features/referral/hooks/useReferralAdminReferralTableStructure.tsx +127 -0
- package/src/features/referral/hooks/useReferralAdminReferrerTableStructure.tsx +229 -0
- package/src/features/referral/hooks/useReferralInvite.ts +2 -0
- package/src/features/referral/index.ts +1 -0
- package/src/features/referral/interfaces/index.ts +1 -0
- package/src/features/referral/interfaces/referral-admin.interface.ts +45 -0
- package/src/features/referral/referral-admin.modules.ts +32 -0
- package/dist/BlockNoteEditor-7GQWHXBC.mjs.map +0 -1
- package/dist/BlockNoteEditor-LX7NMBV6.js.map +0 -1
- package/dist/chunk-3I5JCFPY.js.map +0 -1
- package/dist/chunk-62P4KIR2.mjs.map +0 -1
- package/dist/chunk-D6UX37IA.mjs +0 -115
- package/dist/chunk-D6UX37IA.mjs.map +0 -1
- package/dist/chunk-KEHP2OBQ.js +0 -115
- package/dist/chunk-KEHP2OBQ.js.map +0 -1
- package/dist/chunk-LDUTS7SJ.mjs.map +0 -1
- package/dist/chunk-Z4OVEA3N.js.map +0 -1
- /package/dist/{BlockNoteViewer-D3Y4FUST.mjs.map → BlockNoteViewer-UCA3LV3N.mjs.map} +0 -0
- /package/dist/{chunk-QB2XU64X.mjs.map → chunk-6RLATJ2L.mjs.map} +0 -0
- /package/dist/{chunk-GHAZOQTT.mjs.map → chunk-YP6W4AB5.mjs.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isReferralEnabled,
|
|
17
17
|
isRegistrationAllowed,
|
|
18
18
|
useWaitlistText
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6RLATJ2L.mjs";
|
|
20
20
|
import {
|
|
21
21
|
getRoleId,
|
|
22
22
|
isRolesConfigured
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
OAUTH_SCOPE_DISPLAY,
|
|
52
52
|
OAuthService,
|
|
53
53
|
PushService,
|
|
54
|
+
ReferralAdminService,
|
|
54
55
|
ReferralService,
|
|
55
56
|
RehydrationFactory,
|
|
56
57
|
RoleService,
|
|
@@ -77,6 +78,7 @@ import {
|
|
|
77
78
|
getLastApiMeta,
|
|
78
79
|
getLastApiTotal,
|
|
79
80
|
getTokenHandler,
|
|
81
|
+
getTokenUsageCurrency,
|
|
80
82
|
getViewportContext,
|
|
81
83
|
handbookPageContent,
|
|
82
84
|
handbookPageSummary,
|
|
@@ -101,7 +103,7 @@ import {
|
|
|
101
103
|
useIsMobile,
|
|
102
104
|
validateItalianTaxCode,
|
|
103
105
|
validatePartitaIva
|
|
104
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-BGLOFZ3K.mjs";
|
|
105
107
|
import {
|
|
106
108
|
ENV
|
|
107
109
|
} from "./chunk-V5MI7RNB.mjs";
|
|
@@ -10838,7 +10840,7 @@ import { useRef as useRef18 } from "react";
|
|
|
10838
10840
|
import dynamic from "next/dynamic";
|
|
10839
10841
|
import React18 from "react";
|
|
10840
10842
|
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
10841
|
-
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-
|
|
10843
|
+
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-ZJPGGUQQ.mjs"), {
|
|
10842
10844
|
ssr: false
|
|
10843
10845
|
});
|
|
10844
10846
|
var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
|
|
@@ -17047,7 +17049,7 @@ __name(BlockNoteEditorMentionSuggestionMenu, "BlockNoteEditorMentionSuggestionMe
|
|
|
17047
17049
|
import dynamic2 from "next/dynamic";
|
|
17048
17050
|
import React29 from "react";
|
|
17049
17051
|
import { jsx as jsx178 } from "react/jsx-runtime";
|
|
17050
|
-
var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-
|
|
17052
|
+
var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-UCA3LV3N.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
|
|
17051
17053
|
var BlockNoteViewerContainer = React29.memo(/* @__PURE__ */ __name(function ViewerContainer(props) {
|
|
17052
17054
|
return /* @__PURE__ */ jsx178(BlockNoteViewer, { ...props });
|
|
17053
17055
|
}, "ViewerContainer"));
|
|
@@ -26965,6 +26967,8 @@ function ReferralCodeCapture() {
|
|
|
26965
26967
|
const existingCode = getReferralCode2();
|
|
26966
26968
|
if (!existingCode) {
|
|
26967
26969
|
setReferralCode(refCode);
|
|
26970
|
+
ReferralService.recordVisit({ referralCode: refCode }).catch(() => {
|
|
26971
|
+
});
|
|
26968
26972
|
}
|
|
26969
26973
|
}
|
|
26970
26974
|
}, [searchParams]);
|
|
@@ -26972,8 +26976,12 @@ function ReferralCodeCapture() {
|
|
|
26972
26976
|
}
|
|
26973
26977
|
__name(ReferralCodeCapture, "ReferralCodeCapture");
|
|
26974
26978
|
|
|
26979
|
+
// src/features/referral/components/ReferralDialog.tsx
|
|
26980
|
+
import { useTranslations as useTranslations165 } from "next-intl";
|
|
26981
|
+
|
|
26975
26982
|
// src/features/referral/components/ReferralWidget.tsx
|
|
26976
26983
|
import { Copy as Copy2, Loader2 as Loader27, Mail, Users } from "lucide-react";
|
|
26984
|
+
import { useTranslations as useTranslations164 } from "next-intl";
|
|
26977
26985
|
import { useCallback as useCallback55, useRef as useRef47, useState as useState120 } from "react";
|
|
26978
26986
|
|
|
26979
26987
|
// src/features/referral/hooks/useReferralInvite.ts
|
|
@@ -26994,6 +27002,7 @@ function useReferralInvite() {
|
|
|
26994
27002
|
setSuccess(true);
|
|
26995
27003
|
} catch (err) {
|
|
26996
27004
|
setError(err);
|
|
27005
|
+
throw err;
|
|
26997
27006
|
} finally {
|
|
26998
27007
|
setSending(false);
|
|
26999
27008
|
}
|
|
@@ -27021,25 +27030,10 @@ __name(useReferralStats, "useReferralStats");
|
|
|
27021
27030
|
|
|
27022
27031
|
// src/features/referral/components/ReferralWidget.tsx
|
|
27023
27032
|
import { jsx as jsx303, jsxs as jsxs180 } from "react/jsx-runtime";
|
|
27024
|
-
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
copyButton: "Copy",
|
|
27029
|
-
copiedMessage: "Link copied to clipboard!",
|
|
27030
|
-
statsLabel: "Your referral stats",
|
|
27031
|
-
completedLabel: "Successful referrals",
|
|
27032
|
-
tokensLabel: "Tokens earned",
|
|
27033
|
-
inviteTitle: "Invite by email",
|
|
27034
|
-
inviteDescription: "Send an invitation directly to a friend's email.",
|
|
27035
|
-
emailPlaceholder: "friend@example.com",
|
|
27036
|
-
sendButton: "Send",
|
|
27037
|
-
sendingButton: "Sending...",
|
|
27038
|
-
inviteSent: "Invitation sent successfully!",
|
|
27039
|
-
inviteError: "Failed to send invitation",
|
|
27040
|
-
copyError: "Failed to copy link",
|
|
27041
|
-
invalidEmail: "Please enter a valid email address"
|
|
27042
|
-
};
|
|
27033
|
+
function inviteErrorCode(err) {
|
|
27034
|
+
return err?.body?.errors?.[0]?.code;
|
|
27035
|
+
}
|
|
27036
|
+
__name(inviteErrorCode, "inviteErrorCode");
|
|
27043
27037
|
async function copyToClipboard(text) {
|
|
27044
27038
|
if (navigator.clipboard?.writeText) {
|
|
27045
27039
|
try {
|
|
@@ -27075,7 +27069,28 @@ function ReferralWidget({
|
|
|
27075
27069
|
onInviteSent,
|
|
27076
27070
|
onInviteError
|
|
27077
27071
|
}) {
|
|
27078
|
-
const t =
|
|
27072
|
+
const t = useTranslations164();
|
|
27073
|
+
const text = {
|
|
27074
|
+
title: t("referral.title"),
|
|
27075
|
+
description: t("referral.description"),
|
|
27076
|
+
yourLink: t("referral.yourLink"),
|
|
27077
|
+
copyButton: t("referral.copy"),
|
|
27078
|
+
copiedMessage: t("referral.linkCopied"),
|
|
27079
|
+
completedLabel: t("referral.completedLabel"),
|
|
27080
|
+
inviteTitle: t("referral.inviteTitle"),
|
|
27081
|
+
inviteDescription: t("referral.inviteDescription"),
|
|
27082
|
+
emailPlaceholder: t("referral.emailPlaceholder"),
|
|
27083
|
+
sendButton: t("referral.send"),
|
|
27084
|
+
sendingButton: t("referral.sending"),
|
|
27085
|
+
inviteSent: t("referral.inviteSent"),
|
|
27086
|
+
inviteError: t("referral.inviteFailed"),
|
|
27087
|
+
copyError: t("referral.copyFailed"),
|
|
27088
|
+
invalidEmail: t("referral.invalidEmail"),
|
|
27089
|
+
loadError: t("referral.loadFailed"),
|
|
27090
|
+
alreadyInvited: t("referral.alreadyInvited"),
|
|
27091
|
+
alreadyRegistered: t("referral.alreadyRegistered"),
|
|
27092
|
+
...translations
|
|
27093
|
+
};
|
|
27079
27094
|
const { stats, loading, error } = useReferralStats();
|
|
27080
27095
|
const { sendInvite, sending } = useReferralInvite();
|
|
27081
27096
|
const [email, setEmail] = useState120("");
|
|
@@ -27092,29 +27107,41 @@ function ReferralWidget({
|
|
|
27092
27107
|
const success = await copyToClipboard(referralUrl);
|
|
27093
27108
|
if (success) {
|
|
27094
27109
|
setCopied(true);
|
|
27095
|
-
showToast(
|
|
27110
|
+
showToast(text.copiedMessage);
|
|
27096
27111
|
onLinkCopied?.();
|
|
27097
27112
|
setTimeout(() => setCopied(false), 2e3);
|
|
27098
27113
|
} else {
|
|
27099
|
-
showError(
|
|
27114
|
+
showError(text.copyError);
|
|
27100
27115
|
}
|
|
27101
|
-
}, [referralUrl,
|
|
27116
|
+
}, [referralUrl, text.copiedMessage, text.copyError, onLinkCopied]);
|
|
27102
27117
|
const handleSendInvite = useCallback55(async () => {
|
|
27103
27118
|
if (!email || !email.includes("@")) {
|
|
27104
|
-
showError(
|
|
27119
|
+
showError(text.invalidEmail);
|
|
27105
27120
|
return;
|
|
27106
27121
|
}
|
|
27107
27122
|
try {
|
|
27108
27123
|
await sendInvite(email);
|
|
27109
|
-
showToast(
|
|
27124
|
+
showToast(text.inviteSent);
|
|
27110
27125
|
onInviteSent?.(email);
|
|
27111
27126
|
setEmail("");
|
|
27112
27127
|
} catch (err) {
|
|
27113
|
-
const
|
|
27114
|
-
showError(
|
|
27115
|
-
|
|
27128
|
+
const code = inviteErrorCode(err);
|
|
27129
|
+
showError(
|
|
27130
|
+
code === "REFERRAL_ALREADY_INVITED" ? text.alreadyInvited : code === "REFERRAL_ALREADY_REGISTERED" ? text.alreadyRegistered : text.inviteError
|
|
27131
|
+
);
|
|
27132
|
+
onInviteError?.(err instanceof Error ? err : new Error(text.inviteError));
|
|
27116
27133
|
}
|
|
27117
|
-
}, [
|
|
27134
|
+
}, [
|
|
27135
|
+
email,
|
|
27136
|
+
sendInvite,
|
|
27137
|
+
text.inviteSent,
|
|
27138
|
+
text.inviteError,
|
|
27139
|
+
text.invalidEmail,
|
|
27140
|
+
text.alreadyInvited,
|
|
27141
|
+
text.alreadyRegistered,
|
|
27142
|
+
onInviteSent,
|
|
27143
|
+
onInviteError
|
|
27144
|
+
]);
|
|
27118
27145
|
const handleEmailKeyDown = useCallback55(
|
|
27119
27146
|
(e) => {
|
|
27120
27147
|
if (e.key === "Enter" && !sending) {
|
|
@@ -27131,7 +27158,7 @@ function ReferralWidget({
|
|
|
27131
27158
|
return /* @__PURE__ */ jsx303(Card, { className: `p-6 ${className ?? ""}`, children: /* @__PURE__ */ jsx303("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx303(Loader27, { className: "text-muted-foreground h-6 w-6 animate-spin" }) }) });
|
|
27132
27159
|
}
|
|
27133
27160
|
if (error) {
|
|
27134
|
-
const errorMessage =
|
|
27161
|
+
const errorMessage = text.loadError;
|
|
27135
27162
|
if (isDialog) {
|
|
27136
27163
|
return /* @__PURE__ */ jsx303("div", { className: "text-destructive text-center text-sm", children: errorMessage });
|
|
27137
27164
|
}
|
|
@@ -27141,12 +27168,12 @@ function ReferralWidget({
|
|
|
27141
27168
|
!isDialog && /* @__PURE__ */ jsxs180("div", { className: "flex items-start gap-3", children: [
|
|
27142
27169
|
/* @__PURE__ */ jsx303("div", { className: "bg-primary/10 rounded-full p-2", children: /* @__PURE__ */ jsx303(Users, { className: "text-primary h-5 w-5" }) }),
|
|
27143
27170
|
/* @__PURE__ */ jsxs180("div", { className: "flex flex-col gap-1", children: [
|
|
27144
|
-
/* @__PURE__ */ jsx303(SectionHeader, { children:
|
|
27145
|
-
/* @__PURE__ */ jsx303("p", { className: "text-muted-foreground text-sm", children:
|
|
27171
|
+
/* @__PURE__ */ jsx303(SectionHeader, { children: text.title }),
|
|
27172
|
+
/* @__PURE__ */ jsx303("p", { className: "text-muted-foreground text-sm", children: text.description })
|
|
27146
27173
|
] })
|
|
27147
27174
|
] }),
|
|
27148
27175
|
/* @__PURE__ */ jsxs180("div", { className: "flex flex-col gap-2", children: [
|
|
27149
|
-
/* @__PURE__ */ jsx303(Label, { children:
|
|
27176
|
+
/* @__PURE__ */ jsx303(Label, { children: text.yourLink }),
|
|
27150
27177
|
/* @__PURE__ */ jsxs180("div", { className: "flex gap-2", children: [
|
|
27151
27178
|
/* @__PURE__ */ jsx303(Input, { ref: linkInputRef, value: referralUrl, readOnly: true, className: "tabular-nums text-sm" }),
|
|
27152
27179
|
/* @__PURE__ */ jsx303(
|
|
@@ -27157,15 +27184,15 @@ function ReferralWidget({
|
|
|
27157
27184
|
size: "icon",
|
|
27158
27185
|
onClick: handleCopyLink,
|
|
27159
27186
|
disabled: !referralUrl,
|
|
27160
|
-
"aria-label":
|
|
27187
|
+
"aria-label": text.copyButton,
|
|
27161
27188
|
children: /* @__PURE__ */ jsx303(Copy2, { className: `h-4 w-4 ${copied ? "text-success" : ""}` })
|
|
27162
27189
|
}
|
|
27163
27190
|
)
|
|
27164
27191
|
] })
|
|
27165
27192
|
] }),
|
|
27166
27193
|
/* @__PURE__ */ jsxs180("div", { className: "flex flex-col gap-2", children: [
|
|
27167
|
-
/* @__PURE__ */ jsx303(Label, { children:
|
|
27168
|
-
/* @__PURE__ */ jsx303("p", { className: "text-muted-foreground text-xs/relaxed", children:
|
|
27194
|
+
/* @__PURE__ */ jsx303(Label, { children: text.inviteTitle }),
|
|
27195
|
+
/* @__PURE__ */ jsx303("p", { className: "text-muted-foreground text-xs/relaxed", children: text.inviteDescription }),
|
|
27169
27196
|
/* @__PURE__ */ jsxs180("div", { className: "flex gap-2", children: [
|
|
27170
27197
|
/* @__PURE__ */ jsx303(
|
|
27171
27198
|
Input,
|
|
@@ -27174,7 +27201,7 @@ function ReferralWidget({
|
|
|
27174
27201
|
value: email,
|
|
27175
27202
|
onChange: (e) => setEmail(e.target.value),
|
|
27176
27203
|
onKeyDown: handleEmailKeyDown,
|
|
27177
|
-
placeholder:
|
|
27204
|
+
placeholder: text.emailPlaceholder,
|
|
27178
27205
|
disabled: sending
|
|
27179
27206
|
}
|
|
27180
27207
|
),
|
|
@@ -27186,14 +27213,14 @@ function ReferralWidget({
|
|
|
27186
27213
|
size: "icon",
|
|
27187
27214
|
onClick: handleSendInvite,
|
|
27188
27215
|
disabled: sending || !email,
|
|
27189
|
-
"aria-label": sending ?
|
|
27216
|
+
"aria-label": sending ? text.sendingButton : text.sendButton,
|
|
27190
27217
|
children: sending ? /* @__PURE__ */ jsx303(Loader27, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx303(Mail, { className: "h-4 w-4" })
|
|
27191
27218
|
}
|
|
27192
27219
|
)
|
|
27193
27220
|
] })
|
|
27194
27221
|
] }),
|
|
27195
27222
|
stats && stats.completedReferrals > 0 && /* @__PURE__ */ jsx303("div", { className: "border-border border-t pt-3", children: /* @__PURE__ */ jsxs180("p", { className: "text-muted-foreground text-sm", children: [
|
|
27196
|
-
|
|
27223
|
+
text.completedLabel,
|
|
27197
27224
|
": ",
|
|
27198
27225
|
stats.completedReferrals
|
|
27199
27226
|
] }) })
|
|
@@ -27207,10 +27234,6 @@ __name(ReferralWidget, "ReferralWidget");
|
|
|
27207
27234
|
|
|
27208
27235
|
// src/features/referral/components/ReferralDialog.tsx
|
|
27209
27236
|
import { jsx as jsx304, jsxs as jsxs181 } from "react/jsx-runtime";
|
|
27210
|
-
var DEFAULT_DIALOG_TRANSLATIONS = {
|
|
27211
|
-
dialogTitle: "Invite Friends",
|
|
27212
|
-
dialogDescription: "Share your referral link and earn rewards when your friends subscribe."
|
|
27213
|
-
};
|
|
27214
27237
|
function ReferralDialog({
|
|
27215
27238
|
open,
|
|
27216
27239
|
onOpenChange,
|
|
@@ -27218,27 +27241,669 @@ function ReferralDialog({
|
|
|
27218
27241
|
dialogClassName,
|
|
27219
27242
|
...widgetProps
|
|
27220
27243
|
}) {
|
|
27244
|
+
const t = useTranslations165();
|
|
27221
27245
|
if (!isReferralEnabled()) {
|
|
27222
27246
|
return null;
|
|
27223
27247
|
}
|
|
27224
|
-
const
|
|
27248
|
+
const text = { dialogTitle: t("referral.title"), dialogDescription: t("referral.description"), ...translations };
|
|
27225
27249
|
return /* @__PURE__ */ jsx304(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs181(DialogContent, { className: dialogClassName ?? "max-w-md", children: [
|
|
27226
27250
|
/* @__PURE__ */ jsxs181(DialogHeader, { children: [
|
|
27227
|
-
/* @__PURE__ */ jsx304(DialogTitle, { children:
|
|
27228
|
-
/* @__PURE__ */ jsx304(DialogDescription, { children:
|
|
27251
|
+
/* @__PURE__ */ jsx304(DialogTitle, { children: text.dialogTitle }),
|
|
27252
|
+
/* @__PURE__ */ jsx304(DialogDescription, { children: text.dialogDescription })
|
|
27229
27253
|
] }),
|
|
27230
27254
|
/* @__PURE__ */ jsx304(ReferralWidget, { ...widgetProps, translations, isDialog: true })
|
|
27231
27255
|
] }) });
|
|
27232
27256
|
}
|
|
27233
27257
|
__name(ReferralDialog, "ReferralDialog");
|
|
27234
27258
|
|
|
27259
|
+
// src/features/referral/components/containers/ReferralsAdminContainer.tsx
|
|
27260
|
+
import { CopyIcon as CopyIcon3 } from "lucide-react";
|
|
27261
|
+
import { useTranslations as useTranslations170 } from "next-intl";
|
|
27262
|
+
import { useEffect as useEffect88, useMemo as useMemo67, useRef as useRef48, useState as useState121 } from "react";
|
|
27263
|
+
|
|
27264
|
+
// src/features/referral/hooks/useReferralAdminReferralTableStructure.tsx
|
|
27265
|
+
import { useTranslations as useTranslations166 } from "next-intl";
|
|
27266
|
+
import { useMemo as useMemo65 } from "react";
|
|
27267
|
+
|
|
27268
|
+
// src/features/tokenusage/lib/formatters.ts
|
|
27269
|
+
import { useLocale } from "next-intl";
|
|
27270
|
+
import { useMemo as useMemo64 } from "react";
|
|
27271
|
+
function createUsageFormatters(locale, currency) {
|
|
27272
|
+
const symbol = new Intl.NumberFormat(locale, { style: "currency", currency, currencyDisplay: "narrowSymbol" }).formatToParts(0).find((part) => part.type === "currency")?.value ?? currency;
|
|
27273
|
+
const decimal = /* @__PURE__ */ __name((value, decimals) => value.toLocaleString(locale, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }), "decimal");
|
|
27274
|
+
const dayFormat = new Intl.DateTimeFormat(locale, { day: "numeric", month: "short", timeZone: "UTC" });
|
|
27275
|
+
const monthFormat = new Intl.DateTimeFormat(locale, { month: "short", year: "numeric", timeZone: "UTC" });
|
|
27276
|
+
const compactFormat = new Intl.NumberFormat(locale, { notation: "compact", maximumSignificantDigits: 3 });
|
|
27277
|
+
const collator = new Intl.Collator(locale);
|
|
27278
|
+
return {
|
|
27279
|
+
decimal,
|
|
27280
|
+
metricValue(value, metric) {
|
|
27281
|
+
if (metric === "cost") return `${symbol} ${decimal(value, 2)}`;
|
|
27282
|
+
if (metric === "credits") return decimal(value, 1);
|
|
27283
|
+
return decimal(value, 0);
|
|
27284
|
+
},
|
|
27285
|
+
currency(value, decimals) {
|
|
27286
|
+
return `${symbol} ${decimal(value, decimals)}`;
|
|
27287
|
+
},
|
|
27288
|
+
percent(value, decimals = 1) {
|
|
27289
|
+
return `${decimal(value, decimals)} %`;
|
|
27290
|
+
},
|
|
27291
|
+
compact(value) {
|
|
27292
|
+
return compactFormat.format(value);
|
|
27293
|
+
},
|
|
27294
|
+
bucketDate(iso, granularity) {
|
|
27295
|
+
const date = /* @__PURE__ */ new Date(`${iso}T00:00:00.000Z`);
|
|
27296
|
+
return granularity === "month" ? monthFormat.format(date) : dayFormat.format(date);
|
|
27297
|
+
},
|
|
27298
|
+
compare(a, b) {
|
|
27299
|
+
return collator.compare(a, b);
|
|
27300
|
+
}
|
|
27301
|
+
};
|
|
27302
|
+
}
|
|
27303
|
+
__name(createUsageFormatters, "createUsageFormatters");
|
|
27304
|
+
function useUsageFormatters() {
|
|
27305
|
+
const locale = useLocale();
|
|
27306
|
+
const currency = getTokenUsageCurrency();
|
|
27307
|
+
return useMemo64(() => createUsageFormatters(locale, currency), [locale, currency]);
|
|
27308
|
+
}
|
|
27309
|
+
__name(useUsageFormatters, "useUsageFormatters");
|
|
27310
|
+
|
|
27311
|
+
// src/features/referral/hooks/useReferralAdminReferralTableStructure.tsx
|
|
27312
|
+
import { jsx as jsx305, jsxs as jsxs182 } from "react/jsx-runtime";
|
|
27313
|
+
var useReferralAdminReferralTableStructure = /* @__PURE__ */ __name((params) => {
|
|
27314
|
+
const t = useTranslations166();
|
|
27315
|
+
const { decimal } = useUsageFormatters();
|
|
27316
|
+
const tableData = useMemo65(() => {
|
|
27317
|
+
return params.data.map((entry) => {
|
|
27318
|
+
const row = { jsonApiData: entry };
|
|
27319
|
+
row["date" /* date */] = entry.referredAt;
|
|
27320
|
+
return row;
|
|
27321
|
+
});
|
|
27322
|
+
}, [params.data]);
|
|
27323
|
+
const fieldColumnMap = {
|
|
27324
|
+
["account" /* account */]: () => ({
|
|
27325
|
+
id: "account" /* account */,
|
|
27326
|
+
header: t("referral.admin.referrals.columns.account"),
|
|
27327
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27328
|
+
const entry = row.original.jsonApiData;
|
|
27329
|
+
return /* @__PURE__ */ jsxs182("div", { className: "flex flex-col", children: [
|
|
27330
|
+
/* @__PURE__ */ jsx305("span", { className: "text-sm", children: entry.name }),
|
|
27331
|
+
/* @__PURE__ */ jsx305("span", { className: "text-muted-foreground text-xs", children: entry.email })
|
|
27332
|
+
] });
|
|
27333
|
+
}, "cell"),
|
|
27334
|
+
enableSorting: false,
|
|
27335
|
+
enableHiding: false
|
|
27336
|
+
}),
|
|
27337
|
+
["referrer" /* referrer */]: () => ({
|
|
27338
|
+
id: "referrer" /* referrer */,
|
|
27339
|
+
header: t("referral.admin.referrals.columns.referrer"),
|
|
27340
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27341
|
+
const entry = row.original.jsonApiData;
|
|
27342
|
+
return /* @__PURE__ */ jsxs182("div", { className: "flex flex-col", children: [
|
|
27343
|
+
/* @__PURE__ */ jsx305("span", { className: "text-sm", children: entry.referrerName }),
|
|
27344
|
+
/* @__PURE__ */ jsx305("span", { className: "text-muted-foreground text-xs", children: entry.referrerEmail })
|
|
27345
|
+
] });
|
|
27346
|
+
}, "cell"),
|
|
27347
|
+
enableSorting: false,
|
|
27348
|
+
enableHiding: false
|
|
27349
|
+
}),
|
|
27350
|
+
["source" /* source */]: () => ({
|
|
27351
|
+
id: "source" /* source */,
|
|
27352
|
+
header: t("referral.admin.referrals.columns.source"),
|
|
27353
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27354
|
+
const source = row.original.jsonApiData.source;
|
|
27355
|
+
if (source === "link") return /* @__PURE__ */ jsx305(Badge, { variant: "softBlue", children: t("referral.admin.source.link") });
|
|
27356
|
+
if (source === "direct") return /* @__PURE__ */ jsx305(Badge, { variant: "softGray", children: t("referral.admin.source.direct") });
|
|
27357
|
+
return /* @__PURE__ */ jsx305("span", { className: "text-muted-foreground text-xs", children: "\u2014" });
|
|
27358
|
+
}, "cell"),
|
|
27359
|
+
enableSorting: false,
|
|
27360
|
+
enableHiding: false
|
|
27361
|
+
}),
|
|
27362
|
+
["date" /* date */]: () => cellDate({ name: "date" /* date */, title: t("referral.admin.referrals.columns.date") }),
|
|
27363
|
+
["status" /* status */]: () => ({
|
|
27364
|
+
id: "status" /* status */,
|
|
27365
|
+
header: t("referral.admin.referrals.columns.status"),
|
|
27366
|
+
cell: /* @__PURE__ */ __name(({ row }) => row.original.jsonApiData.status === "completed" ? /* @__PURE__ */ jsx305(Badge, { variant: "softGreen", children: t("referral.admin.status.completed") }) : /* @__PURE__ */ jsx305(Badge, { variant: "softYellow", children: t("referral.admin.status.pending") }), "cell"),
|
|
27367
|
+
enableSorting: false,
|
|
27368
|
+
enableHiding: false
|
|
27369
|
+
}),
|
|
27370
|
+
["credits" /* credits */]: () => ({
|
|
27371
|
+
id: "credits" /* credits */,
|
|
27372
|
+
header: t("referral.admin.referrals.columns.credits"),
|
|
27373
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27374
|
+
const entry = row.original.jsonApiData;
|
|
27375
|
+
if (entry.status !== "completed" || !entry.tokensAwarded)
|
|
27376
|
+
return /* @__PURE__ */ jsx305("span", { className: "block text-muted-foreground text-xs text-end", children: "\u2014" });
|
|
27377
|
+
const award = decimal(entry.tokensAwarded, 0);
|
|
27378
|
+
return /* @__PURE__ */ jsx305("span", { className: "block text-xs tabular-nums text-end", children: `${award} + ${award}` });
|
|
27379
|
+
}, "cell"),
|
|
27380
|
+
meta: { className: "text-end" },
|
|
27381
|
+
enableSorting: false,
|
|
27382
|
+
enableHiding: false
|
|
27383
|
+
})
|
|
27384
|
+
};
|
|
27385
|
+
const columns = useMemo65(() => {
|
|
27386
|
+
return params.fields.map((field) => fieldColumnMap[field]?.()).filter((col) => col !== void 0);
|
|
27387
|
+
}, [params.fields, fieldColumnMap, t, decimal]);
|
|
27388
|
+
return useMemo65(() => ({ data: tableData, columns }), [tableData, columns]);
|
|
27389
|
+
}, "useReferralAdminReferralTableStructure");
|
|
27390
|
+
registerTableGenerator("referrals/administration/referrals", useReferralAdminReferralTableStructure);
|
|
27391
|
+
|
|
27392
|
+
// src/features/referral/hooks/useReferralAdminReferrerTableStructure.tsx
|
|
27393
|
+
import { CopyIcon as CopyIcon2 } from "lucide-react";
|
|
27394
|
+
import { useTranslations as useTranslations167 } from "next-intl";
|
|
27395
|
+
import { useMemo as useMemo66 } from "react";
|
|
27396
|
+
import { jsx as jsx306, jsxs as jsxs183 } from "react/jsx-runtime";
|
|
27397
|
+
async function copyReferrerEmails(text, t) {
|
|
27398
|
+
try {
|
|
27399
|
+
await navigator.clipboard.writeText(text);
|
|
27400
|
+
showToast(t("referral.admin.referrers.copied"));
|
|
27401
|
+
} catch {
|
|
27402
|
+
showError(t("referral.admin.referrers.copyFailed"));
|
|
27403
|
+
}
|
|
27404
|
+
}
|
|
27405
|
+
__name(copyReferrerEmails, "copyReferrerEmails");
|
|
27406
|
+
var NUMERIC = { className: "text-end" };
|
|
27407
|
+
var useReferralAdminReferrerTableStructure = /* @__PURE__ */ __name((params) => {
|
|
27408
|
+
const t = useTranslations167();
|
|
27409
|
+
const { decimal } = useUsageFormatters();
|
|
27410
|
+
const context = params.context;
|
|
27411
|
+
const tableData = useMemo66(() => {
|
|
27412
|
+
return params.data.map((entry, index) => {
|
|
27413
|
+
const row = { jsonApiData: entry };
|
|
27414
|
+
row["rank" /* rank */] = index + 1;
|
|
27415
|
+
row["lastInvite" /* lastInvite */] = entry.lastInviteAt;
|
|
27416
|
+
return row;
|
|
27417
|
+
});
|
|
27418
|
+
}, [params.data]);
|
|
27419
|
+
const sortableHeader = /* @__PURE__ */ __name((sort, label) => () => {
|
|
27420
|
+
const active = context?.sort === sort;
|
|
27421
|
+
return /* @__PURE__ */ jsx306(
|
|
27422
|
+
Button,
|
|
27423
|
+
{
|
|
27424
|
+
type: "button",
|
|
27425
|
+
variant: "ghost",
|
|
27426
|
+
size: "xs",
|
|
27427
|
+
className: active ? "text-primary" : "text-muted-foreground",
|
|
27428
|
+
title: t("referral.admin.referrers.sortBy"),
|
|
27429
|
+
"aria-sort": active ? "descending" : void 0,
|
|
27430
|
+
"data-testid": active ? "referrals-referrers-sort" : void 0,
|
|
27431
|
+
onClick: () => context?.onSort(sort),
|
|
27432
|
+
children: label
|
|
27433
|
+
}
|
|
27434
|
+
);
|
|
27435
|
+
}, "sortableHeader");
|
|
27436
|
+
const numericCell = /* @__PURE__ */ __name((read) => {
|
|
27437
|
+
return ({ row }) => /* @__PURE__ */ jsx306("span", { className: "block text-xs tabular-nums text-end", children: decimal(read(row.original.jsonApiData), 0) });
|
|
27438
|
+
}, "numericCell");
|
|
27439
|
+
const fieldColumnMap = {
|
|
27440
|
+
["rank" /* rank */]: () => ({
|
|
27441
|
+
id: "rank" /* rank */,
|
|
27442
|
+
header: "#",
|
|
27443
|
+
cell: /* @__PURE__ */ __name(({ row }) => /* @__PURE__ */ jsx306("span", { className: "text-muted-foreground text-xs tabular-nums", children: row.original["rank" /* rank */] }), "cell"),
|
|
27444
|
+
enableSorting: false,
|
|
27445
|
+
enableHiding: false
|
|
27446
|
+
}),
|
|
27447
|
+
["referrer" /* referrer */]: () => ({
|
|
27448
|
+
id: "referrer" /* referrer */,
|
|
27449
|
+
header: t("referral.admin.referrers.columns.referrer"),
|
|
27450
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27451
|
+
const entry = row.original.jsonApiData;
|
|
27452
|
+
return /* @__PURE__ */ jsxs183("div", { className: "flex items-center gap-2", children: [
|
|
27453
|
+
/* @__PURE__ */ jsxs183("div", { className: "flex flex-col", children: [
|
|
27454
|
+
/* @__PURE__ */ jsx306("span", { className: "text-sm", children: entry.name }),
|
|
27455
|
+
/* @__PURE__ */ jsx306("span", { className: "text-muted-foreground text-xs", children: entry.email })
|
|
27456
|
+
] }),
|
|
27457
|
+
entry.email && /* @__PURE__ */ jsx306(
|
|
27458
|
+
Button,
|
|
27459
|
+
{
|
|
27460
|
+
type: "button",
|
|
27461
|
+
variant: "ghost",
|
|
27462
|
+
size: "icon-xs",
|
|
27463
|
+
"aria-label": t("referral.admin.referrers.copyEmail"),
|
|
27464
|
+
title: t("referral.admin.referrers.copyEmail"),
|
|
27465
|
+
"data-testid": `referrals-copy-email-${entry.id}`,
|
|
27466
|
+
onClick: () => copyReferrerEmails(entry.email, t),
|
|
27467
|
+
children: /* @__PURE__ */ jsx306(CopyIcon2, {})
|
|
27468
|
+
}
|
|
27469
|
+
)
|
|
27470
|
+
] });
|
|
27471
|
+
}, "cell"),
|
|
27472
|
+
enableSorting: false,
|
|
27473
|
+
enableHiding: false
|
|
27474
|
+
}),
|
|
27475
|
+
["visits" /* visits */]: () => ({
|
|
27476
|
+
id: "visits" /* visits */,
|
|
27477
|
+
header: t("referral.admin.referrers.columns.visits"),
|
|
27478
|
+
cell: numericCell((entry) => entry.visits),
|
|
27479
|
+
meta: NUMERIC,
|
|
27480
|
+
enableSorting: false,
|
|
27481
|
+
enableHiding: false
|
|
27482
|
+
}),
|
|
27483
|
+
["invites" /* invites */]: () => ({
|
|
27484
|
+
id: "invites" /* invites */,
|
|
27485
|
+
header: sortableHeader("invites", t("referral.admin.referrers.columns.invites")),
|
|
27486
|
+
cell: numericCell((entry) => entry.invitesSent),
|
|
27487
|
+
meta: NUMERIC,
|
|
27488
|
+
enableSorting: false,
|
|
27489
|
+
enableHiding: false
|
|
27490
|
+
}),
|
|
27491
|
+
["signups" /* signups */]: () => ({
|
|
27492
|
+
id: "signups" /* signups */,
|
|
27493
|
+
header: sortableHeader("signups", t("referral.admin.referrers.columns.signups")),
|
|
27494
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27495
|
+
const entry = row.original.jsonApiData;
|
|
27496
|
+
return /* @__PURE__ */ jsxs183("div", { className: "flex flex-col items-end", children: [
|
|
27497
|
+
/* @__PURE__ */ jsx306("span", { className: "text-xs tabular-nums", children: decimal(entry.signupsLink + entry.signupsDirect, 0) }),
|
|
27498
|
+
/* @__PURE__ */ jsx306("span", { className: "text-muted-foreground text-xs", children: t("referral.admin.referrers.split", { link: entry.signupsLink, direct: entry.signupsDirect }) })
|
|
27499
|
+
] });
|
|
27500
|
+
}, "cell"),
|
|
27501
|
+
meta: NUMERIC,
|
|
27502
|
+
enableSorting: false,
|
|
27503
|
+
enableHiding: false
|
|
27504
|
+
}),
|
|
27505
|
+
["paying" /* paying */]: () => ({
|
|
27506
|
+
id: "paying" /* paying */,
|
|
27507
|
+
header: sortableHeader("paying", t("referral.admin.referrers.columns.paying")),
|
|
27508
|
+
cell: numericCell((entry) => entry.paying),
|
|
27509
|
+
meta: NUMERIC,
|
|
27510
|
+
enableSorting: false,
|
|
27511
|
+
enableHiding: false
|
|
27512
|
+
}),
|
|
27513
|
+
["conversion" /* conversion */]: () => ({
|
|
27514
|
+
id: "conversion" /* conversion */,
|
|
27515
|
+
header: sortableHeader("conversion", t("referral.admin.referrers.columns.conversion")),
|
|
27516
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
27517
|
+
const entry = row.original.jsonApiData;
|
|
27518
|
+
if (!entry.invitesSent) return /* @__PURE__ */ jsx306("span", { className: "block text-muted-foreground text-xs text-end", children: "\u2014" });
|
|
27519
|
+
const rate = Math.round(entry.paying / entry.invitesSent * 100);
|
|
27520
|
+
return /* @__PURE__ */ jsxs183("span", { className: "flex items-center justify-end gap-1.5", children: [
|
|
27521
|
+
/* @__PURE__ */ jsx306("span", { className: "bg-primary/15 relative h-1.5 w-12 overflow-hidden rounded-full", children: /* @__PURE__ */ jsx306("span", { className: "bg-primary absolute inset-y-0 start-0", style: { width: `${Math.min(rate, 100)}%` } }) }),
|
|
27522
|
+
/* @__PURE__ */ jsx306("span", { className: "text-xs tabular-nums", children: `${decimal(rate, 0)}%` })
|
|
27523
|
+
] });
|
|
27524
|
+
}, "cell"),
|
|
27525
|
+
meta: NUMERIC,
|
|
27526
|
+
enableSorting: false,
|
|
27527
|
+
enableHiding: false
|
|
27528
|
+
}),
|
|
27529
|
+
["credits" /* credits */]: () => ({
|
|
27530
|
+
id: "credits" /* credits */,
|
|
27531
|
+
header: sortableHeader("credits", t("referral.admin.referrers.columns.credits")),
|
|
27532
|
+
cell: numericCell((entry) => entry.creditsEarned),
|
|
27533
|
+
meta: NUMERIC,
|
|
27534
|
+
enableSorting: false,
|
|
27535
|
+
enableHiding: false
|
|
27536
|
+
}),
|
|
27537
|
+
["lastInvite" /* lastInvite */]: () => cellDate({
|
|
27538
|
+
name: "lastInvite" /* lastInvite */,
|
|
27539
|
+
title: t("referral.admin.referrers.columns.lastInvite")
|
|
27540
|
+
})
|
|
27541
|
+
};
|
|
27542
|
+
const columns = useMemo66(() => {
|
|
27543
|
+
return params.fields.map((field) => fieldColumnMap[field]?.()).filter((col) => col !== void 0);
|
|
27544
|
+
}, [params.fields, fieldColumnMap, t, decimal, context?.sort]);
|
|
27545
|
+
return useMemo66(() => ({ data: tableData, columns }), [tableData, columns]);
|
|
27546
|
+
}, "useReferralAdminReferrerTableStructure");
|
|
27547
|
+
registerTableGenerator("referrals/administration/referrers", useReferralAdminReferrerTableStructure);
|
|
27548
|
+
|
|
27549
|
+
// src/features/referral/components/ReferralsAdminFunnel.tsx
|
|
27550
|
+
import { useTranslations as useTranslations168 } from "next-intl";
|
|
27551
|
+
|
|
27552
|
+
// src/features/tokenusage/lib/palette.ts
|
|
27553
|
+
var CATEGORICAL_LIGHT = [
|
|
27554
|
+
"#2a78d6",
|
|
27555
|
+
"#eb6834",
|
|
27556
|
+
"#1baf7a",
|
|
27557
|
+
"#eda100",
|
|
27558
|
+
"#e87ba4",
|
|
27559
|
+
"#008300",
|
|
27560
|
+
"#4a3aa7"
|
|
27561
|
+
];
|
|
27562
|
+
var CATEGORICAL_DARK = [
|
|
27563
|
+
"#3987e5",
|
|
27564
|
+
"#d95926",
|
|
27565
|
+
"#199e70",
|
|
27566
|
+
"#c98500",
|
|
27567
|
+
"#d55181",
|
|
27568
|
+
"#008300",
|
|
27569
|
+
"#9085e9"
|
|
27570
|
+
];
|
|
27571
|
+
var CATEGORICAL_CEILING = CATEGORICAL_LIGHT.length;
|
|
27572
|
+
var OTHER_COLOR = "#898781";
|
|
27573
|
+
var SEQUENTIAL_RAMP_LIGHT = ["#104281", "#1c5cab", "#2a78d6", "#5598e7", "#86b6ef"];
|
|
27574
|
+
var SEQUENTIAL_RAMP = SEQUENTIAL_RAMP_LIGHT;
|
|
27575
|
+
var categoricalSet = /* @__PURE__ */ __name((mode) => mode === "dark" ? CATEGORICAL_DARK : CATEGORICAL_LIGHT, "categoricalSet");
|
|
27576
|
+
function seriesColor(index, mode = "light") {
|
|
27577
|
+
if (index < 0 || index >= CATEGORICAL_CEILING) return OTHER_COLOR;
|
|
27578
|
+
return categoricalSet(mode)[index];
|
|
27579
|
+
}
|
|
27580
|
+
__name(seriesColor, "seriesColor");
|
|
27581
|
+
function seriesTheme(index) {
|
|
27582
|
+
return { light: seriesColor(index, "light"), dark: seriesColor(index, "dark") };
|
|
27583
|
+
}
|
|
27584
|
+
__name(seriesTheme, "seriesTheme");
|
|
27585
|
+
|
|
27586
|
+
// src/features/referral/components/ReferralsAdminFunnel.tsx
|
|
27587
|
+
import { jsx as jsx307, jsxs as jsxs184 } from "react/jsx-runtime";
|
|
27588
|
+
function ReferralsAdminFunnel({ summary }) {
|
|
27589
|
+
const t = useTranslations168();
|
|
27590
|
+
const { decimal } = useUsageFormatters();
|
|
27591
|
+
const current = summary.find((row) => row.window === "current");
|
|
27592
|
+
const steps = [
|
|
27593
|
+
{ label: t("referral.admin.tiles.visits"), value: current?.visits ?? 0 },
|
|
27594
|
+
{ label: t("referral.admin.tiles.invites"), value: current?.invitesSent ?? 0 },
|
|
27595
|
+
{ label: t("referral.admin.tiles.signups"), value: current?.signups ?? 0 },
|
|
27596
|
+
{ label: t("referral.admin.tiles.paying"), value: current?.paying ?? 0 }
|
|
27597
|
+
];
|
|
27598
|
+
const max = Math.max(...steps.map((step) => step.value), 0);
|
|
27599
|
+
return /* @__PURE__ */ jsxs184("section", { "data-testid": "referrals-funnel", className: "grid gap-2", children: [
|
|
27600
|
+
/* @__PURE__ */ jsx307("h2", { className: "text-muted-foreground flex items-center gap-x-2 text-sm font-light whitespace-nowrap", children: t("referral.admin.funnel.title") }),
|
|
27601
|
+
/* @__PURE__ */ jsx307("div", { className: "grid gap-0.5", children: steps.map((step, index) => {
|
|
27602
|
+
const width = max > 0 ? step.value / max * 100 : 0;
|
|
27603
|
+
const before = index > 0 ? steps[index - 1].value : void 0;
|
|
27604
|
+
const share = before === void 0 ? "" : before ? `${decimal(Math.round(step.value / before * 100), 0)}%` : "\u2014";
|
|
27605
|
+
return /* @__PURE__ */ jsxs184(
|
|
27606
|
+
"div",
|
|
27607
|
+
{
|
|
27608
|
+
className: "grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-3 gap-y-0.5 py-0.5",
|
|
27609
|
+
children: [
|
|
27610
|
+
/* @__PURE__ */ jsxs184("div", { className: "grid min-w-0 gap-0.5", children: [
|
|
27611
|
+
/* @__PURE__ */ jsx307("span", { className: "text-muted-foreground truncate text-xs", children: step.label }),
|
|
27612
|
+
/* @__PURE__ */ jsx307("div", { className: "bg-muted h-2 w-full overflow-hidden rounded-r-[4px]", dir: "ltr", children: /* @__PURE__ */ jsx307(
|
|
27613
|
+
"div",
|
|
27614
|
+
{
|
|
27615
|
+
className: "h-full rounded-r-[4px]",
|
|
27616
|
+
style: {
|
|
27617
|
+
width: `${width}%`,
|
|
27618
|
+
backgroundColor: SEQUENTIAL_RAMP[Math.min(index, SEQUENTIAL_RAMP.length - 1)]
|
|
27619
|
+
}
|
|
27620
|
+
}
|
|
27621
|
+
) })
|
|
27622
|
+
] }),
|
|
27623
|
+
/* @__PURE__ */ jsx307("span", { className: "text-end text-xs tabular-nums", children: decimal(step.value, 0) }),
|
|
27624
|
+
/* @__PURE__ */ jsx307("span", { className: "text-muted-foreground w-16 text-end text-xs tabular-nums", children: share })
|
|
27625
|
+
]
|
|
27626
|
+
},
|
|
27627
|
+
step.label
|
|
27628
|
+
);
|
|
27629
|
+
}) })
|
|
27630
|
+
] });
|
|
27631
|
+
}
|
|
27632
|
+
__name(ReferralsAdminFunnel, "ReferralsAdminFunnel");
|
|
27633
|
+
|
|
27634
|
+
// src/features/referral/components/ReferralsAdminTiles.tsx
|
|
27635
|
+
import { useTranslations as useTranslations169 } from "next-intl";
|
|
27636
|
+
|
|
27637
|
+
// src/features/tokenusage/lib/metrics.ts
|
|
27638
|
+
function metricValue(row, metric) {
|
|
27639
|
+
if (metric === "cost") return row.cost;
|
|
27640
|
+
if (metric === "credits") return row.credits;
|
|
27641
|
+
return row.tokensIn + row.tokensOut;
|
|
27642
|
+
}
|
|
27643
|
+
__name(metricValue, "metricValue");
|
|
27644
|
+
function cacheHitPercentage(cached, tokensIn) {
|
|
27645
|
+
if (!tokensIn) return 0;
|
|
27646
|
+
return cached / tokensIn * 100;
|
|
27647
|
+
}
|
|
27648
|
+
__name(cacheHitPercentage, "cacheHitPercentage");
|
|
27649
|
+
function percentageDelta(current, previous) {
|
|
27650
|
+
if (!previous) return void 0;
|
|
27651
|
+
return Math.round((current - previous) / previous * 100);
|
|
27652
|
+
}
|
|
27653
|
+
__name(percentageDelta, "percentageDelta");
|
|
27654
|
+
|
|
27655
|
+
// src/features/referral/components/ReferralsAdminTiles.tsx
|
|
27656
|
+
import { jsx as jsx308, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
27657
|
+
var ZERO = {
|
|
27658
|
+
visits: 0,
|
|
27659
|
+
invitesSent: 0,
|
|
27660
|
+
signups: 0,
|
|
27661
|
+
paying: 0,
|
|
27662
|
+
creditsGiven: 0,
|
|
27663
|
+
sharingCompanies: 0,
|
|
27664
|
+
eligibleCompanies: 0
|
|
27665
|
+
};
|
|
27666
|
+
function ReferralsAdminTiles({ summary }) {
|
|
27667
|
+
const t = useTranslations169();
|
|
27668
|
+
const { decimal } = useUsageFormatters();
|
|
27669
|
+
const current = summary.find((row) => row.window === "current") ?? ZERO;
|
|
27670
|
+
const previous = summary.find((row) => row.window === "previous");
|
|
27671
|
+
const change = /* @__PURE__ */ __name((metric) => {
|
|
27672
|
+
if (!previous) return void 0;
|
|
27673
|
+
const delta = percentageDelta(current[metric], previous[metric]);
|
|
27674
|
+
const formatted = delta === void 0 ? "\u2014" : `${delta > 0 ? "+" : ""}${decimal(delta, 0)}%`;
|
|
27675
|
+
return t("referral.admin.tiles.change", { delta: formatted });
|
|
27676
|
+
}, "change");
|
|
27677
|
+
return /* @__PURE__ */ jsxs185("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,4fr)]", children: [
|
|
27678
|
+
/* @__PURE__ */ jsx308(
|
|
27679
|
+
LeadTile,
|
|
27680
|
+
{
|
|
27681
|
+
id: "sharing",
|
|
27682
|
+
label: t("referral.admin.tiles.sharing"),
|
|
27683
|
+
value: decimal(current.sharingCompanies, 0),
|
|
27684
|
+
detail: t("referral.admin.tiles.sharingOf", {
|
|
27685
|
+
count: decimal(current.sharingCompanies, 0),
|
|
27686
|
+
total: decimal(current.eligibleCompanies, 0)
|
|
27687
|
+
})
|
|
27688
|
+
}
|
|
27689
|
+
),
|
|
27690
|
+
/* @__PURE__ */ jsxs185("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5", children: [
|
|
27691
|
+
/* @__PURE__ */ jsx308(
|
|
27692
|
+
SupportingTile,
|
|
27693
|
+
{
|
|
27694
|
+
id: "visits",
|
|
27695
|
+
label: t("referral.admin.tiles.visits"),
|
|
27696
|
+
value: decimal(current.visits, 0),
|
|
27697
|
+
change: change("visits")
|
|
27698
|
+
}
|
|
27699
|
+
),
|
|
27700
|
+
/* @__PURE__ */ jsx308(
|
|
27701
|
+
SupportingTile,
|
|
27702
|
+
{
|
|
27703
|
+
id: "invites",
|
|
27704
|
+
label: t("referral.admin.tiles.invites"),
|
|
27705
|
+
value: decimal(current.invitesSent, 0),
|
|
27706
|
+
change: change("invitesSent")
|
|
27707
|
+
}
|
|
27708
|
+
),
|
|
27709
|
+
/* @__PURE__ */ jsx308(
|
|
27710
|
+
SupportingTile,
|
|
27711
|
+
{
|
|
27712
|
+
id: "signups",
|
|
27713
|
+
label: t("referral.admin.tiles.signups"),
|
|
27714
|
+
value: decimal(current.signups, 0),
|
|
27715
|
+
change: change("signups")
|
|
27716
|
+
}
|
|
27717
|
+
),
|
|
27718
|
+
/* @__PURE__ */ jsx308(
|
|
27719
|
+
SupportingTile,
|
|
27720
|
+
{
|
|
27721
|
+
id: "paying",
|
|
27722
|
+
label: t("referral.admin.tiles.paying"),
|
|
27723
|
+
value: decimal(current.paying, 0),
|
|
27724
|
+
change: change("paying")
|
|
27725
|
+
}
|
|
27726
|
+
),
|
|
27727
|
+
/* @__PURE__ */ jsx308(
|
|
27728
|
+
SupportingTile,
|
|
27729
|
+
{
|
|
27730
|
+
id: "credits",
|
|
27731
|
+
label: t("referral.admin.tiles.credits"),
|
|
27732
|
+
value: decimal(current.creditsGiven, 0),
|
|
27733
|
+
change: change("creditsGiven")
|
|
27734
|
+
}
|
|
27735
|
+
)
|
|
27736
|
+
] })
|
|
27737
|
+
] });
|
|
27738
|
+
}
|
|
27739
|
+
__name(ReferralsAdminTiles, "ReferralsAdminTiles");
|
|
27740
|
+
function LeadTile({ id, label, value, detail }) {
|
|
27741
|
+
return /* @__PURE__ */ jsx308(Card, { "data-testid": `referrals-tile-${id}`, children: /* @__PURE__ */ jsxs185(CardContent, { className: "grid gap-1", children: [
|
|
27742
|
+
/* @__PURE__ */ jsx308(MicroLabel, { children: label }),
|
|
27743
|
+
/* @__PURE__ */ jsx308("span", { "data-testid": `referrals-tile-${id}-value`, className: "text-primary text-xl font-semibold tabular-nums", children: value }),
|
|
27744
|
+
/* @__PURE__ */ jsx308("span", { className: "text-muted-foreground text-xs", children: detail })
|
|
27745
|
+
] }) });
|
|
27746
|
+
}
|
|
27747
|
+
__name(LeadTile, "LeadTile");
|
|
27748
|
+
function SupportingTile({ id, label, value, change }) {
|
|
27749
|
+
return /* @__PURE__ */ jsx308(Card, { "data-testid": `referrals-tile-${id}`, size: "sm", children: /* @__PURE__ */ jsxs185(CardContent, { className: "grid gap-1", children: [
|
|
27750
|
+
/* @__PURE__ */ jsx308(MicroLabel, { children: label }),
|
|
27751
|
+
/* @__PURE__ */ jsxs185("span", { className: "flex items-center gap-2", children: [
|
|
27752
|
+
/* @__PURE__ */ jsx308("span", { "data-testid": `referrals-tile-${id}-value`, className: "text-sm font-medium tabular-nums", children: value }),
|
|
27753
|
+
change && /* @__PURE__ */ jsx308("span", { "data-testid": `referrals-tile-${id}-change`, className: "text-muted-foreground text-xs", children: change })
|
|
27754
|
+
] })
|
|
27755
|
+
] }) });
|
|
27756
|
+
}
|
|
27757
|
+
__name(SupportingTile, "SupportingTile");
|
|
27758
|
+
|
|
27759
|
+
// src/features/referral/components/containers/ReferralsAdminContainer.tsx
|
|
27760
|
+
import { jsx as jsx309, jsxs as jsxs186 } from "react/jsx-runtime";
|
|
27761
|
+
var PERIODS = ["30d", "90d", "all"];
|
|
27762
|
+
var REFERRER_FIELDS = [
|
|
27763
|
+
"rank" /* rank */,
|
|
27764
|
+
"referrer" /* referrer */,
|
|
27765
|
+
"visits" /* visits */,
|
|
27766
|
+
"invites" /* invites */,
|
|
27767
|
+
"signups" /* signups */,
|
|
27768
|
+
"paying" /* paying */,
|
|
27769
|
+
"conversion" /* conversion */,
|
|
27770
|
+
"credits" /* credits */,
|
|
27771
|
+
"lastInvite" /* lastInvite */
|
|
27772
|
+
];
|
|
27773
|
+
var REFERRAL_FIELDS = [
|
|
27774
|
+
"account" /* account */,
|
|
27775
|
+
"referrer" /* referrer */,
|
|
27776
|
+
"source" /* source */,
|
|
27777
|
+
"date" /* date */,
|
|
27778
|
+
"status" /* status */,
|
|
27779
|
+
"credits" /* credits */
|
|
27780
|
+
];
|
|
27781
|
+
function useRefetchOnChange(retriever, key, value) {
|
|
27782
|
+
const previous = useRef48(value);
|
|
27783
|
+
useEffect88(() => {
|
|
27784
|
+
if (previous.current === value) return;
|
|
27785
|
+
previous.current = value;
|
|
27786
|
+
retriever.addAdditionalParameter(key, value);
|
|
27787
|
+
}, [retriever, key, value]);
|
|
27788
|
+
}
|
|
27789
|
+
__name(useRefetchOnChange, "useRefetchOnChange");
|
|
27790
|
+
function ReferralsAdminContainer() {
|
|
27791
|
+
const t = useTranslations170();
|
|
27792
|
+
const [period, setPeriod] = useState121("30d");
|
|
27793
|
+
const [sort, setSort] = useState121("paying");
|
|
27794
|
+
const [summary, setSummary] = useState121([]);
|
|
27795
|
+
useEffect88(() => {
|
|
27796
|
+
let cancelled = false;
|
|
27797
|
+
ReferralAdminService.getSummary({ period }).then((rows) => {
|
|
27798
|
+
if (!cancelled) setSummary(rows ?? []);
|
|
27799
|
+
}).catch(() => {
|
|
27800
|
+
if (!cancelled) setSummary([]);
|
|
27801
|
+
});
|
|
27802
|
+
return () => {
|
|
27803
|
+
cancelled = true;
|
|
27804
|
+
};
|
|
27805
|
+
}, [period]);
|
|
27806
|
+
const referrers = useDataListRetriever({
|
|
27807
|
+
module: Modules.ReferralAdminReferrer,
|
|
27808
|
+
retriever: /* @__PURE__ */ __name((params) => ReferralAdminService.getReferrers({ period: params.period, sort: params.sort }), "retriever"),
|
|
27809
|
+
retrieverParams: { period, sort }
|
|
27810
|
+
});
|
|
27811
|
+
const referrals = useDataListRetriever({
|
|
27812
|
+
module: Modules.ReferralAdminReferral,
|
|
27813
|
+
retriever: /* @__PURE__ */ __name((params) => ReferralAdminService.getReferrals({ period: params.period }), "retriever"),
|
|
27814
|
+
retrieverParams: { period }
|
|
27815
|
+
});
|
|
27816
|
+
useRefetchOnChange(referrers, "period", period);
|
|
27817
|
+
useRefetchOnChange(referrers, "sort", sort);
|
|
27818
|
+
useRefetchOnChange(referrals, "period", period);
|
|
27819
|
+
const referrerContext = useMemo67(() => ({ sort, onSort: setSort }), [sort]);
|
|
27820
|
+
const periodLabels = {
|
|
27821
|
+
"30d": t("referral.admin.period.30d"),
|
|
27822
|
+
"90d": t("referral.admin.period.90d"),
|
|
27823
|
+
all: t("referral.admin.period.all")
|
|
27824
|
+
};
|
|
27825
|
+
const periodButtons = /* @__PURE__ */ jsx309(
|
|
27826
|
+
"div",
|
|
27827
|
+
{
|
|
27828
|
+
role: "group",
|
|
27829
|
+
className: "border-border inline-flex items-center gap-0.5 rounded-md border p-0.5",
|
|
27830
|
+
children: PERIODS.map((value) => {
|
|
27831
|
+
const selected = value === period;
|
|
27832
|
+
return /* @__PURE__ */ jsx309(
|
|
27833
|
+
Button,
|
|
27834
|
+
{
|
|
27835
|
+
type: "button",
|
|
27836
|
+
size: "sm",
|
|
27837
|
+
variant: selected ? "default" : "ghost",
|
|
27838
|
+
"aria-pressed": selected,
|
|
27839
|
+
"data-testid": `referrals-period-${value}`,
|
|
27840
|
+
onClick: () => setPeriod(value),
|
|
27841
|
+
children: periodLabels[value]
|
|
27842
|
+
},
|
|
27843
|
+
value
|
|
27844
|
+
);
|
|
27845
|
+
})
|
|
27846
|
+
},
|
|
27847
|
+
"referralsAdminPeriod"
|
|
27848
|
+
);
|
|
27849
|
+
const shownEmails = (referrers.data ?? []).map((entry) => entry.email).filter((email) => !!email);
|
|
27850
|
+
const copyAll = /* @__PURE__ */ jsxs186(
|
|
27851
|
+
Button,
|
|
27852
|
+
{
|
|
27853
|
+
type: "button",
|
|
27854
|
+
variant: "outline",
|
|
27855
|
+
size: "sm",
|
|
27856
|
+
"data-testid": "referrals-copy-all-emails",
|
|
27857
|
+
disabled: shownEmails.length === 0,
|
|
27858
|
+
onClick: () => copyReferrerEmails(shownEmails.join(", "), t),
|
|
27859
|
+
children: [
|
|
27860
|
+
/* @__PURE__ */ jsx309(CopyIcon3, {}),
|
|
27861
|
+
t("referral.admin.referrers.copyAll")
|
|
27862
|
+
]
|
|
27863
|
+
}
|
|
27864
|
+
);
|
|
27865
|
+
const breadcrumbs = [{ name: t("referral.admin.title") }];
|
|
27866
|
+
return /* @__PURE__ */ jsx309(SharedProvider, { value: { breadcrumbs, title: { type: t("referral.admin.title"), functions: periodButtons } }, children: /* @__PURE__ */ jsx309(RoundPageContainer, { module: Modules.ReferralAdminSummary, fullWidth: true, forceHeader: true, testId: "page-admin-referrals", children: /* @__PURE__ */ jsxs186("div", { className: "flex w-full flex-col gap-6 p-4", children: [
|
|
27867
|
+
/* @__PURE__ */ jsx309("p", { className: "text-muted-foreground text-xs", children: t("referral.admin.description") }),
|
|
27868
|
+
/* @__PURE__ */ jsx309(ReferralsAdminTiles, { summary }),
|
|
27869
|
+
/* @__PURE__ */ jsx309(ReferralsAdminFunnel, { summary }),
|
|
27870
|
+
/* @__PURE__ */ jsx309("section", { "data-testid": "referrals-referrers", children: /* @__PURE__ */ jsx309(
|
|
27871
|
+
ContentListTable,
|
|
27872
|
+
{
|
|
27873
|
+
data: referrers,
|
|
27874
|
+
fields: REFERRER_FIELDS,
|
|
27875
|
+
tableGeneratorType: Modules.ReferralAdminReferrer,
|
|
27876
|
+
context: referrerContext,
|
|
27877
|
+
title: t("referral.admin.referrers.title"),
|
|
27878
|
+
titleActions: copyAll,
|
|
27879
|
+
hidePagination: true,
|
|
27880
|
+
allowSearch: false,
|
|
27881
|
+
emptyState: t("referral.admin.referrers.empty")
|
|
27882
|
+
}
|
|
27883
|
+
) }),
|
|
27884
|
+
/* @__PURE__ */ jsx309("section", { "data-testid": "referrals-referrals", children: /* @__PURE__ */ jsx309(
|
|
27885
|
+
ContentListTable,
|
|
27886
|
+
{
|
|
27887
|
+
data: referrals,
|
|
27888
|
+
fields: REFERRAL_FIELDS,
|
|
27889
|
+
tableGeneratorType: Modules.ReferralAdminReferral,
|
|
27890
|
+
title: t("referral.admin.referrals.title"),
|
|
27891
|
+
hidePagination: true,
|
|
27892
|
+
allowSearch: false,
|
|
27893
|
+
emptyState: t("referral.admin.referrals.empty")
|
|
27894
|
+
}
|
|
27895
|
+
) })
|
|
27896
|
+
] }) }) });
|
|
27897
|
+
}
|
|
27898
|
+
__name(ReferralsAdminContainer, "ReferralsAdminContainer");
|
|
27899
|
+
|
|
27235
27900
|
// src/features/signup-source/SignupSourceCapture.tsx
|
|
27236
27901
|
import { usePathname as usePathname4, useSearchParams as useSearchParams7 } from "next/navigation";
|
|
27237
|
-
import { useEffect as
|
|
27902
|
+
import { useEffect as useEffect89 } from "react";
|
|
27238
27903
|
function SignupSourceCapture({ persist }) {
|
|
27239
27904
|
const searchParams = useSearchParams7();
|
|
27240
27905
|
const pathname = usePathname4();
|
|
27241
|
-
|
|
27906
|
+
useEffect89(() => {
|
|
27242
27907
|
captureSignupSource({ persist });
|
|
27243
27908
|
}, [pathname, searchParams, persist]);
|
|
27244
27909
|
return null;
|
|
@@ -27246,38 +27911,38 @@ function SignupSourceCapture({ persist }) {
|
|
|
27246
27911
|
__name(SignupSourceCapture, "SignupSourceCapture");
|
|
27247
27912
|
|
|
27248
27913
|
// src/features/role/components/details/RoleDetails.tsx
|
|
27249
|
-
import { useTranslations as
|
|
27250
|
-
import { jsx as
|
|
27914
|
+
import { useTranslations as useTranslations171 } from "next-intl";
|
|
27915
|
+
import { jsx as jsx310 } from "react/jsx-runtime";
|
|
27251
27916
|
function RoleDetails() {
|
|
27252
27917
|
const { role } = useRoleContext();
|
|
27253
|
-
const t =
|
|
27918
|
+
const t = useTranslations171();
|
|
27254
27919
|
if (!role) return null;
|
|
27255
|
-
return /* @__PURE__ */
|
|
27920
|
+
return /* @__PURE__ */ jsx310(Card, { className: "w-full", children: /* @__PURE__ */ jsx310(CardContent, { className: "p-4", children: /* @__PURE__ */ jsx310(AttributeElement, { title: t(`role.fields.description.label`), value: role.description }) }) });
|
|
27256
27921
|
}
|
|
27257
27922
|
__name(RoleDetails, "RoleDetails");
|
|
27258
27923
|
|
|
27259
27924
|
// src/features/role/components/containers/RoleContainer.tsx
|
|
27260
|
-
import { Fragment as Fragment63, jsx as
|
|
27925
|
+
import { Fragment as Fragment63, jsx as jsx311, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
27261
27926
|
function RoleContainer() {
|
|
27262
27927
|
const { role } = useRoleContext();
|
|
27263
27928
|
if (!role) return null;
|
|
27264
|
-
return /* @__PURE__ */
|
|
27265
|
-
/* @__PURE__ */
|
|
27266
|
-
/* @__PURE__ */
|
|
27929
|
+
return /* @__PURE__ */ jsxs187(Fragment63, { children: [
|
|
27930
|
+
/* @__PURE__ */ jsx311(RoleDetails, {}),
|
|
27931
|
+
/* @__PURE__ */ jsx311(RoleUsersList, { role })
|
|
27267
27932
|
] });
|
|
27268
27933
|
}
|
|
27269
27934
|
__name(RoleContainer, "RoleContainer");
|
|
27270
27935
|
|
|
27271
27936
|
// src/features/role/components/forms/FormRoles.tsx
|
|
27272
|
-
import { useTranslations as
|
|
27273
|
-
import { jsx as
|
|
27937
|
+
import { useTranslations as useTranslations172 } from "next-intl";
|
|
27938
|
+
import { jsx as jsx312, jsxs as jsxs188 } from "react/jsx-runtime";
|
|
27274
27939
|
function FormRoles({ form, id, name, roles }) {
|
|
27275
|
-
const t =
|
|
27940
|
+
const t = useTranslations172();
|
|
27276
27941
|
const { hasAccesToFeature } = useCurrentUserContext();
|
|
27277
|
-
return /* @__PURE__ */
|
|
27942
|
+
return /* @__PURE__ */ jsx312("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx312(FormFieldWrapper, { form, name: id, label: name, children: (field) => /* @__PURE__ */ jsx312("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) => {
|
|
27278
27943
|
if (role.requiredFeature && !hasAccesToFeature(role.requiredFeature.id)) return null;
|
|
27279
|
-
return /* @__PURE__ */
|
|
27280
|
-
/* @__PURE__ */
|
|
27944
|
+
return /* @__PURE__ */ jsxs188("div", { className: "flex w-full items-center", children: [
|
|
27945
|
+
/* @__PURE__ */ jsx312(
|
|
27281
27946
|
Checkbox,
|
|
27282
27947
|
{
|
|
27283
27948
|
id: `role-${role.id}`,
|
|
@@ -27294,9 +27959,9 @@ function FormRoles({ form, id, name, roles }) {
|
|
|
27294
27959
|
}
|
|
27295
27960
|
}
|
|
27296
27961
|
),
|
|
27297
|
-
/* @__PURE__ */
|
|
27298
|
-
/* @__PURE__ */
|
|
27299
|
-
/* @__PURE__ */
|
|
27962
|
+
/* @__PURE__ */ jsxs188(Tooltip2, { children: [
|
|
27963
|
+
/* @__PURE__ */ jsx312(TooltipTrigger, { children: /* @__PURE__ */ jsx312(FieldLabel, { htmlFor: `role-${role.id}`, className: "ms-3 cursor-pointer font-normal", children: t(`role.roles`, { role: role.id.replaceAll(`-`, ``) }) }) }),
|
|
27964
|
+
/* @__PURE__ */ jsx312(TooltipContent, { children: t(`role.roles_descriptions`, { role: role.id.replaceAll(`-`, ``) }) })
|
|
27300
27965
|
] })
|
|
27301
27966
|
] }, role.id);
|
|
27302
27967
|
}) }) }) });
|
|
@@ -27304,14 +27969,14 @@ function FormRoles({ form, id, name, roles }) {
|
|
|
27304
27969
|
__name(FormRoles, "FormRoles");
|
|
27305
27970
|
|
|
27306
27971
|
// src/features/role/components/forms/RemoveUserFromRole.tsx
|
|
27307
|
-
import { useTranslations as
|
|
27308
|
-
import { useEffect as
|
|
27309
|
-
import { Fragment as Fragment64, jsx as
|
|
27972
|
+
import { useTranslations as useTranslations173 } from "next-intl";
|
|
27973
|
+
import { useEffect as useEffect90, useState as useState122 } from "react";
|
|
27974
|
+
import { Fragment as Fragment64, jsx as jsx313, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
27310
27975
|
function RemoveUserFromRole({ role, user, refresh }) {
|
|
27311
|
-
const [open, setOpen] =
|
|
27312
|
-
const [canRemove, setCanRemove] =
|
|
27313
|
-
const t =
|
|
27314
|
-
|
|
27976
|
+
const [open, setOpen] = useState122(false);
|
|
27977
|
+
const [canRemove, setCanRemove] = useState122(false);
|
|
27978
|
+
const t = useTranslations173();
|
|
27979
|
+
useEffect90(() => {
|
|
27315
27980
|
async function checkCompanyAdminDeletability() {
|
|
27316
27981
|
const roleUsers = await UserService.findAllUsersByRole({
|
|
27317
27982
|
roleId: role.id
|
|
@@ -27338,8 +28003,8 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
27338
28003
|
}
|
|
27339
28004
|
}, "remove");
|
|
27340
28005
|
const roleName = t(`role.roles`, { role: role.id.replaceAll(`-`, ``) });
|
|
27341
|
-
return /* @__PURE__ */
|
|
27342
|
-
/* @__PURE__ */
|
|
28006
|
+
return /* @__PURE__ */ jsxs189(Dialog, { open, onOpenChange: setOpen, children: [
|
|
28007
|
+
/* @__PURE__ */ jsx313(
|
|
27343
28008
|
DialogTrigger,
|
|
27344
28009
|
{
|
|
27345
28010
|
onClick: (e) => {
|
|
@@ -27347,19 +28012,19 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
27347
28012
|
e.preventDefault();
|
|
27348
28013
|
setOpen(true);
|
|
27349
28014
|
},
|
|
27350
|
-
children: /* @__PURE__ */
|
|
28015
|
+
children: /* @__PURE__ */ jsx313("span", { className: "hover:text-destructive cursor-pointer", children: t(`role.remove_user.title`) })
|
|
27351
28016
|
}
|
|
27352
28017
|
),
|
|
27353
|
-
/* @__PURE__ */
|
|
27354
|
-
/* @__PURE__ */
|
|
27355
|
-
/* @__PURE__ */
|
|
27356
|
-
/* @__PURE__ */
|
|
28018
|
+
/* @__PURE__ */ jsxs189(DialogContent, { className: `flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`, children: [
|
|
28019
|
+
/* @__PURE__ */ jsxs189(DialogHeader, { children: [
|
|
28020
|
+
/* @__PURE__ */ jsx313(DialogTitle, { children: t(`role.remove_user.title`) }),
|
|
28021
|
+
/* @__PURE__ */ jsx313(DialogDescription, { children: canRemove ? t(`role.remove_user.subtitle_allowed`) : t(`role.remove_user.subtitle_not_allowed`) })
|
|
27357
28022
|
] }),
|
|
27358
|
-
canRemove ? /* @__PURE__ */
|
|
28023
|
+
canRemove ? /* @__PURE__ */ jsxs189(Fragment64, { children: [
|
|
27359
28024
|
t(`role.remove_user.description_allowed`, { role: roleName, user: user.name }),
|
|
27360
|
-
/* @__PURE__ */
|
|
27361
|
-
/* @__PURE__ */
|
|
27362
|
-
/* @__PURE__ */
|
|
28025
|
+
/* @__PURE__ */ jsxs189("div", { className: "flex justify-end", children: [
|
|
28026
|
+
/* @__PURE__ */ jsx313(Button, { className: "me-2", variant: "outline", type: `button`, onClick: () => setOpen(false), children: t(`ui.buttons.cancel`) }),
|
|
28027
|
+
/* @__PURE__ */ jsx313(
|
|
27363
28028
|
Button,
|
|
27364
28029
|
{
|
|
27365
28030
|
type: "submit",
|
|
@@ -27372,7 +28037,7 @@ function RemoveUserFromRole({ role, user, refresh }) {
|
|
|
27372
28037
|
}
|
|
27373
28038
|
)
|
|
27374
28039
|
] })
|
|
27375
|
-
] }) : /* @__PURE__ */
|
|
28040
|
+
] }) : /* @__PURE__ */ jsx313(Fragment64, { children: t(`role.remove_user.description_not_allowed`, { role: roleName, user: user.name }) })
|
|
27376
28041
|
] })
|
|
27377
28042
|
] });
|
|
27378
28043
|
}
|
|
@@ -27380,15 +28045,15 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
|
|
|
27380
28045
|
|
|
27381
28046
|
// src/features/role/components/forms/UserRoleAdd.tsx
|
|
27382
28047
|
import { PlusCircle as PlusCircle2 } from "lucide-react";
|
|
27383
|
-
import { useTranslations as
|
|
27384
|
-
import { useCallback as useCallback56, useEffect as
|
|
27385
|
-
import { Fragment as Fragment65, jsx as
|
|
28048
|
+
import { useTranslations as useTranslations174 } from "next-intl";
|
|
28049
|
+
import { useCallback as useCallback56, useEffect as useEffect91, useRef as useRef49, useState as useState123 } from "react";
|
|
28050
|
+
import { Fragment as Fragment65, jsx as jsx314, jsxs as jsxs190 } from "react/jsx-runtime";
|
|
27386
28051
|
function UserRoleAdd({ user, refresh }) {
|
|
27387
|
-
const [open, setOpen] =
|
|
27388
|
-
const inputRef =
|
|
27389
|
-
const [searchTerm, setSearchTerm] =
|
|
27390
|
-
const [roles, setRoles] =
|
|
27391
|
-
const t =
|
|
28052
|
+
const [open, setOpen] = useState123(false);
|
|
28053
|
+
const inputRef = useRef49(null);
|
|
28054
|
+
const [searchTerm, setSearchTerm] = useState123("");
|
|
28055
|
+
const [roles, setRoles] = useState123([]);
|
|
28056
|
+
const t = useTranslations174();
|
|
27392
28057
|
const addUserToRole = /* @__PURE__ */ __name(async (role) => {
|
|
27393
28058
|
await RoleService.addUserToRole({
|
|
27394
28059
|
roleId: role.id,
|
|
@@ -27423,32 +28088,32 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
27423
28088
|
[searchTerm, user]
|
|
27424
28089
|
);
|
|
27425
28090
|
const updateSearchTerm = useDebounce2(searchRoles, 500);
|
|
27426
|
-
|
|
28091
|
+
useEffect91(() => {
|
|
27427
28092
|
if (open) updateSearchTerm(searchTerm);
|
|
27428
28093
|
}, [open, searchTerm]);
|
|
27429
|
-
|
|
28094
|
+
useEffect91(() => {
|
|
27430
28095
|
if (open) searchRoles("");
|
|
27431
28096
|
}, [open]);
|
|
27432
|
-
return /* @__PURE__ */
|
|
27433
|
-
/* @__PURE__ */
|
|
27434
|
-
/* @__PURE__ */
|
|
28097
|
+
return /* @__PURE__ */ jsxs190(Fragment65, { children: [
|
|
28098
|
+
/* @__PURE__ */ jsxs190(Button, { size: "sm", onClick: () => setOpen(true), children: [
|
|
28099
|
+
/* @__PURE__ */ jsx314(PlusCircle2, { className: "me-3 h-3.5 w-3.5" }),
|
|
27435
28100
|
t(`common.association.label`, {
|
|
27436
28101
|
source: t(`entities.roles`, { count: 1 }),
|
|
27437
28102
|
destination: t(`entities.users`, { count: 1 })
|
|
27438
28103
|
})
|
|
27439
28104
|
] }),
|
|
27440
|
-
/* @__PURE__ */
|
|
27441
|
-
/* @__PURE__ */
|
|
28105
|
+
/* @__PURE__ */ jsxs190(CommandDialog, { open, onOpenChange: setOpen, children: [
|
|
28106
|
+
/* @__PURE__ */ jsx314(DialogTitle, { children: t(`common.association.label`, {
|
|
27442
28107
|
source: t(`entities.roles`, { count: 1 }),
|
|
27443
28108
|
destination: t(`entities.users`, { count: 1 })
|
|
27444
28109
|
}) }),
|
|
27445
|
-
/* @__PURE__ */
|
|
28110
|
+
/* @__PURE__ */ jsx314(DialogDescription, { children: t(`common.association.description`, {
|
|
27446
28111
|
source: t(`entities.roles`, { count: 1 }),
|
|
27447
28112
|
destination: t(`entities.users`, { count: 1 }),
|
|
27448
28113
|
destination_name: user.name
|
|
27449
28114
|
}) }),
|
|
27450
|
-
/* @__PURE__ */
|
|
27451
|
-
/* @__PURE__ */
|
|
28115
|
+
/* @__PURE__ */ jsxs190(Command, { shouldFilter: false, children: [
|
|
28116
|
+
/* @__PURE__ */ jsx314(
|
|
27452
28117
|
CommandInput,
|
|
27453
28118
|
{
|
|
27454
28119
|
placeholder: t(`ui.search.placeholder`, { type: t(`entities.roles`, { count: 1 }) }),
|
|
@@ -27457,9 +28122,9 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
27457
28122
|
ref: inputRef
|
|
27458
28123
|
}
|
|
27459
28124
|
),
|
|
27460
|
-
/* @__PURE__ */
|
|
27461
|
-
/* @__PURE__ */
|
|
27462
|
-
roles.map((role) => /* @__PURE__ */
|
|
28125
|
+
/* @__PURE__ */ jsxs190(CommandList, { className: "mt-3 h-auto max-h-96 min-h-96 max-w-full overflow-x-hidden overflow-y-auto", children: [
|
|
28126
|
+
/* @__PURE__ */ jsx314(CommandEmpty, { children: t(`ui.search.no_results`, { type: t(`entities.roles`, { count: 1 }) }) }),
|
|
28127
|
+
roles.map((role) => /* @__PURE__ */ jsx314(
|
|
27463
28128
|
CommandItem,
|
|
27464
28129
|
{
|
|
27465
28130
|
className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
|
|
@@ -27478,16 +28143,16 @@ function UserRoleAdd({ user, refresh }) {
|
|
|
27478
28143
|
__name(UserRoleAdd, "UserRoleAdd");
|
|
27479
28144
|
|
|
27480
28145
|
// src/features/role/components/lists/RolesList.tsx
|
|
27481
|
-
import { useTranslations as
|
|
27482
|
-
import { jsx as
|
|
28146
|
+
import { useTranslations as useTranslations175 } from "next-intl";
|
|
28147
|
+
import { jsx as jsx315 } from "react/jsx-runtime";
|
|
27483
28148
|
function RolesList() {
|
|
27484
|
-
const t =
|
|
28149
|
+
const t = useTranslations175();
|
|
27485
28150
|
const data = useDataListRetriever({
|
|
27486
28151
|
retriever: /* @__PURE__ */ __name((params) => RoleService.findAllRoles(params), "retriever"),
|
|
27487
28152
|
retrieverParams: {},
|
|
27488
28153
|
module: Modules.Role
|
|
27489
28154
|
});
|
|
27490
|
-
return /* @__PURE__ */
|
|
28155
|
+
return /* @__PURE__ */ jsx315(
|
|
27491
28156
|
ContentListTable,
|
|
27492
28157
|
{
|
|
27493
28158
|
data,
|
|
@@ -27500,16 +28165,16 @@ function RolesList() {
|
|
|
27500
28165
|
__name(RolesList, "RolesList");
|
|
27501
28166
|
|
|
27502
28167
|
// src/features/role/components/lists/UserRolesList.tsx
|
|
27503
|
-
import { useTranslations as
|
|
27504
|
-
import { jsx as
|
|
28168
|
+
import { useTranslations as useTranslations176 } from "next-intl";
|
|
28169
|
+
import { jsx as jsx316 } from "react/jsx-runtime";
|
|
27505
28170
|
function UserRolesList({ user }) {
|
|
27506
|
-
const t =
|
|
28171
|
+
const t = useTranslations176();
|
|
27507
28172
|
const data = useDataListRetriever({
|
|
27508
28173
|
retriever: /* @__PURE__ */ __name((params) => RoleService.findAllRolesByUser(params), "retriever"),
|
|
27509
28174
|
retrieverParams: { userId: user.id },
|
|
27510
28175
|
module: Modules.Role
|
|
27511
28176
|
});
|
|
27512
|
-
return /* @__PURE__ */
|
|
28177
|
+
return /* @__PURE__ */ jsx316(
|
|
27513
28178
|
ContentListTable,
|
|
27514
28179
|
{
|
|
27515
28180
|
data,
|
|
@@ -27522,10 +28187,10 @@ function UserRolesList({ user }) {
|
|
|
27522
28187
|
__name(UserRolesList, "UserRolesList");
|
|
27523
28188
|
|
|
27524
28189
|
// src/features/oauth/components/OAuthRedirectUriInput.tsx
|
|
27525
|
-
import { useTranslations as
|
|
28190
|
+
import { useTranslations as useTranslations177 } from "next-intl";
|
|
27526
28191
|
import { useCallback as useCallback57 } from "react";
|
|
27527
28192
|
import { Plus as Plus3, Trash2 as Trash23 } from "lucide-react";
|
|
27528
|
-
import { jsx as
|
|
28193
|
+
import { jsx as jsx317, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
27529
28194
|
function isValidRedirectUri(uri) {
|
|
27530
28195
|
if (!uri.trim()) return false;
|
|
27531
28196
|
if (uri.startsWith("http://localhost") || uri.startsWith("http://127.0.0.1")) {
|
|
@@ -27553,7 +28218,7 @@ function OAuthRedirectUriInput({
|
|
|
27553
28218
|
disabled = false,
|
|
27554
28219
|
label: labelProp
|
|
27555
28220
|
}) {
|
|
27556
|
-
const t =
|
|
28221
|
+
const t = useTranslations177();
|
|
27557
28222
|
const label = labelProp ?? t("oauth.ui.redirect_uris.label");
|
|
27558
28223
|
const handleAdd = useCallback57(() => {
|
|
27559
28224
|
onChange([...value, ""]);
|
|
@@ -27573,17 +28238,17 @@ function OAuthRedirectUriInput({
|
|
|
27573
28238
|
},
|
|
27574
28239
|
[value, onChange]
|
|
27575
28240
|
);
|
|
27576
|
-
return /* @__PURE__ */
|
|
27577
|
-
/* @__PURE__ */
|
|
28241
|
+
return /* @__PURE__ */ jsxs191("div", { className: "space-y-2", children: [
|
|
28242
|
+
/* @__PURE__ */ jsxs191(Label, { children: [
|
|
27578
28243
|
label,
|
|
27579
28244
|
" *"
|
|
27580
28245
|
] }),
|
|
27581
|
-
/* @__PURE__ */
|
|
27582
|
-
/* @__PURE__ */
|
|
28246
|
+
/* @__PURE__ */ jsx317("p", { className: "text-sm text-muted-foreground", children: t("oauth.ui.redirect_uris.help") }),
|
|
28247
|
+
/* @__PURE__ */ jsx317("div", { className: "space-y-2", children: value.map((uri, index) => {
|
|
27583
28248
|
const isValid3 = !uri || isValidRedirectUri(uri);
|
|
27584
|
-
return /* @__PURE__ */
|
|
27585
|
-
/* @__PURE__ */
|
|
27586
|
-
/* @__PURE__ */
|
|
28249
|
+
return /* @__PURE__ */ jsxs191("div", { className: "flex gap-2", children: [
|
|
28250
|
+
/* @__PURE__ */ jsxs191("div", { className: "flex-1", children: [
|
|
28251
|
+
/* @__PURE__ */ jsx317(
|
|
27587
28252
|
Input,
|
|
27588
28253
|
{
|
|
27589
28254
|
value: uri,
|
|
@@ -27593,9 +28258,9 @@ function OAuthRedirectUriInput({
|
|
|
27593
28258
|
className: !isValid3 ? "border-destructive" : ""
|
|
27594
28259
|
}
|
|
27595
28260
|
),
|
|
27596
|
-
!isValid3 && /* @__PURE__ */
|
|
28261
|
+
!isValid3 && /* @__PURE__ */ jsx317("p", { className: "text-xs text-destructive mt-1", children: t("oauth.ui.redirect_uris.invalid") })
|
|
27597
28262
|
] }),
|
|
27598
|
-
/* @__PURE__ */
|
|
28263
|
+
/* @__PURE__ */ jsx317(
|
|
27599
28264
|
Button,
|
|
27600
28265
|
{
|
|
27601
28266
|
type: "button",
|
|
@@ -27604,24 +28269,24 @@ function OAuthRedirectUriInput({
|
|
|
27604
28269
|
onClick: () => handleRemove(index),
|
|
27605
28270
|
disabled: disabled || value.length === 1,
|
|
27606
28271
|
title: t("oauth.ui.redirect_uris.remove"),
|
|
27607
|
-
children: /* @__PURE__ */
|
|
28272
|
+
children: /* @__PURE__ */ jsx317(Trash23, { className: "h-4 w-4" })
|
|
27608
28273
|
}
|
|
27609
28274
|
)
|
|
27610
28275
|
] }, index);
|
|
27611
28276
|
}) }),
|
|
27612
|
-
/* @__PURE__ */
|
|
27613
|
-
/* @__PURE__ */
|
|
28277
|
+
/* @__PURE__ */ jsxs191(Button, { type: "button", variant: "outline", size: "sm", onClick: handleAdd, disabled, className: "mt-2", children: [
|
|
28278
|
+
/* @__PURE__ */ jsx317(Plus3, { className: "h-4 w-4 me-2" }),
|
|
27614
28279
|
t("oauth.ui.redirect_uris.add")
|
|
27615
28280
|
] }),
|
|
27616
|
-
error && /* @__PURE__ */
|
|
28281
|
+
error && /* @__PURE__ */ jsx317("p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
27617
28282
|
] });
|
|
27618
28283
|
}
|
|
27619
28284
|
__name(OAuthRedirectUriInput, "OAuthRedirectUriInput");
|
|
27620
28285
|
|
|
27621
28286
|
// src/features/oauth/components/OAuthScopeSelector.tsx
|
|
27622
|
-
import { useTranslations as
|
|
28287
|
+
import { useTranslations as useTranslations178 } from "next-intl";
|
|
27623
28288
|
import { useCallback as useCallback58 } from "react";
|
|
27624
|
-
import { jsx as
|
|
28289
|
+
import { jsx as jsx318, jsxs as jsxs192 } from "react/jsx-runtime";
|
|
27625
28290
|
function OAuthScopeSelector({
|
|
27626
28291
|
value,
|
|
27627
28292
|
onChange,
|
|
@@ -27630,7 +28295,7 @@ function OAuthScopeSelector({
|
|
|
27630
28295
|
error,
|
|
27631
28296
|
label: labelProp
|
|
27632
28297
|
}) {
|
|
27633
|
-
const t =
|
|
28298
|
+
const t = useTranslations178();
|
|
27634
28299
|
const scopeText = useOAuthScopeText();
|
|
27635
28300
|
const label = labelProp ?? t("oauth.ui.scope_selector.label");
|
|
27636
28301
|
const handleToggle = useCallback58(
|
|
@@ -27655,25 +28320,25 @@ function OAuthScopeSelector({
|
|
|
27655
28320
|
},
|
|
27656
28321
|
{}
|
|
27657
28322
|
);
|
|
27658
|
-
return /* @__PURE__ */
|
|
27659
|
-
/* @__PURE__ */
|
|
27660
|
-
/* @__PURE__ */
|
|
28323
|
+
return /* @__PURE__ */ jsxs192("div", { className: "space-y-4", children: [
|
|
28324
|
+
/* @__PURE__ */ jsxs192("div", { children: [
|
|
28325
|
+
/* @__PURE__ */ jsxs192(Label, { children: [
|
|
27661
28326
|
label,
|
|
27662
28327
|
" *"
|
|
27663
28328
|
] }),
|
|
27664
|
-
/* @__PURE__ */
|
|
28329
|
+
/* @__PURE__ */ jsx318("p", { className: "text-sm text-muted-foreground", children: t("oauth.ui.scope_selector.help") })
|
|
27665
28330
|
] }),
|
|
27666
|
-
/* @__PURE__ */
|
|
27667
|
-
/* @__PURE__ */
|
|
27668
|
-
/* @__PURE__ */
|
|
28331
|
+
/* @__PURE__ */ jsx318("div", { className: "space-y-4", children: Object.entries(groupedScopes).map(([groupName, scopes]) => /* @__PURE__ */ jsxs192("div", { className: "space-y-2", children: [
|
|
28332
|
+
/* @__PURE__ */ jsx318("h4", { className: "text-sm font-medium capitalize", children: groupName }),
|
|
28333
|
+
/* @__PURE__ */ jsx318("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2 ps-2", children: scopes.map((scopeInfo) => {
|
|
27669
28334
|
const isChecked = value.includes(scopeInfo.scope);
|
|
27670
28335
|
const isAdmin = scopeInfo.scope === "admin";
|
|
27671
|
-
return /* @__PURE__ */
|
|
28336
|
+
return /* @__PURE__ */ jsxs192(
|
|
27672
28337
|
"div",
|
|
27673
28338
|
{
|
|
27674
28339
|
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" : ""}`,
|
|
27675
28340
|
children: [
|
|
27676
|
-
/* @__PURE__ */
|
|
28341
|
+
/* @__PURE__ */ jsx318(
|
|
27677
28342
|
Checkbox,
|
|
27678
28343
|
{
|
|
27679
28344
|
id: `scope-${scopeInfo.scope}`,
|
|
@@ -27682,12 +28347,12 @@ function OAuthScopeSelector({
|
|
|
27682
28347
|
disabled
|
|
27683
28348
|
}
|
|
27684
28349
|
),
|
|
27685
|
-
/* @__PURE__ */
|
|
27686
|
-
/* @__PURE__ */
|
|
28350
|
+
/* @__PURE__ */ jsxs192("div", { className: "flex-1", children: [
|
|
28351
|
+
/* @__PURE__ */ jsxs192(Label, { htmlFor: `scope-${scopeInfo.scope}`, className: "cursor-pointer", children: [
|
|
27687
28352
|
scopeText(scopeInfo).name,
|
|
27688
|
-
isAdmin && /* @__PURE__ */
|
|
28353
|
+
isAdmin && /* @__PURE__ */ jsx318("span", { className: "ms-2 text-xs text-destructive", children: t("oauth.ui.scope_selector.dangerous") })
|
|
27689
28354
|
] }),
|
|
27690
|
-
/* @__PURE__ */
|
|
28355
|
+
/* @__PURE__ */ jsx318("p", { className: "text-xs text-muted-foreground", children: scopeText(scopeInfo).description })
|
|
27691
28356
|
] })
|
|
27692
28357
|
]
|
|
27693
28358
|
},
|
|
@@ -27695,19 +28360,19 @@ function OAuthScopeSelector({
|
|
|
27695
28360
|
);
|
|
27696
28361
|
}) })
|
|
27697
28362
|
] }, groupName)) }),
|
|
27698
|
-
error && /* @__PURE__ */
|
|
28363
|
+
error && /* @__PURE__ */ jsx318("p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
27699
28364
|
] });
|
|
27700
28365
|
}
|
|
27701
28366
|
__name(OAuthScopeSelector, "OAuthScopeSelector");
|
|
27702
28367
|
|
|
27703
28368
|
// src/features/oauth/components/OAuthClientSecretDisplay.tsx
|
|
27704
|
-
import { useTranslations as
|
|
27705
|
-
import { useState as
|
|
28369
|
+
import { useTranslations as useTranslations179 } from "next-intl";
|
|
28370
|
+
import { useState as useState124, useCallback as useCallback59 } from "react";
|
|
27706
28371
|
import { Copy as Copy3, Check, AlertTriangle } from "lucide-react";
|
|
27707
|
-
import { jsx as
|
|
28372
|
+
import { jsx as jsx319, jsxs as jsxs193 } from "react/jsx-runtime";
|
|
27708
28373
|
function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
27709
|
-
const t =
|
|
27710
|
-
const [copied, setCopied] =
|
|
28374
|
+
const t = useTranslations179();
|
|
28375
|
+
const [copied, setCopied] = useState124(false);
|
|
27711
28376
|
const handleCopy = useCallback59(async () => {
|
|
27712
28377
|
try {
|
|
27713
28378
|
await navigator.clipboard.writeText(secret);
|
|
@@ -27721,25 +28386,25 @@ function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
|
27721
28386
|
setCopied(false);
|
|
27722
28387
|
onDismiss();
|
|
27723
28388
|
}, [onDismiss]);
|
|
27724
|
-
return /* @__PURE__ */
|
|
27725
|
-
/* @__PURE__ */
|
|
27726
|
-
/* @__PURE__ */
|
|
27727
|
-
/* @__PURE__ */
|
|
28389
|
+
return /* @__PURE__ */ jsx319(Dialog, { open, onOpenChange: (isOpen) => !isOpen && handleDismiss(), children: /* @__PURE__ */ jsxs193(DialogContent, { className: "sm:max-w-md", children: [
|
|
28390
|
+
/* @__PURE__ */ jsxs193(DialogHeader, { children: [
|
|
28391
|
+
/* @__PURE__ */ jsxs193(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
28392
|
+
/* @__PURE__ */ jsx319(AlertTriangle, { className: "h-5 w-5 text-warning" }),
|
|
27728
28393
|
t("oauth.ui.secret_display.title")
|
|
27729
28394
|
] }),
|
|
27730
|
-
/* @__PURE__ */
|
|
28395
|
+
/* @__PURE__ */ jsx319(DialogDescription, { children: clientName ? t("oauth.ui.secret_display.description_named", { name: clientName }) : t("oauth.ui.secret_display.description") })
|
|
27731
28396
|
] }),
|
|
27732
|
-
/* @__PURE__ */
|
|
27733
|
-
/* @__PURE__ */
|
|
27734
|
-
/* @__PURE__ */
|
|
27735
|
-
/* @__PURE__ */
|
|
27736
|
-
/* @__PURE__ */
|
|
28397
|
+
/* @__PURE__ */ jsxs193(Alert, { variant: "destructive", className: "my-4", children: [
|
|
28398
|
+
/* @__PURE__ */ jsx319(AlertTriangle, { className: "h-4 w-4" }),
|
|
28399
|
+
/* @__PURE__ */ jsxs193(AlertDescription, { children: [
|
|
28400
|
+
/* @__PURE__ */ jsx319("strong", { children: t("oauth.ui.secret_display.warning_title") }),
|
|
28401
|
+
/* @__PURE__ */ jsx319("br", {}),
|
|
27737
28402
|
t("oauth.ui.secret_display.warning_body")
|
|
27738
28403
|
] })
|
|
27739
28404
|
] }),
|
|
27740
|
-
/* @__PURE__ */
|
|
27741
|
-
/* @__PURE__ */
|
|
27742
|
-
/* @__PURE__ */
|
|
28405
|
+
/* @__PURE__ */ jsxs193("div", { className: "flex items-center space-x-2", children: [
|
|
28406
|
+
/* @__PURE__ */ jsx319("div", { className: "flex-1", children: /* @__PURE__ */ jsx319(Input, { value: secret, readOnly: true, className: "tabular-nums text-sm", onClick: (e) => e.currentTarget.select() }) }),
|
|
28407
|
+
/* @__PURE__ */ jsx319(
|
|
27743
28408
|
Button,
|
|
27744
28409
|
{
|
|
27745
28410
|
type: "button",
|
|
@@ -27747,44 +28412,44 @@ function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
|
|
|
27747
28412
|
size: "icon",
|
|
27748
28413
|
onClick: handleCopy,
|
|
27749
28414
|
title: copied ? t("oauth.ui.secret_display.copied_short") : t("oauth.ui.secret_display.copy_to_clipboard"),
|
|
27750
|
-
children: copied ? /* @__PURE__ */
|
|
28415
|
+
children: copied ? /* @__PURE__ */ jsx319(Check, { className: "text-success h-4 w-4" }) : /* @__PURE__ */ jsx319(Copy3, { className: "h-4 w-4" })
|
|
27751
28416
|
}
|
|
27752
28417
|
)
|
|
27753
28418
|
] }),
|
|
27754
|
-
copied && /* @__PURE__ */
|
|
27755
|
-
/* @__PURE__ */
|
|
28419
|
+
copied && /* @__PURE__ */ jsx319("p", { className: "text-success text-center text-sm", children: t("oauth.ui.secret_display.copied") }),
|
|
28420
|
+
/* @__PURE__ */ jsx319(DialogFooter, { className: "mt-4", children: /* @__PURE__ */ jsx319(Button, { onClick: handleDismiss, className: "w-full", children: t("oauth.ui.secret_display.confirm") }) })
|
|
27756
28421
|
] }) });
|
|
27757
28422
|
}
|
|
27758
28423
|
__name(OAuthClientSecretDisplay, "OAuthClientSecretDisplay");
|
|
27759
28424
|
|
|
27760
28425
|
// src/features/oauth/components/OAuthClientCard.tsx
|
|
27761
|
-
import { useTranslations as
|
|
28426
|
+
import { useTranslations as useTranslations180 } from "next-intl";
|
|
27762
28427
|
import { formatDistanceToNow } from "date-fns";
|
|
27763
28428
|
import { Key as Key2, MoreVertical, Pencil, Trash2 as Trash24 } from "lucide-react";
|
|
27764
|
-
import { jsx as
|
|
28429
|
+
import { jsx as jsx320, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
27765
28430
|
function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
27766
|
-
const t =
|
|
28431
|
+
const t = useTranslations180();
|
|
27767
28432
|
const dateFnsLocale = useI18nDateFnsLocale();
|
|
27768
28433
|
const truncatedId = client.clientId.length > 12 ? `${client.clientId.slice(0, 8)}...${client.clientId.slice(-4)}` : client.clientId;
|
|
27769
28434
|
const createdAgo = client.createdAt ? formatDistanceToNow(new Date(client.createdAt), { addSuffix: true, locale: dateFnsLocale }) : t("oauth.ui.card.unknown");
|
|
27770
|
-
return /* @__PURE__ */
|
|
28435
|
+
return /* @__PURE__ */ jsxs194(
|
|
27771
28436
|
Card,
|
|
27772
28437
|
{
|
|
27773
28438
|
className: `cursor-pointer transition-colors hover:bg-accent/50 ${!client.isActive ? "opacity-60" : ""}`,
|
|
27774
28439
|
onClick,
|
|
27775
28440
|
children: [
|
|
27776
|
-
/* @__PURE__ */
|
|
27777
|
-
/* @__PURE__ */
|
|
27778
|
-
/* @__PURE__ */
|
|
27779
|
-
/* @__PURE__ */
|
|
27780
|
-
/* @__PURE__ */
|
|
28441
|
+
/* @__PURE__ */ jsxs194(CardHeader, { className: "pb-2", children: [
|
|
28442
|
+
/* @__PURE__ */ jsxs194("div", { className: "flex items-start justify-between", children: [
|
|
28443
|
+
/* @__PURE__ */ jsxs194("div", { className: "flex items-center gap-2", children: [
|
|
28444
|
+
/* @__PURE__ */ jsx320(Key2, { className: "h-5 w-5 text-muted-foreground" }),
|
|
28445
|
+
/* @__PURE__ */ jsx320(CardTitle, { className: "text-lg", children: client.name })
|
|
27781
28446
|
] }),
|
|
27782
|
-
/* @__PURE__ */
|
|
27783
|
-
/* @__PURE__ */
|
|
27784
|
-
(onEdit || onDelete) && /* @__PURE__ */
|
|
27785
|
-
/* @__PURE__ */
|
|
27786
|
-
/* @__PURE__ */
|
|
27787
|
-
onEdit && /* @__PURE__ */
|
|
28447
|
+
/* @__PURE__ */ jsxs194("div", { className: "flex items-center gap-2", children: [
|
|
28448
|
+
/* @__PURE__ */ jsx320(Badge, { variant: client.isActive ? "default" : "secondary", children: client.isActive ? t("oauth.ui.card.active") : t("oauth.ui.card.inactive") }),
|
|
28449
|
+
(onEdit || onDelete) && /* @__PURE__ */ jsxs194(DropdownMenu, { children: [
|
|
28450
|
+
/* @__PURE__ */ jsx320(DropdownMenuTrigger, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx320(Button, { render: /* @__PURE__ */ jsx320("div", {}), nativeButton: false, variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx320(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
28451
|
+
/* @__PURE__ */ jsxs194(DropdownMenuContent, { align: "end", children: [
|
|
28452
|
+
onEdit && /* @__PURE__ */ jsxs194(
|
|
27788
28453
|
DropdownMenuItem,
|
|
27789
28454
|
{
|
|
27790
28455
|
onClick: (e) => {
|
|
@@ -27792,12 +28457,12 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
27792
28457
|
onEdit();
|
|
27793
28458
|
},
|
|
27794
28459
|
children: [
|
|
27795
|
-
/* @__PURE__ */
|
|
28460
|
+
/* @__PURE__ */ jsx320(Pencil, { className: "h-4 w-4 me-2" }),
|
|
27796
28461
|
t("ui.buttons.edit")
|
|
27797
28462
|
]
|
|
27798
28463
|
}
|
|
27799
28464
|
),
|
|
27800
|
-
onDelete && /* @__PURE__ */
|
|
28465
|
+
onDelete && /* @__PURE__ */ jsxs194(
|
|
27801
28466
|
DropdownMenuItem,
|
|
27802
28467
|
{
|
|
27803
28468
|
onClick: (e) => {
|
|
@@ -27806,7 +28471,7 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
27806
28471
|
},
|
|
27807
28472
|
className: "text-destructive",
|
|
27808
28473
|
children: [
|
|
27809
|
-
/* @__PURE__ */
|
|
28474
|
+
/* @__PURE__ */ jsx320(Trash24, { className: "h-4 w-4 me-2" }),
|
|
27810
28475
|
t("ui.buttons.delete")
|
|
27811
28476
|
]
|
|
27812
28477
|
}
|
|
@@ -27815,12 +28480,12 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
27815
28480
|
] })
|
|
27816
28481
|
] })
|
|
27817
28482
|
] }),
|
|
27818
|
-
client.description && /* @__PURE__ */
|
|
28483
|
+
client.description && /* @__PURE__ */ jsx320(CardDescription, { className: "line-clamp-2", children: client.description })
|
|
27819
28484
|
] }),
|
|
27820
|
-
/* @__PURE__ */
|
|
27821
|
-
/* @__PURE__ */
|
|
27822
|
-
/* @__PURE__ */
|
|
27823
|
-
/* @__PURE__ */
|
|
28485
|
+
/* @__PURE__ */ jsx320(CardContent, { children: /* @__PURE__ */ jsxs194("div", { className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground", children: [
|
|
28486
|
+
/* @__PURE__ */ jsx320("span", { className: "tabular-nums", children: truncatedId }),
|
|
28487
|
+
/* @__PURE__ */ jsx320("span", { children: t("oauth.ui.card.created", { ago: createdAgo }) }),
|
|
28488
|
+
/* @__PURE__ */ jsx320("span", { children: client.isConfidential ? t("oauth.ui.card.confidential") : t("oauth.ui.card.public") })
|
|
27824
28489
|
] }) })
|
|
27825
28490
|
]
|
|
27826
28491
|
}
|
|
@@ -27829,9 +28494,9 @@ function OAuthClientCard({ client, onClick, onEdit, onDelete }) {
|
|
|
27829
28494
|
__name(OAuthClientCard, "OAuthClientCard");
|
|
27830
28495
|
|
|
27831
28496
|
// src/features/oauth/components/OAuthClientList.tsx
|
|
27832
|
-
import { useTranslations as
|
|
28497
|
+
import { useTranslations as useTranslations181 } from "next-intl";
|
|
27833
28498
|
import { Plus as Plus4, Key as Key3 } from "lucide-react";
|
|
27834
|
-
import { jsx as
|
|
28499
|
+
import { jsx as jsx321, jsxs as jsxs195 } from "react/jsx-runtime";
|
|
27835
28500
|
function OAuthClientList({
|
|
27836
28501
|
clients,
|
|
27837
28502
|
isLoading = false,
|
|
@@ -27843,53 +28508,53 @@ function OAuthClientList({
|
|
|
27843
28508
|
emptyStateMessage: emptyStateMessageProp,
|
|
27844
28509
|
title: titleProp
|
|
27845
28510
|
}) {
|
|
27846
|
-
const t =
|
|
28511
|
+
const t = useTranslations181();
|
|
27847
28512
|
const emptyStateMessage = emptyStateMessageProp ?? t("oauth.ui.list.empty_message");
|
|
27848
28513
|
const title = titleProp ?? t("oauth.ui.list.title");
|
|
27849
28514
|
if (isLoading && clients.length === 0) {
|
|
27850
|
-
return /* @__PURE__ */
|
|
27851
|
-
/* @__PURE__ */
|
|
27852
|
-
/* @__PURE__ */
|
|
27853
|
-
/* @__PURE__ */
|
|
28515
|
+
return /* @__PURE__ */ jsxs195("div", { className: "space-y-4", children: [
|
|
28516
|
+
/* @__PURE__ */ jsxs195("div", { className: "flex items-center justify-between", children: [
|
|
28517
|
+
/* @__PURE__ */ jsx321(SectionHeader, { level: 2, children: title }),
|
|
28518
|
+
/* @__PURE__ */ jsx321(Skeleton, { className: "h-10 w-32" })
|
|
27854
28519
|
] }),
|
|
27855
|
-
/* @__PURE__ */
|
|
28520
|
+
/* @__PURE__ */ jsx321("div", { className: "space-y-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx321(Skeleton, { className: "h-32 w-full" }, i)) })
|
|
27856
28521
|
] });
|
|
27857
28522
|
}
|
|
27858
28523
|
if (error) {
|
|
27859
|
-
return /* @__PURE__ */
|
|
27860
|
-
/* @__PURE__ */
|
|
27861
|
-
/* @__PURE__ */
|
|
28524
|
+
return /* @__PURE__ */ jsxs195("div", { className: "space-y-4", children: [
|
|
28525
|
+
/* @__PURE__ */ jsx321("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx321(SectionHeader, { level: 2, children: title }) }),
|
|
28526
|
+
/* @__PURE__ */ jsx321("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-6 text-center", children: /* @__PURE__ */ jsx321("p", { className: "text-destructive", children: error.message }) })
|
|
27862
28527
|
] });
|
|
27863
28528
|
}
|
|
27864
28529
|
if (clients.length === 0) {
|
|
27865
|
-
return /* @__PURE__ */
|
|
27866
|
-
/* @__PURE__ */
|
|
27867
|
-
/* @__PURE__ */
|
|
27868
|
-
onCreateClick && /* @__PURE__ */
|
|
27869
|
-
/* @__PURE__ */
|
|
28530
|
+
return /* @__PURE__ */ jsxs195("div", { className: "space-y-4", children: [
|
|
28531
|
+
/* @__PURE__ */ jsxs195("div", { className: "flex items-center justify-between", children: [
|
|
28532
|
+
/* @__PURE__ */ jsx321(SectionHeader, { level: 2, children: title }),
|
|
28533
|
+
onCreateClick && /* @__PURE__ */ jsxs195(Button, { onClick: onCreateClick, children: [
|
|
28534
|
+
/* @__PURE__ */ jsx321(Plus4, { className: "h-4 w-4 me-2" }),
|
|
27870
28535
|
t("oauth.ui.list.new_app")
|
|
27871
28536
|
] })
|
|
27872
28537
|
] }),
|
|
27873
|
-
/* @__PURE__ */
|
|
27874
|
-
/* @__PURE__ */
|
|
27875
|
-
/* @__PURE__ */
|
|
27876
|
-
/* @__PURE__ */
|
|
27877
|
-
onCreateClick && /* @__PURE__ */
|
|
27878
|
-
/* @__PURE__ */
|
|
28538
|
+
/* @__PURE__ */ jsxs195("div", { className: "rounded-lg border border-dashed p-12 text-center", children: [
|
|
28539
|
+
/* @__PURE__ */ jsx321(Key3, { className: "h-12 w-12 mx-auto text-muted-foreground mb-4" }),
|
|
28540
|
+
/* @__PURE__ */ jsx321("h3", { className: "text-lg font-medium mb-2", children: t("oauth.ui.list.empty_title") }),
|
|
28541
|
+
/* @__PURE__ */ jsx321("p", { className: "text-muted-foreground mb-4", children: emptyStateMessage }),
|
|
28542
|
+
onCreateClick && /* @__PURE__ */ jsxs195(Button, { onClick: onCreateClick, children: [
|
|
28543
|
+
/* @__PURE__ */ jsx321(Plus4, { className: "h-4 w-4 me-2" }),
|
|
27879
28544
|
t("oauth.ui.list.create")
|
|
27880
28545
|
] })
|
|
27881
28546
|
] })
|
|
27882
28547
|
] });
|
|
27883
28548
|
}
|
|
27884
|
-
return /* @__PURE__ */
|
|
27885
|
-
/* @__PURE__ */
|
|
27886
|
-
/* @__PURE__ */
|
|
27887
|
-
onCreateClick && /* @__PURE__ */
|
|
27888
|
-
/* @__PURE__ */
|
|
28549
|
+
return /* @__PURE__ */ jsxs195("div", { className: "space-y-4", children: [
|
|
28550
|
+
/* @__PURE__ */ jsxs195("div", { className: "flex items-center justify-between", children: [
|
|
28551
|
+
/* @__PURE__ */ jsx321(SectionHeader, { level: 2, children: title }),
|
|
28552
|
+
onCreateClick && /* @__PURE__ */ jsxs195(Button, { onClick: onCreateClick, children: [
|
|
28553
|
+
/* @__PURE__ */ jsx321(Plus4, { className: "h-4 w-4 me-2" }),
|
|
27889
28554
|
t("oauth.ui.list.new_app")
|
|
27890
28555
|
] })
|
|
27891
28556
|
] }),
|
|
27892
|
-
/* @__PURE__ */
|
|
28557
|
+
/* @__PURE__ */ jsx321("div", { className: "space-y-3", children: clients.map((client) => /* @__PURE__ */ jsx321(
|
|
27893
28558
|
OAuthClientCard,
|
|
27894
28559
|
{
|
|
27895
28560
|
client,
|
|
@@ -27904,9 +28569,9 @@ function OAuthClientList({
|
|
|
27904
28569
|
__name(OAuthClientList, "OAuthClientList");
|
|
27905
28570
|
|
|
27906
28571
|
// src/features/oauth/components/OAuthClientForm.tsx
|
|
27907
|
-
import { useTranslations as
|
|
27908
|
-
import { useState as
|
|
27909
|
-
import { jsx as
|
|
28572
|
+
import { useTranslations as useTranslations182 } from "next-intl";
|
|
28573
|
+
import { useState as useState125, useCallback as useCallback60 } from "react";
|
|
28574
|
+
import { jsx as jsx322, jsxs as jsxs196 } from "react/jsx-runtime";
|
|
27910
28575
|
function OAuthClientForm({
|
|
27911
28576
|
client,
|
|
27912
28577
|
onSubmit,
|
|
@@ -27915,16 +28580,16 @@ function OAuthClientForm({
|
|
|
27915
28580
|
availableScopes,
|
|
27916
28581
|
defaultScopes = []
|
|
27917
28582
|
}) {
|
|
27918
|
-
const t =
|
|
28583
|
+
const t = useTranslations182();
|
|
27919
28584
|
const isEditMode = !!client;
|
|
27920
|
-
const [formState, setFormState] =
|
|
28585
|
+
const [formState, setFormState] = useState125({
|
|
27921
28586
|
name: client?.name || "",
|
|
27922
28587
|
description: client?.description || "",
|
|
27923
28588
|
redirectUris: client?.redirectUris?.length ? client.redirectUris : [""],
|
|
27924
28589
|
allowedScopes: client ? client.allowedScopes || [] : defaultScopes,
|
|
27925
28590
|
isConfidential: client?.isConfidential ?? true
|
|
27926
28591
|
});
|
|
27927
|
-
const [errors, setErrors] =
|
|
28592
|
+
const [errors, setErrors] = useState125({});
|
|
27928
28593
|
const validate = useCallback60(() => {
|
|
27929
28594
|
const newErrors = {};
|
|
27930
28595
|
if (!formState.name.trim()) {
|
|
@@ -27956,18 +28621,18 @@ function OAuthClientForm({
|
|
|
27956
28621
|
},
|
|
27957
28622
|
[formState, validate, onSubmit]
|
|
27958
28623
|
);
|
|
27959
|
-
return /* @__PURE__ */
|
|
27960
|
-
/* @__PURE__ */
|
|
27961
|
-
/* @__PURE__ */
|
|
27962
|
-
/* @__PURE__ */
|
|
28624
|
+
return /* @__PURE__ */ jsx322(Card, { children: /* @__PURE__ */ jsxs196("form", { onSubmit: handleSubmit, children: [
|
|
28625
|
+
/* @__PURE__ */ jsxs196(CardHeader, { children: [
|
|
28626
|
+
/* @__PURE__ */ jsx322(CardTitle, { children: isEditMode ? t("oauth.ui.form.edit_title") : t("oauth.settings.create_title") }),
|
|
28627
|
+
/* @__PURE__ */ jsx322(CardDescription, { children: isEditMode ? t("oauth.ui.form.edit_description") : t("oauth.ui.form.create_description") })
|
|
27963
28628
|
] }),
|
|
27964
|
-
/* @__PURE__ */
|
|
27965
|
-
/* @__PURE__ */
|
|
27966
|
-
/* @__PURE__ */
|
|
28629
|
+
/* @__PURE__ */ jsxs196(CardContent, { className: "space-y-6", children: [
|
|
28630
|
+
/* @__PURE__ */ jsxs196("div", { className: "space-y-2", children: [
|
|
28631
|
+
/* @__PURE__ */ jsxs196(Label, { htmlFor: "name", children: [
|
|
27967
28632
|
t("oauth.ui.form.name"),
|
|
27968
28633
|
" *"
|
|
27969
28634
|
] }),
|
|
27970
|
-
/* @__PURE__ */
|
|
28635
|
+
/* @__PURE__ */ jsx322(
|
|
27971
28636
|
Input,
|
|
27972
28637
|
{
|
|
27973
28638
|
id: "name",
|
|
@@ -27978,11 +28643,11 @@ function OAuthClientForm({
|
|
|
27978
28643
|
className: errors.name ? "border-destructive" : ""
|
|
27979
28644
|
}
|
|
27980
28645
|
),
|
|
27981
|
-
errors.name && /* @__PURE__ */
|
|
28646
|
+
errors.name && /* @__PURE__ */ jsx322("p", { className: "text-destructive text-xs/relaxed", children: errors.name })
|
|
27982
28647
|
] }),
|
|
27983
|
-
/* @__PURE__ */
|
|
27984
|
-
/* @__PURE__ */
|
|
27985
|
-
/* @__PURE__ */
|
|
28648
|
+
/* @__PURE__ */ jsxs196("div", { className: "space-y-2", children: [
|
|
28649
|
+
/* @__PURE__ */ jsx322(Label, { htmlFor: "description", children: t("oauth.ui.form.description") }),
|
|
28650
|
+
/* @__PURE__ */ jsx322(
|
|
27986
28651
|
Textarea,
|
|
27987
28652
|
{
|
|
27988
28653
|
id: "description",
|
|
@@ -27994,7 +28659,7 @@ function OAuthClientForm({
|
|
|
27994
28659
|
}
|
|
27995
28660
|
)
|
|
27996
28661
|
] }),
|
|
27997
|
-
/* @__PURE__ */
|
|
28662
|
+
/* @__PURE__ */ jsx322(
|
|
27998
28663
|
OAuthRedirectUriInput,
|
|
27999
28664
|
{
|
|
28000
28665
|
value: formState.redirectUris,
|
|
@@ -28003,7 +28668,7 @@ function OAuthClientForm({
|
|
|
28003
28668
|
disabled: isLoading
|
|
28004
28669
|
}
|
|
28005
28670
|
),
|
|
28006
|
-
/* @__PURE__ */
|
|
28671
|
+
/* @__PURE__ */ jsx322(
|
|
28007
28672
|
OAuthScopeSelector,
|
|
28008
28673
|
{
|
|
28009
28674
|
value: formState.allowedScopes,
|
|
@@ -28013,48 +28678,48 @@ function OAuthClientForm({
|
|
|
28013
28678
|
disabled: isLoading
|
|
28014
28679
|
}
|
|
28015
28680
|
),
|
|
28016
|
-
/* @__PURE__ */
|
|
28017
|
-
/* @__PURE__ */
|
|
28018
|
-
/* @__PURE__ */
|
|
28681
|
+
/* @__PURE__ */ jsxs196("div", { className: "space-y-3", children: [
|
|
28682
|
+
/* @__PURE__ */ jsx322(Label, { children: t("oauth.ui.form.client_type") }),
|
|
28683
|
+
/* @__PURE__ */ jsxs196(
|
|
28019
28684
|
RadioGroup,
|
|
28020
28685
|
{
|
|
28021
28686
|
value: formState.isConfidential ? "confidential" : "public",
|
|
28022
28687
|
onValueChange: (v) => setFormState((s) => ({ ...s, isConfidential: v === "confidential" })),
|
|
28023
28688
|
disabled: isLoading || isEditMode,
|
|
28024
28689
|
children: [
|
|
28025
|
-
/* @__PURE__ */
|
|
28026
|
-
/* @__PURE__ */
|
|
28027
|
-
/* @__PURE__ */
|
|
28028
|
-
/* @__PURE__ */
|
|
28029
|
-
/* @__PURE__ */
|
|
28690
|
+
/* @__PURE__ */ jsxs196("div", { className: "flex items-start space-x-3 p-3 rounded-md border", children: [
|
|
28691
|
+
/* @__PURE__ */ jsx322(RadioGroupItem, { value: "confidential", id: "confidential", className: "mt-1" }),
|
|
28692
|
+
/* @__PURE__ */ jsxs196("div", { children: [
|
|
28693
|
+
/* @__PURE__ */ jsx322(Label, { htmlFor: "confidential", className: "cursor-pointer", children: t("oauth.ui.card.confidential") }),
|
|
28694
|
+
/* @__PURE__ */ jsx322("p", { className: "text-sm text-muted-foreground", children: t("oauth.ui.form.confidential_help") })
|
|
28030
28695
|
] })
|
|
28031
28696
|
] }),
|
|
28032
|
-
/* @__PURE__ */
|
|
28033
|
-
/* @__PURE__ */
|
|
28034
|
-
/* @__PURE__ */
|
|
28035
|
-
/* @__PURE__ */
|
|
28036
|
-
/* @__PURE__ */
|
|
28697
|
+
/* @__PURE__ */ jsxs196("div", { className: "flex items-start space-x-3 p-3 rounded-md border", children: [
|
|
28698
|
+
/* @__PURE__ */ jsx322(RadioGroupItem, { value: "public", id: "public", className: "mt-1" }),
|
|
28699
|
+
/* @__PURE__ */ jsxs196("div", { children: [
|
|
28700
|
+
/* @__PURE__ */ jsx322(Label, { htmlFor: "public", className: "cursor-pointer", children: t("oauth.ui.card.public") }),
|
|
28701
|
+
/* @__PURE__ */ jsx322("p", { className: "text-sm text-muted-foreground", children: t("oauth.ui.form.public_help") })
|
|
28037
28702
|
] })
|
|
28038
28703
|
] })
|
|
28039
28704
|
]
|
|
28040
28705
|
}
|
|
28041
28706
|
),
|
|
28042
|
-
isEditMode && /* @__PURE__ */
|
|
28707
|
+
isEditMode && /* @__PURE__ */ jsx322("p", { className: "text-sm text-muted-foreground", children: t("oauth.ui.form.client_type_locked") })
|
|
28043
28708
|
] })
|
|
28044
28709
|
] }),
|
|
28045
|
-
/* @__PURE__ */
|
|
28046
|
-
/* @__PURE__ */
|
|
28047
|
-
/* @__PURE__ */
|
|
28710
|
+
/* @__PURE__ */ jsxs196(CardFooter, { className: "flex justify-end gap-3", children: [
|
|
28711
|
+
/* @__PURE__ */ jsx322(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
28712
|
+
/* @__PURE__ */ jsx322(Button, { type: "submit", disabled: isLoading, children: isLoading ? t("oauth.ui.form.saving") : isEditMode ? t("oauth.ui.form.save_changes") : t("oauth.ui.list.create") })
|
|
28048
28713
|
] })
|
|
28049
28714
|
] }) });
|
|
28050
28715
|
}
|
|
28051
28716
|
__name(OAuthClientForm, "OAuthClientForm");
|
|
28052
28717
|
|
|
28053
28718
|
// src/features/oauth/components/OAuthClientDetail.tsx
|
|
28054
|
-
import { useTranslations as
|
|
28055
|
-
import { useState as
|
|
28719
|
+
import { useTranslations as useTranslations183 } from "next-intl";
|
|
28720
|
+
import { useState as useState126, useCallback as useCallback61 } from "react";
|
|
28056
28721
|
import { Copy as Copy4, Check as Check2, RefreshCw as RefreshCw3, Pencil as Pencil2, Trash2 as Trash25, ExternalLink } from "lucide-react";
|
|
28057
|
-
import { Fragment as Fragment66, jsx as
|
|
28722
|
+
import { Fragment as Fragment66, jsx as jsx323, jsxs as jsxs197 } from "react/jsx-runtime";
|
|
28058
28723
|
function OAuthClientDetail({
|
|
28059
28724
|
client,
|
|
28060
28725
|
isLoading = false,
|
|
@@ -28062,14 +28727,14 @@ function OAuthClientDetail({
|
|
|
28062
28727
|
onDelete,
|
|
28063
28728
|
onRegenerateSecret
|
|
28064
28729
|
}) {
|
|
28065
|
-
const t =
|
|
28730
|
+
const t = useTranslations183();
|
|
28066
28731
|
const locale = useI18nLocale();
|
|
28067
28732
|
const scopeText = useOAuthScopeText();
|
|
28068
|
-
const [copiedField, setCopiedField] =
|
|
28069
|
-
const [showDeleteConfirm, setShowDeleteConfirm] =
|
|
28070
|
-
const [showRegenerateConfirm, setShowRegenerateConfirm] =
|
|
28071
|
-
const [isDeleting, setIsDeleting] =
|
|
28072
|
-
const [isRegenerating, setIsRegenerating] =
|
|
28733
|
+
const [copiedField, setCopiedField] = useState126(null);
|
|
28734
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = useState126(false);
|
|
28735
|
+
const [showRegenerateConfirm, setShowRegenerateConfirm] = useState126(false);
|
|
28736
|
+
const [isDeleting, setIsDeleting] = useState126(false);
|
|
28737
|
+
const [isRegenerating, setIsRegenerating] = useState126(false);
|
|
28073
28738
|
const copyToClipboard2 = useCallback61(async (text, field) => {
|
|
28074
28739
|
try {
|
|
28075
28740
|
await navigator.clipboard.writeText(text);
|
|
@@ -28100,40 +28765,40 @@ function OAuthClientDetail({
|
|
|
28100
28765
|
}
|
|
28101
28766
|
}, [onRegenerateSecret]);
|
|
28102
28767
|
const createdDate = client.createdAt ? new Date(client.createdAt).toLocaleDateString(dateFormatLocale(locale), { dateStyle: "long" }) : t("oauth.ui.card.unknown");
|
|
28103
|
-
return /* @__PURE__ */
|
|
28104
|
-
/* @__PURE__ */
|
|
28105
|
-
/* @__PURE__ */
|
|
28106
|
-
/* @__PURE__ */
|
|
28107
|
-
/* @__PURE__ */
|
|
28108
|
-
client.description && /* @__PURE__ */
|
|
28768
|
+
return /* @__PURE__ */ jsxs197(Fragment66, { children: [
|
|
28769
|
+
/* @__PURE__ */ jsxs197(Card, { children: [
|
|
28770
|
+
/* @__PURE__ */ jsx323(CardHeader, { children: /* @__PURE__ */ jsxs197("div", { className: "flex items-start justify-between", children: [
|
|
28771
|
+
/* @__PURE__ */ jsxs197("div", { children: [
|
|
28772
|
+
/* @__PURE__ */ jsx323(CardTitle, { children: client.name }),
|
|
28773
|
+
client.description && /* @__PURE__ */ jsx323(CardDescription, { className: "mt-1", children: client.description })
|
|
28109
28774
|
] }),
|
|
28110
|
-
/* @__PURE__ */
|
|
28111
|
-
/* @__PURE__ */
|
|
28112
|
-
/* @__PURE__ */
|
|
28775
|
+
/* @__PURE__ */ jsxs197("div", { className: "flex items-center gap-2", children: [
|
|
28776
|
+
/* @__PURE__ */ jsx323(Badge, { variant: client.isActive ? "default" : "secondary", children: client.isActive ? t("oauth.ui.card.active") : t("oauth.ui.card.inactive") }),
|
|
28777
|
+
/* @__PURE__ */ jsx323(Badge, { variant: "outline", children: client.isConfidential ? t("oauth.ui.card.confidential") : t("oauth.ui.card.public") })
|
|
28113
28778
|
] })
|
|
28114
28779
|
] }) }),
|
|
28115
|
-
/* @__PURE__ */
|
|
28116
|
-
/* @__PURE__ */
|
|
28117
|
-
/* @__PURE__ */
|
|
28118
|
-
/* @__PURE__ */
|
|
28119
|
-
/* @__PURE__ */
|
|
28120
|
-
/* @__PURE__ */
|
|
28780
|
+
/* @__PURE__ */ jsxs197(CardContent, { className: "space-y-6", children: [
|
|
28781
|
+
/* @__PURE__ */ jsxs197("div", { className: "space-y-2", children: [
|
|
28782
|
+
/* @__PURE__ */ jsx323(Label, { children: t("oauth.ui.detail.client_id") }),
|
|
28783
|
+
/* @__PURE__ */ jsxs197("div", { className: "flex gap-2", children: [
|
|
28784
|
+
/* @__PURE__ */ jsx323(Input, { value: client.clientId, readOnly: true, className: "tabular-nums" }),
|
|
28785
|
+
/* @__PURE__ */ jsx323(
|
|
28121
28786
|
Button,
|
|
28122
28787
|
{
|
|
28123
28788
|
variant: "outline",
|
|
28124
28789
|
size: "icon",
|
|
28125
28790
|
onClick: () => copyToClipboard2(client.clientId, "clientId"),
|
|
28126
28791
|
title: t("oauth.ui.detail.copy_client_id"),
|
|
28127
|
-
children: copiedField === "clientId" ? /* @__PURE__ */
|
|
28792
|
+
children: copiedField === "clientId" ? /* @__PURE__ */ jsx323(Check2, { className: "text-success h-4 w-4" }) : /* @__PURE__ */ jsx323(Copy4, { className: "h-4 w-4" })
|
|
28128
28793
|
}
|
|
28129
28794
|
)
|
|
28130
28795
|
] })
|
|
28131
28796
|
] }),
|
|
28132
|
-
/* @__PURE__ */
|
|
28133
|
-
/* @__PURE__ */
|
|
28134
|
-
/* @__PURE__ */
|
|
28135
|
-
/* @__PURE__ */
|
|
28136
|
-
onRegenerateSecret && /* @__PURE__ */
|
|
28797
|
+
/* @__PURE__ */ jsxs197("div", { className: "space-y-2", children: [
|
|
28798
|
+
/* @__PURE__ */ jsx323(Label, { children: t("oauth.ui.detail.client_secret") }),
|
|
28799
|
+
/* @__PURE__ */ jsxs197("div", { className: "flex gap-2", children: [
|
|
28800
|
+
/* @__PURE__ */ jsx323(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" }),
|
|
28801
|
+
onRegenerateSecret && /* @__PURE__ */ jsx323(
|
|
28137
28802
|
Button,
|
|
28138
28803
|
{
|
|
28139
28804
|
variant: "outline",
|
|
@@ -28141,50 +28806,50 @@ function OAuthClientDetail({
|
|
|
28141
28806
|
onClick: () => setShowRegenerateConfirm(true),
|
|
28142
28807
|
title: t("oauth.ui.detail.regenerate_secret"),
|
|
28143
28808
|
disabled: isLoading,
|
|
28144
|
-
children: /* @__PURE__ */
|
|
28809
|
+
children: /* @__PURE__ */ jsx323(RefreshCw3, { className: "h-4 w-4" })
|
|
28145
28810
|
}
|
|
28146
28811
|
)
|
|
28147
28812
|
] }),
|
|
28148
|
-
/* @__PURE__ */
|
|
28813
|
+
/* @__PURE__ */ jsx323("p", { className: "text-xs text-muted-foreground", children: t("oauth.ui.detail.regenerate_help") })
|
|
28149
28814
|
] }),
|
|
28150
|
-
/* @__PURE__ */
|
|
28151
|
-
/* @__PURE__ */
|
|
28152
|
-
/* @__PURE__ */
|
|
28153
|
-
/* @__PURE__ */
|
|
28154
|
-
/* @__PURE__ */
|
|
28815
|
+
/* @__PURE__ */ jsx323(Separator, {}),
|
|
28816
|
+
/* @__PURE__ */ jsxs197("div", { className: "space-y-2", children: [
|
|
28817
|
+
/* @__PURE__ */ jsx323(Label, { children: t("oauth.ui.redirect_uris.label") }),
|
|
28818
|
+
/* @__PURE__ */ jsx323("ul", { className: "space-y-1", children: client.redirectUris.map((uri, index) => /* @__PURE__ */ jsxs197("li", { className: "flex items-center gap-2 text-sm tabular-nums", children: [
|
|
28819
|
+
/* @__PURE__ */ jsx323(ExternalLink, { className: "h-3 w-3 text-muted-foreground" }),
|
|
28155
28820
|
uri
|
|
28156
28821
|
] }, index)) })
|
|
28157
28822
|
] }),
|
|
28158
|
-
/* @__PURE__ */
|
|
28159
|
-
/* @__PURE__ */
|
|
28160
|
-
/* @__PURE__ */
|
|
28823
|
+
/* @__PURE__ */ jsxs197("div", { className: "space-y-2", children: [
|
|
28824
|
+
/* @__PURE__ */ jsx323(Label, { children: t("oauth.ui.scope_selector.label") }),
|
|
28825
|
+
/* @__PURE__ */ jsx323("div", { className: "flex flex-wrap gap-2", children: client.allowedScopes.map((scope) => /* @__PURE__ */ jsx323(Badge, { variant: "secondary", children: scopeText(scope).name }, scope)) })
|
|
28161
28826
|
] }),
|
|
28162
|
-
/* @__PURE__ */
|
|
28163
|
-
/* @__PURE__ */
|
|
28164
|
-
/* @__PURE__ */
|
|
28827
|
+
/* @__PURE__ */ jsxs197("div", { className: "space-y-2", children: [
|
|
28828
|
+
/* @__PURE__ */ jsx323(Label, { children: t("oauth.ui.detail.grant_types") }),
|
|
28829
|
+
/* @__PURE__ */ jsx323("div", { className: "flex flex-wrap gap-2", children: client.allowedGrantTypes.map((grant) => /* @__PURE__ */ jsx323(Badge, { variant: "outline", children: grant.replace(/_/g, " ") }, grant)) })
|
|
28165
28830
|
] }),
|
|
28166
|
-
/* @__PURE__ */
|
|
28167
|
-
/* @__PURE__ */
|
|
28168
|
-
/* @__PURE__ */
|
|
28169
|
-
onEdit && /* @__PURE__ */
|
|
28170
|
-
/* @__PURE__ */
|
|
28831
|
+
/* @__PURE__ */ jsx323(Separator, {}),
|
|
28832
|
+
/* @__PURE__ */ jsx323("div", { className: "flex flex-wrap gap-x-6 gap-y-2 text-sm text-muted-foreground", children: /* @__PURE__ */ jsx323("span", { children: t("oauth.ui.detail.created", { date: createdDate }) }) }),
|
|
28833
|
+
/* @__PURE__ */ jsxs197("div", { className: "flex gap-3 pt-4", children: [
|
|
28834
|
+
onEdit && /* @__PURE__ */ jsxs197(Button, { variant: "outline", onClick: onEdit, disabled: isLoading, children: [
|
|
28835
|
+
/* @__PURE__ */ jsx323(Pencil2, { className: "h-4 w-4 me-2" }),
|
|
28171
28836
|
t("ui.buttons.edit")
|
|
28172
28837
|
] }),
|
|
28173
|
-
onDelete && /* @__PURE__ */
|
|
28174
|
-
/* @__PURE__ */
|
|
28838
|
+
onDelete && /* @__PURE__ */ jsxs197(Button, { variant: "destructive", onClick: () => setShowDeleteConfirm(true), disabled: isLoading, children: [
|
|
28839
|
+
/* @__PURE__ */ jsx323(Trash25, { className: "h-4 w-4 me-2" }),
|
|
28175
28840
|
t("ui.buttons.delete")
|
|
28176
28841
|
] })
|
|
28177
28842
|
] })
|
|
28178
28843
|
] })
|
|
28179
28844
|
] }),
|
|
28180
|
-
/* @__PURE__ */
|
|
28181
|
-
/* @__PURE__ */
|
|
28182
|
-
/* @__PURE__ */
|
|
28183
|
-
/* @__PURE__ */
|
|
28845
|
+
/* @__PURE__ */ jsx323(AlertDialog, { open: showDeleteConfirm, onOpenChange: setShowDeleteConfirm, children: /* @__PURE__ */ jsxs197(AlertDialogContent, { children: [
|
|
28846
|
+
/* @__PURE__ */ jsxs197(AlertDialogHeader, { children: [
|
|
28847
|
+
/* @__PURE__ */ jsx323(AlertDialogTitle, { children: t("oauth.settings.delete_title") }),
|
|
28848
|
+
/* @__PURE__ */ jsx323(AlertDialogDescription, { children: t("oauth.settings.delete_description", { name: client.name }) })
|
|
28184
28849
|
] }),
|
|
28185
|
-
/* @__PURE__ */
|
|
28186
|
-
/* @__PURE__ */
|
|
28187
|
-
/* @__PURE__ */
|
|
28850
|
+
/* @__PURE__ */ jsxs197(AlertDialogFooter, { children: [
|
|
28851
|
+
/* @__PURE__ */ jsx323(AlertDialogCancel, { disabled: isDeleting, children: t("ui.buttons.cancel") }),
|
|
28852
|
+
/* @__PURE__ */ jsx323(
|
|
28188
28853
|
AlertDialogAction,
|
|
28189
28854
|
{
|
|
28190
28855
|
onClick: handleDelete,
|
|
@@ -28195,14 +28860,14 @@ function OAuthClientDetail({
|
|
|
28195
28860
|
)
|
|
28196
28861
|
] })
|
|
28197
28862
|
] }) }),
|
|
28198
|
-
/* @__PURE__ */
|
|
28199
|
-
/* @__PURE__ */
|
|
28200
|
-
/* @__PURE__ */
|
|
28201
|
-
/* @__PURE__ */
|
|
28863
|
+
/* @__PURE__ */ jsx323(AlertDialog, { open: showRegenerateConfirm, onOpenChange: setShowRegenerateConfirm, children: /* @__PURE__ */ jsxs197(AlertDialogContent, { children: [
|
|
28864
|
+
/* @__PURE__ */ jsxs197(AlertDialogHeader, { children: [
|
|
28865
|
+
/* @__PURE__ */ jsx323(AlertDialogTitle, { children: t("oauth.ui.detail.regenerate_title") }),
|
|
28866
|
+
/* @__PURE__ */ jsx323(AlertDialogDescription, { children: t("oauth.ui.detail.regenerate_description") })
|
|
28202
28867
|
] }),
|
|
28203
|
-
/* @__PURE__ */
|
|
28204
|
-
/* @__PURE__ */
|
|
28205
|
-
/* @__PURE__ */
|
|
28868
|
+
/* @__PURE__ */ jsxs197(AlertDialogFooter, { children: [
|
|
28869
|
+
/* @__PURE__ */ jsx323(AlertDialogCancel, { disabled: isRegenerating, children: t("ui.buttons.cancel") }),
|
|
28870
|
+
/* @__PURE__ */ jsx323(AlertDialogAction, { onClick: handleRegenerateSecret, disabled: isRegenerating, children: isRegenerating ? t("oauth.ui.detail.regenerating") : t("oauth.ui.detail.regenerate") })
|
|
28206
28871
|
] })
|
|
28207
28872
|
] }) })
|
|
28208
28873
|
] });
|
|
@@ -28211,24 +28876,24 @@ __name(OAuthClientDetail, "OAuthClientDetail");
|
|
|
28211
28876
|
|
|
28212
28877
|
// src/features/oauth/components/consent/OAuthConsentHeader.tsx
|
|
28213
28878
|
import { Shield } from "lucide-react";
|
|
28214
|
-
import { useTranslations as
|
|
28215
|
-
import { jsx as
|
|
28879
|
+
import { useTranslations as useTranslations184 } from "next-intl";
|
|
28880
|
+
import { jsx as jsx324, jsxs as jsxs198 } from "react/jsx-runtime";
|
|
28216
28881
|
function OAuthConsentHeader({ client, logoUrl, appName }) {
|
|
28217
|
-
const t =
|
|
28218
|
-
return /* @__PURE__ */
|
|
28219
|
-
/* @__PURE__ */
|
|
28220
|
-
/* @__PURE__ */
|
|
28221
|
-
/* @__PURE__ */
|
|
28222
|
-
/* @__PURE__ */
|
|
28882
|
+
const t = useTranslations184();
|
|
28883
|
+
return /* @__PURE__ */ jsxs198("div", { className: "text-center space-y-4", children: [
|
|
28884
|
+
/* @__PURE__ */ jsx324("div", { className: "flex justify-center", children: logoUrl ? /* @__PURE__ */ jsx324("img", { src: logoUrl, alt: appName, className: "h-12 w-auto" }) : /* @__PURE__ */ jsx324("div", { className: "h-12 w-12 rounded-full bg-primary flex items-center justify-center", children: /* @__PURE__ */ jsx324(Shield, { className: "h-6 w-6 text-primary-foreground" }) }) }),
|
|
28885
|
+
/* @__PURE__ */ jsxs198("div", { className: "space-y-2", children: [
|
|
28886
|
+
/* @__PURE__ */ jsx324(ContentTitle, { element: t("oauth.consent.title", { client: client.name }), className: "mb-0 justify-center" }),
|
|
28887
|
+
/* @__PURE__ */ jsx324("p", { className: "text-muted-foreground text-sm", children: t("oauth.consent.wants_access", { client: client.name, appName }) })
|
|
28223
28888
|
] })
|
|
28224
28889
|
] });
|
|
28225
28890
|
}
|
|
28226
28891
|
__name(OAuthConsentHeader, "OAuthConsentHeader");
|
|
28227
28892
|
|
|
28228
28893
|
// src/features/oauth/components/consent/OAuthScopeList.tsx
|
|
28229
|
-
import { useTranslations as
|
|
28894
|
+
import { useTranslations as useTranslations185 } from "next-intl";
|
|
28230
28895
|
import { Eye, Pencil as Pencil3, Image as Image15, Upload, Film, FolderPlus, User, Shield as Shield2 } from "lucide-react";
|
|
28231
|
-
import { jsx as
|
|
28896
|
+
import { jsx as jsx325, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
28232
28897
|
var SCOPE_ICONS = {
|
|
28233
28898
|
eye: Eye,
|
|
28234
28899
|
pencil: Pencil3,
|
|
@@ -28240,20 +28905,20 @@ var SCOPE_ICONS = {
|
|
|
28240
28905
|
shield: Shield2
|
|
28241
28906
|
};
|
|
28242
28907
|
function OAuthScopeList({ scopes }) {
|
|
28243
|
-
const t =
|
|
28908
|
+
const t = useTranslations185();
|
|
28244
28909
|
const scopeText = useOAuthScopeText();
|
|
28245
28910
|
if (scopes.length === 0) {
|
|
28246
28911
|
return null;
|
|
28247
28912
|
}
|
|
28248
|
-
return /* @__PURE__ */
|
|
28249
|
-
/* @__PURE__ */
|
|
28250
|
-
/* @__PURE__ */
|
|
28913
|
+
return /* @__PURE__ */ jsxs199("div", { className: "space-y-3", children: [
|
|
28914
|
+
/* @__PURE__ */ jsx325(MicroLabel, { as: "h3", children: t("oauth.consent.scopes_heading") }),
|
|
28915
|
+
/* @__PURE__ */ jsx325("ul", { className: "space-y-3", children: scopes.map((scope) => {
|
|
28251
28916
|
const IconComponent = scope.icon ? SCOPE_ICONS[scope.icon] : Eye;
|
|
28252
|
-
return /* @__PURE__ */
|
|
28253
|
-
/* @__PURE__ */
|
|
28254
|
-
/* @__PURE__ */
|
|
28255
|
-
/* @__PURE__ */
|
|
28256
|
-
/* @__PURE__ */
|
|
28917
|
+
return /* @__PURE__ */ jsxs199("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
28918
|
+
/* @__PURE__ */ jsx325("div", { className: "flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsx325("div", { className: "h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center", children: IconComponent && /* @__PURE__ */ jsx325(IconComponent, { className: "h-4 w-4 text-primary" }) }) }),
|
|
28919
|
+
/* @__PURE__ */ jsxs199("div", { className: "flex-1", children: [
|
|
28920
|
+
/* @__PURE__ */ jsx325("p", { className: "font-medium", children: scopeText(scope).name }),
|
|
28921
|
+
/* @__PURE__ */ jsx325("p", { className: "text-sm text-muted-foreground", children: scopeText(scope).description })
|
|
28257
28922
|
] })
|
|
28258
28923
|
] }, scope.scope);
|
|
28259
28924
|
}) })
|
|
@@ -28262,35 +28927,35 @@ function OAuthScopeList({ scopes }) {
|
|
|
28262
28927
|
__name(OAuthScopeList, "OAuthScopeList");
|
|
28263
28928
|
|
|
28264
28929
|
// src/features/oauth/components/consent/OAuthConsentActions.tsx
|
|
28265
|
-
import { useTranslations as
|
|
28266
|
-
import { jsx as
|
|
28930
|
+
import { useTranslations as useTranslations186 } from "next-intl";
|
|
28931
|
+
import { jsx as jsx326, jsxs as jsxs200 } from "react/jsx-runtime";
|
|
28267
28932
|
function OAuthConsentActions({ onApprove, onDeny, isLoading = false }) {
|
|
28268
|
-
const t =
|
|
28269
|
-
return /* @__PURE__ */
|
|
28270
|
-
/* @__PURE__ */
|
|
28271
|
-
/* @__PURE__ */
|
|
28933
|
+
const t = useTranslations186();
|
|
28934
|
+
return /* @__PURE__ */ jsxs200("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
28935
|
+
/* @__PURE__ */ jsx326(Button, { variant: "outline", onClick: onDeny, disabled: isLoading, className: "flex-1", children: t("oauth.consent.deny") }),
|
|
28936
|
+
/* @__PURE__ */ jsx326(Button, { onClick: onApprove, disabled: isLoading, className: "flex-1", children: isLoading ? t("oauth.consent.authorizing") : t("oauth.consent.authorize") })
|
|
28272
28937
|
] });
|
|
28273
28938
|
}
|
|
28274
28939
|
__name(OAuthConsentActions, "OAuthConsentActions");
|
|
28275
28940
|
|
|
28276
28941
|
// src/features/oauth/components/consent/OAuthConsentScreen.tsx
|
|
28277
28942
|
import { ExternalLink as ExternalLink2, AlertTriangle as AlertTriangle2, Loader2 as Loader28 } from "lucide-react";
|
|
28278
|
-
import { useTranslations as
|
|
28943
|
+
import { useTranslations as useTranslations188 } from "next-intl";
|
|
28279
28944
|
|
|
28280
28945
|
// src/features/oauth/components/consent/OAuthCompanySelector.tsx
|
|
28281
|
-
import { useTranslations as
|
|
28282
|
-
import { useMemo as
|
|
28283
|
-
import { jsx as
|
|
28946
|
+
import { useTranslations as useTranslations187 } from "next-intl";
|
|
28947
|
+
import { useMemo as useMemo68 } from "react";
|
|
28948
|
+
import { jsx as jsx327, jsxs as jsxs201 } from "react/jsx-runtime";
|
|
28284
28949
|
function OAuthCompanySelector({ companies, value, onChange }) {
|
|
28285
|
-
const t =
|
|
28286
|
-
const items =
|
|
28950
|
+
const t = useTranslations187();
|
|
28951
|
+
const items = useMemo68(
|
|
28287
28952
|
() => Object.fromEntries(companies.map((company) => [company.id, company.name])),
|
|
28288
28953
|
[companies]
|
|
28289
28954
|
);
|
|
28290
28955
|
if (companies.length <= 1) return null;
|
|
28291
|
-
return /* @__PURE__ */
|
|
28292
|
-
/* @__PURE__ */
|
|
28293
|
-
/* @__PURE__ */
|
|
28956
|
+
return /* @__PURE__ */ jsxs201("div", { className: "space-y-3", children: [
|
|
28957
|
+
/* @__PURE__ */ jsx327(MicroLabel, { as: "h3", children: t("oauth.consent.company_label") }),
|
|
28958
|
+
/* @__PURE__ */ jsxs201(
|
|
28294
28959
|
Select,
|
|
28295
28960
|
{
|
|
28296
28961
|
items,
|
|
@@ -28299,8 +28964,8 @@ function OAuthCompanySelector({ companies, value, onChange }) {
|
|
|
28299
28964
|
if (selected) onChange(String(selected));
|
|
28300
28965
|
},
|
|
28301
28966
|
children: [
|
|
28302
|
-
/* @__PURE__ */
|
|
28303
|
-
/* @__PURE__ */
|
|
28967
|
+
/* @__PURE__ */ jsx327(SelectTrigger, { className: "w-full", "aria-label": t("oauth.consent.company_label"), children: /* @__PURE__ */ jsx327(SelectValue, { placeholder: t("oauth.consent.company_label") }) }),
|
|
28968
|
+
/* @__PURE__ */ jsx327(SelectContent, { children: companies.map((company) => /* @__PURE__ */ jsx327(SelectItem, { value: company.id, children: company.name }, company.id)) })
|
|
28304
28969
|
]
|
|
28305
28970
|
}
|
|
28306
28971
|
)
|
|
@@ -28309,7 +28974,7 @@ function OAuthCompanySelector({ companies, value, onChange }) {
|
|
|
28309
28974
|
__name(OAuthCompanySelector, "OAuthCompanySelector");
|
|
28310
28975
|
|
|
28311
28976
|
// src/features/oauth/components/consent/OAuthConsentScreen.tsx
|
|
28312
|
-
import { Fragment as Fragment67, jsx as
|
|
28977
|
+
import { Fragment as Fragment67, jsx as jsx328, jsxs as jsxs202 } from "react/jsx-runtime";
|
|
28313
28978
|
function OAuthConsentScreen({
|
|
28314
28979
|
params,
|
|
28315
28980
|
logoUrl,
|
|
@@ -28318,52 +28983,52 @@ function OAuthConsentScreen({
|
|
|
28318
28983
|
privacyUrl = "/privacy",
|
|
28319
28984
|
defaultCompanyId
|
|
28320
28985
|
}) {
|
|
28321
|
-
const t =
|
|
28986
|
+
const t = useTranslations188();
|
|
28322
28987
|
const { clientInfo, isLoading, error, approve, deny, isSubmitting, companyId, setCompanyId } = useOAuthConsent(
|
|
28323
28988
|
params,
|
|
28324
28989
|
{ defaultCompanyId }
|
|
28325
28990
|
);
|
|
28326
28991
|
if (isLoading) {
|
|
28327
|
-
return /* @__PURE__ */
|
|
28328
|
-
/* @__PURE__ */
|
|
28329
|
-
/* @__PURE__ */
|
|
28992
|
+
return /* @__PURE__ */ jsx328("div", { className: "min-h-dvh flex items-center justify-center p-4", children: /* @__PURE__ */ jsx328(Card, { className: "w-full max-w-md", children: /* @__PURE__ */ jsxs202(CardContent, { className: "flex flex-col items-center justify-center py-12", children: [
|
|
28993
|
+
/* @__PURE__ */ jsx328(Loader28, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
|
|
28994
|
+
/* @__PURE__ */ jsx328("p", { className: "mt-4 text-muted-foreground text-sm", children: t("oauth.consent.loading") })
|
|
28330
28995
|
] }) }) });
|
|
28331
28996
|
}
|
|
28332
28997
|
if (error || !clientInfo) {
|
|
28333
|
-
return /* @__PURE__ */
|
|
28334
|
-
/* @__PURE__ */
|
|
28335
|
-
/* @__PURE__ */
|
|
28998
|
+
return /* @__PURE__ */ jsx328("div", { className: "min-h-dvh flex items-center justify-center p-4", children: /* @__PURE__ */ jsx328(Card, { className: "w-full max-w-md", children: /* @__PURE__ */ jsx328(CardContent, { className: "py-8", children: /* @__PURE__ */ jsxs202(Alert, { variant: "destructive", children: [
|
|
28999
|
+
/* @__PURE__ */ jsx328(AlertTriangle2, { className: "h-4 w-4" }),
|
|
29000
|
+
/* @__PURE__ */ jsx328(AlertDescription, { children: error?.message || t("oauth.consent.invalid_request") })
|
|
28336
29001
|
] }) }) }) });
|
|
28337
29002
|
}
|
|
28338
29003
|
const { client, scopes } = clientInfo;
|
|
28339
29004
|
const companies = clientInfo.companies ?? [];
|
|
28340
|
-
return /* @__PURE__ */
|
|
28341
|
-
/* @__PURE__ */
|
|
28342
|
-
/* @__PURE__ */
|
|
28343
|
-
/* @__PURE__ */
|
|
28344
|
-
/* @__PURE__ */
|
|
28345
|
-
/* @__PURE__ */
|
|
28346
|
-
companies.length > 1 && /* @__PURE__ */
|
|
28347
|
-
/* @__PURE__ */
|
|
28348
|
-
/* @__PURE__ */
|
|
29005
|
+
return /* @__PURE__ */ jsx328("div", { className: "min-h-dvh flex items-center justify-center p-4 bg-muted/30", children: /* @__PURE__ */ jsxs202(Card, { className: "w-full max-w-md", children: [
|
|
29006
|
+
/* @__PURE__ */ jsxs202(CardContent, { className: "pt-6 space-y-6", children: [
|
|
29007
|
+
/* @__PURE__ */ jsx328(OAuthConsentHeader, { client, logoUrl, appName }),
|
|
29008
|
+
/* @__PURE__ */ jsx328(Separator, {}),
|
|
29009
|
+
/* @__PURE__ */ jsx328(OAuthScopeList, { scopes }),
|
|
29010
|
+
/* @__PURE__ */ jsx328(Separator, {}),
|
|
29011
|
+
companies.length > 1 && /* @__PURE__ */ jsxs202(Fragment67, { children: [
|
|
29012
|
+
/* @__PURE__ */ jsx328(OAuthCompanySelector, { companies, value: companyId, onChange: setCompanyId }),
|
|
29013
|
+
/* @__PURE__ */ jsx328(Separator, {})
|
|
28349
29014
|
] }),
|
|
28350
|
-
/* @__PURE__ */
|
|
28351
|
-
/* @__PURE__ */
|
|
28352
|
-
/* @__PURE__ */
|
|
28353
|
-
/* @__PURE__ */
|
|
28354
|
-
/* @__PURE__ */
|
|
29015
|
+
/* @__PURE__ */ jsxs202("div", { className: "flex items-start gap-2 text-sm text-muted-foreground", children: [
|
|
29016
|
+
/* @__PURE__ */ jsx328(ExternalLink2, { className: "h-4 w-4 mt-0.5 flex-shrink-0" }),
|
|
29017
|
+
/* @__PURE__ */ jsxs202("div", { children: [
|
|
29018
|
+
/* @__PURE__ */ jsx328("span", { children: t("oauth.consent.redirect_notice") }),
|
|
29019
|
+
/* @__PURE__ */ jsx328("p", { className: "tabular-nums text-xs mt-1 break-all", children: params.redirectUri })
|
|
28355
29020
|
] })
|
|
28356
29021
|
] }),
|
|
28357
|
-
/* @__PURE__ */
|
|
29022
|
+
/* @__PURE__ */ jsx328(OAuthConsentActions, { onApprove: approve, onDeny: deny, isLoading: isSubmitting })
|
|
28358
29023
|
] }),
|
|
28359
|
-
/* @__PURE__ */
|
|
29024
|
+
/* @__PURE__ */ jsx328(CardFooter, { className: "justify-center", children: /* @__PURE__ */ jsxs202("p", { className: "text-xs text-center text-muted-foreground", children: [
|
|
28360
29025
|
t("oauth.consent.agreement"),
|
|
28361
29026
|
" ",
|
|
28362
|
-
/* @__PURE__ */
|
|
29027
|
+
/* @__PURE__ */ jsx328("a", { href: termsUrl, className: "hover:text-foreground", target: "_blank", rel: "noopener", children: t("oauth.consent.terms") }),
|
|
28363
29028
|
" ",
|
|
28364
29029
|
t("oauth.consent.and"),
|
|
28365
29030
|
" ",
|
|
28366
|
-
/* @__PURE__ */
|
|
29031
|
+
/* @__PURE__ */ jsx328("a", { href: privacyUrl, className: "hover:text-foreground", target: "_blank", rel: "noopener", children: t("oauth.consent.privacy") }),
|
|
28367
29032
|
"."
|
|
28368
29033
|
] }) })
|
|
28369
29034
|
] }) });
|
|
@@ -28373,14 +29038,14 @@ __name(OAuthConsentScreen, "OAuthConsentScreen");
|
|
|
28373
29038
|
// src/features/waitlist/components/forms/WaitlistForm.tsx
|
|
28374
29039
|
import { zodResolver as zodResolver13 } from "@hookform/resolvers/zod";
|
|
28375
29040
|
import { CheckCircle as CheckCircle2, Mail as Mail2 } from "lucide-react";
|
|
28376
|
-
import { useTranslations as
|
|
28377
|
-
import { useState as
|
|
29041
|
+
import { useTranslations as useTranslations189 } from "next-intl";
|
|
29042
|
+
import { useState as useState127 } from "react";
|
|
28378
29043
|
import { useForm as useForm13 } from "react-hook-form";
|
|
28379
29044
|
import { v4 as v415 } from "uuid";
|
|
28380
29045
|
import { z as z14 } from "zod";
|
|
28381
29046
|
|
|
28382
29047
|
// src/features/waitlist/components/forms/WaitlistQuestionnaireRenderer.tsx
|
|
28383
|
-
import { jsx as
|
|
29048
|
+
import { jsx as jsx329, jsxs as jsxs203 } from "react/jsx-runtime";
|
|
28384
29049
|
function WaitlistQuestionnaireRenderer({
|
|
28385
29050
|
form,
|
|
28386
29051
|
fields,
|
|
@@ -28390,11 +29055,11 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28390
29055
|
if (!fields || fields.length === 0) {
|
|
28391
29056
|
return null;
|
|
28392
29057
|
}
|
|
28393
|
-
return /* @__PURE__ */
|
|
29058
|
+
return /* @__PURE__ */ jsx329("div", { className: "space-y-4", children: fields.map((field) => {
|
|
28394
29059
|
const fieldId = `${fieldPrefix}.${field.id}`;
|
|
28395
29060
|
switch (field.type) {
|
|
28396
29061
|
case "text":
|
|
28397
|
-
return /* @__PURE__ */
|
|
29062
|
+
return /* @__PURE__ */ jsx329(
|
|
28398
29063
|
FormInput,
|
|
28399
29064
|
{
|
|
28400
29065
|
form,
|
|
@@ -28406,7 +29071,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28406
29071
|
field.id
|
|
28407
29072
|
);
|
|
28408
29073
|
case "textarea":
|
|
28409
|
-
return /* @__PURE__ */
|
|
29074
|
+
return /* @__PURE__ */ jsx329(
|
|
28410
29075
|
FormTextarea,
|
|
28411
29076
|
{
|
|
28412
29077
|
form,
|
|
@@ -28421,7 +29086,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28421
29086
|
if (!field.options || field.options.length === 0) {
|
|
28422
29087
|
return null;
|
|
28423
29088
|
}
|
|
28424
|
-
return /* @__PURE__ */
|
|
29089
|
+
return /* @__PURE__ */ jsx329(
|
|
28425
29090
|
FormSelect,
|
|
28426
29091
|
{
|
|
28427
29092
|
form,
|
|
@@ -28436,7 +29101,7 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28436
29101
|
);
|
|
28437
29102
|
case "checkbox":
|
|
28438
29103
|
if (!field.options || field.options.length === 0) {
|
|
28439
|
-
return /* @__PURE__ */
|
|
29104
|
+
return /* @__PURE__ */ jsx329(
|
|
28440
29105
|
FormCheckbox,
|
|
28441
29106
|
{
|
|
28442
29107
|
form,
|
|
@@ -28448,13 +29113,13 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28448
29113
|
field.id
|
|
28449
29114
|
);
|
|
28450
29115
|
}
|
|
28451
|
-
return /* @__PURE__ */
|
|
28452
|
-
/* @__PURE__ */
|
|
29116
|
+
return /* @__PURE__ */ jsxs203("div", { className: "space-y-2", children: [
|
|
29117
|
+
/* @__PURE__ */ jsxs203("span", { className: "text-sm font-medium", children: [
|
|
28453
29118
|
text(field.label) ?? field.label,
|
|
28454
|
-
field.required && /* @__PURE__ */
|
|
29119
|
+
field.required && /* @__PURE__ */ jsx329("span", { className: "ms-1 text-destructive", children: "*" })
|
|
28455
29120
|
] }),
|
|
28456
|
-
field.description && /* @__PURE__ */
|
|
28457
|
-
/* @__PURE__ */
|
|
29121
|
+
field.description && /* @__PURE__ */ jsx329("p", { className: "text-muted-foreground text-xs", children: text(field.description) }),
|
|
29122
|
+
/* @__PURE__ */ jsx329("div", { className: "space-y-2", children: field.options.map((option) => /* @__PURE__ */ jsx329(
|
|
28458
29123
|
FormCheckbox,
|
|
28459
29124
|
{
|
|
28460
29125
|
form,
|
|
@@ -28473,11 +29138,11 @@ function WaitlistQuestionnaireRenderer({
|
|
|
28473
29138
|
__name(WaitlistQuestionnaireRenderer, "WaitlistQuestionnaireRenderer");
|
|
28474
29139
|
|
|
28475
29140
|
// src/features/waitlist/components/forms/WaitlistForm.tsx
|
|
28476
|
-
import { Fragment as Fragment68, jsx as
|
|
29141
|
+
import { Fragment as Fragment68, jsx as jsx330, jsxs as jsxs204 } from "react/jsx-runtime";
|
|
28477
29142
|
function WaitlistForm({ onSuccess }) {
|
|
28478
|
-
const t =
|
|
28479
|
-
const [isSubmitting, setIsSubmitting] =
|
|
28480
|
-
const [isSuccess, setIsSuccess] =
|
|
29143
|
+
const t = useTranslations189();
|
|
29144
|
+
const [isSubmitting, setIsSubmitting] = useState127(false);
|
|
29145
|
+
const [isSuccess, setIsSuccess] = useState127(false);
|
|
28481
29146
|
const config = getWaitlistConfig();
|
|
28482
29147
|
const questionnaireFields = config.questionnaire ?? [];
|
|
28483
29148
|
const questionnaireSchema = questionnaireFields.reduce(
|
|
@@ -28563,20 +29228,20 @@ function WaitlistForm({ onSuccess }) {
|
|
|
28563
29228
|
}
|
|
28564
29229
|
}, "onSubmit");
|
|
28565
29230
|
if (isSuccess) {
|
|
28566
|
-
return /* @__PURE__ */
|
|
28567
|
-
/* @__PURE__ */
|
|
28568
|
-
/* @__PURE__ */
|
|
28569
|
-
/* @__PURE__ */
|
|
28570
|
-
/* @__PURE__ */
|
|
29231
|
+
return /* @__PURE__ */ jsxs204("div", { className: "space-y-6 text-center", children: [
|
|
29232
|
+
/* @__PURE__ */ jsx330("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-green-100", children: /* @__PURE__ */ jsx330(CheckCircle2, { className: "text-success h-8 w-8" }) }),
|
|
29233
|
+
/* @__PURE__ */ jsxs204("div", { className: "space-y-2", children: [
|
|
29234
|
+
/* @__PURE__ */ jsx330(SectionHeader, { children: t("waitlist.success.title") }),
|
|
29235
|
+
/* @__PURE__ */ jsx330("p", { className: "text-muted-foreground", children: t("waitlist.success.description") })
|
|
28571
29236
|
] }),
|
|
28572
|
-
/* @__PURE__ */
|
|
28573
|
-
/* @__PURE__ */
|
|
28574
|
-
/* @__PURE__ */
|
|
29237
|
+
/* @__PURE__ */ jsxs204("div", { className: "flex items-center justify-center gap-2 text-muted-foreground text-sm", children: [
|
|
29238
|
+
/* @__PURE__ */ jsx330(Mail2, { className: "h-4 w-4" }),
|
|
29239
|
+
/* @__PURE__ */ jsx330("span", { children: t("waitlist.success.hint") })
|
|
28575
29240
|
] })
|
|
28576
29241
|
] });
|
|
28577
29242
|
}
|
|
28578
|
-
return /* @__PURE__ */
|
|
28579
|
-
/* @__PURE__ */
|
|
29243
|
+
return /* @__PURE__ */ jsx330(Form, { ...form, children: /* @__PURE__ */ jsxs204("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
29244
|
+
/* @__PURE__ */ jsx330(
|
|
28580
29245
|
FormInput,
|
|
28581
29246
|
{
|
|
28582
29247
|
isRequired: true,
|
|
@@ -28586,23 +29251,23 @@ function WaitlistForm({ onSuccess }) {
|
|
|
28586
29251
|
placeholder: t("common.fields.email.placeholder")
|
|
28587
29252
|
}
|
|
28588
29253
|
),
|
|
28589
|
-
questionnaireFields.length > 0 && /* @__PURE__ */
|
|
28590
|
-
/* @__PURE__ */
|
|
28591
|
-
/* @__PURE__ */
|
|
29254
|
+
questionnaireFields.length > 0 && /* @__PURE__ */ jsx330(WaitlistQuestionnaireRenderer, { form, fields: questionnaireFields }),
|
|
29255
|
+
/* @__PURE__ */ jsxs204("div", { className: "space-y-4 py-4", children: [
|
|
29256
|
+
/* @__PURE__ */ jsx330(
|
|
28592
29257
|
GdprConsentCheckbox,
|
|
28593
29258
|
{
|
|
28594
29259
|
form,
|
|
28595
29260
|
id: "gdprConsent",
|
|
28596
|
-
label: /* @__PURE__ */
|
|
29261
|
+
label: /* @__PURE__ */ jsxs204(Fragment68, { children: [
|
|
28597
29262
|
t("auth.gdpr.terms_prefix"),
|
|
28598
|
-
/* @__PURE__ */
|
|
29263
|
+
/* @__PURE__ */ jsx330(Link, { href: "/terms", target: "_blank", rel: "noopener", children: t("auth.gdpr.terms_of_service") }),
|
|
28599
29264
|
t("auth.gdpr.and"),
|
|
28600
|
-
/* @__PURE__ */
|
|
29265
|
+
/* @__PURE__ */ jsx330(Link, { href: "/privacy", target: "_blank", rel: "noopener", children: t("auth.gdpr.privacy_policy") })
|
|
28601
29266
|
] }),
|
|
28602
29267
|
required: true
|
|
28603
29268
|
}
|
|
28604
29269
|
),
|
|
28605
|
-
/* @__PURE__ */
|
|
29270
|
+
/* @__PURE__ */ jsx330(
|
|
28606
29271
|
GdprConsentCheckbox,
|
|
28607
29272
|
{
|
|
28608
29273
|
form,
|
|
@@ -28612,59 +29277,59 @@ function WaitlistForm({ onSuccess }) {
|
|
|
28612
29277
|
}
|
|
28613
29278
|
)
|
|
28614
29279
|
] }),
|
|
28615
|
-
/* @__PURE__ */
|
|
29280
|
+
/* @__PURE__ */ jsx330(Button, { type: "submit", className: "w-full", disabled: isSubmitting, children: isSubmitting ? t("common.actions.submitting") : t("waitlist.buttons.join") })
|
|
28616
29281
|
] }) });
|
|
28617
29282
|
}
|
|
28618
29283
|
__name(WaitlistForm, "WaitlistForm");
|
|
28619
29284
|
|
|
28620
29285
|
// src/features/waitlist/components/sections/WaitlistHeroSection.tsx
|
|
28621
29286
|
import { CheckCircle as CheckCircle3 } from "lucide-react";
|
|
28622
|
-
import { jsx as
|
|
29287
|
+
import { jsx as jsx331, jsxs as jsxs205 } from "react/jsx-runtime";
|
|
28623
29288
|
function WaitlistHeroSection() {
|
|
28624
29289
|
const config = getWaitlistConfig();
|
|
28625
29290
|
const text = useWaitlistText();
|
|
28626
|
-
return /* @__PURE__ */
|
|
28627
|
-
/* @__PURE__ */
|
|
28628
|
-
/* @__PURE__ */
|
|
28629
|
-
config.heroTitle && /* @__PURE__ */
|
|
28630
|
-
config.heroSubtitle && /* @__PURE__ */
|
|
28631
|
-
config.heroDescription && /* @__PURE__ */
|
|
29291
|
+
return /* @__PURE__ */ jsx331("section", { className: "relative overflow-hidden py-16 md:py-24", children: /* @__PURE__ */ jsx331("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxs205("div", { className: "grid gap-12 lg:grid-cols-2 lg:items-center", children: [
|
|
29292
|
+
/* @__PURE__ */ jsxs205("div", { className: "space-y-8", children: [
|
|
29293
|
+
/* @__PURE__ */ jsxs205("div", { className: "space-y-4", children: [
|
|
29294
|
+
config.heroTitle && /* @__PURE__ */ jsx331("h1", { className: "text-4xl font-bold tracking-tight md:text-5xl lg:text-6xl", children: text(config.heroTitle) }),
|
|
29295
|
+
config.heroSubtitle && /* @__PURE__ */ jsx331("p", { className: "text-muted-foreground text-xl md:text-2xl", children: text(config.heroSubtitle) }),
|
|
29296
|
+
config.heroDescription && /* @__PURE__ */ jsx331("p", { className: "text-muted-foreground", children: text(config.heroDescription) })
|
|
28632
29297
|
] }),
|
|
28633
|
-
config.benefits && config.benefits.length > 0 && /* @__PURE__ */
|
|
28634
|
-
/* @__PURE__ */
|
|
28635
|
-
/* @__PURE__ */
|
|
29298
|
+
config.benefits && config.benefits.length > 0 && /* @__PURE__ */ jsx331("ul", { className: "space-y-3", children: config.benefits.map((benefit, index) => /* @__PURE__ */ jsxs205("li", { className: "flex items-start gap-3", children: [
|
|
29299
|
+
/* @__PURE__ */ jsx331(CheckCircle3, { className: "text-primary mt-0.5 h-5 w-5 shrink-0" }),
|
|
29300
|
+
/* @__PURE__ */ jsx331("span", { children: text(benefit) })
|
|
28636
29301
|
] }, index)) })
|
|
28637
29302
|
] }),
|
|
28638
|
-
/* @__PURE__ */
|
|
29303
|
+
/* @__PURE__ */ jsx331("div", { className: "lg:pl-8", children: /* @__PURE__ */ jsx331("div", { className: "bg-card rounded-lg border p-6 shadow-lg md:p-8", children: /* @__PURE__ */ jsx331(WaitlistForm, {}) }) })
|
|
28639
29304
|
] }) }) });
|
|
28640
29305
|
}
|
|
28641
29306
|
__name(WaitlistHeroSection, "WaitlistHeroSection");
|
|
28642
29307
|
|
|
28643
29308
|
// src/features/waitlist/components/sections/WaitlistSuccessState.tsx
|
|
28644
29309
|
import { CheckCircle as CheckCircle4 } from "lucide-react";
|
|
28645
|
-
import { useTranslations as
|
|
28646
|
-
import { jsx as
|
|
29310
|
+
import { useTranslations as useTranslations190 } from "next-intl";
|
|
29311
|
+
import { jsx as jsx332, jsxs as jsxs206 } from "react/jsx-runtime";
|
|
28647
29312
|
function WaitlistSuccessState() {
|
|
28648
|
-
const t =
|
|
28649
|
-
return /* @__PURE__ */
|
|
28650
|
-
/* @__PURE__ */
|
|
28651
|
-
/* @__PURE__ */
|
|
28652
|
-
/* @__PURE__ */
|
|
28653
|
-
/* @__PURE__ */
|
|
29313
|
+
const t = useTranslations190();
|
|
29314
|
+
return /* @__PURE__ */ jsxs206("div", { className: "flex flex-col items-center justify-center space-y-4 py-8 text-center", children: [
|
|
29315
|
+
/* @__PURE__ */ jsx332("div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ jsx332(CheckCircle4, { className: "text-primary h-12 w-12" }) }),
|
|
29316
|
+
/* @__PURE__ */ jsx332(SectionHeader, { level: 2, children: t("waitlist.success.title") }),
|
|
29317
|
+
/* @__PURE__ */ jsx332("p", { className: "text-muted-foreground max-w-md", children: t("waitlist.success.description") }),
|
|
29318
|
+
/* @__PURE__ */ jsx332("p", { className: "text-muted-foreground text-sm", children: t("waitlist.success.hint") })
|
|
28654
29319
|
] });
|
|
28655
29320
|
}
|
|
28656
29321
|
__name(WaitlistSuccessState, "WaitlistSuccessState");
|
|
28657
29322
|
|
|
28658
29323
|
// src/features/waitlist/components/sections/WaitlistConfirmation.tsx
|
|
28659
29324
|
import { CheckCircle as CheckCircle5, Loader2 as Loader29, XCircle as XCircle3 } from "lucide-react";
|
|
28660
|
-
import { useTranslations as
|
|
28661
|
-
import { useEffect as
|
|
28662
|
-
import { jsx as
|
|
29325
|
+
import { useTranslations as useTranslations191 } from "next-intl";
|
|
29326
|
+
import { useEffect as useEffect92, useState as useState128 } from "react";
|
|
29327
|
+
import { jsx as jsx333, jsxs as jsxs207 } from "react/jsx-runtime";
|
|
28663
29328
|
function WaitlistConfirmation({ code }) {
|
|
28664
|
-
const t =
|
|
28665
|
-
const [state, setState] =
|
|
28666
|
-
const [errorMessage, setErrorMessage] =
|
|
28667
|
-
|
|
29329
|
+
const t = useTranslations191();
|
|
29330
|
+
const [state, setState] = useState128("loading");
|
|
29331
|
+
const [errorMessage, setErrorMessage] = useState128("");
|
|
29332
|
+
useEffect92(() => {
|
|
28668
29333
|
async function confirmEmail() {
|
|
28669
29334
|
try {
|
|
28670
29335
|
await WaitlistService.confirm(code);
|
|
@@ -28678,37 +29343,37 @@ function WaitlistConfirmation({ code }) {
|
|
|
28678
29343
|
confirmEmail();
|
|
28679
29344
|
}, [code, t]);
|
|
28680
29345
|
if (state === "loading") {
|
|
28681
|
-
return /* @__PURE__ */
|
|
28682
|
-
/* @__PURE__ */
|
|
28683
|
-
/* @__PURE__ */
|
|
29346
|
+
return /* @__PURE__ */ jsxs207("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
29347
|
+
/* @__PURE__ */ jsx333(Loader29, { className: "text-primary h-12 w-12 animate-spin" }),
|
|
29348
|
+
/* @__PURE__ */ jsx333("p", { className: "text-muted-foreground", children: t("waitlist.confirmation.loading") })
|
|
28684
29349
|
] });
|
|
28685
29350
|
}
|
|
28686
29351
|
if (state === "error") {
|
|
28687
|
-
return /* @__PURE__ */
|
|
28688
|
-
/* @__PURE__ */
|
|
28689
|
-
/* @__PURE__ */
|
|
28690
|
-
/* @__PURE__ */
|
|
28691
|
-
/* @__PURE__ */
|
|
29352
|
+
return /* @__PURE__ */ jsxs207("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
29353
|
+
/* @__PURE__ */ jsx333("div", { className: "bg-destructive/10 rounded-full p-4", children: /* @__PURE__ */ jsx333(XCircle3, { className: "text-destructive h-12 w-12" }) }),
|
|
29354
|
+
/* @__PURE__ */ jsx333(SectionHeader, { level: 2, children: t("waitlist.confirmation.error_title") }),
|
|
29355
|
+
/* @__PURE__ */ jsx333("p", { className: "text-muted-foreground max-w-md", children: errorMessage }),
|
|
29356
|
+
/* @__PURE__ */ jsx333(Link, { href: "/waitlist", className: buttonVariants({ variant: "outline" }), children: t("waitlist.buttons.return") })
|
|
28692
29357
|
] });
|
|
28693
29358
|
}
|
|
28694
|
-
return /* @__PURE__ */
|
|
28695
|
-
/* @__PURE__ */
|
|
28696
|
-
/* @__PURE__ */
|
|
28697
|
-
/* @__PURE__ */
|
|
28698
|
-
/* @__PURE__ */
|
|
29359
|
+
return /* @__PURE__ */ jsxs207("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
29360
|
+
/* @__PURE__ */ jsx333("div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ jsx333(CheckCircle5, { className: "text-primary h-12 w-12" }) }),
|
|
29361
|
+
/* @__PURE__ */ jsx333(SectionHeader, { level: 2, children: t("waitlist.confirmation.success_title") }),
|
|
29362
|
+
/* @__PURE__ */ jsx333("p", { className: "text-muted-foreground max-w-md", children: t("waitlist.confirmation.success_description") }),
|
|
29363
|
+
/* @__PURE__ */ jsx333("p", { className: "text-muted-foreground text-sm", children: t("waitlist.confirmation.success_hint") })
|
|
28699
29364
|
] });
|
|
28700
29365
|
}
|
|
28701
29366
|
__name(WaitlistConfirmation, "WaitlistConfirmation");
|
|
28702
29367
|
|
|
28703
29368
|
// src/features/waitlist/components/lists/WaitlistList.tsx
|
|
28704
29369
|
import { RefreshCw as RefreshCw4 } from "lucide-react";
|
|
28705
|
-
import { useTranslations as
|
|
28706
|
-
import { useCallback as useCallback62, useEffect as
|
|
28707
|
-
import { jsx as
|
|
29370
|
+
import { useTranslations as useTranslations192 } from "next-intl";
|
|
29371
|
+
import { useCallback as useCallback62, useEffect as useEffect93, useMemo as useMemo69, useState as useState129 } from "react";
|
|
29372
|
+
import { jsx as jsx334, jsxs as jsxs208 } from "react/jsx-runtime";
|
|
28708
29373
|
function WaitlistList({ fullWidth } = {}) {
|
|
28709
|
-
const t =
|
|
28710
|
-
const [statusFilter, setStatusFilter] =
|
|
28711
|
-
const [stats, setStats] =
|
|
29374
|
+
const t = useTranslations192();
|
|
29375
|
+
const [statusFilter, setStatusFilter] = useState129("all");
|
|
29376
|
+
const [stats, setStats] = useState129(void 0);
|
|
28712
29377
|
const data = useDataListRetriever({
|
|
28713
29378
|
retriever: /* @__PURE__ */ __name((params) => WaitlistService.findMany(params), "retriever"),
|
|
28714
29379
|
retrieverParams: {},
|
|
@@ -28721,7 +29386,7 @@ function WaitlistList({ fullWidth } = {}) {
|
|
|
28721
29386
|
errorToast({ title: t("common.errors.error"), error });
|
|
28722
29387
|
}
|
|
28723
29388
|
}, [t]);
|
|
28724
|
-
|
|
29389
|
+
useEffect93(() => {
|
|
28725
29390
|
void loadStats();
|
|
28726
29391
|
}, [loadStats]);
|
|
28727
29392
|
const refresh = /* @__PURE__ */ __name(() => {
|
|
@@ -28742,7 +29407,7 @@ function WaitlistList({ fullWidth } = {}) {
|
|
|
28742
29407
|
setStatusFilter(status);
|
|
28743
29408
|
data.addAdditionalParameter("status", status === "all" ? null : status);
|
|
28744
29409
|
}, "handleStatusChange");
|
|
28745
|
-
const statusItems =
|
|
29410
|
+
const statusItems = useMemo69(
|
|
28746
29411
|
() => ({
|
|
28747
29412
|
all: t("waitlist.admin.all_statuses"),
|
|
28748
29413
|
pending: t("waitlist.admin.status.pending"),
|
|
@@ -28752,18 +29417,18 @@ function WaitlistList({ fullWidth } = {}) {
|
|
|
28752
29417
|
}),
|
|
28753
29418
|
[t]
|
|
28754
29419
|
);
|
|
28755
|
-
const filters = /* @__PURE__ */
|
|
28756
|
-
/* @__PURE__ */
|
|
28757
|
-
/* @__PURE__ */
|
|
28758
|
-
/* @__PURE__ */
|
|
28759
|
-
/* @__PURE__ */
|
|
28760
|
-
/* @__PURE__ */
|
|
28761
|
-
/* @__PURE__ */
|
|
28762
|
-
/* @__PURE__ */
|
|
28763
|
-
/* @__PURE__ */
|
|
29420
|
+
const filters = /* @__PURE__ */ jsxs208("div", { className: "flex items-center gap-4", children: [
|
|
29421
|
+
/* @__PURE__ */ jsxs208(Select, { items: statusItems, value: statusFilter, onValueChange: handleStatusChange, children: [
|
|
29422
|
+
/* @__PURE__ */ jsx334(SelectTrigger, { className: "w-40", children: /* @__PURE__ */ jsx334(SelectValue, { placeholder: t("waitlist.admin.filter_placeholder") }) }),
|
|
29423
|
+
/* @__PURE__ */ jsxs208(SelectContent, { children: [
|
|
29424
|
+
/* @__PURE__ */ jsx334(SelectItem, { value: "all", children: t("waitlist.admin.all_statuses") }),
|
|
29425
|
+
/* @__PURE__ */ jsx334(SelectItem, { value: "pending", children: t("waitlist.admin.status.pending") }),
|
|
29426
|
+
/* @__PURE__ */ jsx334(SelectItem, { value: "confirmed", children: t("waitlist.admin.status.confirmed") }),
|
|
29427
|
+
/* @__PURE__ */ jsx334(SelectItem, { value: "invited", children: t("waitlist.admin.status.invited") }),
|
|
29428
|
+
/* @__PURE__ */ jsx334(SelectItem, { value: "registered", children: t("waitlist.admin.status.registered") })
|
|
28764
29429
|
] })
|
|
28765
29430
|
] }),
|
|
28766
|
-
/* @__PURE__ */
|
|
29431
|
+
/* @__PURE__ */ jsx334(Button, { variant: "outline", size: "icon", onClick: refresh, disabled: !data.isLoaded, children: /* @__PURE__ */ jsx334(RefreshCw4, { className: `h-4 w-4 ${!data.isLoaded ? "animate-spin" : ""}` }) })
|
|
28767
29432
|
] });
|
|
28768
29433
|
const totals = [
|
|
28769
29434
|
{ key: "total", label: t("waitlist.admin.total"), value: stats?.total },
|
|
@@ -28772,12 +29437,12 @@ function WaitlistList({ fullWidth } = {}) {
|
|
|
28772
29437
|
{ key: "invited", label: t("waitlist.admin.status.invited"), value: stats?.invited },
|
|
28773
29438
|
{ key: "registered", label: t("waitlist.admin.status.registered"), value: stats?.registered }
|
|
28774
29439
|
];
|
|
28775
|
-
return /* @__PURE__ */
|
|
28776
|
-
/* @__PURE__ */
|
|
28777
|
-
/* @__PURE__ */
|
|
28778
|
-
/* @__PURE__ */
|
|
29440
|
+
return /* @__PURE__ */ jsxs208("div", { className: "flex flex-col gap-4", children: [
|
|
29441
|
+
/* @__PURE__ */ jsx334("dl", { className: "grid grid-cols-5 divide-x divide-border rounded-md border", "data-testid": "waitlist-totals", children: totals.map((total) => /* @__PURE__ */ jsxs208("div", { className: "flex flex-col-reverse items-center gap-1 p-3", children: [
|
|
29442
|
+
/* @__PURE__ */ jsx334("dt", { className: "text-muted-foreground text-xs", children: total.label }),
|
|
29443
|
+
/* @__PURE__ */ jsx334("dd", { className: "text-primary text-xl font-semibold tabular-nums", children: total.value ?? "-" })
|
|
28779
29444
|
] }, total.key)) }),
|
|
28780
|
-
/* @__PURE__ */
|
|
29445
|
+
/* @__PURE__ */ jsx334(
|
|
28781
29446
|
ContentListTable,
|
|
28782
29447
|
{
|
|
28783
29448
|
data,
|
|
@@ -28804,12 +29469,12 @@ __name(WaitlistList, "WaitlistList");
|
|
|
28804
29469
|
|
|
28805
29470
|
// src/features/rbac/components/RbacContainer.tsx
|
|
28806
29471
|
import { Loader2Icon as Loader2Icon4 } from "lucide-react";
|
|
28807
|
-
import { useTranslations as
|
|
28808
|
-
import { memo as memo2, useCallback as useCallback64, useEffect as
|
|
29472
|
+
import { useTranslations as useTranslations194 } from "next-intl";
|
|
29473
|
+
import { memo as memo2, useCallback as useCallback64, useEffect as useEffect95, useMemo as useMemo70, useRef as useRef50, useState as useState131 } from "react";
|
|
28809
29474
|
|
|
28810
29475
|
// src/features/rbac/components/RbacPermissionCell.tsx
|
|
28811
29476
|
import { CheckIcon as CheckIcon9, MinusIcon as MinusIcon2, XIcon as XIcon14 } from "lucide-react";
|
|
28812
|
-
import { jsx as
|
|
29477
|
+
import { jsx as jsx335, jsxs as jsxs209 } from "react/jsx-runtime";
|
|
28813
29478
|
function RbacPermissionCell({
|
|
28814
29479
|
value,
|
|
28815
29480
|
originalValue,
|
|
@@ -28818,7 +29483,7 @@ function RbacPermissionCell({
|
|
|
28818
29483
|
}) {
|
|
28819
29484
|
const isDirty = originalValue !== void 0 && value !== originalValue;
|
|
28820
29485
|
if (isRoleColumn && (value === null || value === void 0)) {
|
|
28821
|
-
return /* @__PURE__ */
|
|
29486
|
+
return /* @__PURE__ */ jsx335(
|
|
28822
29487
|
"div",
|
|
28823
29488
|
{
|
|
28824
29489
|
onClick,
|
|
@@ -28826,12 +29491,12 @@ function RbacPermissionCell({
|
|
|
28826
29491
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
28827
29492
|
isDirty && "ring-2 ring-amber-400/50"
|
|
28828
29493
|
),
|
|
28829
|
-
children: /* @__PURE__ */
|
|
29494
|
+
children: /* @__PURE__ */ jsx335(MinusIcon2, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
28830
29495
|
}
|
|
28831
29496
|
);
|
|
28832
29497
|
}
|
|
28833
29498
|
if (value === true) {
|
|
28834
|
-
return /* @__PURE__ */
|
|
29499
|
+
return /* @__PURE__ */ jsx335(
|
|
28835
29500
|
"div",
|
|
28836
29501
|
{
|
|
28837
29502
|
onClick,
|
|
@@ -28839,15 +29504,15 @@ function RbacPermissionCell({
|
|
|
28839
29504
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
28840
29505
|
isDirty && "ring-2 ring-amber-400/50"
|
|
28841
29506
|
),
|
|
28842
|
-
children: /* @__PURE__ */
|
|
28843
|
-
/* @__PURE__ */
|
|
28844
|
-
/* @__PURE__ */
|
|
29507
|
+
children: /* @__PURE__ */ jsxs209(Badge, { variant: "default", className: "bg-emerald-600 hover:bg-emerald-700 gap-1 text-xs", children: [
|
|
29508
|
+
/* @__PURE__ */ jsx335(CheckIcon9, { className: "h-3 w-3" }),
|
|
29509
|
+
/* @__PURE__ */ jsx335("span", { children: "true" })
|
|
28845
29510
|
] })
|
|
28846
29511
|
}
|
|
28847
29512
|
);
|
|
28848
29513
|
}
|
|
28849
29514
|
if (value === false) {
|
|
28850
|
-
return /* @__PURE__ */
|
|
29515
|
+
return /* @__PURE__ */ jsx335(
|
|
28851
29516
|
"div",
|
|
28852
29517
|
{
|
|
28853
29518
|
onClick,
|
|
@@ -28855,17 +29520,17 @@ function RbacPermissionCell({
|
|
|
28855
29520
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
28856
29521
|
isDirty && "ring-2 ring-amber-400/50"
|
|
28857
29522
|
),
|
|
28858
|
-
children: /* @__PURE__ */
|
|
28859
|
-
/* @__PURE__ */
|
|
28860
|
-
/* @__PURE__ */
|
|
29523
|
+
children: /* @__PURE__ */ jsxs209(Badge, { variant: "destructive", className: "gap-1 text-xs", children: [
|
|
29524
|
+
/* @__PURE__ */ jsx335(XIcon14, { className: "h-3 w-3" }),
|
|
29525
|
+
/* @__PURE__ */ jsx335("span", { children: "false" })
|
|
28861
29526
|
] })
|
|
28862
29527
|
}
|
|
28863
29528
|
);
|
|
28864
29529
|
}
|
|
28865
29530
|
const displayValue = typeof value === "string" ? value : String(value);
|
|
28866
29531
|
const truncated = displayValue.length > 20 ? displayValue.substring(0, 18) + "..." : displayValue;
|
|
28867
|
-
return /* @__PURE__ */
|
|
28868
|
-
/* @__PURE__ */
|
|
29532
|
+
return /* @__PURE__ */ jsxs209(Tooltip2, { children: [
|
|
29533
|
+
/* @__PURE__ */ jsx335(
|
|
28869
29534
|
TooltipTrigger,
|
|
28870
29535
|
{
|
|
28871
29536
|
onClick,
|
|
@@ -28873,11 +29538,11 @@ function RbacPermissionCell({
|
|
|
28873
29538
|
"flex h-8 w-full items-center justify-center rounded px-2 transition-colors hover:bg-muted cursor-pointer",
|
|
28874
29539
|
isDirty && "ring-2 ring-amber-400/50"
|
|
28875
29540
|
),
|
|
28876
|
-
render: /* @__PURE__ */
|
|
28877
|
-
children: /* @__PURE__ */
|
|
29541
|
+
render: /* @__PURE__ */ jsx335("div", {}),
|
|
29542
|
+
children: /* @__PURE__ */ jsx335(Badge, { variant: "outline", className: "max-w-full truncate text-xs tabular-nums", children: truncated })
|
|
28878
29543
|
}
|
|
28879
29544
|
),
|
|
28880
|
-
/* @__PURE__ */
|
|
29545
|
+
/* @__PURE__ */ jsx335(TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ jsx335("p", { className: "tabular-nums text-xs break-all", children: displayValue }) })
|
|
28881
29546
|
] });
|
|
28882
29547
|
}
|
|
28883
29548
|
__name(RbacPermissionCell, "RbacPermissionCell");
|
|
@@ -28885,9 +29550,9 @@ __name(RbacPermissionCell, "RbacPermissionCell");
|
|
|
28885
29550
|
// src/features/rbac/components/RbacPermissionPicker.tsx
|
|
28886
29551
|
import { Popover as PopoverPrimitive2 } from "@base-ui/react/popover";
|
|
28887
29552
|
import { CheckIcon as CheckIcon10, MinusIcon as MinusIcon3, XIcon as XIcon15 } from "lucide-react";
|
|
28888
|
-
import { useTranslations as
|
|
28889
|
-
import { useCallback as useCallback63, useEffect as
|
|
28890
|
-
import { Fragment as Fragment69, jsx as
|
|
29553
|
+
import { useTranslations as useTranslations193 } from "next-intl";
|
|
29554
|
+
import { useCallback as useCallback63, useEffect as useEffect94, useState as useState130 } from "react";
|
|
29555
|
+
import { Fragment as Fragment69, jsx as jsx336, jsxs as jsxs210 } from "react/jsx-runtime";
|
|
28891
29556
|
function RbacPermissionPicker({
|
|
28892
29557
|
open,
|
|
28893
29558
|
anchor,
|
|
@@ -28898,9 +29563,9 @@ function RbacPermissionPicker({
|
|
|
28898
29563
|
onClear,
|
|
28899
29564
|
onClose
|
|
28900
29565
|
}) {
|
|
28901
|
-
const t =
|
|
28902
|
-
const [customSegment, setCustomSegment] =
|
|
28903
|
-
|
|
29566
|
+
const t = useTranslations193();
|
|
29567
|
+
const [customSegment, setCustomSegment] = useState130("");
|
|
29568
|
+
useEffect94(() => {
|
|
28904
29569
|
if (!open) setCustomSegment("");
|
|
28905
29570
|
}, [open]);
|
|
28906
29571
|
const currentSegments = typeof value === "string" ? value.split("|").filter(Boolean) : [];
|
|
@@ -28920,14 +29585,14 @@ function RbacPermissionPicker({
|
|
|
28920
29585
|
}
|
|
28921
29586
|
setCustomSegment("");
|
|
28922
29587
|
}, [customSegment, currentSegments, onSetValue]);
|
|
28923
|
-
return /* @__PURE__ */
|
|
29588
|
+
return /* @__PURE__ */ jsx336(
|
|
28924
29589
|
PopoverPrimitive2.Root,
|
|
28925
29590
|
{
|
|
28926
29591
|
open,
|
|
28927
29592
|
onOpenChange: (next) => {
|
|
28928
29593
|
if (!next) onClose();
|
|
28929
29594
|
},
|
|
28930
|
-
children: /* @__PURE__ */
|
|
29595
|
+
children: /* @__PURE__ */ jsx336(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx336(
|
|
28931
29596
|
PopoverPrimitive2.Positioner,
|
|
28932
29597
|
{
|
|
28933
29598
|
anchor: anchor ?? void 0,
|
|
@@ -28935,11 +29600,11 @@ function RbacPermissionPicker({
|
|
|
28935
29600
|
align: "center",
|
|
28936
29601
|
sideOffset: 4,
|
|
28937
29602
|
className: "isolate z-50",
|
|
28938
|
-
children: /* @__PURE__ */
|
|
28939
|
-
/* @__PURE__ */
|
|
28940
|
-
/* @__PURE__ */
|
|
28941
|
-
/* @__PURE__ */
|
|
28942
|
-
/* @__PURE__ */
|
|
29603
|
+
children: /* @__PURE__ */ jsxs210(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: [
|
|
29604
|
+
/* @__PURE__ */ jsxs210("div", { children: [
|
|
29605
|
+
/* @__PURE__ */ jsx336("p", { className: "text-muted-foreground mb-2 text-xs font-medium", children: t("rbac.quick_value") }),
|
|
29606
|
+
/* @__PURE__ */ jsxs210("div", { className: "flex gap-2", children: [
|
|
29607
|
+
/* @__PURE__ */ jsxs210(
|
|
28943
29608
|
Button,
|
|
28944
29609
|
{
|
|
28945
29610
|
size: "sm",
|
|
@@ -28950,12 +29615,12 @@ function RbacPermissionPicker({
|
|
|
28950
29615
|
onClose();
|
|
28951
29616
|
},
|
|
28952
29617
|
children: [
|
|
28953
|
-
/* @__PURE__ */
|
|
28954
|
-
/* @__PURE__ */
|
|
29618
|
+
/* @__PURE__ */ jsx336(CheckIcon10, { className: "h-3 w-3" }),
|
|
29619
|
+
/* @__PURE__ */ jsx336("span", { children: "true" })
|
|
28955
29620
|
]
|
|
28956
29621
|
}
|
|
28957
29622
|
),
|
|
28958
|
-
/* @__PURE__ */
|
|
29623
|
+
/* @__PURE__ */ jsxs210(
|
|
28959
29624
|
Button,
|
|
28960
29625
|
{
|
|
28961
29626
|
size: "sm",
|
|
@@ -28966,16 +29631,16 @@ function RbacPermissionPicker({
|
|
|
28966
29631
|
onClose();
|
|
28967
29632
|
},
|
|
28968
29633
|
children: [
|
|
28969
|
-
/* @__PURE__ */
|
|
28970
|
-
/* @__PURE__ */
|
|
29634
|
+
/* @__PURE__ */ jsx336(XIcon15, { className: "h-3 w-3" }),
|
|
29635
|
+
/* @__PURE__ */ jsx336("span", { children: "false" })
|
|
28971
29636
|
]
|
|
28972
29637
|
}
|
|
28973
29638
|
)
|
|
28974
29639
|
] })
|
|
28975
29640
|
] }),
|
|
28976
|
-
isRoleColumn && onClear && /* @__PURE__ */
|
|
28977
|
-
/* @__PURE__ */
|
|
28978
|
-
/* @__PURE__ */
|
|
29641
|
+
isRoleColumn && onClear && /* @__PURE__ */ jsxs210(Fragment69, { children: [
|
|
29642
|
+
/* @__PURE__ */ jsx336(Separator, {}),
|
|
29643
|
+
/* @__PURE__ */ jsxs210(
|
|
28979
29644
|
Button,
|
|
28980
29645
|
{
|
|
28981
29646
|
size: "sm",
|
|
@@ -28986,34 +29651,34 @@ function RbacPermissionPicker({
|
|
|
28986
29651
|
onClose();
|
|
28987
29652
|
},
|
|
28988
29653
|
children: [
|
|
28989
|
-
/* @__PURE__ */
|
|
29654
|
+
/* @__PURE__ */ jsx336(MinusIcon3, { className: "h-3 w-3" }),
|
|
28990
29655
|
t("rbac.inherit_from_defaults")
|
|
28991
29656
|
]
|
|
28992
29657
|
}
|
|
28993
29658
|
)
|
|
28994
29659
|
] }),
|
|
28995
|
-
/* @__PURE__ */
|
|
28996
|
-
/* @__PURE__ */
|
|
28997
|
-
/* @__PURE__ */
|
|
28998
|
-
knownSegments.length > 0 && /* @__PURE__ */
|
|
29660
|
+
/* @__PURE__ */ jsx336(Separator, {}),
|
|
29661
|
+
/* @__PURE__ */ jsxs210("div", { children: [
|
|
29662
|
+
/* @__PURE__ */ jsx336("p", { className: "text-muted-foreground mb-2 text-xs font-medium", children: t("rbac.relationships") }),
|
|
29663
|
+
knownSegments.length > 0 && /* @__PURE__ */ jsx336("div", { className: "max-h-40 space-y-1 overflow-y-auto", children: knownSegments.map((segment) => /* @__PURE__ */ jsxs210(
|
|
28999
29664
|
"label",
|
|
29000
29665
|
{
|
|
29001
29666
|
className: "hover:bg-muted flex cursor-pointer items-center gap-2 rounded px-1 py-0.5 text-sm",
|
|
29002
29667
|
children: [
|
|
29003
|
-
/* @__PURE__ */
|
|
29668
|
+
/* @__PURE__ */ jsx336(
|
|
29004
29669
|
Checkbox,
|
|
29005
29670
|
{
|
|
29006
29671
|
checked: currentSegments.includes(segment),
|
|
29007
29672
|
onCheckedChange: () => toggleSegment(segment)
|
|
29008
29673
|
}
|
|
29009
29674
|
),
|
|
29010
|
-
/* @__PURE__ */
|
|
29675
|
+
/* @__PURE__ */ jsx336("span", { className: "tabular-nums text-xs", children: segment })
|
|
29011
29676
|
]
|
|
29012
29677
|
},
|
|
29013
29678
|
segment
|
|
29014
29679
|
)) }),
|
|
29015
|
-
/* @__PURE__ */
|
|
29016
|
-
/* @__PURE__ */
|
|
29680
|
+
/* @__PURE__ */ jsxs210("div", { className: "mt-2 flex gap-1", children: [
|
|
29681
|
+
/* @__PURE__ */ jsx336(
|
|
29017
29682
|
Input,
|
|
29018
29683
|
{
|
|
29019
29684
|
value: customSegment,
|
|
@@ -29028,7 +29693,7 @@ function RbacPermissionPicker({
|
|
|
29028
29693
|
}
|
|
29029
29694
|
}
|
|
29030
29695
|
),
|
|
29031
|
-
/* @__PURE__ */
|
|
29696
|
+
/* @__PURE__ */ jsx336(
|
|
29032
29697
|
Button,
|
|
29033
29698
|
{
|
|
29034
29699
|
size: "sm",
|
|
@@ -29040,9 +29705,9 @@ function RbacPermissionPicker({
|
|
|
29040
29705
|
}
|
|
29041
29706
|
)
|
|
29042
29707
|
] }),
|
|
29043
|
-
currentSegments.length > 0 && /* @__PURE__ */
|
|
29044
|
-
/* @__PURE__ */
|
|
29045
|
-
/* @__PURE__ */
|
|
29708
|
+
currentSegments.length > 0 && /* @__PURE__ */ jsxs210("div", { className: "bg-muted mt-2 rounded p-2", children: [
|
|
29709
|
+
/* @__PURE__ */ jsx336("p", { className: "text-muted-foreground mb-1 text-xs", children: t("rbac.preview") }),
|
|
29710
|
+
/* @__PURE__ */ jsx336("p", { className: "tabular-nums text-xs break-all", children: currentSegments.join("|") })
|
|
29046
29711
|
] })
|
|
29047
29712
|
] })
|
|
29048
29713
|
] })
|
|
@@ -29054,7 +29719,7 @@ function RbacPermissionPicker({
|
|
|
29054
29719
|
__name(RbacPermissionPicker, "RbacPermissionPicker");
|
|
29055
29720
|
|
|
29056
29721
|
// src/features/rbac/components/RbacContainer.tsx
|
|
29057
|
-
import { jsx as
|
|
29722
|
+
import { jsx as jsx337, jsxs as jsxs211 } from "react/jsx-runtime";
|
|
29058
29723
|
function findToken(tokens, action) {
|
|
29059
29724
|
if (!tokens) return void 0;
|
|
29060
29725
|
return tokens.find((t) => t.action === action);
|
|
@@ -29074,13 +29739,13 @@ var CellButton = memo2(/* @__PURE__ */ __name(function CellButton2({
|
|
|
29074
29739
|
isRoleColumn,
|
|
29075
29740
|
onOpen
|
|
29076
29741
|
}) {
|
|
29077
|
-
const ref =
|
|
29742
|
+
const ref = useRef50(null);
|
|
29078
29743
|
const value = cellValue(tokens, action);
|
|
29079
29744
|
const handleClick = useCallback64(() => {
|
|
29080
29745
|
if (!ref.current) return;
|
|
29081
29746
|
onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
|
|
29082
29747
|
}, [onOpen, moduleId, rowKey, action, isRoleColumn]);
|
|
29083
|
-
return /* @__PURE__ */
|
|
29748
|
+
return /* @__PURE__ */ jsx337("div", { ref, children: /* @__PURE__ */ jsx337(RbacPermissionCell, { value, isRoleColumn, onClick: handleClick }) });
|
|
29084
29749
|
}, "CellButton"));
|
|
29085
29750
|
var ACTION_LABEL_KEYS = {
|
|
29086
29751
|
read: "rbac.actions.read",
|
|
@@ -29096,22 +29761,22 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
29096
29761
|
roleNames,
|
|
29097
29762
|
onOpenPicker
|
|
29098
29763
|
}) {
|
|
29099
|
-
const t =
|
|
29764
|
+
const t = useTranslations194();
|
|
29100
29765
|
const defaultTokens = block.default ?? [];
|
|
29101
|
-
return /* @__PURE__ */
|
|
29102
|
-
/* @__PURE__ */
|
|
29103
|
-
/* @__PURE__ */
|
|
29104
|
-
/* @__PURE__ */
|
|
29766
|
+
return /* @__PURE__ */ jsxs211("div", { className: "rounded-lg border border-accent bg-card", children: [
|
|
29767
|
+
/* @__PURE__ */ jsxs211("div", { className: "flex items-center justify-between border-b px-4 py-2", children: [
|
|
29768
|
+
/* @__PURE__ */ jsx337("h4", { className: "text-sm font-medium", children: moduleLabel }),
|
|
29769
|
+
/* @__PURE__ */ jsx337("span", { className: "text-muted-foreground tabular-nums text-xs", children: moduleId })
|
|
29105
29770
|
] }),
|
|
29106
|
-
/* @__PURE__ */
|
|
29107
|
-
/* @__PURE__ */
|
|
29108
|
-
/* @__PURE__ */
|
|
29109
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
29771
|
+
/* @__PURE__ */ jsx337("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs211("table", { className: "w-full text-sm", children: [
|
|
29772
|
+
/* @__PURE__ */ jsx337("thead", { children: /* @__PURE__ */ jsxs211("tr", { className: "border-b bg-muted/50", children: [
|
|
29773
|
+
/* @__PURE__ */ jsx337("th", { className: "w-40 px-4 py-2 text-start text-xs font-medium text-muted-foreground", children: t("rbac.role") }),
|
|
29774
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx337("th", { className: "min-w-28 px-2 py-2 text-center text-xs font-medium text-muted-foreground", children: t(ACTION_LABEL_KEYS[action]) }, action))
|
|
29110
29775
|
] }) }),
|
|
29111
|
-
/* @__PURE__ */
|
|
29112
|
-
/* @__PURE__ */
|
|
29113
|
-
/* @__PURE__ */
|
|
29114
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
29776
|
+
/* @__PURE__ */ jsxs211("tbody", { children: [
|
|
29777
|
+
/* @__PURE__ */ jsxs211("tr", { className: cn("border-b bg-muted/30"), children: [
|
|
29778
|
+
/* @__PURE__ */ jsx337("td", { className: "px-4 py-1 text-xs font-bold text-muted-foreground", children: t("rbac.defaults") }),
|
|
29779
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx337("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx337(
|
|
29115
29780
|
CellButton,
|
|
29116
29781
|
{
|
|
29117
29782
|
moduleId,
|
|
@@ -29126,9 +29791,9 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
29126
29791
|
roleIds.map((roleId) => {
|
|
29127
29792
|
const roleTokens = block[roleId];
|
|
29128
29793
|
const roleLabel = roleNames?.[roleId] ?? roleId;
|
|
29129
|
-
return /* @__PURE__ */
|
|
29130
|
-
/* @__PURE__ */
|
|
29131
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
29794
|
+
return /* @__PURE__ */ jsxs211("tr", { className: "border-b last:border-b-0", children: [
|
|
29795
|
+
/* @__PURE__ */ jsx337("td", { className: "px-4 py-1 text-xs font-medium text-muted-foreground", children: roleLabel }),
|
|
29796
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx337("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx337(
|
|
29132
29797
|
CellButton,
|
|
29133
29798
|
{
|
|
29134
29799
|
moduleId,
|
|
@@ -29146,10 +29811,10 @@ var ModuleEditor = memo2(/* @__PURE__ */ __name(function ModuleEditor2({
|
|
|
29146
29811
|
] });
|
|
29147
29812
|
}, "ModuleEditor"));
|
|
29148
29813
|
function RbacContainer() {
|
|
29149
|
-
const t =
|
|
29814
|
+
const t = useTranslations194();
|
|
29150
29815
|
const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
|
|
29151
|
-
const [selectedModuleId, setSelectedModuleId] =
|
|
29152
|
-
const [activePicker, setActivePicker] =
|
|
29816
|
+
const [selectedModuleId, setSelectedModuleId] = useState131(null);
|
|
29817
|
+
const [activePicker, setActivePicker] = useState131(null);
|
|
29153
29818
|
const openPicker = useCallback64((picker) => {
|
|
29154
29819
|
setActivePicker(picker);
|
|
29155
29820
|
}, []);
|
|
@@ -29160,11 +29825,11 @@ function RbacContainer() {
|
|
|
29160
29825
|
setSelectedModuleId(id);
|
|
29161
29826
|
setActivePicker(null);
|
|
29162
29827
|
}, []);
|
|
29163
|
-
const sortedModuleIds =
|
|
29828
|
+
const sortedModuleIds = useMemo70(() => {
|
|
29164
29829
|
if (!matrix) return [];
|
|
29165
29830
|
return Object.keys(matrix).sort((a, b) => (moduleNames?.[a] ?? a).localeCompare(moduleNames?.[b] ?? b));
|
|
29166
29831
|
}, [matrix, moduleNames]);
|
|
29167
|
-
const roleIds =
|
|
29832
|
+
const roleIds = useMemo70(() => {
|
|
29168
29833
|
if (roleNames) {
|
|
29169
29834
|
return Object.keys(roleNames).sort((a, b) => (roleNames[a] ?? a).localeCompare(roleNames[b] ?? b));
|
|
29170
29835
|
}
|
|
@@ -29177,19 +29842,19 @@ function RbacContainer() {
|
|
|
29177
29842
|
}
|
|
29178
29843
|
return Array.from(set).sort();
|
|
29179
29844
|
}, [matrix, roleNames]);
|
|
29180
|
-
|
|
29845
|
+
useEffect95(() => {
|
|
29181
29846
|
if (!selectedModuleId && sortedModuleIds.length > 0) {
|
|
29182
29847
|
setSelectedModuleId(sortedModuleIds[0]);
|
|
29183
29848
|
}
|
|
29184
29849
|
}, [selectedModuleId, sortedModuleIds]);
|
|
29185
|
-
const activeValue =
|
|
29850
|
+
const activeValue = useMemo70(() => {
|
|
29186
29851
|
if (!activePicker || !matrix) return void 0;
|
|
29187
29852
|
const block = matrix[activePicker.moduleId];
|
|
29188
29853
|
if (!block) return void 0;
|
|
29189
29854
|
const tokens = activePicker.rowKey === "default" ? block.default : block[activePicker.rowKey];
|
|
29190
29855
|
return cellValue(tokens, activePicker.action);
|
|
29191
29856
|
}, [activePicker, matrix]);
|
|
29192
|
-
const activeSegments =
|
|
29857
|
+
const activeSegments = useMemo70(() => {
|
|
29193
29858
|
if (!activePicker) return [];
|
|
29194
29859
|
return modulePaths[activePicker.moduleId] ?? [];
|
|
29195
29860
|
}, [activePicker, modulePaths]);
|
|
@@ -29205,16 +29870,16 @@ function RbacContainer() {
|
|
|
29205
29870
|
clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
|
|
29206
29871
|
}, [activePicker, clearCell]);
|
|
29207
29872
|
if (loading) {
|
|
29208
|
-
return /* @__PURE__ */
|
|
29873
|
+
return /* @__PURE__ */ jsx337(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx337("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx337(Loader2Icon4, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) });
|
|
29209
29874
|
}
|
|
29210
29875
|
if (error) {
|
|
29211
|
-
return /* @__PURE__ */
|
|
29876
|
+
return /* @__PURE__ */ jsx337(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx337("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx337("p", { className: "text-destructive", children: error }) }) });
|
|
29212
29877
|
}
|
|
29213
29878
|
if (!matrix) return null;
|
|
29214
29879
|
const selectedBlock = selectedModuleId ? matrix[selectedModuleId] : void 0;
|
|
29215
|
-
return /* @__PURE__ */
|
|
29216
|
-
/* @__PURE__ */
|
|
29217
|
-
/* @__PURE__ */
|
|
29880
|
+
return /* @__PURE__ */ jsxs211(RoundPageContainer, { fullWidth: true, forceHeader: true, children: [
|
|
29881
|
+
/* @__PURE__ */ jsxs211("div", { className: "flex h-full w-full", children: [
|
|
29882
|
+
/* @__PURE__ */ jsx337("aside", { className: "w-60 shrink-0 overflow-y-auto border-e bg-muted/20", children: /* @__PURE__ */ jsx337("ul", { className: "py-1", children: sortedModuleIds.map((id) => /* @__PURE__ */ jsx337("li", { children: /* @__PURE__ */ jsx337(
|
|
29218
29883
|
"button",
|
|
29219
29884
|
{
|
|
29220
29885
|
type: "button",
|
|
@@ -29228,7 +29893,7 @@ function RbacContainer() {
|
|
|
29228
29893
|
children: moduleNames?.[id] ?? id
|
|
29229
29894
|
}
|
|
29230
29895
|
) }, id)) }) }),
|
|
29231
|
-
/* @__PURE__ */
|
|
29896
|
+
/* @__PURE__ */ jsx337("section", { className: "flex-1 overflow-y-auto p-4", children: selectedModuleId && selectedBlock ? /* @__PURE__ */ jsx337(
|
|
29232
29897
|
ModuleEditor,
|
|
29233
29898
|
{
|
|
29234
29899
|
moduleId: selectedModuleId,
|
|
@@ -29238,9 +29903,9 @@ function RbacContainer() {
|
|
|
29238
29903
|
roleNames,
|
|
29239
29904
|
onOpenPicker: openPicker
|
|
29240
29905
|
}
|
|
29241
|
-
) : /* @__PURE__ */
|
|
29906
|
+
) : /* @__PURE__ */ jsx337("p", { className: "text-muted-foreground text-sm", children: t("rbac.select_module_prompt") }) })
|
|
29242
29907
|
] }),
|
|
29243
|
-
/* @__PURE__ */
|
|
29908
|
+
/* @__PURE__ */ jsx337(
|
|
29244
29909
|
RbacPermissionPicker,
|
|
29245
29910
|
{
|
|
29246
29911
|
open: !!activePicker,
|
|
@@ -29259,9 +29924,9 @@ __name(RbacContainer, "RbacContainer");
|
|
|
29259
29924
|
|
|
29260
29925
|
// src/features/rbac/components/RbacByRoleContainer.tsx
|
|
29261
29926
|
import { Loader2Icon as Loader2Icon5 } from "lucide-react";
|
|
29262
|
-
import { useTranslations as
|
|
29263
|
-
import { Fragment as Fragment70, memo as memo3, useCallback as useCallback65, useEffect as
|
|
29264
|
-
import { jsx as
|
|
29927
|
+
import { useTranslations as useTranslations195 } from "next-intl";
|
|
29928
|
+
import { Fragment as Fragment70, memo as memo3, useCallback as useCallback65, useEffect as useEffect96, useMemo as useMemo71, useRef as useRef51, useState as useState132 } from "react";
|
|
29929
|
+
import { jsx as jsx338, jsxs as jsxs212 } from "react/jsx-runtime";
|
|
29265
29930
|
function findToken2(tokens, action) {
|
|
29266
29931
|
if (!tokens) return void 0;
|
|
29267
29932
|
return tokens.find((t) => t.action === action);
|
|
@@ -29281,13 +29946,13 @@ var CellButton3 = memo3(/* @__PURE__ */ __name(function CellButton4({
|
|
|
29281
29946
|
isRoleColumn,
|
|
29282
29947
|
onOpen
|
|
29283
29948
|
}) {
|
|
29284
|
-
const ref =
|
|
29949
|
+
const ref = useRef51(null);
|
|
29285
29950
|
const value = cellValue2(tokens, action);
|
|
29286
29951
|
const handleClick = useCallback65(() => {
|
|
29287
29952
|
if (!ref.current) return;
|
|
29288
29953
|
onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
|
|
29289
29954
|
}, [onOpen, moduleId, rowKey, action, isRoleColumn]);
|
|
29290
|
-
return /* @__PURE__ */
|
|
29955
|
+
return /* @__PURE__ */ jsx338("div", { ref, children: /* @__PURE__ */ jsx338(RbacPermissionCell, { value, isRoleColumn, onClick: handleClick }) });
|
|
29291
29956
|
}, "CellButton"));
|
|
29292
29957
|
var ACTION_LABEL_KEYS2 = {
|
|
29293
29958
|
read: "rbac.actions.read",
|
|
@@ -29296,10 +29961,10 @@ var ACTION_LABEL_KEYS2 = {
|
|
|
29296
29961
|
delete: "rbac.actions.delete"
|
|
29297
29962
|
};
|
|
29298
29963
|
function RbacByRoleContainer() {
|
|
29299
|
-
const t =
|
|
29964
|
+
const t = useTranslations195();
|
|
29300
29965
|
const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
|
|
29301
|
-
const [selectedRoleId, setSelectedRoleId] =
|
|
29302
|
-
const [activePicker, setActivePicker] =
|
|
29966
|
+
const [selectedRoleId, setSelectedRoleId] = useState132(null);
|
|
29967
|
+
const [activePicker, setActivePicker] = useState132(null);
|
|
29303
29968
|
const openPicker = useCallback65((picker) => {
|
|
29304
29969
|
setActivePicker(picker);
|
|
29305
29970
|
}, []);
|
|
@@ -29310,27 +29975,27 @@ function RbacByRoleContainer() {
|
|
|
29310
29975
|
setSelectedRoleId(id);
|
|
29311
29976
|
setActivePicker(null);
|
|
29312
29977
|
}, []);
|
|
29313
|
-
const sortedRoleIds =
|
|
29978
|
+
const sortedRoleIds = useMemo71(() => {
|
|
29314
29979
|
if (!roleNames) return [];
|
|
29315
29980
|
return Object.keys(roleNames).sort((a, b) => (roleNames[a] ?? a).localeCompare(roleNames[b] ?? b));
|
|
29316
29981
|
}, [roleNames]);
|
|
29317
|
-
const sortedModuleIds =
|
|
29982
|
+
const sortedModuleIds = useMemo71(() => {
|
|
29318
29983
|
if (!matrix) return [];
|
|
29319
29984
|
return Object.keys(matrix).sort((a, b) => (moduleNames?.[a] ?? a).localeCompare(moduleNames?.[b] ?? b));
|
|
29320
29985
|
}, [matrix, moduleNames]);
|
|
29321
|
-
|
|
29986
|
+
useEffect96(() => {
|
|
29322
29987
|
if (!selectedRoleId && sortedRoleIds.length > 0) {
|
|
29323
29988
|
setSelectedRoleId(sortedRoleIds[0]);
|
|
29324
29989
|
}
|
|
29325
29990
|
}, [selectedRoleId, sortedRoleIds]);
|
|
29326
|
-
const activeValue =
|
|
29991
|
+
const activeValue = useMemo71(() => {
|
|
29327
29992
|
if (!activePicker || !matrix) return void 0;
|
|
29328
29993
|
const block = matrix[activePicker.moduleId];
|
|
29329
29994
|
if (!block) return void 0;
|
|
29330
29995
|
const tokens = activePicker.rowKey === "default" ? block.default : block[activePicker.rowKey];
|
|
29331
29996
|
return cellValue2(tokens, activePicker.action);
|
|
29332
29997
|
}, [activePicker, matrix]);
|
|
29333
|
-
const activeSegments =
|
|
29998
|
+
const activeSegments = useMemo71(() => {
|
|
29334
29999
|
if (!activePicker) return [];
|
|
29335
30000
|
return modulePaths[activePicker.moduleId] ?? [];
|
|
29336
30001
|
}, [activePicker, modulePaths]);
|
|
@@ -29346,15 +30011,15 @@ function RbacByRoleContainer() {
|
|
|
29346
30011
|
clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
|
|
29347
30012
|
}, [activePicker, clearCell]);
|
|
29348
30013
|
if (loading) {
|
|
29349
|
-
return /* @__PURE__ */
|
|
30014
|
+
return /* @__PURE__ */ jsx338(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx338("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx338(Loader2Icon5, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) });
|
|
29350
30015
|
}
|
|
29351
30016
|
if (error) {
|
|
29352
|
-
return /* @__PURE__ */
|
|
30017
|
+
return /* @__PURE__ */ jsx338(RoundPageContainer, { fullWidth: true, children: /* @__PURE__ */ jsx338("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx338("p", { className: "text-destructive", children: error }) }) });
|
|
29353
30018
|
}
|
|
29354
30019
|
if (!matrix || !selectedRoleId) return null;
|
|
29355
|
-
return /* @__PURE__ */
|
|
29356
|
-
/* @__PURE__ */
|
|
29357
|
-
/* @__PURE__ */
|
|
30020
|
+
return /* @__PURE__ */ jsxs212(RoundPageContainer, { fullWidth: true, forceHeader: true, children: [
|
|
30021
|
+
/* @__PURE__ */ jsxs212("div", { className: "flex h-full w-full", children: [
|
|
30022
|
+
/* @__PURE__ */ jsx338("aside", { className: "w-60 shrink-0 overflow-y-auto border-e bg-muted/20", children: /* @__PURE__ */ jsx338("ul", { className: "py-1", children: sortedRoleIds.map((id) => /* @__PURE__ */ jsx338("li", { children: /* @__PURE__ */ jsx338(
|
|
29358
30023
|
"button",
|
|
29359
30024
|
{
|
|
29360
30025
|
type: "button",
|
|
@@ -29368,10 +30033,10 @@ function RbacByRoleContainer() {
|
|
|
29368
30033
|
children: roleNames?.[id] ?? id
|
|
29369
30034
|
}
|
|
29370
30035
|
) }, id)) }) }),
|
|
29371
|
-
/* @__PURE__ */
|
|
29372
|
-
/* @__PURE__ */
|
|
29373
|
-
/* @__PURE__ */
|
|
29374
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
30036
|
+
/* @__PURE__ */ jsx338("section", { className: "flex-1 overflow-y-auto p-4", children: sortedModuleIds.length > 0 ? /* @__PURE__ */ jsx338("div", { className: "rounded-lg border border-accent bg-card", children: /* @__PURE__ */ jsx338("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs212("table", { className: "w-full text-sm", children: [
|
|
30037
|
+
/* @__PURE__ */ jsx338("thead", { className: "sticky top-0 z-10", children: /* @__PURE__ */ jsxs212("tr", { className: "border-b bg-muted/80 backdrop-blur-sm", children: [
|
|
30038
|
+
/* @__PURE__ */ jsx338("th", { className: "w-40 px-4 py-2 text-start text-xs font-medium text-muted-foreground", children: t("rbac.module") }),
|
|
30039
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx338(
|
|
29375
30040
|
"th",
|
|
29376
30041
|
{
|
|
29377
30042
|
className: "min-w-28 px-2 py-2 text-center text-xs font-medium text-muted-foreground",
|
|
@@ -29380,14 +30045,14 @@ function RbacByRoleContainer() {
|
|
|
29380
30045
|
action
|
|
29381
30046
|
))
|
|
29382
30047
|
] }) }),
|
|
29383
|
-
/* @__PURE__ */
|
|
30048
|
+
/* @__PURE__ */ jsx338("tbody", { children: sortedModuleIds.map((moduleId) => {
|
|
29384
30049
|
const block = matrix[moduleId];
|
|
29385
30050
|
if (!block) return null;
|
|
29386
30051
|
const defaultTokens = block.default ?? [];
|
|
29387
30052
|
const roleTokens = block[selectedRoleId];
|
|
29388
30053
|
const moduleLabel = moduleNames?.[moduleId] ?? moduleId;
|
|
29389
|
-
return /* @__PURE__ */
|
|
29390
|
-
/* @__PURE__ */
|
|
30054
|
+
return /* @__PURE__ */ jsxs212(Fragment70, { children: [
|
|
30055
|
+
/* @__PURE__ */ jsx338("tr", { className: "border-b bg-muted/40", children: /* @__PURE__ */ jsx338(
|
|
29391
30056
|
"td",
|
|
29392
30057
|
{
|
|
29393
30058
|
colSpan: ACTION_TYPES.length + 1,
|
|
@@ -29395,13 +30060,13 @@ function RbacByRoleContainer() {
|
|
|
29395
30060
|
children: moduleLabel
|
|
29396
30061
|
}
|
|
29397
30062
|
) }),
|
|
29398
|
-
/* @__PURE__ */
|
|
29399
|
-
/* @__PURE__ */
|
|
29400
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
30063
|
+
/* @__PURE__ */ jsxs212("tr", { className: "border-b bg-muted/20", children: [
|
|
30064
|
+
/* @__PURE__ */ jsx338("td", { className: "px-4 py-1 text-xs text-muted-foreground", children: t("rbac.defaults") }),
|
|
30065
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx338("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx338(RbacPermissionCell, { value: cellValue2(defaultTokens, action) }) }, action))
|
|
29401
30066
|
] }),
|
|
29402
|
-
/* @__PURE__ */
|
|
29403
|
-
/* @__PURE__ */
|
|
29404
|
-
ACTION_TYPES.map((action) => /* @__PURE__ */
|
|
30067
|
+
/* @__PURE__ */ jsxs212("tr", { className: "border-b last:border-b-0", children: [
|
|
30068
|
+
/* @__PURE__ */ jsx338("td", { className: "px-4 py-1 text-xs font-medium text-muted-foreground", children: roleNames?.[selectedRoleId] ?? selectedRoleId }),
|
|
30069
|
+
ACTION_TYPES.map((action) => /* @__PURE__ */ jsx338("td", { className: "px-2 py-1", children: /* @__PURE__ */ jsx338(
|
|
29405
30070
|
CellButton3,
|
|
29406
30071
|
{
|
|
29407
30072
|
moduleId,
|
|
@@ -29415,9 +30080,9 @@ function RbacByRoleContainer() {
|
|
|
29415
30080
|
] })
|
|
29416
30081
|
] }, moduleId);
|
|
29417
30082
|
}) })
|
|
29418
|
-
] }) }) }) : /* @__PURE__ */
|
|
30083
|
+
] }) }) }) : /* @__PURE__ */ jsx338("p", { className: "text-muted-foreground text-sm", children: t("rbac.select_role_prompt") }) })
|
|
29419
30084
|
] }),
|
|
29420
|
-
/* @__PURE__ */
|
|
30085
|
+
/* @__PURE__ */ jsx338(
|
|
29421
30086
|
RbacPermissionPicker,
|
|
29422
30087
|
{
|
|
29423
30088
|
open: !!activePicker,
|
|
@@ -29986,6 +30651,19 @@ export {
|
|
|
29986
30651
|
ReferralCodeCapture,
|
|
29987
30652
|
ReferralWidget,
|
|
29988
30653
|
ReferralDialog,
|
|
30654
|
+
createUsageFormatters,
|
|
30655
|
+
useUsageFormatters,
|
|
30656
|
+
CATEGORICAL_CEILING,
|
|
30657
|
+
OTHER_COLOR,
|
|
30658
|
+
SEQUENTIAL_RAMP,
|
|
30659
|
+
seriesColor,
|
|
30660
|
+
seriesTheme,
|
|
30661
|
+
ReferralsAdminFunnel,
|
|
30662
|
+
metricValue,
|
|
30663
|
+
cacheHitPercentage,
|
|
30664
|
+
percentageDelta,
|
|
30665
|
+
ReferralsAdminTiles,
|
|
30666
|
+
ReferralsAdminContainer,
|
|
29989
30667
|
SignupSourceCapture,
|
|
29990
30668
|
RoleProvider,
|
|
29991
30669
|
useRoleContext,
|
|
@@ -30073,4 +30751,4 @@ export {
|
|
|
30073
30751
|
useOAuthClients,
|
|
30074
30752
|
useOAuthClient
|
|
30075
30753
|
};
|
|
30076
|
-
//# sourceMappingURL=chunk-
|
|
30754
|
+
//# sourceMappingURL=chunk-SQUMPLNN.mjs.map
|