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

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.
@@ -39160,17 +39160,35 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
39160
39160
  useTemplate(item) {
39161
39161
  return __awaiter(this, void 0, void 0, function* () {
39162
39162
  const host = `/api/site/draft/${item.folderID}`;
39163
- yield this.upload(host, "index.html");
39163
+ let html = yield FetchBuilder.get(`${host}/index.html`).responseAsText();
39164
+ const parser = new DOMParser();
39165
+ const doc = parser.parseFromString(html, "text/html");
39166
+ let modified = false;
39167
+ for (const iterator of Array.from(doc.querySelectorAll(`link[rel="stylesheet"]`))) {
39168
+ const href = iterator.getAttribute("href");
39169
+ if (/vars\.css/i.test(href)) {
39170
+ continue;
39171
+ }
39172
+ modified = true;
39173
+ const path = href.split("#")[0].split("?")[0];
39174
+ const name = href.split("/").pop();
39175
+ const style = yield this.upload(void 0, name, "styles", void 0, href);
39176
+ iterator.setAttribute("href", `/api/site/asset/download/${this.parameters.appFileID}/${style.appFileID}/${style.fileContentID}/${name}`);
39177
+ }
39178
+ if (modified) {
39179
+ html = doc.documentElement.outerHTML;
39180
+ }
39181
+ yield this.upload(host, "index.html", void 0, html);
39164
39182
  yield this.upload(host, "vars.css", "styles");
39165
39183
  });
39166
39184
  }
39167
- upload(host, fileName, folder = void 0) {
39185
+ upload(host, fileName, folder = void 0, content = void 0, url = void 0) {
39168
39186
  return __awaiter(this, void 0, void 0, function* () {
39169
39187
  const templatePath = folder ? `${folder}/${fileName}` : fileName;
39170
- const path = `${host}/${templatePath}`;
39171
- const content = yield FetchBuilder.get(path).responseAsText();
39188
+ url !== null && url !== void 0 ? url : url = `${host}/${templatePath}`;
39189
+ content !== null && content !== void 0 ? content : content = yield FetchBuilder.get(url).responseAsText();
39172
39190
  const contentType = yield this.mimeTypeService.getMimeType(fileName);
39173
- yield this.cloudFileService.saveFile({
39191
+ return yield this.cloudFileService.saveFile({
39174
39192
  content: new File([content], fileName, {
39175
39193
  type: contentType
39176
39194
  }),