jazz-browser-auth-clerk 0.8.30 → 0.8.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +20 -30
  3. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # jazz-browser-media-images
2
2
 
3
+ ## 0.8.32
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a4bda0: Document usage in readme
8
+ - Updated dependencies [df42b2b]
9
+ - Updated dependencies [df42b2b]
10
+ - cojson@0.8.32
11
+ - jazz-tools@0.8.32
12
+ - jazz-browser@0.8.32
13
+
14
+ ## 0.8.31
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [e511d6d]
19
+ - cojson@0.8.31
20
+ - jazz-browser@0.8.31
21
+ - jazz-tools@0.8.31
22
+
3
23
  ## 0.8.30
4
24
 
5
25
  ### Patch Changes
package/README.md CHANGED
@@ -2,40 +2,30 @@
2
2
 
3
3
  This package provides a [Clerk-based](https://clerk.com/) authentication strategy for Jazz.
4
4
 
5
+ Looking for a React integration? Check out [`jazz-react-auth-clerk`](https://www.npmjs.com/package/jazz-react-auth-clerk).
6
+
5
7
  ## Usage
6
8
 
7
- `useJazzClerkAuth` is a hook that returns a `JazzAuth` object and a `JazzAuthState` object. Provide a Clerk instance to `useJazzClerkAuth`, and it will return the appropriate `JazzAuth` object. Once authenticated, authentication will persist across page reloads, even if the device is offline.
9
+ `BrowserClerkAuth` is a class that provides a `JazzAuth` object. Provide a Clerk instance to `BrowserClerkAuth`, and it will return the appropriate `JazzAuth` object. Once authenticated, authentication will persist across page reloads, even if the device is offline.
8
10
 
9
11
 
10
12
  From [the example chat app](https://github.com/gardencmp/jazz/tree/main/examples/chat-clerk):
11
13
 
12
- ```typescript
13
- import { ClerkProvider, SignInButton, useClerk } from "@clerk/clerk-react";
14
- import { useJazzClerkAuth } from "jazz-react-auth-clerk";
15
-
16
- const Jazz = createJazzReactApp();
17
- export const { useAccount, useCoState } = Jazz;
18
-
19
- function JazzAndAuth({ children }: { children: React.ReactNode }) {
20
- const clerk = useClerk();
21
- const [auth, state] = useJazzClerkAuth(clerk);
22
-
23
- return (
24
- <>
25
- {state.errors.map((error) => (
26
- <div key={error}>{error}</div>
27
- ))}
28
- {auth ? (
29
- <Jazz.Provider
30
- auth={auth}
31
- peer="wss://cloud.jazz.tools/?key=chat-example-jazz-clerk@gcmp.io"
32
- >
33
- {children}
34
- </Jazz.Provider>
35
- ) : (
36
- <SignInButton />
37
- )}
38
- </>
39
- );
40
- }
14
+ ```ts
15
+ import { BrowserClerkAuth } from "jazz-browser-auth-clerk";
16
+
17
+ // ...
18
+
19
+ const auth = new BrowserClerkAuth(
20
+ {
21
+ onError: (error) => {
22
+ void clerk.signOut();
23
+ setState((state) => ({
24
+ ...state,
25
+ errors: [...state.errors, error.toString()],
26
+ }));
27
+ },
28
+ },
29
+ clerk,
30
+ );
41
31
  ```
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "jazz-browser-auth-clerk",
3
- "version": "0.8.30",
3
+ "version": "0.8.32",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "cojson": "0.8.30",
10
- "jazz-browser": "0.8.30",
11
- "jazz-tools": "0.8.30"
9
+ "cojson": "0.8.32",
10
+ "jazz-browser": "0.8.32",
11
+ "jazz-tools": "0.8.32"
12
12
  },
13
13
  "devDependencies": {
14
14
  "typescript": "^5.3.3"