underpost 2.7.91 → 2.7.93

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 (54) hide show
  1. package/bin/deploy.js +13 -11
  2. package/bin/file.js +1 -0
  3. package/bin/hwt.js +59 -0
  4. package/bin/index.js +1 -1
  5. package/conf.js +29 -5
  6. package/docker-compose.yml +1 -1
  7. package/package.json +133 -133
  8. package/src/client/Default.index.js +2 -1
  9. package/src/client/components/core/404.js +20 -0
  10. package/src/client/components/core/500.js +20 -0
  11. package/src/client/{ssr/common → components/core}/Alert.js +13 -11
  12. package/src/client/components/core/Docs.js +1 -1
  13. package/src/client/components/core/Modal.js +8 -6
  14. package/src/client/components/core/Scroll.js +65 -1
  15. package/src/client/components/core/Translate.js +21 -5
  16. package/src/client/components/core/VanillaJs.js +4 -1
  17. package/src/client/components/core/Worker.js +10 -11
  18. package/src/client/components/default/MenuDefault.js +69 -0
  19. package/src/client/components/default/RoutesDefault.js +2 -0
  20. package/src/client/public/default/plantuml/client-conf.svg +1 -1
  21. package/src/client/public/default/plantuml/client-schema.svg +1 -1
  22. package/src/client/public/default/plantuml/cron-schema.svg +1 -1
  23. package/src/client/public/default/plantuml/server-conf.svg +1 -1
  24. package/src/client/public/default/plantuml/server-schema.svg +1 -1
  25. package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
  26. package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
  27. package/src/client/ssr/Render.js +1 -6
  28. package/src/client/ssr/body/404.js +73 -0
  29. package/src/client/ssr/body/500.js +72 -0
  30. package/src/client/ssr/{components/body → body}/CacheControl.js +1 -1
  31. package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
  32. package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
  33. package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
  34. package/src/client/ssr/pages/Test.js +198 -0
  35. package/src/client/sw/default.sw.js +43 -166
  36. package/src/mailer/EmailRender.js +2 -4
  37. package/src/mailer/MailerProvider.js +4 -1
  38. package/src/server/client-build.js +100 -74
  39. package/src/server/client-formatted.js +2 -4
  40. package/src/server/conf.js +40 -13
  41. package/src/server/proxy.js +0 -2
  42. package/src/server/runtime.js +38 -10
  43. package/src/client/ssr/common/SsrCore.js +0 -91
  44. package/src/client/ssr/common/Translate.js +0 -26
  45. package/src/client/ssr/common/Worker.js +0 -28
  46. package/src/client/ssr/components/head/PwaDefault.js +0 -60
  47. /package/src/client/ssr/{components/body → body}/DefaultSplashScreen.js +0 -0
  48. /package/src/client/ssr/{components/email → email}/DefaultRecoverEmail.js +0 -0
  49. /package/src/client/ssr/{components/email → email}/DefaultVerifyEmail.js +0 -0
  50. /package/src/client/ssr/{components/head → head}/Css.js +0 -0
  51. /package/src/client/ssr/{components/head → head}/DefaultScripts.js +0 -0
  52. /package/src/client/ssr/{components/head → head}/Production.js +0 -0
  53. /package/src/client/ssr/{components/head → head}/Pwa.js +0 -0
  54. /package/src/client/ssr/{components/head → head}/Seo.js +0 -0
