@corbado/react-sdk
Advanced tools
Comparing version 0.1.7-alpha.1 to 0.1.7-alpha.2
@@ -1,7 +0,6 @@ | ||
import type { CorbadoAppParams, PassKeyList, ProjectConfig, SessionUser, UserAuthMethods } from '@corbado/types'; | ||
/// <reference types="react" /> | ||
import type { PassKeyList, ProjectConfig, SessionUser, UserAuthMethods } from '@corbado/types'; | ||
import type { AppendPasskeyError, AuthMethodsListError, CompleteLoginWithEmailOTPError, CompleteSignupWithEmailOTPError, GetProjectConfigError, InitLoginWithEmailOTPError, InitSignUpWithEmailOTPError, LoginWithPasskeyError, NonRecoverableError, PasskeyDeleteError, PasskeyListError, RecoverableError, SignUpWithPasskeyError } from '@corbado/web-core'; | ||
import type { CorbadoApp } from '@corbado/web-core'; | ||
import { type PropsWithChildren } from 'react'; | ||
import type { Result } from 'ts-results'; | ||
export type AppProviderParams = PropsWithChildren<CorbadoAppParams>; | ||
export interface CorbadoContextProps { | ||
@@ -8,0 +7,0 @@ corbadoApp: CorbadoApp | undefined; |
@@ -1,3 +0,7 @@ | ||
import type { FC } from 'react'; | ||
import type { AppProviderParams } from './CorbadoContext'; | ||
export declare const CorbadoProvider: FC<AppProviderParams>; | ||
import type { CorbadoAppParams } from '@corbado/types'; | ||
import { CorbadoApp } from '@corbado/web-core'; | ||
import type { FC, PropsWithChildren } from 'react'; | ||
export type CorbadoProviderParams = PropsWithChildren<CorbadoAppParams & { | ||
corbadoAppInstance?: CorbadoApp; | ||
}>; | ||
export declare const CorbadoProvider: FC<CorbadoProviderParams>; |
@@ -1,2 +0,2 @@ | ||
export { CorbadoProvider } from './CorbadoProvider'; | ||
export { CorbadoContext, CorbadoContextProps } from './CorbadoContext'; | ||
export * from './CorbadoProvider'; | ||
export * from './CorbadoContext'; |
@@ -1,2 +0,2 @@ | ||
import*as e from"@corbado/web-core";import*as r from"react";var a={d:(e,r)=>{for(var s in r)a.o(r,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},s={};a.d(s,{kr:()=>c,Hg:()=>d,lH:()=>o.InvalidEmailError,bu:()=>o.InvalidFullnameError,zT:()=>o.InvalidOtpInputError,CU:()=>o.InvalidPasskeyError,nJ:()=>o.NoPasskeyAvailableError,X$:()=>o.PasskeyChallengeCancelledError,eA:()=>o.UnknownUserError,k5:()=>o.UserAlreadyExistsError,km:()=>E});const o=(t={CorbadoApp:()=>e.CorbadoApp,InvalidEmailError:()=>e.InvalidEmailError,InvalidFullnameError:()=>e.InvalidFullnameError,InvalidOtpInputError:()=>e.InvalidOtpInputError,InvalidPasskeyError:()=>e.InvalidPasskeyError,NoPasskeyAvailableError:()=>e.NoPasskeyAvailableError,PasskeyChallengeCancelledError:()=>e.PasskeyChallengeCancelledError,UnknownUserError:()=>e.UnknownUserError,UserAlreadyExistsError:()=>e.UserAlreadyExistsError},i={},a.d(i,t),i);var t,i;const l=(e=>{var r={};return a.d(r,e),r})({createContext:()=>r.createContext,default:()=>r.default,useCallback:()=>r.useCallback,useContext:()=>r.useContext,useEffect:()=>r.useEffect,useMemo:()=>r.useMemo,useRef:()=>r.useRef,useState:()=>r.useState}),n=()=>{throw new Error("Please make sure that your components are wrapped inside <CorbadoProvider/>")},u={corbadoApp:void 0,shortSession:void 0,user:void 0,globalError:void 0,loading:!1,signUpWithPasskey:n,loginWithPasskey:n,loginWithConditionalUI:n,initLoginWithEmailOTP:n,completeLoginWithEmailOTP:n,logout:n,initSignUpWithEmailOTP:n,completeSignUpWithEmailOTP:n,appendPasskey:n,getPasskeys:n,deletePasskey:n,getUserAuthMethods:n,getProjectConfig:n,userExists:n},c=(0,l.createContext)(u),d=({children:e,...r})=>{const[a]=(0,l.useState)((()=>new o.CorbadoApp(r))),[s,t]=(0,l.useState)(),[i,n]=(0,l.useState)(),[u,d]=(0,l.useState)(!0),[E,h]=(0,l.useState)(),k=(0,l.useRef)(!1);(0,l.useEffect)((()=>{k.current||(k.current=!0,d(!0),a.authService.shortSessionChanges.subscribe((e=>{void 0!==e&&t(e)})),a.authService.userChanges.subscribe((e=>{void 0!==e&&n(e)})),a.globalErrors.subscribe((e=>{h(e)})),a.init(),d(!1))}),[]);const v=(0,l.useCallback)(((e,r)=>a.authService.signUpWithPasskey(e,r)),[a]),p=(0,l.useCallback)((e=>a.authService.loginWithPasskey(e)),[a]),g=(0,l.useCallback)((()=>a.authService.loginWithConditionalUI()),[a]),C=(0,l.useCallback)((()=>a.authService.appendPasskey()),[a]),P=(0,l.useCallback)((()=>a.authService.passkeyList()),[a]),b=(0,l.useCallback)((e=>a.authService.passkeyDelete(e)),[a]),m=(0,l.useCallback)((e=>a.authService.initLoginWithEmailOTP(e)),[a]),y=(0,l.useCallback)((e=>a.authService.completeLoginWithEmailOTP(e)),[a]),S=(0,l.useCallback)((()=>{a.authService.logout(),t(void 0),n(void 0)}),[a]),U=(0,l.useCallback)(((e,r)=>a.authService.initSignUpWithEmailOTP(e,r)),[a]),I=(0,l.useCallback)((e=>a.authService.completeSignupWithEmailOTP(e)),[a]),W=(0,l.useCallback)((e=>a.authService.authMethods(e)),[a]),f=(0,l.useCallback)((e=>a.authService.userExists(e)),[a]),O=(0,l.useCallback)((()=>a.projectService.getProjectConfig()),[a]),A=(0,l.useMemo)((()=>({corbadoApp:a,shortSession:s,user:i,globalError:E,loading:u,signUpWithPasskey:v,loginWithPasskey:p,loginWithConditionalUI:g,initLoginWithEmailOTP:m,completeLoginWithEmailOTP:y,logout:S,initSignUpWithEmailOTP:U,completeSignUpWithEmailOTP:I,appendPasskey:C,getPasskeys:P,deletePasskey:b,getUserAuthMethods:W,getProjectConfig:O,userExists:f})),[a,s,i,E,u,v,p,g,m,y,S,U,I,C,P,b,W,O,f]);return l.default.createElement(c.Provider,{value:A},e)},E=(e=c)=>(0,l.useContext)(e);var h=s.kr,k=s.Hg,v=s.lH,p=s.bu,g=s.zT,C=s.CU,P=s.nJ,b=s.X$,m=s.eA,y=s.k5,S=s.km;export{h as CorbadoContext,k as CorbadoProvider,v as InvalidEmailError,p as InvalidFullnameError,g as InvalidOtpInputError,C as InvalidPasskeyError,P as NoPasskeyAvailableError,b as PasskeyChallengeCancelledError,m as UnknownUserError,y as UserAlreadyExistsError,S as useCorbado}; | ||
import*as e from"@corbado/web-core";import*as r from"react";var a={d:(e,r)=>{for(var s in r)a.o(r,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},s={};a.d(s,{kr:()=>c,Hg:()=>d,lH:()=>o.InvalidEmailError,bu:()=>o.InvalidFullnameError,zT:()=>o.InvalidOtpInputError,CU:()=>o.InvalidPasskeyError,nJ:()=>o.NoPasskeyAvailableError,X$:()=>o.PasskeyChallengeCancelledError,eA:()=>o.UnknownUserError,k5:()=>o.UserAlreadyExistsError,du:()=>u,km:()=>E});const o=(t={CorbadoApp:()=>e.CorbadoApp,InvalidEmailError:()=>e.InvalidEmailError,InvalidFullnameError:()=>e.InvalidFullnameError,InvalidOtpInputError:()=>e.InvalidOtpInputError,InvalidPasskeyError:()=>e.InvalidPasskeyError,NoPasskeyAvailableError:()=>e.NoPasskeyAvailableError,PasskeyChallengeCancelledError:()=>e.PasskeyChallengeCancelledError,UnknownUserError:()=>e.UnknownUserError,UserAlreadyExistsError:()=>e.UserAlreadyExistsError},i={},a.d(i,t),i);var t,i;const l=(e=>{var r={};return a.d(r,e),r})({createContext:()=>r.createContext,default:()=>r.default,useCallback:()=>r.useCallback,useContext:()=>r.useContext,useEffect:()=>r.useEffect,useMemo:()=>r.useMemo,useRef:()=>r.useRef,useState:()=>r.useState}),n=()=>{throw new Error("Please make sure that your components are wrapped inside <CorbadoProvider/>")},u={corbadoApp:void 0,shortSession:void 0,user:void 0,globalError:void 0,loading:!1,signUpWithPasskey:n,loginWithPasskey:n,loginWithConditionalUI:n,initLoginWithEmailOTP:n,completeLoginWithEmailOTP:n,logout:n,initSignUpWithEmailOTP:n,completeSignUpWithEmailOTP:n,appendPasskey:n,getPasskeys:n,deletePasskey:n,getUserAuthMethods:n,getProjectConfig:n,userExists:n},c=(0,l.createContext)(u),d=({children:e,corbadoAppInstance:r,...a})=>{const[s]=(0,l.useState)((()=>null!=r?r:new o.CorbadoApp(a))),[t,i]=(0,l.useState)(),[n,u]=(0,l.useState)(),[d,E]=(0,l.useState)(!0),[h,k]=(0,l.useState)(),p=(0,l.useRef)(!1);(0,l.useEffect)((()=>{p.current||(E(!0),s.init(),s.authService.shortSessionChanges.subscribe((e=>{void 0!==e&&i(e)})),s.authService.userChanges.subscribe((e=>{void 0!==e&&u(e)})),s.globalErrors.subscribe((e=>{k(e)})),p.current=!0,E(!1))}),[]);const v=(0,l.useCallback)(((e,r)=>s.authService.signUpWithPasskey(e,r)),[s]),C=(0,l.useCallback)((e=>s.authService.loginWithPasskey(e)),[s]),g=(0,l.useCallback)((()=>s.authService.loginWithConditionalUI()),[s]),b=(0,l.useCallback)((()=>s.authService.appendPasskey()),[s]),P=(0,l.useCallback)((()=>s.authService.passkeyList()),[s]),m=(0,l.useCallback)((e=>s.authService.passkeyDelete(e)),[s]),y=(0,l.useCallback)((e=>s.authService.initLoginWithEmailOTP(e)),[s]),S=(0,l.useCallback)((e=>s.authService.completeLoginWithEmailOTP(e)),[s]),U=(0,l.useCallback)((()=>{s.authService.logout(),i(void 0),u(void 0)}),[s]),I=(0,l.useCallback)(((e,r)=>s.authService.initSignUpWithEmailOTP(e,r)),[s]),W=(0,l.useCallback)((e=>s.authService.completeSignupWithEmailOTP(e)),[s]),f=(0,l.useCallback)((e=>s.authService.authMethods(e)),[s]),O=(0,l.useCallback)((e=>s.authService.userExists(e)),[s]),A=(0,l.useCallback)((()=>s.projectService.getProjectConfig()),[s]),x=(0,l.useMemo)((()=>({corbadoApp:s,shortSession:t,user:n,globalError:h,loading:d,signUpWithPasskey:v,loginWithPasskey:C,loginWithConditionalUI:g,initLoginWithEmailOTP:y,completeLoginWithEmailOTP:S,logout:U,initSignUpWithEmailOTP:I,completeSignUpWithEmailOTP:W,appendPasskey:b,getPasskeys:P,deletePasskey:m,getUserAuthMethods:f,getProjectConfig:A,userExists:O})),[s,t,n,h,d,v,C,g,y,S,U,I,W,b,P,m,f,A,O]);return l.default.createElement(c.Provider,{value:x},e)},E=(e=c)=>(0,l.useContext)(e);var h=s.kr,k=s.Hg,p=s.lH,v=s.bu,C=s.zT,g=s.CU,b=s.nJ,P=s.X$,m=s.eA,y=s.k5,S=s.du,U=s.km;export{h as CorbadoContext,k as CorbadoProvider,p as InvalidEmailError,v as InvalidFullnameError,C as InvalidOtpInputError,g as InvalidPasskeyError,b as NoPasskeyAvailableError,P as PasskeyChallengeCancelledError,m as UnknownUserError,y as UserAlreadyExistsError,S as initialContext,U as useCorbado}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@corbado/react-sdk", | ||
"version": "0.1.7-alpha.1", | ||
"version": "0.1.7-alpha.2", | ||
"description": "This SDK is for developers who want to add Corbado's Authentication management in their applications but want to use a UI flow of their own.", | ||
@@ -38,9 +38,9 @@ "author": "Abdullah Shahbaz <abdullah_ghani@live.com>", | ||
"dependencies": { | ||
"@corbado/web-core": "^0.1.7-alpha.1" | ||
"@corbado/web-core": "^0.1.7-alpha.2" | ||
}, | ||
"devDependencies": { | ||
"@corbado/types": "^0.1.1-alpha.1", | ||
"@corbado/types": "^0.1.1-alpha.2", | ||
"@types/react": "^18.2.0" | ||
}, | ||
"gitHead": "b03d031d5a3cafdf798d2170d9c0c0803b3c9b4f" | ||
"gitHead": "170d17f6c315a8e0ee26e8726ff547e3cc7f06d5" | ||
} |
@@ -0,0 +0,0 @@ # `react-sdk` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22445
62
0