@useinsider/guido 3.27.0-beta.ee85b86 → 3.27.1-beta.4ca8aae

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 (37) hide show
  1. package/README.md +5 -10
  2. package/dist/components/Guido.vue.js +7 -7
  3. package/dist/components/Guido.vue2.js +83 -86
  4. package/dist/composables/useHtmlCompiler.js +8 -9
  5. package/dist/composables/useModuleRepair.js +32 -63
  6. package/dist/composables/useStripo.js +43 -44
  7. package/dist/config/compiler/htmlCompilerRules.js +6 -16
  8. package/dist/config/migrator/unsubscribeMigrator.js +112 -100
  9. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +58 -40
  10. package/dist/extensions/Blocks/Unsubscribe/block.js +104 -96
  11. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
  12. package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +5 -0
  13. package/dist/guido.css +1 -1
  14. package/dist/package.json.js +3 -3
  15. package/dist/src/@types/generic.d.ts +0 -7
  16. package/dist/src/composables/useModuleRepair.d.ts +0 -6
  17. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  18. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  19. package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +1 -0
  20. package/dist/src/utils/dynamicContentConverter.d.ts +18 -20
  21. package/dist/src/utils/genericUtil.d.ts +8 -4
  22. package/dist/static/stripo-runtime-manifest.json.js +2 -2
  23. package/dist/utils/dynamicContentConverter.js +27 -41
  24. package/dist/utils/genericUtil.js +39 -39
  25. package/dist/utils/templatePreparation.js +9 -9
  26. package/package.json +2 -2
  27. package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js +0 -24
  28. package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue2.js +0 -59
  29. package/dist/composables/useAmbiguousDynamicContent.js +0 -72
  30. package/dist/enums/dynamic-content.js +0 -4
  31. package/dist/src/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.d.ts +0 -2
  32. package/dist/src/composables/useAmbiguousDynamicContent.d.ts +0 -7
  33. package/dist/src/enums/dynamic-content.d.ts +0 -3
  34. package/dist/src/stores/module-dynamic-content.d.ts +0 -30
  35. package/dist/src/utils/dynamicContentPendingMarker.d.ts +0 -2
  36. package/dist/stores/module-dynamic-content.js +0 -20
  37. package/dist/utils/dynamicContentPendingMarker.js +0 -6
@@ -1,45 +1,31 @@
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
- const t = [];
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
- const n = /* @__PURE__ */ new Map();
11
- return e.forEach((t) => {
12
- new Set([t.text, t.tagText].map(d)).forEach((s) => {
13
- if (!s)
14
- return;
15
- let a = n.get(s);
16
- a || (a = [], n.set(s, a)), a.some((o) => o.value === t.value) || a.push(t);
1
+ import { DATA_ATTRIBUTE_REGEX as A, DYNAMIC_CONTENT_TAG_REGEX as m, ALLOWED_DYNAMIC_SYSTEM_TOKENS as D } from "../enums/html-validator.js";
2
+ import { dynamicContentToMergeTags as T } from "./genericUtil.js";
3
+ const p = "guidoDataMask", M = "EndDataMask", f = /guidoDataMask(\d+)EndDataMask/g, h = /^\d+_\d+_.+$/, E = (o) => o.trim().toLowerCase(), I = (...o) => {
4
+ const r = /* @__PURE__ */ new Map();
5
+ return o.forEach((i) => {
6
+ i.forEach((s) => {
7
+ const a = E(s.text);
8
+ a && r.set(a, s);
17
9
  });
18
- }), n;
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
- ]);
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
- if (u.length === 1)
30
- return _(c, u[0].value);
31
- if (u.length > 1) {
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;
10
+ }), r;
11
+ }, w = (o, r, i) => {
12
+ const s = /* @__PURE__ */ new Set(), a = new Set([...r.values()].map((e) => e.value)), u = [];
13
+ return { html: o.replace(A, (e) => (u.push(e), `${p}${u.length - 1}${M}`)).replace(m, (e) => {
14
+ const n = e.slice(2, -2), c = n.indexOf("|"), l = c === -1 ? n : n.slice(0, c), t = l.trim();
15
+ if (t === "" || D.includes(t) || t.includes(".") || h.test(t) || a.has(t))
16
+ return e;
17
+ const d = r.get(E(t));
18
+ if (d) {
19
+ if (c !== -1) {
20
+ const _ = n.slice(c);
21
+ return `{{${l.replace(t, () => d.value)}${_}}}`;
22
+ }
23
+ return T([d], i)[0].value;
34
24
  }
35
- return s.add(r), l;
36
- }), unresolved: [...s], ambiguous: [...a.values()] };
37
- }, I = (e, n) => E(e, (t) => {
38
- const s = n.get(t.name);
39
- return s ? _(t, s) : t.tag;
40
- });
25
+ return s.add(t), e;
26
+ }).replace(f, (e, n) => u[Number(n)]), unresolved: [...s] };
27
+ };
41
28
  export {
42
- I as applyDynamicContentChoices,
43
- w as buildDynamicContentLookup,
44
- x as convertModuleDynamicContent
29
+ I as buildDynamicContentLookup,
30
+ w as convertModuleDynamicContent
45
31
  };
