Skip to content

Latest commit

 

History

History
1443 lines (909 loc) · 37.3 KB

CHANGELOG.md

File metadata and controls

1443 lines (909 loc) · 37.3 KB

@nhost/react

3.10.0

Minor Changes

  • cb63233: chore: add react 19 as peer dependency

3.9.1

Patch Changes

  • @nhost/nhost-js@3.2.4

3.9.0

Minor Changes

  • 04d2ce1: feat: add signin security key with user handle

Patch Changes

  • @nhost/nhost-js@3.2.3

3.8.1

Patch Changes

  • @nhost/nhost-js@3.2.2

3.8.0

Minor Changes

  • 14e6100: feat: add support for ID token sign-in from authentication providers

Patch Changes

  • @nhost/nhost-js@3.2.1

3.7.0

Minor Changes

  • fe6e8e2: feat: add email OTP sign-in functionality

Patch Changes

  • Updated dependencies [72899a6]
    • @nhost/nhost-js@3.2.0

3.6.0

Minor Changes

  • 55d8bb5: feat: add requestOptions to signUpEmailPassword to allow passing extra headers with the signup request

Patch Changes

  • @nhost/nhost-js@3.1.10

3.5.6

Patch Changes

  • @nhost/nhost-js@3.1.9

3.5.5

Patch Changes

  • @nhost/nhost-js@3.1.8

3.5.4

Patch Changes

  • @nhost/nhost-js@3.1.7

3.5.3

Patch Changes

  • @nhost/nhost-js@3.1.6

3.5.2

Patch Changes

  • @nhost/nhost-js@3.1.5

3.5.1

Patch Changes

  • @nhost/nhost-js@3.1.4

3.5.0

Minor Changes

  • d0c9f4c: fix: replace jose with jwt-decode version 4.0.0

Patch Changes

  • @nhost/nhost-js@3.1.3

3.4.4

Patch Changes

  • Updated dependencies [4c35171]
  • Updated dependencies [3cea460]
    • @nhost/nhost-js@3.1.2

3.4.3

Patch Changes

  • @nhost/nhost-js@3.1.1

3.4.2

Patch Changes

  • Updated dependencies [304065a]
    • @nhost/nhost-js@3.1.0

3.4.1

Patch Changes

  • @nhost/nhost-js@3.0.11

3.4.0

Minor Changes

  • 768ca17: chore: update dependencies

Patch Changes

  • @nhost/nhost-js@3.0.10

3.3.2

Patch Changes

  • 311374e: feat: add connect param to useProviderLink hook
    • @nhost/nhost-js@3.0.10

3.3.1

Patch Changes

  • @nhost/nhost-js@3.0.9

3.3.0

Minor Changes

  • 49a80c2: chore: update dependencies

Patch Changes

  • @nhost/nhost-js@3.0.8

3.2.3

Patch Changes

  • @nhost/nhost-js@3.0.8

3.2.2

Patch Changes

  • @nhost/nhost-js@3.0.7

3.2.1

Patch Changes

  • @nhost/nhost-js@3.0.6

3.2.0

Minor Changes

  • 017f1a6: feat: add elevated permission examples

Patch Changes

  • @nhost/nhost-js@3.0.5

3.1.1

Patch Changes

  • @nhost/nhost-js@3.0.4

3.1.0

Minor Changes

  • 1a61c65: feat: add 'elevateEmailSecurityKey' to the SDKs along with integration into react-apollo and vue-apollo examples

Patch Changes

  • e5bab6a: chore: update dependencies
    • @nhost/nhost-js@3.0.3

3.0.2

Patch Changes

  • 8d91f71: chore: update deps and enable pnpm audit
  • Updated dependencies [8d91f71]
    • @nhost/nhost-js@3.0.2

3.0.1

Patch Changes

  • @nhost/nhost-js@3.0.1

3.0.0

Major Changes

  • bc9eff6e4: chore: remove support for using backendUrl when instantiating the Nhost client

Patch Changes

  • Updated dependencies [bc9eff6e4]
    • @nhost/nhost-js@3.0.0

2.1.1

Patch Changes

  • Updated dependencies [8b127fbb6]
    • @nhost/nhost-js@2.2.18

2.1.0

Minor Changes

  • 66c3193bc: Update useChangePassword hook interface to include ActionLoadingState

Patch Changes

  • 00c363f80: fix(docs): update changeEmail usage reference

2.0.32

Patch Changes

  • 4fe4a1696: return refreshToken immediately after signIn and signUp
    • @nhost/nhost-js@2.2.17

2.0.31

Patch Changes

  • @nhost/nhost-js@2.2.16

2.0.30

Patch Changes

  • @nhost/nhost-js@2.2.15

