(core) Add product for new personal plan

Summary:
Adds the new personal plan as a product that will be available
in the future. Can be enabled along with other plan-related via
an environment variable.

Test Plan: Browser tests and existing tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3533
This commit is contained in:
George Gevoian
2022-07-26 10:49:35 -07:00
parent 5c8211c61d
commit aeba738f7c
18 changed files with 194 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
import { isTeamPlan, Product } from 'app/common/Features';
import { normalizeEmail } from 'app/common/emails';
import { Features } from 'app/common/Features';
import { PermissionData, PermissionDelta } from 'app/common/UserAPI';
/**
@@ -33,7 +33,9 @@ export interface ShareAnnotations {
* current shares in place.
*/
export class ShareAnnotator {
constructor(private _features: Features, private _state: PermissionData) {
private _features = this._product?.features ?? {};
constructor(private _product: Product|null, private _state: PermissionData) {
}
public updateState(state: PermissionData) {
@@ -43,7 +45,7 @@ export class ShareAnnotator {
public annotateChanges(change: PermissionDelta): ShareAnnotations {
const features = this._features;
const annotations: ShareAnnotations = {
hasTeam: features.maxWorkspacesPerOrg !== 1,
hasTeam: !this._product || isTeamPlan(this._product.name),
users: new Map(),
};
if (features.maxSharesPerDocPerRole || features.maxSharesPerWorkspace) {