@useinsider/guido 3.25.0-beta.2954d1a → 3.25.0-beta.aa06f6b

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/README.md +9 -0
  2. package/dist/@types/config/schemas.js +17 -15
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +94 -90
  5. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useModuleRepair.js +33 -24
  8. package/dist/config/migrator/index.js +8 -7
  9. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  10. package/dist/config/migrator/recommendationMigrator.js +64 -78
  11. package/dist/enums/academy.js +2 -1
  12. package/dist/guido.css +1 -1
  13. package/dist/package.json.js +2 -2
  14. package/dist/src/@types/config/schemas.d.ts +4 -0
  15. package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +2 -0
  16. package/dist/src/composables/useConfig.d.ts +2 -0
  17. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  18. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  19. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +1 -1
  20. package/dist/src/config/migrator/recommendationMigrator.d.ts +5 -1
  21. package/dist/src/enums/academy.d.ts +1 -0
  22. package/dist/src/stores/config.d.ts +20 -0
  23. package/dist/src/stores/editor.d.ts +27 -0
  24. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  25. package/dist/stores/editor.js +1 -0
  26. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  27. package/package.json +1 -1
  28. package/dist/config/migrator/recommendation/inferLegacyConfig.js +0 -133
  29. package/dist/src/config/migrator/recommendation/inferLegacyConfig.d.ts +0 -6
package/README.md CHANGED
@@ -171,6 +171,7 @@ const config: GuidoConfigInput = {
171
171
  allowlistEnabled?: boolean, // Default: false - Pre-save domain-allowlist check (opt-in). Guido self-serves the block toaster (role lookup, deep-link, copy from window.trans).
172
172
  allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
173
173
  reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
174
+ 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.
174
175
  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.
175
176
  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).
176
177
  },
@@ -705,6 +706,14 @@ multiple partners (e.g. architect) should key by partner and place the active pa
705
706
  first. Omit the prop and the repair is a safe no-op — nothing is rewritten and no
706
707
  toaster fires (useful before the host has wired the catalog).
707
708
 
709
+ With `features.legacyUnsubscribeConversion: true`, a dropped or copied module's legacy
710
+ unsubscribe block that has no unsubscribe link (the old editor reused it as plain text,
711
+ e.g. a company address) becomes a plain text block that keeps its content, and a warning
712
+ modal explains it. The same conversion runs when a template is opened. Register these
713
+ keys host-side: `email-editor.legacy-unsubscribe-converted-modal-title`,
714
+ `email-editor.legacy-unsubscribe-converted-modal-message` and
715
+ `email-editor.legacy-unsubscribe-converted-modal-visit-academy` (OK reuses `action-builder.ok`).
716
+
708
717
  ---
709
718
 
710
719
  ## Development
