2017-02-28 21:32:23 +00:00
|
|
|
import React, {PureComponent} from 'react';
|
2017-03-03 01:44:07 +00:00
|
|
|
import autobind from 'autobind-decorator';
|
2017-03-08 05:52:17 +00:00
|
|
|
import PromptButton from '../base/prompt-button';
|
|
|
|
import Link from '../base/link';
|
|
|
|
import Modal from '../base/modal';
|
|
|
|
import ModalBody from '../base/modal-body';
|
|
|
|
import ModalHeader from '../base/modal-header';
|
2016-11-17 23:22:23 +00:00
|
|
|
import {trackEvent} from '../../../analytics';
|
2017-01-11 03:18:15 +00:00
|
|
|
import * as session from '../../../sync/session';
|
|
|
|
import * as sync from '../../../sync/index';
|
2016-11-17 23:22:23 +00:00
|
|
|
|
|
|
|
let hidePaymentNotificationUntilNextLaunch = false;
|
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
@autobind
|
2017-02-28 21:32:23 +00:00
|
|
|
class PaymentNotificationModal extends PureComponent {
|
2017-03-03 01:44:07 +00:00
|
|
|
async _handleCancel () {
|
2017-01-11 03:18:15 +00:00
|
|
|
await sync.cancelTrial();
|
2016-11-27 21:42:38 +00:00
|
|
|
this.hide();
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
2016-11-27 21:42:38 +00:00
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
_setModalRef (n) {
|
|
|
|
this.modal = n;
|
|
|
|
}
|
2017-02-28 21:32:23 +00:00
|
|
|
|
2016-11-17 23:22:23 +00:00
|
|
|
show () {
|
|
|
|
// Don't trigger automatically if user has dismissed it already
|
|
|
|
if (hidePaymentNotificationUntilNextLaunch) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hidePaymentNotificationUntilNextLaunch = true;
|
|
|
|
this.modal.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
hide () {
|
|
|
|
trackEvent('Billing', 'Trial Ended', 'Cancel');
|
|
|
|
this.modal.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
2017-02-28 21:32:23 +00:00
|
|
|
<Modal ref={this._setModalRef}>
|
2017-02-01 03:01:27 +00:00
|
|
|
<ModalHeader>Insomnia Plus Trial Ended</ModalHeader>
|
2016-11-17 23:22:23 +00:00
|
|
|
<ModalBody className="pad changelog">
|
|
|
|
<div className="text-center pad">
|
2017-01-11 03:18:15 +00:00
|
|
|
<h1>Hi {session.getFirstName()},</h1>
|
2016-11-17 23:22:23 +00:00
|
|
|
<p style={{maxWidth: '30rem', margin: 'auto'}}>
|
2017-02-01 20:30:51 +00:00
|
|
|
Your Insomnia Plus trial has come to an end. Please enter your billing info
|
2017-01-11 03:18:15 +00:00
|
|
|
to continue using Plus features like encrypted data synchronization and backup.
|
2016-11-17 23:22:23 +00:00
|
|
|
</p>
|
|
|
|
<br/>
|
|
|
|
<p className="pad-top">
|
2017-01-11 03:18:15 +00:00
|
|
|
<PromptButton onClick={this._handleCancel} className="btn btn--compact faint">
|
2017-02-01 20:30:51 +00:00
|
|
|
Cancel Subscription
|
2017-01-11 03:18:15 +00:00
|
|
|
</PromptButton>
|
2017-02-01 20:30:51 +00:00
|
|
|
|
2017-03-01 21:15:56 +00:00
|
|
|
<Link button
|
2017-01-11 03:18:15 +00:00
|
|
|
href="https://insomnia.rest/app/subscribe/"
|
|
|
|
className="btn btn--compact btn--outlined">
|
2017-02-09 00:46:12 +00:00
|
|
|
Update Billing
|
2016-12-21 23:37:48 +00:00
|
|
|
</Link>
|
2016-11-17 23:22:23 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</ModalBody>
|
|
|
|
</Modal>
|
2017-03-03 20:09:08 +00:00
|
|
|
);
|
2016-11-17 23:22:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PaymentNotificationModal.propTypes = {};
|
|
|
|
|
|
|
|
export default PaymentNotificationModal;
|