@xk2800/nextjs-template 0.7.1-beta.13 → 0.7.1-beta.15
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/components/auth/oneTap.tsx +9 -1
- package/components/ui/alert-dialog.tsx +1 -1
- package/components/ui/avatar.tsx +1 -1
- package/components/ui/badge.tsx +2 -2
- package/components/ui/dialog.tsx +1 -1
- package/components/ui/dropdown-menu.tsx +1 -1
- package/components/ui/label.tsx +1 -1
- package/dist/api/feedback.js +498 -63
- package/dist/api/feedback.js.map +1 -1
- package/dist/api/feedback.mjs +1 -1
- package/dist/api/marketing.js +498 -63
- package/dist/api/marketing.js.map +1 -1
- package/dist/api/marketing.mjs +2 -2
- package/dist/auth/helpers.d.mts +3 -3
- package/dist/auth/helpers.d.ts +3 -3
- package/dist/auth/helpers.js +496 -61
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/helpers.mjs +2 -2
- package/dist/auth/index.d.mts +142 -10
- package/dist/auth/index.d.ts +142 -10
- package/dist/auth/index.js +496 -61
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/auth-client/index.d.mts +16 -16
- package/dist/auth-client/index.d.ts +16 -16
- package/dist/{chunk-6Z3WUSDJ.mjs → chunk-A2K3FVDH.mjs} +3 -3
- package/dist/{chunk-6Z3WUSDJ.mjs.map → chunk-A2K3FVDH.mjs.map} +1 -1
- package/dist/chunk-WJMWCE2I.mjs +897 -0
- package/dist/chunk-WJMWCE2I.mjs.map +1 -0
- package/package.json +2 -16
- package/dist/chunk-7QVIOQ47.mjs +0 -462
- package/dist/chunk-7QVIOQ47.mjs.map +0 -1
package/dist/auth/index.mjs
CHANGED
|
@@ -826,8 +826,8 @@ declare const authClient: better_auth_react.ReactAuthClient<{
|
|
|
826
826
|
$Infer: {
|
|
827
827
|
body: {
|
|
828
828
|
permissions: {
|
|
829
|
-
readonly user?: ("
|
|
830
|
-
readonly session?: ("
|
|
829
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
830
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
831
831
|
};
|
|
832
832
|
} & {
|
|
833
833
|
userId?: string | undefined;
|
|
@@ -916,8 +916,8 @@ declare const authClient: better_auth_react.ReactAuthClient<{
|
|
|
916
916
|
admin: {
|
|
917
917
|
checkRolePermission: <R extends "user" | "admin">(data: {
|
|
918
918
|
permissions: {
|
|
919
|
-
readonly user?: ("
|
|
920
|
-
readonly session?: ("
|
|
919
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
920
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
921
921
|
};
|
|
922
922
|
} & {
|
|
923
923
|
role: R;
|
|
@@ -2423,8 +2423,8 @@ declare const useSession: () => {
|
|
|
2423
2423
|
banned: boolean | null | undefined;
|
|
2424
2424
|
} & {
|
|
2425
2425
|
role?: string | null | undefined;
|
|
2426
|
-
banExpires?: Date | null | undefined;
|
|
2427
2426
|
banReason?: string | null | undefined;
|
|
2427
|
+
banExpires?: Date | null | undefined;
|
|
2428
2428
|
} & {
|
|
2429
2429
|
twoFactorEnabled: boolean | null | undefined;
|
|
2430
2430
|
} & {}>;
|
|
@@ -2450,7 +2450,7 @@ declare const useSession: () => {
|
|
|
2450
2450
|
};
|
|
2451
2451
|
declare const signIn: {
|
|
2452
2452
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
2453
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2453
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2454
2454
|
callbackURL?: string | undefined;
|
|
2455
2455
|
newUserCallbackURL?: string | undefined;
|
|
2456
2456
|
errorCallbackURL?: string | undefined;
|
|
@@ -2475,7 +2475,7 @@ declare const signIn: {
|
|
|
2475
2475
|
additionalParams?: Record<string, string> | undefined;
|
|
2476
2476
|
additionalData?: Record<string, any> | undefined;
|
|
2477
2477
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, string | undefined> | undefined>>(data_0: better_auth.Prettify<Omit<{
|
|
2478
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2478
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2479
2479
|
callbackURL?: string | undefined;
|
|
2480
2480
|
newUserCallbackURL?: string | undefined;
|
|
2481
2481
|
errorCallbackURL?: string | undefined;
|
|
@@ -2502,7 +2502,7 @@ declare const signIn: {
|
|
|
2502
2502
|
} & {
|
|
2503
2503
|
fetchOptions?: FetchOptions | undefined;
|
|
2504
2504
|
}, "provider"> & {
|
|
2505
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2505
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2506
2506
|
fetchOptions?: FetchOptions | undefined;
|
|
2507
2507
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
2508
2508
|
redirect: boolean;
|
|
@@ -2533,8 +2533,8 @@ declare const signIn: {
|
|
|
2533
2533
|
banned: boolean | null | undefined;
|
|
2534
2534
|
} & {
|
|
2535
2535
|
role?: string | null | undefined;
|
|
2536
|
-
banExpires?: Date | null | undefined;
|
|
2537
2536
|
banReason?: string | null | undefined;
|
|
2537
|
+
banExpires?: Date | null | undefined;
|
|
2538
2538
|
} & {
|
|
2539
2539
|
twoFactorEnabled: boolean | null | undefined;
|
|
2540
2540
|
} & {}>;
|
|
@@ -2581,8 +2581,8 @@ declare const signIn: {
|
|
|
2581
2581
|
banned: boolean | null | undefined;
|
|
2582
2582
|
} & {
|
|
2583
2583
|
role?: string | null | undefined;
|
|
2584
|
-
banExpires?: Date | null | undefined;
|
|
2585
2584
|
banReason?: string | null | undefined;
|
|
2585
|
+
banExpires?: Date | null | undefined;
|
|
2586
2586
|
} & {
|
|
2587
2587
|
twoFactorEnabled: boolean | null | undefined;
|
|
2588
2588
|
} & {}>;
|
|
@@ -3481,8 +3481,8 @@ declare const signUp: {
|
|
|
3481
3481
|
$Infer: {
|
|
3482
3482
|
body: {
|
|
3483
3483
|
permissions: {
|
|
3484
|
-
readonly user?: ("
|
|
3485
|
-
readonly session?: ("
|
|
3484
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
3485
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
3486
3486
|
};
|
|
3487
3487
|
} & {
|
|
3488
3488
|
userId?: string | undefined;
|
|
@@ -3571,8 +3571,8 @@ declare const signUp: {
|
|
|
3571
3571
|
admin: {
|
|
3572
3572
|
checkRolePermission: <R extends "user" | "admin">(data: {
|
|
3573
3573
|
permissions: {
|
|
3574
|
-
readonly user?: ("
|
|
3575
|
-
readonly session?: ("
|
|
3574
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
3575
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
3576
3576
|
};
|
|
3577
3577
|
} & {
|
|
3578
3578
|
role: R;
|
|
@@ -5155,8 +5155,8 @@ declare const signUp: {
|
|
|
5155
5155
|
banned: boolean | null | undefined;
|
|
5156
5156
|
} & {
|
|
5157
5157
|
role?: string | null | undefined;
|
|
5158
|
-
banExpires?: Date | null | undefined;
|
|
5159
5158
|
banReason?: string | null | undefined;
|
|
5159
|
+
banExpires?: Date | null | undefined;
|
|
5160
5160
|
} & {
|
|
5161
5161
|
twoFactorEnabled: boolean | null | undefined;
|
|
5162
5162
|
} & {}>;
|
|
@@ -5184,8 +5184,8 @@ declare const signUp: {
|
|
|
5184
5184
|
banned: boolean | null | undefined;
|
|
5185
5185
|
} & {
|
|
5186
5186
|
role?: string | null | undefined;
|
|
5187
|
-
banExpires?: Date | null | undefined;
|
|
5188
5187
|
banReason?: string | null | undefined;
|
|
5188
|
+
banExpires?: Date | null | undefined;
|
|
5189
5189
|
} & {
|
|
5190
5190
|
twoFactorEnabled: boolean | null | undefined;
|
|
5191
5191
|
} & {}>;
|
|
@@ -826,8 +826,8 @@ declare const authClient: better_auth_react.ReactAuthClient<{
|
|
|
826
826
|
$Infer: {
|
|
827
827
|
body: {
|
|
828
828
|
permissions: {
|
|
829
|
-
readonly user?: ("
|
|
830
|
-
readonly session?: ("
|
|
829
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
830
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
831
831
|
};
|
|
832
832
|
} & {
|
|
833
833
|
userId?: string | undefined;
|
|
@@ -916,8 +916,8 @@ declare const authClient: better_auth_react.ReactAuthClient<{
|
|
|
916
916
|
admin: {
|
|
917
917
|
checkRolePermission: <R extends "user" | "admin">(data: {
|
|
918
918
|
permissions: {
|
|
919
|
-
readonly user?: ("
|
|
920
|
-
readonly session?: ("
|
|
919
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
920
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
921
921
|
};
|
|
922
922
|
} & {
|
|
923
923
|
role: R;
|
|
@@ -2423,8 +2423,8 @@ declare const useSession: () => {
|
|
|
2423
2423
|
banned: boolean | null | undefined;
|
|
2424
2424
|
} & {
|
|
2425
2425
|
role?: string | null | undefined;
|
|
2426
|
-
banExpires?: Date | null | undefined;
|
|
2427
2426
|
banReason?: string | null | undefined;
|
|
2427
|
+
banExpires?: Date | null | undefined;
|
|
2428
2428
|
} & {
|
|
2429
2429
|
twoFactorEnabled: boolean | null | undefined;
|
|
2430
2430
|
} & {}>;
|
|
@@ -2450,7 +2450,7 @@ declare const useSession: () => {
|
|
|
2450
2450
|
};
|
|
2451
2451
|
declare const signIn: {
|
|
2452
2452
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
2453
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2453
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2454
2454
|
callbackURL?: string | undefined;
|
|
2455
2455
|
newUserCallbackURL?: string | undefined;
|
|
2456
2456
|
errorCallbackURL?: string | undefined;
|
|
@@ -2475,7 +2475,7 @@ declare const signIn: {
|
|
|
2475
2475
|
additionalParams?: Record<string, string> | undefined;
|
|
2476
2476
|
additionalData?: Record<string, any> | undefined;
|
|
2477
2477
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, string | undefined> | undefined>>(data_0: better_auth.Prettify<Omit<{
|
|
2478
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2478
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2479
2479
|
callbackURL?: string | undefined;
|
|
2480
2480
|
newUserCallbackURL?: string | undefined;
|
|
2481
2481
|
errorCallbackURL?: string | undefined;
|
|
@@ -2502,7 +2502,7 @@ declare const signIn: {
|
|
|
2502
2502
|
} & {
|
|
2503
2503
|
fetchOptions?: FetchOptions | undefined;
|
|
2504
2504
|
}, "provider"> & {
|
|
2505
|
-
provider: "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat"
|
|
2505
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
2506
2506
|
fetchOptions?: FetchOptions | undefined;
|
|
2507
2507
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
2508
2508
|
redirect: boolean;
|
|
@@ -2533,8 +2533,8 @@ declare const signIn: {
|
|
|
2533
2533
|
banned: boolean | null | undefined;
|
|
2534
2534
|
} & {
|
|
2535
2535
|
role?: string | null | undefined;
|
|
2536
|
-
banExpires?: Date | null | undefined;
|
|
2537
2536
|
banReason?: string | null | undefined;
|
|
2537
|
+
banExpires?: Date | null | undefined;
|
|
2538
2538
|
} & {
|
|
2539
2539
|
twoFactorEnabled: boolean | null | undefined;
|
|
2540
2540
|
} & {}>;
|
|
@@ -2581,8 +2581,8 @@ declare const signIn: {
|
|
|
2581
2581
|
banned: boolean | null | undefined;
|
|
2582
2582
|
} & {
|
|
2583
2583
|
role?: string | null | undefined;
|
|
2584
|
-
banExpires?: Date | null | undefined;
|
|
2585
2584
|
banReason?: string | null | undefined;
|
|
2585
|
+
banExpires?: Date | null | undefined;
|
|
2586
2586
|
} & {
|
|
2587
2587
|
twoFactorEnabled: boolean | null | undefined;
|
|
2588
2588
|
} & {}>;
|
|
@@ -3481,8 +3481,8 @@ declare const signUp: {
|
|
|
3481
3481
|
$Infer: {
|
|
3482
3482
|
body: {
|
|
3483
3483
|
permissions: {
|
|
3484
|
-
readonly user?: ("
|
|
3485
|
-
readonly session?: ("
|
|
3484
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
3485
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
3486
3486
|
};
|
|
3487
3487
|
} & {
|
|
3488
3488
|
userId?: string | undefined;
|
|
@@ -3571,8 +3571,8 @@ declare const signUp: {
|
|
|
3571
3571
|
admin: {
|
|
3572
3572
|
checkRolePermission: <R extends "user" | "admin">(data: {
|
|
3573
3573
|
permissions: {
|
|
3574
|
-
readonly user?: ("
|
|
3575
|
-
readonly session?: ("
|
|
3574
|
+
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
|
|
3575
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
3576
3576
|
};
|
|
3577
3577
|
} & {
|
|
3578
3578
|
role: R;
|
|
@@ -5155,8 +5155,8 @@ declare const signUp: {
|
|
|
5155
5155
|
banned: boolean | null | undefined;
|
|
5156
5156
|
} & {
|
|
5157
5157
|
role?: string | null | undefined;
|
|
5158
|
-
banExpires?: Date | null | undefined;
|
|
5159
5158
|
banReason?: string | null | undefined;
|
|
5159
|
+
banExpires?: Date | null | undefined;
|
|
5160
5160
|
} & {
|
|
5161
5161
|
twoFactorEnabled: boolean | null | undefined;
|
|
5162
5162
|
} & {}>;
|
|
@@ -5184,8 +5184,8 @@ declare const signUp: {
|
|
|
5184
5184
|
banned: boolean | null | undefined;
|
|
5185
5185
|
} & {
|
|
5186
5186
|
role?: string | null | undefined;
|
|
5187
|
-
banExpires?: Date | null | undefined;
|
|
5188
5187
|
banReason?: string | null | undefined;
|
|
5188
|
+
banExpires?: Date | null | undefined;
|
|
5189
5189
|
} & {
|
|
5190
5190
|
twoFactorEnabled: boolean | null | undefined;
|
|
5191
5191
|
} & {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { auth } from './chunk-
|
|
1
|
+
import { auth } from './chunk-WJMWCE2I.mjs';
|
|
2
2
|
import { db } from './chunk-ZJMFE5B2.mjs';
|
|
3
3
|
import { users } from './chunk-TR5XFBTD.mjs';
|
|
4
4
|
import 'server-only';
|
|
@@ -58,5 +58,5 @@ function normalizeCallbackUrl(value) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export { getCurrentSession, hasRole, normalizeCallbackUrl, requireAuth, requireRole };
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
62
|
-
//# sourceMappingURL=chunk-
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IAAA,CAAK,IAAA,EAAM,YAAY,CAAA,EAAG;AAC7C,IAAA,QAAA,CAAS,YAAY,CAAA;AAAA,EACvB;AAEA,EAAA,OAAO,OAAA;AACT;AAQO,SAAS,qBAAqB,KAAA,EAAmC;AACtE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,IAAA,IAAQ,OAAO,YAAA;AAEvD,EAAA,MAAM,SAAA,GAAY,MAAM,IAAA,EAAK;AAE7B,EAAA,IAAI;AACF,IAAA,MAAM,SAAA,GAAY,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,uBAAuB,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,uBAAuB,CAAA,CAAE,MAAA;AACrH,IAAA,MAAM,WAAA,GAAc,IAAI,GAAA,CAAI,SAAA,EAAW,SAAS,CAAA;AAEhD,IAAA,IAAI,WAAA,CAAY,WAAW,SAAA,EAAW;AACpC,MAAA,OAAO,YAAA;AAAA,IACT;AAEA,IAAA,OAAO,CAAA,EAAG,YAAY,QAAQ,CAAA,EAAG,YAAY,MAAM,CAAA,EAAG,WAAA,CAAY,IAAI,CAAA,CAAA,IAAM,YAAA;AAAA,EAC9E,CAAA,CAAA,OAAQ,CAAA,EAAA;AACN,IAAA,OAAO,YAAA;AAAA,EACT;AACF","file":"chunk-A2K3FVDH.mjs","sourcesContent":["import \"server-only\"\nimport { cache } from \"react\"\nimport { auth } from \"../server/auth\"\nimport { headers } from \"next/headers\"\nimport { redirect } from \"next/navigation\"\nimport { db } from \"../server/db\"\nimport { users } from \"../server/db/schema\"\nimport { eq } from \"drizzle-orm\"\n\n/**\n * Get current session (server-side only)\n * Returns session data or null if not authenticated\n *\n * Wrapped in React's cache() so the layout and page (both of which call\n * requireAuth per request) share one auth.api.getSession call instead of two.\n */\nexport const getCurrentSession = cache(async () => {\n const session = await auth.api.getSession({\n headers: await headers()\n })\n\n return session\n})\n\n/**\n * Require authentication - redirect to login if not authenticated\n * Use in server components/layouts that need protection\n *\n * Wrapped in cache() so the layout, page, and any admin layout that all call\n * requireAuth per request share one banned-status DB lookup instead of several.\n */\nexport const requireAuth = cache(async () => {\n const session = await getCurrentSession()\n\n if (!session?.user) {\n redirect('/login')\n }\n\n // Check if user is banned\n const user = await db\n .select()\n .from(users)\n .where(eq(users.id, session.user.id))\n .limit(1)\n\n if (user[0]?.banned) {\n // Sign out the user\n await auth.api.signOut({\n headers: await headers()\n })\n redirect('/login?error=account_banned')\n }\n\n return session\n})\n\n/**\n * Check if user has specific role\n */\nexport function hasRole(userRole: string | null | undefined, requiredRole: 'user' | 'admin'): boolean {\n if (!userRole) return false\n\n if (requiredRole === 'admin') {\n return userRole === 'admin'\n }\n\n // 'user' role check - every role ('user', 'admin', 'tester') has access\n return userRole === 'user' || userRole === 'admin' || userRole === 'tester'\n}\n\n/**\n * Require specific role - throw error if user doesn't have it\n */\nexport async function requireRole(requiredRole: 'user' | 'admin') {\n const session = await requireAuth()\n\n if (!hasRole(session.user.role, requiredRole)) {\n redirect('/dashboard')\n }\n\n return session\n}\n\n/**\n * Normalize a callbackUrl query param to a same-origin path before it's ever\n * passed to redirect() or an auth form's callbackURL. Guards against open\n * redirects (e.g. /login?callbackUrl=https://evil.com) — anything that\n * doesn't resolve to this app's own origin falls back to /dashboard.\n */\nexport function normalizeCallbackUrl(value?: string | string[]): string {\n if (typeof value !== 'string' || !value.trim()) return '/dashboard'\n\n const candidate = value.trim()\n\n try {\n const appOrigin = new URL(process.env.NEXT_PUBLIC_APP_URL || process.env.BETTER_AUTH_URL || 'http://localhost:3000').origin\n const callbackUrl = new URL(candidate, appOrigin)\n\n if (callbackUrl.origin !== appOrigin) {\n return '/dashboard'\n }\n\n return `${callbackUrl.pathname}${callbackUrl.search}${callbackUrl.hash}` || '/dashboard'\n } catch {\n return '/dashboard'\n }\n}\n\n"]}
|