Remove unused end trial modal (#4804)

This commit is contained in:
David Marby 2022-05-20 16:02:16 +02:00 committed by GitHub
parent 3a8561f8d1
commit deee30ad75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 92 deletions

View File

@ -231,9 +231,6 @@ export function setSessionData(
export async function listTeams() {
return fetch.get('/api/teams', getCurrentSessionId());
}
export async function endTrial() {
await fetch.put('/api/billing/end-trial', null, getCurrentSessionId());
}
// ~~~~~~~~~~~~~~~~ //
// Helper Functions //

View File

@ -1,81 +0,0 @@
import { autoBindMethodsForReact } from 'class-autobind-decorator';
import React, { PureComponent } from 'react';
import { endTrial, getFirstName, logout } from '../../../account/session';
import { AUTOBIND_CFG } from '../../../common/constants';
import { Link } from '../base/link';
import { Modal } from '../base/modal';
import { ModalBody } from '../base/modal-body';
import { ModalHeader } from '../base/modal-header';
import { PromptButton } from '../base/prompt-button';
let hidePaymentNotificationUntilNextLaunch = false;
@autoBindMethodsForReact(AUTOBIND_CFG)
export class PaymentNotificationModal extends PureComponent {
async _handleCancel() {
try {
await endTrial();
await logout();
} catch (err) {
// That's okay
}
this.hide();
}
modal: Modal | null = null;
_setModalRef(n: Modal) {
this.modal = n;
}
show() {
// Don't trigger automatically if user has dismissed it already
if (hidePaymentNotificationUntilNextLaunch) {
return;
}
hidePaymentNotificationUntilNextLaunch = true;
this.modal?.show();
}
hide() {
this.modal?.hide();
}
render() {
return (
<Modal ref={this._setModalRef}>
<ModalHeader>Insomnia Plus Trial Ended</ModalHeader>
<ModalBody className="pad changelog">
<div className="text-center pad">
<h1>Hi {getFirstName()},</h1>
<p
style={{
maxWidth: '30rem',
margin: 'auto',
}}
>
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.
</p>
<br />
<p className="pad-top">
<PromptButton onClick={this._handleCancel} className="btn btn--compact faint">
Cancel Subscription
</PromptButton>
&nbsp;&nbsp;
<Link
button
href="https://app.insomnia.rest/app/subscribe/"
className="btn btn--compact btn--outlined"
>
Update Billing
</Link>
</p>
</div>
</ModalBody>
</Modal>
);
}
}

View File

@ -53,7 +53,6 @@ import { GitStagingModal } from './modals/git-staging-modal';
import { registerModal, showModal } from './modals/index';
import { LoginModal } from './modals/login-modal';
import { NunjucksModal } from './modals/nunjucks-modal';
import { PaymentNotificationModal } from './modals/payment-notification-modal';
import ProjectSettingsModal from './modals/project-settings-modal';
import { PromptModal } from './modals/prompt-modal';
import ProtoFilesModal from './modals/proto-files-modal';
@ -488,7 +487,6 @@ export class Wrapper extends PureComponent<WrapperProps, State> {
<AskModal ref={registerModal} />
<SelectModal ref={registerModal} />
<RequestCreateModal ref={registerModal} />
<PaymentNotificationModal ref={registerModal} />
<FilterHelpModal ref={registerModal} />
<RequestRenderErrorModal ref={registerModal} />
<GenerateConfigModal ref={registerModal} />

View File

@ -35,7 +35,6 @@ import { AskModal } from '../../../ui/components/modals/ask-modal';
import { AlertModal } from '../../components/modals/alert-modal';
import { showAlert, showError, showModal } from '../../components/modals/index';
import { LoginModal } from '../../components/modals/login-modal';
import { PaymentNotificationModal } from '../../components/modals/payment-notification-modal';
import { SelectModal } from '../../components/modals/select-modal';
import {
SettingsModal,
@ -60,7 +59,6 @@ export const SET_ACTIVE_ACTIVITY = 'global/activate-activity';
export const SET_IS_FINISHED_BOOTING = 'global/is-finished-booting';
const COMMAND_ALERT = 'app/alert';
const COMMAND_LOGIN = 'app/auth/login';
const COMMAND_TRIAL_END = 'app/billing/trial-end';
const COMMAND_IMPORT_URI = 'app/import';
const COMMAND_PLUGIN_INSTALL = 'plugins/install';
const COMMAND_PLUGIN_THEME = 'plugins/theme';
@ -207,10 +205,6 @@ export const newCommand = (command: string, args: any) => async (dispatch: Dispa
});
break;
case COMMAND_TRIAL_END:
showModal(PaymentNotificationModal);
break;
case COMMAND_IMPORT_URI:
await showModal(AlertModal, {
title: 'Confirm Data Import',