@useinsider/guido 3.1.1-beta.4fc983e → 3.1.1-beta.513425d

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 (29) hide show
  1. package/dist/@types/config/schemas.js +9 -7
  2. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  3. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  4. package/dist/composables/useHtmlCompiler.js +19 -17
  5. package/dist/composables/useSave.js +17 -16
  6. package/dist/composables/useStripo.js +32 -32
  7. package/dist/composables/validators/useLiquidValidator.js +28 -0
  8. package/dist/config/compiler/liquidCompilerRules.js +14 -0
  9. package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
  10. package/dist/extensions/Blocks/CouponBlock/template.js +22 -13
  11. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
  13. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +79 -81
  14. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  15. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
  16. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
  17. package/dist/package.json.js +1 -1
  18. package/dist/src/@types/config/schemas.d.ts +4 -0
  19. package/dist/src/@types/generic.d.ts +1 -0
  20. package/dist/src/composables/useConfig.d.ts +2 -0
  21. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  22. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  23. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  24. package/dist/src/stores/config.d.ts +18 -0
  25. package/dist/static/styles/components/button.css.js +7 -13
  26. package/dist/static/styles/components/narrow-panel.css.js +0 -52
  27. package/dist/utils/templatePreparation.js +16 -14
  28. package/dist/utils/tooltipUtils.js +5 -4
  29. package/package.json +4 -4
