@insforge/react 0.2.5 → 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/components.d.mts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +2 -24
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +2 -24
- package/dist/components.mjs.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.js +4 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -33
- package/dist/index.mjs.map +1 -1
- package/dist/router.d.mts +25 -41
- package/dist/router.d.ts +25 -41
- package/dist/router.js +2 -107
- package/dist/router.js.map +1 -1
- package/dist/router.mjs +4 -109
- package/dist/router.mjs.map +1 -1
- package/dist/types.d.mts +0 -4
- package/dist/types.d.ts +0 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1260,10 +1260,8 @@ function SignInForm({
|
|
|
1260
1260
|
);
|
|
1261
1261
|
}
|
|
1262
1262
|
function SignIn({
|
|
1263
|
-
afterSignInUrl = "/",
|
|
1264
1263
|
onSuccess,
|
|
1265
1264
|
onError,
|
|
1266
|
-
onRedirect,
|
|
1267
1265
|
...uiProps
|
|
1268
1266
|
}) {
|
|
1269
1267
|
const { signIn, baseUrl } = useInsforge();
|
|
@@ -1289,11 +1287,6 @@ function SignIn({
|
|
|
1289
1287
|
if (onSuccess) {
|
|
1290
1288
|
if (user) onSuccess(user, accessToken || "");
|
|
1291
1289
|
}
|
|
1292
|
-
if (onRedirect) {
|
|
1293
|
-
onRedirect(afterSignInUrl);
|
|
1294
|
-
} else {
|
|
1295
|
-
window.location.href = afterSignInUrl;
|
|
1296
|
-
}
|
|
1297
1290
|
} catch (err) {
|
|
1298
1291
|
const errorMessage = err.message || "Sign in failed";
|
|
1299
1292
|
setError(errorMessage);
|
|
@@ -1307,7 +1300,6 @@ function SignIn({
|
|
|
1307
1300
|
setOauthLoading(provider);
|
|
1308
1301
|
setError("");
|
|
1309
1302
|
const redirectTo = `${window.location.origin}/auth/callback`;
|
|
1310
|
-
sessionStorage.setItem("oauth_final_destination", afterSignInUrl || "/");
|
|
1311
1303
|
await insforge.auth.signInWithOAuth({
|
|
1312
1304
|
provider,
|
|
1313
1305
|
redirectTo
|
|
@@ -1489,10 +1481,8 @@ function SignUpForm({
|
|
|
1489
1481
|
);
|
|
1490
1482
|
}
|
|
1491
1483
|
function SignUp({
|
|
1492
|
-
afterSignUpUrl = "/",
|
|
1493
1484
|
onSuccess,
|
|
1494
1485
|
onError,
|
|
1495
|
-
onRedirect,
|
|
1496
1486
|
...uiProps
|
|
1497
1487
|
}) {
|
|
1498
1488
|
const { signUp, baseUrl } = useInsforge();
|
|
@@ -1523,11 +1513,6 @@ function SignUp({
|
|
|
1523
1513
|
if (onSuccess) {
|
|
1524
1514
|
if (user) onSuccess(user, accessToken || "");
|
|
1525
1515
|
}
|
|
1526
|
-
if (onRedirect) {
|
|
1527
|
-
onRedirect(afterSignUpUrl);
|
|
1528
|
-
} else {
|
|
1529
|
-
window.location.href = afterSignUpUrl;
|
|
1530
|
-
}
|
|
1531
1516
|
} catch (err) {
|
|
1532
1517
|
const errorMessage = err.message || "Sign up failed";
|
|
1533
1518
|
setError(errorMessage);
|
|
@@ -1541,7 +1526,6 @@ function SignUp({
|
|
|
1541
1526
|
setOauthLoading(provider);
|
|
1542
1527
|
setError("");
|
|
1543
1528
|
const redirectTo = `${window.location.origin}/auth/callback`;
|
|
1544
|
-
sessionStorage.setItem("oauth_final_destination", afterSignUpUrl || "/");
|
|
1545
1529
|
await insforge.auth.signInWithOAuth({
|
|
1546
1530
|
provider,
|
|
1547
1531
|
redirectTo
|
|
@@ -1778,10 +1762,7 @@ function InsforgeCallback({
|
|
|
1778
1762
|
}
|
|
1779
1763
|
return;
|
|
1780
1764
|
}
|
|
1781
|
-
const accessToken = searchParams.get("access_token")
|
|
1782
|
-
const userId = searchParams.get("user_id");
|
|
1783
|
-
const email = searchParams.get("email");
|
|
1784
|
-
const name = searchParams.get("name");
|
|
1765
|
+
const accessToken = searchParams.get("access_token");
|
|
1785
1766
|
if (!accessToken) {
|
|
1786
1767
|
const errorMsg = "no_token";
|
|
1787
1768
|
if (onError) {
|
|
@@ -1797,10 +1778,7 @@ function InsforgeCallback({
|
|
|
1797
1778
|
return;
|
|
1798
1779
|
}
|
|
1799
1780
|
const result = await handleAuthCallback({
|
|
1800
|
-
accessToken
|
|
1801
|
-
userId: userId || void 0,
|
|
1802
|
-
email: email || void 0,
|
|
1803
|
-
name: name || void 0
|
|
1781
|
+
accessToken
|
|
1804
1782
|
});
|
|
1805
1783
|
if (!result.success) {
|
|
1806
1784
|
const errorMsg = result.error || "authentication_failed";
|
|
@@ -2201,16 +2179,9 @@ function getInsforgeRoutes(config) {
|
|
|
2201
2179
|
signUp = "/sign-up",
|
|
2202
2180
|
verifyEmail = "/verify-email",
|
|
2203
2181
|
forgotPassword = "/forgot-password",
|
|
2204
|
-
resetPassword = "/reset-password"
|
|
2205
|
-
callback = "/auth/callback"
|
|
2182
|
+
resetPassword = "/reset-password"
|
|
2206
2183
|
} = paths;
|
|
2207
|
-
const routes = [
|
|
2208
|
-
// Always include callback route
|
|
2209
|
-
{
|
|
2210
|
-
path: callback,
|
|
2211
|
-
element: /* @__PURE__ */ jsx(InsforgeCallback, {})
|
|
2212
|
-
}
|
|
2213
|
-
];
|
|
2184
|
+
const routes = [];
|
|
2214
2185
|
if (builtInAuth) {
|
|
2215
2186
|
routes.push(
|
|
2216
2187
|
{
|