@cedarjs/auth-clerk-web 5.0.4-next.167 → 5.0.4

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.
@@ -0,0 +1,151 @@
1
+ import type { SignOutCallback, Clerk as ClerkClient, GetTokenOptions, SignOutOptions } from '@clerk/types';
2
+ import type { CurrentUser } from '@cedarjs/auth';
3
+ type AuthImplementationOptions = {
4
+ defaultGetTokenOptions?: GetTokenOptions;
5
+ };
6
+ export declare function createAuth(customProviderHooks?: {
7
+ useCurrentUser?: () => Promise<CurrentUser>;
8
+ useHasRole?: (currentUser: CurrentUser | null) => (rolesToCheck: string | string[]) => boolean;
9
+ }, authImplementationOptions?: AuthImplementationOptions): {
10
+ AuthContext: import("react").Context<import("@cedarjs/auth").AuthContextInterface<import("@clerk/types").UserResource | undefined, ({
11
+ path: string | undefined;
12
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "path">;
13
+ } & {
14
+ forceRedirectUrl?: string | null;
15
+ fallbackRedirectUrl?: string | null;
16
+ signInUrl?: string;
17
+ signUpUrl?: string;
18
+ appearance?: import("@clerk/types").SignInTheme;
19
+ initialValues?: import("@clerk/types").SignInInitialValues & import("@clerk/types").SignUpInitialValues;
20
+ __experimental?: Record<string, any> & {
21
+ newComponents?: boolean;
22
+ };
23
+ waitlistUrl?: string;
24
+ unsafeMetadata?: SignUpUnsafeMetadata;
25
+ withSignUp?: boolean;
26
+ oauthFlow?: "auto" | "redirect" | "popup";
27
+ oidcPrompt?: string;
28
+ } & import("@clerk/types").TransferableOption & import("@clerk/types").SignUpForceRedirectUrl & import("@clerk/types").SignUpFallbackRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl) | ({
29
+ path?: never;
30
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "hash" | "virtual">;
31
+ } & {
32
+ forceRedirectUrl?: string | null;
33
+ fallbackRedirectUrl?: string | null;
34
+ signInUrl?: string;
35
+ signUpUrl?: string;
36
+ appearance?: import("@clerk/types").SignInTheme;
37
+ initialValues?: import("@clerk/types").SignInInitialValues & import("@clerk/types").SignUpInitialValues;
38
+ __experimental?: Record<string, any> & {
39
+ newComponents?: boolean;
40
+ };
41
+ waitlistUrl?: string;
42
+ unsafeMetadata?: SignUpUnsafeMetadata;
43
+ withSignUp?: boolean;
44
+ oauthFlow?: "auto" | "redirect" | "popup";
45
+ oidcPrompt?: string;
46
+ } & import("@clerk/types").TransferableOption & import("@clerk/types").SignUpForceRedirectUrl & import("@clerk/types").SignUpFallbackRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl), void, SignOutCallback | SignOutOptions, void | undefined, ({
47
+ path: string | undefined;
48
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "path">;
49
+ } & {
50
+ forceRedirectUrl?: string | null;
51
+ fallbackRedirectUrl?: string | null;
52
+ signInUrl?: string;
53
+ appearance?: import("@clerk/types").SignUpTheme;
54
+ unsafeMetadata?: SignUpUnsafeMetadata;
55
+ initialValues?: import("@clerk/types").SignUpInitialValues;
56
+ __experimental?: Record<string, any> & {
57
+ newComponents?: boolean;
58
+ };
59
+ waitlistUrl?: string;
60
+ oauthFlow?: "auto" | "redirect" | "popup";
61
+ oidcPrompt?: string;
62
+ } & import("@clerk/types").SignInFallbackRedirectUrl & import("@clerk/types").SignInForceRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl) | ({
63
+ path?: never;
64
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "hash" | "virtual">;
65
+ } & {
66
+ forceRedirectUrl?: string | null;
67
+ fallbackRedirectUrl?: string | null;
68
+ signInUrl?: string;
69
+ appearance?: import("@clerk/types").SignUpTheme;
70
+ unsafeMetadata?: SignUpUnsafeMetadata;
71
+ initialValues?: import("@clerk/types").SignUpInitialValues;
72
+ __experimental?: Record<string, any> & {
73
+ newComponents?: boolean;
74
+ };
75
+ waitlistUrl?: string;
76
+ oauthFlow?: "auto" | "redirect" | "popup";
77
+ oidcPrompt?: string;
78
+ } & import("@clerk/types").SignInFallbackRedirectUrl & import("@clerk/types").SignInForceRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl), void, unknown, unknown, unknown, unknown, ClerkClient | null> | undefined>;
79
+ AuthProvider: ({ children }: import("@cedarjs/auth").AuthProviderProps) => import("react").JSX.Element;
80
+ useAuth: () => import("@cedarjs/auth").AuthContextInterface<import("@clerk/types").UserResource | undefined, ({
81
+ path: string | undefined;
82
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "path">;
83
+ } & {
84
+ forceRedirectUrl?: string | null;
85
+ fallbackRedirectUrl?: string | null;
86
+ signInUrl?: string;
87
+ signUpUrl?: string;
88
+ appearance?: import("@clerk/types").SignInTheme;
89
+ initialValues?: import("@clerk/types").SignInInitialValues & import("@clerk/types").SignUpInitialValues;
90
+ __experimental?: Record<string, any> & {
91
+ newComponents?: boolean;
92
+ };
93
+ waitlistUrl?: string;
94
+ unsafeMetadata?: SignUpUnsafeMetadata;
95
+ withSignUp?: boolean;
96
+ oauthFlow?: "auto" | "redirect" | "popup";
97
+ oidcPrompt?: string;
98
+ } & import("@clerk/types").TransferableOption & import("@clerk/types").SignUpForceRedirectUrl & import("@clerk/types").SignUpFallbackRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl) | ({
99
+ path?: never;
100
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "hash" | "virtual">;
101
+ } & {
102
+ forceRedirectUrl?: string | null;
103
+ fallbackRedirectUrl?: string | null;
104
+ signInUrl?: string;
105
+ signUpUrl?: string;
106
+ appearance?: import("@clerk/types").SignInTheme;
107
+ initialValues?: import("@clerk/types").SignInInitialValues & import("@clerk/types").SignUpInitialValues;
108
+ __experimental?: Record<string, any> & {
109
+ newComponents?: boolean;
110
+ };
111
+ waitlistUrl?: string;
112
+ unsafeMetadata?: SignUpUnsafeMetadata;
113
+ withSignUp?: boolean;
114
+ oauthFlow?: "auto" | "redirect" | "popup";
115
+ oidcPrompt?: string;
116
+ } & import("@clerk/types").TransferableOption & import("@clerk/types").SignUpForceRedirectUrl & import("@clerk/types").SignUpFallbackRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl), void, SignOutCallback | SignOutOptions, void | undefined, ({
117
+ path: string | undefined;
118
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "path">;
119
+ } & {
120
+ forceRedirectUrl?: string | null;
121
+ fallbackRedirectUrl?: string | null;
122
+ signInUrl?: string;
123
+ appearance?: import("@clerk/types").SignUpTheme;
124
+ unsafeMetadata?: SignUpUnsafeMetadata;
125
+ initialValues?: import("@clerk/types").SignUpInitialValues;
126
+ __experimental?: Record<string, any> & {
127
+ newComponents?: boolean;
128
+ };
129
+ waitlistUrl?: string;
130
+ oauthFlow?: "auto" | "redirect" | "popup";
131
+ oidcPrompt?: string;
132
+ } & import("@clerk/types").SignInFallbackRedirectUrl & import("@clerk/types").SignInForceRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl) | ({
133
+ path?: never;
134
+ routing?: Extract<import("@clerk/types").RoutingStrategy, "hash" | "virtual">;
135
+ } & {
136
+ forceRedirectUrl?: string | null;
137
+ fallbackRedirectUrl?: string | null;
138
+ signInUrl?: string;
139
+ appearance?: import("@clerk/types").SignUpTheme;
140
+ unsafeMetadata?: SignUpUnsafeMetadata;
141
+ initialValues?: import("@clerk/types").SignUpInitialValues;
142
+ __experimental?: Record<string, any> & {
143
+ newComponents?: boolean;
144
+ };
145
+ waitlistUrl?: string;
146
+ oauthFlow?: "auto" | "redirect" | "popup";
147
+ oidcPrompt?: string;
148
+ } & import("@clerk/types").SignInFallbackRedirectUrl & import("@clerk/types").SignInForceRedirectUrl & import("@clerk/types").LegacyRedirectProps & import("@clerk/types").AfterSignOutUrl), void, unknown, unknown, unknown, unknown, ClerkClient | null>;
149
+ };
150
+ export {};
151
+ //# sourceMappingURL=clerk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../../src/clerk.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,eAAe,EACf,KAAK,IAAI,WAAW,EACpB,eAAe,EACf,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAKhD,KAAK,yBAAyB,GAAG;IAC/B,sBAAsB,CAAC,EAAE,eAAe,CAAA;CACzC,CAAA;AAED,wBAAgB,UAAU,CACxB,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WAAW,GAAG,IAAI,KAC5B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAA;CAClD,EACD,yBAAyB,CAAC,EAAE,yBAAyB;;;;;;;;;;;;yBA4D0/tU,CAAC;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;yBAAilK,CAAC;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;yBAAnlK,CAAC;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;yBAAilK,CAAC;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;EAvDno4U"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var clerk_exports = {};
20
+ __export(clerk_exports, {
21
+ createAuth: () => createAuth
22
+ });
23
+ module.exports = __toCommonJS(clerk_exports);
24
+ var import_auth = require("@cedarjs/auth");
25
+ function createAuth(customProviderHooks, authImplementationOptions) {
26
+ const authImplementation = createAuthImplementation(authImplementationOptions);
27
+ return (0, import_auth.createAuthentication)(authImplementation, customProviderHooks);
28
+ }
29
+ function createAuthImplementation({
30
+ defaultGetTokenOptions = {}
31
+ } = {}) {
32
+ return {
33
+ type: "clerk",
34
+ // Using a getter here to make sure we're always returning a fresh value
35
+ // and not creating a closure around an old (probably `undefined`) value
36
+ // for Clerk that'll we always return, even when Clerk on the window object
37
+ // eventually refreshes
38
+ get client() {
39
+ return typeof window === "undefined" ? void 0 : window.Clerk;
40
+ },
41
+ login: async (options) => {
42
+ const clerk = window.Clerk;
43
+ clerk?.openSignIn(options || {});
44
+ },
45
+ logout: async (callbackOrOptions, options) => {
46
+ const clerk = window.Clerk;
47
+ return clerk?.signOut(callbackOrOptions, options);
48
+ },
49
+ signup: async (options) => {
50
+ const clerk = window.Clerk;
51
+ clerk?.openSignUp(options || {});
52
+ },
53
+ getToken: async (options) => {
54
+ const clerk = window.Clerk;
55
+ let token;
56
+ try {
57
+ token = await clerk?.session?.getToken({
58
+ ...defaultGetTokenOptions,
59
+ ...options
60
+ });
61
+ } catch {
62
+ token = null;
63
+ }
64
+ return token || null;
65
+ },
66
+ getUserMetadata: async () => {
67
+ const clerk = window.Clerk;
68
+ return clerk?.user;
69
+ },
70
+ clientHasLoaded: () => {
71
+ return window.Clerk !== void 0;
72
+ },
73
+ loadWhileReauthenticating: true
74
+ };
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ createAuth
79
+ });
@@ -0,0 +1,2 @@
1
+ export { createAuth } from './clerk.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ createAuth: () => import_clerk.createAuth
22
+ });
23
+ module.exports = __toCommonJS(index_exports);
24
+ var import_clerk = require("./clerk.js");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ createAuth
28
+ });
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-clerk-web",
3
- "version": "5.0.4-next.167",
3
+ "version": "5.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,19 +10,28 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "default": {
13
+ "import": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
+ },
17
+ "default": {
18
+ "types": "./dist/cjs/index.d.ts",
19
+ "default": "./dist/cjs/index.js"
16
20
  }
