@emailmaker/emailmaker 1.0.54 → 1.0.56

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 (33) hide show
  1. package/README.md +1 -1
  2. package/asset-manifest.json +22 -22
  3. package/emailmaker-esm.js +1 -1
  4. package/emailmaker.d.ts +120 -99
  5. package/emailmaker.js +1 -1
  6. package/iframe/{iframe-eblock.b0f6ba78787fbb881698.html → iframe-eblock.afc9f1ce83dc7d6275f4.html} +1 -1
  7. package/iframe/{iframe.b0f6ba78787fbb881698.html → iframe.afc9f1ce83dc7d6275f4.html} +1 -1
  8. package/iframe/js/cssbeautify.js +1 -1
  9. package/iframe/sandbox-eblock.js +1 -1
  10. package/iframe/sandbox.js +1 -1
  11. package/package.json +1 -1
  12. package/plugin.html +271 -265
  13. package/plugin_blocks_test.html +1 -1
  14. package/plugin_default.html +1 -1
  15. package/plugin_idigital.html +1 -1
  16. package/plugin_s.html +1 -1
  17. package/static/css/{3062.52a0a40e.css → 2055.377300a1.css} +1 -1
  18. package/static/css/{5211.8f70ec84.css → 5211.45142985.css} +1 -1
  19. package/static/css/{8995.3b37ba81.css → 8995.d8d44365.css} +1 -1
  20. package/static/js/2055.5d000245.js +1 -0
  21. package/static/js/{2151.516911d8.js → 2151.fe35f394.js} +1 -1
  22. package/static/js/3430.b951243d.js +1 -0
  23. package/static/js/5211.638a9803.js +1 -0
  24. package/static/js/{1821.41877832.js → 7269.6683b194.js} +1 -1
  25. package/static/js/78.a4deb390.js +1 -0
  26. package/static/js/{8995.d8b7e9e5.js → 8995.6244768a.js} +1 -1
  27. package/static/js/{emailmaker_core.f53b7c8e.js → emailmaker_core.b6a49f02.js} +1 -1
  28. package/translations.pot +211 -188
  29. package/webpack/index.js +1 -2
  30. package/static/js/3062.6ce869e9.js +0 -1
  31. package/static/js/3430.81e9a5aa.js +0 -1
  32. package/static/js/5211.2afa2b82.js +0 -1
  33. package/static/js/78.dca8224c.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailmaker/emailmaker",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "private": false,
5
5
  "main": "emailmaker.js",
6
6
  "module": "emailmaker-esm.js",
package/plugin.html CHANGED
@@ -1,281 +1,287 @@
1
- <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?888d7cc9e8f729d72e4a"></script></head><body><button id="change_theme" style="width: 150px; height: 30px">Click Me</button><div style="background: white; width: 100%; height: 50px; display: flex; justify-content: center; align-items: center"></div><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?888d7cc9e8f729d72e4a";
2
- const auth_jwt = {
3
- username: '****',
4
- password: '****',
5
- };
6
-
7
- const systemfields = [
8
- {
9
- label: 'Дополнительное поле «Имя»',
10
- value: 'Name',
11
- },
12
- {
13
- label: 'Имя получателя',
14
- value: 'ToName',
15
- },
16
- ];
17
-
18
- const auth_client = {
19
- client_id: '****',
20
- client_secret: '****',
21
- };
22
-
23
- const getAuthToken = async () => {
24
- var formdata = new FormData();
25
- formdata.append('grant_type', 'client_credentials');
26
- formdata.append('client_id', 'z72ev3L8JuDoyoE9JQeb2CiVGvVRibQ9q95jNiJ8');
27
- formdata.append('client_secret', 'wxMqp4DbfH6DzKj7xkMg7cQUkh1AbTvxjr04uwQ2');
28
-
29
- var requestOptions = {
30
- method: 'POST',
31
- body: formdata,
32
- redirect: 'follow',
1
+ <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?d4fa16edb5080f1a7384"></script></head><body><button id="change_theme" style="width: 150px; height: 30px">Click Me</button><div style="background: white; width: 100%; height: 50px; display: flex; justify-content: center; align-items: center"></div><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?d4fa16edb5080f1a7384";
2
+ const auth_jwt = {
3
+ username: '****',
4
+ password: '****',
33
5
  };
34
6
 
35
- return fetch('http://localhost:3000/api?oauth=token', requestOptions)
36
- .then((response) => response.json())
37
- .then((result) => result.access_token)
38
- .catch((error) => {
39
- console.log('error', error);
40
- return '';
41
- });
42
- };
7
+ const systemfields = [
8
+ {
9
+ label: 'Дополнительное поле «Имя»',
10
+ value: 'Name',
11
+ },
12
+ {
13
+ label: 'Имя получателя',
14
+ value: 'ToName',
15
+ },
16
+ ];
43
17
 
18
+ const auth_client = {
19
+ client_id: '****',
20
+ client_secret: '****',
21
+ };
44
22
 
45
- const auth_client_oauth = {
46
- client_id: "****",
47
- client_secret: "****",
48
- };
23
+ const getAuthToken = async () => {
24
+ var formdata = new FormData();
25
+ formdata.append('grant_type', 'client_credentials');
26
+ formdata.append('client_id', 'z72ev3L8JuDoyoE9JQeb2CiVGvVRibQ9q95jNiJ8');
27
+ formdata.append('client_secret', 'wxMqp4DbfH6DzKj7xkMg7cQUkh1AbTvxjr04uwQ2');
49
28
 
29
+ var requestOptions = {
30
+ method: 'POST',
31
+ body: formdata,
32
+ redirect: 'follow',
33
+ };
50
34
 
51
- const BLOCKS_KEY = "blocks";
52
- const COMMENTS_KEY = "blocks";
53
- const RESOURSE = 'aaa.bbb.xyz.com';
54
- let _instance = undefined;
55
- const options = {
56
- getAuthToken,
57
- previewIconEnabled: true,
58
- livePreviewEnabled: true,
59
- element: "#test",
60
- handleEmailChanged(event) {
61
- console.log(event);
62
- },
63
- handleLoad(instance) {
64
- _instance = instance;
65
- },
66
- handleReadEmailRevisions() {
67
- return [];
68
- },
69
- // async handleReadLocale() {
70
- // const response = await fetch("./react_app-ru_RU.po");
71
- // const text = await response.text();
72
- // return text;
73
- // },
74
- async handleSaveEmail({ value }) {
75
- const email = await _instance.compileEmail(value);
76
- },
77
- handleEmailChanged(event) {
78
- console.log(event);
79
- },
80
- handleLoad(instance) {
81
- _instance = instance;
82
- },
83
- async handleSaveEmail({ value }) {
84
- const email = await _instance.compileEmail(value);
85
- console.log(email);
86
- },
87
- handleCloneEmail(event) {
88
- console.log(event);
89
- },
90
- handleShareEmail(event) {
91
- console.log(event);
92
- },
93
- handlePreviewEmail(event) {
94
- console.log(event);
95
- },
96
- handleLivePreviewEmail(event) {
97
- console.log(event);
98
- },
99
- handleValidate(e) {
100
- console.log(e);
101
- },
102
- // headless: true,
103
- content: {
104
- templateId: 321739,
35
+ return fetch('http://localhost:3000/api?oauth=token', requestOptions)
36
+ .then((response) => response.json())
37
+ .then((result) => result.access_token)
38
+ .catch((error) => {
39
+ console.log('error', error);
40
+ return '';
41
+ });
42
+ };
105
43
 
106
- email: {
107
- id: '3769995',
108
- author: 123,
109
- isNew: false,
110
- subject: 'topic',
111
- preheader: '',
112
- description: '',
113
- project: 'undefined',
114
- parent_email: '309707',
115
- common_styles:
116
- '{"block":{"darkBgColor":"#1c52dc"},"text":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":16,"fontSizeDim":"px","lineHeight":21,"lineHeightDim":"px","color":"#5a5a5a","textAlign":"left","paddingBottom":10,"paddingBottomDim":"px"},"headings":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":24,"fontSizeDim":"px","lineHeight":32,"lineHeightDim":"px","color":"#333333","textAlign":"left","paddingTop":20,"paddingTopDim":"px","paddingBottom":10,"paddingBottomDim":"px","letterSpacing":0,"letterSpacingDim":"px","bold":true,"italic":false},"links":{"color":"#1C52DC","underline":true},"buttons":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":16,"fontSizeDim":"px","letterSpacing":0,"letterSpacingDim":"px","color":"#FFFFFF","bold":false,"italic":false,"backgroundColor":"#1C52DC","marginTop":10,"marginTopDim":"px","marginBottom":10,"marginBottomDim":"px","border":{"all":null,"top":null,"right":null,"bottom":null,"left":null},"borderRadius":{"all":5,"topLeft":null,"topRight":null,"bottomRight":null,"bottomLeft":null},"textAlign":"center","padding":{"all":null,"top":null,"right":null,"bottom":null,"left":null}},"block":{"backgroundColor":""}}',
117
- title: '',
118
- date: '2024-01-12T08:42:09',
119
- modified: '2024-02-16T17:21:01',
120
- group: [],
121
- lock: false,
122
- utm_parameters: {
123
- utm_content: 'ssssssss',
124
- },
125
- // "code": "<html><head></head><body><body></html>",
126
- },
127
- },
128
- project: undefined,
129
- user: {
130
- id: 123,
131
- username: "testetrter",
132
- name: "ssss"
133
- },
44
+ const auth_client_oauth = {
45
+ client_id: '****',
46
+ client_secret: '****',
47
+ };
134
48
 
135
- config: {
136
- mode: 'pro',
137
- configSwither: true,
138
- revisionService: true,
139
- theme: 'light',
140
- testEmails: ['test@test.com'],
141
- settingsEnabled: true,
142
- UTMEnabled: true,
143
- // locale: "ru_RU",
144
- locale: 'en_US',
145
- // emailDropdownMenuEnabled: true,
49
+ const BLOCKS_KEY = 'blocks';
50
+ const COMMENTS_KEY = 'blocks';
51
+ const RESOURSE = 'aaa.bbb.xyz.com';
52
+ let _instance = undefined;
53
+ const options = {
54
+ getAuthToken,
146
55
  previewIconEnabled: true,
147
- previewModeEnabled: true,
148
56
  livePreviewEnabled: true,
149
- sendTestEnabled: true,
150
- emailExportEnabled: true,
151
- sharePreviewEnabled: true,
152
- emailDropdownMenuLock: true,
153
- emailDropdownMenuClone: true,
154
- emailDropdownMenuRemove: true,
155
- // Стилизация через token
156
- mergeTags: {
157
- syntax: ['{{%value%}}'],
158
- items: [
159
- {
160
- label: 'Системные123',
161
- value: 'System',
162
- children: systemfields,
163
- },
164
- {
165
- label: 'Пользовательские',
166
- value: 'User',
167
- children: systemfields,
168
- },
169
- ],
57
+ element: '#test',
58
+ handleEmailChanged(event) {
59
+ console.log(event);
170
60
  },
171
- },
172
- };
173
- async function init() {
174
- const instance = await emailmaker.init(options);
175
- instance.handleSaveEmail(async ({ value, patch, prev }) => {
176
- const _email = await instance.compileEmail(value);
177
- console.log(_email);
178
- });
179
- instance.setConfig({
180
- ...options.config,
181
- mergeTags: {
182
- syntax: ['{{%value%}}'],
183
- items: [
184
- {
185
- label: 'Системные123',
186
- value: 'System',
187
- children: systemfields,
188
- },
189
- {
190
- label: 'Пользовательские',
191
- value: 'User',
192
- children: systemfields,
193
- },
194
- ],
61
+ handleLoad(instance) {
62
+ _instance = instance;
63
+ },
64
+ handleReadEmailRevisions() {
65
+ return [];
66
+ },
67
+ // async handleReadLocale() {
68
+ // const response = await fetch("./react_app-ru_RU.po");
69
+ // const text = await response.text();
70
+ // return text;
71
+ // },
72
+ async handleSaveEmail({ value }) {
73
+ const email = await _instance.compileEmail(value);
74
+ },
75
+ handleEmailChanged(event) {
76
+ console.log(event);
77
+ },
78
+ handleLoad(instance) {
79
+ _instance = instance;
80
+ },
81
+ async handleSaveEmail({ value }) {
82
+ const email = await _instance.compileEmail(value);
83
+ console.log(email);
195
84
  },
196
- });
197
- // await instance.show({
198
- // email: {
199
- // "id": "3769995",
200
- // "isNew": false,
201
- // "subject": "topic1Ы",
202
- // "preheader": "pre",
203
- // "description": "",
204
- // "project": "undefined",
205
- // "parent_email": "309707",
206
- // "common_styles": "{\"text\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"lineHeight\":21,\"lineHeightDim\":\"px\",\"color\":\"#5a5a5a\",\"textAlign\":\"left\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\"},\"headings\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":24,\"fontSizeDim\":\"px\",\"lineHeight\":32,\"lineHeightDim\":\"px\",\"color\":\"#333333\",\"textAlign\":\"left\",\"paddingTop\":20,\"paddingTopDim\":\"px\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"bold\":true,\"italic\":false},\"links\":{\"color\":\"#1C52DC\",\"underline\":true},\"buttons\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"color\":\"#FFFFFF\",\"bold\":false,\"italic\":false,\"backgroundColor\":\"#1C52DC\",\"marginTop\":10,\"marginTopDim\":\"px\",\"marginBottom\":10,\"marginBottomDim\":\"px\",\"border\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null},\"borderRadius\":{\"all\":5,\"topLeft\":null,\"topRight\":null,\"bottomRight\":null,\"bottomLeft\":null},\"textAlign\":\"center\",\"padding\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null}},\"block\":{\"backgroundColor\":\"\"}}",
207
- // "title": "",
208
- // "date": "2024-01-12T08:42:09",
209
- // "modified": "2024-02-16T17:21:01",
210
- // "group": [],
211
- // "lock": false,
212
- // "code": "<html><head></head><body><body></html>",
213
- // }
214
- // });
215
- // const email = await instance.getEmail();
85
+ handleCloneEmail(event) {
86
+ console.log(event);
87
+ },
88
+ handleShareEmail(event) {
89
+ console.log(event);
90
+ },
91
+ handlePreviewEmail(event) {
92
+ console.log(event);
93
+ },
94
+ handleLivePreviewEmail(event) {
95
+ console.log(event);
96
+ },
97
+ handleValidate(e) {
98
+ console.log(e);
99
+ },
100
+ // headless: true,
101
+ content: {
102
+ templateId: 321739,
216
103
 
217
- // const TITLE_REGEX = /<title>(.*)<\/title>/gm;
218
- // console.log(email.code);
219
- // email.code.matchAll(TITLE_REGEX).map(item => item[1]).find(title => console.log(title));
220
- };
221
- async function init() {
222
- // const response = await fetch("./key.txt");
223
- // const key = await response.text();
224
- const instance = await emailmaker.init({ ...options });
225
- instance.handleSaveEmail(async ({ value, patch, prev }) => {
226
- const _email = await instance.compileEmail(value);
227
- console.log(_email);
228
- _email.utm_parameters = { ..._email.utm_parameters, utm_content: "333" }
229
- const a = await instance.compileEmail(_email);
230
- console.log(a);
231
- });
232
- setTimeout(() => {
233
- console.log(instance.getCodeErrors());
234
- }, 5000);
235
- instance.setConfig({
236
- ...options.config,
237
- mergeTags: {
238
- "syntax": [
239
- "{{%value%}}"
240
- ],
241
- "items": [
242
- {
243
- "label": "Системные3131",
244
- "value": "System",
245
- "children": systemfields
104
+ email: {
105
+ id: '3769995',
106
+ author: 123,
107
+ isNew: false,
108
+ subject: 'topic',
109
+ preheader: '',
110
+ description: '',
111
+ project: 'undefined',
112
+ parent_email: '309707',
113
+ common_styles:
114
+ '{"block":{"darkBgColor":"#1c52dc"},"text":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":16,"fontSizeDim":"px","lineHeight":21,"lineHeightDim":"px","color":"#5a5a5a","textAlign":"left","paddingBottom":10,"paddingBottomDim":"px"},"headings":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":24,"fontSizeDim":"px","lineHeight":32,"lineHeightDim":"px","color":"#333333","textAlign":"left","paddingTop":20,"paddingTopDim":"px","paddingBottom":10,"paddingBottomDim":"px","letterSpacing":0,"letterSpacingDim":"px","bold":true,"italic":false},"links":{"color":"#1C52DC","underline":true},"buttons":{"fontFamily":["Safe Fonts","-apple-system, \'Segoe UI\', \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif"],"fontSize":16,"fontSizeDim":"px","letterSpacing":0,"letterSpacingDim":"px","color":"#FFFFFF","bold":false,"italic":false,"backgroundColor":"#1C52DC","marginTop":10,"marginTopDim":"px","marginBottom":10,"marginBottomDim":"px","border":{"all":null,"top":null,"right":null,"bottom":null,"left":null},"borderRadius":{"all":5,"topLeft":null,"topRight":null,"bottomRight":null,"bottomLeft":null},"textAlign":"center","padding":{"all":null,"top":null,"right":null,"bottom":null,"left":null}},"block":{"backgroundColor":""}}',
115
+ title: '',
116
+ date: '2024-01-12T08:42:09',
117
+ modified: '2024-02-16T17:21:01',
118
+ group: [],
119
+ lock: false,
120
+ utm_parameters: {
121
+ utm_content: 'ssssssss',
246
122
  },
247
- {
248
- "label": "Пользовательские4444",
249
- "value": "User",
250
- "children": systemfields
251
- }
252
- ]
253
- }
254
- });
255
- // await instance.show({
256
- // email: {
257
- // "id": "3769995",
258
- // "isNew": false,
259
- // "subject": "topic1Ы",
260
- // "preheader": "pre",
261
- // "description": "",
262
- // "project": "undefined",
263
- // "parent_email": "309707",
264
- // "common_styles": "{\"text\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"lineHeight\":21,\"lineHeightDim\":\"px\",\"color\":\"#5a5a5a\",\"textAlign\":\"left\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\"},\"headings\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":24,\"fontSizeDim\":\"px\",\"lineHeight\":32,\"lineHeightDim\":\"px\",\"color\":\"#333333\",\"textAlign\":\"left\",\"paddingTop\":20,\"paddingTopDim\":\"px\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"bold\":true,\"italic\":false},\"links\":{\"color\":\"#1C52DC\",\"underline\":true},\"buttons\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"color\":\"#FFFFFF\",\"bold\":false,\"italic\":false,\"backgroundColor\":\"#1C52DC\",\"marginTop\":10,\"marginTopDim\":\"px\",\"marginBottom\":10,\"marginBottomDim\":\"px\",\"border\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null},\"borderRadius\":{\"all\":5,\"topLeft\":null,\"topRight\":null,\"bottomRight\":null,\"bottomLeft\":null},\"textAlign\":\"center\",\"padding\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null}},\"block\":{\"backgroundColor\":\"\"}}",
265
- // "title": "",
266
- // "date": "2024-01-12T08:42:09",
267
- // "modified": "2024-02-16T17:21:01",
268
- // "group": [],
269
- // "lock": false,
270
- // "code": "<html><head></head><body><body></html>",
271
- // }
272
- // });
273
- // const email = await instance.getEmail();
123
+ // "code": "<html><head></head><body><body></html>",
124
+ },
125
+ },
126
+ project: undefined,
127
+ user: {
128
+ id: 123,
129
+ username: 'testetrter',
130
+ name: 'ssss',
131
+ },
132
+
133
+ config: {
134
+ counters: { optimization_counter: 2, ai_counter: 3, ai_generator_counter: 4, ai_img_counter: 4 },
135
+ limits: { optimization_limit: 5, ai_limit: 5, ai_generator_limit: 5, ai_img_limit: 5 },
136
+ billingPageUrl: 'https://billing.yandex.ru',
137
+ mode: 'pro',
138
+ configSwither: true,
139
+ revisionService: true,
140
+ theme: 'light',
141
+ testEmails: ['test@test.com'],
142
+ settingsEnabled: true,
143
+ UTMEnabled: true,
144
+ // locale: "ru_RU",
145
+ locale: 'en_US',
146
+ // emailDropdownMenuEnabled: true,
147
+ previewIconEnabled: true,
148
+ previewModeEnabled: true,
149
+ livePreviewEnabled: true,
150
+ sendTestEnabled: true,
151
+ emailExportEnabled: true,
152
+ sharePreviewEnabled: true,
153
+ emailDropdownMenuLock: true,
154
+ emailDropdownMenuClone: true,
155
+ emailDropdownMenuRemove: true,
156
+ // Стилизация через token
157
+ mergeTags: {
158
+ syntax: ['{{%value%}}'],
159
+ items: [
160
+ {
161
+ label: 'Системные123',
162
+ value: 'System',
163
+ children: systemfields,
164
+ },
165
+ {
166
+ label: 'Пользовательские',
167
+ value: 'User',
168
+ children: systemfields,
169
+ },
170
+ ],
171
+ },
172
+ },
173
+ };
174
+ async function init() {
175
+ const instance = await emailmaker.init(options);
176
+ instance.handleSaveEmail(async ({ value, patch, prev }) => {
177
+ const _email = await instance.compileEmail(value);
178
+ console.log(_email);
179
+ });
180
+ instance.handleLimitUsage(({ name, count }) => {
181
+ console.log('Словил отработку лимит каунтера');
182
+ });
183
+ instance.setConfig({
184
+ ...options.config,
185
+ mergeTags: {
186
+ syntax: ['{{%value%}}'],
187
+ items: [
188
+ {
189
+ label: 'Системные123',
190
+ value: 'System',
191
+ children: systemfields,
192
+ },
193
+ {
194
+ label: 'Пользовательские',
195
+ value: 'User',
196
+ children: systemfields,
197
+ },
198
+ ],
199
+ },
200
+ });
201
+ // await instance.show({
202
+ // email: {
203
+ // "id": "3769995",
204
+ // "isNew": false,
205
+ // "subject": "topic1Ы",
206
+ // "preheader": "pre",
207
+ // "description": "",
208
+ // "project": "undefined",
209
+ // "parent_email": "309707",
210
+ // "common_styles": "{\"text\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"lineHeight\":21,\"lineHeightDim\":\"px\",\"color\":\"#5a5a5a\",\"textAlign\":\"left\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\"},\"headings\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":24,\"fontSizeDim\":\"px\",\"lineHeight\":32,\"lineHeightDim\":\"px\",\"color\":\"#333333\",\"textAlign\":\"left\",\"paddingTop\":20,\"paddingTopDim\":\"px\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"bold\":true,\"italic\":false},\"links\":{\"color\":\"#1C52DC\",\"underline\":true},\"buttons\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"color\":\"#FFFFFF\",\"bold\":false,\"italic\":false,\"backgroundColor\":\"#1C52DC\",\"marginTop\":10,\"marginTopDim\":\"px\",\"marginBottom\":10,\"marginBottomDim\":\"px\",\"border\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null},\"borderRadius\":{\"all\":5,\"topLeft\":null,\"topRight\":null,\"bottomRight\":null,\"bottomLeft\":null},\"textAlign\":\"center\",\"padding\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null}},\"block\":{\"backgroundColor\":\"\"}}",
211
+ // "title": "",
212
+ // "date": "2024-01-12T08:42:09",
213
+ // "modified": "2024-02-16T17:21:01",
214
+ // "group": [],
215
+ // "lock": false,
216
+ // "code": "<html><head></head><body><body></html>",
217
+ // }
218
+ // });
219
+ // const email = await instance.getEmail();
220
+
221
+ // const TITLE_REGEX = /<title>(.*)<\/title>/gm;
222
+ // console.log(email.code);
223
+ // email.code.matchAll(TITLE_REGEX).map(item => item[1]).find(title => console.log(title));
224
+ }
225
+ async function init() {
226
+ // const response = await fetch("./key.txt");
227
+ // const key = await response.text();
228
+ const instance = await emailmaker.init({ ...options });
229
+ instance.handleSaveEmail(async ({ value, patch, prev }) => {
230
+ const _email = await instance.compileEmail(value);
231
+ console.log(_email);
232
+ _email.utm_parameters = { ..._email.utm_parameters, utm_content: '333' };
233
+ const a = await instance.compileEmail(_email);
234
+ console.log(a);
235
+ });
236
+ setTimeout(() => {
237
+ console.log(instance.getCodeErrors());
238
+ }, 5000);
239
+ instance.setConfig({
240
+ ...options.config,
241
+ mergeTags: {
242
+ syntax: ['{{%value%}}'],
243
+ items: [
244
+ {
245
+ label: 'Системные3131',
246
+ value: 'System',
247
+ children: systemfields,
248
+ },
249
+ {
250
+ label: 'Пользовательские4444',
251
+ value: 'User',
252
+ children: systemfields,
253
+ },
254
+ ],
255
+ },
256
+ });
257
+ instance.handleLimitUsage(({ name, count }) => {
258
+ console.log('Вы превысили количество допустимых сообщений в чат с AI');
259
+ console.log(name, count);
260
+ });
261
+ // await instance.show({
262
+ // email: {
263
+ // "id": "3769995",
264
+ // "isNew": false,
265
+ // "subject": "topic1Ы",
266
+ // "preheader": "pre",
267
+ // "description": "",
268
+ // "project": "undefined",
269
+ // "parent_email": "309707",
270
+ // "common_styles": "{\"text\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"lineHeight\":21,\"lineHeightDim\":\"px\",\"color\":\"#5a5a5a\",\"textAlign\":\"left\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\"},\"headings\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":24,\"fontSizeDim\":\"px\",\"lineHeight\":32,\"lineHeightDim\":\"px\",\"color\":\"#333333\",\"textAlign\":\"left\",\"paddingTop\":20,\"paddingTopDim\":\"px\",\"paddingBottom\":10,\"paddingBottomDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"bold\":true,\"italic\":false},\"links\":{\"color\":\"#1C52DC\",\"underline\":true},\"buttons\":{\"fontFamily\":[\"Safe Fonts\",\"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif\"],\"fontSize\":16,\"fontSizeDim\":\"px\",\"letterSpacing\":0,\"letterSpacingDim\":\"px\",\"color\":\"#FFFFFF\",\"bold\":false,\"italic\":false,\"backgroundColor\":\"#1C52DC\",\"marginTop\":10,\"marginTopDim\":\"px\",\"marginBottom\":10,\"marginBottomDim\":\"px\",\"border\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null},\"borderRadius\":{\"all\":5,\"topLeft\":null,\"topRight\":null,\"bottomRight\":null,\"bottomLeft\":null},\"textAlign\":\"center\",\"padding\":{\"all\":null,\"top\":null,\"right\":null,\"bottom\":null,\"left\":null}},\"block\":{\"backgroundColor\":\"\"}}",
271
+ // "title": "",
272
+ // "date": "2024-01-12T08:42:09",
273
+ // "modified": "2024-02-16T17:21:01",
274
+ // "group": [],
275
+ // "lock": false,
276
+ // "code": "<html><head></head><body><body></html>",
277
+ // }
278
+ // });
279
+ // const email = await instance.getEmail();
274
280
 
275
- // const TITLE_REGEX = /<title>(.*)<\/title>/gm;
276
- // console.log(email.code);
277
- // email.code.matchAll(TITLE_REGEX).map(item => item[1]).find(title => console.log(title));
278
- }
281
+ // const TITLE_REGEX = /<title>(.*)<\/title>/gm;
282
+ // console.log(email.code);
283
+ // email.code.matchAll(TITLE_REGEX).map(item => item[1]).find(title => console.log(title));
284
+ }
279
285
 
280
- init().catch(e => console.log(e));
281
- // })</script></body></html>
286
+ init().catch((e) => console.log(e));
287
+ // })</script></body></html>
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?888d7cc9e8f729d72e4a"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">const getAuthToken = async () => {
1
+ <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?d4fa16edb5080f1a7384"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">const getAuthToken = async () => {
2
2
  var requestOptions = {
3
3
  method: 'POST',
4
4
  redirect: 'follow',
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?888d7cc9e8f729d72e4a"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh;"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?888d7cc9e8f729d72e4a";
1
+ <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?d4fa16edb5080f1a7384"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh;"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?d4fa16edb5080f1a7384";
2
2
  const auth_jwt = {
3
3
  username: "****",
4
4
  password: "****"
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?888d7cc9e8f729d72e4a"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?888d7cc9e8f729d72e4a";
1
+ <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?d4fa16edb5080f1a7384"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh"></div><script async defer="defer">// import { init } from "./emailmaker-esm.js?d4fa16edb5080f1a7384";
2
2
  const auth_jwt = {
3
3
  username: '****',
4
4
  password: '****',
package/plugin_s.html CHANGED
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?888d7cc9e8f729d72e4a"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh;"></div><script async defer="defer">const getAuthToken = async () => {
1
+ <!doctype html><html lang="en"><head><script id="plugin-script" src="emailmaker.js?d4fa16edb5080f1a7384"></script></head><body><div id="test" style="padding: 0px; background: #fff; height: 100vh;"></div><script async defer="defer">const getAuthToken = async () => {
2
2
 
3
3
  var requestOptions = {
4
4
  method: 'POST',