@useinsider/guido 3.22.0 → 3.23.0-beta.86bed27

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
@@ -582,9 +582,9 @@ import '@useinsider/guido/style';
582
582
 
583
583
  ### Subpath entries
584
584
 
585
- Two surfaces also ship as their own entry points. Importing one pulls in only its
586
- own dependencies, so a consumer that needs the store or the tracking-id helpers
587
- never loads the editor:
585
+ Three surfaces also ship as their own entry points. Importing one pulls in only its
586
+ own dependencies, so a consumer that needs the store, the tracking-id helpers or the
587
+ runtime prefetch never loads the editor:
588
588
 
589
589
  ```typescript
590
590
  // Live editor state, published by the editor into the host's shared Pinia instance.
@@ -595,11 +595,42 @@ import type { GuidoEmailEditorState } from '@useinsider/guido/editor-state';
595
595
  // Persistent link ids for the click heatmap.
596
596
  import { assignTrackingIds, TRACK_ID_ATTRIBUTE } from '@useinsider/guido/tracking-ids';
597
597
  import type { TrackingIdResult } from '@useinsider/guido/tracking-ids';
598
+
599
+ // Start downloading the Stripo editor runtime before the editor opens.
600
+ import { prefetchGuidoRuntime } from '@useinsider/guido/prefetch';
598
601
  ```
599
602
 
600
- Both are re-exported from the root barrel as well; the subpath is what keeps the
603
+ All three are re-exported from the root barrel as well; the subpath is what keeps the
601
604
  editor out of the consumer's module graph.
602
605
 
606
+ ### Runtime prefetch
607
+
608
+ ```typescript
609
+ import { prefetchGuidoRuntime } from '@useinsider/guido/prefetch';
610
+
611
+ prefetchGuidoRuntime(); // e.g. when the user lands on the page that opens the editor
612
+ ```
613
+
614
+ Call it as early as the host knows an editor is likely to open. It appends one
615
+ `<link rel="prefetch" data-guido-prefetch>` per file of the pinned Stripo runtime
616
+ (`src/static/stripo-runtime-manifest.json`) from
617
+ `https://email-static.useinsider.com/guido/<stripo version>/`, so the files are in the
618
+ HTTP cache when `<Guido>` mounts. It only downloads: no Stripo code runs and the
619
+ editor's startup order does not change.
620
+
621
+ - Returns `void` and never throws.
622
+ - Idempotent: later calls add nothing.
623
+ - Adds nothing when the runtime is already loading or loaded (`#UiEditorScript` exists
624
+ or `window.UIEditor` is defined), when the browser does not support `rel="prefetch"`
625
+ (Safari by default), when `navigator.connection.saveData` is on, or when
626
+ `navigator.connection.effectiveType` is `slow-2g` or `2g`.
627
+ - The `guido_editor_open` metric reports it as `runtime_prefetch`: `none` (not called
628
+ before Guido's setup), `pending` (some files still downloading) or `done`.
629
+
630
+ After bumping `guido.stripo.version`, regenerate the file list with
631
+ `npm run stripo:manifest`; a unit test fails while the manifest's version differs from
632
+ the pinned one.
633
+
603
634
  ---
604
635
 
605
636
  ## Constants
@@ -12,7 +12,7 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "c5146fc5"
15
+ "f2154cb6"
16
16
  );
17
17
  const v = n.exports;
