(core) Removing NEW_DEAL flag

Summary:
Removing NEW_DEAL flag checks and exposing all new deal features as default.
Also removing Pages.ts as it was moved to grist-core.

Test Plan: Existing and updated tests.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3572
This commit is contained in:
Jarosław Sadziński 2022-08-09 16:49:51 +02:00
parent 083a0ec000
commit ee109e9186
7 changed files with 9 additions and 23 deletions

View File

@ -4,7 +4,7 @@ import {reportError, setErrorNotifier} from 'app/client/models/errors';
import {urlState} from 'app/client/models/gristUrlState'; import {urlState} from 'app/client/models/gristUrlState';
import {Notifier} from 'app/client/models/NotifyModel'; import {Notifier} from 'app/client/models/NotifyModel';
import {getFlavor, ProductFlavor} from 'app/client/ui/CustomThemes'; import {getFlavor, ProductFlavor} from 'app/client/ui/CustomThemes';
import {buildNewSiteModal, buildUpgradeModal, NEW_DEAL} from 'app/client/ui/ProductUpgrades'; import {buildNewSiteModal, buildUpgradeModal} from 'app/client/ui/ProductUpgrades';
import {OrgUsageSummary} from 'app/common/DocUsage'; import {OrgUsageSummary} from 'app/common/DocUsage';
import {Features, isLegacyPlan, Product} from 'app/common/Features'; import {Features, isLegacyPlan, Product} from 'app/common/Features';
import {GristLoadConfig} from 'app/common/gristUrls'; import {GristLoadConfig} from 'app/common/gristUrls';
@ -206,9 +206,7 @@ export class AppModelImpl extends Disposable implements AppModel {
public readonly isPersonal = Boolean(this.currentOrg?.owner); public readonly isPersonal = Boolean(this.currentOrg?.owner);
public readonly isTeamSite = Boolean(this.currentOrg) && !this.isPersonal; public readonly isTeamSite = Boolean(this.currentOrg) && !this.isPersonal;
// TODO: the `NEW_DEAL` observable can be removed after new deal is released. public readonly isLegacySite = Boolean(this.currentProduct && isLegacyPlan(this.currentProduct.name));
public readonly isLegacySite = Boolean(
NEW_DEAL().get() && this.currentProduct && isLegacyPlan(this.currentProduct.name));
public readonly userPrefsObs = getUserPrefsObs(this); public readonly userPrefsObs = getUserPrefsObs(this);

View File

@ -10,7 +10,7 @@ import {BillingPlanManagers} from 'app/client/ui/BillingPlanManagers';
import {createForbiddenPage} from 'app/client/ui/errorPages'; import {createForbiddenPage} from 'app/client/ui/errorPages';
import {leftPanelBasic} from 'app/client/ui/LeftPanelCommon'; import {leftPanelBasic} from 'app/client/ui/LeftPanelCommon';
import {pagePanels} from 'app/client/ui/PagePanels'; import {pagePanels} from 'app/client/ui/PagePanels';
import {NEW_DEAL, showTeamUpgradeConfirmation} from 'app/client/ui/ProductUpgrades'; import {showTeamUpgradeConfirmation} from 'app/client/ui/ProductUpgrades';
import {createTopBarHome} from 'app/client/ui/TopBar'; import {createTopBarHome} from 'app/client/ui/TopBar';
import {cssBreadcrumbs, cssBreadcrumbsLink, separator} from 'app/client/ui2018/breadcrumbs'; import {cssBreadcrumbs, cssBreadcrumbsLink, separator} from 'app/client/ui2018/breadcrumbs';
import {bigBasicButton, bigBasicButtonLink, bigPrimaryButton} from 'app/client/ui2018/buttons'; import {bigBasicButton, bigBasicButtonLink, bigPrimaryButton} from 'app/client/ui2018/buttons';
@ -272,9 +272,8 @@ export class BillingPage extends Disposable {
), ),
!canManage ? null : !canManage ? null :
makeActionLink('Manage billing', 'Settings', this._model.getCustomerPortalUrl(), testId('portal-link')), makeActionLink('Manage billing', 'Settings', this._model.getCustomerPortalUrl(), testId('portal-link')),
!wasTeam ? null : !wasTeam ? null : makeActionButton('Downgrade plan', 'Settings',
dom.maybe(NEW_DEAL(), () => makeActionButton('Downgrade plan', 'Settings', () => this._confirmDowngradeToTeamFree(), testId('downgrade-free-link')),
() => this._confirmDowngradeToTeamFree(), testId('downgrade-free-link'))),
!canRenew ? null : !canRenew ? null :
makeActionLink('Renew subscription', 'Settings', this._model.renewPlan(), testId('renew-link')), makeActionLink('Renew subscription', 'Settings', this._model.renewPlan(), testId('renew-link')),
!canUpgrade ? null : !canUpgrade ? null :

