aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth/Pricing.js
blob: 2fcabe54dbcda4af00ea73d9c441d3bcdb0a663b (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import injectSheet from 'react-jss';
import { H2, Loader } from '@meetfranz/ui';
import classnames from 'classnames';

import { Button } from '@meetfranz/forms';
import { FeatureItem } from '../ui/FeatureItem';
import { FeatureList } from '../ui/FeatureList';

const messages = defineMessages({
  headline: {
    id: 'pricing.trial.headline.pro',
    defaultMessage: '!!!Hi {name}, welcome to Franz',
  },
  specialTreat: {
    id: 'pricing.trial.intro.specialTreat',
    defaultMessage: '!!!We have a special treat for you.',
  },
  tryPro: {
    id: 'pricing.trial.intro.tryPro',
    defaultMessage: '!!!Enjoy the full Franz Professional experience completely free for 14 days.',
  },
  happyMessaging: {
    id: 'pricing.trial.intro.happyMessaging',
    defaultMessage: '!!!Happy messaging,',
  },
  noStringsAttachedHeadline: {
    id: 'pricing.trial.terms.headline',
    defaultMessage: '!!!No strings attached',
  },
  noCreditCard: {
    id: 'pricing.trial.terms.noCreditCard',
    defaultMessage: '!!!No credit card required',
  },
  automaticTrialEnd: {
    id: 'pricing.trial.terms.automaticTrialEnd',
    defaultMessage: '!!!Your free trial ends automatically after 14 days',
  },
  trialWorth: {
    id: 'pricing.trial.terms.trialWorth',
    defaultMessage: '!!!Free trial (normally {currency}{price} per month)',
  },
  activationError: {
    id: 'pricing.trial.error',
    defaultMessage: '!!!Sorry, we could not activate your trial!',
  },
  ctaAccept: {
    id: 'pricing.trial.cta.accept',
    defaultMessage: '!!!Start my 14-day Franz Professional Trial ',
  },
  ctaStart: {
    id: 'pricing.trial.cta.start',
    defaultMessage: '!!!Start using Franz',
  },
  ctaSkip: {
    id: 'pricing.trial.cta.skip',
    defaultMessage: '!!!Continue to Ferdi',
  },
  featuresHeadline: {
    id: 'pricing.trial.features.headline',
    defaultMessage: '!!!Franz Professional includes:',
  },
});

const styles = theme => ({
  root: {
    width: '500px !important',
    textAlign: 'center',
    padding: 20,
    zIndex: 100,

    '& h1': {
    },
  },
  container: {
    position: 'relative',
    marginLeft: -150,
  },
  welcomeOffer: {
    textAlign: 'center',
    fontWeight: 'bold',
    marginBottom: '6 !important',
  },
  keyTerms: {
    textAlign: 'center',
  },
  content: {
    position: 'relative',
    zIndex: 20,
  },
  featureContainer: {
    width: 300,
    position: 'absolute',
    left: 'calc(100% / 2 + 250px)',
    marginTop: 20,
    background: theme.signup.pricing.feature.background,
    height: 'auto',
    padding: 20,
    borderTopRightRadius: theme.borderRadius,
    borderBottomRightRadius: theme.borderRadius,
    zIndex: 10,
  },
  featureItem: {
    borderBottom: [1, 'solid', theme.signup.pricing.feature.border],
  },
  cta: {
    marginTop: 40,
    width: '100%',
  },
  skipLink: {
    textAlign: 'center',
    marginTop: 10,
  },
  error: {
    margin: [20, 0, 0],
    color: theme.styleTypes.danger.accent,
  },
  priceContainer: {
    display: 'flex',
    justifyContent: 'space-evenly',
    margin: [10, 0, 15],
  },
  price: {
    '& sup': {
      verticalAlign: 14,
      fontSize: 20,
    },
  },
  figure: {
    fontSize: 40,
  },
  regularPrice: {
    position: 'relative',

    '&:before': {
      content: '" "',
      position: 'absolute',
      width: '130%',
      height: 1,
      top: 14,
      left: -12,
      borderBottom: [3, 'solid', 'red'],
      transform: 'rotateZ(-20deg)',
    },
  },
});

export default @injectSheet(styles) @observer class Signup extends Component {
  static propTypes = {
    onSubmit: PropTypes.func.isRequired,
    isLoadingRequiredData: PropTypes.bool.isRequired,
    isActivatingTrial: PropTypes.bool.isRequired,
    trialActivationError: PropTypes.bool.isRequired,
    canSkipTrial: PropTypes.bool.isRequired,
    classes: PropTypes.object.isRequired,
    currency: PropTypes.string.isRequired,
    price: PropTypes.number.isRequired,
    name: PropTypes.string.isRequired,
  };

  static contextTypes = {
    intl: intlShape,
  };

  render() {
    const {
      onSubmit,
      isLoadingRequiredData,
      isActivatingTrial,
      trialActivationError,
      canSkipTrial,
      classes,
      currency,
      price,
      name,
    } = this.props;
    const { intl } = this.context;

    const [intPart, fractionPart] = (price).toString().split('.');

    return (
      <>
        <div className={classnames('auth__container', classes.root, classes.container)}>
          <form className="franz-form auth__form">
            {isLoadingRequiredData ? <Loader /> : (
              <img
                src="./assets/images/sm.png"
                className="auth__logo auth__logo--sm"
                alt=""
              />
            )}
            <h1>{intl.formatMessage(messages.headline, { name })}</h1>
            <div className="auth__letter">
              <p>
                {intl.formatMessage(messages.specialTreat)}
                <br />
              </p>
              <p>
                {intl.formatMessage(messages.tryPro)}
                <br />
              </p>
              <p>
                {intl.formatMessage(messages.happyMessaging)}
              </p>
              <p>
                <strong>Stefan Malzner</strong>
              </p>
            </div>
            <div className={classes.priceContainer}>
              <p className={classnames(classes.price, classes.regularPrice)}>
                <span className={classes.figure}>
                  {currency}
                  {intPart}
                </span>
                <sup>{fractionPart}</sup>
              </p>
              <p className={classnames(classes.price, classes.trialPrice)}>
                <span className={classes.figure}>
                  {currency}
                  0
                </span>
                <sup>00</sup>
              </p>
            </div>
            <div className={classes.keyTerms}>
              <H2>
                {intl.formatMessage(messages.noStringsAttachedHeadline)}
              </H2>
              <ul className={classes.keyTermsList}>
                <FeatureItem
                  icon="👉"
                  name={intl.formatMessage(messages.trialWorth, {
                    currency,
                    price,
                  })}
                />
                <FeatureItem icon="👉" name={intl.formatMessage(messages.noCreditCard)} />
                <FeatureItem icon="👉" name={intl.formatMessage(messages.automaticTrialEnd)} />
              </ul>
            </div>
            {trialActivationError && (
            <p className={classes.error}>{intl.formatMessage(messages.activationError)}</p>
            )}
            <Button
              label={intl.formatMessage(!canSkipTrial ? messages.ctaStart : messages.ctaAccept)}
              className={classes.cta}
              onClick={onSubmit}
              busy={isActivatingTrial}
              disabled={isLoadingRequiredData || isActivatingTrial}
            />
            {canSkipTrial && (
            <p className={classes.skipLink}>
              <a href="#/">{intl.formatMessage(messages.ctaSkip)}</a>
            </p>
            )}
          </form>
        </div>
        <div className={classes.featureContainer}>
          <H2>
            {intl.formatMessage(messages.featuresHeadline)}
          </H2>
          <FeatureList />
        </div>
      </>
    );
  }
}