@clerk/shared 3.22.1 → 3.23.0

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.
@@ -4,6 +4,6 @@
4
4
  * @param publishableKey - The publishable key to parse.
5
5
  * @returns One of Clerk's API URLs.
6
6
  */
7
- declare const apiUrlFromPublishableKey: (publishableKey: string) => "https://api.lclclerk.com" | "https://api.clerkstage.dev" | "https://api.clerk.com";
7
+ declare const apiUrlFromPublishableKey: (publishableKey: string) => "https://api.clerk.com" | "https://api.lclclerk.com" | "https://api.clerkstage.dev";
8
8
 
9
9
  export { apiUrlFromPublishableKey };
@@ -4,6 +4,6 @@
4
4
  * @param publishableKey - The publishable key to parse.
5
5
  * @returns One of Clerk's API URLs.
6
6
  */
7
- declare const apiUrlFromPublishableKey: (publishableKey: string) => "https://api.lclclerk.com" | "https://api.clerkstage.dev" | "https://api.clerk.com";
7
+ declare const apiUrlFromPublishableKey: (publishableKey: string) => "https://api.clerk.com" | "https://api.lclclerk.com" | "https://api.clerkstage.dev";
8
8
 
9
9
  export { apiUrlFromPublishableKey };
@@ -1,12 +1,12 @@
1
1
  // src/versionSelector.ts
