@useinsider/guido 3.21.1-beta.f5fb7ac → 3.21.2

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 +0 -9
  2. package/dist/@types/config/schemas.js +33 -35
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +96 -100
  5. package/dist/composables/useModuleRepair.js +23 -32
  6. package/dist/config/compiler/utils/recommendationCompilerUtils.js +55 -53
  7. package/dist/config/migrator/index.js +9 -10
  8. package/dist/enums/academy.js +1 -2
  9. package/dist/extensions/Blocks/Recommendation/block.js +52 -37
  10. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +76 -16
  11. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +16 -15
  12. package/dist/guido.css +1 -1
  13. package/dist/src/@types/config/schemas.d.ts +0 -4
  14. package/dist/src/composables/useConfig.d.ts +0 -2
  15. package/dist/src/composables/useModuleRepair.d.ts +11 -2
  16. package/dist/src/enums/academy.d.ts +0 -1
  17. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  18. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +31 -17
  19. package/dist/src/stores/config.d.ts +0 -20
  20. package/dist/src/stores/editor.d.ts +0 -25
  21. package/dist/stores/editor.js +14 -15
  22. package/package.json +1 -1
  23. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +0 -17
  24. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +0 -30
  25. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +0 -16
  26. package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +0 -2
  27. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +0 -1
  28. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +0 -10
  29. package/dist/utils/legacyUnsubscribeConversion.js +0 -49
