@useinsider/guido 3.30.0-beta.23d415d → 3.30.0-beta.2d741af

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +12 -18
  2. package/dist/@types/config/schemas.js +5 -7
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +110 -105
  5. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useHtmlCompiler.js +13 -15
  8. package/dist/composables/useModuleRepair.js +56 -50
  9. package/dist/composables/useStripo.js +85 -79
  10. package/dist/config/compiler/liquidCompilerRules.js +5 -13
  11. package/dist/config/migrator/index.js +10 -9
  12. package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
  13. package/dist/enums/academy.js +2 -1
  14. package/dist/extensions/DynamicContent/dynamic-content.js +33 -56
  15. package/dist/guido.css +1 -1
  16. package/dist/package.json.js +1 -1
  17. package/dist/src/@types/config/schemas.d.ts +0 -4
  18. package/dist/src/@types/generic.d.ts +0 -10
  19. package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
  20. package/dist/src/composables/useConfig.d.ts +0 -2
  21. package/dist/src/composables/useModuleRepair.d.ts +1 -1
  22. package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
  23. package/dist/src/enums/academy.d.ts +1 -0
  24. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +0 -11
  25. package/dist/src/stores/config.d.ts +0 -21
  26. package/dist/src/stores/editor.d.ts +54 -0
  27. package/dist/src/utils/genericUtil.d.ts +1 -6
  28. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
  29. package/dist/stores/editor.js +2 -0
  30. package/dist/utils/genericUtil.js +45 -55
  31. package/dist/utils/legacyUnsubscribeConversion.js +69 -28
  32. package/package.json +1 -1
  33. package/dist/src/utils/clipboardText.d.ts +0 -1
  34. package/dist/src/utils/linkTokenPaste.d.ts +0 -3
  35. package/dist/src/utils/liquidLinkQuotes.d.ts +0 -4
  36. package/dist/utils/clipboardText.js +0 -31
  37. package/dist/utils/linkTokenPaste.js +0 -28
  38. package/dist/utils/liquidLinkQuotes.js +0 -10
@@ -1,75 +1,81 @@
1
- import { useConfig as h } from "./useConfig.js";
2
- import { useToaster as v } from "./useToaster.js";
3
- import { useTranslations as M } from "./useTranslations.js";
4
- import { ModuleDynamicContentAttribute as T } from "../enums/dynamic-content.js";
5
- import { ToasterTypeOptions as A } from "../enums/toaster.js";
6
- import { itemsBlockDynamicVariables as O } from "../extensions/Blocks/Items/enums/productEnums.js";
1
+ import { useConfig as M } from "./useConfig.js";
2
+ import { useToaster as A } from "./useToaster.js";
3
+ import { useTranslations as T } from "./useTranslations.js";
4
+ import { ModuleDynamicContentAttribute as U } from "../enums/dynamic-content.js";
5
+ import { ToasterTypeOptions as O } from "../enums/toaster.js";
6
+ import { itemsBlockDynamicVariables as S } from "../extensions/Blocks/Items/enums/productEnums.js";
7
7
  import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