@@ -1,78 +1,78 @@
1
- import { formatToLiquidFilter as y, liquidFilterToFormat as g, quoteArgument as m } from "./liquidDynamicContent.js";
2
- const v = (t) => {
1
+ import { formatToLiquidFilter as b, quoteArgument as y, liquidFilterToFormat as h } from "./liquidDynamicContent.js";
2
+ const g = (t) => {
3
3
  if (!t.includes("="))
4
4
  return null;
5
5
  const [r, e] = t.split("=");
6
6
  return { key: r.trim(), value: e.trim() };
7
- }, u = "default:", i = (t) => {
8
- if (!t.startsWith(u))
7
+ }, c = "default:", f = (t) => {
8
+ if (!t.startsWith(c))
9
9
  return t;
10
- const r = t.slice(u.length).trim(), e = (n) => r.length >= 2 && r.startsWith(n) && r.endsWith(n);
10
+ const r = t.slice(c.length).trim(), e = (l) => r.length >= 2 && r.startsWith(l) && r.endsWith(l);
11
11
  return e('"') || e("'") ? r.slice(1, -1) : r;
12
- }, $ = (t) => {
13
- const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [n] = e, s = {
12
+ }, k = (t) => {
13
+ const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [l] = e, s = {
14
14
  text: t.label,
15
- value: n || ""
15
+ value: l || ""
16
16
  };
17
17
  if (e.length >= 2) {
18
- const [, a, o] = e;
19
- if (a.startsWith(u))
20
- s.fallback = i(a);
18
+ const [, a, n] = e;
19
+ if (a.startsWith(c))
20
+ s.fallback = f(a);
21
21
  else {
22
- const l = g(a) ?? v(a);
23
- l ? s.format = l : o || (s.fallback = a), o && (s.fallback = i(o));
22
+ const o = h(a) ?? g(a);
23
+ o ? s.format = o : n || (s.fallback = a), n && (s.fallback = f(n));
24
24
  }
25
25
  }
26
26
  return s;
27
- }, h = (t) => {
28
- const e = !Number.isNaN(Number(t)) && t.trim() !== "" ? t : m(t);
29
- return e === null ? null : `${u} ${e}`;
30
27
  }, p = (t) => {
31
- const r = t.format ? y(t.format) : null, e = t.fallback ? h(t.fallback) : null, n = [t.value, r, e].filter(Boolean);
28
+ const e = !Number.isNaN(Number(t)) && t.trim() !== "" ? t : y(t);
29
+ return e === null ? null : `${c} ${e}`;
30
+ }, v = (t) => {
31
+ const r = t.format ? b(t.format) : null, e = t.fallback ? p(t.fallback) : null, l = [t.value, r, e].filter(Boolean);
32
32
  return {
33
33
  label: [t.text, r, e && t.fallback].filter(Boolean).join(" | "),
34
- value: `{{ ${n.join(" | ")} }}`
34
+ value: `{{ ${l.join(" | ")} }}`
35
35
  };
36
- }, b = (t, r = !1) => t.map((e) => r ? p(e) : e.format ? {
36
+ }, i = (t, r = !1) => t.map((e) => r ? v(e) : e.format ? {
37
37
  label: `${e.text} | ${e.format.key}=${e.format.value}`,
38
38
  value: `{{${e.value}|${e.format.key}=${e.format.value}}}`
39
39
  } : {
40
40
  label: e.fallback ? `${e.text} | ${e.fallback}` : e.text,
41
41
  value: e.fallback ? `{{${e.value}|${e.fallback}}}` : `{{${e.value}}}`
42
- }), k = (t) => {
43
- const r = [], e = /* @__PURE__ */ new Set(), n = (a, o) => {
44
- Array.isArray(a) && a.forEach((l) => {
45
- const f = [...l.children ?? [], ...l.select_items ?? []], c = l.text || l.tag_text;
46
- if (f.length > 0) {
47
- n(f, c ? [...o, c] : o);
42
+ }), $ = (t) => {
43
+ const r = [], e = /* @__PURE__ */ new Set(), l = (a) => {
44
+ Array.isArray(a) && a.forEach((n) => {
45
+ const o = [...n.children ?? [], ...n.select_items ?? []];
46
+ if (o.length > 0) {
47
+ l(o);
48
48
  return;
49
49
  }
50
- c && l.value && !e.has(l.value) && (e.add(l.value), r.push({ value: l.value, text: c, tagText: l.tag_text || c, path: o }));
50
+ const u = n.text || n.tag_text;
51
+ u && n.value && !e.has(n.value) && (e.add(n.value), r.push({ text: u, value: n.value }));
51
52
  });
52
53
  }, [s] = Object.values(t ?? {});
53
- return n(s, []), r;
54
- }, x = (t) => k(t).map(({ text: r, value: e }) => ({ text: r, value: e })), T = (t, r, e = !1) => {
55
- const n = new Set(t.map((a) => a.value)), s = r.filter((a) => n.has(a.value) ? !1 : (n.add(a.value), !0));
54
+ return l(s), r;
55
+ }, d = (t, r, e = !1) => {
56
+ const l = new Set(t.map((a) => a.value)), s = r.filter((a) => l.has(a.value) ? !1 : (l.add(a.value), !0));
56
57
  return [
57
- ...b(t, e),
58
- ...b(s, e)
58
+ ...i(t, e),
59
+ ...i(s, e)
59
60
  ];
60
61
  }, F = () => {
61
62
  var t;
62
63
  return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
63
- }, P = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", j = (t) => {
64
+ }, T = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", x = (t) => {
64
65
  if (t === null || typeof t != "object" || Array.isArray(t))
65
66
  return !1;
66
67
  const r = Object.getPrototypeOf(t);
67
68
  return r === Object.prototype || r === null;
68
69
  };
69
70
  export {
70
- P as asText,
71
- T as buildMergeTagEntries,
72
- b as dynamicContentToMergeTags,
73
- k as flattenDynamicContentCandidates,
74
- x as flattenDynamicContentList,
71
+ T as asText,
72
+ d as buildMergeTagEntries,
73
+ i as dynamicContentToMergeTags,
74
+ $ as flattenDynamicContentList,
75
75
  F as getCsrfToken,
76
- j as isPlainObject,
77
- $ as mergeTagToDynamicContent
76
+ x as isPlainObject,
77
+ k as mergeTagToDynamicContent
78
78
  };
@@ -50,17 +50,17 @@ const Y = () => {
50
50
  const n = L(), s = N(), o = z(), { getCompiledEmail: r, getTemplateData: e } = x(), { writeTrackingIds: i } = F(), { compileHtml: t, compileAmpHtml: c } = I(), { isFeatureEnabled: a } = D();
51
51
  return {
52
52
  prepareTemplateDetails: async (h) => {
53
- let { html: m, css: p, syncModulesIds: u = [] } = h ?? await e();
53
+ let { html: m, css: u, syncModulesIds: f = [] } = h ?? await e();
54
54
  if (a("linkTrackingIds")) {
55
55
  const { changed: P, nextSeq: E } = i(s.trackIdSessionFloor);
56
- s.trackIdSessionFloor = E, P && ({ html: m, css: p, syncModulesIds: u = [] } = await e());
56
+ s.trackIdSessionFloor = E, P && ({ html: m, css: u, syncModulesIds: f = [] } = await e());
57
57
  }
58
58
  const { html: T, ampHtml: d = "", ampErrors: w = [] } = await r({
59
59
  minimize: !0,
60
60
  resetDataSavedFlag: !1
61
- });
62
- o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(m);
63
- const { compiledHtml: A, stats: l, appliedRules: y } = t(T), C = d && c(d).compiledHtml, k = n.getSelectedDynamicContentList, H = b(), f = M(m);
61
+ }), p = M(m);
62
+ (p.length || o.selectedUnsubscribePages.length) && await o.fetchTemplates(), await S(m);
63
+ const { compiledHtml: A, stats: l, appliedRules: y } = t(T), C = d && c(d).compiledHtml, k = n.getSelectedDynamicContentList, H = b();
64
64
  return console.debug("HTML Compilation Stats:", {
65
65
  originalSize: l.originalSize,
66
66
  compiledSize: l.compiledSize,
@@ -71,17 +71,17 @@ const Y = () => {
71
71
  dynamicContentList: k,
72
72
  compiledHtml: A,
73
73
  rawHtml: m,
74
- css: p,
74
+ css: u,
75
75
  ampHtml: C,
76
76
  ampErrors: w,
77
- modules: u.map(Number),
77
+ modules: f.map(Number),
78
78
  recommendation: {
79
79
  campaignUrls: H.recommendationCampaignUrls,
80
80
  configs: {}
81
81
  },
82
82
  unsubscribe: {
83
- status: f.length > 0,
84
- config: f
83
+ status: p.length > 0,
84
+ config: p
85
85
  }
86
86
  };
87
87
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.27.0-beta.ee85b86",
3
+ "version": "3.27.1-beta.4ca8aae",
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",
@@ -136,7 +136,7 @@
136
136
  },
137
137
  "guido": {
138
138
  "stripo": {
139
- "version": "2.83.1"
139
+ "version": "2.86.1"
140
140
  }
141
141
  }
142
142
  }
@@ -1,24 +0,0 @@
1
- import i from "./AmbiguousDynamicContentModal.vue2.js";
2
- /* empty css */
3
- import l from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var c = function() {
5
- var n = this, a = n._self._c, t = n._self._setupProxy;
6
- return t.current ? a(t.WpModal, { attrs: { id: "guido__ambiguous-dynamic-content-modal", size: "medium", "close-on-outside-click": !1, "footer-button-options": t.footerButtonOptions, title: t.trans("email-editor.ambiguous-dynamic-content-title") }, on: { close: t.cancel, "primary-action": t.apply } }, [a("div", { staticClass: "ambiguous-dynamic-content-modal__content" }, [a("p", { staticClass: "mb-3" }, [n._v(" " + n._s(t.trans("email-editor.ambiguous-dynamic-content-message")) + " ")]), n._l(t.rows, function(e, s) {
7
- return a(t.InSelect, { key: e.label, staticClass: "mb-2", attrs: { id: `guido__ambiguous-dynamic-content-select-${s}`, "search-status": "", "button-status": !1, "label-text": `{{ ${e.label} }}`, options: e.options, "placeholder-text": t.trans("email-editor.ambiguous-dynamic-content-placeholder"), state: e.isInvalid ? "error" : "default", "state-message": t.trans("email-editor.ambiguous-dynamic-content-validation"), value: e.selected }, on: { close: function(o) {
8
- return t.touch(e.label);
9
- }, select: function(o) {
10
- return t.select(e.label, o);
11
- } } });
12
- })], 2)]) : n._e();
13
- }, r = [], u = /* @__PURE__ */ l(
14
- i,
15
- c,
16
- r,
17
- !1,
18
- null,
19
- "2643213c"
20
- );
21
- const f = u.exports;
22
- export {
23
- f as default
24
- };
@@ -1,59 +0,0 @@
1
- import { defineComponent as h, ref as y, computed as u, watch as _ } from "vue";
2
- import x from "../../wrappers/WpModal.vue.js";
3
- import { useAmbiguousDynamicContent as S } from "../../../composables/useAmbiguousDynamicContent.js";
4
- import { useTranslations as T } from "../../../composables/useTranslations.js";
5
- import { useEditorStore as C } from "../../../stores/editor.js";
6
- import { useModuleDynamicContentStore as B } from "../../../stores/module-dynamic-content.js";
7
- import { InSelect as D } from "@useinsider/design-system-vue";
8
- const G = /* @__PURE__ */ h({
9
- __name: "AmbiguousDynamicContentModal",
10
- setup(I) {
11
- const s = T(), i = C(), c = B(), { resolve: r, dismiss: p } = S(), o = y({}), l = y([]), t = u(() => i.isStripoInitialized ? c.current : null);
12
- _(() => {
13
- var e;
14
- return (e = t.value) == null ? void 0 : e.id;
15
- }, () => {
16
- o.value = {}, l.value = [];
17
- });
18
- const m = (e) => ({
19
- text: [...e.path, e.tagText].join(" › "),
20
- value: e.value
21
- }), v = u(() => {
22
- var e;
23
- return (((e = t.value) == null ? void 0 : e.items) ?? []).map((a) => {
24
- const d = a.candidates.map(m), f = d.filter((g) => g.value === o.value[a.label]);
25
- return {
26
- label: a.label,
27
- options: d,
28
- selected: f,
29
- isInvalid: f.length === 0 && l.value.includes(a.label)
30
- };
31
- });
32
- }), n = u(() => v.value.every((e) => e.selected.length > 0)), b = u(() => ({
33
- cancelOrBackButton: {
34
- type: "secondary",
35
- labelText: s("action-builder.cancel"),
36
- styling: "ghost"
37
- },
38
- primaryButton: {
39
- type: "primary",
40
- labelText: s("email-editor.ambiguous-dynamic-content-apply"),
41
- disabledStatus: !n.value,
42
- isTooltip: !n.value,
43
- tooltipText: n.value ? "" : s("email-editor.ambiguous-dynamic-content-apply-tooltip")
44
- }
45
- }));
46
- return { __sfc: !0, trans: s, editorStore: i, store: c, resolve: r, dismiss: p, selections: o, touched: l, current: t, toOption: m, rows: v, isComplete: n, footerButtonOptions: b, select: (e, { value: a }) => {
47
- o.value = { ...o.value, [e]: a };
48
- }, touch: (e) => {
49
- l.value.includes(e) || (l.value = [...l.value, e]);
50
- }, apply: () => {
51
- t.value && n.value && r(t.value, o.value);
52
- }, cancel: () => {
53
- t.value && p(t.value.id);
54
- }, WpModal: x, InSelect: D };
55
- }
56
- });
57
- export {
58
- G as default
59
- };
@@ -1,72 +0,0 @@
1
- import { useModuleRepair as A, UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY as D, registerUsedAttributes as C } from "./useModuleRepair.js";
2
- import { useToaster as v } from "./useToaster.js";
3
- import { useTranslations as R } from "./useTranslations.js";
4
- import { ModuleDynamicContentAttribute as b } from "../enums/dynamic-content.js";
5
- import { ToasterTypeOptions as h } from "../enums/toaster.js";
6
- import { useModuleDynamicContentStore as O } 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 u } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
11
- const c = b.Pending, M = () => {
12
- const { editorCopilotApi: t } = w();
13
- if (!t)
14
- throw new Error(N);
15
- return { api: t, root: t.getDocumentRootHtmlNode() };
16
- }, E = (t) => {
17
- const { api: p, root: a } = M(), m = a.querySelector(`[${c}="${t}"]`);
18
- return { api: p, node: m };
19
- }, G = () => {
20
- const t = O(), { convertDynamicContent: p } = A(), { showToaster: a, handleError: m } = v(), f = R();
21
- return { resolve: ({ id: o, items: r }, i) => {
22
- try {
23
- const { api: e, node: n } = E(o);
24
- if (n) {
25
- const s = /* @__PURE__ */ new Map();
26
- r.forEach((l) => {
27
- const g = i[l.label];
28
- g && l.spellings.forEach((T) => s.set(T, g));
29
- });
30
- const d = _(H(n.getOuterHTML(), s)), y = e.getTemplateModifier();
31
- y.modifyHtml(n).replaceWith(d), y.apply(new u("Resolved dynamic content")), C(d, r.flatMap((l) => l.candidates)), a({
32
- type: h.Success,
33
- message: f("email-editor.ambiguous-dynamic-content-success")
34
- });
35
- }
36
- t.remove(o);
37
- } catch (e) {
38
- m(e, "Failed to apply the dynamic content choice");
39
- }
40
- }, dismiss: (o) => {
41
- try {
42
- const { api: r, node: i } = E(o);
43
- if (i) {
44
- const e = r.getTemplateModifier();
45
- e.modifyHtml(i).removeAttribute(c), e.apply(new u("Cleared pending dynamic content").asHidden()), a({
46
- type: h.Warning,
47
- message: f(D)
48
- });
49
- }
50
- } catch (r) {
51
- m(r, "Failed to dismiss the dynamic content choice");
52
- } finally {
53
- t.remove(o);
54
- }
55
- }, restorePending: () => {
56
- try {
57
- const { api: o, root: r } = M(), i = [];
58
- if (r.querySelectorAll(`[${c}]`).forEach((e) => {
59
- const n = e.getAttribute(c), { ambiguous: s } = p(e.getOuterHTML());
60
- !n || s.length === 0 ? i.push(e) : t.queue.some((d) => d.id === n) || t.enqueue({ id: n, items: s });
61
- }), i.length > 0) {
62
- const e = o.getTemplateModifier();
63
- i.forEach((n) => e.modifyHtml(n).removeAttribute(c)), e.apply(new u("Cleared pending dynamic content").asHidden());
64
- }
65
- } catch (o) {
66
- console.error("Failed to restore pending dynamic content:", o);
67
- }
68
- } };
69
- };
70
- export {
71
- G as useAmbiguousDynamicContent
72
- };
@@ -1,4 +0,0 @@
1
- var n = /* @__PURE__ */ ((d) => (d.Pending = "data-guido-dc-pending", d))(n || {});
2
- export {
3
- n as ModuleDynamicContentAttribute
4
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,7 +0,0 @@
1
- import { type PendingModuleDynamicContent } from '@@/Stores/module-dynamic-content';
2
- /** Resolves or dismisses the labels a dropped module left pending (see `useModuleRepair`). */
3
- export declare const useAmbiguousDynamicContent: () => {
4
- resolve: ({ id, items }: PendingModuleDynamicContent, selections: Record<string, string>) => void;
5
- dismiss: (id: string) => void;
6
- restorePending: () => void;
7
- };
@@ -1,3 +0,0 @@
1
- export declare enum ModuleDynamicContentAttribute {
2
- Pending = "data-guido-dc-pending"
3
- }
@@ -1,30 +0,0 @@
1
- import type { AmbiguousDynamicContent } from '@@/Utils/dynamicContentConverter';
2
- export interface PendingModuleDynamicContent {
3
- /** Value of the module root's pending marker attribute. */
4
- id: string;
5
- items: AmbiguousDynamicContent[];
6
- }
7
- interface ModuleDynamicContentState {
8
- queue: PendingModuleDynamicContent[];
9
- }
10
- export declare const useModuleDynamicContentStore: import("pinia").StoreDefinition<"guidoModuleDynamicContent", ModuleDynamicContentState, {
11
- current: (state: {
12
- queue: {
13
- id: string;
14
- items: {
15
- label: string;
16
- spellings: string[];
17
- candidates: {
18
- value: string;
19
- text: string;
20
- tagText: string;
21
- path: string[];
22
- }[];
23
- }[];
24
- }[];
25
- } & import("pinia").PiniaCustomStateProperties<ModuleDynamicContentState>) => PendingModuleDynamicContent | null;
26
- }, {
27
- enqueue(entry: PendingModuleDynamicContent): void;
28
- remove(id: string): void;
29
- }>;
30
- export {};
@@ -1,2 +0,0 @@
1
- export declare const PENDING_MARKER_PATTERN = "\\s+data-guido-dc-pending=\"[^\"]*\"";
2
- export declare const stripPendingMarker: (html: string) => string;
@@ -1,20 +0,0 @@
1
- import { defineStore as u } from "pinia";
2
- const i = u("guidoModuleDynamicContent", {
3
- state: () => ({
4
- queue: []
5
- }),
6
- getters: {
7
- current: (e) => e.queue[0] ?? null
8
- },
9
- actions: {
10
- enqueue(e) {
11
- this.queue = [...this.queue, e];
12
- },
13
- remove(e) {
14
- this.queue = this.queue.filter((t) => t.id !== e);
15
- }
16
- }
17
- });
18
- export {
19
- i as useModuleDynamicContentStore
20
- };
@@ -1,6 +0,0 @@
1
- import { ModuleDynamicContentAttribute as n } from "../enums/dynamic-content.js";
2
- const t = `\\s+${n.Pending}="[^"]*"`, o = (e) => e.replace(new RegExp(t, "g"), "");
3
- export {
4
- t as PENDING_MARKER_PATTERN,
5
- o as stripPendingMarker
6
- };