17
21
  },
18
22
  "./dist/clerk": {
19
- "default": {
23
+ "import": {
20
24
  "types": "./dist/clerk.d.ts",
21
25
  "default": "./dist/clerk.js"
26
+ },
27
+ "default": {
28
+ "types": "./dist/cjs/clerk.d.ts",
29
+ "default": "./dist/cjs/clerk.js"
22
30
  }
23
31
  }
24
32
  },
25
- "main": "./dist/index.js",
33
+ "main": "./dist/cjs/index.js",
34
+ "module": "./dist/index.js",
26
35
  "types": "./dist/index.d.ts",
27
36
  "files": [
28
37
  "dist"
@@ -31,6 +40,7 @@
31
40
  "build": "node ./build.ts",
32
41
  "build:pack": "yarn pack -o cedarjs-auth-clerk-web.tgz",
33
42
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
43
+ "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
34
44
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
35
45
  "check:attw": "yarn cedar-fwtools-attw",
36
46
  "check:package": "concurrently npm:check:attw yarn:publint",
@@ -39,17 +49,18 @@
39
49
  "test:watch": "vitest watch"
40
50
  },
41
51
  "dependencies": {
42
- "@cedarjs/auth": "5.0.4-next.167"
52
+ "@cedarjs/auth": "5.0.4"
43
53
  },
44
54
  "devDependencies": {
45
- "@cedarjs/framework-tools": "5.0.4-next.167",
55
+ "@cedarjs/framework-tools": "5.0.4",
56
+ "@clerk/clerk-react": "5.61.3",
46
57
  "@clerk/types": "4.101.20",
47
58
  "@types/react": "^18.2.55",
48
59
  "concurrently": "9.2.4",
49
- "publint": "0.3.22",
60
+ "publint": "0.3.21",
50
61
  "react": "18.3.1",
51
62
  "typescript": "5.9.3",
52
- "vitest": "4.1.10"
63
+ "vitest": "3.2.6"
53
64
  },
54
65
  "peerDependencies": {
55
66
  "@clerk/clerk-react": "5.61.3"