constructor( props ) { super( props ); if ( isEmpty( props.emailAddress ) || isEmpty( props.token ) ) { this.props.showMagicLoginLinkExpiredPage(); } }
renderI18nSuggestions() { const { locale, path, isLoginView } = this.props; if ( ! isLoginView ) { return null; } return <LocaleSuggestions locale={ locale } path={ path } />; }
UNSAFE_componentWillReceiveProps( nextProps ) { if ( ! nextProps.lockExpires || nextProps.lockExpires === this.props.lockExpires ) { return; } // Add 2 seconds to the refresh clock to prevent race conditions this._refresh && clearTimeout( this._refresh ); this._refresh = setTimeout( () => this.forceUpdate(), nextProps.lockExpires - new Date().getTime() + 2000 ); }
UNSAFE_componentWillReceiveProps( nextProps ) { if ( this.props.isDeleting && ! nextProps.isDeleting ) { this.setState( { isDeleting: false, isDeletingAll: false, } ); } }
componentDidMount() { window.addEventListener( 'keydown', this.handleSuggestionsKeyDown, false ); window.addEventListener( 'keyup', this.handleSuggestionsKeyUp, false ); window.addEventListener( 'blur', this.handleSuggestionBlur, true ); this.props.fetchSuggestions( this.props.note.meta.ids.site ); }
isCheckBoxChecked( goal ) { const initialVal = this.props.siteGoals.split( ',' ); if ( initialVal.indexOf( goal ) !== -1 ) { return true; } return false; }
/** * Before component updates, check if we have to go somewhere else. * If Rewind was activated, user clicked the Switch now button so let's go to migrate creds. * * @param {object} nextProps Props received by component for next update. */ UNSAFE_componentWillUpdate( nextProps ) { if ( this.props.rewindIsNowActive !== nextProps.rewindIsNowActive ) { this.props.submitSignupStep( { stepName: this.props.stepName }, { rewindconfig: true } ); this.props.goToNextStep(); } }
debounce( () => { this.forceUpdate(); if ( this.props.verticalPreviewContent || this.props.verticalPreviewScreenshot ) { this.props.recordTracksEvent( 'calypso_signup_site_preview_mockup_rendered', { site_type: this.props.siteType, vertical_slug: this.props.verticalSlug, site_style: this.props.siteStyle || 'default', } ); } }, 777 )
createUserButtonText() { const { translate } = this.props; if ( this.state.submitting ) { return translate( 'Creating your account…' ); } return translate( 'Create your account' ); }
componentDidUpdate( prevProps ) { // If the signup site preview is visible and there's a sub step, e.g., mapping, transfer, use-your-domain if ( prevProps.stepSectionName !== this.props.stepSectionName ) { if ( this.props.isSitePreviewVisible && this.props.stepSectionName ) { this.props.hideSitePreview(); } if ( ! this.props.isSitePreviewVisible && ! this.props.stepSectionName ) { this.props.showSitePreview(); } } }
this.props.updateFields( { [ name ]: newValue, }, () => { this.submitForm(); } );
UNSAFE_componentWillReceiveProps( nextProps ) { const { siteId } = this.props; if ( ! nextProps.siteId || siteId === nextProps.siteId ) { return; } this.requestSettings( nextProps ); }
completeP2FlowAfterLoggingIn() { if ( ! this.props.progress ) { return; } const p2SiteStep = this.props.progress[ 'p2-site' ]; if ( p2SiteStep && p2SiteStep.status === 'pending' && user() && user().get() ) { // By removing and adding the p2-site step, we trigger the `SignupFlowController` store listener // to process the signup flow. this.props.removeStep( p2SiteStep ); this.props.addStep( p2SiteStep ); } }
/** * Before component updates, check if credentials were correctly saved and go to next step. * * @param {object} nextProps Props received by component for next update. */ UNSAFE_componentWillUpdate( nextProps ) { if ( nextProps.rewindIsNowActive ) { this.props.submitSignupStep( { stepName: this.props.stepName }, { rewindconfig: true } ); this.props.goToNextStep(); } }