@@ -0,0 +1,198 @@
1
+ const s = (el) => document.querySelector(el);
2
+
3
+ const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
4
+
5
+ const getLang = () =>
6
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
7
+ .slice(0, 2)
8
+ .toLowerCase();
9
+
10
+ const main = () => {
11
+ const Translate = {
12
+ Data: {
13
+ ['back']: {
14
+ en: 'Back to <br> homepage',
15
+ es: 'Volver a <br> la pagina principal',
16
+ },
17
+ },
18
+ Render: function (id) {
19
+ return this.Data[id][getLang()] ? this.Data[id][getLang()] : this.Data[id]['en'];
20
+ },
21
+ };
22
+ const icon = html`
23
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 32 32">
24
+ <g fill="none">
25
+ <g filter="url(#f2465id5)">
26
+ <path fill="#A5D9FF" d="m21.066 4.43l6.992 6.992l-16.926 16.926a4.944 4.944 0 1 1-6.992-6.992z" />
27
+ </g>
28
+ <g filter="url(#f2465id6)"><path fill="#C6EFFF" d="m23.37 7.524l1.653 1.653L17 17.199l-1.653-1.652z" /></g>
29
+ <g filter="url(#f2465id7)">
30
+ <path fill="#D1F884" d="m26.112 13.368l-14.98 14.98a4.944 4.944 0 1 1-6.992-6.992l7.988-7.988z" />
31
+ <path fill="url(#f2465id0)" d="m26.112 13.368l-14.98 14.98a4.944 4.944 0 1 1-6.992-6.992l7.988-7.988z" />
32
+ </g>
33
+ <path fill="url(#f2465id1)" d="M14.761 10.735L13.6 11.897l2.093 2.092a.822.822 0 0 0 1.162-1.162z" />
34
+ <path fill="url(#f2465id2)" d="m9.097 16.398l1.162-1.162l2.085 2.085a.822.822 0 1 1-1.162 1.162z" />
35
+ <path fill="url(#f2465id3)" d="m4.589 20.907l1.162-1.162l2.084 2.084a.822.822 0 0 1-1.163 1.162z" />
36
+ <g filter="url(#f2465id8)">
37
+ <path
38
+ fill="#A9D8FF"
39
+ d="M19.55 2.617a1.47 1.47 0 0 0 0 2.079l8.242 8.242a1.47 1.47 0 0 0 2.078-2.079l-8.242-8.242a1.47 1.47 0 0 0-2.078 0"
40
+ />
41
+ <path
42
+ fill="url(#f2465id4)"
43
+ d="M19.55 2.617a1.47 1.47 0 0 0 0 2.079l8.242 8.242a1.47 1.47 0 0 0 2.078-2.079l-8.242-8.242a1.47 1.47 0 0 0-2.078 0"
44
+ />
45
+ </g>
46
+ <g filter="url(#f2465id9)"><path fill="#C4ECFF" d="m19.916 4.001l1.11-1.11l8.376 8.374l-1.111 1.111z" /></g>
47
+ <defs>
48
+ <linearGradient id="f2465id0" x1="25.761" x2="17.074" y1="13.875" y2="16.875" gradientUnits="userSpaceOnUse">
49
+ <stop offset=".203" stop-color="#E9EB7E" />
50
+ <stop offset="1" stop-color="#E9EB7E" stop-opacity="0" />
51
+ </linearGradient>
52
+ <linearGradient id="f2465id1" x1="16.761" x2="14.011" y1="14.063" y2="11.469" gradientUnits="userSpaceOnUse">
53
+ <stop stop-color="#138979" />
54
+ <stop offset="1" stop-color="#2E7B65" />
55
+ </linearGradient>
56
+ <linearGradient id="f2465id2" x1="12.252" x2="9.508" y1="18.557" y2="15.969" gradientUnits="userSpaceOnUse">
57
+ <stop stop-color="#138979" />
58
+ <stop offset="1" stop-color="#2E7B65" />
59
+ </linearGradient>
60
+ <linearGradient id="f2465id3" x1="7.743" x2="5" y1="23.065" y2="20.477" gradientUnits="userSpaceOnUse">
61
+ <stop stop-color="#138979" />
62
+ <stop offset="1" stop-color="#2E7B65" />
63
+ </linearGradient>
64
+ <linearGradient id="f2465id4" x1="28.786" x2="28.656" y1="13.521" y2="11.86" gradientUnits="userSpaceOnUse">
65
+ <stop stop-color="#A8C3FF" />
66
+ <stop offset="1" stop-color="#A8C3FF" stop-opacity="0" />
67
+ </linearGradient>
68
+ <filter
69
+ id="f2465id5"
70
+ width="25.366"
71
+ height="25.366"
72
+ x="2.692"
73
+ y="4.43"
74
+ color-interpolation-filters="sRGB"
75
+ filterUnits="userSpaceOnUse"
76
+ >
77
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
78
+ <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
79
+ <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" />
80
+ <feOffset />
81
+ <feGaussianBlur stdDeviation="1" />
82
+ <feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic" />
83
+ <feColorMatrix values="0 0 0 0 0.745098 0 0 0 0 0.85098 0 0 0 0 0.964706 0 0 0 1 0" />
84
+ <feBlend in2="shape" result="effect1_innerShadow_18_24902" />
85
+ </filter>
86
+ <filter
87
+ id="f2465id6"
88
+ width="13.675"
89
+ height="13.675"
90
+ x="13.347"
91
+ y="5.524"
92
+ color-interpolation-filters="sRGB"
93
+ filterUnits="userSpaceOnUse"
94
+ >
95
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
96
+ <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
97
+ <feGaussianBlur result="effect1_foregroundBlur_18_24902" stdDeviation="1" />
98
+ </filter>
99
+ <filter
100
+ id="f2465id7"
101
+ width="26.42"
102
+ height="17.178"
103
+ x="2.692"
104
+ y="12.618"
105
+ color-interpolation-filters="sRGB"
106
+ filterUnits="userSpaceOnUse"
107
+ >
108
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
109
+ <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
110
+ <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" />
111
+ <feOffset dx="4" dy="-.75" />
112
+ <feGaussianBlur stdDeviation="1.5" />
113
+ <feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic" />
114
+ <feColorMatrix values="0 0 0 0 0.505882 0 0 0 0 0.811765 0 0 0 0 0.34902 0 0 0 1 0" />
115
+ <feBlend in2="shape" result="effect1_innerShadow_18_24902" />
116
+ <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" />
117
+ <feOffset dy="-.4" />
118
+ <feGaussianBlur stdDeviation=".5" />
119
+ <feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic" />
120
+ <feColorMatrix values="0 0 0 0 0.788235 0 0 0 0 0.843137 0 0 0 0 0.898039 0 0 0 1 0" />
121
+ <feBlend in2="effect1_innerShadow_18_24902" result="effect2_innerShadow_18_24902" />
122
+ <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" />
123
+ <feOffset dx=".4" dy="-.4" />
124
+ <feGaussianBlur stdDeviation=".5" />
125
+ <feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic" />
126
+ <feColorMatrix values="0 0 0 0 0.67451 0 0 0 0 0.839216 0 0 0 0 0.623529 0 0 0 1 0" />
127
+ <feBlend in2="effect2_innerShadow_18_24902" result="effect3_innerShadow_18_24902" />
128
+ </filter>
129
+ <filter
130
+ id="f2465id8"
131
+ width="11.181"
132
+ height="11.181"
133
+ x="19.12"
134
+ y="2.187"
135
+ color-interpolation-filters="sRGB"
136
+ filterUnits="userSpaceOnUse"
137
+ >
138
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
139
+ <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
140
+ <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" />
141
+ <feOffset />
142
+ <feGaussianBlur stdDeviation=".5" />
143
+ <feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic" />
144
+ <feColorMatrix values="0 0 0 0 0.658824 0 0 0 0 0.776471 0 0 0 0 0.937255 0 0 0 1 0" />
145
+ <feBlend in2="shape" result="effect1_innerShadow_18_24902" />
146
+ </filter>
147
+ <filter
148
+ id="f2465id9"
149
+ width="10.986"
150
+ height="10.986"
151
+ x="19.166"
152
+ y="2.14"
153
+ color-interpolation-filters="sRGB"
154
+ filterUnits="userSpaceOnUse"
155
+ >
156
+ <feFlood flood-opacity="0" result="BackgroundImageFix" />
157
+ <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
158
+ <feGaussianBlur result="effect1_foregroundBlur_18_24902" stdDeviation=".375" />
159
+ </filter>
160
+ </defs>
161
+ </g>
162
+ </svg>
163
+ `;
164
+ append(
165
+ 'body',
166
+ html` <style>
167
+ body {
168
+ font-family: arial;
169
+ font-size: 20px;
170
+ background-color: #d8d8d8;
171
+ color: #333;
172
+ }
173
+ a {
174
+ color: black;
175
+ }
176
+ </style>
177
+
178
+ <div class="abs center" style="top: 45%">
179
+ ${icon}
180
+ <br />
181
+ <br />
182
+ <span class="bold">Test Page</span>
183
+ <br />
184
+ <br />
185
+ <a href="${location.origin}">${Translate.Render('back')}</a>
186
+ </div>`,
187
+ );
188
+ };
189
+
190
+ SrrComponent = () => html`<script>
191
+ {
192
+ const s = ${s};
193
+ const append = ${append};
194
+ const getLang = ${getLang};
195
+ const main = ${main};
196
+ window.onload = main;
197
+ }
198
+ </script>`;
@@ -1,58 +1,27 @@
1
- import { loggerFactory } from '../components/core/Logger.js';
2
-
3
- // https://googlechrome.github.io/samples/service-worker/custom-offline-page/
4
-
5
- /*
6
- Copyright 2015, 2019 Google Inc. All Rights Reserved.
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
10
- http://www.apache.org/licenses/LICENSE-2.0
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- // https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
19
- // https://web.dev/cache-api-quick-guide/
20
- // https://developer.mozilla.org/en-US/docs/Web/API
21
- // https://developer.mozilla.org/es/docs/Web/Progressive_web_apps/Re-engageable_Notifications_Push
22
- // https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification
23
- // https://github.com/GoogleChrome/samples/blob/9e4b3b77b091268d28e5438bb2fe8829091e9540/service-worker/basic/service-worker.js#L59
24
- // https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
25
-
26
- /*
27
-
28
- 4 different ways to store data on client-side without using cookies:
29
-
30
- - Local Storage (Session and Local key/value pairs)
31
- - Web SQL (my favorite, it's a whole SQL Database, and it's NOT obsolete)
32
- - IndexedDB (another Database with different structure and acceptance)
33
- - Service Workers (Persistent background processing,
34
- even while offline, can asynchronously save files and many other things)
35
-
36
- */
37
-
38
- const logger = loggerFactory(import.meta);
39
-
1
+ const PRE_CACHED_RESOURCES = [];
2
+ const CACHE_NAME = 'app-cache';
40
3
  const PROXY_PATH = '/';