@@ -114,7 +114,9 @@ const m = {
114
114
  /** Enable unsubscribe block */
115
115
  unsubscribe: e(a(), !0),
116
116
  /** Disable modules panel in the editor */
117
- modulesDisabled: e(a(), !1)
117
+ modulesDisabled: e(a(), !1),
118
+ /** Enable Liquid template syntax */
119
+ liquidSyntax: e(a(), !1)
118
120
  }), E = n([
119
121
  "amp-accordion",
120
122
  "amp-carousel",
@@ -191,12 +193,12 @@ const m = {
191
193
  M,
192
194
  N,
193
195
  D
194
- ]), U = o({
196
+ ]), x = o({
195
197
  /** Custom compiler rules to apply */
196
198
  customRules: e(c(v), []),
197
199
  /** Skip default compiler rules */
198
200
  ignoreDefaultRules: e(a(), !1)
199
- }), x = o({
201
+ }), U = o({
200
202
  /**
201
203
  * External validation handler called before save completes.
202
204
  * Return false to cancel the save operation.
@@ -225,15 +227,15 @@ const m = {
225
227
  /** Block configuration */
226
228
  blocks: e(O, {}),
227
229
  /** Compiler configuration */
228
- compiler: e(U, {}),
230
+ compiler: e(x, {}),
229
231
  /** Callbacks and event handlers */
230
- callbacks: e(x, {})
232
+ callbacks: e(U, {})
231
233
  });
232
234
  export {
233
235
  O as BlocksSchema,
234
- x as CallbacksSchema,
236
+ U as CallbacksSchema,
235
237
  v as CompilerRuleSchema,
236
- U as CompilerSchema,
238
+ x as CompilerSchema,
237
239
  g as CustomBlockTypeSchema,
238
240
  D as CustomRuleSchema,
239
241
  E as DefaultBlockTypeSchema,
@@ -1,17 +1,17 @@
1
- import o from "./RightSlot.vue2.js";
2
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var n = function() {
4
- var r = this, t = r._self._c, e = r._self._setupProxy;
5
- return t("div", { staticClass: "d-f" }, [e.editorStore.isVersionHistoryOpen ? t(e.RestoreButton) : t(e.EditorActions, { ref: "editorActionsRef" })], 1);
6
- }, i = [], _ = /* @__PURE__ */ s(
7
- o,
8
- n,
1
+ import i from "./RightSlot.vue2.js";
2
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var o = function() {
4
+ var s = this, e = s._self._c, t = s._self._setupProxy;
5
+ return e("div", { staticClass: "d-f a-i-c" }, [t.isLiquidEnabled && !t.editorStore.isVersionHistoryOpen ? e(t.InChips, { staticClass: "mr-3", attrs: { id: "guido__liquid-tag-chip", styles: "stroke", type: "default", value: "liquid-tags", "close-button": !1, "disabled-status": t.editorStore.loadingStatus, interactive: !1, text: t.trans("email-editor.liquid-tags-enabled") } }) : s._e(), t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : e(t.EditorActions, { ref: "editorActionsRef" })], 1);
6
+ }, a = [], n = /* @__PURE__ */ r(
9
7
  i,
8
+ o,
9
+ a,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const l = _.exports;
14
+ const u = n.exports;
15
15
  export {
16
- l as default
16
+ u as default
17
17
  };
@@ -1,19 +1,22 @@
1
- import { defineComponent as i, ref as s } from "vue";
2
- import { useEditorStore as m } from "../../../stores/editor.js";
3
- import f from "./EditorActions.vue.js";
4
- import a from "./version-history/RestoreButton.vue.js";
5
- const l = /* @__PURE__ */ i({
1
+ import { defineComponent as a, ref as f, computed as p } from "vue";
2
+ import { useConfig as u } from "../../../composables/useConfig.js";
3
+ import { useTranslations as d } from "../../../composables/useTranslations.js";
4
+ import { useEditorStore as c } from "../../../stores/editor.js";
5
+ import { InChips as l } from "@useinsider/design-system-vue";
6
+ import _ from "./EditorActions.vue.js";
7
+ import S from "./version-history/RestoreButton.vue.js";
8
+ const x = /* @__PURE__ */ a({
6
9
  __name: "RightSlot",
7
- setup(p, { expose: e }) {
8
- const r = m(), o = s(null);
9
- return e({
10
- handleSave: (n) => {
11
- var t;
12
- return (t = o.value) == null ? void 0 : t.handleSave(n);
10
+ setup(h, { expose: r }) {
11
+ const { isFeatureEnabled: o } = u(), n = d(), i = c(), t = f(null), s = p(() => o("liquidSyntax"));
12
+ return r({
13
+ handleSave: (m) => {
14
+ var e;
15
+ return (e = t.value) == null ? void 0 : e.handleSave(m);
13
16
  }
14
- }), { __sfc: !0, editorStore: r, editorActionsRef: o, EditorActions: f, RestoreButton: a };
17
+ }), { __sfc: !0, isFeatureEnabled: o, trans: n, editorStore: i, editorActionsRef: t, isLiquidEnabled: s, InChips: l, EditorActions: _, RestoreButton: S };
15
18
  }
16
19
  });
17
20
  export {
18
- l as default
21
+ x as default
19
22
  };
@@ -1,28 +1,30 @@
1
1
  import { defaultHtmlCompilerRules as p } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as u } from "../config/compiler/itemsCompilerRules.js";
3
- import { outlookCompilerRules as c } from "../config/compiler/outlookCompilerRules.js";
4
- import { recommendationCompilerRules as n } from "../config/compiler/recommendationCompilerRules.js";
5
- import { socialCompilerRules as f } from "../config/compiler/socialCompilerRules.js";
6
- import { unsubscribeCompilerRules as R } from "../config/compiler/unsubscribeCompilerRules.js";
7
- import { createHtmlCompiler as a } from "../utils/htmlCompiler.js";
8
- import { useConfig as C } from "./useConfig.js";
9
- const B = () => {
2
+ import { itemsCompilerRules as n } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as c } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as a } from "../config/compiler/outlookCompilerRules.js";
5
+ import { recommendationCompilerRules as f } from "../config/compiler/recommendationCompilerRules.js";
6
+ import { socialCompilerRules as R } from "../config/compiler/socialCompilerRules.js";
7
+ import { unsubscribeCompilerRules as C } from "../config/compiler/unsubscribeCompilerRules.js";
8
+ import { createHtmlCompiler as d } from "../utils/htmlCompiler.js";
9
+ import { useConfig as g } from "./useConfig.js";
10
+ const F = () => {
10
11
  var m, l;
11
- const { compiler: e } = C(), r = ((m = e.value) == null ? void 0 : m.customRules) || [], t = [
12
+ const { compiler: e, isFeatureEnabled: r } = g(), i = ((m = e.value) == null ? void 0 : m.customRules) || [], t = [
12
13
  ...!!((l = e.value) != null && l.ignoreDefaultRules) ? [] : p,
14
+ ...f,
15
+ ...C,
13
16
  ...n,
17
+ ...a,
14
18
  ...R,
15
- ...u,
16
- ...c,
17
- ...f,
18
- ...r.map((o, s) => ({
19
+ ...r("liquidSyntax") ? c : [],
20
+ ...i.map((o, u) => ({
19
21
  ...o,
20
- priority: o.priority + 1e3 + s
22
+ priority: o.priority + 1e3 + u
21
23
  // Ensure additional rules run after default rules
22
24
  }))
23
- ], i = a(t);
24
- return { compileHtml: (o) => i.compile(o) };
25
+ ], s = d(t);
26
+ return { compileHtml: (o) => s.compile(o) };
25
27
  };
26
28
  export {
27
- B as useHtmlCompiler
29
+ F as useHtmlCompiler
28
30
  };
@@ -1,21 +1,22 @@
1
- import { useConfig as d } from "./useConfig.js";
2
- import { useSaveStart as p, useSaveComplete as f } from "./useGuidoActions.js";
3
- import { useSyncModuleExtractor as v } from "./useSyncModuleExtractor.js";
4
- import { useStripoApi as S } from "../services/stripoApi.js";
5
- import { useTemplatePreparation as x } from "../utils/templatePreparation.js";
6
- import { useHtmlValidator as V } from "./useHtmlValidator.js";
7
- const g = () => {
8
- const o = p(), s = f(), { validateHtml: i } = V(), { callbacks: a } = d(), { extractSyncModuleData: r } = v(), { setSyncModuleUnsubscriptionPages: n } = S();
9
- return { save: async (l = !1) => {
10
- var e;
11
- o();
12
- const { prepareTemplateDetails: c } = x(), t = await c();
13
- if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
1
+ import { useConfig as v } from "./useConfig.js";
2
+ import { useSaveStart as S, useSaveComplete as V } from "./useGuidoActions.js";
3
+ import { useSyncModuleExtractor as x } from "./useSyncModuleExtractor.js";
4
+ import { useStripoApi as y } from "../services/stripoApi.js";
5
+ import { useTemplatePreparation as w } from "../utils/templatePreparation.js";
6
+ import { useHtmlValidator as b } from "./useHtmlValidator.js";
7
+ import { useLiquidValidator as q } from "./validators/useLiquidValidator.js";
8
+ const k = () => {
9
+ const e = S(), o = V(), { validateHtml: s } = b(), { validateLiquidSyntax: r } = q(), { callbacks: a, isFeatureEnabled: n } = v(), { extractSyncModuleData: l } = x(), { setSyncModuleUnsubscriptionPages: d } = y();
10
+ return { save: async (u = !1) => {
11
+ var i;
12
+ e();
13
+ const { prepareTemplateDetails: c } = w(), t = await c();
14
+ if (!await s(t.compiledHtml, t.dynamicContentList, !0) || n("liquidSyntax") && !await r(t.compiledHtml) || (i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
14
15
  return;
15
- const { unsubscribePayload: m, stripoModules: u } = r(t.rawHtml);
16
- return await n(m), t.modules = u, l || s(t), t;
16
+ const { unsubscribePayload: m, stripoModules: p } = l(t.rawHtml);
17
+ return await d(m), t.modules = p, u || o(t), t;
17
18
  } };
18
19
  };
19
20
  export {
20
- g as useSave
21
+ k as useSave
21
22
  };
@@ -1,42 +1,42 @@
1
- import { useActionsApi as A } from "./useActionsApi.js";
2
- import { useBlocksConfig as F } from "./useBlocksConfig.js";
3
- import { useConfig as D } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as I } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as P } from "./useStripoEventHandler.js";
6
- import { useToaster as U } from "./useToaster.js";
7
- import { localePatch as R } from "../config/i18n/index.js";
8
- import { displayConditions as H } from "../enums/displayConditions.js";
9
- import { useStripoApi as O } from "../services/stripoApi.js";
10
- import q from "../static/styles/customEditorStyle.css.js";
1
+ import { useActionsApi as F } from "./useActionsApi.js";
2
+ import { useBlocksConfig as D } from "./useBlocksConfig.js";
3
+ import { useConfig as I } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as P } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as U } from "./useStripoEventHandler.js";
6
+ import { useToaster as R } from "./useToaster.js";
7
+ import { localePatch as H } from "../config/i18n/index.js";
8
+ import { displayConditions as q } from "../enums/displayConditions.js";
9
+ import { useStripoApi as x } from "../services/stripoApi.js";
10
+ import O from "../static/styles/customEditorStyle.css.js";
11
11
  import { useEditorStore as S } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
13
- import L from "../package.json.js";
14
- const oe = (C, c) => {
15
- const { features: l, template: E } = D(), { handleError: u } = U(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = O(), { handleEvent: k } = P(), { getStripoBlocksConfig: T } = F(), V = async (i, n = [], r = !1) => {
12
+ import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
13
+ import $ from "../package.json.js";
14
+ const ie = (C, c) => {
15
+ const { features: l, template: E, isFeatureEnabled: h } = I(), { handleError: u } = R(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = x(), { handleEvent: T } = U(), { getStripoBlocksConfig: V } = D(), _ = async (i, n = [], r = !1) => {
16
16
  var f, g, y;
17
- const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await T(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, B = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
17
+ const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await V(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, v = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, M = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
18
  window.UIEditor.initEditor(
19
19
  document.querySelector("#guido-editor"),
20
20
  {
21
21
  metadata: C,
22
22
  html: m,
23
23
  css: a,
24
- forceRecreate: v,
24
+ forceRecreate: M,
25
25
  locale: "en",
26
26
  undoButtonSelector: "#guido__undo-button",
27
27
  redoButtonSelector: "#guido__redo-button",
28
28
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
29
29
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
30
30
  codeEditorButtonSelector: "#guido__code-button",
31
- customAppearanceMergetags: !0,
31
+ customAppearanceMergetags: !h("liquidSyntax"),
32
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
33
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: q,
34
+ customViewStyles: O,
35
35
  conditionsEnabled: p,
36
36
  customConditionsEnabled: p,
37
- conditionCategories: H,
37
+ conditionCategories: q,
38
38
  enableXSSSecurity: !0,
39
- modulesDisabled: B,
39
+ modulesDisabled: v,
40
40
  syncModulesEnabled: r,
41
41
  messageSettingsEnabled: !0,
42
42
  displayGmailAnnotations: !0,
@@ -52,12 +52,12 @@ const oe = (C, c) => {
52
52
  },
53
53
  mergeTags: [
54
54
  {
55
- entries: x(c.preselectedDynamicContentList)
55
+ entries: L(c.preselectedDynamicContentList)
56
56
  }
57
57
  ],
58
58
  async onTokenRefreshRequest(t) {
59
59
  try {
60
- const s = await h();
60
+ const s = await b();
61
61
  t(s);
62
62
  } catch (s) {
63
63
  u(s, "Failed to refresh token");
@@ -65,8 +65,8 @@ const oe = (C, c) => {
65
65
  },
66
66
  onTemplateLoaded() {
67
67
  try {
68
- const { importCss: t } = I(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = A();
69
- t(), s(), M(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
68
+ const { importCss: t } = P(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: A } = F();
69
+ t(), s(), A(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
70
70
  e.hasChanges = !1;
71
71
  }, 1e3);
72
72
  } catch (t) {
@@ -85,23 +85,23 @@ const oe = (C, c) => {
85
85
  onDataChanged() {
86
86
  e.hasChanges = !0;
87
87
  },
88
- onEvent: k,
88
+ onEvent: T,
89
89
  ignoreClickOutsideSelectors: [
90
90
  "#guido-dynamic-content-modal",
91
91
  ".in-on-board-wrapper",
92
92
  ".in-drawer__container"
93
93
  ],
94
94
  extensions: d,
95
- localePatch: R
95
+ localePatch: H
96
96
  }
97
97
  );
98
- }, _ = (i) => new Promise((n, r) => {
98
+ }, B = (i) => new Promise((n, r) => {
99
99
  var d;
100
100
  if (document.getElementById("UiEditorScript")) {
101
101
  i(), n();
102
102
  return;
103
103
  }
104
- const e = L.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
104
+ const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
105
105
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
106
106
  i(), n();
107
107
  }, o.onerror = () => {
@@ -109,15 +109,15 @@ const oe = (C, c) => {
109
109
  }, document.body.appendChild(o);
110
110
  });
111
111
  return { initPlugin: async (i) => {
112
- await _(async () => {
112
+ await B(async () => {
113
113
  const n = S(), [r, e] = await Promise.all([
114
114
  w(),
115
- b()
115
+ k()
116
116
  ]);
117
- n.syncModulesEnabled = e, await V(i, r, e);
117
+ n.syncModulesEnabled = e, await _(i, r, e);
118
118
  });
119
119
  } };
120
120
  };
121
121
  export {
122
- oe as useStripo
122
+ ie as useStripo
123
123
  };
@@ -0,0 +1,28 @@
1
+ import { ToasterTypeOptions as l } from "../../enums/toaster.js";
2
+ import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
3
+ import { useHttp as d } from "../useHttp.js";
4
+ import { useToaster as m } from "../useToaster.js";
5
+ import { useTranslations as p } from "../useTranslations.js";
6
+ const T = () => {
7
+ const { post: r } = d(), { showToaster: s } = m(), o = p();
8
+ return { validateLiquidSyntax: async (i) => {
9
+ var e, a;
10
+ const n = await r("/newsletter/contents/validate-syntax", [{
11
+ identifier: "default",
12
+ syntax: "liquid",
13
+ contents: {
14
+ subject: null,
15
+ preheader: null,
16
+ html: u(i),
17
+ ampHtml: null
18
+ }
19
+ }]), [t] = n.data;
20
+ return (e = t == null ? void 0 : t.results) != null && e.html ? !0 : (s({
21
+ type: l.Alert,
22
+ message: ((a = t == null ? void 0 : t.errors) == null ? void 0 : a.html) ?? o("journey-builder.liquid-validation-failed")
23
+ }), !1);
24
+ } };
25
+ };
26
+ export {
27
+ T as useLiquidValidator
28
+ };
@@ -0,0 +1,14 @@
1
+ const e = [
2
+ {
3
+ id: "liquid-coupon-code",
4
+ description: "Replace legacy coupon placeholder with liquid syntax",
5
+ type: "replace",
6
+ search: "{@COUPON_CODE}",
7
+ replacement: "{{ins_coupon_code}}",
8
+ replaceAll: !0,
9
+ priority: 50
10
+ }
11
+ ];
12
+ export {
13
+ e as liquidCompilerRules
14
+ };
@@ -1,41 +1,41 @@
1
- import { usePartner as N } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as S, INSIDER_ID as R, URLS as _ } from "../../enums/unsubscribe.js";
3
- import { parsePageList as U } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as B } from "../../stores/config.js";
5
- import { useDynamicContentStore as y } from "../../stores/dynamic-content.js";
6
- import { useUnsubscribeStore as L } from "../../stores/unsubscribe.js";
7
- const D = [
1
+ import { usePartner as y } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as p, LINK_TYPES as S, INSIDER_ID as m, URLS as R } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as I } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
6
+ import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
7
+ const G = [
8
8
  {
9
9
  id: "add-unsubscribe-link-values",
10
10
  description: "Adding unsubscribe link values",
11
11
  type: "custom",
12
12
  processor: (t) => {
13
- const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.variationId;
13
+ const { getPartnerName: i } = y(), o = N(), s = U(), d = C(), a = o.variationId;
14
14
  if (!a)
15
15
  return t;
16
16
  let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`;
18
- return new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
19
- var g;
20
- const m = p.getAttribute("data-unsubscribe-page-list");
21
- if (!m)
17
+ const r = `/${i()}/email/${a}?user={{iid}}`, E = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
18
+ let c = !1, l = !1;
19
+ return E.forEach((f) => {
20
+ var b;
21
+ const u = f.getAttribute("data-unsubscribe-page-list");
22
+ if (!u)
22
23
  return;
23
- const I = U(m), d = ((g = u.templates) == null ? void 0 : g.filter(
24
- (o) => I.includes(o.id)
25
- )) ?? [], E = d.some((o) => o.type === S.UNSUBSCRIBE_LINK_TYPE), b = d.some((o) => o.type === S.PREFERENCES_LINK_TYPE), f = p.outerHTML;
26
- let s = f;
27
- (E || b) && n.selectedDynamicContentList.push({
28
- text: R,
29
- value: R,
30
- fallback: ""
31
- }), E && (s = s.replace(
32
- l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
33
- _.UNSUBSCRIBE_URL + r
34
- )), b && (s = s.replace(
35
- l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
36
- _.PREFERENCES_URL + r
37
- )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), e = e.replace(f, s);
38
- }), e;
24
+ const _ = I(u), g = ((b = d.templates) == null ? void 0 : b.filter(
25
+ (n) => _.includes(n.id)
26
+ )) ?? [];
27
+ c = c || g.some((n) => n.type === S.UNSUBSCRIBE_LINK_TYPE), l = l || g.some((n) => n.type === S.PREFERENCES_LINK_TYPE);
28
+ }), (c || l) && (s.selectedDynamicContentList.some((u) => u.value === m) || s.selectedDynamicContentList.push({
29
+ text: m,
30
+ value: m,
31
+ fallback: ""
32
+ })), c && (e = e.replace(
33
+ p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
34
+ R.UNSUBSCRIBE_URL + r
35
+ )), l && (e = e.replace(
36
+ p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
37
+ R.PREFERENCES_URL + r
38
+ )), E.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
39
39
  },
40
40
  priority: 60
41
41
  },
@@ -43,7 +43,7 @@ const D = [
43
43
  id: "remove-data-ogsb-button-styles",
44
44
  description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
45
45
  type: "regex",
46
- pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
46
+ pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
47
47
  replacement: "",
48
48
  flags: "g",
49
49
  priority: 61
@@ -61,16 +61,16 @@ const D = [
61
61
  type: "custom",
62
62
  processor: (t) => {
63
63
  let i = t;
64
- const c = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return c && c.forEach((n) => {
66
- if (n.includes("insEmail=1"))
64
+ const o = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
+ return o && o.forEach((s) => {
66
+ if (s.includes("insEmail=1"))
67
67
  return;
68
- if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
68
+ if (s.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
+ const a = s.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
70
  const r = e.slice(6, e.length - 1).trim();
71
71
  return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
72
72
  });
73
- i = i.replace(n, a);
73
+ i = i.replace(s, a);
74
74
  }
75
75
  }), i;
76
76
  },
@@ -78,5 +78,5 @@ const D = [
78
78
  }
79
79
  ];
80
80
  export {
81
- D as unsubscribeCompilerRules
81
+ G as unsubscribeCompilerRules
82
82
  };
@@ -1,29 +1,38 @@
1
- import { BlockType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { COUPON_BLOCK_ID as e } from "./block.js";
3
- const t = `
4
- <${o.BLOCK_TEXT}
1
+ import { useConfig as n } from "../../../composables/useConfig.js";
2
+ import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { COUPON_BLOCK_ID as t } from "./block.js";
4
+ const c = "{@COUPON_CODE}", s = "{{ins_coupon_code}}";
5
+ function l() {
6
+ const { isFeatureEnabled: o } = n();
7
+ return o("liquidSyntax") ? s : c;
8
+ }
9
+ function i(o) {
10
+ return `
11
+ <${e.BLOCK_TEXT}
5
12
  class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
6
13
  align="center"
7
- esd-extension-block-id="${e}">
14
+ esd-extension-block-id="${t}">
8
15
  <p
9
16
  path="1"
10
17
  contenteditable="false"
11
18
  style="font-size: 16px; color: #333333;">
12
- <strong path="1,0">{@COUPON_CODE}</strong>
19
+ <strong path="1,0">${o}</strong>
13
20
  </p>
14
- </${o.BLOCK_TEXT}>
15
- `, l = `
21
+ </${e.BLOCK_TEXT}>
22
+ `;
23
+ }
24
+ const u = `
16
25
  <td
17
26
  class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
18
- esd-extension-block-id="${e}"
27
+ esd-extension-block-id="${t}"
19
28
  >
20
29
  <p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
21
30
  </td>
22
31
  `;
23
- function s() {
24
- return t;
32
+ function d() {
33
+ return i(l());
25
34
  }
26
35
  export {
27
- l as default,
28
- s as getDefaultTemplate
36
+ u as default,
37
+ d as getDefaultTemplate
29
38
  };
@@ -169,7 +169,7 @@ class q extends b {
169
169
  if (e && e.includes(a))
170
170
  return t;
171
171
  }
172
- return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
172
+ return "querySelector" in t ? t.querySelector(`.${a}`) : null;
173
173
  }
174
174
  /**
175
175
  * Migrate configuration from legacy format
@@ -16,7 +16,7 @@ function M(t) {
16
16
  if (e && e.includes(h))
17
17
  return t;
18
18
  }
19
- return "querySelector" in t ? t.querySelector(`.${h}`) ?? null : null;
19
+ return "querySelector" in t ? t.querySelector(`.${h}`) : null;
20
20
  }
21
21
  function g(t) {
22
22
  const e = M(t);