@useinsider/guido 1.0.3-beta.45db97c → 1.0.3-beta.46b1cdf
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 +3 -140
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +73 -79
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
- package/dist/components/organisms/header/RightSlot.vue.js +11 -11
- package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
- package/dist/composables/useGuidoActions.js +9 -19
- package/dist/composables/useStripo.js +58 -49
- package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
- package/dist/config/migrator/radioButtonMigrator.js +5 -5
- package/dist/enums/defaults.js +9 -16
- package/dist/enums/unsubscribe.js +25 -27
- package/dist/extensions/Blocks/Checkbox/control.js +14 -15
- package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
- package/dist/extensions/Blocks/RadioButton/control.js +17 -18
- package/dist/extensions/Blocks/RadioButton/template.js +4 -4
- package/dist/extensions/Blocks/Recommendation/extension.js +4 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +4 -4
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +1 -1
- package/dist/src/@types/generic.d.ts +6 -36
- package/dist/src/components/Guido.vue.d.ts +2 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useGuidoActions.d.ts +0 -9
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
- package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
- package/dist/src/stores/config.d.ts +2 -9
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +1 -1
- package/dist/src/stores/onboarding.d.ts +1 -1
- package/dist/src/stores/preview.d.ts +1 -1
- package/dist/src/stores/recommendation.d.ts +1 -1
- package/dist/src/stores/save-as-template.d.ts +1 -1
- package/dist/src/stores/toaster.d.ts +1 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -1
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/genericUtil.d.ts +0 -1
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +5 -5
- package/dist/stores/dynamic-content.js +2 -2
- package/dist/stores/editor.js +1 -1
- package/dist/stores/onboarding.js +27 -27
- package/dist/stores/preview.js +1 -1
- package/dist/stores/recommendation.js +3 -3
- package/dist/stores/save-as-template.js +2 -2
- package/dist/stores/toaster.js +1 -1
- package/dist/stores/unsubscribe.js +1 -1
- package/dist/stores/version-history.js +4 -4
- package/dist/utils/genericUtil.js +9 -20
- package/package.json +2 -2
- package/dist/composables/useBlocksConfig.js +0 -49
- package/dist/src/composables/useBlocksConfig.d.ts +0 -11
- package/dist/src/utils/environmentUtil.d.ts +0 -5
- package/dist/utils/environmentUtil.js +0 -4
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useCustomInterfaceAppearance as E } from "./useCustomInterfaceAppearance.js";
|
|
3
|
+
import { useStripoEventHandler as S } from "./useStripoEventHandler.js";
|
|
4
|
+
import { useToaster as C } from "./useToaster.js";
|
|
5
|
+
import { displayConditions as y } from "../enums/displayConditions.js";
|
|
6
|
+
import h from "../extensions/Blocks/Checkbox/extension.js";
|
|
7
|
+
import w from "../extensions/Blocks/CouponBlock/extension.js";
|
|
8
|
+
import b from "../extensions/Blocks/RadioButton/extension.js";
|
|
9
|
+
import V from "../extensions/Blocks/Recommendation/extension.js";
|
|
10
|
+
import _ from "../extensions/Blocks/Unsubscribe/extension.js";
|
|
11
|
+
import k from "../extensions/DynamicContent/extension.js";
|
|
12
|
+
import { useStripoApi as B } from "../services/stripoApi.js";
|
|
13
|
+
import x from "../static/styles/customEditorStyle.css.js";
|
|
14
|
+
import { useEditorStore as F } from "../stores/editor.js";
|
|
15
|
+
import { dynamicContentToMergeTags as A } from "../utils/genericUtil.js";
|
|
16
|
+
import T from "../package.json.js";
|
|
17
|
+
const G = (a) => {
|
|
18
|
+
const { handleError: d } = C(), { getToken: u, getCustomFonts: m } = B(), { handleEvent: p } = S(), l = (r, i = []) => {
|
|
19
|
+
const t = F(), { html: n, css: c, forceRecreate: s } = r;
|
|
17
20
|
window.UIEditor.initEditor(
|
|
18
21
|
document.querySelector("#guido-editor"),
|
|
19
22
|
{
|
|
20
|
-
metadata:
|
|
23
|
+
metadata: a,
|
|
21
24
|
html: n,
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
25
|
+
css: c,
|
|
26
|
+
forceRecreate: s,
|
|
24
27
|
locale: "en",
|
|
25
28
|
undoButtonSelector: "#guido__undo-button",
|
|
26
29
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,40 +33,39 @@ const N = (d) => {
|
|
|
30
33
|
customAppearanceMergetags: !0,
|
|
31
34
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
35
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
36
|
+
customViewStyles: x,
|
|
37
|
+
conditionsEnabled: !0,
|
|
38
|
+
customConditionsEnabled: !0,
|
|
39
|
+
conditionCategories: y,
|
|
37
40
|
enableXSSSecurity: !0,
|
|
38
41
|
messageSettingsEnabled: !1,
|
|
39
42
|
selectBlockAfterDropFromSettingsPanel: !0,
|
|
40
|
-
...e ? { baseBlocks: e } : {},
|
|
41
43
|
editorFonts: {
|
|
42
44
|
showDefaultStandardFonts: !0,
|
|
43
45
|
showDefaultNotStandardFonts: !0,
|
|
44
|
-
customFonts:
|
|
46
|
+
customFonts: i
|
|
45
47
|
},
|
|
46
48
|
mergeTags: [
|
|
47
49
|
{
|
|
48
|
-
entries:
|
|
50
|
+
entries: A(a.preselectedDynamicContentList)
|
|
49
51
|
}
|
|
50
52
|
],
|
|
51
53
|
async onTokenRefreshRequest(o) {
|
|
52
54
|
try {
|
|
53
|
-
const
|
|
54
|
-
o(
|
|
55
|
-
} catch (
|
|
56
|
-
|
|
55
|
+
const e = await u();
|
|
56
|
+
o(e);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
d(e, "Failed to refresh token");
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
onTemplateLoaded() {
|
|
60
62
|
try {
|
|
61
|
-
const { importCss: o } =
|
|
62
|
-
o(),
|
|
63
|
+
const { importCss: o } = E(), { activateCustomViewStyles: e } = f();
|
|
64
|
+
o(), e(), a.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
63
65
|
t.hasChanges = !1;
|
|
64
66
|
}, 1e3);
|
|
65
67
|
} catch (o) {
|
|
66
|
-
|
|
68
|
+
d(o, "Failed to load custom interface appearance");
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
onCodeEditorVisibilityChanged(o) {
|
|
@@ -78,35 +80,42 @@ const N = (d) => {
|
|
|
78
80
|
onDataChanged() {
|
|
79
81
|
t.hasChanges = !0;
|
|
80
82
|
},
|
|
81
|
-
onEvent:
|
|
83
|
+
onEvent: p,
|
|
82
84
|
ignoreClickOutsideSelectors: [
|
|
83
85
|
"#guido-dynamic-content-modal",
|
|
84
86
|
".in-on-board-wrapper",
|
|
85
87
|
".in-drawer__container"
|
|
86
88
|
],
|
|
87
|
-
extensions:
|
|
89
|
+
extensions: [
|
|
90
|
+
k,
|
|
91
|
+
h,
|
|
92
|
+
b,
|
|
93
|
+
V,
|
|
94
|
+
_,
|
|
95
|
+
w
|
|
96
|
+
]
|
|
88
97
|
}
|
|
89
98
|
);
|
|
90
|
-
},
|
|
91
|
-
var
|
|
99
|
+
}, g = (r) => new Promise((i, t) => {
|
|
100
|
+
var e;
|
|
92
101
|
if (document.getElementById("UiEditorScript")) {
|
|
93
|
-
|
|
102
|
+
r(), i();
|
|
94
103
|
return;
|
|
95
104
|
}
|
|
96
|
-
const n =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
t(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
101
|
-
}, document.body.appendChild(
|
|
105
|
+
const n = T.guido, s = `https://email-static.useinsider.com/guido/${(e = n == null ? void 0 : n.stripo) == null ? void 0 : e.version}/UIEditor.js`, o = document.createElement("script");
|
|
106
|
+
o.id = "UiEditorScript", o.type = "module", o.src = s, o.onload = () => {
|
|
107
|
+
r(), i();
|
|
108
|
+
}, o.onerror = () => {
|
|
109
|
+
t(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
110
|
+
}, document.body.appendChild(o);
|
|
102
111
|
});
|
|
103
|
-
return { initPlugin: async (
|
|
104
|
-
await
|
|
105
|
-
const
|
|
106
|
-
|
|
112
|
+
return { initPlugin: async (r) => {
|
|
113
|
+
await g(async () => {
|
|
114
|
+
const i = await m();
|
|
115
|
+
l(r, i);
|
|
107
116
|
});
|
|
108
117
|
} };
|
|
109
118
|
};
|
|
110
119
|
export {
|
|
111
|
-
|
|
120
|
+
G as useStripo
|
|
112
121
|
};
|
|
@@ -1,41 +1,36 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as l, LINK_TYPES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const D = [
|
|
1
|
+
import { usePartner as U } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as l, LINK_TYPES as b, URLS as f } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as B } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as N } from "../../stores/config.js";
|
|
5
|
+
import { useUnsubscribeStore as I } from "../../stores/unsubscribe.js";
|
|
6
|
+
const T = [
|
|
8
7
|
{
|
|
9
8
|
id: "add-unsubscribe-link-values",
|
|
10
9
|
description: "Adding unsubscribe link values",
|
|
11
10
|
type: "custom",
|
|
12
11
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } =
|
|
14
|
-
if (!
|
|
12
|
+
const { getPartnerName: i } = U(), a = N(), n = I(), u = a.getVariationId;
|
|
13
|
+
if (!u)
|
|
15
14
|
return t;
|
|
16
|
-
let
|
|
17
|
-
const
|
|
18
|
-
return new DOMParser().parseFromString(
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
15
|
+
let o = t;
|
|
16
|
+
const e = `/${i()}/email/${u}?user={{iid}}`;
|
|
17
|
+
return new DOMParser().parseFromString(o, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
|
|
18
|
+
var g;
|
|
19
|
+
const d = p.getAttribute("data-unsubscribe-page-list");
|
|
20
|
+
if (!d)
|
|
22
21
|
return;
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
)) ?? [],
|
|
22
|
+
const S = B(d), m = ((g = n.templates) == null ? void 0 : g.filter(
|
|
23
|
+
(c) => S.includes(c.id)
|
|
24
|
+
)) ?? [], R = m.some((c) => c.type === b.UNSUBSCRIBE_LINK_TYPE), _ = m.some((c) => c.type === b.PREFERENCES_LINK_TYPE), E = p.outerHTML;
|
|
26
25
|
let s = E;
|
|
27
|
-
|
|
28
|
-
text: f,
|
|
29
|
-
value: f,
|
|
30
|
-
fallback: ""
|
|
31
|
-
}), s = s.replace(
|
|
26
|
+
R && (s = s.replace(
|
|
32
27
|
l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
33
|
-
|
|
34
|
-
)),
|
|
28
|
+
f.UNSUBSCRIBE_URL + e
|
|
29
|
+
)), _ && (s = s.replace(
|
|
35
30
|
l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
36
|
-
|
|
37
|
-
)), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""),
|
|
38
|
-
}),
|
|
31
|
+
f.PREFERENCES_URL + e
|
|
32
|
+
)), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), o = o.replace(E, s);
|
|
33
|
+
}), o;
|
|
39
34
|
},
|
|
40
35
|
priority: 60
|
|
41
36
|
},
|
|
@@ -61,16 +56,16 @@ const D = [
|
|
|
61
56
|
type: "custom",
|
|
62
57
|
processor: (t) => {
|
|
63
58
|
let i = t;
|
|
64
|
-
const
|
|
65
|
-
return
|
|
59
|
+
const a = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
60
|
+
return a && a.forEach((n) => {
|
|
66
61
|
if (n.includes("insEmail=1"))
|
|
67
62
|
return;
|
|
68
63
|
if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
69
|
-
const
|
|
64
|
+
const o = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
|
|
70
65
|
const r = e.slice(6, e.length - 1).trim();
|
|
71
66
|
return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
|
|
72
67
|
});
|
|
73
|
-
i = i.replace(n,
|
|
68
|
+
i = i.replace(n, o);
|
|
74
69
|
}
|
|
75
70
|
}), i;
|
|
76
71
|
},
|
|
@@ -78,5 +73,5 @@ const D = [
|
|
|
78
73
|
}
|
|
79
74
|
];
|
|
80
75
|
export {
|
|
81
|
-
|
|
76
|
+
T as unsubscribeCompilerRules
|
|
82
77
|
};
|
|
@@ -11,7 +11,7 @@ class T {
|
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((s) => {
|
|
14
|
-
const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"),
|
|
14
|
+
const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), y = this.parser.parseFromString(
|
|
15
15
|
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
16
16
|
"text/html"
|
|
17
17
|
).querySelector(".radio-button-v2");
|
|
@@ -43,13 +43,13 @@ class T {
|
|
|
43
43
|
styles: "",
|
|
44
44
|
classList: ""
|
|
45
45
|
};
|
|
46
|
-
const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"),
|
|
46
|
+
const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
|
|
47
47
|
return {
|
|
48
48
|
text: o,
|
|
49
49
|
isBold: p,
|
|
50
50
|
isItalic: u,
|
|
51
51
|
align: a,
|
|
52
|
-
styles:
|
|
52
|
+
styles: g,
|
|
53
53
|
classList: m
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -78,9 +78,9 @@ class T {
|
|
|
78
78
|
return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function A(r) {
|
|
82
82
|
return new T().migrate(r);
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
85
|
+
A as migrateRadioButton
|
|
86
86
|
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = {
|
|
2
2
|
translationsPath: "window.trans.en",
|
|
3
3
|
migrationDate: 1759696858,
|
|
4
4
|
emailHeader: {
|
|
@@ -8,25 +8,18 @@ const e = {
|
|
|
8
8
|
extensions: {
|
|
9
9
|
unsubscribe: !0
|
|
10
10
|
},
|
|
11
|
-
blocks: {
|
|
12
|
-
excludeDefaults: [],
|
|
13
|
-
includeCustoms: []
|
|
14
|
-
},
|
|
15
11
|
features: {
|
|
16
12
|
dynamicContent: !0,
|
|
17
13
|
saveAsTemplate: !0,
|
|
18
|
-
versionHistory: !0
|
|
19
|
-
testMessage: !0,
|
|
20
|
-
displayConditions: !0
|
|
14
|
+
versionHistory: !0
|
|
21
15
|
},
|
|
22
16
|
useHeader: !0
|
|
23
17
|
}, t = {
|
|
24
18
|
promotional: 1,
|
|
25
19
|
transactional: 2
|
|
26
|
-
},
|
|
20
|
+
}, e = "email", o = "Guido User", n = t.promotional, i = 2, s = {
|
|
27
21
|
email: 60,
|
|
28
|
-
architect: 49
|
|
29
|
-
unsubscribePages: 97
|
|
22
|
+
architect: 49
|
|
30
23
|
}, u = [
|
|
31
24
|
"alfredtesting",
|
|
32
25
|
"electio",
|
|
@@ -60,12 +53,12 @@ const e = {
|
|
|
60
53
|
"stripoeditorlivetest"
|
|
61
54
|
];
|
|
62
55
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
a as DefaultGuidoConfig,
|
|
57
|
+
n as DefaultMessageType,
|
|
58
|
+
e as DefaultProductType,
|
|
66
59
|
o as DefaultUsername,
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
i as EditorType,
|
|
61
|
+
s as ProductIds,
|
|
69
62
|
u as TEST_PARTNER_LIST,
|
|
70
63
|
t as TemplateTypes
|
|
71
64
|
};
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
|
|
3
|
-
const e = n(), I = {
|
|
1
|
+
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
|
+
const s = e(), R = {
|
|
4
3
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
4
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
5
|
+
}, S = {
|
|
7
6
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
7
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
8
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
9
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL:
|
|
13
|
-
PREFERENCES_URL:
|
|
14
|
-
},
|
|
10
|
+
}, N = {
|
|
11
|
+
UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
|
|
12
|
+
PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
|
|
13
|
+
}, _ = {
|
|
15
14
|
name: "Global Unsubscribe",
|
|
16
15
|
sendGridId: "G"
|
|
17
|
-
},
|
|
16
|
+
}, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
|
|
18
17
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
19
18
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
20
19
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
20
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
21
|
RESUBSCRIBE: 5
|
|
23
|
-
},
|
|
22
|
+
}, i = {
|
|
24
23
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
25
24
|
E.GLOBAL_UNSUBSCRIBE,
|
|
26
25
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -30,27 +29,26 @@ const e = n(), I = {
|
|
|
30
29
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
30
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
32
31
|
]
|
|
33
|
-
},
|
|
34
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
35
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
36
|
-
[E.RESUBSCRIBE]:
|
|
37
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
38
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
39
|
-
},
|
|
32
|
+
}, B = {
|
|
33
|
+
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
34
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
35
|
+
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
36
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
37
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
38
|
+
}, C = {
|
|
40
39
|
default: "{{ins-unsubscribe-link}}",
|
|
41
40
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
42
41
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
43
42
|
};
|
|
44
43
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
o as MERGE_TAGS,
|
|
44
|
+
I as ACADEMY_LINK,
|
|
45
|
+
_ as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
46
|
+
S as LINK_REGEXES,
|
|
47
|
+
R as LINK_TYPES,
|
|
48
|
+
C as MERGE_TAGS,
|
|
51
49
|
E as PAGE_TYPES,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
i as TYPE_COLLECTIONS,
|
|
51
|
+
B as TYPE_TRANSLATIONS,
|
|
52
|
+
r as UNSUBSCRIBE_PAGES_LINK,
|
|
53
|
+
N as URLS
|
|
56
54
|
};
|
|
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
|
|
|
2
2
|
var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
3
3
|
var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
-
import { DEFAULT_UNSUBSCRIBE_GROUP as
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
|
|
6
6
|
import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
const m = "ui-elements-checkbox",
|
|
7
|
+
const m = "ui-elements-checkbox", a = "select", { get: C } = L();
|
|
8
8
|
class S extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -16,15 +16,14 @@ class S extends h {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.
|
|
19
|
+
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const e = this.currentNode.getAttribute("id");
|
|
21
21
|
if (e) {
|
|
22
|
-
const s = e ===
|
|
23
|
-
s && (this.selectedUnsubGroup = s
|
|
22
|
+
const s = e === u.sendGridId ? e : Number(e);
|
|
23
|
+
s && (this.selectedUnsubGroup = s, this.api.updateValues({
|
|
24
|
+
[a]: this.selectedUnsubGroup
|
|
25
|
+
}));
|
|
24
26
|
}
|
|
25
|
-
this.api.updateValues({
|
|
26
|
-
[u]: this.selectedUnsubGroup
|
|
27
|
-
});
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
_getLabel(e, s = `${Math.random()}`) {
|
|
@@ -55,7 +54,7 @@ class S extends h {
|
|
|
55
54
|
</${i.LABEL}>
|
|
56
55
|
|
|
57
56
|
<${i.SELECTPICKER}
|
|
58
|
-
${t.SELECTPICKER.name}="${
|
|
57
|
+
${t.SELECTPICKER.name}="${a}"
|
|
59
58
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
60
59
|
${this._getSelect()}
|
|
61
60
|
</${i.SELECTPICKER}>
|
|
@@ -67,21 +66,21 @@ class S extends h {
|
|
|
67
66
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
68
67
|
}
|
|
69
68
|
_listenToFormUpdates() {
|
|
70
|
-
this.api.onValueChanged(
|
|
69
|
+
this.api.onValueChanged(a, (e) => this._onSelectChange(e));
|
|
71
70
|
}
|
|
72
71
|
onTemplateNodeUpdated(e) {
|
|
73
|
-
this.currentNode = e
|
|
72
|
+
this.currentNode = e;
|
|
74
73
|
}
|
|
75
74
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
76
75
|
async onRender() {
|
|
77
76
|
const e = await C(
|
|
78
77
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
80
|
-
[t.SELECT_ITEM.text]:
|
|
81
|
-
[t.SELECT_ITEM.value]:
|
|
78
|
+
), s = [u, ...e.data], E = s.map((c) => ({
|
|
79
|
+
[t.SELECT_ITEM.text]: c.name,
|
|
80
|
+
[t.SELECT_ITEM.value]: c.sendGridId
|
|
82
81
|
}));
|
|
83
82
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
84
|
-
|
|
83
|
+
a,
|
|
85
84
|
t.SELECTPICKER.items,
|
|
86
85
|
E
|
|
87
86
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
@@ -3,7 +3,7 @@ import { CheckboxBlock as t } from "./block.js";
|
|
|
3
3
|
import { CheckboxControl as e } from "./control.js";
|
|
4
4
|
import { CheckboxIconsRegistry as r } from "./iconsRegistry.js";
|
|
5
5
|
import { CheckboxBlockSettings as i } from "./settingsPanel.js";
|
|
6
|
-
const
|
|
6
|
+
const k = new o().addBlock(t).withSettingsPanelRegistry(i).addControl(e).withIconsRegistry(r).build();
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
k as default
|
|
9
9
|
};
|
|
@@ -2,7 +2,7 @@ import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-edito
|
|
|
2
2
|
import { CouponBlock as t } from "./block.js";
|
|
3
3
|
import { CouponIconsRegistry as i } from "./iconsRegistry.js";
|
|
4
4
|
import { CouponBlockSettings as n } from "./settingsPanel.js";
|
|
5
|
-
const
|
|
5
|
+
const m = new o().addBlock(t).withSettingsPanelRegistry(n).withIconsRegistry(i).build();
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
m as default
|
|
8
8
|
};
|
|
@@ -2,10 +2,10 @@ var d = Object.defineProperty;
|
|
|
2
2
|
var l = (r, n, t) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
3
|
var o = (r, n, t) => l(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
-
import { DEFAULT_UNSUBSCRIBE_GROUP as
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as E } from "../../../enums/unsubscribe.js";
|
|
6
6
|
import { Control as p, UIElementType as i, UEAttr as e, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
const m = "ui-elements-radio-button",
|
|
8
|
-
class
|
|
7
|
+
const m = "ui-elements-radio-button", a = "select", { get: $ } = L();
|
|
8
|
+
class _ extends p {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -16,16 +16,15 @@ class S extends p {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.
|
|
19
|
+
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const t = this.currentNode.getAttribute("id");
|
|
21
21
|
if (t) {
|
|
22
|
-
const s = t ===
|
|
23
|
-
s && (this.selectedUnsubGroup = s
|
|
22
|
+
const s = t === E.sendGridId ? t : Number(t);
|
|
23
|
+
s && (this.selectedUnsubGroup = s, this.api.updateValues({
|
|
24
|
+
[a]: this.selectedUnsubGroup
|
|
25
|
+
}));
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
|
-
this.api.updateValues({
|
|
27
|
-
[u]: this.selectedUnsubGroup
|
|
28
|
-
});
|
|
29
28
|
}
|
|
30
29
|
_getLabel(t, s = `${Math.random()}`) {
|
|
31
30
|
return `
|
|
@@ -55,7 +54,7 @@ class S extends p {
|
|
|
55
54
|
</${i.LABEL}>
|
|
56
55
|
|
|
57
56
|
<${i.SELECTPICKER}
|
|
58
|
-
${e.SELECTPICKER.name}="${
|
|
57
|
+
${e.SELECTPICKER.name}="${a}"
|
|
59
58
|
${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
60
59
|
${this._getSelect()}
|
|
61
60
|
</${i.SELECTPICKER}>
|
|
@@ -67,27 +66,27 @@ class S extends p {
|
|
|
67
66
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
|
|
68
67
|
}
|
|
69
68
|
_listenToFormUpdates() {
|
|
70
|
-
this.api.onValueChanged(
|
|
69
|
+
this.api.onValueChanged(a, (t) => this._onSelectChange(t));
|
|
71
70
|
}
|
|
72
71
|
onTemplateNodeUpdated(t) {
|
|
73
|
-
this.currentNode = t
|
|
72
|
+
this.currentNode = t;
|
|
74
73
|
}
|
|
75
74
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
76
75
|
async onRender() {
|
|
77
76
|
const t = await $(
|
|
78
77
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
80
|
-
[e.SELECT_ITEM.text]:
|
|
81
|
-
[e.SELECT_ITEM.value]:
|
|
78
|
+
), s = [E, ...t.data], c = s.map((u) => ({
|
|
79
|
+
[e.SELECT_ITEM.text]: u.name,
|
|
80
|
+
[e.SELECT_ITEM.value]: u.sendGridId
|
|
82
81
|
}));
|
|
83
82
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
84
|
-
|
|
83
|
+
a,
|
|
85
84
|
e.SELECTPICKER.items,
|
|
86
|
-
|
|
85
|
+
c
|
|
87
86
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
export {
|
|
91
90
|
m as CONTROL_BLOCK_ID,
|
|
92
|
-
|
|
91
|
+
_ as RadioButtonControl
|
|
93
92
|
};
|
|
@@ -32,7 +32,7 @@ const e = {
|
|
|
32
32
|
<input
|
|
33
33
|
type="radio"
|
|
34
34
|
id="radioYes"
|
|
35
|
-
name="unsubscribe
|
|
35
|
+
name="unsubscribe"
|
|
36
36
|
data-cke-editable="1"
|
|
37
37
|
style="margin: 0px; vertical-align: middle;">
|
|
38
38
|
</td>
|
|
@@ -53,7 +53,7 @@ const e = {
|
|
|
53
53
|
<input
|
|
54
54
|
type="radio"
|
|
55
55
|
id="radioNo"
|
|
56
|
-
name="unsubscribe
|
|
56
|
+
name="unsubscribe"
|
|
57
57
|
data-cke-editable="1"
|
|
58
58
|
style="margin: 0px; vertical-align: middle;">
|
|
59
59
|
</td>
|
|
@@ -108,7 +108,7 @@ const e = {
|
|
|
108
108
|
<input
|
|
109
109
|
type="radio"
|
|
110
110
|
id="radioYes"
|
|
111
|
-
name="unsubscribe
|
|
111
|
+
name="unsubscribe"
|
|
112
112
|
data-cke-editable="1"
|
|
113
113
|
style="margin: 0px; vertical-align: middle;>
|
|
114
114
|
</td>
|
|
@@ -123,7 +123,7 @@ const e = {
|
|
|
123
123
|
<input
|
|
124
124
|
type="radio"
|
|
125
125
|
id="radioNo"
|
|
126
|
-
name="unsubscribe
|
|
126
|
+
name="unsubscribe"
|
|
127
127
|
data-cke-editable="1"
|
|
128
128
|
style="margin: 0px; vertical-align: middle;">
|
|
129
129
|
</td>
|