@ossy/sdk-react 0.4.1 → 0.4.3
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 +1 @@
|
|
|
1
|
-
import{useCallback as t,useEffect as n}from"react";import{useCache as i}from"./Cache.js";import{useSdk as
|
|
1
|
+
import{useCallback as t,useEffect as n}from"react";import{useCache as i}from"./Cache.js";import{useSdk as e}from"./useSdk.js";var r={AuthenticationError:"AuthenticationError",NotInitialized:"NotInitialized",NotAuthenticated:"NotAuthenticated",Verifying:"Verifying",Authenticated:"Authenticated",VerifySignIn:"VerifySignIn"},u=["auth","status"],o=function(){var o=e(),c=i(u),f=c.data,a=void 0===f?r.NotInitialized:f,h=c.set,s=t(function(t){return h(function(){return r.Verifying}),o.auth.signUp({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),g=t(function(t){return h(function(){return r.Verifying}),o.auth.signIn({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),d=t(function(t){return h(function(){return r.Verifying}),o.auth.verifySignIn({token:t}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),A=t(function(t,n){return h(function(){return r.Verifying}),o.auth.verifyInvitation({workspaceId:t,token:n}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),y=t(function(){return o.auth.signOff().then(function(){return h(r.NotAuthenticated)})},[o]);return n(function(){a===r.NotInitialized&&(h(function(){return r.Verifying}),o.auth.getAuthenticatedUser().then(function(t){if(!t)return Promise.reject();h(function(){return r.Authenticated})}).catch(function(){h(function(){return r.NotAuthenticated})}))},[a]),{status:a,signUp:s,signIn:g,signOff:y,verifySignIn:d,verifyInvitation:A}};export{r as AuthenticationStatus,o as useAuthentication};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk-react",
|
|
3
3
|
"description": "Sofware Development Kit React",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"url": "git://github.com/ossy-se/packages/sdk-react",
|
|
6
6
|
"source": "src/public.index.ts",
|
|
7
7
|
"module": "build/sdk-react/src/public.index.js",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"/build",
|
|
57
57
|
"README.md"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8449a9e996f4bc10ba4253ca216f818f155f5bf3"
|
|
60
60
|
}
|