@tern-secure/nextjs 3.3.3 → 3.4.0
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/types/index.d.ts +1 -0
- package/package.json +79 -79
- package/dist/cjs/app-router/client/TernSecureProvider.js +0 -33
- package/dist/cjs/app-router/client/TernSecureProvider.js.map +0 -1
- package/dist/cjs/app-router/client/actions.js +0 -97
- package/dist/cjs/app-router/client/actions.js.map +0 -1
- package/dist/cjs/app-router/server/auth.js +0 -71
- package/dist/cjs/app-router/server/auth.js.map +0 -1
- package/dist/cjs/app-router/server/index.js +0 -42
- package/dist/cjs/app-router/server/index.js.map +0 -1
- package/dist/cjs/app-router/server/sessionTernSecure.js +0 -159
- package/dist/cjs/app-router/server/sessionTernSecure.js.map +0 -1
- package/dist/cjs/app-router/server/ternSecureMiddleware.js +0 -50
- package/dist/cjs/app-router/server/ternSecureMiddleware.js.map +0 -1
- package/dist/cjs/boundary/TernSecureClientProvider.js +0 -94
- package/dist/cjs/boundary/TernSecureClientProvider.js.map +0 -1
- package/dist/cjs/boundary/TernSecureCtx.js +0 -49
- package/dist/cjs/boundary/TernSecureCtx.js.map +0 -1
- package/dist/cjs/boundary/hooks/useAuth.js +0 -51
- package/dist/cjs/boundary/hooks/useAuth.js.map +0 -1
- package/dist/cjs/boundary/hooks/useUser.js +0 -44
- package/dist/cjs/boundary/hooks/useUser.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 -243
- package/dist/cjs/components/sign-in.js.map +0 -1
- package/dist/cjs/components/sign-out.js +0 -69
- package/dist/cjs/components/sign-out.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 +0 -59
- package/dist/cjs/components/ui/separator.js.map +0 -1
- package/dist/cjs/errors.js +0 -41
- package/dist/cjs/errors.js.map +0 -1
- package/dist/cjs/index.js +0 -56
- package/dist/cjs/index.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 +0 -33
- package/dist/cjs/lib/utils.js.map +0 -1
- package/dist/cjs/types.js +0 -17
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/admin-init.js +0 -57
- package/dist/cjs/utils/admin-init.js.map +0 -1
- package/dist/cjs/utils/client-init.js +0 -49
- package/dist/cjs/utils/client-init.js.map +0 -1
- package/dist/cjs/utils/config.js +0 -113
- package/dist/cjs/utils/config.js.map +0 -1
- package/dist/cjs/utils/construct.js +0 -63
- package/dist/cjs/utils/construct.js.map +0 -1
- package/dist/cjs/utils/create-styles.js +0 -149
- package/dist/cjs/utils/create-styles.js.map +0 -1
- package/dist/esm/app-router/client/TernSecureProvider.js +0 -9
- package/dist/esm/app-router/client/TernSecureProvider.js.map +0 -1
- package/dist/esm/app-router/client/actions.js +0 -70
- package/dist/esm/app-router/client/actions.js.map +0 -1
- package/dist/esm/app-router/server/auth.js +0 -47
- package/dist/esm/app-router/server/auth.js.map +0 -1
- package/dist/esm/app-router/server/index.js +0 -13
- package/dist/esm/app-router/server/index.js.map +0 -1
- package/dist/esm/app-router/server/sessionTernSecure.js +0 -129
- package/dist/esm/app-router/server/sessionTernSecure.js.map +0 -1
- package/dist/esm/app-router/server/ternSecureMiddleware.js +0 -26
- package/dist/esm/app-router/server/ternSecureMiddleware.js.map +0 -1
- package/dist/esm/boundary/TernSecureClientProvider.js +0 -70
- 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 -27
- package/dist/esm/boundary/hooks/useAuth.js.map +0 -1
- package/dist/esm/boundary/hooks/useUser.js +0 -20
- package/dist/esm/boundary/hooks/useUser.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 -219
- package/dist/esm/components/sign-in.js.map +0 -1
- package/dist/esm/components/sign-out.js +0 -45
- package/dist/esm/components/sign-out.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/errors.js +0 -16
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/index.js +0 -22
- package/dist/esm/index.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/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/utils/admin-init.js +0 -22
- package/dist/esm/utils/admin-init.js.map +0 -1
- package/dist/esm/utils/client-init.js +0 -22
- package/dist/esm/utils/client-init.js.map +0 -1
- package/dist/esm/utils/config.js +0 -84
- package/dist/esm/utils/config.js.map +0 -1
- package/dist/esm/utils/construct.js +0 -37
- package/dist/esm/utils/construct.js.map +0 -1
- package/dist/esm/utils/create-styles.js +0 -123
- package/dist/esm/utils/create-styles.js.map +0 -1
- package/dist/types/app-router/client/TernSecureProvider.d.ts +0 -26
- package/dist/types/app-router/client/TernSecureProvider.d.ts.map +0 -1
- package/dist/types/app-router/client/actions.d.ts +0 -39
- package/dist/types/app-router/client/actions.d.ts.map +0 -1
- package/dist/types/app-router/server/auth.d.ts +0 -7
- package/dist/types/app-router/server/auth.d.ts.map +0 -1
- package/dist/types/app-router/server/index.d.ts +0 -5
- package/dist/types/app-router/server/index.d.ts.map +0 -1
- package/dist/types/app-router/server/sessionTernSecure.d.ts +0 -37
- package/dist/types/app-router/server/sessionTernSecure.d.ts.map +0 -1
- package/dist/types/app-router/server/ternSecureMiddleware.d.ts +0 -7
- package/dist/types/app-router/server/ternSecureMiddleware.d.ts.map +0 -1
- package/dist/types/boundary/TernSecureClientProvider.d.ts +0 -11
- package/dist/types/boundary/TernSecureClientProvider.d.ts.map +0 -1
- package/dist/types/boundary/TernSecureCtx.d.ts +0 -15
- package/dist/types/boundary/TernSecureCtx.d.ts.map +0 -1
- package/dist/types/boundary/hooks/useAuth.d.ts +0 -11
- package/dist/types/boundary/hooks/useAuth.d.ts.map +0 -1
- package/dist/types/boundary/hooks/useUser.d.ts +0 -7
- package/dist/types/boundary/hooks/useUser.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.d.ts +0 -10
- package/dist/types/components/sign-out.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/errors.d.ts +0 -9
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/index.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/dist/types/types.d.ts +0 -63
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/admin-init.d.ts +0 -4
- package/dist/types/utils/admin-init.d.ts.map +0 -1
- package/dist/types/utils/client-init.d.ts +0 -5
- package/dist/types/utils/client-init.d.ts.map +0 -1
- package/dist/types/utils/config.d.ts +0 -35
- package/dist/types/utils/config.d.ts.map +0 -1
- package/dist/types/utils/construct.d.ts +0 -22
- package/dist/types/utils/construct.d.ts.map +0 -1
- package/dist/types/utils/create-styles.d.ts +0 -99
- package/dist/types/utils/create-styles.d.ts.map +0 -1
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var sign_in_exports = {};
|
|
21
|
-
__export(sign_in_exports, {
|
|
22
|
-
SignIn: () => SignIn
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(sign_in_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_navigation = require("next/navigation");
|
|
28
|
-
var import_actions = require("../app-router/client/actions");
|
|
29
|
-
var import_card = require("./ui/card");
|
|
30
|
-
var import_input = require("./ui/input");
|
|
31
|
-
var import_label = require("./ui/label");
|
|
32
|
-
var import_button = require("./ui/button");
|
|
33
|
-
var import_alert = require("./ui/alert");
|
|
34
|
-
var import_separator = require("./ui/separator");
|
|
35
|
-
var import_utils = require("../lib/utils");
|
|
36
|
-
var import_lucide_react = require("lucide-react");
|
|
37
|
-
var import_auth = require("firebase/auth");
|
|
38
|
-
var import_client_init = require("../utils/client-init");
|
|
39
|
-
var import_sessionTernSecure = require("../app-router/server/sessionTernSecure");
|
|
40
|
-
var import_background = require("./background");
|
|
41
|
-
var import_construct = require("../utils/construct");
|
|
42
|
-
const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
|
43
|
-
const authDomain = process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN;
|
|
44
|
-
const appName = process.env.NEXT_PUBLIC_FIREBASE_APP_NAME || "TernSecure";
|
|
45
|
-
function SignIn({
|
|
46
|
-
redirectUrl,
|
|
47
|
-
onError,
|
|
48
|
-
onSuccess,
|
|
49
|
-
className,
|
|
50
|
-
customStyles = {}
|
|
51
|
-
}) {
|
|
52
|
-
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
53
|
-
const [checkingRedirect, setCheckingRedirect] = (0, import_react.useState)(true);
|
|
54
|
-
const [error, setError] = (0, import_react.useState)("");
|
|
55
|
-
const [email, setEmail] = (0, import_react.useState)("");
|
|
56
|
-
const [password, setPassword] = (0, import_react.useState)("");
|
|
57
|
-
const searchParams = (0, import_navigation.useSearchParams)();
|
|
58
|
-
const isRedirectSignIn = searchParams.get("signInRedirect") === "true";
|
|
59
|
-
const handleRedirectResult = (0, import_react.useCallback)(async () => {
|
|
60
|
-
if (!isRedirectSignIn) return false;
|
|
61
|
-
setCheckingRedirect(true);
|
|
62
|
-
try {
|
|
63
|
-
console.log("Checking redirect result...");
|
|
64
|
-
console.log("Current hostname:", window.location.hostname);
|
|
65
|
-
console.log("Auth domain hostname:", authDomain);
|
|
66
|
-
const isOnAuth = authDomain && window.location.hostname === authDomain.replace(/https?:\/\//, "");
|
|
67
|
-
console.log("Is on AuthDomain:", isOnAuth);
|
|
68
|
-
const result = await (0, import_auth.getRedirectResult)(import_client_init.ternSecureAuth);
|
|
69
|
-
console.log("Redirect result:", result);
|
|
70
|
-
if (result) {
|
|
71
|
-
const idToken = await result.user.getIdToken();
|
|
72
|
-
const sessionResult = await (0, import_sessionTernSecure.createSessionCookie)(idToken);
|
|
73
|
-
if (!sessionResult.success) {
|
|
74
|
-
throw new Error("Failed to create session");
|
|
75
|
-
}
|
|
76
|
-
const storedRedirectUrl = sessionStorage.getItem("auth_return_url");
|
|
77
|
-
sessionStorage.removeItem("auth_redirect_url");
|
|
78
|
-
onSuccess == null ? void 0 : onSuccess();
|
|
79
|
-
window.location.href = storedRedirectUrl || (0, import_construct.getValidRedirectUrl)(redirectUrl, searchParams);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
setCheckingRedirect(false);
|
|
83
|
-
} catch (err) {
|
|
84
|
-
console.error("Redirect result error:", err);
|
|
85
|
-
const errorMessage = err instanceof Error ? err.message : "Authentication failed";
|
|
86
|
-
setError(errorMessage);
|
|
87
|
-
onError == null ? void 0 : onError(err instanceof Error ? err : new Error(errorMessage));
|
|
88
|
-
sessionStorage.removeItem("auth_redirect_url");
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}, [isRedirectSignIn, redirectUrl, searchParams, onSuccess, onError]);
|
|
92
|
-
(0, import_react.useEffect)(() => {
|
|
93
|
-
if (isRedirectSignIn) {
|
|
94
|
-
handleRedirectResult();
|
|
95
|
-
}
|
|
96
|
-
;
|
|
97
|
-
}, [handleRedirectResult, isRedirectSignIn]);
|
|
98
|
-
const handleSubmit = async (e) => {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
setLoading(true);
|
|
101
|
-
try {
|
|
102
|
-
const user = await (0, import_actions.signInWithEmail)(email, password);
|
|
103
|
-
if (user.success) {
|
|
104
|
-
onSuccess == null ? void 0 : onSuccess();
|
|
105
|
-
window.location.href = (0, import_construct.getValidRedirectUrl)(redirectUrl, searchParams);
|
|
106
|
-
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
const errorMessage = err instanceof Error ? err.message : "Failed to sign in";
|
|
109
|
-
setError(errorMessage);
|
|
110
|
-
onError == null ? void 0 : onError(err instanceof Error ? err : new Error("Failed to sign in"));
|
|
111
|
-
} finally {
|
|
112
|
-
setLoading(false);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const handleSocialSignIn = async (provider) => {
|
|
116
|
-
setLoading(true);
|
|
117
|
-
try {
|
|
118
|
-
const validRedirectUrl = (0, import_construct.getValidRedirectUrl)(redirectUrl, searchParams);
|
|
119
|
-
sessionStorage.setItem("auth_redirect_url", validRedirectUrl);
|
|
120
|
-
const currentUrl = new URL(window.location.href);
|
|
121
|
-
currentUrl.searchParams.set("signInRedirect", "true");
|
|
122
|
-
window.history.replaceState({}, "", currentUrl.toString());
|
|
123
|
-
const result = provider === "google" ? await (0, import_actions.signInWithRedirectGoogle)() : await (0, import_actions.signInWithMicrosoft)();
|
|
124
|
-
if (!result.success) {
|
|
125
|
-
throw new Error(result.error);
|
|
126
|
-
}
|
|
127
|
-
} catch (err) {
|
|
128
|
-
const errorMessage = err instanceof Error ? err.message : `Failed to sign in with ${provider}`;
|
|
129
|
-
setError(errorMessage);
|
|
130
|
-
onError == null ? void 0 : onError(err instanceof Error ? err : new Error(`Failed to sign in with ${provider}`));
|
|
131
|
-
setLoading(false);
|
|
132
|
-
sessionStorage.removeItem("auth_redirect_url");
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
if (checkingRedirect && isRedirectSignIn) {
|
|
136
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto" }) }) });
|
|
137
|
-
}
|
|
138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative flex items-center justify-center", children: [
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_background.AuthBackground, {}),
|
|
140
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { className: (0, import_utils.cn)("w-full max-w-md mx-auto mt-8", className, customStyles.card), children: [
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardHeader, { className: "space-y-1 text-center", children: [
|
|
142
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardTitle, { className: (0, import_utils.cn)("font-bold", customStyles.title), children: [
|
|
143
|
-
"Sign in to ",
|
|
144
|
-
`${appName}`
|
|
145
|
-
] }),
|
|
146
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardDescription, { className: (0, import_utils.cn)("text-muted-foreground", customStyles.description), children: "Please sign in to continue" })
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardContent, { className: "space-y-4", children: [
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
150
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.Alert, { variant: "destructive", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.AlertDescription, { children: error }) }),
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
152
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "email", className: (0, import_utils.cn)(customStyles.label), children: "Email" }),
|
|
153
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
|
-
import_input.Input,
|
|
155
|
-
{
|
|
156
|
-
id: "email",
|
|
157
|
-
type: "email",
|
|
158
|
-
placeholder: "m@example.com",
|
|
159
|
-
value: email,
|
|
160
|
-
onChange: (e) => setEmail(e.target.value),
|
|
161
|
-
disabled: loading,
|
|
162
|
-
className: (0, import_utils.cn)(customStyles.input),
|
|
163
|
-
required: true
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "password", className: (0, import_utils.cn)(customStyles.label), children: "Password" }),
|
|
169
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
|
-
import_input.Input,
|
|
171
|
-
{
|
|
172
|
-
id: "password",
|
|
173
|
-
type: "password",
|
|
174
|
-
value: password,
|
|
175
|
-
onChange: (e) => setPassword(e.target.value),
|
|
176
|
-
disabled: loading,
|
|
177
|
-
className: (0, import_utils.cn)(customStyles.input),
|
|
178
|
-
required: true
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
] }),
|
|
182
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { type: "submit", disabled: loading, className: (0, import_utils.cn)("w-full", customStyles.button), children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
184
|
-
"Signing in..."
|
|
185
|
-
] }) : "Sign in" })
|
|
186
|
-
] }),
|
|
187
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
188
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_separator.Separator, { className: (0, import_utils.cn)(customStyles.separator) }),
|
|
189
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "bg-background px-2 text-muted-foreground text-sm", children: "Or continue with" }) })
|
|
190
|
-
] }),
|
|
191
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
193
|
-
import_button.Button,
|
|
194
|
-
{
|
|
195
|
-
variant: "outline",
|
|
196
|
-
disabled: loading,
|
|
197
|
-
onClick: () => handleSocialSignIn("google"),
|
|
198
|
-
className: (0, import_utils.cn)("flex items-center justify-center", customStyles.socialButton),
|
|
199
|
-
children: [
|
|
200
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { className: "w-5 h-5 mr-2", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
201
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z", fill: "#4285F4" }),
|
|
202
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z", fill: "#34A853" }),
|
|
203
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z", fill: "#FBBC05" }),
|
|
204
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "#EA4335" })
|
|
205
|
-
] }),
|
|
206
|
-
"Google"
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
211
|
-
import_button.Button,
|
|
212
|
-
{
|
|
213
|
-
variant: "outline",
|
|
214
|
-
disabled: loading,
|
|
215
|
-
onClick: () => handleSocialSignIn("microsoft"),
|
|
216
|
-
className: (0, import_utils.cn)("flex items-center justify-center", customStyles.socialButton),
|
|
217
|
-
children: [
|
|
218
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { className: "w-5 h-5 mr-2", viewBox: "0 0 23 23", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#f3f3f3", d: "M0 0h23v23H0z" }),
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
|
|
221
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
|
|
222
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
223
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
224
|
-
] }),
|
|
225
|
-
"Microsoft"
|
|
226
|
-
]
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
] })
|
|
230
|
-
] }),
|
|
231
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardFooter, { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-sm text-muted-foreground", children: [
|
|
232
|
-
"Don't have an account?",
|
|
233
|
-
" ",
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "/signup", className: "text-primary hover:underline", children: "Sign up" })
|
|
235
|
-
] }) })
|
|
236
|
-
] })
|
|
237
|
-
] });
|
|
238
|
-
}
|
|
239
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
240
|
-
0 && (module.exports = {
|
|
241
|
-
SignIn
|
|
242
|
-
});
|
|
243
|
-
//# sourceMappingURL=sign-in.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/sign-in.tsx"],"sourcesContent":["'use client'\r\n\r\nimport React, { useState, useCallback, useEffect } from 'react'\r\nimport { useSearchParams } from 'next/navigation'\r\nimport { signInWithEmail, signInWithRedirectGoogle, signInWithMicrosoft } from '../app-router/client/actions'\r\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from \"./ui/card\"\r\nimport { Input } from \"./ui/input\"\r\nimport { Label } from \"./ui/label\"\r\nimport { Button } from \"./ui/button\"\r\nimport { Alert, AlertDescription } from \"./ui/alert\"\r\nimport { Separator } from \"./ui/separator\"\r\nimport { cn } from \"../lib/utils\"\r\nimport { Loader2 } from 'lucide-react'\r\nimport { getRedirectResult } from 'firebase/auth'\r\nimport { ternSecureAuth } from '../utils/client-init'\r\nimport { createSessionCookie } from '../app-router/server/sessionTernSecure'\r\nimport { AuthBackground } from './background'\r\nimport { getValidRedirectUrl } from '../utils/construct'\r\n\r\nconst isLocalhost = typeof window !== 'undefined' && \r\n (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');\r\n\r\nconst authDomain = process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN;\r\nconst appName = process.env.NEXT_PUBLIC_FIREBASE_APP_NAME || 'TernSecure';\r\n\r\n\r\nexport interface SignInProps {\r\n redirectUrl?: string\r\n onError?: (error: Error) => void\r\n onSuccess?: () => void\r\n className?: string\r\n customStyles?: {\r\n card?: string\r\n input?: string\r\n button?: string\r\n label?: string\r\n separator?: string\r\n title?: string\r\n description?: string\r\n socialButton?: string\r\n }\r\n}\r\n\r\nexport function SignIn({\r\n redirectUrl,\r\n onError,\r\n onSuccess,\r\n className,\r\n customStyles = {}\r\n}: SignInProps) {\r\n const [loading, setLoading] = useState(false)\r\n const [checkingRedirect, setCheckingRedirect] = useState(true)\r\n const [error, setError] = useState('')\r\n const [email, setEmail] = useState('')\r\n const [password, setPassword] = useState('')\r\n const searchParams = useSearchParams()\r\n const isRedirectSignIn = searchParams.get('signInRedirect') === 'true'\r\n\r\n\r\n const handleRedirectResult = useCallback(async () => {\r\n if (!isRedirectSignIn) return false\r\n setCheckingRedirect(true)\r\n try {\r\n console.log('Checking redirect result...');\r\n console.log('Current hostname:', window.location.hostname);\r\n console.log('Auth domain hostname:', authDomain);\r\n\r\n const isOnAuth = authDomain && \r\n window.location.hostname === authDomain.replace(/https?:\\/\\//, '');\r\n console.log('Is on AuthDomain:', isOnAuth);\r\n\r\n\r\n const result = await getRedirectResult(ternSecureAuth)\r\n console.log('Redirect result:', result);\r\n if (result) {\r\n const idToken = await result.user.getIdToken()\r\n const sessionResult = await createSessionCookie(idToken)\r\n if (!sessionResult.success) {\r\n throw new Error('Failed to create session')\r\n }\r\n const storedRedirectUrl = sessionStorage.getItem('auth_return_url')\r\n sessionStorage.removeItem('auth_redirect_url') \r\n onSuccess?.()\r\n window.location.href = storedRedirectUrl || getValidRedirectUrl(redirectUrl, searchParams)\r\n return true\r\n }\r\n setCheckingRedirect(false)\r\n } catch (err) {\r\n console.error('Redirect result error:', err)\r\n const errorMessage = err instanceof Error ? err.message : 'Authentication failed'\r\n setError(errorMessage)\r\n onError?.(err instanceof Error ? err : new Error(errorMessage))\r\n sessionStorage.removeItem('auth_redirect_url')\r\n return false\r\n }\r\n }, [isRedirectSignIn, redirectUrl, searchParams, onSuccess, onError])\r\n\r\n ///const REDIRECT_TIMEOUT = 5000;\r\n\r\n useEffect(() => {\r\n //let timeoutId: NodeJS.Timeout;\r\n\r\n if (isRedirectSignIn) {\r\n handleRedirectResult();\r\n\r\n /*timeoutId = setTimeout(() => {\r\n console.warn('Redirect check timed out');\r\n setCheckingRedirect(false);\r\n setError('Sign in took too long. Please try again.');\r\n \r\n }, REDIRECT_TIMEOUT);\r\n }\r\n\r\n return () => {\r\n if (timeoutId) {\r\n clearTimeout(timeoutId);\r\n }*/\r\n };\r\n }, [handleRedirectResult, isRedirectSignIn])\r\n\r\n const handleSubmit = async (e: React.FormEvent) => {\r\n e.preventDefault()\r\n setLoading(true)\r\n try {\r\n const user = await signInWithEmail(email, password)\r\n if (user.success) {\r\n onSuccess?.()\r\n window.location.href = getValidRedirectUrl(redirectUrl, searchParams)\r\n }\r\n } catch (err) {\r\n const errorMessage = err instanceof Error ? err.message : 'Failed to sign in'\r\n setError(errorMessage)\r\n onError?.(err instanceof Error ? err : new Error('Failed to sign in'))\r\n } finally {\r\n setLoading(false)\r\n }\r\n }\r\n\r\n const handleSocialSignIn = async (provider: 'google' | 'microsoft') => {\r\n setLoading(true)\r\n try {\r\n\r\n const validRedirectUrl = getValidRedirectUrl(redirectUrl, searchParams)\r\n sessionStorage.setItem('auth_redirect_url', validRedirectUrl)\r\n\r\n const currentUrl = new URL(window.location.href)\r\n currentUrl.searchParams.set('signInRedirect', 'true')\r\n window.history.replaceState({}, '', currentUrl.toString())\r\n\r\n const result = provider === 'google' ? await signInWithRedirectGoogle() : await signInWithMicrosoft()\r\n if (!result.success) {\r\n throw new Error(result.error)\r\n }\r\n } catch (err) {\r\n const errorMessage = err instanceof Error ? err.message : `Failed to sign in with ${provider}`\r\n setError(errorMessage)\r\n onError?.(err instanceof Error ? err : new Error(`Failed to sign in with ${provider}`))\r\n setLoading(false)\r\n sessionStorage.removeItem('auth_redirect_url')\r\n }\r\n }\r\n\r\n if (checkingRedirect && isRedirectSignIn) {\r\n return (\r\n <div className=\"flex min-h-screen items-center justify-center\">\r\n <div className=\"text-center space-y-4\">\r\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto\" />\r\n \r\n </div>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"relative flex items-center justify-center\">\r\n <AuthBackground />\r\n <Card className={cn(\"w-full max-w-md mx-auto mt-8\", className, customStyles.card)}>\r\n <CardHeader className=\"space-y-1 text-center\">\r\n <CardTitle className={cn(\"font-bold\", customStyles.title)}>Sign in to {`${appName}`}</CardTitle>\r\n <CardDescription className={cn(\"text-muted-foreground\", customStyles.description)}>\r\n Please sign in to continue\r\n </CardDescription>\r\n </CardHeader>\r\n <CardContent className=\"space-y-4\">\r\n <form onSubmit={handleSubmit} className=\"space-y-4\">\r\n {error && (\r\n <Alert variant=\"destructive\">\r\n <AlertDescription>{error}</AlertDescription>\r\n </Alert>\r\n )}\r\n <div className=\"space-y-2\">\r\n <Label htmlFor=\"email\" className={cn(customStyles.label)}>Email</Label>\r\n <Input\r\n id=\"email\"\r\n type=\"email\"\r\n placeholder=\"m@example.com\"\r\n value={email}\r\n onChange={(e) => setEmail(e.target.value)}\r\n disabled={loading}\r\n className={cn(customStyles.input)}\r\n required\r\n />\r\n </div>\r\n <div className=\"space-y-2\">\r\n <Label htmlFor=\"password\" className={cn(customStyles.label)}>Password</Label>\r\n <Input\r\n id=\"password\"\r\n type=\"password\"\r\n value={password}\r\n onChange={(e) => setPassword(e.target.value)}\r\n disabled={loading}\r\n className={cn(customStyles.input)}\r\n required\r\n />\r\n </div>\r\n <Button type=\"submit\" disabled={loading} className={cn(\"w-full\", customStyles.button)}>\r\n {loading ? (\r\n <>\r\n <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\r\n Signing in...\r\n </>\r\n ) : (\r\n 'Sign in'\r\n )}\r\n </Button>\r\n </form>\r\n <div className=\"relative\">\r\n <Separator className={cn(customStyles.separator)} />\r\n <div className=\"absolute inset-0 flex items-center justify-center\">\r\n <span className=\"bg-background px-2 text-muted-foreground text-sm\">Or continue with</span>\r\n </div>\r\n </div>\r\n <div className=\"grid grid-cols-2 gap-4\">\r\n <Button \r\n variant=\"outline\" \r\n disabled={loading} \r\n onClick={() => handleSocialSignIn('google')} \r\n className={cn(\"flex items-center justify-center\", customStyles.socialButton)}\r\n >\r\n <svg className=\"w-5 h-5 mr-2\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\" fill=\"#4285F4\"/>\r\n <path d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\" fill=\"#34A853\"/>\r\n <path d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" fill=\"#FBBC05\"/>\r\n <path d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" fill=\"#EA4335\"/>\r\n </svg>\r\n Google\r\n </Button>\r\n <Button \r\n variant=\"outline\" \r\n disabled={loading} \r\n onClick={() => handleSocialSignIn('microsoft')} \r\n className={cn(\"flex items-center justify-center\", customStyles.socialButton)}\r\n >\r\n <svg className=\"w-5 h-5 mr-2\" viewBox=\"0 0 23 23\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill=\"#f3f3f3\" d=\"M0 0h23v23H0z\"/>\r\n <path fill=\"#f35325\" d=\"M1 1h10v10H1z\"/>\r\n <path fill=\"#81bc06\" d=\"M12 1h10v10H12z\"/>\r\n <path fill=\"#05a6f0\" d=\"M1 12h10v10H1z\"/>\r\n <path fill=\"#ffba08\" d=\"M12 12h10v10H12z\"/>\r\n </svg>\r\n Microsoft\r\n </Button>\r\n </div>\r\n </CardContent>\r\n <CardFooter className=\"flex justify-center\">\r\n <p className=\"text-sm text-muted-foreground\">\r\n Don't have an account?{' '}\r\n <a href=\"/signup\" className=\"text-primary hover:underline\">\r\n Sign up\r\n </a>\r\n </p>\r\n </CardFooter>\r\n </Card>\r\n </div>\r\n )\r\n}\r\n\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsKU;AApKV,mBAAwD;AACxD,wBAAgC;AAChC,qBAA+E;AAC/E,kBAAsF;AACtF,mBAAsB;AACtB,mBAAsB;AACtB,oBAAuB;AACvB,mBAAwC;AACxC,uBAA0B;AAC1B,mBAAmB;AACnB,0BAAwB;AACxB,kBAAkC;AAClC,yBAA+B;AAC/B,+BAAoC;AACpC,wBAA+B;AAC/B,uBAAoC;AAEpC,MAAM,cAAc,OAAO,WAAW,gBACnC,OAAO,SAAS,aAAa,eAAe,OAAO,SAAS,aAAa;AAE5E,MAAM,aAAa,QAAQ,IAAI;AAC/B,MAAM,UAAU,QAAQ,IAAI,iCAAiC;AAoBtD,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA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B,WAAW;AAAA,cAC7C,eAAW,iBAAG,oCAAoC,aAAa,YAAY;AAAA,cAE3E;AAAA,6DAAC,SAAI,WAAU,gBAAe,SAAQ,aAAY,OAAM,8BACtD;AAAA,8DAAC,UAAK,MAAK,WAAU,GAAE,iBAAe;AAAA,kBACtC,4CAAC,UAAK,MAAK,WAAU,GAAE,iBAAe;AAAA,kBACtC,4CAAC,UAAK,MAAK,WAAU,GAAE,mBAAiB;AAAA,kBACxC,4CAAC,UAAK,MAAK,WAAU,GAAE,kBAAgB;AAAA,kBACvC,4CAAC,UAAK,MAAK,WAAU,GAAE,oBAAkB;AAAA,mBAC3C;AAAA,gBAAM;AAAA;AAAA;AAAA,UAER;AAAA,WACF;AAAA,SACF;AAAA,MACA,4CAAC,0BAAW,WAAU,uBACpB,uDAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,QACjB;AAAA,QAC1B,4CAAC,OAAE,MAAK,WAAU,WAAU,gCAA+B,qBAE3D;AAAA,SACF,GACF;AAAA,OACF;AAAA,KACA;AAEJ;","names":[]}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var sign_out_exports = {};
|
|
21
|
-
__export(sign_out_exports, {
|
|
22
|
-
SignOut: () => SignOut
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(sign_out_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_navigation = require("next/navigation");
|
|
28
|
-
var import_auth = require("firebase/auth");
|
|
29
|
-
var import_button = require("./ui/button");
|
|
30
|
-
var import_client_init = require("../utils/client-init");
|
|
31
|
-
var import_sessionTernSecure = require("../app-router/server/sessionTernSecure");
|
|
32
|
-
function SignOut({
|
|
33
|
-
children = "Sign out",
|
|
34
|
-
onError,
|
|
35
|
-
onSignOutSuccess,
|
|
36
|
-
...buttonProps
|
|
37
|
-
}) {
|
|
38
|
-
const router = (0, import_navigation.useRouter)();
|
|
39
|
-
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
|
|
40
|
-
const handleSignOut = async () => {
|
|
41
|
-
setIsLoading(true);
|
|
42
|
-
try {
|
|
43
|
-
await (0, import_auth.signOut)(import_client_init.ternSecureAuth);
|
|
44
|
-
await (0, import_sessionTernSecure.clearSessionCookie)();
|
|
45
|
-
onSignOutSuccess == null ? void 0 : onSignOutSuccess();
|
|
46
|
-
router.push("/sign-in");
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error("Sign out error:", error);
|
|
49
|
-
onError == null ? void 0 : onError(error instanceof Error ? error : new Error("Failed to sign out"));
|
|
50
|
-
} finally {
|
|
51
|
-
setIsLoading(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
-
import_button.Button,
|
|
56
|
-
{
|
|
57
|
-
variant: "outline",
|
|
58
|
-
onClick: handleSignOut,
|
|
59
|
-
disabled: isLoading,
|
|
60
|
-
...buttonProps,
|
|
61
|
-
children: isLoading ? "Signing out..." : children
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
-
0 && (module.exports = {
|
|
67
|
-
SignOut
|
|
68
|
-
});
|
|
69
|
-
//# sourceMappingURL=sign-out.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/sign-out.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { useState } from 'react'\r\nimport { useRouter } from 'next/navigation'\r\nimport { signOut } from 'firebase/auth'\r\nimport { Button, type ButtonProps } from './ui/button'\r\nimport { ternSecureAuth } from '../utils/client-init'\r\nimport { clearSessionCookie } from '../app-router/server/sessionTernSecure'\r\n\r\ntype SignOutCustomProps = {\r\n children?: React.ReactNode\r\n onError?: (error: Error) => void\r\n onSignOutSuccess?: () => void\r\n}\r\n\r\ntype SignOutProps = Omit<ButtonProps, 'onClick'> & SignOutCustomProps\r\n\r\nexport function SignOut({ \r\n children = 'Sign out', \r\n onError,\r\n onSignOutSuccess,\r\n ...buttonProps \r\n}: SignOutProps) {\r\n const router = useRouter()\r\n const [isLoading, setIsLoading] = useState(false)\r\n\r\n const handleSignOut = async () => {\r\n setIsLoading(true)\r\n try {\r\n // Sign out from Firebase\r\n await signOut(ternSecureAuth)\r\n \r\n await clearSessionCookie()\r\n \r\n // Call success callback if provided\r\n onSignOutSuccess?.()\r\n \r\n // Redirect to sign-in page\r\n router.push('/sign-in')\r\n } catch (error) {\r\n console.error('Sign out error:', error)\r\n onError?.(error instanceof Error ? error : new Error('Failed to sign out'))\r\n } finally {\r\n setIsLoading(false)\r\n }\r\n }\r\n\r\n return (\r\n <Button\r\n variant=\"outline\"\r\n onClick={handleSignOut}\r\n disabled={isLoading}\r\n {...buttonProps}\r\n >\r\n {isLoading ? 'Signing out...' : children}\r\n </Button>\r\n )\r\n}\r\n\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDI;AA9CJ,mBAAyB;AACzB,wBAA0B;AAC1B,kBAAwB;AACxB,oBAAyC;AACzC,yBAA+B;AAC/B,+BAAmC;AAU5B,SAAS,QAAQ;AAAA,EACtB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiB;AACf,QAAM,aAAS,6BAAU;AACzB,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAEhD,QAAM,gBAAgB,YAAY;AAChC,iBAAa,IAAI;AACjB,QAAI;AAEF,gBAAM,qBAAQ,iCAAc;AAE5B,gBAAM,6CAAmB;AAGzB;AAGA,aAAO,KAAK,UAAU;AAAA,IACxB,SAAS,OAAO;AACd,cAAQ,MAAM,mBAAmB,KAAK;AACtC,yCAAU,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,oBAAoB;AAAA,IAC3E,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACT,GAAG;AAAA,MAEH,sBAAY,mBAAmB;AAAA;AAAA,EAClC;AAEJ;","names":[]}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var alert_exports = {};
|
|
30
|
-
__export(alert_exports, {
|
|
31
|
-
Alert: () => Alert,
|
|
32
|
-
AlertDescription: () => AlertDescription,
|
|
33
|
-
AlertTitle: () => AlertTitle
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(alert_exports);
|
|
36
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var React = __toESM(require("react"));
|
|
38
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
-
var import_utils = require("../../lib/utils");
|
|
40
|
-
const alertVariants = (0, import_class_variance_authority.cva)(
|
|
41
|
-
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
42
|
-
{
|
|
43
|
-
variants: {
|
|
44
|
-
variant: {
|
|
45
|
-
default: "bg-background text-foreground",
|
|
46
|
-
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
variant: "default"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
const Alert = React.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
-
"div",
|
|
56
|
-
{
|
|
57
|
-
ref,
|
|
58
|
-
role: "alert",
|
|
59
|
-
className: (0, import_utils.cn)(alertVariants({ variant }), className),
|
|
60
|
-
...props
|
|
61
|
-
}
|
|
62
|
-
));
|
|
63
|
-
Alert.displayName = "Alert";
|
|
64
|
-
const AlertTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
-
"h5",
|
|
66
|
-
{
|
|
67
|
-
ref,
|
|
68
|
-
className: (0, import_utils.cn)("mb-1 font-medium leading-none tracking-tight", className),
|
|
69
|
-
...props
|
|
70
|
-
}
|
|
71
|
-
));
|
|
72
|
-
AlertTitle.displayName = "AlertTitle";
|
|
73
|
-
const AlertDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
ref,
|
|
77
|
-
className: (0, import_utils.cn)("text-sm [&_p]:leading-relaxed", className),
|
|
78
|
-
...props
|
|
79
|
-
}
|
|
80
|
-
));
|
|
81
|
-
AlertDescription.displayName = "AlertDescription";
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
0 && (module.exports = {
|
|
84
|
-
Alert,
|
|
85
|
-
AlertDescription,
|
|
86
|
-
AlertTitle
|
|
87
|
-
});
|
|
88
|
-
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ui/alert.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"../../lib/utils\"\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground\",\n destructive:\n \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n))\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\nexport { Alert, AlertTitle, AlertDescription }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBE;AAzBF,YAAuB;AACvB,sCAAuC;AAEvC,mBAAmB;AAEnB,MAAM,oBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,MACJ;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEA,MAAM,QAAQ,MAAM,WAGlB,CAAC,EAAE,WAAW,SAAS,GAAG,MAAM,GAAG,QACnC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,eAAW,iBAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,IAClD,GAAG;AAAA;AACN,CACD;AACD,MAAM,cAAc;AAEpB,MAAM,aAAa,MAAM,WAGvB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,eAAW,iBAAG,gDAAgD,SAAS;AAAA,IACtE,GAAG;AAAA;AACN,CACD;AACD,WAAW,cAAc;AAEzB,MAAM,mBAAmB,MAAM,WAG7B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,eAAW,iBAAG,iCAAiC,SAAS;AAAA,IACvD,GAAG;AAAA;AACN,CACD;AACD,iBAAiB,cAAc;","names":[]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var button_exports = {};
|
|
30
|
-
__export(button_exports, {
|
|
31
|
-
Button: () => Button,
|
|
32
|
-
buttonVariants: () => buttonVariants
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(button_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var React = __toESM(require("react"));
|
|
37
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
38
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
-
var import_utils = require("../../lib/utils");
|
|
40
|
-
const buttonVariants = (0, import_class_variance_authority.cva)(
|
|
41
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
42
|
-
{
|
|
43
|
-
variants: {
|
|
44
|
-
variant: {
|
|
45
|
-
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
46
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
47
|
-
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
48
|
-
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
49
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
50
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
51
|
-
},
|
|
52
|
-
size: {
|
|
53
|
-
default: "h-9 px-4 py-2",
|
|
54
|
-
sm: "h-8 rounded-md px-3 text-xs",
|
|
55
|
-
lg: "h-10 rounded-md px-8",
|
|
56
|
-
icon: "h-9 w-9"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
defaultVariants: {
|
|
60
|
-
variant: "default",
|
|
61
|
-
size: "default"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
const Button = React.forwardRef(
|
|
66
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
67
|
-
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
68
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
-
Comp,
|
|
70
|
-
{
|
|
71
|
-
className: (0, import_utils.cn)(buttonVariants({ variant, size, className })),
|
|
72
|
-
ref,
|
|
73
|
-
...props
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
Button.displayName = "Button";
|
|
79
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
-
0 && (module.exports = {
|
|
81
|
-
Button,
|
|
82
|
-
buttonVariants
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ui/button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"../../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\"\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CM;AA9CN,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AAEvC,mBAAmB;AAEnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAQA,MAAM,SAAS,MAAM;AAAA,EACnB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;AAChE,UAAM,OAAO,UAAU,yBAAO;AAC9B,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,iBAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,QAC1D;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var card_exports = {};
|
|
30
|
-
__export(card_exports, {
|
|
31
|
-
Card: () => Card,
|
|
32
|
-
CardContent: () => CardContent,
|
|
33
|
-
CardDescription: () => CardDescription,
|
|
34
|
-
CardFooter: () => CardFooter,
|
|
35
|
-
CardHeader: () => CardHeader,
|
|
36
|
-
CardTitle: () => CardTitle
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(card_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
var React = __toESM(require("react"));
|
|
41
|
-
var import_utils = require("../../lib/utils");
|
|
42
|
-
const Card = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
ref,
|
|
46
|
-
className: (0, import_utils.cn)(
|
|
47
|
-
"rounded-xl border bg-card text-card-foreground shadow",
|
|
48
|
-
className
|
|
49
|
-
),
|
|
50
|
-
...props
|
|
51
|
-
}
|
|
52
|
-
));
|
|
53
|
-
Card.displayName = "Card";
|
|
54
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
-
"div",
|
|
56
|
-
{
|
|
57
|
-
ref,
|
|
58
|
-
className: (0, import_utils.cn)("flex flex-col space-y-1.5 p-6", className),
|
|
59
|
-
...props
|
|
60
|
-
}
|
|
61
|
-
));
|
|
62
|
-
CardHeader.displayName = "CardHeader";
|
|
63
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
-
"div",
|
|
65
|
-
{
|
|
66
|
-
ref,
|
|
67
|
-
className: (0, import_utils.cn)("font-semibold leading-none tracking-tight", className),
|
|
68
|
-
...props
|
|
69
|
-
}
|
|
70
|
-
));
|
|
71
|
-
CardTitle.displayName = "CardTitle";
|
|
72
|
-
const CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
ref,
|
|
76
|
-
className: (0, import_utils.cn)("text-sm text-muted-foreground", className),
|
|
77
|
-
...props
|
|
78
|
-
}
|
|
79
|
-
));
|
|
80
|
-
CardDescription.displayName = "CardDescription";
|
|
81
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: (0, import_utils.cn)("p-6 pt-0", className), ...props }));
|
|
82
|
-
CardContent.displayName = "CardContent";
|
|
83
|
-
const CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
-
"div",
|
|
85
|
-
{
|
|
86
|
-
ref,
|
|
87
|
-
className: (0, import_utils.cn)("flex items-center p-6 pt-0", className),
|
|
88
|
-
...props
|
|
89
|
-
}
|
|
90
|
-
));
|
|
91
|
-
CardFooter.displayName = "CardFooter";
|
|
92
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
-
0 && (module.exports = {
|
|
94
|
-
Card,
|
|
95
|
-
CardContent,
|
|
96
|
-
CardDescription,
|
|
97
|
-
CardFooter,
|
|
98
|
-
CardHeader,
|
|
99
|
-
CardTitle
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=card.js.map
|