2.0.29

Patch Changes

  • @nhost/nhost-js@2.2.14

2.0.28

Patch Changes

  • @nhost/nhost-js@2.2.13

2.0.27

Patch Changes

  • @nhost/nhost-js@2.2.12

2.0.26

Patch Changes

  • @nhost/nhost-js@2.2.11

2.0.25

Patch Changes

  • b3b64a3b7: chore(deps): bump @types/react to v18.2.14 and @types/react-dom to v18.2.6

2.0.24

Patch Changes

  • Updated dependencies [07a45fde0]
    • @nhost/nhost-js@2.2.10

2.0.23

Patch Changes

  • Updated dependencies [5a4e237a2]
    • @nhost/nhost-js@2.2.9

2.0.22

Patch Changes

  • @nhost/nhost-js@2.2.8

2.0.21

Patch Changes

  • @nhost/nhost-js@2.2.7

2.0.20

Patch Changes

  • Updated dependencies [aa3c62989]
    • @nhost/nhost-js@2.2.6

2.0.19

Patch Changes

  • 203bc97f: feat(pat): add support for personal access tokens
  • 7fea29a8: fix: update types config and fix the exposed React components
  • Updated dependencies [7fea29a8]
    • @nhost/nhost-js@2.2.5

2.0.18

Patch Changes

  • @nhost/nhost-js@2.2.4

2.0.17

Patch Changes

  • da03bf39: chore(build): change build target to ES2019
  • Updated dependencies [da03bf39]
    • @nhost/nhost-js@2.2.3

2.0.16

Patch Changes

  • 90c60311: chore(deps): add types to package.json
  • Updated dependencies [90c60311]
    • @nhost/nhost-js@2.2.2

2.0.15

Patch Changes

  • Updated dependencies [08e70b9d]
    • @nhost/nhost-js@2.2.1

2.0.14

Patch Changes

  • 43b1b144: chore(deps): bump @types/react to v18.0.34 and @types/react-dom to v18.0.11
    • @nhost/nhost-js@2.2.0

2.0.13

Patch Changes

  • Updated dependencies [a0e093d7]
    • @nhost/nhost-js@2.2.0

2.0.12

Patch Changes

  • @nhost/nhost-js@2.1.2

2.0.11

Patch Changes

  • @nhost/nhost-js@2.1.1

2.0.10

Patch Changes

  • Updated dependencies [bfb4c1a6]
    • @nhost/nhost-js@2.1.0

2.0.9

Patch Changes

  • f375eacc: fix(react): accept service URLs
  • Updated dependencies [088584e7]
    • @nhost/nhost-js@2.0.9

2.0.8

Patch Changes

  • Updated dependencies [1d155559]
    • @nhost/nhost-js@2.0.8

2.0.7

Patch Changes

  • 850a049c: chore(deps): update docker/build-push-action action to v4
  • Updated dependencies [850a049c]
    • @nhost/nhost-js@2.0.7

2.0.6

Patch Changes

  • 4bf40995: chore(deps): bump typescript to 4.9.5
  • 8bb097c9: chore(deps): bump vitest
  • Updated dependencies [4bf40995]
  • Updated dependencies [8bb097c9]
  • Updated dependencies [35d52aab]
    • @nhost/nhost-js@2.0.6

2.0.5

Patch Changes

  • Updated dependencies [3c7cf92e]
    • @nhost/nhost-js@2.0.5

2.0.4

Patch Changes

  • 01318860: fix(nhost-js): use correct URL for functions requests
  • Updated dependencies [01318860]
    • @nhost/nhost-js@2.0.4

2.0.3

Patch Changes

  • 445d8ef4: chore(deps): bump @nhost/nhost-js version to 2.0.3
  • Updated dependencies [445d8ef4]
    • @nhost/nhost-js@2.0.3

2.0.2

Patch Changes

  • Updated dependencies [2d9145f9]
    • @nhost/nhost-js@2.0.2

2.0.1

Patch Changes

  • @nhost/nhost-js@2.0.1

2.0.0

