@useinsider/guido 3.1.1-beta.58e1771 → 3.1.1-beta.5fce9b2

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,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}}) */
@@ -61,14 +68,14 @@ const m = {
61
68
  value: t()
62
69
  })
63
70
  )
64
- }), A = o({
71
+ }), R = o({
65
72
  /** Initial HTML content */
66
73
  html: e(t(), ""),
67
74
  /** Initial CSS content */
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
  ),
74
81
  /** Valid custom field attribute names from the partner's categorized fields */
@@ -77,12 +84,12 @@ const m = {
77
84
  selectedUnsubscribePages: e(c(p()), []),
78
85
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
79
86
  forceRecreate: e(a(), !1)
80
- }), R = o({
87
+ }), C = o({
81
88
  /** Sender display name */
82
89
  senderName: e(t(), ""),
83
90
  /** Email subject line */
84
91
  subject: e(t(), "")
85
- }), C = o({
92
+ }), T = o({
86
93
  /** Locale for the editor UI */
87
94
  locale: e(t(), "en"),
88
95
  /** Path to translations object */
@@ -90,17 +97,17 @@ const m = {
90
97
  /** Migration date for template compatibility */
91
98
  migrationDate: e(p(), 1759696858),
92
99
  /** Email header settings */
93
- emailHeader: e(R, { senderName: "", subject: "" }),
100
+ emailHeader: e(C, { senderName: "", subject: "" }),
94
101
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
95
102
  savedModulesFolderName: e(t(), b.SAVED_MODULES),
96
103
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
97
104
  defaultModulesFolderName: e(t(), b.DEFAULT_MODULES)
98
- }), T = o({
105
+ }), I = o({
99
106
  /** Whether to show the header bar */
100
107
  showHeader: e(a(), !0),
101
108
  /** Custom label for back button (if shown) */
102
109
  backButtonLabel: e(t())
103
- }), I = o({
110
+ }), E = o({
104
111
  /** Enable dynamic content insertion */
105
112
  dynamicContent: e(a(), !0),
106
113
  /** Enable save as template functionality */
@@ -115,7 +122,7 @@ const m = {
115
122
  unsubscribe: e(a(), !0),
116
123
  /** Disable modules panel in the editor */
117
124
  modulesDisabled: e(a(), !1)
118
- }), E = n([
125
+ }), g = n([
119
126
  "amp-accordion",
120
127
  "amp-carousel",
121
128
  "amp-form-controls",
@@ -129,7 +136,7 @@ const m = {
129
136
  "text-block",
130
137
  "timer-block",
131
138
  "video-block"
132
- ]), g = n([
139
+ ]), O = n([
133
140
  "dynamic-content",
134
141
  "checkbox-block",
135
142
  "radio-button-block",
@@ -137,66 +144,66 @@ const m = {
137
144
  "unsubscribe-block",
138
145
  "coupon-block",
139
146
  "items-block"
140
- ]), O = o({
147
+ ]), L = o({
141
148
  /** Default blocks to exclude from the editor */
142
149
  excludeDefaults: e(
143
- c(E),
150
+ c(g),
144
151
  []
145
152
  ),
146
153
  /** Custom blocks to include in the editor */
147
154
  includeCustoms: e(
148
- c(g),
155
+ c(O),
149
156
  []
150
157
  )
151
- }), l = o({
158
+ }), r = o({
152
159
  /** Unique identifier for the rule */
153
160
  id: t(),
154
161
  /** Human-readable description */
155
162
  description: e(t()),
156
163
  /** Priority for rule ordering (lower = earlier) */
157
164
  priority: p()
158
- }), L = o({
159
- ...l.entries,
160
- type: r("replace"),
165
+ }), M = o({
166
+ ...r.entries,
167
+ type: l("replace"),
161
168
  /** String to search for */
162
169
  search: t(),
163
170
  /** Replacement string */
164
171
  replacement: t(),
165
172
  /** Replace all occurrences (default: false) */
166
173
  replaceAll: e(a())
167
- }), M = o({
168
- ...l.entries,
169
- type: r("regex"),
174
+ }), N = o({
175
+ ...r.entries,
176
+ type: l("regex"),
170
177
  /** Regex pattern string */
171
178
  pattern: t(),
172
179
  /** Replacement string (supports $1, $2, etc.) */
173
180
  replacement: t(),
174
181
  /** Regex flags (e.g., 'gi') */
175
182
  flags: e(t())
176
- }), N = o({
177
- ...l.entries,
178
- type: r("remove"),
183
+ }), D = o({
184
+ ...r.entries,
185
+ type: l("remove"),
179
186
  /** Strings or patterns to remove */
180
187
  targets: c(t())
181
- }), D = o({
182
- ...l.entries,
183
- type: r("custom"),
188
+ }), v = o({
189
+ ...r.entries,
190
+ type: l("custom"),
184
191
  /** Custom processor function */
185
192
  processor: S(
186
193
  (i) => typeof i == "function",
187
194
  "processor must be a function"
188
195
  )
189
- }), v = k("type", [
190
- L,
196
+ }), U = k("type", [
191
197
  M,
192
198
  N,
193
- D
194
- ]), U = o({
199
+ D,
200
+ v
201
+ ]), x = o({
195
202
  /** Custom compiler rules to apply */
196
- customRules: e(c(v), []),
203
+ customRules: e(c(U), []),
197
204
  /** Skip default compiler rules */
198
205
  ignoreDefaultRules: e(a(), !1)
199
- }), x = o({
206
+ }), B = o({
200
207
  /**
201
208
  * External validation handler called before save completes.
202
209
  * Return false to cancel the save operation.
@@ -207,48 +214,49 @@ const m = {
207
214
  "externalValidation must be a function"
208
215
  )
209
216
  )
210
- }), F = o({
217
+ }), H = o({
211
218
  // Required sections
212
219
  /** Identity configuration (required) */
213
220
  identity: h,
214
221
  /** Partner configuration (required) */
215
- partner: y,
222
+ partner: f,
216
223
  // Optional sections (with defaults)
217
224
  /** Template content and presets */
218
- template: e(A, {}),
225
+ template: e(R, {}),
219
226
  /** Editor settings */
220
- editor: e(C, {}),
227
+ editor: e(T, {}),
221
228
  /** UI configuration */
222
- ui: e(T, {}),
229
+ ui: e(I, {}),
223
230
  /** Feature toggles */
224
- features: e(I, {}),
231
+ features: e(E, {}),
225
232
  /** Block configuration */
226
- blocks: e(O, {}),
233
+ blocks: e(L, {}),
227
234
  /** Compiler configuration */
228
- compiler: e(U, {}),
235
+ compiler: e(x, {}),
229
236
  /** Callbacks and event handlers */
230
- callbacks: e(x, {})
237
+ callbacks: e(B, {})
231
238
  });
232
239
  export {
233
- O as BlocksSchema,
234
- x as CallbacksSchema,
235
- v as CompilerRuleSchema,
236
- U as CompilerSchema,
237
- g as CustomBlockTypeSchema,
238
- D as CustomRuleSchema,
239
- E as DefaultBlockTypeSchema,
240
- f as DynamicContentSchema,
241
- C as EditorSchema,
242
- R as EmailHeaderSchema,
243
- I as FeaturesSchema,
244
- F as GuidoConfigSchema,
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,
252
+ H as GuidoConfigSchema,
245
253
  h as IdentitySchema,
246
254
  m as MessageType,
247
- y as PartnerSchema,
255
+ f as PartnerSchema,
248
256
  s as ProductType,
249
- M as RegexRuleSchema,
250
- N as RemoveRuleSchema,
251
- L as ReplaceRuleSchema,
252
- A as TemplateSchema,
253
- T as UISchema
257
+ N as RegexRuleSchema,
258
+ D as RemoveRuleSchema,
259
+ M as ReplaceRuleSchema,
260
+ R as TemplateSchema,
261
+ I as UISchema
254
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
- "870ebbaf"
13
+ "2cb418af"
14
14
  );
15
15
  const m = n.exports;
16
16
  export {
@@ -1,26 +1,17 @@
1
- import { defineComponent as u, ref as a, computed as p, watch as _ } from "vue";
2
- import { useActionsApi as f } from "../../../../composables/useActionsApi.js";
3
- import { useTranslations as v } from "../../../../composables/useTranslations.js";
4
- import { usePreviewStore as d } from "../../../../stores/preview.js";
5
- import { InTooltipV2 as h, InProgress as g } from "@useinsider/design-system-vue";
6
- const B = /* @__PURE__ */ u({
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({
7
6
  __name: "EmailSizeIndicator",
8
- setup(w) {
9
- const o = d(), { getCompiledEmail: s } = f(), t = 102, e = a(0), r = a({
10
- type: "success",
11
- value: 0
12
- }), i = p(() => `~${e.value} KB`), n = async () => {
13
- const { html: c } = await s({ minimize: !0, resetDataSavedFlag: !1 }), l = new TextEncoder().encode(c).byteLength;
14
- e.value = Math.round(l / 1024), r.value = {
15
- type: e.value < t ? "success" : "warning",
16
- value: Math.min(e.value, t)
17
- };
18
- }, m = v();
19
- return _(() => o.previewHtml, () => {
20
- n();
21
- }, { immediate: !0 }), { __sfc: !0, previewStore: o, getCompiledEmail: s, MAX_EMAIL_SIZE_IN_KB: t, htmlKB: e, progress: r, htmlSize: i, calculateProgress: n, trans: m, InProgress: g, InTooltipV2: h };
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 };
22
13
  }
23
14
  });
24
15
  export {
25
- B as default
16
+ z as default
26
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
  };
@@ -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
  };
@@ -11,6 +11,8 @@ class f {
11
11
  try {
12
12
  const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
13
13
  return i.length === 0 ? t : (i.forEach((r) => {
14
+ if (r.classList.contains("checkbox-block-v2"))
15
+ return;
14
16
  const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
15
17
  `<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
16
18
  "text/html"
@@ -22,7 +24,7 @@ class f {
22
24
  }
23
25
  }
24
26
  extractTextFromElement(t, e) {
25
- var o, u;
27
+ var o, d;
26
28
  const i = t.querySelector(`.${e}`);
27
29
  if (!i)
28
30
  return {
@@ -41,13 +43,13 @@ class f {
41
43
  align: i.getAttribute("align") || "left",
42
44
  styles: ""
43
45
  };
44
- const n = ((u = r.textContent) == null ? void 0 : u.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g);
46
+ const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
45
47
  return {
46
48
  text: n,
47
49
  isBold: a,
48
50
  isItalic: p,
49
51
  align: c,
50
- styles: d
52
+ styles: u
51
53
  };
52
54
  }
53
55
  buildTextBlock(t) {
@@ -1,28 +1,30 @@
1
- var b = Object.defineProperty;
2
- var f = (r, t, e) => t in r ? b(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var x = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
1
+ var x = Object.defineProperty;
2
+ var f = (r, t, e) => t in r ? x(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var b = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  import h from "../../extensions/Blocks/RadioButton/template.js";
5
5
  class T {
6
6
  constructor() {
7
- x(this, "parser");
7
+ b(this, "parser");
8
8
  this.parser = new DOMParser();
9
9
  }
10
10
  migrate(t) {
11
11
  try {
12
12
  const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
13
13
  return i.length === 0 ? t : (i.forEach((s) => {
14
- const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), y = this.parser.parseFromString(
14
+ if (s.classList.contains("radio-button-v2"))
15
+ return;
16
+ const n = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), o = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", o), y = this.parser.parseFromString(
15
17
  `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
16
18
  "text/html"
17
19
  ).querySelector(".radio-button-v2");
18
- y && s.parentNode && (y.setAttribute("id", o || ""), s.parentNode.replaceChild(y, s));
20
+ y && s.parentNode && (y.setAttribute("id", n || ""), s.parentNode.replaceChild(y, s));
19
21
  }), e.documentElement.outerHTML);
20
22
  } catch (e) {
21
23
  return console.error("RadioButtonMigrator failed:", e), t;
22
24
  }
23
25
  }
24
26
  extractTextFromElement(t, e) {
25
- var n, c;
27
+ var o, c;
26
28
  const i = t.querySelector(`.${e}`);
27
29
  if (!i)
28
30
  return {
@@ -36,16 +38,16 @@ class T {
36
38
  const s = i.querySelector("p");
37
39
  if (!s)
38
40
  return {
39
- text: ((n = i.textContent) == null ? void 0 : n.trim()) || (e === "ins-title" ? "Title" : "Description"),
41
+ text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
40
42
  isBold: !1,
41
43
  isItalic: !1,
42
44
  align: i.getAttribute("align") || "left",
43
45
  styles: "",
44
46
  classList: ""
45
47
  };
46
- const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
48
+ const n = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
47
49
  return {
48
- text: o,
50
+ text: n,
49
51
  isBold: p,
50
52
  isItalic: u,
51
53
  align: a,
@@ -66,8 +68,8 @@ class T {
66
68
  `;
67
69
  }
68
70
  removeStyleProperties(t, e) {
69
- return t ? e.reduce((s, o) => {
70
- const l = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
71
+ return t ? e.reduce((s, n) => {
72
+ const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
71
73
  return s.replace(l, "");
72
74
  }, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
73
75
  }
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-3b53a736],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-870ebbaf] .in-progress-wrapper__progress p span:last-child{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.editor-actions[data-v-acff76a8]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-a26d7792]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-a26d7792]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-a26d7792]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-29b9af29] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-d073b1dc] .vueperslides__bullets{pointer-events:none!important}[data-v-d073b1dc] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-3b53a736],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.editor-actions[data-v-acff76a8]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-a26d7792]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-a26d7792]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-a26d7792]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-29b9af29] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-d073b1dc] .vueperslides__bullets{pointer-events:none!important}[data-v-d073b1dc] .vueperslides__parallax-wrapper{height:110px!important}
@@ -1,34 +1,36 @@
1
1
  import { useHttp as c } from "../composables/useHttp.js";
2
- import { URLS as m } from "../enums/extensions/recommendationBlock.js";
2
+ import { URLS as i } from "../enums/extensions/recommendationBlock.js";
3
3
  const f = () => {
4
- const { get: o } = c();
5
- return {
4
+ const { get: r } = c(), a = void 0;
5
+ return console.error("[Guido] VITE_INS_RECOMMENDATION_CLIENT_ID is not set. Recommendation API requests will fail."), {
6
6
  fetchRecommendationCreateData: async () => {
7
7
  try {
8
- return (await o("/newsletter/recommendations/create-data")).data;
8
+ return (await r("/newsletter/recommendations/create-data")).data;
9
9
  } catch (e) {
10
10
  throw console.error("fetchUserModalState error:", e), e;
11
11
  }
12
12
  },
13
13
  fetchRecommendationFilters: async () => {
14
14
  try {
15
- const { data: e } = await o("/stripo/email-recommendation-attributes");
15
+ const { data: e } = await r("/stripo/email-recommendation-attributes");
16
16
  return e;
17
17
  } catch (e) {
18
18
  throw console.error("fetchRecommendationFilters error:", e), e;
19
19
  }
20
20
  },
21
- fetchRecommendationProducts: async (e, a) => {
21
+ fetchRecommendationProducts: async (e, s) => {
22
22
  var n;
23
23
  try {
24
- const t = decodeURIComponent(new URLSearchParams(Object.entries(a)).toString());
24
+ const t = decodeURIComponent(new URLSearchParams(Object.entries(s)).toString());
25
25
  console.debug("🏁 Recommendation API Query:", t);
26
- const { get: s } = c({
27
- headers: {}
28
- }), r = await s(
29
- `${m.RECOMMENDATION_API_URL}/v2/${e}?${t}`
26
+ const { get: m } = c({
27
+ headers: {
28
+ "X-CLIENT-ID": a
29
+ }
30
+ }), o = await m(
31
+ `${i.RECOMMENDATION_API_URL}/v2/${e}?${t}`
30
32
  );
31
- return ((n = r == null ? void 0 : r.data) == null ? void 0 : n.data) ?? [];
33
+ return ((n = o == null ? void 0 : o.data) == null ? void 0 : n.data) ?? [];
32
34
  } catch (t) {
33
35
  throw console.error("fetchRecommendationProducts error:", t), t;
34
36
  }
@@ -8,7 +8,7 @@
8
8
  * - Validation utilities
9
9
  */
10
10
  export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
- export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
11
+ export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, FallbackFont, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
12
12
  export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
13
13
  export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
14
14
  export type { ValidationResult, ValidationError, } from './validator';
@@ -47,6 +47,12 @@ export declare const IdentitySchema: v.ObjectSchema<{
47
47
  /**
48
48
  * Partner configuration - organization and product context
49
49
  */
50
+ export declare const FallbackFontSchema: v.ObjectSchema<{
51
+ /** Fallback font name (e.g., "Georgia") */
52
+ readonly name: v.StringSchema<undefined>;
53
+ /** Fallback font family (e.g., "serif" or "sans-serif") */
54
+ readonly family: v.StringSchema<undefined>;
55
+ }, undefined>;
50
56
  export declare const PartnerSchema: v.ObjectSchema<{
51
57
  /** Partner/organization name (required) */
52
58
  readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "partner.name is required">]>;
@@ -56,6 +62,13 @@ export declare const PartnerSchema: v.ObjectSchema<{
56
62
  readonly messageType: v.OptionalSchema<v.PicklistSchema<[1, 2], undefined>, 1>;
57
63
  /** Display name for the current user */
58
64
  readonly username: v.OptionalSchema<v.StringSchema<undefined>, "Guido User">;
65
+ /** Fallback font settings from partner settings — used to match backend size calculation */
66
+ readonly fallbackFont: v.OptionalSchema<v.ObjectSchema<{
67
+ /** Fallback font name (e.g., "Georgia") */
68
+ readonly name: v.StringSchema<undefined>;
69
+ /** Fallback font family (e.g., "serif" or "sans-serif") */
70
+ readonly family: v.StringSchema<undefined>;
71
+ }, undefined>, undefined>;
59
72
  }, undefined>;
60
73
  /**
61
74
  * Dynamic content item schema
@@ -403,6 +416,13 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
403
416
  readonly messageType: v.OptionalSchema<v.PicklistSchema<[1, 2], undefined>, 1>;
404
417
  /** Display name for the current user */
405
418
  readonly username: v.OptionalSchema<v.StringSchema<undefined>, "Guido User">;
419
+ /** Fallback font settings from partner settings — used to match backend size calculation */
420
+ readonly fallbackFont: v.OptionalSchema<v.ObjectSchema<{
421
+ /** Fallback font name (e.g., "Georgia") */
422
+ readonly name: v.StringSchema<undefined>;
423
+ /** Fallback font family (e.g., "serif" or "sans-serif") */
424
+ readonly family: v.StringSchema<undefined>;
425
+ }, undefined>, undefined>;
406
426
  }, undefined>;
407
427
  /** Template content and presets */
408
428
  readonly template: v.OptionalSchema<v.ObjectSchema<{
@@ -5,7 +5,7 @@
5
5
  * This ensures type definitions are always in sync with validation.
6
6
  * @module @types/config/types
7
7
  */
8
- import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, ExternalValidationHandler } from './schemas';
8
+ import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, FallbackFontSchema, ExternalValidationHandler } from './schemas';
9
9
  import type * as v from 'valibot';
10
10
  /**
11
11
  * Complete validated Guido configuration.
@@ -29,6 +29,8 @@ export type GuidoConfig = v.InferOutput<typeof GuidoConfigSchema>;
29
29
  export type IdentityConfig = v.InferOutput<typeof IdentitySchema>;
30
30
  /** Partner configuration (name, productType, messageType, username) */
31
31
  export type PartnerConfig = v.InferOutput<typeof PartnerSchema>;
32
+ /** Fallback font settings for backend size calculation alignment */
33
+ export type FallbackFont = v.InferOutput<typeof FallbackFontSchema>;
32
34
  /** Template configuration (html, css, dynamic content, unsubscribe pages) */
33
35
  export type TemplateConfig = v.InferOutput<typeof TemplateSchema>;
34
36
  /** Editor configuration (locale, translations, migration date, email header) */
@@ -44,7 +44,6 @@ export interface TooltipOptions {
44
44
  x: number;
45
45
  y: number;
46
46
  };
47
- preventXss?: boolean;
48
47
  }
49
48
  export type TextValueObject = {
50
49
  text: string;
@@ -17,6 +17,10 @@ export declare const useConfig: () => {
17
17
  productType: 60 | 49 | 97;
18
18
  messageType: 1 | 2;
19
19
  username: string;
20
+ fallbackFont?: {
21
+ name: string;
22
+ family: string;
23
+ } | undefined;
20
24
  };
21
25
  template: {
22
26
  html: string;
@@ -109,6 +113,10 @@ export declare const useConfig: () => {
109
113
  productType: 60 | 49 | 97;
110
114
  messageType: 1 | 2;
111
115
  username: string;
116
+ fallbackFont?: {
117
+ name: string;
118
+ family: string;
119
+ } | undefined;
112
120
  } | null>;
113
121
  template: import("vue").ComputedRef<{
114
122
  html: string;
@@ -22,6 +22,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
22
22
  productType: 60 | 49 | 97;
23
23
  messageType: 1 | 2;
24
24
  username: string;
25
+ fallbackFont?: {
26
+ name: string;
27
+ family: string;
28
+ } | undefined;
25
29
  };
26
30
  template: {
27
31
  html: string;
@@ -120,6 +124,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
120
124
  productType: 60 | 49 | 97;
121
125
  messageType: 1 | 2;
122
126
  username: string;
127
+ fallbackFont?: {
128
+ name: string;
129
+ family: string;
130
+ } | undefined;
123
131
  };
124
132
  template: {
125
133
  html: string;
@@ -218,6 +226,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
218
226
  productType: 60 | 49 | 97;
219
227
  messageType: 1 | 2;
220
228
  username: string;
229
+ fallbackFont?: {
230
+ name: string;
231
+ family: string;
232
+ } | undefined;
221
233
  };
222
234
  template: {
223
235
  html: string;
@@ -316,6 +328,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
316
328
  productType: 60 | 49 | 97;
317
329
  messageType: 1 | 2;
318
330
  username: string;
331
+ fallbackFont?: {
332
+ name: string;
333
+ family: string;
334
+ } | undefined;
319
335
  };
320
336
  template: {
321
337
  html: string;
@@ -414,6 +430,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
414
430
  productType: 60 | 49 | 97;
415
431
  messageType: 1 | 2;
416
432
  username: string;
433
+ fallbackFont?: {
434
+ name: string;
435
+ family: string;
436
+ } | undefined;
417
437
  };
418
438
  template: {
419
439
  html: string;
@@ -512,6 +532,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
512
532
  productType: 60 | 49 | 97;
513
533
  messageType: 1 | 2;
514
534
  username: string;
535
+ fallbackFont?: {
536
+ name: string;
537
+ family: string;
538
+ } | undefined;
515
539
  };
516
540
  template: {
517
541
  html: string;
@@ -610,6 +634,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
610
634
  productType: 60 | 49 | 97;
611
635
  messageType: 1 | 2;
612
636
  username: string;
637
+ fallbackFont?: {
638
+ name: string;
639
+ family: string;
640
+ } | undefined;
613
641
  };
614
642
  template: {
615
643
  html: string;
@@ -708,6 +736,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
708
736
  productType: 60 | 49 | 97;
709
737
  messageType: 1 | 2;
710
738
  username: string;
739
+ fallbackFont?: {
740
+ name: string;
741
+ family: string;
742
+ } | undefined;
711
743
  };
712
744
  template: {
713
745
  html: string;
@@ -806,6 +838,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
806
838
  productType: 60 | 49 | 97;
807
839
  messageType: 1 | 2;
808
840
  username: string;
841
+ fallbackFont?: {
842
+ name: string;
843
+ family: string;
844
+ } | undefined;
809
845
  };
810
846
  template: {
811
847
  html: string;
@@ -904,6 +940,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
904
940
  productType: 60 | 49 | 97;
905
941
  messageType: 1 | 2;
906
942
  username: string;
943
+ fallbackFont?: {
944
+ name: string;
945
+ family: string;
946
+ } | undefined;
907
947
  };
908
948
  template: {
909
949
  html: string;
@@ -1002,6 +1042,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1002
1042
  productType: 60 | 49 | 97;
1003
1043
  messageType: 1 | 2;
1004
1044
  username: string;
1045
+ fallbackFont?: {
1046
+ name: string;
1047
+ family: string;
1048
+ } | undefined;
1005
1049
  };
1006
1050
  template: {
1007
1051
  html: string;
@@ -1100,6 +1144,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1100
1144
  productType: 60 | 49 | 97;
1101
1145
  messageType: 1 | 2;
1102
1146
  username: string;
1147
+ fallbackFont?: {
1148
+ name: string;
1149
+ family: string;
1150
+ } | undefined;
1103
1151
  };
1104
1152
  template: {
1105
1153
  html: string;
@@ -1198,6 +1246,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1198
1246
  productType: 60 | 49 | 97;
1199
1247
  messageType: 1 | 2;
1200
1248
  username: string;
1249
+ fallbackFont?: {
1250
+ name: string;
1251
+ family: string;
1252
+ } | undefined;
1201
1253
  };
1202
1254
  template: {
1203
1255
  html: string;
@@ -1296,6 +1348,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1296
1348
  productType: 60 | 49 | 97;
1297
1349
  messageType: 1 | 2;
1298
1350
  username: string;
1351
+ fallbackFont?: {
1352
+ name: string;
1353
+ family: string;
1354
+ } | undefined;
1299
1355
  };
1300
1356
  template: {
1301
1357
  html: string;
@@ -1394,6 +1450,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1394
1450
  productType: 60 | 49 | 97;
1395
1451
  messageType: 1 | 2;
1396
1452
  username: string;
1453
+ fallbackFont?: {
1454
+ name: string;
1455
+ family: string;
1456
+ } | undefined;
1397
1457
  };
1398
1458
  template: {
1399
1459
  html: string;
@@ -1492,6 +1552,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1492
1552
  productType: 60 | 49 | 97;
1493
1553
  messageType: 1 | 2;
1494
1554
  username: string;
1555
+ fallbackFont?: {
1556
+ name: string;
1557
+ family: string;
1558
+ } | undefined;
1495
1559
  };
1496
1560
  template: {
1497
1561
  html: string;
@@ -1590,6 +1654,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1590
1654
  productType: 60 | 49 | 97;
1591
1655
  messageType: 1 | 2;
1592
1656
  username: string;
1657
+ fallbackFont?: {
1658
+ name: string;
1659
+ family: string;
1660
+ } | undefined;
1593
1661
  };
1594
1662
  template: {
1595
1663
  html: string;
@@ -1688,6 +1756,10 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1688
1756
  productType: 60 | 49 | 97;
1689
1757
  messageType: 1 | 2;
1690
1758
  username: string;
1759
+ fallbackFont?: {
1760
+ name: string;
1761
+ family: string;
1762
+ } | undefined;
1691
1763
  };
1692
1764
  template: {
1693
1765
  html: string;
@@ -7,6 +7,7 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
7
7
  templateHtml: string;
8
8
  isLoaded: boolean;
9
9
  isAMPErrorModalVisible: boolean;
10
+ emailSizeKB: number;
10
11
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
11
12
  previewHtml(): string;
12
13
  hasAMP: (state: {
@@ -16,6 +17,7 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
16
17
  templateHtml: string;
17
18
  isLoaded: boolean;
18
19
  isAMPErrorModalVisible: boolean;
20
+ emailSizeKB: number;
19
21
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
20
22
  hasAMPErrors: (state: {
21
23
  emailFormat: EmailFormat;
@@ -24,6 +26,7 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
24
26
  templateHtml: string;
25
27
  isLoaded: boolean;
26
28
  isAMPErrorModalVisible: boolean;
29
+ emailSizeKB: number;
27
30
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
28
31
  showAMPErrorButton(): boolean;
29
32
  isAMPResponsive(): boolean;
@@ -1,8 +1,9 @@
1
+ import type { FallbackFont } from '@@/Types/config';
1
2
  import type { CompilerRule, CompilationResult, HtmlCompiler } from '@@/Types/html-compiler';
2
3
  export declare class HtmlCompilerEngine implements HtmlCompiler {
3
4
  private rules;
4
5
  constructor(rules?: CompilerRule[]);
5
- compile(html: string, rules?: CompilerRule[]): CompilationResult;
6
+ compile(html: string, rules?: CompilerRule[], fallbackFont?: FallbackFont): CompilationResult;
6
7
  private applyRule;
7
8
  private applyReplaceRule;
8
9
  private applyRegexRule;
@@ -1,13 +1,14 @@
1
1
  import { defineStore as e } from "pinia";
2
- const s = () => ({
2
+ const i = () => ({
3
3
  emailFormat: "html",
4
4
  ampHtml: "",
5
5
  ampErrors: [],
6
6
  templateHtml: "",
7
7
  isLoaded: !1,
8
- isAMPErrorModalVisible: !1
8
+ isAMPErrorModalVisible: !1,
9
+ emailSizeKB: 0
9
10
  }), a = e("guidoPreview", {
10
- state: () => s(),
11
+ state: () => i(),
11
12
  getters: {
12
13
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
13
14
  previewHtml() {
@@ -1,70 +1,77 @@
1
- var y = Object.defineProperty;
2
- var g = (p, e, r) => e in p ? y(p, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : p[e] = r;
3
- var u = (p, e, r) => g(p, typeof e != "symbol" ? e + "" : e, r);
4
- import { useToaster as m } from "../composables/useToaster.js";
5
- class d {
1
+ var h = Object.defineProperty;
2
+ var f = (o, e, t) => e in o ? h(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var m = (o, e, t) => f(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { useToaster as x } from "../composables/useToaster.js";
5
+ const E = /font-family\s*:[^;}"']+/gi;
6
+ class T {
6
7
  constructor(e = []) {
7
- u(this, "rules");
8
+ m(this, "rules");
8
9
  this.rules = e;
9
10
  }
10
- compile(e, r) {
11
- const l = performance.now(), t = e, o = e.length;
11
+ compile(e, t, r) {
12
+ const n = performance.now(), l = e, c = e.length;
12
13
  let s = e;
13
- const a = [];
14
- (r || this.rules).sort((n, c) => n.priority - c.priority).forEach((n) => {
15
- const c = s.length;
16
- s = this.applyRule(s, n), s.length !== c && a.push(n.id);
14
+ const i = [];
15
+ (t || this.rules).sort((p, a) => p.priority - a.priority).forEach((p) => {
16
+ const a = s.length;
17
+ s = this.applyRule(s, p), s.length !== a && i.push(p.id);
17
18
  });
18
- const i = s.length, R = o > 0 ? (o - i) / o * 100 : 0;
19
+ const u = s.length, R = c > 0 ? (c - u) / c * 100 : 0, d = new TextEncoder().encode(s).byteLength;
20
+ let y = 0;
21
+ if (r && r.name && r.family) {
22
+ const p = (s.match(E) || []).length, a = `, ${r.name}, ${r.family}`;
23
+ y = p * new TextEncoder().encode(a).byteLength;
24
+ }
25
+ const g = Math.round((d + y) / 1024);
19
26
  return {
20
- originalHtml: t,
27
+ originalHtml: l,
21
28
  compiledHtml: s,
22
- appliedRules: a,
23
- // TODO: We can use stats for monitoring in the future
29
+ appliedRules: i,
30
+ estimatedSizeKB: g,
24
31
  stats: {
25
- originalSize: o,
26
- compiledSize: i,
32
+ originalSize: c,
33
+ compiledSize: u,
27
34
  reductionPercentage: R,
28
- executionTime: performance.now() - l
35
+ executionTime: performance.now() - n
29
36
  }
30
37
  };
31
38
  }
32
- applyRule(e, r) {
39
+ applyRule(e, t) {
33
40
  try {
34
- switch (r.type) {
41
+ switch (t.type) {
35
42
  case "replace":
36
- return this.applyReplaceRule(e, r);
43
+ return this.applyReplaceRule(e, t);
37
44
  case "regex":
38
- return this.applyRegexRule(e, r);
45
+ return this.applyRegexRule(e, t);
39
46
  case "remove":
40
- return this.applyRemoveRule(e, r);
47
+ return this.applyRemoveRule(e, t);
41
48
  case "custom":
42
- return this.applyCustomRule(e, r);
49
+ return this.applyCustomRule(e, t);
43
50
  default:
44
51
  return e;
45
52
  }
46
- } catch (l) {
47
- const { handleError: t } = m();
48
- return t(l, `Failed to apply rule ${r.id}:`), e;
53
+ } catch (r) {
54
+ const { handleError: n } = x();
55
+ return n(r, `Failed to apply rule ${t.id}:`), e;
49
56
  }
50
57
  }
51
- applyReplaceRule(e, r) {
52
- const { search: l, replacement: t, replaceAll: o = !0 } = r;
53
- return o ? e.replaceAll(l, t) : e.replace(l, t);
58
+ applyReplaceRule(e, t) {
59
+ const { search: r, replacement: n, replaceAll: l = !0 } = t;
60
+ return l ? e.replaceAll(r, n) : e.replace(r, n);
54
61
  }
55
- applyRegexRule(e, r) {
56
- const { pattern: l, replacement: t, flags: o = "g" } = r, s = new RegExp(l, o);
57
- return e.replace(s, t);
62
+ applyRegexRule(e, t) {
63
+ const { pattern: r, replacement: n, flags: l = "g" } = t, c = new RegExp(r, l);
64
+ return e.replace(c, n);
58
65
  }
59
- applyRemoveRule(e, r) {
60
- return r.targets.reduce((l, t) => t instanceof RegExp ? l.replace(t, "") : l.replaceAll(t, ""), e);
66
+ applyRemoveRule(e, t) {
67
+ return t.targets.reduce((r, n) => n instanceof RegExp ? r.replace(n, "") : r.replaceAll(n, ""), e);
61
68
  }
62
- applyCustomRule(e, r) {
63
- return r.processor(e);
69
+ applyCustomRule(e, t) {
70
+ return t.processor(e);
64
71
  }
65
72
  }
66
- const A = (p = []) => new d(p);
73
+ const H = (o = []) => new T(o);
67
74
  export {
68
- d as HtmlCompilerEngine,
69
- A as createHtmlCompiler
75
+ T as HtmlCompilerEngine,
76
+ H as createHtmlCompiler
70
77
  };
@@ -1,32 +1,32 @@
1
- import { useActionsApi as f } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
- import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
5
- import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
6
- const w = () => {
7
- const o = x(), e = y(), { getCompiledEmail: i, getTemplateData: s, editorSave: n } = f(), { compileHtml: a } = C();
1
+ import { useActionsApi as S } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as f } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { useDynamicContentStore as T } from "../stores/dynamic-content.js";
5
+ import { useUnsubscribeStore as x } from "../stores/unsubscribe.js";
6
+ const h = () => {
7
+ const o = T(), e = x(), { getCompiledEmail: i, getTemplateData: s } = S(), { compileHtml: n } = f();
8
8
  return {
9
9
  prepareTemplateDetails: async () => {
10
- const { html: m, ampHtml: r = "", ampErrors: c = [] } = await i({
10
+ const { html: a, ampHtml: m = "", ampErrors: r = [] } = await i({
11
11
  minimize: !0,
12
12
  resetDataSavedFlag: !1
13
- }), { html: l, css: p, syncModulesIds: u = [] } = await s();
13
+ }), { html: c, css: l, syncModulesIds: p = [] } = await s();
14
14
  e.selectedUnsubscribePages.length && await e.fetchTemplates();
15
- const { compiledHtml: d, stats: t, appliedRules: g } = a(m), S = o.getSelectedDynamicContentList, b = T();
16
- return n(), console.debug("HTML Compilation Stats:", {
15
+ const { compiledHtml: u, stats: t, appliedRules: d } = n(a), g = o.getSelectedDynamicContentList, b = C();
16
+ return console.debug("HTML Compilation Stats:", {
17
17
  originalSize: t.originalSize,
18
18
  compiledSize: t.compiledSize,
19
19
  reduction: `${t.reductionPercentage.toFixed(2)}%`,
20
- appliedRules: g,
20
+ appliedRules: d,
21
21
  executionTime: `${t.executionTime.toFixed(2)}ms`
22
22
  }), {
23
- dynamicContentList: S,
24
- compiledHtml: d,
25
- rawHtml: l,
26
- css: p,
27
- ampHtml: r,
28
- ampErrors: c,
29
- modules: u.map(Number),
23
+ dynamicContentList: g,
24
+ compiledHtml: u,
25
+ rawHtml: c,
26
+ css: l,
27
+ ampHtml: m,
28
+ ampErrors: r,
29
+ modules: p.map(Number),
30
30
  recommendation: {
31
31
  campaignUrls: b.recommendationCampaignUrls,
32
32
  configs: {}
@@ -40,5 +40,5 @@ const w = () => {
40
40
  };
41
41
  };
42
42
  export {
43
- w as useTemplatePreparation
43
+ h as useTemplatePreparation
44
44
  };
@@ -1,11 +1,10 @@
1
- const e = (s, t = {}) => ({
2
- id: s,
1
+ const o = (i, t = {}) => ({
2
+ id: i,
3
3
  dynamicPosition: t.dynamicPosition ?? !1,
4
4
  staticPosition: t.staticPosition ?? "bottom center",
5
5
  iconStatus: t.iconStatus ?? !1,
6
- offset: t.offset,
7
- preventXss: t.preventXss
6
+ offset: t.offset
8
7
  });
9
8
  export {
10
- e as getTooltipOptions
9
+ o as getTooltipOptions
11
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.58e1771",
3
+ "version": "3.1.1-beta.5fce9b2",
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",
@@ -33,7 +33,7 @@
33
33
  "license": "ISC",
34
34
  "dependencies": {
35
35
  "@stripoinc/ui-editor-extensions": "3.5.0",
36
- "@useinsider/design-system-vue": "0.14.28",
36
+ "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
37
37
  "@vueuse/core": "11.3.0",
38
38
  "lodash-es": "4.17.21",
39
39
  "pinia": "2.3.1",