View File

@ -1,6 +1,6 @@
import type {AppModel} from 'app/client/models/AppModel'; import type {AppModel} from 'app/client/models/AppModel';
import {commonUrls} from 'app/common/gristUrls'; import {commonUrls} from 'app/common/gristUrls';
import {Disposable, DomArg, DomContents, IDisposableOwner, Observable, observable} from 'grainjs'; import {Disposable, DomArg, DomContents, IDisposableOwner} from 'grainjs';
export function buildNewSiteModal(context: Disposable, options: { export function buildNewSiteModal(context: Disposable, options: {
planName: string, planName: string,
@ -28,7 +28,3 @@ export function buildUpgradeButton(owner: IDisposableOwner, app: AppModel): Upgr
showUpgradeButton : () => null, showUpgradeButton : () => null,
}; };
} }
export function NEW_DEAL(): Observable<boolean> {
return observable(false);
}

View File

@ -545,9 +545,6 @@ export interface GristLoadConfig {
// String to append to the end of the HTML document.title // String to append to the end of the HTML document.title
pageTitleSuffix?: string; pageTitleSuffix?: string;
// TODO: can be removed once new deal is released.
newDeal?: boolean;
} }
export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts"); export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts");

View File

@ -147,8 +147,7 @@ export const PRODUCTS: IProduct[] = [
export function getDefaultProductNames() { export function getDefaultProductNames() {
const defaultProduct = process.env.GRIST_DEFAULT_PRODUCT; const defaultProduct = process.env.GRIST_DEFAULT_PRODUCT;
// TODO: can be removed once new deal is released. // TODO: can be removed once new deal is released.
const personalFreePlan = process.env.NEW_DEAL === 'true' const personalFreePlan = PERSONAL_FREE_PLAN;
? PERSONAL_FREE_PLAN : PERSONAL_LEGACY_PLAN;
return { return {
// Personal site start off on a functional plan. // Personal site start off on a functional plan.
personal: defaultProduct || personalFreePlan, personal: defaultProduct || personalFreePlan,

View File

@ -35,8 +35,7 @@ import {Group} from "app/gen-server/entity/Group";
import {Login} from "app/gen-server/entity/Login"; import {Login} from "app/gen-server/entity/Login";
import {AccessOption, AccessOptionWithRole, Organization} from "app/gen-server/entity/Organization"; import {AccessOption, AccessOptionWithRole, Organization} from "app/gen-server/entity/Organization";
import {Pref} from "app/gen-server/entity/Pref"; import {Pref} from "app/gen-server/entity/Pref";
import {getDefaultProductNames, personalFreeFeatures, personalLegacyFeatures, import {getDefaultProductNames, personalFreeFeatures, Product} from "app/gen-server/entity/Product";
Product} from "app/gen-server/entity/Product";
import {Secret} from "app/gen-server/entity/Secret"; import {Secret} from "app/gen-server/entity/Secret";
import {User} from "app/gen-server/entity/User"; import {User} from "app/gen-server/entity/User";
import {Workspace} from "app/gen-server/entity/Workspace"; import {Workspace} from "app/gen-server/entity/Workspace";
@ -821,8 +820,7 @@ export class HomeDBManager extends EventEmitter {
individual: true, individual: true,
product: { product: {
name: 'anonymous', name: 'anonymous',
features: process.env.NEW_DEAL === 'true' features: personalFreeFeatures,
? personalFreeFeatures : personalLegacyFeatures,
}, },
isManager: false, isManager: false,
inGoodStanding: true, inGoodStanding: true,

View File

@ -55,7 +55,6 @@ export function makeGristConfig(homeUrl: string|null, extra: Partial<GristLoadCo
survey: Boolean(process.env.DOC_ID_NEW_USER_INFO), survey: Boolean(process.env.DOC_ID_NEW_USER_INFO),
tagManagerId: process.env.GOOGLE_TAG_MANAGER_ID, tagManagerId: process.env.GOOGLE_TAG_MANAGER_ID,
activation: (mreq as RequestWithLogin|undefined)?.activation, activation: (mreq as RequestWithLogin|undefined)?.activation,
newDeal: process.env.NEW_DEAL === 'true',
...extra, ...extra,
}; };
} }