@social-mail/social-mail-client 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +1 -91
  2. package/dist/admin/Admin.js +50 -2
  3. package/dist/admin/Admin.js.map +1 -1
  4. package/dist/admin/commands/AdminCommands.js +37 -0
  5. package/dist/admin/commands/AdminCommands.js.map +1 -1
  6. package/dist/admin/drawer/AdminDrawer.js +40 -2
  7. package/dist/admin/drawer/AdminDrawer.js.map +1 -1
  8. package/dist/admin/pages/config/ConfigPage.js +18 -0
  9. package/dist/admin/pages/config/ConfigPage.js.map +1 -0
  10. package/dist/admin/pages/domains/ChooseDomainPage.js +86 -0
  11. package/dist/admin/pages/domains/ChooseDomainPage.js.map +1 -0
  12. package/dist/admin/pages/domains/DomainListPage.js +67 -0
  13. package/dist/admin/pages/domains/DomainListPage.js.map +1 -0
  14. package/dist/admin/pages/domains/EditDomainPage.js +79 -0
  15. package/dist/admin/pages/domains/EditDomainPage.js.map +1 -0
  16. package/dist/admin/pages/domains/services/AdminDomainService.js +50 -0
  17. package/dist/admin/pages/domains/services/AdminDomainService.js.map +1 -0
  18. package/dist/admin/pages/home/AdminHome.js +18 -0
  19. package/dist/admin/pages/home/AdminHome.js.map +1 -0
  20. package/dist/admin/pages/users/EditUserPage.js +105 -0
  21. package/dist/admin/pages/users/EditUserPage.js.map +1 -0
  22. package/dist/admin/pages/users/UserListPage.js +82 -0
  23. package/dist/admin/pages/users/UserListPage.js.map +1 -0
  24. package/dist/admin/pages/users/services/AdminUserService.js +57 -0
  25. package/dist/admin/pages/users/services/AdminUserService.js.map +1 -0
  26. package/dist/common/SocialMailApp.js +14 -0
  27. package/dist/common/SocialMailApp.js.map +1 -0
  28. package/dist/common/Sql.js +12 -0
  29. package/dist/common/Sql.js.map +1 -0
  30. package/dist/common/controls/form/RequiredFormField.js +57 -0
  31. package/dist/common/controls/form/RequiredFormField.js.map +1 -0
  32. package/dist/common/controls/repeater/InfiniteRepeater.js +100 -0
  33. package/dist/common/controls/repeater/InfiniteRepeater.js.map +1 -0
  34. package/dist/common/pages/LoginPage.js +79 -0
  35. package/dist/common/pages/LoginPage.js.map +1 -0
  36. package/dist/common/pages/mailboxes/MailboxEditorPage.js +79 -0
  37. package/dist/common/pages/mailboxes/MailboxEditorPage.js.map +1 -0
  38. package/dist/common/pages/mailboxes/MailboxListPage.js +80 -0
  39. package/dist/common/pages/mailboxes/MailboxListPage.js.map +1 -0
  40. package/dist/common/pages/mailboxes/services/MailboxService.js +60 -0
  41. package/dist/common/pages/mailboxes/services/MailboxService.js.map +1 -0
  42. package/dist/common/pages/user/LoginPage.js +79 -0
  43. package/dist/common/pages/user/LoginPage.js.map +1 -0
  44. package/dist/model/model.js +36 -0
  45. package/dist/model/model.js.map +1 -1
  46. package/dist/services/ConfigService.js +45 -0
  47. package/dist/services/ConfigService.js.map +1 -0
  48. package/dist/services/EntityService.js +4 -0
  49. package/dist/services/EntityService.js.map +1 -1
  50. package/dist/services/UserService.js +54 -0
  51. package/dist/services/UserService.js.map +1 -0
  52. package/dist/style/GlobalStyle.js +11 -3
  53. package/dist/style/GlobalStyle.js.map +1 -1
  54. package/dist/style/OverrideAppStyle.js +22 -0
  55. package/dist/style/OverrideAppStyle.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/dist/web/AppIndex.js +38 -2
  58. package/dist/web/AppIndex.js.map +1 -1
  59. package/node_modules/@web-atoms/entity/dist/services/BaseEntityService.d.ts +5 -2
  60. package/node_modules/@web-atoms/entity/dist/services/BaseEntityService.d.ts.map +1 -1
  61. package/node_modules/@web-atoms/entity/dist/services/BaseEntityService.js +18 -1
  62. package/node_modules/@web-atoms/entity/dist/services/BaseEntityService.js.map +1 -1
  63. package/node_modules/@web-atoms/entity/dist/services/MockBaseEntityService.d.ts +2 -0
  64. package/node_modules/@web-atoms/entity/dist/services/MockBaseEntityService.d.ts.map +1 -1
  65. package/node_modules/@web-atoms/entity/dist/services/MockBaseEntityService.js +1 -0
  66. package/node_modules/@web-atoms/entity/dist/services/MockBaseEntityService.js.map +1 -1
  67. package/node_modules/@web-atoms/entity/dist/services/Query.d.ts +2 -0
  68. package/node_modules/@web-atoms/entity/dist/services/Query.d.ts.map +1 -1
  69. package/node_modules/@web-atoms/entity/dist/services/Query.js +9 -6
  70. package/node_modules/@web-atoms/entity/dist/services/Query.js.map +1 -1
  71. package/node_modules/@web-atoms/entity/dist/services/QueryProcessor.d.ts +2 -0
  72. package/node_modules/@web-atoms/entity/dist/services/QueryProcessor.d.ts.map +1 -0
  73. package/node_modules/@web-atoms/entity/dist/services/QueryProcessor.js +9 -0
  74. package/node_modules/@web-atoms/entity/dist/services/QueryProcessor.js.map +1 -0
  75. package/node_modules/@web-atoms/entity/dist/tsconfig.tsbuildinfo +1 -1
  76. package/node_modules/@web-atoms/entity/package.json +1 -1
  77. package/node_modules/@web-atoms/entity/src/services/BaseEntityService.ts +23 -3
  78. package/node_modules/@web-atoms/entity/src/services/MockBaseEntityService.ts +3 -0
  79. package/node_modules/@web-atoms/entity/src/services/Query.ts +12 -7
  80. package/node_modules/@web-atoms/entity/src/services/QueryProcessor.ts +1 -0
  81. package/package.json +2 -2
  82. package/src/admin/Admin.tsx +40 -1
  83. package/src/admin/commands/AdminCommands.ts +33 -0
  84. package/src/admin/drawer/AdminDrawer.tsx +70 -0
  85. package/src/admin/pages/config/ConfigPage.tsx +5 -0
  86. package/src/admin/pages/domains/DomainListPage.tsx +43 -0
  87. package/src/admin/pages/domains/choose/ChooseDomainPage.tsx +57 -0
  88. package/src/admin/pages/domains/edit/EditDomainPage.tsx +102 -0
  89. package/src/admin/pages/domains/services/AdminDomainService.ts +34 -0
  90. package/src/admin/pages/home/AdminHome.tsx +6 -0
  91. package/src/admin/pages/users/EditUserPage.tsx +85 -0
  92. package/src/admin/pages/users/UserListPage.tsx +53 -0
  93. package/src/admin/pages/users/services/AdminUserService.ts +34 -0
  94. package/src/common/SocialMailApp.ts +7 -0
  95. package/src/common/Sql.ts +74 -0
  96. package/src/common/commands/CommonCommands.ts +6 -0
  97. package/src/common/controls/buttons/IconButton.tsx +60 -0
  98. package/src/common/controls/form/RequiredFormField.tsx +53 -0
  99. package/src/common/controls/repeater/InfiniteRepeater.tsx +93 -0
  100. package/src/common/pages/mailboxes/MailboxEditorPage.tsx +66 -0
  101. package/src/common/pages/mailboxes/MailboxListPage.tsx +48 -0
  102. package/src/common/pages/mailboxes/services/MailboxService.ts +34 -0
  103. package/src/common/pages/user/LoginPage.tsx +51 -0
  104. package/src/model/model.ts +234 -0
  105. package/src/services/BusyProgress.ts +2 -2
  106. package/src/services/ConfigService.ts +19 -0
  107. package/src/services/EntityService.ts +3 -0
  108. package/src/services/UserService.ts +26 -0
  109. package/src/style/GlobalStyle.ts +11 -2
  110. package/src/style/OverrideAppStyle.ts +9 -0
  111. package/src/web/AppIndex.tsx +26 -1
