@useinsider/guido 3.9.0-beta.69ecfd1 → 3.9.0-beta.7168aa8

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.
@@ -1,12 +1,12 @@
1
1
  var c = Object.defineProperty;
2
- var i = (s, a, e) => a in s ? c(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e;
3
- var T = (s, a, e) => i(s, typeof a != "symbol" ? a + "" : a, e);
2
+ var i = (s, r, e) => r in s ? c(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
+ var u = (s, r, e) => i(s, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { Control as I, UIElementType as n, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- class _ extends I {
5
+ class d extends I {
6
6
  constructor() {
7
7
  super(...arguments);
8
- T(this, "currentNode");
9
- T(this, "lastBlockInstanceId", null);
8
+ u(this, "currentNode");
9
+ u(this, "lastBlockInstanceId", null);
10
10
  }
11
11
  getContainer() {
12
12
  var e;
@@ -47,15 +47,15 @@ class _ extends I {
47
47
  const t = this.getBlockInstanceId();
48
48
  if (!t)
49
49
  return !1;
50
- const E = t !== this.lastBlockInstanceId;
51
- return e(), E && (this.lastBlockInstanceId = t), E;
50
+ const o = t !== this.lastBlockInstanceId;
51
+ return e(), o && (this.lastBlockInstanceId = t), o;
52
52
  }
53
- _GuLabel({ text: e, name: t = "", hint: E }) {
53
+ _GuLabel({ text: e, name: t = "", hint: o }) {
54
54
  return `
55
55
  <${n.LABEL}
56
56
  ${$.LABEL.text}="${e}"
57
57
  ${$.LABEL.name}="${t || `${e} Label`}"
58
- ${E ? `${$.LABEL.hint}="${E}"` : ""}>
58
+ ${o ? `${$.LABEL.hint}="${o}"` : ""}>
59
59
  </${n.LABEL}>
60
60
  `;
61
61
  }
@@ -73,7 +73,7 @@ class _ extends I {
73
73
  * Use in getTemplate() — the icon is registered in a hidden store so Stripo initializes it.
74
74
  * Pair with _setInfoMessageValue() in onRender() to set the text content.
75
75
  */
76
- _GuOnPageMessage({ name: e, icon: t = "not-found", type: E = "info" }) {
76
+ _GuOnPageMessage({ name: e, icon: t = "not-found", type: o = "info" }) {
77
77
  return `
78
78
  <div data-info-message="${e}" style="display: none; padding: 16px 16px 0;">
79
79
  <div class="icon-store" style="display: none;">
@@ -81,7 +81,7 @@ class _ extends I {
81
81
  ${this._GuIcon({ src: t, className: "icon" })}
82
82
  </div>
83
83
  </div>
84
- ${this._GuMessage({ name: e, type: E })}
84
+ ${this._GuMessage({ name: e, type: o })}
85
85
  </div>
86
86
  `;
87
87
  }
@@ -91,7 +91,7 @@ class _ extends I {
91
91
  * and combines it with the text in Stripo's alert-message layout.
92
92
  */
93
93
  _setInfoMessageValue(e, t) {
94
- const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`), r = o == null ? void 0 : o.querySelector("ue-icon-component"), l = (r == null ? void 0 : r.outerHTML) ?? "";
94
+ const o = this.getContainer(), E = o.querySelector(`[data-icon-key="${e}"]`), a = E == null ? void 0 : E.querySelector("ue-icon-component"), l = (a == null ? void 0 : a.outerHTML) ?? "";
95
95
  this.api.setUIEAttribute(
96
96
  e,
97
97
  "value",
@@ -104,8 +104,8 @@ class _ extends I {
104
104
  </div>
105
105
  `
106
106
  );
107
- const u = E.querySelector(`[data-info-message="${e}"]`);
108
- u && (u.style.display = "");
107
+ const T = o.querySelector(`[data-info-message="${e}"]`);
108
+ T && (T.style.display = "");
109
109
  }
110
110
  _GuToggle(e) {
111
111
  return `
@@ -121,59 +121,59 @@ class _ extends I {
121
121
  ${$.SELECT_ITEM.value}="${t}">
122
122
  </${n.SELECT_ITEM}>`;
123
123
  }
124
- _GuSelect({ name: e, placeholder: t, options: E, className: o = "es-180w" }) {
124
+ _GuSelect({ name: e, placeholder: t, options: o, className: E = "es-180w" }) {
125
125
  return `
126
126
  <${n.SELECTPICKER}
127
- class="${o}"
127
+ class="${E}"
128
128
  ${$.SELECTPICKER.name}="${e}"
129
129
  ${$.SELECTPICKER.placeholder}="${t}">
130
- ${E.map((r) => this._GuSelectItem(r)).join("")}
130
+ ${o.map((a) => this._GuSelectItem(a)).join("")}
131
131
  </${n.SELECTPICKER}>
132
132
  `;
133
133
  }
134
- _GuTextInput({ name: e, placeholder: t, className: E = "", disabled: o = !1 }) {
134
+ _GuTextInput({ name: e, placeholder: t, className: o = "", disabled: E = !1 }) {
135
135
  return `
136
136
  <${n.TEXT}
137
- class=${E}
137
+ class=${o}
138
138
  ${$.TEXT.name}="${e}"
139
139
  placeholder="${t || e}"
140
- ${o ? `${$.TEXT.disabled}="true"` : ""}>
140
+ ${E ? `${$.TEXT.disabled}="true"` : ""}>
141
141
  </${n.TEXT}>
142
142
  `;
143
143
  }
144
- _GuCounter({ name: e, maxValue: t, minValue: E = 1, step: o = 1 }) {
144
+ _GuCounter({ name: e, maxValue: t, minValue: o = 1, step: E = 1 }) {
145
145
  return `
146
146
  <${n.COUNTER}
147
147
  ${$.COUNTER.name}="${e}"
148
- ${$.COUNTER.minValue}="${E}"
148
+ ${$.COUNTER.minValue}="${o}"
149
149
  ${$.COUNTER.maxValue}="${t}"
150
- ${$.COUNTER.step}="${o}">
150
+ ${$.COUNTER.step}="${E}">
151
151
  </${n.COUNTER}>
152
152
  `;
153
153
  }
154
- _GuRadioButtonItem({ text: e, value: t, icon: E }) {
154
+ _GuRadioButtonItem({ text: e, value: t, icon: o }) {
155
155
  return `
156
156
  <${n.RADIO_ITEM}
157
157
  ${$.RADIO_ITEM.value}="${t}"
158
158
  ${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
159
- ${E ? `${$.RADIO_ITEM.icon}="${E}"` : ""}>
159
+ ${o ? `${$.RADIO_ITEM.icon}="${o}"` : ""}>
160
160
  </${n.RADIO_ITEM}>
161
161
  `;
162
162
  }
163
- _GuRadioButton({ name: e, buttons: t, id: E = "" }) {
163
+ _GuRadioButton({ name: e, buttons: t, id: o = "" }) {
164
164
  return `
165
165
  <${n.RADIO_BUTTONS}
166
- ${E ? `id="${E}"` : ""}
166
+ ${o ? `id="${o}"` : ""}
167
167
  ${$.RADIO_BUTTONS.name}="${e}">
168
- ${t.map((o) => this._GuRadioButtonItem(o)).join("")}
168
+ ${t.map((E) => this._GuRadioButtonItem(E)).join("")}
169
169
  </${n.RADIO_BUTTONS}>
170
170
  `;
171
171
  }
172
- _GuButton({ name: e, label: t, id: E = "" }) {
172
+ _GuButton({ name: e, label: t, id: o = "" }) {
173
173
  return `
174
174
  <${n.BUTTON}
175
175
  ${$.BUTTON.name}="${e}"
176
- ${E ? `id="${E}"` : ""}
176
+ ${o ? `id="${o}"` : ""}
177
177
  ${$.BUTTON.caption}="${t}"}>
178
178
  </${n.BUTTON}>
179
179
  `;
@@ -191,10 +191,10 @@ class _ extends I {
191
191
  * @param param0
192
192
  * @returns It returns a button with an icon.
193
193
  */
194
- _GuIconButton({ name: e, icon: t, className: E = "" }) {
194
+ _GuIconButton({ name: e, icon: t, className: o = "" }) {
195
195
  return `
196
196
  <${n.BUTTON}
197
- class="${E}"
197
+ class="${o}"
198
198
  ${$.BUTTON.name}="${e}"
199
199
  ${$.BUTTON.icon}="${t}">
200
200
  </${n.BUTTON}>
@@ -222,19 +222,19 @@ class _ extends I {
222
222
  * @returns HTML string for the orderable control
223
223
  */
224
224
  _GuOrderable(e, t) {
225
- let E = "";
226
- t.forEach((r) => {
225
+ let o = "";
226
+ t.forEach((a) => {
227
227
  const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
228
- E += `
229
- <${n.ORDERABLE_ITEM} ${l}="${r.key}">
230
- ${r.content}
228
+ o += `
229
+ <${n.ORDERABLE_ITEM} ${l}="${a.key}">
230
+ ${a.content}
231
231
  </${n.ORDERABLE_ITEM}>
232
232
  `;
233
233
  });
234
- const o = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
234
+ const E = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
235
235
  return `
236
- <${n.ORDERABLE} ${o}="${e}">
237
- ${E}
236
+ <${n.ORDERABLE} ${E}="${e}">
237
+ ${o}
238
238
  </${n.ORDERABLE}>
239
239
  `;
240
240
  }
@@ -275,16 +275,16 @@ class _ extends I {
275
275
  `;
276
276
  }
277
277
  _GuRadioButtons(e, t) {
278
- const E = t.map((o) => `
278
+ const o = t.map((E) => `
279
279
  <${n.RADIO_ITEM}
280
- ${$.RADIO_ITEM.text}="${o.text}"
281
- ${$.RADIO_ITEM.value}="${o.value}">
280
+ ${$.RADIO_ITEM.text}="${E.text}"
281
+ ${$.RADIO_ITEM.value}="${E.value}">
282
282
  </${n.RADIO_ITEM}>
283
283
  `).join("");
284
284
  return `
285
285
  <${n.RADIO_BUTTONS}
286
286
  ${$.RADIO_BUTTONS.name}="${e}">
287
- ${E}
287
+ ${o}
288
288
  </${n.RADIO_BUTTONS}>
289
289
  `;
290
290
  }
@@ -296,20 +296,7 @@ class _ extends I {
296
296
  </${n.CHECKBOX}>
297
297
  `;
298
298
  }
299
- // Tag/chips input (Stripo MULTIPLE_SELECT): add-by-Enter, remove-by-×.
300
- // Value is read/written as a string[] via updateValues / onValueChanged.
301
- _GuMultiSelect({ name: e, placeholder: t = "", className: E = "", disabled: o = !1 }) {
302
- const r = [E, o ? "" : "click-enabled"].filter(Boolean).join(" ");
303
- return `
304
- <${n.MULTIPLE_SELECT}
305
- class="${r}"
306
- ${$.MULTIPLE_SELECT.name}="${e}"
307
- ${$.MULTIPLE_SELECT.placeholder}="${t}"
308
- ${o ? `${$.MULTIPLE_SELECT.disabled}="true"` : ""}>
309
- </${n.MULTIPLE_SELECT}>
310
- `;
311
- }
312
299
  }
313
300
  export {
314
- _ as CommonControl
301
+ d as CommonControl
315
302
  };
@@ -1,58 +1,77 @@
1
- import { useHttp as d } from "../composables/useHttp.js";
2
- import { useToaster as m } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as y } from "../enums/defaults.js";
4
- import f from "../static/templates/empty/index.html.js";
5
- import g from "../static/templates/empty/style.css.js";
6
- const E = () => {
7
- const { get: s, post: c } = d(), { handleError: r } = m();
1
+ import { useHttp as y } from "../composables/useHttp.js";
2
+ import { useToaster as g } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as w, BLANK_TEMPLATE_HTML_URL as T, BLANK_TEMPLATE_CSS_URL as M } from "../enums/defaults.js";
4
+ const S = {
5
+ html: '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><div class="es-wrapper"></div></body></html>',
6
+ css: ""
7
+ };
8
+ let o = null;
9
+ const A = () => {
10
+ const { get: s, post: i } = y(), { handleError: a } = g(), p = async () => {
11
+ try {
12
+ const { data: t } = await s("/stripo/get-user-token");
13
+ return t.body.token;
14
+ } catch (t) {
15
+ return a(t, "Failed to fetch token"), "";
16
+ }
17
+ }, m = async () => {
18
+ try {
19
+ const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
20
+ return t.map((e) => ({
21
+ ...e,
22
+ active: !0
23
+ }));
24
+ } catch (t) {
25
+ return a(t, "Failed to fetch custom fonts"), [];
26
+ }
27
+ }, f = async () => {
28
+ try {
29
+ const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
30
+ return t.status;
31
+ } catch (t) {
32
+ return a(t, "Failed to fetch sync modules status"), !1;
33
+ }
34
+ }, c = async () => {
35
+ if (o)
36
+ return o;
37
+ try {
38
+ const [t, e] = await Promise.all([
39
+ fetch(T).then((r) => {
40
+ if (!r.ok)
41
+ throw new Error(`Blank template HTML request failed: ${r.status}`);
42
+ return r.text();
43
+ }),
44
+ fetch(M).then((r) => {
45
+ if (!r.ok)
46
+ throw new Error(`Blank template CSS request failed: ${r.status}`);
47
+ return r.text();
48
+ })
49
+ ]);
50
+ return o = { html: t, css: e }, o;
51
+ } catch (t) {
52
+ return a(t, "Failed to fetch blank template"), S;
53
+ }
54
+ };
8
55
  return {
9
- getToken: async () => {
10
- try {
11
- const { data: t } = await s("/stripo/get-user-token");
12
- return t.body.token;
13
- } catch (t) {
14
- return r(t, "Failed to fetch token"), "";
15
- }
16
- },
17
- getCustomFonts: async () => {
18
- try {
19
- const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
20
- return t.map((e) => ({
21
- ...e,
22
- active: !0
23
- }));
24
- } catch (t) {
25
- return r(t, "Failed to fetch custom fonts"), [];
26
- }
27
- },
56
+ getToken: p,
57
+ getCustomFonts: m,
28
58
  getDefaultTemplate: async () => {
29
- const t = {
30
- html: f,
31
- css: g
32
- };
33
- try {
34
- const e = new URLSearchParams(window.location.search), u = e.get("default-template"), p = e.get("master"), a = u ? parseInt(u) : 0, i = a >= 1 && a <= y ? a : 0;
35
- if (!i && !p)
36
- return t;
37
- const l = `/stripo/default-template/${i}`, { data: n } = await s(l), o = typeof n == "string" ? JSON.parse(n) : n;
38
- return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? t : o;
39
- } catch (e) {
40
- return r(e, "Failed to fetch default template"), t;
41
- }
42
- },
43
- getSyncModulesStatus: async () => {
44
59
  try {
45
- const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
46
- return t.status;
60
+ const t = new URLSearchParams(window.location.search), e = t.get("default-template"), r = t.get("master"), u = e ? parseInt(e) : 0, d = u >= 1 && u <= w ? u : 0;
61
+ if (!d && !r)
62
+ return await c();
63
+ const h = `/stripo/default-template/${d}`, { data: l } = await s(h), n = typeof l == "string" ? JSON.parse(l) : l;
64
+ return !n || typeof n != "object" || !("html" in n) || !("css" in n) ? await c() : n;
47
65
  } catch (t) {
48
- return r(t, "Failed to fetch sync modules status"), !1;
66
+ return a(t, "Failed to fetch default template"), c();
49
67
  }
50
68
  },
69
+ getSyncModulesStatus: f,
51
70
  updateSyncModule: async (t) => {
52
71
  try {
53
- return await c(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
72
+ return await i(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
54
73
  } catch (e) {
55
- return r(e, "Failed to update sync module"), !1;
74
+ return a(e, "Failed to update sync module"), !1;
56
75
  }
57
76
  },
58
77
  getSyncModule: async (t) => {
@@ -60,7 +79,7 @@ const E = () => {
60
79
  const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
61
80
  return e;
62
81
  } catch (e) {
63
- return r(e, "Failed to get sync module"), {
82
+ return a(e, "Failed to get sync module"), {
64
83
  id: 0,
65
84
  stripoId: 0,
66
85
  unsubscriptionPreferencePages: []
@@ -71,13 +90,13 @@ const E = () => {
71
90
  if (t.length === 0)
72
91
  return !0;
73
92
  try {
74
- return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
93
+ return await i("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
75
94
  } catch (e) {
76
- return r(e, "Failed to set unsubscription preference pages"), !1;
95
+ return a(e, "Failed to set unsubscription preference pages"), !1;
77
96
  }
78
97
  }
79
98
  };
80
99
  };
81
100
  export {
82
- E as useStripoApi
101
+ A as useStripoApi
83
102
  };
@@ -8,6 +8,9 @@ export declare const TemplateTypes: {
8
8
  };
9
9
  export declare const EditorType: number;
10
10
  export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
11
+ export declare const EMAIL_STATIC_BASE_URL = "https://email-static.useinsider.com";
12
+ export declare const BLANK_TEMPLATE_HTML_URL = "https://email-static.useinsider.com/templates/campaign/default.html";
13
+ export declare const BLANK_TEMPLATE_CSS_URL = "https://email-static.useinsider.com/templates/campaign/default.css";
11
14
  export declare const ProductIds: Record<string, number>;
12
15
  export declare const ModuleFolderDefaults: {
13
16
  readonly SAVED_MODULES: "savedModules";
@@ -21,10 +21,9 @@ export declare class AlgorithmControl extends CommonControl {
21
21
  onRender(): void;
22
22
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
23
23
  _setFormValues(): void;
24
- _clearProductIdsDraft(): void;
25
24
  _initializeSelectItems(): void;
26
25
  _setProductIdsVisibility(strategy?: string): void;
27
26
  _onAlgorithmChange(value: string): void;
28
- _onProductIdsChange(value: string[]): void;
27
+ _onProductIdsChange(value: string): void;
29
28
  _listenToFormUpdates(): void;
30
29
  }
@@ -6,12 +6,6 @@ interface TextInputProps {
6
6
  className?: string;
7
7
  disabled?: boolean;
8
8
  }
9
- interface MultiSelectProps {
10
- name: string;
11
- placeholder?: string;
12
- className?: string;
13
- disabled?: boolean;
14
- }
15
9
  interface LabelProps {
16
10
  text: string;
17
11
  name?: string;
@@ -151,6 +145,5 @@ export declare abstract class CommonControl extends Control {
151
145
  value: string;
152
146
  }[]): string;
153
147
  _GuCheckbox(name: string, caption: string): string;
154
- _GuMultiSelect({ name, placeholder, className, disabled }: MultiSelectProps): string;
155
148
  }
156
149
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.9.0-beta.69ecfd1",
3
+ "version": "3.9.0-beta.7168aa8",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,74 +0,0 @@
1
- const t = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta content="width=device-width, initial-scale=1" name="viewport">
7
- <meta name="x-apple-disable-message-reformatting">
8
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
- <meta content="telephone=no" name="format-detection">
10
- <title></title>
11
- <!--[if (mso 16)]><style type="text/css">a{text-decoration:none}</style><![endif]-->
12
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
13
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
14
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
15
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
16
- <!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]-->
17
- </head>
18
-
19
- <body>
20
- <div class="es-wrapper-color">
21
- <!--[if gte mso 9]>
22
- <v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
23
- <v:fill type="tile" color="#f6f6f6"></v:fill>
24
- </v:background>
25
- <![endif]-->
26
- <table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0">
27
- <tbody>
28
- <tr>
29
- <td class="esd-email-paddings" valign="top">
30
- <table class="es-content esd-footer-popover" cellspacing="0" cellpadding="0" align="center">
31
- <tbody>
32
- <tr>
33
- <td class="esd-stripe" align="center">
34
- <table class="es-content-body" width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
35
- <tbody>
36
- <tr>
37
- <td class="esd-structure es-p20" align="left">
38
- <table cellpadding="0" cellspacing="0" width="100%">
39
- <tbody>
40
- <tr>
41
- <td width="560" class="esd-container-frame" align="center" valign="top">
42
- <table cellpadding="0" cellspacing="0" width="100%">
43
- <tbody>
44
- <tr>
45
- <td align="center" class="esd-empty-container" style="display: none;"></td>
46
- </tr>
47
- </tbody>
48
- </table>
49
- </td>
50
- </tr>
51
- </tbody>
52
- </table>
53
- </td>
54
- </tr>
55
- </tbody>
56
- </table>
57
- </td>
58
- </tr>
59
- </tbody>
60
- </table>
61
- </td>
62
- </tr>
63
- </tbody>
64
- </table>
65
- </div>
66
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px;"></div>
67
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px; padding: 0px; border: 0px none; width: 1px;"></div>
68
- </body>
69
-
70
- </html>
71
- `;
72
- export {
73
- t as default
74
- };