@xk2800/nextjs-template 0.7.1-beta.14 → 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/auth/oneTap.tsx +9 -1
- package/components/dashboard/deleteAccountCard.tsx +31 -4
- 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.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/{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 -2
- package/dist/chunk-7QVIOQ47.mjs +0 -462
- package/dist/chunk-7QVIOQ47.mjs.map +0 -1
|
@@ -41,8 +41,16 @@ const OneTap = ({ callbackURL = '/dashboard' }: OneTapProps) => {
|
|
|
41
41
|
if (oneTapOffered !== true) return
|
|
42
42
|
if (!oneTapAllowed) return
|
|
43
43
|
|
|
44
|
+
// Passing fetchOptions (and no callbackURL) turns off the client's own redirect, so
|
|
45
|
+
// a 2FA challenge ({ twoFactorRedirect }) isn't overwritten by a jump to callbackURL.
|
|
44
46
|
authClient.oneTap({
|
|
45
|
-
|
|
47
|
+
fetchOptions: {
|
|
48
|
+
onSuccess: ({ data }) => {
|
|
49
|
+
window.location.href = (data as { twoFactorRedirect?: boolean } | null)?.twoFactorRedirect
|
|
50
|
+
? `/login/2fa?callbackUrl=${encodeURIComponent(callbackURL)}`
|
|
51
|
+
: callbackURL
|
|
52
|
+
},
|
|
53
|
+
},
|
|
46
54
|
onPromptNotification: (notification) => {
|
|
47
55
|
console.log('One Tap prompt notification:', notification)
|
|
48
56
|
}
|
|
@@ -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
|
|