// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {checkIfTeamExists, createTeam} from 'actions/team_actions.jsx';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import Constants from 'utils/constants.jsx';
import * as URL from 'utils/url.jsx';
import logoImage from 'images/logo.png';
import React from 'react';
import ReactDOM from 'react-dom';
import {Button, Tooltip, OverlayTrigger} from 'react-bootstrap';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
export default class TeamUrl extends React.Component {
constructor(props) {
super(props);
this.submitBack = this.submitBack.bind(this);
this.submitNext = this.submitNext.bind(this);
this.handleFocus = this.handleFocus.bind(this);
this.state = {
nameError: '',
isLoading: false
};
}
componentDidMount() {
trackEvent('signup', 'signup_team_02_url');
}
submitBack(e) {
e.preventDefault();
this.props.state.wizard = 'display_name';
this.props.updateParent(this.props.state);
}
submitNext(e) {
e.preventDefault();
const name = ReactDOM.findDOMNode(this.refs.name).value.trim();
const cleanedName = URL.cleanUpUrlable(name);
const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g;
if (!name) {
this.setState({nameError: (