You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/types/src/hooks.ts
+6-150
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ type CheckAuthorizationWithoutOrgOrUser = (params: Parameters<CheckAuthorization
17
17
18
18
/**
19
19
* Return values of the `useAuth()` hook
20
+
* @interface
20
21
*/
21
22
exporttypeUseAuthReturn=
22
23
|{
@@ -63,137 +64,48 @@ export type UseAuthReturn =
63
64
getToken: GetToken;
64
65
}
65
66
|{
66
-
/**
67
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
68
-
*/
69
67
isLoaded: true;
70
-
/**
71
-
* A boolean that indicates whether a user is currently signed in.
72
-
*/
73
68
isSignedIn: false;
74
-
/**
75
-
* The ID of the current user.
76
-
*/
77
69
userId: null;
78
-
/**
79
-
* The ID for the current session.
80
-
*/
81
70
sessionId: null;
82
71
actor: null;
83
-
/**
84
-
* The ID of the user's active organization.
85
-
*/
86
72
orgId: null;
87
-
/**
88
-
* The current user's role in their active organization.
89
-
*/
90
73
orgRole: null;
91
-
/**
92
-
* The URL-friendly identifier of the user's active organization.
93
-
*/
94
74
orgSlug: null;
95
-
/**
96
-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
97
-
*/
98
75
has: CheckAuthorizationWithoutOrgOrUser;
99
-
/**
100
-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
101
-
*/
102
76
signOut: SignOut;
103
-
/**
104
-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
105
-
*/
106
77
getToken: GetToken;
107
78
}
108
79
|{
109
-
/**
110
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
111
-
*/
112
80
isLoaded: true;
113
-
/**
114
-
* A boolean that indicates whether a user is currently signed in.
115
-
*/
116
81
isSignedIn: true;
117
-
/**
118
-
* The ID of the current user.
119
-
*/
120
82
userId: string;
121
-
/**
122
-
* The ID for the current session.
123
-
*/
124
83
sessionId: string;
125
84
actor: ActJWTClaim|null;
126
-
/**
127
-
* The ID of the user's active organization.
128
-
*/
129
85
orgId: null;
130
-
/**
131
-
* The current user's role in their active organization.
132
-
*/
133
86
orgRole: null;
134
-
/**
135
-
* The URL-friendly identifier of the user's active organization.
136
-
*/
137
87
orgSlug: null;
138
-
/**
139
-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
140
-
*/
141
88
has: CheckAuthorizationWithCustomPermissions;
142
-
/**
143
-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
144
-
*/
145
89
signOut: SignOut;
146
-
/**
147
-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
148
-
*/
149
90
getToken: GetToken;
150
91
}
151
92
|{
152
-
/**
153
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
154
-
*/
155
93
isLoaded: true;
156
-
/**
157
-
* A boolean that indicates whether a user is currently signed in.
158
-
*/
159
94
isSignedIn: true;
160
-
/**
161
-
* The ID of the current user.
162
-
*/
163
95
userId: string;
164
-
/**
165
-
* The ID for the current session.
166
-
*/
167
96
sessionId: string;
168
97
actor: ActJWTClaim|null;
169
-
/**
170
-
* The ID of the user's active organization.
171
-
*/
172
98
orgId: string;
173
-
/**
174
-
* The current user's role in their active organization.
175
-
*/
176
99
orgRole: OrganizationCustomRoleKey;
177
-
/**
178
-
* The URL-friendly identifier of the user's active organization.
179
-
*/
180
100
orgSlug: string|null;
181
-
/**
182
-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
183
-
*/
184
101
has: CheckAuthorizationWithCustomPermissions;
185
-
/**
186
-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
187
-
*/
188
102
signOut: SignOut;
189
-
/**
190
-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
191
-
*/
192
103
getToken: GetToken;
193
104
};
194
105
195
106
/**
196
107
* Return values of the `useSignIn()` hook
108
+
* @interface
197
109
*/
198
110
exporttypeUseSignInReturn=
199
111
|{
@@ -211,22 +123,14 @@ export type UseSignInReturn =
211
123
setActive: undefined;
212
124
}
213
125
|{
214
-
/**
215
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
216
-
*/
217
126
isLoaded: true;
218
-
/**
219
-
* An object that contains the current sign-in attempt status and methods to create a new sign-in attempt.
220
-
*/
221
127
signIn: SignInResource;
222
-
/**
223
-
* A function that sets the active session.
224
-
*/
225
128
setActive: SetActive;
226
129
};
227
130
228
131
/**
229
132
* Return values of the `useSignUp()` hook
133
+
* @interface
230
134
*/
231
135
exporttypeUseSignUpReturn=
232
136
|{
@@ -244,22 +148,14 @@ export type UseSignUpReturn =
244
148
setActive: undefined;
245
149
}
246
150
|{
247
-
/**
248
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
249
-
*/
250
151
isLoaded: true;
251
-
/**
252
-
* An object that contains the current sign-up attempt status and methods to create a new sign-up attempt.
253
-
*/
254
152
signUp: SignUpResource;
255
-
/**
256
-
* A function that sets the active session.
257
-
*/
258
153
setActive: SetActive;
259
154
};
260
155
261
156
/**
262
157
* Return values of the `useSession()` hook
158
+
* @interface
263
159
*/
264
160
exporttypeUseSessionReturn=
265
161
|{
@@ -277,36 +173,19 @@ export type UseSessionReturn =
277
173
session: undefined;
278
174
}
279
175
|{
280
-
/**
281
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
282
-
*/
283
176
isLoaded: true;
284
-
/**
285
-
* A boolean that indicates whether a user is currently signed in.
286
-
*/
287
177
isSignedIn: false;
288
-
/**
289
-
* Holds the current active session for the user.
290
-
*/
291
178
session: null;
292
179
}
293
180
|{
294
-
/**
295
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
296
-
*/
297
181
isLoaded: true;
298
-
/**
299
-
* A boolean that indicates whether a user is currently signed in.
300
-
*/
301
182
isSignedIn: true;
302
-
/**
303
-
* Holds the current active session for the user.
304
-
*/
305
183
session: ActiveSessionResource;
306
184
};
307
185
308
186
/**
309
187
* Return values of the `useSessionList()` hook
188
+
* @interface
310
189
*/
311
190
exporttypeUseSessionListReturn=
312
191
|{
@@ -324,22 +203,14 @@ export type UseSessionListReturn =
324
203
setActive: undefined;
325
204
}
326
205
|{
327
-
/**
328
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
329
-
*/
330
206
isLoaded: true;
331
-
/**
332
-
* A list of sessions that have been registered on the client device.
333
-
*/
334
207
sessions: SessionResource[];
335
-
/**
336
-
* A function that sets the active session and/or organization.
337
-
*/
338
208
setActive: SetActive;
339
209
};
340
210
341
211
/**
342
212
* Return values of the `useUser()` hook
213
+
* @interface
343
214
*/
344
215
exporttypeUseUserReturn=
345
216
|{
@@ -358,26 +229,11 @@ export type UseUserReturn =
358
229
}
359
230
|{
360
231
isLoaded: true;
361
-
/**
362
-
* A boolean that indicates whether a user is currently signed in.
363
-
*/
364
232
isSignedIn: false;
365
-
/**
366
-
* The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
367
-
*/
368
233
user: null;
369
234
}
370
235
|{
371
-
/**
372
-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
373
-
*/
374
236
isLoaded: true;
375
-
/**
376
-
* A boolean that indicates whether a user is currently signed in.
377
-
*/
378
237
isSignedIn: true;
379
-
/**
380
-
* The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
0 commit comments