authera 1.2.8-test-8 → 1.2.8-test-10

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.
@@ -1,12 +1,5 @@
1
1
  import { userBaseData } from "../helper/context";
2
2
  export declare function useAuth<T extends string>(): {
3
- backendUrl: string;
4
- storage: import("../helper/storage").storagesNames | import("../helper/storage").customeFunc;
5
- tokenType: "jwt";
6
- refreshStrategy: "silent";
7
- fallback_401_url: string;
8
- on_after_login?: (response_data: any) => void;
9
- on_after_step?: (step_key: string) => void;
10
3
  permits: T[];
11
4
  isPermitted: (perm: T) => boolean;
12
5
  on: (perm: T, callback: () => void, fallback?: () => void) => void;
@@ -68,6 +68,6 @@ export function useAuth() {
68
68
  setAccessToken,
69
69
  setRefreshToken,
70
70
  logout,
71
- ...authera_props,
71
+ // ...authera_props,
72
72
  };
73
73
  }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,7 @@
1
- import { customeFunc, storagesNames } from "./helper/storage";
2
1
  import { type AuthHookSettings } from "./helper/types";
3
2
  export default function AuthHook<T extends string>(props: AuthHookSettings<T>): {
4
3
  createAuthProvider: (children: React.ReactNode) => React.ReactNode;
5
4
  useAuth: () => {
6
- backendUrl: string;
7
- storage: storagesNames | customeFunc;
8
- tokenType: "jwt";
9
- refreshStrategy: "silent";
10
- fallback_401_url: string;
11
- on_after_login?: (response_data: any) => void;
12
- on_after_step?: (step_key: string) => void;
13
5
  permits: T[];
14
6
  isPermitted: (perm: T) => boolean;
15
7
  on: (perm: T, callback: () => void, fallback?: (() => void) | undefined) => void;
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export default function AuthHook(props) {
13
13
  return {
14
14
  createAuthProvider: (children) => (_jsx(AuthProvider, { storage: storage, authera_props: props, children: children })),
15
15
  useAuth: () => useAuth(),
16
- LoginScenario: () => (_jsx(LoginForm, { on_after_login: props.on_after_login, on_after_step: props.on_after_step })),
16
+ LoginScenario: () => (_jsx(LoginForm, { on_after_login: props.on_after_login, on_after_step: props.on_after_step, backendUrl: props.backendUrl })),
17
17
  };
18
18
  }
19
19
  export { default as AuthGuard } from "./web/guard";
@@ -1,6 +1,7 @@
1
1
  interface LoginFormProps {
2
2
  on_after_login?: (response_data: any) => void;
3
3
  on_after_step?: (step_key: string) => void;
4
+ backendUrl: string;
4
5
  }
5
- export default function LoginForm({ on_after_login, on_after_step, }: LoginFormProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function LoginForm({ on_after_login, on_after_step, backendUrl, }: LoginFormProps): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
package/dist/web/login.js CHANGED
@@ -4,15 +4,13 @@ import { convertFromSchema } from "minimal-form";
4
4
  import EasyForm from "minimal-form";
5
5
  import { useEffect, useState } from "react";
6
6
  import { useForm } from "react-hook-form";
7
- import { useAuth } from "../hooks/useAuth";
8
- export default function LoginForm({ on_after_login, on_after_step, }) {
7
+ export default function LoginForm({ on_after_login, on_after_step, backendUrl, }) {
9
8
  const [steps, stepsHnadler] = useState();
10
9
  const [activeStep, activeStepHandler] = useState();
11
10
  const [loading, loadingHandler] = useState(true);
12
11
  const [userID, userIDHandler] = useState("");
13
12
  const [stepPayload, stepPayloadHandler] = useState({});
14
13
  const { handleSubmit, control } = useForm();
15
- const { backendUrl, setUserData, setPermits } = useAuth();
16
14
  const request = axios.create({
17
15
  baseURL: backendUrl,
18
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authera",
3
- "version": "1.2.8-test-8",
3
+ "version": "1.2.8-test-10",
4
4
  "description": "this project is a simple auth hook for react",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",