@githat/nextjs 0.4.1 → 0.5.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 +580 -45
- package/dist/githat.css +41 -0
- package/dist/index.js +85 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -70
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs.map +1 -1
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -86,14 +86,21 @@ function createClient(apiUrl, appKey, options = {}) {
|
|
|
86
86
|
});
|
|
87
87
|
} catch (networkError) {
|
|
88
88
|
if (networkError instanceof TypeError) {
|
|
89
|
-
const isMissingKey = !appKey || !appKey.startsWith("pk_live_");
|
|
89
|
+
const isMissingKey = !appKey || !appKey.startsWith("pk_live_") && !appKey.startsWith("pk_test_");
|
|
90
90
|
const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
|
91
91
|
if (isMissingKey && !isLocalhost) {
|
|
92
92
|
throw new Error(
|
|
93
|
-
"Missing
|
|
93
|
+
"GitHat: Missing or invalid publishable key. Add NEXT_PUBLIC_GITHAT_PUBLISHABLE_KEY to your environment variables. Get your key at https://githat.io/dashboard/apps"
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
if (isLocalhost) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
"GitHat: Cannot reach api.githat.io. Check your internet connection."
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
throw new Error(
|
|
102
|
+
"GitHat: API request failed. Verify your publishable key and app domain at https://githat.io/dashboard/apps"
|
|
103
|
+
);
|
|
97
104
|
}
|
|
98
105
|
throw networkError;
|
|
99
106
|
}
|
|
@@ -129,12 +136,61 @@ function createClient(apiUrl, appKey, options = {}) {
|
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
// src/provider.tsx
|
|
132
|
-
import { jsx } from "react/jsx-runtime";
|
|
139
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
133
140
|
var GitHatContext = createContext(null);
|
|
141
|
+
function isDevMode(key) {
|
|
142
|
+
return !key || !key.startsWith("pk_live_") && !key.startsWith("pk_test_");
|
|
143
|
+
}
|
|
144
|
+
function DevModeBanner() {
|
|
145
|
+
const [dismissed, setDismissed] = useState(() => {
|
|
146
|
+
if (typeof window === "undefined") return true;
|
|
147
|
+
return localStorage.getItem("githat_dev_banner_dismissed") === "1";
|
|
148
|
+
});
|
|
149
|
+
if (dismissed || typeof window === "undefined") return null;
|
|
150
|
+
const hostname = window.location.hostname;
|
|
151
|
+
if (hostname !== "localhost" && hostname !== "127.0.0.1") return null;
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", { className: "githat-dev-banner", role: "status", children: [
|
|
153
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
154
|
+
/* @__PURE__ */ jsx("strong", { children: "GitHat Dev Mode" }),
|
|
155
|
+
" \u2014 No publishable key. Auth works on localhost.",
|
|
156
|
+
" ",
|
|
157
|
+
/* @__PURE__ */ jsx("a", { href: "https://githat.io/dashboard/apps", target: "_blank", rel: "noopener noreferrer", children: "Get your key" })
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
onClick: () => {
|
|
163
|
+
setDismissed(true);
|
|
164
|
+
localStorage.setItem("githat_dev_banner_dismissed", "1");
|
|
165
|
+
},
|
|
166
|
+
"aria-label": "Dismiss",
|
|
167
|
+
children: "\xD7"
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] });
|
|
171
|
+
}
|
|
134
172
|
function GitHatProvider({ config: rawConfig, children }) {
|
|
135
173
|
const config = useMemo(() => resolveConfig(rawConfig), [rawConfig]);
|
|
136
174
|
const useCookies = config.tokenStorage === "cookie";
|
|
175
|
+
const devMode = isDevMode(config.publishableKey);
|
|
137
176
|
const clientRef = useRef(createClient(config.apiUrl, config.publishableKey, { useCookies }));
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (!devMode || typeof window === "undefined") return;
|
|
179
|
+
const hostname = window.location.hostname;
|
|
180
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
181
|
+
console.warn(
|
|
182
|
+
"%c GitHat Dev Mode %c No publishable key configured. Auth works on localhost but will fail in production. Get your key at https://githat.io/dashboard/apps",
|
|
183
|
+
"background: #f59e0b; color: #000; font-weight: bold; padding: 2px 6px; border-radius: 3px;",
|
|
184
|
+
"color: #f59e0b;"
|
|
185
|
+
);
|
|
186
|
+
} else {
|
|
187
|
+
console.error(
|
|
188
|
+
"%c GitHat %c Missing publishable key. Auth requests will fail. Add NEXT_PUBLIC_GITHAT_PUBLISHABLE_KEY to your environment. Get your key at https://githat.io/dashboard/apps",
|
|
189
|
+
"background: #ef4444; color: #fff; font-weight: bold; padding: 2px 6px; border-radius: 3px;",
|
|
190
|
+
"color: #ef4444;"
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}, []);
|
|
138
194
|
const [user, setUser] = useState(null);
|
|
139
195
|
const [org, setOrg] = useState(null);
|
|
140
196
|
const [isSignedIn, setIsSignedIn] = useState(false);
|
|
@@ -282,7 +338,10 @@ function GitHatProvider({ config: rawConfig, children }) {
|
|
|
282
338
|
signOut,
|
|
283
339
|
switchOrg
|
|
284
340
|
}), [user, org, isSignedIn, isLoading, authError, config, signIn, signUp, signOut, switchOrg]);
|
|
285
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ jsxs(GitHatContext.Provider, { value, children: [
|
|
342
|
+
devMode && /* @__PURE__ */ jsx(DevModeBanner, {}),
|
|
343
|
+
children
|
|
344
|
+
] });
|
|
286
345
|
}
|
|
287
346
|
|
|
288
347
|
// src/hooks.ts
|
|
@@ -490,7 +549,7 @@ function useData() {
|
|
|
490
549
|
|
|
491
550
|
// src/components/SignInForm.tsx
|
|
492
551
|
import { useState as useState2 } from "react";
|
|
493
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
552
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
494
553
|
function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
495
554
|
const { signIn, config } = useAuth();
|
|
496
555
|
const [email, setEmail] = useState2("");
|
|
@@ -520,14 +579,14 @@ function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
|
520
579
|
setLoading(false);
|
|
521
580
|
}
|
|
522
581
|
};
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ jsxs2("div", { className: "githat-form-container", children: [
|
|
583
|
+
/* @__PURE__ */ jsxs2("div", { className: "githat-form-header", children: [
|
|
525
584
|
/* @__PURE__ */ jsx2("h2", { className: "githat-form-title", children: "Sign in" }),
|
|
526
585
|
/* @__PURE__ */ jsx2("p", { className: "githat-form-subtitle", children: "Welcome back to GitHat" })
|
|
527
586
|
] }),
|
|
528
587
|
error && /* @__PURE__ */ jsx2("div", { className: "githat-alert githat-alert-error", role: "alert", "aria-live": "polite", children: error }),
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "githat-form", "aria-label": "Sign in form", children: [
|
|
589
|
+
/* @__PURE__ */ jsxs2("div", { className: "githat-field", children: [
|
|
531
590
|
/* @__PURE__ */ jsx2("label", { className: "githat-label", htmlFor: "githat-signin-email", children: "Email" }),
|
|
532
591
|
/* @__PURE__ */ jsx2(
|
|
533
592
|
"input",
|
|
@@ -543,7 +602,7 @@ function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
|
543
602
|
}
|
|
544
603
|
)
|
|
545
604
|
] }),
|
|
546
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ jsxs2("div", { className: "githat-field", children: [
|
|
547
606
|
/* @__PURE__ */ jsx2("label", { className: "githat-label", htmlFor: "githat-signin-password", children: "Password" }),
|
|
548
607
|
/* @__PURE__ */ jsx2(
|
|
549
608
|
"input",
|
|
@@ -570,11 +629,11 @@ function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
|
570
629
|
}
|
|
571
630
|
)
|
|
572
631
|
] }),
|
|
573
|
-
signUpUrl && /* @__PURE__ */
|
|
632
|
+
signUpUrl && /* @__PURE__ */ jsxs2("p", { className: "githat-form-footer", children: [
|
|
574
633
|
"Don't have an account? ",
|
|
575
634
|
/* @__PURE__ */ jsx2("a", { href: signUpUrl, className: "githat-link", children: "Sign up" })
|
|
576
635
|
] }),
|
|
577
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ jsxs2("p", { className: "githat-powered-by", children: [
|
|
578
637
|
"Secured by ",
|
|
579
638
|
/* @__PURE__ */ jsx2("strong", { children: "GitHat" })
|
|
580
639
|
] })
|
|
@@ -583,7 +642,7 @@ function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
|
583
642
|
|
|
584
643
|
// src/components/SignUpForm.tsx
|
|
585
644
|
import { useState as useState3 } from "react";
|
|
586
|
-
import { jsx as jsx3, jsxs as
|
|
645
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
587
646
|
function SignUpForm({ onSuccess, signInUrl }) {
|
|
588
647
|
const { signUp, config } = useAuth();
|
|
589
648
|
const [name, setName] = useState3("");
|
|
@@ -591,6 +650,8 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
591
650
|
const [password, setPassword] = useState3("");
|
|
592
651
|
const [error, setError] = useState3("");
|
|
593
652
|
const [loading, setLoading] = useState3(false);
|
|
653
|
+
const [verificationSent, setVerificationSent] = useState3(false);
|
|
654
|
+
const [verificationEmail, setVerificationEmail] = useState3("");
|
|
594
655
|
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
595
656
|
const passwordValid = password.length >= 8 && /[A-Z]/.test(password) && /[a-z]/.test(password) && /\d/.test(password);
|
|
596
657
|
const handleSubmit = async (e) => {
|
|
@@ -609,6 +670,9 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
609
670
|
const result = await signUp({ email, password, name });
|
|
610
671
|
if (onSuccess) {
|
|
611
672
|
onSuccess(result);
|
|
673
|
+
} else if (result.requiresVerification) {
|
|
674
|
+
setVerificationSent(true);
|
|
675
|
+
setVerificationEmail(result.email);
|
|
612
676
|
} else if (typeof window !== "undefined") {
|
|
613
677
|
window.location.href = config.afterSignInUrl;
|
|
614
678
|
}
|
|
@@ -618,14 +682,31 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
618
682
|
setLoading(false);
|
|
619
683
|
}
|
|
620
684
|
};
|
|
621
|
-
|
|
622
|
-
/* @__PURE__ */
|
|
685
|
+
if (verificationSent) {
|
|
686
|
+
return /* @__PURE__ */ jsxs3("div", { className: "githat-form-container", children: [
|
|
687
|
+
/* @__PURE__ */ jsxs3("div", { className: "githat-form-header", children: [
|
|
688
|
+
/* @__PURE__ */ jsx3("h2", { className: "githat-form-title", children: "Check your email" }),
|
|
689
|
+
/* @__PURE__ */ jsxs3("p", { className: "githat-form-subtitle", children: [
|
|
690
|
+
"We sent a verification link to ",
|
|
691
|
+
/* @__PURE__ */ jsx3("strong", { children: verificationEmail })
|
|
692
|
+
] })
|
|
693
|
+
] }),
|
|
694
|
+
/* @__PURE__ */ jsx3("div", { className: "githat-alert githat-alert-success", role: "status", children: "Account created! Click the link in your email to verify, then sign in." }),
|
|
695
|
+
signInUrl && /* @__PURE__ */ jsx3("p", { className: "githat-form-footer", children: /* @__PURE__ */ jsx3("a", { href: signInUrl, className: "githat-link", children: "Go to sign in" }) }),
|
|
696
|
+
/* @__PURE__ */ jsxs3("p", { className: "githat-powered-by", children: [
|
|
697
|
+
"Secured by ",
|
|
698
|
+
/* @__PURE__ */ jsx3("strong", { children: "GitHat" })
|
|
699
|
+
] })
|
|
700
|
+
] });
|
|
701
|
+
}
|
|
702
|
+
return /* @__PURE__ */ jsxs3("div", { className: "githat-form-container", children: [
|
|
703
|
+
/* @__PURE__ */ jsxs3("div", { className: "githat-form-header", children: [
|
|
623
704
|
/* @__PURE__ */ jsx3("h2", { className: "githat-form-title", children: "Create an account" }),
|
|
624
705
|
/* @__PURE__ */ jsx3("p", { className: "githat-form-subtitle", children: "Get started with GitHat" })
|
|
625
706
|
] }),
|
|
626
707
|
error && /* @__PURE__ */ jsx3("div", { className: "githat-alert githat-alert-error", role: "alert", "aria-live": "polite", children: error }),
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "githat-form", "aria-label": "Sign up form", children: [
|
|
709
|
+
/* @__PURE__ */ jsxs3("div", { className: "githat-field", children: [
|
|
629
710
|
/* @__PURE__ */ jsx3("label", { className: "githat-label", htmlFor: "githat-signup-name", children: "Full name" }),
|
|
630
711
|
/* @__PURE__ */ jsx3(
|
|
631
712
|
"input",
|
|
@@ -641,7 +722,7 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
641
722
|
}
|
|
642
723
|
)
|
|
643
724
|
] }),
|
|
644
|
-
/* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ jsxs3("div", { className: "githat-field", children: [
|
|
645
726
|
/* @__PURE__ */ jsx3("label", { className: "githat-label", htmlFor: "githat-signup-email", children: "Email" }),
|
|
646
727
|
/* @__PURE__ */ jsx3(
|
|
647
728
|
"input",
|
|
@@ -657,7 +738,7 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
657
738
|
}
|
|
658
739
|
)
|
|
659
740
|
] }),
|
|
660
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ jsxs3("div", { className: "githat-field", children: [
|
|
661
742
|
/* @__PURE__ */ jsx3("label", { className: "githat-label", htmlFor: "githat-signup-password", children: "Password" }),
|
|
662
743
|
/* @__PURE__ */ jsx3(
|
|
663
744
|
"input",
|
|
@@ -684,11 +765,11 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
684
765
|
}
|
|
685
766
|
)
|
|
686
767
|
] }),
|
|
687
|
-
signInUrl && /* @__PURE__ */
|
|
768
|
+
signInUrl && /* @__PURE__ */ jsxs3("p", { className: "githat-form-footer", children: [
|
|
688
769
|
"Already have an account? ",
|
|
689
770
|
/* @__PURE__ */ jsx3("a", { href: signInUrl, className: "githat-link", children: "Sign in" })
|
|
690
771
|
] }),
|
|
691
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ jsxs3("p", { className: "githat-powered-by", children: [
|
|
692
773
|
"Secured by ",
|
|
693
774
|
/* @__PURE__ */ jsx3("strong", { children: "GitHat" })
|
|
694
775
|
] })
|
|
@@ -715,7 +796,7 @@ function SignUpButton({ className, children, href }) {
|
|
|
715
796
|
|
|
716
797
|
// src/components/UserButton.tsx
|
|
717
798
|
import { useState as useState4, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
718
|
-
import { jsx as jsx6, jsxs as
|
|
799
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
719
800
|
function UserButton() {
|
|
720
801
|
const { user, org, isSignedIn, signOut } = useAuth();
|
|
721
802
|
const [open, setOpen] = useState4(false);
|
|
@@ -729,10 +810,10 @@ function UserButton() {
|
|
|
729
810
|
}, []);
|
|
730
811
|
if (!isSignedIn || !user) return null;
|
|
731
812
|
const initials = user.name ? user.name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2) : user.email[0].toUpperCase();
|
|
732
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ jsxs4("div", { className: "githat-user-button", ref, children: [
|
|
733
814
|
/* @__PURE__ */ jsx6("button", { className: "githat-avatar-trigger", onClick: () => setOpen(!open), "aria-label": "User menu", "aria-expanded": open, "aria-haspopup": "true", children: user.avatarUrl ? /* @__PURE__ */ jsx6("img", { src: user.avatarUrl, alt: user.name || "User avatar", className: "githat-avatar-img" }) : /* @__PURE__ */ jsx6("span", { className: "githat-avatar-initials", children: initials }) }),
|
|
734
|
-
open && /* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
815
|
+
open && /* @__PURE__ */ jsxs4("div", { className: "githat-dropdown", role: "menu", children: [
|
|
816
|
+
/* @__PURE__ */ jsxs4("div", { className: "githat-dropdown-header", children: [
|
|
736
817
|
/* @__PURE__ */ jsx6("p", { className: "githat-dropdown-name", children: user.name }),
|
|
737
818
|
/* @__PURE__ */ jsx6("p", { className: "githat-dropdown-email", children: user.email }),
|
|
738
819
|
org && /* @__PURE__ */ jsx6("p", { className: "githat-dropdown-org", children: org.name })
|
|
@@ -748,7 +829,7 @@ function UserButton() {
|
|
|
748
829
|
|
|
749
830
|
// src/components/OrgSwitcher.tsx
|
|
750
831
|
import { useState as useState5, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
751
|
-
import { jsx as jsx7, jsxs as
|
|
832
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
752
833
|
function OrgSwitcher() {
|
|
753
834
|
const { org, isSignedIn, switchOrg } = useAuth();
|
|
754
835
|
const githat = useGitHat();
|
|
@@ -771,12 +852,12 @@ function OrgSwitcher() {
|
|
|
771
852
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
772
853
|
}, []);
|
|
773
854
|
if (!isSignedIn || !org || orgs.length < 2 && !orgsLoading) return null;
|
|
774
|
-
return /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ jsxs5("div", { className: "githat-org-switcher", ref, children: [
|
|
856
|
+
/* @__PURE__ */ jsxs5("button", { className: "githat-org-trigger", onClick: () => setOpen(!open), "aria-label": "Switch organization", "aria-expanded": open, "aria-haspopup": "true", children: [
|
|
776
857
|
/* @__PURE__ */ jsx7("span", { className: "githat-org-name", children: org.name }),
|
|
777
858
|
/* @__PURE__ */ jsx7("span", { className: "githat-chevron", children: open ? "\u25B2" : "\u25BC" })
|
|
778
859
|
] }),
|
|
779
|
-
open && /* @__PURE__ */ jsx7("div", { className: "githat-dropdown", role: "menu", children: orgsLoading ? /* @__PURE__ */ jsx7("div", { className: "githat-dropdown-item", "aria-busy": "true", children: "Loading..." }) : orgs.map((o) => /* @__PURE__ */
|
|
860
|
+
open && /* @__PURE__ */ jsx7("div", { className: "githat-dropdown", role: "menu", children: orgsLoading ? /* @__PURE__ */ jsx7("div", { className: "githat-dropdown-item", "aria-busy": "true", children: "Loading..." }) : orgs.map((o) => /* @__PURE__ */ jsxs5(
|
|
780
861
|
"button",
|
|
781
862
|
{
|
|
782
863
|
className: `githat-dropdown-item ${o.id === org.id ? "githat-dropdown-item-active" : ""}`,
|
|
@@ -798,7 +879,7 @@ function OrgSwitcher() {
|
|
|
798
879
|
|
|
799
880
|
// src/components/VerifiedBadge.tsx
|
|
800
881
|
import { useState as useState6, useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
801
|
-
import { jsxs as
|
|
882
|
+
import { jsxs as jsxs6 } from "react/jsx-runtime";
|
|
802
883
|
var CACHE_TTL = 5 * 60 * 1e3;
|
|
803
884
|
var cache = /* @__PURE__ */ new Map();
|
|
804
885
|
function VerifiedBadge({ type, identifier, label }) {
|
|
@@ -827,7 +908,7 @@ function VerifiedBadge({ type, identifier, label }) {
|
|
|
827
908
|
};
|
|
828
909
|
}, [type, identifier]);
|
|
829
910
|
if (verified === null) return null;
|
|
830
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ jsxs6("span", { className: `githat-badge ${verified ? "githat-badge-verified" : "githat-badge-unverified"}`, children: [
|
|
831
912
|
verified ? "\u2713" : "\u2717",
|
|
832
913
|
" ",
|
|
833
914
|
label || (verified ? "Verified" : "Unverified")
|
|
@@ -852,7 +933,7 @@ function ProtectedRoute({ children, fallback }) {
|
|
|
852
933
|
|
|
853
934
|
// src/components/ForgotPasswordForm.tsx
|
|
854
935
|
import { useState as useState7 } from "react";
|
|
855
|
-
import { jsx as jsx9, jsxs as
|
|
936
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
856
937
|
function ForgotPasswordForm({
|
|
857
938
|
onSuccess,
|
|
858
939
|
onError,
|
|
@@ -885,29 +966,29 @@ function ForgotPasswordForm({
|
|
|
885
966
|
}
|
|
886
967
|
};
|
|
887
968
|
if (sent) {
|
|
888
|
-
return /* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ jsxs7("div", { className: "githat-form-container", children: [
|
|
970
|
+
/* @__PURE__ */ jsxs7("div", { className: "githat-form-header", children: [
|
|
890
971
|
/* @__PURE__ */ jsx9("h2", { className: "githat-form-title", children: "Check your email" }),
|
|
891
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ jsxs7("p", { className: "githat-form-subtitle", children: [
|
|
892
973
|
"We sent a password reset link to ",
|
|
893
974
|
/* @__PURE__ */ jsx9("strong", { children: email })
|
|
894
975
|
] })
|
|
895
976
|
] }),
|
|
896
977
|
/* @__PURE__ */ jsx9("a", { href: signInUrl, className: "githat-link", children: "Back to sign in" }),
|
|
897
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsxs7("p", { className: "githat-powered-by", children: [
|
|
898
979
|
"Secured by ",
|
|
899
980
|
/* @__PURE__ */ jsx9("strong", { children: "GitHat" })
|
|
900
981
|
] })
|
|
901
982
|
] });
|
|
902
983
|
}
|
|
903
|
-
return /* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ jsxs7("div", { className: "githat-form-container", children: [
|
|
985
|
+
/* @__PURE__ */ jsxs7("div", { className: "githat-form-header", children: [
|
|
905
986
|
/* @__PURE__ */ jsx9("h2", { className: "githat-form-title", children: "Forgot password" }),
|
|
906
987
|
/* @__PURE__ */ jsx9("p", { className: "githat-form-subtitle", children: "Enter your email and we'll send you a reset link" })
|
|
907
988
|
] }),
|
|
908
989
|
error && /* @__PURE__ */ jsx9("div", { className: "githat-alert githat-alert-error", role: "alert", "aria-live": "polite", children: error }),
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: "githat-form", "aria-label": "Forgot password form", children: [
|
|
991
|
+
/* @__PURE__ */ jsxs7("div", { className: "githat-field", children: [
|
|
911
992
|
/* @__PURE__ */ jsx9("label", { className: "githat-label", htmlFor: "githat-forgot-email", children: "Email" }),
|
|
912
993
|
/* @__PURE__ */ jsx9(
|
|
913
994
|
"input",
|
|
@@ -934,11 +1015,11 @@ function ForgotPasswordForm({
|
|
|
934
1015
|
}
|
|
935
1016
|
)
|
|
936
1017
|
] }),
|
|
937
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ jsxs7("p", { className: "githat-form-footer", children: [
|
|
938
1019
|
"Remember your password? ",
|
|
939
1020
|
/* @__PURE__ */ jsx9("a", { href: signInUrl, className: "githat-link", children: "Sign in" })
|
|
940
1021
|
] }),
|
|
941
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsxs7("p", { className: "githat-powered-by", children: [
|
|
942
1023
|
"Secured by ",
|
|
943
1024
|
/* @__PURE__ */ jsx9("strong", { children: "GitHat" })
|
|
944
1025
|
] })
|
|
@@ -947,7 +1028,7 @@ function ForgotPasswordForm({
|
|
|
947
1028
|
|
|
948
1029
|
// src/components/ResetPasswordForm.tsx
|
|
949
1030
|
import { useState as useState8 } from "react";
|
|
950
|
-
import { jsx as jsx10, jsxs as
|
|
1031
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
951
1032
|
function ResetPasswordForm({
|
|
952
1033
|
token,
|
|
953
1034
|
onSuccess,
|
|
@@ -986,26 +1067,26 @@ function ResetPasswordForm({
|
|
|
986
1067
|
}
|
|
987
1068
|
};
|
|
988
1069
|
if (success) {
|
|
989
|
-
return /* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ jsxs8("div", { className: "githat-form-container", children: [
|
|
1071
|
+
/* @__PURE__ */ jsxs8("div", { className: "githat-form-header", children: [
|
|
991
1072
|
/* @__PURE__ */ jsx10("h2", { className: "githat-form-title", children: "Password reset!" }),
|
|
992
1073
|
/* @__PURE__ */ jsx10("p", { className: "githat-form-subtitle", children: "Your password has been successfully reset." })
|
|
993
1074
|
] }),
|
|
994
1075
|
/* @__PURE__ */ jsx10("a", { href: signInUrl, className: "githat-button githat-button-primary", style: { display: "block", textAlign: "center", textDecoration: "none" }, children: "Sign in" }),
|
|
995
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsxs8("p", { className: "githat-powered-by", children: [
|
|
996
1077
|
"Secured by ",
|
|
997
1078
|
/* @__PURE__ */ jsx10("strong", { children: "GitHat" })
|
|
998
1079
|
] })
|
|
999
1080
|
] });
|
|
1000
1081
|
}
|
|
1001
|
-
return /* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1082
|
+
return /* @__PURE__ */ jsxs8("div", { className: "githat-form-container", children: [
|
|
1083
|
+
/* @__PURE__ */ jsxs8("div", { className: "githat-form-header", children: [
|
|
1003
1084
|
/* @__PURE__ */ jsx10("h2", { className: "githat-form-title", children: "Reset password" }),
|
|
1004
1085
|
/* @__PURE__ */ jsx10("p", { className: "githat-form-subtitle", children: "Enter your new password" })
|
|
1005
1086
|
] }),
|
|
1006
1087
|
error && /* @__PURE__ */ jsx10("div", { className: "githat-alert githat-alert-error", role: "alert", "aria-live": "polite", children: error }),
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsxs8("form", { onSubmit: handleSubmit, className: "githat-form", "aria-label": "Reset password form", children: [
|
|
1089
|
+
/* @__PURE__ */ jsxs8("div", { className: "githat-field", children: [
|
|
1009
1090
|
/* @__PURE__ */ jsx10("label", { className: "githat-label", htmlFor: "githat-reset-password", children: "New password" }),
|
|
1010
1091
|
/* @__PURE__ */ jsx10(
|
|
1011
1092
|
"input",
|
|
@@ -1023,7 +1104,7 @@ function ResetPasswordForm({
|
|
|
1023
1104
|
}
|
|
1024
1105
|
)
|
|
1025
1106
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ jsxs8("div", { className: "githat-field", children: [
|
|
1027
1108
|
/* @__PURE__ */ jsx10("label", { className: "githat-label", htmlFor: "githat-reset-confirm", children: "Confirm password" }),
|
|
1028
1109
|
/* @__PURE__ */ jsx10(
|
|
1029
1110
|
"input",
|
|
@@ -1050,7 +1131,7 @@ function ResetPasswordForm({
|
|
|
1050
1131
|
}
|
|
1051
1132
|
)
|
|
1052
1133
|
] }),
|
|
1053
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ jsxs8("p", { className: "githat-powered-by", children: [
|
|
1054
1135
|
"Secured by ",
|
|
1055
1136
|
/* @__PURE__ */ jsx10("strong", { children: "GitHat" })
|
|
1056
1137
|
] })
|
|
@@ -1059,7 +1140,7 @@ function ResetPasswordForm({
|
|
|
1059
1140
|
|
|
1060
1141
|
// src/components/VerifyEmailStatus.tsx
|
|
1061
1142
|
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
1062
|
-
import { Fragment as Fragment2, jsx as jsx11, jsxs as
|
|
1143
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1063
1144
|
function VerifyEmailStatus({
|
|
1064
1145
|
token,
|
|
1065
1146
|
onSuccess,
|
|
@@ -1091,29 +1172,29 @@ function VerifyEmailStatus({
|
|
|
1091
1172
|
onError?.(err instanceof Error ? err : new Error(message));
|
|
1092
1173
|
});
|
|
1093
1174
|
}, [token, verifyEmail, onSuccess, onError, signInUrl, redirectDelay]);
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
status === "loading" && /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ jsxs9("div", { className: "githat-form-container", children: [
|
|
1176
|
+
status === "loading" && /* @__PURE__ */ jsxs9("div", { className: "githat-form-header", children: [
|
|
1096
1177
|
/* @__PURE__ */ jsx11("h2", { className: "githat-form-title", children: "Verifying email..." }),
|
|
1097
1178
|
/* @__PURE__ */ jsx11("p", { className: "githat-form-subtitle", children: "Please wait while we verify your email address." })
|
|
1098
1179
|
] }),
|
|
1099
|
-
status === "success" && /* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1180
|
+
status === "success" && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1181
|
+
/* @__PURE__ */ jsxs9("div", { className: "githat-form-header", children: [
|
|
1101
1182
|
/* @__PURE__ */ jsx11("h2", { className: "githat-form-title", children: "Email verified!" }),
|
|
1102
1183
|
/* @__PURE__ */ jsx11("p", { className: "githat-form-subtitle", children: "Your email has been successfully verified. Redirecting to sign in..." })
|
|
1103
1184
|
] }),
|
|
1104
1185
|
/* @__PURE__ */ jsx11("a", { href: signInUrl, className: "githat-button githat-button-primary", style: { display: "block", textAlign: "center", textDecoration: "none" }, children: "Sign in now" })
|
|
1105
1186
|
] }),
|
|
1106
|
-
status === "error" && /* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1187
|
+
status === "error" && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1188
|
+
/* @__PURE__ */ jsxs9("div", { className: "githat-form-header", children: [
|
|
1108
1189
|
/* @__PURE__ */ jsx11("h2", { className: "githat-form-title", children: "Verification failed" }),
|
|
1109
1190
|
/* @__PURE__ */ jsx11("p", { className: "githat-form-subtitle", children: error })
|
|
1110
1191
|
] }),
|
|
1111
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ jsxs9("p", { className: "githat-form-footer", children: [
|
|
1112
1193
|
"The link may have expired. ",
|
|
1113
1194
|
/* @__PURE__ */ jsx11("a", { href: "/sign-up", className: "githat-link", children: "Try signing up again" })
|
|
1114
1195
|
] })
|
|
1115
1196
|
] }),
|
|
1116
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ jsxs9("p", { className: "githat-powered-by", children: [
|
|
1117
1198
|
"Secured by ",
|
|
1118
1199
|
/* @__PURE__ */ jsx11("strong", { children: "GitHat" })
|
|
1119
1200
|
] })
|
|
@@ -1122,7 +1203,7 @@ function VerifyEmailStatus({
|
|
|
1122
1203
|
|
|
1123
1204
|
// src/components/ChangePasswordForm.tsx
|
|
1124
1205
|
import { useState as useState10 } from "react";
|
|
1125
|
-
import { jsx as jsx12, jsxs as
|
|
1206
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1126
1207
|
function ChangePasswordForm({
|
|
1127
1208
|
onSuccess,
|
|
1128
1209
|
onError,
|
|
@@ -1162,15 +1243,15 @@ function ChangePasswordForm({
|
|
|
1162
1243
|
setIsLoading(false);
|
|
1163
1244
|
}
|
|
1164
1245
|
};
|
|
1165
|
-
return /* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ jsxs10("div", { className: "githat-form-container", children: [
|
|
1247
|
+
/* @__PURE__ */ jsxs10("div", { className: "githat-form-header", children: [
|
|
1167
1248
|
/* @__PURE__ */ jsx12("h2", { className: "githat-form-title", children: "Change password" }),
|
|
1168
1249
|
/* @__PURE__ */ jsx12("p", { className: "githat-form-subtitle", children: "Update your account password" })
|
|
1169
1250
|
] }),
|
|
1170
1251
|
success && /* @__PURE__ */ jsx12("div", { className: "githat-alert githat-alert-success", role: "status", "aria-live": "polite", children: "Password changed successfully!" }),
|
|
1171
1252
|
error && /* @__PURE__ */ jsx12("div", { className: "githat-alert githat-alert-error", role: "alert", "aria-live": "polite", children: error }),
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ jsxs10("form", { onSubmit: handleSubmit, className: "githat-form", "aria-label": "Change password form", children: [
|
|
1254
|
+
/* @__PURE__ */ jsxs10("div", { className: "githat-field", children: [
|
|
1174
1255
|
/* @__PURE__ */ jsx12("label", { className: "githat-label", htmlFor: "githat-change-current", children: "Current password" }),
|
|
1175
1256
|
/* @__PURE__ */ jsx12(
|
|
1176
1257
|
"input",
|
|
@@ -1187,7 +1268,7 @@ function ChangePasswordForm({
|
|
|
1187
1268
|
}
|
|
1188
1269
|
)
|
|
1189
1270
|
] }),
|
|
1190
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ jsxs10("div", { className: "githat-field", children: [
|
|
1191
1272
|
/* @__PURE__ */ jsx12("label", { className: "githat-label", htmlFor: "githat-change-new", children: "New password" }),
|
|
1192
1273
|
/* @__PURE__ */ jsx12(
|
|
1193
1274
|
"input",
|
|
@@ -1205,7 +1286,7 @@ function ChangePasswordForm({
|
|
|
1205
1286
|
}
|
|
1206
1287
|
)
|
|
1207
1288
|
] }),
|
|
1208
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ jsxs10("div", { className: "githat-field", children: [
|
|
1209
1290
|
/* @__PURE__ */ jsx12("label", { className: "githat-label", htmlFor: "githat-change-confirm", children: "Confirm new password" }),
|
|
1210
1291
|
/* @__PURE__ */ jsx12(
|
|
1211
1292
|
"input",
|
|
@@ -1232,7 +1313,7 @@ function ChangePasswordForm({
|
|
|
1232
1313
|
}
|
|
1233
1314
|
)
|
|
1234
1315
|
] }),
|
|
1235
|
-
/* @__PURE__ */
|
|
1316
|
+
/* @__PURE__ */ jsxs10("p", { className: "githat-powered-by", children: [
|
|
1236
1317
|
"Secured by ",
|
|
1237
1318
|
/* @__PURE__ */ jsx12("strong", { children: "GitHat" })
|
|
1238
1319
|
] })
|