@githat/nextjs 0.2.6 → 0.2.7
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/dist/index.d.mts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +93 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +41 -1
- package/dist/server.d.ts +41 -1
- package/dist/server.js +18 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +17 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -232,6 +232,52 @@ declare function useData(): {
|
|
|
232
232
|
batch: (collection: string, operations: BatchOperation[]) => Promise<BatchResult>;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
+
interface SendEmailOptions {
|
|
236
|
+
/** Recipient email address(es). Single string or array of up to 50 addresses. */
|
|
237
|
+
to: string | string[];
|
|
238
|
+
/** Email subject line (max 998 characters). */
|
|
239
|
+
subject: string;
|
|
240
|
+
/** HTML body (optional if text is provided). */
|
|
241
|
+
html?: string;
|
|
242
|
+
/** Plain text body (optional if html is provided). */
|
|
243
|
+
text?: string;
|
|
244
|
+
/** Reply-to email address. Recipients can reply directly to this address. */
|
|
245
|
+
replyTo?: string;
|
|
246
|
+
}
|
|
247
|
+
interface SendEmailResult {
|
|
248
|
+
/** SES message ID for tracking. */
|
|
249
|
+
messageId: string;
|
|
250
|
+
/** Recipient addresses the email was sent to. */
|
|
251
|
+
to: string[];
|
|
252
|
+
/** Subject line as sent. */
|
|
253
|
+
subject: string;
|
|
254
|
+
/** Whether the email was sent successfully. */
|
|
255
|
+
sent: boolean;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Hook for sending transactional emails via GitHat's Email API.
|
|
259
|
+
* Emails are sent from noreply@githat.io. Use replyTo for customer replies.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```tsx
|
|
263
|
+
* const { send } = useEmail();
|
|
264
|
+
*
|
|
265
|
+
* await send({
|
|
266
|
+
* to: 'user@example.com',
|
|
267
|
+
* subject: 'Your order is confirmed',
|
|
268
|
+
* html: '<h1>Order Confirmed</h1><p>Thank you!</p>',
|
|
269
|
+
* replyTo: 'support@myapp.com'
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
declare function useEmail(): {
|
|
274
|
+
/**
|
|
275
|
+
* Send a transactional email.
|
|
276
|
+
* @param options - Email options (to, subject, html/text, replyTo)
|
|
277
|
+
*/
|
|
278
|
+
send: (options: SendEmailOptions) => Promise<SendEmailResult>;
|
|
279
|
+
};
|
|
280
|
+
|
|
235
281
|
interface SignInFormProps {
|
|
236
282
|
onSuccess?: () => void;
|
|
237
283
|
signUpUrl?: string;
|
|
@@ -439,5 +485,23 @@ interface WithAuthOptions {
|
|
|
439
485
|
*/
|
|
440
486
|
onUnauthorized?: () => Response;
|
|
441
487
|
}
|
|
488
|
+
interface ServerSendEmailOptions {
|
|
489
|
+
/** Recipient email address(es). */
|
|
490
|
+
to: string | string[];
|
|
491
|
+
/** Email subject line. */
|
|
492
|
+
subject: string;
|
|
493
|
+
/** HTML body. */
|
|
494
|
+
html?: string;
|
|
495
|
+
/** Plain text body. */
|
|
496
|
+
text?: string;
|
|
497
|
+
/** Reply-to email address. */
|
|
498
|
+
replyTo?: string;
|
|
499
|
+
}
|
|
500
|
+
interface ServerSendEmailResult {
|
|
501
|
+
messageId: string;
|
|
502
|
+
to: string[];
|
|
503
|
+
subject: string;
|
|
504
|
+
sent: boolean;
|
|
505
|
+
}
|
|
442
506
|
|
|
443
|
-
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
|
|
507
|
+
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, type SendEmailOptions, type SendEmailResult, type ServerSendEmailOptions, type ServerSendEmailResult, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useEmail, useGitHat };
|
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,52 @@ declare function useData(): {
|
|
|
232
232
|
batch: (collection: string, operations: BatchOperation[]) => Promise<BatchResult>;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
+
interface SendEmailOptions {
|
|
236
|
+
/** Recipient email address(es). Single string or array of up to 50 addresses. */
|
|
237
|
+
to: string | string[];
|
|
238
|
+
/** Email subject line (max 998 characters). */
|
|
239
|
+
subject: string;
|
|
240
|
+
/** HTML body (optional if text is provided). */
|
|
241
|
+
html?: string;
|
|
242
|
+
/** Plain text body (optional if html is provided). */
|
|
243
|
+
text?: string;
|
|
244
|
+
/** Reply-to email address. Recipients can reply directly to this address. */
|
|
245
|
+
replyTo?: string;
|
|
246
|
+
}
|
|
247
|
+
interface SendEmailResult {
|
|
248
|
+
/** SES message ID for tracking. */
|
|
249
|
+
messageId: string;
|
|
250
|
+
/** Recipient addresses the email was sent to. */
|
|
251
|
+
to: string[];
|
|
252
|
+
/** Subject line as sent. */
|
|
253
|
+
subject: string;
|
|
254
|
+
/** Whether the email was sent successfully. */
|
|
255
|
+
sent: boolean;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Hook for sending transactional emails via GitHat's Email API.
|
|
259
|
+
* Emails are sent from noreply@githat.io. Use replyTo for customer replies.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```tsx
|
|
263
|
+
* const { send } = useEmail();
|
|
264
|
+
*
|
|
265
|
+
* await send({
|
|
266
|
+
* to: 'user@example.com',
|
|
267
|
+
* subject: 'Your order is confirmed',
|
|
268
|
+
* html: '<h1>Order Confirmed</h1><p>Thank you!</p>',
|
|
269
|
+
* replyTo: 'support@myapp.com'
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
declare function useEmail(): {
|
|
274
|
+
/**
|
|
275
|
+
* Send a transactional email.
|
|
276
|
+
* @param options - Email options (to, subject, html/text, replyTo)
|
|
277
|
+
*/
|
|
278
|
+
send: (options: SendEmailOptions) => Promise<SendEmailResult>;
|
|
279
|
+
};
|
|
280
|
+
|
|
235
281
|
interface SignInFormProps {
|
|
236
282
|
onSuccess?: () => void;
|
|
237
283
|
signUpUrl?: string;
|
|
@@ -439,5 +485,23 @@ interface WithAuthOptions {
|
|
|
439
485
|
*/
|
|
440
486
|
onUnauthorized?: () => Response;
|
|
441
487
|
}
|
|
488
|
+
interface ServerSendEmailOptions {
|
|
489
|
+
/** Recipient email address(es). */
|
|
490
|
+
to: string | string[];
|
|
491
|
+
/** Email subject line. */
|
|
492
|
+
subject: string;
|
|
493
|
+
/** HTML body. */
|
|
494
|
+
html?: string;
|
|
495
|
+
/** Plain text body. */
|
|
496
|
+
text?: string;
|
|
497
|
+
/** Reply-to email address. */
|
|
498
|
+
replyTo?: string;
|
|
499
|
+
}
|
|
500
|
+
interface ServerSendEmailResult {
|
|
501
|
+
messageId: string;
|
|
502
|
+
to: string[];
|
|
503
|
+
subject: string;
|
|
504
|
+
sent: boolean;
|
|
505
|
+
}
|
|
442
506
|
|
|
443
|
-
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
|
|
507
|
+
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, type SendEmailOptions, type SendEmailResult, type ServerSendEmailOptions, type ServerSendEmailResult, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useEmail, useGitHat };
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
VerifyEmailStatus: () => VerifyEmailStatus,
|
|
41
41
|
useAuth: () => useAuth,
|
|
42
42
|
useData: () => useData,
|
|
43
|
+
useEmail: () => useEmail,
|
|
43
44
|
useGitHat: () => useGitHat
|
|
44
45
|
});
|
|
45
46
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -643,15 +644,40 @@ function useData() {
|
|
|
643
644
|
}), [client]);
|
|
644
645
|
}
|
|
645
646
|
|
|
646
|
-
// src/
|
|
647
|
+
// src/email.ts
|
|
647
648
|
var import_react4 = require("react");
|
|
649
|
+
function useEmail() {
|
|
650
|
+
const ctx = useAuth();
|
|
651
|
+
const client = (0, import_react4.useMemo)(
|
|
652
|
+
() => createClient(ctx.config.apiUrl, ctx.config.publishableKey),
|
|
653
|
+
[ctx.config.apiUrl, ctx.config.publishableKey]
|
|
654
|
+
);
|
|
655
|
+
return (0, import_react4.useMemo)(() => ({
|
|
656
|
+
/**
|
|
657
|
+
* Send a transactional email.
|
|
658
|
+
* @param options - Email options (to, subject, html/text, replyTo)
|
|
659
|
+
*/
|
|
660
|
+
send: async (options) => {
|
|
661
|
+
if (!options.to) throw new Error('Recipient "to" is required');
|
|
662
|
+
if (!options.subject) throw new Error("Subject is required");
|
|
663
|
+
if (!options.html && !options.text) throw new Error('At least one of "html" or "text" is required');
|
|
664
|
+
return client.fetchApi("/email/send", {
|
|
665
|
+
method: "POST",
|
|
666
|
+
body: JSON.stringify(options)
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
}), [client]);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/components/SignInForm.tsx
|
|
673
|
+
var import_react5 = require("react");
|
|
648
674
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
649
675
|
function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
650
676
|
const { signIn, config } = useAuth();
|
|
651
|
-
const [email, setEmail] = (0,
|
|
652
|
-
const [password, setPassword] = (0,
|
|
653
|
-
const [error, setError] = (0,
|
|
654
|
-
const [loading, setLoading] = (0,
|
|
677
|
+
const [email, setEmail] = (0, import_react5.useState)("");
|
|
678
|
+
const [password, setPassword] = (0, import_react5.useState)("");
|
|
679
|
+
const [error, setError] = (0, import_react5.useState)("");
|
|
680
|
+
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
655
681
|
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
656
682
|
const handleSubmit = async (e) => {
|
|
657
683
|
e.preventDefault();
|
|
@@ -737,15 +763,15 @@ function SignInForm({ onSuccess, signUpUrl, forgotPasswordUrl }) {
|
|
|
737
763
|
}
|
|
738
764
|
|
|
739
765
|
// src/components/SignUpForm.tsx
|
|
740
|
-
var
|
|
766
|
+
var import_react6 = require("react");
|
|
741
767
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
742
768
|
function SignUpForm({ onSuccess, signInUrl }) {
|
|
743
769
|
const { signUp, config } = useAuth();
|
|
744
|
-
const [name, setName] = (0,
|
|
745
|
-
const [email, setEmail] = (0,
|
|
746
|
-
const [password, setPassword] = (0,
|
|
747
|
-
const [error, setError] = (0,
|
|
748
|
-
const [loading, setLoading] = (0,
|
|
770
|
+
const [name, setName] = (0, import_react6.useState)("");
|
|
771
|
+
const [email, setEmail] = (0, import_react6.useState)("");
|
|
772
|
+
const [password, setPassword] = (0, import_react6.useState)("");
|
|
773
|
+
const [error, setError] = (0, import_react6.useState)("");
|
|
774
|
+
const [loading, setLoading] = (0, import_react6.useState)(false);
|
|
749
775
|
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
750
776
|
const passwordValid = password.length >= 8 && /[A-Z]/.test(password) && /[a-z]/.test(password) && /\d/.test(password);
|
|
751
777
|
const handleSubmit = async (e) => {
|
|
@@ -851,31 +877,31 @@ function SignUpForm({ onSuccess, signInUrl }) {
|
|
|
851
877
|
}
|
|
852
878
|
|
|
853
879
|
// src/components/SignInButton.tsx
|
|
854
|
-
var
|
|
880
|
+
var import_react7 = require("react");
|
|
855
881
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
856
882
|
function SignInButton({ className, children, href }) {
|
|
857
|
-
const ctx = (0,
|
|
883
|
+
const ctx = (0, import_react7.useContext)(GitHatContext);
|
|
858
884
|
const url = href || ctx?.config.signInUrl || "/sign-in";
|
|
859
885
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: url, className: className || "githat-button githat-button-primary", "aria-label": "Sign in", children: children || "Sign in" });
|
|
860
886
|
}
|
|
861
887
|
|
|
862
888
|
// src/components/SignUpButton.tsx
|
|
863
|
-
var
|
|
889
|
+
var import_react8 = require("react");
|
|
864
890
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
865
891
|
function SignUpButton({ className, children, href }) {
|
|
866
|
-
const ctx = (0,
|
|
892
|
+
const ctx = (0, import_react8.useContext)(GitHatContext);
|
|
867
893
|
const url = href || ctx?.config.signUpUrl || "/sign-up";
|
|
868
894
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: url, className: className || "githat-button githat-button-outline", "aria-label": "Sign up", children: children || "Sign up" });
|
|
869
895
|
}
|
|
870
896
|
|
|
871
897
|
// src/components/UserButton.tsx
|
|
872
|
-
var
|
|
898
|
+
var import_react9 = require("react");
|
|
873
899
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
874
900
|
function UserButton() {
|
|
875
901
|
const { user, org, isSignedIn, signOut } = useAuth();
|
|
876
|
-
const [open, setOpen] = (0,
|
|
877
|
-
const ref = (0,
|
|
878
|
-
(0,
|
|
902
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
903
|
+
const ref = (0, import_react9.useRef)(null);
|
|
904
|
+
(0, import_react9.useEffect)(() => {
|
|
879
905
|
const handleClickOutside = (e) => {
|
|
880
906
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
881
907
|
};
|
|
@@ -902,23 +928,23 @@ function UserButton() {
|
|
|
902
928
|
}
|
|
903
929
|
|
|
904
930
|
// src/components/OrgSwitcher.tsx
|
|
905
|
-
var
|
|
931
|
+
var import_react10 = require("react");
|
|
906
932
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
907
933
|
function OrgSwitcher() {
|
|
908
934
|
const { org, isSignedIn, switchOrg } = useAuth();
|
|
909
935
|
const githat = useGitHat();
|
|
910
|
-
const [orgs, setOrgs] = (0,
|
|
911
|
-
const [orgsLoading, setOrgsLoading] = (0,
|
|
912
|
-
const [open, setOpen] = (0,
|
|
913
|
-
const ref = (0,
|
|
914
|
-
(0,
|
|
936
|
+
const [orgs, setOrgs] = (0, import_react10.useState)([]);
|
|
937
|
+
const [orgsLoading, setOrgsLoading] = (0, import_react10.useState)(false);
|
|
938
|
+
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
939
|
+
const ref = (0, import_react10.useRef)(null);
|
|
940
|
+
(0, import_react10.useEffect)(() => {
|
|
915
941
|
if (isSignedIn) {
|
|
916
942
|
setOrgsLoading(true);
|
|
917
943
|
githat.getUserOrgs().then((data) => setOrgs(data.orgs || [])).catch(() => {
|
|
918
944
|
}).finally(() => setOrgsLoading(false));
|
|
919
945
|
}
|
|
920
946
|
}, [isSignedIn]);
|
|
921
|
-
(0,
|
|
947
|
+
(0, import_react10.useEffect)(() => {
|
|
922
948
|
const handleClickOutside = (e) => {
|
|
923
949
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
924
950
|
};
|
|
@@ -952,15 +978,15 @@ function OrgSwitcher() {
|
|
|
952
978
|
}
|
|
953
979
|
|
|
954
980
|
// src/components/VerifiedBadge.tsx
|
|
955
|
-
var
|
|
981
|
+
var import_react11 = require("react");
|
|
956
982
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
957
983
|
var CACHE_TTL = 5 * 60 * 1e3;
|
|
958
984
|
var cache = /* @__PURE__ */ new Map();
|
|
959
985
|
function VerifiedBadge({ type, identifier, label }) {
|
|
960
986
|
const githat = useGitHat();
|
|
961
|
-
const [verified, setVerified] = (0,
|
|
962
|
-
const mounted = (0,
|
|
963
|
-
(0,
|
|
987
|
+
const [verified, setVerified] = (0, import_react11.useState)(null);
|
|
988
|
+
const mounted = (0, import_react11.useRef)(true);
|
|
989
|
+
(0, import_react11.useEffect)(() => {
|
|
964
990
|
mounted.current = true;
|
|
965
991
|
const key = `${type}:${identifier}`;
|
|
966
992
|
const cached = cache.get(key);
|
|
@@ -1006,7 +1032,7 @@ function ProtectedRoute({ children, fallback }) {
|
|
|
1006
1032
|
}
|
|
1007
1033
|
|
|
1008
1034
|
// src/components/ForgotPasswordForm.tsx
|
|
1009
|
-
var
|
|
1035
|
+
var import_react12 = require("react");
|
|
1010
1036
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1011
1037
|
function ForgotPasswordForm({
|
|
1012
1038
|
onSuccess,
|
|
@@ -1014,10 +1040,10 @@ function ForgotPasswordForm({
|
|
|
1014
1040
|
signInUrl = "/sign-in"
|
|
1015
1041
|
}) {
|
|
1016
1042
|
const { forgotPassword } = useGitHat();
|
|
1017
|
-
const [email, setEmail] = (0,
|
|
1018
|
-
const [isLoading, setIsLoading] = (0,
|
|
1019
|
-
const [sent, setSent] = (0,
|
|
1020
|
-
const [error, setError] = (0,
|
|
1043
|
+
const [email, setEmail] = (0, import_react12.useState)("");
|
|
1044
|
+
const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
|
|
1045
|
+
const [sent, setSent] = (0, import_react12.useState)(false);
|
|
1046
|
+
const [error, setError] = (0, import_react12.useState)("");
|
|
1021
1047
|
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
1022
1048
|
const handleSubmit = async (e) => {
|
|
1023
1049
|
e.preventDefault();
|
|
@@ -1101,7 +1127,7 @@ function ForgotPasswordForm({
|
|
|
1101
1127
|
}
|
|
1102
1128
|
|
|
1103
1129
|
// src/components/ResetPasswordForm.tsx
|
|
1104
|
-
var
|
|
1130
|
+
var import_react13 = require("react");
|
|
1105
1131
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1106
1132
|
function ResetPasswordForm({
|
|
1107
1133
|
token,
|
|
@@ -1111,11 +1137,11 @@ function ResetPasswordForm({
|
|
|
1111
1137
|
minPasswordLength = 8
|
|
1112
1138
|
}) {
|
|
1113
1139
|
const { resetPassword } = useGitHat();
|
|
1114
|
-
const [password, setPassword] = (0,
|
|
1115
|
-
const [confirm, setConfirm] = (0,
|
|
1116
|
-
const [isLoading, setIsLoading] = (0,
|
|
1117
|
-
const [success, setSuccess] = (0,
|
|
1118
|
-
const [error, setError] = (0,
|
|
1140
|
+
const [password, setPassword] = (0, import_react13.useState)("");
|
|
1141
|
+
const [confirm, setConfirm] = (0, import_react13.useState)("");
|
|
1142
|
+
const [isLoading, setIsLoading] = (0, import_react13.useState)(false);
|
|
1143
|
+
const [success, setSuccess] = (0, import_react13.useState)(false);
|
|
1144
|
+
const [error, setError] = (0, import_react13.useState)("");
|
|
1119
1145
|
const handleSubmit = async (e) => {
|
|
1120
1146
|
e.preventDefault();
|
|
1121
1147
|
if (password !== confirm) {
|
|
@@ -1213,7 +1239,7 @@ function ResetPasswordForm({
|
|
|
1213
1239
|
}
|
|
1214
1240
|
|
|
1215
1241
|
// src/components/VerifyEmailStatus.tsx
|
|
1216
|
-
var
|
|
1242
|
+
var import_react14 = require("react");
|
|
1217
1243
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1218
1244
|
function VerifyEmailStatus({
|
|
1219
1245
|
token,
|
|
@@ -1223,9 +1249,9 @@ function VerifyEmailStatus({
|
|
|
1223
1249
|
redirectDelay = 3e3
|
|
1224
1250
|
}) {
|
|
1225
1251
|
const { verifyEmail } = useGitHat();
|
|
1226
|
-
const [status, setStatus] = (0,
|
|
1227
|
-
const [error, setError] = (0,
|
|
1228
|
-
(0,
|
|
1252
|
+
const [status, setStatus] = (0, import_react14.useState)("loading");
|
|
1253
|
+
const [error, setError] = (0, import_react14.useState)("");
|
|
1254
|
+
(0, import_react14.useEffect)(() => {
|
|
1229
1255
|
if (!token) {
|
|
1230
1256
|
setStatus("error");
|
|
1231
1257
|
setError("Missing verification token");
|
|
@@ -1276,7 +1302,7 @@ function VerifyEmailStatus({
|
|
|
1276
1302
|
}
|
|
1277
1303
|
|
|
1278
1304
|
// src/components/ChangePasswordForm.tsx
|
|
1279
|
-
var
|
|
1305
|
+
var import_react15 = require("react");
|
|
1280
1306
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1281
1307
|
function ChangePasswordForm({
|
|
1282
1308
|
onSuccess,
|
|
@@ -1284,12 +1310,12 @@ function ChangePasswordForm({
|
|
|
1284
1310
|
minPasswordLength = 8
|
|
1285
1311
|
}) {
|
|
1286
1312
|
const { changePassword } = useGitHat();
|
|
1287
|
-
const [current, setCurrent] = (0,
|
|
1288
|
-
const [newPass, setNewPass] = (0,
|
|
1289
|
-
const [confirm, setConfirm] = (0,
|
|
1290
|
-
const [isLoading, setIsLoading] = (0,
|
|
1291
|
-
const [error, setError] = (0,
|
|
1292
|
-
const [success, setSuccess] = (0,
|
|
1313
|
+
const [current, setCurrent] = (0, import_react15.useState)("");
|
|
1314
|
+
const [newPass, setNewPass] = (0, import_react15.useState)("");
|
|
1315
|
+
const [confirm, setConfirm] = (0, import_react15.useState)("");
|
|
1316
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
|
|
1317
|
+
const [error, setError] = (0, import_react15.useState)("");
|
|
1318
|
+
const [success, setSuccess] = (0, import_react15.useState)(false);
|
|
1293
1319
|
const handleSubmit = async (e) => {
|
|
1294
1320
|
e.preventDefault();
|
|
1295
1321
|
if (newPass !== confirm) {
|
|
@@ -1395,7 +1421,7 @@ function ChangePasswordForm({
|
|
|
1395
1421
|
}
|
|
1396
1422
|
|
|
1397
1423
|
// src/components/GitHubButton.tsx
|
|
1398
|
-
var
|
|
1424
|
+
var import_react16 = require("react");
|
|
1399
1425
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1400
1426
|
var GitHubIcon = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z" }) });
|
|
1401
1427
|
function GitHubButton({
|
|
@@ -1408,8 +1434,8 @@ function GitHubButton({
|
|
|
1408
1434
|
disabled = false
|
|
1409
1435
|
}) {
|
|
1410
1436
|
const { getGitHubOAuthUrl } = useGitHat();
|
|
1411
|
-
const [isLoading, setIsLoading] = (0,
|
|
1412
|
-
const handleClick = (0,
|
|
1437
|
+
const [isLoading, setIsLoading] = (0, import_react16.useState)(false);
|
|
1438
|
+
const handleClick = (0, import_react16.useCallback)(async () => {
|
|
1413
1439
|
if (isLoading || disabled) return;
|
|
1414
1440
|
setIsLoading(true);
|
|
1415
1441
|
try {
|
|
@@ -1496,7 +1522,7 @@ if (typeof document !== "undefined") {
|
|
|
1496
1522
|
}
|
|
1497
1523
|
|
|
1498
1524
|
// src/components/GitHubCallback.tsx
|
|
1499
|
-
var
|
|
1525
|
+
var import_react17 = require("react");
|
|
1500
1526
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1501
1527
|
function GitHubCallback({
|
|
1502
1528
|
redirectUrl = "/dashboard",
|
|
@@ -1508,9 +1534,9 @@ function GitHubCallback({
|
|
|
1508
1534
|
}) {
|
|
1509
1535
|
const { signInWithGitHub } = useGitHat();
|
|
1510
1536
|
const { config } = useAuth();
|
|
1511
|
-
const [error, setError] = (0,
|
|
1512
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
1513
|
-
(0,
|
|
1537
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
1538
|
+
const [isProcessing, setIsProcessing] = (0, import_react17.useState)(true);
|
|
1539
|
+
(0, import_react17.useEffect)(() => {
|
|
1514
1540
|
const handleCallback = async () => {
|
|
1515
1541
|
const params = new URLSearchParams(window.location.search);
|
|
1516
1542
|
const code = params.get("code");
|
|
@@ -1628,7 +1654,7 @@ if (typeof document !== "undefined") {
|
|
|
1628
1654
|
}
|
|
1629
1655
|
|
|
1630
1656
|
// src/components/CognitoButton.tsx
|
|
1631
|
-
var
|
|
1657
|
+
var import_react18 = require("react");
|
|
1632
1658
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1633
1659
|
var AWSIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.264-.168.312a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.415-.287-.806-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.336-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.176 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z" }) });
|
|
1634
1660
|
function CognitoButton({
|
|
@@ -1641,8 +1667,8 @@ function CognitoButton({
|
|
|
1641
1667
|
disabled = false
|
|
1642
1668
|
}) {
|
|
1643
1669
|
const { getCognitoOAuthUrl } = useGitHat();
|
|
1644
|
-
const [isLoading, setIsLoading] = (0,
|
|
1645
|
-
const handleClick = (0,
|
|
1670
|
+
const [isLoading, setIsLoading] = (0, import_react18.useState)(false);
|
|
1671
|
+
const handleClick = (0, import_react18.useCallback)(async () => {
|
|
1646
1672
|
if (isLoading || disabled) return;
|
|
1647
1673
|
setIsLoading(true);
|
|
1648
1674
|
try {
|
|
@@ -1728,7 +1754,7 @@ if (typeof document !== "undefined") {
|
|
|
1728
1754
|
}
|
|
1729
1755
|
|
|
1730
1756
|
// src/components/CognitoCallback.tsx
|
|
1731
|
-
var
|
|
1757
|
+
var import_react19 = require("react");
|
|
1732
1758
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1733
1759
|
function CognitoCallback({
|
|
1734
1760
|
redirectUrl = "/dashboard",
|
|
@@ -1740,9 +1766,9 @@ function CognitoCallback({
|
|
|
1740
1766
|
}) {
|
|
1741
1767
|
const { signInWithCognito } = useGitHat();
|
|
1742
1768
|
const { config } = useAuth();
|
|
1743
|
-
const [error, setError] = (0,
|
|
1744
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
1745
|
-
(0,
|
|
1769
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
1770
|
+
const [isProcessing, setIsProcessing] = (0, import_react19.useState)(true);
|
|
1771
|
+
(0, import_react19.useEffect)(() => {
|
|
1746
1772
|
const handleCallback = async () => {
|
|
1747
1773
|
const params = new URLSearchParams(window.location.search);
|
|
1748
1774
|
const code = params.get("code");
|
|
@@ -1835,6 +1861,7 @@ function CognitoCallback({
|
|
|
1835
1861
|
VerifyEmailStatus,
|
|
1836
1862
|
useAuth,
|
|
1837
1863
|
useData,
|
|
1864
|
+
useEmail,
|
|
1838
1865
|
useGitHat
|
|
1839
1866
|
});
|
|
1840
1867
|
//# sourceMappingURL=index.js.map
|