(core) Makes EE frontend behave as core if EE isn't activated

Summary:
- Makes EE decide which ActivationPage to use
- Makes ProductUpgrades use core implementation if not activated
- Changes banners to proxy to core implementation if EE not activated
- [Fix] Enables new site creation in EE as in Core:
    - Core enables people to freely create new team sites.
    - Enterprise currently redirects to the pricing page.
    - This enables enterprise to also create team sites, instead of
    redirecting.

Test Plan: Manually test in EE, unit tests in Jenkins

Reviewers: paulfitz, jordigh

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D4264
This commit is contained in:
Spoffy 2024-06-13 19:36:05 +01:00
parent e296e168e8
commit b98bad0b93
6 changed files with 39 additions and 24 deletions

View File

@ -0,0 +1,10 @@
import {AppModel} from 'app/client/models/AppModel';
import {DocPageModel} from 'app/client/models/DocPageModel';
export function buildHomeBanners(_app: AppModel) {
return null;
}
export function buildDocumentBanners(_docPageModel: DocPageModel) {
return null;
}

View File

@ -82,7 +82,7 @@ function createMainPage(appModel: AppModel, appObj: App) {
} else if (pageType === 'admin') { } else if (pageType === 'admin') {
return domAsync(loadAdminPanel().then(m => dom.create(m.AdminPanel, appModel))); return domAsync(loadAdminPanel().then(m => dom.create(m.AdminPanel, appModel)));
} else if (pageType === 'activation') { } else if (pageType === 'activation') {
return domAsync(loadActivationPage().then(ap => dom.create(ap.ActivationPage, appModel))); return domAsync(loadActivationPage().then(ap => dom.create(ap.getActivationPage(), appModel)));
} else { } else {
return dom.create(pagePanelsDoc, appModel, appObj); return dom.create(pagePanelsDoc, appModel, appObj);
} }

View File

@ -24,10 +24,10 @@ export async function buildNewSiteModal(context: Disposable, options: {
appModel: AppModel, appModel: AppModel,
plan?: PlanSelection, plan?: PlanSelection,
onCreate?: () => void onCreate?: () => void
}) { }): Promise<void> {
const { onCreate } = options; const { onCreate } = options;
return showModal( showModal(
context, context,
(_owner: Disposable, ctrl: IModalControl) => dom.create(NewSiteModalContent, ctrl, onCreate), (_owner: Disposable, ctrl: IModalControl) => dom.create(NewSiteModalContent, ctrl, onCreate),
dom.cls(cssModalIndex.className), dom.cls(cssModalIndex.className),
@ -87,12 +87,12 @@ export function buildUpgradeModal(owner: Disposable, options: {
throw new UserError(t(`Billing is not supported in grist-core`)); throw new UserError(t(`Billing is not supported in grist-core`));
} }
export interface UpgradeButton { export interface IUpgradeButton {
showUpgradeCard(...args: DomArg<HTMLElement>[]): DomContents; showUpgradeCard(...args: DomArg<HTMLElement>[]): DomContents;
showUpgradeButton(...args: DomArg<HTMLElement>[]): DomContents; showUpgradeButton(...args: DomArg<HTMLElement>[]): DomContents;
} }
export function buildUpgradeButton(owner: IDisposableOwner, app: AppModel): UpgradeButton { export function buildUpgradeButton(owner: IDisposableOwner, app: AppModel): IUpgradeButton {
return { return {
showUpgradeCard: () => null, showUpgradeCard: () => null,
showUpgradeButton: () => null, showUpgradeButton: () => null,

View File

@ -0,0 +1,18 @@
import {AppModel} from 'app/client/models/AppModel';
import { Disposable, IDomCreator } from 'grainjs';
export type IActivationPageCreator = IDomCreator<[AppModel]>
/**
* A blank ActivationPage stand-in, as it's possible for the frontend to try and load an "activation page",
* even though there's no activation in core.
*/
export class DefaultActivationPage extends Disposable {
constructor(_appModel: AppModel) {
super();
}
public buildDom() {
return null;
}
}

View File

@ -1,10 +1,2 @@
import {AppModel} from 'app/client/models/AppModel'; export { buildHomeBanners, buildDocumentBanners } from 'app/client/components/CoreBanners';
import {DocPageModel} from 'app/client/models/DocPageModel';
export function buildHomeBanners(_app: AppModel) {
return null;
}
export function buildDocumentBanners(_docPageModel: DocPageModel) {
return null;
}

View File

@ -1,12 +1,7 @@
import {AppModel} from 'app/client/models/AppModel'; import {
import {Disposable} from 'grainjs'; DefaultActivationPage, IActivationPageCreator
} from "app/client/ui/DefaultActivationPage";
export class ActivationPage extends Disposable { export function getActivationPage(): IActivationPageCreator {
constructor(_appModel: AppModel) { return DefaultActivationPage;
super();
}
public buildDom() {
return null;
}
} }