@xk2800/nextjs-template 0.7.1-beta.15 → 0.7.1-beta.16
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/dashboard/deleteAccountCard.tsx +31 -4
- package/dist/activity/queries.d.mts +1 -1
- package/dist/activity/queries.d.ts +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/schema.d.mts +1 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/{schema-lgO4CzE4.d.mts → schema-CN_Y6EXv.d.mts} +1 -1
- package/dist/{schema-lgO4CzE4.d.ts → schema-CN_Y6EXv.d.ts} +1 -1
- package/dist/settings/queries.d.mts +1 -1
- package/dist/settings/queries.d.ts +1 -1
- package/package.json +1 -1
|
@@ -16,8 +16,18 @@ import {
|
|
|
16
16
|
AlertDialogTitle,
|
|
17
17
|
} from '../ui/alert-dialog'
|
|
18
18
|
import { authClient, useSession } from '../../lib/auth-client'
|
|
19
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip'
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
type Props = {
|
|
22
|
+
/**
|
|
23
|
+
* When set, the Delete account button is disabled (dimmed) and hovering or focusing it
|
|
24
|
+
* shows this text, e.g. "You have an active subscription. Cancel it first." Enforce the
|
|
25
|
+
* same rule on the server too (an auth hook on /delete-user): this only changes the UI.
|
|
26
|
+
*/
|
|
27
|
+
disabledReason?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function DeleteAccountCard({ disabledReason }: Props = {}) {
|
|
21
31
|
const { data: session } = useSession()
|
|
22
32
|
const email = session?.user.email ?? ''
|
|
23
33
|
// null = still checking. Credential users confirm with their password;
|
|
@@ -78,9 +88,26 @@ export default function DeleteAccountCard() {
|
|
|
78
88
|
</CardDescription>
|
|
79
89
|
</CardHeader>
|
|
80
90
|
<CardContent>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
{disabledReason ? (
|
|
92
|
+
<TooltipProvider>
|
|
93
|
+
<Tooltip>
|
|
94
|
+
<TooltipTrigger asChild>
|
|
95
|
+
{/* A disabled button gets no pointer events, so this focusable wrapper
|
|
96
|
+
carries the hover / keyboard focus that opens the tooltip. */}
|
|
97
|
+
<span tabIndex={0} aria-label={`Delete account unavailable: ${disabledReason}`} className="inline-block cursor-not-allowed">
|
|
98
|
+
<Button variant="destructive" disabled>
|
|
99
|
+
Delete account
|
|
100
|
+
</Button>
|
|
101
|
+
</span>
|
|
102
|
+
</TooltipTrigger>
|
|
103
|
+
<TooltipContent>{disabledReason}</TooltipContent>
|
|
104
|
+
</Tooltip>
|
|
105
|
+
</TooltipProvider>
|
|
106
|
+
) : (
|
|
107
|
+
<Button variant="destructive" onClick={() => setOpen(true)} disabled={hasPassword === null}>
|
|
108
|
+
Delete account
|
|
109
|
+
</Button>
|
|
110
|
+
)}
|
|
84
111
|
</CardContent>
|
|
85
112
|
</Card>
|
|
86
113
|
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -954,7 +954,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
954
954
|
$Infer: {
|
|
955
955
|
body: {
|
|
956
956
|
permissions: {
|
|
957
|
-
readonly user?: ("
|
|
957
|
+
readonly user?: ("delete" | "update" | "list" | "create" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
958
958
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
959
959
|
};
|
|
960
960
|
} & {
|
|
@@ -3282,7 +3282,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3282
3282
|
$Infer: {
|
|
3283
3283
|
body: {
|
|
3284
3284
|
permissions: {
|
|
3285
|
-
readonly user?: ("
|
|
3285
|
+
readonly user?: ("delete" | "update" | "list" | "create" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3286
3286
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3287
3287
|
};
|
|
3288
3288
|
} & {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -954,7 +954,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
954
954
|
$Infer: {
|
|
955
955
|
body: {
|
|
956
956
|
permissions: {
|
|
957
|
-
readonly user?: ("
|
|
957
|
+
readonly user?: ("delete" | "update" | "list" | "create" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
958
958
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
959
959
|
};
|
|
960
960
|
} & {
|
|
@@ -3282,7 +3282,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3282
3282
|
$Infer: {
|
|
3283
3283
|
body: {
|
|
3284
3284
|
permissions: {
|
|
3285
|
-
readonly user?: ("
|
|
3285
|
+
readonly user?: ("delete" | "update" | "list" | "create" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3286
3286
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3287
3287
|
};
|
|
3288
3288
|
} & {
|
package/dist/db/index.d.mts
CHANGED
package/dist/db/index.d.ts
CHANGED
package/dist/db/schema.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-CN_Y6EXv.mjs';
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-CN_Y6EXv.js';
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login" | "logout" | "login_failed" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login" | "logout" | "login_failed" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|