mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) set up a trialing list and a call scheduled flag for Grist SaaS
Summary: This adds support for the automation described in https://grist.quip.com/rt3tAoEH4kuy/Automate-Sprouts-outreach-email Test Plan: added tests; will need manual testing and iterative integration work Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3804
This commit is contained in:
parent
bc43e16bc7
commit
3aba7f6208
@ -101,6 +101,7 @@ export interface AppModel {
|
||||
dismissedWelcomePopups: Observable<DismissedReminder[]>;
|
||||
|
||||
pageType: Observable<PageType>;
|
||||
needsOrg: Observable<boolean>;
|
||||
|
||||
notifier: Notifier;
|
||||
planName: string|null;
|
||||
@ -253,6 +254,11 @@ export class AppModelImpl extends Disposable implements AppModel {
|
||||
public readonly pageType: Observable<PageType> = Computed.create(this, urlState().state,
|
||||
(use, state) => (state.doc ? "doc" : (state.billing ? "billing" : (state.welcome ? "welcome" : "home"))));
|
||||
|
||||
public readonly needsOrg: Observable<boolean> = Computed.create(
|
||||
this, urlState().state, (use, state) => {
|
||||
return !(Boolean(state.welcome) || state.billing === 'scheduled');
|
||||
});
|
||||
|
||||
public readonly notifier = this.topAppModel.notifier;
|
||||
|
||||
public readonly behavioralPromptsManager: BehavioralPromptsManager =
|
||||
|
@ -53,7 +53,7 @@ export function createAppUI(topAppModel: TopAppModel, appObj: App): IDisposable
|
||||
}
|
||||
|
||||
function createMainPage(appModel: AppModel, appObj: App) {
|
||||
if (!appModel.currentOrg && appModel.pageType.get() !== 'welcome') {
|
||||
if (!appModel.currentOrg && appModel.needsOrg.get()) {
|
||||
const err = appModel.orgError;
|
||||
if (err && err.status === 404) {
|
||||
return createNotFoundPage(appModel);
|
||||
|
@ -4,7 +4,7 @@ import {StringUnion} from 'app/common/StringUnion';
|
||||
import {addCurrentOrgToPath} from 'app/common/urlUtils';
|
||||
import {BillingAccount, ManagerDelta, OrganizationWithoutAccessInfo} from 'app/common/UserAPI';
|
||||
|
||||
export const BillingSubPage = StringUnion('payment');
|
||||
export const BillingSubPage = StringUnion('payment', 'scheduled');
|
||||
export type BillingSubPage = typeof BillingSubPage.type;
|
||||
|
||||
export const BillingPage = StringUnion(...BillingSubPage.values, 'billing');
|
||||
|
@ -83,6 +83,8 @@ export const NotifierEvents = StringUnion(
|
||||
'addBillingManager',
|
||||
'teamCreator',
|
||||
'trialPeriodEndingSoon',
|
||||
'trialingSubscription',
|
||||
'scheduledCall',
|
||||
);
|
||||
|
||||
export type NotifierEvent = typeof NotifierEvents.type;
|
||||
@ -467,6 +469,10 @@ export class HomeDBManager extends EventEmitter {
|
||||
return await User.findOne({where: {apiKey}, relations: ["logins"]}) || undefined;
|
||||
}
|
||||
|
||||
public async getUserByRef(ref: string): Promise<User|undefined> {
|
||||
return await User.findOne({where: {ref}, relations: ["logins"]}) || undefined;
|
||||
}
|
||||
|
||||
public async getUser(userId: number): Promise<User|undefined> {
|
||||
return await User.findOne({where: {id: userId}, relations: ["logins"]}) || undefined;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user