@useinsider/guido 3.30.0-beta.a1f329f → 3.30.0-beta.b189780

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
@@ -174,7 +174,6 @@ const config: GuidoConfigInput = {
174
174
  allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
175
175
  reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
176
176
  legacyUnsubscribeConversion?: boolean, // Default: false - Convert legacy unsubscribe blocks that have no unsubscribe link into text blocks (on load and on module drop/copy) and show a warning modal.
177
- readonly?: boolean, // Default: false - Opens the design with Save disabled: no save path persists (toolbar Save, "Save and Continue", autosave, saveSilent() resolves undefined), no save:start / save:complete, and edits never emit on-change, so the host shows no leave-page warning. Read at mount; to change it, remount Guido.
178
177
  accessibilityTesting?: boolean, // Default: false - Show the Accessibility Test entry in the header kebab menu (Stripo's checker: contrast, image alternatives, colour-vision simulation) and the tab-bar onboarding tour that points at it.
179
178
  itemsPriceFormatting?: boolean, // Default: false - Items block price formatting: thousand/decimal separator + decimal count on the block root, raw price tags in the export (formatted at send time).
180
179
  blockUnsubscribeLinks?: boolean, // Default: false - Warn on save when the design carries an Insider unsubscribe link or code ({{ins-*-unsubscribe-link}}, <%asm_*_raw_url%>, <%unsub%>): the legacy save is rejected with a warning toaster; with the validation drawer on it is a warning row that "Save and Continue" can skip. Launch blocking is up to the host. Set true for accounts whose unsubscribes are managed outside Insider (SFMC).
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
- import { object as o, number as c, optional as e, string as t, picklist as m, pipe as i, minLength as p, custom as k, boolean as a, array as n, transform as S, unknown as r, record as g, fallback as R, literal as u, lazy as T, looseObject as C, variant as I, union as h } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as c, optional as e, string as t, picklist as m, pipe as r, minLength as p, custom as k, boolean as a, array as n, transform as S, unknown as i, record as g, fallback as R, literal as u, lazy as T, looseObject as C, variant as I, union as h } from "../../node_modules/valibot/dist/index.js";
3
3
  const b = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -14,12 +14,12 @@ const b = {
14
14
  UNSUBSCRIBE_PAGES: 97
15
15
  }, A = o({
16
16
  /** Unique identifier for the template being edited */
17
- templateId: i(
17
+ templateId: r(
18
18
  t(),
19
19
  p(1, "templateId is required")
20
20
  ),
21
21
  /** Unique identifier for the user editing the template */
22
- userId: i(
22
+ userId: r(
23
23
  t(),
24
24
  p(1, "userId is required")
25
25
  ),
@@ -40,7 +40,7 @@ const b = {
40
40
  family: t()
41
41
  }), E = o({
42
42
  /** Partner/organization name (required) */
43
- name: i(
43
+ name: r(
44
44
  t(),
45
45
  p(1, "partner.name is required")
46
46
  ),
@@ -93,23 +93,23 @@ const b = {
93
93
  /** Decimal places for price display (legacy data may use string or number) */
94
94
  decimalCount: e(h([t(), c()])),
95
95
  /** Pinned product IDs (empty array when filter-driven) */
96
- productIds: e(n(r())),
96
+ productIds: e(n(i())),
97
97
  /** Whether the block requested live products at send time */
98
98
  sendProductRequestFlag: e(a()),
99
99
  /** Whether to randomize product order */
100
100
  shuffleProducts: e(a()),
101
101
  /** Filter rules driving product selection */
102
- filters: e(n(r())),
102
+ filters: e(n(i())),
103
103
  /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
104
104
  currency: e(t()),
105
105
  /** Currency display settings (separators, alignment, decimals) */
106
- currencySettings: e(r()),
106
+ currencySettings: e(i()),
107
107
  /** Locale (e.g. 'nl_NL') */
108
108
  language: e(t()),
109
109
  /** Recommendation strategy key (e.g. 'newArrivals') */
110
110
  strategy: e(t()),
111
111
  /** Snapshot of products as rendered by the legacy block */
112
- recommendedProducts: e(n(r())),
112
+ recommendedProducts: e(n(i())),
113
113
  /** Number of product cards per row */
114
114
  cardsInRow: e(c()),
115
115
  /** Mobile-only padding (right) */
@@ -174,7 +174,7 @@ const b = {
174
174
  * mount. Non-numbers still fail, like every other field in this schema.
175
175
  */
176
176
  trackIdCounter: e(
177
- i(
177
+ r(
178
178
  c(),
179
179
  S((s) => Number.isFinite(s) ? Math.max(0, Math.floor(s)) : 0)
180
180
  ),
@@ -188,8 +188,8 @@ const b = {
188
188
  * cannot be undone. Hosts send `[]` for an empty map.
189
189
  */
190
190
  recommendationCampaignUrls: e(
191
- i(
192
- r(),
191
+ r(
192
+ i(),
193
193
  S((s) => s && typeof s == "object" ? { ...s } : void 0)
194
194
  )
195
195
  ),
@@ -249,8 +249,6 @@ const b = {
249
249
  reusableRecommendationStrategy: e(a(), !1),
250
250
  /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
251
251
  legacyUnsubscribeConversion: e(a(), !1),
252
- /** Disable every save path and the unsaved-changes signal; read at mount only. */
253
- readonly: e(a(), !1),
254
252
  /** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
255
253
  itemsPriceFormatting: e(a(), !1),
256
254
  /** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
@@ -4,7 +4,7 @@ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var d = function() {
5
5
  var o, s;
6
6
  var i = this, e = i._self._c, t = i._self._setupProxy;
7
- return e("div", { staticClass: "d-f a-i-c editor-actions" }, [!t.editorStore.isPreviewModeOpen && t.hasContentOnTheLeft ? e("div", { staticClass: "editor-actions__divider" }) : i._e(), (s = (o = t.config) == null ? void 0 : o.features) != null && s.testMessage ? e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.handleTestEmail } }) : i._e(), e(t.EditorActionsMenu), t.editorStore.isPreviewModeOpen ? i._e() : e("div", { staticClass: "editor-actions__divider" }), t.editorStore.isPreviewModeOpen ? i._e() : e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "disabled-status": t.isFeatureEnabled("readonly") || !t.isSaving && t.editorStore.isSaveButtonDisabled, "label-text": t.saveLabel, "loading-status": t.isSaving }, on: { click: function(n) {
7
+ return e("div", { staticClass: "d-f a-i-c editor-actions" }, [!t.editorStore.isPreviewModeOpen && t.hasContentOnTheLeft ? e("div", { staticClass: "editor-actions__divider" }) : i._e(), (s = (o = t.config) == null ? void 0 : o.features) != null && s.testMessage ? e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.handleTestEmail } }) : i._e(), e(t.EditorActionsMenu), t.editorStore.isPreviewModeOpen ? i._e() : e("div", { staticClass: "editor-actions__divider" }), t.editorStore.isPreviewModeOpen ? i._e() : e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "label-text": t.saveLabel, "loading-status": t.isSaving }, on: { click: function(n) {
8
8
  return t.handleSave(!1);
9
9
  } } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(n) {
10
10
  return t.executeSave(!1);
@@ -15,7 +15,7 @@ var d = function() {
15
15
  l,
16
16
  !1,
17
17
  null,
18
- "b3603ae4"
18
+ "9a028d08"
19
19
  );
20
20
  const p = c.exports;
21
21
  export {
@@ -2,17 +2,17 @@ import i from "./EditorActionsMenu.vue2.js";
2
2
  /* empty css */
3
3
  import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var n = function() {
5
- var e = this, o = e._self._c, t = e._self._setupProxy;
6
- return o("div", { staticClass: "editor-actions-menu p-r" }, [o(t.InButtonV2, { attrs: { id: "guido__kebab-button", "data-testid": "Editor Actions Menu", "left-icon": "line-more-vertical", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.loadingStatus, "label-text-status": !1, "selected-status": t.isPanelOpen, "tooltip-options": t.getTooltipOptions("guido__kebab-button"), "tooltip-text": t.trans("email-editor.more-actions") }, on: { click: function(d) {
5
+ var o = this, e = o._self._c, t = o._self._setupProxy;
6
+ return e("div", { staticClass: "editor-actions-menu p-r" }, [e(t.InButtonV2, { attrs: { id: "guido__kebab-button", "data-testid": "Editor Actions Menu", "left-icon": "line-more-vertical", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isEditorUnavailable, "label-text-status": !1, "selected-status": t.isPanelOpen, "tooltip-options": t.getTooltipOptions("guido__kebab-button"), "tooltip-text": t.trans("email-editor.more-actions") }, on: { click: function(c) {
7
7
  t.isOpen = !t.isOpen;
8
- } } }), o(t.InDropdownMenu, { staticClass: "editor-actions-menu__dropdown", attrs: { id: "guido__kebab-menu", "box-width": "basedOnLongestItem", "static-position": "bottom right", "dynamic-position": !1, "max-height": 400, options: t.options, "select-all-option-status": !1, status: t.isPanelOpen }, on: { clickOutside: t.close, optionClick: t.handleOptionClick } })], 1);
8
+ } } }), e(t.InDropdownMenu, { staticClass: "editor-actions-menu__dropdown", attrs: { id: "guido__kebab-menu", "box-width": "basedOnLongestItem", "static-position": "bottom right", "dynamic-position": !1, "max-height": 400, options: t.options, "select-all-option-status": !1, status: t.isPanelOpen }, on: { clickOutside: t.close, optionClick: t.handleOptionClick } })], 1);
9
9
  }, a = [], r = /* @__PURE__ */ s(
10
10
  i,
11
11
  n,
12
12
  a,
13
13
  !1,
14
14
  null,
15
- "bdb3b37a"
15
+ "0e63ebe1"
16
16
  );
17
17
  const _ = r.exports;
18
18
  export {
@@ -1,9 +1,9 @@
1
- import { defineComponent as D, ref as C, computed as i, watch as L } from "vue";
2
- import { useAccessibilityApi as R } from "../../../composables/useAccessibilityApi.js";
3
- import { useConfig as Y } from "../../../composables/useConfig.js";
4
- import { useExport as F } from "../../../composables/useExport.js";
5
- import { useTranslations as N } from "../../../composables/useTranslations.js";
6
- import { useVersionHistoryApi as U } from "../../../composables/useVersionHistoryApi.js";
1
+ import { defineComponent as D, ref as C, computed as s, watch as L } from "vue";
2
+ import { useAccessibilityApi as U } from "../../../composables/useAccessibilityApi.js";
3
+ import { useConfig as R } from "../../../composables/useConfig.js";
4
+ import { useExport as Y } from "../../../composables/useExport.js";
5
+ import { useTranslations as F } from "../../../composables/useTranslations.js";
6
+ import { useVersionHistoryApi as N } from "../../../composables/useVersionHistoryApi.js";
7
7
  import { useAutosaveStore as X } from "../../../stores/autosave.js";
8
8
  import { useEditorStore as j } from "../../../stores/editor.js";
9
9
  import { useOnboardingStore as q } from "../../../stores/onboarding.js";
@@ -12,22 +12,22 @@ import { InToggle as G, InDropdownMenu as J, InButtonV2 as K } from "@useinsider
12
12
  const ce = /* @__PURE__ */ D({
13
13
  __name: "EditorActionsMenu",
14
14
  setup(Q) {
15
- const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config: m, isFeatureEnabled: b } = Y(), { exportHtml: y } = F(), { openVersionHistory: A, closeVersionHistory: S } = U(), { toggleAccessibilityTestingMode: _ } = R(), e = j(), a = X(), f = q(), o = N(), g = C(!1), M = i(() => g.value || f.isEditorActionsMenuPinned), r = C(!1), O = i(() => b("autosave")), x = i(
15
+ const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config: b, isFeatureEnabled: m } = R(), { exportHtml: y } = Y(), { openVersionHistory: A, closeVersionHistory: _ } = N(), { toggleAccessibilityTestingMode: O } = U(), e = j(), a = X(), f = q(), o = F(), g = C(!1), M = s(() => g.value || f.isEditorActionsMenuPinned), r = C(!1), S = s(() => m("autosave")), E = s(
16
16
  () => {
17
- var t, s;
18
- return !!((s = (t = m.value) == null ? void 0 : t.features) != null && s.versionHistory) && !e.isPreviewModeOpen;
17
+ var t, i;
18
+ return !!((i = (t = b.value) == null ? void 0 : t.features) != null && i.versionHistory) && !e.isPreviewModeOpen;
19
19
  }
20
- ), h = i(
21
- () => b("accessibilityTesting") && !e.isPreviewModeOpen
22
- ), V = i(() => {
23
- var t, s;
24
- return !!((s = (t = m.value) == null ? void 0 : t.features) != null && s.saveAsTemplate);
25
- }), E = i(() => O.value ? [
20
+ ), x = s(
21
+ () => m("accessibilityTesting") && !e.isPreviewModeOpen
22
+ ), h = s(() => {
23
+ var t, i;
24
+ return !!((i = (t = b.value) == null ? void 0 : t.features) != null && i.saveAsTemplate);
25
+ }), V = s(() => S.value ? [
26
26
  { categoryText: o("email-editor.preferences") },
27
27
  {
28
28
  text: o("email-editor.auto-save"),
29
29
  value: c,
30
- disable: e.loadingStatus,
30
+ disable: e.isEditorUnavailable,
31
31
  rightSlotComponent: G,
32
32
  rightSlotProps: {
33
33
  // InDropdownMenu fills attrs.id with its own positional test id, and v-bind
@@ -35,25 +35,25 @@ const ce = /* @__PURE__ */ D({
35
35
  name: "guido-kebab-autosave-toggle",
36
36
  class: "p-e-n",
37
37
  checked: a.isOn,
38
- disable: e.loadingStatus
38
+ disable: e.isEditorUnavailable
39
39
  }
40
40
  },
41
41
  { divider: "solid" }
42
- ] : []), T = i(() => [
42
+ ] : []), T = s(() => [
43
43
  { categoryText: o("email-editor.actions") },
44
- ...x.value ? [{
44
+ ...E.value ? [{
45
45
  text: o("newsletter.version-history"),
46
46
  value: u,
47
47
  iconLeft: "line-architect-version-history",
48
48
  disable: e.isVersionHistoryButtonDisabled
49
49
  }] : [],
50
- ...h.value ? [{
50
+ ...x.value ? [{
51
51
  text: o("email-editor.accessibility-test"),
52
52
  value: p,
53
53
  iconLeft: "line-accessibility",
54
- disable: e.loadingStatus
54
+ disable: e.isEditorUnavailable
55
55
  }] : [],
56
- ...V.value ? [{
56
+ ...h.value ? [{
57
57
  text: o("newsletter.save-templates"),
58
58
  value: d,
59
59
  iconLeft: "line-newsletter-save-as-template",
@@ -65,7 +65,7 @@ const ce = /* @__PURE__ */ D({
65
65
  iconLeft: "line-export",
66
66
  disable: r.value || e.isExportButtonDisabled
67
67
  }
68
- ]), P = i(() => [...E.value, ...T.value]), n = () => {
68
+ ]), P = s(() => [...V.value, ...T.value]), n = () => {
69
69
  g.value = !1;
70
70
  };
71
71
  L(() => f.isEditorActionsMenuPinned, (t) => {
@@ -74,9 +74,9 @@ const ce = /* @__PURE__ */ D({
74
74
  const k = () => {
75
75
  a.isOn = !a.isOn;
76
76
  }, w = () => {
77
- e.isVersionHistoryOpen ? S() : A(), n();
77
+ e.isVersionHistoryOpen ? _() : A(), n();
78
78
  }, H = () => {
79
- _(), n();
79
+ O(), n();
80
80
  }, I = () => {
81
81
  e.isSaveAsTemplateDrawerOpen = !0, n();
82
82
  }, B = async () => {
@@ -88,9 +88,9 @@ const ce = /* @__PURE__ */ D({
88
88
  [d]: I,
89
89
  [v]: B
90
90
  };
91
- return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config: m, isFeatureEnabled: b, exportHtml: y, openVersionHistory: A, closeVersionHistory: S, toggleAccessibilityTestingMode: _, editorStore: e, autosaveStore: a, onboardingStore: f, trans: o, isOpen: g, isPanelOpen: M, isExporting: r, isAutosaveVisible: O, isVersionHistoryVisible: x, isAccessibilityVisible: h, isSaveAsVisible: V, preferenceOptions: E, actionOptions: T, options: P, close: n, toggleAutosave: k, handleVersionHistory: w, handleAccessibility: H, handleSaveAs: I, handleExport: B, optionHandlers: l, handleOptionClick: ({ value: t }) => {
92
- var s;
93
- return (s = l[t]) == null ? void 0 : s.call(l);
91
+ return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config: b, isFeatureEnabled: m, exportHtml: y, openVersionHistory: A, closeVersionHistory: _, toggleAccessibilityTestingMode: O, editorStore: e, autosaveStore: a, onboardingStore: f, trans: o, isOpen: g, isPanelOpen: M, isExporting: r, isAutosaveVisible: S, isVersionHistoryVisible: E, isAccessibilityVisible: x, isSaveAsVisible: h, preferenceOptions: V, actionOptions: T, options: P, close: n, toggleAutosave: k, handleVersionHistory: w, handleAccessibility: H, handleSaveAs: I, handleExport: B, optionHandlers: l, handleOptionClick: ({ value: t }) => {
92
+ var i;
93
+ return (i = l[t]) == null ? void 0 : i.call(l);
94
94
  }, getTooltipOptions: z, InButtonV2: K, InDropdownMenu: J };
95
95
  }
96
96
  });
@@ -3,9 +3,9 @@ import { useEditorLock as y } from "./useEditorLock.js";
3
3
  import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
4
4
  import { useEditorStore as L } from "../stores/editor.js";
5
5
  import { computed as w, watch as V, onUnmounted as k } from "vue";
6
- const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
6
+ const D = 18e4, b = 6e4, U = (g, { clearsChanges: h = () => !0 } = {}) => {
7
7
  const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
8
- let o = null, l = 0, u = -1;
8
+ let i = null, l = 0, u = -1;
9
9
  const d = w(
10
10
  () => m("autosave") && t.isOn
11
11
  ), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
@@ -30,43 +30,43 @@ const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
30
30
  return;
31
31
  }
32
32
  e === "visibility" && (l = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING;
33
- const n = s.changeSeq;
33
+ const o = s.changeSeq;
34
34
  try {
35
35
  if (await g() === void 0) {
36
36
  console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
37
37
  return;
38
38
  }
39
- u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
39
+ u = o, h() && s.changeSeq === o && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
40
40
  } catch (S) {
41
41
  console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
42
42
  }
43
- }, i = () => {
43
+ }, n = () => {
44
44
  const { visibilityState: e } = document;
45
45
  if (console.debug("guido:autosave:visibility-change", {
46
46
  visibilityState: e,
47
47
  isActive: d.value
48
48
  }), e !== "hidden")
49
49
  return;
50
- const n = Date.now() - l;
51
- if (n < b) {
50
+ const o = Date.now() - l;
51
+ if (o < b) {
52
52
  console.debug("guido:autosave:visibility-debounced", {
53
- sinceLastMs: n,
53
+ sinceLastMs: o,
54
54
  debounceMs: b
55
55
  });
56
56
  return;
57
57
  }
58
58
  r("visibility");
59
59
  }, c = () => {
60
- o && (clearInterval(o), o = null);
60
+ i && (clearInterval(i), i = null);
61
61
  }, v = () => {
62
- document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
62
+ document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
63
63
  };
64
64
  V(
65
65
  d,
66
66
  (e) => {
67
- console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
67
+ console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), i = setInterval(() => {
68
68
  console.debug("guido:autosave:interval-tick"), r("interval");
69
- }, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
69
+ }, D), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (c(), v(), t.status = a.IDLE);
70
70
  },
71
71
  { immediate: !0 }
72
72
  ), k(() => {
@@ -74,5 +74,5 @@ const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
74
74
  });
75
75
  };
76
76
  export {
77
- _ as useAutoSave
77
+ U as useAutoSave
78
78
  };
@@ -1,101 +1,101 @@
1
- import { useActionsApi as D } from "./useActionsApi.js";
2
- import { useConfig as F } from "./useConfig.js";
3
- import { useEditorLock as I } from "./useEditorLock.js";
4
- import { useSaveStart as N, useSaveComplete as j } from "./useGuidoActions.js";
5
- import { useSaveValidation as z } from "./useSaveValidation.js";
6
- import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
7
- import { useSyncModuleExtractor as J } from "./useSyncModuleExtractor.js";
8
- import { ToasterTypeOptions as K } from "../enums/toaster.js";
9
- import { useStripoApi as Q } from "../services/stripoApi.js";
10
- import { useConfigStore as X } from "../stores/config.js";
11
- import { useDynamicContentStore as Y } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as Z } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as _, getHtmlReferencedUnsubscribePages as $ } from "../utils/templatePreparation.js";
14
- import { useAllowlist as ee } from "./useAllowlist.js";
15
- import { useHtmlValidator as te } from "./useHtmlValidator.js";
16
- import { useToaster as oe } from "./useToaster.js";
17
- import { useCouponBlockValidator as ie } from "./validators/useCouponBlockValidator.js";
18
- import { useHtmlDocumentCountValidator as se } from "./validators/useHtmlDocumentCountValidator.js";
19
- import { useLiquidValidator as re } from "./validators/useLiquidValidator.js";
20
- import { useSyncModuleBlockValidator as ae } from "./validators/useSyncModuleBlockValidator.js";
21
- import { useUnsubscribeBlockValidator as ne } from "./validators/useUnsubscribeBlockValidator.js";
22
- const Ue = () => {
23
- const l = N(), S = j(), { validateHtml: b } = te(), { validateLiquidSyntax: H } = re(), { validateCouponBlockTags: E } = ie(), {
24
- validateUnsubscribeBlockUniqueness: g,
25
- validateUnsubscribeBlockHasTemplate: V,
26
- validateNoInsiderUnsubscribeCode: x
27
- } = ne(), { validateSyncModuleBlocks: c } = ae(), { validateSingleHtmlDocument: u } = se(), { callbacks: a, isFeatureEnabled: n } = F(), { extractSyncModuleData: k } = J(), { setSyncModuleUnsubscriptionPages: C } = Q(), { editorSave: h, getTemplateData: d } = D(), { showToaster: B } = oe(), { getBlockedDomains: P, resolveToast: T } = ee(), { prepareTemplateDetails: w } = _(), { collectSaveValidationErrors: L } = z(), { isEnabled: U } = G(), A = Z(), M = Y(), y = X(), { runExclusive: m } = I(), f = async (e, t, i) => {
28
- if (!n("allowlistEnabled"))
1
+ import { useActionsApi as O } from "./useActionsApi.js";
2
+ import { useConfig as D } from "./useConfig.js";
3
+ import { useEditorLock as F } from "./useEditorLock.js";
4
+ import { useSaveStart as I, useSaveComplete as N } from "./useGuidoActions.js";
5
+ import { useSaveValidation as j } from "./useSaveValidation.js";
6
+ import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
7
+ import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
8
+ import { ToasterTypeOptions as J } from "../enums/toaster.js";
9
+ import { useStripoApi as K } from "../services/stripoApi.js";
10
+ import { useConfigStore as Q } from "../stores/config.js";
11
+ import { useDynamicContentStore as X } from "../stores/dynamic-content.js";
12
+ import { useSaveValidationStore as Y } from "../stores/save-validation.js";
13
+ import { useTemplatePreparation as Z, getHtmlReferencedUnsubscribePages as _ } from "../utils/templatePreparation.js";
14
+ import { useAllowlist as $ } from "./useAllowlist.js";
15
+ import { useHtmlValidator as tt } from "./useHtmlValidator.js";
16
+ import { useToaster as et } from "./useToaster.js";
17
+ import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
18
+ import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
19
+ import { useLiquidValidator as rt } from "./validators/useLiquidValidator.js";
20
+ import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
21
+ import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
22
+ const Pt = () => {
23
+ const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = rt(), { validateCouponBlockTags: H } = ot(), {
24
+ validateUnsubscribeBlockUniqueness: E,
25
+ validateUnsubscribeBlockHasTemplate: g,
26
+ validateNoInsiderUnsubscribeCode: V
27
+ } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
28
+ if (!u("allowlistEnabled"))
29
29
  return !1;
30
- const o = await P(e, t);
30
+ const o = await B(t, e);
31
31
  if (!o.length)
32
32
  return !1;
33
33
  if (!i) {
34
- const s = await T(o);
35
- s != null && s.message && B({
36
- type: K.Warning,
37
- message: s.message,
38
- actionButton: s.actionButton
34
+ const r = await T(o);
35
+ r != null && r.message && h({
36
+ type: J.Warning,
37
+ message: r.message,
38
+ actionButton: r.actionButton
39
39
  });
40
40
  }
41
41
  return !0;
42
- }, R = async (e, t) => !E(e.compiledHtml) || n("blockUnsubscribeLinks") && !x(e.rawHtml, t) || !g(e.compiledHtml) || !V(e.compiledHtml) ? !1 : n("liquidSyntax") ? H(e.compiledHtml) : b(e.compiledHtml, e.dynamicContentList, !0), v = async (e, t) => {
43
- if (!await h())
42
+ }, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
43
+ if (!await C())
44
44
  return;
45
- const { unsubscribePayload: o, stripoModules: s } = k(e.rawHtml);
46
- if (await C(o), e.modules = s, !t.suppress) {
47
- const r = t.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
48
- S({ ...e, ...r, silent: t.silent });
45
+ const { unsubscribePayload: o, stripoModules: r } = x(t.rawHtml);
46
+ if (await k(o), t.modules = r, !e.suppress) {
47
+ const s = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
48
+ S({ ...t, ...s, silent: e.silent });
49
49
  }
50
- return e;
51
- }, W = async (e, t) => {
52
- var s;
53
- l();
54
- const i = await d();
55
- if (!u(i.html, t))
50
+ return t;
51
+ }, W = async (t, e) => {
52
+ var r;
53
+ n();
54
+ const i = await m();
55
+ if (!c(i.html, e))
56
56
  return;
57
- const o = await w(i);
58
- if (c(o.rawHtml, t)) {
59
- if (U.value && !t) {
60
- const r = await L(
57
+ const o = await p(i);
58
+ if (l(o.rawHtml, e)) {
59
+ if (P.value && !e) {
60
+ const s = await L(
61
61
  o.compiledHtml,
62
62
  o.dynamicContentList,
63
63
  o.rawHtml
64
64
  );
65
- if (!r)
65
+ if (!s)
66
66
  return;
67
- if (r.length) {
68
- A.open(r, "save");
67
+ if (s.length) {
68
+ U.open(s, "save");
69
69
  return;
70
70
  }
71
- } else if (!await R(o, t))
71
+ } else if (!await M(o, e))
72
72
  return;
73
- if (!((s = a.value) != null && s.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, t))
74
- return v(o, { silent: t, suppress: e });
73
+ if (!((r = a.value) != null && r.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
74
+ return v(o, { silent: e, suppress: t });
75
75
  }
76
- }, q = async () => {
76
+ }, R = async () => {
77
77
  var i;
78
- if (!y.allowSaveWithErrors)
78
+ if (!w.allowSaveWithErrors)
79
79
  return;
80
- l();
81
- const e = await d();
82
- if (!u(e.html, !1))
80
+ n();
81
+ const t = await m();
82
+ if (!c(t.html, !1))
83
83
  return;
84
- const t = await w(e);
85
- if (c(t.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t)) && !await f(t.compiledHtml, t.css, !1))
86
- return v(t, { silent: !1, blankCompiled: !0 });
87
- }, O = async () => {
88
- if (!y.allowSaveWithErrors)
84
+ const e = await p(t);
85
+ if (l(e.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(e)) && !await f(e.compiledHtml, e.css, !1))
86
+ return v(e, { silent: !1, blankCompiled: !0 });
87
+ }, q = async () => {
88
+ if (!w.allowSaveWithErrors)
89
89
  return;
90
- l();
91
- const { html: e, css: t } = await d();
92
- if (!u(e, !0) || !c(e, !0) || await f(e, t, !0))
90
+ n();
91
+ const { html: t, css: e } = await m();
92
+ if (!c(t, !0) || !l(t, !0) || await f(t, e, !0))
93
93
  return;
94
- const i = $(e), o = {
95
- dynamicContentList: M.getSelectedDynamicContentList,
94
+ const i = _(t), o = {
95
+ dynamicContentList: A.getSelectedDynamicContentList,
96
96
  compiledHtml: "",
97
- rawHtml: e,
98
- css: t,
97
+ rawHtml: t,
98
+ css: e,
99
99
  ampHtml: "",
100
100
  ampErrors: [],
101
101
  modules: [],
@@ -107,9 +107,11 @@ const Ue = () => {
107
107
  }
108
108
  };
109
109
  return v(o, { silent: !0 });
110
- }, p = () => n("readonly");
111
- return { save: (e = !1, t = !1) => p() ? Promise.resolve(void 0) : m(() => W(e, t)), saveWithErrors: () => p() ? Promise.resolve(void 0) : m(q), saveRawOnly: () => p() ? Promise.resolve(void 0) : m(O) };
110
+ };
111
+ return { save: (t = !1, e = !1) => d(
112
+ () => W(t, e)
113
+ ), saveWithErrors: () => d(R), saveRawOnly: () => d(q) };
112
114
  };
113
115
  export {
114
- Ue as useSave
116
+ Pt as useSave
115
117
  };