@insforge/react 1.0.9-dev.0 → 1.0.9-dev.2
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/components.cjs +36 -12
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +3 -5
- package/dist/components.d.ts +3 -5
- package/dist/components.js +36 -12
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +36 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/components.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { InsforgeUser } from '@insforge/shared';
|
|
3
2
|
import { VerifyEmailResponse } from '@insforge/shared-schemas';
|
|
4
3
|
import { ReactNode } from 'react';
|
|
4
|
+
import { InsforgeUser } from '@insforge/shared';
|
|
5
5
|
export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.cjs';
|
|
6
6
|
export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.cjs';
|
|
7
7
|
import './types.cjs';
|
|
@@ -21,7 +21,6 @@ interface SignInProps {
|
|
|
21
21
|
signUpLinkText?: string;
|
|
22
22
|
signUpUrl?: string;
|
|
23
23
|
dividerText?: string;
|
|
24
|
-
onSuccess?: (accessToken: string, user: InsforgeUser, csrfToken?: string | null) => void;
|
|
25
24
|
onError?: (error: Error) => void;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
@@ -35,7 +34,7 @@ interface SignInProps {
|
|
|
35
34
|
* />
|
|
36
35
|
* ```
|
|
37
36
|
*/
|
|
38
|
-
declare function SignIn({
|
|
37
|
+
declare function SignIn({ onError, ...uiProps }: SignInProps): react_jsx_runtime.JSX.Element | null;
|
|
39
38
|
|
|
40
39
|
interface SignUpProps {
|
|
41
40
|
title?: string;
|
|
@@ -50,7 +49,6 @@ interface SignUpProps {
|
|
|
50
49
|
signInLinkText?: string;
|
|
51
50
|
signInUrl?: string;
|
|
52
51
|
dividerText?: string;
|
|
53
|
-
onSuccess?: (accessToken: string, user: InsforgeUser, csrfToken?: string | null) => void;
|
|
54
52
|
onError?: (error: Error) => void;
|
|
55
53
|
}
|
|
56
54
|
/**
|
|
@@ -65,7 +63,7 @@ interface SignUpProps {
|
|
|
65
63
|
*
|
|
66
64
|
* ```
|
|
67
65
|
*/
|
|
68
|
-
declare function SignUp({
|
|
66
|
+
declare function SignUp({ onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
|
|
69
67
|
|
|
70
68
|
interface ForgotPasswordProps {
|
|
71
69
|
/** Text customization */
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { InsforgeUser } from '@insforge/shared';
|
|
3
2
|
import { VerifyEmailResponse } from '@insforge/shared-schemas';
|
|
4
3
|
import { ReactNode } from 'react';
|
|
4
|
+
import { InsforgeUser } from '@insforge/shared';
|
|
5
5
|
export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.js';
|
|
6
6
|
export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.js';
|
|
7
7
|
import './types.js';
|
|
@@ -21,7 +21,6 @@ interface SignInProps {
|
|
|
21
21
|
signUpLinkText?: string;
|
|
22
22
|
signUpUrl?: string;
|
|
23
23
|
dividerText?: string;
|
|
24
|
-
onSuccess?: (accessToken: string, user: InsforgeUser, csrfToken?: string | null) => void;
|
|
25
24
|
onError?: (error: Error) => void;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
@@ -35,7 +34,7 @@ interface SignInProps {
|
|
|
35
34
|
* />
|
|
36
35
|
* ```
|
|
37
36
|
*/
|
|
38
|
-
declare function SignIn({
|
|
37
|
+
declare function SignIn({ onError, ...uiProps }: SignInProps): react_jsx_runtime.JSX.Element | null;
|
|
39
38
|
|
|
40
39
|
interface SignUpProps {
|
|
41
40
|
title?: string;
|
|
@@ -50,7 +49,6 @@ interface SignUpProps {
|
|
|
50
49
|
signInLinkText?: string;
|
|
51
50
|
signInUrl?: string;
|
|
52
51
|
dividerText?: string;
|
|
53
|
-
onSuccess?: (accessToken: string, user: InsforgeUser, csrfToken?: string | null) => void;
|
|
54
52
|
onError?: (error: Error) => void;
|
|
55
53
|
}
|
|
56
54
|
/**
|
|
@@ -65,7 +63,7 @@ interface SignUpProps {
|
|
|
65
63
|
*
|
|
66
64
|
* ```
|
|
67
65
|
*/
|
|
68
|
-
declare function SignUp({
|
|
66
|
+
declare function SignUp({ onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
|
|
69
67
|
|
|
70
68
|
interface ForgotPasswordProps {
|
|
71
69
|
/** Text customization */
|
package/dist/components.js
CHANGED
|
@@ -3624,7 +3624,7 @@ function SignInForm({
|
|
|
3624
3624
|
] })
|
|
3625
3625
|
] });
|
|
3626
3626
|
}
|
|
3627
|
-
function SignIn({
|
|
3627
|
+
function SignIn({ onError, ...uiProps }) {
|
|
3628
3628
|
const { signIn, verifyEmail, loginWithOAuth } = useInsforge();
|
|
3629
3629
|
const { authConfig } = usePublicAuthConfig();
|
|
3630
3630
|
const [email, setEmail] = useState("");
|
|
@@ -3649,12 +3649,18 @@ function SignIn({ onSuccess, onError, ...uiProps }) {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
throw new Error(result.error);
|
|
3651
3651
|
}
|
|
3652
|
-
const {
|
|
3653
|
-
if (
|
|
3654
|
-
|
|
3652
|
+
const { user, accessToken, redirectTo, csrfToken } = result;
|
|
3653
|
+
if (user) {
|
|
3654
|
+
const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
|
|
3655
|
+
finalUrl.searchParams.set("access_token", accessToken);
|
|
3656
|
+
finalUrl.searchParams.set("user_id", user.id);
|
|
3657
|
+
finalUrl.searchParams.set("email", user.email);
|
|
3658
|
+
finalUrl.searchParams.set("name", user.profile?.name || "");
|
|
3659
|
+
if (csrfToken) {
|
|
3660
|
+
finalUrl.searchParams.set("csrf_token", csrfToken);
|
|
3661
|
+
}
|
|
3662
|
+
window.location.href = finalUrl.toString();
|
|
3655
3663
|
}
|
|
3656
|
-
const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
|
|
3657
|
-
window.location.href = finalUrl.toString();
|
|
3658
3664
|
} catch (err) {
|
|
3659
3665
|
const errorMessage = err instanceof Error ? err.message : "Sign in failed";
|
|
3660
3666
|
setError(errorMessage);
|
|
@@ -3673,6 +3679,13 @@ function SignIn({ onSuccess, onError, ...uiProps }) {
|
|
|
3673
3679
|
throw new Error("Verification failed");
|
|
3674
3680
|
}
|
|
3675
3681
|
const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
|
|
3682
|
+
finalUrl.searchParams.set("access_token", result.accessToken);
|
|
3683
|
+
finalUrl.searchParams.set("user_id", result.user.id);
|
|
3684
|
+
finalUrl.searchParams.set("email", result.user.email);
|
|
3685
|
+
finalUrl.searchParams.set("name", result.user.profile?.name || "");
|
|
3686
|
+
if (result.csrfToken) {
|
|
3687
|
+
finalUrl.searchParams.set("csrf_token", result.csrfToken);
|
|
3688
|
+
}
|
|
3676
3689
|
window.location.href = finalUrl.toString();
|
|
3677
3690
|
} catch (err) {
|
|
3678
3691
|
const errorMessage = err instanceof Error ? err.message : "Invalid verification code";
|
|
@@ -3832,7 +3845,7 @@ function createPasswordSchema(options) {
|
|
|
3832
3845
|
return schema;
|
|
3833
3846
|
}
|
|
3834
3847
|
createPasswordSchema();
|
|
3835
|
-
function SignUp({
|
|
3848
|
+
function SignUp({ onError, ...uiProps }) {
|
|
3836
3849
|
const { signUp, verifyEmail, loginWithOAuth } = useInsforge();
|
|
3837
3850
|
const { authConfig } = usePublicAuthConfig();
|
|
3838
3851
|
const [email, setEmail] = useState("");
|
|
@@ -3883,12 +3896,16 @@ function SignUp({ onSuccess, onError, ...uiProps }) {
|
|
|
3883
3896
|
setLoading(false);
|
|
3884
3897
|
return;
|
|
3885
3898
|
}
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3899
|
+
if (result.accessToken && result.user) {
|
|
3900
|
+
const csrfToken = result.csrfToken;
|
|
3901
|
+
const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
|
|
3902
|
+
finalUrl.searchParams.set("access_token", result.accessToken);
|
|
3903
|
+
finalUrl.searchParams.set("user_id", result.user.id);
|
|
3904
|
+
finalUrl.searchParams.set("email", result.user.email);
|
|
3905
|
+
finalUrl.searchParams.set("name", result.user.profile?.name || "");
|
|
3906
|
+
if (csrfToken) {
|
|
3907
|
+
finalUrl.searchParams.set("csrf_token", csrfToken);
|
|
3890
3908
|
}
|
|
3891
|
-
const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
|
|
3892
3909
|
window.location.href = finalUrl.toString();
|
|
3893
3910
|
}
|
|
3894
3911
|
} catch (err) {
|
|
@@ -3909,6 +3926,13 @@ function SignUp({ onSuccess, onError, ...uiProps }) {
|
|
|
3909
3926
|
throw new Error("Verification failed");
|
|
3910
3927
|
}
|
|
3911
3928
|
const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
|
|
3929
|
+
finalUrl.searchParams.set("access_token", result.accessToken);
|
|
3930
|
+
finalUrl.searchParams.set("user_id", result.user.id);
|
|
3931
|
+
finalUrl.searchParams.set("email", result.user.email);
|
|
3932
|
+
finalUrl.searchParams.set("name", result.user.profile?.name || "");
|
|
3933
|
+
if (result.csrfToken) {
|
|
3934
|
+
finalUrl.searchParams.set("csrf_token", result.csrfToken);
|
|
3935
|
+
}
|
|
3912
3936
|
window.location.href = finalUrl.toString();
|
|
3913
3937
|
} catch (err) {
|
|
3914
3938
|
const errorMessage = err instanceof Error ? err.message : "Invalid verification code";
|