@social-mail/social-mail-client 1.2.235 → 1.2.237

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.
@@ -42996,17 +42996,35 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
42996
42996
  useTemplate(item) {
42997
42997
  return __awaiter(this, void 0, void 0, function* () {
42998
42998
  const host = `/api/site/draft/${item.folderID}`;
42999
- yield this.upload(host, "index.html");
42999
+ let html = yield FetchBuilder.get(`${host}/index.html`).responseAsText();
43000
+ const parser = new DOMParser();
43001
+ const doc = parser.parseFromString(html, "text/html");
43002
+ let modified = false;
43003
+ for (const iterator of Array.from(doc.querySelectorAll(`link[rel="stylesheet"]`))) {
43004
+ const href = iterator.getAttribute("href");
43005
+ if (/vars\.css/i.test(href)) {
43006
+ continue;
43007
+ }
43008
+ modified = true;
43009
+ const path = href.split("#")[0].split("?")[0];
43010
+ const name = path.split("/").pop();
43011
+ const style = yield this.upload(void 0, name, "styles", void 0, href);
43012
+ iterator.setAttribute("href", `/api/site/asset/download/${this.parameters.appFileID}/${style.appFileID}/${style.fileContentID}/${name}`);
43013
+ }
43014
+ if (modified) {
43015
+ html = doc.documentElement.outerHTML;
43016
+ }
43017
+ yield this.upload(host, "index.html", void 0, html);
43000
43018
  yield this.upload(host, "vars.css", "styles");
43001
43019
  });
43002
43020
  }
43003
- upload(host, fileName, folder = void 0) {
43021
+ upload(host, fileName, folder = void 0, content = void 0, url = void 0) {
43004
43022
  return __awaiter(this, void 0, void 0, function* () {
43005
43023
  const templatePath = folder ? `${folder}/${fileName}` : fileName;
43006
- const path = `${host}/${templatePath}`;
43007
- const content = yield FetchBuilder.get(path).responseAsText();
43024
+ url !== null && url !== void 0 ? url : url = `${host}/${templatePath}`;
43025
+ content !== null && content !== void 0 ? content : content = yield FetchBuilder.get(url).responseAsText();
43008
43026
  const contentType = yield this.mimeTypeService.getMimeType(fileName);
43009
- yield this.cloudFileService.saveFile({
43027
+ return yield this.cloudFileService.saveFile({
43010
43028
  content: new File([content], fileName, {
43011
43029
  type: contentType
43012
43030
  }),