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
@@ -353,23 +353,21 @@ class OrgApi extends BaseApiWithErrors {
}
/**
* Sends a domain request (verify, add, or remove domain)
* @param key Domain operation key: 'verify_domain', 'add_domain', or 'remove_domain'
* Sends a domain request (connect, refresh, or remove)
* @param action Domain operation action
* @param domain Domain name
* @returns Domain request response data
*/
async sendDomainRequest(key: 'verify_domain' | 'add_domain' | 'remove_domain', domain: string) {
async sendDomainRequest(action: 'connect' | 'refresh' | 'remove', domain: string) {
return this.execute<DomainRequestRequest>({
requestFn: () =>
classroomio.domain.$post({
json: {
params: {
key,
domain
}
action,
domain
}
}),
logContext: `processing domain request: ${key}`,
logContext: `processing domain request: ${action}`,
onSuccess: () => {
this.success = true;
this.errors = {};
@@ -53,6 +53,8 @@ export type UpdateOrganizationSuccess = Extract<UpdateOrganizationResponse, { su
export type DomainRequestRequest = typeof classroomio.domain.$post;
export type DomainRequestResponse = InferResponseType<DomainRequestRequest>;
export type DomainRequestSuccess = Extract<DomainRequestResponse, { success: true }>;
export type DomainRequestData = DomainRequestSuccess['data'];
export type DomainRequestStatus = DomainRequestData['status'];
// SSO types
export type GetSsoConfigRequest = (typeof classroomio.organization)['sso']['$get'];