aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/ui/SubscriptionPopupScreen.js
blob: 0b6432e5092db5ea59bd7c453a4694f7edc1c86a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';

import SubscriptionPopup from '../../components/ui/SubscriptionPopup';


@inject('stores', 'actions') @observer
export default class SubscriptionPopupScreen extends Component {
  state = {
    complete: false,
  };

  completeCheck(event) {
    const { url } = event;

    if (url.includes('recurly') && url.includes('confirmation')) {
      this.setState({
        complete: true,
      });
    }
  }

  render() {
    return (
      <SubscriptionPopup
        url={this.props.router.params.url}
        closeWindow={() => window.close()}
        completeCheck={e => this.completeCheck(e)}
        isCompleted={this.state.complete}
      />
    );
  }
}


SubscriptionPopupScreen.wrappedComponent.propTypes = {
  router: PropTypes.shape({
    params: PropTypes.shape({
      url: PropTypes.string.isRequired,
    }).isRequired,
  }).isRequired,
};