@pelatform/starter 0.1.5 → 0.1.6
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/chunk-2ZAZ77F6.js +234 -0
- package/dist/extend.d.ts +31 -34
- package/dist/extend.js +1 -1
- package/dist/index.d.ts +250 -243
- package/dist/index.js +1098 -769
- package/dist/server.js +0 -2
- package/dist/style.css +1 -1
- package/dist/{ui-DhgTAR3u.d.ts → ui-BjeCRH96.d.ts} +619 -476
- package/package.json +52 -40
- package/LICENSE +0 -21
- package/dist/chunk-ZWKHMRY6.js +0 -531
- package/dist/metafile-esm.json +0 -1
package/dist/index.js
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use client';
|
|
3
|
-
|
|
4
2
|
import {
|
|
5
|
-
AppleIcon,
|
|
6
|
-
DiscordIcon,
|
|
7
|
-
DropboxIcon,
|
|
8
|
-
FacebookIcon,
|
|
9
|
-
GitHubIcon,
|
|
10
|
-
GitLabIcon,
|
|
11
|
-
GoogleIcon,
|
|
12
|
-
HuggingFaceIcon,
|
|
13
|
-
KickIcon,
|
|
14
|
-
LinearIcon,
|
|
15
|
-
LinkedInIcon,
|
|
16
|
-
MicrosoftIcon,
|
|
17
|
-
NotionIcon,
|
|
18
|
-
RedditIcon,
|
|
19
|
-
RobloxIcon,
|
|
20
|
-
SlackIcon,
|
|
21
|
-
SpotifyIcon,
|
|
22
|
-
TikTokIcon,
|
|
23
|
-
TwitchIcon,
|
|
24
|
-
VKIcon,
|
|
25
|
-
XIcon,
|
|
26
|
-
ZoomIcon,
|
|
27
3
|
defaultAuthQueryOptions,
|
|
28
4
|
fileToBase64,
|
|
29
5
|
getPasswordSchema,
|
|
30
6
|
getTranslations,
|
|
31
7
|
resizeAndCropImage,
|
|
32
8
|
socialProviders
|
|
33
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2ZAZ77F6.js";
|
|
34
10
|
|
|
35
11
|
// src/config/hook.ts
|
|
36
12
|
import { useContext } from "react";
|
|
@@ -123,7 +99,6 @@ var defaultConfig = {
|
|
|
123
99
|
PRIVACY: "/privacy"
|
|
124
100
|
},
|
|
125
101
|
auth: {
|
|
126
|
-
ACCEPT_INVITATION: "/join",
|
|
127
102
|
CALLBACK: "/callback",
|
|
128
103
|
EMAIL_OTP: "/otp",
|
|
129
104
|
FORGOT_PASSWORD: "/forgot-password",
|
|
@@ -155,6 +130,10 @@ var defaultConfig = {
|
|
|
155
130
|
admin: {
|
|
156
131
|
OVERVIEW: "/admin/overview",
|
|
157
132
|
USERS: "/admin/users"
|
|
133
|
+
},
|
|
134
|
+
custom: {
|
|
135
|
+
ACCEPT_INVITATION: "/join",
|
|
136
|
+
NEW_WORKSPACE: "/new"
|
|
158
137
|
}
|
|
159
138
|
},
|
|
160
139
|
ui: {
|
|
@@ -235,10 +214,7 @@ import { useContext as useContext5 } from "react";
|
|
|
235
214
|
|
|
236
215
|
// src/hooks/auth-mutation.ts
|
|
237
216
|
import { useContext as useContext2 } from "react";
|
|
238
|
-
import {
|
|
239
|
-
useMutation,
|
|
240
|
-
useQueryClient
|
|
241
|
-
} from "@pelatform/ui/re/tanstack-query";
|
|
217
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
242
218
|
function useAuthMutation({
|
|
243
219
|
queryKey,
|
|
244
220
|
mutationFn,
|
|
@@ -291,11 +267,11 @@ var useOnMutateError = () => {
|
|
|
291
267
|
// src/hooks/auth-query.ts
|
|
292
268
|
import { useContext as useContext4 } from "react";
|
|
293
269
|
import { skipToken } from "@tanstack/query-core";
|
|
294
|
-
import { useQuery as useQuery2 } from "@
|
|
270
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
295
271
|
|
|
296
272
|
// src/hooks/use-session.ts
|
|
297
273
|
import { useContext as useContext3 } from "react";
|
|
298
|
-
import { useQuery } from "@
|
|
274
|
+
import { useQuery } from "@tanstack/react-query";
|
|
299
275
|
function useSession(options) {
|
|
300
276
|
const { authClient } = useConfig();
|
|
301
277
|
const { sessionQueryOptions, queryOptions, queryKey } = useContext3(QueryContext);
|
|
@@ -389,10 +365,7 @@ function useListApiKeys(options) {
|
|
|
389
365
|
|
|
390
366
|
// src/hooks/device-sessions.ts
|
|
391
367
|
import { useContext as useContext7 } from "react";
|
|
392
|
-
import {
|
|
393
|
-
useMutation as useMutation2,
|
|
394
|
-
useQueryClient as useQueryClient2
|
|
395
|
-
} from "@pelatform/ui/re/tanstack-query";
|
|
368
|
+
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
396
369
|
function useListDeviceSessions(options) {
|
|
397
370
|
const { authClient } = useConfig();
|
|
398
371
|
const { queryKey } = useContext7(QueryContext);
|
|
@@ -549,11 +522,27 @@ function useUpdateUser(options) {
|
|
|
549
522
|
});
|
|
550
523
|
}
|
|
551
524
|
|
|
525
|
+
// src/hooks/use-invitation.ts
|
|
526
|
+
import { useContext as useContext12 } from "react";
|
|
527
|
+
function useInvitation(params, options) {
|
|
528
|
+
const { authClient } = useConfig();
|
|
529
|
+
const { queryKey: key } = useContext12(QueryContext);
|
|
530
|
+
const queryKey = [key.invitationKey, JSON.stringify(params)];
|
|
531
|
+
return useAuthQuery({
|
|
532
|
+
queryKey,
|
|
533
|
+
queryFn: (fnParams) => authClient.organization.getInvitation({
|
|
534
|
+
...params,
|
|
535
|
+
...fnParams
|
|
536
|
+
}),
|
|
537
|
+
options
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
|
|
552
541
|
// src/ui/account/dialogs/backup-codes.tsx
|
|
553
542
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
554
543
|
import { useTranslations as useTranslations2 } from "next-intl";
|
|
555
|
-
import { Button as Button2 } from "
|
|
556
|
-
import { useCopyToClipboard } from "
|
|
544
|
+
import { Button as Button2 } from "pelatform-ui/default";
|
|
545
|
+
import { useCopyToClipboard } from "pelatform-ui/hooks";
|
|
557
546
|
import { cn as cn2 } from "@pelatform/utils";
|
|
558
547
|
|
|
559
548
|
// src/ui/shared/components/dialog.tsx
|
|
@@ -566,7 +555,7 @@ import {
|
|
|
566
555
|
DialogFooter,
|
|
567
556
|
DialogHeader,
|
|
568
557
|
DialogTitle
|
|
569
|
-
} from "
|
|
558
|
+
} from "pelatform-ui/default";
|
|
570
559
|
import { cn } from "@pelatform/utils";
|
|
571
560
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
572
561
|
function DialogComponent({
|
|
@@ -686,8 +675,9 @@ function BackupCodesDialog({
|
|
|
686
675
|
|
|
687
676
|
// src/ui/account/dialogs/delete-account.tsx
|
|
688
677
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
678
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
689
679
|
import { useTranslations as useTranslations5 } from "next-intl";
|
|
690
|
-
import { AlertToast } from "
|
|
680
|
+
import { AlertToast } from "pelatform-ui/components";
|
|
691
681
|
import {
|
|
692
682
|
Button as Button4,
|
|
693
683
|
Card,
|
|
@@ -698,16 +688,15 @@ import {
|
|
|
698
688
|
FormLabel,
|
|
699
689
|
FormMessage,
|
|
700
690
|
Spinner
|
|
701
|
-
} from "
|
|
702
|
-
import { useForm } from "
|
|
703
|
-
import {
|
|
704
|
-
import { z } from "@pelatform/ui/re/zod";
|
|
691
|
+
} from "pelatform-ui/default";
|
|
692
|
+
import { useForm } from "react-hook-form";
|
|
693
|
+
import { z } from "zod";
|
|
705
694
|
import { cn as cn6 } from "@pelatform/utils";
|
|
706
695
|
|
|
707
696
|
// src/ui/shared/password-input.tsx
|
|
708
697
|
import { useState as useState2 } from "react";
|
|
709
698
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
710
|
-
import { Button as Button3, Input } from "
|
|
699
|
+
import { Button as Button3, Input } from "pelatform-ui/default";
|
|
711
700
|
import { cn as cn3 } from "@pelatform/utils";
|
|
712
701
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
713
702
|
function PasswordInput({
|
|
@@ -761,14 +750,14 @@ function PasswordInput({
|
|
|
761
750
|
// src/ui/shared/view.tsx
|
|
762
751
|
import { KeyRoundIcon } from "lucide-react";
|
|
763
752
|
import { useLocale, useTranslations as useTranslations4 } from "next-intl";
|
|
764
|
-
import { Skeleton as Skeleton2 } from "
|
|
753
|
+
import { Skeleton as Skeleton2 } from "pelatform-ui/default";
|
|
765
754
|
import { cn as cn5 } from "@pelatform/utils";
|
|
766
755
|
|
|
767
756
|
// src/ui/shared/avatar.tsx
|
|
768
|
-
import { UserRoundIcon } from "lucide-react";
|
|
757
|
+
import { BuildingIcon, UserRoundIcon } from "lucide-react";
|
|
769
758
|
import { useTranslations as useTranslations3 } from "next-intl";
|
|
770
|
-
import { getInitials } from "
|
|
771
|
-
import { Avatar, AvatarFallback, AvatarImage, Skeleton } from "
|
|
759
|
+
import { getInitials } from "pelatform-ui/components";
|
|
760
|
+
import { Avatar, AvatarFallback, AvatarImage, Skeleton } from "pelatform-ui/default";
|
|
772
761
|
import { cn as cn4 } from "@pelatform/utils";
|
|
773
762
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
774
763
|
function getSize(size) {
|
|
@@ -828,6 +817,57 @@ function UserAvatar({
|
|
|
828
817
|
}
|
|
829
818
|
);
|
|
830
819
|
}
|
|
820
|
+
function WorkspaceLogo({
|
|
821
|
+
className,
|
|
822
|
+
classNames,
|
|
823
|
+
isPending,
|
|
824
|
+
size,
|
|
825
|
+
workspace,
|
|
826
|
+
...props
|
|
827
|
+
}) {
|
|
828
|
+
const t = useTranslations3();
|
|
829
|
+
const name = workspace?.name;
|
|
830
|
+
const src = workspace?.logo;
|
|
831
|
+
if (isPending) {
|
|
832
|
+
return /* @__PURE__ */ jsx5(
|
|
833
|
+
Skeleton,
|
|
834
|
+
{
|
|
835
|
+
className: cn4(
|
|
836
|
+
"shrink-0 rounded-full",
|
|
837
|
+
getSize(size),
|
|
838
|
+
className,
|
|
839
|
+
classNames?.base,
|
|
840
|
+
classNames?.skeleton
|
|
841
|
+
)
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
return /* @__PURE__ */ jsxs4(
|
|
846
|
+
Avatar,
|
|
847
|
+
{
|
|
848
|
+
className: cn4("rounded-full bg-accent", getSize(size), className, classNames?.base),
|
|
849
|
+
...props,
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ jsx5(
|
|
852
|
+
AvatarImage,
|
|
853
|
+
{
|
|
854
|
+
src: src || void 0,
|
|
855
|
+
alt: name || t("systems.ORGANIZATION"),
|
|
856
|
+
className: classNames?.image
|
|
857
|
+
}
|
|
858
|
+
),
|
|
859
|
+
/* @__PURE__ */ jsx5(
|
|
860
|
+
AvatarFallback,
|
|
861
|
+
{
|
|
862
|
+
className: cn4("text-foreground", classNames?.fallback),
|
|
863
|
+
delayMs: src ? 600 : void 0,
|
|
864
|
+
children: /* @__PURE__ */ jsx5(BuildingIcon, { className: cn4("size-[50%]", classNames?.fallbackIcon) })
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
]
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
}
|
|
831
871
|
|
|
832
872
|
// src/ui/shared/view.tsx
|
|
833
873
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -919,6 +959,68 @@ function ApiKeyView({ className, classNames, apiKey }) {
|
|
|
919
959
|
] })
|
|
920
960
|
] });
|
|
921
961
|
}
|
|
962
|
+
function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
963
|
+
const t = useTranslations4();
|
|
964
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn5("flex items-center gap-2 truncate", className, classNames?.base), children: [
|
|
965
|
+
/* @__PURE__ */ jsx6(
|
|
966
|
+
WorkspaceLogo,
|
|
967
|
+
{
|
|
968
|
+
className: cn5(size !== "sm" && "my-0.5"),
|
|
969
|
+
classNames: classNames?.avatar,
|
|
970
|
+
isPending,
|
|
971
|
+
workspace,
|
|
972
|
+
size
|
|
973
|
+
}
|
|
974
|
+
),
|
|
975
|
+
/* @__PURE__ */ jsx6("div", { className: cn5("flex flex-col truncate text-start leading-tight", classNames?.content), children: isPending ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
976
|
+
/* @__PURE__ */ jsx6(
|
|
977
|
+
Skeleton2,
|
|
978
|
+
{
|
|
979
|
+
className: cn5(
|
|
980
|
+
"max-w-full",
|
|
981
|
+
size === "lg" ? "h-4.5 w-32" : "h-3.5 w-24",
|
|
982
|
+
classNames?.title,
|
|
983
|
+
classNames?.skeleton
|
|
984
|
+
)
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
size !== "sm" && /* @__PURE__ */ jsx6(
|
|
988
|
+
Skeleton2,
|
|
989
|
+
{
|
|
990
|
+
className: cn5(
|
|
991
|
+
"mt-1.5 max-w-full",
|
|
992
|
+
size === "lg" ? "h-3.5 w-24" : "h-3 w-16",
|
|
993
|
+
classNames?.subtitle,
|
|
994
|
+
classNames?.skeleton
|
|
995
|
+
)
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
999
|
+
/* @__PURE__ */ jsx6(
|
|
1000
|
+
"span",
|
|
1001
|
+
{
|
|
1002
|
+
className: cn5(
|
|
1003
|
+
"truncate font-semibold",
|
|
1004
|
+
size === "lg" ? "text-base" : "text-sm",
|
|
1005
|
+
classNames?.title
|
|
1006
|
+
),
|
|
1007
|
+
children: workspace?.name || t("systems.ORGANIZATION")
|
|
1008
|
+
}
|
|
1009
|
+
),
|
|
1010
|
+
size !== "sm" && workspace?.slug && /* @__PURE__ */ jsx6(
|
|
1011
|
+
"span",
|
|
1012
|
+
{
|
|
1013
|
+
className: cn5(
|
|
1014
|
+
"truncate opacity-70",
|
|
1015
|
+
size === "lg" ? "text-sm" : "text-xs",
|
|
1016
|
+
classNames?.subtitle
|
|
1017
|
+
),
|
|
1018
|
+
children: workspace.slug
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1021
|
+
] }) })
|
|
1022
|
+
] });
|
|
1023
|
+
}
|
|
922
1024
|
|
|
923
1025
|
// src/ui/account/dialogs/delete-account.tsx
|
|
924
1026
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -1046,7 +1148,7 @@ function DeleteAccountDialog({
|
|
|
1046
1148
|
// src/ui/account/dialogs/session-freshness.tsx
|
|
1047
1149
|
import { useRouter as useRouter3 } from "next/navigation";
|
|
1048
1150
|
import { useTranslations as useTranslations6 } from "next-intl";
|
|
1049
|
-
import { Button as Button5 } from "
|
|
1151
|
+
import { Button as Button5 } from "pelatform-ui/default";
|
|
1050
1152
|
import { cn as cn7 } from "@pelatform/utils";
|
|
1051
1153
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1052
1154
|
function SessionFreshnessDialog({
|
|
@@ -1088,8 +1190,9 @@ function SessionFreshnessDialog({
|
|
|
1088
1190
|
// src/ui/account/dialogs/two-factor-password.tsx
|
|
1089
1191
|
import { useState as useState3 } from "react";
|
|
1090
1192
|
import { useRouter as useRouter4 } from "next/navigation";
|
|
1193
|
+
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
|
1091
1194
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
1092
|
-
import { AlertToast as AlertToast2 } from "
|
|
1195
|
+
import { AlertToast as AlertToast2 } from "pelatform-ui/components";
|
|
1093
1196
|
import {
|
|
1094
1197
|
Button as Button6,
|
|
1095
1198
|
Form as Form2,
|
|
@@ -1099,10 +1202,9 @@ import {
|
|
|
1099
1202
|
FormLabel as FormLabel2,
|
|
1100
1203
|
FormMessage as FormMessage2,
|
|
1101
1204
|
Spinner as Spinner2
|
|
1102
|
-
} from "
|
|
1103
|
-
import { useForm as useForm2 } from "
|
|
1104
|
-
import {
|
|
1105
|
-
import { z as z2 } from "@pelatform/ui/re/zod";
|
|
1205
|
+
} from "pelatform-ui/default";
|
|
1206
|
+
import { useForm as useForm2 } from "react-hook-form";
|
|
1207
|
+
import { z as z2 } from "zod";
|
|
1106
1208
|
import { cn as cn8 } from "@pelatform/utils";
|
|
1107
1209
|
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1108
1210
|
function TwoFactorPasswordDialog({
|
|
@@ -1250,8 +1352,8 @@ import { useState as useState4 } from "react";
|
|
|
1250
1352
|
import { useTranslations as useTranslations8 } from "next-intl";
|
|
1251
1353
|
|
|
1252
1354
|
// src/ui/shared/components/card.tsx
|
|
1253
|
-
import { Button as Button7, Card as Card2, CardContent, CardFooter, Skeleton as Skeleton3, Spinner as Spinner3 } from "
|
|
1254
|
-
import { useFormState } from "
|
|
1355
|
+
import { Button as Button7, Card as Card2, CardContent, CardFooter, Skeleton as Skeleton3, Spinner as Spinner3 } from "pelatform-ui/default";
|
|
1356
|
+
import { useFormState } from "react-hook-form";
|
|
1255
1357
|
import { cn as cn9 } from "@pelatform/utils";
|
|
1256
1358
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1257
1359
|
function CardComponent({
|
|
@@ -1467,14 +1569,14 @@ function DeleteAccountCard({
|
|
|
1467
1569
|
import { useRef, useState as useState5 } from "react";
|
|
1468
1570
|
import { Trash2Icon, UploadCloudIcon } from "lucide-react";
|
|
1469
1571
|
import { useTranslations as useTranslations9 } from "next-intl";
|
|
1470
|
-
import { AlertToast as AlertToast3 } from "
|
|
1572
|
+
import { AlertToast as AlertToast3 } from "pelatform-ui/components";
|
|
1471
1573
|
import {
|
|
1472
1574
|
Button as Button8,
|
|
1473
1575
|
DropdownMenu,
|
|
1474
1576
|
DropdownMenuContent,
|
|
1475
1577
|
DropdownMenuItem,
|
|
1476
1578
|
DropdownMenuTrigger
|
|
1477
|
-
} from "
|
|
1579
|
+
} from "pelatform-ui/default";
|
|
1478
1580
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1479
1581
|
function FormAvatarCard({
|
|
1480
1582
|
className,
|
|
@@ -1597,8 +1699,9 @@ function FormAvatarCard({
|
|
|
1597
1699
|
|
|
1598
1700
|
// src/ui/account/partials/form-email.tsx
|
|
1599
1701
|
import { useState as useState6 } from "react";
|
|
1702
|
+
import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
|
|
1600
1703
|
import { useTranslations as useTranslations10 } from "next-intl";
|
|
1601
|
-
import { AlertToast as AlertToast4 } from "
|
|
1704
|
+
import { AlertToast as AlertToast4 } from "pelatform-ui/components";
|
|
1602
1705
|
import {
|
|
1603
1706
|
Form as Form3,
|
|
1604
1707
|
FormControl as FormControl3,
|
|
@@ -1607,10 +1710,9 @@ import {
|
|
|
1607
1710
|
FormMessage as FormMessage3,
|
|
1608
1711
|
Input as Input2,
|
|
1609
1712
|
Skeleton as Skeleton4
|
|
1610
|
-
} from "
|
|
1611
|
-
import { useForm as useForm3 } from "
|
|
1612
|
-
import {
|
|
1613
|
-
import { z as z3 } from "@pelatform/ui/re/zod";
|
|
1713
|
+
} from "pelatform-ui/default";
|
|
1714
|
+
import { useForm as useForm3 } from "react-hook-form";
|
|
1715
|
+
import { z as z3 } from "zod";
|
|
1614
1716
|
import { cn as cn10 } from "@pelatform/utils";
|
|
1615
1717
|
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1616
1718
|
function FormEmailCard({ className, classNames, ...props }) {
|
|
@@ -1730,8 +1832,9 @@ function FormEmailCard({ className, classNames, ...props }) {
|
|
|
1730
1832
|
}
|
|
1731
1833
|
|
|
1732
1834
|
// src/ui/account/partials/form-fields.tsx
|
|
1835
|
+
import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
|
|
1733
1836
|
import { useTranslations as useTranslations11 } from "next-intl";
|
|
1734
|
-
import { AlertToast as AlertToast5 } from "
|
|
1837
|
+
import { AlertToast as AlertToast5 } from "pelatform-ui/components";
|
|
1735
1838
|
import {
|
|
1736
1839
|
Checkbox,
|
|
1737
1840
|
Form as Form4,
|
|
@@ -1743,10 +1846,9 @@ import {
|
|
|
1743
1846
|
Input as Input3,
|
|
1744
1847
|
Skeleton as Skeleton5,
|
|
1745
1848
|
Textarea
|
|
1746
|
-
} from "
|
|
1747
|
-
import { useForm as useForm4 } from "
|
|
1748
|
-
import {
|
|
1749
|
-
import { z as z4 } from "@pelatform/ui/re/zod";
|
|
1849
|
+
} from "pelatform-ui/default";
|
|
1850
|
+
import { useForm as useForm4 } from "react-hook-form";
|
|
1851
|
+
import { z as z4 } from "zod";
|
|
1750
1852
|
import { cn as cn11 } from "@pelatform/utils";
|
|
1751
1853
|
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1752
1854
|
function FormFieldsCard({
|
|
@@ -1930,8 +2032,9 @@ function FormNameCard({ className, classNames, ...props }) {
|
|
|
1930
2032
|
}
|
|
1931
2033
|
|
|
1932
2034
|
// src/ui/account/partials/form-password.tsx
|
|
2035
|
+
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
|
1933
2036
|
import { useTranslations as useTranslations13 } from "next-intl";
|
|
1934
|
-
import { AlertToast as AlertToast6 } from "
|
|
2037
|
+
import { AlertToast as AlertToast6 } from "pelatform-ui/components";
|
|
1935
2038
|
import {
|
|
1936
2039
|
Form as Form5,
|
|
1937
2040
|
FormControl as FormControl5,
|
|
@@ -1939,14 +2042,13 @@ import {
|
|
|
1939
2042
|
FormItem as FormItem5,
|
|
1940
2043
|
FormLabel as FormLabel4,
|
|
1941
2044
|
FormMessage as FormMessage5
|
|
1942
|
-
} from "
|
|
1943
|
-
import { useForm as useForm5 } from "
|
|
1944
|
-
import {
|
|
1945
|
-
import { z as z5 } from "@pelatform/ui/re/zod";
|
|
2045
|
+
} from "pelatform-ui/default";
|
|
2046
|
+
import { useForm as useForm5 } from "react-hook-form";
|
|
2047
|
+
import { z as z5 } from "zod";
|
|
1946
2048
|
import { cn as cn13 } from "@pelatform/utils";
|
|
1947
2049
|
|
|
1948
2050
|
// src/ui/shared/components/skeleton.tsx
|
|
1949
|
-
import { Card as Card3, Skeleton as Skeleton6 } from "
|
|
2051
|
+
import { Card as Card3, Skeleton as Skeleton6 } from "pelatform-ui/default";
|
|
1950
2052
|
import { cn as cn12 } from "@pelatform/utils";
|
|
1951
2053
|
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1952
2054
|
function SkeletonViewComponent({ classNames }) {
|
|
@@ -2171,7 +2273,7 @@ import { useState as useState7 } from "react";
|
|
|
2171
2273
|
import { useRouter as useRouter5 } from "next/navigation";
|
|
2172
2274
|
import { EllipsisIcon, LogOutIcon, RepeatIcon, UserX2Icon } from "lucide-react";
|
|
2173
2275
|
import { useTranslations as useTranslations15 } from "next-intl";
|
|
2174
|
-
import { AlertToast as AlertToast7 } from "
|
|
2276
|
+
import { AlertToast as AlertToast7 } from "pelatform-ui/components";
|
|
2175
2277
|
import {
|
|
2176
2278
|
Button as Button9,
|
|
2177
2279
|
Card as Card4,
|
|
@@ -2180,7 +2282,7 @@ import {
|
|
|
2180
2282
|
DropdownMenuItem as DropdownMenuItem2,
|
|
2181
2283
|
DropdownMenuTrigger as DropdownMenuTrigger2,
|
|
2182
2284
|
Spinner as Spinner4
|
|
2183
|
-
} from "
|
|
2285
|
+
} from "pelatform-ui/default";
|
|
2184
2286
|
import { cn as cn14 } from "@pelatform/utils";
|
|
2185
2287
|
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2186
2288
|
function MultiAccountCard({ className, classNames, ...props }) {
|
|
@@ -2323,9 +2425,9 @@ function MultiAccountCell({
|
|
|
2323
2425
|
import { useState as useState8 } from "react";
|
|
2324
2426
|
import { FingerprintIcon } from "lucide-react";
|
|
2325
2427
|
import { useTranslations as useTranslations16 } from "next-intl";
|
|
2326
|
-
import { AlertToast as AlertToast8 } from "
|
|
2327
|
-
import { Button as Button10, Card as Card5, Form as Form6, Spinner as Spinner5 } from "
|
|
2328
|
-
import { useForm as useForm6 } from "
|
|
2428
|
+
import { AlertToast as AlertToast8 } from "pelatform-ui/components";
|
|
2429
|
+
import { Button as Button10, Card as Card5, Form as Form6, Spinner as Spinner5 } from "pelatform-ui/default";
|
|
2430
|
+
import { useForm as useForm6 } from "react-hook-form";
|
|
2329
2431
|
import { cn as cn15 } from "@pelatform/utils";
|
|
2330
2432
|
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2331
2433
|
function PasskeysCard({ className, classNames, ...props }) {
|
|
@@ -2449,8 +2551,8 @@ function PasskeyCell({
|
|
|
2449
2551
|
// src/ui/account/partials/providers.tsx
|
|
2450
2552
|
import { useState as useState9 } from "react";
|
|
2451
2553
|
import { useTranslations as useTranslations17 } from "next-intl";
|
|
2452
|
-
import { AlertToast as AlertToast9 } from "
|
|
2453
|
-
import { Button as Button11, Card as Card6, Skeleton as Skeleton7, Spinner as Spinner6 } from "
|
|
2554
|
+
import { AlertToast as AlertToast9 } from "pelatform-ui/components";
|
|
2555
|
+
import { Button as Button11, Card as Card6, Skeleton as Skeleton7, Spinner as Spinner6 } from "pelatform-ui/default";
|
|
2454
2556
|
import { cn as cn16 } from "@pelatform/utils";
|
|
2455
2557
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2456
2558
|
function ProvidersCard({
|
|
@@ -2580,9 +2682,9 @@ import { useState as useState10 } from "react";
|
|
|
2580
2682
|
import { useRouter as useRouter6 } from "next/navigation";
|
|
2581
2683
|
import { LaptopIcon, SmartphoneIcon } from "lucide-react";
|
|
2582
2684
|
import { useTranslations as useTranslations18 } from "next-intl";
|
|
2685
|
+
import { AlertToast as AlertToast10 } from "pelatform-ui/components";
|
|
2686
|
+
import { Button as Button12, Card as Card7, Spinner as Spinner7 } from "pelatform-ui/default";
|
|
2583
2687
|
import { UAParser } from "ua-parser-js";
|
|
2584
|
-
import { AlertToast as AlertToast10 } from "@pelatform/ui/components";
|
|
2585
|
-
import { Button as Button12, Card as Card7, Spinner as Spinner7 } from "@pelatform/ui/default";
|
|
2586
2688
|
import { cn as cn17 } from "@pelatform/utils";
|
|
2587
2689
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2588
2690
|
function SessionsCard({ className, classNames, ...props }) {
|
|
@@ -2765,8 +2867,8 @@ import {
|
|
|
2765
2867
|
TooltipContent,
|
|
2766
2868
|
TooltipProvider,
|
|
2767
2869
|
TooltipTrigger
|
|
2768
|
-
} from "
|
|
2769
|
-
import { useCopyToClipboard as useCopyToClipboard2 } from "
|
|
2870
|
+
} from "pelatform-ui/default";
|
|
2871
|
+
import { useCopyToClipboard as useCopyToClipboard2 } from "pelatform-ui/hooks";
|
|
2770
2872
|
import { cn as cn19 } from "@pelatform/utils";
|
|
2771
2873
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2772
2874
|
function DisplayIdCard({
|
|
@@ -2847,12 +2949,13 @@ function SettingsCards({
|
|
|
2847
2949
|
// src/ui/apikeys/apikeys.tsx
|
|
2848
2950
|
import { useMemo as useMemo2, useState as useState13 } from "react";
|
|
2849
2951
|
import { useTranslations as useTranslations25 } from "next-intl";
|
|
2850
|
-
import { Button as Button17, Card as Card9 } from "
|
|
2952
|
+
import { Button as Button17, Card as Card9 } from "pelatform-ui/default";
|
|
2851
2953
|
import { cn as cn24 } from "@pelatform/utils";
|
|
2852
2954
|
|
|
2853
2955
|
// src/ui/apikeys/create-apikey.tsx
|
|
2956
|
+
import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
|
|
2854
2957
|
import { useLocale as useLocale2, useTranslations as useTranslations22 } from "next-intl";
|
|
2855
|
-
import { AlertToast as AlertToast11 } from "
|
|
2958
|
+
import { AlertToast as AlertToast11 } from "pelatform-ui/components";
|
|
2856
2959
|
import {
|
|
2857
2960
|
Button as Button14,
|
|
2858
2961
|
Form as Form7,
|
|
@@ -2868,10 +2971,9 @@ import {
|
|
|
2868
2971
|
SelectTrigger,
|
|
2869
2972
|
SelectValue,
|
|
2870
2973
|
Spinner as Spinner8
|
|
2871
|
-
} from "
|
|
2872
|
-
import { useForm as useForm7 } from "
|
|
2873
|
-
import {
|
|
2874
|
-
import { z as z6 } from "@pelatform/ui/re/zod";
|
|
2974
|
+
} from "pelatform-ui/default";
|
|
2975
|
+
import { useForm as useForm7 } from "react-hook-form";
|
|
2976
|
+
import { z as z6 } from "zod";
|
|
2875
2977
|
import { cn as cn21 } from "@pelatform/utils";
|
|
2876
2978
|
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2877
2979
|
function CreateApiKeyDialog({
|
|
@@ -3011,8 +3113,8 @@ function CreateApiKeyDialog({
|
|
|
3011
3113
|
// src/ui/apikeys/delete-apikey.tsx
|
|
3012
3114
|
import { useState as useState12 } from "react";
|
|
3013
3115
|
import { useTranslations as useTranslations23 } from "next-intl";
|
|
3014
|
-
import { AlertToast as AlertToast12 } from "
|
|
3015
|
-
import { Button as Button15, Card as Card8, Spinner as Spinner9 } from "
|
|
3116
|
+
import { AlertToast as AlertToast12 } from "pelatform-ui/components";
|
|
3117
|
+
import { Button as Button15, Card as Card8, Spinner as Spinner9 } from "pelatform-ui/default";
|
|
3016
3118
|
import { cn as cn22 } from "@pelatform/utils";
|
|
3017
3119
|
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3018
3120
|
function ApiKeyDeleteDialog({
|
|
@@ -3073,8 +3175,8 @@ function ApiKeyDeleteDialog({
|
|
|
3073
3175
|
// src/ui/apikeys/display-apikey.tsx
|
|
3074
3176
|
import { CheckIcon as CheckIcon3, CopyIcon as CopyIcon3 } from "lucide-react";
|
|
3075
3177
|
import { useTranslations as useTranslations24 } from "next-intl";
|
|
3076
|
-
import { Button as Button16 } from "
|
|
3077
|
-
import { useCopyToClipboard as useCopyToClipboard3 } from "
|
|
3178
|
+
import { Button as Button16 } from "pelatform-ui/default";
|
|
3179
|
+
import { useCopyToClipboard as useCopyToClipboard3 } from "pelatform-ui/hooks";
|
|
3078
3180
|
import { cn as cn23 } from "@pelatform/utils";
|
|
3079
3181
|
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3080
3182
|
function ApiKeyDisplayDialog({
|
|
@@ -3237,12 +3339,12 @@ function ApiKeyCell({
|
|
|
3237
3339
|
import { useRouter as useRouter7 } from "next/navigation";
|
|
3238
3340
|
import { LockIcon, MailIcon } from "lucide-react";
|
|
3239
3341
|
import { useTranslations as useTranslations27 } from "next-intl";
|
|
3240
|
-
import { Button as Button18 } from "
|
|
3342
|
+
import { Button as Button18 } from "pelatform-ui/default";
|
|
3241
3343
|
import { cn as cn26 } from "@pelatform/utils";
|
|
3242
3344
|
|
|
3243
3345
|
// src/ui/auth/partials/last-used-button.tsx
|
|
3244
3346
|
import { useTranslations as useTranslations26 } from "next-intl";
|
|
3245
|
-
import { Badge } from "
|
|
3347
|
+
import { Badge } from "pelatform-ui/default";
|
|
3246
3348
|
import { cn as cn25 } from "@pelatform/utils";
|
|
3247
3349
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3248
3350
|
function LastUsedButton({
|
|
@@ -3304,7 +3406,7 @@ function EmailOTPButton({ className, classNames, isSubmitting, view }) {
|
|
|
3304
3406
|
import { useRouter as useRouter8 } from "next/navigation";
|
|
3305
3407
|
import { LockIcon as LockIcon2, MailIcon as MailIcon2 } from "lucide-react";
|
|
3306
3408
|
import { useTranslations as useTranslations28 } from "next-intl";
|
|
3307
|
-
import { Button as Button19 } from "
|
|
3409
|
+
import { Button as Button19 } from "pelatform-ui/default";
|
|
3308
3410
|
import { cn as cn27 } from "@pelatform/utils";
|
|
3309
3411
|
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3310
3412
|
function MagicLinkButton({ className, classNames, isSubmitting, view }) {
|
|
@@ -3341,7 +3443,7 @@ function MagicLinkButton({ className, classNames, isSubmitting, view }) {
|
|
|
3341
3443
|
// src/ui/auth/partials/one-tap.tsx
|
|
3342
3444
|
import { useEffect as useEffect2, useRef as useRef3 } from "react";
|
|
3343
3445
|
import { useTranslations as useTranslations29 } from "next-intl";
|
|
3344
|
-
import { AlertToast as AlertToast13 } from "
|
|
3446
|
+
import { AlertToast as AlertToast13 } from "pelatform-ui/components";
|
|
3345
3447
|
function OneTap({ redirectTo }) {
|
|
3346
3448
|
const { authClient } = useConfig();
|
|
3347
3449
|
const t = useTranslations29();
|
|
@@ -3373,8 +3475,8 @@ function OneTap({ redirectTo }) {
|
|
|
3373
3475
|
// src/ui/auth/partials/passkey-button.tsx
|
|
3374
3476
|
import { FingerprintIcon as FingerprintIcon2 } from "lucide-react";
|
|
3375
3477
|
import { useTranslations as useTranslations30 } from "next-intl";
|
|
3376
|
-
import { AlertToast as AlertToast14 } from "
|
|
3377
|
-
import { Button as Button20 } from "
|
|
3478
|
+
import { AlertToast as AlertToast14 } from "pelatform-ui/components";
|
|
3479
|
+
import { Button as Button20 } from "pelatform-ui/default";
|
|
3378
3480
|
import { cn as cn28 } from "@pelatform/utils";
|
|
3379
3481
|
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3380
3482
|
function PasskeyButton({
|
|
@@ -3439,8 +3541,8 @@ function PasskeyButton({
|
|
|
3439
3541
|
// src/ui/auth/partials/provider-button.tsx
|
|
3440
3542
|
import { useSearchParams as useSearchParams2 } from "next/navigation";
|
|
3441
3543
|
import { useTranslations as useTranslations31 } from "next-intl";
|
|
3442
|
-
import { AlertToast as AlertToast15 } from "
|
|
3443
|
-
import { Button as Button21 } from "
|
|
3544
|
+
import { AlertToast as AlertToast15 } from "pelatform-ui/components";
|
|
3545
|
+
import { Button as Button21 } from "pelatform-ui/default";
|
|
3444
3546
|
import { cn as cn29, REDIRECT_QUERY_PARAM as REDIRECT_QUERY_PARAM2 } from "@pelatform/utils";
|
|
3445
3547
|
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3446
3548
|
function ProviderButton({
|
|
@@ -3501,27 +3603,228 @@ function ProviderButton({
|
|
|
3501
3603
|
);
|
|
3502
3604
|
}
|
|
3503
3605
|
|
|
3606
|
+
// src/ui/auth/accept-invitation.tsx
|
|
3607
|
+
import { useEffect as useEffect3, useState as useState14 } from "react";
|
|
3608
|
+
import { useRouter as useRouter9, useSearchParams as useSearchParams3 } from "next/navigation";
|
|
3609
|
+
import { CheckIcon as CheckIcon4, XIcon } from "lucide-react";
|
|
3610
|
+
import { useTranslations as useTranslations32 } from "next-intl";
|
|
3611
|
+
import { AlertToast as AlertToast16 } from "pelatform-ui/components";
|
|
3612
|
+
import { Button as Button22, Card as Card10, CardContent as CardContent2, CardHeader, Skeleton as Skeleton9, Spinner as Spinner10 } from "pelatform-ui/default";
|
|
3613
|
+
import { cn as cn30 } from "@pelatform/utils";
|
|
3614
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3615
|
+
function AcceptInvitation({
|
|
3616
|
+
className,
|
|
3617
|
+
classNames,
|
|
3618
|
+
redirectTo: redirectToProp
|
|
3619
|
+
}) {
|
|
3620
|
+
const router = useRouter9();
|
|
3621
|
+
const searchParams = useSearchParams3();
|
|
3622
|
+
const t = useTranslations32();
|
|
3623
|
+
const { data: sessionData } = useSession();
|
|
3624
|
+
const { redirectTo } = useOnSuccessTransition(redirectToProp);
|
|
3625
|
+
const [invitationId, setInvitationId] = useState14(null);
|
|
3626
|
+
useEffect3(() => {
|
|
3627
|
+
const invitationIdParam = searchParams.get("invitationId");
|
|
3628
|
+
if (!invitationIdParam) {
|
|
3629
|
+
AlertToast16({
|
|
3630
|
+
message: t("systems.INVITATION_NOT_FOUND"),
|
|
3631
|
+
icon: "destructive"
|
|
3632
|
+
});
|
|
3633
|
+
router.replace(redirectTo);
|
|
3634
|
+
return;
|
|
3635
|
+
}
|
|
3636
|
+
setInvitationId(invitationIdParam);
|
|
3637
|
+
}, [router, redirectTo, searchParams.get, t]);
|
|
3638
|
+
if (!sessionData || !invitationId) {
|
|
3639
|
+
return /* @__PURE__ */ jsx36(AcceptInvitationSkeleton, { className, classNames });
|
|
3640
|
+
}
|
|
3641
|
+
return /* @__PURE__ */ jsx36(
|
|
3642
|
+
AcceptInvitationContent,
|
|
3643
|
+
{
|
|
3644
|
+
className,
|
|
3645
|
+
classNames,
|
|
3646
|
+
invitationId,
|
|
3647
|
+
redirectTo
|
|
3648
|
+
}
|
|
3649
|
+
);
|
|
3650
|
+
}
|
|
3651
|
+
function AcceptInvitationContent({
|
|
3652
|
+
className,
|
|
3653
|
+
classNames,
|
|
3654
|
+
invitationId,
|
|
3655
|
+
redirectTo
|
|
3656
|
+
}) {
|
|
3657
|
+
const { authClient } = useConfig();
|
|
3658
|
+
const router = useRouter9();
|
|
3659
|
+
const t = useTranslations32();
|
|
3660
|
+
const { data: invitation, isPending } = useInvitation({
|
|
3661
|
+
query: {
|
|
3662
|
+
id: invitationId
|
|
3663
|
+
}
|
|
3664
|
+
});
|
|
3665
|
+
const [isRejecting, setIsRejecting] = useState14(false);
|
|
3666
|
+
const [isAccepting, setIsAccepting] = useState14(false);
|
|
3667
|
+
const isProcessing = isRejecting || isAccepting;
|
|
3668
|
+
useEffect3(() => {
|
|
3669
|
+
if (isPending || !invitationId) return;
|
|
3670
|
+
if (!invitation) {
|
|
3671
|
+
AlertToast16({
|
|
3672
|
+
message: t("systems.INVITATION_NOT_FOUND"),
|
|
3673
|
+
icon: "destructive"
|
|
3674
|
+
});
|
|
3675
|
+
router.replace(redirectTo);
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
if (invitation.status !== "pending" || new Date(invitation.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
3679
|
+
AlertToast16({
|
|
3680
|
+
message: new Date(invitation.expiresAt) < /* @__PURE__ */ new Date() ? t("systems.INVITATION_EXPIRED") : t("systems.INVITATION_NOT_FOUND"),
|
|
3681
|
+
icon: "destructive"
|
|
3682
|
+
});
|
|
3683
|
+
router.replace(redirectTo);
|
|
3684
|
+
}
|
|
3685
|
+
}, [invitation, isPending, invitationId, router, redirectTo, t]);
|
|
3686
|
+
const acceptInvitation = async () => {
|
|
3687
|
+
setIsAccepting(true);
|
|
3688
|
+
try {
|
|
3689
|
+
await authClient.organization.acceptInvitation({
|
|
3690
|
+
invitationId,
|
|
3691
|
+
fetchOptions: { throw: true }
|
|
3692
|
+
});
|
|
3693
|
+
AlertToast16({
|
|
3694
|
+
message: t("systems.INVITATION_ACCEPTED")
|
|
3695
|
+
});
|
|
3696
|
+
router.replace(redirectTo);
|
|
3697
|
+
} catch (error) {
|
|
3698
|
+
AlertToast16({
|
|
3699
|
+
message: getTranslations({ error, t }),
|
|
3700
|
+
icon: "destructive"
|
|
3701
|
+
});
|
|
3702
|
+
setIsAccepting(false);
|
|
3703
|
+
}
|
|
3704
|
+
};
|
|
3705
|
+
const rejectInvitation = async () => {
|
|
3706
|
+
setIsRejecting(true);
|
|
3707
|
+
try {
|
|
3708
|
+
await authClient.organization.rejectInvitation({
|
|
3709
|
+
invitationId,
|
|
3710
|
+
fetchOptions: { throw: true }
|
|
3711
|
+
});
|
|
3712
|
+
AlertToast16({
|
|
3713
|
+
message: t("systems.INVITATION_REJECTED")
|
|
3714
|
+
});
|
|
3715
|
+
router.replace(redirectTo);
|
|
3716
|
+
} catch (error) {
|
|
3717
|
+
AlertToast16({
|
|
3718
|
+
message: getTranslations({ error, t }),
|
|
3719
|
+
icon: "destructive"
|
|
3720
|
+
});
|
|
3721
|
+
setIsRejecting(false);
|
|
3722
|
+
}
|
|
3723
|
+
};
|
|
3724
|
+
if (!invitation) {
|
|
3725
|
+
return /* @__PURE__ */ jsx36(AcceptInvitationSkeleton, { className, classNames });
|
|
3726
|
+
}
|
|
3727
|
+
return /* @__PURE__ */ jsxs31(Card10, { className: cn30("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
3728
|
+
/* @__PURE__ */ jsx36(CardHeader, { className: "py-4", children: /* @__PURE__ */ jsx36(
|
|
3729
|
+
CardHeaderComponent,
|
|
3730
|
+
{
|
|
3731
|
+
title: t("systems.ACCEPT_INVITATION"),
|
|
3732
|
+
description: t("systems.ACCEPT_INVITATION_DESCRIPTION")
|
|
3733
|
+
}
|
|
3734
|
+
) }),
|
|
3735
|
+
/* @__PURE__ */ jsxs31(CardContent2, { className: cn30("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
3736
|
+
/* @__PURE__ */ jsxs31(Card10, { className: cn30("flex-row items-center p-4"), children: [
|
|
3737
|
+
/* @__PURE__ */ jsx36(
|
|
3738
|
+
WorkspaceView,
|
|
3739
|
+
{
|
|
3740
|
+
workspace: {
|
|
3741
|
+
id: invitation.organizationId,
|
|
3742
|
+
name: invitation.organizationName,
|
|
3743
|
+
slug: invitation.organizationSlug,
|
|
3744
|
+
// logo: invitation.organizationLogo,
|
|
3745
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
),
|
|
3749
|
+
/* @__PURE__ */ jsx36("p", { className: "ms-auto font-semibold text-muted-foreground text-sm", children: t(`systems.${invitation?.role.toUpperCase()}`) || invitation?.role })
|
|
3750
|
+
] }),
|
|
3751
|
+
/* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
3752
|
+
/* @__PURE__ */ jsxs31(
|
|
3753
|
+
Button22,
|
|
3754
|
+
{
|
|
3755
|
+
variant: "destructive",
|
|
3756
|
+
className: cn30(classNames?.button, classNames?.destructiveButton),
|
|
3757
|
+
onClick: rejectInvitation,
|
|
3758
|
+
disabled: isProcessing,
|
|
3759
|
+
children: [
|
|
3760
|
+
isRejecting ? /* @__PURE__ */ jsx36(Spinner10, {}) : /* @__PURE__ */ jsx36(XIcon, {}),
|
|
3761
|
+
t("systems.REJECT")
|
|
3762
|
+
]
|
|
3763
|
+
}
|
|
3764
|
+
),
|
|
3765
|
+
/* @__PURE__ */ jsxs31(
|
|
3766
|
+
Button22,
|
|
3767
|
+
{
|
|
3768
|
+
className: cn30(classNames?.button, classNames?.primaryButton),
|
|
3769
|
+
onClick: acceptInvitation,
|
|
3770
|
+
disabled: isProcessing,
|
|
3771
|
+
children: [
|
|
3772
|
+
isAccepting ? /* @__PURE__ */ jsx36(Spinner10, {}) : /* @__PURE__ */ jsx36(CheckIcon4, {}),
|
|
3773
|
+
t("systems.ACCEPT")
|
|
3774
|
+
]
|
|
3775
|
+
}
|
|
3776
|
+
)
|
|
3777
|
+
] })
|
|
3778
|
+
] })
|
|
3779
|
+
] });
|
|
3780
|
+
}
|
|
3781
|
+
function AcceptInvitationSkeleton({ className, classNames }) {
|
|
3782
|
+
const t = useTranslations32();
|
|
3783
|
+
return /* @__PURE__ */ jsxs31(Card10, { className: cn30("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
3784
|
+
/* @__PURE__ */ jsx36(CardHeader, { className: "py-4", children: /* @__PURE__ */ jsx36(
|
|
3785
|
+
CardHeaderComponent,
|
|
3786
|
+
{
|
|
3787
|
+
className: "w-full",
|
|
3788
|
+
title: t("systems.ACCEPT_INVITATION"),
|
|
3789
|
+
description: t("systems.ACCEPT_INVITATION_DESCRIPTION"),
|
|
3790
|
+
isPending: true
|
|
3791
|
+
}
|
|
3792
|
+
) }),
|
|
3793
|
+
/* @__PURE__ */ jsxs31(CardContent2, { className: cn30("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
3794
|
+
/* @__PURE__ */ jsxs31(Card10, { className: cn30("flex-row items-center p-4"), children: [
|
|
3795
|
+
/* @__PURE__ */ jsx36(WorkspaceView, { isPending: true }),
|
|
3796
|
+
/* @__PURE__ */ jsx36(Skeleton9, { className: "ms-auto mt-0.5 h-4 w-full max-w-14 shrink-2" })
|
|
3797
|
+
] }),
|
|
3798
|
+
/* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
3799
|
+
/* @__PURE__ */ jsx36(Skeleton9, { className: "h-9 w-full" }),
|
|
3800
|
+
/* @__PURE__ */ jsx36(Skeleton9, { className: "h-9 w-full" })
|
|
3801
|
+
] })
|
|
3802
|
+
] })
|
|
3803
|
+
] });
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3504
3806
|
// src/ui/auth/callback.tsx
|
|
3505
|
-
import { useEffect as
|
|
3506
|
-
import { Spinner as
|
|
3507
|
-
import { jsx as
|
|
3807
|
+
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
3808
|
+
import { Spinner as Spinner11 } from "pelatform-ui/default";
|
|
3809
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3508
3810
|
function AuthCallback({ redirectTo }) {
|
|
3509
3811
|
const { onSuccess } = useOnSuccessTransition(redirectTo);
|
|
3510
3812
|
const isRedirecting = useRef4(false);
|
|
3511
|
-
|
|
3813
|
+
useEffect4(() => {
|
|
3512
3814
|
if (isRedirecting.current) return;
|
|
3513
3815
|
isRedirecting.current = true;
|
|
3514
3816
|
onSuccess();
|
|
3515
3817
|
}, [onSuccess]);
|
|
3516
|
-
return /* @__PURE__ */
|
|
3818
|
+
return /* @__PURE__ */ jsx37("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx37(Spinner11, { className: "size-12" }) });
|
|
3517
3819
|
}
|
|
3518
3820
|
|
|
3519
3821
|
// src/ui/auth/email-otp.tsx
|
|
3520
|
-
import { useEffect as
|
|
3521
|
-
import {
|
|
3522
|
-
import {
|
|
3822
|
+
import { useEffect as useEffect5, useState as useState15 } from "react";
|
|
3823
|
+
import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
|
|
3824
|
+
import { useTranslations as useTranslations33 } from "next-intl";
|
|
3825
|
+
import { AlertToast as AlertToast17 } from "pelatform-ui/components";
|
|
3523
3826
|
import {
|
|
3524
|
-
Button as
|
|
3827
|
+
Button as Button23,
|
|
3525
3828
|
Form as Form8,
|
|
3526
3829
|
FormControl as FormControl7,
|
|
3527
3830
|
FormField as FormField7,
|
|
@@ -3530,68 +3833,67 @@ import {
|
|
|
3530
3833
|
FormMessage as FormMessage7,
|
|
3531
3834
|
Input as Input6,
|
|
3532
3835
|
InputOTP,
|
|
3533
|
-
Spinner as
|
|
3534
|
-
} from "
|
|
3535
|
-
import { useForm as useForm8 } from "
|
|
3536
|
-
import {
|
|
3537
|
-
import {
|
|
3538
|
-
import { cn as cn30 } from "@pelatform/utils";
|
|
3836
|
+
Spinner as Spinner12
|
|
3837
|
+
} from "pelatform-ui/default";
|
|
3838
|
+
import { useForm as useForm8 } from "react-hook-form";
|
|
3839
|
+
import { z as z7 } from "zod";
|
|
3840
|
+
import { cn as cn31 } from "@pelatform/utils";
|
|
3539
3841
|
|
|
3540
3842
|
// src/ui/shared/otp-input-group.tsx
|
|
3541
|
-
import { InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "
|
|
3542
|
-
import { Fragment as Fragment14, jsx as
|
|
3843
|
+
import { InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "pelatform-ui/default";
|
|
3844
|
+
import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3543
3845
|
function OTPInputGroup({ otpSeparators = 0 }) {
|
|
3544
3846
|
if (otpSeparators === 0) {
|
|
3545
|
-
return /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3848
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 0 }),
|
|
3849
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 1 }),
|
|
3850
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 2 }),
|
|
3851
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 3 }),
|
|
3852
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 4 }),
|
|
3853
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 5 })
|
|
3552
3854
|
] });
|
|
3553
3855
|
}
|
|
3554
3856
|
if (otpSeparators === 1) {
|
|
3555
|
-
return /* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3557
|
-
/* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3559
|
-
/* @__PURE__ */
|
|
3857
|
+
return /* @__PURE__ */ jsxs32(Fragment14, { children: [
|
|
3858
|
+
/* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3859
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 0 }),
|
|
3860
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 1 }),
|
|
3861
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 2 })
|
|
3560
3862
|
] }),
|
|
3561
|
-
/* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3863
|
+
/* @__PURE__ */ jsx38(InputOTPSeparator, {}),
|
|
3864
|
+
/* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3865
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 3 }),
|
|
3866
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 4 }),
|
|
3867
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 5 })
|
|
3566
3868
|
] })
|
|
3567
3869
|
] });
|
|
3568
3870
|
}
|
|
3569
|
-
return /* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
/* @__PURE__ */
|
|
3871
|
+
return /* @__PURE__ */ jsxs32(Fragment14, { children: [
|
|
3872
|
+
/* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3873
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 0 }),
|
|
3874
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 1 })
|
|
3573
3875
|
] }),
|
|
3574
|
-
/* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3576
|
-
/* @__PURE__ */
|
|
3577
|
-
/* @__PURE__ */
|
|
3876
|
+
/* @__PURE__ */ jsx38(InputOTPSeparator, {}),
|
|
3877
|
+
/* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3878
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 2 }),
|
|
3879
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 3 })
|
|
3578
3880
|
] }),
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
/* @__PURE__ */
|
|
3581
|
-
/* @__PURE__ */
|
|
3582
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsx38(InputOTPSeparator, {}),
|
|
3882
|
+
/* @__PURE__ */ jsxs32(InputOTPGroup, { children: [
|
|
3883
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 4 }),
|
|
3884
|
+
/* @__PURE__ */ jsx38(InputOTPSlot, { index: 5 })
|
|
3583
3885
|
] })
|
|
3584
3886
|
] });
|
|
3585
3887
|
}
|
|
3586
3888
|
|
|
3587
3889
|
// src/ui/auth/email-otp.tsx
|
|
3588
|
-
import { jsx as
|
|
3890
|
+
import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3589
3891
|
function EmailOTPForm(props) {
|
|
3590
|
-
const [email, setEmail] =
|
|
3892
|
+
const [email, setEmail] = useState15();
|
|
3591
3893
|
if (!email) {
|
|
3592
|
-
return /* @__PURE__ */
|
|
3894
|
+
return /* @__PURE__ */ jsx39(EmailForm, { ...props, setEmail });
|
|
3593
3895
|
}
|
|
3594
|
-
return /* @__PURE__ */
|
|
3896
|
+
return /* @__PURE__ */ jsx39(OTPForm, { ...props, email });
|
|
3595
3897
|
}
|
|
3596
3898
|
function EmailForm({
|
|
3597
3899
|
className,
|
|
@@ -3601,7 +3903,7 @@ function EmailForm({
|
|
|
3601
3903
|
setEmail
|
|
3602
3904
|
}) {
|
|
3603
3905
|
const { authClient } = useConfig();
|
|
3604
|
-
const t =
|
|
3906
|
+
const t = useTranslations33();
|
|
3605
3907
|
const formSchema = z7.object({
|
|
3606
3908
|
email: z7.email({
|
|
3607
3909
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
@@ -3614,7 +3916,7 @@ function EmailForm({
|
|
|
3614
3916
|
}
|
|
3615
3917
|
});
|
|
3616
3918
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
3617
|
-
|
|
3919
|
+
useEffect5(() => {
|
|
3618
3920
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
3619
3921
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
3620
3922
|
async function onSubmit({ email }) {
|
|
@@ -3624,29 +3926,29 @@ function EmailForm({
|
|
|
3624
3926
|
type: "sign-in",
|
|
3625
3927
|
fetchOptions: { throw: true }
|
|
3626
3928
|
});
|
|
3627
|
-
|
|
3929
|
+
AlertToast17({ message: t("systems.EMAIL_OTP_VERIFICATION_SENT") });
|
|
3628
3930
|
setEmail(email);
|
|
3629
3931
|
} catch (error) {
|
|
3630
|
-
|
|
3932
|
+
AlertToast17({
|
|
3631
3933
|
message: getTranslations({ error, t }),
|
|
3632
3934
|
icon: "destructive"
|
|
3633
3935
|
});
|
|
3634
3936
|
}
|
|
3635
3937
|
}
|
|
3636
|
-
return /* @__PURE__ */
|
|
3938
|
+
return /* @__PURE__ */ jsx39(Form8, { ...form, children: /* @__PURE__ */ jsxs33(
|
|
3637
3939
|
"form",
|
|
3638
3940
|
{
|
|
3639
3941
|
onSubmit: form.handleSubmit(onSubmit),
|
|
3640
|
-
className:
|
|
3942
|
+
className: cn31("grid w-full gap-6", className, classNames?.base),
|
|
3641
3943
|
children: [
|
|
3642
|
-
/* @__PURE__ */
|
|
3944
|
+
/* @__PURE__ */ jsx39(
|
|
3643
3945
|
FormField7,
|
|
3644
3946
|
{
|
|
3645
3947
|
control: form.control,
|
|
3646
3948
|
name: "email",
|
|
3647
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3648
|
-
/* @__PURE__ */
|
|
3649
|
-
/* @__PURE__ */
|
|
3949
|
+
render: ({ field }) => /* @__PURE__ */ jsxs33(FormItem7, { children: [
|
|
3950
|
+
/* @__PURE__ */ jsx39(FormLabel6, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
3951
|
+
/* @__PURE__ */ jsx39(FormControl7, { children: /* @__PURE__ */ jsx39(
|
|
3650
3952
|
Input6,
|
|
3651
3953
|
{
|
|
3652
3954
|
type: "email",
|
|
@@ -3657,17 +3959,17 @@ function EmailForm({
|
|
|
3657
3959
|
...field
|
|
3658
3960
|
}
|
|
3659
3961
|
) }),
|
|
3660
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ jsx39(FormMessage7, { className: classNames?.error })
|
|
3661
3963
|
] })
|
|
3662
3964
|
}
|
|
3663
3965
|
),
|
|
3664
|
-
/* @__PURE__ */
|
|
3665
|
-
|
|
3966
|
+
/* @__PURE__ */ jsx39(
|
|
3967
|
+
Button23,
|
|
3666
3968
|
{
|
|
3667
3969
|
type: "submit",
|
|
3668
|
-
className:
|
|
3970
|
+
className: cn31("w-full", classNames?.button, classNames?.primaryButton),
|
|
3669
3971
|
disabled: submitting,
|
|
3670
|
-
children: submitting ? /* @__PURE__ */
|
|
3972
|
+
children: submitting ? /* @__PURE__ */ jsx39(Spinner12, {}) : t("systems.EMAIL_OTP_SEND_ACTION")
|
|
3671
3973
|
}
|
|
3672
3974
|
)
|
|
3673
3975
|
]
|
|
@@ -3684,7 +3986,7 @@ function OTPForm({
|
|
|
3684
3986
|
email
|
|
3685
3987
|
}) {
|
|
3686
3988
|
const { authClient } = useConfig();
|
|
3687
|
-
const t =
|
|
3989
|
+
const t = useTranslations33();
|
|
3688
3990
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectTo);
|
|
3689
3991
|
const formSchema = z7.object({
|
|
3690
3992
|
code: z7.string().min(1, {
|
|
@@ -3700,7 +4002,7 @@ function OTPForm({
|
|
|
3700
4002
|
}
|
|
3701
4003
|
});
|
|
3702
4004
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
3703
|
-
|
|
4005
|
+
useEffect5(() => {
|
|
3704
4006
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
3705
4007
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
3706
4008
|
async function onSubmit({ code }) {
|
|
@@ -3712,27 +4014,27 @@ function OTPForm({
|
|
|
3712
4014
|
});
|
|
3713
4015
|
await onSuccess();
|
|
3714
4016
|
} catch (error) {
|
|
3715
|
-
|
|
4017
|
+
AlertToast17({
|
|
3716
4018
|
message: getTranslations({ error, t }),
|
|
3717
4019
|
icon: "destructive"
|
|
3718
4020
|
});
|
|
3719
4021
|
form.reset();
|
|
3720
4022
|
}
|
|
3721
4023
|
}
|
|
3722
|
-
return /* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsx39(Form8, { ...form, children: /* @__PURE__ */ jsxs33(
|
|
3723
4025
|
"form",
|
|
3724
4026
|
{
|
|
3725
4027
|
onSubmit: form.handleSubmit(onSubmit),
|
|
3726
|
-
className:
|
|
4028
|
+
className: cn31("grid w-full gap-6", className, classNames?.base),
|
|
3727
4029
|
children: [
|
|
3728
|
-
/* @__PURE__ */
|
|
4030
|
+
/* @__PURE__ */ jsx39(
|
|
3729
4031
|
FormField7,
|
|
3730
4032
|
{
|
|
3731
4033
|
control: form.control,
|
|
3732
4034
|
name: "code",
|
|
3733
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
/* @__PURE__ */
|
|
4035
|
+
render: ({ field }) => /* @__PURE__ */ jsxs33(FormItem7, { children: [
|
|
4036
|
+
/* @__PURE__ */ jsx39(FormLabel6, { className: classNames?.label, children: t("systems.EMAIL_OTP") }),
|
|
4037
|
+
/* @__PURE__ */ jsx39(FormControl7, { children: /* @__PURE__ */ jsx39(
|
|
3736
4038
|
InputOTP,
|
|
3737
4039
|
{
|
|
3738
4040
|
...field,
|
|
@@ -3746,20 +4048,20 @@ function OTPForm({
|
|
|
3746
4048
|
containerClassName: classNames?.otpInputContainer,
|
|
3747
4049
|
className: classNames?.otpInput,
|
|
3748
4050
|
disabled: submitting,
|
|
3749
|
-
children: /* @__PURE__ */
|
|
4051
|
+
children: /* @__PURE__ */ jsx39(OTPInputGroup, { otpSeparators })
|
|
3750
4052
|
}
|
|
3751
4053
|
) }),
|
|
3752
|
-
/* @__PURE__ */
|
|
4054
|
+
/* @__PURE__ */ jsx39(FormMessage7, { className: classNames?.error })
|
|
3753
4055
|
] })
|
|
3754
4056
|
}
|
|
3755
4057
|
),
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
|
|
4058
|
+
/* @__PURE__ */ jsx39(
|
|
4059
|
+
Button23,
|
|
3758
4060
|
{
|
|
3759
4061
|
type: "submit",
|
|
3760
|
-
className:
|
|
4062
|
+
className: cn31("w-full", classNames?.button, classNames?.primaryButton),
|
|
3761
4063
|
disabled: submitting,
|
|
3762
|
-
children: submitting ? /* @__PURE__ */
|
|
4064
|
+
children: submitting ? /* @__PURE__ */ jsx39(Spinner12, {}) : t("systems.EMAIL_OTP_VERIFY_ACTION")
|
|
3763
4065
|
}
|
|
3764
4066
|
)
|
|
3765
4067
|
]
|
|
@@ -3768,12 +4070,13 @@ function OTPForm({
|
|
|
3768
4070
|
}
|
|
3769
4071
|
|
|
3770
4072
|
// src/ui/auth/forgot-password.tsx
|
|
3771
|
-
import { useEffect as
|
|
3772
|
-
import { useRouter as
|
|
3773
|
-
import {
|
|
3774
|
-
import {
|
|
4073
|
+
import { useEffect as useEffect6 } from "react";
|
|
4074
|
+
import { useRouter as useRouter10 } from "next/navigation";
|
|
4075
|
+
import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
|
|
4076
|
+
import { useTranslations as useTranslations34 } from "next-intl";
|
|
4077
|
+
import { AlertToast as AlertToast18 } from "pelatform-ui/components";
|
|
3775
4078
|
import {
|
|
3776
|
-
Button as
|
|
4079
|
+
Button as Button24,
|
|
3777
4080
|
Form as Form9,
|
|
3778
4081
|
FormControl as FormControl8,
|
|
3779
4082
|
FormField as FormField8,
|
|
@@ -3781,13 +4084,12 @@ import {
|
|
|
3781
4084
|
FormLabel as FormLabel7,
|
|
3782
4085
|
FormMessage as FormMessage8,
|
|
3783
4086
|
Input as Input7,
|
|
3784
|
-
Spinner as
|
|
3785
|
-
} from "
|
|
3786
|
-
import { useForm as useForm9 } from "
|
|
3787
|
-
import {
|
|
3788
|
-
import {
|
|
3789
|
-
import {
|
|
3790
|
-
import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4087
|
+
Spinner as Spinner13
|
|
4088
|
+
} from "pelatform-ui/default";
|
|
4089
|
+
import { useForm as useForm9 } from "react-hook-form";
|
|
4090
|
+
import { z as z8 } from "zod";
|
|
4091
|
+
import { cn as cn32 } from "@pelatform/utils";
|
|
4092
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3791
4093
|
function ForgotPasswordForm({
|
|
3792
4094
|
className,
|
|
3793
4095
|
classNames,
|
|
@@ -3795,9 +4097,9 @@ function ForgotPasswordForm({
|
|
|
3795
4097
|
setIsSubmitting
|
|
3796
4098
|
}) {
|
|
3797
4099
|
const { authClient, app, path } = useConfig();
|
|
3798
|
-
const router =
|
|
3799
|
-
const t =
|
|
3800
|
-
const formSchema = z8.object({
|
|
4100
|
+
const router = useRouter10();
|
|
4101
|
+
const t = useTranslations34();
|
|
4102
|
+
const formSchema = z8.object({
|
|
3801
4103
|
email: z8.email({
|
|
3802
4104
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
3803
4105
|
})
|
|
@@ -3809,7 +4111,7 @@ function ForgotPasswordForm({
|
|
|
3809
4111
|
}
|
|
3810
4112
|
});
|
|
3811
4113
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
3812
|
-
|
|
4114
|
+
useEffect6(() => {
|
|
3813
4115
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
3814
4116
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
3815
4117
|
async function onSubmit({ email }) {
|
|
@@ -3819,31 +4121,31 @@ function ForgotPasswordForm({
|
|
|
3819
4121
|
redirectTo: `${app.url}${path.auth.RESET_PASSWORD}`,
|
|
3820
4122
|
fetchOptions: { throw: true }
|
|
3821
4123
|
});
|
|
3822
|
-
|
|
4124
|
+
AlertToast18({
|
|
3823
4125
|
message: t("systems.FORGOT_PASSWORD_EMAIL")
|
|
3824
4126
|
});
|
|
3825
4127
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
3826
4128
|
} catch (error) {
|
|
3827
|
-
|
|
4129
|
+
AlertToast18({
|
|
3828
4130
|
message: getTranslations({ error, t }),
|
|
3829
4131
|
icon: "destructive"
|
|
3830
4132
|
});
|
|
3831
4133
|
}
|
|
3832
4134
|
}
|
|
3833
|
-
return /* @__PURE__ */
|
|
4135
|
+
return /* @__PURE__ */ jsx40(Form9, { ...form, children: /* @__PURE__ */ jsxs34(
|
|
3834
4136
|
"form",
|
|
3835
4137
|
{
|
|
3836
4138
|
onSubmit: form.handleSubmit(onSubmit),
|
|
3837
|
-
className:
|
|
4139
|
+
className: cn32("grid w-full gap-6", className, classNames?.base),
|
|
3838
4140
|
children: [
|
|
3839
|
-
/* @__PURE__ */
|
|
4141
|
+
/* @__PURE__ */ jsx40(
|
|
3840
4142
|
FormField8,
|
|
3841
4143
|
{
|
|
3842
4144
|
control: form.control,
|
|
3843
4145
|
name: "email",
|
|
3844
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
4146
|
+
render: ({ field }) => /* @__PURE__ */ jsxs34(FormItem8, { children: [
|
|
4147
|
+
/* @__PURE__ */ jsx40(FormLabel7, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
4148
|
+
/* @__PURE__ */ jsx40(FormControl8, { children: /* @__PURE__ */ jsx40(
|
|
3847
4149
|
Input7,
|
|
3848
4150
|
{
|
|
3849
4151
|
type: "email",
|
|
@@ -3854,17 +4156,17 @@ function ForgotPasswordForm({
|
|
|
3854
4156
|
...field
|
|
3855
4157
|
}
|
|
3856
4158
|
) }),
|
|
3857
|
-
/* @__PURE__ */
|
|
4159
|
+
/* @__PURE__ */ jsx40(FormMessage8, { className: classNames?.error })
|
|
3858
4160
|
] })
|
|
3859
4161
|
}
|
|
3860
4162
|
),
|
|
3861
|
-
/* @__PURE__ */
|
|
3862
|
-
|
|
4163
|
+
/* @__PURE__ */ jsx40(
|
|
4164
|
+
Button24,
|
|
3863
4165
|
{
|
|
3864
4166
|
type: "submit",
|
|
3865
|
-
className:
|
|
4167
|
+
className: cn32("w-full", classNames?.button, classNames?.primaryButton),
|
|
3866
4168
|
disabled: submitting,
|
|
3867
|
-
children: submitting ? /* @__PURE__ */
|
|
4169
|
+
children: submitting ? /* @__PURE__ */ jsx40(Spinner13, {}) : t("systems.FORGOT_PASSWORD_ACTION")
|
|
3868
4170
|
}
|
|
3869
4171
|
)
|
|
3870
4172
|
]
|
|
@@ -3873,12 +4175,13 @@ function ForgotPasswordForm({
|
|
|
3873
4175
|
}
|
|
3874
4176
|
|
|
3875
4177
|
// src/ui/auth/magic-link.tsx
|
|
3876
|
-
import { useEffect as
|
|
3877
|
-
import { useSearchParams as
|
|
3878
|
-
import {
|
|
3879
|
-
import {
|
|
4178
|
+
import { useEffect as useEffect7 } from "react";
|
|
4179
|
+
import { useSearchParams as useSearchParams4 } from "next/navigation";
|
|
4180
|
+
import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
|
|
4181
|
+
import { useTranslations as useTranslations35 } from "next-intl";
|
|
4182
|
+
import { AlertToast as AlertToast19 } from "pelatform-ui/components";
|
|
3880
4183
|
import {
|
|
3881
|
-
Button as
|
|
4184
|
+
Button as Button25,
|
|
3882
4185
|
Form as Form10,
|
|
3883
4186
|
FormControl as FormControl9,
|
|
3884
4187
|
FormField as FormField9,
|
|
@@ -3886,13 +4189,12 @@ import {
|
|
|
3886
4189
|
FormLabel as FormLabel8,
|
|
3887
4190
|
FormMessage as FormMessage9,
|
|
3888
4191
|
Input as Input8,
|
|
3889
|
-
Spinner as
|
|
3890
|
-
} from "
|
|
3891
|
-
import { useForm as useForm10 } from "
|
|
3892
|
-
import {
|
|
3893
|
-
import {
|
|
3894
|
-
import {
|
|
3895
|
-
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4192
|
+
Spinner as Spinner14
|
|
4193
|
+
} from "pelatform-ui/default";
|
|
4194
|
+
import { useForm as useForm10 } from "react-hook-form";
|
|
4195
|
+
import { z as z9 } from "zod";
|
|
4196
|
+
import { cn as cn33, REDIRECT_QUERY_PARAM as REDIRECT_QUERY_PARAM3 } from "@pelatform/utils";
|
|
4197
|
+
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3896
4198
|
function MagicLinkForm({
|
|
3897
4199
|
className,
|
|
3898
4200
|
classNames,
|
|
@@ -3900,8 +4202,8 @@ function MagicLinkForm({
|
|
|
3900
4202
|
setIsSubmitting
|
|
3901
4203
|
}) {
|
|
3902
4204
|
const { authClient, app, path } = useConfig();
|
|
3903
|
-
const searchParams =
|
|
3904
|
-
const t =
|
|
4205
|
+
const searchParams = useSearchParams4();
|
|
4206
|
+
const t = useTranslations35();
|
|
3905
4207
|
const formSchema = z9.object({
|
|
3906
4208
|
email: z9.email({
|
|
3907
4209
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
@@ -3914,7 +4216,7 @@ function MagicLinkForm({
|
|
|
3914
4216
|
}
|
|
3915
4217
|
});
|
|
3916
4218
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
3917
|
-
|
|
4219
|
+
useEffect7(() => {
|
|
3918
4220
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
3919
4221
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
3920
4222
|
async function onSubmit({ email }) {
|
|
@@ -3924,31 +4226,31 @@ function MagicLinkForm({
|
|
|
3924
4226
|
callbackURL: `${app.url}${path.auth.CALLBACK}?redirectTo=${searchParams?.get(REDIRECT_QUERY_PARAM3)}`,
|
|
3925
4227
|
fetchOptions: { throw: true }
|
|
3926
4228
|
});
|
|
3927
|
-
|
|
4229
|
+
AlertToast19({
|
|
3928
4230
|
message: t("systems.MAGIC_LINK_EMAIL")
|
|
3929
4231
|
});
|
|
3930
4232
|
form.reset();
|
|
3931
4233
|
} catch (error) {
|
|
3932
|
-
|
|
4234
|
+
AlertToast19({
|
|
3933
4235
|
message: getTranslations({ error, t }),
|
|
3934
4236
|
icon: "destructive"
|
|
3935
4237
|
});
|
|
3936
4238
|
}
|
|
3937
4239
|
}
|
|
3938
|
-
return /* @__PURE__ */
|
|
4240
|
+
return /* @__PURE__ */ jsx41(Form10, { ...form, children: /* @__PURE__ */ jsxs35(
|
|
3939
4241
|
"form",
|
|
3940
4242
|
{
|
|
3941
4243
|
onSubmit: form.handleSubmit(onSubmit),
|
|
3942
|
-
className:
|
|
4244
|
+
className: cn33("grid w-full gap-6", className, classNames?.base),
|
|
3943
4245
|
children: [
|
|
3944
|
-
/* @__PURE__ */
|
|
4246
|
+
/* @__PURE__ */ jsx41(
|
|
3945
4247
|
FormField9,
|
|
3946
4248
|
{
|
|
3947
4249
|
control: form.control,
|
|
3948
4250
|
name: "email",
|
|
3949
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
4251
|
+
render: ({ field }) => /* @__PURE__ */ jsxs35(FormItem9, { children: [
|
|
4252
|
+
/* @__PURE__ */ jsx41(FormLabel8, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
4253
|
+
/* @__PURE__ */ jsx41(FormControl9, { children: /* @__PURE__ */ jsx41(
|
|
3952
4254
|
Input8,
|
|
3953
4255
|
{
|
|
3954
4256
|
type: "email",
|
|
@@ -3959,17 +4261,17 @@ function MagicLinkForm({
|
|
|
3959
4261
|
...field
|
|
3960
4262
|
}
|
|
3961
4263
|
) }),
|
|
3962
|
-
/* @__PURE__ */
|
|
4264
|
+
/* @__PURE__ */ jsx41(FormMessage9, { className: classNames?.error })
|
|
3963
4265
|
] })
|
|
3964
4266
|
}
|
|
3965
4267
|
),
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
|
|
4268
|
+
/* @__PURE__ */ jsx41(
|
|
4269
|
+
Button25,
|
|
3968
4270
|
{
|
|
3969
4271
|
type: "submit",
|
|
3970
|
-
className:
|
|
4272
|
+
className: cn33("w-full", classNames?.button, classNames?.primaryButton),
|
|
3971
4273
|
disabled: submitting,
|
|
3972
|
-
children: submitting ? /* @__PURE__ */
|
|
4274
|
+
children: submitting ? /* @__PURE__ */ jsx41(Spinner14, {}) : t("systems.MAGIC_LINK_ACTION")
|
|
3973
4275
|
}
|
|
3974
4276
|
)
|
|
3975
4277
|
]
|
|
@@ -3978,11 +4280,12 @@ function MagicLinkForm({
|
|
|
3978
4280
|
}
|
|
3979
4281
|
|
|
3980
4282
|
// src/ui/auth/recover-account.tsx
|
|
3981
|
-
import { useEffect as
|
|
3982
|
-
import {
|
|
3983
|
-
import {
|
|
4283
|
+
import { useEffect as useEffect8 } from "react";
|
|
4284
|
+
import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
|
|
4285
|
+
import { useTranslations as useTranslations36 } from "next-intl";
|
|
4286
|
+
import { AlertToast as AlertToast20 } from "pelatform-ui/components";
|
|
3984
4287
|
import {
|
|
3985
|
-
Button as
|
|
4288
|
+
Button as Button26,
|
|
3986
4289
|
Form as Form11,
|
|
3987
4290
|
FormControl as FormControl10,
|
|
3988
4291
|
FormField as FormField10,
|
|
@@ -3990,13 +4293,12 @@ import {
|
|
|
3990
4293
|
FormLabel as FormLabel9,
|
|
3991
4294
|
FormMessage as FormMessage10,
|
|
3992
4295
|
Input as Input9,
|
|
3993
|
-
Spinner as
|
|
3994
|
-
} from "
|
|
3995
|
-
import { useForm as useForm11 } from "
|
|
3996
|
-
import {
|
|
3997
|
-
import {
|
|
3998
|
-
import {
|
|
3999
|
-
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4296
|
+
Spinner as Spinner15
|
|
4297
|
+
} from "pelatform-ui/default";
|
|
4298
|
+
import { useForm as useForm11 } from "react-hook-form";
|
|
4299
|
+
import { z as z10 } from "zod";
|
|
4300
|
+
import { cn as cn34 } from "@pelatform/utils";
|
|
4301
|
+
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4000
4302
|
function RecoverAccountForm({
|
|
4001
4303
|
className,
|
|
4002
4304
|
classNames,
|
|
@@ -4005,7 +4307,7 @@ function RecoverAccountForm({
|
|
|
4005
4307
|
setIsSubmitting
|
|
4006
4308
|
}) {
|
|
4007
4309
|
const { authClient } = useConfig();
|
|
4008
|
-
const t =
|
|
4310
|
+
const t = useTranslations36();
|
|
4009
4311
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectTo);
|
|
4010
4312
|
const formSchema = z10.object({
|
|
4011
4313
|
code: z10.string().min(1, { error: t("systems.BACKUP_CODE_REQUIRED") })
|
|
@@ -4017,7 +4319,7 @@ function RecoverAccountForm({
|
|
|
4017
4319
|
}
|
|
4018
4320
|
});
|
|
4019
4321
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4020
|
-
|
|
4322
|
+
useEffect8(() => {
|
|
4021
4323
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4022
4324
|
}, [setIsSubmitting, form.formState.isSubmitting, transitionPending]);
|
|
4023
4325
|
async function onSubmit({ code }) {
|
|
@@ -4028,27 +4330,27 @@ function RecoverAccountForm({
|
|
|
4028
4330
|
});
|
|
4029
4331
|
await onSuccess();
|
|
4030
4332
|
} catch (error) {
|
|
4031
|
-
|
|
4333
|
+
AlertToast20({
|
|
4032
4334
|
message: getTranslations({ error, t }),
|
|
4033
4335
|
icon: "destructive"
|
|
4034
4336
|
});
|
|
4035
4337
|
form.reset();
|
|
4036
4338
|
}
|
|
4037
4339
|
}
|
|
4038
|
-
return /* @__PURE__ */
|
|
4340
|
+
return /* @__PURE__ */ jsx42(Form11, { ...form, children: /* @__PURE__ */ jsxs36(
|
|
4039
4341
|
"form",
|
|
4040
4342
|
{
|
|
4041
4343
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4042
|
-
className:
|
|
4344
|
+
className: cn34("grid w-full gap-6", className, classNames?.base),
|
|
4043
4345
|
children: [
|
|
4044
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx42(
|
|
4045
4347
|
FormField10,
|
|
4046
4348
|
{
|
|
4047
4349
|
control: form.control,
|
|
4048
4350
|
name: "code",
|
|
4049
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4050
|
-
/* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4351
|
+
render: ({ field }) => /* @__PURE__ */ jsxs36(FormItem10, { children: [
|
|
4352
|
+
/* @__PURE__ */ jsx42(FormLabel9, { className: classNames?.label, children: t("systems.BACKUP_CODE") }),
|
|
4353
|
+
/* @__PURE__ */ jsx42(FormControl10, { children: /* @__PURE__ */ jsx42(
|
|
4052
4354
|
Input9,
|
|
4053
4355
|
{
|
|
4054
4356
|
autoComplete: "off",
|
|
@@ -4058,17 +4360,17 @@ function RecoverAccountForm({
|
|
|
4058
4360
|
...field
|
|
4059
4361
|
}
|
|
4060
4362
|
) }),
|
|
4061
|
-
/* @__PURE__ */
|
|
4363
|
+
/* @__PURE__ */ jsx42(FormMessage10, { className: classNames?.error })
|
|
4062
4364
|
] })
|
|
4063
4365
|
}
|
|
4064
4366
|
),
|
|
4065
|
-
/* @__PURE__ */
|
|
4066
|
-
|
|
4367
|
+
/* @__PURE__ */ jsx42(
|
|
4368
|
+
Button26,
|
|
4067
4369
|
{
|
|
4068
4370
|
type: "submit",
|
|
4069
|
-
className:
|
|
4371
|
+
className: cn34("w-full", classNames?.button, classNames?.primaryButton),
|
|
4070
4372
|
disabled: submitting,
|
|
4071
|
-
children: submitting ? /* @__PURE__ */
|
|
4373
|
+
children: submitting ? /* @__PURE__ */ jsx42(Spinner15, {}) : t("systems.RECOVER_ACCOUNT_ACTION")
|
|
4072
4374
|
}
|
|
4073
4375
|
)
|
|
4074
4376
|
]
|
|
@@ -4077,25 +4379,25 @@ function RecoverAccountForm({
|
|
|
4077
4379
|
}
|
|
4078
4380
|
|
|
4079
4381
|
// src/ui/auth/reset-password.tsx
|
|
4080
|
-
import { useEffect as
|
|
4081
|
-
import { useRouter as
|
|
4082
|
-
import {
|
|
4083
|
-
import {
|
|
4382
|
+
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef5 } from "react";
|
|
4383
|
+
import { useRouter as useRouter11, useSearchParams as useSearchParams5 } from "next/navigation";
|
|
4384
|
+
import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
|
|
4385
|
+
import { useTranslations as useTranslations37 } from "next-intl";
|
|
4386
|
+
import { AlertToast as AlertToast21 } from "pelatform-ui/components";
|
|
4084
4387
|
import {
|
|
4085
|
-
Button as
|
|
4388
|
+
Button as Button27,
|
|
4086
4389
|
Form as Form12,
|
|
4087
4390
|
FormControl as FormControl11,
|
|
4088
4391
|
FormField as FormField11,
|
|
4089
4392
|
FormItem as FormItem11,
|
|
4090
4393
|
FormLabel as FormLabel10,
|
|
4091
4394
|
FormMessage as FormMessage11,
|
|
4092
|
-
Spinner as
|
|
4093
|
-
} from "
|
|
4094
|
-
import { useForm as useForm12 } from "
|
|
4095
|
-
import {
|
|
4096
|
-
import {
|
|
4097
|
-
import {
|
|
4098
|
-
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4395
|
+
Spinner as Spinner16
|
|
4396
|
+
} from "pelatform-ui/default";
|
|
4397
|
+
import { useForm as useForm12 } from "react-hook-form";
|
|
4398
|
+
import { z as z11 } from "zod";
|
|
4399
|
+
import { cn as cn35 } from "@pelatform/utils";
|
|
4400
|
+
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4099
4401
|
function ResetPasswordForm({
|
|
4100
4402
|
className,
|
|
4101
4403
|
classNames,
|
|
@@ -4103,9 +4405,9 @@ function ResetPasswordForm({
|
|
|
4103
4405
|
setIsSubmitting
|
|
4104
4406
|
}) {
|
|
4105
4407
|
const { authClient, path } = useConfig();
|
|
4106
|
-
const router =
|
|
4107
|
-
const searchParams =
|
|
4108
|
-
const t =
|
|
4408
|
+
const router = useRouter11();
|
|
4409
|
+
const searchParams = useSearchParams5();
|
|
4410
|
+
const t = useTranslations37();
|
|
4109
4411
|
const token = searchParams?.get("token");
|
|
4110
4412
|
const tokenChecked = useRef5(false);
|
|
4111
4413
|
const formSchema = useMemo3(
|
|
@@ -4126,14 +4428,14 @@ function ResetPasswordForm({
|
|
|
4126
4428
|
}
|
|
4127
4429
|
});
|
|
4128
4430
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
4129
|
-
|
|
4431
|
+
useEffect9(() => {
|
|
4130
4432
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
4131
4433
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
4132
|
-
|
|
4434
|
+
useEffect9(() => {
|
|
4133
4435
|
if (tokenChecked.current) return;
|
|
4134
4436
|
tokenChecked.current = true;
|
|
4135
4437
|
if (!token || token === "INVALID_TOKEN") {
|
|
4136
|
-
|
|
4438
|
+
AlertToast21({
|
|
4137
4439
|
message: t("systems.INVALID_TOKEN"),
|
|
4138
4440
|
icon: "destructive"
|
|
4139
4441
|
});
|
|
@@ -4142,7 +4444,7 @@ function ResetPasswordForm({
|
|
|
4142
4444
|
}, [path.auth.SIGN_IN, router, t, token]);
|
|
4143
4445
|
async function onSubmit({ newPassword }) {
|
|
4144
4446
|
if (!token) {
|
|
4145
|
-
|
|
4447
|
+
AlertToast21({
|
|
4146
4448
|
message: t("systems.INVALID_TOKEN"),
|
|
4147
4449
|
icon: "destructive"
|
|
4148
4450
|
});
|
|
@@ -4154,32 +4456,32 @@ function ResetPasswordForm({
|
|
|
4154
4456
|
token,
|
|
4155
4457
|
fetchOptions: { throw: true }
|
|
4156
4458
|
});
|
|
4157
|
-
|
|
4459
|
+
AlertToast21({
|
|
4158
4460
|
message: t("systems.RESET_PASSWORD_SUCCESS")
|
|
4159
4461
|
});
|
|
4160
4462
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
4161
4463
|
} catch (error) {
|
|
4162
|
-
|
|
4464
|
+
AlertToast21({
|
|
4163
4465
|
message: getTranslations({ error, t }),
|
|
4164
4466
|
icon: "destructive"
|
|
4165
4467
|
});
|
|
4166
4468
|
form.reset();
|
|
4167
4469
|
}
|
|
4168
4470
|
}
|
|
4169
|
-
return /* @__PURE__ */
|
|
4471
|
+
return /* @__PURE__ */ jsx43(Form12, { ...form, children: /* @__PURE__ */ jsxs37(
|
|
4170
4472
|
"form",
|
|
4171
4473
|
{
|
|
4172
4474
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4173
|
-
className:
|
|
4475
|
+
className: cn35("grid w-full gap-6", className, classNames?.base),
|
|
4174
4476
|
children: [
|
|
4175
|
-
/* @__PURE__ */
|
|
4477
|
+
/* @__PURE__ */ jsx43(
|
|
4176
4478
|
FormField11,
|
|
4177
4479
|
{
|
|
4178
4480
|
control: form.control,
|
|
4179
4481
|
name: "newPassword",
|
|
4180
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4482
|
+
render: ({ field }) => /* @__PURE__ */ jsxs37(FormItem11, { children: [
|
|
4483
|
+
/* @__PURE__ */ jsx43(FormLabel10, { className: classNames?.label, children: t("systems.NEW_PASSWORD") }),
|
|
4484
|
+
/* @__PURE__ */ jsx43(FormControl11, { children: /* @__PURE__ */ jsx43(
|
|
4183
4485
|
PasswordInput,
|
|
4184
4486
|
{
|
|
4185
4487
|
autoComplete: "new-password",
|
|
@@ -4190,18 +4492,18 @@ function ResetPasswordForm({
|
|
|
4190
4492
|
...field
|
|
4191
4493
|
}
|
|
4192
4494
|
) }),
|
|
4193
|
-
/* @__PURE__ */
|
|
4495
|
+
/* @__PURE__ */ jsx43(FormMessage11, { className: classNames?.error })
|
|
4194
4496
|
] })
|
|
4195
4497
|
}
|
|
4196
4498
|
),
|
|
4197
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsx43(
|
|
4198
4500
|
FormField11,
|
|
4199
4501
|
{
|
|
4200
4502
|
control: form.control,
|
|
4201
4503
|
name: "confirmPassword",
|
|
4202
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4203
|
-
/* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4504
|
+
render: ({ field }) => /* @__PURE__ */ jsxs37(FormItem11, { children: [
|
|
4505
|
+
/* @__PURE__ */ jsx43(FormLabel10, { className: classNames?.label, children: t("systems.CONFIRM_PASSWORD") }),
|
|
4506
|
+
/* @__PURE__ */ jsx43(FormControl11, { children: /* @__PURE__ */ jsx43(
|
|
4205
4507
|
PasswordInput,
|
|
4206
4508
|
{
|
|
4207
4509
|
autoComplete: "new-password",
|
|
@@ -4212,17 +4514,17 @@ function ResetPasswordForm({
|
|
|
4212
4514
|
...field
|
|
4213
4515
|
}
|
|
4214
4516
|
) }),
|
|
4215
|
-
/* @__PURE__ */
|
|
4517
|
+
/* @__PURE__ */ jsx43(FormMessage11, { className: classNames?.error })
|
|
4216
4518
|
] })
|
|
4217
4519
|
}
|
|
4218
4520
|
),
|
|
4219
|
-
/* @__PURE__ */
|
|
4220
|
-
|
|
4521
|
+
/* @__PURE__ */ jsx43(
|
|
4522
|
+
Button27,
|
|
4221
4523
|
{
|
|
4222
4524
|
type: "submit",
|
|
4223
|
-
className:
|
|
4525
|
+
className: cn35("w-full", classNames?.button, classNames?.primaryButton),
|
|
4224
4526
|
disabled: submitting || !token,
|
|
4225
|
-
children: submitting ? /* @__PURE__ */
|
|
4527
|
+
children: submitting ? /* @__PURE__ */ jsx43(Spinner16, {}) : t("systems.RESET_PASSWORD_ACTION")
|
|
4226
4528
|
}
|
|
4227
4529
|
)
|
|
4228
4530
|
]
|
|
@@ -4231,13 +4533,14 @@ function ResetPasswordForm({
|
|
|
4231
4533
|
}
|
|
4232
4534
|
|
|
4233
4535
|
// src/ui/auth/sign-in.tsx
|
|
4234
|
-
import { useEffect as
|
|
4536
|
+
import { useEffect as useEffect10 } from "react";
|
|
4235
4537
|
import Link from "next/link";
|
|
4236
|
-
import { useRouter as
|
|
4237
|
-
import {
|
|
4238
|
-
import {
|
|
4538
|
+
import { useRouter as useRouter12 } from "next/navigation";
|
|
4539
|
+
import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
|
|
4540
|
+
import { useTranslations as useTranslations38 } from "next-intl";
|
|
4541
|
+
import { AlertToast as AlertToast22 } from "pelatform-ui/components";
|
|
4239
4542
|
import {
|
|
4240
|
-
Button as
|
|
4543
|
+
Button as Button28,
|
|
4241
4544
|
Checkbox as Checkbox2,
|
|
4242
4545
|
Form as Form13,
|
|
4243
4546
|
FormControl as FormControl12,
|
|
@@ -4246,13 +4549,12 @@ import {
|
|
|
4246
4549
|
FormLabel as FormLabel11,
|
|
4247
4550
|
FormMessage as FormMessage12,
|
|
4248
4551
|
Input as Input10,
|
|
4249
|
-
Spinner as
|
|
4250
|
-
} from "
|
|
4251
|
-
import { useForm as useForm13 } from "
|
|
4252
|
-
import {
|
|
4253
|
-
import {
|
|
4254
|
-
import {
|
|
4255
|
-
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4552
|
+
Spinner as Spinner17
|
|
4553
|
+
} from "pelatform-ui/default";
|
|
4554
|
+
import { useForm as useForm13 } from "react-hook-form";
|
|
4555
|
+
import { z as z12 } from "zod";
|
|
4556
|
+
import { cn as cn36, validateEmail } from "@pelatform/utils";
|
|
4557
|
+
import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4256
4558
|
function SignInForm({
|
|
4257
4559
|
className,
|
|
4258
4560
|
classNames,
|
|
@@ -4261,8 +4563,8 @@ function SignInForm({
|
|
|
4261
4563
|
setIsSubmitting
|
|
4262
4564
|
}) {
|
|
4263
4565
|
const { authClient, auth, path } = useConfig();
|
|
4264
|
-
const t =
|
|
4265
|
-
const router =
|
|
4566
|
+
const t = useTranslations38();
|
|
4567
|
+
const router = useRouter12();
|
|
4266
4568
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectToProp);
|
|
4267
4569
|
const usernameEnabled = auth.authentication.username;
|
|
4268
4570
|
const formSchema = z12.object({
|
|
@@ -4283,7 +4585,7 @@ function SignInForm({
|
|
|
4283
4585
|
}
|
|
4284
4586
|
});
|
|
4285
4587
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4286
|
-
|
|
4588
|
+
useEffect10(() => {
|
|
4287
4589
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4288
4590
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4289
4591
|
async function onSubmit({ email, password, rememberMe }) {
|
|
@@ -4311,27 +4613,27 @@ function SignInForm({
|
|
|
4311
4613
|
await onSuccess();
|
|
4312
4614
|
}
|
|
4313
4615
|
} catch (error) {
|
|
4314
|
-
|
|
4616
|
+
AlertToast22({
|
|
4315
4617
|
message: getTranslations({ error, t }),
|
|
4316
4618
|
icon: "destructive"
|
|
4317
4619
|
});
|
|
4318
4620
|
form.resetField("password");
|
|
4319
4621
|
}
|
|
4320
4622
|
}
|
|
4321
|
-
return /* @__PURE__ */
|
|
4623
|
+
return /* @__PURE__ */ jsx44(Form13, { ...form, children: /* @__PURE__ */ jsxs38(
|
|
4322
4624
|
"form",
|
|
4323
4625
|
{
|
|
4324
4626
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4325
|
-
className:
|
|
4627
|
+
className: cn36("grid w-full gap-6", className, classNames?.base),
|
|
4326
4628
|
children: [
|
|
4327
|
-
/* @__PURE__ */
|
|
4629
|
+
/* @__PURE__ */ jsx44(
|
|
4328
4630
|
FormField12,
|
|
4329
4631
|
{
|
|
4330
4632
|
control: form.control,
|
|
4331
4633
|
name: "email",
|
|
4332
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4333
|
-
/* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4634
|
+
render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem12, { children: [
|
|
4635
|
+
/* @__PURE__ */ jsx44(FormLabel11, { className: classNames?.label, children: usernameEnabled ? t("systems.USERNAME") : t("systems.EMAIL") }),
|
|
4636
|
+
/* @__PURE__ */ jsx44(FormControl12, { children: /* @__PURE__ */ jsx44(
|
|
4335
4637
|
Input10,
|
|
4336
4638
|
{
|
|
4337
4639
|
type: usernameEnabled ? "text" : "email",
|
|
@@ -4342,30 +4644,30 @@ function SignInForm({
|
|
|
4342
4644
|
...field
|
|
4343
4645
|
}
|
|
4344
4646
|
) }),
|
|
4345
|
-
/* @__PURE__ */
|
|
4647
|
+
/* @__PURE__ */ jsx44(FormMessage12, { className: classNames?.error })
|
|
4346
4648
|
] })
|
|
4347
4649
|
}
|
|
4348
4650
|
),
|
|
4349
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx44(
|
|
4350
4652
|
FormField12,
|
|
4351
4653
|
{
|
|
4352
4654
|
control: form.control,
|
|
4353
4655
|
name: "password",
|
|
4354
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4355
|
-
/* @__PURE__ */
|
|
4356
|
-
/* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
|
|
4656
|
+
render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem12, { children: [
|
|
4657
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between", children: [
|
|
4658
|
+
/* @__PURE__ */ jsx44(FormLabel11, { className: classNames?.label, children: t("systems.PASSWORD") }),
|
|
4659
|
+
/* @__PURE__ */ jsx44(Link, { href: `${path.auth.FORGOT_PASSWORD}${window.location.search}`, children: /* @__PURE__ */ jsx44(
|
|
4660
|
+
Button28,
|
|
4359
4661
|
{
|
|
4360
4662
|
mode: "link",
|
|
4361
4663
|
underline: "dashed",
|
|
4362
4664
|
size: "sm",
|
|
4363
|
-
className:
|
|
4665
|
+
className: cn36("px-0 text-foreground text-sm", classNames?.forgotPasswordLink),
|
|
4364
4666
|
children: t("systems.FORGOT_PASSWORD_LINK")
|
|
4365
4667
|
}
|
|
4366
4668
|
) })
|
|
4367
4669
|
] }),
|
|
4368
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsx44(FormControl12, { children: /* @__PURE__ */ jsx44(
|
|
4369
4671
|
PasswordInput,
|
|
4370
4672
|
{
|
|
4371
4673
|
autoComplete: "current-password",
|
|
@@ -4376,17 +4678,17 @@ function SignInForm({
|
|
|
4376
4678
|
...field
|
|
4377
4679
|
}
|
|
4378
4680
|
) }),
|
|
4379
|
-
/* @__PURE__ */
|
|
4681
|
+
/* @__PURE__ */ jsx44(FormMessage12, { className: classNames?.error })
|
|
4380
4682
|
] })
|
|
4381
4683
|
}
|
|
4382
4684
|
),
|
|
4383
|
-
/* @__PURE__ */
|
|
4685
|
+
/* @__PURE__ */ jsx44(
|
|
4384
4686
|
FormField12,
|
|
4385
4687
|
{
|
|
4386
4688
|
control: form.control,
|
|
4387
4689
|
name: "rememberMe",
|
|
4388
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */
|
|
4690
|
+
render: ({ field }) => /* @__PURE__ */ jsx44(FormItem12, { children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center space-x-2", children: [
|
|
4691
|
+
/* @__PURE__ */ jsx44(FormControl12, { children: /* @__PURE__ */ jsx44(
|
|
4390
4692
|
Checkbox2,
|
|
4391
4693
|
{
|
|
4392
4694
|
checked: field.value,
|
|
@@ -4394,18 +4696,18 @@ function SignInForm({
|
|
|
4394
4696
|
disabled: submitting
|
|
4395
4697
|
}
|
|
4396
4698
|
) }),
|
|
4397
|
-
/* @__PURE__ */
|
|
4699
|
+
/* @__PURE__ */ jsx44(FormLabel11, { children: t("systems.REMEMBER_ME") })
|
|
4398
4700
|
] }) })
|
|
4399
4701
|
}
|
|
4400
4702
|
),
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
|
|
4703
|
+
/* @__PURE__ */ jsxs38(
|
|
4704
|
+
Button28,
|
|
4403
4705
|
{
|
|
4404
4706
|
type: "submit",
|
|
4405
|
-
className:
|
|
4707
|
+
className: cn36("relative w-full", classNames?.button, classNames?.primaryButton),
|
|
4406
4708
|
disabled: submitting,
|
|
4407
4709
|
children: [
|
|
4408
|
-
/* @__PURE__ */
|
|
4710
|
+
/* @__PURE__ */ jsx44(
|
|
4409
4711
|
LastUsedButton,
|
|
4410
4712
|
{
|
|
4411
4713
|
className: classNames?.lastLoginMethod,
|
|
@@ -4413,7 +4715,7 @@ function SignInForm({
|
|
|
4413
4715
|
variant: "secondary"
|
|
4414
4716
|
}
|
|
4415
4717
|
),
|
|
4416
|
-
submitting ? /* @__PURE__ */
|
|
4718
|
+
submitting ? /* @__PURE__ */ jsx44(Spinner17, {}) : t("systems.SIGN_IN_ACTION")
|
|
4417
4719
|
]
|
|
4418
4720
|
}
|
|
4419
4721
|
)
|
|
@@ -4423,28 +4725,29 @@ function SignInForm({
|
|
|
4423
4725
|
}
|
|
4424
4726
|
|
|
4425
4727
|
// src/ui/auth/sign-out.tsx
|
|
4426
|
-
import { useEffect as
|
|
4427
|
-
import { Spinner as
|
|
4428
|
-
import { jsx as
|
|
4728
|
+
import { useEffect as useEffect11, useRef as useRef6 } from "react";
|
|
4729
|
+
import { Spinner as Spinner18 } from "pelatform-ui/default";
|
|
4730
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
4429
4731
|
function SignOut({ redirectTo }) {
|
|
4430
4732
|
const { authClient, auth } = useConfig();
|
|
4431
4733
|
const { onSuccess } = useOnSuccessTransition(redirectTo || auth.redirectAfterLogout || "/");
|
|
4432
4734
|
const signingOut = useRef6(false);
|
|
4433
|
-
|
|
4735
|
+
useEffect11(() => {
|
|
4434
4736
|
if (signingOut.current) return;
|
|
4435
4737
|
signingOut.current = true;
|
|
4436
4738
|
authClient.signOut().finally(onSuccess);
|
|
4437
4739
|
}, [authClient, onSuccess]);
|
|
4438
|
-
return /* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ jsx45("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx45(Spinner18, { className: "size-12" }) });
|
|
4439
4741
|
}
|
|
4440
4742
|
|
|
4441
4743
|
// src/ui/auth/sign-up.tsx
|
|
4442
|
-
import { useEffect as
|
|
4443
|
-
import { useRouter as
|
|
4444
|
-
import {
|
|
4445
|
-
import {
|
|
4744
|
+
import { useEffect as useEffect12 } from "react";
|
|
4745
|
+
import { useRouter as useRouter13 } from "next/navigation";
|
|
4746
|
+
import { zodResolver as zodResolver13 } from "@hookform/resolvers/zod";
|
|
4747
|
+
import { useTranslations as useTranslations39 } from "next-intl";
|
|
4748
|
+
import { AlertToast as AlertToast23 } from "pelatform-ui/components";
|
|
4446
4749
|
import {
|
|
4447
|
-
Button as
|
|
4750
|
+
Button as Button29,
|
|
4448
4751
|
Form as Form14,
|
|
4449
4752
|
FormControl as FormControl13,
|
|
4450
4753
|
FormField as FormField13,
|
|
@@ -4452,13 +4755,12 @@ import {
|
|
|
4452
4755
|
FormLabel as FormLabel12,
|
|
4453
4756
|
FormMessage as FormMessage13,
|
|
4454
4757
|
Input as Input11,
|
|
4455
|
-
Spinner as
|
|
4456
|
-
} from "
|
|
4457
|
-
import { useForm as useForm14 } from "
|
|
4458
|
-
import {
|
|
4459
|
-
import {
|
|
4460
|
-
import {
|
|
4461
|
-
import { jsx as jsx45, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4758
|
+
Spinner as Spinner19
|
|
4759
|
+
} from "pelatform-ui/default";
|
|
4760
|
+
import { useForm as useForm14 } from "react-hook-form";
|
|
4761
|
+
import { z as z13 } from "zod";
|
|
4762
|
+
import { cn as cn37 } from "@pelatform/utils";
|
|
4763
|
+
import { jsx as jsx46, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4462
4764
|
function SignUpForm({
|
|
4463
4765
|
className,
|
|
4464
4766
|
classNames,
|
|
@@ -4467,8 +4769,8 @@ function SignUpForm({
|
|
|
4467
4769
|
setIsSubmitting
|
|
4468
4770
|
}) {
|
|
4469
4771
|
const { authClient, app, path } = useConfig();
|
|
4470
|
-
const t =
|
|
4471
|
-
const router =
|
|
4772
|
+
const t = useTranslations39();
|
|
4773
|
+
const router = useRouter13();
|
|
4472
4774
|
const {
|
|
4473
4775
|
onSuccess,
|
|
4474
4776
|
isPending: transitionPending,
|
|
@@ -4492,7 +4794,7 @@ function SignUpForm({
|
|
|
4492
4794
|
}
|
|
4493
4795
|
});
|
|
4494
4796
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4495
|
-
|
|
4797
|
+
useEffect12(() => {
|
|
4496
4798
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4497
4799
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4498
4800
|
async function onSubmit({ name, email, password }) {
|
|
@@ -4507,33 +4809,33 @@ function SignUpForm({
|
|
|
4507
4809
|
if ("token" in data && data.token) {
|
|
4508
4810
|
await onSuccess();
|
|
4509
4811
|
} else {
|
|
4510
|
-
|
|
4812
|
+
AlertToast23({
|
|
4511
4813
|
message: t("systems.SIGN_UP_EMAIL")
|
|
4512
4814
|
});
|
|
4513
4815
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
4514
4816
|
}
|
|
4515
4817
|
} catch (error) {
|
|
4516
|
-
|
|
4818
|
+
AlertToast23({
|
|
4517
4819
|
message: getTranslations({ error, t }),
|
|
4518
4820
|
icon: "destructive"
|
|
4519
4821
|
});
|
|
4520
4822
|
form.resetField("password");
|
|
4521
4823
|
}
|
|
4522
4824
|
}
|
|
4523
|
-
return /* @__PURE__ */
|
|
4825
|
+
return /* @__PURE__ */ jsx46(Form14, { ...form, children: /* @__PURE__ */ jsxs39(
|
|
4524
4826
|
"form",
|
|
4525
4827
|
{
|
|
4526
4828
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4527
|
-
className:
|
|
4829
|
+
className: cn37("grid w-full gap-6", className, classNames?.base),
|
|
4528
4830
|
children: [
|
|
4529
|
-
/* @__PURE__ */
|
|
4831
|
+
/* @__PURE__ */ jsx46(
|
|
4530
4832
|
FormField13,
|
|
4531
4833
|
{
|
|
4532
4834
|
control: form.control,
|
|
4533
4835
|
name: "name",
|
|
4534
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4836
|
+
render: ({ field }) => /* @__PURE__ */ jsxs39(FormItem13, { children: [
|
|
4837
|
+
/* @__PURE__ */ jsx46(FormLabel12, { className: classNames?.label, children: t("systems.NAME") }),
|
|
4838
|
+
/* @__PURE__ */ jsx46(FormControl13, { children: /* @__PURE__ */ jsx46(
|
|
4537
4839
|
Input11,
|
|
4538
4840
|
{
|
|
4539
4841
|
type: "text",
|
|
@@ -4544,18 +4846,18 @@ function SignUpForm({
|
|
|
4544
4846
|
...field
|
|
4545
4847
|
}
|
|
4546
4848
|
) }),
|
|
4547
|
-
/* @__PURE__ */
|
|
4849
|
+
/* @__PURE__ */ jsx46(FormMessage13, { className: classNames?.error })
|
|
4548
4850
|
] })
|
|
4549
4851
|
}
|
|
4550
4852
|
),
|
|
4551
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsx46(
|
|
4552
4854
|
FormField13,
|
|
4553
4855
|
{
|
|
4554
4856
|
control: form.control,
|
|
4555
4857
|
name: "email",
|
|
4556
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
4858
|
+
render: ({ field }) => /* @__PURE__ */ jsxs39(FormItem13, { children: [
|
|
4859
|
+
/* @__PURE__ */ jsx46(FormLabel12, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
4860
|
+
/* @__PURE__ */ jsx46(FormControl13, { children: /* @__PURE__ */ jsx46(
|
|
4559
4861
|
Input11,
|
|
4560
4862
|
{
|
|
4561
4863
|
type: "email",
|
|
@@ -4566,18 +4868,18 @@ function SignUpForm({
|
|
|
4566
4868
|
...field
|
|
4567
4869
|
}
|
|
4568
4870
|
) }),
|
|
4569
|
-
/* @__PURE__ */
|
|
4871
|
+
/* @__PURE__ */ jsx46(FormMessage13, { className: classNames?.error })
|
|
4570
4872
|
] })
|
|
4571
4873
|
}
|
|
4572
4874
|
),
|
|
4573
|
-
/* @__PURE__ */
|
|
4875
|
+
/* @__PURE__ */ jsx46(
|
|
4574
4876
|
FormField13,
|
|
4575
4877
|
{
|
|
4576
4878
|
control: form.control,
|
|
4577
4879
|
name: "password",
|
|
4578
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4579
|
-
/* @__PURE__ */
|
|
4580
|
-
/* @__PURE__ */
|
|
4880
|
+
render: ({ field }) => /* @__PURE__ */ jsxs39(FormItem13, { children: [
|
|
4881
|
+
/* @__PURE__ */ jsx46(FormLabel12, { className: classNames?.label, children: t("systems.PASSWORD") }),
|
|
4882
|
+
/* @__PURE__ */ jsx46(FormControl13, { children: /* @__PURE__ */ jsx46(
|
|
4581
4883
|
PasswordInput,
|
|
4582
4884
|
{
|
|
4583
4885
|
autoComplete: "new-password",
|
|
@@ -4588,17 +4890,17 @@ function SignUpForm({
|
|
|
4588
4890
|
...field
|
|
4589
4891
|
}
|
|
4590
4892
|
) }),
|
|
4591
|
-
/* @__PURE__ */
|
|
4893
|
+
/* @__PURE__ */ jsx46(FormMessage13, { className: classNames?.error })
|
|
4592
4894
|
] })
|
|
4593
4895
|
}
|
|
4594
4896
|
),
|
|
4595
|
-
/* @__PURE__ */
|
|
4596
|
-
|
|
4897
|
+
/* @__PURE__ */ jsx46(
|
|
4898
|
+
Button29,
|
|
4597
4899
|
{
|
|
4598
4900
|
type: "submit",
|
|
4599
|
-
className:
|
|
4901
|
+
className: cn37("w-full", classNames?.button, classNames?.primaryButton),
|
|
4600
4902
|
disabled: submitting,
|
|
4601
|
-
children: submitting ? /* @__PURE__ */
|
|
4903
|
+
children: submitting ? /* @__PURE__ */ jsx46(Spinner19, {}) : t("systems.SIGN_UP_ACTION")
|
|
4602
4904
|
}
|
|
4603
4905
|
)
|
|
4604
4906
|
]
|
|
@@ -4607,15 +4909,15 @@ function SignUpForm({
|
|
|
4607
4909
|
}
|
|
4608
4910
|
|
|
4609
4911
|
// src/ui/auth/two-factor.tsx
|
|
4610
|
-
import { useCallback as useCallback2, useEffect as
|
|
4912
|
+
import { useCallback as useCallback2, useEffect as useEffect13, useMemo as useMemo4, useRef as useRef7, useState as useState16 } from "react";
|
|
4611
4913
|
import Link2 from "next/link";
|
|
4612
|
-
import { useSearchParams as
|
|
4914
|
+
import { useSearchParams as useSearchParams6 } from "next/navigation";
|
|
4915
|
+
import { zodResolver as zodResolver14 } from "@hookform/resolvers/zod";
|
|
4613
4916
|
import { QrCodeIcon, SendIcon } from "lucide-react";
|
|
4614
|
-
import { useTranslations as
|
|
4615
|
-
import
|
|
4616
|
-
import { AlertToast as AlertToast23 } from "@pelatform/ui/components";
|
|
4917
|
+
import { useTranslations as useTranslations40 } from "next-intl";
|
|
4918
|
+
import { AlertToast as AlertToast24 } from "pelatform-ui/components";
|
|
4617
4919
|
import {
|
|
4618
|
-
Button as
|
|
4920
|
+
Button as Button30,
|
|
4619
4921
|
Checkbox as Checkbox3,
|
|
4620
4922
|
Form as Form15,
|
|
4621
4923
|
FormControl as FormControl14,
|
|
@@ -4625,13 +4927,13 @@ import {
|
|
|
4625
4927
|
FormMessage as FormMessage14,
|
|
4626
4928
|
InputOTP as InputOTP2,
|
|
4627
4929
|
Label,
|
|
4628
|
-
Spinner as
|
|
4629
|
-
} from "
|
|
4630
|
-
import
|
|
4631
|
-
import {
|
|
4632
|
-
import { z as z14 } from "
|
|
4633
|
-
import { cn as
|
|
4634
|
-
import { Fragment as Fragment15, jsx as
|
|
4930
|
+
Spinner as Spinner20
|
|
4931
|
+
} from "pelatform-ui/default";
|
|
4932
|
+
import QRCode from "qrcode";
|
|
4933
|
+
import { useForm as useForm15 } from "react-hook-form";
|
|
4934
|
+
import { z as z14 } from "zod";
|
|
4935
|
+
import { cn as cn38 } from "@pelatform/utils";
|
|
4936
|
+
import { Fragment as Fragment15, jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4635
4937
|
function TwoFactorForm({
|
|
4636
4938
|
className,
|
|
4637
4939
|
classNames,
|
|
@@ -4641,16 +4943,16 @@ function TwoFactorForm({
|
|
|
4641
4943
|
setIsSubmitting
|
|
4642
4944
|
}) {
|
|
4643
4945
|
const { authClient, path } = useConfig();
|
|
4644
|
-
const searchParams =
|
|
4645
|
-
const t =
|
|
4946
|
+
const searchParams = useSearchParams6();
|
|
4947
|
+
const t = useTranslations40();
|
|
4646
4948
|
const { user } = useSession();
|
|
4647
4949
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectToProp);
|
|
4648
4950
|
const totpURI = searchParams?.get("totpURI");
|
|
4649
4951
|
const isTwoFactorEnabled = user?.twoFactorEnabled;
|
|
4650
4952
|
const initialSendRef = useRef7(false);
|
|
4651
|
-
const [method, setMethod] =
|
|
4652
|
-
const [isSendingOtp, setIsSendingOtp] =
|
|
4653
|
-
const [cooldownSeconds, setCooldownSeconds] =
|
|
4953
|
+
const [method, setMethod] = useState16("totp");
|
|
4954
|
+
const [isSendingOtp, setIsSendingOtp] = useState16(false);
|
|
4955
|
+
const [cooldownSeconds, setCooldownSeconds] = useState16(0);
|
|
4654
4956
|
const formSchema = z14.object({
|
|
4655
4957
|
code: z14.string().min(1, {
|
|
4656
4958
|
error: `${t("systems.ONE_TIME_PASSWORD")} ${t("systems.IS_REQUIRED")}`
|
|
@@ -4667,16 +4969,16 @@ function TwoFactorForm({
|
|
|
4667
4969
|
}
|
|
4668
4970
|
});
|
|
4669
4971
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4670
|
-
|
|
4972
|
+
useEffect13(() => {
|
|
4671
4973
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4672
4974
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4673
|
-
|
|
4975
|
+
useEffect13(() => {
|
|
4674
4976
|
if (method === "otp" && cooldownSeconds <= 0 && !initialSendRef.current) {
|
|
4675
4977
|
initialSendRef.current = true;
|
|
4676
4978
|
sendOtp();
|
|
4677
4979
|
}
|
|
4678
4980
|
}, [method]);
|
|
4679
|
-
|
|
4981
|
+
useEffect13(() => {
|
|
4680
4982
|
if (cooldownSeconds <= 0) return;
|
|
4681
4983
|
const timer = setTimeout(() => {
|
|
4682
4984
|
setCooldownSeconds((prev) => prev - 1);
|
|
@@ -4692,7 +4994,7 @@ function TwoFactorForm({
|
|
|
4692
4994
|
});
|
|
4693
4995
|
setCooldownSeconds(60);
|
|
4694
4996
|
} catch (error) {
|
|
4695
|
-
|
|
4997
|
+
AlertToast24({
|
|
4696
4998
|
message: getTranslations({ error, t }),
|
|
4697
4999
|
icon: "destructive"
|
|
4698
5000
|
});
|
|
@@ -4713,47 +5015,47 @@ function TwoFactorForm({
|
|
|
4713
5015
|
});
|
|
4714
5016
|
await onSuccess();
|
|
4715
5017
|
if (user && !isTwoFactorEnabled) {
|
|
4716
|
-
|
|
5018
|
+
AlertToast24({
|
|
4717
5019
|
message: t("systems.TWO_FACTOR_ENABLED")
|
|
4718
5020
|
});
|
|
4719
5021
|
}
|
|
4720
5022
|
} catch (error) {
|
|
4721
|
-
|
|
5023
|
+
AlertToast24({
|
|
4722
5024
|
message: getTranslations({ error, t }),
|
|
4723
5025
|
icon: "destructive"
|
|
4724
5026
|
});
|
|
4725
5027
|
form.reset();
|
|
4726
5028
|
}
|
|
4727
5029
|
}
|
|
4728
|
-
return /* @__PURE__ */
|
|
5030
|
+
return /* @__PURE__ */ jsx47(Form15, { ...form, children: /* @__PURE__ */ jsxs40(
|
|
4729
5031
|
"form",
|
|
4730
5032
|
{
|
|
4731
5033
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4732
|
-
className:
|
|
5034
|
+
className: cn38("grid w-full gap-6", className, classNames?.base),
|
|
4733
5035
|
children: [
|
|
4734
|
-
totpURI && method === "totp" && /* @__PURE__ */
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
5036
|
+
totpURI && method === "totp" && /* @__PURE__ */ jsxs40("div", { className: "space-y-3", children: [
|
|
5037
|
+
/* @__PURE__ */ jsx47(Label, { className: cn38("block", classNames?.label), children: t("systems.TWO_FACTOR_TOTP_LABEL") }),
|
|
5038
|
+
/* @__PURE__ */ jsx47(QRCodeComponent, { className: classNames?.qrCode, value: totpURI })
|
|
4737
5039
|
] }),
|
|
4738
|
-
method !== null && /* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
5040
|
+
method !== null && /* @__PURE__ */ jsxs40(Fragment15, { children: [
|
|
5041
|
+
/* @__PURE__ */ jsx47(
|
|
4740
5042
|
FormField14,
|
|
4741
5043
|
{
|
|
4742
5044
|
control: form.control,
|
|
4743
5045
|
name: "code",
|
|
4744
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4745
|
-
/* @__PURE__ */
|
|
4746
|
-
/* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
5046
|
+
render: ({ field }) => /* @__PURE__ */ jsxs40(FormItem14, { children: [
|
|
5047
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between", children: [
|
|
5048
|
+
/* @__PURE__ */ jsx47(FormLabel13, { className: classNames?.label, children: t("systems.ONE_TIME_PASSWORD") }),
|
|
5049
|
+
/* @__PURE__ */ jsx47(
|
|
4748
5050
|
Link2,
|
|
4749
5051
|
{
|
|
4750
|
-
className:
|
|
5052
|
+
className: cn38("text-sm hover:underline", classNames?.forgotPasswordLink),
|
|
4751
5053
|
href: `${path.auth.RECOVER_ACCOUNT}${window.location.search}`,
|
|
4752
5054
|
children: t("systems.FORGOT_AUTHENTICATOR")
|
|
4753
5055
|
}
|
|
4754
5056
|
)
|
|
4755
5057
|
] }),
|
|
4756
|
-
/* @__PURE__ */
|
|
5058
|
+
/* @__PURE__ */ jsx47(FormControl14, { children: /* @__PURE__ */ jsx47(
|
|
4757
5059
|
InputOTP2,
|
|
4758
5060
|
{
|
|
4759
5061
|
...field,
|
|
@@ -4767,20 +5069,20 @@ function TwoFactorForm({
|
|
|
4767
5069
|
containerClassName: classNames?.otpInputContainer,
|
|
4768
5070
|
className: classNames?.otpInput,
|
|
4769
5071
|
disabled: submitting,
|
|
4770
|
-
children: /* @__PURE__ */
|
|
5072
|
+
children: /* @__PURE__ */ jsx47(OTPInputGroup, { otpSeparators })
|
|
4771
5073
|
}
|
|
4772
5074
|
) }),
|
|
4773
|
-
/* @__PURE__ */
|
|
5075
|
+
/* @__PURE__ */ jsx47(FormMessage14, { className: classNames?.error })
|
|
4774
5076
|
] })
|
|
4775
5077
|
}
|
|
4776
5078
|
),
|
|
4777
|
-
/* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ jsx47(
|
|
4778
5080
|
FormField14,
|
|
4779
5081
|
{
|
|
4780
5082
|
control: form.control,
|
|
4781
5083
|
name: "trustDevice",
|
|
4782
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
5084
|
+
render: ({ field }) => /* @__PURE__ */ jsx47(FormItem14, { children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center space-x-2", children: [
|
|
5085
|
+
/* @__PURE__ */ jsx47(FormControl14, { children: /* @__PURE__ */ jsx47(
|
|
4784
5086
|
Checkbox3,
|
|
4785
5087
|
{
|
|
4786
5088
|
className: classNames?.checkbox,
|
|
@@ -4789,60 +5091,60 @@ function TwoFactorForm({
|
|
|
4789
5091
|
disabled: submitting
|
|
4790
5092
|
}
|
|
4791
5093
|
) }),
|
|
4792
|
-
/* @__PURE__ */
|
|
5094
|
+
/* @__PURE__ */ jsx47(FormLabel13, { className: classNames?.label, children: t("systems.TRUST_DEVICE") })
|
|
4793
5095
|
] }) })
|
|
4794
5096
|
}
|
|
4795
5097
|
)
|
|
4796
5098
|
] }),
|
|
4797
|
-
/* @__PURE__ */
|
|
4798
|
-
method !== null && /* @__PURE__ */
|
|
4799
|
-
|
|
5099
|
+
/* @__PURE__ */ jsxs40("div", { className: "grid gap-4", children: [
|
|
5100
|
+
method !== null && /* @__PURE__ */ jsx47(
|
|
5101
|
+
Button30,
|
|
4800
5102
|
{
|
|
4801
5103
|
type: "submit",
|
|
4802
|
-
className:
|
|
5104
|
+
className: cn38(classNames?.button, classNames?.primaryButton),
|
|
4803
5105
|
disabled: submitting,
|
|
4804
|
-
children: submitting ? /* @__PURE__ */
|
|
5106
|
+
children: submitting ? /* @__PURE__ */ jsx47(Spinner20, {}) : t("systems.TWO_FACTOR_ACTION")
|
|
4805
5107
|
}
|
|
4806
5108
|
),
|
|
4807
|
-
method === "otp" && /* @__PURE__ */
|
|
4808
|
-
|
|
5109
|
+
method === "otp" && /* @__PURE__ */ jsxs40(
|
|
5110
|
+
Button30,
|
|
4809
5111
|
{
|
|
4810
5112
|
type: "button",
|
|
4811
5113
|
variant: "outline",
|
|
4812
|
-
className:
|
|
5114
|
+
className: cn38(classNames?.button, classNames?.outlineButton),
|
|
4813
5115
|
onClick: sendOtp,
|
|
4814
5116
|
disabled: cooldownSeconds > 0 || isSendingOtp || submitting,
|
|
4815
5117
|
children: [
|
|
4816
|
-
isSendingOtp ? /* @__PURE__ */
|
|
5118
|
+
isSendingOtp ? /* @__PURE__ */ jsx47(Spinner20, {}) : /* @__PURE__ */ jsx47(SendIcon, { className: classNames?.icon }),
|
|
4817
5119
|
t("systems.RESEND_CODE"),
|
|
4818
5120
|
cooldownSeconds > 0 && ` (${cooldownSeconds})`
|
|
4819
5121
|
]
|
|
4820
5122
|
}
|
|
4821
5123
|
),
|
|
4822
|
-
method !== "otp" && /* @__PURE__ */
|
|
4823
|
-
|
|
5124
|
+
method !== "otp" && /* @__PURE__ */ jsxs40(
|
|
5125
|
+
Button30,
|
|
4824
5126
|
{
|
|
4825
5127
|
type: "button",
|
|
4826
5128
|
variant: "secondary",
|
|
4827
|
-
className:
|
|
5129
|
+
className: cn38(classNames?.button, classNames?.secondaryButton),
|
|
4828
5130
|
onClick: () => setMethod("otp"),
|
|
4829
5131
|
disabled: submitting,
|
|
4830
5132
|
children: [
|
|
4831
|
-
/* @__PURE__ */
|
|
5133
|
+
/* @__PURE__ */ jsx47(SendIcon, { className: classNames?.icon }),
|
|
4832
5134
|
t("systems.SEND_VERIFICATION_CODE")
|
|
4833
5135
|
]
|
|
4834
5136
|
}
|
|
4835
5137
|
),
|
|
4836
|
-
method !== "totp" && /* @__PURE__ */
|
|
4837
|
-
|
|
5138
|
+
method !== "totp" && /* @__PURE__ */ jsxs40(
|
|
5139
|
+
Button30,
|
|
4838
5140
|
{
|
|
4839
5141
|
type: "button",
|
|
4840
5142
|
variant: "secondary",
|
|
4841
|
-
className:
|
|
5143
|
+
className: cn38(classNames?.button, classNames?.secondaryButton),
|
|
4842
5144
|
onClick: () => setMethod("totp"),
|
|
4843
5145
|
disabled: submitting,
|
|
4844
5146
|
children: [
|
|
4845
|
-
/* @__PURE__ */
|
|
5147
|
+
/* @__PURE__ */ jsx47(QrCodeIcon, { className: classNames?.icon }),
|
|
4846
5148
|
t("systems.CONTINUE_WITH_AUTHENTICATOR")
|
|
4847
5149
|
]
|
|
4848
5150
|
}
|
|
@@ -4859,12 +5161,12 @@ function QRCodeComponent({
|
|
|
4859
5161
|
as = "svg",
|
|
4860
5162
|
className
|
|
4861
5163
|
}) {
|
|
4862
|
-
const [src, setSrc] =
|
|
5164
|
+
const [src, setSrc] = useState16("");
|
|
4863
5165
|
const opts = useMemo4(
|
|
4864
5166
|
() => ({ errorCorrectionLevel: level, margin: 1, width: size }),
|
|
4865
5167
|
[level, size]
|
|
4866
5168
|
);
|
|
4867
|
-
|
|
5169
|
+
useEffect13(() => {
|
|
4868
5170
|
let cancelled = false;
|
|
4869
5171
|
if (as === "img") {
|
|
4870
5172
|
QRCode.toDataURL(value, opts).then((url) => !cancelled && setSrc(url));
|
|
@@ -4879,36 +5181,36 @@ function QRCodeComponent({
|
|
|
4879
5181
|
}, [value, opts, as]);
|
|
4880
5182
|
if (!src) return null;
|
|
4881
5183
|
if (as === "img") {
|
|
4882
|
-
return /* @__PURE__ */
|
|
5184
|
+
return /* @__PURE__ */ jsx47("img", { src, width: size, height: size, alt: "QR code", className });
|
|
4883
5185
|
}
|
|
4884
|
-
return /* @__PURE__ */
|
|
5186
|
+
return /* @__PURE__ */ jsx47(
|
|
4885
5187
|
"span",
|
|
4886
5188
|
{
|
|
4887
|
-
className:
|
|
5189
|
+
className: cn38("block", className),
|
|
4888
5190
|
dangerouslySetInnerHTML: { __html: src }
|
|
4889
5191
|
}
|
|
4890
5192
|
);
|
|
4891
5193
|
}
|
|
4892
5194
|
|
|
4893
5195
|
// src/ui/auth/view.tsx
|
|
4894
|
-
import { useEffect as
|
|
5196
|
+
import { useEffect as useEffect14, useState as useState17 } from "react";
|
|
4895
5197
|
import Link3 from "next/link";
|
|
4896
|
-
import { useRouter as
|
|
5198
|
+
import { useRouter as useRouter14 } from "next/navigation";
|
|
4897
5199
|
import { ArrowLeftIcon } from "lucide-react";
|
|
4898
|
-
import { useTranslations as
|
|
5200
|
+
import { useTranslations as useTranslations41 } from "next-intl";
|
|
4899
5201
|
import {
|
|
4900
|
-
Button as
|
|
4901
|
-
Card as
|
|
4902
|
-
CardContent as
|
|
5202
|
+
Button as Button31,
|
|
5203
|
+
Card as Card11,
|
|
5204
|
+
CardContent as CardContent3,
|
|
4903
5205
|
CardDescription,
|
|
4904
5206
|
CardFooter as CardFooter2,
|
|
4905
|
-
CardHeader,
|
|
5207
|
+
CardHeader as CardHeader2,
|
|
4906
5208
|
CardHeading,
|
|
4907
5209
|
CardTitle,
|
|
4908
5210
|
Separator
|
|
4909
|
-
} from "
|
|
4910
|
-
import { cn as
|
|
4911
|
-
import { Fragment as Fragment16, jsx as
|
|
5211
|
+
} from "pelatform-ui/default";
|
|
5212
|
+
import { cn as cn39 } from "@pelatform/utils";
|
|
5213
|
+
import { Fragment as Fragment16, jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4912
5214
|
function getViewByPath(pathConfig, path) {
|
|
4913
5215
|
if (!path) return null;
|
|
4914
5216
|
const cleanPath = path.replace(/^\//, "").split("?")[0];
|
|
@@ -4923,6 +5225,7 @@ function AuthView({
|
|
|
4923
5225
|
className,
|
|
4924
5226
|
classNames,
|
|
4925
5227
|
cardHeader,
|
|
5228
|
+
enableAcceptInvitation: enableAcceptInvitationProp,
|
|
4926
5229
|
otpSeparators = 1,
|
|
4927
5230
|
path: pathProp,
|
|
4928
5231
|
pathname,
|
|
@@ -4930,8 +5233,8 @@ function AuthView({
|
|
|
4930
5233
|
socialLayout: socialLayoutProp = "auto",
|
|
4931
5234
|
view: viewProp
|
|
4932
5235
|
}) {
|
|
4933
|
-
const { auth, path: pathConfig } = useConfig();
|
|
4934
|
-
const t =
|
|
5236
|
+
const { auth, features, path: pathConfig } = useConfig();
|
|
5237
|
+
const t = useTranslations41();
|
|
4935
5238
|
const auths = auth.authentication;
|
|
4936
5239
|
let socialLayout = socialLayoutProp;
|
|
4937
5240
|
if (socialLayout === "auto") {
|
|
@@ -4939,8 +5242,8 @@ function AuthView({
|
|
|
4939
5242
|
}
|
|
4940
5243
|
const currentPath = pathProp ?? pathname?.split("/").pop();
|
|
4941
5244
|
const view = viewProp || getViewByPath(pathConfig.auth, currentPath) || "SIGN_IN";
|
|
4942
|
-
const [isSubmitting, setIsSubmitting] =
|
|
4943
|
-
|
|
5245
|
+
const [isSubmitting, setIsSubmitting] = useState17(false);
|
|
5246
|
+
useEffect14(() => {
|
|
4944
5247
|
const handlePageHide = () => setIsSubmitting(false);
|
|
4945
5248
|
window.addEventListener("pagehide", handlePageHide);
|
|
4946
5249
|
return () => {
|
|
@@ -4948,8 +5251,12 @@ function AuthView({
|
|
|
4948
5251
|
window.removeEventListener("pagehide", handlePageHide);
|
|
4949
5252
|
};
|
|
4950
5253
|
}, []);
|
|
4951
|
-
|
|
4952
|
-
if (view === "
|
|
5254
|
+
const enableAcceptInvitation = enableAcceptInvitationProp ?? features.workspace;
|
|
5255
|
+
if (view === "CALLBACK") return /* @__PURE__ */ jsx48(AuthCallback, { redirectTo });
|
|
5256
|
+
if (view === "SIGN_OUT") return /* @__PURE__ */ jsx48(SignOut, {});
|
|
5257
|
+
if (view === "ACCEPT_INVITATION" && enableAcceptInvitation) {
|
|
5258
|
+
return /* @__PURE__ */ jsx48(AcceptInvitation, {});
|
|
5259
|
+
}
|
|
4953
5260
|
const description = !auths.password && !auths.magicLink && !auths.emailOtp ? t("systems.DISABLED_CREDENTIALS_DESCRIPTION") : t(`systems.${view}_DESCRIPTION`);
|
|
4954
5261
|
const showSocialProviders = view !== "RESET_PASSWORD" && view !== "FORGOT_PASSWORD" && auth.socialProviders && auth.socialProviders.length > 0;
|
|
4955
5262
|
const showPasskey = auths.passkey && [
|
|
@@ -4961,38 +5268,38 @@ function AuthView({
|
|
|
4961
5268
|
"FORGOT_PASSWORD"
|
|
4962
5269
|
].includes(view);
|
|
4963
5270
|
const showCredentials = auths.password || auths.magicLink || auths.emailOtp;
|
|
4964
|
-
return /* @__PURE__ */
|
|
4965
|
-
|
|
5271
|
+
return /* @__PURE__ */ jsxs41(
|
|
5272
|
+
Card11,
|
|
4966
5273
|
{
|
|
4967
|
-
className:
|
|
5274
|
+
className: cn39(
|
|
4968
5275
|
"w-full max-w-full border-0 bg-transparent p-0 shadow-none",
|
|
4969
5276
|
className,
|
|
4970
5277
|
classNames?.base
|
|
4971
5278
|
),
|
|
4972
5279
|
children: [
|
|
4973
|
-
/* @__PURE__ */
|
|
4974
|
-
|
|
5280
|
+
/* @__PURE__ */ jsx48(
|
|
5281
|
+
CardHeader2,
|
|
4975
5282
|
{
|
|
4976
|
-
className:
|
|
5283
|
+
className: cn39(
|
|
4977
5284
|
"justify-center space-y-1.5 border-0 py-4 pb-3 text-center",
|
|
4978
5285
|
classNames?.header
|
|
4979
5286
|
),
|
|
4980
|
-
children: cardHeader ? cardHeader : /* @__PURE__ */
|
|
4981
|
-
/* @__PURE__ */
|
|
4982
|
-
description && /* @__PURE__ */
|
|
5287
|
+
children: cardHeader ? cardHeader : /* @__PURE__ */ jsxs41(CardHeading, { children: [
|
|
5288
|
+
/* @__PURE__ */ jsx48(CardTitle, { className: cn39("font-semibold text-2xl tracking-tight", classNames?.title), children: t(`systems.${view}`) }),
|
|
5289
|
+
description && /* @__PURE__ */ jsx48(
|
|
4983
5290
|
CardDescription,
|
|
4984
5291
|
{
|
|
4985
|
-
className:
|
|
5292
|
+
className: cn39("text-muted-foreground text-sm", classNames?.description),
|
|
4986
5293
|
children: description
|
|
4987
5294
|
}
|
|
4988
5295
|
)
|
|
4989
5296
|
] })
|
|
4990
5297
|
}
|
|
4991
5298
|
),
|
|
4992
|
-
/* @__PURE__ */
|
|
4993
|
-
auths.oneTap && ["SIGN_IN", "SIGN_UP", "MAGIC_LINK", "EMAIL_OTP"].includes(view) && /* @__PURE__ */
|
|
4994
|
-
showCredentials && /* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
5299
|
+
/* @__PURE__ */ jsxs41(CardContent3, { className: cn39("grid gap-6", classNames?.content), children: [
|
|
5300
|
+
auths.oneTap && ["SIGN_IN", "SIGN_UP", "MAGIC_LINK", "EMAIL_OTP"].includes(view) && /* @__PURE__ */ jsx48(OneTap, { redirectTo }),
|
|
5301
|
+
showCredentials && /* @__PURE__ */ jsxs41("div", { className: "grid gap-4", children: [
|
|
5302
|
+
/* @__PURE__ */ jsx48(
|
|
4996
5303
|
AuthForm,
|
|
4997
5304
|
{
|
|
4998
5305
|
classNames: classNames?.form,
|
|
@@ -5005,22 +5312,22 @@ function AuthView({
|
|
|
5005
5312
|
),
|
|
5006
5313
|
auths.magicLink && (auths.password && ["FORGOT_PASSWORD", "SIGN_UP", "SIGN_IN", "MAGIC_LINK", "EMAIL_OTP"].includes(
|
|
5007
5314
|
view
|
|
5008
|
-
) || auths.emailOtp && view === "EMAIL_OTP") && /* @__PURE__ */
|
|
5315
|
+
) || auths.emailOtp && view === "EMAIL_OTP") && /* @__PURE__ */ jsx48(MagicLinkButton, { classNames, view }),
|
|
5009
5316
|
auths.emailOtp && (auths.password && ["FORGOT_PASSWORD", "SIGN_UP", "SIGN_IN", "MAGIC_LINK", "EMAIL_OTP"].includes(
|
|
5010
5317
|
view
|
|
5011
|
-
) || auths.magicLink && ["SIGN_IN", "MAGIC_LINK"].includes(view)) && /* @__PURE__ */
|
|
5318
|
+
) || auths.magicLink && ["SIGN_IN", "MAGIC_LINK"].includes(view)) && /* @__PURE__ */ jsx48(EmailOTPButton, { classNames, view })
|
|
5012
5319
|
] }),
|
|
5013
|
-
(showSocialProviders || showPasskey) && /* @__PURE__ */
|
|
5014
|
-
showCredentials && /* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5320
|
+
(showSocialProviders || showPasskey) && /* @__PURE__ */ jsxs41(Fragment16, { children: [
|
|
5321
|
+
showCredentials && /* @__PURE__ */ jsxs41("div", { className: cn39("flex items-center gap-2", classNames?.continueWith), children: [
|
|
5322
|
+
/* @__PURE__ */ jsx48(Separator, { className: cn39("w-auto! grow", classNames?.separator) }),
|
|
5323
|
+
/* @__PURE__ */ jsx48("span", { className: "shrink-0 text-muted-foreground text-sm", children: t("systems.OR_CONTINUE_WITH") }),
|
|
5324
|
+
/* @__PURE__ */ jsx48(Separator, { className: cn39("w-auto! grow", classNames?.separator) })
|
|
5018
5325
|
] }),
|
|
5019
|
-
/* @__PURE__ */
|
|
5020
|
-
showSocialProviders && /* @__PURE__ */
|
|
5326
|
+
/* @__PURE__ */ jsxs41("div", { className: "grid gap-4", children: [
|
|
5327
|
+
showSocialProviders && /* @__PURE__ */ jsx48(
|
|
5021
5328
|
"div",
|
|
5022
5329
|
{
|
|
5023
|
-
className:
|
|
5330
|
+
className: cn39(
|
|
5024
5331
|
"flex w-full items-center justify-between gap-4",
|
|
5025
5332
|
socialLayout === "horizontal" && "flex-wrap",
|
|
5026
5333
|
socialLayout === "vertical" && "flex-col",
|
|
@@ -5031,7 +5338,7 @@ function AuthView({
|
|
|
5031
5338
|
(socialProvider2) => socialProvider2.provider === provider
|
|
5032
5339
|
);
|
|
5033
5340
|
if (!socialProvider) return null;
|
|
5034
|
-
return /* @__PURE__ */
|
|
5341
|
+
return /* @__PURE__ */ jsx48(
|
|
5035
5342
|
ProviderButton,
|
|
5036
5343
|
{
|
|
5037
5344
|
classNames,
|
|
@@ -5046,50 +5353,50 @@ function AuthView({
|
|
|
5046
5353
|
})
|
|
5047
5354
|
}
|
|
5048
5355
|
),
|
|
5049
|
-
showPasskey && /* @__PURE__ */
|
|
5356
|
+
showPasskey && /* @__PURE__ */ jsx48(PasskeyButton, { classNames, redirectTo })
|
|
5050
5357
|
] })
|
|
5051
5358
|
] })
|
|
5052
5359
|
] }),
|
|
5053
|
-
auths.password && auth.enableSignup && /* @__PURE__ */
|
|
5360
|
+
auths.password && auth.enableSignup && /* @__PURE__ */ jsx48(
|
|
5054
5361
|
CardFooter2,
|
|
5055
5362
|
{
|
|
5056
|
-
className:
|
|
5363
|
+
className: cn39(
|
|
5057
5364
|
"justify-center gap-1.5 border-0 text-muted-foreground text-sm",
|
|
5058
5365
|
classNames?.footer
|
|
5059
5366
|
),
|
|
5060
|
-
children: view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? /* @__PURE__ */
|
|
5367
|
+
children: view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? /* @__PURE__ */ jsxs41(Fragment16, { children: [
|
|
5061
5368
|
t("systems.DONT_HAVE_AN_ACCOUNT"),
|
|
5062
|
-
/* @__PURE__ */
|
|
5063
|
-
|
|
5369
|
+
/* @__PURE__ */ jsx48(Link3, { href: `${pathConfig.auth.SIGN_UP}${window.location.search}`, children: /* @__PURE__ */ jsx48(
|
|
5370
|
+
Button31,
|
|
5064
5371
|
{
|
|
5065
5372
|
mode: "link",
|
|
5066
5373
|
underline: "dashed",
|
|
5067
5374
|
size: "sm",
|
|
5068
|
-
className:
|
|
5375
|
+
className: cn39("px-0 text-foreground", classNames?.footerLink),
|
|
5069
5376
|
children: t("systems.SIGN_UP")
|
|
5070
5377
|
}
|
|
5071
5378
|
) })
|
|
5072
|
-
] }) : view === "SIGN_UP" ? /* @__PURE__ */
|
|
5379
|
+
] }) : view === "SIGN_UP" ? /* @__PURE__ */ jsxs41(Fragment16, { children: [
|
|
5073
5380
|
t("systems.ALREADY_HAVE_AN_ACCOUNT"),
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
|
|
5381
|
+
/* @__PURE__ */ jsx48(Link3, { href: `${pathConfig.auth.SIGN_IN}${window.location.search}`, children: /* @__PURE__ */ jsx48(
|
|
5382
|
+
Button31,
|
|
5076
5383
|
{
|
|
5077
5384
|
mode: "link",
|
|
5078
5385
|
underline: "dashed",
|
|
5079
5386
|
size: "sm",
|
|
5080
|
-
className:
|
|
5387
|
+
className: cn39("px-0 text-foreground", classNames?.footerLink),
|
|
5081
5388
|
children: t("systems.SIGN_IN")
|
|
5082
5389
|
}
|
|
5083
5390
|
) })
|
|
5084
|
-
] }) : /* @__PURE__ */
|
|
5085
|
-
/* @__PURE__ */
|
|
5086
|
-
/* @__PURE__ */
|
|
5087
|
-
|
|
5391
|
+
] }) : /* @__PURE__ */ jsxs41(Fragment16, { children: [
|
|
5392
|
+
/* @__PURE__ */ jsx48(ArrowLeftIcon, { className: "size-3" }),
|
|
5393
|
+
/* @__PURE__ */ jsx48(
|
|
5394
|
+
Button31,
|
|
5088
5395
|
{
|
|
5089
5396
|
mode: "link",
|
|
5090
5397
|
underline: "dashed",
|
|
5091
5398
|
size: "sm",
|
|
5092
|
-
className:
|
|
5399
|
+
className: cn39("px-0 text-foreground", classNames?.footerLink),
|
|
5093
5400
|
onClick: () => {
|
|
5094
5401
|
if (typeof window !== "undefined") {
|
|
5095
5402
|
window.history.back();
|
|
@@ -5116,10 +5423,10 @@ function AuthForm({
|
|
|
5116
5423
|
view: viewProp
|
|
5117
5424
|
}) {
|
|
5118
5425
|
const { auth, path: pathConfig } = useConfig();
|
|
5119
|
-
const router =
|
|
5426
|
+
const router = useRouter14();
|
|
5120
5427
|
const auths = auth.authentication;
|
|
5121
5428
|
const view = viewProp || getViewByPath(pathConfig.auth, pathname) || "SIGN_IN";
|
|
5122
|
-
|
|
5429
|
+
useEffect14(() => {
|
|
5123
5430
|
let isInvalidView = false;
|
|
5124
5431
|
if (view === "MAGIC_LINK" && (!auths.magicLink || !auths.password && !auths.emailOtp)) {
|
|
5125
5432
|
isInvalidView = true;
|
|
@@ -5151,10 +5458,10 @@ function AuthForm({
|
|
|
5151
5458
|
pathConfig.auth.SIGN_IN,
|
|
5152
5459
|
router
|
|
5153
5460
|
]);
|
|
5154
|
-
if (view === "SIGN_OUT") return /* @__PURE__ */
|
|
5155
|
-
if (view === "CALLBACK") return /* @__PURE__ */
|
|
5461
|
+
if (view === "SIGN_OUT") return /* @__PURE__ */ jsx48(SignOut, {});
|
|
5462
|
+
if (view === "CALLBACK") return /* @__PURE__ */ jsx48(AuthCallback, { redirectTo });
|
|
5156
5463
|
if (view === "SIGN_IN") {
|
|
5157
|
-
return auths.password ? /* @__PURE__ */
|
|
5464
|
+
return auths.password ? /* @__PURE__ */ jsx48(
|
|
5158
5465
|
SignInForm,
|
|
5159
5466
|
{
|
|
5160
5467
|
className,
|
|
@@ -5163,7 +5470,7 @@ function AuthForm({
|
|
|
5163
5470
|
redirectTo,
|
|
5164
5471
|
setIsSubmitting
|
|
5165
5472
|
}
|
|
5166
|
-
) : auths.magicLink ? /* @__PURE__ */
|
|
5473
|
+
) : auths.magicLink ? /* @__PURE__ */ jsx48(
|
|
5167
5474
|
MagicLinkForm,
|
|
5168
5475
|
{
|
|
5169
5476
|
className,
|
|
@@ -5171,7 +5478,7 @@ function AuthForm({
|
|
|
5171
5478
|
isSubmitting,
|
|
5172
5479
|
setIsSubmitting
|
|
5173
5480
|
}
|
|
5174
|
-
) : auths.emailOtp ? /* @__PURE__ */
|
|
5481
|
+
) : auths.emailOtp ? /* @__PURE__ */ jsx48(
|
|
5175
5482
|
EmailOTPForm,
|
|
5176
5483
|
{
|
|
5177
5484
|
className,
|
|
@@ -5183,7 +5490,7 @@ function AuthForm({
|
|
|
5183
5490
|
) : null;
|
|
5184
5491
|
}
|
|
5185
5492
|
if (view === "TWO_FACTOR") {
|
|
5186
|
-
return /* @__PURE__ */
|
|
5493
|
+
return /* @__PURE__ */ jsx48(
|
|
5187
5494
|
TwoFactorForm,
|
|
5188
5495
|
{
|
|
5189
5496
|
className,
|
|
@@ -5196,7 +5503,7 @@ function AuthForm({
|
|
|
5196
5503
|
);
|
|
5197
5504
|
}
|
|
5198
5505
|
if (view === "RECOVER_ACCOUNT") {
|
|
5199
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ jsx48(
|
|
5200
5507
|
RecoverAccountForm,
|
|
5201
5508
|
{
|
|
5202
5509
|
className,
|
|
@@ -5208,7 +5515,7 @@ function AuthForm({
|
|
|
5208
5515
|
);
|
|
5209
5516
|
}
|
|
5210
5517
|
if (view === "MAGIC_LINK") {
|
|
5211
|
-
return /* @__PURE__ */
|
|
5518
|
+
return /* @__PURE__ */ jsx48(
|
|
5212
5519
|
MagicLinkForm,
|
|
5213
5520
|
{
|
|
5214
5521
|
className,
|
|
@@ -5219,7 +5526,7 @@ function AuthForm({
|
|
|
5219
5526
|
);
|
|
5220
5527
|
}
|
|
5221
5528
|
if (view === "EMAIL_OTP") {
|
|
5222
|
-
return /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ jsx48(
|
|
5223
5530
|
EmailOTPForm,
|
|
5224
5531
|
{
|
|
5225
5532
|
className,
|
|
@@ -5231,7 +5538,7 @@ function AuthForm({
|
|
|
5231
5538
|
);
|
|
5232
5539
|
}
|
|
5233
5540
|
if (view === "FORGOT_PASSWORD") {
|
|
5234
|
-
return /* @__PURE__ */
|
|
5541
|
+
return /* @__PURE__ */ jsx48(
|
|
5235
5542
|
ForgotPasswordForm,
|
|
5236
5543
|
{
|
|
5237
5544
|
className,
|
|
@@ -5242,7 +5549,7 @@ function AuthForm({
|
|
|
5242
5549
|
);
|
|
5243
5550
|
}
|
|
5244
5551
|
if (view === "RESET_PASSWORD") {
|
|
5245
|
-
return /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsx48(
|
|
5246
5553
|
ResetPasswordForm,
|
|
5247
5554
|
{
|
|
5248
5555
|
className,
|
|
@@ -5253,7 +5560,7 @@ function AuthForm({
|
|
|
5253
5560
|
);
|
|
5254
5561
|
}
|
|
5255
5562
|
if (view === "SIGN_UP") {
|
|
5256
|
-
return auth.enableSignup ? /* @__PURE__ */
|
|
5563
|
+
return auth.enableSignup ? /* @__PURE__ */ jsx48(
|
|
5257
5564
|
SignUpForm,
|
|
5258
5565
|
{
|
|
5259
5566
|
className,
|
|
@@ -5270,73 +5577,73 @@ function AuthForm({
|
|
|
5270
5577
|
// src/ui/layouts/auth.tsx
|
|
5271
5578
|
import Link6 from "next/link";
|
|
5272
5579
|
import { usePathname } from "next/navigation";
|
|
5273
|
-
import { useTranslations as
|
|
5274
|
-
import { LayoutBlank } from "
|
|
5580
|
+
import { useTranslations as useTranslations45 } from "next-intl";
|
|
5581
|
+
import { LayoutBlank } from "pelatform-ui/components";
|
|
5275
5582
|
|
|
5276
5583
|
// src/ui/shared/logo.tsx
|
|
5277
5584
|
import Link4 from "next/link";
|
|
5278
|
-
import { Logo } from "
|
|
5279
|
-
import { cn as
|
|
5280
|
-
import { jsx as
|
|
5585
|
+
import { Logo } from "pelatform-ui/components";
|
|
5586
|
+
import { cn as cn40 } from "@pelatform/utils";
|
|
5587
|
+
import { jsx as jsx49, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5281
5588
|
function LogoWithName({ className }) {
|
|
5282
5589
|
const { app } = useConfig();
|
|
5283
|
-
return /* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5285
|
-
/* @__PURE__ */
|
|
5590
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn40("flex items-center gap-2", className), children: [
|
|
5591
|
+
/* @__PURE__ */ jsx49(Logo, { className: "size-7" }),
|
|
5592
|
+
/* @__PURE__ */ jsx49("span", { className: "font-semibold text-lg text-mono", children: app.name })
|
|
5286
5593
|
] });
|
|
5287
5594
|
}
|
|
5288
5595
|
function LogoWithHref({ className, href = "/" }) {
|
|
5289
5596
|
const { app } = useConfig();
|
|
5290
|
-
return /* @__PURE__ */
|
|
5291
|
-
/* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
5597
|
+
return /* @__PURE__ */ jsxs42(Link4, { href, className: cn40("flex items-center gap-2", className), children: [
|
|
5598
|
+
/* @__PURE__ */ jsx49(Logo, { className: "size-7" }),
|
|
5599
|
+
/* @__PURE__ */ jsx49("span", { className: "font-semibold text-lg text-mono", children: app.name })
|
|
5293
5600
|
] });
|
|
5294
5601
|
}
|
|
5295
5602
|
|
|
5296
5603
|
// src/ui/shared/signed-in-hint.tsx
|
|
5297
5604
|
import Link5 from "next/link";
|
|
5298
|
-
import { useTranslations as
|
|
5299
|
-
import { Button as
|
|
5300
|
-
import { jsx as
|
|
5605
|
+
import { useTranslations as useTranslations42 } from "next-intl";
|
|
5606
|
+
import { Button as Button32 } from "pelatform-ui/default";
|
|
5607
|
+
import { jsx as jsx50, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5301
5608
|
function SignedInHint({ linkHref = "/signin" }) {
|
|
5302
|
-
const t =
|
|
5609
|
+
const t = useTranslations42("customs.common.signed");
|
|
5303
5610
|
const { isPending, user } = useSession();
|
|
5304
|
-
return /* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5611
|
+
return /* @__PURE__ */ jsxs43("div", { className: "fixed start-0 bottom-0 z-40 m-5 flex flex-col gap-2", children: [
|
|
5612
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
|
|
5306
5613
|
t("text"),
|
|
5307
5614
|
" ",
|
|
5308
|
-
isPending || !user ? /* @__PURE__ */
|
|
5615
|
+
isPending || !user ? /* @__PURE__ */ jsx50("span", { className: "h-3 w-32 animate-pulse rounded-md border bg-muted-foreground" }) : /* @__PURE__ */ jsx50("b", { className: "text-foreground", children: user.email })
|
|
5309
5616
|
] }),
|
|
5310
|
-
/* @__PURE__ */
|
|
5617
|
+
/* @__PURE__ */ jsx50(Button32, { variant: "mono", className: "h-8 w-fit rounded-lg px-3 text-xs shadow-sm", children: /* @__PURE__ */ jsx50(Link5, { href: linkHref, children: t("button") }) })
|
|
5311
5618
|
] });
|
|
5312
5619
|
}
|
|
5313
5620
|
|
|
5314
5621
|
// src/ui/layouts/loader.tsx
|
|
5315
|
-
import { useTranslations as
|
|
5316
|
-
import { ScreenLoader } from "
|
|
5317
|
-
import { jsx as
|
|
5622
|
+
import { useTranslations as useTranslations43 } from "next-intl";
|
|
5623
|
+
import { ScreenLoader } from "pelatform-ui/components";
|
|
5624
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
5318
5625
|
function LayoutLoader({ children }) {
|
|
5319
|
-
const t =
|
|
5626
|
+
const t = useTranslations43();
|
|
5320
5627
|
const { isPending } = useSession();
|
|
5321
5628
|
if (isPending) {
|
|
5322
|
-
return /* @__PURE__ */
|
|
5629
|
+
return /* @__PURE__ */ jsx51(ScreenLoader, { loadingText: t("systems.common.status.loading") });
|
|
5323
5630
|
}
|
|
5324
5631
|
return children;
|
|
5325
5632
|
}
|
|
5326
5633
|
|
|
5327
5634
|
// src/ui/layouts/toolbar.tsx
|
|
5328
5635
|
import { Suspense } from "react";
|
|
5329
|
-
import { ModeSwitcher } from "
|
|
5330
|
-
import { cn as
|
|
5636
|
+
import { ModeSwitcher } from "pelatform-ui/components";
|
|
5637
|
+
import { cn as cn41 } from "@pelatform/utils";
|
|
5331
5638
|
|
|
5332
5639
|
// src/ui/shared/language-switcher.tsx
|
|
5333
5640
|
import Image from "next/image";
|
|
5334
|
-
import { useRouter as
|
|
5335
|
-
import { useLocale as useLocale3, useTranslations as
|
|
5641
|
+
import { useRouter as useRouter15 } from "next/navigation";
|
|
5642
|
+
import { useLocale as useLocale3, useTranslations as useTranslations44 } from "next-intl";
|
|
5336
5643
|
import {
|
|
5337
5644
|
LanguageSwitcher as LanguageSwitcherBase
|
|
5338
|
-
} from "
|
|
5339
|
-
import { jsx as
|
|
5645
|
+
} from "pelatform-ui/components";
|
|
5646
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
5340
5647
|
function LanguageSwitcher({
|
|
5341
5648
|
className,
|
|
5342
5649
|
type,
|
|
@@ -5346,8 +5653,8 @@ function LanguageSwitcher({
|
|
|
5346
5653
|
showFlags
|
|
5347
5654
|
}) {
|
|
5348
5655
|
const { i18n } = useConfig();
|
|
5349
|
-
const router =
|
|
5350
|
-
const t =
|
|
5656
|
+
const router = useRouter15();
|
|
5657
|
+
const t = useTranslations44();
|
|
5351
5658
|
const currentLocale = useLocale3();
|
|
5352
5659
|
const availableLocales = (() => {
|
|
5353
5660
|
if (!i18n.enabled) {
|
|
@@ -5371,7 +5678,7 @@ function LanguageSwitcher({
|
|
|
5371
5678
|
document.cookie = `${i18n.localeCookieName}=${newLocale}; max-age=${60 * 60 * 24 * 365}; path=/`;
|
|
5372
5679
|
router.refresh();
|
|
5373
5680
|
}
|
|
5374
|
-
return /* @__PURE__ */
|
|
5681
|
+
return /* @__PURE__ */ jsx52(
|
|
5375
5682
|
LanguageSwitcherBase,
|
|
5376
5683
|
{
|
|
5377
5684
|
className,
|
|
@@ -5392,33 +5699,33 @@ function LanguageSwitcher({
|
|
|
5392
5699
|
}
|
|
5393
5700
|
|
|
5394
5701
|
// src/ui/layouts/toolbar.tsx
|
|
5395
|
-
import { jsx as
|
|
5702
|
+
import { jsx as jsx53, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5396
5703
|
var DEFAULT_SHOW = ["darkmode"];
|
|
5397
5704
|
function Toolbar(props) {
|
|
5398
|
-
return /* @__PURE__ */
|
|
5705
|
+
return /* @__PURE__ */ jsx53(Suspense, { fallback: null, children: /* @__PURE__ */ jsx53("div", { className: cn41("fixed end-0 bottom-0 z-40 m-5", props.className), children: /* @__PURE__ */ jsx53(ToolbarRSC, { ...props }) }) });
|
|
5399
5706
|
}
|
|
5400
5707
|
function ToolbarRSC({ show = DEFAULT_SHOW }) {
|
|
5401
|
-
return /* @__PURE__ */
|
|
5402
|
-
show.includes("darkmode") && /* @__PURE__ */
|
|
5403
|
-
show.includes("help") && /* @__PURE__ */
|
|
5404
|
-
show.includes("language") && /* @__PURE__ */
|
|
5405
|
-
show.includes("onboarding") && /* @__PURE__ */
|
|
5708
|
+
return /* @__PURE__ */ jsx53("div", { className: "flex flex-col items-center gap-2.5", children: /* @__PURE__ */ jsxs44("div", { className: "shrink-0", children: [
|
|
5709
|
+
show.includes("darkmode") && /* @__PURE__ */ jsx53(ModeSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5710
|
+
show.includes("help") && /* @__PURE__ */ jsx53("div", { className: "hidden" }),
|
|
5711
|
+
show.includes("language") && /* @__PURE__ */ jsx53(LanguageSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5712
|
+
show.includes("onboarding") && /* @__PURE__ */ jsx53("div", { className: "hidden" })
|
|
5406
5713
|
] }) });
|
|
5407
5714
|
}
|
|
5408
5715
|
|
|
5409
5716
|
// src/ui/layouts/auth.tsx
|
|
5410
|
-
import { jsx as
|
|
5717
|
+
import { jsx as jsx54, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5411
5718
|
function AuthLayout({
|
|
5412
5719
|
children,
|
|
5413
|
-
logo = /* @__PURE__ */
|
|
5720
|
+
logo = /* @__PURE__ */ jsx54(LogoWithName, {})
|
|
5414
5721
|
}) {
|
|
5415
5722
|
const { app, path } = useConfig();
|
|
5416
5723
|
const pathname = usePathname();
|
|
5417
|
-
const t =
|
|
5418
|
-
const footer = /* @__PURE__ */
|
|
5724
|
+
const t = useTranslations45();
|
|
5725
|
+
const footer = /* @__PURE__ */ jsxs45("p", { className: "px-20 py-4 text-center font-medium text-muted-foreground text-xs md:px-0", children: [
|
|
5419
5726
|
t("customs.common.agree"),
|
|
5420
5727
|
" ",
|
|
5421
|
-
/* @__PURE__ */
|
|
5728
|
+
/* @__PURE__ */ jsx54(
|
|
5422
5729
|
Link6,
|
|
5423
5730
|
{
|
|
5424
5731
|
href: path.main.TERMS,
|
|
@@ -5428,7 +5735,7 @@ function AuthLayout({
|
|
|
5428
5735
|
}
|
|
5429
5736
|
),
|
|
5430
5737
|
" ",
|
|
5431
|
-
/* @__PURE__ */
|
|
5738
|
+
/* @__PURE__ */ jsx54(
|
|
5432
5739
|
Link6,
|
|
5433
5740
|
{
|
|
5434
5741
|
href: path.main.PRIVACY,
|
|
@@ -5438,9 +5745,9 @@ function AuthLayout({
|
|
|
5438
5745
|
}
|
|
5439
5746
|
)
|
|
5440
5747
|
] });
|
|
5441
|
-
return /* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5748
|
+
return /* @__PURE__ */ jsxs45(LayoutLoader, { children: [
|
|
5749
|
+
/* @__PURE__ */ jsx54(Toolbar, { show: ["language"], className: "top-0!" }),
|
|
5750
|
+
/* @__PURE__ */ jsx54(
|
|
5444
5751
|
LayoutBlank,
|
|
5445
5752
|
{
|
|
5446
5753
|
className: "[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0",
|
|
@@ -5450,17 +5757,17 @@ function AuthLayout({
|
|
|
5450
5757
|
children
|
|
5451
5758
|
}
|
|
5452
5759
|
),
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
pathname === path.auth.ACCEPT_INVITATION && /* @__PURE__ */
|
|
5760
|
+
/* @__PURE__ */ jsx54(Toolbar, { show: ["darkmode"] }),
|
|
5761
|
+
pathname === path.auth.ACCEPT_INVITATION && /* @__PURE__ */ jsx54(SignedInHint, { linkHref: path.auth.SIGN_IN })
|
|
5455
5762
|
] });
|
|
5456
5763
|
}
|
|
5457
5764
|
|
|
5458
5765
|
// src/ui/layouts/header.tsx
|
|
5459
|
-
import { useEffect as
|
|
5766
|
+
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
5460
5767
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
5461
5768
|
import { Menu, PanelRight } from "lucide-react";
|
|
5462
5769
|
import {
|
|
5463
|
-
Button as
|
|
5770
|
+
Button as Button33,
|
|
5464
5771
|
Sheet,
|
|
5465
5772
|
SheetBody,
|
|
5466
5773
|
SheetContent,
|
|
@@ -5468,15 +5775,15 @@ import {
|
|
|
5468
5775
|
SheetHeader,
|
|
5469
5776
|
SheetTitle,
|
|
5470
5777
|
SheetTrigger
|
|
5471
|
-
} from "
|
|
5778
|
+
} from "pelatform-ui/default";
|
|
5472
5779
|
|
|
5473
5780
|
// src/ui/shared/user-menu.tsx
|
|
5474
|
-
import { Fragment as Fragment17, useCallback as useCallback3, useEffect as
|
|
5781
|
+
import { Fragment as Fragment17, useCallback as useCallback3, useEffect as useEffect15, useState as useState18 } from "react";
|
|
5475
5782
|
import Link7 from "next/link";
|
|
5476
|
-
import { useRouter as
|
|
5783
|
+
import { useRouter as useRouter16 } from "next/navigation";
|
|
5477
5784
|
import { LogOut, PlusCircleIcon, Settings, Shield, UserStar } from "lucide-react";
|
|
5478
|
-
import { useTranslations as
|
|
5479
|
-
import { ModeSwitcher as ModeSwitcher2, UserAvatar as UserAvatar2 } from "
|
|
5785
|
+
import { useTranslations as useTranslations46 } from "next-intl";
|
|
5786
|
+
import { ModeSwitcher as ModeSwitcher2, UserAvatar as UserAvatar2 } from "pelatform-ui/components";
|
|
5480
5787
|
import {
|
|
5481
5788
|
Badge as Badge2,
|
|
5482
5789
|
DropdownMenu as DropdownMenu3,
|
|
@@ -5484,19 +5791,19 @@ import {
|
|
|
5484
5791
|
DropdownMenuItem as DropdownMenuItem3,
|
|
5485
5792
|
DropdownMenuSeparator,
|
|
5486
5793
|
DropdownMenuTrigger as DropdownMenuTrigger3,
|
|
5487
|
-
Skeleton as
|
|
5488
|
-
} from "
|
|
5489
|
-
import { Fragment as Fragment18, jsx as
|
|
5794
|
+
Skeleton as Skeleton10
|
|
5795
|
+
} from "pelatform-ui/default";
|
|
5796
|
+
import { Fragment as Fragment18, jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5490
5797
|
function UserMenu({ hiddenSwitcher = false }) {
|
|
5491
5798
|
const { features, path } = useConfig();
|
|
5492
|
-
const router =
|
|
5493
|
-
const t =
|
|
5799
|
+
const router = useRouter16();
|
|
5800
|
+
const t = useTranslations46();
|
|
5494
5801
|
const { isPending: sessionPending, user } = useSession();
|
|
5495
5802
|
const { setActiveSessionAsync } = useSetActiveSession();
|
|
5496
5803
|
const { data: deviceSessions, isPending: deviceSessionsPending } = useListDeviceSessions({
|
|
5497
5804
|
enabled: features.multiSession
|
|
5498
5805
|
});
|
|
5499
|
-
const [activeSessionPending, setActiveSessionPending] =
|
|
5806
|
+
const [activeSessionPending, setActiveSessionPending] = useState18(false);
|
|
5500
5807
|
const isPending = sessionPending || activeSessionPending;
|
|
5501
5808
|
const switchAccount = useCallback3(
|
|
5502
5809
|
async (sessionToken) => {
|
|
@@ -5512,7 +5819,7 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5512
5819
|
},
|
|
5513
5820
|
[router, setActiveSessionAsync]
|
|
5514
5821
|
);
|
|
5515
|
-
|
|
5822
|
+
useEffect15(() => {
|
|
5516
5823
|
if (!features.multiSession) return;
|
|
5517
5824
|
setActiveSessionPending(false);
|
|
5518
5825
|
}, [features.multiSession, user?.id]);
|
|
@@ -5523,33 +5830,33 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5523
5830
|
const userName = getName(user);
|
|
5524
5831
|
const userAvatar = user?.image || void 0;
|
|
5525
5832
|
const userRole = user?.role || "user";
|
|
5526
|
-
return /* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5531
|
-
/* @__PURE__ */
|
|
5532
|
-
/* @__PURE__ */
|
|
5533
|
-
/* @__PURE__ */
|
|
5534
|
-
/* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsxs46(DropdownMenu3, { children: [
|
|
5834
|
+
/* @__PURE__ */ jsx55(DropdownMenuTrigger3, { className: "focus:outline-none focus:ring-0", children: isPending ? /* @__PURE__ */ jsx55(Skeleton10, { className: "size-8 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx55(UserAvatar2, { className: "size-8", indicator: true, src: userAvatar, alt: userName }) }),
|
|
5835
|
+
/* @__PURE__ */ jsxs46(DropdownMenuContent3, { className: "w-56", side: "bottom", align: "end", sideOffset: 11, children: [
|
|
5836
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
5837
|
+
/* @__PURE__ */ jsx55(UserAvatar2, { src: userAvatar, alt: userName }),
|
|
5838
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5839
|
+
/* @__PURE__ */ jsx55("span", { className: "truncate font-semibold text-foreground text-sm", children: userName }),
|
|
5840
|
+
/* @__PURE__ */ jsx55("span", { className: "block w-full truncate text-muted-foreground text-xs", children: userEmail }),
|
|
5841
|
+
/* @__PURE__ */ jsx55(Badge2, { variant: "success", appearance: "outline", size: "sm", className: "mt-1", children: userRole.toUpperCase() })
|
|
5535
5842
|
] })
|
|
5536
5843
|
] }),
|
|
5537
|
-
/* @__PURE__ */
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5540
|
-
/* @__PURE__ */
|
|
5844
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
5845
|
+
/* @__PURE__ */ jsx55(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs46(Link7, { href: path.account.SETTINGS, children: [
|
|
5846
|
+
/* @__PURE__ */ jsx55(Settings, {}),
|
|
5847
|
+
/* @__PURE__ */ jsx55("span", { children: t("systems.navigation.preferences") })
|
|
5541
5848
|
] }) }),
|
|
5542
|
-
/* @__PURE__ */
|
|
5543
|
-
/* @__PURE__ */
|
|
5544
|
-
/* @__PURE__ */
|
|
5849
|
+
/* @__PURE__ */ jsx55(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs46(Link7, { href: path.account.SECURITY, children: [
|
|
5850
|
+
/* @__PURE__ */ jsx55(Shield, {}),
|
|
5851
|
+
/* @__PURE__ */ jsx55("span", { children: t("systems.navigation.security") })
|
|
5545
5852
|
] }) }),
|
|
5546
|
-
"admin" === userRole && /* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
5853
|
+
"admin" === userRole && /* @__PURE__ */ jsx55(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs46(Link7, { href: path.admin.OVERVIEW, children: [
|
|
5854
|
+
/* @__PURE__ */ jsx55(UserStar, {}),
|
|
5855
|
+
/* @__PURE__ */ jsx55("span", { children: "Admin Dashboard" })
|
|
5549
5856
|
] }) }),
|
|
5550
|
-
!hiddenSwitcher && /* @__PURE__ */
|
|
5551
|
-
/* @__PURE__ */
|
|
5552
|
-
/* @__PURE__ */
|
|
5857
|
+
!hiddenSwitcher && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
5858
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
5859
|
+
/* @__PURE__ */ jsx55(
|
|
5553
5860
|
ModeSwitcher2,
|
|
5554
5861
|
{
|
|
5555
5862
|
type: "sub-dropdown",
|
|
@@ -5560,31 +5867,31 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5560
5867
|
}
|
|
5561
5868
|
}
|
|
5562
5869
|
),
|
|
5563
|
-
/* @__PURE__ */
|
|
5870
|
+
/* @__PURE__ */ jsx55(LanguageSwitcher, { type: "sub-dropdown" })
|
|
5564
5871
|
] }),
|
|
5565
|
-
/* @__PURE__ */
|
|
5566
|
-
/* @__PURE__ */
|
|
5567
|
-
/* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5872
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
5873
|
+
/* @__PURE__ */ jsx55(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs46(Link7, { href: path.auth.SIGN_OUT, children: [
|
|
5874
|
+
/* @__PURE__ */ jsx55(LogOut, {}),
|
|
5875
|
+
/* @__PURE__ */ jsx55("span", { children: t("systems.navigation.logout") })
|
|
5569
5876
|
] }) }),
|
|
5570
|
-
user && features.multiSession && /* @__PURE__ */
|
|
5571
|
-
/* @__PURE__ */
|
|
5572
|
-
!deviceSessions && deviceSessionsPending && /* @__PURE__ */
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
/* @__PURE__ */
|
|
5877
|
+
user && features.multiSession && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
5878
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
5879
|
+
!deviceSessions && deviceSessionsPending && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
5880
|
+
/* @__PURE__ */ jsx55(DropdownMenuItem3, { disabled: true, children: /* @__PURE__ */ jsx55(UserView, { isPending: true }) }),
|
|
5881
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {})
|
|
5575
5882
|
] }),
|
|
5576
|
-
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5579
|
-
/* @__PURE__ */
|
|
5580
|
-
/* @__PURE__ */
|
|
5581
|
-
/* @__PURE__ */
|
|
5883
|
+
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */ jsxs46(Fragment17, { children: [
|
|
5884
|
+
/* @__PURE__ */ jsxs46(DropdownMenuItem3, { onClick: () => switchAccount(session.token), children: [
|
|
5885
|
+
/* @__PURE__ */ jsx55(UserAvatar2, { src: multiUser?.image || void 0, alt: getName(multiUser) }),
|
|
5886
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5887
|
+
/* @__PURE__ */ jsx55("span", { className: "truncate font-semibold text-foreground text-xs", children: getName(multiUser) }),
|
|
5888
|
+
/* @__PURE__ */ jsx55("span", { className: "block w-full truncate text-muted-foreground text-xs", children: multiUser?.email })
|
|
5582
5889
|
] })
|
|
5583
5890
|
] }),
|
|
5584
|
-
/* @__PURE__ */
|
|
5891
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {})
|
|
5585
5892
|
] }, session.id)),
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5893
|
+
/* @__PURE__ */ jsx55(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs46(Link7, { href: path.auth.SIGN_IN, children: [
|
|
5894
|
+
/* @__PURE__ */ jsx55(PlusCircleIcon, {}),
|
|
5588
5895
|
t("systems.ADD_ACCOUNT")
|
|
5589
5896
|
] }) })
|
|
5590
5897
|
] })
|
|
@@ -5593,48 +5900,48 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5593
5900
|
}
|
|
5594
5901
|
|
|
5595
5902
|
// src/ui/layouts/header.tsx
|
|
5596
|
-
import { jsx as
|
|
5903
|
+
import { jsx as jsx56, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5597
5904
|
function Header({ children }) {
|
|
5598
|
-
return /* @__PURE__ */
|
|
5905
|
+
return /* @__PURE__ */ jsx56("header", { className: "fixed start-0 end-0 top-0 z-10 flex h-(--header-height-mobile) shrink-0 items-stretch border-border border-b bg-background/95 pe-(--removed-body-scroll-bar-size,0px) backdrop-blur-sm supports-backdrop-filter:bg-background/60 lg:h-(--header-height)", children: /* @__PURE__ */ jsx56("div", { className: "@container flex grow items-stretch justify-between gap-2.5 pe-5", children }) });
|
|
5599
5906
|
}
|
|
5600
5907
|
function HeaderLeft() {
|
|
5601
5908
|
const { logoHeader, sidebarToggle } = useLayout();
|
|
5602
|
-
return /* @__PURE__ */
|
|
5909
|
+
return /* @__PURE__ */ jsx56("div", { className: "flex items-center gap-2 px-5 lg:w-(--sidebar-width)", children: /* @__PURE__ */ jsxs47("div", { className: "flex w-full items-center justify-between", children: [
|
|
5603
5910
|
logoHeader,
|
|
5604
|
-
/* @__PURE__ */
|
|
5605
|
-
|
|
5911
|
+
/* @__PURE__ */ jsx56(
|
|
5912
|
+
Button33,
|
|
5606
5913
|
{
|
|
5607
5914
|
mode: "icon",
|
|
5608
5915
|
variant: "ghost",
|
|
5609
5916
|
onClick: sidebarToggle,
|
|
5610
5917
|
className: "hidden text-muted-foreground hover:text-foreground lg:inline-flex",
|
|
5611
|
-
children: /* @__PURE__ */
|
|
5918
|
+
children: /* @__PURE__ */ jsx56(PanelRight, { className: "-rotate-180 in-data-[sidebar-open=false]:rotate-0 opacity-100" })
|
|
5612
5919
|
}
|
|
5613
5920
|
)
|
|
5614
5921
|
] }) });
|
|
5615
5922
|
}
|
|
5616
5923
|
function HeaderRight({ sidebar, button }) {
|
|
5617
5924
|
const { isMobile } = useLayout();
|
|
5618
|
-
return /* @__PURE__ */
|
|
5925
|
+
return /* @__PURE__ */ jsxs47("nav", { className: "flex items-center gap-1.5 lg:gap-2.5", children: [
|
|
5619
5926
|
button,
|
|
5620
5927
|
isMobile && sidebar,
|
|
5621
|
-
/* @__PURE__ */
|
|
5928
|
+
/* @__PURE__ */ jsx56(UserMenu, {})
|
|
5622
5929
|
] });
|
|
5623
5930
|
}
|
|
5624
5931
|
function HeaderSidebarMobile({ children }) {
|
|
5625
5932
|
const pathname = usePathname2();
|
|
5626
|
-
const [isSheetOpen, setIsSheetOpen] =
|
|
5627
|
-
|
|
5933
|
+
const [isSheetOpen, setIsSheetOpen] = useState19(false);
|
|
5934
|
+
useEffect16(() => {
|
|
5628
5935
|
setIsSheetOpen(false);
|
|
5629
5936
|
}, [pathname]);
|
|
5630
|
-
return /* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5633
|
-
/* @__PURE__ */
|
|
5634
|
-
/* @__PURE__ */
|
|
5635
|
-
/* @__PURE__ */
|
|
5937
|
+
return /* @__PURE__ */ jsxs47(Sheet, { open: isSheetOpen, onOpenChange: setIsSheetOpen, children: [
|
|
5938
|
+
/* @__PURE__ */ jsx56(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(Button33, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx56(Menu, { className: "size-4" }) }) }),
|
|
5939
|
+
/* @__PURE__ */ jsxs47(SheetContent, { className: "w-(--sidebar-width) gap-0 p-0", side: "left", close: false, children: [
|
|
5940
|
+
/* @__PURE__ */ jsxs47(SheetHeader, { className: "hidden space-y-0 p-0", children: [
|
|
5941
|
+
/* @__PURE__ */ jsx56(SheetTitle, { className: "sr-only", children: "Navigation menu" }),
|
|
5942
|
+
/* @__PURE__ */ jsx56(SheetDescription, { className: "sr-only", children: "NavigatSheet Description" })
|
|
5636
5943
|
] }),
|
|
5637
|
-
/* @__PURE__ */
|
|
5944
|
+
/* @__PURE__ */ jsx56(SheetBody, { className: "flex grow flex-col p-0", children })
|
|
5638
5945
|
] })
|
|
5639
5946
|
] });
|
|
5640
5947
|
}
|
|
@@ -5643,8 +5950,8 @@ function HeaderSidebarMobile({ children }) {
|
|
|
5643
5950
|
import { useCallback as useCallback4, useMemo as useMemo5 } from "react";
|
|
5644
5951
|
import Link8 from "next/link";
|
|
5645
5952
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
5646
|
-
import { useTranslations as
|
|
5647
|
-
import { BackLink } from "
|
|
5953
|
+
import { useTranslations as useTranslations47 } from "next-intl";
|
|
5954
|
+
import { BackLink } from "pelatform-ui/components";
|
|
5648
5955
|
import {
|
|
5649
5956
|
AccordionMenu,
|
|
5650
5957
|
AccordionMenuGroup,
|
|
@@ -5656,27 +5963,27 @@ import {
|
|
|
5656
5963
|
AccordionMenuSubTrigger,
|
|
5657
5964
|
Badge as Badge3,
|
|
5658
5965
|
ScrollArea
|
|
5659
|
-
} from "
|
|
5660
|
-
import { Fragment as Fragment19, jsx as
|
|
5966
|
+
} from "pelatform-ui/default";
|
|
5967
|
+
import { Fragment as Fragment19, jsx as jsx57, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5661
5968
|
function Sidebar({ children }) {
|
|
5662
5969
|
const { isMobile } = useLayout();
|
|
5663
5970
|
if (isMobile) {
|
|
5664
5971
|
return null;
|
|
5665
5972
|
}
|
|
5666
|
-
return /* @__PURE__ */
|
|
5973
|
+
return /* @__PURE__ */ jsxs48("aside", { className: "in-data-[sidebar-open=false]:-start-full fixed start-0 top-(--header-height) bottom-0 flex w-(--sidebar-width) shrink-0 flex-col items-stretch border-border border-e transition-all duration-300", children: [
|
|
5667
5974
|
children,
|
|
5668
|
-
/* @__PURE__ */
|
|
5975
|
+
/* @__PURE__ */ jsx57("div", {})
|
|
5669
5976
|
] });
|
|
5670
5977
|
}
|
|
5671
5978
|
function SidebarHeaderBack({
|
|
5672
5979
|
linkHref = "/",
|
|
5673
5980
|
admin = false
|
|
5674
5981
|
}) {
|
|
5675
|
-
const t =
|
|
5676
|
-
return /* @__PURE__ */
|
|
5982
|
+
const t = useTranslations47();
|
|
5983
|
+
return /* @__PURE__ */ jsx57("div", { className: "flex h-14 shrink-0 items-center gap-2 border-border border-b px-2.5 lg:h-15", children: /* @__PURE__ */ jsx57(BackLink, { Link: Link8, href: linkHref, children: admin ? t("systems.common.actions.back") : t("systems.navigation.settings") }) });
|
|
5677
5984
|
}
|
|
5678
5985
|
function SidebarContent({ children }) {
|
|
5679
|
-
return /* @__PURE__ */
|
|
5986
|
+
return /* @__PURE__ */ jsx57(ScrollArea, { className: "mt-2 mb-2.5 h-[calc(100vh-5.5rem)] grow lg:mt-4 lg:mb-7.5 lg:h-[calc(100vh-4rem)]", children });
|
|
5680
5987
|
}
|
|
5681
5988
|
function SidebarContentMenu({
|
|
5682
5989
|
menu,
|
|
@@ -5718,7 +6025,7 @@ function SidebarContentMenu({
|
|
|
5718
6025
|
[activePath, normalize]
|
|
5719
6026
|
);
|
|
5720
6027
|
if (type === "toggle") {
|
|
5721
|
-
return /* @__PURE__ */
|
|
6028
|
+
return /* @__PURE__ */ jsx57(
|
|
5722
6029
|
AccordionMenu,
|
|
5723
6030
|
{
|
|
5724
6031
|
type: "single",
|
|
@@ -5732,16 +6039,16 @@ function SidebarContentMenu({
|
|
|
5732
6039
|
subTrigger: "text-xs font-normal text-muted-foreground hover:bg-transparent",
|
|
5733
6040
|
subContent: "ps-0"
|
|
5734
6041
|
},
|
|
5735
|
-
children: menu.map((item, index) => /* @__PURE__ */
|
|
5736
|
-
/* @__PURE__ */
|
|
5737
|
-
/* @__PURE__ */
|
|
5738
|
-
/* @__PURE__ */
|
|
6042
|
+
children: menu.map((item, index) => /* @__PURE__ */ jsxs48(AccordionMenuSub, { value: item.title || "menu", children: [
|
|
6043
|
+
/* @__PURE__ */ jsxs48(AccordionMenuSubTrigger, { value: "menu-trigger", children: [
|
|
6044
|
+
/* @__PURE__ */ jsx57("span", { children: item.title }),
|
|
6045
|
+
/* @__PURE__ */ jsx57(AccordionMenuIndicator, {})
|
|
5739
6046
|
] }),
|
|
5740
|
-
/* @__PURE__ */
|
|
5741
|
-
const content = /* @__PURE__ */
|
|
5742
|
-
child.icon && /* @__PURE__ */
|
|
5743
|
-
/* @__PURE__ */
|
|
5744
|
-
child.badge && /* @__PURE__ */
|
|
6047
|
+
/* @__PURE__ */ jsx57(AccordionMenuSubContent, { type: "single", collapsible: true, parentValue: "menu-trigger", children: item.children?.map((child, idx) => {
|
|
6048
|
+
const content = /* @__PURE__ */ jsxs48(Fragment19, { children: [
|
|
6049
|
+
child.icon && /* @__PURE__ */ jsx57(child.icon, {}),
|
|
6050
|
+
/* @__PURE__ */ jsx57("span", { children: child.title }),
|
|
6051
|
+
child.badge && /* @__PURE__ */ jsx57(
|
|
5745
6052
|
Badge3,
|
|
5746
6053
|
{
|
|
5747
6054
|
size: "sm",
|
|
@@ -5752,7 +6059,7 @@ function SidebarContentMenu({
|
|
|
5752
6059
|
)
|
|
5753
6060
|
] });
|
|
5754
6061
|
if (child.external && child.path) {
|
|
5755
|
-
return /* @__PURE__ */
|
|
6062
|
+
return /* @__PURE__ */ jsx57(
|
|
5756
6063
|
Link8,
|
|
5757
6064
|
{
|
|
5758
6065
|
href: child.path,
|
|
@@ -5764,13 +6071,13 @@ function SidebarContentMenu({
|
|
|
5764
6071
|
child.path || `ext-${idx}`
|
|
5765
6072
|
);
|
|
5766
6073
|
}
|
|
5767
|
-
return /* @__PURE__ */
|
|
6074
|
+
return /* @__PURE__ */ jsx57(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx57(Link8, { href: child.path || "#", children: content }) }, idx);
|
|
5768
6075
|
}) })
|
|
5769
6076
|
] }, index))
|
|
5770
6077
|
}
|
|
5771
6078
|
);
|
|
5772
6079
|
}
|
|
5773
|
-
return /* @__PURE__ */
|
|
6080
|
+
return /* @__PURE__ */ jsx57(
|
|
5774
6081
|
AccordionMenu,
|
|
5775
6082
|
{
|
|
5776
6083
|
type: "multiple",
|
|
@@ -5783,13 +6090,13 @@ function SidebarContentMenu({
|
|
|
5783
6090
|
group: ""
|
|
5784
6091
|
},
|
|
5785
6092
|
children: menu.map((item, index) => {
|
|
5786
|
-
return /* @__PURE__ */
|
|
5787
|
-
/* @__PURE__ */
|
|
6093
|
+
return /* @__PURE__ */ jsxs48(AccordionMenuGroup, { children: [
|
|
6094
|
+
/* @__PURE__ */ jsx57(AccordionMenuLabel, { children: item.title }),
|
|
5788
6095
|
item.children?.map((child, idx) => {
|
|
5789
|
-
const content = /* @__PURE__ */
|
|
5790
|
-
child.icon && /* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
5792
|
-
child.badge && /* @__PURE__ */
|
|
6096
|
+
const content = /* @__PURE__ */ jsxs48(Fragment19, { children: [
|
|
6097
|
+
child.icon && /* @__PURE__ */ jsx57(child.icon, {}),
|
|
6098
|
+
/* @__PURE__ */ jsx57("span", { children: child.title }),
|
|
6099
|
+
child.badge && /* @__PURE__ */ jsx57(
|
|
5793
6100
|
Badge3,
|
|
5794
6101
|
{
|
|
5795
6102
|
size: "sm",
|
|
@@ -5800,7 +6107,7 @@ function SidebarContentMenu({
|
|
|
5800
6107
|
)
|
|
5801
6108
|
] });
|
|
5802
6109
|
if (child.external && child.path) {
|
|
5803
|
-
return /* @__PURE__ */
|
|
6110
|
+
return /* @__PURE__ */ jsx57(
|
|
5804
6111
|
Link8,
|
|
5805
6112
|
{
|
|
5806
6113
|
href: child.path,
|
|
@@ -5812,7 +6119,7 @@ function SidebarContentMenu({
|
|
|
5812
6119
|
child.path || `ext-${idx}`
|
|
5813
6120
|
);
|
|
5814
6121
|
}
|
|
5815
|
-
return /* @__PURE__ */
|
|
6122
|
+
return /* @__PURE__ */ jsx57(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx57(Link8, { href: child.path || "#", children: content }) }, idx);
|
|
5816
6123
|
})
|
|
5817
6124
|
] }, index);
|
|
5818
6125
|
})
|
|
@@ -5822,15 +6129,16 @@ function SidebarContentMenu({
|
|
|
5822
6129
|
|
|
5823
6130
|
// src/ui/layouts/site-footer.tsx
|
|
5824
6131
|
import Link9 from "next/link";
|
|
5825
|
-
import { useTranslations as
|
|
5826
|
-
import { SiteFooter as UISiteFooter } from "
|
|
5827
|
-
import { Button as
|
|
5828
|
-
import {
|
|
5829
|
-
|
|
6132
|
+
import { useTranslations as useTranslations48 } from "next-intl";
|
|
6133
|
+
import { SiteFooter as UISiteFooter } from "pelatform-ui/components";
|
|
6134
|
+
import { Button as Button34 } from "pelatform-ui/default";
|
|
6135
|
+
import { cn as cn42 } from "@pelatform/utils";
|
|
6136
|
+
import { jsx as jsx58, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
6137
|
+
function SiteFooter({ disableProjectBy = false }) {
|
|
5830
6138
|
const { app } = useConfig();
|
|
5831
|
-
const t =
|
|
5832
|
-
return /* @__PURE__ */
|
|
5833
|
-
/* @__PURE__ */
|
|
6139
|
+
const t = useTranslations48();
|
|
6140
|
+
return /* @__PURE__ */ jsxs49(UISiteFooter, { className: cn42("*:gap-2! *:py-0!", disableProjectBy ? "*:justify-center!" : ""), children: [
|
|
6141
|
+
/* @__PURE__ */ jsxs49("div", { className: "text-balance text-center text-muted-foreground text-sm leading-loose md:text-left", children: [
|
|
5834
6142
|
"\xA9 ",
|
|
5835
6143
|
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
5836
6144
|
" ",
|
|
@@ -5838,10 +6146,10 @@ function SiteFooter() {
|
|
|
5838
6146
|
". ",
|
|
5839
6147
|
t("customs.common.copyright")
|
|
5840
6148
|
] }),
|
|
5841
|
-
/* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
6149
|
+
!disableProjectBy && /* @__PURE__ */ jsx58("div", { className: "flex items-center gap-2.5 text-balance text-sm leading-loose", children: /* @__PURE__ */ jsxs49("div", { className: "inline-flex items-center gap-1", children: [
|
|
6150
|
+
/* @__PURE__ */ jsx58("span", { className: "text-muted-foreground", children: t("customs.common.project_by") }),
|
|
5843
6151
|
" ",
|
|
5844
|
-
/* @__PURE__ */
|
|
6152
|
+
/* @__PURE__ */ jsx58(Button34, { mode: "link", underline: "dashed", children: /* @__PURE__ */ jsx58(
|
|
5845
6153
|
Link9,
|
|
5846
6154
|
{
|
|
5847
6155
|
href: "https://pelatform.com",
|
|
@@ -5855,42 +6163,42 @@ function SiteFooter() {
|
|
|
5855
6163
|
}
|
|
5856
6164
|
|
|
5857
6165
|
// src/ui/layouts/site-header.tsx
|
|
5858
|
-
import { useState as
|
|
6166
|
+
import { useState as useState20 } from "react";
|
|
5859
6167
|
import Link10 from "next/link";
|
|
5860
|
-
import { usePathname as usePathname4, useRouter as
|
|
5861
|
-
import { useTranslations as
|
|
6168
|
+
import { usePathname as usePathname4, useRouter as useRouter17 } from "next/navigation";
|
|
6169
|
+
import { useTranslations as useTranslations49 } from "next-intl";
|
|
5862
6170
|
import {
|
|
5863
6171
|
MainNav,
|
|
5864
6172
|
MobileNav,
|
|
5865
6173
|
MobileNavItemRenderer,
|
|
5866
6174
|
ModeSwitcher as ModeSwitcher3,
|
|
5867
6175
|
SiteHeader as UISiteHeader
|
|
5868
|
-
} from "
|
|
5869
|
-
import { Button as
|
|
5870
|
-
import { jsx as
|
|
6176
|
+
} from "pelatform-ui/components";
|
|
6177
|
+
import { Button as Button35, Separator as Separator2 } from "pelatform-ui/default";
|
|
6178
|
+
import { jsx as jsx59, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
5871
6179
|
function SiteHeader({
|
|
5872
6180
|
menu,
|
|
5873
|
-
logo = /* @__PURE__ */
|
|
6181
|
+
logo = /* @__PURE__ */ jsx59(LogoWithHref, { href: "/home" })
|
|
5874
6182
|
}) {
|
|
5875
6183
|
const { path } = useConfig();
|
|
5876
6184
|
const pathname = usePathname4();
|
|
5877
|
-
const router =
|
|
5878
|
-
const t =
|
|
6185
|
+
const router = useRouter17();
|
|
6186
|
+
const t = useTranslations49();
|
|
5879
6187
|
const { isPending, session, user } = useSession();
|
|
5880
|
-
const [, setMobileNavOpen] =
|
|
6188
|
+
const [, setMobileNavOpen] = useState20(false);
|
|
5881
6189
|
const isAuthenticated = !isPending && session && user;
|
|
5882
|
-
return /* @__PURE__ */
|
|
5883
|
-
/* @__PURE__ */
|
|
6190
|
+
return /* @__PURE__ */ jsxs50(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
6191
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-4.5", children: [
|
|
5884
6192
|
logo,
|
|
5885
|
-
/* @__PURE__ */
|
|
6193
|
+
/* @__PURE__ */ jsx59(MainNav, { Link: Link10, pathname, items: menu })
|
|
5886
6194
|
] }),
|
|
5887
|
-
/* @__PURE__ */
|
|
5888
|
-
/* @__PURE__ */
|
|
5889
|
-
/* @__PURE__ */
|
|
5890
|
-
/* @__PURE__ */
|
|
5891
|
-
/* @__PURE__ */
|
|
6195
|
+
/* @__PURE__ */ jsx59("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs50("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
6196
|
+
/* @__PURE__ */ jsx59(ModeSwitcher3, {}),
|
|
6197
|
+
/* @__PURE__ */ jsx59(LanguageSwitcher, {}),
|
|
6198
|
+
/* @__PURE__ */ jsx59(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
6199
|
+
/* @__PURE__ */ jsx59(MobileNav, { children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col space-y-3", children: [
|
|
5892
6200
|
menu?.map(
|
|
5893
|
-
(item, navIndex) => item.href || item.children ? /* @__PURE__ */
|
|
6201
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx59(
|
|
5894
6202
|
MobileNavItemRenderer,
|
|
5895
6203
|
{
|
|
5896
6204
|
item,
|
|
@@ -5902,8 +6210,8 @@ function SiteHeader({
|
|
|
5902
6210
|
`nav-${navIndex}-${item.href}`
|
|
5903
6211
|
) : null
|
|
5904
6212
|
),
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
|
|
6213
|
+
/* @__PURE__ */ jsx59("div", { className: "border-t pt-3", children: isAuthenticated ? /* @__PURE__ */ jsx59(
|
|
6214
|
+
Button35,
|
|
5907
6215
|
{
|
|
5908
6216
|
variant: "outline",
|
|
5909
6217
|
size: "sm",
|
|
@@ -5911,18 +6219,55 @@ function SiteHeader({
|
|
|
5911
6219
|
onClick: () => router.push(path.auth.SIGN_OUT),
|
|
5912
6220
|
children: t("systems.navigation.logout")
|
|
5913
6221
|
}
|
|
5914
|
-
) : /* @__PURE__ */
|
|
6222
|
+
) : /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx59(Link10, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) }) })
|
|
6223
|
+
] }) }),
|
|
6224
|
+
isAuthenticated ? /* @__PURE__ */ jsx59(UserMenu, { hiddenSwitcher: true }) : /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx59(Link10, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) })
|
|
6225
|
+
] }) })
|
|
6226
|
+
] });
|
|
6227
|
+
}
|
|
6228
|
+
function SiteHeaderSecondary({
|
|
6229
|
+
menu,
|
|
6230
|
+
logo = /* @__PURE__ */ jsx59(LogoWithHref, { href: "/home" }),
|
|
6231
|
+
loginLink
|
|
6232
|
+
}) {
|
|
6233
|
+
const pathname = usePathname4();
|
|
6234
|
+
const t = useTranslations49();
|
|
6235
|
+
const [, setMobileNavOpen] = useState20(false);
|
|
6236
|
+
return /* @__PURE__ */ jsxs50(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
6237
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex items-center gap-4.5", children: [
|
|
6238
|
+
logo,
|
|
6239
|
+
/* @__PURE__ */ jsx59(MainNav, { Link: Link10, pathname, items: menu })
|
|
6240
|
+
] }),
|
|
6241
|
+
/* @__PURE__ */ jsx59("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs50("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
6242
|
+
/* @__PURE__ */ jsx59(ModeSwitcher3, {}),
|
|
6243
|
+
/* @__PURE__ */ jsx59(LanguageSwitcher, {}),
|
|
6244
|
+
/* @__PURE__ */ jsx59(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
6245
|
+
/* @__PURE__ */ jsx59(MobileNav, { children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col space-y-3", children: [
|
|
6246
|
+
menu?.map(
|
|
6247
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx59(
|
|
6248
|
+
MobileNavItemRenderer,
|
|
6249
|
+
{
|
|
6250
|
+
item,
|
|
6251
|
+
Link: Link10,
|
|
6252
|
+
pathname,
|
|
6253
|
+
level: 1,
|
|
6254
|
+
onOpenChange: setMobileNavOpen
|
|
6255
|
+
},
|
|
6256
|
+
`nav-${navIndex}-${item.href}`
|
|
6257
|
+
) : null
|
|
6258
|
+
),
|
|
6259
|
+
loginLink && /* @__PURE__ */ jsx59("div", { className: "border-t pt-3", children: /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx59(Link10, { href: loginLink, children: t("systems.navigation.login") }) }) })
|
|
5915
6260
|
] }) }),
|
|
5916
|
-
|
|
6261
|
+
loginLink && /* @__PURE__ */ jsx59(Button35, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx59(Link10, { href: loginLink, children: t("systems.navigation.login") }) })
|
|
5917
6262
|
] }) })
|
|
5918
6263
|
] });
|
|
5919
6264
|
}
|
|
5920
6265
|
|
|
5921
6266
|
// src/ui/providers/layout.tsx
|
|
5922
|
-
import { useEffect as
|
|
5923
|
-
import { useIsMobile } from "
|
|
5924
|
-
import { cn as
|
|
5925
|
-
import { jsx as
|
|
6267
|
+
import { useEffect as useEffect17, useState as useState21 } from "react";
|
|
6268
|
+
import { useIsMobile } from "pelatform-ui/hooks";
|
|
6269
|
+
import { cn as cn43 } from "@pelatform/utils";
|
|
6270
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
5926
6271
|
var SIDEBAR_WIDTH = "240px";
|
|
5927
6272
|
var HEADER_HEIGHT = "54px";
|
|
5928
6273
|
var SIDEBAR_WIDTH_MOBILE = "240px";
|
|
@@ -5932,10 +6277,10 @@ function LayoutProvider({
|
|
|
5932
6277
|
style: customStyle,
|
|
5933
6278
|
bodyClassName = "",
|
|
5934
6279
|
className = "",
|
|
5935
|
-
logoHeader = /* @__PURE__ */
|
|
6280
|
+
logoHeader = /* @__PURE__ */ jsx60(LogoWithHref, {})
|
|
5936
6281
|
}) {
|
|
5937
6282
|
const isMobile = useIsMobile();
|
|
5938
|
-
const [isSidebarOpen, setIsSidebarOpen] =
|
|
6283
|
+
const [isSidebarOpen, setIsSidebarOpen] = useState21(true);
|
|
5939
6284
|
const defaultStyle = {
|
|
5940
6285
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
5941
6286
|
"--header-height": HEADER_HEIGHT,
|
|
@@ -5947,7 +6292,7 @@ function LayoutProvider({
|
|
|
5947
6292
|
...customStyle
|
|
5948
6293
|
};
|
|
5949
6294
|
const sidebarToggle = () => setIsSidebarOpen((open) => !open);
|
|
5950
|
-
|
|
6295
|
+
useEffect17(() => {
|
|
5951
6296
|
if (bodyClassName) {
|
|
5952
6297
|
const body = document.body;
|
|
5953
6298
|
const existingClasses = body.className;
|
|
@@ -5957,7 +6302,7 @@ function LayoutProvider({
|
|
|
5957
6302
|
};
|
|
5958
6303
|
}
|
|
5959
6304
|
}, [bodyClassName]);
|
|
5960
|
-
return /* @__PURE__ */
|
|
6305
|
+
return /* @__PURE__ */ jsx60(
|
|
5961
6306
|
LayoutContext.Provider,
|
|
5962
6307
|
{
|
|
5963
6308
|
value: {
|
|
@@ -5968,11 +6313,11 @@ function LayoutProvider({
|
|
|
5968
6313
|
sidebarToggle,
|
|
5969
6314
|
logoHeader
|
|
5970
6315
|
},
|
|
5971
|
-
children: /* @__PURE__ */
|
|
6316
|
+
children: /* @__PURE__ */ jsx60(
|
|
5972
6317
|
"div",
|
|
5973
6318
|
{
|
|
5974
6319
|
"data-slot": "layout-wrapper",
|
|
5975
|
-
className:
|
|
6320
|
+
className: cn43("flex grow", className),
|
|
5976
6321
|
"data-sidebar-open": isSidebarOpen,
|
|
5977
6322
|
style,
|
|
5978
6323
|
children
|
|
@@ -5983,25 +6328,25 @@ function LayoutProvider({
|
|
|
5983
6328
|
}
|
|
5984
6329
|
|
|
5985
6330
|
// src/ui/layouts/wrapper.tsx
|
|
5986
|
-
import { Fragment as Fragment20, jsx as
|
|
6331
|
+
import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5987
6332
|
function LayoutWrapper({
|
|
5988
6333
|
children,
|
|
5989
6334
|
sidebarHeader,
|
|
5990
6335
|
sidebarMenu,
|
|
5991
6336
|
logoHeader
|
|
5992
6337
|
}) {
|
|
5993
|
-
const sidebarContent = /* @__PURE__ */
|
|
6338
|
+
const sidebarContent = /* @__PURE__ */ jsxs51(Fragment20, { children: [
|
|
5994
6339
|
sidebarHeader,
|
|
5995
|
-
/* @__PURE__ */
|
|
6340
|
+
/* @__PURE__ */ jsx61(SidebarContent, { children: sidebarMenu })
|
|
5996
6341
|
] });
|
|
5997
|
-
return /* @__PURE__ */
|
|
5998
|
-
/* @__PURE__ */
|
|
5999
|
-
/* @__PURE__ */
|
|
6000
|
-
/* @__PURE__ */
|
|
6342
|
+
return /* @__PURE__ */ jsxs51(LayoutProvider, { logoHeader, children: [
|
|
6343
|
+
/* @__PURE__ */ jsxs51(Header, { children: [
|
|
6344
|
+
/* @__PURE__ */ jsx61(HeaderLeft, {}),
|
|
6345
|
+
/* @__PURE__ */ jsx61(HeaderRight, { sidebar: /* @__PURE__ */ jsx61(HeaderSidebarMobile, { children: sidebarContent }) })
|
|
6001
6346
|
] }),
|
|
6002
|
-
/* @__PURE__ */
|
|
6003
|
-
/* @__PURE__ */
|
|
6004
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsxs51("div", { className: "flex grow pt-(--header-height-mobile) lg:pt-(--header-height)", children: [
|
|
6348
|
+
/* @__PURE__ */ jsx61(Sidebar, { children: sidebarContent }),
|
|
6349
|
+
/* @__PURE__ */ jsx61("main", { className: "grow transition-all duration-300 lg:in-data-[sidebar-open=false]:ps-0 lg:ps-(--sidebar-width)", children })
|
|
6005
6350
|
] })
|
|
6006
6351
|
] });
|
|
6007
6352
|
}
|
|
@@ -6010,30 +6355,31 @@ function LayoutWrapper({
|
|
|
6010
6355
|
import { Suspense as Suspense2 } from "react";
|
|
6011
6356
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
6012
6357
|
import { NextIntlClientProvider } from "next-intl";
|
|
6013
|
-
import { QueryProvider, ThemeProvider } from "
|
|
6014
|
-
import { Toaster as
|
|
6015
|
-
import { jsx as
|
|
6358
|
+
import { QueryProvider, ThemeProvider } from "pelatform-ui/components";
|
|
6359
|
+
import { Toaster as Sonner } from "pelatform-ui/default";
|
|
6360
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6016
6361
|
function SharedProviders({
|
|
6017
6362
|
children,
|
|
6018
6363
|
locale,
|
|
6019
6364
|
messages,
|
|
6020
|
-
timeZone = "Asia/Jakarta"
|
|
6365
|
+
timeZone = "Asia/Jakarta",
|
|
6366
|
+
sonnerPosition = "top-center"
|
|
6021
6367
|
}) {
|
|
6022
6368
|
const config = useConfig();
|
|
6023
|
-
return /* @__PURE__ */
|
|
6024
|
-
/* @__PURE__ */
|
|
6369
|
+
return /* @__PURE__ */ jsxs52(QueryProvider, { children: [
|
|
6370
|
+
/* @__PURE__ */ jsx62(ThemeProvider, { defaultTheme: config.ui.defaultTheme, children: /* @__PURE__ */ jsx62(NextIntlClientProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsxs52(Suspense2, { children: [
|
|
6025
6371
|
children,
|
|
6026
|
-
/* @__PURE__ */
|
|
6372
|
+
/* @__PURE__ */ jsx62(Sonner, { position: sonnerPosition })
|
|
6027
6373
|
] }) }) }),
|
|
6028
|
-
/* @__PURE__ */
|
|
6374
|
+
/* @__PURE__ */ jsx62(ReactQueryDevtools, { initialIsOpen: false })
|
|
6029
6375
|
] });
|
|
6030
6376
|
}
|
|
6031
6377
|
|
|
6032
6378
|
// src/ui/shared/empty-state.tsx
|
|
6033
6379
|
import Link11 from "next/link";
|
|
6034
|
-
import { useTranslations as
|
|
6035
|
-
import { cn as
|
|
6036
|
-
import { jsx as
|
|
6380
|
+
import { useTranslations as useTranslations50 } from "next-intl";
|
|
6381
|
+
import { cn as cn44 } from "@pelatform/utils";
|
|
6382
|
+
import { jsx as jsx63, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6037
6383
|
function EmptyState({
|
|
6038
6384
|
className,
|
|
6039
6385
|
icon: Icon,
|
|
@@ -6043,14 +6389,14 @@ function EmptyState({
|
|
|
6043
6389
|
learnMoreText,
|
|
6044
6390
|
children
|
|
6045
6391
|
}) {
|
|
6046
|
-
const t =
|
|
6047
|
-
return /* @__PURE__ */
|
|
6048
|
-
Icon && /* @__PURE__ */
|
|
6049
|
-
/* @__PURE__ */
|
|
6050
|
-
description && /* @__PURE__ */
|
|
6392
|
+
const t = useTranslations50();
|
|
6393
|
+
return /* @__PURE__ */ jsxs53("div", { className: cn44("flex flex-col items-center justify-center gap-y-4", className), children: [
|
|
6394
|
+
Icon && /* @__PURE__ */ jsx63("div", { className: "flex size-14 items-center justify-center rounded-2xl border bg-muted", children: /* @__PURE__ */ jsx63(Icon, { className: "size-6 text-foreground" }) }),
|
|
6395
|
+
/* @__PURE__ */ jsx63("p", { className: "text-center font-medium text-base text-foreground", children: title }),
|
|
6396
|
+
description && /* @__PURE__ */ jsxs53("p", { className: "max-w-sm text-balance text-center text-muted-foreground text-sm", children: [
|
|
6051
6397
|
description,
|
|
6052
6398
|
" ",
|
|
6053
|
-
learnMore && /* @__PURE__ */
|
|
6399
|
+
learnMore && /* @__PURE__ */ jsxs53(
|
|
6054
6400
|
Link11,
|
|
6055
6401
|
{
|
|
6056
6402
|
href: learnMore,
|
|
@@ -6066,11 +6412,11 @@ function EmptyState({
|
|
|
6066
6412
|
] });
|
|
6067
6413
|
}
|
|
6068
6414
|
export {
|
|
6415
|
+
AcceptInvitation,
|
|
6069
6416
|
ApiKeyDeleteDialog,
|
|
6070
6417
|
ApiKeyDisplayDialog,
|
|
6071
6418
|
ApiKeyView,
|
|
6072
6419
|
ApiKeysCard,
|
|
6073
|
-
AppleIcon,
|
|
6074
6420
|
AuthCallback,
|
|
6075
6421
|
AuthForm,
|
|
6076
6422
|
AuthLayout,
|
|
@@ -6087,13 +6433,10 @@ export {
|
|
|
6087
6433
|
DeleteAccountDialog,
|
|
6088
6434
|
DialogComponent,
|
|
6089
6435
|
DialogFooterComponent,
|
|
6090
|
-
DiscordIcon,
|
|
6091
6436
|
DisplayIdCard,
|
|
6092
|
-
DropboxIcon,
|
|
6093
6437
|
EmailOTPButton,
|
|
6094
6438
|
EmailOTPForm,
|
|
6095
6439
|
EmptyState,
|
|
6096
|
-
FacebookIcon,
|
|
6097
6440
|
ForgotPasswordForm,
|
|
6098
6441
|
FormAvatarCard,
|
|
6099
6442
|
FormEmailCard,
|
|
@@ -6101,28 +6444,19 @@ export {
|
|
|
6101
6444
|
FormNameCard,
|
|
6102
6445
|
FormPasswordCard,
|
|
6103
6446
|
FormUsernameCard,
|
|
6104
|
-
GitHubIcon,
|
|
6105
|
-
GitLabIcon,
|
|
6106
|
-
GoogleIcon,
|
|
6107
6447
|
Header,
|
|
6108
6448
|
HeaderLeft,
|
|
6109
6449
|
HeaderRight,
|
|
6110
6450
|
HeaderSidebarMobile,
|
|
6111
|
-
HuggingFaceIcon,
|
|
6112
|
-
KickIcon,
|
|
6113
6451
|
LanguageSwitcher,
|
|
6114
6452
|
LastUsedButton,
|
|
6115
6453
|
LayoutContext,
|
|
6116
6454
|
LayoutLoader,
|
|
6117
6455
|
LayoutProvider,
|
|
6118
6456
|
LayoutWrapper,
|
|
6119
|
-
LinearIcon,
|
|
6120
|
-
LinkedInIcon,
|
|
6121
6457
|
MagicLinkButton,
|
|
6122
6458
|
MagicLinkForm,
|
|
6123
|
-
MicrosoftIcon,
|
|
6124
6459
|
MultiAccountCard,
|
|
6125
|
-
NotionIcon,
|
|
6126
6460
|
OTPInputGroup,
|
|
6127
6461
|
OneTap,
|
|
6128
6462
|
PasskeyButton,
|
|
@@ -6132,9 +6466,7 @@ export {
|
|
|
6132
6466
|
ProvidersCard,
|
|
6133
6467
|
QueryContext,
|
|
6134
6468
|
RecoverAccountForm,
|
|
6135
|
-
RedditIcon,
|
|
6136
6469
|
ResetPasswordForm,
|
|
6137
|
-
RobloxIcon,
|
|
6138
6470
|
SecurityCards,
|
|
6139
6471
|
SessionFreshnessDialog,
|
|
6140
6472
|
SessionsCard,
|
|
@@ -6150,22 +6482,18 @@ export {
|
|
|
6150
6482
|
SignedInHint,
|
|
6151
6483
|
SiteFooter,
|
|
6152
6484
|
SiteHeader,
|
|
6485
|
+
SiteHeaderSecondary,
|
|
6153
6486
|
SkeletonInputComponent,
|
|
6154
6487
|
SkeletonViewComponent,
|
|
6155
|
-
SlackIcon,
|
|
6156
|
-
SpotifyIcon,
|
|
6157
|
-
TikTokIcon,
|
|
6158
6488
|
Toolbar,
|
|
6159
|
-
TwitchIcon,
|
|
6160
6489
|
TwoFactorCard,
|
|
6161
6490
|
TwoFactorForm,
|
|
6162
6491
|
TwoFactorPasswordDialog,
|
|
6163
6492
|
UserAvatar,
|
|
6164
6493
|
UserMenu,
|
|
6165
6494
|
UserView,
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
ZoomIcon,
|
|
6495
|
+
WorkspaceLogo,
|
|
6496
|
+
WorkspaceView,
|
|
6169
6497
|
getUserName,
|
|
6170
6498
|
useAccountInfo,
|
|
6171
6499
|
useAuthMutation,
|
|
@@ -6174,6 +6502,7 @@ export {
|
|
|
6174
6502
|
useCreateApiKey,
|
|
6175
6503
|
useDeleteApiKey,
|
|
6176
6504
|
useDeletePasskey,
|
|
6505
|
+
useInvitation,
|
|
6177
6506
|
useLayout,
|
|
6178
6507
|
useListAccounts,
|
|
6179
6508
|
useListApiKeys,
|