@social-mail/social-mail-client 1.2.39 → 1.2.40

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.39",
3
+ "version": "1.2.40",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,6 +3,7 @@ import { IAppFile } from "../../../../model/model";
3
3
  import XNode from "@web-atoms/core/dist/core/XNode";
4
4
  import Action from "@web-atoms/core/dist/view-model/Action";
5
5
  import { UMD } from "@web-atoms/core/dist/core/types";
6
+ import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
6
7
 
7
8
  export default class ChooseWebSiteTemplatePage extends PopupWindowPage {
8
9
 
@@ -19,16 +20,18 @@ export default class ChooseWebSiteTemplatePage extends PopupWindowPage {
19
20
  @Action({ onEvent: "create-template", close: true})
20
21
  async createTemplate() {
21
22
 
22
- // upload a simple html...
23
- const path = UMD.resolvePath("@social-mail/social-mail-client/content/templates/plain/index.html");
24
- const rs = await fetch(path);
25
- const text = await rs.text();
23
+ const template = "plain";
26
24
 
27
25
  // upload
28
- await this.upload("index.html", text);
26
+ await this.upload("index.html", template);
27
+ await this.upload("styles/vars.css", template);
29
28
  }
30
29
 
31
- async upload(fileName: string, content: string) {
30
+ async upload(fileName: string, template) {
31
+
32
+ const path = UMD.resolvePath(`@social-mail/social-mail-client/content/templates/${template}/${fileName}`);
33
+ const content = await FetchBuilder.get(path).responseAsText();
34
+
32
35
  const url = `/api/upload?parentID=${this.parameters.appFileID}`;
33
36
  const body = new FormData();
34
37
  body.append(fileName, new Blob([content], { type: "text/html"}), fileName);