@@ -1,5 +1,5 @@
1
- import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
2
- import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as b, custom as k, boolean as o, array as c, transform as y, unknown as r, record as g, fallback as R, literal as u, looseObject as C, variant as T, union as h, lazy as I } from "../../node_modules/valibot/dist/index.js";
1
+ import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
+ import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as b, custom as g, boolean as o, array as c, transform as S, unknown as r, record as k, fallback as R, literal as u, looseObject as C, variant as T, union as h, lazy as I } from "../../node_modules/valibot/dist/index.js";
3
3
  const p = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -84,10 +84,10 @@ const p = {
84
84
  children: e(c(f)),
85
85
  // eslint-disable-next-line camelcase -- backend field name
86
86
  select_items: e(c(f))
87
- })), P = g(
87
+ })), P = k(
88
88
  t(),
89
89
  R(c(f), [])
90
- ), N = C({
90
+ ), v = C({
91
91
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
92
92
  id: e(s()),
93
93
  /** Decimal places for price display (legacy data may use string or number) */
@@ -132,7 +132,7 @@ const p = {
132
132
  isPriceMovedToNextLine: e(o()),
133
133
  /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
134
134
  isPriceDeletedForZeroSale: e(o())
135
- }), v = a({
135
+ }), N = a({
136
136
  /**
137
137
  * Legacy recommendation block configs keyed by block ID.
138
138
  * Pass this when loading a template authored with the v1
@@ -140,7 +140,7 @@ const p = {
140
140
  * strategy, currency, locale, and layout data.
141
141
  */
142
142
  recommendationConfigs: e(
143
- g(t(), N),
143
+ k(t(), v),
144
144
  {}
145
145
  )
146
146
  }), x = a({
@@ -176,7 +176,7 @@ const p = {
176
176
  trackIdCounter: e(
177
177
  i(
178
178
  s(),
179
- y((n) => Number.isFinite(n) ? Math.max(0, Math.floor(n)) : 0)
179
+ S((n) => Number.isFinite(n) ? Math.max(0, Math.floor(n)) : 0)
180
180
  ),
181
181
  0
182
182
  ),
@@ -190,11 +190,11 @@ const p = {
190
190
  recommendationCampaignUrls: e(
191
191
  i(
192
192
  r(),
193
- y((n) => n && typeof n == "object" ? { ...n } : void 0)
193
+ S((n) => n && typeof n == "object" ? { ...n } : void 0)
194
194
  )
195
195
  ),
196
196
  /** Migration-only inputs (legacy block configs) */
197
- migration: e(v, {})
197
+ migration: e(N, {})
198
198
  }), D = a({
199
199
  /** Sender display name */
200
200
  senderName: e(t(), ""),
@@ -210,9 +210,9 @@ const p = {
210
210
  /** Email header settings */
211
211
  emailHeader: e(D, { senderName: "", subject: "" }),
212
212
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
213
- savedModulesFolderName: e(t(), S.SAVED_MODULES),
213
+ savedModulesFolderName: e(t(), y.SAVED_MODULES),
214
214
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
215
- defaultModulesFolderName: e(t(), S.DEFAULT_MODULES)
215
+ defaultModulesFolderName: e(t(), y.DEFAULT_MODULES)
216
216
  }), F = a({
217
217
  /** Whether to show the header bar */
218
218
  showHeader: e(o(), !0),
@@ -245,6 +245,8 @@ const p = {
245
245
  /** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
246
246
  allowSaveWithErrors: e(o(), !0),
247
247
  reusableRecommendationStrategy: e(o(), !1),
248
+ /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
249
+ legacyUnsubscribeConversion: e(o(), !1),
248
250
  /** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
249
251
  itemsPriceFormatting: e(o(), !1)
250
252
  }), w = m([
@@ -314,7 +316,7 @@ const p = {
314
316
  ...d.entries,
315
317
  type: u("custom"),
316
318
  /** Custom processor function */
317
- processor: k(
319
+ processor: g(
318
320
  (n) => typeof n == "function",
319
321
  "processor must be a function"
320
322
  )
@@ -334,7 +336,7 @@ const p = {
334
336
  * Return false to cancel the save operation.
335
337
  */
336
338
  externalValidation: e(
337
- k(
339
+ g(
338
340
  (n) => typeof n == "function",
339
341
  "externalValidation must be a function"
340
342
  )
@@ -378,14 +380,14 @@ export {
378
380
  U as FeaturesSchema,
379
381
  K as GuidoConfigSchema,
380
382
  A as IdentitySchema,
381
- N as LegacyRecommendationConfigSchema,
383
+ v as LegacyRecommendationConfigSchema,
382
384
  p as MessageType,
383
385
  E as PartnerSchema,
384
386
  l as ProductType,
385
387
  _ as RegexRuleSchema,
386
388
  q as RemoveRuleSchema,
387
389
  H as ReplaceRuleSchema,
388
- v as TemplateMigrationSchema,
390
+ N as TemplateMigrationSchema,
389
391
  x as TemplateSchema,
390
392
  F as UISchema
391
393
  };
@@ -3,7 +3,7 @@ import o from "./Guido.vue2.js";
3
3
  import i from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var t = function() {
5
5
  var a = this, r = a._self._c, e = a._self._setupProxy;
6
- return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper), r(e.AutoSaveController, { ref: "autoSaveControllerRef" }), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.AuthErrorModal), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? r(e.ValidationErrorDrawer) : a._e(), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
6
+ return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper), r(e.AutoSaveController, { ref: "autoSaveControllerRef" }), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.AuthErrorModal), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), e.isLegacyUnsubscribeConversionEnabled ? r(e.LegacyUnsubscribeConvertedModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? r(e.ValidationErrorDrawer) : a._e(), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
7
7
  return e.emit("onboarding:finished");
8
8
  } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
9
  }, s = [], n = /* @__PURE__ */ i(
@@ -12,9 +12,9 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "98b59f91"
15
+ "415cfac1"
16
16
  );
17
- const c = n.exports;
17
+ const v = n.exports;
18
18
  export {
19
- c as default
19
+ v as default
20
20
  };
@@ -1,74 +1,76 @@
1
- import { defineComponent as ue, defineAsyncComponent as l, ref as W, computed as f, watch as G, onMounted as pe, onUnmounted as fe } from "vue";
2
- import { useCortexBlueprintBridge as ge } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as ye } from "../composables/useEditorLock.js";
4
- import { startEditorOpenMetrics as ve } from "../composables/useEditorOpenMetrics.js";
5
- import { provideGuidoActions as be } from "../composables/useGuidoActions.js";
6
- import { useGuidoStateBridge as Se } from "../composables/useGuidoStateBridge.js";
7
- import { usePartner as he } from "../composables/usePartner.js";
8
- import { useSaveValidationRollout as Ee } from "../composables/useSaveValidationRollout.js";
9
- import { useStripo as we } from "../composables/useStripo.js";
10
- import { useTimerClone as Te } from "../composables/useTimerClone.js";
11
- import { useToaster as ke } from "../composables/useToaster.js";
12
- import { useTranslations as Ce } from "../composables/useTranslations.js";
13
- import { migrate as De } from "../config/migrator/index.js";
1
+ import { defineComponent as fe, defineAsyncComponent as m, ref as W, computed as u, watch as G, onMounted as ge, onUnmounted as ye } from "vue";
2
+ import { useCortexBlueprintBridge as be } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as ve } from "../composables/useEditorLock.js";
4
+ import { startEditorOpenMetrics as Se } from "../composables/useEditorOpenMetrics.js";
5
+ import { provideGuidoActions as he } from "../composables/useGuidoActions.js";
6
+ import { useGuidoStateBridge as Ee } from "../composables/useGuidoStateBridge.js";
7
+ import { usePartner as Ce } from "../composables/usePartner.js";
8
+ import { useSaveValidationRollout as we } from "../composables/useSaveValidationRollout.js";
9
+ import { useStripo as Te } from "../composables/useStripo.js";
10
+ import { useTimerClone as ke } from "../composables/useTimerClone.js";
11
+ import { useToaster as Fe } from "../composables/useToaster.js";
12
+ import { useTranslations as De } from "../composables/useTranslations.js";
13
+ import { migrate as Ie } from "../config/migrator/index.js";
14
14
  import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
15
- import { RIBBON_SELECTOR as Fe } from "../enums/onboarding.js";
16
- import { ToasterTypeOptions as Ie } from "../enums/toaster.js";
17
- import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as Me } from "../extensions/Blocks/Recommendation/store/recommendation.js";
18
- import { disposeUnsubscribeListeners as Re } from "../extensions/Blocks/Unsubscribe/block.js";
19
- import Le from "./organisms/AutoSaveController.vue.js";
20
- import Oe from "./organisms/base/AuthErrorModal.vue.js";
21
- import Ue from "./organisms/base/Toaster.vue.js";
22
- import Ne from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
23
- import _e from "./organisms/header/HeaderWrapper.vue.js";
24
- import Ae from "./organisms/LoadingWrapper.vue.js";
25
- import Pe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
26
- import Be from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
27
- import xe from "./organisms/validation/ValidationErrorDrawer.vue.js";
28
- import { useStripoApi as He } from "../services/stripoApi.js";
29
- import { useConfigStore as Ve } from "../stores/config.js";
30
- import { useDynamicContentStore as We } from "../stores/dynamic-content.js";
31
- import { useEditorStore as w } from "../stores/editor.js";
32
- import { usePreviewStore as Ge } from "../stores/preview.js";
33
- import { useSaveValidationStore as $e } from "../stores/save-validation.js";
34
- import { useTemplateStore as ze } from "../stores/template.js";
35
- import { useUnsubscribeStore as qe } from "../stores/unsubscribe.js";
15
+ import { RIBBON_SELECTOR as Me } from "../enums/onboarding.js";
16
+ import { ToasterTypeOptions as Le } from "../enums/toaster.js";
17
+ import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as Re } from "../extensions/Blocks/Recommendation/store/recommendation.js";
18
+ import { disposeUnsubscribeListeners as Ue } from "../extensions/Blocks/Unsubscribe/block.js";
19
+ import Oe from "./organisms/AutoSaveController.vue.js";
20
+ import Ne from "./organisms/base/AuthErrorModal.vue.js";
21
+ import _e from "./organisms/base/Toaster.vue.js";
22
+ import Ae from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
23
+ import Pe from "./organisms/header/HeaderWrapper.vue.js";
24
+ import Be from "./organisms/LoadingWrapper.vue.js";
25
+ import xe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
26
+ import He from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
27
+ import Ve from "./organisms/validation/ValidationErrorDrawer.vue.js";
28
+ import { useStripoApi as We } from "../services/stripoApi.js";
29
+ import { useConfigStore as Ge } from "../stores/config.js";
30
+ import { useDynamicContentStore as $e } from "../stores/dynamic-content.js";
31
+ import { useEditorStore as C } from "../stores/editor.js";
32
+ import { usePreviewStore as ze } from "../stores/preview.js";
33
+ import { useSaveValidationStore as qe } from "../stores/save-validation.js";
34
+ import { useTemplateStore as Ke } from "../stores/template.js";
35
+ import { useUnsubscribeStore as je } from "../stores/unsubscribe.js";
36
36
  import { readTrackFloor as q } from "../utils/linkTrackingIds.js";
37
- const Mt = /* @__PURE__ */ ue({
37
+ const Rt = /* @__PURE__ */ fe({
38
38
  __name: "Guido",
39
39
  props: {
40
40
  config: null,
41
41
  ready: { type: Boolean, default: !0 }
42
42
  },
43
43
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
44
- setup(K, { expose: j, emit: i }) {
45
- const a = K, n = ve(), J = l(
44
+ setup(K, { expose: j, emit: s }) {
45
+ const a = K, n = Se(), J = m(
46
46
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
47
- ), Q = l(
47
+ ), Q = m(
48
48
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
49
- ), X = l(
49
+ ), X = m(
50
50
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
51
- ), Y = l(
51
+ ), Y = m(
52
52
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
53
- ), T = W(), Z = l(
53
+ ), w = W(), Z = m(
54
54
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
55
- ), g = W(), y = We(), k = qe(), o = Ve();
55
+ ), ee = m(
56
+ () => import("./organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js")
57
+ ), g = W(), y = $e(), T = je(), o = Ge();
56
58
  a.ready && o.init(a.config);
57
- const c = w(), ee = Ge(), u = f(() => c.hasChanges), { isTestPartner: te } = he(), { isEnabled: oe, loadRollout: C } = Ee(), { showToaster: D } = ke(), F = Ce(), I = () => {
59
+ const c = C(), te = ze(), p = u(() => c.hasChanges), { isTestPartner: oe } = Ce(), { isEnabled: re, loadRollout: k } = we(), { showToaster: F } = Fe(), D = De(), I = () => {
58
60
  var t;
59
61
  if (c.isVersionHistoryOpen) {
60
- console.debug("guido:save:silent:blocked", { isVersionHistoryOpen: !0 }), D({
61
- type: Ie.Warning,
62
- message: F("email-editor.save-blocked-outside-editor")
62
+ console.debug("guido:save:silent:blocked", { isVersionHistoryOpen: !0 }), F({
63
+ type: Le.Warning,
64
+ message: D("email-editor.save-blocked-outside-editor")
63
65
  });
64
66
  return;
65
67
  }
66
- return (t = T.value) == null ? void 0 : t.saveSilent();
68
+ return (t = w.value) == null ? void 0 : t.saveSilent();
67
69
  }, M = (t) => {
68
70
  c.loadingStatus = t;
69
71
  };
70
- ge(), Se();
71
- const v = () => {
72
+ be(), Ee();
73
+ const b = () => {
72
74
  var t, e;
73
75
  return {
74
76
  emailId: o.templateId,
@@ -78,27 +80,29 @@ const Mt = /* @__PURE__ */ ue({
78
80
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || $.SAVED_MODULES,
79
81
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || $.DEFAULT_MODULES
80
82
  };
81
- }, { initPlugin: R, preloadRuntime: L } = we(n), { runExclusive: O, beginMount: U, isCurrentMount: b } = ye();
82
- let p = 0;
83
- const { getDefaultTemplate: N } = He(), { cloneTimersOnSave: _, hasTimerBlocks: A } = Te(), re = f(() => {
83
+ }, { initPlugin: L, preloadRuntime: R } = Te(n), { runExclusive: U, beginMount: O, isCurrentMount: v } = ve();
84
+ let f = 0;
85
+ const { getDefaultTemplate: N } = We(), { cloneTimersOnSave: _, hasTimerBlocks: A } = ke(), ne = u(() => {
84
86
  var t;
85
87
  return !((t = o.ui) != null && t.showHeader);
86
- }), ne = f(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ie = f(
88
+ }), se = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ie = u(
89
+ () => o.isFeatureEnabled("legacyUnsubscribeConversion")
90
+ ), ae = u(
87
91
  () => !!z().recommendationConfigs.strategyId
88
92
  );
89
- be({
93
+ he({
90
94
  onBack: () => {
91
- console.debug("guido:back"), i("back");
95
+ console.debug("guido:back"), s("back");
92
96
  },
93
97
  onSaveStart: () => {
94
- console.debug("guido:save:start"), i("save:start");
98
+ console.debug("guido:save:start"), s("save:start");
95
99
  },
96
100
  onSaveComplete: (t) => {
97
- const e = { ...t, metadata: v() };
98
- console.debug("guido:save:complete", e), i("save:complete", e);
101
+ const e = { ...t, metadata: b() };
102
+ console.debug("guido:save:complete", e), s("save:complete", e);
99
103
  },
100
104
  onTestEmailClick: () => {
101
- console.debug("guido:test-email:click"), i("test-email:click");
105
+ console.debug("guido:test-email:click"), s("test-email:click");
102
106
  }
103
107
  });
104
108
  const P = (t) => {
@@ -106,17 +110,17 @@ const Mt = /* @__PURE__ */ ue({
106
110
  }, B = () => {
107
111
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
108
112
  };
109
- G(() => u.value, () => {
110
- i("on-change", u.value);
113
+ G(() => p.value, () => {
114
+ s("on-change", p.value);
111
115
  });
112
116
  const S = (t) => {
113
- const e = t, { attribute: s, position: m } = e.detail;
114
- console.debug("dynamic-content:open", e.detail), i("dynamic-content:open", s, m);
117
+ const e = t, { attribute: i, position: l } = e.detail;
118
+ console.debug("dynamic-content:open", e.detail), s("dynamic-content:open", i, l);
115
119
  };
116
120
  let d = null;
117
121
  const h = () => {
118
122
  var e;
119
- const t = document.querySelector(Fe);
123
+ const t = document.querySelector(Me);
120
124
  (e = g.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
121
125
  }, E = async () => {
122
126
  var t;
@@ -128,58 +132,58 @@ const Mt = /* @__PURE__ */ ue({
128
132
  templateId: o.templateId,
129
133
  variationId: o.variationId
130
134
  });
131
- const e = o.template, s = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", x = (e == null ? void 0 : e.preselectedDynamicContent) || [];
132
- k.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
133
- const se = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, H = o.isFeatureEnabled("linkTrackingIds"), ae = {
135
+ const e = o.template, i = (e == null ? void 0 : e.html) || "", l = (e == null ? void 0 : e.css) || "", x = (e == null ? void 0 : e.preselectedDynamicContent) || [];
136
+ T.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
137
+ const ce = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, H = o.isFeatureEnabled("linkTrackingIds"), de = {
134
138
  partnerName: o.partnerName,
135
139
  campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
136
140
  rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
137
- }, ce = {
141
+ }, me = {
138
142
  itemsPriceFormatting: o.isFeatureEnabled("itemsPriceFormatting")
139
- }, V = (le) => n.timed(
143
+ }, V = (pe) => n.timed(
140
144
  "migration",
141
- () => De(le, se, ae, ce)
145
+ () => Ie(pe, ce, de, me)
142
146
  );
143
147
  let r = {
144
- html: s && await V(s),
145
- css: m
148
+ html: i && await V(i),
149
+ css: l
146
150
  };
147
151
  r.html || (r = await n.timed("default_template", () => N()), r.html = await V(r.html));
148
- const de = H ? q(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
149
- A(r.html) && (r.html = await n.timed("timer_clone", () => _(r.html))), H && (c.trackIdSessionFloor = Math.max(de, q(r.html)));
150
- const me = {
152
+ const le = H ? q(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
153
+ A(r.html) && (r.html = await n.timed("timer_clone", () => _(r.html))), H && (c.trackIdSessionFloor = Math.max(le, q(r.html)));
154
+ const ue = {
151
155
  preselectedDynamicContentList: x,
152
156
  onReady: () => {
153
- console.debug("guido:ready"), i("ready");
157
+ console.debug("guido:ready"), s("ready");
154
158
  }
155
159
  };
156
- p = U(), await R(r, v(), me, r.html !== s), y.selectedDynamicContentList = x;
160
+ f = O(), await L(r, b(), ue, r.html !== i), y.selectedDynamicContentList = x;
157
161
  } catch (e) {
158
162
  console.error("Failed to initialize Stripo editor:", e), n.markFailed();
159
163
  }
160
164
  };
161
- return pe(async () => {
165
+ return ge(async () => {
162
166
  var e;
163
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), w().$reset(), ze().$reset(), $e().$reset(), C(), h();
167
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), C().$reset(), Ke().$reset(), qe().$reset(), k(), h();
164
168
  const t = (e = g.value) == null ? void 0 : e.parentElement;
165
- if (t && (d = new ResizeObserver(h), d.observe(t)), L(), a.ready)
169
+ if (t && (d = new ResizeObserver(h), d.observe(t)), R(), a.ready)
166
170
  await E();
167
171
  else {
168
- const s = G(() => a.ready, (m) => {
169
- m && (s(), E());
172
+ const i = G(() => a.ready, (l) => {
173
+ l && (i(), E());
170
174
  });
171
175
  }
172
176
  document.addEventListener("dynamic-content:open", S);
173
- }), fe(() => {
174
- if (Re(), Me(), n.dispose(), d == null || d.disconnect(), document.removeEventListener("dynamic-content:open", S), b(p))
177
+ }), ye(() => {
178
+ if (Ue(), Re(), n.dispose(), d == null || d.disconnect(), document.removeEventListener("dynamic-content:open", S), v(f))
175
179
  try {
176
- const t = w();
180
+ const t = C();
177
181
  t.isStripoInitialized = !1, t.isAccessibilityTestingOpen = !1, t.imagesHidden = !1, t.colorVisionDeficiency = "";
178
182
  } catch (t) {
179
183
  console.debug("Failed to close the editor readiness gate on unmount", t);
180
184
  }
181
- O(async () => {
182
- if (b(p))
185
+ U(async () => {
186
+ if (v(f))
183
187
  try {
184
188
  window.UIEditor.removeEditor();
185
189
  } catch {
@@ -191,12 +195,12 @@ const Mt = /* @__PURE__ */ ue({
191
195
  insert: P,
192
196
  close: B
193
197
  },
194
- hasChanges: u,
198
+ hasChanges: p,
195
199
  saveSilent: I,
196
200
  setLoading: M
197
- }), { __sfc: !0, openMetrics: n, PreviewContainer: J, OnboardingWrapper: Q, AssignStrategyDrawer: X, RemoveStrategyModal: Y, autoSaveControllerRef: T, LegacyStrategyUpdatedModal: Z, wrapperRef: g, dynamicContentStore: y, unsubscribeStore: k, props: a, configStore: o, editorStore: c, previewStore: ee, hasChanges: u, isTestPartner: te, isSaveValidationEnabled: oe, loadRollout: C, showToaster: D, trans: F, saveSilent: I, setLoading: M, emit: i, buildMetadata: v, initPlugin: R, preloadRuntime: L, runExclusive: O, beginMount: U, isCurrentMount: b, mountGeneration: p, getDefaultTemplate: N, cloneTimersOnSave: _, hasTimerBlocks: A, noHeader: re, isRrsEnabled: ne, hasAssignedStrategy: ie, insertDynamicContent: P, closeDynamicContent: B, handleDynamicContentOpen: S, ribbonObserver: d, updateRibbonOffset: h, startEditor: E, AutoSaveController: Le, AuthErrorModal: Oe, Toaster: Ue, FilterSelectionDrawer: Ne, HeaderWrapper: _e, LoadingWrapper: Ae, SaveAsTemplateDrawer: Pe, UnsubscribeWrapper: Be, ValidationErrorDrawer: xe };
201
+ }), { __sfc: !0, openMetrics: n, PreviewContainer: J, OnboardingWrapper: Q, AssignStrategyDrawer: X, RemoveStrategyModal: Y, autoSaveControllerRef: w, LegacyStrategyUpdatedModal: Z, LegacyUnsubscribeConvertedModal: ee, wrapperRef: g, dynamicContentStore: y, unsubscribeStore: T, props: a, configStore: o, editorStore: c, previewStore: te, hasChanges: p, isTestPartner: oe, isSaveValidationEnabled: re, loadRollout: k, showToaster: F, trans: D, saveSilent: I, setLoading: M, emit: s, buildMetadata: b, initPlugin: L, preloadRuntime: R, runExclusive: U, beginMount: O, isCurrentMount: v, mountGeneration: f, getDefaultTemplate: N, cloneTimersOnSave: _, hasTimerBlocks: A, noHeader: ne, isRrsEnabled: se, isLegacyUnsubscribeConversionEnabled: ie, hasAssignedStrategy: ae, insertDynamicContent: P, closeDynamicContent: B, handleDynamicContentOpen: S, ribbonObserver: d, updateRibbonOffset: h, startEditor: E, AutoSaveController: Oe, AuthErrorModal: Ne, Toaster: _e, FilterSelectionDrawer: Ae, HeaderWrapper: Pe, LoadingWrapper: Be, SaveAsTemplateDrawer: xe, UnsubscribeWrapper: He, ValidationErrorDrawer: Ve };
198
202
  }
199
203
  });
200
204
  export {
201
- Mt as default
205
+ Rt as default
202
206
  };
@@ -0,0 +1,17 @@
1
+ import s from "./LegacyUnsubscribeConvertedModal.vue2.js";
2
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var n = function() {
4
+ var o = this, t = o._self._c, e = o._self._setupProxy;
5
+ return e.isVisible ? t(e.WpModal, { attrs: { id: "guido__legacy-unsubscribe-converted-modal", "close-on-outside-click": !1, "footer-button-options": e.footerButtonOptions, title: e.trans("email-editor.legacy-unsubscribe-converted-modal-title") }, on: { close: e.close, "primary-action": e.close, "secondary-action": e.openAcademy } }, [t("p", [o._v(o._s(e.trans("email-editor.legacy-unsubscribe-converted-modal-message")))])]) : o._e();
6
+ }, a = [], c = /* @__PURE__ */ r(
7
+ s,
8
+ n,
9
+ a,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const d = c.exports;
15
+ export {
16
+ d as default
17
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as n, computed as t } from "vue";
2
+ import i from "../../wrappers/WpModal.vue.js";
3
+ import { useTranslations as a } from "../../../composables/useTranslations.js";
4
+ import { ACADEMY_LINKS as c } from "../../../enums/academy.js";
5
+ import { useEditorStore as p } from "../../../stores/editor.js";
6
+ const L = /* @__PURE__ */ n({
7
+ __name: "LegacyUnsubscribeConvertedModal",
8
+ setup(d) {
9
+ const o = a(), e = p(), r = t(
10
+ () => e.isLegacyUnsubscribeModalRequested && e.isStripoInitialized
11
+ ), s = t(() => ({
12
+ secondaryButton: {
13
+ type: "subtle-primary",
14
+ labelText: o("email-editor.legacy-unsubscribe-converted-modal-visit-academy")
15
+ },
16
+ primaryButton: {
17
+ type: "primary",
18
+ labelText: o("action-builder.ok")
19
+ }
20
+ }));
21
+ return { __sfc: !0, trans: o, editorStore: e, isVisible: r, footerButtonOptions: s, close: () => {
22
+ e.isLegacyUnsubscribeModalRequested = !1;
23
+ }, openAcademy: () => {
24
+ window.open(c.LEGACY_UNSUBSCRIBE_MODULE, "_blank", "noopener,noreferrer");
25
+ }, WpModal: i };
26
+ }
27
+ });
28
+ export {
29
+ L as default
30
+ };
@@ -1,35 +1,44 @@
1
- import { useConfig as T } from "./useConfig.js";
2
- import { useToaster as g } from "./useToaster.js";
1
+ import { useConfig as f } from "./useConfig.js";
2
+ import { useToaster as d } from "./useToaster.js";
3
3
  import { useTranslations as C } from "./useTranslations.js";
4
- import { ToasterTypeOptions as D } from "../enums/toaster.js";
5
- import { buildDynamicContentLookup as f, convertModuleDynamicContent as h } from "../utils/dynamicContentConverter.js";
6
- import { flattenDynamicContentList as O } from "../utils/genericUtil.js";
4
+ import { ToasterTypeOptions as T } from "../enums/toaster.js";
5
+ import { useEditorStore as h } from "../stores/editor.js";
6
+ import { buildDynamicContentLookup as v, convertModuleDynamicContent as D } from "../utils/dynamicContentConverter.js";
7
+ import { flattenDynamicContentList as L } from "../utils/genericUtil.js";
7
8
  import { repairItemsCurrencyAttributes as M } from "../utils/itemsCurrencyRepair.js";
8
- const N = "dynamic-content.unresolved-attributes-on-drop", d = () => {
9
- const { template: p, isFeatureEnabled: s } = T(), { showToaster: a } = g(), y = C();
10
- return { handleModuleAdd: (e, o) => {
11
- var c, l, i;
9
+ import { convertLegacyUnsubscribeInModuleHtml as O } from "../utils/legacyUnsubscribeConversion.js";
10
+ const E = "dynamic-content.unresolved-attributes-on-drop", S = () => {
11
+ const { template: p, isFeatureEnabled: n } = f(), { showToaster: y } = d(), b = C();
12
+ return { handleModuleAdd: (t, r) => {
13
+ var c, i, l;
12
14
  try {
13
- if ((e == null ? void 0 : e.action) !== "ADD" && (e == null ? void 0 : e.action) !== "COPY")
15
+ if ((t == null ? void 0 : t.action) !== "ADD" && (t == null ? void 0 : t.action) !== "COPY")
14
16
  return;
15
- const t = (c = o == null ? void 0 : o.getTargetNode) == null ? void 0 : c.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
16
- if (!t || typeof r != "string")
17
+ const e = (c = r == null ? void 0 : r.getTargetNode) == null ? void 0 : c.call(r), s = (i = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : i.call(e);
18
+ if (!e || typeof s != "string")
17
19
  return;
18
- let n = M(r, {
19
- convertToPriceFormat: s("itemsPriceFormatting")
20
+ let o = M(s, {
21
+ convertToPriceFormat: n("itemsPriceFormatting")
22
+ }), u = !1;
23
+ n("legacyUnsubscribeConversion") && ({ html: o, converted: u } = O(o));
24
+ const m = v(L((l = p.value) == null ? void 0 : l.dynamicContentList));
25
+ let a = [];
26
+ if (m.size > 0 && ({ html: o, unresolved: a } = D(o, m, n("liquidSyntax"))), o !== s && r.modifyHtml(e).replaceWith(o), u)
27
+ try {
28
+ h().isLegacyUnsubscribeModalRequested = !0;
29
+ } catch (g) {
30
+ console.error("Failed to request the legacy unsubscribe modal:", g);
31
+ }
32
+ a.length > 0 && y({
33
+ type: T.Warning,
34
+ message: b(E)
20
35
  });
21
- const u = f(O((i = p.value) == null ? void 0 : i.dynamicContentList));
22
- let m = [];
23
- u.size > 0 && ({ html: n, unresolved: m } = h(n, u, s("liquidSyntax"))), n !== r && o.modifyHtml(t).replaceWith(n), m.length > 0 && a({
24
- type: D.Warning,
25
- message: y(N)
26
- });
27
- } catch (t) {
28
- console.error("Failed to repair module on add:", t);
36
+ } catch (e) {
37
+ console.error("Failed to repair module on add:", e);
29
38
  }
30
39
  } };
31
40
  };
32
41
  export {
33
- N as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
34
- d as useModuleRepair
42
+ E as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
43
+ S as useModuleRepair
35
44
  };
@@ -3,17 +3,18 @@ import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
3
3
  import { migrateFullStoryScripts as c } from "./fullStoryScriptMigrator.js";
4
4
  import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
5
5
  import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
6
- import { migrateProductNameLink as p } from "./productNameLinkMigrator.js";
7
- import { migrateRadioButton as f } from "./radioButtonMigrator.js";
8
- import { migrateRecommendation as l } from "./recommendationMigrator.js";
6
+ import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
7
+ import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
8
+ import { migrateRadioButton as l } from "./radioButtonMigrator.js";
9
+ import { migrateRecommendation as s } from "./recommendationMigrator.js";
9
10
  import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
10
- import { migrateRecommendationTitle as s } from "./recommendationTitleMigrator.js";
11
+ import { migrateRecommendationTitle as b } from "./recommendationTitleMigrator.js";
11
12
  import { migrateSocialIcons as k } from "./socialIconMigrator.js";
12
13
  import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
13
- const H = async (t, i = {}, r, o) => {
14
+ const w = async (t, i = {}, o, r) => {
14
15
  let m = t;
15
- return m = e(m), m = f(m), m = await P(m), m = a(m), m = l(m, i), r && (m = d(m, r)), m = s(m), m = g(m), o != null && o.itemsPriceFormatting && (m = n(m)), m = p(m), m = k(m), m = c(m), m;
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;
16
17
  };
17
18
  export {
18
- H as migrate
19
+ w as migrate
19
20
  };
@@ -0,0 +1,16 @@
1
+ import { useConfigStore as o } from "../../stores/config.js";
2
+ import { useEditorStore as s } from "../../stores/editor.js";
3
+ import { hasLegacyUnsubscribeClass as c, convertLegacyUnsubscribeInDocumentHtml as i } from "../../utils/legacyUnsubscribeConversion.js";
4
+ const b = (e) => {
5
+ try {
6
+ if (!c(e) || !o().isFeatureEnabled("legacyUnsubscribeConversion"))
7
+ return e;
8
+ const { html: r, converted: t } = i(e);
9
+ return t && (s().isLegacyUnsubscribeModalRequested = !0), r;
10
+ } catch (r) {
11
+ return console.error("LegacyUnsubscribeTextMigrator failed:", r), e;
12
+ }
13
+ };
14
+ export {
15
+ b as migrateLegacyUnsubscribeText
16
+ };