2
- var versionSelector = (clerkJSVersion, packageVersion = "5.89.0") => {
2
+ var versionSelector = (clerkJSVersion, packageVersion = "5.90.0") => {
3
3
  if (clerkJSVersion) {
4
4
  return clerkJSVersion;
5
5
  }
6
6
  const prereleaseTag = getPrereleaseTag(packageVersion);
7
7
  if (prereleaseTag) {
8
8
  if (prereleaseTag === "snapshot") {
9
- return "5.89.0";
9
+ return "5.90.0";
10
10
  }
11
11
  return prereleaseTag;
12
12
  }
@@ -19,4 +19,4 @@ export {
19
19
  versionSelector,
20
20
  getMajorVersion
21
21
  };
22
- //# sourceMappingURL=chunk-3WOXVFBV.mjs.map
22
+ //# sourceMappingURL=chunk-3WDALBMO.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  versionSelector
3
- } from "./chunk-3WOXVFBV.mjs";
3
+ } from "./chunk-3WDALBMO.mjs";
4
4
  import {
5
5
  isValidProxyUrl,
6
6
  proxyUrlToAbsoluteURL
@@ -139,4 +139,4 @@ export {
139
139
  clerkJsScriptUrl,
140
140
  buildClerkJsScriptAttributes
141
141
  };
142
- //# sourceMappingURL=chunk-WNUQLZBG.mjs.map
142
+ //# sourceMappingURL=chunk-ZIFNY2NJ.mjs.map
package/dist/index.js CHANGED
@@ -1276,14 +1276,14 @@ var ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
1276
1276
  var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
1277
1277
 
1278
1278
  // src/versionSelector.ts
1279
- var versionSelector = (clerkJSVersion, packageVersion = "5.89.0") => {
1279
+ var versionSelector = (clerkJSVersion, packageVersion = "5.90.0") => {
1280
1280
  if (clerkJSVersion) {
1281
1281
  return clerkJSVersion;
1282
1282
  }
1283
1283
  const prereleaseTag = getPrereleaseTag(packageVersion);
1284
1284
  if (prereleaseTag) {
1285
1285
  if (prereleaseTag === "snapshot") {
1286
- return "5.89.0";
1286
+ return "5.90.0";
1287
1287
  }
1288
1288
  return prereleaseTag;
1289
1289
  }
package/dist/index.mjs CHANGED
@@ -36,10 +36,10 @@ import {
36
36
  clerkJsScriptUrl,
37
37
  loadClerkJsScript,
38
38
  setClerkJsLoadingErrorPackageName
39
- } from "./chunk-WNUQLZBG.mjs";
39
+ } from "./chunk-ZIFNY2NJ.mjs";
40
40
  import {
41
41
  versionSelector
42
- } from "./chunk-3WOXVFBV.mjs";
42
+ } from "./chunk-3WDALBMO.mjs";
43
43
  import {
44
44
  isHttpOrHttps,
45
45
  isProxyUrlRelative,
@@ -334,14 +334,14 @@ function addClerkPrefix(str) {
334
334
  }
335
335
 
336
336
  // src/versionSelector.ts
337
- var versionSelector = (clerkJSVersion, packageVersion = "5.89.0") => {
337
+ var versionSelector = (clerkJSVersion, packageVersion = "5.90.0") => {
338
338
  if (clerkJSVersion) {
339
339
  return clerkJSVersion;
340
340
  }
341
341
  const prereleaseTag = getPrereleaseTag(packageVersion);
342
342
  if (prereleaseTag) {
343
343
  if (prereleaseTag === "snapshot") {
344
- return "5.89.0";
344
+ return "5.90.0";
345
345
  }
346
346
  return prereleaseTag;
347
347
  }
@@ -3,8 +3,8 @@ import {
3
3
  clerkJsScriptUrl,
4
4
  loadClerkJsScript,
5
5
  setClerkJsLoadingErrorPackageName
6
- } from "./chunk-WNUQLZBG.mjs";
7
- import "./chunk-3WOXVFBV.mjs";
6
+ } from "./chunk-ZIFNY2NJ.mjs";
7
+ import "./chunk-3WDALBMO.mjs";
8
8
  import "./chunk-6NDGN2IU.mjs";
9
9
  import "./chunk-IFTVZ2LQ.mjs";
10
10
  import "./chunk-3TMSNP4L.mjs";
@@ -708,6 +708,8 @@ declare const useSessionList: () => UseSessionListReturn;
708
708
  * The following example uses the `useUser()` hook to access the [`User`](https://clerk.com/docs/references/javascript/user) object, which contains the current user's data such as their full name. The `isLoaded` and `isSignedIn` properties are used to handle the loading state and to check if the user is signed in, respectively.
709
709
  *
710
710
  * ```tsx {{ filename: 'src/Example.tsx' }}
711
+ * import { useUser } from '@clerk/clerk-react'
712
+ *
711
713
  * export default function Example() {
712
714
  * const { isSignedIn, user, isLoaded } = useUser()
713
715
  *
@@ -735,14 +737,14 @@ declare const useSessionList: () => UseSessionListReturn;
735
737
  * import { useUser } from '@clerk/clerk-react'
736
738
  *
737
739
  * export default function Home() {
738
- * const { isLoaded, user } = useUser()
740
+ * const { isSignedIn, isLoaded, user } = useUser()
739
741
  *
740
742
  * if (!isLoaded) {
741
743
  * // Handle loading state
742
744
  * return null
743
745
  * }
744
746
  *
745
- * if (!user) return null
747
+ * if (!isSignedIn) return null
746
748
  *
747
749
  * const updateUser = async () => {
748
750
  * await user.update({
@@ -754,8 +756,8 @@ declare const useSessionList: () => UseSessionListReturn;
754
756
  * return (
755
757
  * <>
756
758
  * <button onClick={updateUser}>Update your name</button>
757
- * <p>user.firstName: {user?.firstName}</p>
758
- * <p>user.lastName: {user?.lastName}</p>
759
+ * <p>user.firstName: {user.firstName}</p>
760
+ * <p>user.lastName: {user.lastName}</p>
759
761
  * </>
760
762
  * )
761
763
  * }
@@ -780,34 +782,39 @@ declare const useSessionList: () => UseSessionListReturn;
780
782
  * import { useUser } from '@clerk/clerk-react'
781
783
  *
782
784
  * export default function Home() {
783
- * const { isLoaded, user } = useUser()
785
+ * const { isSignedIn, isLoaded, user } = useUser();
784
786
  *
785
787
  * if (!isLoaded) {
786
788
  * // Handle loading state
787
- * return null
789
+ * return null;
788
790
  * }
789
791
  *
790
- * if (!user) return null
792
+ * if (!isSignedIn) return null;
791
793
  *
792
794
  * const updateUser = async () => {
793
795
  * // Update data via an API endpoint
794
- * const updateMetadata = await fetch('/api/updateMetadata')
796
+ * const updateMetadata = await fetch('/api/updateMetadata', {
797
+ * method: 'POST',
798
+ * body: JSON.stringify({
799
+ * role: 'admin'
800
+ * })
801
+ * });
795
802
  *
796
803
  * // Check if the update was successful
797
- * if (updateMetadata.message !== 'success') {
798
- * throw new Error('Error updating')
804
+ * if ((await updateMetadata.json()).message !== 'success') {
805
+ * throw new Error('Error updating');
799
806
  * }
800
807
  *
801
808
  * // If the update was successful, reload the user data
802
- * await user.reload()
803
- * }
809
+ * await user.reload();
810
+ * };
804
811
  *
805
812
  * return (
806
813
  * <>
807
814
  * <button onClick={updateUser}>Update your metadata</button>
808
- * <p>user role: {user?.publicMetadata.role}</p>
815
+ * <p>user role: {user.publicMetadata.role}</p>
809
816
  * </>
810
- * )
817
+ * );
811
818
  * }
812
819
  * ```
813
820
  *
@@ -708,6 +708,8 @@ declare const useSessionList: () => UseSessionListReturn;
708
708
  * The following example uses the `useUser()` hook to access the [`User`](https://clerk.com/docs/references/javascript/user) object, which contains the current user's data such as their full name. The `isLoaded` and `isSignedIn` properties are used to handle the loading state and to check if the user is signed in, respectively.
709
709
  *
710
710
  * ```tsx {{ filename: 'src/Example.tsx' }}
711
+ * import { useUser } from '@clerk/clerk-react'
712
+ *
711
713
  * export default function Example() {
712
714
  * const { isSignedIn, user, isLoaded } = useUser()
713
715
  *
@@ -735,14 +737,14 @@ declare const useSessionList: () => UseSessionListReturn;
735
737
  * import { useUser } from '@clerk/clerk-react'
736
738
  *
737
739
  * export default function Home() {
738
- * const { isLoaded, user } = useUser()
740
+ * const { isSignedIn, isLoaded, user } = useUser()
739
741
  *
740
742
  * if (!isLoaded) {
741
743
  * // Handle loading state
742
744
  * return null
743
745
  * }
744
746
  *
745
- * if (!user) return null
747
+ * if (!isSignedIn) return null
746
748
  *
747
749
  * const updateUser = async () => {
748
750
  * await user.update({
@@ -754,8 +756,8 @@ declare const useSessionList: () => UseSessionListReturn;
754
756
  * return (
755
757
  * <>
756
758
  * <button onClick={updateUser}>Update your name</button>
757
- * <p>user.firstName: {user?.firstName}</p>
758
- * <p>user.lastName: {user?.lastName}</p>
759
+ * <p>user.firstName: {user.firstName}</p>
760
+ * <p>user.lastName: {user.lastName}</p>
759
761
  * </>
760
762
  * )
761
763
  * }
@@ -780,34 +782,39 @@ declare const useSessionList: () => UseSessionListReturn;
780
782
  * import { useUser } from '@clerk/clerk-react'
781
783
  *
782
784
  * export default function Home() {
783
- * const { isLoaded, user } = useUser()
785
+ * const { isSignedIn, isLoaded, user } = useUser();
784
786
  *
785
787
  * if (!isLoaded) {
786
788
  * // Handle loading state
787
- * return null
789
+ * return null;
788
790
  * }
789
791
  *
790
- * if (!user) return null
792
+ * if (!isSignedIn) return null;
791
793
  *
792
794
  * const updateUser = async () => {
793
795
  * // Update data via an API endpoint
794
- * const updateMetadata = await fetch('/api/updateMetadata')
796
+ * const updateMetadata = await fetch('/api/updateMetadata', {
797
+ * method: 'POST',
798
+ * body: JSON.stringify({
799
+ * role: 'admin'
800
+ * })
801
+ * });
795
802
  *
796
803
  * // Check if the update was successful
797
- * if (updateMetadata.message !== 'success') {
798
- * throw new Error('Error updating')
804
+ * if ((await updateMetadata.json()).message !== 'success') {
805
+ * throw new Error('Error updating');
799
806
  * }
800
807
  *
801
808
  * // If the update was successful, reload the user data
802
- * await user.reload()
803
- * }
809
+ * await user.reload();
810
+ * };
804
811
  *
805
812
  * return (
806
813
  * <>
807
814
  * <button onClick={updateUser}>Update your metadata</button>
808
- * <p>user role: {user?.publicMetadata.role}</p>
815
+ * <p>user role: {user.publicMetadata.role}</p>
809
816
  * </>
810
- * )
817
+ * );
811
818
  * }
812
819
  * ```
813
820
  *