(core) New URL that opens Create site popup.

Summary: Adding new url parameter for team site creation

Test Plan: Updated tests.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3554
This commit is contained in:
Jarosław Sadziński
2022-08-03 12:48:01 +02:00
parent c359547f6b
commit 40c9b8b7e8
5 changed files with 35 additions and 8 deletions

View File

@@ -4,6 +4,8 @@ import {encodeUrl, getSlugIfNeeded, GristLoadConfig, IGristUrlState, isOrgInPath
parseSubdomain, sanitizePathTail} from 'app/common/gristUrls';
import {getOrgUrlInfo} from 'app/common/gristUrls';
import {UserProfile} from 'app/common/LoginSessionAPI';
import {BillingTask} from 'app/common/BillingAPI';
import {TEAM_FREE_PLAN, TEAM_PLAN} from 'app/common/Features';
import {tbind} from 'app/common/tbind';
import * as version from 'app/common/version';
import {ApiServer, getOrgFromRequest} from 'app/gen-server/ApiServer';
@@ -70,7 +72,6 @@ import {AddressInfo} from 'net';
import fetch from 'node-fetch';
import * as path from 'path';
import * as serveStatic from "serve-static";
import {BillingTask} from 'app/common/BillingAPI';
// Health checks are a little noisy in the logs, so we don't show them all.
// We show the first N health checks:
@@ -1200,6 +1201,19 @@ export class FlexServer implements GristServer {
const url = `${getPrefix(req)}/api/billing/signup?planType=${planType}&billingPlan=${billingPlan}`;
return resp.redirect(url);
}));
// New landing page for the new NEW_DEAL.
this.app.get('/billing/create-team', ...middleware, expressWrap(async (req, resp, next) => {
const planType = optStringParam(req.query.planType) || '';
// Currently we have hardcoded support only for those two plans.
const supportedPlans = [TEAM_PLAN, TEAM_FREE_PLAN];
if (!supportedPlans.includes(planType)) {
return this._sendAppPage(req, resp, {path: 'error.html', status: 404, config: {errPage: 'not-found'}});
}
// Redirect to home page with url params
const url = `${getPrefix(req)}?planType=${planType}#create-team`;
return resp.redirect(url);
}));
}
/**
@@ -1238,9 +1252,7 @@ export class FlexServer implements GristServer {
});
resp.status(200).send();
}),
// Add a final error handler that reports errors as JSON.
jsonErrorHandler);
}), jsonErrorHandler); // Add a final error handler that reports errors as JSON.
}
public finalize() {