@@ -1,5 +1,5 @@
1
- import { defineStore as i } from "pinia";
2
- const o = i("guidoEditor", {
1
+ import { defineStore as e } from "pinia";
2
+ const o = e("guidoEditor", {
3
3
  state: () => ({
4
4
  loadingStatus: !0,
5
5
  isCodeEditorOpen: !1,
@@ -13,7 +13,6 @@ const o = i("guidoEditor", {
13
13
  // that need every change (the outbound state bridge) watch this instead.
14
14
  changeSeq: 0,
15
15
  isStripoInitialized: !1,
16
- isLegacyUnsubscribeModalRequested: !1,
17
16
  templateId: "",
18
17
  syncModulesEnabled: !1,
19
18
  // In-session id high-water mark; floors tracking-id minting so ids
@@ -22,20 +21,20 @@ const o = i("guidoEditor", {
22
21
  }),
23
22
  getters: {
24
23
  // Middle Slot
25
- isEditorToolbarVisible: (e) => !e.isVersionHistoryOpen && !e.isPreviewModeOpen,
26
- isUndoButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
27
- isRedoButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
28
- isCodeEditorButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
29
- isPreviewButtonDisabled: (e) => e.loadingStatus,
30
- isViewOptionsDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
24
+ isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen,
25
+ isUndoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
26
+ isRedoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
27
+ isCodeEditorButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
28
+ isPreviewButtonDisabled: (i) => i.loadingStatus,
29
+ isViewOptionsDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
31
30
  // Right Slot
32
- isVersionHistoryButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
33
- isExportButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
34
- isSaveAsButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
35
- isTestButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
36
- isSaveButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen || e.isPreviewModeOpen,
31
+ isVersionHistoryButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
32
+ isExportButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
33
+ isSaveAsButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
34
+ isTestButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
35
+ isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen,
37
36
  // Autosave
38
- isInSaveableState: (e) => !e.loadingStatus && !e.isVersionHistoryOpen && !e.isPreviewModeOpen && !e.isCodeEditorOpen
37
+ isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
39
38
  }
40
39
  });
41
40
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.1-beta.f5fb7ac",
3
+ "version": "3.21.2",
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",
@@ -1,17 +0,0 @@
1
- import s from "./LegacyUnsubscribeConvertedModal.vue2.js";
2
- import n from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var r = 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", state: "warning", "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__ */ n(
7
- s,
8
- r,
9
- a,
10
- !1,
11
- null,
12
- null
13
- );
14
- const d = c.exports;
15
- export {
16
- d as default
17
- };
@@ -1,30 +0,0 @@
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,16 +0,0 @@
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
- };
@@ -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 +0,0 @@
1
- export declare const migrateLegacyUnsubscribeText: (html: string) => string;
@@ -1,10 +0,0 @@
1
- export declare const LEGACY_UNSUBSCRIBE_SELECTOR = "td.unsubscribe-block";
2
- export declare const LEGACY_UNSUBSCRIBE_LINK_SELECTORS: readonly ["a.unsubscribe-link", "a[href*=\"unsubscribe\"]"];
3
- export interface LegacyUnsubscribeConversionResult {
4
- html: string;
5
- converted: boolean;
6
- }
7
- export declare const hasLegacyUnsubscribeClass: (html: string) => boolean;
8
- export declare const convertLinklessLegacyUnsubscribeBlocks: (root: ParentNode) => number;
9
- export declare const convertLegacyUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
10
- export declare const convertLegacyUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
@@ -1,49 +0,0 @@
1
- import { protectLiquid as a, restoreLiquid as u } from "./liquidProtection.js";
2
- const b = "td.unsubscribe-block", l = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], d = "esd-block-text", m = [
3
- "unsubscribe-block",
4
- "esd-extension",
5
- "esd-extension-block",
6
- "esd-unsubscribe-block",
7
- "esd-block-unsubscribe"
8
- ], L = "esd-extension-block-id", S = "data-unsubscribe-", E = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", f = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), p = (e) => typeof e == "string" && f.test(e), y = (e) => l.some((t) => e.querySelector(t) !== null), g = (e) => {
9
- e.classList.remove(...m), e.classList.add(d), e.removeAttribute(L), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(S)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(E) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
10
- }, h = (e) => {
11
- const t = Array.from(e.querySelectorAll(b)).filter((r) => !y(r));
12
- return t.forEach(g), t.length;
13
- }, v = (e) => {
14
- const t = e.trimStart(), r = new DOMParser();
15
- return /^<t[dh][\s>]/i.test(t) ? r.parseFromString(`<table><tbody><tr>${e}</tr></tbody></table>`, "text/html").querySelector("tr") : /^<tr[\s>]/i.test(t) ? r.parseFromString(`<table><tbody>${e}</tbody></table>`, "text/html").querySelector("tbody") : /^<table[\s>]/i.test(t) ? r.parseFromString(e, "text/html").body : (console.debug("[LegacyUnsubscribeConversion] Skipped module with a non-table root"), null);
16
- }, c = (e) => {
17
- const t = e.search(/<html[\s>]/i), r = [...e.matchAll(/<\/html\s*>/gi)].at(-1), s = (r == null ? void 0 : r.index) === void 0 ? -1 : r.index + r[0].length;
18
- return t < 0 || s <= t ? { head: "", root: e, tail: "" } : { head: e.slice(0, t), root: e.slice(t, s), tail: e.slice(s) };
19
- }, i = (e, t, r, s) => {
20
- if (!p(e))
21
- return { html: e, converted: !1 };
22
- try {
23
- const o = a(e), n = t(o);
24
- return !n || h(n) === 0 ? { html: e, converted: !1 } : { html: u(r(n, o)), converted: !0 };
25
- } catch (o) {
26
- return console.error(`Failed to convert legacy unsubscribe blocks in ${s}:`, o), { html: e, converted: !1 };
27
- }
28
- }, C = (e) => i(
29
- e,
30
- v,
31
- (t) => t.innerHTML,
32
- "module"
33
- ), _ = (e) => i(
34
- e,
35
- (t) => new DOMParser().parseFromString(c(t).root, "text/html"),
36
- (t, r) => {
37
- const { head: s, tail: o } = c(r);
38
- return `${s}${t.documentElement.outerHTML}${o}`;
39
- },
40
- "document"
41
- );
42
- export {
43
- l as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
44
- b as LEGACY_UNSUBSCRIBE_SELECTOR,
45
- _ as convertLegacyUnsubscribeInDocumentHtml,
46
- C as convertLegacyUnsubscribeInModuleHtml,
47
- h as convertLinklessLegacyUnsubscribeBlocks,
48
- p as hasLegacyUnsubscribeClass
49
- };