Skip to content

Commit f14cdf6

Browse files
committed
feat: add isCustomDomain utility method.
1 parent e847a88 commit f14cdf6

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

lib/main.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe("index exports", () => {
4343
"exchangeAuthCode",
4444
"isAuthenticated",
4545
"refreshToken",
46+
"isCustomDomain",
4647

4748
// session manager
4849
"MemoryStorage",

lib/utils/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { sanitizeUrl } from "./sanitizeUrl";
66
import { generateAuthUrl } from "./generateAuthUrl";
77
import { mapLoginMethodParamsForUrl } from "./mapLoginMethodParamsForUrl";
88
import { exchangeAuthCode, frameworkSettings } from "./exchangeAuthCode";
9+
import { isCustomDomain } from "./isCustomDomain";
910

1011
export {
1112
// config
@@ -19,4 +20,5 @@ export {
1920
generateAuthUrl,
2021
mapLoginMethodParamsForUrl,
2122
exchangeAuthCode,
23+
isCustomDomain,
2224
};

lib/utils/isCustomDomain.test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { isCustomDomain } from "./isCustomDomain";
2+
import { describe, expect, it } from "vitest";
3+
4+
describe.only("isCustomDomain", () => {
5+
it("custom domain in use", () => {
6+
const result = isCustomDomain("www.test.com");
7+
expect(result).toEqual(true);
8+
});
9+
it("custom domain not in use", () => {
10+
const result = isCustomDomain("test.kinde.com");
11+
expect(result).toEqual(false);
12+
});
13+
});

lib/utils/isCustomDomain.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const isCustomDomain = (domain: string): boolean => {
2+
return !domain.match("^[a-zA-Z]*.kinde.com");
3+
}

0 commit comments

Comments
 (0)