@useinsider/guido 1.0.3-beta.38aa20d → 1.0.3-beta.391f32c
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/dist/@types/generic.d.ts +8 -0
- package/dist/components/Guido.vue.d.ts +2 -2
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +68 -64
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +18 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +16 -0
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +24 -0
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +108 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +18 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +12 -0
- package/dist/components/wrappers/WpDrawer.vue.d.ts +6 -4
- package/dist/components/wrappers/WpDrawer.vue.js +6 -4
- package/dist/composables/useStripo.js +31 -25
- package/dist/config/compiler/unsubscribeCompilerRules.js +19 -19
- package/dist/config/migrator/index.d.ts +1 -1
- package/dist/config/migrator/index.js +6 -5
- package/dist/config/migrator/unsubscribeMigrator.d.ts +1 -0
- package/dist/config/migrator/unsubscribeMigrator.js +112 -0
- package/dist/enums/defaults.js +6 -3
- package/dist/enums/unsubscribe.d.ts +19 -0
- package/dist/enums/unsubscribe.js +39 -6
- package/dist/extensions/Blocks/Checkbox/block.d.ts +1 -0
- package/dist/extensions/Blocks/Checkbox/block.js +15 -24
- package/dist/extensions/Blocks/Checkbox/control.js +24 -38
- package/dist/extensions/Blocks/Checkbox/extension.js +5 -16
- package/dist/extensions/Blocks/Checkbox/iconsRegistry.d.ts +4 -0
- package/dist/extensions/Blocks/Checkbox/iconsRegistry.js +18 -0
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +12 -25
- package/dist/extensions/Blocks/Checkbox/template.js +5 -16
- package/dist/extensions/Blocks/RadioButton/block.d.ts +1 -0
- package/dist/extensions/Blocks/RadioButton/block.js +13 -22
- package/dist/extensions/Blocks/RadioButton/control.js +32 -46
- package/dist/extensions/Blocks/RadioButton/extension.js +4 -15
- package/dist/extensions/Blocks/RadioButton/iconsRegistry.d.ts +4 -0
- package/dist/extensions/Blocks/RadioButton/iconsRegistry.js +14 -0
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +13 -26
- package/dist/extensions/Blocks/RadioButton/template.js +7 -18
- package/dist/extensions/Blocks/Unsubscribe/block.d.ts +31 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +131 -0
- package/dist/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
- package/dist/extensions/Blocks/Unsubscribe/control.js +167 -0
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +42 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +2 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +20 -0
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +4 -0
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +19 -0
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +42 -0
- package/dist/extensions/Blocks/Unsubscribe/tagRegistry.d.ts +4 -0
- package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +10 -0
- package/dist/extensions/Blocks/Unsubscribe/template.d.ts +12 -0
- package/dist/extensions/Blocks/Unsubscribe/template.js +22 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
- package/dist/extensions/Blocks/_Boilerplate/block.d.ts +1 -0
- package/dist/extensions/Blocks/_Boilerplate/iconsRegistry.d.ts +4 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +31 -45
- package/dist/extensions/DynamicContent/extension.js +6 -18
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +648 -0
- package/dist/services/unsubscribeApi.d.ts +4 -0
- package/dist/services/unsubscribeApi.js +16 -0
- package/dist/stores/unsubscribe.d.ts +183 -5
- package/dist/stores/unsubscribe.js +125 -6
- package/package.json +2 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +0 -75
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +0 -77
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +0 -123
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +0 -12
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +0 -119
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +0 -12
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +0 -7
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +0 -24
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +0 -24
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +0 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +0 -33
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +0 -22
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +0 -40
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +0 -5
|
@@ -5,14 +5,15 @@ import { useToaster as C } from "./useToaster.js";
|
|
|
5
5
|
import { displayConditions as y } from "../enums/displayConditions.js";
|
|
6
6
|
import h from "../extensions/Blocks/Checkbox/extension.js";
|
|
7
7
|
import w from "../extensions/Blocks/RadioButton/extension.js";
|
|
8
|
-
import b from "../extensions/
|
|
8
|
+
import b from "../extensions/Blocks/Unsubscribe/extension.js";
|
|
9
|
+
import _ from "../extensions/DynamicContent/extension.js";
|
|
9
10
|
import { useStripoApi as k } from "../services/stripoApi.js";
|
|
10
11
|
import B from "../static/styles/customEditorStyle.css.js";
|
|
11
12
|
import { useEditorStore as V } from "../stores/editor.js";
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
const
|
|
13
|
+
import { dynamicContentToMergeTags as F } from "../utils/genericUtil.js";
|
|
14
|
+
const j = (s) => {
|
|
14
15
|
const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = k(), { handleEvent: l } = E(), m = (r, i = []) => {
|
|
15
|
-
const
|
|
16
|
+
const t = V(), { html: e, css: a, forceRecreate: g } = r;
|
|
16
17
|
window.UIEditor.initEditor(
|
|
17
18
|
document.querySelector("#guido-editor"),
|
|
18
19
|
{
|
|
@@ -43,49 +44,54 @@ const q = (s) => {
|
|
|
43
44
|
},
|
|
44
45
|
mergeTags: [
|
|
45
46
|
{
|
|
46
|
-
entries:
|
|
47
|
+
entries: F(s.preselectedDynamicContentList)
|
|
47
48
|
}
|
|
48
49
|
],
|
|
49
|
-
async onTokenRefreshRequest(
|
|
50
|
+
async onTokenRefreshRequest(o) {
|
|
50
51
|
try {
|
|
51
52
|
const n = await c();
|
|
52
|
-
|
|
53
|
+
o(n);
|
|
53
54
|
} catch (n) {
|
|
54
55
|
d(n, "Failed to refresh token");
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
onTemplateLoaded() {
|
|
58
59
|
try {
|
|
59
|
-
const { importCss:
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const { importCss: o } = S(), { activateCustomViewStyles: n } = f();
|
|
61
|
+
o(), n(), s.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
62
|
+
t.hasChanges = !1;
|
|
62
63
|
}, 1e3);
|
|
63
|
-
} catch (
|
|
64
|
-
d(
|
|
64
|
+
} catch (o) {
|
|
65
|
+
d(o, "Failed to load custom interface appearance");
|
|
65
66
|
}
|
|
66
67
|
},
|
|
67
|
-
onCodeEditorVisibilityChanged(
|
|
68
|
-
|
|
68
|
+
onCodeEditorVisibilityChanged(o) {
|
|
69
|
+
t.isCodeEditorOpen = o;
|
|
69
70
|
},
|
|
70
|
-
onEditorVisualModeChanged(
|
|
71
|
-
|
|
71
|
+
onEditorVisualModeChanged(o) {
|
|
72
|
+
t.editorVisualMode = o.toLowerCase();
|
|
72
73
|
},
|
|
73
|
-
onVersionHistoryVisibilityChanged(
|
|
74
|
-
|
|
74
|
+
onVersionHistoryVisibilityChanged(o) {
|
|
75
|
+
t.isVersionHistoryOpen = o;
|
|
75
76
|
},
|
|
76
77
|
onDataChanged() {
|
|
77
|
-
|
|
78
|
+
t.hasChanges = !0;
|
|
78
79
|
},
|
|
79
80
|
onEvent: l,
|
|
80
|
-
ignoreClickOutsideSelectors: [
|
|
81
|
+
ignoreClickOutsideSelectors: [
|
|
82
|
+
"#guido-dynamic-content-modal",
|
|
83
|
+
".in-on-board-wrapper",
|
|
84
|
+
".in-drawer__container"
|
|
85
|
+
],
|
|
81
86
|
extensions: [
|
|
82
|
-
|
|
87
|
+
_,
|
|
83
88
|
h,
|
|
84
|
-
w
|
|
89
|
+
w,
|
|
90
|
+
b
|
|
85
91
|
]
|
|
86
92
|
}
|
|
87
93
|
);
|
|
88
|
-
}, p = (r) => new Promise((i,
|
|
94
|
+
}, p = (r) => new Promise((i, t) => {
|
|
89
95
|
if (document.getElementById("UiEditorScript")) {
|
|
90
96
|
r(), i();
|
|
91
97
|
return;
|
|
@@ -95,7 +101,7 @@ const q = (s) => {
|
|
|
95
101
|
r(), i();
|
|
96
102
|
}, e.onerror = () => {
|
|
97
103
|
const a = new Error("Failed to load Stripo UIEditor script");
|
|
98
|
-
|
|
104
|
+
t(a);
|
|
99
105
|
}, document.body.appendChild(e);
|
|
100
106
|
});
|
|
101
107
|
return { initPlugin: async (r) => {
|
|
@@ -106,5 +112,5 @@ const q = (s) => {
|
|
|
106
112
|
} };
|
|
107
113
|
};
|
|
108
114
|
export {
|
|
109
|
-
|
|
115
|
+
j as useStripo
|
|
110
116
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { usePartner as m } from "../../composables/usePartner.js";
|
|
2
|
-
import { LINK_REGEXES as
|
|
2
|
+
import { LINK_REGEXES as l, LINK_TYPES as p, URLS as d } from "../../enums/unsubscribe.js";
|
|
3
3
|
import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
|
|
4
4
|
const S = [
|
|
5
5
|
{
|
|
6
6
|
id: "add-unsubscribe-link-values",
|
|
7
7
|
description: "Adding unsubscribe link values",
|
|
8
8
|
type: "custom",
|
|
9
|
-
processor: (
|
|
9
|
+
processor: (t) => {
|
|
10
10
|
var a, u;
|
|
11
|
-
const { getPartnerName:
|
|
12
|
-
let e =
|
|
13
|
-
const
|
|
11
|
+
const { getPartnerName: n } = m(), i = b();
|
|
12
|
+
let e = t;
|
|
13
|
+
const c = `/${n()}/email/0?user={{iid}}`, r = (a = i.templates) == null ? void 0 : a.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = i.templates) == null ? void 0 : u.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.PREFERENCES_LINK_TYPE);
|
|
14
14
|
return r && (e = e.replace(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
16
|
+
d.UNSUBSCRIBE_URL + c
|
|
17
17
|
)), s && (e = e.replace(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)), e.replace(
|
|
18
|
+
l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
19
|
+
d.PREFERENCES_URL + c
|
|
20
|
+
)), e.replace(l.UNSUBSCRIBE_LINK_REGEX, "");
|
|
21
21
|
},
|
|
22
22
|
priority: 60
|
|
23
23
|
},
|
|
@@ -25,7 +25,7 @@ const S = [
|
|
|
25
25
|
id: "remove-data-ogsb-button-styles",
|
|
26
26
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
27
27
|
type: "regex",
|
|
28
|
-
pattern:
|
|
28
|
+
pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
29
29
|
replacement: "",
|
|
30
30
|
flags: "g",
|
|
31
31
|
priority: 61
|
|
@@ -34,27 +34,27 @@ const S = [
|
|
|
34
34
|
id: "format-comment-braces",
|
|
35
35
|
description: "Adding spaces around comment braces for proper formatting",
|
|
36
36
|
type: "custom",
|
|
37
|
-
processor: (
|
|
37
|
+
processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
38
38
|
priority: 62
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
id: "add-universal-link-flags",
|
|
42
42
|
description: "Adding universal link flags",
|
|
43
43
|
type: "custom",
|
|
44
|
-
processor: (
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
return
|
|
44
|
+
processor: (t) => {
|
|
45
|
+
let n = t;
|
|
46
|
+
const i = n.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
47
|
+
return i && i.forEach((e) => {
|
|
48
48
|
if (e.includes("insEmail=1"))
|
|
49
49
|
return;
|
|
50
50
|
if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
51
|
-
const
|
|
51
|
+
const c = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
52
52
|
const s = r.slice(6, r.length - 1).trim();
|
|
53
53
|
return r.includes("?") || r.includes("#") ? s.slice(-1) === "&" ? r.replace(s, `${s}insEmail=1`) : r.replace(s, `${s}&insEmail=1`) : r.replace(s, `${s}?insEmail=1`);
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
n = n.replace(e, c);
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), n;
|
|
58
58
|
},
|
|
59
59
|
priority: 63
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const migrate: (html: string) => string
|
|
1
|
+
export declare const migrate: (html: string) => Promise<string>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateRadioButton as
|
|
3
|
-
|
|
1
|
+
import { migrateCheckbox as m } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateRadioButton as i } from "./radioButtonMigrator.js";
|
|
3
|
+
import { migrateUnsubscribe as o } from "./unsubscribeMigrator.js";
|
|
4
|
+
const n = async (r) => {
|
|
4
5
|
let t = r;
|
|
5
|
-
return t =
|
|
6
|
+
return t = m(t), t = i(t), t = await o(t), t;
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
n as migrate
|
|
9
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrateUnsubscribe(html: string): Promise<string>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var T = (l, e, t) => e in l ? A(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var d = (l, e, t) => T(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { MERGE_TAGS as p, PAGE_TYPES as g } from "../../enums/unsubscribe.js";
|
|
5
|
+
import { DATA_ATTRIBUTES as y } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { useUnsubscribeStore as x } from "../../stores/unsubscribe.js";
|
|
7
|
+
class h {
|
|
8
|
+
constructor() {
|
|
9
|
+
d(this, "parser");
|
|
10
|
+
this.parser = new DOMParser();
|
|
11
|
+
}
|
|
12
|
+
async migrate(e) {
|
|
13
|
+
try {
|
|
14
|
+
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll("td.unsubscribe-block");
|
|
15
|
+
if (!s.length)
|
|
16
|
+
return e;
|
|
17
|
+
const u = x();
|
|
18
|
+
return await u.fetchTemplates(), s.forEach((i) => {
|
|
19
|
+
const a = i.getAttribute("id"), n = this.extractUnsubscribeContent(i), r = this.getCollectionTypeFromMergeTag(n.linkHref), o = u.getSelectedUnsubscribePagesByCollection(r);
|
|
20
|
+
console.debug("[UnsubscribeMigrator]", {
|
|
21
|
+
mergeTag: n.linkHref,
|
|
22
|
+
collectionType: r,
|
|
23
|
+
pageIds: o
|
|
24
|
+
});
|
|
25
|
+
const c = this.buildUnsubscribeBlock(n, r, o), b = this.parser.parseFromString(
|
|
26
|
+
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
27
|
+
"text/html"
|
|
28
|
+
).querySelector(".unsubscribe-block-v2");
|
|
29
|
+
b && i.parentNode && (b.setAttribute("id", a || ""), i.parentNode.replaceChild(b, i));
|
|
30
|
+
}), t.documentElement.outerHTML;
|
|
31
|
+
} catch (t) {
|
|
32
|
+
return console.error("UnsubscribeMigrator failed:", t), e;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
extractUnsubscribeContent(e) {
|
|
36
|
+
var m;
|
|
37
|
+
const t = e.querySelector("p");
|
|
38
|
+
if (!t)
|
|
39
|
+
return {
|
|
40
|
+
textBefore: "You can ",
|
|
41
|
+
linkText: "unsubscribe",
|
|
42
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
43
|
+
linkStyle: "",
|
|
44
|
+
textAfter: " from our emails, if you need to.",
|
|
45
|
+
isBold: !1,
|
|
46
|
+
isItalic: !1,
|
|
47
|
+
align: "center",
|
|
48
|
+
paragraphStyle: ""
|
|
49
|
+
};
|
|
50
|
+
const s = e.getAttribute("align") || t.getAttribute("align") || "center", u = t.getAttribute("style") || "", i = t.querySelector("a.unsubscribe-link") || t.querySelector('a[href*="unsubscribe"]');
|
|
51
|
+
if (!i)
|
|
52
|
+
return {
|
|
53
|
+
textBefore: "You can ",
|
|
54
|
+
linkText: "unsubscribe",
|
|
55
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
56
|
+
linkStyle: "",
|
|
57
|
+
textAfter: " from our emails, if you need to.",
|
|
58
|
+
isBold: !1,
|
|
59
|
+
isItalic: !1,
|
|
60
|
+
align: s,
|
|
61
|
+
paragraphStyle: u
|
|
62
|
+
};
|
|
63
|
+
const a = ((m = i.textContent) == null ? void 0 : m.trim()) || "unsubscribe", n = i.getAttribute("href") || "{{ins-unsubscribe-link}}", r = i.getAttribute("style") || "", o = t.textContent || "", c = o.indexOf(a), f = c >= 0 ? o.substring(0, c).trim() : "You can ", b = c >= 0 ? o.substring(c + a.length).trim() : " from our emails, if you need to.", k = !!t.querySelector("b, strong"), S = !!t.querySelector("i, em");
|
|
64
|
+
return {
|
|
65
|
+
textBefore: f,
|
|
66
|
+
linkText: a,
|
|
67
|
+
linkHref: this.normalizeUnsubscribeHref(n),
|
|
68
|
+
linkStyle: r,
|
|
69
|
+
textAfter: b,
|
|
70
|
+
isBold: k,
|
|
71
|
+
isItalic: S,
|
|
72
|
+
align: s,
|
|
73
|
+
paragraphStyle: u
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
buildUnsubscribeBlock(e, t, s) {
|
|
77
|
+
const u = e.linkStyle ? ` style="${e.linkStyle}"` : "", a = `<a ${`href="${e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${u}>${e.linkText}</a>`, n = [];
|
|
78
|
+
e.textBefore && n.push(e.textBefore), n.push(a), e.textAfter && n.push(e.textAfter);
|
|
79
|
+
let r = n.join(" ");
|
|
80
|
+
e.isBold && e.isItalic ? r = `<strong path="1,0"><em path="1,0,0">${r}</em></strong>` : e.isBold ? r = `<strong path="1,0">${r}</strong>` : e.isItalic && (r = `<em path="1,0">${r}</em>`);
|
|
81
|
+
const o = e.align ? ` align="${e.align}"` : "", c = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", f = s.length > 0 ? ` ${y.PAGE_LIST}="${s.join(",")}"` : "", b = ` ${y.PAGE_TYPE}="${t}"`;
|
|
82
|
+
return `
|
|
83
|
+
<td
|
|
84
|
+
data-migration="true"
|
|
85
|
+
esd-extension-block-id="unsubscribe-block"
|
|
86
|
+
class="esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block"
|
|
87
|
+
${o}${b}${f}
|
|
88
|
+
>
|
|
89
|
+
<p path="1"${c}>
|
|
90
|
+
${r}
|
|
91
|
+
</p>
|
|
92
|
+
</td>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
getCollectionTypeFromMergeTag(e) {
|
|
96
|
+
return e === p[g.SUBSCRIPTION_PREFERENCE_CENTER] ? g.SUBSCRIPTION_PREFERENCE_CENTER : e === p[g.GLOBAL_UNSUBSCRIBE] ? g.GLOBAL_UNSUBSCRIBE : g.GLOBAL_UNSUBSCRIBE;
|
|
97
|
+
}
|
|
98
|
+
normalizeUnsubscribeHref(e) {
|
|
99
|
+
if (Object.values(p).includes(e))
|
|
100
|
+
return e;
|
|
101
|
+
const s = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
|
|
102
|
+
return s ? s[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
|
|
103
|
+
`[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
|
|
104
|
+
), "{{ins-unsubscribe-link}}") : e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function $(l) {
|
|
108
|
+
return new h().migrate(l);
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
$ as migrateUnsubscribe
|
|
112
|
+
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -4,6 +4,9 @@ const a = {
|
|
|
4
4
|
senderName: "",
|
|
5
5
|
subject: ""
|
|
6
6
|
},
|
|
7
|
+
extensions: {
|
|
8
|
+
unsubscribe: !0
|
|
9
|
+
},
|
|
7
10
|
features: {
|
|
8
11
|
dynamicContent: !0,
|
|
9
12
|
saveAsTemplate: !0,
|
|
@@ -13,7 +16,7 @@ const a = {
|
|
|
13
16
|
}, t = {
|
|
14
17
|
promotional: 1,
|
|
15
18
|
transactional: 2
|
|
16
|
-
}, e = "email", o = "Guido User", n = t.promotional,
|
|
19
|
+
}, e = "email", o = "Guido User", n = t.promotional, s = 2, i = {
|
|
17
20
|
email: 60,
|
|
18
21
|
architect: 49
|
|
19
22
|
}, u = [
|
|
@@ -53,8 +56,8 @@ export {
|
|
|
53
56
|
n as DefaultMessageType,
|
|
54
57
|
e as DefaultProductType,
|
|
55
58
|
o as DefaultUsername,
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
s as EditorType,
|
|
60
|
+
i as ProductIds,
|
|
58
61
|
u as TEST_PARTNER_LIST,
|
|
59
62
|
t as TemplateTypes
|
|
60
63
|
};
|
|
@@ -13,3 +13,22 @@ export declare const URLS: {
|
|
|
13
13
|
PREFERENCES_URL: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const INSIDER_ID = "iid";
|
|
16
|
+
export declare const ACADEMY_LINK = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center";
|
|
17
|
+
export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
|
|
18
|
+
export declare const PAGE_TYPES: {
|
|
19
|
+
GLOBAL_UNSUBSCRIBE: number;
|
|
20
|
+
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: number;
|
|
21
|
+
SUBSCRIPTION_PREFERENCE_CENTER: number;
|
|
22
|
+
SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
|
|
23
|
+
RESUBSCRIBE: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const TYPE_COLLECTIONS: {
|
|
26
|
+
[x: number]: number[];
|
|
27
|
+
};
|
|
28
|
+
export declare const TYPE_TRANSLATIONS: {
|
|
29
|
+
[x: number]: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const MERGE_TAGS: {
|
|
32
|
+
[x: number]: string;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
@@ -1,17 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
|
+
const s = e(), n = {
|
|
2
3
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
3
4
|
PREFERENCES_LINK_TYPE: 3
|
|
4
|
-
},
|
|
5
|
+
}, S = {
|
|
5
6
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
6
7
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
7
8
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
8
9
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
9
|
-
},
|
|
10
|
+
}, N = {
|
|
10
11
|
UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
|
|
11
12
|
PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
|
|
13
|
+
}, _ = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", I = "/email/unsubscribe-pages", E = {
|
|
14
|
+
GLOBAL_UNSUBSCRIBE: 1,
|
|
15
|
+
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
16
|
+
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
17
|
+
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
18
|
+
RESUBSCRIBE: 5
|
|
19
|
+
}, r = {
|
|
20
|
+
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
21
|
+
E.GLOBAL_UNSUBSCRIBE,
|
|
22
|
+
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
23
|
+
E.RESUBSCRIBE
|
|
24
|
+
],
|
|
25
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: [
|
|
26
|
+
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
27
|
+
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
28
|
+
]
|
|
29
|
+
}, i = {
|
|
30
|
+
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
31
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
32
|
+
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
33
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
34
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
35
|
+
}, B = {
|
|
36
|
+
default: "{{ins-unsubscribe-link}}",
|
|
37
|
+
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
38
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
12
39
|
};
|
|
13
40
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
_ as ACADEMY_LINK,
|
|
42
|
+
S as LINK_REGEXES,
|
|
43
|
+
n as LINK_TYPES,
|
|
44
|
+
B as MERGE_TAGS,
|
|
45
|
+
E as PAGE_TYPES,
|
|
46
|
+
r as TYPE_COLLECTIONS,
|
|
47
|
+
i as TYPE_TRANSLATIONS,
|
|
48
|
+
I as UNSUBSCRIBE_PAGES_LINK,
|
|
49
|
+
N as URLS
|
|
17
50
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
|
|
2
2
|
export declare const CHECKBOX_BLOCK_ID = "checkbox-block";
|
|
3
3
|
export declare class CheckboxBlock extends Block {
|
|
4
|
+
constructor();
|
|
4
5
|
getId(): string;
|
|
5
6
|
getIcon(): string;
|
|
6
7
|
getBlockCompositionType(): BlockCompositionType;
|
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
import { Block as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/
|
|
2
|
-
import "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
|
|
9
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
|
|
10
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
|
|
11
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
|
|
12
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
|
|
13
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
|
|
14
|
-
import { getDefaultTemplate as r } from "./template.js";
|
|
15
|
-
const e = "checkbox-block";
|
|
16
|
-
class x extends t {
|
|
1
|
+
import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { getDefaultTemplate as o } from "./template.js";
|
|
3
|
+
const r = "checkbox-block";
|
|
4
|
+
class p extends e {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
17
8
|
getId() {
|
|
18
|
-
return
|
|
9
|
+
return r;
|
|
19
10
|
}
|
|
20
11
|
getIcon() {
|
|
21
|
-
return "
|
|
12
|
+
return "checkbox-icon";
|
|
22
13
|
}
|
|
23
14
|
getBlockCompositionType() {
|
|
24
|
-
return
|
|
15
|
+
return t.CONTAINER;
|
|
25
16
|
}
|
|
26
17
|
getName() {
|
|
27
|
-
return this.api.translate("Checkbox
|
|
18
|
+
return this.api.translate("Checkbox Block");
|
|
28
19
|
}
|
|
29
20
|
getDescription() {
|
|
30
|
-
return this.api.translate("Checkbox
|
|
21
|
+
return this.api.translate("Checkbox Block Description");
|
|
31
22
|
}
|
|
32
23
|
getTemplate() {
|
|
33
|
-
return
|
|
24
|
+
return o();
|
|
34
25
|
}
|
|
35
26
|
}
|
|
36
27
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
r as CHECKBOX_BLOCK_ID,
|
|
29
|
+
p as CheckboxBlock
|
|
39
30
|
};
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
|
-
var c = (
|
|
3
|
-
var a = (
|
|
4
|
-
import { useHttp as
|
|
5
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
|
|
9
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
|
|
10
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
|
|
11
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
|
|
12
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
|
|
13
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
|
|
14
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
|
|
15
|
-
import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
|
|
16
|
-
import { UEAttr as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js";
|
|
17
|
-
import { UIElementType as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
|
|
18
|
-
import { Control as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js";
|
|
19
|
-
import { ModificationDescription as l } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js";
|
|
20
|
-
const d = "ui-elements-checkbox", n = "select", { get: L } = p();
|
|
21
|
-
class K extends m {
|
|
2
|
+
var c = (r, s, t) => s in r ? E(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var a = (r, s, t) => c(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { useHttp as l } from "../../../composables/useHttp.js";
|
|
5
|
+
import { Control as d, UIElementType as n, UEAttr as e, ModificationDescription as L } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
const p = "ui-elements-checkbox", o = "select", { get: h } = l();
|
|
7
|
+
class b extends d {
|
|
22
8
|
constructor() {
|
|
23
9
|
super(...arguments);
|
|
24
10
|
a(this, "currentNode");
|
|
@@ -26,27 +12,27 @@ class K extends m {
|
|
|
26
12
|
a(this, "unsubList", []);
|
|
27
13
|
}
|
|
28
14
|
getId() {
|
|
29
|
-
return
|
|
15
|
+
return p;
|
|
30
16
|
}
|
|
31
17
|
_setFormValues() {
|
|
32
18
|
this.api.updateValues({
|
|
33
|
-
[
|
|
19
|
+
[o]: ""
|
|
34
20
|
});
|
|
35
21
|
}
|
|
36
22
|
_getLabel(t, i = `${Math.random()}`) {
|
|
37
23
|
return `
|
|
38
|
-
<${
|
|
24
|
+
<${n.LABEL}
|
|
39
25
|
${e.LABEL.text}="${t}"
|
|
40
26
|
${e.LABEL.name}="${i}">
|
|
41
|
-
</${
|
|
27
|
+
</${n.LABEL}>
|
|
42
28
|
`;
|
|
43
29
|
}
|
|
44
30
|
_getSelectItem(t, i) {
|
|
45
31
|
return `
|
|
46
|
-
<${
|
|
32
|
+
<${n.SELECT_ITEM}
|
|
47
33
|
${e.SELECT_ITEM.text}="${t}"
|
|
48
34
|
${e.SELECT_ITEM.value}="${i}">
|
|
49
|
-
</${
|
|
35
|
+
</${n.SELECT_ITEM}>`;
|
|
50
36
|
}
|
|
51
37
|
_getSelect() {
|
|
52
38
|
return this.unsubList.map((t) => this._getSelectItem(t.name, t.sendGridId)).join("");
|
|
@@ -55,50 +41,50 @@ class K extends m {
|
|
|
55
41
|
return `
|
|
56
42
|
<div class="checkbox-controls-container">
|
|
57
43
|
<div class="checkbox-select-container container two-columns stretch">
|
|
58
|
-
<${
|
|
44
|
+
<${n.LABEL}
|
|
59
45
|
${e.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
|
|
60
46
|
${e.LABEL.name}="${Math.random()}">
|
|
61
|
-
</${
|
|
47
|
+
</${n.LABEL}>
|
|
62
48
|
|
|
63
|
-
<${
|
|
64
|
-
${e.SELECTPICKER.name}="${
|
|
49
|
+
<${n.SELECTPICKER}
|
|
50
|
+
${e.SELECTPICKER.name}="${o}"
|
|
65
51
|
${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
66
52
|
${this._getSelect()}
|
|
67
|
-
</${
|
|
53
|
+
</${n.SELECTPICKER}>
|
|
68
54
|
</div>
|
|
69
55
|
</div>
|
|
70
56
|
`;
|
|
71
57
|
}
|
|
72
58
|
_onSelectChange(t) {
|
|
73
|
-
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new
|
|
59
|
+
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new L(`Updated text to ${t}`));
|
|
74
60
|
}
|
|
75
61
|
_listenToFormUpdates() {
|
|
76
|
-
this.api.onValueChanged(
|
|
62
|
+
this.api.onValueChanged(o, (t) => this._onSelectChange(t));
|
|
77
63
|
}
|
|
78
64
|
onTemplateNodeUpdated(t) {
|
|
79
65
|
if (this.currentNode = t, "getAttribute" in t) {
|
|
80
66
|
const i = Number(t.getAttribute("id"));
|
|
81
67
|
i && (this.selectedUnsubGroup = i, this.api.updateValues({
|
|
82
|
-
[
|
|
68
|
+
[o]: this.selectedUnsubGroup
|
|
83
69
|
}));
|
|
84
70
|
}
|
|
85
71
|
}
|
|
86
72
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
87
73
|
async onRender() {
|
|
88
|
-
const t = await
|
|
74
|
+
const t = await h(
|
|
89
75
|
"/unsubscribe-groups/unsubscribe-list"
|
|
90
76
|
), i = t.data.map((u) => ({
|
|
91
77
|
[e.SELECT_ITEM.text]: u.name,
|
|
92
78
|
[e.SELECT_ITEM.value]: u.sendGridId
|
|
93
79
|
}));
|
|
94
80
|
this.unsubList = t.data, this.api.setUIEAttribute(
|
|
95
|
-
|
|
81
|
+
o,
|
|
96
82
|
e.SELECTPICKER.items,
|
|
97
83
|
i
|
|
98
84
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
p as CHECKBOX_CONTROL_BLOCK_ID,
|
|
89
|
+
b as CheckboxControl
|
|
104
90
|
};
|