@asgardeo/auth-react 5.1.2 → 5.2.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.
Files changed (44) hide show
  1. package/LICENSE +201 -0
  2. package/dist/types/src/actions.d.ts.map +1 -0
  3. package/dist/types/src/api.d.ts.map +1 -0
  4. package/dist/types/src/authenticate.d.ts.map +1 -0
  5. package/dist/types/src/authenticated-component.d.ts.map +1 -0
  6. package/dist/types/src/index.d.ts.map +1 -0
  7. package/dist/types/src/models.d.ts.map +1 -0
  8. package/dist/types/src/public-api.d.ts.map +1 -0
  9. package/dist/types/src/reducer.d.ts.map +1 -0
  10. package/dist/types/src/secure-app.d.ts.map +1 -0
  11. package/package.json +9 -2
  12. package/.eslintignore +0 -2
  13. package/.eslintrc.js +0 -166
  14. package/babel.config.js +0 -43
  15. package/dist/src/actions.d.ts.map +0 -1
  16. package/dist/src/api.d.ts.map +0 -1
  17. package/dist/src/authenticate.d.ts.map +0 -1
  18. package/dist/src/authenticated-component.d.ts.map +0 -1
  19. package/dist/src/index.d.ts.map +0 -1
  20. package/dist/src/models.d.ts.map +0 -1
  21. package/dist/src/public-api.d.ts.map +0 -1
  22. package/dist/src/reducer.d.ts.map +0 -1
  23. package/dist/src/secure-app.d.ts.map +0 -1
  24. package/dist/tsconfig.tsbuildinfo +0 -1
  25. package/src/actions.ts +0 -51
  26. package/src/api.ts +0 -466
  27. package/src/authenticate.tsx +0 -325
  28. package/src/authenticated-component.tsx +0 -43
  29. package/src/index.ts +0 -23
  30. package/src/models.ts +0 -138
  31. package/src/public-api.ts +0 -22
  32. package/src/reducer.ts +0 -68
  33. package/src/secure-app.tsx +0 -83
  34. package/tsconfig.json +0 -26
  35. package/webpack.config.js +0 -94
  36. /package/dist/{src → types/src}/actions.d.ts +0 -0
  37. /package/dist/{src → types/src}/api.d.ts +0 -0
  38. /package/dist/{src → types/src}/authenticate.d.ts +0 -0
  39. /package/dist/{src → types/src}/authenticated-component.d.ts +0 -0
  40. /package/dist/{src → types/src}/index.d.ts +0 -0
  41. /package/dist/{src → types/src}/models.d.ts +0 -0
  42. /package/dist/{src → types/src}/public-api.d.ts +0 -0
  43. /package/dist/{src → types/src}/reducer.d.ts +0 -0
  44. /package/dist/{src → types/src}/secure-app.d.ts +0 -0
