@xk2800/nextjs-template 0.5.3
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/README.md +339 -0
- package/components/auth/authCard.tsx +92 -0
- package/components/auth/authShell.tsx +46 -0
- package/components/auth/deviceCheck.tsx +52 -0
- package/components/auth/emailPasswordLogin.tsx +136 -0
- package/components/auth/emailPasswordSignup.tsx +178 -0
- package/components/auth/forgotPasswordForm.tsx +66 -0
- package/components/auth/loginErrorRecovery.tsx +117 -0
- package/components/auth/logoutButtons.tsx +26 -0
- package/components/auth/oneTap.tsx +50 -0
- package/components/auth/passkeyLogin.tsx +50 -0
- package/components/auth/resetPasswordForm.tsx +112 -0
- package/components/auth/socialLogin.tsx +51 -0
- package/components/auth/twoFactorVerifyForm.tsx +100 -0
- package/components/dashboard/accountDetailsCard.tsx +58 -0
- package/components/dashboard/activityLogsCard.tsx +141 -0
- package/components/dashboard/activityLogsCardSkeleton.tsx +20 -0
- package/components/dashboard/activityLogsSection.tsx +16 -0
- package/components/dashboard/admin/activityLogsSection.tsx +13 -0
- package/components/dashboard/admin/adminActivityLogsSkeleton.tsx +34 -0
- package/components/dashboard/admin/adminActivityLogsTable.tsx +319 -0
- package/components/dashboard/admin/adminStatsGrid.tsx +30 -0
- package/components/dashboard/admin/adminStatsGridSkeleton.tsx +16 -0
- package/components/dashboard/admin/adminUserActivityLogCard.tsx +53 -0
- package/components/dashboard/admin/adminUserActivityLogTable.tsx +69 -0
- package/components/dashboard/admin/adminUserLoginInfoCard.tsx +50 -0
- package/components/dashboard/admin/adminUserLoginInfoTable.tsx +63 -0
- package/components/dashboard/admin/adminUserSessionsCard.tsx +225 -0
- package/components/dashboard/admin/adminUserStatusCard.tsx +57 -0
- package/components/dashboard/admin/adminUsersSkeleton.tsx +30 -0
- package/components/dashboard/admin/adminUsersTable.tsx +596 -0
- package/components/dashboard/admin/deviceThrottleCard.tsx +59 -0
- package/components/dashboard/admin/deviceThrottleTable.tsx +93 -0
- package/components/dashboard/admin/impersonationLogCard.tsx +73 -0
- package/components/dashboard/admin/newDeviceCard.tsx +35 -0
- package/components/dashboard/admin/newDeviceTable.tsx +71 -0
- package/components/dashboard/admin/revokeAllSessionsButton.tsx +77 -0
- package/components/dashboard/admin/sharedDeviceCard.tsx +42 -0
- package/components/dashboard/admin/sharedDeviceTable.tsx +75 -0
- package/components/dashboard/admin/systemSettingsForm.tsx +200 -0
- package/components/dashboard/admin/systemSettingsSection.tsx +9 -0
- package/components/dashboard/admin/systemSettingsSkeleton.tsx +29 -0
- package/components/dashboard/admin/usersSection.tsx +13 -0
- package/components/dashboard/adminSection.tsx +31 -0
- package/components/dashboard/appSidebar.tsx +170 -0
- package/components/dashboard/dashboardHeader.tsx +85 -0
- package/components/dashboard/heartbeat.tsx +22 -0
- package/components/dashboard/impersonationBanner.tsx +50 -0
- package/components/dashboard/passkeysCard.tsx +187 -0
- package/components/dashboard/profileCard.tsx +42 -0
- package/components/dashboard/sectionErrorFallback.tsx +18 -0
- package/components/dashboard/sessionsCard.tsx +194 -0
- package/components/dashboard/sessionsCardSkeleton.tsx +20 -0
- package/components/dashboard/sessionsSection.tsx +22 -0
- package/components/dashboard/twoFactorCard.tsx +344 -0
- package/components/dashboard/verifyEmailButton.tsx +32 -0
- package/components/email/email-template-2.tsx +44 -0
- package/components/email/email-template-new-device.tsx +80 -0
- package/components/email/email-template-passkey-change.tsx +81 -0
- package/components/email/email-template-reset-password.tsx +56 -0
- package/components/email/email-template-verify-email.tsx +55 -0
- package/components/email/email-template-welcome.tsx +53 -0
- package/components/email/email-template.tsx +33 -0
- package/components/email/send-email-button.tsx +61 -0
- package/components/providers/theme-provider.tsx +9 -0
- package/components/theme/theme-toggle.tsx +53 -0
- package/components/ui/alert-dialog.tsx +141 -0
- package/components/ui/avatar.tsx +53 -0
- package/components/ui/badge.tsx +46 -0
- package/components/ui/button.tsx +64 -0
- package/components/ui/card.tsx +92 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/data-table.tsx +302 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/dropdown-menu.tsx +203 -0
- package/components/ui/input.tsx +21 -0
- package/components/ui/label.tsx +26 -0
- package/components/ui/password-input.tsx +38 -0
- package/components/ui/separator.tsx +28 -0
- package/components/ui/sheet.tsx +143 -0
- package/components/ui/sidebar.tsx +726 -0
- package/components/ui/skeleton.tsx +13 -0
- package/components/ui/switch.tsx +35 -0
- package/components/ui/table.tsx +116 -0
- package/components/ui/textarea.tsx +18 -0
- package/components/ui/tooltip.tsx +57 -0
- package/dist/activity/logger.d.mts +18 -0
- package/dist/activity/logger.d.ts +18 -0
- package/dist/activity/logger.js +289 -0
- package/dist/activity/logger.js.map +1 -0
- package/dist/activity/logger.mjs +7 -0
- package/dist/activity/logger.mjs.map +1 -0
- package/dist/activity/queries.d.mts +98 -0
- package/dist/activity/queries.d.ts +98 -0
- package/dist/activity/queries.js +372 -0
- package/dist/activity/queries.js.map +1 -0
- package/dist/activity/queries.mjs +124 -0
- package/dist/activity/queries.mjs.map +1 -0
- package/dist/admin/queries.d.mts +68 -0
- package/dist/admin/queries.d.ts +68 -0
- package/dist/admin/queries.js +450 -0
- package/dist/admin/queries.js.map +1 -0
- package/dist/admin/queries.mjs +143 -0
- package/dist/admin/queries.mjs.map +1 -0
- package/dist/auth/helpers.d.mts +111 -0
- package/dist/auth/helpers.d.ts +111 -0
- package/dist/auth/helpers.js +1023 -0
- package/dist/auth/helpers.js.map +1 -0
- package/dist/auth/helpers.mjs +67 -0
- package/dist/auth/helpers.mjs.map +1 -0
- package/dist/auth/index.d.mts +6589 -0
- package/dist/auth/index.d.ts +6589 -0
- package/dist/auth/index.js +968 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/index.mjs +10 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/auth-client/index.d.mts +4864 -0
- package/dist/auth-client/index.d.ts +4864 -0
- package/dist/auth-client/index.js +55 -0
- package/dist/auth-client/index.js.map +1 -0
- package/dist/auth-client/index.mjs +49 -0
- package/dist/auth-client/index.mjs.map +1 -0
- package/dist/chunk-2FW7C3KS.mjs +556 -0
- package/dist/chunk-2FW7C3KS.mjs.map +1 -0
- package/dist/chunk-ENGYO4K7.mjs +189 -0
- package/dist/chunk-ENGYO4K7.mjs.map +1 -0
- package/dist/chunk-GTPTVNY2.mjs +40 -0
- package/dist/chunk-GTPTVNY2.mjs.map +1 -0
- package/dist/chunk-HYKUB3A2.mjs +30 -0
- package/dist/chunk-HYKUB3A2.mjs.map +1 -0
- package/dist/chunk-JIYHBWAU.mjs +79 -0
- package/dist/chunk-JIYHBWAU.mjs.map +1 -0
- package/dist/chunk-K6OJCSJS.mjs +41 -0
- package/dist/chunk-K6OJCSJS.mjs.map +1 -0
- package/dist/chunk-N6ECRCHY.mjs +61 -0
- package/dist/chunk-N6ECRCHY.mjs.map +1 -0
- package/dist/chunk-YN4436PK.mjs +33 -0
- package/dist/chunk-YN4436PK.mjs.map +1 -0
- package/dist/config/env.d.mts +15 -0
- package/dist/config/env.d.ts +15 -0
- package/dist/config/env.js +42 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/env.mjs +4 -0
- package/dist/config/env.mjs.map +1 -0
- package/dist/db/index.d.mts +10 -0
- package/dist/db/index.d.ts +10 -0
- package/dist/db/index.js +252 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/index.mjs +6 -0
- package/dist/db/index.mjs.map +1 -0
- package/dist/db/schema.d.mts +2 -0
- package/dist/db/schema.d.ts +2 -0
- package/dist/db/schema.js +186 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/schema.mjs +4 -0
- package/dist/db/schema.mjs.map +1 -0
- package/dist/schema-CgkDv4wJ.d.mts +1758 -0
- package/dist/schema-CgkDv4wJ.d.ts +1758 -0
- package/dist/sessions/queries.d.mts +34 -0
- package/dist/sessions/queries.d.ts +34 -0
- package/dist/sessions/queries.js +268 -0
- package/dist/sessions/queries.js.map +1 -0
- package/dist/sessions/queries.mjs +23 -0
- package/dist/sessions/queries.mjs.map +1 -0
- package/dist/settings/queries.d.mts +20 -0
- package/dist/settings/queries.d.ts +20 -0
- package/dist/settings/queries.js +344 -0
- package/dist/settings/queries.js.map +1 -0
- package/dist/settings/queries.mjs +7 -0
- package/dist/settings/queries.mjs.map +1 -0
- package/dist/types/auth/loginSchema.d.mts +8 -0
- package/dist/types/auth/loginSchema.d.ts +8 -0
- package/dist/types/auth/loginSchema.js +18 -0
- package/dist/types/auth/loginSchema.js.map +1 -0
- package/dist/types/auth/loginSchema.mjs +16 -0
- package/dist/types/auth/loginSchema.mjs.map +1 -0
- package/dist/types/auth/signupSchema.d.mts +9 -0
- package/dist/types/auth/signupSchema.d.ts +9 -0
- package/dist/types/auth/signupSchema.js +21 -0
- package/dist/types/auth/signupSchema.js.map +1 -0
- package/dist/types/auth/signupSchema.mjs +19 -0
- package/dist/types/auth/signupSchema.mjs.map +1 -0
- package/dist/users/queries.d.mts +71 -0
- package/dist/users/queries.d.ts +71 -0
- package/dist/users/queries.js +293 -0
- package/dist/users/queries.js.map +1 -0
- package/dist/users/queries.mjs +47 -0
- package/dist/users/queries.mjs.map +1 -0
- package/lib/auth-client.ts +58 -0
- package/lib/cookie-names.ts +13 -0
- package/lib/device-fingerprint.ts +21 -0
- package/lib/formatters.ts +53 -0
- package/lib/recalculate-columns.ts +75 -0
- package/lib/request-info.ts +78 -0
- package/lib/utils.ts +6 -0
- package/package.json +301 -0
- package/styles/theme.css +124 -0
- package/types/auth/loginSchema.ts +11 -0
- package/types/auth/signupSchema.ts +14 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('better-auth/react');
|
|
4
|
+
var plugins = require('better-auth/client/plugins');
|
|
5
|
+
|
|
6
|
+
// lib/auth-client.ts
|
|
7
|
+
var oneTapEnabled = process.env.NEXT_PUBLIC_AUTH_ENABLE_ONE_TAP === "true";
|
|
8
|
+
var baseAuthClient = react.createAuthClient({
|
|
9
|
+
baseURL: typeof window !== "undefined" ? window.location.origin : void 0,
|
|
10
|
+
plugins: [
|
|
11
|
+
plugins.adminClient(),
|
|
12
|
+
plugins.twoFactorClient(),
|
|
13
|
+
plugins.passkeyClient(),
|
|
14
|
+
...oneTapEnabled ? [
|
|
15
|
+
// On newer better-auth versions (>=1.6, within our ^1.3.34 range) the
|
|
16
|
+
// one-tap plugin's `getActions` signature doesn't structurally satisfy
|
|
17
|
+
// `BetterAuthClientPlugin` (a generic-variance mismatch upstream), so
|
|
18
|
+
// it can't be assigned into this array as-is. Widen it here —
|
|
19
|
+
// `.oneTap` is added back to `authClient`'s type below via
|
|
20
|
+
// `OneTapActions`, independent of this array's inferred plugin type.
|
|
21
|
+
plugins.oneTapClient({
|
|
22
|
+
clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "",
|
|
23
|
+
// Optional client configuration:
|
|
24
|
+
autoSelect: false,
|
|
25
|
+
cancelOnTapOutside: true,
|
|
26
|
+
context: "signin",
|
|
27
|
+
additionalOptions: {
|
|
28
|
+
// Any extra options for the Google initialize method
|
|
29
|
+
},
|
|
30
|
+
// Configure prompt behavior and exponential backoff:
|
|
31
|
+
promptOptions: {
|
|
32
|
+
baseDelay: 1e3,
|
|
33
|
+
// Base delay in ms (default: 1000)
|
|
34
|
+
maxAttempts: 5
|
|
35
|
+
// Maximum number of attempts before triggering onPromptNotification (default: 5)
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
] : []
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
var authClient = baseAuthClient;
|
|
42
|
+
var {
|
|
43
|
+
useSession,
|
|
44
|
+
signIn,
|
|
45
|
+
signOut,
|
|
46
|
+
signUp
|
|
47
|
+
} = authClient;
|
|
48
|
+
|
|
49
|
+
exports.authClient = authClient;
|
|
50
|
+
exports.signIn = signIn;
|
|
51
|
+
exports.signOut = signOut;
|
|
52
|
+
exports.signUp = signUp;
|
|
53
|
+
exports.useSession = useSession;
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../lib/auth-client.ts"],"names":["createAuthClient","adminClient","twoFactorClient","passkeyClient","oneTapClient"],"mappings":";;;;;;AAIA,IAAM,aAAA,GAAgB,OAAA,CAAQ,GAAA,CAAI,+BAAA,KAAoC,MAAA;AAMtE,IAAM,iBAAiBA,sBAAA,CAAiB;AAAA,EACtC,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS,MAAA;AAAA,EAElE,OAAA,EAAS;AAAA,IACPC,mBAAA,EAAY;AAAA,IACZC,uBAAA,EAAgB;AAAA,IAChBC,qBAAA,EAAc;AAAA,IACd,GAAI,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOlBC,oBAAA,CAAa;AAAA,QACX,QAAA,EAAU,OAAA,CAAQ,GAAA,CAAI,4BAAA,IAAgC,EAAA;AAAA;AAAA,QAEtD,UAAA,EAAY,KAAA;AAAA,QACZ,kBAAA,EAAoB,IAAA;AAAA,QACpB,OAAA,EAAS,QAAA;AAAA,QACT,iBAAA,EAAmB;AAAA;AAAA,SAEnB;AAAA;AAAA,QAEA,aAAA,EAAe;AAAA,UACb,SAAA,EAAW,GAAA;AAAA;AAAA,UACX,WAAA,EAAa;AAAA;AAAA;AACf,OACD;AAAA,QACC;AAAC;AAET,CAAC,CAAA;AAQM,IAAM,UAAA,GAAa;AAGnB,IAAM;AAAA,EACX,UAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,GAAI","file":"index.js","sourcesContent":["import { createAuthClient } from \"better-auth/react\"\nimport { oneTapClient, adminClient, twoFactorClient, passkeyClient } from \"better-auth/client/plugins\"\nimport type { BetterAuthClientPlugin } from \"better-auth/client\"\n\nconst oneTapEnabled = process.env.NEXT_PUBLIC_AUTH_ENABLE_ONE_TAP === \"true\"\n\n// Derived (not hand-written) from the plugin's own return type, so it tracks\n// whatever better-auth version is actually installed by the consumer.\ntype OneTapActions = ReturnType<ReturnType<typeof oneTapClient>[\"getActions\"]>\n\nconst baseAuthClient = createAuthClient({\n baseURL: typeof window !== \"undefined\" ? window.location.origin : undefined,\n\n plugins: [\n adminClient(),\n twoFactorClient(),\n passkeyClient(),\n ...(oneTapEnabled ? [\n // On newer better-auth versions (>=1.6, within our ^1.3.34 range) the\n // one-tap plugin's `getActions` signature doesn't structurally satisfy\n // `BetterAuthClientPlugin` (a generic-variance mismatch upstream), so\n // it can't be assigned into this array as-is. Widen it here —\n // `.oneTap` is added back to `authClient`'s type below via\n // `OneTapActions`, independent of this array's inferred plugin type.\n oneTapClient({\n clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || \"\",\n // Optional client configuration:\n autoSelect: false,\n cancelOnTapOutside: true,\n context: \"signin\",\n additionalOptions: {\n // Any extra options for the Google initialize method\n },\n // Configure prompt behavior and exponential backoff:\n promptOptions: {\n baseDelay: 1000, // Base delay in ms (default: 1000)\n maxAttempts: 5 // Maximum number of attempts before triggering onPromptNotification (default: 5)\n }\n }) as unknown as BetterAuthClientPlugin\n ] : []),\n ]\n})\n\n// createAuthClient can't narrow `Option[\"plugins\"]` from a conditional spread,\n// so it loses the one-tap plugin's action types. Add `.oneTap` back here\n// instead of forcing the plugin into the array unconditionally — doing that\n// trips a getActions variance mismatch against BetterAuthClientPlugin on\n// newer better-auth versions (>=1.6). The env check above still fully gates\n// whether the plugin (and thus `.oneTap`) is registered at runtime.\nexport const authClient = baseAuthClient as typeof baseAuthClient & OneTapActions\n\n// Export commonly used hooks and methods for convenience\nexport const {\n useSession,\n signIn,\n signOut,\n signUp,\n} = authClient\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import '../chunk-YN4436PK.mjs';
|
|
2
|
+
import { createAuthClient } from 'better-auth/react';
|
|
3
|
+
import { adminClient, twoFactorClient, passkeyClient, oneTapClient } from 'better-auth/client/plugins';
|
|
4
|
+
|
|
5
|
+
var oneTapEnabled = process.env.NEXT_PUBLIC_AUTH_ENABLE_ONE_TAP === "true";
|
|
6
|
+
var baseAuthClient = createAuthClient({
|
|
7
|
+
baseURL: typeof window !== "undefined" ? window.location.origin : void 0,
|
|
8
|
+
plugins: [
|
|
9
|
+
adminClient(),
|
|
10
|
+
twoFactorClient(),
|
|
11
|
+
passkeyClient(),
|
|
12
|
+
...oneTapEnabled ? [
|
|
13
|
+
// On newer better-auth versions (>=1.6, within our ^1.3.34 range) the
|
|
14
|
+
// one-tap plugin's `getActions` signature doesn't structurally satisfy
|
|
15
|
+
// `BetterAuthClientPlugin` (a generic-variance mismatch upstream), so
|
|
16
|
+
// it can't be assigned into this array as-is. Widen it here —
|
|
17
|
+
// `.oneTap` is added back to `authClient`'s type below via
|
|
18
|
+
// `OneTapActions`, independent of this array's inferred plugin type.
|
|
19
|
+
oneTapClient({
|
|
20
|
+
clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "",
|
|
21
|
+
// Optional client configuration:
|
|
22
|
+
autoSelect: false,
|
|
23
|
+
cancelOnTapOutside: true,
|
|
24
|
+
context: "signin",
|
|
25
|
+
additionalOptions: {
|
|
26
|
+
// Any extra options for the Google initialize method
|
|
27
|
+
},
|
|
28
|
+
// Configure prompt behavior and exponential backoff:
|
|
29
|
+
promptOptions: {
|
|
30
|
+
baseDelay: 1e3,
|
|
31
|
+
// Base delay in ms (default: 1000)
|
|
32
|
+
maxAttempts: 5
|
|
33
|
+
// Maximum number of attempts before triggering onPromptNotification (default: 5)
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
] : []
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
var authClient = baseAuthClient;
|
|
40
|
+
var {
|
|
41
|
+
useSession,
|
|
42
|
+
signIn,
|
|
43
|
+
signOut,
|
|
44
|
+
signUp
|
|
45
|
+
} = authClient;
|
|
46
|
+
|
|
47
|
+
export { authClient, signIn, signOut, signUp, useSession };
|
|
48
|
+
//# sourceMappingURL=index.mjs.map
|
|
49
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../lib/auth-client.ts"],"names":[],"mappings":";;;;AAIA,IAAM,aAAA,GAAgB,OAAA,CAAQ,GAAA,CAAI,+BAAA,KAAoC,MAAA;AAMtE,IAAM,iBAAiB,gBAAA,CAAiB;AAAA,EACtC,SAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS,MAAA;AAAA,EAElE,OAAA,EAAS;AAAA,IACP,WAAA,EAAY;AAAA,IACZ,eAAA,EAAgB;AAAA,IAChB,aAAA,EAAc;AAAA,IACd,GAAI,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOlB,YAAA,CAAa;AAAA,QACX,QAAA,EAAU,OAAA,CAAQ,GAAA,CAAI,4BAAA,IAAgC,EAAA;AAAA;AAAA,QAEtD,UAAA,EAAY,KAAA;AAAA,QACZ,kBAAA,EAAoB,IAAA;AAAA,QACpB,OAAA,EAAS,QAAA;AAAA,QACT,iBAAA,EAAmB;AAAA;AAAA,SAEnB;AAAA;AAAA,QAEA,aAAA,EAAe;AAAA,UACb,SAAA,EAAW,GAAA;AAAA;AAAA,UACX,WAAA,EAAa;AAAA;AAAA;AACf,OACD;AAAA,QACC;AAAC;AAET,CAAC,CAAA;AAQM,IAAM,UAAA,GAAa;AAGnB,IAAM;AAAA,EACX,UAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,GAAI","file":"index.mjs","sourcesContent":["import { createAuthClient } from \"better-auth/react\"\nimport { oneTapClient, adminClient, twoFactorClient, passkeyClient } from \"better-auth/client/plugins\"\nimport type { BetterAuthClientPlugin } from \"better-auth/client\"\n\nconst oneTapEnabled = process.env.NEXT_PUBLIC_AUTH_ENABLE_ONE_TAP === \"true\"\n\n// Derived (not hand-written) from the plugin's own return type, so it tracks\n// whatever better-auth version is actually installed by the consumer.\ntype OneTapActions = ReturnType<ReturnType<typeof oneTapClient>[\"getActions\"]>\n\nconst baseAuthClient = createAuthClient({\n baseURL: typeof window !== \"undefined\" ? window.location.origin : undefined,\n\n plugins: [\n adminClient(),\n twoFactorClient(),\n passkeyClient(),\n ...(oneTapEnabled ? [\n // On newer better-auth versions (>=1.6, within our ^1.3.34 range) the\n // one-tap plugin's `getActions` signature doesn't structurally satisfy\n // `BetterAuthClientPlugin` (a generic-variance mismatch upstream), so\n // it can't be assigned into this array as-is. Widen it here —\n // `.oneTap` is added back to `authClient`'s type below via\n // `OneTapActions`, independent of this array's inferred plugin type.\n oneTapClient({\n clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || \"\",\n // Optional client configuration:\n autoSelect: false,\n cancelOnTapOutside: true,\n context: \"signin\",\n additionalOptions: {\n // Any extra options for the Google initialize method\n },\n // Configure prompt behavior and exponential backoff:\n promptOptions: {\n baseDelay: 1000, // Base delay in ms (default: 1000)\n maxAttempts: 5 // Maximum number of attempts before triggering onPromptNotification (default: 5)\n }\n }) as unknown as BetterAuthClientPlugin\n ] : []),\n ]\n})\n\n// createAuthClient can't narrow `Option[\"plugins\"]` from a conditional spread,\n// so it loses the one-tap plugin's action types. Add `.oneTap` back here\n// instead of forcing the plugin into the array unconditionally — doing that\n// trips a getActions variance mismatch against BetterAuthClientPlugin on\n// newer better-auth versions (>=1.6). The env check above still fully gates\n// whether the plugin (and thus `.oneTap`) is registered at runtime.\nexport const authClient = baseAuthClient as typeof baseAuthClient & OneTapActions\n\n// Export commonly used hooks and methods for convenience\nexport const {\n useSession,\n signIn,\n signOut,\n signUp,\n} = authClient\n"]}
|