blob: f89ea0465cd9abc654d928dfbe9c5ac4cd8aac1d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
import { makeObservable, observable } from 'mobx';
interface IUser {
id: string | null;
email: string | null;
firstname: string | null;
lastname: string | null;
organization: string | null;
accountType: string | null;
beta: boolean;
locale: string;
isSubscriptionOwner: boolean;
team: object;
}
// TODO: Need to cleanup these fields since we have removed the tiers of the paid plans from Ferdium
export default class User {
id: string | null = null;
@observable email: string | null = null;
@observable firstname: string | null = null;
@observable lastname: string | null = null;
@observable organization: string | null = null;
@observable accountType: string | null = null;
// Note: Kept around to be able to handle the response from Franz server
// better assume it's confirmed to avoid noise
@observable subscription = {};
@observable isSubscriptionOwner = false;
@observable beta = false;
@observable locale: string | null = null;
@observable team = {};
constructor(data: IUser) {
makeObservable(this);
if (!data) {
throw new Error('User config not valid');
}
if (!data.id) {
throw new Error('User requires Id');
}
this.id = data.id;
this.email = data.email || this.email;
this.firstname = data.firstname || this.firstname;
this.lastname = data.lastname || this.lastname;
this.organization = data.organization || this.organization;
this.accountType = data.accountType || this.accountType;
this.beta = data.beta || this.beta;
this.locale = data.locale || this.locale;
this.isSubscriptionOwner =
data.isSubscriptionOwner || this.isSubscriptionOwner;
this.team = data.team || this.team;
}
}
|