Major Changes

  • 19b11d40: Remove deprecated signatures in React hooks

    It is now not possible to send the input values of the following hooks when creating them:

    • useChangeEmail
    • useChangePassword
    • useResetPassword
    • useSendVerificationEmail
    • useSignInEmailPassword
    • useSignInEmailPasswordless
    • useSignUpEmailPassword

    For instance, it is not possible to do the following:

    const [email, setEmail] = useState('')
    const { changeEmail } = useChangeEmail(email)
    
    const handleSubmit = async (e: React.SyntheticEvent<HTMLFormElement>) => {
        e.preventDefault()
        await changeEmail()
    }
    
    return <form onSubmit={ handleSubmit }>
                <input value={email} onChange={onChange={(event) => setEmail(event.target.value)}}  />
           </form>

    Instead, write:

    const [email, setEmail] = useState('')
    const { changeEmail } = useChangeEmail()
    
    const handleSubmit = async (e: React.SyntheticEvent<HTMLFormElement>) => {
        e.preventDefault()
        await changeEmail(email)
    }
    
    return <form onSubmit={ handleSubmit }>
                <input value={email} onChange={onChange={(event) => setEmail(event.target.value)}}  />
           </form>
  • 19b11d40: Remove deprecated hooks

    • useNhostAuth: use useNhostClient instead
    • useAuthLoading: use useAuthenticationStatus instead
    • useAvatarUrl: use useUserAvatarUrl instead.
    • useDefaultRole: use useUserDefaultRole instead.
    • useDisplayName: use useUserDisplayName instead.
    • useEmail: use useUserEmail instead.
    • useIsAnonymous: use useUserIsAnonymous instead.
    • useNhostBackendUrl: use useNhostClient instead, then the urls in the respective nhost.<auth,storage,graphql,functions> clients

Patch Changes

  • Updated dependencies [c9d2d31a]
  • Updated dependencies [80bbd3a1]
  • Updated dependencies [80bbd3a1]
  • Updated dependencies [2949ff0f]
    • @nhost/nhost-js@2.0.0

1.13.5

Patch Changes

  • 5013213b: chore(deps): update dependency @nhost/docgen to 0.1.6
  • bf1e4071: chore(react): fix exports for @nhost/nextjs
  • Updated dependencies [5013213b]
    • @nhost/nhost-js@1.13.4

1.13.4

Patch Changes

  • @nhost/nhost-js@1.13.3

1.13.3

Patch Changes

  • @nhost/nhost-js@1.13.2

1.13.2

Patch Changes

  • 200e9f77: chore(deps): update dependency @types/react-dom to v18.0.10
  • Updated dependencies [200e9f77]
    • @nhost/nhost-js@1.13.1

1.13.1

Patch Changes

  • c2706c7d: Export commonly used types

    BackendUrl, ErrorPayload, NhostSession, Subdomain, and User are now exported in all our SDKs

  • d42c27ae: Add explicit return types to React hooks

1.13.0

Patch Changes

  • @nhost/nhost-js@1.13.0

1.12.1

Patch Changes

  • 1be6d324: Only export what is required by the user or @nhost/nextjs
  • 2e8f73df: Improve the error message when the application is not wrapped in <NhostProvider></NhostProvider>
  • 85683547: Allow useFileUpload to be reused Once a file were uploaded with useFileUpload, it was not possible to reuse it as the returned file id were kept in memory and sent again to hasura-storage, leading to a conflict error. File upload now makes sure to clear the metadata information from the first file before uploading the second file.
    • @nhost/nhost-js@1.12.1

1.12.0

Minor Changes

  • 65687bee: Remove @nhost/nhost-js from peerDepencencies

    The contents of the @nhost/nhost-js package are now exported by @nhost/react.

Patch Changes

  • b21222b3: chore(deps): update dependency @types/node to v16
  • 54df0df4: Remove unused immer dependency
  • 54df0df4: Improve the initialisation of the internal authentication state to support React 18 strict mode
  • Updated dependencies [b21222b3]
  • Updated dependencies [19cca7f4]
  • Updated dependencies [65687bee]
  • Updated dependencies [54df0df4]
  • Updated dependencies [1a9e1fde]
  • Updated dependencies [5be9abb0]
  • Updated dependencies [54df0df4]
    • @nhost/nhost-js@1.12.0

0.17.0

Minor Changes

  • 57db5b83: Refactor: remove dependency to @nhost/core

Patch Changes

  • Updated dependencies [57db5b83]
    • @nhost/hasura-auth-js@1.7.0
    • @nhost/hasura-storage-js@0.8.0
    • @nhost/nhost-js@1.7.0

0.16.0

Minor Changes

  • 7f251111: Use NhostProvider instead of NhostReactProvider and NhostNextProvider

    NhostReactProvider and NhostNextProvider are now deprecated

0.15.2

Patch Changes

  • 132a4f4b: chore(deps): synchronize @types/react-dom and @types/react versions

0.15.1

Patch Changes

  • 2e6923dc: Refactoring: use xstate's interpreter.getSnapshot() instead of interpreter.state
  • Updated dependencies [66b4f3d0]
  • Updated dependencies [2e6923dc]
  • Updated dependencies [ef117c28]
  • Updated dependencies [aebb8225]
    • @nhost/core@0.9.4
    • @nhost/hasura-storage-js@0.7.4
    • @nhost/nhost-js@1.6.2

