Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/src/packages/frontend/account/table.ts
Views: 923
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Table } from "@cocalc/frontend/app-framework/Table";67// Create and register account table, which gets automatically8// synchronized with the server.9export class AccountTable extends Table {10private first_set: boolean = true;1112constructor(name, redux) {13super(name, redux);14this.query = this.query.bind(this);15this._change = this._change.bind(this);16}1718options() {19return [];20}2122query() {23return {24accounts: [25{26account_id: null,27balance: null,28min_balance: null,29balance_alert: null,30auto_balance: null,31email_address: null,32email_address_verified: null,33email_address_problem: null,34editor_settings: null,35other_settings: null,36name: null,37first_name: null,38last_name: null,39terminal: null,40autosave: null,41evaluate_key: null,42font_size: null,43passports: null,44groups: null,45last_active: null,46ssh_keys: null,47created: null,48unlisted: null,49//tags: null,50tours: null,51purchase_closing_day: null,52email_daily_statements: null,53stripe_checkout_session: null,54stripe_usage_subscription: null,55stripe_customer: null, // used for legacy upgrades ONLY.56unread_message_count: null,57},58],59};60}6162_change(table: { get_one: () => { toJS: () => any } }) {63const changes = table.get_one();64if (!changes) return;65const actions = this.redux.getActions("account");66const obj = changes.toJS();67actions.setState(obj);68if (this.first_set) {69this.first_set = false;70actions.setState({ is_ready: true });71this.redux.getStore("account").emit("is_ready");72if (obj.stripe_customer?.subscriptions?.data != null) {73// exclude legacy customers from commercialization requirements.74(75this.redux.getActions("customize") as any76).disableCommercializationParameters();77}78}79}80}818283