@clerk/shared
Advanced tools
Comparing version 0.19.1 to 0.20.0-snapshot.73a3055
@@ -21,2 +21,3 @@ "use strict"; | ||
__export(errors_exports, { | ||
is4xxError: () => is4xxError, | ||
isNetworkError: () => isNetworkError, | ||
@@ -31,2 +32,6 @@ isUnauthorizedError: () => isUnauthorizedError | ||
} | ||
function is4xxError(e) { | ||
const status = e?.status; | ||
return !!status && status >= 400 && status < 500; | ||
} | ||
function isNetworkError(e) { | ||
@@ -38,2 +43,3 @@ const message = (`${e.message}${e.name}` || "").toLowerCase().replace(/\s+/g, ""); | ||
0 && (module.exports = { | ||
is4xxError, | ||
isNetworkError, | ||
@@ -40,0 +46,0 @@ isUnauthorizedError |
@@ -22,2 +22,4 @@ "use strict"; | ||
addClerkPrefix: () => addClerkPrefix, | ||
isCrossOrigin: () => isCrossOrigin, | ||
isRelativeUrl: () => isRelativeUrl, | ||
parseSearchParams: () => parseSearchParams, | ||
@@ -27,2 +29,3 @@ stripScheme: () => stripScheme | ||
module.exports = __toCommonJS(url_exports); | ||
const DUMMY_URL_BASE = "http://clerk-dummy"; | ||
function parseSearchParams(queryString = "") { | ||
@@ -52,5 +55,17 @@ if (queryString.startsWith("?")) { | ||
} | ||
function isRelativeUrl(str) { | ||
const url = new URL(str, DUMMY_URL_BASE); | ||
return url.origin === DUMMY_URL_BASE; | ||
} | ||
function isCrossOrigin(str1, str2) { | ||
const base = typeof window === void 0 ? DUMMY_URL_BASE : window.location.origin; | ||
const url1 = new URL(str1, base); | ||
const url2 = new URL(str2, base); | ||
return url1.origin !== url2.origin; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
addClerkPrefix, | ||
isCrossOrigin, | ||
isRelativeUrl, | ||
parseSearchParams, | ||
@@ -57,0 +72,0 @@ stripScheme |
@@ -6,2 +6,6 @@ function isUnauthorizedError(e) { | ||
} | ||
function is4xxError(e) { | ||
const status = e?.status; | ||
return !!status && status >= 400 && status < 500; | ||
} | ||
function isNetworkError(e) { | ||
@@ -12,2 +16,3 @@ const message = (`${e.message}${e.name}` || "").toLowerCase().replace(/\s+/g, ""); | ||
export { | ||
is4xxError, | ||
isNetworkError, | ||
@@ -14,0 +19,0 @@ isUnauthorizedError |
@@ -0,1 +1,2 @@ | ||
const DUMMY_URL_BASE = "http://clerk-dummy"; | ||
function parseSearchParams(queryString = "") { | ||
@@ -25,4 +26,16 @@ if (queryString.startsWith("?")) { | ||
} | ||
function isRelativeUrl(str) { | ||
const url = new URL(str, DUMMY_URL_BASE); | ||
return url.origin === DUMMY_URL_BASE; | ||
} | ||
function isCrossOrigin(str1, str2) { | ||
const base = typeof window === void 0 ? DUMMY_URL_BASE : window.location.origin; | ||
const url1 = new URL(str1, base); | ||
const url2 = new URL(str2, base); | ||
return url1.origin !== url2.origin; | ||
} | ||
export { | ||
addClerkPrefix, | ||
isCrossOrigin, | ||
isRelativeUrl, | ||
parseSearchParams, | ||
@@ -29,0 +42,0 @@ stripScheme |
export declare function isUnauthorizedError(e: any): boolean; | ||
export declare function is4xxError(e: any): boolean; | ||
export declare function isNetworkError(e: any): boolean; | ||
//# sourceMappingURL=errors.d.ts.map |
export declare function parseSearchParams(queryString?: string): URLSearchParams; | ||
export declare function stripScheme(url?: string): string; | ||
export declare function addClerkPrefix(str: string | undefined): string; | ||
export declare function isRelativeUrl(str: string): boolean; | ||
export declare function isCrossOrigin(str1: string, str2: string): boolean; | ||
//# sourceMappingURL=url.d.ts.map |
{ | ||
"name": "@clerk/shared", | ||
"version": "0.19.1", | ||
"version": "0.20.0-snapshot.73a3055", | ||
"description": "Internal package utils used by the Clerk SDKs", | ||
@@ -38,3 +38,3 @@ "types": "./dist/types/index.d.ts", | ||
"devDependencies": { | ||
"@clerk/types": "^3.42.0", | ||
"@clerk/types": "3.46.1-snapshot.73a3055", | ||
"@types/glob-to-regexp": "0.4.1", | ||
@@ -41,0 +41,0 @@ "@types/js-cookie": "3.0.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
462964
5301