@frontegg/react 3.0.13 → 3.0.14

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 (2) hide show
  1. package/README.md +70 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Frontegg React
2
+
3
+ ![alt text](https://fronteggstuff.blob.core.windows.net/frongegg-logos/logo-transparent.png)
4
+
5
+ Frontegg is a web platform where SaaS companies can set up their fully managed, scalable and brand aware - SaaS features
6
+ and integrate them into their SaaS portals in up to 5 lines of code.
7
+
8
+ ## BREAKING CHANGES SINCE VERSION 2.1.0
9
+
10
+ ### The new @frontegg/react uses AdminPortal and LoginBox instead of multiple components.
11
+
12
+ ## Installation
13
+
14
+ Use the package manager [npm](https://www.npmjs.com/) to install frontegg React.JS library.
15
+
16
+ ```bash
17
+ npm install @frontegg/react
18
+ ```
19
+
20
+ ## Configuration
21
+
22
+ Wrap your application with `Frontegg Provider`:
23
+
24
+ ```js
25
+ import { FronteggProvider } from '@frontegg/react'
26
+
27
+ const contextOptions = {
28
+ baseUrl: 'https://{HOST}.frontegg.com', // Your backend base URL (frontegg will direct the requests to it)
29
+ }
30
+
31
+ export const App = () => {
32
+ return <FronteggProvider contextOptions={contextOptions}>
33
+ {/*...*/}
34
+ </FronteggProvider>
35
+ }
36
+
37
+ ```
38
+
39
+ ### Usage
40
+
41
+ You can use React Hooks to access Frontegg store.
42
+
43
+ ```js
44
+ import { useAuthUser } from '@frontegg/react'
45
+
46
+ const HomePage = () => {
47
+ const user = useAuthUser();
48
+
49
+ return <div>
50
+ Logged In user: {user.email}
51
+ </div>
52
+ }
53
+ ```
54
+
55
+ Openning the Admin Portal is available via the following code snippet.
56
+
57
+ ```js
58
+ import { AdminPortal } from '@frontegg/react'
59
+
60
+ const Toolbar = () => {
61
+
62
+ return <nav>
63
+ {/*... your application tabs ...*/}
64
+
65
+ <button onClick={() => AdminPortal.show()}>
66
+ Open Admin Portal
67
+ </button>
68
+ </nav>
69
+ }
70
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/react",
3
3
  "libName": "FronteggReact",
4
- "version": "3.0.13",
4
+ "version": "3.0.14",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "test": "jest --runInBand --passWithNoTests -c ../../scripts/jest.config.json --rootDir ."
12
12
  },
13
13
  "dependencies": {
14
- "@frontegg/admin-portal": "4.32.1",
15
- "@frontegg/react-hooks": "4.32.1",
14
+ "@frontegg/admin-portal": "4.32.2",
15
+ "@frontegg/react-hooks": "4.32.2",
16
16
  "react-router-dom": ">5.0.0"
17
17
  },
18
18
  "peerDependencies": {