Skip to content

Commit 3009186

Browse files
authored
CIAB domain purchasing fixes (#107439)
* Update so WOO_HOSTED trial plans aren't flagged as free We want to allow users with the ciab trial to perform all domain operations. This is controlled by a feature flag in case product wants to change it. * Update so /ciab respects redirect_to when purchasing a domain * Fix rebase issue * Linting
1 parent 5592be7 commit 3009186

File tree

15 files changed

+33
-12
lines changed

15 files changed

+33
-12
lines changed

client/dashboard/domains/add-domain-button.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { wpcomLink } from '../utils/link';
77
export function AddDomainButton( {
88
siteSlug,
99
domainConnectionSetupUrl,
10+
redirectTo,
1011
}: {
1112
siteSlug?: string;
1213
domainConnectionSetupUrl?: string;
14+
redirectTo?: string;
1315
} ) {
1416
const buildQueryArgs = () => {
1517
const queryArgs: Record< string, string > = {};
@@ -19,6 +21,9 @@ export function AddDomainButton( {
1921
if ( domainConnectionSetupUrl ) {
2022
queryArgs.domainConnectionSetupUrl = domainConnectionSetupUrl;
2123
}
24+
if ( redirectTo ) {
25+
queryArgs.redirect_to = redirectTo;
26+
}
2227
return queryArgs;
2328
};
2429

client/dashboard/sites/domains/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { filterSortAndPaginate } from '@wordpress/dataviews';
55
import { createInterpolateElement } from '@wordpress/element';
66
import { __ } from '@wordpress/i18n';
77
import { useAuth } from '../../app/auth';
8+
import { useAppContext } from '../../app/context';
89
import { usePersistentView } from '../../app/hooks/use-persistent-view';
910
import { domainConnectionSetupRoute } from '../../app/router/domains';
1011
import { siteRoute, siteDomainsRoute, siteSettingsRedirectRoute } from '../../app/router/sites';
@@ -67,6 +68,8 @@ function SiteDomains() {
6768
domainConnectionSetupUrlRelativePath,
6869
window.location.origin
6970
).href;
71+
const { basePath } = useAppContext();
72+
const redirectTo = `${ basePath }/sites/${ site.slug }/domains`;
7073

7174
return (
7275
<PageLayout
@@ -77,6 +80,7 @@ function SiteDomains() {
7780
<AddDomainButton
7881
siteSlug={ site.slug }
7982
domainConnectionSetupUrl={ domainConnectionSetupUrl }
83+
redirectTo={ redirectTo }
8084
/>
8185
}
8286
/>

client/landing/stepper/declarative-flow/flows/domain/domain.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ const domain: FlowV2< typeof initialize > = {
100100
const hasOnlyDomainConnection =
101101
domainCartItems && domainCartItems.length === 1 && isDomainMapping( domainCartItems[ 0 ] );
102102

103-
let destination = `/v2/sites/${ siteSlug }/domains`;
103+
// Use the redirect_to query param if provided, otherwise fall back to v2 domains
104+
let destination = redirectTo || `/v2/sites/${ siteSlug }/domains`;
104105

105-
if ( hasOnlyDomainConnection ) {
106+
// But send domain-only connects to domain-connection-setup.
107+
if ( ! redirectTo && hasOnlyDomainConnection ) {
106108
const domain = domainCartItems[ 0 ].meta;
107109
if ( domain ) {
108110
destination = `/v2/domains/${ domain }/domain-connection-setup`;
@@ -114,8 +116,10 @@ const domain: FlowV2< typeof initialize > = {
114116
addQueryArgs( `/checkout/${ encodeURIComponent( siteSlug ) }`, {
115117
redirect_to: destination,
116118
signup: 1,
117-
cancel_to: new URL( addQueryArgs( '/setup/domain', { siteSlug } ), window.location.href )
118-
.href,
119+
cancel_to: new URL(
120+
addQueryArgs( '/setup/domain', { siteSlug, redirect_to: redirectTo } ),
121+
window.location.href
122+
).href,
119123
} )
120124
);
121125
};

config/dashboard-development.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"site_name": "Hosting Dashboard",
1515
"features": {
1616
"always_use_logout_url": true,
17+
"ciab/allow-domain-features": true,
1718
"cookie-banner": false,
1819
"dashboard": true,
1920
"dashboard/v2": false,

config/dashboard-horizon.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"wpcom_login_url": "https://wordpress.com/log-in",
1212
"site_name": "Hosting Dashboard",
1313
"features": {
14+
"ciab/allow-domain-features": true,
1415
"cookie-banner": false,
1516
"dashboard": true,
1617
"dashboard/v2": false,

config/dashboard-production.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"wpcom_login_url": "https://wordpress.com/log-in",
1212
"site_name": "Hosting Dashboard",
1313
"features": {
14+
"ciab/allow-domain-features": true,
1415
"cookie-banner": true,
1516
"dashboard": false,
1617
"dashboard/v2": false

config/dashboard-stage.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"wpcom_login_url": "https://wordpress.com/log-in",
1212
"site_name": "Hosting Dashboard",
1313
"features": {
14+
"ciab/allow-domain-features": true,
1415
"cookie-banner": false,
1516
"dashboard": true,
1617
"dashboard/v2": false

config/development.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"calypso/domains-dataviews": true,
4646
"cancellation-offers": true,
4747
"checkout/checkout-version": true,
48+
"ciab/allow-domain-features": true,
4849
"checkout/ebanx-pix": true,
4950
"checkout/google-pay": true,
5051
"checkout/razorpay": true,

config/horizon.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"cancellation-offers": true,
2121
"catch-js-errors": true,
2222
"checkout/checkout-version": false,
23+
"ciab/allow-domain-features": true,
2324
"checkout/ebanx-pix": true,
2425
"checkout/google-pay": true,
2526
"checkout/razorpay": true,

config/production.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"cancellation-offers": true,
3333
"catch-js-errors": true,
3434
"checkout/checkout-version": false,
35+
"ciab/allow-domain-features": true,
3536
"checkout/ebanx-pix": true,
3637
"checkout/google-pay": true,
3738
"checkout/razorpay": false,

0 commit comments

Comments
 (0)