41
-
42
4
  self.addEventListener('install', (event) => {
43
5
  // Activate right away
44
6
  self.skipWaiting();
45
7
 
46
8
  event.waitUntil(
47
9
  (async () => {
48
- // const cache = await caches.open(CACHE_NAME);
49
- // Setting {cache: 'reload'} in the new request will ensure that the response
50
- // isn't fulfilled from the HTTP cache; i.e., it will be from the network.
51
- // await cache.add(new Request(OFFLINE_URL, { cache: 'reload' }));
52
10
  // Open the app's cache.
53
- // const cache = await caches.open(CACHE_NAME);
11
+ const cache = await caches.open(CACHE_NAME);
54
12
  // Cache all static resources.
55
- // await cache.addAll(PRE_CACHED_RESOURCES);
13
+ try {
14
+ await cache.addAll(PRE_CACHED_RESOURCES);
15
+ } catch (error) {
16
+ console.error(error);
17
+ }
18
+ // for (const cacheKey of PRE_CACHED_RESOURCES) {
19
+ // try {
20
+ // await cache.add(cacheKey);
21
+ // } catch (error) {
22
+ // console.error(error, cacheKey);
23
+ // }
24
+ // }
56
25
  })(),
57
26
  );
58
27
  });
@@ -67,139 +36,47 @@ self.addEventListener('activate', (event) => {
67
36
  }
68
37
  })(),
69
38
  );
70
-
71
39
  // Tell the active service worker to take control of the page immediately.
72
40
  self.clients.claim();
73
-
74
- // event message
75
- self.addEventListener('message', (event) => {
76
- logger.info('Received event message', event.data);
77
-
78
- switch (event.data.status) {
79
- case 'skipWaiting':
80
- return self.skipWaiting();
81
- break;
82
-
83
- default:
84
- break;
85
- }
86
-
87
- clients.matchAll().then((clientList) => {
88
- for (const client of clientList) {
89
- logger.info('client', client);
90
- client.postMessage({
91
- title: 'Hello from SW event message',
92
- });
93
- // client -> document.visibilityState
94
- // client.visibilityState
95
- }
96
- });
97
- });
98
- // broadcast message
99
- const channel = new BroadcastChannel('sw-messages');
100
- channel.addEventListener('message', (event) => {
101
- logger.info('Received broadcast message', event.data);
102
- channel.postMessage({ title: 'Hello from SW broadcast message' });
103
- });
104
41
  });
105
42
 
106
43
  self.addEventListener('fetch', (event) => {
107
- let path;
108
-
109
- if (event.request.url.match(location.origin)) path = event.request.url.slice(location.origin.length);
110
- const preload = path && !path.match('/api');
111
-
112
- logger.info(`On fetch`, {
113
- mode: event.request.mode,
114
- url: event.request.url,
115
- referrer: event.request.referrer,
116
- method: event.request.method,
117
- path,
118
- preload,
119
- });
120
-
121
- (async () => {
122
- // Get the client.
123
- const client = await clients.get(event.clientId);
124
- if (client)
125
- client.postMessage({
126
- status: 'loader',
127
- path,
128
- });
129
- else logger.warn('client not found');
130
- })();
44
+ // Cache-First Strategy
45
+ event.respondWith(
46
+ (async () => {
47
+ // First, try to use the navigation preload response if it's supported.
48
+ try {
49
+ const preloadResponse = await event.preloadResponse;
50
+ if (preloadResponse) return preloadResponse;
51
+ return await fetch(event.request);
52
+ } catch (error) {
53
+ console.error('Fetch failed; returning offline page instead.', event.request.url, error);
54
+ // Fallback to the offline page.
55
+ const path = PRE_CACHED_RESOURCES.find((path) => event.request.url.match(path.replaceAll('/index.html', '')));
131
56
 
132
- // We only want to call event.respondWith() if this is a navigation request
133
- // for an HTML page.
134
- if (path !== undefined || event.request.mode === 'navigate') {
135
- event.respondWith(
136
- (async () => {
137
57
  try {
138
- // First, try to use the navigation preload response if it's supported.
139
- const preloadResponse = await event.preloadResponse;
140
- if (preloadResponse) {
141
- return preloadResponse;
142
- }
143
-
144
- if (preload) {
145
- const preloadCache = await caches.has(path);
146
- const cache = await caches.open(path);
147
- const cacheResponse = await cache.match(path);
148
- if (!preloadCache || !cacheResponse || cacheResponse.status !== 200) {
149
- logger.warn('install', path);
150
- // await cache.add(new Request(event.request.url, { cache: 'reload' }));
151
-
152
- // Other option:
153
- // The resource wasn't found in the cache, so fetch it from the network.
154
- const fetchResponse = await fetch(event.request.url);
155
-
156
- if (fetchResponse.status === 200) {
157
- // Put the response in cache.
158
- await cache.put(event.request.url, fetchResponse.clone());
159
- // And return the response.
160
- return fetchResponse;
161
- } else {
162
- await caches.delete(path);
163
- throw new Error(await fetchResponse.text());
164
- }
165
- }
166
- // logger.info('cache response', path);
167
- return cacheResponse;
168
- }
169
-
170
- const networkResponse = await fetch(event.request);
171
- logger.warn('fetch response', event.request.url);
172
- return networkResponse;
58
+ const cachedResponse = await caches.match(event.request);
59
+ if (cachedResponse) return cachedResponse;
60
+ const cache = await caches.open(CACHE_NAME);
61
+ const preCachedResponse = await cache.match(path);
62
+ if (!preCachedResponse) throw new Error(error.message);
63
+ return preCachedResponse;
173
64
  } catch (error) {
174
- // catch is only triggered if an exception is thrown, which is likely
175
- // due to a network error.
176
- // If fetch() returns a valid HTTP response with a response code in
177
- // the 4xx or 5xx range, the catch() will NOT be called.
178
- if (path) {
179
- const preloadCache = await caches.has(path);
180
- if (preloadCache) await caches.delete(path);
181
- }
182
-
183
- logger.error('Fetch failed; returning offline page instead.', { error, path });
65
+ console.error('Error opening cache for pre cached page', event.request.url, error);
184
66
  try {
185
- const cache = await caches.open(`${PROXY_PATH}offline.html`);
186
- const cachedResponse = await cache.match(`${PROXY_PATH}offline.html`);
187
- return cachedResponse;
67
+ const cache = await caches.open(CACHE_NAME);
68
+ const preCachedResponse = await cache.match(`${PROXY_PATH === '/' ? '' : PROXY_PATH}/offline/index.html`);
69
+ if (!preCachedResponse) throw new Error(error.message);
70
+ return preCachedResponse;
188
71
  } catch (error) {
189
- logger.error('Error opening cache for offline page', { error, path });
190
- const response = new Response(JSON.stringify({ status: 'error', message: 'offline test response' }));
72
+ console.error('Error opening cache for offline page', event.request.url, error);
73
+ const response = new Response(JSON.stringify({ status: 'error', message: error.message }));
191
74
  // response.status = 200;
192
75
  response.headers.set('Content-Type', 'application/json');
193
76
  return response;
194
77
  }
195
78
  }
196
- })(),
197
- );
198
- }
199
-
200
- // If our if() condition is false, then this fetch handler won't intercept the
201
- // request. If there are any other fetch handlers registered, they will get a
202
- // chance to call event.respondWith(). If no fetch handlers call
203
- // event.respondWith(), the request will be handled by the browser as if there
204
- // were no service worker involvement.
79
+ }
80
+ })(),
81
+ );
205
82
  });
