Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/pages/pricing/subscriptions.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Alert, Layout, List } from "antd";6import dayjs from "dayjs";78import { Icon, IconName } from "@cocalc/frontend/components/icon";9import { LicenseIdleTimeouts } from "@cocalc/util/consts/site-license";10import { compute_cost } from "@cocalc/util/licenses/purchase/compute-cost";11import {12CURRENT_VERSION,13discount_monthly_pct,14discount_yearly_pct,15MIN_QUOTE,16} from "@cocalc/util/licenses/purchase/consts";17import { PurchaseInfo } from "@cocalc/util/licenses/purchase/types";18import { money } from "@cocalc/util/licenses/purchase/utils";19import { COLORS } from "@cocalc/util/theme";20import Footer from "components/landing/footer";21import Head from "components/landing/head";22import Header from "components/landing/header";23import PricingItem, { Line } from "components/landing/pricing-item";24import { Paragraph, Title } from "components/misc";25import A from "components/misc/A";26import {27applyLicense,28listedPrices,29pricingQuestions,30} from "components/share/pricing";31import { LinkToStore, StoreConf } from "components/store/link";32import { MAX_WIDTH } from "lib/config";33import { Customize } from "lib/customize";34import withCustomize from "lib/with-customize";3536function addMonth(date: Date): Date {37return dayjs(date).add(30, "days").add(12, "hours").toDate();38}3940interface Item {41title: string;42icon: IconName;43projects: number;44disk: number;45shared_ram: number;46shared_cores: number;47academic?: boolean;48uptime?: string;49monthly: number;50yearly: number;51conf: StoreConf;52}5354const now = new Date();5556const hobby: Item = (() => {57const conf = {58run_limit: 2,59disk: 3,60ram: 2,61cpu: 1,62uptime: "short",63user: "academic",64} as const;6566const info: PurchaseInfo = {67version: CURRENT_VERSION,68type: "quota",69user: conf.user,70upgrade: "custom",71quantity: conf.run_limit,72subscription: "monthly",73start: now,74end: addMonth(now),75custom_ram: conf.ram,76custom_cpu: conf.cpu,77custom_disk: conf.disk,78custom_member: true,79custom_dedicated_ram: 0,80custom_dedicated_cpu: 0,81custom_uptime: conf.uptime,82};8384const priceM = compute_cost(info);85const priceY = compute_cost({ ...info, subscription: "yearly" });8687return {88title: "Hobbyist",89icon: "battery-quarter",90projects: conf.run_limit,91shared_ram: conf.ram,92shared_cores: conf.cpu,93disk: conf.disk,94academic: true,95uptime: LicenseIdleTimeouts[conf.uptime].labelShort,96monthly: priceM.cost,97yearly: priceY.cost,98conf,99};100})();101102const academic: Item = (() => {103const conf = {104run_limit: 3,105disk: 10,106ram: 5,107cpu: 2,108uptime: "day",109user: "academic",110} as const;111112const info: PurchaseInfo = {113version: CURRENT_VERSION,114type: "quota",115user: conf.user,116upgrade: "custom",117quantity: conf.run_limit,118subscription: "monthly",119start: now,120end: addMonth(now),121custom_ram: conf.ram,122custom_cpu: conf.cpu,123custom_disk: conf.disk,124custom_member: true,125custom_dedicated_ram: 0,126custom_dedicated_cpu: 0,127custom_uptime: conf.uptime,128};129130const priceM = compute_cost(info);131const priceY = compute_cost({ ...info, subscription: "yearly" });132133return {134title: "Academic Researcher Group",135icon: "battery-half",136projects: conf.run_limit,137shared_ram: conf.ram,138shared_cores: conf.cpu,139disk: conf.disk,140dedicated_cores: 0,141academic: true,142uptime: LicenseIdleTimeouts[conf.uptime].labelShort,143monthly: priceM.cost,144yearly: priceY.cost,145conf,146};147})();148149const business: Item = (() => {150const conf = {151run_limit: 5,152disk: 5,153ram: 4,154cpu: 1,155uptime: "medium",156user: "business",157} as const;158159const info: PurchaseInfo = {160version: CURRENT_VERSION,161type: "quota",162user: conf.user,163upgrade: "custom",164quantity: conf.run_limit,165subscription: "monthly",166start: now,167end: addMonth(now),168custom_ram: conf.ram,169custom_cpu: conf.cpu,170custom_disk: conf.disk,171custom_member: true,172custom_dedicated_ram: 0,173custom_dedicated_cpu: 0,174custom_uptime: conf.uptime,175};176177const priceM = compute_cost(info);178const priceY = compute_cost({ ...info, subscription: "yearly" });179180return {181title: "Business Working Group",182icon: "battery-full",183projects: conf.run_limit,184shared_ram: conf.ram,185shared_cores: conf.cpu,186disk: conf.disk,187academic: false,188uptime: LicenseIdleTimeouts[conf.uptime].labelShort,189monthly: priceM.cost,190yearly: priceY.cost,191conf,192};193})();194195const data: Item[] = [hobby, academic, business];196197function dedicated(): JSX.Element {198return (199<Alert200style={{ margin: "15px 0" }}201message="Dedicated Virtual Machines"202description={203<span style={{ fontSize: "11pt" }}>204For more intensive workloads you can also rent a{" "}205<A href="/pricing/dedicated">dedicated virtual machine or disk</A>.206</span>207}208type="info"209showIcon210/>211);212}213214export default function Subscriptions({ customize }) {215const { siteName } = customize;216return (217<Customize value={customize}>218<Head title={`${siteName} – Pricing – Subscriptions`} />219<Layout>220<Header page="pricing" subPage="subscriptions" />221<Layout.Content222style={{223backgroundColor: "white",224}}225>226<Body />227<Footer />228</Layout.Content>229</Layout>230</Customize>231);232}233234function Body(): JSX.Element {235return (236<div237style={{238maxWidth: MAX_WIDTH,239margin: "15px auto",240padding: "15px",241backgroundColor: "white",242}}243>244<Title level={1} style={{ textAlign: "center" }}>245<Icon name="calendar" style={{ marginRight: "30px" }} /> CoCalc -246Subscriptions247</Title>248<a id="subscriptions"></a>249<Paragraph>250Initially, you start using CoCalc under a{" "}251<A href="https://doc.cocalc.com/trial.html">free trial plan</A> in order252to test out the service. If CoCalc works for you, please purchase a253license.254</Paragraph>255<Paragraph>256A subscription provides you with a{" "}257<A href="https://doc.cocalc.com/licenses.html">license key</A> for{" "}258<A href="https://doc.cocalc.com/project-settings.html#licenses">259upgrading your projects260</A>{" "}261or other projects where you are a collaborator — everyone using an262upgraded project benefits equally. Such a{" "}263<A href="/billing/subscriptions">subscription</A>{" "}264<b>automatically renews</b> at the end of each period. You can{" "}265<A href="/billing/subscriptions">266<b>cancel at any time</b>267</A>268.269</Paragraph>270271{applyLicense()}272273<Title level={2}>Examples</Title>274<Paragraph>275We list three typical configurations below, which you can{" "}276<A href="/store/site-license">modify and purchase here</A>. All277parameters can be adjusted to fit your needs. Listed upgrades are for278each project. Exact prices may vary. Below ${MIN_QUOTE}, only online279purchases are available (no purchase orders). Subscriptions receive a{" "}280{discount_monthly_pct}% discount for monthly and {discount_yearly_pct}%281for yearly periods.282</Paragraph>283<List284grid={{ gutter: 15, column: 3, xs: 1, sm: 1 }}285dataSource={data}286renderItem={(item) => (287<PricingItem title={item.title} icon={item.icon}>288<Line amount={item.projects} desc="Projects" />289<Line amount={item.shared_ram} desc="Shared RAM per project" />290<Line amount={item.shared_cores} desc="Shared CPU per project" />291<Line amount={item.disk} desc="Disk space per project" />292<Line amount={item.uptime} desc="Idle timeout" />293<Line amount={"∞"} desc="Collaborators" />294{item.academic ? (295<Line amount="40%" desc="Academic discount" />296) : (297<Line amount="" desc="" />298)}299300<br />301<br />302<div>303<span304style={{305fontWeight: "bold",306fontSize: "18pt",307color: COLORS.GRAY_DD,308}}309>310{money(item.monthly, true)}311</span>{" "}312/ month313</div>314<div>315<span316style={{317fontWeight: "bold",318fontSize: "18pt",319color: COLORS.GRAY_DD,320}}321>322{money(item.yearly, true)}323</span>{" "}324/ year325</div>326<LinkToStore conf={item.conf} />327</PricingItem>328)}329/>330{listedPrices()}331{pricingQuestions()}332{dedicated()}333</div>334);335}336337export async function getServerSideProps(context) {338return await withCustomize({ context });339}340341342