@pelatform/starter 0.1.6 → 0.1.7
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/extend.d.ts +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +893 -898
- package/dist/server.js +1 -1
- package/dist/{ui-BjeCRH96.d.ts → ui-DxCTGGLe.d.ts} +0 -7
- package/package.json +7 -9
package/dist/index.js
CHANGED
|
@@ -483,13 +483,12 @@ var useLayout = () => {
|
|
|
483
483
|
// src/hooks/use-onsuccess-transition.ts
|
|
484
484
|
import { useCallback, useEffect, useState, useTransition } from "react";
|
|
485
485
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
486
|
-
import { REDIRECT_QUERY_PARAM } from "@pelatform/utils";
|
|
487
486
|
function useOnSuccessTransition(redirectToProp) {
|
|
488
487
|
const { auth } = useConfig();
|
|
489
488
|
const router = useRouter();
|
|
490
489
|
const searchParams = useSearchParams();
|
|
491
490
|
const { refetch: refetchSession } = useSession();
|
|
492
|
-
const redirectTo = redirectToProp || searchParams?.get(
|
|
491
|
+
const redirectTo = redirectToProp || searchParams?.get("redirectTo") || auth.redirectAfterSignIn;
|
|
493
492
|
const [isPending, startTransition] = useTransition();
|
|
494
493
|
const [success, setSuccess] = useState(false);
|
|
495
494
|
useEffect(() => {
|
|
@@ -541,12 +540,13 @@ function useInvitation(params, options) {
|
|
|
541
540
|
// src/ui/account/dialogs/backup-codes.tsx
|
|
542
541
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
543
542
|
import { useTranslations as useTranslations2 } from "next-intl";
|
|
543
|
+
import { cn as cn2 } from "pelatform-ui";
|
|
544
544
|
import { Button as Button2 } from "pelatform-ui/default";
|
|
545
545
|
import { useCopyToClipboard } from "pelatform-ui/hooks";
|
|
546
|
-
import { cn as cn2 } from "@pelatform/utils";
|
|
547
546
|
|
|
548
547
|
// src/ui/shared/components/dialog.tsx
|
|
549
548
|
import { useTranslations } from "next-intl";
|
|
549
|
+
import { cn } from "pelatform-ui";
|
|
550
550
|
import {
|
|
551
551
|
Button,
|
|
552
552
|
Dialog,
|
|
@@ -556,7 +556,6 @@ import {
|
|
|
556
556
|
DialogHeader,
|
|
557
557
|
DialogTitle
|
|
558
558
|
} from "pelatform-ui/default";
|
|
559
|
-
import { cn } from "@pelatform/utils";
|
|
560
559
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
561
560
|
function DialogComponent({
|
|
562
561
|
children,
|
|
@@ -677,6 +676,9 @@ function BackupCodesDialog({
|
|
|
677
676
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
678
677
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
679
678
|
import { useTranslations as useTranslations5 } from "next-intl";
|
|
679
|
+
import { useForm } from "react-hook-form";
|
|
680
|
+
import { z } from "zod";
|
|
681
|
+
import { cn as cn6 } from "pelatform-ui";
|
|
680
682
|
import { AlertToast } from "pelatform-ui/components";
|
|
681
683
|
import {
|
|
682
684
|
Button as Button4,
|
|
@@ -689,15 +691,12 @@ import {
|
|
|
689
691
|
FormMessage,
|
|
690
692
|
Spinner
|
|
691
693
|
} from "pelatform-ui/default";
|
|
692
|
-
import { useForm } from "react-hook-form";
|
|
693
|
-
import { z } from "zod";
|
|
694
|
-
import { cn as cn6 } from "@pelatform/utils";
|
|
695
694
|
|
|
696
695
|
// src/ui/shared/password-input.tsx
|
|
697
696
|
import { useState as useState2 } from "react";
|
|
698
697
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
698
|
+
import { cn as cn3 } from "pelatform-ui";
|
|
699
699
|
import { Button as Button3, Input } from "pelatform-ui/default";
|
|
700
|
-
import { cn as cn3 } from "@pelatform/utils";
|
|
701
700
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
702
701
|
function PasswordInput({
|
|
703
702
|
className,
|
|
@@ -750,15 +749,15 @@ function PasswordInput({
|
|
|
750
749
|
// src/ui/shared/view.tsx
|
|
751
750
|
import { KeyRoundIcon } from "lucide-react";
|
|
752
751
|
import { useLocale, useTranslations as useTranslations4 } from "next-intl";
|
|
752
|
+
import { cn as cn5 } from "pelatform-ui";
|
|
753
753
|
import { Skeleton as Skeleton2 } from "pelatform-ui/default";
|
|
754
|
-
import { cn as cn5 } from "@pelatform/utils";
|
|
755
754
|
|
|
756
755
|
// src/ui/shared/avatar.tsx
|
|
757
756
|
import { BuildingIcon, UserRoundIcon } from "lucide-react";
|
|
758
757
|
import { useTranslations as useTranslations3 } from "next-intl";
|
|
758
|
+
import { cn as cn4 } from "pelatform-ui";
|
|
759
759
|
import { getInitials } from "pelatform-ui/components";
|
|
760
760
|
import { Avatar, AvatarFallback, AvatarImage, Skeleton } from "pelatform-ui/default";
|
|
761
|
-
import { cn as cn4 } from "@pelatform/utils";
|
|
762
761
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
763
762
|
function getSize(size) {
|
|
764
763
|
return size === "sm" ? "size-6" : size === "lg" ? "size-10" : "size-8";
|
|
@@ -1148,8 +1147,8 @@ function DeleteAccountDialog({
|
|
|
1148
1147
|
// src/ui/account/dialogs/session-freshness.tsx
|
|
1149
1148
|
import { useRouter as useRouter3 } from "next/navigation";
|
|
1150
1149
|
import { useTranslations as useTranslations6 } from "next-intl";
|
|
1150
|
+
import { cn as cn7 } from "pelatform-ui";
|
|
1151
1151
|
import { Button as Button5 } from "pelatform-ui/default";
|
|
1152
|
-
import { cn as cn7 } from "@pelatform/utils";
|
|
1153
1152
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1154
1153
|
function SessionFreshnessDialog({
|
|
1155
1154
|
classNames,
|
|
@@ -1192,6 +1191,9 @@ import { useState as useState3 } from "react";
|
|
|
1192
1191
|
import { useRouter as useRouter4 } from "next/navigation";
|
|
1193
1192
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
|
1194
1193
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
1194
|
+
import { useForm as useForm2 } from "react-hook-form";
|
|
1195
|
+
import { z as z2 } from "zod";
|
|
1196
|
+
import { cn as cn8 } from "pelatform-ui";
|
|
1195
1197
|
import { AlertToast as AlertToast2 } from "pelatform-ui/components";
|
|
1196
1198
|
import {
|
|
1197
1199
|
Button as Button6,
|
|
@@ -1203,9 +1205,6 @@ import {
|
|
|
1203
1205
|
FormMessage as FormMessage2,
|
|
1204
1206
|
Spinner as Spinner2
|
|
1205
1207
|
} from "pelatform-ui/default";
|
|
1206
|
-
import { useForm as useForm2 } from "react-hook-form";
|
|
1207
|
-
import { z as z2 } from "zod";
|
|
1208
|
-
import { cn as cn8 } from "@pelatform/utils";
|
|
1209
1208
|
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1210
1209
|
function TwoFactorPasswordDialog({
|
|
1211
1210
|
classNames,
|
|
@@ -1352,9 +1351,9 @@ import { useState as useState4 } from "react";
|
|
|
1352
1351
|
import { useTranslations as useTranslations8 } from "next-intl";
|
|
1353
1352
|
|
|
1354
1353
|
// src/ui/shared/components/card.tsx
|
|
1355
|
-
import { Button as Button7, Card as Card2, CardContent, CardFooter, Skeleton as Skeleton3, Spinner as Spinner3 } from "pelatform-ui/default";
|
|
1356
1354
|
import { useFormState } from "react-hook-form";
|
|
1357
|
-
import { cn as cn9 } from "
|
|
1355
|
+
import { cn as cn9 } from "pelatform-ui";
|
|
1356
|
+
import { Button as Button7, Card as Card2, CardContent, CardFooter, Skeleton as Skeleton3, Spinner as Spinner3 } from "pelatform-ui/default";
|
|
1358
1357
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1359
1358
|
function CardComponent({
|
|
1360
1359
|
children,
|
|
@@ -1701,6 +1700,9 @@ function FormAvatarCard({
|
|
|
1701
1700
|
import { useState as useState6 } from "react";
|
|
1702
1701
|
import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
|
|
1703
1702
|
import { useTranslations as useTranslations10 } from "next-intl";
|
|
1703
|
+
import { useForm as useForm3 } from "react-hook-form";
|
|
1704
|
+
import { z as z3 } from "zod";
|
|
1705
|
+
import { cn as cn10 } from "pelatform-ui";
|
|
1704
1706
|
import { AlertToast as AlertToast4 } from "pelatform-ui/components";
|
|
1705
1707
|
import {
|
|
1706
1708
|
Form as Form3,
|
|
@@ -1711,9 +1713,6 @@ import {
|
|
|
1711
1713
|
Input as Input2,
|
|
1712
1714
|
Skeleton as Skeleton4
|
|
1713
1715
|
} from "pelatform-ui/default";
|
|
1714
|
-
import { useForm as useForm3 } from "react-hook-form";
|
|
1715
|
-
import { z as z3 } from "zod";
|
|
1716
|
-
import { cn as cn10 } from "@pelatform/utils";
|
|
1717
1716
|
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1718
1717
|
function FormEmailCard({ className, classNames, ...props }) {
|
|
1719
1718
|
const { authClient, auth } = useConfig();
|
|
@@ -1834,6 +1833,9 @@ function FormEmailCard({ className, classNames, ...props }) {
|
|
|
1834
1833
|
// src/ui/account/partials/form-fields.tsx
|
|
1835
1834
|
import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
|
|
1836
1835
|
import { useTranslations as useTranslations11 } from "next-intl";
|
|
1836
|
+
import { useForm as useForm4 } from "react-hook-form";
|
|
1837
|
+
import { z as z4 } from "zod";
|
|
1838
|
+
import { cn as cn11 } from "pelatform-ui";
|
|
1837
1839
|
import { AlertToast as AlertToast5 } from "pelatform-ui/components";
|
|
1838
1840
|
import {
|
|
1839
1841
|
Checkbox,
|
|
@@ -1847,9 +1849,6 @@ import {
|
|
|
1847
1849
|
Skeleton as Skeleton5,
|
|
1848
1850
|
Textarea
|
|
1849
1851
|
} from "pelatform-ui/default";
|
|
1850
|
-
import { useForm as useForm4 } from "react-hook-form";
|
|
1851
|
-
import { z as z4 } from "zod";
|
|
1852
|
-
import { cn as cn11 } from "@pelatform/utils";
|
|
1853
1852
|
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1854
1853
|
function FormFieldsCard({
|
|
1855
1854
|
className,
|
|
@@ -2034,6 +2033,9 @@ function FormNameCard({ className, classNames, ...props }) {
|
|
|
2034
2033
|
// src/ui/account/partials/form-password.tsx
|
|
2035
2034
|
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
|
2036
2035
|
import { useTranslations as useTranslations13 } from "next-intl";
|
|
2036
|
+
import { useForm as useForm5 } from "react-hook-form";
|
|
2037
|
+
import { z as z5 } from "zod";
|
|
2038
|
+
import { cn as cn13 } from "pelatform-ui";
|
|
2037
2039
|
import { AlertToast as AlertToast6 } from "pelatform-ui/components";
|
|
2038
2040
|
import {
|
|
2039
2041
|
Form as Form5,
|
|
@@ -2043,13 +2045,10 @@ import {
|
|
|
2043
2045
|
FormLabel as FormLabel4,
|
|
2044
2046
|
FormMessage as FormMessage5
|
|
2045
2047
|
} from "pelatform-ui/default";
|
|
2046
|
-
import { useForm as useForm5 } from "react-hook-form";
|
|
2047
|
-
import { z as z5 } from "zod";
|
|
2048
|
-
import { cn as cn13 } from "@pelatform/utils";
|
|
2049
2048
|
|
|
2050
2049
|
// src/ui/shared/components/skeleton.tsx
|
|
2050
|
+
import { cn as cn12 } from "pelatform-ui";
|
|
2051
2051
|
import { Card as Card3, Skeleton as Skeleton6 } from "pelatform-ui/default";
|
|
2052
|
-
import { cn as cn12 } from "@pelatform/utils";
|
|
2053
2052
|
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2054
2053
|
function SkeletonViewComponent({ classNames }) {
|
|
2055
2054
|
return /* @__PURE__ */ jsxs13(Card3, { className: cn12("flex-row items-center gap-3 px-4 py-3", classNames?.cell), children: [
|
|
@@ -2273,6 +2272,7 @@ import { useState as useState7 } from "react";
|
|
|
2273
2272
|
import { useRouter as useRouter5 } from "next/navigation";
|
|
2274
2273
|
import { EllipsisIcon, LogOutIcon, RepeatIcon, UserX2Icon } from "lucide-react";
|
|
2275
2274
|
import { useTranslations as useTranslations15 } from "next-intl";
|
|
2275
|
+
import { cn as cn14 } from "pelatform-ui";
|
|
2276
2276
|
import { AlertToast as AlertToast7 } from "pelatform-ui/components";
|
|
2277
2277
|
import {
|
|
2278
2278
|
Button as Button9,
|
|
@@ -2283,7 +2283,6 @@ import {
|
|
|
2283
2283
|
DropdownMenuTrigger as DropdownMenuTrigger2,
|
|
2284
2284
|
Spinner as Spinner4
|
|
2285
2285
|
} from "pelatform-ui/default";
|
|
2286
|
-
import { cn as cn14 } from "@pelatform/utils";
|
|
2287
2286
|
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2288
2287
|
function MultiAccountCard({ className, classNames, ...props }) {
|
|
2289
2288
|
const { path } = useConfig();
|
|
@@ -2425,10 +2424,10 @@ function MultiAccountCell({
|
|
|
2425
2424
|
import { useState as useState8 } from "react";
|
|
2426
2425
|
import { FingerprintIcon } from "lucide-react";
|
|
2427
2426
|
import { useTranslations as useTranslations16 } from "next-intl";
|
|
2427
|
+
import { useForm as useForm6 } from "react-hook-form";
|
|
2428
|
+
import { cn as cn15 } from "pelatform-ui";
|
|
2428
2429
|
import { AlertToast as AlertToast8 } from "pelatform-ui/components";
|
|
2429
2430
|
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";
|
|
2431
|
-
import { cn as cn15 } from "@pelatform/utils";
|
|
2432
2431
|
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2433
2432
|
function PasskeysCard({ className, classNames, ...props }) {
|
|
2434
2433
|
const { authClient, auth } = useConfig();
|
|
@@ -2551,9 +2550,9 @@ function PasskeyCell({
|
|
|
2551
2550
|
// src/ui/account/partials/providers.tsx
|
|
2552
2551
|
import { useState as useState9 } from "react";
|
|
2553
2552
|
import { useTranslations as useTranslations17 } from "next-intl";
|
|
2553
|
+
import { cn as cn16 } from "pelatform-ui";
|
|
2554
2554
|
import { AlertToast as AlertToast9 } from "pelatform-ui/components";
|
|
2555
2555
|
import { Button as Button11, Card as Card6, Skeleton as Skeleton7, Spinner as Spinner6 } from "pelatform-ui/default";
|
|
2556
|
-
import { cn as cn16 } from "@pelatform/utils";
|
|
2557
2556
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2558
2557
|
function ProvidersCard({
|
|
2559
2558
|
className,
|
|
@@ -2682,10 +2681,10 @@ import { useState as useState10 } from "react";
|
|
|
2682
2681
|
import { useRouter as useRouter6 } from "next/navigation";
|
|
2683
2682
|
import { LaptopIcon, SmartphoneIcon } from "lucide-react";
|
|
2684
2683
|
import { useTranslations as useTranslations18 } from "next-intl";
|
|
2684
|
+
import { UAParser } from "ua-parser-js";
|
|
2685
|
+
import { cn as cn17 } from "pelatform-ui";
|
|
2685
2686
|
import { AlertToast as AlertToast10 } from "pelatform-ui/components";
|
|
2686
2687
|
import { Button as Button12, Card as Card7, Spinner as Spinner7 } from "pelatform-ui/default";
|
|
2687
|
-
import { UAParser } from "ua-parser-js";
|
|
2688
|
-
import { cn as cn17 } from "@pelatform/utils";
|
|
2689
2688
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2690
2689
|
function SessionsCard({ className, classNames, ...props }) {
|
|
2691
2690
|
const t = useTranslations18();
|
|
@@ -2806,7 +2805,7 @@ function TwoFactorCard({ className, classNames, ...props }) {
|
|
|
2806
2805
|
}
|
|
2807
2806
|
|
|
2808
2807
|
// src/ui/account/security.tsx
|
|
2809
|
-
import { cn as cn18 } from "
|
|
2808
|
+
import { cn as cn18 } from "pelatform-ui";
|
|
2810
2809
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2811
2810
|
function SecurityCards({
|
|
2812
2811
|
className,
|
|
@@ -2853,12 +2852,13 @@ function SecurityCards({
|
|
|
2853
2852
|
|
|
2854
2853
|
// src/ui/account/settings.tsx
|
|
2855
2854
|
import { useTranslations as useTranslations21 } from "next-intl";
|
|
2856
|
-
import { cn as cn20 } from "
|
|
2855
|
+
import { cn as cn20 } from "pelatform-ui";
|
|
2857
2856
|
|
|
2858
2857
|
// src/ui/shared/display-id.tsx
|
|
2859
2858
|
import { useRef as useRef2 } from "react";
|
|
2860
2859
|
import { CheckIcon as CheckIcon2, CopyIcon as CopyIcon2 } from "lucide-react";
|
|
2861
2860
|
import { useTranslations as useTranslations20 } from "next-intl";
|
|
2861
|
+
import { cn as cn19 } from "pelatform-ui";
|
|
2862
2862
|
import {
|
|
2863
2863
|
Button as Button13,
|
|
2864
2864
|
Input as Input4,
|
|
@@ -2869,7 +2869,6 @@ import {
|
|
|
2869
2869
|
TooltipTrigger
|
|
2870
2870
|
} from "pelatform-ui/default";
|
|
2871
2871
|
import { useCopyToClipboard as useCopyToClipboard2 } from "pelatform-ui/hooks";
|
|
2872
|
-
import { cn as cn19 } from "@pelatform/utils";
|
|
2873
2872
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2874
2873
|
function DisplayIdCard({
|
|
2875
2874
|
className,
|
|
@@ -2949,12 +2948,15 @@ function SettingsCards({
|
|
|
2949
2948
|
// src/ui/apikeys/apikeys.tsx
|
|
2950
2949
|
import { useMemo as useMemo2, useState as useState13 } from "react";
|
|
2951
2950
|
import { useTranslations as useTranslations25 } from "next-intl";
|
|
2951
|
+
import { cn as cn24 } from "pelatform-ui";
|
|
2952
2952
|
import { Button as Button17, Card as Card9 } from "pelatform-ui/default";
|
|
2953
|
-
import { cn as cn24 } from "@pelatform/utils";
|
|
2954
2953
|
|
|
2955
2954
|
// src/ui/apikeys/create-apikey.tsx
|
|
2956
2955
|
import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
|
|
2957
2956
|
import { useLocale as useLocale2, useTranslations as useTranslations22 } from "next-intl";
|
|
2957
|
+
import { useForm as useForm7 } from "react-hook-form";
|
|
2958
|
+
import { z as z6 } from "zod";
|
|
2959
|
+
import { cn as cn21 } from "pelatform-ui";
|
|
2958
2960
|
import { AlertToast as AlertToast11 } from "pelatform-ui/components";
|
|
2959
2961
|
import {
|
|
2960
2962
|
Button as Button14,
|
|
@@ -2972,9 +2974,6 @@ import {
|
|
|
2972
2974
|
SelectValue,
|
|
2973
2975
|
Spinner as Spinner8
|
|
2974
2976
|
} from "pelatform-ui/default";
|
|
2975
|
-
import { useForm as useForm7 } from "react-hook-form";
|
|
2976
|
-
import { z as z6 } from "zod";
|
|
2977
|
-
import { cn as cn21 } from "@pelatform/utils";
|
|
2978
2977
|
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2979
2978
|
function CreateApiKeyDialog({
|
|
2980
2979
|
classNames,
|
|
@@ -3113,9 +3112,9 @@ function CreateApiKeyDialog({
|
|
|
3113
3112
|
// src/ui/apikeys/delete-apikey.tsx
|
|
3114
3113
|
import { useState as useState12 } from "react";
|
|
3115
3114
|
import { useTranslations as useTranslations23 } from "next-intl";
|
|
3115
|
+
import { cn as cn22 } from "pelatform-ui";
|
|
3116
3116
|
import { AlertToast as AlertToast12 } from "pelatform-ui/components";
|
|
3117
3117
|
import { Button as Button15, Card as Card8, Spinner as Spinner9 } from "pelatform-ui/default";
|
|
3118
|
-
import { cn as cn22 } from "@pelatform/utils";
|
|
3119
3118
|
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3120
3119
|
function ApiKeyDeleteDialog({
|
|
3121
3120
|
classNames,
|
|
@@ -3175,9 +3174,9 @@ function ApiKeyDeleteDialog({
|
|
|
3175
3174
|
// src/ui/apikeys/display-apikey.tsx
|
|
3176
3175
|
import { CheckIcon as CheckIcon3, CopyIcon as CopyIcon3 } from "lucide-react";
|
|
3177
3176
|
import { useTranslations as useTranslations24 } from "next-intl";
|
|
3177
|
+
import { cn as cn23 } from "pelatform-ui";
|
|
3178
3178
|
import { Button as Button16 } from "pelatform-ui/default";
|
|
3179
3179
|
import { useCopyToClipboard as useCopyToClipboard3 } from "pelatform-ui/hooks";
|
|
3180
|
-
import { cn as cn23 } from "@pelatform/utils";
|
|
3181
3180
|
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3182
3181
|
function ApiKeyDisplayDialog({
|
|
3183
3182
|
classNames,
|
|
@@ -3339,13 +3338,13 @@ function ApiKeyCell({
|
|
|
3339
3338
|
import { useRouter as useRouter7 } from "next/navigation";
|
|
3340
3339
|
import { LockIcon, MailIcon } from "lucide-react";
|
|
3341
3340
|
import { useTranslations as useTranslations27 } from "next-intl";
|
|
3341
|
+
import { cn as cn26 } from "pelatform-ui";
|
|
3342
3342
|
import { Button as Button18 } from "pelatform-ui/default";
|
|
3343
|
-
import { cn as cn26 } from "@pelatform/utils";
|
|
3344
3343
|
|
|
3345
3344
|
// src/ui/auth/partials/last-used-button.tsx
|
|
3346
3345
|
import { useTranslations as useTranslations26 } from "next-intl";
|
|
3346
|
+
import { cn as cn25 } from "pelatform-ui";
|
|
3347
3347
|
import { Badge } from "pelatform-ui/default";
|
|
3348
|
-
import { cn as cn25 } from "@pelatform/utils";
|
|
3349
3348
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3350
3349
|
function LastUsedButton({
|
|
3351
3350
|
className,
|
|
@@ -3406,8 +3405,8 @@ function EmailOTPButton({ className, classNames, isSubmitting, view }) {
|
|
|
3406
3405
|
import { useRouter as useRouter8 } from "next/navigation";
|
|
3407
3406
|
import { LockIcon as LockIcon2, MailIcon as MailIcon2 } from "lucide-react";
|
|
3408
3407
|
import { useTranslations as useTranslations28 } from "next-intl";
|
|
3408
|
+
import { cn as cn27 } from "pelatform-ui";
|
|
3409
3409
|
import { Button as Button19 } from "pelatform-ui/default";
|
|
3410
|
-
import { cn as cn27 } from "@pelatform/utils";
|
|
3411
3410
|
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3412
3411
|
function MagicLinkButton({ className, classNames, isSubmitting, view }) {
|
|
3413
3412
|
const { path } = useConfig();
|
|
@@ -3475,9 +3474,9 @@ function OneTap({ redirectTo }) {
|
|
|
3475
3474
|
// src/ui/auth/partials/passkey-button.tsx
|
|
3476
3475
|
import { FingerprintIcon as FingerprintIcon2 } from "lucide-react";
|
|
3477
3476
|
import { useTranslations as useTranslations30 } from "next-intl";
|
|
3477
|
+
import { cn as cn28 } from "pelatform-ui";
|
|
3478
3478
|
import { AlertToast as AlertToast14 } from "pelatform-ui/components";
|
|
3479
3479
|
import { Button as Button20 } from "pelatform-ui/default";
|
|
3480
|
-
import { cn as cn28 } from "@pelatform/utils";
|
|
3481
3480
|
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3482
3481
|
function PasskeyButton({
|
|
3483
3482
|
className,
|
|
@@ -3541,9 +3540,9 @@ function PasskeyButton({
|
|
|
3541
3540
|
// src/ui/auth/partials/provider-button.tsx
|
|
3542
3541
|
import { useSearchParams as useSearchParams2 } from "next/navigation";
|
|
3543
3542
|
import { useTranslations as useTranslations31 } from "next-intl";
|
|
3543
|
+
import { cn as cn29, REDIRECT_QUERY_PARAM } from "pelatform-ui";
|
|
3544
3544
|
import { AlertToast as AlertToast15 } from "pelatform-ui/components";
|
|
3545
3545
|
import { Button as Button21 } from "pelatform-ui/default";
|
|
3546
|
-
import { cn as cn29, REDIRECT_QUERY_PARAM as REDIRECT_QUERY_PARAM2 } from "@pelatform/utils";
|
|
3547
3546
|
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3548
3547
|
function ProviderButton({
|
|
3549
3548
|
className,
|
|
@@ -3561,7 +3560,7 @@ function ProviderButton({
|
|
|
3561
3560
|
try {
|
|
3562
3561
|
await authClient.signIn.social({
|
|
3563
3562
|
provider: provider.provider,
|
|
3564
|
-
callbackURL: `${app.url}${path.auth.CALLBACK}?redirectTo=${searchParams?.get(
|
|
3563
|
+
callbackURL: `${app.url}${path.auth.CALLBACK}?redirectTo=${searchParams?.get(REDIRECT_QUERY_PARAM)}`,
|
|
3565
3564
|
fetchOptions: { throw: true }
|
|
3566
3565
|
});
|
|
3567
3566
|
} catch (error) {
|
|
@@ -3603,228 +3602,31 @@ function ProviderButton({
|
|
|
3603
3602
|
);
|
|
3604
3603
|
}
|
|
3605
3604
|
|
|
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
|
-
|
|
3806
3605
|
// src/ui/auth/callback.tsx
|
|
3807
|
-
import { useEffect as
|
|
3808
|
-
import { Spinner as
|
|
3809
|
-
import { jsx as
|
|
3606
|
+
import { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
3607
|
+
import { Spinner as Spinner10 } from "pelatform-ui/default";
|
|
3608
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3810
3609
|
function AuthCallback({ redirectTo }) {
|
|
3811
3610
|
const { onSuccess } = useOnSuccessTransition(redirectTo);
|
|
3812
3611
|
const isRedirecting = useRef4(false);
|
|
3813
|
-
|
|
3612
|
+
useEffect3(() => {
|
|
3814
3613
|
if (isRedirecting.current) return;
|
|
3815
3614
|
isRedirecting.current = true;
|
|
3816
3615
|
onSuccess();
|
|
3817
3616
|
}, [onSuccess]);
|
|
3818
|
-
return /* @__PURE__ */
|
|
3617
|
+
return /* @__PURE__ */ jsx36("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx36(Spinner10, { className: "size-12" }) });
|
|
3819
3618
|
}
|
|
3820
3619
|
|
|
3821
3620
|
// src/ui/auth/email-otp.tsx
|
|
3822
|
-
import { useEffect as
|
|
3621
|
+
import { useEffect as useEffect4, useState as useState14 } from "react";
|
|
3823
3622
|
import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
|
|
3824
|
-
import { useTranslations as
|
|
3825
|
-
import {
|
|
3623
|
+
import { useTranslations as useTranslations32 } from "next-intl";
|
|
3624
|
+
import { useForm as useForm8 } from "react-hook-form";
|
|
3625
|
+
import { z as z7 } from "zod";
|
|
3626
|
+
import { cn as cn30 } from "pelatform-ui";
|
|
3627
|
+
import { AlertToast as AlertToast16 } from "pelatform-ui/components";
|
|
3826
3628
|
import {
|
|
3827
|
-
Button as
|
|
3629
|
+
Button as Button22,
|
|
3828
3630
|
Form as Form8,
|
|
3829
3631
|
FormControl as FormControl7,
|
|
3830
3632
|
FormField as FormField7,
|
|
@@ -3833,67 +3635,64 @@ import {
|
|
|
3833
3635
|
FormMessage as FormMessage7,
|
|
3834
3636
|
Input as Input6,
|
|
3835
3637
|
InputOTP,
|
|
3836
|
-
Spinner as
|
|
3638
|
+
Spinner as Spinner11
|
|
3837
3639
|
} 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";
|
|
3841
3640
|
|
|
3842
3641
|
// src/ui/shared/otp-input-group.tsx
|
|
3843
3642
|
import { InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "pelatform-ui/default";
|
|
3844
|
-
import { Fragment as Fragment14, jsx as
|
|
3643
|
+
import { Fragment as Fragment14, jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3845
3644
|
function OTPInputGroup({ otpSeparators = 0 }) {
|
|
3846
3645
|
if (otpSeparators === 0) {
|
|
3847
|
-
return /* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3646
|
+
return /* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3647
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 0 }),
|
|
3648
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 1 }),
|
|
3649
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 2 }),
|
|
3650
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 3 }),
|
|
3651
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 4 }),
|
|
3652
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 5 })
|
|
3854
3653
|
] });
|
|
3855
3654
|
}
|
|
3856
3655
|
if (otpSeparators === 1) {
|
|
3857
|
-
return /* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3861
|
-
/* @__PURE__ */
|
|
3656
|
+
return /* @__PURE__ */ jsxs31(Fragment14, { children: [
|
|
3657
|
+
/* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3658
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 0 }),
|
|
3659
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 1 }),
|
|
3660
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 2 })
|
|
3862
3661
|
] }),
|
|
3863
|
-
/* @__PURE__ */
|
|
3864
|
-
/* @__PURE__ */
|
|
3865
|
-
/* @__PURE__ */
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsx37(InputOTPSeparator, {}),
|
|
3663
|
+
/* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3664
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 3 }),
|
|
3665
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 4 }),
|
|
3666
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 5 })
|
|
3868
3667
|
] })
|
|
3869
3668
|
] });
|
|
3870
3669
|
}
|
|
3871
|
-
return /* @__PURE__ */
|
|
3872
|
-
/* @__PURE__ */
|
|
3873
|
-
/* @__PURE__ */
|
|
3874
|
-
/* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsxs31(Fragment14, { children: [
|
|
3671
|
+
/* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3672
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 0 }),
|
|
3673
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 1 })
|
|
3875
3674
|
] }),
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx37(InputOTPSeparator, {}),
|
|
3676
|
+
/* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3677
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 2 }),
|
|
3678
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 3 })
|
|
3880
3679
|
] }),
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
/* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3680
|
+
/* @__PURE__ */ jsx37(InputOTPSeparator, {}),
|
|
3681
|
+
/* @__PURE__ */ jsxs31(InputOTPGroup, { children: [
|
|
3682
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 4 }),
|
|
3683
|
+
/* @__PURE__ */ jsx37(InputOTPSlot, { index: 5 })
|
|
3885
3684
|
] })
|
|
3886
3685
|
] });
|
|
3887
3686
|
}
|
|
3888
3687
|
|
|
3889
3688
|
// src/ui/auth/email-otp.tsx
|
|
3890
|
-
import { jsx as
|
|
3689
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3891
3690
|
function EmailOTPForm(props) {
|
|
3892
|
-
const [email, setEmail] =
|
|
3691
|
+
const [email, setEmail] = useState14();
|
|
3893
3692
|
if (!email) {
|
|
3894
|
-
return /* @__PURE__ */
|
|
3693
|
+
return /* @__PURE__ */ jsx38(EmailForm, { ...props, setEmail });
|
|
3895
3694
|
}
|
|
3896
|
-
return /* @__PURE__ */
|
|
3695
|
+
return /* @__PURE__ */ jsx38(OTPForm, { ...props, email });
|
|
3897
3696
|
}
|
|
3898
3697
|
function EmailForm({
|
|
3899
3698
|
className,
|
|
@@ -3903,7 +3702,7 @@ function EmailForm({
|
|
|
3903
3702
|
setEmail
|
|
3904
3703
|
}) {
|
|
3905
3704
|
const { authClient } = useConfig();
|
|
3906
|
-
const t =
|
|
3705
|
+
const t = useTranslations32();
|
|
3907
3706
|
const formSchema = z7.object({
|
|
3908
3707
|
email: z7.email({
|
|
3909
3708
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
@@ -3916,7 +3715,7 @@ function EmailForm({
|
|
|
3916
3715
|
}
|
|
3917
3716
|
});
|
|
3918
3717
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
3919
|
-
|
|
3718
|
+
useEffect4(() => {
|
|
3920
3719
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
3921
3720
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
3922
3721
|
async function onSubmit({ email }) {
|
|
@@ -3926,29 +3725,29 @@ function EmailForm({
|
|
|
3926
3725
|
type: "sign-in",
|
|
3927
3726
|
fetchOptions: { throw: true }
|
|
3928
3727
|
});
|
|
3929
|
-
|
|
3728
|
+
AlertToast16({ message: t("systems.EMAIL_OTP_VERIFICATION_SENT") });
|
|
3930
3729
|
setEmail(email);
|
|
3931
3730
|
} catch (error) {
|
|
3932
|
-
|
|
3731
|
+
AlertToast16({
|
|
3933
3732
|
message: getTranslations({ error, t }),
|
|
3934
3733
|
icon: "destructive"
|
|
3935
3734
|
});
|
|
3936
3735
|
}
|
|
3937
3736
|
}
|
|
3938
|
-
return /* @__PURE__ */
|
|
3737
|
+
return /* @__PURE__ */ jsx38(Form8, { ...form, children: /* @__PURE__ */ jsxs32(
|
|
3939
3738
|
"form",
|
|
3940
3739
|
{
|
|
3941
3740
|
onSubmit: form.handleSubmit(onSubmit),
|
|
3942
|
-
className:
|
|
3741
|
+
className: cn30("grid w-full gap-6", className, classNames?.base),
|
|
3943
3742
|
children: [
|
|
3944
|
-
/* @__PURE__ */
|
|
3743
|
+
/* @__PURE__ */ jsx38(
|
|
3945
3744
|
FormField7,
|
|
3946
3745
|
{
|
|
3947
3746
|
control: form.control,
|
|
3948
3747
|
name: "email",
|
|
3949
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
3748
|
+
render: ({ field }) => /* @__PURE__ */ jsxs32(FormItem7, { children: [
|
|
3749
|
+
/* @__PURE__ */ jsx38(FormLabel6, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
3750
|
+
/* @__PURE__ */ jsx38(FormControl7, { children: /* @__PURE__ */ jsx38(
|
|
3952
3751
|
Input6,
|
|
3953
3752
|
{
|
|
3954
3753
|
type: "email",
|
|
@@ -3959,17 +3758,17 @@ function EmailForm({
|
|
|
3959
3758
|
...field
|
|
3960
3759
|
}
|
|
3961
3760
|
) }),
|
|
3962
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ jsx38(FormMessage7, { className: classNames?.error })
|
|
3963
3762
|
] })
|
|
3964
3763
|
}
|
|
3965
3764
|
),
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
|
|
3765
|
+
/* @__PURE__ */ jsx38(
|
|
3766
|
+
Button22,
|
|
3968
3767
|
{
|
|
3969
3768
|
type: "submit",
|
|
3970
|
-
className:
|
|
3769
|
+
className: cn30("w-full", classNames?.button, classNames?.primaryButton),
|
|
3971
3770
|
disabled: submitting,
|
|
3972
|
-
children: submitting ? /* @__PURE__ */
|
|
3771
|
+
children: submitting ? /* @__PURE__ */ jsx38(Spinner11, {}) : t("systems.EMAIL_OTP_SEND_ACTION")
|
|
3973
3772
|
}
|
|
3974
3773
|
)
|
|
3975
3774
|
]
|
|
@@ -3986,7 +3785,7 @@ function OTPForm({
|
|
|
3986
3785
|
email
|
|
3987
3786
|
}) {
|
|
3988
3787
|
const { authClient } = useConfig();
|
|
3989
|
-
const t =
|
|
3788
|
+
const t = useTranslations32();
|
|
3990
3789
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectTo);
|
|
3991
3790
|
const formSchema = z7.object({
|
|
3992
3791
|
code: z7.string().min(1, {
|
|
@@ -4002,7 +3801,7 @@ function OTPForm({
|
|
|
4002
3801
|
}
|
|
4003
3802
|
});
|
|
4004
3803
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4005
|
-
|
|
3804
|
+
useEffect4(() => {
|
|
4006
3805
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4007
3806
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4008
3807
|
async function onSubmit({ code }) {
|
|
@@ -4014,27 +3813,27 @@ function OTPForm({
|
|
|
4014
3813
|
});
|
|
4015
3814
|
await onSuccess();
|
|
4016
3815
|
} catch (error) {
|
|
4017
|
-
|
|
3816
|
+
AlertToast16({
|
|
4018
3817
|
message: getTranslations({ error, t }),
|
|
4019
3818
|
icon: "destructive"
|
|
4020
3819
|
});
|
|
4021
3820
|
form.reset();
|
|
4022
3821
|
}
|
|
4023
3822
|
}
|
|
4024
|
-
return /* @__PURE__ */
|
|
3823
|
+
return /* @__PURE__ */ jsx38(Form8, { ...form, children: /* @__PURE__ */ jsxs32(
|
|
4025
3824
|
"form",
|
|
4026
3825
|
{
|
|
4027
3826
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4028
|
-
className:
|
|
3827
|
+
className: cn30("grid w-full gap-6", className, classNames?.base),
|
|
4029
3828
|
children: [
|
|
4030
|
-
/* @__PURE__ */
|
|
3829
|
+
/* @__PURE__ */ jsx38(
|
|
4031
3830
|
FormField7,
|
|
4032
3831
|
{
|
|
4033
3832
|
control: form.control,
|
|
4034
3833
|
name: "code",
|
|
4035
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4036
|
-
/* @__PURE__ */
|
|
4037
|
-
/* @__PURE__ */
|
|
3834
|
+
render: ({ field }) => /* @__PURE__ */ jsxs32(FormItem7, { children: [
|
|
3835
|
+
/* @__PURE__ */ jsx38(FormLabel6, { className: classNames?.label, children: t("systems.EMAIL_OTP") }),
|
|
3836
|
+
/* @__PURE__ */ jsx38(FormControl7, { children: /* @__PURE__ */ jsx38(
|
|
4038
3837
|
InputOTP,
|
|
4039
3838
|
{
|
|
4040
3839
|
...field,
|
|
@@ -4048,20 +3847,20 @@ function OTPForm({
|
|
|
4048
3847
|
containerClassName: classNames?.otpInputContainer,
|
|
4049
3848
|
className: classNames?.otpInput,
|
|
4050
3849
|
disabled: submitting,
|
|
4051
|
-
children: /* @__PURE__ */
|
|
3850
|
+
children: /* @__PURE__ */ jsx38(OTPInputGroup, { otpSeparators })
|
|
4052
3851
|
}
|
|
4053
3852
|
) }),
|
|
4054
|
-
/* @__PURE__ */
|
|
3853
|
+
/* @__PURE__ */ jsx38(FormMessage7, { className: classNames?.error })
|
|
4055
3854
|
] })
|
|
4056
3855
|
}
|
|
4057
3856
|
),
|
|
4058
|
-
/* @__PURE__ */
|
|
4059
|
-
|
|
3857
|
+
/* @__PURE__ */ jsx38(
|
|
3858
|
+
Button22,
|
|
4060
3859
|
{
|
|
4061
3860
|
type: "submit",
|
|
4062
|
-
className:
|
|
3861
|
+
className: cn30("w-full", classNames?.button, classNames?.primaryButton),
|
|
4063
3862
|
disabled: submitting,
|
|
4064
|
-
children: submitting ? /* @__PURE__ */
|
|
3863
|
+
children: submitting ? /* @__PURE__ */ jsx38(Spinner11, {}) : t("systems.EMAIL_OTP_VERIFY_ACTION")
|
|
4065
3864
|
}
|
|
4066
3865
|
)
|
|
4067
3866
|
]
|
|
@@ -4070,13 +3869,16 @@ function OTPForm({
|
|
|
4070
3869
|
}
|
|
4071
3870
|
|
|
4072
3871
|
// src/ui/auth/forgot-password.tsx
|
|
4073
|
-
import { useEffect as
|
|
4074
|
-
import { useRouter as
|
|
3872
|
+
import { useEffect as useEffect5 } from "react";
|
|
3873
|
+
import { useRouter as useRouter9 } from "next/navigation";
|
|
4075
3874
|
import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
|
|
4076
|
-
import { useTranslations as
|
|
4077
|
-
import {
|
|
3875
|
+
import { useTranslations as useTranslations33 } from "next-intl";
|
|
3876
|
+
import { useForm as useForm9 } from "react-hook-form";
|
|
3877
|
+
import { z as z8 } from "zod";
|
|
3878
|
+
import { cn as cn31 } from "pelatform-ui";
|
|
3879
|
+
import { AlertToast as AlertToast17 } from "pelatform-ui/components";
|
|
4078
3880
|
import {
|
|
4079
|
-
Button as
|
|
3881
|
+
Button as Button23,
|
|
4080
3882
|
Form as Form9,
|
|
4081
3883
|
FormControl as FormControl8,
|
|
4082
3884
|
FormField as FormField8,
|
|
@@ -4084,12 +3886,9 @@ import {
|
|
|
4084
3886
|
FormLabel as FormLabel7,
|
|
4085
3887
|
FormMessage as FormMessage8,
|
|
4086
3888
|
Input as Input7,
|
|
4087
|
-
Spinner as
|
|
3889
|
+
Spinner as Spinner12
|
|
4088
3890
|
} from "pelatform-ui/default";
|
|
4089
|
-
import {
|
|
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";
|
|
3891
|
+
import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4093
3892
|
function ForgotPasswordForm({
|
|
4094
3893
|
className,
|
|
4095
3894
|
classNames,
|
|
@@ -4097,8 +3896,8 @@ function ForgotPasswordForm({
|
|
|
4097
3896
|
setIsSubmitting
|
|
4098
3897
|
}) {
|
|
4099
3898
|
const { authClient, app, path } = useConfig();
|
|
4100
|
-
const router =
|
|
4101
|
-
const t =
|
|
3899
|
+
const router = useRouter9();
|
|
3900
|
+
const t = useTranslations33();
|
|
4102
3901
|
const formSchema = z8.object({
|
|
4103
3902
|
email: z8.email({
|
|
4104
3903
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
@@ -4111,7 +3910,7 @@ function ForgotPasswordForm({
|
|
|
4111
3910
|
}
|
|
4112
3911
|
});
|
|
4113
3912
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
4114
|
-
|
|
3913
|
+
useEffect5(() => {
|
|
4115
3914
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
4116
3915
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
4117
3916
|
async function onSubmit({ email }) {
|
|
@@ -4121,31 +3920,31 @@ function ForgotPasswordForm({
|
|
|
4121
3920
|
redirectTo: `${app.url}${path.auth.RESET_PASSWORD}`,
|
|
4122
3921
|
fetchOptions: { throw: true }
|
|
4123
3922
|
});
|
|
4124
|
-
|
|
3923
|
+
AlertToast17({
|
|
4125
3924
|
message: t("systems.FORGOT_PASSWORD_EMAIL")
|
|
4126
3925
|
});
|
|
4127
3926
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
4128
3927
|
} catch (error) {
|
|
4129
|
-
|
|
3928
|
+
AlertToast17({
|
|
4130
3929
|
message: getTranslations({ error, t }),
|
|
4131
3930
|
icon: "destructive"
|
|
4132
3931
|
});
|
|
4133
3932
|
}
|
|
4134
3933
|
}
|
|
4135
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx39(Form9, { ...form, children: /* @__PURE__ */ jsxs33(
|
|
4136
3935
|
"form",
|
|
4137
3936
|
{
|
|
4138
3937
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4139
|
-
className:
|
|
3938
|
+
className: cn31("grid w-full gap-6", className, classNames?.base),
|
|
4140
3939
|
children: [
|
|
4141
|
-
/* @__PURE__ */
|
|
3940
|
+
/* @__PURE__ */ jsx39(
|
|
4142
3941
|
FormField8,
|
|
4143
3942
|
{
|
|
4144
3943
|
control: form.control,
|
|
4145
3944
|
name: "email",
|
|
4146
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
3945
|
+
render: ({ field }) => /* @__PURE__ */ jsxs33(FormItem8, { children: [
|
|
3946
|
+
/* @__PURE__ */ jsx39(FormLabel7, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
3947
|
+
/* @__PURE__ */ jsx39(FormControl8, { children: /* @__PURE__ */ jsx39(
|
|
4149
3948
|
Input7,
|
|
4150
3949
|
{
|
|
4151
3950
|
type: "email",
|
|
@@ -4156,17 +3955,17 @@ function ForgotPasswordForm({
|
|
|
4156
3955
|
...field
|
|
4157
3956
|
}
|
|
4158
3957
|
) }),
|
|
4159
|
-
/* @__PURE__ */
|
|
3958
|
+
/* @__PURE__ */ jsx39(FormMessage8, { className: classNames?.error })
|
|
4160
3959
|
] })
|
|
4161
3960
|
}
|
|
4162
3961
|
),
|
|
4163
|
-
/* @__PURE__ */
|
|
4164
|
-
|
|
3962
|
+
/* @__PURE__ */ jsx39(
|
|
3963
|
+
Button23,
|
|
4165
3964
|
{
|
|
4166
3965
|
type: "submit",
|
|
4167
|
-
className:
|
|
3966
|
+
className: cn31("w-full", classNames?.button, classNames?.primaryButton),
|
|
4168
3967
|
disabled: submitting,
|
|
4169
|
-
children: submitting ? /* @__PURE__ */
|
|
3968
|
+
children: submitting ? /* @__PURE__ */ jsx39(Spinner12, {}) : t("systems.FORGOT_PASSWORD_ACTION")
|
|
4170
3969
|
}
|
|
4171
3970
|
)
|
|
4172
3971
|
]
|
|
@@ -4175,13 +3974,16 @@ function ForgotPasswordForm({
|
|
|
4175
3974
|
}
|
|
4176
3975
|
|
|
4177
3976
|
// src/ui/auth/magic-link.tsx
|
|
4178
|
-
import { useEffect as
|
|
4179
|
-
import { useSearchParams as
|
|
3977
|
+
import { useEffect as useEffect6 } from "react";
|
|
3978
|
+
import { useSearchParams as useSearchParams3 } from "next/navigation";
|
|
4180
3979
|
import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
|
|
4181
|
-
import { useTranslations as
|
|
4182
|
-
import {
|
|
3980
|
+
import { useTranslations as useTranslations34 } from "next-intl";
|
|
3981
|
+
import { useForm as useForm10 } from "react-hook-form";
|
|
3982
|
+
import { z as z9 } from "zod";
|
|
3983
|
+
import { cn as cn32, REDIRECT_QUERY_PARAM as REDIRECT_QUERY_PARAM2 } from "pelatform-ui";
|
|
3984
|
+
import { AlertToast as AlertToast18 } from "pelatform-ui/components";
|
|
4183
3985
|
import {
|
|
4184
|
-
Button as
|
|
3986
|
+
Button as Button24,
|
|
4185
3987
|
Form as Form10,
|
|
4186
3988
|
FormControl as FormControl9,
|
|
4187
3989
|
FormField as FormField9,
|
|
@@ -4189,12 +3991,9 @@ import {
|
|
|
4189
3991
|
FormLabel as FormLabel8,
|
|
4190
3992
|
FormMessage as FormMessage9,
|
|
4191
3993
|
Input as Input8,
|
|
4192
|
-
Spinner as
|
|
3994
|
+
Spinner as Spinner13
|
|
4193
3995
|
} from "pelatform-ui/default";
|
|
4194
|
-
import {
|
|
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";
|
|
3996
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4198
3997
|
function MagicLinkForm({
|
|
4199
3998
|
className,
|
|
4200
3999
|
classNames,
|
|
@@ -4202,8 +4001,8 @@ function MagicLinkForm({
|
|
|
4202
4001
|
setIsSubmitting
|
|
4203
4002
|
}) {
|
|
4204
4003
|
const { authClient, app, path } = useConfig();
|
|
4205
|
-
const searchParams =
|
|
4206
|
-
const t =
|
|
4004
|
+
const searchParams = useSearchParams3();
|
|
4005
|
+
const t = useTranslations34();
|
|
4207
4006
|
const formSchema = z9.object({
|
|
4208
4007
|
email: z9.email({
|
|
4209
4008
|
error: `${t("systems.EMAIL")} ${t("systems.IS_INVALID")}`
|
|
@@ -4216,41 +4015,41 @@ function MagicLinkForm({
|
|
|
4216
4015
|
}
|
|
4217
4016
|
});
|
|
4218
4017
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
4219
|
-
|
|
4018
|
+
useEffect6(() => {
|
|
4220
4019
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
4221
4020
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
4222
4021
|
async function onSubmit({ email }) {
|
|
4223
4022
|
try {
|
|
4224
4023
|
await authClient.signIn.magicLink({
|
|
4225
4024
|
email,
|
|
4226
|
-
callbackURL: `${app.url}${path.auth.CALLBACK}?redirectTo=${searchParams?.get(
|
|
4025
|
+
callbackURL: `${app.url}${path.auth.CALLBACK}?redirectTo=${searchParams?.get(REDIRECT_QUERY_PARAM2)}`,
|
|
4227
4026
|
fetchOptions: { throw: true }
|
|
4228
4027
|
});
|
|
4229
|
-
|
|
4028
|
+
AlertToast18({
|
|
4230
4029
|
message: t("systems.MAGIC_LINK_EMAIL")
|
|
4231
4030
|
});
|
|
4232
4031
|
form.reset();
|
|
4233
4032
|
} catch (error) {
|
|
4234
|
-
|
|
4033
|
+
AlertToast18({
|
|
4235
4034
|
message: getTranslations({ error, t }),
|
|
4236
4035
|
icon: "destructive"
|
|
4237
4036
|
});
|
|
4238
4037
|
}
|
|
4239
4038
|
}
|
|
4240
|
-
return /* @__PURE__ */
|
|
4039
|
+
return /* @__PURE__ */ jsx40(Form10, { ...form, children: /* @__PURE__ */ jsxs34(
|
|
4241
4040
|
"form",
|
|
4242
4041
|
{
|
|
4243
4042
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4244
|
-
className:
|
|
4043
|
+
className: cn32("grid w-full gap-6", className, classNames?.base),
|
|
4245
4044
|
children: [
|
|
4246
|
-
/* @__PURE__ */
|
|
4045
|
+
/* @__PURE__ */ jsx40(
|
|
4247
4046
|
FormField9,
|
|
4248
4047
|
{
|
|
4249
4048
|
control: form.control,
|
|
4250
4049
|
name: "email",
|
|
4251
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4252
|
-
/* @__PURE__ */
|
|
4253
|
-
/* @__PURE__ */
|
|
4050
|
+
render: ({ field }) => /* @__PURE__ */ jsxs34(FormItem9, { children: [
|
|
4051
|
+
/* @__PURE__ */ jsx40(FormLabel8, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
4052
|
+
/* @__PURE__ */ jsx40(FormControl9, { children: /* @__PURE__ */ jsx40(
|
|
4254
4053
|
Input8,
|
|
4255
4054
|
{
|
|
4256
4055
|
type: "email",
|
|
@@ -4261,17 +4060,17 @@ function MagicLinkForm({
|
|
|
4261
4060
|
...field
|
|
4262
4061
|
}
|
|
4263
4062
|
) }),
|
|
4264
|
-
/* @__PURE__ */
|
|
4063
|
+
/* @__PURE__ */ jsx40(FormMessage9, { className: classNames?.error })
|
|
4265
4064
|
] })
|
|
4266
4065
|
}
|
|
4267
4066
|
),
|
|
4268
|
-
/* @__PURE__ */
|
|
4269
|
-
|
|
4067
|
+
/* @__PURE__ */ jsx40(
|
|
4068
|
+
Button24,
|
|
4270
4069
|
{
|
|
4271
4070
|
type: "submit",
|
|
4272
|
-
className:
|
|
4071
|
+
className: cn32("w-full", classNames?.button, classNames?.primaryButton),
|
|
4273
4072
|
disabled: submitting,
|
|
4274
|
-
children: submitting ? /* @__PURE__ */
|
|
4073
|
+
children: submitting ? /* @__PURE__ */ jsx40(Spinner13, {}) : t("systems.MAGIC_LINK_ACTION")
|
|
4275
4074
|
}
|
|
4276
4075
|
)
|
|
4277
4076
|
]
|
|
@@ -4280,12 +4079,15 @@ function MagicLinkForm({
|
|
|
4280
4079
|
}
|
|
4281
4080
|
|
|
4282
4081
|
// src/ui/auth/recover-account.tsx
|
|
4283
|
-
import { useEffect as
|
|
4082
|
+
import { useEffect as useEffect7 } from "react";
|
|
4284
4083
|
import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
|
|
4285
|
-
import { useTranslations as
|
|
4286
|
-
import {
|
|
4084
|
+
import { useTranslations as useTranslations35 } from "next-intl";
|
|
4085
|
+
import { useForm as useForm11 } from "react-hook-form";
|
|
4086
|
+
import { z as z10 } from "zod";
|
|
4087
|
+
import { cn as cn33 } from "pelatform-ui";
|
|
4088
|
+
import { AlertToast as AlertToast19 } from "pelatform-ui/components";
|
|
4287
4089
|
import {
|
|
4288
|
-
Button as
|
|
4090
|
+
Button as Button25,
|
|
4289
4091
|
Form as Form11,
|
|
4290
4092
|
FormControl as FormControl10,
|
|
4291
4093
|
FormField as FormField10,
|
|
@@ -4293,12 +4095,9 @@ import {
|
|
|
4293
4095
|
FormLabel as FormLabel9,
|
|
4294
4096
|
FormMessage as FormMessage10,
|
|
4295
4097
|
Input as Input9,
|
|
4296
|
-
Spinner as
|
|
4098
|
+
Spinner as Spinner14
|
|
4297
4099
|
} from "pelatform-ui/default";
|
|
4298
|
-
import {
|
|
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";
|
|
4100
|
+
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4302
4101
|
function RecoverAccountForm({
|
|
4303
4102
|
className,
|
|
4304
4103
|
classNames,
|
|
@@ -4307,7 +4106,7 @@ function RecoverAccountForm({
|
|
|
4307
4106
|
setIsSubmitting
|
|
4308
4107
|
}) {
|
|
4309
4108
|
const { authClient } = useConfig();
|
|
4310
|
-
const t =
|
|
4109
|
+
const t = useTranslations35();
|
|
4311
4110
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectTo);
|
|
4312
4111
|
const formSchema = z10.object({
|
|
4313
4112
|
code: z10.string().min(1, { error: t("systems.BACKUP_CODE_REQUIRED") })
|
|
@@ -4319,7 +4118,7 @@ function RecoverAccountForm({
|
|
|
4319
4118
|
}
|
|
4320
4119
|
});
|
|
4321
4120
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4322
|
-
|
|
4121
|
+
useEffect7(() => {
|
|
4323
4122
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4324
4123
|
}, [setIsSubmitting, form.formState.isSubmitting, transitionPending]);
|
|
4325
4124
|
async function onSubmit({ code }) {
|
|
@@ -4330,27 +4129,27 @@ function RecoverAccountForm({
|
|
|
4330
4129
|
});
|
|
4331
4130
|
await onSuccess();
|
|
4332
4131
|
} catch (error) {
|
|
4333
|
-
|
|
4132
|
+
AlertToast19({
|
|
4334
4133
|
message: getTranslations({ error, t }),
|
|
4335
4134
|
icon: "destructive"
|
|
4336
4135
|
});
|
|
4337
4136
|
form.reset();
|
|
4338
4137
|
}
|
|
4339
4138
|
}
|
|
4340
|
-
return /* @__PURE__ */
|
|
4139
|
+
return /* @__PURE__ */ jsx41(Form11, { ...form, children: /* @__PURE__ */ jsxs35(
|
|
4341
4140
|
"form",
|
|
4342
4141
|
{
|
|
4343
4142
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4344
|
-
className:
|
|
4143
|
+
className: cn33("grid w-full gap-6", className, classNames?.base),
|
|
4345
4144
|
children: [
|
|
4346
|
-
/* @__PURE__ */
|
|
4145
|
+
/* @__PURE__ */ jsx41(
|
|
4347
4146
|
FormField10,
|
|
4348
4147
|
{
|
|
4349
4148
|
control: form.control,
|
|
4350
4149
|
name: "code",
|
|
4351
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4150
|
+
render: ({ field }) => /* @__PURE__ */ jsxs35(FormItem10, { children: [
|
|
4151
|
+
/* @__PURE__ */ jsx41(FormLabel9, { className: classNames?.label, children: t("systems.BACKUP_CODE") }),
|
|
4152
|
+
/* @__PURE__ */ jsx41(FormControl10, { children: /* @__PURE__ */ jsx41(
|
|
4354
4153
|
Input9,
|
|
4355
4154
|
{
|
|
4356
4155
|
autoComplete: "off",
|
|
@@ -4360,17 +4159,17 @@ function RecoverAccountForm({
|
|
|
4360
4159
|
...field
|
|
4361
4160
|
}
|
|
4362
4161
|
) }),
|
|
4363
|
-
/* @__PURE__ */
|
|
4162
|
+
/* @__PURE__ */ jsx41(FormMessage10, { className: classNames?.error })
|
|
4364
4163
|
] })
|
|
4365
4164
|
}
|
|
4366
4165
|
),
|
|
4367
|
-
/* @__PURE__ */
|
|
4368
|
-
|
|
4166
|
+
/* @__PURE__ */ jsx41(
|
|
4167
|
+
Button25,
|
|
4369
4168
|
{
|
|
4370
4169
|
type: "submit",
|
|
4371
|
-
className:
|
|
4170
|
+
className: cn33("w-full", classNames?.button, classNames?.primaryButton),
|
|
4372
4171
|
disabled: submitting,
|
|
4373
|
-
children: submitting ? /* @__PURE__ */
|
|
4172
|
+
children: submitting ? /* @__PURE__ */ jsx41(Spinner14, {}) : t("systems.RECOVER_ACCOUNT_ACTION")
|
|
4374
4173
|
}
|
|
4375
4174
|
)
|
|
4376
4175
|
]
|
|
@@ -4379,25 +4178,25 @@ function RecoverAccountForm({
|
|
|
4379
4178
|
}
|
|
4380
4179
|
|
|
4381
4180
|
// src/ui/auth/reset-password.tsx
|
|
4382
|
-
import { useEffect as
|
|
4383
|
-
import { useRouter as
|
|
4181
|
+
import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef5 } from "react";
|
|
4182
|
+
import { useRouter as useRouter10, useSearchParams as useSearchParams4 } from "next/navigation";
|
|
4384
4183
|
import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
|
|
4385
|
-
import { useTranslations as
|
|
4386
|
-
import {
|
|
4184
|
+
import { useTranslations as useTranslations36 } from "next-intl";
|
|
4185
|
+
import { useForm as useForm12 } from "react-hook-form";
|
|
4186
|
+
import { z as z11 } from "zod";
|
|
4187
|
+
import { cn as cn34 } from "pelatform-ui";
|
|
4188
|
+
import { AlertToast as AlertToast20 } from "pelatform-ui/components";
|
|
4387
4189
|
import {
|
|
4388
|
-
Button as
|
|
4190
|
+
Button as Button26,
|
|
4389
4191
|
Form as Form12,
|
|
4390
4192
|
FormControl as FormControl11,
|
|
4391
4193
|
FormField as FormField11,
|
|
4392
4194
|
FormItem as FormItem11,
|
|
4393
4195
|
FormLabel as FormLabel10,
|
|
4394
4196
|
FormMessage as FormMessage11,
|
|
4395
|
-
Spinner as
|
|
4197
|
+
Spinner as Spinner15
|
|
4396
4198
|
} from "pelatform-ui/default";
|
|
4397
|
-
import {
|
|
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";
|
|
4199
|
+
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4401
4200
|
function ResetPasswordForm({
|
|
4402
4201
|
className,
|
|
4403
4202
|
classNames,
|
|
@@ -4405,9 +4204,9 @@ function ResetPasswordForm({
|
|
|
4405
4204
|
setIsSubmitting
|
|
4406
4205
|
}) {
|
|
4407
4206
|
const { authClient, path } = useConfig();
|
|
4408
|
-
const router =
|
|
4409
|
-
const searchParams =
|
|
4410
|
-
const t =
|
|
4207
|
+
const router = useRouter10();
|
|
4208
|
+
const searchParams = useSearchParams4();
|
|
4209
|
+
const t = useTranslations36();
|
|
4411
4210
|
const token = searchParams?.get("token");
|
|
4412
4211
|
const tokenChecked = useRef5(false);
|
|
4413
4212
|
const formSchema = useMemo3(
|
|
@@ -4428,14 +4227,14 @@ function ResetPasswordForm({
|
|
|
4428
4227
|
}
|
|
4429
4228
|
});
|
|
4430
4229
|
const submitting = isSubmitting || form.formState.isSubmitting;
|
|
4431
|
-
|
|
4230
|
+
useEffect8(() => {
|
|
4432
4231
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
4433
4232
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
4434
|
-
|
|
4233
|
+
useEffect8(() => {
|
|
4435
4234
|
if (tokenChecked.current) return;
|
|
4436
4235
|
tokenChecked.current = true;
|
|
4437
4236
|
if (!token || token === "INVALID_TOKEN") {
|
|
4438
|
-
|
|
4237
|
+
AlertToast20({
|
|
4439
4238
|
message: t("systems.INVALID_TOKEN"),
|
|
4440
4239
|
icon: "destructive"
|
|
4441
4240
|
});
|
|
@@ -4444,7 +4243,7 @@ function ResetPasswordForm({
|
|
|
4444
4243
|
}, [path.auth.SIGN_IN, router, t, token]);
|
|
4445
4244
|
async function onSubmit({ newPassword }) {
|
|
4446
4245
|
if (!token) {
|
|
4447
|
-
|
|
4246
|
+
AlertToast20({
|
|
4448
4247
|
message: t("systems.INVALID_TOKEN"),
|
|
4449
4248
|
icon: "destructive"
|
|
4450
4249
|
});
|
|
@@ -4456,32 +4255,32 @@ function ResetPasswordForm({
|
|
|
4456
4255
|
token,
|
|
4457
4256
|
fetchOptions: { throw: true }
|
|
4458
4257
|
});
|
|
4459
|
-
|
|
4258
|
+
AlertToast20({
|
|
4460
4259
|
message: t("systems.RESET_PASSWORD_SUCCESS")
|
|
4461
4260
|
});
|
|
4462
4261
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
4463
4262
|
} catch (error) {
|
|
4464
|
-
|
|
4263
|
+
AlertToast20({
|
|
4465
4264
|
message: getTranslations({ error, t }),
|
|
4466
4265
|
icon: "destructive"
|
|
4467
4266
|
});
|
|
4468
4267
|
form.reset();
|
|
4469
4268
|
}
|
|
4470
4269
|
}
|
|
4471
|
-
return /* @__PURE__ */
|
|
4270
|
+
return /* @__PURE__ */ jsx42(Form12, { ...form, children: /* @__PURE__ */ jsxs36(
|
|
4472
4271
|
"form",
|
|
4473
4272
|
{
|
|
4474
4273
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4475
|
-
className:
|
|
4274
|
+
className: cn34("grid w-full gap-6", className, classNames?.base),
|
|
4476
4275
|
children: [
|
|
4477
|
-
/* @__PURE__ */
|
|
4276
|
+
/* @__PURE__ */ jsx42(
|
|
4478
4277
|
FormField11,
|
|
4479
4278
|
{
|
|
4480
4279
|
control: form.control,
|
|
4481
4280
|
name: "newPassword",
|
|
4482
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4281
|
+
render: ({ field }) => /* @__PURE__ */ jsxs36(FormItem11, { children: [
|
|
4282
|
+
/* @__PURE__ */ jsx42(FormLabel10, { className: classNames?.label, children: t("systems.NEW_PASSWORD") }),
|
|
4283
|
+
/* @__PURE__ */ jsx42(FormControl11, { children: /* @__PURE__ */ jsx42(
|
|
4485
4284
|
PasswordInput,
|
|
4486
4285
|
{
|
|
4487
4286
|
autoComplete: "new-password",
|
|
@@ -4492,18 +4291,18 @@ function ResetPasswordForm({
|
|
|
4492
4291
|
...field
|
|
4493
4292
|
}
|
|
4494
4293
|
) }),
|
|
4495
|
-
/* @__PURE__ */
|
|
4294
|
+
/* @__PURE__ */ jsx42(FormMessage11, { className: classNames?.error })
|
|
4496
4295
|
] })
|
|
4497
4296
|
}
|
|
4498
4297
|
),
|
|
4499
|
-
/* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsx42(
|
|
4500
4299
|
FormField11,
|
|
4501
4300
|
{
|
|
4502
4301
|
control: form.control,
|
|
4503
4302
|
name: "confirmPassword",
|
|
4504
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4505
|
-
/* @__PURE__ */
|
|
4506
|
-
/* @__PURE__ */
|
|
4303
|
+
render: ({ field }) => /* @__PURE__ */ jsxs36(FormItem11, { children: [
|
|
4304
|
+
/* @__PURE__ */ jsx42(FormLabel10, { className: classNames?.label, children: t("systems.CONFIRM_PASSWORD") }),
|
|
4305
|
+
/* @__PURE__ */ jsx42(FormControl11, { children: /* @__PURE__ */ jsx42(
|
|
4507
4306
|
PasswordInput,
|
|
4508
4307
|
{
|
|
4509
4308
|
autoComplete: "new-password",
|
|
@@ -4514,17 +4313,17 @@ function ResetPasswordForm({
|
|
|
4514
4313
|
...field
|
|
4515
4314
|
}
|
|
4516
4315
|
) }),
|
|
4517
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx42(FormMessage11, { className: classNames?.error })
|
|
4518
4317
|
] })
|
|
4519
4318
|
}
|
|
4520
4319
|
),
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
|
|
4320
|
+
/* @__PURE__ */ jsx42(
|
|
4321
|
+
Button26,
|
|
4523
4322
|
{
|
|
4524
4323
|
type: "submit",
|
|
4525
|
-
className:
|
|
4324
|
+
className: cn34("w-full", classNames?.button, classNames?.primaryButton),
|
|
4526
4325
|
disabled: submitting || !token,
|
|
4527
|
-
children: submitting ? /* @__PURE__ */
|
|
4326
|
+
children: submitting ? /* @__PURE__ */ jsx42(Spinner15, {}) : t("systems.RESET_PASSWORD_ACTION")
|
|
4528
4327
|
}
|
|
4529
4328
|
)
|
|
4530
4329
|
]
|
|
@@ -4533,14 +4332,17 @@ function ResetPasswordForm({
|
|
|
4533
4332
|
}
|
|
4534
4333
|
|
|
4535
4334
|
// src/ui/auth/sign-in.tsx
|
|
4536
|
-
import { useEffect as
|
|
4335
|
+
import { useEffect as useEffect9 } from "react";
|
|
4537
4336
|
import Link from "next/link";
|
|
4538
|
-
import { useRouter as
|
|
4337
|
+
import { useRouter as useRouter11 } from "next/navigation";
|
|
4539
4338
|
import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
|
|
4540
|
-
import { useTranslations as
|
|
4541
|
-
import {
|
|
4339
|
+
import { useTranslations as useTranslations37 } from "next-intl";
|
|
4340
|
+
import { useForm as useForm13 } from "react-hook-form";
|
|
4341
|
+
import { z as z12 } from "zod";
|
|
4342
|
+
import { cn as cn35, validateEmail } from "pelatform-ui";
|
|
4343
|
+
import { AlertToast as AlertToast21 } from "pelatform-ui/components";
|
|
4542
4344
|
import {
|
|
4543
|
-
Button as
|
|
4345
|
+
Button as Button27,
|
|
4544
4346
|
Checkbox as Checkbox2,
|
|
4545
4347
|
Form as Form13,
|
|
4546
4348
|
FormControl as FormControl12,
|
|
@@ -4549,12 +4351,9 @@ import {
|
|
|
4549
4351
|
FormLabel as FormLabel11,
|
|
4550
4352
|
FormMessage as FormMessage12,
|
|
4551
4353
|
Input as Input10,
|
|
4552
|
-
Spinner as
|
|
4354
|
+
Spinner as Spinner16
|
|
4553
4355
|
} from "pelatform-ui/default";
|
|
4554
|
-
import {
|
|
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";
|
|
4356
|
+
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4558
4357
|
function SignInForm({
|
|
4559
4358
|
className,
|
|
4560
4359
|
classNames,
|
|
@@ -4563,8 +4362,8 @@ function SignInForm({
|
|
|
4563
4362
|
setIsSubmitting
|
|
4564
4363
|
}) {
|
|
4565
4364
|
const { authClient, auth, path } = useConfig();
|
|
4566
|
-
const t =
|
|
4567
|
-
const router =
|
|
4365
|
+
const t = useTranslations37();
|
|
4366
|
+
const router = useRouter11();
|
|
4568
4367
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectToProp);
|
|
4569
4368
|
const usernameEnabled = auth.authentication.username;
|
|
4570
4369
|
const formSchema = z12.object({
|
|
@@ -4585,7 +4384,7 @@ function SignInForm({
|
|
|
4585
4384
|
}
|
|
4586
4385
|
});
|
|
4587
4386
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4588
|
-
|
|
4387
|
+
useEffect9(() => {
|
|
4589
4388
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4590
4389
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4591
4390
|
async function onSubmit({ email, password, rememberMe }) {
|
|
@@ -4613,27 +4412,27 @@ function SignInForm({
|
|
|
4613
4412
|
await onSuccess();
|
|
4614
4413
|
}
|
|
4615
4414
|
} catch (error) {
|
|
4616
|
-
|
|
4415
|
+
AlertToast21({
|
|
4617
4416
|
message: getTranslations({ error, t }),
|
|
4618
4417
|
icon: "destructive"
|
|
4619
4418
|
});
|
|
4620
4419
|
form.resetField("password");
|
|
4621
4420
|
}
|
|
4622
4421
|
}
|
|
4623
|
-
return /* @__PURE__ */
|
|
4422
|
+
return /* @__PURE__ */ jsx43(Form13, { ...form, children: /* @__PURE__ */ jsxs37(
|
|
4624
4423
|
"form",
|
|
4625
4424
|
{
|
|
4626
4425
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4627
|
-
className:
|
|
4426
|
+
className: cn35("grid w-full gap-6", className, classNames?.base),
|
|
4628
4427
|
children: [
|
|
4629
|
-
/* @__PURE__ */
|
|
4428
|
+
/* @__PURE__ */ jsx43(
|
|
4630
4429
|
FormField12,
|
|
4631
4430
|
{
|
|
4632
4431
|
control: form.control,
|
|
4633
4432
|
name: "email",
|
|
4634
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4433
|
+
render: ({ field }) => /* @__PURE__ */ jsxs37(FormItem12, { children: [
|
|
4434
|
+
/* @__PURE__ */ jsx43(FormLabel11, { className: classNames?.label, children: usernameEnabled ? t("systems.USERNAME") : t("systems.EMAIL") }),
|
|
4435
|
+
/* @__PURE__ */ jsx43(FormControl12, { children: /* @__PURE__ */ jsx43(
|
|
4637
4436
|
Input10,
|
|
4638
4437
|
{
|
|
4639
4438
|
type: usernameEnabled ? "text" : "email",
|
|
@@ -4644,30 +4443,30 @@ function SignInForm({
|
|
|
4644
4443
|
...field
|
|
4645
4444
|
}
|
|
4646
4445
|
) }),
|
|
4647
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsx43(FormMessage12, { className: classNames?.error })
|
|
4648
4447
|
] })
|
|
4649
4448
|
}
|
|
4650
4449
|
),
|
|
4651
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx43(
|
|
4652
4451
|
FormField12,
|
|
4653
4452
|
{
|
|
4654
4453
|
control: form.control,
|
|
4655
4454
|
name: "password",
|
|
4656
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
|
|
4455
|
+
render: ({ field }) => /* @__PURE__ */ jsxs37(FormItem12, { children: [
|
|
4456
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between", children: [
|
|
4457
|
+
/* @__PURE__ */ jsx43(FormLabel11, { className: classNames?.label, children: t("systems.PASSWORD") }),
|
|
4458
|
+
/* @__PURE__ */ jsx43(Link, { href: `${path.auth.FORGOT_PASSWORD}${window.location.search}`, children: /* @__PURE__ */ jsx43(
|
|
4459
|
+
Button27,
|
|
4661
4460
|
{
|
|
4662
4461
|
mode: "link",
|
|
4663
4462
|
underline: "dashed",
|
|
4664
4463
|
size: "sm",
|
|
4665
|
-
className:
|
|
4464
|
+
className: cn35("px-0 text-foreground text-sm", classNames?.forgotPasswordLink),
|
|
4666
4465
|
children: t("systems.FORGOT_PASSWORD_LINK")
|
|
4667
4466
|
}
|
|
4668
4467
|
) })
|
|
4669
4468
|
] }),
|
|
4670
|
-
/* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsx43(FormControl12, { children: /* @__PURE__ */ jsx43(
|
|
4671
4470
|
PasswordInput,
|
|
4672
4471
|
{
|
|
4673
4472
|
autoComplete: "current-password",
|
|
@@ -4678,17 +4477,17 @@ function SignInForm({
|
|
|
4678
4477
|
...field
|
|
4679
4478
|
}
|
|
4680
4479
|
) }),
|
|
4681
|
-
/* @__PURE__ */
|
|
4480
|
+
/* @__PURE__ */ jsx43(FormMessage12, { className: classNames?.error })
|
|
4682
4481
|
] })
|
|
4683
4482
|
}
|
|
4684
4483
|
),
|
|
4685
|
-
/* @__PURE__ */
|
|
4484
|
+
/* @__PURE__ */ jsx43(
|
|
4686
4485
|
FormField12,
|
|
4687
4486
|
{
|
|
4688
4487
|
control: form.control,
|
|
4689
4488
|
name: "rememberMe",
|
|
4690
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */
|
|
4489
|
+
render: ({ field }) => /* @__PURE__ */ jsx43(FormItem12, { children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center space-x-2", children: [
|
|
4490
|
+
/* @__PURE__ */ jsx43(FormControl12, { children: /* @__PURE__ */ jsx43(
|
|
4692
4491
|
Checkbox2,
|
|
4693
4492
|
{
|
|
4694
4493
|
checked: field.value,
|
|
@@ -4696,18 +4495,18 @@ function SignInForm({
|
|
|
4696
4495
|
disabled: submitting
|
|
4697
4496
|
}
|
|
4698
4497
|
) }),
|
|
4699
|
-
/* @__PURE__ */
|
|
4498
|
+
/* @__PURE__ */ jsx43(FormLabel11, { children: t("systems.REMEMBER_ME") })
|
|
4700
4499
|
] }) })
|
|
4701
4500
|
}
|
|
4702
4501
|
),
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
|
|
4502
|
+
/* @__PURE__ */ jsxs37(
|
|
4503
|
+
Button27,
|
|
4705
4504
|
{
|
|
4706
4505
|
type: "submit",
|
|
4707
|
-
className:
|
|
4506
|
+
className: cn35("relative w-full", classNames?.button, classNames?.primaryButton),
|
|
4708
4507
|
disabled: submitting,
|
|
4709
4508
|
children: [
|
|
4710
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsx43(
|
|
4711
4510
|
LastUsedButton,
|
|
4712
4511
|
{
|
|
4713
4512
|
className: classNames?.lastLoginMethod,
|
|
@@ -4715,7 +4514,7 @@ function SignInForm({
|
|
|
4715
4514
|
variant: "secondary"
|
|
4716
4515
|
}
|
|
4717
4516
|
),
|
|
4718
|
-
submitting ? /* @__PURE__ */
|
|
4517
|
+
submitting ? /* @__PURE__ */ jsx43(Spinner16, {}) : t("systems.SIGN_IN_ACTION")
|
|
4719
4518
|
]
|
|
4720
4519
|
}
|
|
4721
4520
|
)
|
|
@@ -4725,29 +4524,32 @@ function SignInForm({
|
|
|
4725
4524
|
}
|
|
4726
4525
|
|
|
4727
4526
|
// src/ui/auth/sign-out.tsx
|
|
4728
|
-
import { useEffect as
|
|
4729
|
-
import { Spinner as
|
|
4730
|
-
import { jsx as
|
|
4527
|
+
import { useEffect as useEffect10, useRef as useRef6 } from "react";
|
|
4528
|
+
import { Spinner as Spinner17 } from "pelatform-ui/default";
|
|
4529
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
4731
4530
|
function SignOut({ redirectTo }) {
|
|
4732
4531
|
const { authClient, auth } = useConfig();
|
|
4733
4532
|
const { onSuccess } = useOnSuccessTransition(redirectTo || auth.redirectAfterLogout || "/");
|
|
4734
4533
|
const signingOut = useRef6(false);
|
|
4735
|
-
|
|
4534
|
+
useEffect10(() => {
|
|
4736
4535
|
if (signingOut.current) return;
|
|
4737
4536
|
signingOut.current = true;
|
|
4738
4537
|
authClient.signOut().finally(onSuccess);
|
|
4739
4538
|
}, [authClient, onSuccess]);
|
|
4740
|
-
return /* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ jsx44("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx44(Spinner17, { className: "size-12" }) });
|
|
4741
4540
|
}
|
|
4742
4541
|
|
|
4743
4542
|
// src/ui/auth/sign-up.tsx
|
|
4744
|
-
import { useEffect as
|
|
4745
|
-
import { useRouter as
|
|
4543
|
+
import { useEffect as useEffect11 } from "react";
|
|
4544
|
+
import { useRouter as useRouter12 } from "next/navigation";
|
|
4746
4545
|
import { zodResolver as zodResolver13 } from "@hookform/resolvers/zod";
|
|
4747
|
-
import { useTranslations as
|
|
4748
|
-
import {
|
|
4546
|
+
import { useTranslations as useTranslations38 } from "next-intl";
|
|
4547
|
+
import { useForm as useForm14 } from "react-hook-form";
|
|
4548
|
+
import { z as z13 } from "zod";
|
|
4549
|
+
import { cn as cn36 } from "pelatform-ui";
|
|
4550
|
+
import { AlertToast as AlertToast22 } from "pelatform-ui/components";
|
|
4749
4551
|
import {
|
|
4750
|
-
Button as
|
|
4552
|
+
Button as Button28,
|
|
4751
4553
|
Form as Form14,
|
|
4752
4554
|
FormControl as FormControl13,
|
|
4753
4555
|
FormField as FormField13,
|
|
@@ -4755,12 +4557,9 @@ import {
|
|
|
4755
4557
|
FormLabel as FormLabel12,
|
|
4756
4558
|
FormMessage as FormMessage13,
|
|
4757
4559
|
Input as Input11,
|
|
4758
|
-
Spinner as
|
|
4560
|
+
Spinner as Spinner18
|
|
4759
4561
|
} from "pelatform-ui/default";
|
|
4760
|
-
import {
|
|
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";
|
|
4562
|
+
import { jsx as jsx45, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4764
4563
|
function SignUpForm({
|
|
4765
4564
|
className,
|
|
4766
4565
|
classNames,
|
|
@@ -4769,8 +4568,8 @@ function SignUpForm({
|
|
|
4769
4568
|
setIsSubmitting
|
|
4770
4569
|
}) {
|
|
4771
4570
|
const { authClient, app, path } = useConfig();
|
|
4772
|
-
const t =
|
|
4773
|
-
const router =
|
|
4571
|
+
const t = useTranslations38();
|
|
4572
|
+
const router = useRouter12();
|
|
4774
4573
|
const {
|
|
4775
4574
|
onSuccess,
|
|
4776
4575
|
isPending: transitionPending,
|
|
@@ -4794,7 +4593,7 @@ function SignUpForm({
|
|
|
4794
4593
|
}
|
|
4795
4594
|
});
|
|
4796
4595
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4797
|
-
|
|
4596
|
+
useEffect11(() => {
|
|
4798
4597
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4799
4598
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4800
4599
|
async function onSubmit({ name, email, password }) {
|
|
@@ -4809,33 +4608,33 @@ function SignUpForm({
|
|
|
4809
4608
|
if ("token" in data && data.token) {
|
|
4810
4609
|
await onSuccess();
|
|
4811
4610
|
} else {
|
|
4812
|
-
|
|
4611
|
+
AlertToast22({
|
|
4813
4612
|
message: t("systems.SIGN_UP_EMAIL")
|
|
4814
4613
|
});
|
|
4815
4614
|
router.push(`${path.auth.SIGN_IN}${window.location.search}`);
|
|
4816
4615
|
}
|
|
4817
4616
|
} catch (error) {
|
|
4818
|
-
|
|
4617
|
+
AlertToast22({
|
|
4819
4618
|
message: getTranslations({ error, t }),
|
|
4820
4619
|
icon: "destructive"
|
|
4821
4620
|
});
|
|
4822
4621
|
form.resetField("password");
|
|
4823
4622
|
}
|
|
4824
4623
|
}
|
|
4825
|
-
return /* @__PURE__ */
|
|
4624
|
+
return /* @__PURE__ */ jsx45(Form14, { ...form, children: /* @__PURE__ */ jsxs38(
|
|
4826
4625
|
"form",
|
|
4827
4626
|
{
|
|
4828
4627
|
onSubmit: form.handleSubmit(onSubmit),
|
|
4829
|
-
className:
|
|
4628
|
+
className: cn36("grid w-full gap-6", className, classNames?.base),
|
|
4830
4629
|
children: [
|
|
4831
|
-
/* @__PURE__ */
|
|
4630
|
+
/* @__PURE__ */ jsx45(
|
|
4832
4631
|
FormField13,
|
|
4833
4632
|
{
|
|
4834
4633
|
control: form.control,
|
|
4835
4634
|
name: "name",
|
|
4836
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4837
|
-
/* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4635
|
+
render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem13, { children: [
|
|
4636
|
+
/* @__PURE__ */ jsx45(FormLabel12, { className: classNames?.label, children: t("systems.NAME") }),
|
|
4637
|
+
/* @__PURE__ */ jsx45(FormControl13, { children: /* @__PURE__ */ jsx45(
|
|
4839
4638
|
Input11,
|
|
4840
4639
|
{
|
|
4841
4640
|
type: "text",
|
|
@@ -4846,18 +4645,18 @@ function SignUpForm({
|
|
|
4846
4645
|
...field
|
|
4847
4646
|
}
|
|
4848
4647
|
) }),
|
|
4849
|
-
/* @__PURE__ */
|
|
4648
|
+
/* @__PURE__ */ jsx45(FormMessage13, { className: classNames?.error })
|
|
4850
4649
|
] })
|
|
4851
4650
|
}
|
|
4852
4651
|
),
|
|
4853
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ jsx45(
|
|
4854
4653
|
FormField13,
|
|
4855
4654
|
{
|
|
4856
4655
|
control: form.control,
|
|
4857
4656
|
name: "email",
|
|
4858
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
/* @__PURE__ */
|
|
4657
|
+
render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem13, { children: [
|
|
4658
|
+
/* @__PURE__ */ jsx45(FormLabel12, { className: classNames?.label, children: t("systems.EMAIL") }),
|
|
4659
|
+
/* @__PURE__ */ jsx45(FormControl13, { children: /* @__PURE__ */ jsx45(
|
|
4861
4660
|
Input11,
|
|
4862
4661
|
{
|
|
4863
4662
|
type: "email",
|
|
@@ -4868,18 +4667,18 @@ function SignUpForm({
|
|
|
4868
4667
|
...field
|
|
4869
4668
|
}
|
|
4870
4669
|
) }),
|
|
4871
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsx45(FormMessage13, { className: classNames?.error })
|
|
4872
4671
|
] })
|
|
4873
4672
|
}
|
|
4874
4673
|
),
|
|
4875
|
-
/* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx45(
|
|
4876
4675
|
FormField13,
|
|
4877
4676
|
{
|
|
4878
4677
|
control: form.control,
|
|
4879
4678
|
name: "password",
|
|
4880
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4679
|
+
render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem13, { children: [
|
|
4680
|
+
/* @__PURE__ */ jsx45(FormLabel12, { className: classNames?.label, children: t("systems.PASSWORD") }),
|
|
4681
|
+
/* @__PURE__ */ jsx45(FormControl13, { children: /* @__PURE__ */ jsx45(
|
|
4883
4682
|
PasswordInput,
|
|
4884
4683
|
{
|
|
4885
4684
|
autoComplete: "new-password",
|
|
@@ -4890,17 +4689,17 @@ function SignUpForm({
|
|
|
4890
4689
|
...field
|
|
4891
4690
|
}
|
|
4892
4691
|
) }),
|
|
4893
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsx45(FormMessage13, { className: classNames?.error })
|
|
4894
4693
|
] })
|
|
4895
4694
|
}
|
|
4896
4695
|
),
|
|
4897
|
-
/* @__PURE__ */
|
|
4898
|
-
|
|
4696
|
+
/* @__PURE__ */ jsx45(
|
|
4697
|
+
Button28,
|
|
4899
4698
|
{
|
|
4900
4699
|
type: "submit",
|
|
4901
|
-
className:
|
|
4700
|
+
className: cn36("w-full", classNames?.button, classNames?.primaryButton),
|
|
4902
4701
|
disabled: submitting,
|
|
4903
|
-
children: submitting ? /* @__PURE__ */
|
|
4702
|
+
children: submitting ? /* @__PURE__ */ jsx45(Spinner18, {}) : t("systems.SIGN_UP_ACTION")
|
|
4904
4703
|
}
|
|
4905
4704
|
)
|
|
4906
4705
|
]
|
|
@@ -4909,15 +4708,19 @@ function SignUpForm({
|
|
|
4909
4708
|
}
|
|
4910
4709
|
|
|
4911
4710
|
// src/ui/auth/two-factor.tsx
|
|
4912
|
-
import { useCallback as useCallback2, useEffect as
|
|
4711
|
+
import { useCallback as useCallback2, useEffect as useEffect12, useMemo as useMemo4, useRef as useRef7, useState as useState15 } from "react";
|
|
4913
4712
|
import Link2 from "next/link";
|
|
4914
|
-
import { useSearchParams as
|
|
4713
|
+
import { useSearchParams as useSearchParams5 } from "next/navigation";
|
|
4915
4714
|
import { zodResolver as zodResolver14 } from "@hookform/resolvers/zod";
|
|
4916
4715
|
import { QrCodeIcon, SendIcon } from "lucide-react";
|
|
4917
|
-
import { useTranslations as
|
|
4918
|
-
import
|
|
4716
|
+
import { useTranslations as useTranslations39 } from "next-intl";
|
|
4717
|
+
import QRCode from "qrcode";
|
|
4718
|
+
import { useForm as useForm15 } from "react-hook-form";
|
|
4719
|
+
import { z as z14 } from "zod";
|
|
4720
|
+
import { cn as cn37 } from "pelatform-ui";
|
|
4721
|
+
import { AlertToast as AlertToast23 } from "pelatform-ui/components";
|
|
4919
4722
|
import {
|
|
4920
|
-
Button as
|
|
4723
|
+
Button as Button29,
|
|
4921
4724
|
Checkbox as Checkbox3,
|
|
4922
4725
|
Form as Form15,
|
|
4923
4726
|
FormControl as FormControl14,
|
|
@@ -4927,13 +4730,9 @@ import {
|
|
|
4927
4730
|
FormMessage as FormMessage14,
|
|
4928
4731
|
InputOTP as InputOTP2,
|
|
4929
4732
|
Label,
|
|
4930
|
-
Spinner as
|
|
4733
|
+
Spinner as Spinner19
|
|
4931
4734
|
} from "pelatform-ui/default";
|
|
4932
|
-
import
|
|
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";
|
|
4735
|
+
import { Fragment as Fragment15, jsx as jsx46, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4937
4736
|
function TwoFactorForm({
|
|
4938
4737
|
className,
|
|
4939
4738
|
classNames,
|
|
@@ -4943,16 +4742,16 @@ function TwoFactorForm({
|
|
|
4943
4742
|
setIsSubmitting
|
|
4944
4743
|
}) {
|
|
4945
4744
|
const { authClient, path } = useConfig();
|
|
4946
|
-
const searchParams =
|
|
4947
|
-
const t =
|
|
4745
|
+
const searchParams = useSearchParams5();
|
|
4746
|
+
const t = useTranslations39();
|
|
4948
4747
|
const { user } = useSession();
|
|
4949
4748
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition(redirectToProp);
|
|
4950
4749
|
const totpURI = searchParams?.get("totpURI");
|
|
4951
4750
|
const isTwoFactorEnabled = user?.twoFactorEnabled;
|
|
4952
4751
|
const initialSendRef = useRef7(false);
|
|
4953
|
-
const [method, setMethod] =
|
|
4954
|
-
const [isSendingOtp, setIsSendingOtp] =
|
|
4955
|
-
const [cooldownSeconds, setCooldownSeconds] =
|
|
4752
|
+
const [method, setMethod] = useState15("totp");
|
|
4753
|
+
const [isSendingOtp, setIsSendingOtp] = useState15(false);
|
|
4754
|
+
const [cooldownSeconds, setCooldownSeconds] = useState15(0);
|
|
4956
4755
|
const formSchema = z14.object({
|
|
4957
4756
|
code: z14.string().min(1, {
|
|
4958
4757
|
error: `${t("systems.ONE_TIME_PASSWORD")} ${t("systems.IS_REQUIRED")}`
|
|
@@ -4969,16 +4768,16 @@ function TwoFactorForm({
|
|
|
4969
4768
|
}
|
|
4970
4769
|
});
|
|
4971
4770
|
const submitting = isSubmitting || form.formState.isSubmitting || transitionPending;
|
|
4972
|
-
|
|
4771
|
+
useEffect12(() => {
|
|
4973
4772
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
4974
4773
|
}, [form.formState.isSubmitting, setIsSubmitting, transitionPending]);
|
|
4975
|
-
|
|
4774
|
+
useEffect12(() => {
|
|
4976
4775
|
if (method === "otp" && cooldownSeconds <= 0 && !initialSendRef.current) {
|
|
4977
4776
|
initialSendRef.current = true;
|
|
4978
4777
|
sendOtp();
|
|
4979
4778
|
}
|
|
4980
4779
|
}, [method]);
|
|
4981
|
-
|
|
4780
|
+
useEffect12(() => {
|
|
4982
4781
|
if (cooldownSeconds <= 0) return;
|
|
4983
4782
|
const timer = setTimeout(() => {
|
|
4984
4783
|
setCooldownSeconds((prev) => prev - 1);
|
|
@@ -4994,7 +4793,7 @@ function TwoFactorForm({
|
|
|
4994
4793
|
});
|
|
4995
4794
|
setCooldownSeconds(60);
|
|
4996
4795
|
} catch (error) {
|
|
4997
|
-
|
|
4796
|
+
AlertToast23({
|
|
4998
4797
|
message: getTranslations({ error, t }),
|
|
4999
4798
|
icon: "destructive"
|
|
5000
4799
|
});
|
|
@@ -5015,47 +4814,47 @@ function TwoFactorForm({
|
|
|
5015
4814
|
});
|
|
5016
4815
|
await onSuccess();
|
|
5017
4816
|
if (user && !isTwoFactorEnabled) {
|
|
5018
|
-
|
|
4817
|
+
AlertToast23({
|
|
5019
4818
|
message: t("systems.TWO_FACTOR_ENABLED")
|
|
5020
4819
|
});
|
|
5021
4820
|
}
|
|
5022
4821
|
} catch (error) {
|
|
5023
|
-
|
|
4822
|
+
AlertToast23({
|
|
5024
4823
|
message: getTranslations({ error, t }),
|
|
5025
4824
|
icon: "destructive"
|
|
5026
4825
|
});
|
|
5027
4826
|
form.reset();
|
|
5028
4827
|
}
|
|
5029
4828
|
}
|
|
5030
|
-
return /* @__PURE__ */
|
|
4829
|
+
return /* @__PURE__ */ jsx46(Form15, { ...form, children: /* @__PURE__ */ jsxs39(
|
|
5031
4830
|
"form",
|
|
5032
4831
|
{
|
|
5033
4832
|
onSubmit: form.handleSubmit(onSubmit),
|
|
5034
|
-
className:
|
|
4833
|
+
className: cn37("grid w-full gap-6", className, classNames?.base),
|
|
5035
4834
|
children: [
|
|
5036
|
-
totpURI && method === "totp" && /* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
4835
|
+
totpURI && method === "totp" && /* @__PURE__ */ jsxs39("div", { className: "space-y-3", children: [
|
|
4836
|
+
/* @__PURE__ */ jsx46(Label, { className: cn37("block", classNames?.label), children: t("systems.TWO_FACTOR_TOTP_LABEL") }),
|
|
4837
|
+
/* @__PURE__ */ jsx46(QRCodeComponent, { className: classNames?.qrCode, value: totpURI })
|
|
5039
4838
|
] }),
|
|
5040
|
-
method !== null && /* @__PURE__ */
|
|
5041
|
-
/* @__PURE__ */
|
|
4839
|
+
method !== null && /* @__PURE__ */ jsxs39(Fragment15, { children: [
|
|
4840
|
+
/* @__PURE__ */ jsx46(
|
|
5042
4841
|
FormField14,
|
|
5043
4842
|
{
|
|
5044
4843
|
control: form.control,
|
|
5045
4844
|
name: "code",
|
|
5046
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
4845
|
+
render: ({ field }) => /* @__PURE__ */ jsxs39(FormItem14, { children: [
|
|
4846
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between", children: [
|
|
4847
|
+
/* @__PURE__ */ jsx46(FormLabel13, { className: classNames?.label, children: t("systems.ONE_TIME_PASSWORD") }),
|
|
4848
|
+
/* @__PURE__ */ jsx46(
|
|
5050
4849
|
Link2,
|
|
5051
4850
|
{
|
|
5052
|
-
className:
|
|
4851
|
+
className: cn37("text-sm hover:underline", classNames?.forgotPasswordLink),
|
|
5053
4852
|
href: `${path.auth.RECOVER_ACCOUNT}${window.location.search}`,
|
|
5054
4853
|
children: t("systems.FORGOT_AUTHENTICATOR")
|
|
5055
4854
|
}
|
|
5056
4855
|
)
|
|
5057
4856
|
] }),
|
|
5058
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsx46(FormControl14, { children: /* @__PURE__ */ jsx46(
|
|
5059
4858
|
InputOTP2,
|
|
5060
4859
|
{
|
|
5061
4860
|
...field,
|
|
@@ -5069,20 +4868,20 @@ function TwoFactorForm({
|
|
|
5069
4868
|
containerClassName: classNames?.otpInputContainer,
|
|
5070
4869
|
className: classNames?.otpInput,
|
|
5071
4870
|
disabled: submitting,
|
|
5072
|
-
children: /* @__PURE__ */
|
|
4871
|
+
children: /* @__PURE__ */ jsx46(OTPInputGroup, { otpSeparators })
|
|
5073
4872
|
}
|
|
5074
4873
|
) }),
|
|
5075
|
-
/* @__PURE__ */
|
|
4874
|
+
/* @__PURE__ */ jsx46(FormMessage14, { className: classNames?.error })
|
|
5076
4875
|
] })
|
|
5077
4876
|
}
|
|
5078
4877
|
),
|
|
5079
|
-
/* @__PURE__ */
|
|
4878
|
+
/* @__PURE__ */ jsx46(
|
|
5080
4879
|
FormField14,
|
|
5081
4880
|
{
|
|
5082
4881
|
control: form.control,
|
|
5083
4882
|
name: "trustDevice",
|
|
5084
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5085
|
-
/* @__PURE__ */
|
|
4883
|
+
render: ({ field }) => /* @__PURE__ */ jsx46(FormItem14, { children: /* @__PURE__ */ jsxs39("div", { className: "flex items-center space-x-2", children: [
|
|
4884
|
+
/* @__PURE__ */ jsx46(FormControl14, { children: /* @__PURE__ */ jsx46(
|
|
5086
4885
|
Checkbox3,
|
|
5087
4886
|
{
|
|
5088
4887
|
className: classNames?.checkbox,
|
|
@@ -5091,60 +4890,60 @@ function TwoFactorForm({
|
|
|
5091
4890
|
disabled: submitting
|
|
5092
4891
|
}
|
|
5093
4892
|
) }),
|
|
5094
|
-
/* @__PURE__ */
|
|
4893
|
+
/* @__PURE__ */ jsx46(FormLabel13, { className: classNames?.label, children: t("systems.TRUST_DEVICE") })
|
|
5095
4894
|
] }) })
|
|
5096
4895
|
}
|
|
5097
4896
|
)
|
|
5098
4897
|
] }),
|
|
5099
|
-
/* @__PURE__ */
|
|
5100
|
-
method !== null && /* @__PURE__ */
|
|
5101
|
-
|
|
4898
|
+
/* @__PURE__ */ jsxs39("div", { className: "grid gap-4", children: [
|
|
4899
|
+
method !== null && /* @__PURE__ */ jsx46(
|
|
4900
|
+
Button29,
|
|
5102
4901
|
{
|
|
5103
4902
|
type: "submit",
|
|
5104
|
-
className:
|
|
4903
|
+
className: cn37(classNames?.button, classNames?.primaryButton),
|
|
5105
4904
|
disabled: submitting,
|
|
5106
|
-
children: submitting ? /* @__PURE__ */
|
|
4905
|
+
children: submitting ? /* @__PURE__ */ jsx46(Spinner19, {}) : t("systems.TWO_FACTOR_ACTION")
|
|
5107
4906
|
}
|
|
5108
4907
|
),
|
|
5109
|
-
method === "otp" && /* @__PURE__ */
|
|
5110
|
-
|
|
4908
|
+
method === "otp" && /* @__PURE__ */ jsxs39(
|
|
4909
|
+
Button29,
|
|
5111
4910
|
{
|
|
5112
4911
|
type: "button",
|
|
5113
4912
|
variant: "outline",
|
|
5114
|
-
className:
|
|
4913
|
+
className: cn37(classNames?.button, classNames?.outlineButton),
|
|
5115
4914
|
onClick: sendOtp,
|
|
5116
4915
|
disabled: cooldownSeconds > 0 || isSendingOtp || submitting,
|
|
5117
4916
|
children: [
|
|
5118
|
-
isSendingOtp ? /* @__PURE__ */
|
|
4917
|
+
isSendingOtp ? /* @__PURE__ */ jsx46(Spinner19, {}) : /* @__PURE__ */ jsx46(SendIcon, { className: classNames?.icon }),
|
|
5119
4918
|
t("systems.RESEND_CODE"),
|
|
5120
4919
|
cooldownSeconds > 0 && ` (${cooldownSeconds})`
|
|
5121
4920
|
]
|
|
5122
4921
|
}
|
|
5123
4922
|
),
|
|
5124
|
-
method !== "otp" && /* @__PURE__ */
|
|
5125
|
-
|
|
4923
|
+
method !== "otp" && /* @__PURE__ */ jsxs39(
|
|
4924
|
+
Button29,
|
|
5126
4925
|
{
|
|
5127
4926
|
type: "button",
|
|
5128
4927
|
variant: "secondary",
|
|
5129
|
-
className:
|
|
4928
|
+
className: cn37(classNames?.button, classNames?.secondaryButton),
|
|
5130
4929
|
onClick: () => setMethod("otp"),
|
|
5131
4930
|
disabled: submitting,
|
|
5132
4931
|
children: [
|
|
5133
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx46(SendIcon, { className: classNames?.icon }),
|
|
5134
4933
|
t("systems.SEND_VERIFICATION_CODE")
|
|
5135
4934
|
]
|
|
5136
4935
|
}
|
|
5137
4936
|
),
|
|
5138
|
-
method !== "totp" && /* @__PURE__ */
|
|
5139
|
-
|
|
4937
|
+
method !== "totp" && /* @__PURE__ */ jsxs39(
|
|
4938
|
+
Button29,
|
|
5140
4939
|
{
|
|
5141
4940
|
type: "button",
|
|
5142
4941
|
variant: "secondary",
|
|
5143
|
-
className:
|
|
4942
|
+
className: cn37(classNames?.button, classNames?.secondaryButton),
|
|
5144
4943
|
onClick: () => setMethod("totp"),
|
|
5145
4944
|
disabled: submitting,
|
|
5146
4945
|
children: [
|
|
5147
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx46(QrCodeIcon, { className: classNames?.icon }),
|
|
5148
4947
|
t("systems.CONTINUE_WITH_AUTHENTICATOR")
|
|
5149
4948
|
]
|
|
5150
4949
|
}
|
|
@@ -5161,12 +4960,12 @@ function QRCodeComponent({
|
|
|
5161
4960
|
as = "svg",
|
|
5162
4961
|
className
|
|
5163
4962
|
}) {
|
|
5164
|
-
const [src, setSrc] =
|
|
4963
|
+
const [src, setSrc] = useState15("");
|
|
5165
4964
|
const opts = useMemo4(
|
|
5166
4965
|
() => ({ errorCorrectionLevel: level, margin: 1, width: size }),
|
|
5167
4966
|
[level, size]
|
|
5168
4967
|
);
|
|
5169
|
-
|
|
4968
|
+
useEffect12(() => {
|
|
5170
4969
|
let cancelled = false;
|
|
5171
4970
|
if (as === "img") {
|
|
5172
4971
|
QRCode.toDataURL(value, opts).then((url) => !cancelled && setSrc(url));
|
|
@@ -5181,36 +4980,36 @@ function QRCodeComponent({
|
|
|
5181
4980
|
}, [value, opts, as]);
|
|
5182
4981
|
if (!src) return null;
|
|
5183
4982
|
if (as === "img") {
|
|
5184
|
-
return /* @__PURE__ */
|
|
4983
|
+
return /* @__PURE__ */ jsx46("img", { src, width: size, height: size, alt: "QR code", className });
|
|
5185
4984
|
}
|
|
5186
|
-
return /* @__PURE__ */
|
|
4985
|
+
return /* @__PURE__ */ jsx46(
|
|
5187
4986
|
"span",
|
|
5188
4987
|
{
|
|
5189
|
-
className:
|
|
4988
|
+
className: cn37("block", className),
|
|
5190
4989
|
dangerouslySetInnerHTML: { __html: src }
|
|
5191
4990
|
}
|
|
5192
4991
|
);
|
|
5193
4992
|
}
|
|
5194
4993
|
|
|
5195
4994
|
// src/ui/auth/view.tsx
|
|
5196
|
-
import { useEffect as
|
|
4995
|
+
import { useEffect as useEffect13, useState as useState16 } from "react";
|
|
5197
4996
|
import Link3 from "next/link";
|
|
5198
|
-
import { useRouter as
|
|
4997
|
+
import { useRouter as useRouter13 } from "next/navigation";
|
|
5199
4998
|
import { ArrowLeftIcon } from "lucide-react";
|
|
5200
|
-
import { useTranslations as
|
|
4999
|
+
import { useTranslations as useTranslations40 } from "next-intl";
|
|
5000
|
+
import { cn as cn38 } from "pelatform-ui";
|
|
5201
5001
|
import {
|
|
5202
|
-
Button as
|
|
5203
|
-
Card as
|
|
5204
|
-
CardContent as
|
|
5002
|
+
Button as Button30,
|
|
5003
|
+
Card as Card10,
|
|
5004
|
+
CardContent as CardContent2,
|
|
5205
5005
|
CardDescription,
|
|
5206
5006
|
CardFooter as CardFooter2,
|
|
5207
|
-
CardHeader
|
|
5007
|
+
CardHeader,
|
|
5208
5008
|
CardHeading,
|
|
5209
5009
|
CardTitle,
|
|
5210
5010
|
Separator
|
|
5211
5011
|
} from "pelatform-ui/default";
|
|
5212
|
-
import {
|
|
5213
|
-
import { Fragment as Fragment16, jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5012
|
+
import { Fragment as Fragment16, jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5214
5013
|
function getViewByPath(pathConfig, path) {
|
|
5215
5014
|
if (!path) return null;
|
|
5216
5015
|
const cleanPath = path.replace(/^\//, "").split("?")[0];
|
|
@@ -5234,7 +5033,7 @@ function AuthView({
|
|
|
5234
5033
|
view: viewProp
|
|
5235
5034
|
}) {
|
|
5236
5035
|
const { auth, features, path: pathConfig } = useConfig();
|
|
5237
|
-
const t =
|
|
5036
|
+
const t = useTranslations40();
|
|
5238
5037
|
const auths = auth.authentication;
|
|
5239
5038
|
let socialLayout = socialLayoutProp;
|
|
5240
5039
|
if (socialLayout === "auto") {
|
|
@@ -5242,8 +5041,8 @@ function AuthView({
|
|
|
5242
5041
|
}
|
|
5243
5042
|
const currentPath = pathProp ?? pathname?.split("/").pop();
|
|
5244
5043
|
const view = viewProp || getViewByPath(pathConfig.auth, currentPath) || "SIGN_IN";
|
|
5245
|
-
const [isSubmitting, setIsSubmitting] =
|
|
5246
|
-
|
|
5044
|
+
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
5045
|
+
useEffect13(() => {
|
|
5247
5046
|
const handlePageHide = () => setIsSubmitting(false);
|
|
5248
5047
|
window.addEventListener("pagehide", handlePageHide);
|
|
5249
5048
|
return () => {
|
|
@@ -5251,12 +5050,9 @@ function AuthView({
|
|
|
5251
5050
|
window.removeEventListener("pagehide", handlePageHide);
|
|
5252
5051
|
};
|
|
5253
5052
|
}, []);
|
|
5254
|
-
const
|
|
5255
|
-
if (view === "CALLBACK") return /* @__PURE__ */
|
|
5256
|
-
if (view === "SIGN_OUT") return /* @__PURE__ */
|
|
5257
|
-
if (view === "ACCEPT_INVITATION" && enableAcceptInvitation) {
|
|
5258
|
-
return /* @__PURE__ */ jsx48(AcceptInvitation, {});
|
|
5259
|
-
}
|
|
5053
|
+
const _enableAcceptInvitation = enableAcceptInvitationProp ?? features.workspace;
|
|
5054
|
+
if (view === "CALLBACK") return /* @__PURE__ */ jsx47(AuthCallback, { redirectTo });
|
|
5055
|
+
if (view === "SIGN_OUT") return /* @__PURE__ */ jsx47(SignOut, {});
|
|
5260
5056
|
const description = !auths.password && !auths.magicLink && !auths.emailOtp ? t("systems.DISABLED_CREDENTIALS_DESCRIPTION") : t(`systems.${view}_DESCRIPTION`);
|
|
5261
5057
|
const showSocialProviders = view !== "RESET_PASSWORD" && view !== "FORGOT_PASSWORD" && auth.socialProviders && auth.socialProviders.length > 0;
|
|
5262
5058
|
const showPasskey = auths.passkey && [
|
|
@@ -5268,38 +5064,38 @@ function AuthView({
|
|
|
5268
5064
|
"FORGOT_PASSWORD"
|
|
5269
5065
|
].includes(view);
|
|
5270
5066
|
const showCredentials = auths.password || auths.magicLink || auths.emailOtp;
|
|
5271
|
-
return /* @__PURE__ */
|
|
5272
|
-
|
|
5067
|
+
return /* @__PURE__ */ jsxs40(
|
|
5068
|
+
Card10,
|
|
5273
5069
|
{
|
|
5274
|
-
className:
|
|
5070
|
+
className: cn38(
|
|
5275
5071
|
"w-full max-w-full border-0 bg-transparent p-0 shadow-none",
|
|
5276
5072
|
className,
|
|
5277
5073
|
classNames?.base
|
|
5278
5074
|
),
|
|
5279
5075
|
children: [
|
|
5280
|
-
/* @__PURE__ */
|
|
5281
|
-
|
|
5076
|
+
/* @__PURE__ */ jsx47(
|
|
5077
|
+
CardHeader,
|
|
5282
5078
|
{
|
|
5283
|
-
className:
|
|
5079
|
+
className: cn38(
|
|
5284
5080
|
"justify-center space-y-1.5 border-0 py-4 pb-3 text-center",
|
|
5285
5081
|
classNames?.header
|
|
5286
5082
|
),
|
|
5287
|
-
children: cardHeader ? cardHeader : /* @__PURE__ */
|
|
5288
|
-
/* @__PURE__ */
|
|
5289
|
-
description && /* @__PURE__ */
|
|
5083
|
+
children: cardHeader ? cardHeader : /* @__PURE__ */ jsxs40(CardHeading, { children: [
|
|
5084
|
+
/* @__PURE__ */ jsx47(CardTitle, { className: cn38("font-semibold text-2xl tracking-tight", classNames?.title), children: t(`systems.${view}`) }),
|
|
5085
|
+
description && /* @__PURE__ */ jsx47(
|
|
5290
5086
|
CardDescription,
|
|
5291
5087
|
{
|
|
5292
|
-
className:
|
|
5088
|
+
className: cn38("text-muted-foreground text-sm", classNames?.description),
|
|
5293
5089
|
children: description
|
|
5294
5090
|
}
|
|
5295
5091
|
)
|
|
5296
5092
|
] })
|
|
5297
5093
|
}
|
|
5298
5094
|
),
|
|
5299
|
-
/* @__PURE__ */
|
|
5300
|
-
auths.oneTap && ["SIGN_IN", "SIGN_UP", "MAGIC_LINK", "EMAIL_OTP"].includes(view) && /* @__PURE__ */
|
|
5301
|
-
showCredentials && /* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5095
|
+
/* @__PURE__ */ jsxs40(CardContent2, { className: cn38("grid gap-6", classNames?.content), children: [
|
|
5096
|
+
auths.oneTap && ["SIGN_IN", "SIGN_UP", "MAGIC_LINK", "EMAIL_OTP"].includes(view) && /* @__PURE__ */ jsx47(OneTap, { redirectTo }),
|
|
5097
|
+
showCredentials && /* @__PURE__ */ jsxs40("div", { className: "grid gap-4", children: [
|
|
5098
|
+
/* @__PURE__ */ jsx47(
|
|
5303
5099
|
AuthForm,
|
|
5304
5100
|
{
|
|
5305
5101
|
classNames: classNames?.form,
|
|
@@ -5312,22 +5108,22 @@ function AuthView({
|
|
|
5312
5108
|
),
|
|
5313
5109
|
auths.magicLink && (auths.password && ["FORGOT_PASSWORD", "SIGN_UP", "SIGN_IN", "MAGIC_LINK", "EMAIL_OTP"].includes(
|
|
5314
5110
|
view
|
|
5315
|
-
) || auths.emailOtp && view === "EMAIL_OTP") && /* @__PURE__ */
|
|
5111
|
+
) || auths.emailOtp && view === "EMAIL_OTP") && /* @__PURE__ */ jsx47(MagicLinkButton, { classNames, view }),
|
|
5316
5112
|
auths.emailOtp && (auths.password && ["FORGOT_PASSWORD", "SIGN_UP", "SIGN_IN", "MAGIC_LINK", "EMAIL_OTP"].includes(
|
|
5317
5113
|
view
|
|
5318
|
-
) || auths.magicLink && ["SIGN_IN", "MAGIC_LINK"].includes(view)) && /* @__PURE__ */
|
|
5114
|
+
) || auths.magicLink && ["SIGN_IN", "MAGIC_LINK"].includes(view)) && /* @__PURE__ */ jsx47(EmailOTPButton, { classNames, view })
|
|
5319
5115
|
] }),
|
|
5320
|
-
(showSocialProviders || showPasskey) && /* @__PURE__ */
|
|
5321
|
-
showCredentials && /* @__PURE__ */
|
|
5322
|
-
/* @__PURE__ */
|
|
5323
|
-
/* @__PURE__ */
|
|
5324
|
-
/* @__PURE__ */
|
|
5116
|
+
(showSocialProviders || showPasskey) && /* @__PURE__ */ jsxs40(Fragment16, { children: [
|
|
5117
|
+
showCredentials && /* @__PURE__ */ jsxs40("div", { className: cn38("flex items-center gap-2", classNames?.continueWith), children: [
|
|
5118
|
+
/* @__PURE__ */ jsx47(Separator, { className: cn38("w-auto! grow", classNames?.separator) }),
|
|
5119
|
+
/* @__PURE__ */ jsx47("span", { className: "shrink-0 text-muted-foreground text-sm", children: t("systems.OR_CONTINUE_WITH") }),
|
|
5120
|
+
/* @__PURE__ */ jsx47(Separator, { className: cn38("w-auto! grow", classNames?.separator) })
|
|
5325
5121
|
] }),
|
|
5326
|
-
/* @__PURE__ */
|
|
5327
|
-
showSocialProviders && /* @__PURE__ */
|
|
5122
|
+
/* @__PURE__ */ jsxs40("div", { className: "grid gap-4", children: [
|
|
5123
|
+
showSocialProviders && /* @__PURE__ */ jsx47(
|
|
5328
5124
|
"div",
|
|
5329
5125
|
{
|
|
5330
|
-
className:
|
|
5126
|
+
className: cn38(
|
|
5331
5127
|
"flex w-full items-center justify-between gap-4",
|
|
5332
5128
|
socialLayout === "horizontal" && "flex-wrap",
|
|
5333
5129
|
socialLayout === "vertical" && "flex-col",
|
|
@@ -5338,7 +5134,7 @@ function AuthView({
|
|
|
5338
5134
|
(socialProvider2) => socialProvider2.provider === provider
|
|
5339
5135
|
);
|
|
5340
5136
|
if (!socialProvider) return null;
|
|
5341
|
-
return /* @__PURE__ */
|
|
5137
|
+
return /* @__PURE__ */ jsx47(
|
|
5342
5138
|
ProviderButton,
|
|
5343
5139
|
{
|
|
5344
5140
|
classNames,
|
|
@@ -5353,50 +5149,50 @@ function AuthView({
|
|
|
5353
5149
|
})
|
|
5354
5150
|
}
|
|
5355
5151
|
),
|
|
5356
|
-
showPasskey && /* @__PURE__ */
|
|
5152
|
+
showPasskey && /* @__PURE__ */ jsx47(PasskeyButton, { classNames, redirectTo })
|
|
5357
5153
|
] })
|
|
5358
5154
|
] })
|
|
5359
5155
|
] }),
|
|
5360
|
-
auths.password && auth.enableSignup && /* @__PURE__ */
|
|
5156
|
+
auths.password && auth.enableSignup && /* @__PURE__ */ jsx47(
|
|
5361
5157
|
CardFooter2,
|
|
5362
5158
|
{
|
|
5363
|
-
className:
|
|
5159
|
+
className: cn38(
|
|
5364
5160
|
"justify-center gap-1.5 border-0 text-muted-foreground text-sm",
|
|
5365
5161
|
classNames?.footer
|
|
5366
5162
|
),
|
|
5367
|
-
children: view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? /* @__PURE__ */
|
|
5163
|
+
children: view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? /* @__PURE__ */ jsxs40(Fragment16, { children: [
|
|
5368
5164
|
t("systems.DONT_HAVE_AN_ACCOUNT"),
|
|
5369
|
-
/* @__PURE__ */
|
|
5370
|
-
|
|
5165
|
+
/* @__PURE__ */ jsx47(Link3, { href: `${pathConfig.auth.SIGN_UP}${window.location.search}`, children: /* @__PURE__ */ jsx47(
|
|
5166
|
+
Button30,
|
|
5371
5167
|
{
|
|
5372
5168
|
mode: "link",
|
|
5373
5169
|
underline: "dashed",
|
|
5374
5170
|
size: "sm",
|
|
5375
|
-
className:
|
|
5171
|
+
className: cn38("px-0 text-foreground", classNames?.footerLink),
|
|
5376
5172
|
children: t("systems.SIGN_UP")
|
|
5377
5173
|
}
|
|
5378
5174
|
) })
|
|
5379
|
-
] }) : view === "SIGN_UP" ? /* @__PURE__ */
|
|
5175
|
+
] }) : view === "SIGN_UP" ? /* @__PURE__ */ jsxs40(Fragment16, { children: [
|
|
5380
5176
|
t("systems.ALREADY_HAVE_AN_ACCOUNT"),
|
|
5381
|
-
/* @__PURE__ */
|
|
5382
|
-
|
|
5177
|
+
/* @__PURE__ */ jsx47(Link3, { href: `${pathConfig.auth.SIGN_IN}${window.location.search}`, children: /* @__PURE__ */ jsx47(
|
|
5178
|
+
Button30,
|
|
5383
5179
|
{
|
|
5384
5180
|
mode: "link",
|
|
5385
5181
|
underline: "dashed",
|
|
5386
5182
|
size: "sm",
|
|
5387
|
-
className:
|
|
5183
|
+
className: cn38("px-0 text-foreground", classNames?.footerLink),
|
|
5388
5184
|
children: t("systems.SIGN_IN")
|
|
5389
5185
|
}
|
|
5390
5186
|
) })
|
|
5391
|
-
] }) : /* @__PURE__ */
|
|
5392
|
-
/* @__PURE__ */
|
|
5393
|
-
/* @__PURE__ */
|
|
5394
|
-
|
|
5187
|
+
] }) : /* @__PURE__ */ jsxs40(Fragment16, { children: [
|
|
5188
|
+
/* @__PURE__ */ jsx47(ArrowLeftIcon, { className: "size-3" }),
|
|
5189
|
+
/* @__PURE__ */ jsx47(
|
|
5190
|
+
Button30,
|
|
5395
5191
|
{
|
|
5396
5192
|
mode: "link",
|
|
5397
5193
|
underline: "dashed",
|
|
5398
5194
|
size: "sm",
|
|
5399
|
-
className:
|
|
5195
|
+
className: cn38("px-0 text-foreground", classNames?.footerLink),
|
|
5400
5196
|
onClick: () => {
|
|
5401
5197
|
if (typeof window !== "undefined") {
|
|
5402
5198
|
window.history.back();
|
|
@@ -5423,10 +5219,10 @@ function AuthForm({
|
|
|
5423
5219
|
view: viewProp
|
|
5424
5220
|
}) {
|
|
5425
5221
|
const { auth, path: pathConfig } = useConfig();
|
|
5426
|
-
const router =
|
|
5222
|
+
const router = useRouter13();
|
|
5427
5223
|
const auths = auth.authentication;
|
|
5428
5224
|
const view = viewProp || getViewByPath(pathConfig.auth, pathname) || "SIGN_IN";
|
|
5429
|
-
|
|
5225
|
+
useEffect13(() => {
|
|
5430
5226
|
let isInvalidView = false;
|
|
5431
5227
|
if (view === "MAGIC_LINK" && (!auths.magicLink || !auths.password && !auths.emailOtp)) {
|
|
5432
5228
|
isInvalidView = true;
|
|
@@ -5458,10 +5254,10 @@ function AuthForm({
|
|
|
5458
5254
|
pathConfig.auth.SIGN_IN,
|
|
5459
5255
|
router
|
|
5460
5256
|
]);
|
|
5461
|
-
if (view === "SIGN_OUT") return /* @__PURE__ */
|
|
5462
|
-
if (view === "CALLBACK") return /* @__PURE__ */
|
|
5257
|
+
if (view === "SIGN_OUT") return /* @__PURE__ */ jsx47(SignOut, {});
|
|
5258
|
+
if (view === "CALLBACK") return /* @__PURE__ */ jsx47(AuthCallback, { redirectTo });
|
|
5463
5259
|
if (view === "SIGN_IN") {
|
|
5464
|
-
return auths.password ? /* @__PURE__ */
|
|
5260
|
+
return auths.password ? /* @__PURE__ */ jsx47(
|
|
5465
5261
|
SignInForm,
|
|
5466
5262
|
{
|
|
5467
5263
|
className,
|
|
@@ -5470,7 +5266,7 @@ function AuthForm({
|
|
|
5470
5266
|
redirectTo,
|
|
5471
5267
|
setIsSubmitting
|
|
5472
5268
|
}
|
|
5473
|
-
) : auths.magicLink ? /* @__PURE__ */
|
|
5269
|
+
) : auths.magicLink ? /* @__PURE__ */ jsx47(
|
|
5474
5270
|
MagicLinkForm,
|
|
5475
5271
|
{
|
|
5476
5272
|
className,
|
|
@@ -5478,7 +5274,7 @@ function AuthForm({
|
|
|
5478
5274
|
isSubmitting,
|
|
5479
5275
|
setIsSubmitting
|
|
5480
5276
|
}
|
|
5481
|
-
) : auths.emailOtp ? /* @__PURE__ */
|
|
5277
|
+
) : auths.emailOtp ? /* @__PURE__ */ jsx47(
|
|
5482
5278
|
EmailOTPForm,
|
|
5483
5279
|
{
|
|
5484
5280
|
className,
|
|
@@ -5490,7 +5286,7 @@ function AuthForm({
|
|
|
5490
5286
|
) : null;
|
|
5491
5287
|
}
|
|
5492
5288
|
if (view === "TWO_FACTOR") {
|
|
5493
|
-
return /* @__PURE__ */
|
|
5289
|
+
return /* @__PURE__ */ jsx47(
|
|
5494
5290
|
TwoFactorForm,
|
|
5495
5291
|
{
|
|
5496
5292
|
className,
|
|
@@ -5503,7 +5299,7 @@ function AuthForm({
|
|
|
5503
5299
|
);
|
|
5504
5300
|
}
|
|
5505
5301
|
if (view === "RECOVER_ACCOUNT") {
|
|
5506
|
-
return /* @__PURE__ */
|
|
5302
|
+
return /* @__PURE__ */ jsx47(
|
|
5507
5303
|
RecoverAccountForm,
|
|
5508
5304
|
{
|
|
5509
5305
|
className,
|
|
@@ -5515,7 +5311,7 @@ function AuthForm({
|
|
|
5515
5311
|
);
|
|
5516
5312
|
}
|
|
5517
5313
|
if (view === "MAGIC_LINK") {
|
|
5518
|
-
return /* @__PURE__ */
|
|
5314
|
+
return /* @__PURE__ */ jsx47(
|
|
5519
5315
|
MagicLinkForm,
|
|
5520
5316
|
{
|
|
5521
5317
|
className,
|
|
@@ -5526,7 +5322,7 @@ function AuthForm({
|
|
|
5526
5322
|
);
|
|
5527
5323
|
}
|
|
5528
5324
|
if (view === "EMAIL_OTP") {
|
|
5529
|
-
return /* @__PURE__ */
|
|
5325
|
+
return /* @__PURE__ */ jsx47(
|
|
5530
5326
|
EmailOTPForm,
|
|
5531
5327
|
{
|
|
5532
5328
|
className,
|
|
@@ -5538,7 +5334,7 @@ function AuthForm({
|
|
|
5538
5334
|
);
|
|
5539
5335
|
}
|
|
5540
5336
|
if (view === "FORGOT_PASSWORD") {
|
|
5541
|
-
return /* @__PURE__ */
|
|
5337
|
+
return /* @__PURE__ */ jsx47(
|
|
5542
5338
|
ForgotPasswordForm,
|
|
5543
5339
|
{
|
|
5544
5340
|
className,
|
|
@@ -5549,7 +5345,7 @@ function AuthForm({
|
|
|
5549
5345
|
);
|
|
5550
5346
|
}
|
|
5551
5347
|
if (view === "RESET_PASSWORD") {
|
|
5552
|
-
return /* @__PURE__ */
|
|
5348
|
+
return /* @__PURE__ */ jsx47(
|
|
5553
5349
|
ResetPasswordForm,
|
|
5554
5350
|
{
|
|
5555
5351
|
className,
|
|
@@ -5560,7 +5356,7 @@ function AuthForm({
|
|
|
5560
5356
|
);
|
|
5561
5357
|
}
|
|
5562
5358
|
if (view === "SIGN_UP") {
|
|
5563
|
-
return auth.enableSignup ? /* @__PURE__ */
|
|
5359
|
+
return auth.enableSignup ? /* @__PURE__ */ jsx47(
|
|
5564
5360
|
SignUpForm,
|
|
5565
5361
|
{
|
|
5566
5362
|
className,
|
|
@@ -5575,75 +5371,57 @@ function AuthForm({
|
|
|
5575
5371
|
}
|
|
5576
5372
|
|
|
5577
5373
|
// src/ui/layouts/auth.tsx
|
|
5578
|
-
import
|
|
5374
|
+
import Link5 from "next/link";
|
|
5579
5375
|
import { usePathname } from "next/navigation";
|
|
5580
|
-
import { useTranslations as
|
|
5376
|
+
import { useTranslations as useTranslations43 } from "next-intl";
|
|
5581
5377
|
import { LayoutBlank } from "pelatform-ui/components";
|
|
5582
5378
|
|
|
5583
5379
|
// src/ui/shared/logo.tsx
|
|
5584
5380
|
import Link4 from "next/link";
|
|
5381
|
+
import { cn as cn39 } from "pelatform-ui";
|
|
5585
5382
|
import { Logo } from "pelatform-ui/components";
|
|
5586
|
-
import {
|
|
5587
|
-
import { jsx as jsx49, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5383
|
+
import { jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5588
5384
|
function LogoWithName({ className }) {
|
|
5589
5385
|
const { app } = useConfig();
|
|
5590
|
-
return /* @__PURE__ */
|
|
5591
|
-
/* @__PURE__ */
|
|
5592
|
-
/* @__PURE__ */
|
|
5386
|
+
return /* @__PURE__ */ jsxs41("div", { className: cn39("flex items-center gap-2", className), children: [
|
|
5387
|
+
/* @__PURE__ */ jsx48(Logo, { className: "size-7" }),
|
|
5388
|
+
/* @__PURE__ */ jsx48("span", { className: "font-semibold text-lg text-mono", children: app.name })
|
|
5593
5389
|
] });
|
|
5594
5390
|
}
|
|
5595
5391
|
function LogoWithHref({ className, href = "/" }) {
|
|
5596
5392
|
const { app } = useConfig();
|
|
5597
|
-
return /* @__PURE__ */
|
|
5598
|
-
/* @__PURE__ */
|
|
5599
|
-
/* @__PURE__ */
|
|
5600
|
-
] });
|
|
5601
|
-
}
|
|
5602
|
-
|
|
5603
|
-
// src/ui/shared/signed-in-hint.tsx
|
|
5604
|
-
import Link5 from "next/link";
|
|
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";
|
|
5608
|
-
function SignedInHint({ linkHref = "/signin" }) {
|
|
5609
|
-
const t = useTranslations42("customs.common.signed");
|
|
5610
|
-
const { isPending, user } = useSession();
|
|
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: [
|
|
5613
|
-
t("text"),
|
|
5614
|
-
" ",
|
|
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 })
|
|
5616
|
-
] }),
|
|
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") }) })
|
|
5393
|
+
return /* @__PURE__ */ jsxs41(Link4, { href, className: cn39("flex items-center gap-2", className), children: [
|
|
5394
|
+
/* @__PURE__ */ jsx48(Logo, { className: "size-7" }),
|
|
5395
|
+
/* @__PURE__ */ jsx48("span", { className: "font-semibold text-lg text-mono", children: app.name })
|
|
5618
5396
|
] });
|
|
5619
5397
|
}
|
|
5620
5398
|
|
|
5621
5399
|
// src/ui/layouts/loader.tsx
|
|
5622
|
-
import { useTranslations as
|
|
5400
|
+
import { useTranslations as useTranslations41 } from "next-intl";
|
|
5623
5401
|
import { ScreenLoader } from "pelatform-ui/components";
|
|
5624
|
-
import { jsx as
|
|
5402
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
5625
5403
|
function LayoutLoader({ children }) {
|
|
5626
|
-
const t =
|
|
5404
|
+
const t = useTranslations41();
|
|
5627
5405
|
const { isPending } = useSession();
|
|
5628
5406
|
if (isPending) {
|
|
5629
|
-
return /* @__PURE__ */
|
|
5407
|
+
return /* @__PURE__ */ jsx49(ScreenLoader, { loadingText: t("systems.common.status.loading") });
|
|
5630
5408
|
}
|
|
5631
5409
|
return children;
|
|
5632
5410
|
}
|
|
5633
5411
|
|
|
5634
5412
|
// src/ui/layouts/toolbar.tsx
|
|
5635
5413
|
import { Suspense } from "react";
|
|
5414
|
+
import { cn as cn40 } from "pelatform-ui";
|
|
5636
5415
|
import { ModeSwitcher } from "pelatform-ui/components";
|
|
5637
|
-
import { cn as cn41 } from "@pelatform/utils";
|
|
5638
5416
|
|
|
5639
5417
|
// src/ui/shared/language-switcher.tsx
|
|
5640
5418
|
import Image from "next/image";
|
|
5641
|
-
import { useRouter as
|
|
5642
|
-
import { useLocale as useLocale3, useTranslations as
|
|
5419
|
+
import { useRouter as useRouter14 } from "next/navigation";
|
|
5420
|
+
import { useLocale as useLocale3, useTranslations as useTranslations42 } from "next-intl";
|
|
5643
5421
|
import {
|
|
5644
5422
|
LanguageSwitcher as LanguageSwitcherBase
|
|
5645
5423
|
} from "pelatform-ui/components";
|
|
5646
|
-
import { jsx as
|
|
5424
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5647
5425
|
function LanguageSwitcher({
|
|
5648
5426
|
className,
|
|
5649
5427
|
type,
|
|
@@ -5653,8 +5431,8 @@ function LanguageSwitcher({
|
|
|
5653
5431
|
showFlags
|
|
5654
5432
|
}) {
|
|
5655
5433
|
const { i18n } = useConfig();
|
|
5656
|
-
const router =
|
|
5657
|
-
const t =
|
|
5434
|
+
const router = useRouter14();
|
|
5435
|
+
const t = useTranslations42();
|
|
5658
5436
|
const currentLocale = useLocale3();
|
|
5659
5437
|
const availableLocales = (() => {
|
|
5660
5438
|
if (!i18n.enabled) {
|
|
@@ -5678,7 +5456,7 @@ function LanguageSwitcher({
|
|
|
5678
5456
|
document.cookie = `${i18n.localeCookieName}=${newLocale}; max-age=${60 * 60 * 24 * 365}; path=/`;
|
|
5679
5457
|
router.refresh();
|
|
5680
5458
|
}
|
|
5681
|
-
return /* @__PURE__ */
|
|
5459
|
+
return /* @__PURE__ */ jsx50(
|
|
5682
5460
|
LanguageSwitcherBase,
|
|
5683
5461
|
{
|
|
5684
5462
|
className,
|
|
@@ -5699,34 +5477,34 @@ function LanguageSwitcher({
|
|
|
5699
5477
|
}
|
|
5700
5478
|
|
|
5701
5479
|
// src/ui/layouts/toolbar.tsx
|
|
5702
|
-
import { jsx as
|
|
5480
|
+
import { jsx as jsx51, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5703
5481
|
var DEFAULT_SHOW = ["darkmode"];
|
|
5704
5482
|
function Toolbar(props) {
|
|
5705
|
-
return /* @__PURE__ */
|
|
5483
|
+
return /* @__PURE__ */ jsx51(Suspense, { fallback: null, children: /* @__PURE__ */ jsx51("div", { className: cn40("fixed end-0 bottom-0 z-40 m-5", props.className), children: /* @__PURE__ */ jsx51(ToolbarRSC, { ...props }) }) });
|
|
5706
5484
|
}
|
|
5707
5485
|
function ToolbarRSC({ show = DEFAULT_SHOW }) {
|
|
5708
|
-
return /* @__PURE__ */
|
|
5709
|
-
show.includes("darkmode") && /* @__PURE__ */
|
|
5710
|
-
show.includes("help") && /* @__PURE__ */
|
|
5711
|
-
show.includes("language") && /* @__PURE__ */
|
|
5712
|
-
show.includes("onboarding") && /* @__PURE__ */
|
|
5486
|
+
return /* @__PURE__ */ jsx51("div", { className: "flex flex-col items-center gap-2.5", children: /* @__PURE__ */ jsxs42("div", { className: "shrink-0", children: [
|
|
5487
|
+
show.includes("darkmode") && /* @__PURE__ */ jsx51(ModeSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5488
|
+
show.includes("help") && /* @__PURE__ */ jsx51("div", { className: "hidden" }),
|
|
5489
|
+
show.includes("language") && /* @__PURE__ */ jsx51(LanguageSwitcher, { variant: "outline", size: "lg", className: "size-10 rounded-full border" }),
|
|
5490
|
+
show.includes("onboarding") && /* @__PURE__ */ jsx51("div", { className: "hidden" })
|
|
5713
5491
|
] }) });
|
|
5714
5492
|
}
|
|
5715
5493
|
|
|
5716
5494
|
// src/ui/layouts/auth.tsx
|
|
5717
|
-
import { jsx as
|
|
5495
|
+
import { jsx as jsx52, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5718
5496
|
function AuthLayout({
|
|
5719
5497
|
children,
|
|
5720
|
-
logo = /* @__PURE__ */
|
|
5498
|
+
logo = /* @__PURE__ */ jsx52(LogoWithName, {})
|
|
5721
5499
|
}) {
|
|
5722
5500
|
const { app, path } = useConfig();
|
|
5723
5501
|
const pathname = usePathname();
|
|
5724
|
-
const t =
|
|
5725
|
-
const footer = /* @__PURE__ */
|
|
5502
|
+
const t = useTranslations43();
|
|
5503
|
+
const footer = /* @__PURE__ */ jsxs43("p", { className: "px-20 py-4 text-center font-medium text-muted-foreground text-xs md:px-0", children: [
|
|
5726
5504
|
t("customs.common.agree"),
|
|
5727
5505
|
" ",
|
|
5728
|
-
/* @__PURE__ */
|
|
5729
|
-
|
|
5506
|
+
/* @__PURE__ */ jsx52(
|
|
5507
|
+
Link5,
|
|
5730
5508
|
{
|
|
5731
5509
|
href: path.main.TERMS,
|
|
5732
5510
|
target: "_blank",
|
|
@@ -5735,8 +5513,8 @@ function AuthLayout({
|
|
|
5735
5513
|
}
|
|
5736
5514
|
),
|
|
5737
5515
|
" ",
|
|
5738
|
-
/* @__PURE__ */
|
|
5739
|
-
|
|
5516
|
+
/* @__PURE__ */ jsx52(
|
|
5517
|
+
Link5,
|
|
5740
5518
|
{
|
|
5741
5519
|
href: path.main.PRIVACY,
|
|
5742
5520
|
target: "_blank",
|
|
@@ -5745,29 +5523,28 @@ function AuthLayout({
|
|
|
5745
5523
|
}
|
|
5746
5524
|
)
|
|
5747
5525
|
] });
|
|
5748
|
-
return /* @__PURE__ */
|
|
5749
|
-
/* @__PURE__ */
|
|
5750
|
-
/* @__PURE__ */
|
|
5526
|
+
return /* @__PURE__ */ jsxs43(LayoutLoader, { children: [
|
|
5527
|
+
/* @__PURE__ */ jsx52(Toolbar, { show: ["language"], className: "top-0!" }),
|
|
5528
|
+
/* @__PURE__ */ jsx52(
|
|
5751
5529
|
LayoutBlank,
|
|
5752
5530
|
{
|
|
5753
5531
|
className: "[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0",
|
|
5754
5532
|
logo,
|
|
5755
5533
|
logoHref: app.url,
|
|
5756
|
-
footer: pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK
|
|
5534
|
+
footer: pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK ? null : footer,
|
|
5757
5535
|
children
|
|
5758
5536
|
}
|
|
5759
5537
|
),
|
|
5760
|
-
/* @__PURE__ */
|
|
5761
|
-
pathname === path.auth.ACCEPT_INVITATION && /* @__PURE__ */ jsx54(SignedInHint, { linkHref: path.auth.SIGN_IN })
|
|
5538
|
+
/* @__PURE__ */ jsx52(Toolbar, { show: ["darkmode"] })
|
|
5762
5539
|
] });
|
|
5763
5540
|
}
|
|
5764
5541
|
|
|
5765
5542
|
// src/ui/layouts/header.tsx
|
|
5766
|
-
import { useEffect as
|
|
5543
|
+
import { useEffect as useEffect15, useState as useState18 } from "react";
|
|
5767
5544
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
5768
5545
|
import { Menu, PanelRight } from "lucide-react";
|
|
5769
5546
|
import {
|
|
5770
|
-
Button as
|
|
5547
|
+
Button as Button31,
|
|
5771
5548
|
Sheet,
|
|
5772
5549
|
SheetBody,
|
|
5773
5550
|
SheetContent,
|
|
@@ -5778,11 +5555,11 @@ import {
|
|
|
5778
5555
|
} from "pelatform-ui/default";
|
|
5779
5556
|
|
|
5780
5557
|
// src/ui/shared/user-menu.tsx
|
|
5781
|
-
import { Fragment as Fragment17, useCallback as useCallback3, useEffect as
|
|
5782
|
-
import
|
|
5783
|
-
import { useRouter as
|
|
5558
|
+
import { Fragment as Fragment17, useCallback as useCallback3, useEffect as useEffect14, useState as useState17 } from "react";
|
|
5559
|
+
import Link6 from "next/link";
|
|
5560
|
+
import { useRouter as useRouter15 } from "next/navigation";
|
|
5784
5561
|
import { LogOut, PlusCircleIcon, Settings, Shield, UserStar } from "lucide-react";
|
|
5785
|
-
import { useTranslations as
|
|
5562
|
+
import { useTranslations as useTranslations44 } from "next-intl";
|
|
5786
5563
|
import { ModeSwitcher as ModeSwitcher2, UserAvatar as UserAvatar2 } from "pelatform-ui/components";
|
|
5787
5564
|
import {
|
|
5788
5565
|
Badge as Badge2,
|
|
@@ -5791,19 +5568,19 @@ import {
|
|
|
5791
5568
|
DropdownMenuItem as DropdownMenuItem3,
|
|
5792
5569
|
DropdownMenuSeparator,
|
|
5793
5570
|
DropdownMenuTrigger as DropdownMenuTrigger3,
|
|
5794
|
-
Skeleton as
|
|
5571
|
+
Skeleton as Skeleton9
|
|
5795
5572
|
} from "pelatform-ui/default";
|
|
5796
|
-
import { Fragment as Fragment18, jsx as
|
|
5573
|
+
import { Fragment as Fragment18, jsx as jsx53, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5797
5574
|
function UserMenu({ hiddenSwitcher = false }) {
|
|
5798
5575
|
const { features, path } = useConfig();
|
|
5799
|
-
const router =
|
|
5800
|
-
const t =
|
|
5576
|
+
const router = useRouter15();
|
|
5577
|
+
const t = useTranslations44();
|
|
5801
5578
|
const { isPending: sessionPending, user } = useSession();
|
|
5802
5579
|
const { setActiveSessionAsync } = useSetActiveSession();
|
|
5803
5580
|
const { data: deviceSessions, isPending: deviceSessionsPending } = useListDeviceSessions({
|
|
5804
5581
|
enabled: features.multiSession
|
|
5805
5582
|
});
|
|
5806
|
-
const [activeSessionPending, setActiveSessionPending] =
|
|
5583
|
+
const [activeSessionPending, setActiveSessionPending] = useState17(false);
|
|
5807
5584
|
const isPending = sessionPending || activeSessionPending;
|
|
5808
5585
|
const switchAccount = useCallback3(
|
|
5809
5586
|
async (sessionToken) => {
|
|
@@ -5819,7 +5596,7 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5819
5596
|
},
|
|
5820
5597
|
[router, setActiveSessionAsync]
|
|
5821
5598
|
);
|
|
5822
|
-
|
|
5599
|
+
useEffect14(() => {
|
|
5823
5600
|
if (!features.multiSession) return;
|
|
5824
5601
|
setActiveSessionPending(false);
|
|
5825
5602
|
}, [features.multiSession, user?.id]);
|
|
@@ -5830,33 +5607,33 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5830
5607
|
const userName = getName(user);
|
|
5831
5608
|
const userAvatar = user?.image || void 0;
|
|
5832
5609
|
const userRole = user?.role || "user";
|
|
5833
|
-
return /* @__PURE__ */
|
|
5834
|
-
/* @__PURE__ */
|
|
5835
|
-
/* @__PURE__ */
|
|
5836
|
-
/* @__PURE__ */
|
|
5837
|
-
/* @__PURE__ */
|
|
5838
|
-
/* @__PURE__ */
|
|
5839
|
-
/* @__PURE__ */
|
|
5840
|
-
/* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
5610
|
+
return /* @__PURE__ */ jsxs44(DropdownMenu3, { children: [
|
|
5611
|
+
/* @__PURE__ */ jsx53(DropdownMenuTrigger3, { className: "focus:outline-none focus:ring-0", children: isPending ? /* @__PURE__ */ jsx53(Skeleton9, { className: "size-8 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx53(UserAvatar2, { className: "size-8", indicator: true, src: userAvatar, alt: userName }) }),
|
|
5612
|
+
/* @__PURE__ */ jsxs44(DropdownMenuContent3, { className: "w-56", side: "bottom", align: "end", sideOffset: 11, children: [
|
|
5613
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
5614
|
+
/* @__PURE__ */ jsx53(UserAvatar2, { src: userAvatar, alt: userName }),
|
|
5615
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5616
|
+
/* @__PURE__ */ jsx53("span", { className: "truncate font-semibold text-foreground text-sm", children: userName }),
|
|
5617
|
+
/* @__PURE__ */ jsx53("span", { className: "block w-full truncate text-muted-foreground text-xs", children: userEmail }),
|
|
5618
|
+
/* @__PURE__ */ jsx53(Badge2, { variant: "success", appearance: "outline", size: "sm", className: "mt-1", children: userRole.toUpperCase() })
|
|
5842
5619
|
] })
|
|
5843
5620
|
] }),
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
5847
|
-
/* @__PURE__ */
|
|
5621
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
|
|
5622
|
+
/* @__PURE__ */ jsx53(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs44(Link6, { href: path.account.SETTINGS, children: [
|
|
5623
|
+
/* @__PURE__ */ jsx53(Settings, {}),
|
|
5624
|
+
/* @__PURE__ */ jsx53("span", { children: t("systems.navigation.preferences") })
|
|
5848
5625
|
] }) }),
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx53(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs44(Link6, { href: path.account.SECURITY, children: [
|
|
5627
|
+
/* @__PURE__ */ jsx53(Shield, {}),
|
|
5628
|
+
/* @__PURE__ */ jsx53("span", { children: t("systems.navigation.security") })
|
|
5852
5629
|
] }) }),
|
|
5853
|
-
"admin" === userRole && /* @__PURE__ */
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
5630
|
+
"admin" === userRole && /* @__PURE__ */ jsx53(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs44(Link6, { href: path.admin.OVERVIEW, children: [
|
|
5631
|
+
/* @__PURE__ */ jsx53(UserStar, {}),
|
|
5632
|
+
/* @__PURE__ */ jsx53("span", { children: "Admin Dashboard" })
|
|
5856
5633
|
] }) }),
|
|
5857
|
-
!hiddenSwitcher && /* @__PURE__ */
|
|
5858
|
-
/* @__PURE__ */
|
|
5859
|
-
/* @__PURE__ */
|
|
5634
|
+
!hiddenSwitcher && /* @__PURE__ */ jsxs44(Fragment18, { children: [
|
|
5635
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
|
|
5636
|
+
/* @__PURE__ */ jsx53(
|
|
5860
5637
|
ModeSwitcher2,
|
|
5861
5638
|
{
|
|
5862
5639
|
type: "sub-dropdown",
|
|
@@ -5867,31 +5644,31 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5867
5644
|
}
|
|
5868
5645
|
}
|
|
5869
5646
|
),
|
|
5870
|
-
/* @__PURE__ */
|
|
5647
|
+
/* @__PURE__ */ jsx53(LanguageSwitcher, { type: "sub-dropdown" })
|
|
5871
5648
|
] }),
|
|
5872
|
-
/* @__PURE__ */
|
|
5873
|
-
/* @__PURE__ */
|
|
5874
|
-
/* @__PURE__ */
|
|
5875
|
-
/* @__PURE__ */
|
|
5649
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
|
|
5650
|
+
/* @__PURE__ */ jsx53(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs44(Link6, { href: path.auth.SIGN_OUT, children: [
|
|
5651
|
+
/* @__PURE__ */ jsx53(LogOut, {}),
|
|
5652
|
+
/* @__PURE__ */ jsx53("span", { children: t("systems.navigation.logout") })
|
|
5876
5653
|
] }) }),
|
|
5877
|
-
user && features.multiSession && /* @__PURE__ */
|
|
5878
|
-
/* @__PURE__ */
|
|
5879
|
-
!deviceSessions && deviceSessionsPending && /* @__PURE__ */
|
|
5880
|
-
/* @__PURE__ */
|
|
5881
|
-
/* @__PURE__ */
|
|
5654
|
+
user && features.multiSession && /* @__PURE__ */ jsxs44(Fragment18, { children: [
|
|
5655
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
|
|
5656
|
+
!deviceSessions && deviceSessionsPending && /* @__PURE__ */ jsxs44(Fragment18, { children: [
|
|
5657
|
+
/* @__PURE__ */ jsx53(DropdownMenuItem3, { disabled: true, children: /* @__PURE__ */ jsx53(UserView, { isPending: true }) }),
|
|
5658
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {})
|
|
5882
5659
|
] }),
|
|
5883
|
-
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */
|
|
5884
|
-
/* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
5886
|
-
/* @__PURE__ */
|
|
5887
|
-
/* @__PURE__ */
|
|
5888
|
-
/* @__PURE__ */
|
|
5660
|
+
deviceSessions?.filter((sessionData) => sessionData.user.id !== user?.id).map(({ session, user: multiUser }) => /* @__PURE__ */ jsxs44(Fragment17, { children: [
|
|
5661
|
+
/* @__PURE__ */ jsxs44(DropdownMenuItem3, { onClick: () => switchAccount(session.token), children: [
|
|
5662
|
+
/* @__PURE__ */ jsx53(UserAvatar2, { src: multiUser?.image || void 0, alt: getName(multiUser) }),
|
|
5663
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
5664
|
+
/* @__PURE__ */ jsx53("span", { className: "truncate font-semibold text-foreground text-xs", children: getName(multiUser) }),
|
|
5665
|
+
/* @__PURE__ */ jsx53("span", { className: "block w-full truncate text-muted-foreground text-xs", children: multiUser?.email })
|
|
5889
5666
|
] })
|
|
5890
5667
|
] }),
|
|
5891
|
-
/* @__PURE__ */
|
|
5668
|
+
/* @__PURE__ */ jsx53(DropdownMenuSeparator, {})
|
|
5892
5669
|
] }, session.id)),
|
|
5893
|
-
/* @__PURE__ */
|
|
5894
|
-
/* @__PURE__ */
|
|
5670
|
+
/* @__PURE__ */ jsx53(DropdownMenuItem3, { asChild: true, children: /* @__PURE__ */ jsxs44(Link6, { href: path.auth.SIGN_IN, children: [
|
|
5671
|
+
/* @__PURE__ */ jsx53(PlusCircleIcon, {}),
|
|
5895
5672
|
t("systems.ADD_ACCOUNT")
|
|
5896
5673
|
] }) })
|
|
5897
5674
|
] })
|
|
@@ -5900,57 +5677,57 @@ function UserMenu({ hiddenSwitcher = false }) {
|
|
|
5900
5677
|
}
|
|
5901
5678
|
|
|
5902
5679
|
// src/ui/layouts/header.tsx
|
|
5903
|
-
import { jsx as
|
|
5680
|
+
import { jsx as jsx54, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5904
5681
|
function Header({ children }) {
|
|
5905
|
-
return /* @__PURE__ */
|
|
5682
|
+
return /* @__PURE__ */ jsx54("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__ */ jsx54("div", { className: "@container flex grow items-stretch justify-between gap-2.5 pe-5", children }) });
|
|
5906
5683
|
}
|
|
5907
5684
|
function HeaderLeft() {
|
|
5908
5685
|
const { logoHeader, sidebarToggle } = useLayout();
|
|
5909
|
-
return /* @__PURE__ */
|
|
5686
|
+
return /* @__PURE__ */ jsx54("div", { className: "flex items-center gap-2 px-5 lg:w-(--sidebar-width)", children: /* @__PURE__ */ jsxs45("div", { className: "flex w-full items-center justify-between", children: [
|
|
5910
5687
|
logoHeader,
|
|
5911
|
-
/* @__PURE__ */
|
|
5912
|
-
|
|
5688
|
+
/* @__PURE__ */ jsx54(
|
|
5689
|
+
Button31,
|
|
5913
5690
|
{
|
|
5914
5691
|
mode: "icon",
|
|
5915
5692
|
variant: "ghost",
|
|
5916
5693
|
onClick: sidebarToggle,
|
|
5917
5694
|
className: "hidden text-muted-foreground hover:text-foreground lg:inline-flex",
|
|
5918
|
-
children: /* @__PURE__ */
|
|
5695
|
+
children: /* @__PURE__ */ jsx54(PanelRight, { className: "-rotate-180 in-data-[sidebar-open=false]:rotate-0 opacity-100" })
|
|
5919
5696
|
}
|
|
5920
5697
|
)
|
|
5921
5698
|
] }) });
|
|
5922
5699
|
}
|
|
5923
5700
|
function HeaderRight({ sidebar, button }) {
|
|
5924
5701
|
const { isMobile } = useLayout();
|
|
5925
|
-
return /* @__PURE__ */
|
|
5702
|
+
return /* @__PURE__ */ jsxs45("nav", { className: "flex items-center gap-1.5 lg:gap-2.5", children: [
|
|
5926
5703
|
button,
|
|
5927
5704
|
isMobile && sidebar,
|
|
5928
|
-
/* @__PURE__ */
|
|
5705
|
+
/* @__PURE__ */ jsx54(UserMenu, {})
|
|
5929
5706
|
] });
|
|
5930
5707
|
}
|
|
5931
5708
|
function HeaderSidebarMobile({ children }) {
|
|
5932
5709
|
const pathname = usePathname2();
|
|
5933
|
-
const [isSheetOpen, setIsSheetOpen] =
|
|
5934
|
-
|
|
5710
|
+
const [isSheetOpen, setIsSheetOpen] = useState18(false);
|
|
5711
|
+
useEffect15(() => {
|
|
5935
5712
|
setIsSheetOpen(false);
|
|
5936
5713
|
}, [pathname]);
|
|
5937
|
-
return /* @__PURE__ */
|
|
5938
|
-
/* @__PURE__ */
|
|
5939
|
-
/* @__PURE__ */
|
|
5940
|
-
/* @__PURE__ */
|
|
5941
|
-
/* @__PURE__ */
|
|
5942
|
-
/* @__PURE__ */
|
|
5714
|
+
return /* @__PURE__ */ jsxs45(Sheet, { open: isSheetOpen, onOpenChange: setIsSheetOpen, children: [
|
|
5715
|
+
/* @__PURE__ */ jsx54(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(Button31, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx54(Menu, { className: "size-4" }) }) }),
|
|
5716
|
+
/* @__PURE__ */ jsxs45(SheetContent, { className: "w-(--sidebar-width) gap-0 p-0", side: "left", close: false, children: [
|
|
5717
|
+
/* @__PURE__ */ jsxs45(SheetHeader, { className: "hidden space-y-0 p-0", children: [
|
|
5718
|
+
/* @__PURE__ */ jsx54(SheetTitle, { className: "sr-only", children: "Navigation menu" }),
|
|
5719
|
+
/* @__PURE__ */ jsx54(SheetDescription, { className: "sr-only", children: "NavigatSheet Description" })
|
|
5943
5720
|
] }),
|
|
5944
|
-
/* @__PURE__ */
|
|
5721
|
+
/* @__PURE__ */ jsx54(SheetBody, { className: "flex grow flex-col p-0", children })
|
|
5945
5722
|
] })
|
|
5946
5723
|
] });
|
|
5947
5724
|
}
|
|
5948
5725
|
|
|
5949
5726
|
// src/ui/layouts/sidebar.tsx
|
|
5950
5727
|
import { useCallback as useCallback4, useMemo as useMemo5 } from "react";
|
|
5951
|
-
import
|
|
5728
|
+
import Link7 from "next/link";
|
|
5952
5729
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
5953
|
-
import { useTranslations as
|
|
5730
|
+
import { useTranslations as useTranslations45 } from "next-intl";
|
|
5954
5731
|
import { BackLink } from "pelatform-ui/components";
|
|
5955
5732
|
import {
|
|
5956
5733
|
AccordionMenu,
|
|
@@ -5964,26 +5741,26 @@ import {
|
|
|
5964
5741
|
Badge as Badge3,
|
|
5965
5742
|
ScrollArea
|
|
5966
5743
|
} from "pelatform-ui/default";
|
|
5967
|
-
import { Fragment as Fragment19, jsx as
|
|
5744
|
+
import { Fragment as Fragment19, jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5968
5745
|
function Sidebar({ children }) {
|
|
5969
5746
|
const { isMobile } = useLayout();
|
|
5970
5747
|
if (isMobile) {
|
|
5971
5748
|
return null;
|
|
5972
5749
|
}
|
|
5973
|
-
return /* @__PURE__ */
|
|
5750
|
+
return /* @__PURE__ */ jsxs46("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: [
|
|
5974
5751
|
children,
|
|
5975
|
-
/* @__PURE__ */
|
|
5752
|
+
/* @__PURE__ */ jsx55("div", {})
|
|
5976
5753
|
] });
|
|
5977
5754
|
}
|
|
5978
5755
|
function SidebarHeaderBack({
|
|
5979
5756
|
linkHref = "/",
|
|
5980
5757
|
admin = false
|
|
5981
5758
|
}) {
|
|
5982
|
-
const t =
|
|
5983
|
-
return /* @__PURE__ */
|
|
5759
|
+
const t = useTranslations45();
|
|
5760
|
+
return /* @__PURE__ */ jsx55("div", { className: "flex h-14 shrink-0 items-center gap-2 border-border border-b px-2.5 lg:h-15", children: /* @__PURE__ */ jsx55(BackLink, { Link: Link7, href: linkHref, children: admin ? t("systems.common.actions.back") : t("systems.navigation.settings") }) });
|
|
5984
5761
|
}
|
|
5985
5762
|
function SidebarContent({ children }) {
|
|
5986
|
-
return /* @__PURE__ */
|
|
5763
|
+
return /* @__PURE__ */ jsx55(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 });
|
|
5987
5764
|
}
|
|
5988
5765
|
function SidebarContentMenu({
|
|
5989
5766
|
menu,
|
|
@@ -6025,7 +5802,7 @@ function SidebarContentMenu({
|
|
|
6025
5802
|
[activePath, normalize]
|
|
6026
5803
|
);
|
|
6027
5804
|
if (type === "toggle") {
|
|
6028
|
-
return /* @__PURE__ */
|
|
5805
|
+
return /* @__PURE__ */ jsx55(
|
|
6029
5806
|
AccordionMenu,
|
|
6030
5807
|
{
|
|
6031
5808
|
type: "single",
|
|
@@ -6039,16 +5816,16 @@ function SidebarContentMenu({
|
|
|
6039
5816
|
subTrigger: "text-xs font-normal text-muted-foreground hover:bg-transparent",
|
|
6040
5817
|
subContent: "ps-0"
|
|
6041
5818
|
},
|
|
6042
|
-
children: menu.map((item, index) => /* @__PURE__ */
|
|
6043
|
-
/* @__PURE__ */
|
|
6044
|
-
/* @__PURE__ */
|
|
6045
|
-
/* @__PURE__ */
|
|
5819
|
+
children: menu.map((item, index) => /* @__PURE__ */ jsxs46(AccordionMenuSub, { value: item.title || "menu", children: [
|
|
5820
|
+
/* @__PURE__ */ jsxs46(AccordionMenuSubTrigger, { value: "menu-trigger", children: [
|
|
5821
|
+
/* @__PURE__ */ jsx55("span", { children: item.title }),
|
|
5822
|
+
/* @__PURE__ */ jsx55(AccordionMenuIndicator, {})
|
|
6046
5823
|
] }),
|
|
6047
|
-
/* @__PURE__ */
|
|
6048
|
-
const content = /* @__PURE__ */
|
|
6049
|
-
child.icon && /* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6051
|
-
child.badge && /* @__PURE__ */
|
|
5824
|
+
/* @__PURE__ */ jsx55(AccordionMenuSubContent, { type: "single", collapsible: true, parentValue: "menu-trigger", children: item.children?.map((child, idx) => {
|
|
5825
|
+
const content = /* @__PURE__ */ jsxs46(Fragment19, { children: [
|
|
5826
|
+
child.icon && /* @__PURE__ */ jsx55(child.icon, {}),
|
|
5827
|
+
/* @__PURE__ */ jsx55("span", { children: child.title }),
|
|
5828
|
+
child.badge && /* @__PURE__ */ jsx55(
|
|
6052
5829
|
Badge3,
|
|
6053
5830
|
{
|
|
6054
5831
|
size: "sm",
|
|
@@ -6059,8 +5836,8 @@ function SidebarContentMenu({
|
|
|
6059
5836
|
)
|
|
6060
5837
|
] });
|
|
6061
5838
|
if (child.external && child.path) {
|
|
6062
|
-
return /* @__PURE__ */
|
|
6063
|
-
|
|
5839
|
+
return /* @__PURE__ */ jsx55(
|
|
5840
|
+
Link7,
|
|
6064
5841
|
{
|
|
6065
5842
|
href: child.path,
|
|
6066
5843
|
target: "_blank",
|
|
@@ -6071,13 +5848,13 @@ function SidebarContentMenu({
|
|
|
6071
5848
|
child.path || `ext-${idx}`
|
|
6072
5849
|
);
|
|
6073
5850
|
}
|
|
6074
|
-
return /* @__PURE__ */
|
|
5851
|
+
return /* @__PURE__ */ jsx55(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx55(Link7, { href: child.path || "#", children: content }) }, idx);
|
|
6075
5852
|
}) })
|
|
6076
5853
|
] }, index))
|
|
6077
5854
|
}
|
|
6078
5855
|
);
|
|
6079
5856
|
}
|
|
6080
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsx55(
|
|
6081
5858
|
AccordionMenu,
|
|
6082
5859
|
{
|
|
6083
5860
|
type: "multiple",
|
|
@@ -6090,13 +5867,13 @@ function SidebarContentMenu({
|
|
|
6090
5867
|
group: ""
|
|
6091
5868
|
},
|
|
6092
5869
|
children: menu.map((item, index) => {
|
|
6093
|
-
return /* @__PURE__ */
|
|
6094
|
-
/* @__PURE__ */
|
|
5870
|
+
return /* @__PURE__ */ jsxs46(AccordionMenuGroup, { children: [
|
|
5871
|
+
/* @__PURE__ */ jsx55(AccordionMenuLabel, { children: item.title }),
|
|
6095
5872
|
item.children?.map((child, idx) => {
|
|
6096
|
-
const content = /* @__PURE__ */
|
|
6097
|
-
child.icon && /* @__PURE__ */
|
|
6098
|
-
/* @__PURE__ */
|
|
6099
|
-
child.badge && /* @__PURE__ */
|
|
5873
|
+
const content = /* @__PURE__ */ jsxs46(Fragment19, { children: [
|
|
5874
|
+
child.icon && /* @__PURE__ */ jsx55(child.icon, {}),
|
|
5875
|
+
/* @__PURE__ */ jsx55("span", { children: child.title }),
|
|
5876
|
+
child.badge && /* @__PURE__ */ jsx55(
|
|
6100
5877
|
Badge3,
|
|
6101
5878
|
{
|
|
6102
5879
|
size: "sm",
|
|
@@ -6107,8 +5884,8 @@ function SidebarContentMenu({
|
|
|
6107
5884
|
)
|
|
6108
5885
|
] });
|
|
6109
5886
|
if (child.external && child.path) {
|
|
6110
|
-
return /* @__PURE__ */
|
|
6111
|
-
|
|
5887
|
+
return /* @__PURE__ */ jsx55(
|
|
5888
|
+
Link7,
|
|
6112
5889
|
{
|
|
6113
5890
|
href: child.path,
|
|
6114
5891
|
target: "_blank",
|
|
@@ -6119,7 +5896,7 @@ function SidebarContentMenu({
|
|
|
6119
5896
|
child.path || `ext-${idx}`
|
|
6120
5897
|
);
|
|
6121
5898
|
}
|
|
6122
|
-
return /* @__PURE__ */
|
|
5899
|
+
return /* @__PURE__ */ jsx55(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx55(Link7, { href: child.path || "#", children: content }) }, idx);
|
|
6123
5900
|
})
|
|
6124
5901
|
] }, index);
|
|
6125
5902
|
})
|
|
@@ -6128,17 +5905,17 @@ function SidebarContentMenu({
|
|
|
6128
5905
|
}
|
|
6129
5906
|
|
|
6130
5907
|
// src/ui/layouts/site-footer.tsx
|
|
6131
|
-
import
|
|
6132
|
-
import { useTranslations as
|
|
5908
|
+
import Link8 from "next/link";
|
|
5909
|
+
import { useTranslations as useTranslations46 } from "next-intl";
|
|
5910
|
+
import { cn as cn41 } from "pelatform-ui";
|
|
6133
5911
|
import { SiteFooter as UISiteFooter } from "pelatform-ui/components";
|
|
6134
|
-
import { Button as
|
|
6135
|
-
import {
|
|
6136
|
-
import { jsx as jsx58, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5912
|
+
import { Button as Button32 } from "pelatform-ui/default";
|
|
5913
|
+
import { jsx as jsx56, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
6137
5914
|
function SiteFooter({ disableProjectBy = false }) {
|
|
6138
5915
|
const { app } = useConfig();
|
|
6139
|
-
const t =
|
|
6140
|
-
return /* @__PURE__ */
|
|
6141
|
-
/* @__PURE__ */
|
|
5916
|
+
const t = useTranslations46();
|
|
5917
|
+
return /* @__PURE__ */ jsxs47(UISiteFooter, { className: cn41("*:gap-2! *:py-0!", disableProjectBy ? "*:justify-center!" : ""), children: [
|
|
5918
|
+
/* @__PURE__ */ jsxs47("div", { className: "text-balance text-center text-muted-foreground text-sm leading-loose md:text-left", children: [
|
|
6142
5919
|
"\xA9 ",
|
|
6143
5920
|
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
6144
5921
|
" ",
|
|
@@ -6146,11 +5923,11 @@ function SiteFooter({ disableProjectBy = false }) {
|
|
|
6146
5923
|
". ",
|
|
6147
5924
|
t("customs.common.copyright")
|
|
6148
5925
|
] }),
|
|
6149
|
-
!disableProjectBy && /* @__PURE__ */
|
|
6150
|
-
/* @__PURE__ */
|
|
5926
|
+
!disableProjectBy && /* @__PURE__ */ jsx56("div", { className: "flex items-center gap-2.5 text-balance text-sm leading-loose", children: /* @__PURE__ */ jsxs47("div", { className: "inline-flex items-center gap-1", children: [
|
|
5927
|
+
/* @__PURE__ */ jsx56("span", { className: "text-muted-foreground", children: t("customs.common.project_by") }),
|
|
6151
5928
|
" ",
|
|
6152
|
-
/* @__PURE__ */
|
|
6153
|
-
|
|
5929
|
+
/* @__PURE__ */ jsx56(Button32, { mode: "link", underline: "dashed", children: /* @__PURE__ */ jsx56(
|
|
5930
|
+
Link8,
|
|
6154
5931
|
{
|
|
6155
5932
|
href: "https://pelatform.com",
|
|
6156
5933
|
target: "_blank",
|
|
@@ -6163,10 +5940,10 @@ function SiteFooter({ disableProjectBy = false }) {
|
|
|
6163
5940
|
}
|
|
6164
5941
|
|
|
6165
5942
|
// src/ui/layouts/site-header.tsx
|
|
6166
|
-
import { useState as
|
|
6167
|
-
import
|
|
6168
|
-
import { usePathname as usePathname4, useRouter as
|
|
6169
|
-
import { useTranslations as
|
|
5943
|
+
import { useState as useState19 } from "react";
|
|
5944
|
+
import Link9 from "next/link";
|
|
5945
|
+
import { usePathname as usePathname4, useRouter as useRouter16 } from "next/navigation";
|
|
5946
|
+
import { useTranslations as useTranslations47 } from "next-intl";
|
|
6170
5947
|
import {
|
|
6171
5948
|
MainNav,
|
|
6172
5949
|
MobileNav,
|
|
@@ -6174,35 +5951,35 @@ import {
|
|
|
6174
5951
|
ModeSwitcher as ModeSwitcher3,
|
|
6175
5952
|
SiteHeader as UISiteHeader
|
|
6176
5953
|
} from "pelatform-ui/components";
|
|
6177
|
-
import { Button as
|
|
6178
|
-
import { jsx as
|
|
5954
|
+
import { Button as Button33, Separator as Separator2 } from "pelatform-ui/default";
|
|
5955
|
+
import { jsx as jsx57, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
6179
5956
|
function SiteHeader({
|
|
6180
5957
|
menu,
|
|
6181
|
-
logo = /* @__PURE__ */
|
|
5958
|
+
logo = /* @__PURE__ */ jsx57(LogoWithHref, { href: "/home" })
|
|
6182
5959
|
}) {
|
|
6183
5960
|
const { path } = useConfig();
|
|
6184
5961
|
const pathname = usePathname4();
|
|
6185
|
-
const router =
|
|
6186
|
-
const t =
|
|
5962
|
+
const router = useRouter16();
|
|
5963
|
+
const t = useTranslations47();
|
|
6187
5964
|
const { isPending, session, user } = useSession();
|
|
6188
|
-
const [, setMobileNavOpen] =
|
|
5965
|
+
const [, setMobileNavOpen] = useState19(false);
|
|
6189
5966
|
const isAuthenticated = !isPending && session && user;
|
|
6190
|
-
return /* @__PURE__ */
|
|
6191
|
-
/* @__PURE__ */
|
|
5967
|
+
return /* @__PURE__ */ jsxs48(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
5968
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-4.5", children: [
|
|
6192
5969
|
logo,
|
|
6193
|
-
/* @__PURE__ */
|
|
5970
|
+
/* @__PURE__ */ jsx57(MainNav, { Link: Link9, pathname, items: menu })
|
|
6194
5971
|
] }),
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__PURE__ */
|
|
6197
|
-
/* @__PURE__ */
|
|
6198
|
-
/* @__PURE__ */
|
|
6199
|
-
/* @__PURE__ */
|
|
5972
|
+
/* @__PURE__ */ jsx57("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs48("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
5973
|
+
/* @__PURE__ */ jsx57(ModeSwitcher3, {}),
|
|
5974
|
+
/* @__PURE__ */ jsx57(LanguageSwitcher, {}),
|
|
5975
|
+
/* @__PURE__ */ jsx57(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
5976
|
+
/* @__PURE__ */ jsx57(MobileNav, { children: /* @__PURE__ */ jsxs48("div", { className: "flex flex-col space-y-3", children: [
|
|
6200
5977
|
menu?.map(
|
|
6201
|
-
(item, navIndex) => item.href || item.children ? /* @__PURE__ */
|
|
5978
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx57(
|
|
6202
5979
|
MobileNavItemRenderer,
|
|
6203
5980
|
{
|
|
6204
5981
|
item,
|
|
6205
|
-
Link:
|
|
5982
|
+
Link: Link9,
|
|
6206
5983
|
pathname,
|
|
6207
5984
|
level: 1,
|
|
6208
5985
|
onOpenChange: setMobileNavOpen
|
|
@@ -6210,8 +5987,8 @@ function SiteHeader({
|
|
|
6210
5987
|
`nav-${navIndex}-${item.href}`
|
|
6211
5988
|
) : null
|
|
6212
5989
|
),
|
|
6213
|
-
/* @__PURE__ */
|
|
6214
|
-
|
|
5990
|
+
/* @__PURE__ */ jsx57("div", { className: "border-t pt-3", children: isAuthenticated ? /* @__PURE__ */ jsx57(
|
|
5991
|
+
Button33,
|
|
6215
5992
|
{
|
|
6216
5993
|
variant: "outline",
|
|
6217
5994
|
size: "sm",
|
|
@@ -6219,36 +5996,36 @@ function SiteHeader({
|
|
|
6219
5996
|
onClick: () => router.push(path.auth.SIGN_OUT),
|
|
6220
5997
|
children: t("systems.navigation.logout")
|
|
6221
5998
|
}
|
|
6222
|
-
) : /* @__PURE__ */
|
|
5999
|
+
) : /* @__PURE__ */ jsx57(Button33, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx57(Link9, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) }) })
|
|
6223
6000
|
] }) }),
|
|
6224
|
-
isAuthenticated ? /* @__PURE__ */
|
|
6001
|
+
isAuthenticated ? /* @__PURE__ */ jsx57(UserMenu, { hiddenSwitcher: true }) : /* @__PURE__ */ jsx57(Button33, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx57(Link9, { href: path.auth.SIGN_IN, children: t("systems.navigation.login") }) })
|
|
6225
6002
|
] }) })
|
|
6226
6003
|
] });
|
|
6227
6004
|
}
|
|
6228
6005
|
function SiteHeaderSecondary({
|
|
6229
6006
|
menu,
|
|
6230
|
-
logo = /* @__PURE__ */
|
|
6007
|
+
logo = /* @__PURE__ */ jsx57(LogoWithHref, { href: "/home" }),
|
|
6231
6008
|
loginLink
|
|
6232
6009
|
}) {
|
|
6233
6010
|
const pathname = usePathname4();
|
|
6234
|
-
const t =
|
|
6235
|
-
const [, setMobileNavOpen] =
|
|
6236
|
-
return /* @__PURE__ */
|
|
6237
|
-
/* @__PURE__ */
|
|
6011
|
+
const t = useTranslations47();
|
|
6012
|
+
const [, setMobileNavOpen] = useState19(false);
|
|
6013
|
+
return /* @__PURE__ */ jsxs48(UISiteHeader, { className: "backdrop-blur-none supports-backdrop-filter:bg-background", children: [
|
|
6014
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-4.5", children: [
|
|
6238
6015
|
logo,
|
|
6239
|
-
/* @__PURE__ */
|
|
6016
|
+
/* @__PURE__ */ jsx57(MainNav, { Link: Link9, pathname, items: menu })
|
|
6240
6017
|
] }),
|
|
6241
|
-
/* @__PURE__ */
|
|
6242
|
-
/* @__PURE__ */
|
|
6243
|
-
/* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6245
|
-
/* @__PURE__ */
|
|
6018
|
+
/* @__PURE__ */ jsx57("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs48("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
6019
|
+
/* @__PURE__ */ jsx57(ModeSwitcher3, {}),
|
|
6020
|
+
/* @__PURE__ */ jsx57(LanguageSwitcher, {}),
|
|
6021
|
+
/* @__PURE__ */ jsx57(Separator2, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
6022
|
+
/* @__PURE__ */ jsx57(MobileNav, { children: /* @__PURE__ */ jsxs48("div", { className: "flex flex-col space-y-3", children: [
|
|
6246
6023
|
menu?.map(
|
|
6247
|
-
(item, navIndex) => item.href || item.children ? /* @__PURE__ */
|
|
6024
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx57(
|
|
6248
6025
|
MobileNavItemRenderer,
|
|
6249
6026
|
{
|
|
6250
6027
|
item,
|
|
6251
|
-
Link:
|
|
6028
|
+
Link: Link9,
|
|
6252
6029
|
pathname,
|
|
6253
6030
|
level: 1,
|
|
6254
6031
|
onOpenChange: setMobileNavOpen
|
|
@@ -6256,18 +6033,18 @@ function SiteHeaderSecondary({
|
|
|
6256
6033
|
`nav-${navIndex}-${item.href}`
|
|
6257
6034
|
) : null
|
|
6258
6035
|
),
|
|
6259
|
-
loginLink && /* @__PURE__ */
|
|
6036
|
+
loginLink && /* @__PURE__ */ jsx57("div", { className: "border-t pt-3", children: /* @__PURE__ */ jsx57(Button33, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx57(Link9, { href: loginLink, children: t("systems.navigation.login") }) }) })
|
|
6260
6037
|
] }) }),
|
|
6261
|
-
loginLink && /* @__PURE__ */
|
|
6038
|
+
loginLink && /* @__PURE__ */ jsx57(Button33, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx57(Link9, { href: loginLink, children: t("systems.navigation.login") }) })
|
|
6262
6039
|
] }) })
|
|
6263
6040
|
] });
|
|
6264
6041
|
}
|
|
6265
6042
|
|
|
6266
6043
|
// src/ui/providers/layout.tsx
|
|
6267
|
-
import { useEffect as
|
|
6044
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
6045
|
+
import { cn as cn42 } from "pelatform-ui";
|
|
6268
6046
|
import { useIsMobile } from "pelatform-ui/hooks";
|
|
6269
|
-
import {
|
|
6270
|
-
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
6047
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
6271
6048
|
var SIDEBAR_WIDTH = "240px";
|
|
6272
6049
|
var HEADER_HEIGHT = "54px";
|
|
6273
6050
|
var SIDEBAR_WIDTH_MOBILE = "240px";
|
|
@@ -6277,10 +6054,10 @@ function LayoutProvider({
|
|
|
6277
6054
|
style: customStyle,
|
|
6278
6055
|
bodyClassName = "",
|
|
6279
6056
|
className = "",
|
|
6280
|
-
logoHeader = /* @__PURE__ */
|
|
6057
|
+
logoHeader = /* @__PURE__ */ jsx58(LogoWithHref, {})
|
|
6281
6058
|
}) {
|
|
6282
6059
|
const isMobile = useIsMobile();
|
|
6283
|
-
const [isSidebarOpen, setIsSidebarOpen] =
|
|
6060
|
+
const [isSidebarOpen, setIsSidebarOpen] = useState20(true);
|
|
6284
6061
|
const defaultStyle = {
|
|
6285
6062
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
6286
6063
|
"--header-height": HEADER_HEIGHT,
|
|
@@ -6292,7 +6069,7 @@ function LayoutProvider({
|
|
|
6292
6069
|
...customStyle
|
|
6293
6070
|
};
|
|
6294
6071
|
const sidebarToggle = () => setIsSidebarOpen((open) => !open);
|
|
6295
|
-
|
|
6072
|
+
useEffect16(() => {
|
|
6296
6073
|
if (bodyClassName) {
|
|
6297
6074
|
const body = document.body;
|
|
6298
6075
|
const existingClasses = body.className;
|
|
@@ -6302,7 +6079,7 @@ function LayoutProvider({
|
|
|
6302
6079
|
};
|
|
6303
6080
|
}
|
|
6304
6081
|
}, [bodyClassName]);
|
|
6305
|
-
return /* @__PURE__ */
|
|
6082
|
+
return /* @__PURE__ */ jsx58(
|
|
6306
6083
|
LayoutContext.Provider,
|
|
6307
6084
|
{
|
|
6308
6085
|
value: {
|
|
@@ -6313,11 +6090,11 @@ function LayoutProvider({
|
|
|
6313
6090
|
sidebarToggle,
|
|
6314
6091
|
logoHeader
|
|
6315
6092
|
},
|
|
6316
|
-
children: /* @__PURE__ */
|
|
6093
|
+
children: /* @__PURE__ */ jsx58(
|
|
6317
6094
|
"div",
|
|
6318
6095
|
{
|
|
6319
6096
|
"data-slot": "layout-wrapper",
|
|
6320
|
-
className:
|
|
6097
|
+
className: cn42("flex grow", className),
|
|
6321
6098
|
"data-sidebar-open": isSidebarOpen,
|
|
6322
6099
|
style,
|
|
6323
6100
|
children
|
|
@@ -6328,25 +6105,225 @@ function LayoutProvider({
|
|
|
6328
6105
|
}
|
|
6329
6106
|
|
|
6330
6107
|
// src/ui/layouts/wrapper.tsx
|
|
6331
|
-
import { Fragment as Fragment20, jsx as
|
|
6108
|
+
import { Fragment as Fragment20, jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
6332
6109
|
function LayoutWrapper({
|
|
6333
6110
|
children,
|
|
6334
6111
|
sidebarHeader,
|
|
6335
6112
|
sidebarMenu,
|
|
6336
6113
|
logoHeader
|
|
6337
6114
|
}) {
|
|
6338
|
-
const sidebarContent = /* @__PURE__ */
|
|
6115
|
+
const sidebarContent = /* @__PURE__ */ jsxs49(Fragment20, { children: [
|
|
6339
6116
|
sidebarHeader,
|
|
6340
|
-
/* @__PURE__ */
|
|
6117
|
+
/* @__PURE__ */ jsx59(SidebarContent, { children: sidebarMenu })
|
|
6341
6118
|
] });
|
|
6342
|
-
return /* @__PURE__ */
|
|
6343
|
-
/* @__PURE__ */
|
|
6344
|
-
/* @__PURE__ */
|
|
6345
|
-
/* @__PURE__ */
|
|
6119
|
+
return /* @__PURE__ */ jsxs49(LayoutProvider, { logoHeader, children: [
|
|
6120
|
+
/* @__PURE__ */ jsxs49(Header, { children: [
|
|
6121
|
+
/* @__PURE__ */ jsx59(HeaderLeft, {}),
|
|
6122
|
+
/* @__PURE__ */ jsx59(HeaderRight, { sidebar: /* @__PURE__ */ jsx59(HeaderSidebarMobile, { children: sidebarContent }) })
|
|
6346
6123
|
] }),
|
|
6347
|
-
/* @__PURE__ */
|
|
6348
|
-
/* @__PURE__ */
|
|
6349
|
-
/* @__PURE__ */
|
|
6124
|
+
/* @__PURE__ */ jsxs49("div", { className: "flex grow pt-(--header-height-mobile) lg:pt-(--header-height)", children: [
|
|
6125
|
+
/* @__PURE__ */ jsx59(Sidebar, { children: sidebarContent }),
|
|
6126
|
+
/* @__PURE__ */ jsx59("main", { className: "grow transition-all duration-300 lg:in-data-[sidebar-open=false]:ps-0 lg:ps-(--sidebar-width)", children })
|
|
6127
|
+
] })
|
|
6128
|
+
] });
|
|
6129
|
+
}
|
|
6130
|
+
|
|
6131
|
+
// src/ui/pages/accept-invitation.tsx
|
|
6132
|
+
import { useEffect as useEffect17, useState as useState21 } from "react";
|
|
6133
|
+
import { useRouter as useRouter17, useSearchParams as useSearchParams6 } from "next/navigation";
|
|
6134
|
+
import { CheckIcon as CheckIcon4, XIcon } from "lucide-react";
|
|
6135
|
+
import { useTranslations as useTranslations48 } from "next-intl";
|
|
6136
|
+
import { cn as cn43 } from "pelatform-ui";
|
|
6137
|
+
import { AlertToast as AlertToast24 } from "pelatform-ui/components";
|
|
6138
|
+
import { Button as Button34, Card as Card11, CardContent as CardContent3, CardHeader as CardHeader2, Skeleton as Skeleton10, Spinner as Spinner20 } from "pelatform-ui/default";
|
|
6139
|
+
import { jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
6140
|
+
function AcceptInvitation({
|
|
6141
|
+
className,
|
|
6142
|
+
classNames,
|
|
6143
|
+
redirectTo: redirectToProp
|
|
6144
|
+
}) {
|
|
6145
|
+
const router = useRouter17();
|
|
6146
|
+
const searchParams = useSearchParams6();
|
|
6147
|
+
const t = useTranslations48();
|
|
6148
|
+
const { data: sessionData } = useSession();
|
|
6149
|
+
const { redirectTo } = useOnSuccessTransition(redirectToProp);
|
|
6150
|
+
const [invitationId, setInvitationId] = useState21(null);
|
|
6151
|
+
useEffect17(() => {
|
|
6152
|
+
const invitationIdParam = searchParams.get("invitationId");
|
|
6153
|
+
if (!invitationIdParam) {
|
|
6154
|
+
AlertToast24({
|
|
6155
|
+
message: t("systems.INVITATION_NOT_FOUND"),
|
|
6156
|
+
icon: "destructive"
|
|
6157
|
+
});
|
|
6158
|
+
router.replace(redirectTo);
|
|
6159
|
+
return;
|
|
6160
|
+
}
|
|
6161
|
+
setInvitationId(invitationIdParam);
|
|
6162
|
+
}, [router, redirectTo, searchParams.get, t]);
|
|
6163
|
+
if (!sessionData || !invitationId) {
|
|
6164
|
+
return /* @__PURE__ */ jsx60(AcceptInvitationSkeleton, { className, classNames });
|
|
6165
|
+
}
|
|
6166
|
+
return /* @__PURE__ */ jsx60(
|
|
6167
|
+
AcceptInvitationContent,
|
|
6168
|
+
{
|
|
6169
|
+
className,
|
|
6170
|
+
classNames,
|
|
6171
|
+
invitationId,
|
|
6172
|
+
redirectTo
|
|
6173
|
+
}
|
|
6174
|
+
);
|
|
6175
|
+
}
|
|
6176
|
+
function AcceptInvitationContent({
|
|
6177
|
+
className,
|
|
6178
|
+
classNames,
|
|
6179
|
+
invitationId,
|
|
6180
|
+
redirectTo
|
|
6181
|
+
}) {
|
|
6182
|
+
const { authClient } = useConfig();
|
|
6183
|
+
const router = useRouter17();
|
|
6184
|
+
const t = useTranslations48();
|
|
6185
|
+
const { data: invitation, isPending } = useInvitation({
|
|
6186
|
+
query: {
|
|
6187
|
+
id: invitationId
|
|
6188
|
+
}
|
|
6189
|
+
});
|
|
6190
|
+
const [isRejecting, setIsRejecting] = useState21(false);
|
|
6191
|
+
const [isAccepting, setIsAccepting] = useState21(false);
|
|
6192
|
+
const isProcessing = isRejecting || isAccepting;
|
|
6193
|
+
useEffect17(() => {
|
|
6194
|
+
if (isPending || !invitationId) return;
|
|
6195
|
+
if (!invitation) {
|
|
6196
|
+
AlertToast24({
|
|
6197
|
+
message: t("systems.INVITATION_NOT_FOUND"),
|
|
6198
|
+
icon: "destructive"
|
|
6199
|
+
});
|
|
6200
|
+
router.replace(redirectTo);
|
|
6201
|
+
return;
|
|
6202
|
+
}
|
|
6203
|
+
if (invitation.status !== "pending" || new Date(invitation.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
6204
|
+
AlertToast24({
|
|
6205
|
+
message: new Date(invitation.expiresAt) < /* @__PURE__ */ new Date() ? t("systems.INVITATION_EXPIRED") : t("systems.INVITATION_NOT_FOUND"),
|
|
6206
|
+
icon: "destructive"
|
|
6207
|
+
});
|
|
6208
|
+
router.replace(redirectTo);
|
|
6209
|
+
}
|
|
6210
|
+
}, [invitation, isPending, invitationId, router, redirectTo, t]);
|
|
6211
|
+
const acceptInvitation = async () => {
|
|
6212
|
+
setIsAccepting(true);
|
|
6213
|
+
try {
|
|
6214
|
+
await authClient.organization.acceptInvitation({
|
|
6215
|
+
invitationId,
|
|
6216
|
+
fetchOptions: { throw: true }
|
|
6217
|
+
});
|
|
6218
|
+
AlertToast24({
|
|
6219
|
+
message: t("systems.INVITATION_ACCEPTED")
|
|
6220
|
+
});
|
|
6221
|
+
router.replace(redirectTo);
|
|
6222
|
+
} catch (error) {
|
|
6223
|
+
AlertToast24({
|
|
6224
|
+
message: getTranslations({ error, t }),
|
|
6225
|
+
icon: "destructive"
|
|
6226
|
+
});
|
|
6227
|
+
setIsAccepting(false);
|
|
6228
|
+
}
|
|
6229
|
+
};
|
|
6230
|
+
const rejectInvitation = async () => {
|
|
6231
|
+
setIsRejecting(true);
|
|
6232
|
+
try {
|
|
6233
|
+
await authClient.organization.rejectInvitation({
|
|
6234
|
+
invitationId,
|
|
6235
|
+
fetchOptions: { throw: true }
|
|
6236
|
+
});
|
|
6237
|
+
AlertToast24({
|
|
6238
|
+
message: t("systems.INVITATION_REJECTED")
|
|
6239
|
+
});
|
|
6240
|
+
router.replace(redirectTo);
|
|
6241
|
+
} catch (error) {
|
|
6242
|
+
AlertToast24({
|
|
6243
|
+
message: getTranslations({ error, t }),
|
|
6244
|
+
icon: "destructive"
|
|
6245
|
+
});
|
|
6246
|
+
setIsRejecting(false);
|
|
6247
|
+
}
|
|
6248
|
+
};
|
|
6249
|
+
if (!invitation) {
|
|
6250
|
+
return /* @__PURE__ */ jsx60(AcceptInvitationSkeleton, { className, classNames });
|
|
6251
|
+
}
|
|
6252
|
+
return /* @__PURE__ */ jsxs50(Card11, { className: cn43("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6253
|
+
/* @__PURE__ */ jsx60(CardHeader2, { className: "py-4", children: /* @__PURE__ */ jsx60(
|
|
6254
|
+
CardHeaderComponent,
|
|
6255
|
+
{
|
|
6256
|
+
title: t("systems.ACCEPT_INVITATION"),
|
|
6257
|
+
description: t("systems.ACCEPT_INVITATION_DESCRIPTION")
|
|
6258
|
+
}
|
|
6259
|
+
) }),
|
|
6260
|
+
/* @__PURE__ */ jsxs50(CardContent3, { className: cn43("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
6261
|
+
/* @__PURE__ */ jsxs50(Card11, { className: cn43("flex-row items-center p-4"), children: [
|
|
6262
|
+
/* @__PURE__ */ jsx60(
|
|
6263
|
+
WorkspaceView,
|
|
6264
|
+
{
|
|
6265
|
+
workspace: {
|
|
6266
|
+
id: invitation.organizationId,
|
|
6267
|
+
name: invitation.organizationName,
|
|
6268
|
+
slug: invitation.organizationSlug,
|
|
6269
|
+
// logo: invitation.organizationLogo,
|
|
6270
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
6271
|
+
}
|
|
6272
|
+
}
|
|
6273
|
+
),
|
|
6274
|
+
/* @__PURE__ */ jsx60("p", { className: "ms-auto font-semibold text-muted-foreground text-sm", children: t(`systems.${invitation?.role.toUpperCase()}`) || invitation?.role })
|
|
6275
|
+
] }),
|
|
6276
|
+
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
6277
|
+
/* @__PURE__ */ jsxs50(
|
|
6278
|
+
Button34,
|
|
6279
|
+
{
|
|
6280
|
+
variant: "destructive",
|
|
6281
|
+
className: cn43(classNames?.button, classNames?.destructiveButton),
|
|
6282
|
+
onClick: rejectInvitation,
|
|
6283
|
+
disabled: isProcessing,
|
|
6284
|
+
children: [
|
|
6285
|
+
isRejecting ? /* @__PURE__ */ jsx60(Spinner20, {}) : /* @__PURE__ */ jsx60(XIcon, {}),
|
|
6286
|
+
t("systems.REJECT")
|
|
6287
|
+
]
|
|
6288
|
+
}
|
|
6289
|
+
),
|
|
6290
|
+
/* @__PURE__ */ jsxs50(
|
|
6291
|
+
Button34,
|
|
6292
|
+
{
|
|
6293
|
+
className: cn43(classNames?.button, classNames?.primaryButton),
|
|
6294
|
+
onClick: acceptInvitation,
|
|
6295
|
+
disabled: isProcessing,
|
|
6296
|
+
children: [
|
|
6297
|
+
isAccepting ? /* @__PURE__ */ jsx60(Spinner20, {}) : /* @__PURE__ */ jsx60(CheckIcon4, {}),
|
|
6298
|
+
t("systems.ACCEPT")
|
|
6299
|
+
]
|
|
6300
|
+
}
|
|
6301
|
+
)
|
|
6302
|
+
] })
|
|
6303
|
+
] })
|
|
6304
|
+
] });
|
|
6305
|
+
}
|
|
6306
|
+
function AcceptInvitationSkeleton({ className, classNames }) {
|
|
6307
|
+
const t = useTranslations48();
|
|
6308
|
+
return /* @__PURE__ */ jsxs50(Card11, { className: cn43("w-full max-w-md overflow-hidden", className, classNames?.base), children: [
|
|
6309
|
+
/* @__PURE__ */ jsx60(CardHeader2, { className: "py-4", children: /* @__PURE__ */ jsx60(
|
|
6310
|
+
CardHeaderComponent,
|
|
6311
|
+
{
|
|
6312
|
+
className: "w-full",
|
|
6313
|
+
title: t("systems.ACCEPT_INVITATION"),
|
|
6314
|
+
description: t("systems.ACCEPT_INVITATION_DESCRIPTION"),
|
|
6315
|
+
isPending: true
|
|
6316
|
+
}
|
|
6317
|
+
) }),
|
|
6318
|
+
/* @__PURE__ */ jsxs50(CardContent3, { className: cn43("flex flex-col gap-6 truncate", classNames?.content), children: [
|
|
6319
|
+
/* @__PURE__ */ jsxs50(Card11, { className: cn43("flex-row items-center p-4"), children: [
|
|
6320
|
+
/* @__PURE__ */ jsx60(WorkspaceView, { isPending: true }),
|
|
6321
|
+
/* @__PURE__ */ jsx60(Skeleton10, { className: "ms-auto mt-0.5 h-4 w-full max-w-14 shrink-2" })
|
|
6322
|
+
] }),
|
|
6323
|
+
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
6324
|
+
/* @__PURE__ */ jsx60(Skeleton10, { className: "h-9 w-full" }),
|
|
6325
|
+
/* @__PURE__ */ jsx60(Skeleton10, { className: "h-9 w-full" })
|
|
6326
|
+
] })
|
|
6350
6327
|
] })
|
|
6351
6328
|
] });
|
|
6352
6329
|
}
|
|
@@ -6357,7 +6334,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
|
6357
6334
|
import { NextIntlClientProvider } from "next-intl";
|
|
6358
6335
|
import { QueryProvider, ThemeProvider } from "pelatform-ui/components";
|
|
6359
6336
|
import { Toaster as Sonner } from "pelatform-ui/default";
|
|
6360
|
-
import { jsx as
|
|
6337
|
+
import { jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
6361
6338
|
function SharedProviders({
|
|
6362
6339
|
children,
|
|
6363
6340
|
locale,
|
|
@@ -6366,20 +6343,20 @@ function SharedProviders({
|
|
|
6366
6343
|
sonnerPosition = "top-center"
|
|
6367
6344
|
}) {
|
|
6368
6345
|
const config = useConfig();
|
|
6369
|
-
return /* @__PURE__ */
|
|
6370
|
-
/* @__PURE__ */
|
|
6346
|
+
return /* @__PURE__ */ jsxs51(QueryProvider, { children: [
|
|
6347
|
+
/* @__PURE__ */ jsx61(ThemeProvider, { defaultTheme: config.ui.defaultTheme, children: /* @__PURE__ */ jsx61(NextIntlClientProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsxs51(Suspense2, { children: [
|
|
6371
6348
|
children,
|
|
6372
|
-
/* @__PURE__ */
|
|
6349
|
+
/* @__PURE__ */ jsx61(Sonner, { position: sonnerPosition })
|
|
6373
6350
|
] }) }) }),
|
|
6374
|
-
/* @__PURE__ */
|
|
6351
|
+
/* @__PURE__ */ jsx61(ReactQueryDevtools, { initialIsOpen: false })
|
|
6375
6352
|
] });
|
|
6376
6353
|
}
|
|
6377
6354
|
|
|
6378
6355
|
// src/ui/shared/empty-state.tsx
|
|
6379
|
-
import
|
|
6380
|
-
import { useTranslations as
|
|
6381
|
-
import { cn as cn44 } from "
|
|
6382
|
-
import { jsx as
|
|
6356
|
+
import Link10 from "next/link";
|
|
6357
|
+
import { useTranslations as useTranslations49 } from "next-intl";
|
|
6358
|
+
import { cn as cn44 } from "pelatform-ui";
|
|
6359
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6383
6360
|
function EmptyState({
|
|
6384
6361
|
className,
|
|
6385
6362
|
icon: Icon,
|
|
@@ -6389,15 +6366,15 @@ function EmptyState({
|
|
|
6389
6366
|
learnMoreText,
|
|
6390
6367
|
children
|
|
6391
6368
|
}) {
|
|
6392
|
-
const t =
|
|
6393
|
-
return /* @__PURE__ */
|
|
6394
|
-
Icon && /* @__PURE__ */
|
|
6395
|
-
/* @__PURE__ */
|
|
6396
|
-
description && /* @__PURE__ */
|
|
6369
|
+
const t = useTranslations49();
|
|
6370
|
+
return /* @__PURE__ */ jsxs52("div", { className: cn44("flex flex-col items-center justify-center gap-y-4", className), children: [
|
|
6371
|
+
Icon && /* @__PURE__ */ jsx62("div", { className: "flex size-14 items-center justify-center rounded-2xl border bg-muted", children: /* @__PURE__ */ jsx62(Icon, { className: "size-6 text-foreground" }) }),
|
|
6372
|
+
/* @__PURE__ */ jsx62("p", { className: "text-center font-medium text-base text-foreground", children: title }),
|
|
6373
|
+
description && /* @__PURE__ */ jsxs52("p", { className: "max-w-sm text-balance text-center text-muted-foreground text-sm", children: [
|
|
6397
6374
|
description,
|
|
6398
6375
|
" ",
|
|
6399
|
-
learnMore && /* @__PURE__ */
|
|
6400
|
-
|
|
6376
|
+
learnMore && /* @__PURE__ */ jsxs52(
|
|
6377
|
+
Link10,
|
|
6401
6378
|
{
|
|
6402
6379
|
href: learnMore,
|
|
6403
6380
|
className: "text-foreground underline underline-offset-2 transition-colors hover:text-primary",
|
|
@@ -6411,6 +6388,24 @@ function EmptyState({
|
|
|
6411
6388
|
children
|
|
6412
6389
|
] });
|
|
6413
6390
|
}
|
|
6391
|
+
|
|
6392
|
+
// src/ui/shared/signed-in-hint.tsx
|
|
6393
|
+
import Link11 from "next/link";
|
|
6394
|
+
import { useTranslations as useTranslations50 } from "next-intl";
|
|
6395
|
+
import { Button as Button35 } from "pelatform-ui/default";
|
|
6396
|
+
import { jsx as jsx63, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6397
|
+
function SignedInHint({ linkHref = "/signin" }) {
|
|
6398
|
+
const t = useTranslations50("customs.common.signed");
|
|
6399
|
+
const { isPending, user } = useSession();
|
|
6400
|
+
return /* @__PURE__ */ jsxs53("div", { className: "fixed start-0 bottom-0 z-40 m-5 flex flex-col gap-2", children: [
|
|
6401
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
|
|
6402
|
+
t("text"),
|
|
6403
|
+
" ",
|
|
6404
|
+
isPending || !user ? /* @__PURE__ */ jsx63("span", { className: "h-3 w-32 animate-pulse rounded-md border bg-muted-foreground" }) : /* @__PURE__ */ jsx63("b", { className: "text-foreground", children: user.email })
|
|
6405
|
+
] }),
|
|
6406
|
+
/* @__PURE__ */ jsx63(Button35, { variant: "mono", className: "h-8 w-fit rounded-lg px-3 text-xs shadow-sm", children: /* @__PURE__ */ jsx63(Link11, { href: linkHref, children: t("button") }) })
|
|
6407
|
+
] });
|
|
6408
|
+
}
|
|
6414
6409
|
export {
|
|
6415
6410
|
AcceptInvitation,
|
|
6416
6411
|
ApiKeyDeleteDialog,
|