From 7d6c1cd4e376df6a359f6acaf151d02d7af7f734 Mon Sep 17 00:00:00 2001 From: Alireza Hassani Date: Sat, 8 Aug 2026 14:07:56 +0330 Subject: [PATCH] Add optional git repo URL on Add Domain for storefront wiring. Super Admin can opt into websites VM provision so Deploy shows on Websites without manual slug maps. Co-authored-by: Cursor --- apps/super-admin/src/pages/BusinessesPage.tsx | 49 +++++++++++++++++-- .../src/services/businessService.ts | 2 + docs/PROJECT_CONTEXT.md | 4 +- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/apps/super-admin/src/pages/BusinessesPage.tsx b/apps/super-admin/src/pages/BusinessesPage.tsx index 1d6384c..5a41324 100644 --- a/apps/super-admin/src/pages/BusinessesPage.tsx +++ b/apps/super-admin/src/pages/BusinessesPage.tsx @@ -227,6 +227,7 @@ export function BusinessesPage() { const [domainBusiness, setDomainBusiness] = useState(null) const [domainId, setDomainId] = useState(null) const [domainHost, setDomainHost] = useState('') + const [domainGitRepoUrl, setDomainGitRepoUrl] = useState('') const [domainSubmitting, setDomainSubmitting] = useState(false) const [domainError, setDomainError] = useState('') @@ -595,6 +596,7 @@ export function BusinessesPage() { setDomainBusiness(b) setDomainId(b.domainId) setDomainHost(b.domain ?? '') + setDomainGitRepoUrl('') setDomainError('') setDomainOpen(true) } @@ -728,6 +730,7 @@ export function BusinessesPage() { if (!domainBusiness) return const host = domainHost.trim() if (!host) return + const gitRepoUrl = domainGitRepoUrl.trim() setDomainSubmitting(true) setDomainError('') @@ -748,7 +751,14 @@ export function BusinessesPage() { const created = (await addBusinessDomain(domainBusiness.id, { host, isPrimary: true, - })) as { id: number; host: string; sslEnabled: boolean } + ...(gitRepoUrl ? { gitRepoUrl } : {}), + })) as { + id: number + host: string + sslEnabled: boolean + deploySlug?: string | null + provisionError?: string | null + } setData((prev) => { if (!prev) return prev return { @@ -765,11 +775,22 @@ export function BusinessesPage() { ), } }) - showToast(`Domain "${host}" added.`, 'success') + if (created.provisionError) { + showToast(`Domain "${host}" added, but storefront setup failed.`, 'error') + showToast(created.provisionError, 'error') + } else if (gitRepoUrl && created.deploySlug) { + showToast( + `Domain "${host}" added. Storefront deploy is ready on Websites.`, + 'success', + ) + } else { + showToast(`Domain "${host}" added.`, 'success') + } } setDomainOpen(false) setDomainBusiness(null) setDomainId(null) + setDomainGitRepoUrl('') } catch (err) { setDomainError(err instanceof ApiError ? err.message : 'Unable to save domain.') } finally { @@ -1278,6 +1299,7 @@ export function BusinessesPage() { setDomainOpen(false) setDomainBusiness(null) setDomainId(null) + setDomainGitRepoUrl('') setDomainError('') }} > @@ -1292,10 +1314,31 @@ export function BusinessesPage() { id="domain-host" value={domainHost} onChange={(e) => setDomainHost(e.target.value)} - placeholder="shop-a.local" + placeholder="oaktasty.com" disabled={domainSubmitting} /> + {!domainId ? ( + <> +
+
+ + setDomainGitRepoUrl(e.target.value)} + placeholder="git@git.meshkee.com:Meshkee-Websites/oaktasty.git" + disabled={domainSubmitting} + autoComplete="off" + spellCheck={false} + /> +

+ Fill to enable storefront Deploy on Websites. Leave empty for domain-only + (dashboards). +

+
+ + ) : null}