@@ -1,83 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
3
- *
4
- * WSO2 Inc. licenses this file to you under the Apache License,
5
- * Version 2.0 (the "License"); you may not use this file except
6
- * in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing,
12
- * software distributed under the License is distributed on an
13
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- * KIND, either express or implied. See the License for the
15
- * specific language governing permissions and limitations
16
- * under the License.
17
- */
18
-
19
- import React, { FunctionComponent, PropsWithChildren, ReactElement, Suspense, useEffect } from "react";
20
- import { useAuthContext } from "./authenticate";
21
- import { AuthenticatedComponent } from "./authenticated-component";
22
-
23
- /**
24
- * Prop types of the `SecureApp` component.
25
- */
26
- interface SecureAppPropsInterface {
27
- children?: React.ReactNode;
28
- /**
29
- * The fallback component to be shown during a sign in attempt.
30
- */
31
- fallback?: React.ReactNode;
32
- /**
33
- * The callback function to be fired after a successful login.
34
- */
35
- onSignIn?: () => void;
36
- /**
37
- * The sign in method to be called. By default `SecureApp` uses the default `signIn` method.
38
- * If you want to use a custom sign in method, you can pass it here. For example, if you use the `form_post`
39
- * method to retrieve the authorization code, then you can call the `signIn` with the code within this method.
40
- */
41
- overrideSignIn?: () => Promise<void>;
42
- }
43
-
44
- /**
45
- * This component can be used to secure a React application. This component renders its children
46
- * only if the user is signed-in. If the user is not signed in, then this component automatically attempts
47
- * to sign the user in using the default `signIn` method or using the `overrideSignIn` method passed as a prop.
48
- *
49
- *
50
- * @param props {SecureAppPropsInterface}
51
- *
52
- * @returns SecureApp component
53
- */
54
- export const SecureApp: FunctionComponent<PropsWithChildren<SecureAppPropsInterface>> = (
55
- props: PropsWithChildren<SecureAppPropsInterface>): ReactElement => {
56
-
57
- const { children, fallback, onSignIn, overrideSignIn } = props;
58
-
59
- const { state: { isAuthenticated, isLoading }, signIn } = useAuthContext();
60
-
61
- useEffect(() => {
62
- if (!isAuthenticated && !isLoading) {
63
- (async () => {
64
- if (overrideSignIn && typeof overrideSignIn === "function") {
65
- await overrideSignIn();
66
- } else {
67
- await signIn();
68
- }
69
- })();
70
- }
71
-
72
- isAuthenticated && onSignIn && typeof onSignIn === "function" && onSignIn();
73
-
74
- }, [ isAuthenticated, isLoading ]);
75
-
76
- return (
77
- <AuthenticatedComponent fallback={ fallback }>
78
- <Suspense fallback={ fallback }>
79
- { children }
80
- </Suspense>
81
- </AuthenticatedComponent>
82
- );
83
- };
package/tsconfig.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "target": "ES6",
5
- "module": "ESNext",
6
- "moduleResolution": "node",
7
- "noImplicitAny": false,
8
- "jsx": "react",
9
- "resolveJsonModule": true,
10
- "sourceMap": true,
11
- "noLib": false,
12
- "suppressImplicitAnyIndexErrors": true,
13
- "experimentalDecorators": true,
14
- "declaration": true,
15
- "composite": true,
16
- "declarationMap": true,
17
- "baseUrl": "src",
18
- "paths": {
19
- "*": ["types/*"]
20
- },
21
- "outDir": "./dist",
22
- "skipLibCheck": true
23
- },
24
- "compileOnSave": false,
25
- "exclude": ["node_modules", "test-configs", "src/**/tests/*", "**/*.test.ts", "**/node_modules"]
26
- }
package/webpack.config.js DELETED
@@ -1,94 +0,0 @@
1
- /**
2
- * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
3
- *
4
- * WSO2 Inc. licenses this file to you under the Apache License,
5
- * Version 2.0 (the "License"); you may not use this file except
6
- * in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing,
12
- * software distributed under the License is distributed on an
13
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- * KIND, either express or implied. See the License for the
15
- * specific language governing permissions and limitations
16
- * under the License.
17
- */
18
-
19
- const path = require("path");
20
- const ESLintPlugin = require("eslint-webpack-plugin");
21
-
22
- // Name of the UMD bundle.
23
- const LIBRARY_NAME = "AsgardeoAuth";
24
-
25
- // Flag to enable source maps in production.
26
- const IS_SOURCE_MAPS_ENABLED_IN_PRODUCTION = false;
27
-
28
- module.exports = (env) => {
29
-
30
- // Build Environments.
31
- const isProduction = env.NODE_ENV === "production";
32
- const isDevelopment = env.NODE_ENV === "development";
33
-
34
- return {
35
- devtool: isProduction
36
- ? IS_SOURCE_MAPS_ENABLED_IN_PRODUCTION
37
- ? "source-map"
38
- : false
39
- : isDevelopment && "eval-cheap-module-source-map",
40
- entry: "./src/index.ts",
41
- externals: [
42
- {
43
- "react": {
44
- commonjs: "react",
45
- commonjs2: "react",
46
- root: "React",
47
- umd: "react"
48
- },
49
- "react-dom": {
50
- commonjs: "react-dom",
51
- commonjs2: "react-dom",
52
- root: "ReactDOM",
53
- umd: "react-dom"
54
- },
55
- "react-router-dom": {
56
- commonjs: "react-router-dom",
57
- commonjs2: "react-router-dom",
58
- root: "ReactRouter",
59
- umd: "react-router-dom"
60
- }
61
- }
62
- ],
63
- mode: isProduction ? "production" : "development",
64
- module: {
65
- rules: [
66
- {
67
- test: /\.worker\.ts$/,
68
- use: {
69
- loader: "worker-loader",
70
- options: {
71
- inline: true
72
- }
73
- }
74
- },
75
- {
76
- exclude: /(node_modules|dist)/,
77
- test: /\.(tsx|jsx|ts|js)?$/,
78
- use: "babel-loader"
79
- }
80
- ]
81
- },
82
- output: {
83
- filename: "main.js",
84
- globalObject: "this",
85
- library: LIBRARY_NAME,
86
- libraryTarget: "umd",
87
- path: path.resolve(__dirname, "dist")
88
- },
89
- plugins: [ new ESLintPlugin()],
90
- resolve: {
91
- extensions: [".tsx", ".ts", ".js"]
92
- }
93
- };
94
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes