@useinsider/guido 3.1.1-beta.a7d73f2 → 3.1.1-beta.a80cc5e

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 (42) hide show
  1. package/dist/@types/config/schemas.js +66 -56
  2. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  3. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  4. package/dist/composables/useHtmlCompiler.js +20 -20
  5. package/dist/composables/useHtmlValidator.js +40 -38
  6. package/dist/composables/usePreviewMode.js +20 -16
  7. package/dist/composables/useSave.js +15 -13
  8. package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
  9. package/dist/config/i18n/en/tooltips.json.js +2 -1
  10. package/dist/config/migrator/checkboxMigrator.js +5 -3
  11. package/dist/config/migrator/radioButtonMigrator.js +14 -12
  12. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  13. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  14. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  15. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
  16. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  19. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  20. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  21. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
  22. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  23. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  24. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  25. package/dist/guido.css +1 -1
  26. package/dist/src/@types/config/index.d.ts +1 -1
  27. package/dist/src/@types/config/schemas.d.ts +24 -0
  28. package/dist/src/@types/config/types.d.ts +3 -1
  29. package/dist/src/composables/useConfig.d.ts +10 -0
  30. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  33. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  34. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  35. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  36. package/dist/src/stores/config.d.ts +90 -0
  37. package/dist/src/stores/preview.d.ts +3 -0
  38. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  39. package/dist/stores/preview.js +4 -3
  40. package/dist/utils/htmlCompiler.js +48 -41
  41. package/dist/utils/templatePreparation.js +20 -20
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as b } from "../../enums/defaults.js";
2
- import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, minLength as d, custom as S, boolean as a, array as c, literal as r, variant as k } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, minLength as d, custom as S, boolean as a, array as c, literal as l, variant as k } from "../../node_modules/valibot/dist/index.js";
3
3
  const m = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -26,6 +26,11 @@ const m = {
26
26
  /** Optional variation ID for A/B testing */
27
27
  variationId: e(t())
28
28
  }), y = o({
29
+ /** Fallback font name (e.g., "Georgia") */
30
+ name: t(),
31
+ /** Fallback font family (e.g., "serif" or "sans-serif") */
32
+ family: t()
33
+ }), f = o({
29
34
  /** Partner/organization name (required) */
30
35
  name: u(
31
36
  t(),
@@ -46,8 +51,10 @@ const m = {
46
51
  m.PROMOTIONAL
47
52
  ),
48
53
  /** Display name for the current user */
49
- username: e(t(), "Guido User")
50
- }), f = o({
54
+ username: e(t(), "Guido User"),
55
+ /** Fallback font settings from partner settings — used to match backend size calculation */
56
+ fallbackFont: e(y)
57
+ }), A = o({
51
58
  /** Display text for the dynamic content */
52
59
  text: t(),
53
60
  /** Template variable value (e.g., {{username}}) */
@@ -68,19 +75,21 @@ const m = {
68
75
  css: e(t(), ""),
69
76
  /** Preselected dynamic content items */
70
77
  preselectedDynamicContent: e(
71
- c(f),
78
+ c(A),
72
79
  []
73
80
  ),
81
+ /** Valid custom field attribute names from the partner's categorized fields */
82
+ customFieldAttributes: e(c(t()), []),
74
83
  /** Selected unsubscribe page IDs */
75
84
  selectedUnsubscribePages: e(c(p()), []),
76
85
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
77
86
  forceRecreate: e(a(), !1)
78
- }), A = o({
87
+ }), C = o({
79
88
  /** Sender display name */
80
89
  senderName: e(t(), ""),
81
90
  /** Email subject line */
82
91
  subject: e(t(), "")
83
- }), C = o({
92
+ }), T = o({
84
93
  /** Locale for the editor UI */
85
94
  locale: e(t(), "en"),
86
95
  /** Path to translations object */
@@ -88,17 +97,17 @@ const m = {
88
97
  /** Migration date for template compatibility */
89
98
  migrationDate: e(p(), 1759696858),
90
99
  /** Email header settings */
91
- emailHeader: e(A, { senderName: "", subject: "" }),
100
+ emailHeader: e(C, { senderName: "", subject: "" }),
92
101
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
93
102
  savedModulesFolderName: e(t(), b.SAVED_MODULES),
94
103
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
95
104
  defaultModulesFolderName: e(t(), b.DEFAULT_MODULES)
96
- }), T = o({
105
+ }), I = o({
97
106
  /** Whether to show the header bar */
98
107
  showHeader: e(a(), !0),
99
108
  /** Custom label for back button (if shown) */
100
109
  backButtonLabel: e(t())
101
- }), I = o({
110
+ }), E = o({
102
111
  /** Enable dynamic content insertion */
103
112
  dynamicContent: e(a(), !0),
104
113
  /** Enable save as template functionality */
@@ -113,7 +122,7 @@ const m = {
113
122
  unsubscribe: e(a(), !0),
114
123
  /** Disable modules panel in the editor */
115
124
  modulesDisabled: e(a(), !1)
116
- }), E = n([
125
+ }), g = n([
117
126
  "amp-accordion",
118
127
  "amp-carousel",
119
128
  "amp-form-controls",
@@ -127,7 +136,7 @@ const m = {
127
136
  "text-block",
128
137
  "timer-block",
129
138
  "video-block"
130
- ]), g = n([
139
+ ]), O = n([
131
140
  "dynamic-content",
132
141
  "checkbox-block",
133
142
  "radio-button-block",
@@ -135,66 +144,66 @@ const m = {
135
144
  "unsubscribe-block",
136
145
  "coupon-block",
137
146
  "items-block"
138
- ]), O = o({
147
+ ]), L = o({
139
148
  /** Default blocks to exclude from the editor */
140
149
  excludeDefaults: e(
141
- c(E),
150
+ c(g),
142
151
  []
143
152
  ),
144
153
  /** Custom blocks to include in the editor */
145
154
  includeCustoms: e(
146
- c(g),
155
+ c(O),
147
156
  []
148
157
  )
149
- }), l = o({
158
+ }), r = o({
150
159
  /** Unique identifier for the rule */
151
160
  id: t(),
152
161
  /** Human-readable description */
153
162
  description: e(t()),
154
163
  /** Priority for rule ordering (lower = earlier) */
155
164
  priority: p()
156
- }), L = o({
157
- ...l.entries,
158
- type: r("replace"),
165
+ }), M = o({
166
+ ...r.entries,
167
+ type: l("replace"),
159
168
  /** String to search for */
160
169
  search: t(),
161
170
  /** Replacement string */
162
171
  replacement: t(),
163
172
  /** Replace all occurrences (default: false) */
164
173
  replaceAll: e(a())
165
- }), M = o({
166
- ...l.entries,
167
- type: r("regex"),
174
+ }), N = o({
175
+ ...r.entries,
176
+ type: l("regex"),
168
177
  /** Regex pattern string */
169
178
  pattern: t(),
170
179
  /** Replacement string (supports $1, $2, etc.) */
171
180
  replacement: t(),
172
181
  /** Regex flags (e.g., 'gi') */
173
182
  flags: e(t())
174
- }), N = o({
175
- ...l.entries,
176
- type: r("remove"),
183
+ }), D = o({
184
+ ...r.entries,
185
+ type: l("remove"),
177
186
  /** Strings or patterns to remove */
178
187
  targets: c(t())
179
- }), D = o({
180
- ...l.entries,
181
- type: r("custom"),
188
+ }), v = o({
189
+ ...r.entries,
190
+ type: l("custom"),
182
191
  /** Custom processor function */
183
192
  processor: S(
184
193
  (i) => typeof i == "function",
185
194
  "processor must be a function"
186
195
  )
187
- }), v = k("type", [
188
- L,
196
+ }), U = k("type", [
189
197
  M,
190
198
  N,
191
- D
192
- ]), U = o({
199
+ D,
200
+ v
201
+ ]), x = o({
193
202
  /** Custom compiler rules to apply */
194
- customRules: e(c(v), []),
203
+ customRules: e(c(U), []),
195
204
  /** Skip default compiler rules */
196
205
  ignoreDefaultRules: e(a(), !1)
197
- }), x = o({
206
+ }), B = o({
198
207
  /**
199
208
  * External validation handler called before save completes.
200
209
  * Return false to cancel the save operation.
@@ -210,43 +219,44 @@ const m = {
210
219
  /** Identity configuration (required) */
211
220
  identity: h,
212
221
  /** Partner configuration (required) */
213
- partner: y,
222
+ partner: f,
214
223
  // Optional sections (with defaults)
215
224
  /** Template content and presets */
216
225
  template: e(R, {}),
217
226
  /** Editor settings */
218
- editor: e(C, {}),
227
+ editor: e(T, {}),
219
228
  /** UI configuration */
220
- ui: e(T, {}),
229
+ ui: e(I, {}),
221
230
  /** Feature toggles */
222
- features: e(I, {}),
231
+ features: e(E, {}),
223
232
  /** Block configuration */
224
- blocks: e(O, {}),
233
+ blocks: e(L, {}),
225
234
  /** Compiler configuration */
226
- compiler: e(U, {}),
235
+ compiler: e(x, {}),
227
236
  /** Callbacks and event handlers */
228
- callbacks: e(x, {})
237
+ callbacks: e(B, {})
229
238
  });
230
239
  export {
231
- O as BlocksSchema,
232
- x as CallbacksSchema,
233
- v as CompilerRuleSchema,
234
- U as CompilerSchema,
235
- g as CustomBlockTypeSchema,
236
- D as CustomRuleSchema,
237
- E as DefaultBlockTypeSchema,
238
- f as DynamicContentSchema,
239
- C as EditorSchema,
240
- A as EmailHeaderSchema,
241
- I as FeaturesSchema,
240
+ L as BlocksSchema,
241
+ B as CallbacksSchema,
242
+ U as CompilerRuleSchema,
243
+ x as CompilerSchema,
244
+ O as CustomBlockTypeSchema,
245
+ v as CustomRuleSchema,
246
+ g as DefaultBlockTypeSchema,
247
+ A as DynamicContentSchema,
248
+ T as EditorSchema,
249
+ C as EmailHeaderSchema,
250
+ y as FallbackFontSchema,
251
+ E as FeaturesSchema,
242
252
  H as GuidoConfigSchema,
243
253
  h as IdentitySchema,
244
254
  m as MessageType,
245
- y as PartnerSchema,
255
+ f as PartnerSchema,
246
256
  s as ProductType,
247
- M as RegexRuleSchema,
248
- N as RemoveRuleSchema,
249
- L as ReplaceRuleSchema,
257
+ N as RegexRuleSchema,
258
+ D as RemoveRuleSchema,
259
+ M as ReplaceRuleSchema,
250
260
  R as TemplateSchema,
251
- T as UISchema
261
+ I as UISchema
252
262
  };
@@ -1,16 +1,16 @@
1
1
  import s from "./EmailSizeIndicator.vue2.js";
2
2
  /* empty css */
3
- import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
5
- var e = this, i = e._self._c, t = e._self._setupProxy;
6
- return t.previewStore.previewHtml ? i("div", { staticClass: "d-f a-i-c j-c-c" }, [i(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), i(t.InTooltipV2, { attrs: { id: "email-size-tooltip", "icon-status": "", "static-position": "bottom center", "dynamic-position": !1, text: t.trans("email-editor.preview-design-size-tooltip") } })], 1) : e._e();
7
- }, a = [], n = /* @__PURE__ */ r(
3
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var i = this, e = i._self._c, t = i._self._setupProxy;
6
+ return e("div", { staticClass: "d-f a-i-c j-c-c" }, [t.previewStore.isLoaded ? [e(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), e(t.InTooltipV2, { attrs: { id: "email-size-tooltip", "icon-status": "", "static-position": "bottom center", "dynamic-position": !1, text: t.trans("email-editor.preview-design-size-tooltip") } })] : e(t.InSkeleton, { attrs: { sizing: { width: 200, height: 20 } } })], 2);
7
+ }, a = [], n = /* @__PURE__ */ o(
8
8
  s,
9
- o,
9
+ r,
10
10
  a,
11
11
  !1,
12
12
  null,
13
- "079d2bf7"
13
+ "2cb418af"
14
14
  );
15
15
  const m = n.exports;
16
16
  export {
@@ -1,25 +1,17 @@
1
- import { defineComponent as c, ref as n, computed as l, watch as u } from "vue";
2
- import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
- import { usePreviewStore as _ } from "../../../../stores/preview.js";
4
- import { InTooltipV2 as v, InProgress as f } from "@useinsider/design-system-vue";
5
- const S = /* @__PURE__ */ c({
1
+ import { defineComponent as i, computed as t } from "vue";
2
+ import { useTranslations as m } from "../../../../composables/useTranslations.js";
3
+ import { usePreviewStore as a } from "../../../../stores/preview.js";
4
+ import { InTooltipV2 as p, InSkeleton as c, InProgress as _ } from "@useinsider/design-system-vue";
5
+ const z = /* @__PURE__ */ i({
6
6
  __name: "EmailSizeIndicator",
7
- setup(w) {
8
- const t = _(), o = 102, e = n(0), s = n({
9
- type: "success",
10
- value: 0
11
- }), a = l(() => `~${e.value} KB`), r = () => {
12
- const m = new Blob([t.previewHtml]).size;
13
- e.value = Math.round(m / 1024), s.value = {
14
- type: e.value < o ? "success" : "warning",
15
- value: Math.min(e.value, o)
16
- };
17
- }, i = p();
18
- return u(() => t.previewHtml, () => {
19
- r();
20
- }, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltipV2: v };
7
+ setup(l) {
8
+ const e = a(), o = 102, r = t(() => `~${e.emailSizeKB} KB`), n = t(() => ({
9
+ type: e.emailSizeKB < o ? "success" : "warning",
10
+ value: Math.min(e.emailSizeKB, o)
11
+ })), s = m();
12
+ return { __sfc: !0, previewStore: e, MAX_EMAIL_SIZE_IN_KB: o, htmlSize: r, progress: n, trans: s, InProgress: _, InSkeleton: c, InTooltipV2: p };
21
13
  }
22
14
  });
23
15
  export {
24
- S as default
16
+ z as default
25
17
  };
@@ -1,28 +1,28 @@
1
- import { defaultHtmlCompilerRules as p } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as u } from "../config/compiler/itemsCompilerRules.js";
3
- import { outlookCompilerRules as c } from "../config/compiler/outlookCompilerRules.js";
4
- import { recommendationCompilerRules as n } from "../config/compiler/recommendationCompilerRules.js";
5
- import { socialCompilerRules as f } from "../config/compiler/socialCompilerRules.js";
6
- import { unsubscribeCompilerRules as R } from "../config/compiler/unsubscribeCompilerRules.js";
7
- import { createHtmlCompiler as a } from "../utils/htmlCompiler.js";
8
- import { useConfig as C } from "./useConfig.js";
9
- const B = () => {
10
- var m, l;
11
- const { compiler: e } = C(), r = ((m = e.value) == null ? void 0 : m.customRules) || [], t = [
12
- ...!!((l = e.value) != null && l.ignoreDefaultRules) ? [] : p,
13
- ...n,
1
+ import { defaultHtmlCompilerRules as n } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as a } from "../config/compiler/itemsCompilerRules.js";
3
+ import { outlookCompilerRules as f } from "../config/compiler/outlookCompilerRules.js";
4
+ import { recommendationCompilerRules as R } from "../config/compiler/recommendationCompilerRules.js";
5
+ import { socialCompilerRules as C } from "../config/compiler/socialCompilerRules.js";
6
+ import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
7
+ import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
8
+ import { useConfig as b } from "./useConfig.js";
9
+ const q = () => {
10
+ var l, m, r;
11
+ const { compiler: e, partner: t } = b(), i = ((l = e.value) == null ? void 0 : l.customRules) || [], s = [
12
+ ...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : n,
14
13
  ...R,
15
- ...u,
16
- ...c,
14
+ ...g,
15
+ ...a,
17
16
  ...f,
18
- ...r.map((o, s) => ({
17
+ ...C,
18
+ ...i.map((o, c) => ({
19
19
  ...o,
20
- priority: o.priority + 1e3 + s
20
+ priority: o.priority + 1e3 + c
21
21
  // Ensure additional rules run after default rules
22
22
  }))
23
- ], i = a(t);
24
- return { compileHtml: (o) => i.compile(o) };
23
+ ], p = H(s), u = (r = t.value) == null ? void 0 : r.fallbackFont;
24
+ return { compileHtml: (o) => p.compile(o, void 0, u) };
25
25
  };
26
26
  export {
27
- B as useHtmlCompiler
27
+ q as useHtmlCompiler
28
28
  };
@@ -9,76 +9,76 @@ import { useHttp as j } from "./useHttp.js";
9
9
  import { useToaster as q } from "./useToaster.js";
10
10
  import { useTranslations as z } from "./useTranslations.js";
11
11
  const K = /recommendation-id="(\d+)"/g;
12
- function U(i) {
13
- return [...i.matchAll(K)].map((u) => u[1]);
12
+ function U(a) {
13
+ return [...a.matchAll(K)].map((u) => u[1]);
14
14
  }
15
- function Y(i, u) {
16
- return u.some((d) => i.startsWith(`${d}_`));
15
+ function Y(a, u) {
16
+ return u.some((d) => a.startsWith(`${d}_`));
17
17
  }
18
18
  const ce = () => {
19
19
  var y, h;
20
- const { showToaster: i } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, w = async (e) => {
20
+ const { showToaster: a } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, b = async (e) => {
21
21
  const t = await u(
22
22
  "/newsletter/template-library/check-template-html-body",
23
23
  { html: X(e) }
24
24
  ), { status: n, message: l } = t.data;
25
- return n || i({
25
+ return n || a({
26
26
  type: c.Alert,
27
27
  message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
28
- }), r(P), l === r(G) && i({
28
+ }), r(P), l === r(G) && a({
29
29
  type: c.Alert,
30
30
  message: r("newsletter.already-in-progress")
31
31
  }), n;
32
- }, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
32
+ }, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
33
33
  const t = e.match(/({%(.*?)%})/g);
34
34
  let n = !0;
35
35
  return t !== null && !p && t.forEach((l) => {
36
36
  const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
37
37
  if (o && o.length > 0) {
38
- const [a] = o;
39
- b(a) && !s.includes(a) && (i({
38
+ const [i] = o;
39
+ w(i) && !s.includes(i) && (a({
40
40
  type: c.Warning,
41
41
  message: r("custom-fields.invalid-custom-fields")
42
42
  }), n = !1);
43
43
  }
44
44
  }), n;
45
45
  }, A = async (e, s, t) => {
46
- const n = t ? await w(e) : !0;
46
+ const n = t ? await b(e) : !0;
47
47
  return E(e, s) && n;
48
- }, I = (e) => e.length > 0 ? !0 : (i({
48
+ }, I = (e) => e.length > 0 ? !0 : (a({
49
49
  type: c.Warning,
50
50
  message: r("newsletter.html-content-is-empty")
51
51
  }), !1), k = (e) => {
52
52
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
53
- return s > t && i({
53
+ return s > t && a({
54
54
  type: c.Warning,
55
55
  message: r("custom-fields.missing-closing-braces")
56
- }), s < t && i({
56
+ }), s < t && a({
57
57
  type: c.Warning,
58
58
  message: r("custom-fields.missing-opening-braces")
59
59
  }), s === t;
60
60
  }, x = (e) => {
61
61
  const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
62
- return s || i({
62
+ return s || a({
63
63
  type: c.Warning,
64
64
  message: r("custom-fields.invalid-custom-fields")
65
65
  }), s;
66
66
  }, T = (e, s) => {
67
67
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
68
68
  if (t && !p) {
69
- const n = new Set(s.map((a) => a.toLowerCase())), l = U(e), o = [];
70
- if (t.forEach((a) => {
71
- const m = a.slice(2, -2).trim().toLowerCase();
69
+ const n = new Set(s.map((i) => i.toLowerCase())), l = U(e), o = [];
70
+ if (t.forEach((i) => {
71
+ const m = i.slice(2, -2).trim().toLowerCase();
72
72
  (!n.has(m) || m === "") && !Y(m, l) && o.push(m);
73
73
  }), o.length > 0) {
74
- const a = `
74
+ const i = `
75
75
  <ul>
76
76
  ${o.map((m) => `<li>${m}</li>`).join("")}
77
77
  </ul>
78
78
  `;
79
- return i({
79
+ return a({
80
80
  type: c.Alert,
81
- message: r("custom-fields.invalid-custom-fields") + a
81
+ message: r("custom-fields.invalid-custom-fields") + i
82
82
  }), !1;
83
83
  }
84
84
  }
@@ -87,12 +87,12 @@ const ce = () => {
87
87
  const s = e.match(/{%(.*?)%}/g), t = [];
88
88
  let n = !0;
89
89
  if (s && s.forEach((l) => {
90
- const o = l.match(_), a = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
91
- (!o || l !== m) && !a && (i({
90
+ const o = l.match(_), i = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
91
+ (!o || l !== m) && !i && (a({
92
92
  type: c.Alert,
93
93
  message: r("newsletter.display-conditions-invalid-syntax")
94
94
  }), n = !1), o && o.forEach((f) => {
95
- f.trim() === "=" && (i({
95
+ f.trim() === "=" && (a({
96
96
  type: c.Alert,
97
97
  message: r("custom-conditions.wrong-equality-operators")
98
98
  }), n = !1);
@@ -102,8 +102,8 @@ const ce = () => {
102
102
  });
103
103
  });
104
104
  }), t.length) {
105
- const l = t.filter((a) => a === "if"), o = t.filter((a) => a === "endif");
106
- l.length !== o.length && (i({
105
+ const l = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
106
+ l.length !== o.length && (a({
107
107
  type: c.Alert,
108
108
  message: r("custom-conditions.missing-if-endif-tag")
109
109
  }), n = !1);
@@ -111,45 +111,47 @@ const ce = () => {
111
111
  return n;
112
112
  }, W = (e) => {
113
113
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
114
- return n || i({
114
+ return n || a({
115
115
  type: c.Warning,
116
116
  message: r("custom-conditions.no-space-after-braces")
117
117
  }), n;
118
- }, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (i({
118
+ }, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
119
119
  type: c.Warning,
120
120
  message: r("custom-conditions.no-braces-inside-if-tag")
121
- }), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (i({
121
+ }), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
122
122
  type: c.Alert,
123
123
  message: r("newsletter.fill-all-necessary-fields")
124
124
  }), !1) : !0, B = (e) => {
125
125
  const s = /src="[^"]*\.(svg|pst)"/gm;
126
- return e.match(s) === null ? !0 : (i({
126
+ return e.match(s) === null ? !0 : (a({
127
127
  type: c.Alert,
128
128
  message: r("newsletter.invalid-image-type")
129
129
  }), !1);
130
130
  }, R = (e) => {
131
131
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
132
132
  return Array.from(n).find((o) => {
133
- var a;
134
- return !((a = o.id) != null && a.trim());
135
- }) ? (i({
133
+ var i;
134
+ return !((i = o.id) != null && i.trim());
135
+ }) ? (a({
136
136
  type: c.Alert,
137
137
  message: r("unsubscribe-templates.select-checkbox-groups")
138
138
  }), !1) : !0;
139
139
  }, D = (e) => {
140
140
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
141
141
  return Array.from(n).find((o) => {
142
- var a;
143
- return !((a = o.id) != null && a.trim());
144
- }) ? (i({
142
+ var i;
143
+ return !((i = o.id) != null && i.trim());
144
+ }) ? (a({
145
145
  type: c.Alert,
146
146
  message: r("unsubscribe-templates.select-radio-button-groups")
147
147
  }), !1) : !0;
148
148
  };
149
149
  return { validateHtml: async (e, s, t = !1) => {
150
+ var o, i;
150
151
  const n = [
151
- ...s.map((o) => o.value),
152
- ...M
152
+ ...s.map((m) => m.value),
153
+ ...M,
154
+ ...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
153
155
  ];
154
156
  return await A(e, n, t) && I(e) && k(e) && x(e) && T(e, n) && F(e) && W(e) && N(e) && O() && B(e) && R(e) && D(e);
155
157
  } };
@@ -1,31 +1,35 @@
1
- import { useEditorStore as n } from "../stores/editor.js";
2
- import { usePreviewStore as l } from "../stores/preview.js";
3
- import { useActionsApi as m } from "./useActionsApi.js";
4
- import { useCodeEditorApi as p } from "./useCodeEditorApi.js";
5
- const E = () => {
6
- const o = n(), e = l(), { closeCodeEditor: a } = p(), { getPreviewData: s } = m(), r = () => {
7
- o.isPreviewModeOpen = !1, e.$reset();
1
+ import { useEditorStore as d } from "../stores/editor.js";
2
+ import { usePreviewStore as n } from "../stores/preview.js";
3
+ import { useActionsApi as p } from "./useActionsApi.js";
4
+ import { useCodeEditorApi as c } from "./useCodeEditorApi.js";
5
+ import { useHtmlCompiler as u } from "./useHtmlCompiler.js";
6
+ const g = () => {
7
+ const t = d(), e = n(), { closeCodeEditor: i } = c(), { getPreviewData: a, getCompiledEmail: s } = p(), { compileHtml: m } = u(), r = () => {
8
+ t.isPreviewModeOpen = !1, e.$reset();
8
9
  };
9
10
  return {
10
11
  closePreviewMode: r,
11
12
  openPreviewMode: () => {
12
- o.isCodeEditorOpen && a(), o.isPreviewModeOpen = !0;
13
+ t.isCodeEditorOpen && i(), t.isPreviewModeOpen = !0;
13
14
  },
14
15
  loadPreviewData: async () => {
15
- if (!(o.loadingStatus || e.isLoaded)) {
16
- o.loadingStatus = !0;
16
+ if (!(t.loadingStatus || e.isLoaded)) {
17
+ t.loadingStatus = !0;
17
18
  try {
18
- const { html: t, ampHtml: i, ampErrors: d } = await s();
19
- e.templateHtml = t || "", e.ampHtml = i || "", e.ampErrors = d || [], e.setEmailFormat(i ? "AMP" : "html"), e.isLoaded = !0;
20
- } catch (t) {
21
- console.error("Failed to load preview data:", t), r();
19
+ const [o, l] = await Promise.all([
20
+ a(),
21
+ s({ minimize: !0, resetDataSavedFlag: !1 })
22
+ ]);
23
+ e.templateHtml = o.html || "", e.ampHtml = o.ampHtml || "", e.ampErrors = o.ampErrors || [], e.setEmailFormat(o.ampHtml ? "AMP" : "html"), e.emailSizeKB = m(l.html).estimatedSizeKB, e.isLoaded = !0;
24
+ } catch (o) {
25
+ console.error("Failed to load preview data:", o), r();
22
26
  } finally {
23
- o.loadingStatus = !1;
27
+ t.loadingStatus = !1;
24
28
  }
25
29
  }
26
30
  }
27
31
  };
28
32
  };
29
33
  export {
30
- E as usePreviewMode
34
+ g as usePreviewMode
31
35
  };
@@ -1,21 +1,23 @@
1
- import { useConfig as d } from "./useConfig.js";
2
- import { useSaveStart as p, useSaveComplete as f } from "./useGuidoActions.js";
3
- import { useSyncModuleExtractor as v } from "./useSyncModuleExtractor.js";
4
- import { useStripoApi as S } from "../services/stripoApi.js";
5
- import { useTemplatePreparation as x } from "../utils/templatePreparation.js";
6
- import { useHtmlValidator as V } from "./useHtmlValidator.js";
7
- const g = () => {
8
- const o = p(), s = f(), { validateHtml: i } = V(), { callbacks: a } = d(), { extractSyncModuleData: r } = v(), { setSyncModuleUnsubscriptionPages: n } = S();
9
- return { save: async (l = !1) => {
1
+ import { useActionsApi as d } from "./useActionsApi.js";
2
+ import { useConfig as f } from "./useConfig.js";
3
+ import { useSaveStart as v, useSaveComplete as S } from "./useGuidoActions.js";
4
+ import { useSyncModuleExtractor as x } from "./useSyncModuleExtractor.js";
5
+ import { useStripoApi as V } from "../services/stripoApi.js";
6
+ import { useTemplatePreparation as y } from "../utils/templatePreparation.js";
7
+ import { useHtmlValidator as w } from "./useHtmlValidator.js";
8
+ const k = () => {
9
+ const o = v(), s = S(), { validateHtml: i } = w(), { callbacks: a } = f(), { extractSyncModuleData: r } = x(), { setSyncModuleUnsubscriptionPages: n } = V(), { editorSave: l } = d();
10
+ return { save: async (c = !1) => {
10
11
  var e;
11
12
  o();
12
- const { prepareTemplateDetails: c } = x(), t = await c();
13
+ const { prepareTemplateDetails: m } = y(), t = await m();
13
14
  if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
14
15
  return;
15
- const { unsubscribePayload: m, stripoModules: u } = r(t.rawHtml);
16
- return await n(m), t.modules = u, l || s(t), t;
16
+ l();
17
+ const { unsubscribePayload: u, stripoModules: p } = r(t.rawHtml);
18
+ return await n(u), t.modules = p, c || s(t), t;
17
19
  } };
18
20
  };
19
21
  export {
20
- g as useSave
22
+ k as useSave
21
23
  };