Implement Cloudflare custom domain management flow

- Added support for connecting, refreshing, and removing custom domains through Cloudflare.
- Updated API routes and validation schemas to handle new domain actions.
- Refactored domain management logic in the dashboard to accommodate Cloudflare integration.
- Enhanced user experience with clear status messages and DNS instructions for domain setup.
- Updated translations and UI components to reflect new domain management features.
This commit is contained in:
Rotimi Best
2026-03-27 09:12:53 +01:00
parent 3919ff6c2f
commit f3d212f984
23 changed files with 1376 additions and 244 deletions
@@ -1,27 +1,25 @@
import type { DomainRequestData } from '$features/org/utils/types';
import { orgApi } from '$features/org/api/org.svelte';
export const sanitizeDomain = (domain: string) => {
return domain
.trim()
.toLowerCase()
.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '')
.split('/')[0];
.replace(/^https?:\/\//i, '')
.split('/')[0]
.replace(/\.$/, '');
};
export async function sendDomainRequest(
key: 'verify_domain' | 'add_domain' | 'remove_domain',
action: 'connect' | 'refresh' | 'remove',
domain: string
): Promise<{ success: boolean; data?: unknown; verified?: boolean; message?: string }> {
const response = await orgApi.sendDomainRequest(key, domain);
if (orgApi.success && response) {
const data = 'data' in response ? response.data : null;
const verified = 'verified' in response ? response.verified : undefined;
): Promise<{ success: boolean; data?: DomainRequestData; message?: string }> {
const response = await orgApi.sendDomainRequest(action, domain);
if (orgApi.success && response?.data) {
return {
success: true,
data,
verified
data: response.data
};
}