0.15.0

Minor Changes

  • 4601d84e: Adding <SignedIn /> and <SignedOut /> components.

Patch Changes

  • 843087cb: Make useUserRoles reactive

0.14.3

Patch Changes

  • Updated dependencies [f2aaff05]
    • @nhost/core@0.9.3
    • @nhost/hasura-storage-js@0.7.3
    • @nhost/nhost-js@1.6.1

0.14.2

Patch Changes

  • Updated dependencies [996e8016]
  • Updated dependencies [996e8016]
  • Updated dependencies [869e7253]
  • Updated dependencies [996e8016]
  • Updated dependencies [b5395be2]
    • @nhost/core@0.9.2
    • @nhost/hasura-storage-js@0.7.2
    • @nhost/nhost-js@1.6.0

0.14.1

Patch Changes

  • Updated dependencies [6b9d163e]
    • @nhost/core@0.9.1
    • @nhost/hasura-storage-js@0.7.1
    • @nhost/nhost-js@1.5.2

0.14.0

Minor Changes

  • 6da44bf8: The useAuthenticationStatus hook now returns the number of attempts to get an access token from the server connectionAttempts.

Patch Changes

  • ba785da1: Bump dependencies versions
  • Updated dependencies [13c41fe6] [ba785da1] [3ced63ab]
    • @nhost/core@0.9.0
    • @nhost/hasura-storage-js@1.0.0
    • @nhost/nhost-js@1.5.1

0.13.0

Minor Changes

  • 739a3c45: Sign up with an email and a security key.

    Use the hook useSignUpEmailSecurityKey to sign up a user with security key and an email using the WebAuthn API.

    const { signUpEmailSecurityKey, needsEmailVerification, isLoading, isSuccess, isError, error } =
      useSignUpEmailSecurityKey()
    
    console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
    
    const handleFormSubmit = async (e) => {
      e.preventDefault()
      await signUpEmailSecurityKey('joe@example.com')
    }

Patch Changes

  • Updated dependencies [739a3c45]
  • Updated dependencies [8e4d790b]
    • @nhost/nhost-js@1.5.0
    • @nhost/core@0.8.0
    • @nhost/hasura-storage-js@1.0.0

0.12.5

Patch Changes

  • Updated dependencies [9eb78e06]
    • @nhost/core@0.7.7
    • @nhost/hasura-storage-js@0.6.1
    • @nhost/nhost-js@1.4.12

0.12.4

Patch Changes

  • @nhost/nhost-js@1.4.11

0.12.3

Patch Changes

  • Updated dependencies [607c457f]
    • @nhost/hasura-storage-js@0.6.0
    • @nhost/nhost-js@1.4.10

0.12.2

Patch Changes

  • Updated dependencies [eb46f7d8]
    • @nhost/nhost-js@1.4.9

0.12.1

Patch Changes

  • @nhost/nhost-js@1.4.8

0.12.0

Minor Changes

  • 84ba29dd: Introduce useSignInSmsPasswordless

    const { signInSmsPasswordless, sendOtp, needsOtp, isLoading, isSuccess, isError, error } =
      useSignInSmsPasswordless()
    1. The signInSmsPasswordless action will send a one-time password to the given phone number.
    2. The client is then awaiting the OTP. needsOtp equals true
    3. After the code is received by SMS, the client sends the code with sendOtp. On success, the client is authenticated, and isSuccess equals true.

    Any error is monitored through isError and error. While the signInSmsPasswordless and sendOtp actions are running, isLoading equals true

Patch Changes

  • 10beea72: Fix React Native build: Export package.json for all npm packages.
  • Updated dependencies [747aa969]
  • Updated dependencies [10beea72]
    • @nhost/core@0.7.6
    • @nhost/hasura-storage-js@0.5.3
    • @nhost/nhost-js@1.4.7

0.11.2

Patch Changes

  • Updated dependencies [197d1d5c]
    • @nhost/core@0.7.5
    • @nhost/hasura-storage-js@0.5.2
    • @nhost/nhost-js@1.4.6

0.11.1

Patch Changes

  • Updated dependencies [6eaa5c79]
    • @nhost/core@0.7.4
    • @nhost/hasura-storage-js@0.5.1
    • @nhost/nhost-js@1.4.5

0.11.0

Minor Changes

  • 4f928756: Extend file upload parameters

    • bucketId is available everywhere as an option
    • It is possible to pass files as a parameter on a multiple upload, making the add action optional.
    • The add and upload actions of multiple file upload accepts both a File, an array of File items, and a FileList

