@insforge/react 0.4.12 → 0.5.1

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/forms.cjs CHANGED
@@ -3,7 +3,6 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var lucideReact = require('lucide-react');
5
5
  var react = require('react');
6
- var reactRouterDom = require('react-router-dom');
7
6
  require('@insforge/sdk');
8
7
 
9
8
  // src/components/atoms/AuthBranding.tsx
@@ -104,6 +103,20 @@ function AuthFormField({ label, id, ...props }) {
104
103
  /* @__PURE__ */ jsxRuntime.jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
105
104
  ] });
106
105
  }
106
+ var NavigationContext = react.createContext(null);
107
+ function useNavigationAdapter() {
108
+ const adapter = react.useContext(NavigationContext);
109
+ if (!adapter) {
110
+ throw new Error("useNavigationAdapter must be used within NavigationProvider");
111
+ }
112
+ return adapter;
113
+ }
114
+
115
+ // src/navigation/useSearchParams.ts
116
+ function useSearchParams() {
117
+ const adapter = useNavigationAdapter();
118
+ return adapter.useSearchParams();
119
+ }
107
120
  function AuthPasswordStrengthIndicator({
108
121
  password,
109
122
  config
@@ -197,7 +210,8 @@ function AuthPasswordField({
197
210
  onFocus,
198
211
  ...props
199
212
  }) {
200
- const [searchParams] = reactRouterDom.useSearchParams();
213
+ const searchParams = useSearchParams();
214
+ const { Link } = useNavigationAdapter();
201
215
  const [showPassword, setShowPassword] = react.useState(false);
202
216
  const [showStrength, setShowStrength] = react.useState(false);
203
217
  const resolvedForgotPasswordHref = react.useMemo(
@@ -213,7 +227,7 @@ function AuthPasswordField({
213
227
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
214
228
  (label || forgotPasswordLink) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-labelRow", children: [
215
229
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
216
- forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsxRuntime.jsx("a", { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
230
+ forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsxRuntime.jsx(Link, { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
217
231
  ] }),
218
232
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-inputWrapper", children: [
219
233
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -265,12 +279,13 @@ function AuthSubmitButton({
265
279
  );
266
280
  }
267
281
  function AuthLink({ text, linkText, href }) {
268
- const [searchParams] = reactRouterDom.useSearchParams();
282
+ const searchParams = useSearchParams();
283
+ const { Link } = useNavigationAdapter();
269
284
  const finalHref = resolveAuthUrl(href, searchParams);
270
285
  return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
271
286
  text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-authLink-text", children: text }),
272
287
  text && " ",
273
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: finalHref, className: "if-authLink-link", children: linkText })
288
+ /* @__PURE__ */ jsxRuntime.jsx(Link, { href: finalHref, className: "if-authLink-link", children: linkText })
274
289
  ] });
275
290
  }
276
291
  function AuthDivider({ text = "or" }) {
@@ -611,7 +626,32 @@ var InsforgeContext = react.createContext(void 0);
611
626
  function useInsforge() {
612
627
  const context = react.useContext(InsforgeContext);
613
628
  if (!context) {
614
- throw new Error("useInsforge must be used within InsforgeProvider");
629
+ if (typeof window !== "undefined") {
630
+ throw new Error("useInsforge must be used within InsforgeProvider");
631
+ }
632
+ return {
633
+ user: null,
634
+ isLoaded: false,
635
+ isSignedIn: false,
636
+ setUser: () => {
637
+ },
638
+ signIn: async () => ({ error: "SSR mode" }),
639
+ signUp: async () => ({ error: "SSR mode" }),
640
+ signOut: async () => {
641
+ },
642
+ updateUser: async () => {
643
+ },
644
+ reloadAuth: async () => ({ success: false, error: "SSR mode" }),
645
+ sendVerificationEmail: async () => null,
646
+ sendResetPasswordEmail: async () => null,
647
+ resetPassword: async () => null,
648
+ verifyEmail: async () => null,
649
+ exchangeResetPasswordToken: async () => ({ error: { message: "SSR mode" } }),
650
+ loginWithOAuth: async () => {
651
+ },
652
+ getPublicAuthConfig: async () => null,
653
+ baseUrl: ""
654
+ };
615
655
  }
616
656
  return context;
617
657
  }