@equinor/mad-auth 0.0.11 → 0.0.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @equinor/mad-auth
2
2
 
3
+ ## 0.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 5a071fb: added scopes prop to the login button
8
+ - Updated dependencies [c2f7949]
9
+ - Updated dependencies [b8b7a72]
10
+ - Updated dependencies [c2f7949]
11
+ - @equinor/mad-components@0.7.0
12
+
3
13
  ## 0.0.11
4
14
 
5
15
  ### Patch Changes
@@ -14,6 +14,7 @@ var useAuthenticate = ({
14
14
  onAuthenticationSuccessful,
15
15
  clientId,
16
16
  redirectUri,
17
+ scopes,
17
18
  enableAutomaticAuthentication
18
19
  }) => {
19
20
  const [authenticationInProgress, setAuthenticationInProgress] = useState(false);
@@ -37,13 +38,13 @@ var useAuthenticate = ({
37
38
  if (authenticationClientExists())
38
39
  setAuthenticationClientInitialized(true);
39
40
  if (enableAutomaticAuthentication)
40
- withAuthenticationPromiseHandler(authenticateSilently([]));
41
+ withAuthenticationPromiseHandler(authenticateSilently(scopes));
41
42
  });
42
43
  initiateClientAndMaybeAuthenticateSilently();
43
44
  }, []);
44
45
  return {
45
46
  authenticationInProgress,
46
- authenticate: () => withAuthenticationPromiseHandler(authenticateInteractively([])),
47
+ authenticate: () => withAuthenticationPromiseHandler(authenticateInteractively(scopes)),
47
48
  authenticationClientInitialized: authenticationClientExists() && authenticationClientInitialized
48
49
  };
49
50
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useAuthenticate
3
- } from "./chunk-O5YSBQA2.js";
3
+ } from "./chunk-CKRPOC3H.js";
4
4
  import {
5
5
  __objRest,
6
6
  __spreadValues
@@ -15,18 +15,21 @@ var LoginButton = (_a) => {
15
15
  redirectUri,
16
16
  onAuthenticationSuccessful,
17
17
  enableAutomaticAuthentication,
18
+ scopes = [],
18
19
  title = "Log in"
19
20
  } = _b, rest = __objRest(_b, [
20
21
  "clientId",
21
22
  "redirectUri",
22
23
  "onAuthenticationSuccessful",
23
24
  "enableAutomaticAuthentication",
25
+ "scopes",
24
26
  "title"
25
27
  ]);
26
28
  const { authenticate, authenticationInProgress, authenticationClientInitialized } = useAuthenticate({
27
29
  clientId,
28
30
  redirectUri,
29
31
  onAuthenticationSuccessful,
32
+ scopes,
30
33
  enableAutomaticAuthentication
31
34
  });
32
35
  const loginButtonIsDisabled = authenticationInProgress || authenticationClientInitialized == false;
@@ -5,6 +5,7 @@ export type LoginButtonProps = Omit<ButtonProps, "onPress" | "loading" | "disabl
5
5
  redirectUri: string;
6
6
  onAuthenticationSuccessful: () => void;
7
7
  title?: ButtonProps["title"];
8
+ scopes?: string[];
8
9
  enableAutomaticAuthentication?: boolean;
9
10
  };
10
- export declare const LoginButton: ({ clientId, redirectUri, onAuthenticationSuccessful, enableAutomaticAuthentication, title, ...rest }: LoginButtonProps) => React.JSX.Element;
11
+ export declare const LoginButton: ({ clientId, redirectUri, onAuthenticationSuccessful, enableAutomaticAuthentication, scopes, title, ...rest }: LoginButtonProps) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LoginButton
3
- } from "../chunk-VC6L6TBN.js";
4
- import "../chunk-O5YSBQA2.js";
3
+ } from "../chunk-O262MRUN.js";
4
+ import "../chunk-CKRPOC3H.js";
5
5
  import "../chunk-GZV7V4EL.js";
6
6
  import "../chunk-GJUHWXAK.js";
7
7
  export {
@@ -1,8 +1,8 @@
1
1
  import "../chunk-HAB34YS7.js";
2
2
  import {
3
3
  LoginButton
4
- } from "../chunk-VC6L6TBN.js";
5
- import "../chunk-O5YSBQA2.js";
4
+ } from "../chunk-O262MRUN.js";
5
+ import "../chunk-CKRPOC3H.js";
6
6
  import "../chunk-GZV7V4EL.js";
7
7
  import "../chunk-GJUHWXAK.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import "../chunk-GUKC6UGZ.js";
2
2
  import {
3
3
  useAuthenticate
4
- } from "../chunk-O5YSBQA2.js";
4
+ } from "../chunk-CKRPOC3H.js";
5
5
  import {
6
6
  useAccount
7
7
  } from "../chunk-YGQY3H47.js";
@@ -3,6 +3,7 @@ export type UseAuthenticateProps = {
3
3
  onAuthenticationSuccessful: (res: MadAuthenticationResult) => void;
4
4
  redirectUri: string;
5
5
  clientId: string;
6
+ scopes: string[];
6
7
  enableAutomaticAuthentication?: boolean;
7
8
  };
8
9
  type UseAuthenticateResult = {
@@ -15,5 +16,5 @@ type UseAuthenticateResult = {
15
16
  * @param {UseAuthenticateProps} params params for client initialization and authentication flow
16
17
  * @returns authenticate function, and some helper variables
17
18
  */
18
- export declare const useAuthenticate: ({ onAuthenticationSuccessful, clientId, redirectUri, enableAutomaticAuthentication, }: UseAuthenticateProps) => UseAuthenticateResult;
19
+ export declare const useAuthenticate: ({ onAuthenticationSuccessful, clientId, redirectUri, scopes, enableAutomaticAuthentication, }: UseAuthenticateProps) => UseAuthenticateResult;
19
20
  export {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useAuthenticate
3
- } from "../chunk-O5YSBQA2.js";
3
+ } from "../chunk-CKRPOC3H.js";
4
4
  import "../chunk-GZV7V4EL.js";
5
5
  import "../chunk-GJUHWXAK.js";
6
6
  export {
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import "./chunk-6F4PWJZI.js";
2
2
  import "./chunk-HAB34YS7.js";
3
3
  import {
4
4
  LoginButton
5
- } from "./chunk-VC6L6TBN.js";
5
+ } from "./chunk-O262MRUN.js";
6
6
  import "./chunk-GUKC6UGZ.js";
7
7
  import {
8
8
  useAuthenticate
9
- } from "./chunk-O5YSBQA2.js";
9
+ } from "./chunk-CKRPOC3H.js";
10
10
  import {
11
11
  useAccount
12
12
  } from "./chunk-YGQY3H47.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-auth",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A simple wrapper library for react-native-msal",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  "react-native-msal": ">=4.0.4"
27
27
  },
28
28
  "dependencies": {
29
- "@equinor/mad-components": "0.6.9"
29
+ "@equinor/mad-components": "0.7.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@equinor/eslint-config-mad": "0.2.1"
@@ -38,7 +38,7 @@
38
38
  "dist"
39
39
  ],
40
40
  "scripts": {
41
- "build": "tsup-node",
41
+ "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
42
42
  "test": "jest",
43
43
  "dev": "tsup-node --watch --clean=false",
44
44
  "lint": "eslint src/"