@@ -1,5 +1,4 @@
1
- import { srcFormatted } from '../server/client-formatted.js';
2
- import fs from 'fs-extra';
1
+ import { ssrFactory } from '../server/client-formatted.js';
3
2
 
4
3
  const EmailRender = {
5
4
  style: {
@@ -58,8 +57,7 @@ const EmailRender = {
58
57
  const templates = {};
59
58
  for (const templateKey of Object.keys(options.templates)) {
60
59
  const ssrEmailComponent = options.templates[templateKey];
61
- let SrrComponent;
62
- eval(await srcFormatted(fs.readFileSync(`./src/client/ssr/components/email/${ssrEmailComponent}.js`, 'utf8')));
60
+ const SrrComponent = await ssrFactory(`./src/client/ssr/mailer/${ssrEmailComponent}.js`);
63
61
  templates[templateKey] = SrrComponent(this, options);
64
62
  }
65
63
  return templates;
@@ -25,7 +25,10 @@ const MailerProvider = {
25
25
  },
26
26
  host: '',
27
27
  path: '',
28
- templates: ['SsrTemplate'],
28
+ templates: {
29
+ userVerifyEmail: 'DefaultVerifyEmail',
30
+ userRecoverEmail: 'DefaultRecoverEmail',
31
+ },
29
32
  },
30
33
  ) {
31
34
  try {