@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.
@@ -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
- export default function DeleteAccountCard() {
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
- <Button variant="destructive" onClick={() => setOpen(true)} disabled={hasPassword === null}>
82
- Delete account
83
- </Button>
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
 
@@ -1,4 +1,4 @@
1
- import { A as ActivityActionEnum } from '../schema-lgO4CzE4.mjs';
1
+ import { A as ActivityActionEnum } from '../schema-CN_Y6EXv.mjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -1,4 +1,4 @@
1
- import { A as ActivityActionEnum } from '../schema-lgO4CzE4.js';
1
+ import { A as ActivityActionEnum } from '../schema-CN_Y6EXv.js';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -954,7 +954,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
954
954
  $Infer: {
955
955
  body: {
956
956
  permissions: {
957
- readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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
  } & {
@@ -954,7 +954,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
954
954
  $Infer: {
955
955
  body: {
956
956
  permissions: {
957
- readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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
  } & {
@@ -1,4 +1,4 @@
1
- import { a as schema } from '../schema-lgO4CzE4.mjs';
1
+ import { a as schema } from '../schema-CN_Y6EXv.mjs';
2
2
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
3
  import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
4
4
  import 'drizzle-orm';
@@ -1,4 +1,4 @@
1
- import { a as schema } from '../schema-lgO4CzE4.js';
1
+ import { a as schema } from '../schema-CN_Y6EXv.js';
2
2
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
3
  import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
4
4
  import 'drizzle-orm';
@@ -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-lgO4CzE4.mjs';
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';
@@ -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-lgO4CzE4.js';
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: "login_failed" | "login" | "logout" | "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";
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: "login_failed" | "login" | "logout" | "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";
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;
@@ -1,4 +1,4 @@
1
- import { s as systemSettings } from '../schema-lgO4CzE4.mjs';
1
+ import { s as systemSettings } from '../schema-CN_Y6EXv.mjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -1,4 +1,4 @@
1
- import { s as systemSettings } from '../schema-lgO4CzE4.js';
1
+ import { s as systemSettings } from '../schema-CN_Y6EXv.js';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xk2800/nextjs-template",
3
- "version": "0.7.1-beta.15",
3
+ "version": "0.7.1-beta.16",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",