jazz-react-auth-clerk 0.8.15 → 0.8.17
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +393 -372
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -12
- package/src/index.tsx +25 -20
- package/tsconfig.json +2 -2
- package/.eslintrc.cjs +0 -24
- package/.prettierrc.js +0 -9
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { BrowserClerkAuth } from "jazz-browser-auth-clerk";
|
2
|
-
import {
|
1
|
+
import { BrowserClerkAuth, } from "jazz-browser-auth-clerk";
|
2
|
+
import { useMemo, useState } from "react";
|
3
3
|
export function useJazzClerkAuth(clerk) {
|
4
4
|
const [state, setState] = useState({ errors: [] });
|
5
5
|
const authMethod = useMemo(() => {
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,UAAU,gBAAgB,CAC9B,KAEC;IAED,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAuB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,OAAO,IAAI,gBAAgB,CACzB;YACE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACjB,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;gBACrB,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBACnB,GAAG,KAAK;oBACR,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;iBAC5C,CAAC,CAAC,CAAC;YACN,CAAC;SACF,EACD,KAAK,CACN,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjB,OAAO,CAAC,UAAU,EAAE,KAAK,CAAU,CAAC;AACtC,CAAC"}
|
package/package.json
CHANGED
@@ -1,19 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "jazz-react-auth-clerk",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.17",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "src/index.tsx",
|
7
7
|
"license": "MIT",
|
8
|
-
"lint-staged": {
|
9
|
-
"*.{ts,tsx}": "eslint --fix",
|
10
|
-
"*.{js,jsx,mdx,json}": "prettier --write"
|
11
|
-
},
|
12
8
|
"dependencies": {
|
13
|
-
"cojson": "0.8.
|
14
|
-
"jazz-browser-auth-clerk": "0.8.
|
15
|
-
"jazz-react": "0.8.
|
16
|
-
"jazz-tools": "0.8.
|
9
|
+
"cojson": "0.8.17",
|
10
|
+
"jazz-browser-auth-clerk": "0.8.17",
|
11
|
+
"jazz-react": "0.8.17",
|
12
|
+
"jazz-tools": "0.8.17"
|
17
13
|
},
|
18
14
|
"peerDependencies": {
|
19
15
|
"react": "^18.2.0"
|
@@ -23,8 +19,8 @@
|
|
23
19
|
"typescript": "^5.3.3"
|
24
20
|
},
|
25
21
|
"scripts": {
|
26
|
-
"lint": "
|
27
|
-
"format": "
|
28
|
-
"build": "
|
22
|
+
"format-and-lint": "biome check .",
|
23
|
+
"format-and-lint:fix": "biome check . --write",
|
24
|
+
"build": "rm -rf ./dist && tsc --sourceMap --outDir dist"
|
29
25
|
}
|
30
26
|
}
|
package/src/index.tsx
CHANGED
@@ -1,25 +1,30 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import {
|
2
|
+
BrowserClerkAuth,
|
3
|
+
type MinimalClerkClient,
|
4
|
+
} from "jazz-browser-auth-clerk";
|
5
|
+
import { useMemo, useState } from "react";
|
3
6
|
|
4
|
-
export function useJazzClerkAuth(
|
7
|
+
export function useJazzClerkAuth(
|
8
|
+
clerk: MinimalClerkClient & {
|
5
9
|
signOut: () => Promise<unknown>;
|
6
|
-
}
|
7
|
-
|
10
|
+
},
|
11
|
+
) {
|
12
|
+
const [state, setState] = useState<{ errors: string[] }>({ errors: [] });
|
8
13
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
const authMethod = useMemo(() => {
|
15
|
+
return new BrowserClerkAuth(
|
16
|
+
{
|
17
|
+
onError: (error) => {
|
18
|
+
void clerk.signOut();
|
19
|
+
setState((state) => ({
|
20
|
+
...state,
|
21
|
+
errors: [...state.errors, error.toString()],
|
22
|
+
}));
|
23
|
+
},
|
24
|
+
},
|
25
|
+
clerk,
|
26
|
+
);
|
27
|
+
}, [clerk.user]);
|
23
28
|
|
24
|
-
|
29
|
+
return [authMethod, state] as const;
|
25
30
|
}
|
package/tsconfig.json
CHANGED
package/.eslintrc.cjs
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
extends: [
|
3
|
-
"eslint:recommended",
|
4
|
-
"plugin:@typescript-eslint/recommended",
|
5
|
-
"plugin:require-extensions/recommended",
|
6
|
-
"prettier"
|
7
|
-
],
|
8
|
-
parser: "@typescript-eslint/parser",
|
9
|
-
plugins: ["@typescript-eslint", "require-extensions"],
|
10
|
-
parserOptions: {
|
11
|
-
project: "./tsconfig.json",
|
12
|
-
tsconfigRootDir: __dirname,
|
13
|
-
},
|
14
|
-
ignorePatterns: [".eslint.cjs"],
|
15
|
-
root: true,
|
16
|
-
rules: {
|
17
|
-
"no-unused-vars": "off",
|
18
|
-
"@typescript-eslint/no-unused-vars": [
|
19
|
-
"error",
|
20
|
-
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
21
|
-
],
|
22
|
-
"@typescript-eslint/no-floating-promises": "error",
|
23
|
-
},
|
24
|
-
}
|