@insforge/react 0.4.11 → 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/dist/atoms.cjs +21 -5
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.js +21 -5
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +26 -10
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +26 -10
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +21 -5
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js +21 -5
- package/dist/forms.js.map +1 -1
- package/dist/hooks.cjs +2 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +58 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +56 -49
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +1 -0
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +1 -0
- package/dist/lib.js.map +1 -1
- package/dist/navigation.cjs +53 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.cts +64 -0
- package/dist/navigation.d.ts +64 -0
- package/dist/navigation.js +48 -0
- package/dist/navigation.js.map +1 -0
- package/package.json +6 -7
- package/dist/router.cjs +0 -44
- package/dist/router.cjs.map +0 -1
- package/dist/router.d.cts +0 -79
- package/dist/router.d.ts +0 -79
- package/dist/router.js +0 -42
- package/dist/router.js.map +0 -1
package/dist/components.cjs
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
|
-
var reactRouterDom = require('react-router-dom');
|
|
5
|
-
require('@insforge/sdk');
|
|
6
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
require('@insforge/sdk');
|
|
7
6
|
var lucideReact = require('lucide-react');
|
|
8
7
|
var zod = require('zod');
|
|
9
8
|
|
|
9
|
+
// src/components/SignIn.tsx
|
|
10
|
+
var NavigationContext = react.createContext(null);
|
|
11
|
+
function useNavigationAdapter() {
|
|
12
|
+
const adapter = react.useContext(NavigationContext);
|
|
13
|
+
if (!adapter) {
|
|
14
|
+
throw new Error("useNavigationAdapter must be used within NavigationProvider");
|
|
15
|
+
}
|
|
16
|
+
return adapter;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/navigation/useSearchParams.ts
|
|
20
|
+
function useSearchParams() {
|
|
21
|
+
const adapter = useNavigationAdapter();
|
|
22
|
+
return adapter.useSearchParams();
|
|
23
|
+
}
|
|
10
24
|
var InsforgeContext = react.createContext(void 0);
|
|
11
25
|
function useInsforge() {
|
|
12
26
|
const context = react.useContext(InsforgeContext);
|
|
@@ -224,7 +238,8 @@ function AuthPasswordField({
|
|
|
224
238
|
onFocus,
|
|
225
239
|
...props
|
|
226
240
|
}) {
|
|
227
|
-
const
|
|
241
|
+
const searchParams = useSearchParams();
|
|
242
|
+
const { Link } = useNavigationAdapter();
|
|
228
243
|
const [showPassword, setShowPassword] = react.useState(false);
|
|
229
244
|
const [showStrength, setShowStrength] = react.useState(false);
|
|
230
245
|
const resolvedForgotPasswordHref = react.useMemo(
|
|
@@ -240,7 +255,7 @@ function AuthPasswordField({
|
|
|
240
255
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
|
|
241
256
|
(label || forgotPasswordLink) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-labelRow", children: [
|
|
242
257
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
|
|
243
|
-
forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsxRuntime.jsx(
|
|
258
|
+
forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsxRuntime.jsx(Link, { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
|
|
244
259
|
] }),
|
|
245
260
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-inputWrapper", children: [
|
|
246
261
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -292,12 +307,13 @@ function AuthSubmitButton({
|
|
|
292
307
|
);
|
|
293
308
|
}
|
|
294
309
|
function AuthLink({ text, linkText, href }) {
|
|
295
|
-
const
|
|
310
|
+
const searchParams = useSearchParams();
|
|
311
|
+
const { Link } = useNavigationAdapter();
|
|
296
312
|
const finalHref = resolveAuthUrl(href, searchParams);
|
|
297
313
|
return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
|
|
298
314
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-authLink-text", children: text }),
|
|
299
315
|
text && " ",
|
|
300
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
/* @__PURE__ */ jsxRuntime.jsx(Link, { href: finalHref, className: "if-authLink-link", children: linkText })
|
|
301
317
|
] });
|
|
302
318
|
}
|
|
303
319
|
function AuthDivider({ text = "or" }) {
|
|
@@ -937,7 +953,7 @@ function SignIn({ onError, ...uiProps }) {
|
|
|
937
953
|
const [loading, setLoading] = react.useState(false);
|
|
938
954
|
const [step, setStep] = react.useState("form");
|
|
939
955
|
const [oauthLoading] = react.useState(null);
|
|
940
|
-
const
|
|
956
|
+
const searchParams = useSearchParams();
|
|
941
957
|
const redirectUrl = searchParams.get("redirect");
|
|
942
958
|
async function handleSubmit(e) {
|
|
943
959
|
e.preventDefault();
|
|
@@ -1146,7 +1162,7 @@ function SignUp({ onError, ...uiProps }) {
|
|
|
1146
1162
|
const [loading, setLoading] = react.useState(false);
|
|
1147
1163
|
const [step, setStep] = react.useState("form");
|
|
1148
1164
|
const [oauthLoading] = react.useState(null);
|
|
1149
|
-
const
|
|
1165
|
+
const searchParams = useSearchParams();
|
|
1150
1166
|
const redirectUrl = searchParams.get("redirect");
|
|
1151
1167
|
async function handleSubmit(e) {
|
|
1152
1168
|
e.preventDefault();
|
|
@@ -1411,7 +1427,7 @@ function ResetPasswordForm({
|
|
|
1411
1427
|
function ForgotPassword({ onError, ...uiProps }) {
|
|
1412
1428
|
const { sendResetPasswordEmail, exchangeResetPasswordToken, resetPassword } = useInsforge();
|
|
1413
1429
|
const { authConfig } = usePublicAuthConfig();
|
|
1414
|
-
const
|
|
1430
|
+
const searchParams = useSearchParams();
|
|
1415
1431
|
const [step, setStep] = react.useState("email");
|
|
1416
1432
|
const [email, setEmail] = react.useState("");
|
|
1417
1433
|
const [resetToken, setResetToken] = react.useState("");
|
|
@@ -1567,7 +1583,7 @@ function ForgotPassword({ onError, ...uiProps }) {
|
|
|
1567
1583
|
);
|
|
1568
1584
|
}
|
|
1569
1585
|
function ResetPassword({ onError, ...uiProps }) {
|
|
1570
|
-
const
|
|
1586
|
+
const searchParams = useSearchParams();
|
|
1571
1587
|
const token = searchParams.get("token");
|
|
1572
1588
|
const { resetPassword } = useInsforge();
|
|
1573
1589
|
const { authConfig } = usePublicAuthConfig();
|