insomnia/app/ui/components/modals/payment-notification-modal.js

73 lines
2.1 KiB
JavaScript
Raw Normal View History

import React, {PureComponent} from 'react';
import autobind from 'autobind-decorator';
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';
import * as session from '../../../sync/session';
import * as sync from '../../../sync/index';
2016-11-17 23:22:23 +00:00
let hidePaymentNotificationUntilNextLaunch = false;
@autobind
class PaymentNotificationModal extends PureComponent {
async _handleCancel () {
await sync.cancelTrial();
this.hide();
}
_setModalRef (n) {
this.modal = n;
}
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 (
<Modal ref={this._setModalRef}>
<ModalHeader>Insomnia Plus Trial Ended</ModalHeader>
2016-11-17 23:22:23 +00:00
<ModalBody className="pad changelog">
<div className="text-center pad">
<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
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">
<PromptButton onClick={this._handleCancel} className="btn btn--compact faint">
2017-02-01 20:30:51 +00:00
Cancel Subscription
</PromptButton>
2017-02-01 20:30:51 +00:00
&nbsp;&nbsp;
<Link button
href="https://insomnia.rest/app/subscribe/"
className="btn btn--compact btn--outlined">
Update Billing
</Link>
2016-11-17 23:22:23 +00:00
</p>
</div>
</ModalBody>
</Modal>
);
2016-11-17 23:22:23 +00:00
}
}
PaymentNotificationModal.propTypes = {};
export default PaymentNotificationModal;