@useinsider/guido 3.21.2-beta.d9d48aa → 3.21.2-beta.eda5c2e
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 +0 -9
- package/dist/@types/config/schemas.js +33 -35
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +96 -100
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
- package/dist/composables/useModuleRepair.js +23 -32
- package/dist/config/migrator/index.js +9 -10
- package/dist/enums/academy.js +1 -2
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useModuleRepair.d.ts +11 -2
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/stores/config.d.ts +0 -20
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/src/stores/unsubscribe.d.ts +10 -0
- package/dist/stores/editor.js +14 -15
- package/dist/stores/unsubscribe.js +28 -24
- package/package.json +1 -1
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +0 -17
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +0 -30
- package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +0 -16
- package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +0 -2
- package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +0 -1
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +0 -10
- package/dist/utils/legacyUnsubscribeConversion.js +0 -49
package/dist/stores/editor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineStore as
|
|
2
|
-
const o =
|
|
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: (
|
|
26
|
-
isUndoButtonDisabled: (
|
|
27
|
-
isRedoButtonDisabled: (
|
|
28
|
-
isCodeEditorButtonDisabled: (
|
|
29
|
-
isPreviewButtonDisabled: (
|
|
30
|
-
isViewOptionsDisabled: (
|
|
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: (
|
|
33
|
-
isExportButtonDisabled: (
|
|
34
|
-
isSaveAsButtonDisabled: (
|
|
35
|
-
isTestButtonDisabled: (
|
|
36
|
-
isSaveButtonDisabled: (
|
|
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: (
|
|
37
|
+
isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
|
|
39
38
|
}
|
|
40
39
|
});
|
|
41
40
|
export {
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { TYPE_COLLECTIONS as
|
|
1
|
+
import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
3
|
import { defineStore as u } from "pinia";
|
|
4
4
|
let o = null;
|
|
5
|
-
const
|
|
5
|
+
const p = () => ({
|
|
6
6
|
templates: [],
|
|
7
7
|
selectedTemplates: {},
|
|
8
8
|
selectedUnsubscribePages: [],
|
|
9
|
-
selectedCollectionType:
|
|
10
|
-
activeType:
|
|
9
|
+
selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
|
|
10
|
+
activeType: r.GLOBAL_UNSUBSCRIBE,
|
|
11
11
|
pageSelectionUpdateStatus: !1,
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
15
|
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
16
|
pendingBlockId: null
|
|
17
|
-
})
|
|
18
|
-
|
|
17
|
+
});
|
|
18
|
+
function h(e) {
|
|
19
|
+
return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
|
|
20
|
+
}
|
|
21
|
+
const f = u("guidoUnsubscribe", {
|
|
22
|
+
state: () => p(),
|
|
19
23
|
getters: {
|
|
20
|
-
getSelectedCollection: (e) =>
|
|
24
|
+
getSelectedCollection: (e) => c[e.selectedCollectionType],
|
|
21
25
|
getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
|
|
22
26
|
getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
|
|
23
27
|
getThumbnailByTemplateId: (e) => (t) => {
|
|
@@ -25,31 +29,31 @@ const r = () => ({
|
|
|
25
29
|
return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
|
|
26
30
|
},
|
|
27
31
|
getSelectedUnsubscribePagesByCollection: (e) => (t) => {
|
|
28
|
-
const l =
|
|
32
|
+
const l = c[t];
|
|
29
33
|
if (!l)
|
|
30
34
|
return [];
|
|
31
35
|
const s = /* @__PURE__ */ new Map();
|
|
32
36
|
e.templates.forEach((n) => {
|
|
33
37
|
s.set(n.id, n.type);
|
|
34
38
|
});
|
|
35
|
-
const
|
|
39
|
+
const i = new Set(l);
|
|
36
40
|
return e.selectedUnsubscribePages.filter((n) => {
|
|
37
41
|
const a = s.get(n);
|
|
38
|
-
return a !== void 0 &&
|
|
42
|
+
return a !== void 0 && i.has(a);
|
|
39
43
|
});
|
|
40
44
|
},
|
|
41
45
|
isActiveTypeFirstInCollection: (e) => {
|
|
42
|
-
const t =
|
|
46
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
43
47
|
return e.activeType === t[0];
|
|
44
48
|
},
|
|
45
49
|
isActiveTypeLastInCollection: (e) => {
|
|
46
|
-
const t =
|
|
50
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
47
51
|
return e.activeType === t[t.length - 1];
|
|
48
52
|
},
|
|
49
53
|
hasTemplatesByCollectionType: (e) => {
|
|
50
54
|
const t = {};
|
|
51
|
-
return (
|
|
52
|
-
t[s] = e.templates.some((
|
|
55
|
+
return (c[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
56
|
+
t[s] = e.templates.some((i) => i.type === s);
|
|
53
57
|
}), t;
|
|
54
58
|
},
|
|
55
59
|
unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
|
|
@@ -58,7 +62,7 @@ const r = () => ({
|
|
|
58
62
|
$reset() {
|
|
59
63
|
const { templates: e, selectedUnsubscribePages: t } = this;
|
|
60
64
|
Object.assign(this, {
|
|
61
|
-
...
|
|
65
|
+
...p(),
|
|
62
66
|
templates: e,
|
|
63
67
|
selectedUnsubscribePages: t
|
|
64
68
|
});
|
|
@@ -66,28 +70,28 @@ const r = () => ({
|
|
|
66
70
|
async fetchTemplates(e = !1) {
|
|
67
71
|
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
68
72
|
const { getUnsubscribePages: t } = d();
|
|
69
|
-
this.templates = await t();
|
|
73
|
+
this.templates = h(await t());
|
|
70
74
|
})().finally(() => {
|
|
71
75
|
o = null;
|
|
72
76
|
})), await o);
|
|
73
77
|
},
|
|
74
78
|
setCollection(e) {
|
|
75
79
|
this.selectedCollectionType = e;
|
|
76
|
-
const t =
|
|
80
|
+
const t = c[e];
|
|
77
81
|
if (t && t.length > 0) {
|
|
78
82
|
[this.activeType] = t;
|
|
79
83
|
const l = { ...this.selectedTemplates };
|
|
80
84
|
t.forEach((s) => {
|
|
81
85
|
if (!l[s]) {
|
|
82
|
-
const
|
|
83
|
-
|
|
86
|
+
const i = this.templates.find((n) => n.type === s);
|
|
87
|
+
i && (l[s] = i.id);
|
|
84
88
|
}
|
|
85
89
|
}), this.selectedTemplates = l;
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
setCollectionWithoutAutoSelection(e) {
|
|
89
93
|
this.selectedCollectionType = e;
|
|
90
|
-
const t =
|
|
94
|
+
const t = c[e];
|
|
91
95
|
t && t.length > 0 && ([this.activeType] = t);
|
|
92
96
|
},
|
|
93
97
|
setSelectedTemplate(e) {
|
|
@@ -107,12 +111,12 @@ const r = () => ({
|
|
|
107
111
|
loadSelectedTemplates(e) {
|
|
108
112
|
const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
|
|
109
113
|
e.forEach((s) => {
|
|
110
|
-
const
|
|
111
|
-
|
|
114
|
+
const i = t.get(s);
|
|
115
|
+
i !== void 0 && (l[i] = s);
|
|
112
116
|
}), this.selectedTemplates = l;
|
|
113
117
|
},
|
|
114
118
|
getSelectedTemplatesByCollection(e) {
|
|
115
|
-
const t =
|
|
119
|
+
const t = c[e], l = [];
|
|
116
120
|
return t.forEach((s) => {
|
|
117
121
|
this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
|
|
118
122
|
}), l;
|
|
@@ -129,5 +133,5 @@ const r = () => ({
|
|
|
129
133
|
}
|
|
130
134
|
});
|
|
131
135
|
export {
|
|
132
|
-
|
|
136
|
+
f as useUnsubscribeStore
|
|
133
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.21.2-beta.
|
|
3
|
+
"version": "3.21.2-beta.eda5c2e",
|
|
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
|
-
};
|