-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Domains: Create 100-Year domain transfer flow (#95634)
* Add flow * Add 100-year domain wrapper to flow variation + price bypass * Add/fix specific styles * Add specific 100-year domain copy/labels * Change page title * Future-proof flow steps * Use specific 100-year domain price * Pass `is_hundred_year_domain` to backend * Fix navigation for new flow * Add 100 volume to domain transfer product * Include 100-year domain transfer variation to 100-year specific processing component * Use vendor string instead of previous (and dated) hundred-year flag * Use price coming from availability endpoint instead of override hack * Hide sidebar price for transfers * Fix linter error
- Loading branch information
1 parent
bc5fd72
commit c2354ff
Showing
14 changed files
with
254 additions
and
30 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
client/landing/stepper/declarative-flow/hundred-year-domain-transfer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { HUNDRED_YEAR_DOMAIN_TRANSFER } from '@automattic/onboarding'; | ||
import { translate } from 'i18n-calypso'; | ||
import { stepsWithRequiredLogin } from 'calypso/landing/stepper/utils/steps-with-required-login'; | ||
import { setSignupCompleteFlowName, setSignupCompleteSlug } from 'calypso/signup/storageUtils'; | ||
import domainTransfer from './domain-transfer'; | ||
import { | ||
AssertConditionResult, | ||
AssertConditionState, | ||
Flow, | ||
ProvidedDependencies, | ||
} from './internals/types'; | ||
|
||
const hundredYearDomainTransfer: Flow = { | ||
...domainTransfer, | ||
variantSlug: HUNDRED_YEAR_DOMAIN_TRANSFER, | ||
get title() { | ||
return translate( '100-Year Domain' ); | ||
}, | ||
|
||
// Always start on the "domains" step, as we don't need what comes before it for the 100-year domain transfer flow. | ||
// It doesn't make sense to show it as it contains additional cluttering information that doesn't matter | ||
// specifically under the 100-year domain context - they'll also come from a different entry point. | ||
useSteps() { | ||
const transferSteps = domainTransfer.useSteps(); | ||
const domainsStepIndex = transferSteps.findIndex( ( step ) => step.slug === 'domains' ); | ||
return [ | ||
transferSteps[ domainsStepIndex ], | ||
...stepsWithRequiredLogin( transferSteps.slice( domainsStepIndex ) ), | ||
]; | ||
}, | ||
|
||
// Always allow the user to proceed with the transfer, as we assert that the user is logged in later. | ||
useAssertConditions(): AssertConditionResult { | ||
return { state: AssertConditionState.SUCCESS }; | ||
}, | ||
|
||
useStepNavigation( _currentStepSlug, navigate ) { | ||
const flowName = this.name; | ||
|
||
const submit = async ( providedDependencies: ProvidedDependencies = {} ) => { | ||
switch ( _currentStepSlug ) { | ||
case 'domains': { | ||
// go to processing step without pushing it to history | ||
// so the back button would go back to domains step | ||
return navigate( 'processing', undefined ); | ||
} | ||
case 'processing': { | ||
setSignupCompleteSlug( providedDependencies?.siteSlug ); | ||
setSignupCompleteFlowName( flowName ); | ||
|
||
// Delay to keep the "Setting up your legacy..." page showing for 2 seconds | ||
// since there's nothing to actually process in that step | ||
await new Promise( ( resolve ) => setTimeout( resolve, 2000 ) ); | ||
|
||
const checkoutBackURL = new URL( | ||
'/setup/hundred-year-domain-transfer', | ||
window.location.href | ||
); | ||
|
||
// use replace instead of assign to remove the processing URL from history | ||
return window.location.replace( | ||
`/checkout/no-site?signup=0&isDomainOnly=1&checkoutBackUrl=${ encodeURIComponent( | ||
checkoutBackURL.href | ||
) }` | ||
); | ||
} | ||
default: | ||
return; | ||
} | ||
}; | ||
|
||
return { submit }; | ||
}, | ||
}; | ||
|
||
export default hundredYearDomainTransfer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...r/declarative-flow/internals/steps-repository/hundred-year-plan-step-wrapper/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const SMALL_BREAKPOINT = 960; | ||
export const WIDE_BREAKPOINT = 1280; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.