@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.
@@ -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
- callbackURL,
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
  }
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
4
+ import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
5
5
  import { cn } from "../../lib/utils"
6
6
  import { buttonVariants } from "./button"
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as AvatarPrimitive from "@radix-ui/react-avatar"
4
+ import { Avatar as AvatarPrimitive } from "radix-ui"
5
5
 
6
6
  import { cn } from "../../lib/utils"
7
7
 
@@ -1,5 +1,5 @@
1
1
  import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
2
+ import { Slot } from "radix-ui"
3
3
  import { cva, type VariantProps } from "class-variance-authority"
4
4
 
5
5
  import { cn } from "../../lib/utils"
@@ -34,7 +34,7 @@ function Badge({
34
34
  ...props
35
35
  }: React.ComponentProps<"span"> &
36
36
  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
37
- const Comp = asChild ? Slot : "span"
37
+ const Comp = asChild ? Slot.Root : "span"
38
38
 
39
39
  return (
40
40
  <Comp
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as DialogPrimitive from "@radix-ui/react-dialog"
4
+ import { Dialog as DialogPrimitive } from "radix-ui"
5
5
  import { XIcon } from "lucide-react"
6
6
 
7
7
  import { cn } from "../../lib/utils"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
5
5
  import { Check, ChevronRight, Circle } from "lucide-react"
6
6
 
7
7
  import { cn } from "../../lib/utils"
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as LabelPrimitive from "@radix-ui/react-label"
4
+ import { Label as LabelPrimitive } from "radix-ui"
5
5
  import { cva, type VariantProps } from "class-variance-authority"
6
6
 
7
7
  import { cn } from "../../lib/utils"