@useinsider/guido 3.13.0 → 3.13.1-beta.88c2f20

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.
package/README.md CHANGED
@@ -134,7 +134,7 @@ const config: GuidoConfigInput = {
134
134
  // Optional: Editor settings
135
135
  editor?: {
136
136
  locale?: string, // Default: 'en'
137
- translationsPath?: string, // Default: 'window.trans.en'
137
+ translationsPath?: string, // Default: first locale registered on window.trans
138
138
  migrationDate?: number, // Stripo migration timestamp
139
139
  emailHeader?: {
140
140
  senderName?: string,
@@ -1,4 +1,7 @@
1
1
  import { ProductType as a, MessageType as o } from "./schemas.js";
2
+ const i = {
3
+ translationsPath: "window.trans[Object.keys(window.trans)[0]]"
4
+ };
2
5
  a.EMAIL;
3
6
  o.PROMOTIONAL;
4
7
  const e = [
@@ -33,12 +36,13 @@ const e = [
33
36
  "vikingsankara",
34
37
  "stripoeditorlivetest"
35
38
  ];
36
- function n(t) {
39
+ function s(t) {
37
40
  return e.includes(t);
38
41
  }
39
42
  export {
43
+ i as DEFAULT_EDITOR,
40
44
  o as MessageType,
41
45
  a as ProductType,
42
46
  e as TEST_PARTNERS,
43
- n as isTestPartner
47
+ s as isTestPartner
44
48
  };
@@ -1,5 +1,5 @@
1
- import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
- import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as f, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
1
+ import { ModuleFolderDefaults as f } from "../../enums/defaults.js";
2
+ import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as y, boolean as o, array as c, record as h, fallback as C, literal as i, looseObject as g, variant as R, union as k, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
3
3
  const d = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -12,7 +12,7 @@ const d = {
12
12
  ARCHITECT: 49,
13
13
  /** Unsubscribe page builder */
14
14
  UNSUBSCRIBE_PAGES: 97
15
- }, A = a({
15
+ }, I = a({
16
16
  /** Unique identifier for the template being edited */
17
17
  templateId: p(
18
18
  t(),
@@ -25,7 +25,7 @@ const d = {
25
25
  ),
26
26
  /** Optional variation ID for A/B testing */
27
27
  variationId: e(t())
28
- }), I = a({
28
+ }), A = a({
29
29
  /** Fallback font name (e.g., "Georgia") */
30
30
  name: t(),
31
31
  /** Fallback font family (e.g., "serif" or "sans-serif") */
@@ -53,7 +53,7 @@ const d = {
53
53
  /** Display name for the current user */
54
54
  username: e(t(), "Guido User"),
55
55
  /** Fallback font settings from partner settings — used to match backend size calculation */
56
- fallbackFont: e(I)
56
+ fallbackFont: e(A)
57
57
  }), v = a({
58
58
  /** Display text for the dynamic content */
59
59
  text: t(),
@@ -76,14 +76,14 @@ const d = {
76
76
  children: e(c(S)),
77
77
  // eslint-disable-next-line camelcase -- backend field name
78
78
  select_items: e(c(S))
79
- })), E = k(
79
+ })), E = h(
80
80
  t(),
81
81
  C(c(S), [])
82
82
  ), P = g({
83
83
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
84
84
  id: e(n()),
85
85
  /** Decimal places for price display (legacy data may use string or number) */
86
- decimalCount: e(f([t(), n()])),
86
+ decimalCount: e(k([t(), n()])),
87
87
  /** Pinned product IDs (empty array when filter-driven) */
88
88
  productIds: e(c(s())),
89
89
  /** Whether the block requested live products at send time */
@@ -117,7 +117,7 @@ const d = {
117
117
  /** Block type marker used by some legacy variants */
118
118
  blockType: e(t()),
119
119
  /** Size variant marker (legacy data may use string or number) */
120
- size: e(f([t(), n()])),
120
+ size: e(k([t(), n()])),
121
121
  /** Vertical responsiveness flag (legacy size=1 variants) */
122
122
  verticalResponsiveness: e(o()),
123
123
  /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
@@ -132,7 +132,7 @@ const d = {
132
132
  * strategy, currency, locale, and layout data.
133
133
  */
134
134
  recommendationConfigs: e(
135
- k(t(), P),
135
+ h(t(), P),
136
136
  {}
137
137
  )
138
138
  }), M = a({
@@ -158,6 +158,11 @@ const d = {
158
158
  selectedUnsubscribePages: e(c(n()), []),
159
159
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
160
160
  forceRecreate: e(o(), !1),
161
+ /**
162
+ * Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
163
+ * during migration so a rolled-back document never re-mints retired tracking ids.
164
+ */
165
+ trackIdCounter: e(n(), 0),
161
166
  /** Migration-only inputs (legacy block configs) */
162
167
  migration: e(D, {})
163
168
  }), N = a({
@@ -175,9 +180,9 @@ const d = {
175
180
  /** Email header settings */
176
181
  emailHeader: e(N, { senderName: "", subject: "" }),
177
182
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
178
- savedModulesFolderName: e(t(), y.SAVED_MODULES),
183
+ savedModulesFolderName: e(t(), f.SAVED_MODULES),
179
184
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
180
- defaultModulesFolderName: e(t(), y.DEFAULT_MODULES)
185
+ defaultModulesFolderName: e(t(), f.DEFAULT_MODULES)
181
186
  }), x = a({
182
187
  /** Whether to show the header bar */
183
188
  showHeader: e(o(), !0),
@@ -203,7 +208,9 @@ const d = {
203
208
  /** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
204
209
  autosave: e(o(), !1),
205
210
  /** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
206
- allowlistEnabled: e(o(), !1)
211
+ allowlistEnabled: e(o(), !1),
212
+ /** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
213
+ linkTrackingIds: e(o(), !1)
207
214
  }), U = r([
208
215
  "amp-accordion",
209
216
  "amp-carousel",
@@ -271,7 +278,7 @@ const d = {
271
278
  ...m.entries,
272
279
  type: i("custom"),
273
280
  /** Custom processor function */
274
- processor: h(
281
+ processor: y(
275
282
  (u) => typeof u == "function",
276
283
  "processor must be a function"
277
284
  )
@@ -291,7 +298,7 @@ const d = {
291
298
  * Return false to cancel the save operation.
292
299
  */
293
300
  externalValidation: e(
294
- h(
301
+ y(
295
302
  (u) => typeof u == "function",
296
303
  "externalValidation must be a function"
297
304
  )
@@ -299,7 +306,7 @@ const d = {
299
306
  }), K = a({
300
307
  // Required sections
301
308
  /** Identity configuration (required) */
302
- identity: A,
309
+ identity: I,
303
310
  /** Partner configuration (required) */
304
311
  partner: L,
305
312
  // Optional sections (with defaults)
@@ -331,10 +338,10 @@ export {
331
338
  v as DynamicContentSchema,
332
339
  O as EditorSchema,
333
340
  N as EmailHeaderSchema,
334
- I as FallbackFontSchema,
341
+ A as FallbackFontSchema,
335
342
  F as FeaturesSchema,
336
343
  K as GuidoConfigSchema,
337
- A as IdentitySchema,
344
+ I as IdentitySchema,
338
345
  P as LegacyRecommendationConfigSchema,
339
346
  d as MessageType,
340
347
  L as PartnerSchema,
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "5079a1c8"
15
+ "8d695bf5"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,49 +1,50 @@
1
- import { defineComponent as q, defineAsyncComponent as M, ref as U, computed as _, watch as B, onMounted as K, onUnmounted as V } from "vue";
2
- import { useCortexBlueprintBridge as j } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as Q } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as X } from "../composables/usePartner.js";
6
- import { useStripo as Y } from "../composables/useStripo.js";
7
- import { useTimerClone as Z } from "../composables/useTimerClone.js";
8
- import { migrate as I } from "../config/migrator/index.js";
1
+ import { defineComponent as j, defineAsyncComponent as R, ref as B, computed as O, watch as U, onMounted as J, onUnmounted as Q } from "vue";
2
+ import { useCortexBlueprintBridge as X } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as Y } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as Z } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as ee } from "../composables/usePartner.js";
6
+ import { useStripo as te } from "../composables/useStripo.js";
7
+ import { useTimerClone as oe } from "../composables/useTimerClone.js";
8
+ import { migrate as _ } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as ee } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as te } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import oe from "./organisms/AutoSaveController.vue.js";
13
- import ne from "./organisms/base/Toaster.vue.js";
14
- import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import se from "./organisms/header/HeaderWrapper.vue.js";
16
- import ie from "./organisms/LoadingWrapper.vue.js";
17
- import ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as de } from "../services/stripoApi.js";
20
- import { useConfigStore as me } from "../stores/config.js";
21
- import { useDynamicContentStore as le } from "../stores/dynamic-content.js";
22
- import { useEditorStore as O } from "../stores/editor.js";
23
- import { usePreviewStore as ue } from "../stores/preview.js";
24
- import { useTemplateStore as pe } from "../stores/template.js";
25
- import { useUnsubscribeStore as fe } from "../stores/unsubscribe.js";
26
- const xe = /* @__PURE__ */ q({
10
+ import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
11
+ import { useRecommendationExtensionStore as re } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
+ import se from "./organisms/AutoSaveController.vue.js";
13
+ import ae from "./organisms/base/Toaster.vue.js";
14
+ import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import ce from "./organisms/header/HeaderWrapper.vue.js";
16
+ import de from "./organisms/LoadingWrapper.vue.js";
17
+ import me from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import le from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as ue } from "../services/stripoApi.js";
20
+ import { useConfigStore as pe } from "../stores/config.js";
21
+ import { useDynamicContentStore as fe } from "../stores/dynamic-content.js";
22
+ import { useEditorStore as P } from "../stores/editor.js";
23
+ import { usePreviewStore as ye } from "../stores/preview.js";
24
+ import { useTemplateStore as ve } from "../stores/template.js";
25
+ import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
26
+ import { readTrackSeq as A } from "../utils/linkTrackingIds.js";
27
+ const ze = /* @__PURE__ */ j({
27
28
  __name: "Guido",
28
29
  props: {
29
30
  config: null,
30
31
  ready: { type: Boolean, default: !0 }
31
32
  },
32
33
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
33
- setup(P, { expose: A, emit: n }) {
34
- const i = P, W = M(
34
+ setup(W, { expose: x, emit: r }) {
35
+ const a = W, G = R(
35
36
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
36
- ), x = M(
37
+ ), H = R(
37
38
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
38
- ), g = U(), l = U(), u = le(), S = fe(), o = me();
39
- i.ready && o.init(i.config);
40
- const d = O(), G = ue(), m = _(() => d.hasChanges), { isTestPartner: H } = X(), h = () => {
39
+ ), S = B(), l = B(), u = fe(), g = Se(), o = pe();
40
+ a.ready && o.init(a.config);
41
+ const c = P(), $ = ye(), m = O(() => c.hasChanges), { isTestPartner: z } = ee(), h = () => {
41
42
  var t;
42
- return (t = g.value) == null ? void 0 : t.handleSave(!0);
43
+ return (t = S.value) == null ? void 0 : t.handleSave(!0);
43
44
  }, b = (t) => {
44
- d.loadingStatus = t;
45
+ c.loadingStatus = t;
45
46
  };
46
- j(), Q();
47
+ X(), Z();
47
48
  const p = () => {
48
49
  var t, e;
49
50
  return {
@@ -54,96 +55,101 @@ const xe = /* @__PURE__ */ q({
54
55
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
55
56
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
56
57
  };
57
- }, { initPlugin: E, preloadRuntime: w } = Y(), { getDefaultTemplate: C } = de(), { cloneTimersOnSave: D, hasTimerBlocks: T } = Z(), $ = _(() => {
58
+ }, { initPlugin: E, preloadRuntime: w } = te(), { getDefaultTemplate: k } = ue(), { cloneTimersOnSave: C, hasTimerBlocks: D } = oe(), q = O(() => {
58
59
  var t;
59
60
  return !((t = o.ui) != null && t.showHeader);
60
61
  });
61
- J({
62
+ Y({
62
63
  onBack: () => {
63
- console.debug("guido:back"), n("back");
64
+ console.debug("guido:back"), r("back");
64
65
  },
65
66
  onSaveStart: () => {
66
- console.debug("guido:save:start"), n("save:start");
67
+ console.debug("guido:save:start"), r("save:start");
67
68
  },
68
69
  onSaveComplete: (t) => {
69
70
  const e = { ...t, metadata: p() };
70
- console.debug("guido:save:complete", e), n("save:complete", e);
71
+ console.debug("guido:save:complete", e), r("save:complete", e);
71
72
  },
72
73
  onTestEmailClick: () => {
73
- console.debug("guido:test-email:click"), n("test-email:click");
74
+ console.debug("guido:test-email:click"), r("test-email:click");
74
75
  }
75
76
  });
76
- const L = (t) => {
77
+ const T = (t) => {
77
78
  console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
78
- }, R = () => {
79
+ }, I = () => {
79
80
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
80
81
  };
81
- B(() => m.value, () => {
82
- n("on-change", m.value);
82
+ U(() => m.value, () => {
83
+ r("on-change", m.value);
83
84
  });
84
85
  const f = (t) => {
85
- const e = t, { attribute: s, position: c } = e.detail;
86
- console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", s, c);
86
+ const e = t, { attribute: s, position: d } = e.detail;
87
+ console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
87
88
  };
88
- let a = null;
89
+ let i = null;
89
90
  const y = () => {
90
91
  var e;
91
- const t = document.querySelector(ee);
92
+ const t = document.querySelector(ne);
92
93
  (e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
93
94
  }, v = async () => {
94
95
  var t;
95
96
  try {
96
- o.initialized || o.init(i.config), d.templateId = o.templateId;
97
- const e = o.template, s = (e == null ? void 0 : e.html) || "", c = (e == null ? void 0 : e.css) || "", k = (e == null ? void 0 : e.preselectedDynamicContent) || [];
98
- S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
99
- const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
100
- let r = {
101
- html: s && await I(s, F),
102
- css: c
97
+ o.initialized || o.init(a.config), c.templateId = o.templateId;
98
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", F = (e == null ? void 0 : e.preselectedDynamicContent) || [];
99
+ g.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
100
+ const L = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, M = {
101
+ linkTrackingIds: o.isFeatureEnabled("linkTrackingIds"),
102
+ trackIdFloor: (e == null ? void 0 : e.trackIdCounter) || 0
103
103
  };
104
- r.html || (r = await C(), r.html = await I(r.html, F)), T(r.html) && (r.html = await D(r.html));
105
- const z = {
106
- preselectedDynamicContentList: k,
104
+ let n = {
105
+ html: s && await _(s, L, M),
106
+ css: d
107
+ };
108
+ n.html || (n = await k(), n.html = await _(n.html, L, M));
109
+ const K = A(n.html);
110
+ D(n.html) && (n.html = await C(n.html)), c.trackIdSessionFloor = Math.max(K, A(n.html));
111
+ const V = {
112
+ preselectedDynamicContentList: F,
107
113
  onReady: () => {
108
- console.debug("guido:ready"), n("ready");
114
+ console.debug("guido:ready"), r("ready");
109
115
  }
110
116
  };
111
- await E(r, p(), z), u.selectedDynamicContentList = k;
117
+ await E(n, p(), V), u.selectedDynamicContentList = F;
112
118
  } catch (e) {
113
119
  console.error("Failed to initialize Stripo editor:", e);
114
120
  }
115
121
  };
116
- return K(async () => {
122
+ return J(async () => {
117
123
  var e;
118
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), te().$reset(), O().$reset(), pe().$reset(), y();
124
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), re().$reset(), P().$reset(), ve().$reset(), y();
119
125
  const t = (e = l.value) == null ? void 0 : e.parentElement;
120
- if (t && (a = new ResizeObserver(y), a.observe(t)), w(), i.ready)
126
+ if (t && (i = new ResizeObserver(y), i.observe(t)), w(), a.ready)
121
127
  await v();
122
128
  else {
123
- const s = B(() => i.ready, (c) => {
124
- c && (s(), v());
129
+ const s = U(() => a.ready, (d) => {
130
+ d && (s(), v());
125
131
  });
126
132
  }
127
133
  document.addEventListener("dynamic-content:open", f);
128
- }), V(() => {
129
- a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", f);
134
+ }), Q(() => {
135
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", f);
130
136
  try {
131
137
  window.UIEditor.removeEditor();
132
138
  } catch {
133
139
  console.debug("Failed to remove Stripo editor: No editor found");
134
140
  }
135
141
  o.reset();
136
- }), A({
142
+ }), x({
137
143
  dynamicContent: {
138
- insert: L,
139
- close: R
144
+ insert: T,
145
+ close: I
140
146
  },
141
147
  hasChanges: m,
142
148
  saveSilent: h,
143
149
  setLoading: b
144
- }), { __sfc: !0, PreviewContainer: W, OnboardingWrapper: x, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: d, previewStore: G, hasChanges: m, isTestPartner: H, saveSilent: h, setLoading: b, emit: n, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: T, noHeader: $, insertDynamicContent: L, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: oe, Toaster: ne, FilterSelectionDrawer: re, HeaderWrapper: se, LoadingWrapper: ie, SaveAsTemplateDrawer: ae, UnsubscribeWrapper: ce };
150
+ }), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: H, headerWrapperRef: S, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: g, props: a, configStore: o, editorStore: c, previewStore: $, hasChanges: m, isTestPartner: z, saveSilent: h, setLoading: b, emit: r, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: k, cloneTimersOnSave: C, hasTimerBlocks: D, noHeader: q, insertDynamicContent: T, closeDynamicContent: I, handleDynamicContentOpen: f, ribbonObserver: i, updateRibbonOffset: y, startEditor: v, AutoSaveController: se, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: ce, LoadingWrapper: de, SaveAsTemplateDrawer: me, UnsubscribeWrapper: le };
145
151
  }
146
152
  });
147
153
  export {
148
- xe as default
154
+ ze as default
149
155
  };
@@ -1,7 +1,7 @@
1
- import { filterAmpErrors as w } from "../utils/ampErrorFilter.js";
1
+ import { filterAmpErrors as T } from "../utils/ampErrorFilter.js";
2
2
  import { useToaster as A } from "./useToaster.js";
3
- const D = () => {
4
- const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
3
+ const p = 1e4, D = () => {
4
+ const { handleError: n } = A(), m = (t = {}) => new Promise((e, a) => {
5
5
  const o = { ...{
6
6
  minimize: !0,
7
7
  utmEntity: {
@@ -21,28 +21,28 @@ const D = () => {
21
21
  forceAmp: !1,
22
22
  resetDataSavedFlag: !1,
23
23
  disableLineHeightsReplace: !0
24
- }, ...t }, l = {
25
- callback: (r, p, d, c, u) => {
24
+ }, ...t }, s = {
25
+ callback: (r, d, c, u, w) => {
26
26
  r ? a(r) : e({
27
- html: p,
28
- ampHtml: d,
29
- ampErrors: w(c ?? []),
30
- displayConditions: u
27
+ html: d,
28
+ ampHtml: c,
29
+ ampErrors: T(u ?? []),
30
+ displayConditions: w
31
31
  });
32
32
  },
33
33
  ...o
34
34
  };
35
- window.StripoEditorApi.actionsApi.compileEmail(l);
35
+ window.StripoEditorApi.actionsApi.compileEmail(s);
36
36
  });
37
37
  return {
38
- getCompiledEmail: s,
38
+ getCompiledEmail: m,
39
39
  getTemplateData: () => new Promise((t) => {
40
- const e = ({ html: a, css: i, width: o, height: m, utmParams: l, syncModulesIds: r }) => t({
40
+ const e = ({ html: a, css: i, width: o, height: l, utmParams: s, syncModulesIds: r }) => t({
41
41
  html: a,
42
42
  css: i,
43
43
  width: o,
44
- height: m,
45
- utmParams: l,
44
+ height: l,
45
+ utmParams: s,
46
46
  syncModulesIds: r
47
47
  });
48
48
  window.StripoEditorApi.actionsApi.getTemplateData(e);
@@ -57,7 +57,7 @@ const D = () => {
57
57
  displayConditions: a,
58
58
  ampHtml: i = "",
59
59
  ampErrors: o = []
60
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
+ } = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
61
61
  return {
62
62
  html: e,
63
63
  ampHtml: i,
@@ -87,9 +87,15 @@ const D = () => {
87
87
  n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
88
88
  }
89
89
  }),
90
- updateHtmlAndCss: (t, e) => {
91
- window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
92
- },
90
+ updateHtmlAndCss: (t, e) => new Promise((a, i) => {
91
+ const o = setTimeout(
92
+ () => i(new Error(`updateHtmlAndCss did not report completion within ${p}ms`)),
93
+ p
94
+ );
95
+ window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e, () => {
96
+ clearTimeout(o), a();
97
+ });
98
+ }),
93
99
  editorSave: () => new Promise((t) => {
94
100
  window.StripoEditorApi.actionsApi.save((e) => {
95
101
  if (e) {
@@ -1,43 +1,45 @@
1
- import { useActionsApi as T } from "./useActionsApi.js";
2
- import { useToaster as f } from "./useToaster.js";
3
- import { useTranslations as y } from "./useTranslations.js";
4
- import { ToasterTypeOptions as n } from "../enums/toaster.js";
5
- import { ref as v } from "vue";
6
- const E = 250, s = v({}), o = {}, j = () => {
7
- const { updateHtmlAndCss: l } = T(), { showToaster: p } = f(), i = y(), u = (e) => {
1
+ import { useActionsApi as f } from "./useActionsApi.js";
2
+ import { useToaster as y } from "./useToaster.js";
3
+ import { useTranslations as v } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as i } from "../enums/toaster.js";
5
+ import { ref as h } from "vue";
6
+ const E = 250, s = h({}), o = {}, k = () => {
7
+ const { updateHtmlAndCss: l } = f(), { showToaster: r } = y(), u = v(), T = (e) => {
8
8
  s.value[e] === void 0 && (s.value = { ...s.value, [e]: "pending" });
9
- }, c = (e, t, r) => {
9
+ }, c = (e, t) => {
10
+ s.value = { ...s.value, [e]: "failed" }, r({
11
+ type: i.Error,
12
+ message: t instanceof Error ? t.message : "Failed to apply template"
13
+ });
14
+ }, m = (e, t, p) => {
10
15
  s.value = { ...s.value, [e]: "applying" };
11
16
  try {
12
- l(t, r), s.value = { ...s.value, [e]: "applied" }, p({
13
- type: n.Success,
14
- message: i("newsletter.ai-template-applied")
17
+ l(t, p).catch((a) => c(e, a)), s.value = { ...s.value, [e]: "applied" }, r({
18
+ type: i.Success,
19
+ message: u("newsletter.ai-template-applied")
15
20
  });
16
21
  } catch (a) {
17
- s.value = { ...s.value, [e]: "failed" }, p({
18
- type: n.Error,
19
- message: a instanceof Error ? a.message : "Failed to apply template"
20
- });
22
+ c(e, a);
21
23
  }
22
- }, m = (e) => {
24
+ }, n = (e) => {
23
25
  const t = o[e];
24
26
  t && (clearTimeout(t), delete o[e]);
25
27
  };
26
- return { applyStatus: s, markPending: u, applyTemplate: (e, t) => {
27
- t.html && (m(e), c(e, t.html, t.css ?? ""));
28
+ return { applyStatus: s, markPending: T, applyTemplate: (e, t) => {
29
+ t.html && (n(e), m(e, t.html, t.css ?? ""));
28
30
  }, applyTemplateDebounced: (e, t) => {
29
31
  if (!t.html)
30
32
  return;
31
- m(e);
32
- const { html: r } = t, a = t.css ?? "";
33
+ n(e);
34
+ const { html: p } = t, a = t.css ?? "";
33
35
  o[e] = setTimeout(() => {
34
- delete o[e], c(e, r, a);
36
+ delete o[e], m(e, p, a);
35
37
  }, E);
36
38
  } };
37
- }, k = () => {
39
+ }, w = () => {
38
40
  Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
39
41
  };
40
42
  export {
41
- k as resetEmailTemplateApplier,
42
- j as useEmailTemplateApplier
43
+ w as resetEmailTemplateApplier,
44
+ k as useEmailTemplateApplier
43
45
  };
@@ -41,7 +41,7 @@ const O = () => {
41
41
  if (!a || a === n)
42
42
  return;
43
43
  const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
44
- l(a, T);
44
+ await l(a, T);
45
45
  } catch (n) {
46
46
  c(n, "Failed to update timer blocks");
47
47
  }
@@ -1,18 +1,20 @@
1
+ import "../@types/config/schemas.js";
2
+ import { DEFAULT_EDITOR } from "../@types/config/defaults.js";
1
3
  import memoize from "../node_modules/lodash-es/memoize.js";
2
4
  import { ref } from "vue";
3
5
  import { useConfig } from "./useConfig.js";
4
6
  const useTranslations = () => {
5
7
  var o, e;
6
- const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
7
- const r = translations.value[n];
8
- return r ? t ? Object.entries(t).reduce(
8
+ const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
9
+ const r = translations.value[t];
10
+ return r ? n ? Object.entries(n).reduce(
9
11
  (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
10
12
  r
11
- ) : r : (console.warn(`Translation key not found: ${n}`), n);
13
+ ) : r : (console.warn(`Translation key not found: ${t}`), t);
12
14
  };
13
15
  return memoize(
14
16
  trans,
15
- (n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
17
+ (t, n) => !n || Object.keys(n).length === 0 ? t : JSON.stringify({ key: t, params: n })
16
18
  );
17
19
  };
18
20
  export {