@@ -0,0 +1,234 @@
1
+ import DateTime from "@web-atoms/date-time/dist/DateTime";
2
+ import type IClrEntity from "@web-atoms/entity/dist/models/IClrEntity";
3
+ import { ICollection, IGeometry, IModel, Model } from "@web-atoms/entity/dist/services/BaseEntityService";
4
+
5
+ export interface IAppRole extends IClrEntity {
6
+ roleName?: string;
7
+ roles?: ICollection<IUserRole>;
8
+ }
9
+
10
+ export const AppRole: IModel<IAppRole> = new Model<IAppRole>("AppRole", { roleName: "" });
11
+
12
+ export interface IAppFile extends IClrEntity {
13
+ appFileID?: number;
14
+ folder?: string;
15
+ fileName?: string;
16
+ fileSize?: number;
17
+ contentType?: string;
18
+ fileContentID?: number;
19
+ fileContent?: IFileContent;
20
+ attachments?: ICollection<IEmailAttachment>;
21
+ }
22
+
23
+ export const AppFile: IModel<IAppFile> = new Model<IAppFile>("AppFile", { folder: "",fileName: "",fileSize: 0,contentType: "",fileContentID: 0 });
24
+
25
+ export interface IFileContent extends IClrEntity {
26
+ fileContentID?: number;
27
+ contentHash?: string;
28
+ cloudPath?: string | null;
29
+ contentType?: string;
30
+ contentSize?: number;
31
+ appFiles?: ICollection<IAppFile>;
32
+ }
33
+
34
+ export const FileContent: IModel<IFileContent> = new Model<IFileContent>("FileContent", { contentHash: "",contentType: "",contentSize: 0 });
35
+
36
+ export interface IConfiguration extends IClrEntity {
37
+ name?: string;
38
+ configValue?: string;
39
+ }
40
+
41
+ export const Configuration: IModel<IConfiguration> = new Model<IConfiguration>("Configuration", { name: "",configValue: "" });
42
+
43
+ export interface IDomain extends IClrEntity {
44
+ domainID?: number;
45
+ name?: string;
46
+ hostedDomain?: IHostedDomain;
47
+ }
48
+
49
+ export const Domain: IModel<IDomain> = new Model<IDomain>("Domain", { name: "" });
50
+
51
+ export interface IHostedDomain extends IClrEntity {
52
+ domainID?: number;
53
+ enableReceive?: boolean;
54
+ enableSend?: boolean;
55
+ useRelay?: boolean;
56
+ aliasForName?: string | null;
57
+ domain?: IDomain;
58
+ aliasFor?: IHostedDomain;
59
+ aliases?: ICollection<IHostedDomain>;
60
+ mailboxes?: ICollection<IMailbox>;
61
+ domainUsers?: ICollection<IDomainUser>;
62
+ domainKeys?: ICollection<IDomainKey>;
63
+ relays?: ICollection<IDomainRelay>;
64
+ }
65
+
66
+ export const HostedDomain: IModel<IHostedDomain> = new Model<IHostedDomain>("HostedDomain", { domainID: 0,enableReceive: false,enableSend: false,useRelay: false });
67
+
68
+ export interface IDomainUser extends IClrEntity {
69
+ domainUserID?: number;
70
+ domainID?: number;
71
+ userID?: number;
72
+ prefix?: string | null;
73
+ hostedDomain?: IHostedDomain;
74
+ user?: IUser;
75
+ }
76
+
77
+ export const DomainUser: IModel<IDomainUser> = new Model<IDomainUser>("DomainUser", { domainID: 0,userID: 0 });
78
+
79
+ export interface IDomainRelay extends IClrEntity {
80
+ domainRelayID?: number;
81
+ domainID?: number;
82
+ type?: "smtp" | "ses";
83
+ host?: string;
84
+ username?: string;
85
+ password?: string;
86
+ priority?: number;
87
+ hostedDomain?: IHostedDomain;
88
+ }
89
+
90
+ export const DomainRelay: IModel<IDomainRelay> = new Model<IDomainRelay>("DomainRelay", { domainID: 0,type: "smtp",host: "",username: "",password: "",priority: 0 });
91
+
92
+ export interface IDomainKey extends IClrEntity {
93
+ domainKeyID?: number;
94
+ name?: string;
95
+ publicKey?: string;
96
+ privateKey?: string;
97
+ domainID?: number;
98
+ domain?: IHostedDomain;
99
+ }
100
+
101
+ export const DomainKey: IModel<IDomainKey> = new Model<IDomainKey>("DomainKey", { name: "",publicKey: "",privateKey: "",domainID: 0 });
102
+
103
+ export interface IEmail extends IClrEntity {
104
+ emailID?: number;
105
+ mailBoxID?: number;
106
+ subject?: string;
107
+ textBody?: string;
108
+ htmlBody?: string;
109
+ senderName?: string;
110
+ senderID?: number;
111
+ headerFrom?: string;
112
+ headerTo?: string;
113
+ headerCc?: string;
114
+ headerBcc?: string;
115
+ mdBody?: string;
116
+ dateReceived?: DateTime;
117
+ dateCreated?: DateTime;
118
+ dateSent?: DateTime | null;
119
+ status?: "queued" | "received" | "draft" | "scheduled" | "sent";
120
+ mailbox?: IMailbox;
121
+ senderEmail?: IEmailAddress;
122
+ tags?: ICollection<IEmailTag>;
123
+ recipients?: ICollection<IEmailRecipient>;
124
+ attachments?: ICollection<IEmailAttachment>;
125
+ }
126
+
127
+ export const Email: IModel<IEmail> = new Model<IEmail>("Email", { mailBoxID: 0,subject: "",textBody: "",htmlBody: "",senderName: "",senderID: 0,headerFrom: "",headerTo: "",headerCc: "",headerBcc: "",mdBody: "",dateReceived: new DateTime(),dateCreated: new DateTime(),status: "queued" });
128
+
129
+ export interface IEmailRecipient extends IClrEntity {
130
+ emailRecipientID?: number;
131
+ emailID?: number;
132
+ email?: IEmail;
133
+ }
134
+
135
+ export const EmailRecipient: IModel<IEmailRecipient> = new Model<IEmailRecipient>("EmailRecipient", { emailID: 0 });
136
+
137
+ export interface IEmailTag extends IClrEntity {
138
+ emailTagID?: number;
139
+ emailID?: number;
140
+ tagID?: number;
141
+ email?: IEmail;
142
+ tag?: ITag;
143
+ }
144
+
145
+ export const EmailTag: IModel<IEmailTag> = new Model<IEmailTag>("EmailTag", { emailID: 0,tagID: 0 });
146
+
147
+ export interface IEmailAddress extends IClrEntity {
148
+ emailAddressID?: number;
149
+ emailAddress?: string;
150
+ mailbox?: IMailbox;
151
+ senders?: ICollection<IEmail>;
152
+ }
153
+
154
+ export const EmailAddress: IModel<IEmailAddress> = new Model<IEmailAddress>("EmailAddress", { emailAddress: "" });
155
+
156
+ export interface IEmailAttachment extends IClrEntity {
157
+ emailAttachmentID?: number;
158
+ emailID?: number;
159
+ appFileID?: number;
160
+ fileName?: string;
161
+ contentType?: string;
162
+ contentDisposition?: string;
163
+ contentID?: string | null;
164
+ email?: IEmail;
165
+ appFile?: IAppFile;
166
+ }
167
+
168
+ export const EmailAttachment: IModel<IEmailAttachment> = new Model<IEmailAttachment>("EmailAttachment", { emailID: 0,appFileID: 0,fileName: "",contentType: "",contentDisposition: "" });
169
+
170
+ export interface IMailbox extends IClrEntity {
171
+ mailboxID?: number;
172
+ domainID?: number;
173
+ storage?: number;
174
+ maxStorage?: number;
175
+ emailAddress?: IEmailAddress;
176
+ domain?: IHostedDomain;
177
+ emails?: ICollection<IEmail>;
178
+ userMailboxes?: ICollection<IUserMailbox>;
179
+ }
180
+
181
+ export const Mailbox: IModel<IMailbox> = new Model<IMailbox>("Mailbox", { mailboxID: 0,domainID: 0,storage: 0,maxStorage: 0 });
182
+
183
+ export interface IUser extends IClrEntity {
184
+ userID?: number;
185
+ userName?: string;
186
+ displayName?: string;
187
+ passwordHash?: string;
188
+ passwordSalt?: string;
189
+ roles?: ICollection<IUserRole>;
190
+ sessions?: ICollection<ILoginSession>;
191
+ domainUsers?: ICollection<IDomainUser>;
192
+ userMailboxes?: ICollection<IUserMailbox>;
193
+ }
194
+
195
+ export const User: IModel<IUser> = new Model<IUser>("User", { userName: "",displayName: "",passwordHash: "",passwordSalt: "" });
196
+
197
+ export interface IUserRole extends IClrEntity {
198
+ id?: number;
199
+ userID?: number;
200
+ roleName?: string;
201
+ user?: IUser;
202
+ role?: IAppRole;
203
+ }
204
+
205
+ export const UserRole: IModel<IUserRole> = new Model<IUserRole>("UserRole", { userID: 0,roleName: "" });
206
+
207
+ export interface IUserMailbox extends IClrEntity {
208
+ userMailboxID?: number;
209
+ emailAddress?: string;
210
+ userID?: number;
211
+ mailbox?: IMailbox;
212
+ user?: IUser;
213
+ }
214
+
215
+ export const UserMailbox: IModel<IUserMailbox> = new Model<IUserMailbox>("UserMailbox", { emailAddress: "",userID: 0 });
216
+
217
+ export interface ILoginSession extends IClrEntity {
218
+ sessionID?: number;
219
+ userID?: number;
220
+ start?: Date;
221
+ expiry?: Date;
222
+ invalid?: boolean;
223
+ user?: IUser;
224
+ }
225
+
226
+ export const LoginSession: IModel<ILoginSession> = new Model<ILoginSession>("LoginSession", { userID: 0,start: new Date(),expiry: new Date(),invalid: false });
227
+
228
+ export interface ITag extends IClrEntity {
229
+ tagID?: number;
230
+ name?: string;
231
+ emailTags?: ICollection<IEmailTag>;
232
+ }
233
+
234
+ export const Tag: IModel<ITag> = new Model<ITag>("Tag", { name: "" });
@@ -20,13 +20,13 @@ const css = styled.css `
20
20
  width: 100%;
21
21
  height: 100%;
22
22
  overflow: hidden;
23
- background-color: rgb(159, 51, 255, 0.25);
23
+ background-color: var(--accent2-color);
24
24
 
25
25
  & > .progress-bar-value {
26
26
  display: none;
27
27
  width: 100%;
28
28
  height: 100%;
29
- background-color: rgb(159, 51, 255);
29
+ background-color: var(--accent-color);
30
30
  transform-origin: 0% 50%;
31
31
  }
32
32
  }
@@ -0,0 +1,19 @@
1
+ import DITransient from "@web-atoms/core/dist/di/DITransient";
2
+ import { Inject } from "@web-atoms/core/dist/di/Inject";
3
+ import EntityService from "./EntityService";
4
+ import { Configuration } from "../model/model";
5
+
6
+ @DITransient()
7
+ export default class ConfigService {
8
+
9
+ @Inject
10
+ private entityService: EntityService;
11
+
12
+ async isConfigured() {
13
+ const configured = "configured";
14
+ const isConfigured = await this.entityService.query(Configuration)
15
+ .where({ configured }, (p) => (x) => x.name === p.configured)
16
+ .firstOrDefault();
17
+ }
18
+
19
+ }
@@ -4,11 +4,14 @@ import { Inject } from "@web-atoms/core/dist/di/Inject";
4
4
  import { App } from "@web-atoms/core/dist/App";
5
5
  import { IHttpRequest } from "@web-atoms/entity/dist/services/HttpSession";
6
6
  import BusyProgress from "./BusyProgress";
7
+ import { QueryProcessor } from "@web-atoms/entity/dist/services/QueryProcessor";
7
8
 
8
9
 
9
10
  @DISingleton()
10
11
  export default class EntityService extends BaseEntityService {
11
12
 
13
+ public queryProcessor: QueryProcessor = "JavaScript";
14
+
12
15
  @Inject
13
16
  private app: App;
14
17
 
@@ -0,0 +1,26 @@
1
+ import DISingleton from "@web-atoms/core/dist/di/DISingleton";
2
+ import { Inject } from "@web-atoms/core/dist/di/Inject";
3
+ import EntityService from "./EntityService";
4
+ import { ILoginSession, IUser, LoginSession, User } from "../model/model";
5
+ import SocialMailApp from "../common/SocialMailApp";
6
+
7
+ @DISingleton()
8
+ export default class UserService {
9
+
10
+ @Inject
11
+ private entityService: EntityService;
12
+
13
+ private user: IUser;
14
+
15
+ public async getUser() {
16
+ this.user ??= (await this.entityService.query(LoginSession, "currentUser").firstOrDefault())?.user;
17
+ SocialMailApp.user = this.user;
18
+ return this.user;
19
+ }
20
+
21
+ public async login(session: ILoginSession) {
22
+ await this.entityService.save(session);
23
+ location.reload();
24
+ }
25
+
26
+ }
@@ -1,3 +1,12 @@
1
+
2
+ import { UMD } from "@web-atoms/core/dist/core/types";
3
+
4
+ import "@web-atoms/core/dist/core/AtomList";
5
+
6
+ import "./OverrideAppStyle";
7
+
8
+ export const ___UMD = UMD;
9
+
1
10
  import styled from "@web-atoms/core/dist/style/styled";
2
11
  import "@web-atoms/data-styles/data-styles";
3
12
 
@@ -27,8 +36,8 @@ addLinkTag("https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css
27
36
 
28
37
  :root {
29
38
  --primary-color: #294D4A;
30
- --accent-color: #9F33FF;
31
- --accent2-color: #382C5285;
39
+ --accent-color: #ff6733;
40
+ --accent2-color: #ff673375;
32
41
  --lighter-accent-color: #e6e6fa60;
33
42
  --light-accent-color: #f2e5fa;
34
43
  --accent-text-color: white;
@@ -0,0 +1,9 @@
1
+ import styled from "@web-atoms/core/dist/style/styled";
2
+
3
+ styled.css `
4
+
5
+ div[data-desktop-app=desktop-app] {
6
+ width: 100%;
7
+ }
8
+
9
+ `.withId("default-app-style").withOrder("medium").installGlobal();
@@ -10,10 +10,35 @@ import Command from "@web-atoms/core/dist/core/Command";
10
10
  import AppCommands from "./commands/AppCommands";
11
11
 
12
12
  import "../style/GlobalStyle";
13
+ import UserService from "../services/UserService";
14
+ import LoginPage from "../common/pages/user/LoginPage";
15
+ import AppDrawer from "./drawer/AppDrawer";
13
16
 
14
17
  @Pack
15
18
  export default class AppIndex extends MobileDesktopApp {
19
+
20
+ @InjectProperty
21
+ private userService: UserService;
22
+
16
23
  async init() {
17
24
  AppCommands.install(this);
25
+
26
+ // check if we are logged in...
27
+ if (!await this.userService.getUser()) {
28
+ PageNavigator.openPage(LoginPage);
29
+ return;
30
+ }
31
+
32
+ this.drawerMenu = AppDrawer;
33
+ }
34
+ }
35
+
36
+ Route.encodeUrl = (url) => {
37
+ if (url.startsWith("#")) {
38
+ return url;
39
+ }
40
+ if (/\d+\./.test(location.hostname)) {
41
+ return "#!" + url;
18
42
  }
19
- }
43
+ return url;
44
+ };