@rpcbase/client 0.174.1-pagerouterauth.0 → 0.175.0

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,9 +1,6 @@
1
1
  /* @flow */
2
- import assert from "assert"
3
-
4
- import page from "../../page"
5
- import getInitials from "../../helpers/getInitials"
6
- import Avatar from "../../ui/Avatar"
2
+ import getInitials from "../../../helpers/getInitials"
3
+ import Avatar from "../../../ui/Avatar"
7
4
 
8
5
  import "./account-list-item.scss"
9
6
 
@@ -47,7 +44,7 @@ const getUserName = (user) => {
47
44
  return name
48
45
  }
49
46
 
50
- const AccountListItem = ({account, onClick, avatarProps}) => {
47
+ export const AccountListItem = ({account, onClick, avatarProps}) => {
51
48
 
52
49
  return (
53
50
  <div
@@ -62,5 +59,3 @@ const AccountListItem = ({account, onClick, avatarProps}) => {
62
59
  </div>
63
60
  )
64
61
  }
65
-
66
- export default AccountListItem
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
- import AccountListItem from "./AccountListItem"
2
+ import {AccountListItem} from "./AccountListItem"
3
3
 
4
4
 
5
- const AccountsList = ({accounts}) => {
5
+ export const AccountsList = ({accounts}) => {
6
6
 
7
7
  return (
8
8
  <>
@@ -15,5 +15,3 @@ const AccountsList = ({accounts}) => {
15
15
  </>
16
16
  )
17
17
  }
18
-
19
- export default AccountsList
@@ -1,8 +1,7 @@
1
1
  /* @flow */
2
-
3
2
  const year = (new Date).getFullYear()
4
3
 
5
- const Footer = ({name}) => {
4
+ export const Footer = ({name}) => {
6
5
 
7
6
  return (
8
7
  <footer className="pt-5 my-5 text-muted border-top">
@@ -10,5 +9,3 @@ const Footer = ({name}) => {
10
9
  </footer>
11
10
  )
12
11
  }
13
-
14
- export default Footer
@@ -4,14 +4,13 @@ import {useHash} from "react-use"
4
4
  import {ActivityIndicator} from "react-native"
5
5
  import isEmail from "validator/lib/isEmail"
6
6
 
7
- import post from "../../helpers/post"
7
+ import post from "../../../helpers/post"
8
8
 
9
- import {setIsSignedIn} from "../index"
10
- import Footer from "../Footer"
9
+ import {Footer} from "../Footer"
11
10
 
12
11
  import "./forgot-password.scss"
13
12
 
14
- const ForgotPassword = ({name, logo}) => {
13
+ export const ForgotPassword = ({name, logo}) => {
15
14
  const [hash, setHash] = useHash()
16
15
 
17
16
  const [isLoading, setIsLoading] = useState(false)
@@ -113,5 +112,3 @@ const ForgotPassword = ({name, logo}) => {
113
112
  </div>
114
113
  )
115
114
  }
116
-
117
- export default ForgotPassword
@@ -2,16 +2,14 @@
2
2
  import {useState, useEffect} from "react"
3
3
  import {useSearchParam} from "react-use"
4
4
  import {ActivityIndicator} from "react-native"
5
- import isEmail from "validator/lib/isEmail"
6
5
 
7
- import post from "../../helpers/post"
6
+ import post from "../../../helpers/post"
8
7
 
9
- import {setIsSignedIn} from "../index"
10
- import Footer from "../Footer"
8
+ import {Footer} from "../Footer"
11
9
 
12
10
  import "./set-new-password.scss"
13
11
 
14
- const SetNewPassword = ({name, logo}) => {
12
+ export const SetNewPassword = ({name, logo}) => {
15
13
  const [isLoading, setIsLoading] = useState(false)
16
14
  const [error, setError] = useState()
17
15
  const [isSuccess, setIsSuccess] = useState(false)
@@ -22,10 +20,6 @@ const SetNewPassword = ({name, logo}) => {
22
20
  const user_id = useSearchParam("uid")
23
21
  const token = useSearchParam("token")
24
22
 
25
- // useEffect(() => {
26
- // console.log("TOKEN", user_id, token)
27
- // }, [user_id, token])
28
-
29
23
  const onSubmit = async(e) => {
30
24
  e.preventDefault()
31
25
 
@@ -134,5 +128,3 @@ const SetNewPassword = ({name, logo}) => {
134
128
  </div>
135
129
  )
136
130
  }
137
-
138
- export default SetNewPassword
@@ -5,15 +5,15 @@ import {useState, useEffect} from "react"
5
5
  import useSearchParam from "react-use/lib/useSearchParam"
6
6
  import isEmail from "validator/lib/isEmail"
7
7
 
8
- import page from "../../page"
9
- import post from "../../helpers/post"
10
- import {reconnect as rts_reconnect} from "../../rts/rts"
11
- import {setIsSignedIn, setUid, setTenantId} from "../index"
8
+ import page from "../../../page"
9
+ import post from "../../../helpers/post"
10
+ import {reconnect as rts_reconnect} from "../../../rts/rts"
11
+ import {setIsSignedIn, setUid, setTenantId} from "../../index"
12
12
 
13
13
 
14
14
  const log = debug("rb:auth:signin")
15
15
 
16
- const SignInEmailForm = ({onSuccess, onSuccessRedirect}) => {
16
+ export const SignInEmailForm = ({onSuccess, onSuccessRedirect}) => {
17
17
  const redirect = useSearchParam("redirect")
18
18
 
19
19
  const [isLoading, setIsLoading] = useState(false)
@@ -111,5 +111,3 @@ const SignInEmailForm = ({onSuccess, onSuccessRedirect}) => {
111
111
  </form>
112
112
  )
113
113
  }
114
-
115
- export default SignInEmailForm
@@ -3,10 +3,10 @@ import assert from "assert"
3
3
 
4
4
  import authConfig from "@rpcbase/dot-rb/auth"
5
5
 
6
- import {AUTH_BUTTONS} from "../../src/ui/oauth"
7
- import Footer from "../Footer"
6
+ import {AUTH_BUTTONS} from "../../../src/ui/oauth"
7
+ import {Footer} from "../Footer"
8
8
 
9
- import SignInEmailForm from "./SignInEmailForm"
9
+ import {SignInEmailForm} from "./SignInEmailForm"
10
10
 
11
11
  import "./sign-in.scss"
12
12
 
@@ -14,7 +14,7 @@ import "./sign-in.scss"
14
14
  const hasOAuth = authConfig.oauth_providers?.length > 0
15
15
  const hasEmail = authConfig.has_email_signup
16
16
 
17
- const SignIn = ({
17
+ export const SignIn = ({
18
18
  name,
19
19
  logo,
20
20
  onSuccessRedirect = "/",
@@ -66,5 +66,3 @@ const SignIn = ({
66
66
  </div>
67
67
  )
68
68
  }
69
-
70
- export default SignIn
@@ -1,18 +1,16 @@
1
1
  /* @flow */
2
2
  import assert from "assert"
3
3
  import {useState, useEffect} from "react"
4
- import {ActivityIndicator} from "react-native"
5
4
  import Alert from "react-bootstrap/Alert"
6
5
 
7
6
  import authConfig from "@rpcbase/dot-rb/auth"
8
7
 
9
- import page from "../../page"
10
- import {sign_out} from "../sign_out"
8
+ import {signOut} from "../../signOut"
11
9
 
12
- import post from "../../helpers/post"
10
+ import post from "../../../helpers/post"
13
11
 
14
- import AccountListItem from "../AccountsList/AccountListItem"
15
- import Footer from "../Footer"
12
+ import {AccountListItem} from "../AccountsList/AccountListItem"
13
+ import {Footer} from "../Footer"
16
14
 
17
15
  import "./sign-out.scss"
18
16
 
@@ -20,7 +18,7 @@ import "./sign-out.scss"
20
18
  // TODO: clear cache + db
21
19
  const hasMultiAccounts = authConfig.has_multi_accounts
22
20
 
23
- const SignOut = ({
21
+ export const SignOut = ({
24
22
  logo,
25
23
  name,
26
24
  onSignOutSuccess = () => null
@@ -45,11 +43,11 @@ const SignOut = ({
45
43
  }, [])
46
44
 
47
45
 
48
- const signOut = async() => {
46
+ const onSignOut = async() => {
49
47
  // TODO: NYI handle sign out from multiple accounts here
50
48
  const res = await post("/api/v1/auth/sign_out")
51
49
  if (res.status === "ok") {
52
- sign_out()
50
+ signOut()
53
51
  setIsSignedOut(true)
54
52
  onSignOutSuccess()
55
53
  } else {
@@ -60,7 +58,7 @@ const SignOut = ({
60
58
 
61
59
  const onSubmit = () => {
62
60
  console.log("sign out from selected accounts", selectedAccounts)
63
- signOut()
61
+ onSignOut()
64
62
  }
65
63
 
66
64
  const message = hasMultiAccounts ? "Select accounts to sign out of:" : "Click here to sign out of your account:"
@@ -134,5 +132,3 @@ const SignOut = ({
134
132
  </div>
135
133
  )
136
134
  }
137
-
138
- export default SignOut
@@ -1,14 +1,14 @@
1
1
  /* @flow */
2
2
  import {useState} from "react"
3
3
 
4
- import page from "../../page"
5
- import {reconnect as rts_reconnect} from "../../rts/rts"
4
+ import page from "../../../page"
5
+ import {reconnect as rts_reconnect} from "../../../rts/rts"
6
6
 
7
- import {setIsSignedIn, setUid, setTenantId} from "../index"
8
- import post from "../../helpers/post"
7
+ import {setIsSignedIn, setUid, setTenantId} from "../../index"
8
+ import post from "../../../helpers/post"
9
9
 
10
10
 
11
- const SignUpEmailForm = ({onSuccessRedirect, onSuccess}) => {
11
+ export const SignUpEmailForm = ({onSuccessRedirect, onSuccess}) => {
12
12
  const [email, setEmail] = useState("")
13
13
  const [password, setPassword] = useState("")
14
14
  const [passwordConfirm, setPasswordConfirm] = useState("")
@@ -97,5 +97,3 @@ const SignUpEmailForm = ({onSuccessRedirect, onSuccess}) => {
97
97
  </>
98
98
  )
99
99
  }
100
-
101
- export default SignUpEmailForm
@@ -3,11 +3,11 @@ import assert from "assert"
3
3
 
4
4
  import authConfig from "@rpcbase/dot-rb/auth"
5
5
 
6
- import {AUTH_BUTTONS} from "../../src/ui/oauth"
6
+ import {AUTH_BUTTONS} from "../../../src/ui/oauth"
7
7
 
8
- import Footer from "../Footer"
8
+ import {Footer} from "../Footer"
9
9
 
10
- import SignUpEmailForm from "./SignUpEmailForm"
10
+ import {SignUpEmailForm} from "./SignUpEmailForm"
11
11
 
12
12
  import "./sign-up.scss"
13
13
 
@@ -15,7 +15,7 @@ import "./sign-up.scss"
15
15
  const hasOAuth = authConfig.oauth_providers?.length > 0
16
16
  const hasEmail = authConfig.has_email_signup
17
17
 
18
- const SignUp = ({
18
+ export const SignUp = ({
19
19
  logo,
20
20
  name,
21
21
  onSuccessRedirect = "/",
@@ -64,5 +64,3 @@ const SignUp = ({
64
64
  </div>
65
65
  )
66
66
  }
67
-
68
- export default SignUp
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  import {setIsSignedIn, setUid, setTenantId} from "./index"
3
3
 
4
- export const sign_out = () => {
4
+ export const signOut = () => {
5
5
  setUid(null)
6
6
  setTenantId(null)
7
7
  setIsSignedIn(false)
@@ -2,11 +2,11 @@ import {useState} from "react"
2
2
 
3
3
  import page from "../page"
4
4
 
5
- import SignIn from "./SignIn"
6
- import SignUp from "./SignUp"
7
- import SignOut from "./SignOut"
8
- import ForgotPassword from "./ForgotPassword"
9
- import SetNewPassword from "./SetNewPassword"
5
+ import {SignIn} from "./components/SignIn"
6
+ import {SignUp} from "./components/SignUp"
7
+ import {SignOut} from "./components/SignOut"
8
+ import {ForgotPassword} from "./components/ForgotPassword"
9
+ import {SetNewPassword} from "./components/SetNewPassword"
10
10
  import { getAuthProps } from "./authProps"
11
11
 
12
12
  const hasInitialized = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.174.1-pagerouterauth.0",
3
+ "version": "0.175.0",
4
4
  "scripts": {
5
5
  "test": "../../node_modules/.bin/wireit"
6
6
  },
File without changes
File without changes