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/frontend/account/table.ts
Views: 687
/*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,27email_address: null,28email_address_verified: null,29email_address_problem: null,30editor_settings: null,31other_settings: null,32name: null,33first_name: null,34last_name: null,35terminal: null,36autosave: null,37evaluate_key: null,38font_size: null,39passports: null,40groups: null,41last_active: null,42ssh_keys: null,43created: null,44unlisted: null,45//tags: null,46tours: null,47purchase_closing_day: null,48email_daily_statements: null,49stripe_checkout_session: null,50stripe_usage_subscription: null,51stripe_customer: null, // used for legacy upgrades ONLY.52},53],54};55}5657_change(table: { get_one: () => { toJS: () => any } }) {58const changes = table.get_one();59if (!changes) return;60const actions = this.redux.getActions("account");61const obj = changes.toJS();62actions.setState(obj);63if (this.first_set) {64this.first_set = false;65actions.setState({ is_ready: true });66this.redux.getStore("account").emit("is_ready");67if (obj.stripe_customer?.subscriptions?.data != null) {68// exclude legacy customers from commercialization requirements.69(70this.redux.getActions("customize") as any71).disableCommercializationParameters();72}73}74}75}767778