18
18
  export {
@@ -1,179 +1,189 @@
1
- import { defineComponent as ie, defineAsyncComponent as m, ref as W, computed as p, watch as G, onMounted as ce, onUnmounted as de } from "vue";
2
- import { useCortexBlueprintBridge as me } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as le } from "../composables/useEditorLock.js";
4
- import { provideGuidoActions as ue } from "../composables/useGuidoActions.js";
5
- import { useGuidoStateBridge as pe } from "../composables/useGuidoStateBridge.js";
6
- import { usePartner as fe } from "../composables/usePartner.js";
7
- import { useSaveValidationRollout as ye } from "../composables/useSaveValidationRollout.js";
8
- import { useStripo as ge } from "../composables/useStripo.js";
9
- import { useTimerClone as Se } from "../composables/useTimerClone.js";
10
- import { migrate as V } from "../config/migrator/index.js";
11
- import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
12
- import { RIBBON_SELECTOR as ve } from "../enums/onboarding.js";
13
- import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as be } from "../extensions/Blocks/Recommendation/store/recommendation.js";
14
- import { disposeUnsubscribeListeners as he } from "../extensions/Blocks/Unsubscribe/block.js";
15
- import Ee from "./organisms/AutoSaveController.vue.js";
16
- import we from "./organisms/base/AuthErrorModal.vue.js";
17
- import De from "./organisms/base/Toaster.vue.js";
18
- import Ce from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
19
- import ke from "./organisms/header/HeaderWrapper.vue.js";
20
- import Re from "./organisms/LoadingWrapper.vue.js";
21
- import Fe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
22
- import Le from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
23
- import Me from "./organisms/validation/ValidationErrorDrawer.vue.js";
24
- import { useStripoApi as Te } from "../services/stripoApi.js";
25
- import { useConfigStore as Ie } from "../stores/config.js";
26
- import { useDynamicContentStore as Ue } from "../stores/dynamic-content.js";
27
- import { useEditorStore as E } from "../stores/editor.js";
28
- import { usePreviewStore as Ae } from "../stores/preview.js";
29
- import { useSaveValidationStore as Be } from "../stores/save-validation.js";
30
- import { useTemplateStore as Ne } from "../stores/template.js";
31
- import { useUnsubscribeStore as Pe } from "../stores/unsubscribe.js";
32
- import { readTrackFloor as H } from "../utils/linkTrackingIds.js";
33
- const yt = /* @__PURE__ */ ie({
1
+ import { defineComponent as de, defineAsyncComponent as l, ref as W, computed as f, watch as G, onMounted as me, onUnmounted as le } from "vue";
2
+ import { useCortexBlueprintBridge as ue } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as pe } from "../composables/useEditorLock.js";
4
+ import { startEditorOpenMetrics as fe } from "../composables/useEditorOpenMetrics.js";
5
+ import { provideGuidoActions as ye } from "../composables/useGuidoActions.js";
6
+ import { useGuidoStateBridge as ge } from "../composables/useGuidoStateBridge.js";
7
+ import { usePartner as ve } from "../composables/usePartner.js";
8
+ import { useSaveValidationRollout as Se } from "../composables/useSaveValidationRollout.js";
9
+ import { useStripo as be } from "../composables/useStripo.js";
10
+ import { useTimerClone as he } from "../composables/useTimerClone.js";
11
+ import { migrate as Ee } from "../config/migrator/index.js";
12
+ import { ModuleFolderDefaults as H } from "../enums/defaults.js";
13
+ import { RIBBON_SELECTOR as we } from "../enums/onboarding.js";
14
+ import { useRecommendationExtensionStore as V, disposeStrategyPageReturnListeners as ke } from "../extensions/Blocks/Recommendation/store/recommendation.js";
15
+ import { disposeUnsubscribeListeners as Ce } from "../extensions/Blocks/Unsubscribe/block.js";
16
+ import De from "./organisms/AutoSaveController.vue.js";
17
+ import Ie from "./organisms/base/AuthErrorModal.vue.js";
18
+ import Fe from "./organisms/base/Toaster.vue.js";
19
+ import Me from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
20
+ import Re from "./organisms/header/HeaderWrapper.vue.js";
21
+ import Te from "./organisms/LoadingWrapper.vue.js";
22
+ import Le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
23
+ import Ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
24
+ import Ne from "./organisms/validation/ValidationErrorDrawer.vue.js";
25
+ import { useStripoApi as _e } from "../services/stripoApi.js";
26
+ import { useConfigStore as Ae } from "../stores/config.js";
27
+ import { useDynamicContentStore as Be } from "../stores/dynamic-content.js";
28
+ import { useEditorStore as w } from "../stores/editor.js";
29
+ import { usePreviewStore as Oe } from "../stores/preview.js";
30
+ import { useSaveValidationStore as Pe } from "../stores/save-validation.js";
31
+ import { useTemplateStore as xe } from "../stores/template.js";
32
+ import { useUnsubscribeStore as We } from "../stores/unsubscribe.js";
33
+ import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
34
+ const ht = /* @__PURE__ */ de({
34
35
  __name: "Guido",
35
36
  props: {
36
37
  config: null,
37
38
  ready: { type: Boolean, default: !0 }
38
39
  },
39
40
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
40
- setup(q, { expose: K, emit: r }) {
41
- const s = q, j = m(
41
+ setup(z, { expose: q, emit: a }) {
42
+ const s = z, n = fe(), K = l(
42
43
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
43
- ), J = m(
44
+ ), j = l(
44
45
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
45
- ), Q = m(
46
+ ), J = l(
46
47
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
47
- ), X = m(
48
+ ), Q = l(
48
49
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
49
- ), Y = m(
50
+ ), X = l(
50
51
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
51
- ), w = W(), f = W(), y = Ue(), D = Pe(), o = Ie();
52
+ ), k = W(), y = W(), g = Be(), C = We(), o = Ae();
52
53
  s.ready && o.init(s.config);
53
- const c = E(), Z = Ae(), l = p(() => c.hasChanges), { isTestPartner: ee } = fe(), { isEnabled: te, loadRollout: C } = ye(), k = () => {
54
+ const d = w(), Y = Oe(), u = f(() => d.hasChanges), { isTestPartner: Z } = ve(), { isEnabled: ee, loadRollout: D } = Se(), I = () => {
54
55
  var t;
55
- return (t = w.value) == null ? void 0 : t.handleSave(!0);
56
- }, R = (t) => {
57
- c.loadingStatus = t;
56
+ return (t = k.value) == null ? void 0 : t.handleSave(!0);
57
+ }, F = (t) => {
58
+ d.loadingStatus = t;
58
59
  };
59
- me(), pe();
60
- const g = () => {
60
+ ue(), ge();
61
+ const v = () => {
61
62
  var t, e;
62
63
  return {
63
64
  emailId: o.templateId,
64
65
  userId: o.userId,
65
66
  username: o.username,
66
67
  partnerName: o.partnerName,
67
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || $.SAVED_MODULES,
68
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || $.DEFAULT_MODULES
68
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || H.SAVED_MODULES,
69
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || H.DEFAULT_MODULES
69
70
  };
70
- }, { initPlugin: F, preloadRuntime: L } = ge(), { runExclusive: M, beginMount: T, isCurrentMount: S } = le();
71
- let u = 0;
72
- const { getDefaultTemplate: I } = Te(), { cloneTimersOnSave: U, hasTimerBlocks: A } = Se(), oe = p(() => {
71
+ }, { initPlugin: M, preloadRuntime: R } = be(n), { runExclusive: T, beginMount: L, isCurrentMount: S } = pe();
72
+ let p = 0;
73
+ const { getDefaultTemplate: U } = _e(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = he(), te = f(() => {
73
74
  var t;
74
75
  return !((t = o.ui) != null && t.showHeader);
75
- }), ne = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), re = p(
76
- () => !!z().recommendationConfigs.strategyId
76
+ }), oe = f(() => o.isFeatureEnabled("reusableRecommendationStrategy")), re = f(
77
+ () => !!V().recommendationConfigs.strategyId
77
78
  );
78
- ue({
79
+ ye({
79
80
  onBack: () => {
80
- console.debug("guido:back"), r("back");
81
+ console.debug("guido:back"), a("back");
81
82
  },
82
83
  onSaveStart: () => {
83
- console.debug("guido:save:start"), r("save:start");
84
+ console.debug("guido:save:start"), a("save:start");
84
85
  },
85
86
  onSaveComplete: (t) => {
86
- const e = { ...t, metadata: g() };
87
- console.debug("guido:save:complete", e), r("save:complete", e);
87
+ const e = { ...t, metadata: v() };
88
+ console.debug("guido:save:complete", e), a("save:complete", e);
88
89
  },
89
90
  onTestEmailClick: () => {
90
- console.debug("guido:test-email:click"), r("test-email:click");
91
+ console.debug("guido:test-email:click"), a("test-email:click");
91
92
  }
92
93
  });
93
- const B = (t) => {
94
- console.debug("dynamic-content:close", t), y.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
95
- }, N = () => {
94
+ const A = (t) => {
95
+ console.debug("dynamic-content:close", t), g.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
96
+ }, B = () => {
96
97
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
97
98
  };
98
- G(() => l.value, () => {
99
- r("on-change", l.value);
99
+ G(() => u.value, () => {
100
+ a("on-change", u.value);
100
101
  });
101
- const v = (t) => {
102
- const e = t, { attribute: a, position: d } = e.detail;
103
- console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", a, d);
102
+ const b = (t) => {
103
+ const e = t, { attribute: i, position: m } = e.detail;
104
+ console.debug("dynamic-content:open", e.detail), a("dynamic-content:open", i, m);
104
105
  };
105
- let i = null;
106
- const b = () => {
106
+ let c = null;
107
+ const h = () => {
107
108
  var e;
108
- const t = document.querySelector(ve);
109
- (e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
110
- }, h = async () => {
109
+ const t = document.querySelector(we);
110
+ (e = y.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
111
+ }, E = async () => {
111
112
  var t;
113
+ n.mark("host_ready");
112
114
  try {
113
- o.initialized || o.init(s.config), c.templateId = o.templateId;
114
- const e = o.template, a = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
115
- D.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
116
- const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, O = o.isFeatureEnabled("linkTrackingIds"), x = {
115
+ o.initialized || o.init(s.config), d.templateId = o.templateId, n.setContext({
116
+ partnerName: o.partnerName,
117
+ productType: o.productType,
118
+ templateId: o.templateId,
119
+ variationId: o.variationId
120
+ });
121
+ const e = o.template, i = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", O = (e == null ? void 0 : e.preselectedDynamicContent) || [];
122
+ C.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
123
+ const ne = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, P = o.isFeatureEnabled("linkTrackingIds"), ae = {
117
124
  partnerName: o.partnerName,
118
125
  campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
119
126
  rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
127
+ }, x = (ce) => n.timed(
128
+ "migration",
129
+ () => Ee(ce, ne, ae)
130
+ );
131
+ let r = {
132
+ html: i && await x(i),
133
+ css: m
120
134
  };
121
- let n = {
122
- html: a && await V(a, _, x),
123
- css: d
124
- };
125
- n.html || (n = await I(), n.html = await V(n.html, _, x));
126
- const ae = O ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
127
- A(n.html) && (n.html = await U(n.html)), O && (c.trackIdSessionFloor = Math.max(ae, H(n.html)));
135
+ r.html || (r = await n.timed("default_template", () => U()), r.html = await x(r.html));
136
+ const ie = P ? $(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
137
+ _(r.html) && (r.html = await n.timed("timer_clone", () => N(r.html))), P && (d.trackIdSessionFloor = Math.max(ie, $(r.html)));
128
138
  const se = {
129
- preselectedDynamicContentList: P,
139
+ preselectedDynamicContentList: O,
130
140
  onReady: () => {
131
- console.debug("guido:ready"), r("ready");
141
+ console.debug("guido:ready"), a("ready");
132
142
  }
133
143
  };
134
- u = T(), await F(n, g(), se), y.selectedDynamicContentList = P;
144
+ p = L(), await M(r, v(), se), g.selectedDynamicContentList = O;
135
145
  } catch (e) {
136
- console.error("Failed to initialize Stripo editor:", e);
146
+ console.error("Failed to initialize Stripo editor:", e), n.markFailed();
137
147
  }
138
148
  };
139
- return ce(async () => {
149
+ return me(async () => {
140
150
  var e;
141
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), E().$reset(), Ne().$reset(), Be().$reset(), C(), b();
142
- const t = (e = f.value) == null ? void 0 : e.parentElement;
143
- if (t && (i = new ResizeObserver(b), i.observe(t)), L(), s.ready)
144
- await h();
151
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), V().$reset(), w().$reset(), xe().$reset(), Pe().$reset(), D(), h();
152
+ const t = (e = y.value) == null ? void 0 : e.parentElement;
153
+ if (t && (c = new ResizeObserver(h), c.observe(t)), R(), s.ready)
154
+ await E();
145
155
  else {
146
- const a = G(() => s.ready, (d) => {
147
- d && (a(), h());
156
+ const i = G(() => s.ready, (m) => {
157
+ m && (i(), E());
148
158
  });
149
159
  }
150
- document.addEventListener("dynamic-content:open", v);
151
- }), de(() => {
152
- if (he(), be(), i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), S(u))
160
+ document.addEventListener("dynamic-content:open", b);
161
+ }), le(() => {
162
+ if (Ce(), ke(), n.dispose(), c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b), S(p))
153
163
  try {
154
- E().isStripoInitialized = !1;
164
+ w().isStripoInitialized = !1;
155
165
  } catch (t) {
156
166
  console.debug("Failed to close the editor readiness gate on unmount", t);
157
167
  }
158
- M(async () => {
159
- if (S(u))
168
+ T(async () => {
169
+ if (S(p))
160
170
  try {
161
171
  window.UIEditor.removeEditor();
162
172
  } catch {
163
173
  console.debug("Failed to remove Stripo editor: No editor found");
164
174
  }
165
175
  }), o.reset();
166
- }), K({
176
+ }), q({
167
177
  dynamicContent: {
168
- insert: B,
169
- close: N
178
+ insert: A,
179
+ close: B
170
180
  },
171
- hasChanges: l,
172
- saveSilent: k,
173
- setLoading: R
174
- }), { __sfc: !0, PreviewContainer: j, OnboardingWrapper: J, AssignStrategyDrawer: Q, RemoveStrategyModal: X, LegacyStrategyUpdatedModal: Y, headerWrapperRef: w, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: D, props: s, configStore: o, editorStore: c, previewStore: Z, hasChanges: l, isTestPartner: ee, isSaveValidationEnabled: te, loadRollout: C, saveSilent: k, setLoading: R, emit: r, buildMetadata: g, initPlugin: F, preloadRuntime: L, runExclusive: M, beginMount: T, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: I, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: oe, isRrsEnabled: ne, hasAssignedStrategy: re, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: Ee, AuthErrorModal: we, Toaster: De, FilterSelectionDrawer: Ce, HeaderWrapper: ke, LoadingWrapper: Re, SaveAsTemplateDrawer: Fe, UnsubscribeWrapper: Le, ValidationErrorDrawer: Me };
181
+ hasChanges: u,
182
+ saveSilent: I,
183
+ setLoading: F
184
+ }), { __sfc: !0, openMetrics: n, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: k, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: C, props: s, configStore: o, editorStore: d, previewStore: Y, hasChanges: u, isTestPartner: Z, isSaveValidationEnabled: ee, loadRollout: D, saveSilent: I, setLoading: F, emit: a, buildMetadata: v, initPlugin: M, preloadRuntime: R, runExclusive: T, beginMount: L, isCurrentMount: S, mountGeneration: p, getDefaultTemplate: U, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: te, isRrsEnabled: oe, hasAssignedStrategy: re, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: h, startEditor: E, AutoSaveController: De, AuthErrorModal: Ie, Toaster: Fe, FilterSelectionDrawer: Me, HeaderWrapper: Re, LoadingWrapper: Te, SaveAsTemplateDrawer: Le, UnsubscribeWrapper: Ue, ValidationErrorDrawer: Ne };
175
185
  }
176
186
  });
177
187
  export {
178
- yt as default
188
+ ht as default
179
189
  };
@@ -0,0 +1,167 @@
1
+ import { SYNC_MODULE_CLASS as w } from "./useSyncModuleExtractor.js";
2
+ import { readRuntimePrefetchState as S } from "../utils/runtimePrefetch.js";
3
+ import { getStripoVersion as R } from "../utils/stripoRuntime.js";
4
+ import M from "../package.json.js";
5
+ const A = [
6
+ "setup",
7
+ "host_ready",
8
+ "migration_start",
9
+ "migration_end",
10
+ "default_template_start",
11
+ "default_template_end",
12
+ "timer_clone_start",
13
+ "timer_clone_end",
14
+ "plugin_start",
15
+ "script_ready",
16
+ "fonts_sync_ready",
17
+ "blocks_config_ready",
18
+ "init_editor",
19
+ "token_start",
20
+ "token_end",
21
+ "ready"
22
+ ], m = "guido:open:", h = "total", p = [
23
+ ["host_wait", "setup", "host_ready"],
24
+ ["migration", "migration_start", "migration_end"],
25
+ ["default_template", "default_template_start", "default_template_end"],
26
+ ["timer_clone", "timer_clone_start", "timer_clone_end"],
27
+ ["script", "plugin_start", "script_ready"],
28
+ ["fonts_sync", "script_ready", "fonts_sync_ready"],
29
+ ["blocks_config", "fonts_sync_ready", "blocks_config_ready"],
30
+ ["editor_config", "blocks_config_ready", "init_editor"],
31
+ ["stripo_load", "init_editor", "ready"],
32
+ ["token", "token_start", "token_end"]
33
+ ], b = (e) => new RegExp(`(?:^|[\\s"'])(?:${e})(?=[\\s"'])`, "g"), N = /<img\b/gi, $ = b(w), L = /\srecommendation-id=/g, C = b("items-block-v2|esd-(?:cart|browsed|purchased)-items-block"), I = "esd-timer-id", f = {
34
+ html_bytes: null,
35
+ css_bytes: null,
36
+ image_count: null,
37
+ synced_module_count: null,
38
+ recommendation_block_count: null,
39
+ items_block_count: null,
40
+ has_timers: null,
41
+ force_recreate: null
42
+ };
43
+ let l = null;
44
+ const i = (e) => {
45
+ try {
46
+ e();
47
+ } catch (t) {
48
+ console.debug("guido:open: metrics step failed", t);
49
+ }
50
+ }, k = () => window.DD_RUM, g = (e, t) => e === void 0 || t === void 0 ? null : Math.round(t - e), _ = (e, t) => {
51
+ var r;
52
+ return ((r = e.match(t)) == null ? void 0 : r.length) ?? 0;
53
+ }, y = (e) => new TextEncoder().encode(e).length, O = (e) => {
54
+ if (!e)
55
+ return f;
56
+ try {
57
+ const { html: t, css: r, forceRecreate: o } = e;
58
+ return {
59
+ html_bytes: y(t),
60
+ css_bytes: y(r),
61
+ image_count: _(t, N),
62
+ synced_module_count: _(t, $),
63
+ recommendation_block_count: _(t, L),
64
+ items_block_count: _(t, C),
65
+ has_timers: t.includes(I),
66
+ force_recreate: o
67
+ };
68
+ } catch (t) {
69
+ return console.debug("guido:open: template weight failed", t), f;
70
+ }
71
+ }, E = () => {
72
+ i(() => {
73
+ A.forEach((e) => performance.clearMarks(`${m}${e}`)), [...p.map(([e]) => e), h].forEach((e) => performance.clearMeasures(`${m}${e}`));
74
+ });
75
+ }, c = (e, t) => {
76
+ if (e.finished || e.marks[t] !== void 0)
77
+ return;
78
+ const r = performance.now();
79
+ e.marks[t] = r, e === l && i(() => performance.mark(`${m}${t}`, { startTime: r }));
80
+ }, s = (e) => {
81
+ e.finished = !0, document.removeEventListener("visibilitychange", e.onVisibilityChange), window.removeEventListener("pagehide", e.onPageHide);
82
+ }, B = (e, t) => {
83
+ const { marks: r } = e, o = p.map(([n, a, d]) => [n, r[a], r[d]]);
84
+ o.push([h, r.setup, t]), o.forEach(([n, a, d]) => {
85
+ a !== void 0 && d !== void 0 && i(() => performance.measure(`${m}${n}`, { start: a, end: d }));
86
+ });
87
+ }, D = (e, t, r) => {
88
+ const { marks: o, context: n } = e, a = Object.fromEntries(
89
+ p.map(([d, v, P]) => [`${d}_ms`, g(o[v], o[P])])
90
+ );
91
+ return {
92
+ outcome: t,
93
+ open_ms: g(o.setup, r),
94
+ ...a,
95
+ script_preloaded: e.scriptPreloaded,
96
+ runtime_prefetch: e.runtimePrefetch,
97
+ ...O(e.template),
98
+ partner_name: (n == null ? void 0 : n.partnerName) ?? null,
99
+ product_type: (n == null ? void 0 : n.productType) ?? null,
100
+ template_id: (n == null ? void 0 : n.templateId) ?? null,
101
+ variation_id: (n == null ? void 0 : n.variationId) ?? null,
102
+ guido_version: M.version,
103
+ stripo_version: R(),
104
+ was_backgrounded: e.wasBackgrounded
105
+ };
106
+ }, u = (e, t) => {
107
+ i(() => {
108
+ const r = e.marks.ready ?? performance.now(), o = D(e, t, r);
109
+ e.template = null, e === l && B(e, r), console.debug("guido:open", o), i(() => {
110
+ var n, a;
111
+ return (a = (n = k()) == null ? void 0 : n.addAction) == null ? void 0 : a.call(n, "guido_editor_open", o);
112
+ });
113
+ });
114
+ }, T = (e) => {
115
+ e.finished || (s(e), u(e, "abandoned"));
116
+ }, H = () => {
117
+ const e = {
118
+ marks: {},
119
+ context: null,
120
+ template: null,
121
+ scriptPreloaded: null,
122
+ runtimePrefetch: null,
123
+ wasBackgrounded: document.visibilityState === "hidden",
124
+ finished: !1,
125
+ onVisibilityChange: () => {
126
+ document.visibilityState === "hidden" && (e.wasBackgrounded = !0);
127
+ },
128
+ onPageHide: () => T(e)
129
+ };
130
+ return e;
131
+ }, Y = (e) => ({
132
+ mark: (t) => c(e, t),
133
+ timed: async (t, r) => {
134
+ c(e, `${t}_start`);
135
+ const o = await r();
136
+ return c(e, `${t}_end`), o;
137
+ },
138
+ setContext: (t) => {
139
+ e.context = t;
140
+ },
141
+ setTemplate: (t) => {
142
+ e.template = t;
143
+ },
144
+ setScriptPreloaded: (t) => {
145
+ e.scriptPreloaded = t;
146
+ },
147
+ markReady: () => {
148
+ e.finished || (c(e, "ready"), s(e), i(() => {
149
+ var t, r;
150
+ return (r = (t = k()) == null ? void 0 : t.addTiming) == null ? void 0 : r.call(t, "guido_editor_ready");
151
+ }), setTimeout(() => u(e, "ready"), 0));
152
+ },
153
+ markFailed: () => {
154
+ e.finished || (s(e), u(e, "error"));
155
+ },
156
+ dispose: () => {
157
+ T(e), e === l && (E(), l = null);
158
+ }
159
+ }), K = () => {
160
+ const e = H();
161
+ return E(), l = e, i(() => {
162
+ e.runtimePrefetch = S();
163
+ }), document.addEventListener("visibilitychange", e.onVisibilityChange), window.addEventListener("pagehide", e.onPageHide), c(e, "setup"), Y(e);
164
+ };
165
+ export {
166
+ K as startEditorOpenMetrics
167
+ };
@@ -1,44 +1,54 @@
1
- import { useActionsApi as L } from "./useActionsApi.js";
2
- import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
- import { useConfig as H } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
- import { useModuleRepair as j } from "./useModuleRepair.js";
7
- import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
- import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
- import { useToaster as G } from "./useToaster.js";
10
- import { localePatch as J } from "../config/i18n/index.js";
11
- import { en as b } from "../config/i18n/en/index.js";
12
- import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
- import { useStripoApi as K } from "../services/stripoApi.js";
14
- import Q from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as k } from "../stores/editor.js";
16
- import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
- import Z from "../package.json.js";
18
- let n = null;
19
- const he = () => {
20
- const { features: c, template: u, isFeatureEnabled: p } = H(), { handleError: m, showToaster: v } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((r, s) => {
21
- var d;
1
+ import { useActionsApi as M } from "./useActionsApi.js";
2
+ import { useBlocksConfig as N } from "./useBlocksConfig.js";
3
+ import { useConfig as j } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as _ } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as z } from "./useFullStoryBridge.js";
6
+ import { useModuleRepair as $ } from "./useModuleRepair.js";
7
+ import { useStripoEventHandler as G } from "./useStripoEventHandler.js";
8
+ import { useStripoNotifications as X } from "./useStripoNotifications.js";
9
+ import { useToaster as J } from "./useToaster.js";
10
+ import { localePatch as K } from "../config/i18n/index.js";
11
+ import { en as B } from "../config/i18n/en/index.js";
12
+ import { ToasterTypeOptions as Q } from "../enums/toaster.js";
13
+ import { useStripoApi as W } from "../services/stripoApi.js";
14
+ import Y from "../static/styles/customEditorStyle.css.js";
15
+ import { useEditorStore as v } from "../stores/editor.js";
16
+ import { buildMergeTagEntries as Z, flattenDynamicContentList as ee } from "../utils/genericUtil.js";
17
+ import { getStripoRuntimeBaseUrl as te } from "../utils/stripoRuntime.js";
18
+ let d = null, T = !1;
19
+ const we = (e) => {
20
+ const { features: u, template: m, isFeatureEnabled: p } = j(), { handleError: f, showToaster: F } = J(), { getToken: A, getCustomFonts: P, getSyncModulesStatus: R } = W(), { handleEvent: U } = G(), { handleModuleAdd: V } = $(), { getStripoBlocksConfig: D } = N(), { getStripoNotifications: I } = X(), g = () => d || (d = new Promise((a, s) => {
22
21
  if (document.getElementById("UiEditorScript")) {
23
- r();
22
+ a();
24
23
  return;
25
24
  }
26
- const o = Z.guido, i = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
27
- e.id = "UiEditorScript", e.type = "module", e.src = i, e.onload = () => r(), e.onerror = () => {
28
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${i}`));
29
- }, document.body.appendChild(e);
30
- }), n.catch(() => {
31
- n = null;
32
- }), n), D = async (r, s, o, a = [], i = !1) => {
33
- var y, E, h, C;
34
- const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
- w().importCss(), await window.UIEditor.initEditor(
25
+ const i = te();
26
+ if (!i) {
27
+ s(
28
+ new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
29
+ );
30
+ return;
31
+ }
32
+ const n = `${i}UIEditor.js`, t = document.createElement("script");
33
+ t.id = "UiEditorScript", t.type = "module", t.src = n, t.onload = () => {
34
+ T = !0, a();
35
+ }, t.onerror = () => {
36
+ t.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${n}`));
37
+ }, document.body.appendChild(t);
38
+ }), d.catch(() => {
39
+ d = null;
40
+ }), d), L = async (a, s, i, n = [], t = !1) => {
41
+ var C, w, k, b;
42
+ const o = v(), { html: c, css: S } = a, { baseBlocks: y, extensions: q } = await D();
43
+ e.mark("blocks_config_ready");
44
+ const E = ((C = u.value) == null ? void 0 : C.displayConditions) ?? !0, x = ((w = u.value) == null ? void 0 : w.modulesDisabled) ?? !1, h = !!c || (((k = m.value) == null ? void 0 : k.forceRecreate) ?? !1), O = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
+ e.setTemplate({ html: c, css: S, forceRecreate: h }), _().importCss(), e.mark("init_editor"), await window.UIEditor.initEditor(
36
46
  document.querySelector("#guido-editor"),
37
47
  {
38
48
  metadata: s,
39
- html: d,
40
- css: P,
41
- forceRecreate: I,
49
+ html: c,
50
+ css: S,
51
+ forceRecreate: h,
42
52
  locale: "en",
43
53
  undoButtonSelector: "#guido__undo-button",
44
54
  redoButtonSelector: "#guido__redo-button",
@@ -48,12 +58,12 @@ const he = () => {
48
58
  customAppearanceMergetags: !p("liquidSyntax"),
49
59
  customAppearanceMergetagsBorderColor: "#f1f3fe",
50
60
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
51
- customViewStyles: Q,
52
- conditionsEnabled: S,
53
- customConditionsEnabled: S,
61
+ customViewStyles: Y,
62
+ conditionsEnabled: E,
63
+ customConditionsEnabled: E,
54
64
  enableXSSSecurity: !0,
55
- modulesDisabled: U,
56
- syncModulesEnabled: i,
65
+ modulesDisabled: x,
66
+ syncModulesEnabled: t,
57
67
  messageSettingsEnabled: !0,
58
68
  displayGmailAnnotations: !0,
59
69
  displayHiddenPreheader: !1,
@@ -63,55 +73,56 @@ const he = () => {
63
73
  copyPasteEnabled: !1,
64
74
  selectElementAfterDrop: !0,
65
75
  sameFontSizeForOutlook: !0,
66
- allowedScriptSourceDomains: q,
67
- ...g ? { baseBlocks: g } : {},
76
+ allowedScriptSourceDomains: O,
77
+ ...y ? { baseBlocks: y } : {},
68
78
  editorFonts: {
69
79
  showDefaultStandardFonts: !0,
70
80
  showDefaultNotStandardFonts: !0,
71
- customFonts: a
81
+ customFonts: n
72
82
  },
73
83
  mergeTags: [
74
84
  {
75
- entries: W(
76
- o.preselectedDynamicContentList,
77
- Y((C = u.value) == null ? void 0 : C.dynamicContentList),
85
+ entries: Z(
86
+ i.preselectedDynamicContentList,
87
+ ee((b = m.value) == null ? void 0 : b.dynamicContentList),
78
88
  p("liquidSyntax")
79
89
  )
80
90
  }
81
91
  ],
82
- async onTokenRefreshRequest(t) {
92
+ async onTokenRefreshRequest(r) {
83
93
  try {
84
- const l = await B();
85
- t(l);
94
+ e.mark("token_start");
95
+ const l = await A();
96
+ e.mark("token_end"), r(l);
86
97
  } catch (l) {
87
- m(l, "Failed to refresh token");
98
+ f(l, "Failed to refresh token");
88
99
  }
89
100
  },
90
101
  onTemplateLoaded() {
91
102
  try {
92
- const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
93
- w().importCss(), t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
94
- e.hasChanges = !1;
95
- }, 1e3);
96
- } catch (t) {
97
- m(t, "Failed to load custom interface appearance");
103
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = M(), { injectFullStory: H } = z();
104
+ _().importCss(), r(), H(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
105
+ o.hasChanges = !1;
106
+ }, 1e3), e.markReady();
107
+ } catch (r) {
108
+ f(r, "Failed to load custom interface appearance");
98
109
  }
99
110
  },
100
- onCodeEditorVisibilityChanged(t) {
101
- e.isCodeEditorOpen = t;
111
+ onCodeEditorVisibilityChanged(r) {
112
+ o.isCodeEditorOpen = r;
102
113
  },
103
- onEditorVisualModeChanged(t) {
104
- e.editorVisualMode = t.toLowerCase();
114
+ onEditorVisualModeChanged(r) {
115
+ o.editorVisualMode = r.toLowerCase();
105
116
  },
106
- onVersionHistoryVisibilityChanged(t) {
107
- e.isVersionHistoryOpen = t;
117
+ onVersionHistoryVisibilityChanged(r) {
118
+ o.isVersionHistoryOpen = r;
108
119
  },
109
120
  onDataChanged() {
110
- e.hasChanges = !0, e.changeSeq += 1;
121
+ o.hasChanges = !0, o.changeSeq += 1;
111
122
  },
112
- onEvent: F,
113
- onModuleAdd: A,
114
- notifications: _(),
123
+ onEvent: U,
124
+ onModuleAdd: V,
125
+ notifications: I(),
115
126
  // Stripo deselects the block on any click outside the canvas, so every surface
116
127
  // that belongs to the block's own flow has to be listed here (SD-153273).
117
128
  ignoreClickOutsideSelectors: [
@@ -121,35 +132,35 @@ const he = () => {
121
132
  ".in-modal-v2-wrapper",
122
133
  ".in-toasts-wrapper"
123
134
  ],
124
- extensions: R,
125
- localePatch: J
135
+ extensions: q,
136
+ localePatch: K
126
137
  }
127
138
  );
128
139
  };
129
- return { initPlugin: async (r, s, o) => {
130
- const a = k();
140
+ return { initPlugin: async (a, s, i) => {
141
+ const n = v();
131
142
  try {
132
- await f();
133
- const [i, e] = await Promise.all([
134
- M(),
135
- T()
143
+ e.mark("plugin_start"), e.setScriptPreloaded(T), await g(), e.mark("script_ready");
144
+ const [t, o] = await Promise.all([
145
+ P(),
146
+ R()
136
147
  ]);
137
- a.syncModulesEnabled = e, await D(r, s, o, i, e);
148
+ e.mark("fonts_sync_ready"), n.syncModulesEnabled = o, await L(a, s, i, t, o);
138
149
  } catch {
139
- a.loadingStatus = !1, v({
140
- type: X.Error,
141
- message: b["An error has occurred. Please report the error code to support."],
150
+ n.loadingStatus = !1, F({
151
+ type: Q.Error,
152
+ message: B["An error has occurred. Please report the error code to support."],
142
153
  actionButton: {
143
- text: b["Reload page"],
154
+ text: B["Reload page"],
144
155
  onClick: () => window.location.reload()
145
156
  }
146
- });
157
+ }), e.markFailed();
147
158
  }
148
159
  }, preloadRuntime: () => {
149
- f().catch(() => {
160
+ g().catch(() => {
150
161
  });
151
162
  } };
152
163
  };
153
164
  export {
154
- he as useStripo
165
+ we as useStripo
155
166
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-c5146fc5]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-c5146fc5]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-c5146fc5]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
1
+ @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-f2154cb6]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-f2154cb6]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-f2154cb6]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
package/dist/library.js CHANGED
@@ -1,20 +1,22 @@
1
1
  import { default as a } from "./components/Guido.vue.js";
2
- import { MessageType as t, ProductType as d } from "./@types/config/schemas.js";
2
+ import { MessageType as t, ProductType as f } from "./@types/config/schemas.js";
3
3
  import "./@types/config/defaults.js";
4
- import { getValidationErrors as s, isValidConfig as p, parseConfig as g, parseConfigSafe as m, validateConfig as n } from "./@types/config/validator.js";
5
- import { assignTrackingIds as u, readTrackFloor as x, readTrackSeq as T } from "./utils/linkTrackingIds.js";
4
+ import { getValidationErrors as p, isValidConfig as s, parseConfig as m, parseConfigSafe as g, validateConfig as n } from "./@types/config/validator.js";
5
+ import { assignTrackingIds as l, readTrackFloor as x, readTrackSeq as c } from "./utils/linkTrackingIds.js";
6
6
  import { useGuidoEmailEditorStore as C } from "./stores/guido-email-editor.js";
7
+ import { prefetchGuidoRuntime as E } from "./utils/runtimePrefetch.js";
7
8
  export {
8
9
  a as Guido,
9
10
  t as MessageType,
10
- d as ProductType,
11
- u as assignTrackingIds,
12
- s as getValidationErrors,
13
- p as isValidConfig,
14
- g as parseConfig,
15
- m as parseConfigSafe,
11
+ f as ProductType,
12
+ l as assignTrackingIds,
13
+ p as getValidationErrors,
14
+ s as isValidConfig,
15
+ m as parseConfig,
16
+ g as parseConfigSafe,
17
+ E as prefetchGuidoRuntime,
16
18
  x as readTrackFloor,
17
- T as readTrackSeq,
19
+ c as readTrackSeq,
18
20
  C as useGuidoEmailEditorStore,
19
21
  n as validateConfig
20
22
  };
@@ -1,7 +1,9 @@
1
- const o = { stripo: { version: "2.81.1" } }, s = {
2
- guido: o
1
+ const o = "3.23.0-beta.86bed27", s = { stripo: { version: "2.81.1" } }, e = {
2
+ version: o,
3
+ guido: s
3
4
  };
4
5
  export {
5
- s as default,
6
- o as guido
6
+ e as default,
7
+ s as guido,
8
+ o as version
7
9
  };
@@ -0,0 +1,4 @@
1
+ import { prefetchGuidoRuntime as r } from "../utils/runtimePrefetch.js";
2
+ export {
3
+ r as prefetchGuidoRuntime
4
+ };
@@ -0,0 +1,27 @@
1
+ export type TimedOpenPhase = 'migration' | 'default_template' | 'timer_clone';
2
+ declare const PHASES: readonly ["setup", "host_ready", "migration_start", "migration_end", "default_template_start", "default_template_end", "timer_clone_start", "timer_clone_end", "plugin_start", "script_ready", "fonts_sync_ready", "blocks_config_ready", "init_editor", "token_start", "token_end", "ready"];
3
+ export type OpenPhase = typeof PHASES[number];
4
+ export type OpenOutcome = 'ready' | 'error' | 'abandoned';
5
+ export interface OpenContext {
6
+ partnerName: string;
7
+ productType: number;
8
+ templateId: string;
9
+ variationId: string;
10
+ }
11
+ export interface OpenTemplate {
12
+ html: string;
13
+ css: string;
14
+ forceRecreate: boolean;
15
+ }
16
+ export interface EditorOpenMetrics {
17
+ mark: (phase: OpenPhase) => void;
18
+ timed: <T>(phase: TimedOpenPhase, task: () => Promise<T>) => Promise<T>;
19
+ setContext: (context: OpenContext) => void;
20
+ setTemplate: (template: OpenTemplate) => void;
21
+ setScriptPreloaded: (preloaded: boolean) => void;
22
+ markReady: () => void;
23
+ markFailed: () => void;
24
+ dispose: () => void;
25
+ }
26
+ export declare const startEditorOpenMetrics: () => EditorOpenMetrics;
27
+ export {};
@@ -1,5 +1,6 @@
1
+ import type { EditorOpenMetrics } from '@@/Composables/useEditorOpenMetrics';
1
2
  import type { Metadata, Options, Template } from '@@/Types/stripo';
2
- export declare const useStripo: () => {
3
+ export declare const useStripo: (openMetrics: EditorOpenMetrics) => {
3
4
  initPlugin: (template: Template, metadata: Metadata, options: Options) => Promise<void>;
4
5
  preloadRuntime: () => void;
5
6
  };
@@ -4,5 +4,6 @@ export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidat
4
4
  export { assignTrackingIds, readTrackFloor, readTrackSeq } from './public/trackingIds';
5
5
  export { useGuidoEmailEditorStore } from './public/editorState';
6
6
  export type { GuidoEmailEditorState } from './public/editorState';
7
+ export { prefetchGuidoRuntime } from './public/prefetchRuntime';
7
8
  export type { StripoEventType } from './@types/events';
8
9
  export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
@@ -0,0 +1 @@
1
+ export { prefetchGuidoRuntime } from '../utils/runtimePrefetch';
@@ -0,0 +1,4 @@
1
+ export type RuntimePrefetchState = 'none' | 'pending' | 'done';
2
+ export declare const RUNTIME_PREFETCH_ATTRIBUTE = "data-guido-prefetch";
3
+ export declare const prefetchGuidoRuntime: () => void;
4
+ export declare const readRuntimePrefetchState: () => RuntimePrefetchState;
@@ -0,0 +1,3 @@
1
+ /** Null when package.json does not pin `guido.stripo.version`. */
2
+ export declare const getStripoVersion: () => string | null;
3
+ export declare const getStripoRuntimeBaseUrl: () => string | null;
@@ -0,0 +1,9 @@
1
+ const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
2
+ version: s,
3
+ files: n
4
+ };
5
+ export {
6
+ i as default,
7
+ n as files,
8
+ s as version
9
+ };
@@ -0,0 +1,26 @@
1
+ import i from "../static/stripo-runtime-manifest.json.js";
2
+ import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
3
+ const n = "data-guido-prefetch", d = "pending", o = "settled", s = `link[${n}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, p = () => document.createElement("link").relList.supports("prefetch"), E = () => {
4
+ const { connection: e } = navigator;
5
+ return (e == null ? void 0 : e.saveData) === !0 || u.includes((e == null ? void 0 : e.effectiveType) ?? "");
6
+ }, m = (e) => {
7
+ const t = document.createElement("link"), r = () => t.setAttribute(n, o);
8
+ t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(n, d), t.addEventListener("load", r, { once: !0 }), t.addEventListener("error", r, { once: !0 }), document.head.appendChild(t);
9
+ }, T = () => {
10
+ try {
11
+ const e = c(), t = document.querySelector(s) !== null;
12
+ if (!e || t || !p() || a() || E())
13
+ return;
14
+ i.files.forEach((r) => m(`${e}${r}`));
15
+ } catch (e) {
16
+ console.debug("guido: runtime prefetch skipped", e);
17
+ }
18
+ }, g = () => {
19
+ const e = Array.from(document.querySelectorAll(s));
20
+ return e.length ? e.every((t) => t.getAttribute(n) === o) ? "done" : "pending" : "none";
21
+ };
22
+ export {
23
+ n as RUNTIME_PREFETCH_ATTRIBUTE,
24
+ T as prefetchGuidoRuntime,
25
+ g as readRuntimePrefetchState
26
+ };
@@ -0,0 +1,13 @@
1
+ import r from "../package.json.js";
2
+ const s = "https://email-static.useinsider.com/guido/", e = () => {
3
+ var o;
4
+ const t = r.guido;
5
+ return (o = t == null ? void 0 : t.stripo) == null ? void 0 : o.version;
6
+ }, n = () => {
7
+ const t = e();
8
+ return t ? `${s}${t}/` : null;
9
+ };
10
+ export {
11
+ n as getStripoRuntimeBaseUrl,
12
+ e as getStripoVersion
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.22.0",
3
+ "version": "3.23.0-beta.86bed27",
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",
@@ -22,6 +22,10 @@
22
22
  "types": "./dist/src/public/editorState.d.ts",
23
23
  "import": "./dist/public/editorState.js"
24
24
  },
25
+ "./prefetch": {
26
+ "types": "./dist/src/public/prefetchRuntime.d.ts",
27
+ "import": "./dist/public/prefetchRuntime.js"
28
+ },
25
29
  "./style": "./dist/guido.css"
26
30
  },
27
31
  "scripts": {
@@ -45,6 +49,7 @@
45
49
  "coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
46
50
  "test:mutation": "stryker run",
47
51
  "test:mutation:since": "CHANGED=$(git diff --name-only --diff-filter=AMR origin/develop...HEAD -- 'src/**/*.ts' ':(glob)src/components/organisms/onboarding/**/*.vue' ':(glob)src/components/organisms/header/**/*.vue' ':(glob)src/components/organisms/unsubscribe/**/*.vue' ':(glob)src/components/organisms/save-as-template/**/*.vue' ':(glob)src/components/organisms/email-preview/**/*.vue' ':(glob)src/components/wrappers/**/*.vue' 'src/components/Guido.vue' ':(exclude)src/**/*.test.ts' ':(exclude)src/**/index.ts' ':(exclude)src/@types/**' ':(exclude)src/enums/**' ':(exclude)src/mock/**' ':(exclude)src/**/_Boilerplate/**' | paste -sd, -); if [ -n \"$CHANGED\" ]; then stryker run --incremental --mutate \"$CHANGED\"; else echo \"No changed mutatable src files vs origin/develop\"; fi",
52
+ "stripo:manifest": "node scripts/stripo-runtime-manifest.mjs",
48
53
  "prepare": "husky",
49
54
  "preinstall": "rm -rf ./node_modules/.vite"
50
55
  },