* refactor: apply biome formatting to packages/features (batch 1 - small subdirs) Format small subdirectories in packages/features: di, flags, holidays, oauth, settings, users, assignment-reason, selectedCalendar, hashedLink, host, form, form-builder, availability, data-table, pbac, schedules, troubleshooter, eventtypes, calendar-subscription, and root-level files. Also includes straggler apps/web BookEventForm.tsx. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: apply biome formatting to packages/features (batch 2 - medium subdirs) Format medium subdirectories in packages/features: auth, credentials, calendars, routing-forms, routing-trace, attributes, watchlist, calAIPhone, tasker, and webhooks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: apply biome formatting to packages/features (batch 3 - bookings + insights) Format bookings and insights subdirectories in packages/features. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: apply biome formatting to packages/features (batch 4 - ee) Format packages/features/ee subdirectory covering billing, workflows, organizations, teams, managed-event-types, round-robin, dsync, integration-attribute-sync, and payments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: apply biome formatting to packages/features (batch 5 - booking-audit part 1) Format booking-audit di, actions, common, dto, repository, and types subdirectories in packages/features/booking-audit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: apply biome formatting to packages/features (batch 6 - booking-audit part 2) Format booking-audit service subdirectory in packages/features/booking-audit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
1.5 KiB
TypeScript
71 lines
1.5 KiB
TypeScript
export function extractDomainFromEmail(email: string) {
|
|
let out = "";
|
|
try {
|
|
const match = email.match(/^(?:.*?:\/\/)?.*?([\w-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[/?#:]|$)/);
|
|
out = (match && match[1]) ?? "";
|
|
} catch {
|
|
/* empty */
|
|
}
|
|
return out.split(".")[0];
|
|
}
|
|
|
|
/**
|
|
* Checks if an email is a company email (not a personal email provider)
|
|
*/
|
|
export function isCompanyEmail(email: string): boolean {
|
|
// A list of popular @domains that are personal email providers
|
|
const personalEmailProviders = [
|
|
"gmail.com",
|
|
"googlemail.com",
|
|
"yahoo.com",
|
|
"ymail.com",
|
|
"rocketmail.com",
|
|
"sbcglobal.net",
|
|
"att.net",
|
|
"outlook.com",
|
|
"hotmail.com",
|
|
"live.com",
|
|
"msn.com",
|
|
"outlook.co",
|
|
"hotmail.co.uk",
|
|
"aol.com",
|
|
"icloud.com",
|
|
"me.com",
|
|
"mac.com",
|
|
"mail.com",
|
|
"email.com",
|
|
"post.com",
|
|
"consultant.com",
|
|
"myself.com",
|
|
"dr.com",
|
|
"europe.com",
|
|
"engineer.com",
|
|
"asia.com",
|
|
"usa.com",
|
|
"protonmail.com",
|
|
"proton.me",
|
|
"pm.me",
|
|
"protonmail.ch",
|
|
"zoho.com",
|
|
"yandex.com",
|
|
"gmx.com",
|
|
"gmx.de",
|
|
"fastmail.com",
|
|
"inbox.com",
|
|
"hushmail.com",
|
|
"rediffmail.com",
|
|
"tutanota.com",
|
|
"mail.ru",
|
|
"qq.com",
|
|
"163.com",
|
|
"naver.com",
|
|
"web.de",
|
|
"excite.com",
|
|
"lycos.com",
|
|
];
|
|
|
|
const emailParts = email.split("@");
|
|
if (emailParts.length < 2) return false;
|
|
return !personalEmailProviders.includes(emailParts[1].toLowerCase());
|
|
}
|