@useinsider/guido 3.26.0-beta.e0662fe → 3.26.0-beta.e3febd5

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
@@ -702,7 +702,7 @@ repairs these automatically using the `template.dynamicContentList` catalog (see
702
702
  - **Label match with one attribute** → canonical value: `{{ Phone Number }}` → `{{phone_number}}` (any author `| default:` / format tail is preserved). A label matches a leaf's `text` or its `tag_text` (e.g. `Wishlist Item (8) Name`), case-insensitively.
703
703
  - **Valid tokens are never rewritten**: an exact catalog value, an Items block variable, or an exact entry of `template.customFieldAttributes` (e.g. the host's long-form aliases `name`, `surname`), stays as written — so `{{name | downcase | capitalize}}` survives a drop.
704
704
  - **Catalog attributes the module ends up using are registered** for Save's allow-list, the same way the picker registers them, so a repaired or chosen token does not fail Save as an invalid custom field.
705
- - **Label match with several attributes** (e.g. a bare `Name` shared by a default attribute and a commerce field) is not guessed: the token is left in place and a modal asks the user to pick an attribute per label, showing each option as `category › label`. Applying the choice is one undo step; closing the modal keeps the tokens and shows the warning toaster below. Register these keys host-side: `email-editor.ambiguous-dynamic-content-title`, `email-editor.ambiguous-dynamic-content-message` and `email-editor.ambiguous-dynamic-content-apply` (Cancel reuses `action-builder.cancel`).
705
+ - **Label match with several attributes** (e.g. a bare `Name` shared by a default attribute and a commerce field) is not guessed: the token is left in place and a modal asks the user to pick an attribute per label, showing each option as `category › label`. Applying the choice is one undo step; closing the modal keeps the tokens and shows the warning toaster below. A module whose choice was still open when the design was saved asks again when the design is reopened. Register these keys host-side: `email-editor.ambiguous-dynamic-content-title`, `email-editor.ambiguous-dynamic-content-message` and `email-editor.ambiguous-dynamic-content-apply` (Cancel reuses `action-builder.cancel`).
706
706
  - Liquid nested tokens (`coupon.code`), recommendation-block variables (`123_0_price`), allowed system tokens, and `data-*` product tags are left untouched.
707
707
  - An **unresolvable** token is left in place and raises a single **warning toaster** (translation key `dynamic-content.unresolved-attributes-on-drop`; register the copy host-side).
708
708
 
@@ -1,62 +1,69 @@
1
- import { useConfig as D } from "./useConfig.js";
2
- import { UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY as M } from "./useModuleRepair.js";
3
- import { useToaster as T } from "./useToaster.js";
4
- import { useTranslations as A } from "./useTranslations.js";
5
- import { ModuleDynamicContentAttribute as O } from "../enums/dynamic-content.js";
6
- import { ToasterTypeOptions as R } from "../enums/toaster.js";
7
- import { useDynamicContentStore as S } from "../stores/dynamic-content.js";
8
- import { useModuleDynamicContentStore as _ } from "../stores/module-dynamic-content.js";
9
- import { applyDynamicContentChoices as v } from "../utils/dynamicContentConverter.js";
10
- import { stripPendingMarker as N } from "../utils/dynamicContentPendingMarker.js";
11
- import { extractUsedDynamicContent as w } from "../utils/registerUsedDynamicContent.js";
12
- import { getEditorApi as b, EDITOR_NOT_READY_MESSAGE as H } from "../utils/stripoEditorApi.js";
13
- import { ModificationDescription as u } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
14
- const h = O.Pending, g = (r) => {
15
- const { editorCopilotApi: e } = b();
16
- if (!e)
17
- throw new Error(H);
18
- const c = e.getDocumentRootHtmlNode().querySelector(`[${h}="${r}"]`);
19
- return { api: e, node: c };
20
- }, z = () => {
21
- const r = _(), e = S(), { isFeatureEnabled: c } = D(), { showToaster: E, handleError: d } = T(), C = A();
22
- return { resolve: ({ id: n, items: o }, i) => {
1
+ import { useModuleRepair as T, UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY as A, registerUsedAttributes as D } from "./useModuleRepair.js";
2
+ import { useToaster as C } from "./useToaster.js";
3
+ import { useTranslations as v } from "./useTranslations.js";
4
+ import { ModuleDynamicContentAttribute as R } from "../enums/dynamic-content.js";
5
+ import { ToasterTypeOptions as O } from "../enums/toaster.js";
6
+ import { useModuleDynamicContentStore as b } from "../stores/module-dynamic-content.js";
7
+ import { applyDynamicContentChoices as H } from "../utils/dynamicContentConverter.js";
8
+ import { stripPendingMarker as _ } from "../utils/dynamicContentPendingMarker.js";
9
+ import { getEditorApi as w, EDITOR_NOT_READY_MESSAGE as N } from "../utils/stripoEditorApi.js";
10
+ import { ModificationDescription as f } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
11
+ const c = R.Pending, h = () => {
12
+ const { editorCopilotApi: t } = w();
13
+ if (!t)
14
+ throw new Error(N);
15
+ return { api: t, root: t.getDocumentRootHtmlNode() };
16
+ }, g = (t) => {
17
+ const { api: l, root: p } = h(), a = p.querySelector(`[${c}="${t}"]`);
18
+ return { api: l, node: a };
19
+ }, G = () => {
20
+ const t = b(), { convertDynamicContent: l } = T(), { showToaster: p, handleError: a } = C(), E = v();
21
+ return { resolve: ({ id: o, items: n }, i) => {
23
22
  try {
24
- const { api: t, node: a } = g(n);
25
- if (a) {
26
- const l = /* @__PURE__ */ new Map();
27
- o.forEach((s) => {
28
- const m = i[s.label];
29
- m && s.spellings.forEach((p) => l.set(p, m));
23
+ const { api: e, node: r } = g(o);
24
+ if (r) {
25
+ const s = /* @__PURE__ */ new Map();
26
+ n.forEach((d) => {
27
+ const y = i[d.label];
28
+ y && d.spellings.forEach((M) => s.set(M, y));
30
29
  });
31
- const f = N(
32
- v(a.getOuterHTML(), l, c("liquidSyntax"))
33
- ), y = t.getTemplateModifier();
34
- y.modifyHtml(a).replaceWith(f), y.apply(new u("Resolved dynamic content")), e.registerDynamicContent(w(
35
- f,
36
- o.flatMap((s) => s.candidates.map(({ text: m, value: p }) => ({ text: m, value: p })))
37
- ));
30
+ const m = _(H(r.getOuterHTML(), s)), u = e.getTemplateModifier();
31
+ u.modifyHtml(r).replaceWith(m), u.apply(new f("Resolved dynamic content")), D(m, n.flatMap((d) => d.candidates));
38
32
  }
39
- r.remove(n);
40
- } catch (t) {
41
- d(t, "Failed to apply the dynamic content choice");
33
+ t.remove(o);
34
+ } catch (e) {
35
+ a(e, "Failed to apply the dynamic content choice");
42
36
  }
43
- }, dismiss: (n) => {
37
+ }, dismiss: (o) => {
44
38
  try {
45
- const { api: o, node: i } = g(n);
39
+ const { api: n, node: i } = g(o);
46
40
  if (i) {
47
- const t = o.getTemplateModifier();
48
- t.modifyHtml(i).removeAttribute(h), t.apply(new u("Cleared pending dynamic content").asHidden()), E({
49
- type: R.Warning,
50
- message: C(M)
41
+ const e = n.getTemplateModifier();
42
+ e.modifyHtml(i).removeAttribute(c), e.apply(new f("Cleared pending dynamic content").asHidden()), p({
43
+ type: O.Warning,
44
+ message: E(A)
51
45
  });
52
46
  }
53
- } catch (o) {
54
- d(o, "Failed to dismiss the dynamic content choice");
47
+ } catch (n) {
48
+ a(n, "Failed to dismiss the dynamic content choice");
55
49
  } finally {
56
- r.remove(n);
50
+ t.remove(o);
51
+ }
52
+ }, restorePending: () => {
53
+ try {
54
+ const { api: o, root: n } = h(), i = [];
55
+ if (n.querySelectorAll(`[${c}]`).forEach((e) => {
56
+ const r = e.getAttribute(c), { ambiguous: s } = l(e.getOuterHTML());
57
+ !r || s.length === 0 ? i.push(e) : t.queue.some((m) => m.id === r) || t.enqueue({ id: r, items: s });
58
+ }), i.length > 0) {
59
+ const e = o.getTemplateModifier();
60
+ i.forEach((r) => e.modifyHtml(r).removeAttribute(c)), e.apply(new f("Cleared pending dynamic content").asHidden());
61
+ }
62
+ } catch (o) {
63
+ console.error("Failed to restore pending dynamic content:", o);
57
64
  }
58
65
  } };
59
66
  };
60
67
  export {
61
- z as useAmbiguousDynamicContent
68
+ G as useAmbiguousDynamicContent
62
69
  };
@@ -1,68 +1,75 @@
1
- import { useConfig as A } from "./useConfig.js";
1
+ import { useConfig as h } from "./useConfig.js";
2
2
  import { useToaster as v } from "./useToaster.js";
3
- import { useTranslations as O } from "./useTranslations.js";
4
- import { ModuleDynamicContentAttribute as E } from "../enums/dynamic-content.js";
5
- import { ToasterTypeOptions as L } from "../enums/toaster.js";
6
- import { itemsBlockDynamicVariables as S } from "../extensions/Blocks/Items/enums/productEnums.js";
7
- import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
8
- import { useEditorStore as _ } from "../stores/editor.js";
9
- import { useModuleDynamicContentStore as F } from "../stores/module-dynamic-content.js";
10
- import { buildDynamicContentLookup as P, convertModuleDynamicContent as q } from "../utils/dynamicContentConverter.js";
11
- import { stripPendingMarker as N } from "../utils/dynamicContentPendingMarker.js";
12
- import { flattenDynamicContentCandidates as R } from "../utils/genericUtil.js";
13
- import { repairItemsCurrencyAttributes as k } from "../utils/itemsCurrencyRepair.js";
14
- import { convertLegacyUnsubscribeInModuleHtml as $ } from "../utils/legacyUnsubscribeConversion.js";
15
- import { extractUsedDynamicContent as x } from "../utils/registerUsedDynamicContent.js";
16
- const H = "dynamic-content.unresolved-attributes-on-drop", I = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
- let M = 0;
18
- const z = (o) => {
19
- M += 1;
20
- const r = `${Date.now().toString(36)}-${M}`;
21
- return { html: o.replace(I, `$1 ${E.Pending}="${r}"`), id: r };
22
- }, Y = (o, r) => {
3
+ import { useTranslations as M } from "./useTranslations.js";
4
+ import { ModuleDynamicContentAttribute as T } from "../enums/dynamic-content.js";
5
+ import { ToasterTypeOptions as A } from "../enums/toaster.js";
6
+ import { itemsBlockDynamicVariables as O } from "../extensions/Blocks/Items/enums/productEnums.js";
7
+ import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
8
+ import { useEditorStore as L } from "../stores/editor.js";
9
+ import { useModuleDynamicContentStore as U } from "../stores/module-dynamic-content.js";
10
+ import { buildDynamicContentLookup as _, convertModuleDynamicContent as F } from "../utils/dynamicContentConverter.js";
11
+ import { stripPendingMarker as P } from "../utils/dynamicContentPendingMarker.js";
12
+ import { flattenDynamicContentCandidates as S } from "../utils/genericUtil.js";
13
+ import { repairItemsCurrencyAttributes as N } from "../utils/itemsCurrencyRepair.js";
14
+ import { convertLegacyUnsubscribeInModuleHtml as R } from "../utils/legacyUnsubscribeConversion.js";
15
+ import { extractUsedDynamicContent as k } from "../utils/registerUsedDynamicContent.js";
16
+ const q = "dynamic-content.unresolved-attributes-on-drop", H = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
+ let y = 0;
18
+ const $ = (s) => {
19
+ y += 1;
20
+ const o = `${Date.now().toString(36)}-${y}`;
21
+ return { html: s.replace(H, `$1 ${T.Pending}="${o}"`), id: o };
22
+ }, I = (s, o) => {
23
23
  try {
24
- const n = x(o, r.map(({ text: c, value: a }) => ({ text: c, value: a })));
25
- n.length > 0 && U().registerDynamicContent(n);
26
- } catch (n) {
27
- console.error("Failed to register module dynamic content:", n);
24
+ const i = k(s, o.map(({ text: a, value: m }) => ({ text: a, value: m })));
25
+ i.length > 0 && E().registerDynamicContent(i);
26
+ } catch (i) {
27
+ console.error("Failed to register module dynamic content:", i);
28
28
  }
29
- }, ne = () => {
30
- const { template: o, isFeatureEnabled: r } = A(), { showToaster: n } = v(), c = O();
31
- return { handleModuleAdd: (i, s) => {
32
- var d, p, y, g;
29
+ }, re = () => {
30
+ const { template: s, isFeatureEnabled: o } = h(), { showToaster: i } = v(), a = M(), m = (r) => {
31
+ var u, e;
32
+ const t = o("liquidSyntax") ? [] : S((u = s.value) == null ? void 0 : u.dynamicContentList), c = _(t);
33
+ return c.size === 0 ? { html: r, unresolved: [], ambiguous: [], candidates: t } : {
34
+ ...F(
35
+ r,
36
+ c,
37
+ [...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...O]
38
+ ),
39
+ candidates: t
40
+ };
41
+ };
42
+ return { handleModuleAdd: (r, t) => {
43
+ var c, u;
33
44
  try {
34
- if ((i == null ? void 0 : i.action) !== "ADD" && (i == null ? void 0 : i.action) !== "COPY")
45
+ if ((r == null ? void 0 : r.action) !== "ADD" && (r == null ? void 0 : r.action) !== "COPY")
35
46
  return;
36
- const e = (d = s == null ? void 0 : s.getTargetNode) == null ? void 0 : d.call(s), u = (p = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : p.call(e);
37
- if (!e || typeof u != "string")
47
+ const e = (c = t == null ? void 0 : t.getTargetNode) == null ? void 0 : c.call(t), l = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
48
+ if (!e || typeof l != "string")
38
49
  return;
39
- let t = N(k(u, {
40
- convertToPriceFormat: r("itemsPriceFormatting")
41
- })), f = !1;
42
- r("legacyUnsubscribeConversion") && ({ html: t, converted: f } = $(t));
43
- const b = r("liquidSyntax"), C = b ? [] : R((y = o.value) == null ? void 0 : y.dynamicContentList), D = P(C);
44
- let h = [], l = [], m = null;
45
- if (D.size > 0 && ({ html: t, unresolved: h, ambiguous: l } = q(
46
- t,
47
- D,
48
- b,
49
- [...((g = o.value) == null ? void 0 : g.customFieldAttributes) ?? [], ...S]
50
- )), l.length > 0 && ({ html: t, id: m } = z(t)), t !== u && s.modifyHtml(e).replaceWith(t), Y(t, C), f)
50
+ let n = P(N(l, {
51
+ convertToPriceFormat: o("itemsPriceFormatting")
52
+ })), p = !1;
53
+ o("legacyUnsubscribeConversion") && ({ html: n, converted: p } = R(n));
54
+ const { html: f, unresolved: b, ambiguous: g, candidates: C } = m(n);
55
+ let d = null;
56
+ if (n = f, g.length > 0 && ({ html: n, id: d } = $(n)), n !== l && t.modifyHtml(e).replaceWith(n), I(n, C), p)
51
57
  try {
52
- _().isLegacyUnsubscribeModalRequested = !0;
53
- } catch (T) {
54
- console.error("Failed to request the legacy unsubscribe modal:", T);
58
+ L().isLegacyUnsubscribeModalRequested = !0;
59
+ } catch (D) {
60
+ console.error("Failed to request the legacy unsubscribe modal:", D);
55
61
  }
56
- m && F().enqueue({ id: m, items: l }), h.length > 0 && n({
57
- type: L.Warning,
58
- message: c(H)
62
+ d && U().enqueue({ id: d, items: g }), b.length > 0 && i({
63
+ type: A.Warning,
64
+ message: a(q)
59
65
  });
60
66
  } catch (e) {
61
67
  console.error("Failed to repair module on add:", e);
62
68
  }
63
- } };
69
+ }, convertDynamicContent: m };
64
70
  };
65
71
  export {
66
- H as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
67
- ne as useModuleRepair
72
+ q as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
73
+ I as registerUsedAttributes,
74
+ re as useModuleRepair
68
75
  };
@@ -1,51 +1,52 @@
1
- import { useActionsApi as N } from "./useActionsApi.js";
2
- import { useBlocksConfig as j } from "./useBlocksConfig.js";
3
- import { useConfig as z } from "./useConfig.js";
1
+ import { useActionsApi as j } from "./useActionsApi.js";
2
+ import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
3
+ import { useBlocksConfig as $ } from "./useBlocksConfig.js";
4
+ import { useConfig as G } from "./useConfig.js";
4
5
  import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as $ } from "./useFullStoryBridge.js";
6
- import { useModuleRepair as G } from "./useModuleRepair.js";
7
- import { useStripoEventHandler as X } from "./useStripoEventHandler.js";
8
- import { useStripoNotifications as J } from "./useStripoNotifications.js";
9
- import { useToaster as K } from "./useToaster.js";
10
- import { localePatch as Q } from "../config/i18n/index.js";
6
+ import { useFullStoryBridge as X } from "./useFullStoryBridge.js";
7
+ import { useModuleRepair as J } from "./useModuleRepair.js";
8
+ import { useStripoEventHandler as K } from "./useStripoEventHandler.js";
9
+ import { useStripoNotifications as Q } from "./useStripoNotifications.js";
10
+ import { useToaster as W } from "./useToaster.js";
11
+ import { localePatch as Y } from "../config/i18n/index.js";
11
12
  import { en as B } from "../config/i18n/en/index.js";
12
- import { ToasterTypeOptions as W } from "../enums/toaster.js";
13
- import { useStripoApi as Y } from "../services/stripoApi.js";
14
- import Z from "../static/styles/customEditorStyle.css.js";
13
+ import { ToasterTypeOptions as Z } from "../enums/toaster.js";
14
+ import { useStripoApi as ee } from "../services/stripoApi.js";
15
+ import te from "../static/styles/customEditorStyle.css.js";
15
16
  import { useEditorStore as T } from "../stores/editor.js";
16
- import { buildMergeTagEntries as ee, flattenDynamicContentList as te } from "../utils/genericUtil.js";
17
- import { getStripoRuntimeBaseUrl as oe } from "../utils/stripoRuntime.js";
17
+ import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
18
+ import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
18
19
  let d = null, F = !1;
19
- const ke = (t) => {
20
- const { features: u, template: m, isFeatureEnabled: p } = z(), { handleError: f, showToaster: A } = K(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: U } = Y(), { handleEvent: V } = X(), { handleModuleAdd: D } = G(), { getStripoBlocksConfig: I } = j(), { getStripoNotifications: L } = J(), g = () => d || (d = new Promise((n, a) => {
20
+ const ve = (t) => {
21
+ const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, s) => {
21
22
  if (document.getElementById("UiEditorScript")) {
22
23
  n();
23
24
  return;
24
25
  }
25
- const i = oe();
26
+ const i = ie();
26
27
  if (!i) {
27
- a(
28
+ s(
28
29
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
29
30
  );
30
31
  return;
31
32
  }
32
- const s = `${i}UIEditor.js`, e = document.createElement("script");
33
- e.id = "UiEditorScript", e.type = "module", e.src = s, e.onload = () => {
33
+ const a = `${i}UIEditor.js`, e = document.createElement("script");
34
+ e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
34
35
  F = !0, n();
35
36
  }, e.onerror = () => {
36
- e.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
37
+ e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
37
38
  }, document.body.appendChild(e);
38
39
  }), d.catch(() => {
39
40
  d = null;
40
- }), d), q = async (n, a, i, s = [], e = !1, c = !1) => {
41
+ }), d), x = async (n, s, i, a = [], e = !1, c = !1) => {
41
42
  var w, k, b, _;
42
- const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: x } = await I();
43
+ const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
43
44
  t.mark("blocks_config_ready");
44
- const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, O = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), H = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
+ const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
46
  t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
46
47
  document.querySelector("#guido-editor"),
47
48
  {
48
- metadata: a,
49
+ metadata: s,
49
50
  html: S,
50
51
  css: y,
51
52
  forceRecreate: C,
@@ -58,11 +59,11 @@ const ke = (t) => {
58
59
  customAppearanceMergetags: !p("liquidSyntax"),
59
60
  customAppearanceMergetagsBorderColor: "#f1f3fe",
60
61
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
61
- customViewStyles: Z,
62
+ customViewStyles: te,
62
63
  conditionsEnabled: h,
63
64
  customConditionsEnabled: h,
64
65
  enableXSSSecurity: !0,
65
- modulesDisabled: O,
66
+ modulesDisabled: H,
66
67
  syncModulesEnabled: e,
67
68
  messageSettingsEnabled: !0,
68
69
  displayGmailAnnotations: !0,
@@ -73,18 +74,18 @@ const ke = (t) => {
73
74
  copyPasteEnabled: !1,
74
75
  selectElementAfterDrop: !0,
75
76
  sameFontSizeForOutlook: !0,
76
- allowedScriptSourceDomains: H,
77
+ allowedScriptSourceDomains: M,
77
78
  ...E ? { baseBlocks: E } : {},
78
79
  editorFonts: {
79
80
  showDefaultStandardFonts: !0,
80
81
  showDefaultNotStandardFonts: !0,
81
- customFonts: s
82
+ customFonts: a
82
83
  },
83
84
  mergeTags: [
84
85
  {
85
- entries: ee(
86
+ entries: oe(
86
87
  i.preselectedDynamicContentList,
87
- te((_ = m.value) == null ? void 0 : _.dynamicContentList),
88
+ re((_ = m.value) == null ? void 0 : _.dynamicContentList),
88
89
  p("liquidSyntax")
89
90
  )
90
91
  }
@@ -100,8 +101,8 @@ const ke = (t) => {
100
101
  },
101
102
  onTemplateLoaded() {
102
103
  try {
103
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = N(), { injectFullStory: M } = $();
104
- v().importCss(), r(), M(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
104
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
105
+ v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
105
106
  o.hasChanges = !1;
106
107
  }, 1e3), t.markReady();
107
108
  } catch (r) {
@@ -120,9 +121,9 @@ const ke = (t) => {
120
121
  onDataChanged() {
121
122
  o.hasChanges = !0, o.changeSeq += 1;
122
123
  },
123
- onEvent: V,
124
- onModuleAdd: D,
125
- notifications: L(),
124
+ onEvent: U,
125
+ onModuleAdd: V,
126
+ notifications: q(),
126
127
  // Stripo deselects the block on any click outside the canvas, so every surface
127
128
  // that belongs to the block's own flow has to be listed here (SD-153273).
128
129
  ignoreClickOutsideSelectors: [
@@ -132,23 +133,23 @@ const ke = (t) => {
132
133
  ".in-modal-v2-wrapper",
133
134
  ".in-toasts-wrapper"
134
135
  ],
135
- extensions: x,
136
- localePatch: Q
136
+ extensions: O,
137
+ localePatch: Y
137
138
  }
138
139
  );
139
140
  };
140
- return { initPlugin: async (n, a, i, s = !1) => {
141
+ return { initPlugin: async (n, s, i, a = !1) => {
141
142
  const e = T();
142
143
  try {
143
144
  t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
144
145
  const [c, o] = await Promise.all([
145
146
  R(),
146
- U()
147
+ D()
147
148
  ]);
148
- t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await q(n, a, i, c, o, s);
149
+ t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, s, i, c, o, a);
149
150
  } catch {
150
151
  e.loadingStatus = !1, A({
151
- type: W.Error,
152
+ type: Z.Error,
152
153
  message: B["An error has occurred. Please report the error code to support."],
153
154
  actionButton: {
154
155
  text: B["Reload page"],
@@ -162,5 +163,5 @@ const ke = (t) => {
162
163
  } };
163
164
  };
164
165
  export {
165
- ke as useStripo
166
+ ve as useStripo
166
167
  };
@@ -1,4 +1,4 @@
1
- const o = "3.26.0-beta.e0662fe", e = { stripo: { version: "2.83.1" } }, s = {
1
+ const o = "3.26.0-beta.e3febd5", e = { stripo: { version: "2.83.1" } }, s = {
2
2
  version: o,
3
3
  guido: e
4
4
  };
@@ -3,4 +3,5 @@ import { type PendingModuleDynamicContent } from '@@/Stores/module-dynamic-conte
3
3
  export declare const useAmbiguousDynamicContent: () => {
4
4
  resolve: ({ id, items }: PendingModuleDynamicContent, selections: Record<string, string>) => void;
5
5
  dismiss: (id: string) => void;
6
+ restorePending: () => void;
6
7
  };
@@ -1,9 +1,15 @@
1
+ import type { DynamicContentCandidate } from '@@/Types/generic';
1
2
  import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
3
+ import { type DynamicContentConversionResult } from '@@/Utils/dynamicContentConverter';
2
4
  export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
5
+ export declare const registerUsedAttributes: (html: string, candidates: DynamicContentCandidate[]) => void;
3
6
  /**
4
7
  * Repairs dropped/copied saved modules (items currency, linkless legacy unsubscribe → text block,
5
8
  * dynamic-content labels → tokens) in one write-back; wired via Stripo's `onModuleAdd` (see `useStripo`).
6
9
  */
7
10
  export declare const useModuleRepair: () => {
8
11
  handleModuleAdd: (data: ModuleAddData, modifier: ModuleModifier) => void;
12
+ convertDynamicContent: (html: string) => DynamicContentConversionResult & {
13
+ candidates: DynamicContentCandidate[];
14
+ };
9
15
  };
@@ -23,7 +23,7 @@ export declare const buildDynamicContentLookup: (candidates: DynamicContentCandi
23
23
  * Rewrites label tokens with one candidate; exact values/`validTokens` stay. Several candidates
24
24
  * → `ambiguous`, none → `unresolved`; reported text is never changed.
25
25
  */
26
- export declare const convertModuleDynamicContent: (html: string, lookup: DynamicContentLookup, liquidSyntax: boolean, validTokens?: string[]) => DynamicContentConversionResult;
26
+ export declare const convertModuleDynamicContent: (html: string, lookup: DynamicContentLookup, validTokens?: string[]) => DynamicContentConversionResult;
27
27
  /** Rewrites every token whose exact name the user resolved (`spelling → value`), keeping tails. */
28
- export declare const applyDynamicContentChoices: (html: string, choices: Map<string, string>, liquidSyntax: boolean) => string;
28
+ export declare const applyDynamicContentChoices: (html: string, choices: Map<string, string>) => string;
29
29
  export {};
@@ -1,45 +1,45 @@
1
- import { DATA_ATTRIBUTE_REGEX as A, DYNAMIC_CONTENT_TAG_REGEX as T, ALLOWED_DYNAMIC_SYSTEM_TOKENS as D } from "../enums/html-validator.js";
2
- import { dynamicContentToMergeTags as f } from "./genericUtil.js";
3
- const h = "guidoDataMask", v = "EndDataMask", M = /guidoDataMask(\d+)EndDataMask/g, C = /^\d+_\d+_.+$/, E = (e) => e.trim().toLowerCase(), _ = (e, n) => {
1
+ import { DATA_ATTRIBUTE_REGEX as g, DYNAMIC_CONTENT_TAG_REGEX as A, ALLOWED_DYNAMIC_SYSTEM_TOKENS as T } from "../enums/html-validator.js";
2
+ import { dynamicContentToMergeTags as D } from "./genericUtil.js";
3
+ const f = "guidoDataMask", h = "EndDataMask", v = /guidoDataMask(\d+)EndDataMask/g, M = /^\d+_\d+_.+$/, d = (e) => e.trim().toLowerCase(), E = (e, n) => {
4
4
  const t = [];
5
- return e.replace(A, (a) => (t.push(a), `${h}${t.length - 1}${v}`)).replace(T, (a) => {
6
- const c = a.slice(2, -2), l = c.indexOf("|"), i = l === -1 ? c : c.slice(0, l);
7
- return n({ tag: a, inner: c, pipeIndex: l, namePart: i, name: i.trim() });
8
- }).replace(M, (a, c) => t[Number(c)]);
9
- }, g = (e, n, t) => e.pipeIndex !== -1 ? `{{${e.namePart.replace(e.name, () => n)}${e.inner.slice(e.pipeIndex)}}}` : f([{ text: e.name, value: n }], t)[0].value, x = (e) => {
5
+ return e.replace(g, (o) => (t.push(o), `${f}${t.length - 1}${h}`)).replace(A, (o) => {
6
+ const i = o.slice(2, -2), c = i.indexOf("|"), l = c === -1 ? i : i.slice(0, c);
7
+ return n({ tag: o, inner: i, pipeIndex: c, namePart: l, name: l.trim() });
8
+ }).replace(v, (o, i) => t[Number(i)]);
9
+ }, _ = (e, n) => e.pipeIndex !== -1 ? `{{${e.namePart.replace(e.name, () => n)}${e.inner.slice(e.pipeIndex)}}}` : D([{ text: e.name, value: n }])[0].value, w = (e) => {
10
10
  const n = /* @__PURE__ */ new Map();
11
11
  return e.forEach((t) => {
12
- new Set([t.text, t.tagText].map(E)).forEach((r) => {
13
- if (!r)
12
+ new Set([t.text, t.tagText].map(d)).forEach((s) => {
13
+ if (!s)
14
14
  return;
15
- let s = n.get(r);
16
- s || (s = [], n.set(r, s)), s.some((a) => a.value === t.value) || s.push(t);
15
+ let a = n.get(s);
16
+ a || (a = [], n.set(s, a)), a.some((o) => o.value === t.value) || a.push(t);
17
17
  });
18
18
  }), n;
19
- }, I = (e, n, t, r = []) => {
20
- const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set([
21
- ...[...n.values()].flat().map((i) => i.value),
22
- ...r
19
+ }, x = (e, n, t = []) => {
20
+ const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
21
+ ...[...n.values()].flat().map((c) => c.value),
22
+ ...t
23
23
  ]);
24
- return { html: _(e, (i) => {
25
- const { tag: m, name: o } = i;
26
- if (o === "" || D.includes(o) || o.includes(".") || C.test(o) || c.has(o))
27
- return m;
28
- const p = E(o), u = n.get(p) ?? [];
24
+ return { html: E(e, (c) => {
25
+ const { tag: l, name: r } = c;
26
+ if (r === "" || T.includes(r) || r.includes(".") || M.test(r) || o.has(r))
27
+ return l;
28
+ const m = d(r), u = n.get(m) ?? [];
29
29
  if (u.length === 1)
30
- return g(i, u[0].value, t);
30
+ return _(c, u[0].value);
31
31
  if (u.length > 1) {
32
- const d = a.get(p) ?? { label: o, spellings: [], candidates: u };
33
- return d.spellings.includes(o) || d.spellings.push(o), a.set(p, d), m;
32
+ const p = a.get(m) ?? { label: r, spellings: [], candidates: u };
33
+ return p.spellings.includes(r) || p.spellings.push(r), a.set(m, p), l;
34
34
  }
35
- return s.add(o), m;
35
+ return s.add(r), l;
36
36
  }), unresolved: [...s], ambiguous: [...a.values()] };
37
- }, R = (e, n, t) => _(e, (r) => {
38
- const s = n.get(r.name);
39
- return s ? g(r, s, t) : r.tag;
37
+ }, I = (e, n) => E(e, (t) => {
38
+ const s = n.get(t.name);
39
+ return s ? _(t, s) : t.tag;
40
40
  });
41
41
  export {
42
- R as applyDynamicContentChoices,
43
- x as buildDynamicContentLookup,
44
- I as convertModuleDynamicContent
42
+ I as applyDynamicContentChoices,
43
+ w as buildDynamicContentLookup,
44
+ x as convertModuleDynamicContent
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.26.0-beta.e0662fe",
3
+ "version": "3.26.0-beta.e3febd5",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",