@tern-secure/nextjs 4.2.11 → 5.0.1
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 +33 -33
- package/dist/cjs/app-router/admin/index.js +5 -8
- package/dist/cjs/app-router/admin/index.js.map +1 -1
- package/dist/cjs/app-router/admin/sessionTernSecure.js +3 -6
- package/dist/cjs/app-router/admin/sessionTernSecure.js.map +1 -1
- package/dist/cjs/app-router/client/TernSecureProvider.js +10 -18
- package/dist/cjs/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/cjs/app-router/client/actions.js +1 -177
- package/dist/cjs/app-router/client/actions.js.map +1 -1
- package/dist/cjs/app-router/route-handler/internal-route.js +4 -35
- package/dist/cjs/app-router/route-handler/internal-route.js.map +1 -1
- package/dist/cjs/boundary/{hooks/useSignUp.js → components.js} +16 -16
- package/dist/cjs/boundary/components.js.map +1 -0
- package/dist/cjs/{lib/utils.js → boundary/hooks.js} +9 -11
- package/dist/cjs/boundary/hooks.js.map +1 -0
- package/dist/cjs/{boundary/TernSecureCtx.js → components/uiComponents.js} +17 -24
- package/dist/cjs/components/uiComponents.js.map +1 -0
- package/dist/cjs/errors.js +1 -0
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +13 -27
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/auth.js +4 -5
- package/dist/cjs/server/auth.js.map +1 -1
- package/dist/cjs/server/crypto.js.map +1 -1
- package/dist/cjs/server/ctx-store.js +1 -2
- package/dist/cjs/server/ctx-store.js.map +1 -1
- package/dist/cjs/server/edge-session.js +6 -7
- package/dist/cjs/server/edge-session.js.map +1 -1
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/cjs/server/jwt-edge.js.map +1 -1
- package/dist/cjs/server/jwt.js.map +1 -1
- package/dist/cjs/server/session-store.js +3 -1
- package/dist/cjs/server/session-store.js.map +1 -1
- package/dist/cjs/server/ternSecureMiddleware.js.map +1 -1
- package/dist/cjs/server/types.js.map +1 -1
- package/dist/cjs/server/utils.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/admin-init.js +3 -0
- package/dist/cjs/utils/admin-init.js.map +1 -1
- package/dist/cjs/utils/allNextProviderProps.js +108 -0
- package/dist/cjs/utils/allNextProviderProps.js.map +1 -0
- package/dist/cjs/utils/client-init.js +2 -47
- package/dist/cjs/utils/client-init.js.map +1 -1
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/construct.js.map +1 -1
- package/dist/cjs/utils/create-styles.js.map +1 -1
- package/dist/cjs/utils/redirect.js.map +1 -1
- package/dist/cjs/{components/ui/separator.js → utils/tern-ui-script.js} +41 -24
- package/dist/cjs/utils/tern-ui-script.js.map +1 -0
- package/dist/esm/app-router/admin/index.js +6 -4
- package/dist/esm/app-router/admin/index.js.map +1 -1
- package/dist/esm/app-router/admin/sessionTernSecure.js +3 -6
- package/dist/esm/app-router/admin/sessionTernSecure.js.map +1 -1
- package/dist/esm/app-router/client/TernSecureProvider.js +13 -19
- package/dist/esm/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/esm/app-router/client/actions.js +1 -157
- package/dist/esm/app-router/client/actions.js.map +1 -1
- package/dist/esm/app-router/route-handler/internal-route.js +5 -30
- package/dist/esm/app-router/route-handler/internal-route.js.map +1 -1
- package/dist/esm/boundary/components.js +18 -0
- package/dist/esm/boundary/components.js.map +1 -0
- package/dist/esm/boundary/hooks.js +9 -0
- package/dist/esm/boundary/hooks.js.map +1 -0
- package/dist/esm/components/uiComponents.js +21 -0
- package/dist/esm/components/uiComponents.js.map +1 -0
- package/dist/esm/errors.js +1 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +15 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/auth.js +4 -5
- package/dist/esm/server/auth.js.map +1 -1
- package/dist/esm/server/crypto.js.map +1 -1
- package/dist/esm/server/ctx-store.js +1 -2
- package/dist/esm/server/ctx-store.js.map +1 -1
- package/dist/esm/server/edge-session.js +6 -7
- package/dist/esm/server/edge-session.js.map +1 -1
- package/dist/esm/server/index.js.map +1 -1
- package/dist/esm/server/jwt-edge.js.map +1 -1
- package/dist/esm/server/jwt.js.map +1 -1
- package/dist/esm/server/session-store.js +3 -1
- package/dist/esm/server/session-store.js.map +1 -1
- package/dist/esm/server/ternSecureMiddleware.js.map +1 -1
- package/dist/esm/server/utils.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/admin-init.js +2 -0
- package/dist/esm/utils/admin-init.js.map +1 -1
- package/dist/esm/utils/allNextProviderProps.js +84 -0
- package/dist/esm/utils/allNextProviderProps.js.map +1 -0
- package/dist/esm/utils/client-init.js +2 -21
- package/dist/esm/utils/client-init.js.map +1 -1
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/construct.js.map +1 -1
- package/dist/esm/utils/create-styles.js.map +1 -1
- package/dist/esm/utils/redirect.js.map +1 -1
- package/dist/esm/utils/tern-ui-script.js +42 -0
- package/dist/esm/utils/tern-ui-script.js.map +1 -0
- package/dist/types/app-router/admin/index.d.ts +1 -2
- package/dist/types/app-router/admin/index.d.ts.map +1 -1
- package/dist/types/app-router/client/TernSecureProvider.d.ts +2 -14
- package/dist/types/app-router/client/TernSecureProvider.d.ts.map +1 -1
- package/dist/types/app-router/client/actions.d.ts +1 -54
- package/dist/types/app-router/client/actions.d.ts.map +1 -1
- package/dist/types/app-router/route-handler/internal-route.d.ts +1 -15
- package/dist/types/app-router/route-handler/internal-route.d.ts.map +1 -1
- package/dist/types/boundary/components.d.ts +2 -0
- package/dist/types/boundary/components.d.ts.map +1 -0
- package/dist/types/boundary/hooks.d.ts +2 -0
- package/dist/types/boundary/hooks.d.ts.map +1 -0
- package/dist/types/components/uiComponents.d.ts +6 -0
- package/dist/types/components/uiComponents.d.ts.map +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/server/ternSecureMiddleware.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -13
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/admin-init.d.ts +2 -1
- package/dist/types/utils/admin-init.d.ts.map +1 -1
- package/dist/types/utils/allNextProviderProps.d.ts +6 -0
- package/dist/types/utils/allNextProviderProps.d.ts.map +1 -0
- package/dist/types/utils/client-init.d.ts +1 -4
- package/dist/types/utils/client-init.d.ts.map +1 -1
- package/dist/types/utils/config.d.ts +1 -1
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/construct.d.ts.map +1 -1
- package/dist/types/utils/tern-ui-script.d.ts +8 -0
- package/dist/types/utils/tern-ui-script.d.ts.map +1 -0
- package/package.json +41 -52
- package/dist/cjs/boundary/TernSecureClientProvider.js +0 -240
- package/dist/cjs/boundary/TernSecureClientProvider.js.map +0 -1
- package/dist/cjs/boundary/TernSecureCtx.js.map +0 -1
- package/dist/cjs/boundary/hooks/useAuth.js +0 -63
- package/dist/cjs/boundary/hooks/useAuth.js.map +0 -1
- package/dist/cjs/boundary/hooks/useSignUp.js.map +0 -1
- package/dist/cjs/components/background.js +0 -65
- package/dist/cjs/components/background.js.map +0 -1
- package/dist/cjs/components/sign-in.js +0 -368
- package/dist/cjs/components/sign-in.js.map +0 -1
- package/dist/cjs/components/sign-out-button.js +0 -84
- package/dist/cjs/components/sign-out-button.js.map +0 -1
- package/dist/cjs/components/sign-out.js +0 -99
- package/dist/cjs/components/sign-out.js.map +0 -1
- package/dist/cjs/components/sign-up.js +0 -332
- package/dist/cjs/components/sign-up.js.map +0 -1
- package/dist/cjs/components/ui/alert.js +0 -88
- package/dist/cjs/components/ui/alert.js.map +0 -1
- package/dist/cjs/components/ui/button.js +0 -84
- package/dist/cjs/components/ui/button.js.map +0 -1
- package/dist/cjs/components/ui/card.js +0 -101
- package/dist/cjs/components/ui/card.js.map +0 -1
- package/dist/cjs/components/ui/input.js +0 -58
- package/dist/cjs/components/ui/input.js.map +0 -1
- package/dist/cjs/components/ui/label.js +0 -55
- package/dist/cjs/components/ui/label.js.map +0 -1
- package/dist/cjs/components/ui/separator.js.map +0 -1
- package/dist/cjs/components/verify.js +0 -195
- package/dist/cjs/components/verify.js.map +0 -1
- package/dist/cjs/lib/utils.d.js +0 -17
- package/dist/cjs/lib/utils.d.js.map +0 -1
- package/dist/cjs/lib/utils.js.map +0 -1
- package/dist/esm/boundary/TernSecureClientProvider.js +0 -216
- package/dist/esm/boundary/TernSecureClientProvider.js.map +0 -1
- package/dist/esm/boundary/TernSecureCtx.js +0 -23
- package/dist/esm/boundary/TernSecureCtx.js.map +0 -1
- package/dist/esm/boundary/hooks/useAuth.js +0 -39
- package/dist/esm/boundary/hooks/useAuth.js.map +0 -1
- package/dist/esm/boundary/hooks/useSignUp.js +0 -16
- package/dist/esm/boundary/hooks/useSignUp.js.map +0 -1
- package/dist/esm/components/background.js +0 -41
- package/dist/esm/components/background.js.map +0 -1
- package/dist/esm/components/sign-in.js +0 -344
- package/dist/esm/components/sign-in.js.map +0 -1
- package/dist/esm/components/sign-out-button.js +0 -60
- package/dist/esm/components/sign-out-button.js.map +0 -1
- package/dist/esm/components/sign-out.js +0 -65
- package/dist/esm/components/sign-out.js.map +0 -1
- package/dist/esm/components/sign-up.js +0 -298
- package/dist/esm/components/sign-up.js.map +0 -1
- package/dist/esm/components/ui/alert.js +0 -52
- package/dist/esm/components/ui/alert.js.map +0 -1
- package/dist/esm/components/ui/button.js +0 -49
- package/dist/esm/components/ui/button.js.map +0 -1
- package/dist/esm/components/ui/card.js +0 -62
- package/dist/esm/components/ui/card.js.map +0 -1
- package/dist/esm/components/ui/input.js +0 -24
- package/dist/esm/components/ui/input.js.map +0 -1
- package/dist/esm/components/ui/label.js +0 -21
- package/dist/esm/components/ui/label.js.map +0 -1
- package/dist/esm/components/ui/separator.js +0 -25
- package/dist/esm/components/ui/separator.js.map +0 -1
- package/dist/esm/components/verify.js +0 -161
- package/dist/esm/components/verify.js.map +0 -1
- package/dist/esm/lib/utils.d.js +0 -1
- package/dist/esm/lib/utils.d.js.map +0 -1
- package/dist/esm/lib/utils.js +0 -9
- package/dist/esm/lib/utils.js.map +0 -1
- package/dist/types/boundary/TernSecureClientProvider.d.ts +0 -27
- package/dist/types/boundary/TernSecureClientProvider.d.ts.map +0 -1
- package/dist/types/boundary/TernSecureCtx.d.ts +0 -11
- package/dist/types/boundary/TernSecureCtx.d.ts.map +0 -1
- package/dist/types/boundary/hooks/useAuth.d.ts +0 -15
- package/dist/types/boundary/hooks/useAuth.d.ts.map +0 -1
- package/dist/types/boundary/hooks/useSignUp.d.ts +0 -5
- package/dist/types/boundary/hooks/useSignUp.d.ts.map +0 -1
- package/dist/types/components/background.d.ts +0 -2
- package/dist/types/components/background.d.ts.map +0 -1
- package/dist/types/components/sign-in.d.ts +0 -18
- package/dist/types/components/sign-in.d.ts.map +0 -1
- package/dist/types/components/sign-out-button.d.ts +0 -14
- package/dist/types/components/sign-out-button.d.ts.map +0 -1
- package/dist/types/components/sign-out.d.ts +0 -12
- package/dist/types/components/sign-out.d.ts.map +0 -1
- package/dist/types/components/sign-up.d.ts +0 -11
- package/dist/types/components/sign-up.d.ts.map +0 -1
- package/dist/types/components/ui/alert.d.ts +0 -9
- package/dist/types/components/ui/alert.d.ts.map +0 -1
- package/dist/types/components/ui/button.d.ts +0 -12
- package/dist/types/components/ui/button.d.ts.map +0 -1
- package/dist/types/components/ui/card.d.ts +0 -9
- package/dist/types/components/ui/card.d.ts.map +0 -1
- package/dist/types/components/ui/input.d.ts +0 -4
- package/dist/types/components/ui/input.d.ts.map +0 -1
- package/dist/types/components/ui/label.d.ts +0 -6
- package/dist/types/components/ui/label.d.ts.map +0 -1
- package/dist/types/components/ui/separator.d.ts +0 -5
- package/dist/types/components/ui/separator.d.ts.map +0 -1
- package/dist/types/components/verify.d.ts +0 -2
- package/dist/types/components/verify.d.ts.map +0 -1
- package/dist/types/lib/utils.d.ts +0 -3
- package/dist/types/lib/utils.d.ts.map +0 -1
- package/server/package.json +0 -5
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useMemo, useCallback } from "react";
|
|
4
|
-
import { ternSecureAuth } from "../utils/client-init";
|
|
5
|
-
import { onAuthStateChanged } from "firebase/auth";
|
|
6
|
-
import { TernSecureCtx } from "./TernSecureCtx";
|
|
7
|
-
import { useRouter, usePathname } from "next/navigation";
|
|
8
|
-
import { isBaseAuthRoute, isInternalRoute, isAuthRoute } from "../app-router/route-handler/internal-route";
|
|
9
|
-
import { hasRedirectLoop } from "../utils/construct";
|
|
10
|
-
function TernSecureClientProvider({
|
|
11
|
-
children,
|
|
12
|
-
loginPath = process.env.NEXT_PUBLIC_SIGN_IN_PATH || "/sign-in",
|
|
13
|
-
signUpPath = process.env.NEXT_PUBLIC_SIGN_UP_PATH || "/sign-up",
|
|
14
|
-
loadingComponent,
|
|
15
|
-
requiresVerification
|
|
16
|
-
}) {
|
|
17
|
-
const auth = useMemo(() => ternSecureAuth, []);
|
|
18
|
-
const router = useRouter();
|
|
19
|
-
const pathname = usePathname();
|
|
20
|
-
const [isRedirecting, setIsRedirecting] = useState(false);
|
|
21
|
-
const [authState, setAuthState] = useState(() => ({
|
|
22
|
-
userId: null,
|
|
23
|
-
isLoaded: false,
|
|
24
|
-
error: null,
|
|
25
|
-
isValid: false,
|
|
26
|
-
isVerified: false,
|
|
27
|
-
isAuthenticated: false,
|
|
28
|
-
token: null,
|
|
29
|
-
email: null,
|
|
30
|
-
status: "loading",
|
|
31
|
-
requiresVerification
|
|
32
|
-
}));
|
|
33
|
-
const constructUrlWithRedirect = useCallback(
|
|
34
|
-
(loginPath2, currentPath, loginPathParam, signUpPathParam) => {
|
|
35
|
-
const baseUrl = window.location.origin;
|
|
36
|
-
const signInUrl = new URL(loginPath2, baseUrl);
|
|
37
|
-
if (!currentPath.includes(loginPathParam) && !currentPath.includes(signUpPathParam)) {
|
|
38
|
-
signInUrl.searchParams.set("redirect", currentPath);
|
|
39
|
-
}
|
|
40
|
-
return signInUrl.toString();
|
|
41
|
-
},
|
|
42
|
-
[]
|
|
43
|
-
);
|
|
44
|
-
const shouldRedirect = useCallback(
|
|
45
|
-
(pathname2, isVerified) => {
|
|
46
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
47
|
-
if (isBaseAuthRoute(pathname2) && !searchParams.has("redirect")) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
if (isInternalRoute(pathname2)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (isAuthRoute(pathname2) && (!requiresVerification || isVerified)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
},
|
|
58
|
-
[requiresVerification]
|
|
59
|
-
);
|
|
60
|
-
const redirectToLogin = useCallback(
|
|
61
|
-
(currentPath) => {
|
|
62
|
-
const path = currentPath || pathname || "/";
|
|
63
|
-
if (isInternalRoute(path)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (hasRedirectLoop(path, loginPath)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
setIsRedirecting(true);
|
|
70
|
-
const loginUrl = constructUrlWithRedirect(loginPath, path, loginPath, signUpPath);
|
|
71
|
-
if (process.env.NODE_ENV === "production") {
|
|
72
|
-
window.location.href = loginUrl;
|
|
73
|
-
} else {
|
|
74
|
-
router.push(loginUrl);
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
[router, loginPath, signUpPath, pathname, constructUrlWithRedirect]
|
|
78
|
-
);
|
|
79
|
-
const handleSignOut = useCallback(async (error) => {
|
|
80
|
-
const currentPath = window.location.pathname;
|
|
81
|
-
await auth.signOut();
|
|
82
|
-
setAuthState({
|
|
83
|
-
isLoaded: true,
|
|
84
|
-
userId: null,
|
|
85
|
-
error: error || null,
|
|
86
|
-
isValid: false,
|
|
87
|
-
token: null,
|
|
88
|
-
email: null,
|
|
89
|
-
isVerified: false,
|
|
90
|
-
isAuthenticated: false,
|
|
91
|
-
status: "unauthenticated",
|
|
92
|
-
requiresVerification
|
|
93
|
-
});
|
|
94
|
-
redirectToLogin(currentPath);
|
|
95
|
-
}, [auth, redirectToLogin, requiresVerification]);
|
|
96
|
-
const setEmail = useCallback((email) => {
|
|
97
|
-
setAuthState((prev) => ({
|
|
98
|
-
...prev,
|
|
99
|
-
email
|
|
100
|
-
}));
|
|
101
|
-
}, []);
|
|
102
|
-
const getAuthError = useCallback(() => {
|
|
103
|
-
if (authState.error) {
|
|
104
|
-
const error = authState.error;
|
|
105
|
-
return {
|
|
106
|
-
success: false,
|
|
107
|
-
message: error.message,
|
|
108
|
-
error: error.code,
|
|
109
|
-
user: null
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (authState.requiresVerification && authState.isValid && !authState.isVerified) {
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
message: "Email verification required",
|
|
116
|
-
error: "EMAIL_NOT_VERIFIED",
|
|
117
|
-
user: null
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
if (!authState.isAuthenticated && authState.status !== "loading") {
|
|
121
|
-
return {
|
|
122
|
-
success: false,
|
|
123
|
-
message: "User is not authenticated",
|
|
124
|
-
error: "AUTHENTICATED",
|
|
125
|
-
user: null
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
success: true,
|
|
130
|
-
user: ternSecureAuth.currentUser
|
|
131
|
-
};
|
|
132
|
-
}, [
|
|
133
|
-
authState.error,
|
|
134
|
-
authState.isValid,
|
|
135
|
-
authState.isVerified,
|
|
136
|
-
authState.isAuthenticated,
|
|
137
|
-
authState.status,
|
|
138
|
-
authState.requiresVerification
|
|
139
|
-
]);
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
let mounted = true;
|
|
142
|
-
let initialLoad = true;
|
|
143
|
-
const unsubscribe = onAuthStateChanged(
|
|
144
|
-
auth,
|
|
145
|
-
async (user) => {
|
|
146
|
-
if (!mounted) return;
|
|
147
|
-
try {
|
|
148
|
-
if (user) {
|
|
149
|
-
const isValid = !!user.uid;
|
|
150
|
-
const isVerified = user.emailVerified;
|
|
151
|
-
const isAuthenticated = isValid && (!requiresVerification || isVerified);
|
|
152
|
-
setAuthState({
|
|
153
|
-
isLoaded: true,
|
|
154
|
-
userId: user.uid,
|
|
155
|
-
isValid,
|
|
156
|
-
isVerified,
|
|
157
|
-
isAuthenticated: isValid && isVerified,
|
|
158
|
-
token: user.getIdToken(),
|
|
159
|
-
error: null,
|
|
160
|
-
email: user.email,
|
|
161
|
-
status: isAuthenticated ? "authenticated" : "unverified",
|
|
162
|
-
requiresVerification
|
|
163
|
-
});
|
|
164
|
-
if (requiresVerification && !isVerified && shouldRedirect(pathname || "", isVerified)) {
|
|
165
|
-
if (initialLoad || !isRedirecting) {
|
|
166
|
-
redirectToLogin(pathname);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
setAuthState({
|
|
171
|
-
isLoaded: true,
|
|
172
|
-
userId: null,
|
|
173
|
-
isValid: false,
|
|
174
|
-
isVerified: false,
|
|
175
|
-
isAuthenticated: false,
|
|
176
|
-
token: null,
|
|
177
|
-
error: null,
|
|
178
|
-
email: null,
|
|
179
|
-
status: "unauthenticated",
|
|
180
|
-
requiresVerification
|
|
181
|
-
});
|
|
182
|
-
if (shouldRedirect(pathname || "", false) && initialLoad) {
|
|
183
|
-
redirectToLogin();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
} catch (error) {
|
|
187
|
-
console.error("Auth state change error:", error);
|
|
188
|
-
if (mounted) {
|
|
189
|
-
handleSignOut(error instanceof Error ? error : new Error("Authentication error occurred"));
|
|
190
|
-
}
|
|
191
|
-
} finally {
|
|
192
|
-
initialLoad = false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
return () => {
|
|
197
|
-
mounted = false;
|
|
198
|
-
unsubscribe();
|
|
199
|
-
};
|
|
200
|
-
}, [auth, handleSignOut, redirectToLogin, requiresVerification, pathname, isRedirecting, shouldRedirect]);
|
|
201
|
-
const contextValue = useMemo(() => ({
|
|
202
|
-
...authState,
|
|
203
|
-
signOut: handleSignOut,
|
|
204
|
-
setEmail,
|
|
205
|
-
getAuthError,
|
|
206
|
-
redirectToLogin
|
|
207
|
-
}), [authState, handleSignOut, setEmail, getAuthError, redirectToLogin]);
|
|
208
|
-
if (!authState.isLoaded) {
|
|
209
|
-
return /* @__PURE__ */ jsx(TernSecureCtx.Provider, { value: contextValue, children: loadingComponent || /* @__PURE__ */ jsx("div", { "aria-live": "polite", "aria-busy": "true", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading authentication state..." }) }) });
|
|
210
|
-
}
|
|
211
|
-
return /* @__PURE__ */ jsx(TernSecureCtx.Provider, { value: contextValue, children });
|
|
212
|
-
}
|
|
213
|
-
export {
|
|
214
|
-
TernSecureClientProvider
|
|
215
|
-
};
|
|
216
|
-
//# sourceMappingURL=TernSecureClientProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/boundary/TernSecureClientProvider.tsx"],"sourcesContent":["\"use client\"\n\nimport React, { useState, useEffect, useMemo, useCallback } from 'react'\nimport { ternSecureAuth } from '../utils/client-init'\nimport { onAuthStateChanged, User } from \"firebase/auth\"\nimport { TernSecureCtx, TernSecureCtxValue } from './TernSecureCtx'\nimport type { TernSecureState, AuthError, SignInResponse } from \"../types\"\nimport type { ERRORS } from '../errors'\nimport { useRouter, usePathname } from 'next/navigation'\nimport { isBaseAuthRoute, isInternalRoute, isAuthRoute} from '../app-router/route-handler/internal-route'\nimport { hasRedirectLoop } from '../utils/construct'\n\n\n\n/**\n * @internal\n * Internal provider props - not meant for direct usage\n */\ninterface TernSecureClientProviderProps {\n children: React.ReactNode\n /** Callback when user state changes */\n onUserChanged?: (user: User | null) => Promise<void>\n /** Login page path */\n loginPath?: string\n /** Signup page path */\n signUpPath?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Whether email verification is required */\n requiresVerification: boolean\n}\n\n/**\n * @internal\n * Internal provider component that handles authentication state\n * This is wrapped by the public TernSecureProvider\n */\n\nexport function TernSecureClientProvider({ \n children, \n loginPath = process.env.NEXT_PUBLIC_SIGN_IN_PATH || '/sign-in',\n signUpPath = process.env.NEXT_PUBLIC_SIGN_UP_PATH || '/sign-up',\n loadingComponent,\n requiresVerification,\n}: TernSecureClientProviderProps) {\n const auth = useMemo(() => ternSecureAuth, []);\n const router = useRouter();\n const pathname = usePathname() // Get current pathname\n const [isRedirecting, setIsRedirecting] = useState(false)\n\n const [authState, setAuthState] = useState<TernSecureState>(() => ({\n userId: null,\n isLoaded: false,\n error: null,\n isValid: false,\n isVerified: false,\n isAuthenticated: false,\n token: null,\n email: null,\n status: \"loading\",\n requiresVerification,\n }));\n\n const constructUrlWithRedirect = useCallback(\n (loginPath: string, currentPath: string, loginPathParam: string, signUpPathParam: string): string => {\n const baseUrl = window.location.origin\n const signInUrl = new URL(loginPath, baseUrl)\n\n // Only add redirect if not already on login or signup page\n if (!currentPath.includes(loginPathParam) && !currentPath.includes(signUpPathParam)) {\n signInUrl.searchParams.set(\"redirect\", currentPath)\n }\n return signInUrl.toString()\n },\n [],\n )\n\n\n const shouldRedirect = useCallback(\n (pathname: string, isVerified: boolean) => {\n // Get current search params\n const searchParams = new URLSearchParams(window.location.search)\n\n // Don't redirect if we're on the base sign-in page with no redirect param\n if (isBaseAuthRoute(pathname) && !searchParams.has(\"redirect\")) {\n return false\n }\n\n // Don't redirect if we're on an internal route\n if (isInternalRoute(pathname)) {\n return false\n }\n\n // Don't redirect if we're in auth routes (except when handling verification)\n if (isAuthRoute(pathname) && (!requiresVerification || isVerified)) {\n return false\n }\n\n return true\n },\n [requiresVerification],\n )\n\n const redirectToLogin = useCallback(\n (currentPath?: string) => {\n const path = currentPath || pathname || \"/\"\n\n\n if (isInternalRoute(path)) { // Don't redirect if we're already on an internal route\n return\n }\n\n // Check for redirect loops\n if (hasRedirectLoop(path, loginPath)) {\n return\n }\n\n setIsRedirecting(true)\n\n const loginUrl = constructUrlWithRedirect(loginPath, path, loginPath, signUpPath)\n\n if (process.env.NODE_ENV === \"production\") {\n window.location.href = loginUrl\n } else {\n // Use router.push for development\n router.push(loginUrl)\n }\n }, \n [router, loginPath, signUpPath, pathname, constructUrlWithRedirect]\n)\n\n const handleSignOut = useCallback(async (error?: Error) => {\n const currentPath = window.location.pathname\n await auth.signOut();\n setAuthState({\n isLoaded: true,\n userId: null,\n error: error || null,\n isValid: false,\n token: null,\n email: null,\n isVerified: false,\n isAuthenticated: false,\n status: \"unauthenticated\",\n requiresVerification,\n })\n redirectToLogin(currentPath)\n }, [auth, redirectToLogin, requiresVerification])\n\n const setEmail = useCallback((email: string) => {\n setAuthState((prev) => ({\n ...prev,\n email,\n }))\n }, [])\n\n const getAuthError = useCallback((): SignInResponse => {\n if (authState.error) {\n const error = authState.error as AuthError;\n return {\n success: false,\n message: error.message,\n error: error.code as keyof typeof ERRORS,\n user: null,\n }\n }\n\n if (authState.requiresVerification && authState.isValid && !authState.isVerified) {\n return {\n success: false,\n message: 'Email verification required',\n error: 'EMAIL_NOT_VERIFIED',\n user: null,\n }\n }\n\n if (!authState.isAuthenticated && authState.status !== \"loading\") {\n return {\n success: false,\n message: 'User is not authenticated',\n error: 'AUTHENTICATED',\n user: null,\n }\n }\n\n return {\n success: true,\n user: ternSecureAuth.currentUser,\n }\n }, [\n authState.error,\n authState.isValid,\n authState.isVerified,\n authState.isAuthenticated,\n authState.status,\n authState.requiresVerification,\n ])\n\nuseEffect(() => {\n let mounted = true\n let initialLoad = true\n\n const unsubscribe = onAuthStateChanged(\n auth,\n async (user: User | null) => {\n if (!mounted) return\n try {\n if (user) {\n const isValid = !!user.uid;\n const isVerified = user.emailVerified;\n const isAuthenticated = isValid && (!requiresVerification || isVerified) // Consider user authenticated if verification is not required or if email is verified\n\n setAuthState({\n isLoaded: true,\n userId: user.uid,\n isValid,\n isVerified,\n isAuthenticated: isValid && isVerified,\n token: user.getIdToken(),\n error: null,\n email: user.email,\n status: isAuthenticated ? \"authenticated\" : \"unverified\",\n requiresVerification,\n })\n \n if (requiresVerification && !isVerified && shouldRedirect(pathname || \"\", isVerified)) {\n if(initialLoad || !isRedirecting) {\n redirectToLogin(pathname)\n }\n }\n } else {\n setAuthState({\n isLoaded: true,\n userId: null,\n isValid: false,\n isVerified: false,\n isAuthenticated: false,\n token: null,\n error: null,\n email: null,\n status: \"unauthenticated\",\n requiresVerification,\n })\n \n if (shouldRedirect(pathname || \"\", false) && initialLoad) {\n redirectToLogin()\n }\n }\n } catch (error){\n console.error(\"Auth state change error:\", error)\n if (mounted) {\n handleSignOut(error instanceof Error ? error : new Error(\"Authentication error occurred\"))\n }\n } finally {\n initialLoad = false\n }\n })\n \n return () => {\n mounted = false\n unsubscribe()\n }\n }, [auth, handleSignOut, redirectToLogin, requiresVerification, pathname, isRedirecting, shouldRedirect])\n\n const contextValue: TernSecureCtxValue = useMemo(() => ({\n ...authState,\n signOut: handleSignOut,\n setEmail,\n getAuthError,\n redirectToLogin,\n }), [authState, handleSignOut, setEmail, getAuthError, redirectToLogin]);\n\n if (!authState.isLoaded) {\n return (\n <TernSecureCtx.Provider value={contextValue}>\n {loadingComponent || (\n <div aria-live=\"polite\" aria-busy=\"true\">\n <span className=\"sr-only\">Loading authentication state...</span>\n </div>\n )}\n </TernSecureCtx.Provider>\n );\n }\n\n return (\n <TernSecureCtx.Provider value={contextValue}>\n {children}\n </TernSecureCtx.Provider>\n )\n}"],"mappings":";AAqRY;AAnRZ,SAAgB,UAAU,WAAW,SAAS,mBAAmB;AACjE,SAAS,sBAAsB;AAC/B,SAAS,0BAAgC;AACzC,SAAS,qBAAyC;AAGlD,SAAS,WAAW,mBAAmB;AACvC,SAAS,iBAAiB,iBAA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;AAAA,cACZ,iBAAiB;AAAA,cACjB,OAAO;AAAA,cACP,OAAO;AAAA,cACP,OAAO;AAAA,cACP,QAAQ;AAAA,cACR;AAAA,YACF,CAAC;AAED,gBAAI,eAAe,YAAY,IAAI,KAAK,KAAK,aAAa;AACxD,8BAAgB;AAAA,YAClB;AAAA,UACF;AAAA,QACF,SAAS,OAAM;AACb,kBAAQ,MAAM,4BAA4B,KAAK;AAC/C,cAAI,SAAS;AACX,0BAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,+BAA+B,CAAC;AAAA,UAC3F;AAAA,QACF,UAAE;AACA,wBAAc;AAAA,QAChB;AAAA,MACF;AAAA,IAAC;AAED,WAAO,MAAM;AACX,gBAAU;AACV,kBAAY;AAAA,IACd;AAAA,EACA,GAAG,CAAC,MAAM,eAAe,iBAAiB,sBAAsB,UAAU,eAAe,cAAc,CAAC;AAExG,QAAM,eAAmC,QAAQ,OAAO;AAAA,IACtD,GAAG;AAAA,IACH,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,CAAC,WAAW,eAAe,UAAU,cAAc,eAAe,CAAC;AAEvE,MAAI,CAAC,UAAU,UAAU;AACvB,WACE,oBAAC,cAAc,UAAd,EAAuB,OAAO,cAC5B,8BACC,oBAAC,SAAI,aAAU,UAAS,aAAU,QAChC,8BAAC,UAAK,WAAU,WAAU,6CAA+B,GAC3D,GAEJ;AAAA,EAEJ;AAEA,SACI,oBAAC,cAAc,UAAd,EAAuB,OAAO,cAC7B,UACF;AAEN;","names":["loginPath","pathname"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { ternSecureAuth } from "../utils/client-init";
|
|
4
|
-
const getCurrentUser = () => {
|
|
5
|
-
return ternSecureAuth.currentUser;
|
|
6
|
-
};
|
|
7
|
-
const TernSecureCtx = createContext(null);
|
|
8
|
-
TernSecureCtx.displayName = "TernSecureCtx";
|
|
9
|
-
const useTernSecure = (hookName) => {
|
|
10
|
-
const context = useContext(TernSecureCtx);
|
|
11
|
-
if (!context) {
|
|
12
|
-
throw new Error(
|
|
13
|
-
`${hookName} must be used within TernSecureProvider`
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
return context;
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
TernSecureCtx,
|
|
20
|
-
getCurrentUser,
|
|
21
|
-
useTernSecure
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=TernSecureCtx.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/boundary/TernSecureCtx.tsx"],"sourcesContent":["\"use client\"\n\nimport { createContext, useContext } from 'react'\nimport { ternSecureAuth } from '../utils/client-init';\nimport type { TernSecureState, SignInResponse, TernSecureUser } from '../types';\n\n\nexport const getCurrentUser = (): TernSecureUser | null => {\n return ternSecureAuth.currentUser;\n}\n\nexport interface TernSecureCtxValue extends TernSecureState {\n signOut: () => Promise<void>\n setEmail: (email: string) => void\n getAuthError: () => SignInResponse\n redirectToLogin: () => void\n}\n\nexport const TernSecureCtx = createContext<TernSecureCtxValue | null>(null)\n\nTernSecureCtx.displayName = 'TernSecureCtx'\n\nexport const useTernSecure = (hookName: string) => {\n const context = useContext(TernSecureCtx)\n \n if (!context) {\n throw new Error(\n `${hookName} must be used within TernSecureProvider`\n )\n }\n\n return context\n}\n\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAC1C,SAAS,sBAAsB;AAIxB,MAAM,iBAAiB,MAA6B;AACzD,SAAO,eAAe;AACxB;AASO,MAAM,gBAAgB,cAAyC,IAAI;AAE1E,cAAc,cAAc;AAErB,MAAM,gBAAgB,CAAC,aAAqB;AACjD,QAAM,UAAU,WAAW,aAAa;AAExC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,GAAG,QAAQ;AAAA,IACb;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { getCurrentUser, useTernSecure } from "../TernSecureCtx";
|
|
3
|
-
function useAuth() {
|
|
4
|
-
const {
|
|
5
|
-
userId,
|
|
6
|
-
isLoaded,
|
|
7
|
-
error,
|
|
8
|
-
isValid,
|
|
9
|
-
isVerified,
|
|
10
|
-
isAuthenticated,
|
|
11
|
-
token,
|
|
12
|
-
getAuthError,
|
|
13
|
-
status,
|
|
14
|
-
requiresVerification,
|
|
15
|
-
signOut
|
|
16
|
-
} = useTernSecure("useAuth");
|
|
17
|
-
const user = getCurrentUser();
|
|
18
|
-
const authResponse = getAuthError();
|
|
19
|
-
return {
|
|
20
|
-
user,
|
|
21
|
-
userId,
|
|
22
|
-
isLoaded,
|
|
23
|
-
error: authResponse.success ? null : authResponse,
|
|
24
|
-
isValid,
|
|
25
|
-
// User is signed in
|
|
26
|
-
isVerified,
|
|
27
|
-
// Email is verified
|
|
28
|
-
isAuthenticated,
|
|
29
|
-
// User is both signed in and verified
|
|
30
|
-
token,
|
|
31
|
-
status,
|
|
32
|
-
requiresVerification,
|
|
33
|
-
signOut
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
useAuth
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=useAuth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/boundary/hooks/useAuth.ts"],"sourcesContent":["\"use client\"\n\nimport { getCurrentUser, useTernSecure } from '../TernSecureCtx'\nimport type { SignInResponse, TernSecureUser } from '../../types'\n\n\nexport function useAuth() {\n const {\n userId,\n isLoaded,\n error,\n isValid,\n isVerified,\n isAuthenticated,\n token,\n getAuthError,\n status,\n requiresVerification,\n signOut\n } = useTernSecure('useAuth')\n\n const user: TernSecureUser | null = getCurrentUser()\n const authResponse: SignInResponse = getAuthError()\n\n\n return {\n user,\n userId,\n isLoaded,\n error: authResponse.success ? null : authResponse,\n isValid, // User is signed in\n isVerified, // Email is verified\n isAuthenticated, // User is both signed in and verified\n token,\n status,\n requiresVerification,\n signOut\n }\n}\n"],"mappings":";AAEA,SAAS,gBAAgB,qBAAqB;AAIvC,SAAS,UAAU;AACxB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc,SAAS;AAE3B,QAAM,OAA8B,eAAe;AACnD,QAAM,eAA+B,aAAa;AAGlD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,aAAa,UAAU,OAAO;AAAA,IACrC;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useTernSecure } from "../TernSecureCtx";
|
|
3
|
-
function useSignUp() {
|
|
4
|
-
const {
|
|
5
|
-
email,
|
|
6
|
-
setEmail
|
|
7
|
-
} = useTernSecure("useSignUp");
|
|
8
|
-
return {
|
|
9
|
-
email,
|
|
10
|
-
setEmail
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
useSignUp
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=useSignUp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/boundary/hooks/useSignUp.ts"],"sourcesContent":["\"use client\"\n\nimport { useTernSecure } from '../TernSecureCtx'\n\nexport function useSignUp() {\n const {\n email,\n setEmail\n } = useTernSecure('useSignUp')\n\n return {\n email, \n setEmail\n }\n}\n"],"mappings":";AAEA,SAAS,qBAAqB;AAEvB,SAAS,YAAY;AAC1B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI,cAAc,WAAW;AAE7B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
function AuthBackground() {
|
|
3
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4
|
-
/* @__PURE__ */ jsx(
|
|
5
|
-
"div",
|
|
6
|
-
{
|
|
7
|
-
className: "absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80",
|
|
8
|
-
"aria-hidden": "true",
|
|
9
|
-
children: /* @__PURE__ */ jsx(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
className: "relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75",
|
|
13
|
-
style: {
|
|
14
|
-
clipPath: "polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
),
|
|
20
|
-
/* @__PURE__ */ jsx(
|
|
21
|
-
"div",
|
|
22
|
-
{
|
|
23
|
-
className: "absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]",
|
|
24
|
-
"aria-hidden": "true",
|
|
25
|
-
children: /* @__PURE__ */ jsx(
|
|
26
|
-
"div",
|
|
27
|
-
{
|
|
28
|
-
className: "relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75",
|
|
29
|
-
style: {
|
|
30
|
-
clipPath: "polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
] });
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
AuthBackground
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=background.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/background.tsx"],"sourcesContent":["export function AuthBackground() {\n return (\n <>\n {/* Primary gradient blob */}\n <div\n className=\"absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80\"\n aria-hidden=\"true\"\n >\n <div\n className=\"relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75\"\n style={{\n clipPath:\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\n }}\n />\n </div>\n \n {/* Secondary gradient blob */}\n <div\n className=\"absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]\"\n aria-hidden=\"true\"\n >\n <div\n className=\"relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75\"\n style={{\n clipPath:\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\n }}\n />\n </div>\n </>\n )\n }\n \n "],"mappings":"AAEM,mBAMM,KANN;AAFC,SAAS,iBAAiB;AAC7B,SACE,iCAEE;AAAA;AAAA,MAAC;AAAA;AAAA,QACG,WAAU;AAAA,QACV,eAAY;AAAA,QAEZ;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,UACE;AAAA,YACJ;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAGF;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,eAAY;AAAA,QAEZ;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,UACE;AAAA,YACJ;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|