From 200080d759fea76e8b11b2e01440c597feb5e33a Mon Sep 17 00:00:00 2001 From: Silas Rafael Barreto Prado Date: Mon, 17 Nov 2025 17:43:16 -0300 Subject: [PATCH 1/4] remove card validation in domain settings --- .../DomainSettings/DomainSettings.react.js | 129 +++--------------- 1 file changed, 22 insertions(+), 107 deletions(-) diff --git a/src/dashboard/DomainSettings/DomainSettings.react.js b/src/dashboard/DomainSettings/DomainSettings.react.js index bd5b18c4f..4b4524e7d 100644 --- a/src/dashboard/DomainSettings/DomainSettings.react.js +++ b/src/dashboard/DomainSettings/DomainSettings.react.js @@ -41,6 +41,7 @@ class DomainSettings extends DashboardView { isUserVerified: false, canChangeCustomDomain: false, + canChangeSubdomain: false, showCardValidation: true, subdomainName: '', @@ -57,19 +58,12 @@ class DomainSettings extends DashboardView { updating: false, isEditing: false, hasToggleChanged: false, - canEdit: false, + canEdit: true, errorCustomDomain: null, successCustomDomain: null, errorUpdateWebHost: null, successUpdateWebHost: null, - - // Session verification states - isVerifyingSession: false, - sessionVerificationError: null, - verifiedSessionId: null, - showSuccessMessage: false, - }; this.onRefresh = this.onRefresh.bind(this); this.handleSubdomainChange = this.handleSubdomainChange.bind(this); @@ -80,7 +74,6 @@ class DomainSettings extends DashboardView { componentWillMount() { this.loadData(); - this.checkForStripeSession(); this.getOwner(); } @@ -108,8 +101,10 @@ class DomainSettings extends DashboardView { } async loadData() { + console.log("STATE", this.state); try { const response = await this.context.getCustomDomain(); + console.log("RESPONSE", response); this.setState({ domainSettings: response }); await this.loadHostSettings(response); } catch (error) { @@ -120,7 +115,7 @@ class DomainSettings extends DashboardView { } async loadHostSettings(response) { - const { hostSettings: appHostSettings, domains, canChangeCustomDomain, createdAt } = response; + const { hostSettings: appHostSettings, domains, canChangeCustomDomain, canChangeSubdomain, createdAt } = response; let customDomainArray = []; let subdomainName = ''; @@ -129,7 +124,6 @@ class DomainSettings extends DashboardView { let isActivated = false; let hasPermission = false; let isUserVerified = false; - let alertValidationCreditCard = true; if (domains && domains.length > 0) { customDomainArray = domains; @@ -151,9 +145,11 @@ class DomainSettings extends DashboardView { } hasPermission = (!response.featuresPermission || response.featuresPermission.webHostLiveQuery === 'Write'); + + console.log("response", createdAt); + if (response && ((appHostSettings.serverURL && appHostSettings.activated) || (createdAt && ((new Date() - new Date(createdAt)) > (6 * 30 * 24 * 60 * 60 * 1000))))) { isUserVerified = true; - alertValidationCreditCard = false; } if (!isUserVerified) { @@ -161,26 +157,22 @@ class DomainSettings extends DashboardView { const plan = await this.context.getAppPlanData(); if (plan && plan.planName && (plan.planName.indexOf('Free') < 0) && (plan.planName.indexOf('Public') < 0)) { isUserVerified = true; - alertValidationCreditCard = false; } else { const currentUser = AccountManager.currentUser(); if (currentUser && currentUser.verification.cardValidation) { isUserVerified = true; - alertValidationCreditCard = false; } } } catch (planError) { const currentUser = AccountManager.currentUser(); if (currentUser && currentUser.verification.cardValidation) { isUserVerified = true; - alertValidationCreditCard = false; } } } this.setState({ isUserVerified, - showCardValidation: alertValidationCreditCard, subdomainName, currentSubdomain, @@ -192,6 +184,7 @@ class DomainSettings extends DashboardView { hasPermission, canChangeCustomDomain, + canChangeSubdomain, }); } @@ -296,7 +289,9 @@ class DomainSettings extends DashboardView { }, 5000); }); } catch (error) { - this.setState({ errorUpdateWebHost: error.message || 'Something went wrong!' }, () => { + console.error('error updating web host', error); + + this.setState({ errorUpdateWebHost: error || 'Something went wrong!' }, () => { setTimeout(() => { this.setState({ errorUpdateWebHost: null }); }, 5000); @@ -309,111 +304,31 @@ class DomainSettings extends DashboardView { async verifyUser() { try { const user = await back4app2.me(); - if (user && user.verification.cardValidation) { - this.setState({ isUserVerified: true, showCardValidation: false }); + if (user) { + this.setState({ isUserVerified: true }); } } catch (e) { console.log('user validation failed!') } } - checkForStripeSession() { - const urlParams = new URLSearchParams(window.location.search); - const sessionId = urlParams.get('session_id'); - - if (sessionId && sessionId !== this.state.verifiedSessionId) { - this.verifyStripeSession(sessionId); - } - } - - async verifyStripeSession(sessionId) { - try { - this.setState({ - isVerifyingSession: true, - sessionVerificationError: null - }); - - await back4app2.stripeSessionStatus(sessionId); - - // Session verification successful - this.setState({ - isVerifyingSession: false, - verifiedSessionId: sessionId, - showSuccessMessage: true - }); - - const user = AccountManager.currentUser(); - user.verification.cardValidation = true; - AccountManager.setCurrentUser({ user }); - - // Show success message for 2 seconds, then close modal and update state - setTimeout(() => { - this.setState({ - showSuccessMessage: false, - isUserVerified: true, - showCardValidation: false - }); - }, 2000); - - } catch (error) { - console.error('Error verifying stripe session:', error); - - this.setState({ - isVerifyingSession: false, - sessionVerificationError: error.message || 'Failed to verify payment. Please try again.', - showCardValidation: true - }); - } finally { - // Clean up URL regardless of success or error - const url = new URL(window.location); - url.searchParams.delete('session_id'); - window.history.replaceState({}, '', url); - } - } - getDisplayContent() { let content = null; - if (this.state.isVerifyingSession || this.state.showSuccessMessage) { - content = } - > -
- {this.state.showSuccessMessage ? ( -
- -
Payment verification successful!
-
- ) : ( -
-
-
Loading...
-
- )} -
-
- } else if (this.state.showCardValidation) { + if (!this.state.canChangeSubdomain && !this.state.isActivated) { content =
} + label={
} else if (this.state.isUserVerified) { content = <>
From 73c52006cb659a20d8be517140aee37436287ba1 Mon Sep 17 00:00:00 2001 From: Silas Rafael Barreto Prado Date: Tue, 18 Nov 2025 07:51:43 -0300 Subject: [PATCH 2/4] fix remove custom domain --- src/lib/ParseApp.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/ParseApp.js b/src/lib/ParseApp.js index 690c91870..1605378d2 100644 --- a/src/lib/ParseApp.js +++ b/src/lib/ParseApp.js @@ -1795,14 +1795,15 @@ export default class ParseApp { } async removeCustomDomain(hostSettings) { - console.log(`${b4aSettings.BACK4APP_API_PATH}/parse-app/${this.slug}/customdomain`) try { return ( await axios.delete( // eslint-disable-next-line no-undef `${b4aSettings.BACK4APP_API_PATH}/parse-app/${this.slug}/customdomain`, - { hostSettings }, - { withCredentials: true } + { + data: { hostSettings }, + withCredentials: true, + } ) ).data; } catch (err) { From 1aa5d2c07c7a77dfa14f954b8409166e4d3d5dfe Mon Sep 17 00:00:00 2001 From: Silas Rafael Barreto Prado Date: Wed, 19 Nov 2025 10:16:32 -0300 Subject: [PATCH 3/4] fix domain settings for collaborators --- .../DomainSettings/DomainSettings.react.js | 92 +++++++++++-------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/src/dashboard/DomainSettings/DomainSettings.react.js b/src/dashboard/DomainSettings/DomainSettings.react.js index 4b4524e7d..0f1ca1bb4 100644 --- a/src/dashboard/DomainSettings/DomainSettings.react.js +++ b/src/dashboard/DomainSettings/DomainSettings.react.js @@ -74,7 +74,6 @@ class DomainSettings extends DashboardView { componentWillMount() { this.loadData(); - this.getOwner(); } componentWillReceiveProps(nextProps, nextContext) { @@ -96,10 +95,6 @@ class DomainSettings extends DashboardView { this.loadData(); } - getOwner() { - this.setState({ canEdit: !!this.context.isOwner }); - } - async loadData() { console.log("STATE", this.state); try { @@ -315,7 +310,8 @@ class DomainSettings extends DashboardView { getDisplayContent() { let content = null; - if (!this.state.canChangeSubdomain && !this.state.isActivated) { + if ( + !this.state.canChangeSubdomain && !this.state.isActivated && this.state.currentDomain.trim().length === 0) { content =
} @@ -336,12 +332,21 @@ class DomainSettings extends DashboardView { label={