Patch Changes

  • Updated dependencies [4f928756]
    • @nhost/hasura-storage-js@0.5.0
    • @nhost/nhost-js@1.4.4

0.10.0

Minor Changes

  • f9854b15: Upload multiple files with useMultipleFilesUpload
  • f9854b15: useFileUpload: keep track of upload progress and cancel upload

Patch Changes

  • Updated dependencies [f9854b15]
  • Updated dependencies [f9854b15]
    • @nhost/hasura-storage-js@0.4.0
    • @nhost/core@0.7.3
    • @nhost/nhost-js@1.4.3

0.9.2

Patch Changes

  • dbc10e62: fixed exports field to support imports in a server-side environment
  • Updated dependencies [dbc10e62]
    • @nhost/core@0.7.2
    • @nhost/nhost-js@1.4.2

0.9.1

Patch Changes

  • Updated dependencies [b8f4b75b]
    • @nhost/nhost-js@1.4.1

0.9.0

Minor Changes

  • 6f0a3005: sendMfaOtp now returns a promise When using useSignInEmailPassword, the sendMfaOtp was void. It now returns a promise that resolves when the server returned the result of the OTP code submission, and returns isSuccess, isError, and error.

Patch Changes

  • Updated dependencies [6f0a3005]
  • Updated dependencies [6f0a3005]
    • @nhost/nhost-js@1.4.0
    • @nhost/core@0.7.1

0.8.0

Minor Changes

  • c1613394: Deanonymisation Once signed in anonymously, users can deanonymise using nhost.auth.deanonymize. Deanonymisation works the same way as email+password sign-up or passwordless sign-in. The related methods, hooks in React and composables in Vue can therefore be used for deanonymising users, such as nhost.auth.signUp, useSignUpEmailPassword, and useSignInEmailPasswordless.

Patch Changes

  • Updated dependencies [c1613394]
    • @nhost/core@0.7.0
    • @nhost/nhost-js@1.3.0

0.7.13

Patch Changes

  • 08a37aae: correct rewriting options when clientUrl is not available The client URL is set to window.location.origin, so it can rewrite redirection urls that are passed on to authenticaion methods. However, clientUrl is set to '' when running on the server side. This fix then avoid raising an error when trying to rewrite redirectTo on non-browser environment, and forces useProviderLink to be rendered on the client side.
  • Updated dependencies [08a37aae]
    • @nhost/core@0.6.5
    • @nhost/nhost-js@1.2.4

0.7.12

Patch Changes

  • ebad0936: reverted ESM related changes
  • Updated dependencies [ebad0936]
    • @nhost/core@0.6.4
    • @nhost/nhost-js@1.2.3

0.7.11

Patch Changes

  • 1b37b9f6: fix: ESM import path fixes
  • Updated dependencies [1b37b9f6]
    • @nhost/core@0.6.3
    • @nhost/nhost-js@1.2.2

0.7.10

Patch Changes

  • 78341491: fix: Next.js and React issues with ESM packages chore: Updated output bundle names
  • Updated dependencies [78341491]
    • @nhost/core@0.6.2
    • @nhost/nhost-js@1.2.1

0.7.9

Patch Changes

  • bc11c9e5: chore: Changed copy script to support Windows fix: Fixed warnings about unknown globals occurring while building the packages
  • 2b2f8e91: fix: ESM related issues in Node environments chore: Improved the way different formats are exposed via exports field in package.js
  • Updated dependencies [bc11c9e5]
  • Updated dependencies [2b2f8e91]
  • Updated dependencies [858014e4]
    • @nhost/core@0.6.1
    • @nhost/nhost-js@1.2.0

0.7.8

Patch Changes

  • 7c8f0926: add the mfa ticket to useSignInEmailPassword The useSignInEmailPassword hook was not returning the MFA ticket. This releases fixes the issue.
  • 7c8f0926: use the same methods and typings to interact with xstate machines in both @nhost/hasura-auth-js, @nhost/react hooks and @nhost/vue composables Both @nhost/react, @nhost/hasura-auth-js and @nhost/vue interact with the authentication state in a similar way. As a result, the same code was repeated three times, with risks of insonsistency and difficult maintainability. @nhost/core now contains the logic and Typescript interfaces that are used in the Vanilla client, React hooks and Vue composables.
  • Updated dependencies [7c8f0926]
  • Updated dependencies [7c8f0926]
  • Updated dependencies [7c8f0926]
    • @nhost/core@0.6.0
    • @nhost/nhost-js@1.1.14

0.7.7

Patch Changes

  • Updated dependencies [6c423394]
    • @nhost/core@0.5.6
    • @nhost/nhost-js@1.1.13

0.7.6