8
- import { useEditorStore as L } from "../stores/editor.js";
9
- import { useModuleDynamicContentStore as U } from "../stores/module-dynamic-content.js";
10
- import { buildDynamicContentLookup as _, convertModuleDynamicContent as F } from "../utils/dynamicContentConverter.js";
11
- import { stripPendingMarker as P } from "../utils/dynamicContentPendingMarker.js";
12
- import { flattenDynamicContentCandidates as S } from "../utils/genericUtil.js";
13
- import { repairItemsCurrencyAttributes as N } from "../utils/itemsCurrencyRepair.js";
14
- import { convertLegacyUnsubscribeInModuleHtml as R } from "../utils/legacyUnsubscribeConversion.js";
15
- import { extractUsedDynamicContent as k } from "../utils/registerUsedDynamicContent.js";
16
- const q = "dynamic-content.unresolved-attributes-on-drop", H = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
- let y = 0;
18
- const $ = (s) => {
19
- y += 1;
20
- const o = `${Date.now().toString(36)}-${y}`;
21
- return { html: s.replace(H, `$1 ${T.Pending}="${o}"`), id: o };
22
- }, I = (s, o) => {
8
+ import { useEditorStore as f } from "../stores/editor.js";
9
+ import { useModuleDynamicContentStore as F } from "../stores/module-dynamic-content.js";
10
+ import { buildDynamicContentLookup as L, convertModuleDynamicContent as _ } from "../utils/dynamicContentConverter.js";
11
+ import { stripPendingMarker as k } from "../utils/dynamicContentPendingMarker.js";
12
+ import { flattenDynamicContentCandidates as q } from "../utils/genericUtil.js";
13
+ import { repairItemsCurrencyAttributes as P } from "../utils/itemsCurrencyRepair.js";
14
+ import { convertAllUnsubscribeInModuleHtml as R, convertLegacyUnsubscribeInModuleHtml as H } from "../utils/legacyUnsubscribeConversion.js";
15
+ import { extractUsedDynamicContent as N } from "../utils/registerUsedDynamicContent.js";
16
+ const I = "dynamic-content.unresolved-attributes-on-drop", $ = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
+ let C = 0;
18
+ const x = (s) => {
19
+ C += 1;
20
+ const n = `${Date.now().toString(36)}-${C}`;
21
+ return { html: s.replace($, `$1 ${U.Pending}="${n}"`), id: n };
22
+ }, z = (s, n) => {
23
23
  try {
24
- const i = k(s, o.map(({ text: a, value: m }) => ({ text: a, value: m })));
24
+ const i = N(s, n.map(({ text: m, value: l }) => ({ text: m, value: l })));
25
25
  i.length > 0 && E().registerDynamicContent(i);
26
26
  } catch (i) {
27
27
  console.error("Failed to register module dynamic content:", i);
28
28
  }
29
- }, re = () => {
30
- const { template: s, isFeatureEnabled: o } = h(), { showToaster: i } = v(), a = M(), m = (r) => {
29
+ }, oe = () => {
30
+ const { template: s, isFeatureEnabled: n } = M(), { showToaster: i } = A(), m = T(), l = (o) => {
31
31
  var u, e;
32
- const t = o("liquidSyntax") ? [] : S((u = s.value) == null ? void 0 : u.dynamicContentList), c = _(t);
33
- return c.size === 0 ? { html: r, unresolved: [], ambiguous: [], candidates: t } : {
34
- ...F(
35
- r,
32
+ const r = n("liquidSyntax") ? [] : q((u = s.value) == null ? void 0 : u.dynamicContentList), c = L(r);
33
+ return c.size === 0 ? { html: o, unresolved: [], ambiguous: [], candidates: r } : {
34
+ ..._(
35
+ o,
36
36
  c,
37
- [...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...O]
37
+ [...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...S]
38
38
  ),
39
- candidates: t
39
+ candidates: r
40
40
  };
41
41
  };
42
- return { handleModuleAdd: (r, t) => {
42
+ return { handleModuleAdd: (o, r) => {
43
43
  var c, u;
44
44
  try {
45
- if ((r == null ? void 0 : r.action) !== "ADD" && (r == null ? void 0 : r.action) !== "COPY")
45
+ if ((o == null ? void 0 : o.action) !== "ADD" && (o == null ? void 0 : o.action) !== "COPY")
46
46
  return;
47
- const e = (c = t == null ? void 0 : t.getTargetNode) == null ? void 0 : c.call(t), l = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
48
- if (!e || typeof l != "string")
47
+ const e = (c = r == null ? void 0 : r.getTargetNode) == null ? void 0 : c.call(r), a = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
48
+ if (!e || typeof a != "string")
49
49
  return;
50
- let n = P(N(l, {
51
- convertToPriceFormat: o("itemsPriceFormatting")
52
- })), p = !1;
53
- o("legacyUnsubscribeConversion") && ({ html: n, converted: p } = R(n));
54
- const { html: f, unresolved: b, ambiguous: g, candidates: C } = m(n);
50
+ let t = k(P(a, {
51
+ convertToPriceFormat: n("itemsPriceFormatting")
52
+ })), b = !1, y = !1;
53
+ n("blockUnsubscribeLinks") ? { html: t, converted: y } = R(t) : n("legacyUnsubscribeConversion") && ({ html: t, converted: b } = H(t));
54
+ const { html: D, unresolved: v, ambiguous: g, candidates: h } = l(t);
55
55
  let d = null;
56
- if (n = f, g.length > 0 && ({ html: n, id: d } = $(n)), n !== l && t.modifyHtml(e).replaceWith(n), I(n, C), p)
56
+ if (t = D, g.length > 0 && ({ html: t, id: d } = x(t)), t !== a && r.modifyHtml(e).replaceWith(t), z(t, h), b)
57
57
  try {
58
- L().isLegacyUnsubscribeModalRequested = !0;
59
- } catch (D) {
60
- console.error("Failed to request the legacy unsubscribe modal:", D);
58
+ f().isLegacyUnsubscribeModalRequested = !0;
59
+ } catch (p) {
60
+ console.error("Failed to request the legacy unsubscribe modal:", p);
61
61
  }
62
- d && U().enqueue({ id: d, items: g }), b.length > 0 && i({
63
- type: A.Warning,
64
- message: a(q)
62
+ if (y)
63
+ try {
64
+ f().isSfmcUnsubscribeModalRequested = !0;
65
+ } catch (p) {
66
+ console.error("Failed to request the SFMC unsubscribe modal:", p);
67
+ }
68
+ d && F().enqueue({ id: d, items: g }), v.length > 0 && i({
69
+ type: O.Warning,
70
+ message: m(I)
65
71
  });
66
72
  } catch (e) {
67
73
  console.error("Failed to repair module on add:", e);
68
74
  }
69
- }, convertDynamicContent: m };
75
+ }, convertDynamicContent: l };
70
76
  };
71
77
  export {
72
- q as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
73
- I as registerUsedAttributes,
74
- re as useModuleRepair
78
+ I as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
79
+ z as registerUsedAttributes,
80
+ oe as useModuleRepair
75
81
  };
@@ -1,72 +1,70 @@
1
- import { useActionsApi as G } from "./useActionsApi.js";
1
+ import { useActionsApi as z } from "./useActionsApi.js";
2
2
  import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
3
- import { useBlocksConfig as X } from "./useBlocksConfig.js";
4
- import { useConfig as J } from "./useConfig.js";
3
+ import { useBlocksConfig as G } from "./useBlocksConfig.js";
4
+ import { useConfig as X } from "./useConfig.js";
5
5
  import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
6
- import { useFullStoryBridge as K } from "./useFullStoryBridge.js";
7
- import { useModuleRepair as Q } from "./useModuleRepair.js";
8
- import { useStripoEventHandler as W } from "./useStripoEventHandler.js";
9
- import { useStripoNotifications as Y } from "./useStripoNotifications.js";
10
- import { useToaster as Z } from "./useToaster.js";
11
- import { localePatch as ee } from "../config/i18n/index.js";
6
+ import { useFullStoryBridge as J } from "./useFullStoryBridge.js";
7
+ import { useModuleRepair as K } from "./useModuleRepair.js";
8
+ import { useStripoEventHandler as Q } from "./useStripoEventHandler.js";
9
+ import { useStripoNotifications as W } from "./useStripoNotifications.js";
10
+ import { useToaster as Y } from "./useToaster.js";
11
+ import { localePatch as Z } from "../config/i18n/index.js";
12
12
  import { en as F } from "../config/i18n/en/index.js";
13
- import { ToasterTypeOptions as te } from "../enums/toaster.js";
14
- import { useStripoApi as oe } from "../services/stripoApi.js";
15
- import re from "../static/styles/customEditorStyle.css.js";
16
- import { useEditorStore as A } from "../stores/editor.js";
17
- import { buildSpecialLinkGroups as ie, buildMergeTagEntries as ne, flattenDynamicContentList as se } from "../utils/genericUtil.js";
18
- import { listenForLinkTokenPaste as ae } from "../utils/linkTokenPaste.js";
19
- import { getStripoRuntimeBaseUrl as de } from "../utils/stripoRuntime.js";
20
- let d = null, P = !1;
21
- const Pe = (t) => {
22
- const { features: p, template: u, isFeatureEnabled: c } = J(), { handleError: f, showToaster: L } = Z(), { getToken: R, getCustomFonts: D, getSyncModulesStatus: U } = oe(), { handleEvent: V } = W(), { handleModuleAdd: I } = Q(), { restorePending: q } = $(), { getStripoBlocksConfig: x } = X(), { getStripoNotifications: O } = Y(), g = () => d || (d = new Promise((n, s) => {
13
+ import { ToasterTypeOptions as ee } from "../enums/toaster.js";
14
+ import { useStripoApi as te } from "../services/stripoApi.js";
15
+ import oe from "../static/styles/customEditorStyle.css.js";
16
+ import { useEditorStore as T } from "../stores/editor.js";
17
+ import { buildMergeTagEntries as re, flattenDynamicContentList as ie } from "../utils/genericUtil.js";
18
+ import { getStripoRuntimeBaseUrl as ne } from "../utils/stripoRuntime.js";
19
+ let d = null, A = !1;
20
+ const Be = (o) => {
21
+ const { features: m, template: p, isFeatureEnabled: f } = X(), { handleError: g, showToaster: P } = Y(), { getToken: U, getCustomFonts: R, getSyncModulesStatus: D } = te(), { handleEvent: V } = Q(), { handleModuleAdd: L } = K(), { restorePending: I } = $(), { getStripoBlocksConfig: O } = G(), { getStripoNotifications: q } = W(), S = () => d || (d = new Promise((n, a) => {
23
22
  if (document.getElementById("UiEditorScript")) {
24
23
  n();
25
24
  return;
26
25
  }
27
- const i = de();
26
+ const i = ne();
28
27
  if (!i) {
29
- s(
28
+ a(
30
29
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
31
30
  );
32
31
  return;
33
32
  }
34
- const a = `${i}UIEditor.js`, e = document.createElement("script");
35
- e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
36
- P = !0, n();
37
- }, e.onerror = () => {
38
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
39
- }, document.body.appendChild(e);
33
+ const s = `${i}UIEditor.js`, t = document.createElement("script");
34
+ t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
35
+ A = !0, n();
36
+ }, t.onerror = () => {
37
+ t.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
38
+ }, document.body.appendChild(t);
40
39
  }), d.catch(() => {
41
40
  d = null;
42
- }), d), H = async (n, s, i, a = [], e = !1, m = !1) => {
43
- var w, b, _, v, T;
44
- const o = A(), { html: S, css: y } = n, { baseBlocks: E, extensions: M } = await x();
45
- t.mark("blocks_config_ready");
46
- const C = ((w = p.value) == null ? void 0 : w.displayConditions) ?? !0, N = ((b = p.value) == null ? void 0 : b.modulesDisabled) ?? !1, h = c("dynamicContentSpecialLinks") ? ie((_ = u.value) == null ? void 0 : _.dynamicContentList, c("liquidSyntax")) : [], k = m || (((v = u.value) == null ? void 0 : v.forceRecreate) ?? !1), j = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
47
- t.setTemplate({ html: S, css: y, forceRecreate: k }), B().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
41
+ }), d), x = async (n, a, i, s = [], t = !1, c = !1) => {
42
+ var w, k, _, v;
43
+ const e = T(), { html: y, css: h } = n, { baseBlocks: C, extensions: H } = await O();
44
+ o.mark("blocks_config_ready");
45
+ const E = ((w = m.value) == null ? void 0 : w.displayConditions) ?? !0, M = ((k = m.value) == null ? void 0 : k.modulesDisabled) ?? !1, b = c || (((_ = p.value) == null ? void 0 : _.forceRecreate) ?? !1), N = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
+ o.setTemplate({ html: y, css: h, forceRecreate: b }), B().importCss(), o.mark("init_editor"), await window.UIEditor.initEditor(
48
47
  document.querySelector("#guido-editor"),
49
48
  {
50
- metadata: s,
51
- html: S,
52
- css: y,
53
- forceRecreate: k,
49
+ metadata: a,
50
+ html: y,
51
+ css: h,
52
+ forceRecreate: b,
54
53
  locale: "en",
55
54
  undoButtonSelector: "#guido__undo-button",
56
55
  redoButtonSelector: "#guido__redo-button",
57
56
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
58
57
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
59
58
  codeEditorButtonSelector: "#guido__code-button",
60
- customAppearanceMergetags: !c("liquidSyntax"),
59
+ customAppearanceMergetags: !f("liquidSyntax"),
61
60
  customAppearanceMergetagsBorderColor: "#f1f3fe",
62
61
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
63
- ...h.length > 0 ? { specialLinks: h } : {},
64
- customViewStyles: re,
65
- conditionsEnabled: C,
66
- customConditionsEnabled: C,
62
+ customViewStyles: oe,
63
+ conditionsEnabled: E,
64
+ customConditionsEnabled: E,
67
65
  enableXSSSecurity: !0,
68
- modulesDisabled: N,
69
- syncModulesEnabled: e,
66
+ modulesDisabled: M,
67
+ syncModulesEnabled: t,
70
68
  messageSettingsEnabled: !0,
71
69
  displayGmailAnnotations: !0,
72
70
  displayHiddenPreheader: !1,
@@ -76,56 +74,64 @@ const Pe = (t) => {
76
74
  copyPasteEnabled: !1,
77
75
  selectElementAfterDrop: !0,
78
76
  sameFontSizeForOutlook: !0,
79
- allowedScriptSourceDomains: j,
80
- ...E ? { baseBlocks: E } : {},
77
+ allowedScriptSourceDomains: N,
78
+ ...C ? { baseBlocks: C } : {},
81
79
  editorFonts: {
82
80
  showDefaultStandardFonts: !0,
83
81
  showDefaultNotStandardFonts: !0,
84
- customFonts: a
82
+ customFonts: s
85
83
  },
86
84
  mergeTags: [
87
85
  {
88
- entries: ne(
86
+ entries: re(
89
87
  i.preselectedDynamicContentList,
90
- se((T = u.value) == null ? void 0 : T.dynamicContentList),
91
- c("liquidSyntax")
88
+ ie((v = p.value) == null ? void 0 : v.dynamicContentList),
89
+ f("liquidSyntax")
92
90
  )
93
91
  }
94
92
  ],
95
93
  async onTokenRefreshRequest(r) {
96
94
  try {
97
- t.mark("token_start");
98
- const l = await R();
99
- t.mark("token_end"), r(l);
95
+ o.mark("token_start");
96
+ const l = await U();
97
+ o.mark("token_end"), r(l);
100
98
  } catch (l) {
101
- f(l, "Failed to refresh token");
99
+ g(l, "Failed to refresh token");
102
100
  }
103
101
  },
104
102
  onTemplateLoaded() {
105
103
  try {
106
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = G(), { injectFullStory: z } = K();
107
- B().importCss(), r(), z(), ae(), q(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
108
- o.hasChanges = !1;
109
- }, 1e3), t.markReady();
104
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = z(), { injectFullStory: j } = J();
105
+ B().importCss(), r(), j(), I(), l(), i.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
106
+ try {
107
+ if (e.isUnsubscribeConvertedOnLoad) {
108
+ const u = e.hasChanges;
109
+ e.hasChanges = !0, e.changeSeq += 1, e.isUnsubscribeConvertedOnLoad = !1, u && i.onLoadConversionSettled();
110
+ } else
111
+ e.hasChanges = !1;
112
+ } catch (u) {
113
+ console.error("Failed to settle the change state after template load:", u);
114
+ }
115
+ }, 1e3), o.markReady();
110
116
  } catch (r) {
111
- f(r, "Failed to load custom interface appearance");
117
+ g(r, "Failed to load custom interface appearance");
112
118
  }
113
119
  },
114
120
  onCodeEditorVisibilityChanged(r) {
115
- o.isCodeEditorOpen = r;
121
+ e.isCodeEditorOpen = r;
116
122
  },
117
123
  onEditorVisualModeChanged(r) {
118
- o.editorVisualMode = r.toLowerCase();
124
+ e.editorVisualMode = r.toLowerCase();
119
125
  },
120
126
  onVersionHistoryVisibilityChanged(r) {
121
- o.isVersionHistoryOpen = r;
127
+ e.isVersionHistoryOpen = r;
122
128
  },
123
129
  onDataChanged() {
124
- o.hasChanges = !0, o.changeSeq += 1;
130
+ e.hasChanges = !0, e.changeSeq += 1;
125
131
  },
126
132
  onEvent: V,
127
- onModuleAdd: I,
128
- notifications: O(),
133
+ onModuleAdd: L,
134
+ notifications: q(),
129
135
  // Stripo deselects the block on any click outside the canvas, so every surface
130
136
  // that belongs to the block's own flow has to be listed here (SD-153273).
131
137
  ignoreClickOutsideSelectors: [
@@ -135,35 +141,35 @@ const Pe = (t) => {
135
141
  ".in-modal-v2-wrapper",
136
142
  ".in-toasts-wrapper"
137
143
  ],
138
- extensions: M,
139
- localePatch: ee
144
+ extensions: H,
145
+ localePatch: Z
140
146
  }
141
147
  );
142
148
  };
143
- return { initPlugin: async (n, s, i, a = !1) => {
144
- const e = A();
149
+ return { initPlugin: async (n, a, i, s = !1) => {
150
+ const t = T();
145
151
  try {
146
- t.mark("plugin_start"), t.setScriptPreloaded(P), await g(), t.mark("script_ready");
147
- const [m, o] = await Promise.all([
148
- D(),
149
- U()
152
+ o.mark("plugin_start"), o.setScriptPreloaded(A), await S(), o.mark("script_ready");
153
+ const [c, e] = await Promise.all([
154
+ R(),
155
+ D()
150
156
  ]);
151
- t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await H(n, s, i, m, o, a);
157
+ o.mark("fonts_sync_ready"), t.syncModulesEnabled = e, await x(n, a, i, c, e, s);
152
158
  } catch {
153
- e.loadingStatus = !1, L({
154
- type: te.Error,
159
+ t.loadingStatus = !1, P({
160
+ type: ee.Error,
155
161
  message: F["An error has occurred. Please report the error code to support."],
156
162
  actionButton: {
157
163
  text: F["Reload page"],
158
164
  onClick: () => window.location.reload()
159
165
  }
160
- }), t.markFailed();
166
+ }), o.markFailed();
161
167
  }
162
168
  }, preloadRuntime: () => {
163
- g().catch(() => {
169
+ S().catch(() => {
164
170
  });
165
171
  } };
166
172
  };
167
173
  export {
168
- Pe as useStripo
174
+ Be as useStripo
169
175
  };
@@ -1,23 +1,15 @@
1
- import { COUPON_PLACEHOLDER_LIQUID as i, COUPON_PLACEHOLDER_DEFAULT as o } from "../../extensions/Blocks/CouponBlock/template.js";
2
- import { singleQuoteLiquidLinks as r } from "../../utils/liquidLinkQuotes.js";
3
- const s = [
1
+ import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
2
+ const o = [
4
3
  {
5
4
  id: "liquid-coupon-code",
6
5
  description: "Replace legacy coupon placeholder with liquid syntax",
7
6
  type: "replace",
8
- search: o,
9
- replacement: i,
7
+ search: i,
8
+ replacement: e,
10
9
  replaceAll: !0,
11
10
  priority: 50
12
- },
13
- {
14
- id: "liquid-single-quote-links",
15
- description: "Replace &quot; string literals with single quotes inside {{ }} tags of href and src values",
16
- type: "custom",
17
- processor: (e) => r(e),
18
- priority: 60
19
11
  }
20
12
  ];
21
13
  export {
22
- s as liquidCompilerRules
14
+ o as liquidCompilerRules
23
15
  };
@@ -5,16 +5,17 @@ import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
5
5
  import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
6
6
  import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
7
7
  import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
8
- import { migrateRadioButton as l } from "./radioButtonMigrator.js";
9
- import { migrateRecommendation as s } from "./recommendationMigrator.js";
10
- import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
11
- import { migrateRecommendationTitle as b } from "./recommendationTitleMigrator.js";
12
- import { migrateSocialIcons as k } from "./socialIconMigrator.js";
13
- import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
14
- const w = async (t, i = {}, o, r) => {
8
+ import { migrateRadioButton as s } from "./radioButtonMigrator.js";
9
+ import { migrateRecommendation as l } from "./recommendationMigrator.js";
10
+ import { migrateRecommendationPartnerScope as b } from "./recommendationPartnerMigrator.js";
11
+ import { migrateRecommendationTitle as d } from "./recommendationTitleMigrator.js";
12
+ import { migrateSfmcUnsubscribeText as k } from "./sfmcUnsubscribeTextMigrator.js";
13
+ import { migrateSocialIcons as u } from "./socialIconMigrator.js";
14
+ import { migrateUnsubscribe as x } from "./unsubscribeMigrator.js";
15
+ const N = async (t, i = {}, o, r) => {
15
16
  let m = t;
16
- return m = e(m), m = l(m), m = p(m), m = await P(m), m = a(m), m = s(m, i), o && (m = d(m, o)), m = b(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = k(m), m = c(m), m;
17
+ return m = e(m), m = s(m), m = k(m), m = p(m), m = await x(m), m = a(m), m = l(m, i), o && (m = b(m, o)), m = d(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = u(m), m = c(m), m;
17
18
  };
18
19
  export {
19
- w as migrate
20
+ N as migrate
20
21
  };
@@ -0,0 +1,20 @@
1
+ import { useConfigStore as s } from "../../stores/config.js";
2
+ import { useEditorStore as n } from "../../stores/editor.js";
3
+ import { hasAnyUnsubscribeClass as i, convertAllUnsubscribeInDocumentHtml as c } from "../../utils/legacyUnsubscribeConversion.js";
4
+ const a = (r) => {
5
+ try {
6
+ if (!i(r) || !s().isFeatureEnabled("blockUnsubscribeLinks"))
7
+ return r;
8
+ const { html: e, converted: o } = c(r);
9
+ if (o) {
10
+ const t = n();
11
+ t.isSfmcUnsubscribeModalRequested = !0, t.isUnsubscribeConvertedOnLoad = !0;
12
+ }
13
+ return e;
14
+ } catch (e) {
15
+ return console.error("SfmcUnsubscribeTextMigrator failed:", e), r;
16
+ }
17
+ };
18
+ export {
19
+ a as migrateSfmcUnsubscribeText
20
+ };
@@ -4,7 +4,8 @@ const e = "https://academy.insiderone.com", o = {
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
5
  EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
6
6
  EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`,
7
- LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`
7
+ LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`,
8
+ SFMC_RELAY: `${e}/docs/sfmc-relay`
8
9
  };
9
10
  export {
10
11
  o as ACADEMY_LINKS
@@ -1,40 +1,37 @@
1
1
  var c = Object.defineProperty;
2
- var d = (o, r, t) => r in o ? c(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
3
- var s = (o, r, t) => d(o, typeof r != "symbol" ? r + "" : r, t);
4
- import { useConfig as g } from "../../composables/useConfig.js";
5
- import { clipboardHtmlToPlainText as m } from "../../utils/clipboardText.js";
6
- import { findEditorShadowRoot as u } from "../../utils/editorShadowRoot.js";
7
- import { mergeTagToDynamicContent as h, dynamicContentToMergeTags as T } from "../../utils/genericUtil.js";
8
- import { UIElement as p, UIElementType as l, UEAttr as C, UIElementTagRegistry as y } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
- import { ExternalMergeTagsLibrary as L } from "./dynamic-content-modal.js";
10
- const a = "external-dynamic-content-ui-element", E = "button-add-dynamic-content";
11
- class v extends y {
12
- registerUiElements(r) {
13
- r[l.MERGETAGS] = a;
2
+ var g = (o, s, t) => s in o ? c(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
+ var r = (o, s, t) => g(o, typeof s != "symbol" ? s + "" : s, t);
4
+ import { useConfig as d } from "../../composables/useConfig.js";
5
+ import { findEditorShadowRoot as m } from "../../utils/editorShadowRoot.js";
6
+ import { mergeTagToDynamicContent as u, dynamicContentToMergeTags as h } from "../../utils/genericUtil.js";
7
+ import { UIElement as T, UIElementType as a, UEAttr as y, UIElementTagRegistry as C } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { ExternalMergeTagsLibrary as E } from "./dynamic-content-modal.js";
9
+ const l = "external-dynamic-content-ui-element", L = "button-add-dynamic-content";
10
+ class B extends C {
11
+ registerUiElements(s) {
12
+ s[a.MERGETAGS] = l;
14
13
  }
15
14
  }
16
- class P extends p {
15
+ class x extends T {
17
16
  constructor() {
18
17
  super(...arguments);
19
- s(this, "mergeTagsButton", null);
20
- s(this, "mergeTagsLibrary", null);
21
- s(this, "clickListener", null);
22
- s(this, "lastClickedElement", null);
23
- s(this, "lastClickedFrame", null);
24
- s(this, "mousedownListener", null);
25
- s(this, "clipboardWindow", null);
26
- s(this, "clipboardListener", (t) => this._writeTokenAsPlainText(t));
18
+ r(this, "mergeTagsButton", null);
19
+ r(this, "mergeTagsLibrary", null);
20
+ r(this, "clickListener", null);
21
+ r(this, "lastClickedElement", null);
22
+ r(this, "lastClickedFrame", null);
23
+ r(this, "mousedownListener", null);
27
24
  }
28
25
  getId() {
29
- return a;
26
+ return l;
30
27
  }
31
28
  onRender(t) {
32
29
  var e;
33
- this.mergeTagsButton = t.querySelector("#guido__btn-add-dynamic-content"), this.clickListener = this._onClick.bind(this), (e = this.mergeTagsButton) == null || e.addEventListener("click", this.clickListener), this._setupCoordinateTracking(), this._setupClipboardTracking();
30
+ this.mergeTagsButton = t.querySelector("#guido__btn-add-dynamic-content"), this.clickListener = this._onClick.bind(this), (e = this.mergeTagsButton) == null || e.addEventListener("click", this.clickListener), this._setupCoordinateTracking();
34
31
  }
35
32
  onDestroy() {
36
33
  var t;
37
- this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this._cleanupClipboardTracking(), this.mergeTagsButton = null, this.clickListener = null, this.lastClickedElement = null, this.lastClickedFrame = null;
34
+ this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this.mergeTagsButton = null, this.clickListener = null, this.lastClickedElement = null, this.lastClickedFrame = null;
38
35
  }
39
36
  _onClick() {
40
37
  this.openMergeTagLibrary();
@@ -48,7 +45,7 @@ class P extends p {
48
45
  onAttributeUpdated(t, e) {
49
46
  if (t !== "mergeTag" || !(e != null && e.value))
50
47
  return;
51
- const n = h(e), i = this._getLastClickedPosition();
48
+ const n = u(e), i = this._getLastClickedPosition();
52
49
  this.lastClickedElement = null, this.lastClickedFrame = null, this._openDynamicContentLibrary(n, i);
53
50
  }
54
51
  openMergeTagLibrary() {
@@ -60,12 +57,12 @@ class P extends p {
60
57
  * Dispatches event with dynamic content data and position
61
58
  */
62
59
  _openDynamicContentLibrary(t, e) {
63
- this.mergeTagsLibrary || (this.mergeTagsLibrary = new L()), this.mergeTagsLibrary.openMergeTagsLibrary(
60
+ this.mergeTagsLibrary || (this.mergeTagsLibrary = new E()), this.mergeTagsLibrary.openMergeTagsLibrary(
64
61
  t,
65
62
  (n) => {
66
63
  if (n.text && n.value) {
67
- const { isFeatureEnabled: i } = g();
68
- this.api.triggerValueChange(T([n], i("liquidSyntax"))[0]);
64
+ const { isFeatureEnabled: i } = d();
65
+ this.api.triggerValueChange(h([n], i("liquidSyntax"))[0]);
69
66
  } else
70
67
  this.api.triggerValueChange(null);
71
68
  },
@@ -94,32 +91,12 @@ class P extends p {
94
91
  i && (this.lastClickedElement = i, this.lastClickedFrame = t);
95
92
  }, t.contentWindow.document.addEventListener("mousedown", this.mousedownListener));
96
93
  }
97
- /**
98
- * Listens on the canvas window so it runs after Stripo's own copy handler
99
- */
100
- _setupClipboardTracking() {
101
- var e;
102
- this._cleanupClipboardTracking();
103
- const t = (e = this._getEditorFrame()) == null ? void 0 : e.contentWindow;
104
- t && (this.clipboardWindow = t, t.addEventListener("copy", this.clipboardListener), t.addEventListener("cut", this.clipboardListener));
105
- }
106
- _cleanupClipboardTracking() {
107
- var t, e;
108
- (t = this.clipboardWindow) == null || t.removeEventListener("copy", this.clipboardListener), (e = this.clipboardWindow) == null || e.removeEventListener("cut", this.clipboardListener), this.clipboardWindow = null;
109
- }
110
- /**
111
- * Link and image fields paste the plain flavour, where Stripo puts the chip label
112
- */
113
- _writeTokenAsPlainText({ clipboardData: t }) {
114
- const e = m((t == null ? void 0 : t.getData("text/html")) ?? "");
115
- e !== null && (t == null || t.setData("text/plain", e));
116
- }
117
94
  /**
118
95
  * Gets the editor iframe element
119
96
  */
120
97
  _getEditorFrame() {
121
98
  var e, n;
122
- const t = (e = u()) == null ? void 0 : e.querySelector("iframe");
99
+ const t = (e = m()) == null ? void 0 : e.querySelector("iframe");
123
100
  return (n = t == null ? void 0 : t.contentWindow) != null && n.document ? t : null;
124
101
  }
125
102
  /**
@@ -165,18 +142,18 @@ class P extends p {
165
142
  getTemplate() {
166
143
  return `
167
144
  <div>
168
- <${l.BUTTON}
145
+ <${a.BUTTON}
169
146
  id="guido__btn-add-dynamic-content"
170
147
  class="btn btn-primary"
171
- ${C.BUTTON.name}="${E}">
172
- <${l.ICON} src="plus" class="icon icon-button color-primary">
173
- </${l.ICON}>
148
+ ${y.BUTTON.name}="${L}">
149
+ <${a.ICON} src="plus" class="icon icon-button color-primary">
150
+ </${a.ICON}>
174
151
  ${this.api.translate("Add Dynamic Content")}
175
- </${l.BUTTON}>
152
+ </${a.BUTTON}>
176
153
  </div>`;
177
154
  }
178
155
  }
179
156
  export {
180
- v as DynamicContentTagRegistry,
181
- P as DynamicContentUiElementExtension
157
+ B as DynamicContentTagRegistry,
158
+ x as DynamicContentUiElementExtension
182
159
  };