Patch Changes

  • Updated dependencies [0b58894e]
  • Updated dependencies [c7a407f1]
    • @nhost/core@0.5.5
    • @nhost/nhost-js@1.1.12

0.7.5

Patch Changes

  • 9d32314: Return an error when trying sign to in/up/out from hooks while in the wrong authentication status The actions of the authentication hooks were not resolving the promise when executed from the wrong authentication status. They now return an error.
  • 236ce72: Correct useSignUpEmailPassword loading state
  • 236ce72: Correct email verification states email verification returns false when the client has started and it is still undetermined
  • Updated dependencies [9d32314]
  • Updated dependencies [e094e68]
  • Updated dependencies [236ce72]
    • @nhost/core@0.5.4
    • @nhost/nhost-js@1.1.11

0.7.4

Patch Changes

  • 2887ce0: @xstate/react bump to support React 18

0.7.3

Patch Changes

  • 584976d: - publishable directory structure changes (ESM, CJS and UMD included in the output)
    • build system improvements
    • fixed some bundling concerns (#428)
  • Updated dependencies [584976d]
    • @nhost/core@0.5.3
    • @nhost/nhost-js@1.1.10

0.7.2

Patch Changes

  • @nhost/nhost-js@1.1.9

0.7.1

Patch Changes

  • 58fa2a2: Improve loading status The loading status indicates the authentication is not yet known to the client when it starts. Once the client is ready, the authentication status is either signed in, or signed out. When the user was trying to authenticate, the loading status was set to true until the result of the authentication was known. The client now only return loading: true on startup, and in no other cases.
  • 58fa2a2: Look for a valid refresh token both the URL and local storage When auto-signin was activated, the client was not taking into account the refresh token in the URL if a token was already stored locally. The user was then not able to authenticate from a link when the refresh token stored locally was invalid or expired. When auto-signin is activated, the client now checks and tries tokens from both the URL and the local storage, starting with the URL.
    • @nhost/nhost-js@1.1.8

0.7.0

Minor Changes

  • 42edb74: Adapt to React 18

Patch Changes

  • b56162a: prefer clientStorage/clientStorageType to clientStorageGetter/clientStorageSetter

  • 1fb51a7: Rename user data hooks to make them all start with userUser... The hooks that help to access user data were not consistently named. The following hooks have been therefore renamed:

    • useAvatarUrl -> useUserAvatarUrl
    • useDefaultRole -> useUserDefaultRole
    • useDisplayName -> useUserDisplayName
    • useEmail -> useUserEmail
    • useIsAnonymous -> useUserIsAnonymous

    Their former names are still available for backwards compatibility, but are flagged as deprecated.

  • 54e1873: Fix: add authentication headers to GraphQL operations when authenticated

  • Updated dependencies [185f39e]

    • @nhost/nhost-js@1.1.7

0.6.1

Patch Changes

  • @nhost/nhost-js@1.1.6

0.6.0

Minor Changes

  • 616e320: Remove refreshToken from the url when autoSignIn is set On startup, when the autoSignIn option is set to true, the client now removes it from the URL when the page loads.
  • 1ce55c5: Add new hooks: useDecodedAccessToken(), useHasuraClaims(), and useHasuraClaim(name: string)
  • 616e320: Look for the refresh token both in the query parameters and in the hash Until now, after redirecting from an email, Hasura-auth puts refresh tokens in the hash part of the url. It is a problem when using SSR as the hash is not accessible to the server. This behaviour is likely to change. As a result, the client now parses both the hash and the query parameters of the url. See this issue to keep track of the progress on Hasura-auth.

Patch Changes

  • 49545c0: Remove filtering of useLayoutEffect from logs The suppressConsoleMessage method was meant to suppress incorrect useLayoutEffect messages raised on Nextjs server-side renderings. Its implementation had an impact on the normal functionning of logging (see #447). This filtering was necessary when using former versions of xstate and can now be removed.
  • b52b4fc: Bump xstate to latest version (4.31.0)
  • Updated dependencies [d49b837]
    • @nhost/nhost-js@1.1.5

0.5.7

Patch Changes

  • @nhost/nhost-js@1.1.4

0.5.6

Patch Changes

  • 5ee395e: Ensure the session is destroyed when signout is done In the useSignOut hook, signOut now returns a promise. We are now sure the user session is empty once the promise is resolved.
    • @nhost/nhost-js@1.1.3

0.5.5

Patch Changes

  • @nhost/nhost-js@1.1.2

0.5.4

Patch Changes

  • @nhost/nhost-js@1.1.1

0.5.3

Patch Changes

  • Updated dependencies [ccba0b5]
    • @nhost/nhost-js@1.1.0

0.5.2

Patch Changes

  • @nhost/nhost-js@1.0.11

0.5.1

Patch Changes

  • Updated dependencies [2c97db6]
    • @nhost/nhost-js@1.0.10

0.5.0

Minor Changes

  • 7135aee: Add user and accessToken to authentication hooks

    Hooks that can complete a successful authentication now have two additional user and accessToken exported states:

    • useSignInEmailPassword
    • useSignInAnonymous
    • useSignUpEmailPassword
  • 587eaff: Return a promise with the current context to hooks actions It is now possible to get the result of an action. Hook handlers return the action context in a promise.

    const { signInEmailPasswordless, isError } = useSignInEmailPasswordless()
    const MyComponent = () => {
        return <div>
                    <button onClick={async () => {
                        const { isSuccess, isError, error } = await signInEmailPasswordless('johan@ikea.se')
                        if (isError) {
                            console.log(error)
                        }}}/>
                    {isError && <div>an error occurred</div>}
                <div>
    }

Patch Changes

  • 7cf875f: Deprecate the use of values sent as hook parameters

    Although handlers parameters of authentication hooks can be given when creating the hook, it is recommended to use them when executing the handler. For instance, instead of:

    const { signInEmailPasswordless } = useSignInEmailPasswordless('nuno@fcporto.pt')
    signInEmailPasswordless()

    It is recommended to use the following syntax:

    const { signInEmailPasswordless } = useSignInEmailPasswordless()
    signInEmailPasswordless('nuno@fcporto.pt')

    No breaking change has been introduced. For instance, useSignUpEmailPassword('szilard@brussels.be','1234', options) will appear as deprecated but will work, while useSignUpEmailPassword(options) will work too.

    • @nhost/nhost-js@1.0.9

0.4.7

Patch Changes

  • @nhost/nhost-js@1.0.8

0.4.6

Patch Changes

  • @nhost/nhost-js@1.0.5

0.4.3

Patch Changes

  • correct dependencies

    See this related issues:

  • Updated dependencies

    • @nhost/nhost-js@1.0.3

0.4.1

Patch Changes

  • @nhost/nhost-js@1.0.2

0.4.0

Minor Changes

  • 39df4d5: Deprecate useAuthLoading and introduce useAuthenticationStatus When using both useAuthLoading and useAuthenticated together, the hooks rerender independently from each other. As a result, when a user loads the page while he previously authenticated, the hooks values were chronologically:

    isLoading isAuthenticated
    true false
    false false
    false true

    The intermediate (false, false) is incorrect and is causing issues when using an authentication gate.

    It is therefore recommended to stop using useAuthLoading, and to use useAuthenticationStatus instead, in order to keep the loading state and the authentication in sync within the same hook.

    Usage:

    const { isLoading, isAuthenticated } = useAuthenticationStatus()

    Fixes this issue

0.3.1

Patch Changes

  • @nhost/nhost-js@1.0.1

0.3.0

Minor Changes

  • 744fd69: Introducing useSendVerificationEmail

    While useSignInEmailPassword automatically sends a verification email (when the backend is configured to do so), an user may sometime want to request for an verification email to be sent again. See the documentation for further information about how to use this hook.

  • 744fd69: Rename hooks and their methods to make them more explicit

    • useEmailPasswordlessSignIn

      • Hook renamed to useSignInEmailPasswordless
      • signIn renamed to signInEmailPasswordless
    • useEmailPasswordSignIn

      • Hook renamed to useSignInEmailPassword
      • signIn renamed to signInEmailPassword
      • needsVerification renamed to needsEmailVerification
    • useEmailPasswordSignUp

      • Hook renamed to useSignUpEmailPassword
      • signUp renamed to signUpEmailPassword
      • needsVerification renamed to needsEmailVerification
    • useAnonymousSignIn

      • Hook renamed to useSignInAnonymous
      • renamed signIn to signInAnonymous
    • useChangeEmail

      • needsVerification renamed to needsEmailVerification
  • 744fd69: Introducing useSignInAnonymous

    Anonymous Sign-In is a feature that allows users to get a temporary id without attaching yet any personal information such as an email or a passowrd.

    Anonymous users can then run GraphQL operations, with a specific public role that is distinct from the default user role. The anonymous can then "deanonymize" their account at a later stage in attaching the missing registration information and an authentication method.

    Note Anonymous Sign-In is not available out of the box yet in the Nhost cloud, but will be available in the near future.

    Note 2 The deanonymisation process is not yet available. This is also part of our roadmap.

    const { signInAnonymous, isLoading, isSuccess, isError, error } = useSignInAnonymous()
    Name Type Notes
    signInAnonymous () => void Registers an anonymous user
    isLoading boolean Returns true when the action is executing, false when it finished its execution.
    isSuccess boolean Returns true if the sign-up suceeded. Returns false if the new email needs to be verified first, or if an error occurred.
    isError boolean Returns true if an error occurred.
    error {status: number, error: string, message: string} | undefined Provides details about the error.

    Usage

    import { useSignInAnonymous } from '@nhost/react'
    
    const Component = () => {
      const { signInAnonymous, isSuccess } = useSignInAnonymous(email, password)
      return (
        <div>
          <button onClick={signInAnonymous}>Anonymous sign-in</button>
          {isSuccess && <div>You are now signed in anonymously</div>}
        </div>
      )
    }
  • 744fd69: Add options to useProviderLink

    Since Hasura Auth version 0.4, it is possible to pass on options when signing up or signin in through an OAuth provider. It is now possible to determine these options in the useProviderLink, so it generates the right URL when using the provider links.

    See the React documentation for additional information.

  • 744fd69: Time-based One-Time Password Multi-Factor Authentication

    Note MFA is not available out of the box yet in the Nhost cloud, but will be available in the near future.

    When enabled in the backend, users that signed up with an email and a password can opt-in for an additional authentication security measure. MFA can be activated in using the new useConfigMfa hook.

    Two methods has been also added to useEmailPasswordSignIn: when MFA is active, authentication won't be a success straight after signin up with an email and a password. The new needsMfaOtp will then appear as true, and the authentication will succeed only when the user will have sent back the OTP code with sendMfaOtp(code:string).

    const { generateQrCode, isGenerating, isGenerated, qrCodeDataUrl, activateMfa, isActivating, isActivated, isError, error } =
      useConfigMfa(code?: string)
    Name Type Notes
    generateQrCode () => void Generates the QR code that will be used by the MFA app e.g. Google Authenticator or Authy.
    isGenerating boolean Returns true if the QR code is generating but not yet available
    isGenerated boolean Returns true when the QR code has been successfully generated and is available
    qrCodeDataUrl string Returns the QR code as a Data URL
    activateMfa (code?: string) => void Activate MFA from the code given by the MFA authentication application
    isActivating boolean Returns true when the activation code has been sent to the server, and we await server response
    isActivated boolean Returns true when MFA has been successfully activated
    isError boolean Returns true if an error occurred.
    error {status: number, error: string, message: string} | undefined Provides details about the error.

    Usage

    import { useConfigMfa } from '@nhost/react'
    import { useState } from 'react'
    
    export const Mfa: React.FC = () => {
      const [code, setCode] = useState('')
      const { generateQrCode, activateMfa, isActivated, isGenerated, qrCodeDataUrl } =
        useConfigMfa(code)
    
      return (
        <div>
          {!isGenerated && (
            <button block appearance="primary" onClick={generateQrCode}>
              Generate
            </button>
          )}
          {isGenerated && !isActivated && (
            <div>
              <img alt="qrcode" src={qrCodeDataUrl} />
              <input value={code} onChange={onChange={(event) => setCode(event.target.value)}} placeholder="Enter activation code" />
              <button block appearance="primary" onClick={activateMfa}>
                Activate
              </button>
            </div>
          )}
          {isActivated && <div>MFA has been activated!!!</div>}
        </div>
      )
    }
  • 744fd69: Unify vanilla, react and next APIs so they can work together React and NextJS libraries now works together with @nhost/nhost-js. It also means the Nhost client needs to be initiated before passing it to the React provider. See the React and NextJS configuration documentation for additional information.

Patch Changes

  • Updated dependencies [744fd69]
    • @nhost/nhost-js@1.0.0

0.2.1

Patch Changes

  • 0d8afde: Bump xstate version 4.30.5
  • Updated dependencies [0d8afde]
    • @nhost/client@0.2.1

0.2.0

Minor Changes

  • 207ae38: New React client

    This release brings a full rewrite of the React client, to make it tree shakable and fully reactive. See the documentation for further information.

    Hooks

    • useAccessToken
    • useAnonymousSignIn
    • useAuthenticated
    • useChangeEmail
    • useChangePassword
    • useEmail
    • useEmailPasswordlessSignIn
    • useEmailPasswordSignIn
    • useEmailPasswordSignUp
    • useIsAnonymous
    • useAuthLoading
    • useNhost
    • useNhostBackendUrl
    • useNhostInterpreter
    • useResetPassword
    • useSignOut
    • useUserData
    • useUserLocale
    • the useNhostAuth has not been included. Use useAuthenticated together with useAuthLoading and useUserData instead

    Closes #189, #127, #186, and #195

Patch Changes

  • Updated dependencies [207ae38]
    • @nhost/client@0.2.0