@useinsider/guido 1.0.3-beta.d8a9e56 → 1.0.3-beta.dbf4a88
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/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +74 -69
- 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.js +24 -0
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +107 -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.js +6 -4
- package/dist/composables/useStripo.js +41 -34
- package/dist/config/compiler/unsubscribeCompilerRules.js +42 -29
- package/dist/config/migrator/index.js +7 -6
- package/dist/config/migrator/unsubscribeMigrator.js +124 -0
- package/dist/enums/defaults.js +6 -3
- package/dist/enums/unsubscribe.js +43 -6
- package/dist/extensions/Blocks/Checkbox/control.js +55 -53
- package/dist/extensions/Blocks/RadioButton/control.js +44 -42
- package/dist/extensions/Blocks/Unsubscribe/block.js +131 -0
- package/dist/extensions/Blocks/Unsubscribe/control.js +167 -0
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +42 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +21 -0
- package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.js +21 -0
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +35 -0
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +42 -0
- package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +10 -0
- package/dist/extensions/Blocks/Unsubscribe/template.js +22 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
- package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +2 -1
- package/dist/package.json.js +7 -0
- package/dist/services/unsubscribeApi.js +16 -0
- package/dist/{@types → src/@types}/generic.d.ts +9 -0
- package/dist/{components → src/components}/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
- package/dist/src/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
- package/dist/src/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
- package/dist/src/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
- package/dist/{components → src/components}/wrappers/WpDrawer.vue.d.ts +6 -4
- package/dist/src/config/migrator/index.d.ts +1 -0
- package/dist/src/config/migrator/unsubscribeMigrator.d.ts +1 -0
- package/dist/src/enums/unsubscribe.d.ts +38 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +32 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
- package/dist/src/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
- package/dist/src/extensions/Blocks/Unsubscribe/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/Blocks/Unsubscribe/tagRegistry.d.ts +4 -0
- package/dist/src/extensions/Blocks/Unsubscribe/template.d.ts +12 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +4 -0
- package/dist/src/extensions/DynamicContent/extension.d.ts +2 -0
- package/dist/src/services/unsubscribeApi.d.ts +4 -0
- package/dist/src/stores/config.d.ts +96 -0
- package/dist/src/stores/unsubscribe.d.ts +256 -0
- package/dist/stores/config.js +17 -0
- package/dist/stores/unsubscribe.js +126 -6
- package/dist/utils/templatePreparation.js +17 -16
- package/package.json +6 -1
- package/dist/config/migrator/index.d.ts +0 -1
- package/dist/enums/unsubscribe.d.ts +0 -15
- package/dist/stores/unsubscribe.d.ts +0 -8
- /package/dist/{@types → src/@types}/events.d.ts +0 -0
- /package/dist/{@types → src/@types}/save-as-template.d.ts +0 -0
- /package/dist/{App.vue.d.ts → src/App.vue.d.ts} +0 -0
- /package/dist/{components → src/components}/organisms/LoadingWrapper.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/base/Toaster.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/PreviewContainer.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/amp/AmpErrorModal.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/amp/AmpToggle.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/desktop-preview/DesktopPreview.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/mobile-preview/ContentView.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/mobile-preview/InboxView.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/email-preview/mobile-preview/MobilePreview.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/HeaderWrapper.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/LeftSlot.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/MiddleSlot.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/RightSlot.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/ViewOptions.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/version-history/RestoreButton.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/version-history/VersionHistory.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/version-history/VersionHistoryItem.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/header/version-history/ViewOptions.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/AMPOnboarding.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/GenericOnboarding.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/NewVersionPopup.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/OnboardingWrapper.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/TextBlockOnboarding.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts +0 -0
- /package/dist/{components → src/components}/organisms/save-as-template/SaveAsTemplateDrawer.vue.d.ts +0 -0
- /package/dist/{components → src/components}/wrappers/WpModal.vue.d.ts +0 -0
- /package/dist/{composables → src/composables}/useActionsApi.d.ts +0 -0
- /package/dist/{composables → src/composables}/useApiExample.d.ts +0 -0
- /package/dist/{composables → src/composables}/useCodeEditorApi.d.ts +0 -0
- /package/dist/{composables → src/composables}/useConfig.d.ts +0 -0
- /package/dist/{composables → src/composables}/useCustomInterfaceAppearance.d.ts +0 -0
- /package/dist/{composables → src/composables}/useDebounce.d.ts +0 -0
- /package/dist/{composables → src/composables}/useExport.d.ts +0 -0
- /package/dist/{composables → src/composables}/useGuidoActions.d.ts +0 -0
- /package/dist/{composables → src/composables}/useHtmlCompiler.d.ts +0 -0
- /package/dist/{composables → src/composables}/useHtmlValidator.d.ts +0 -0
- /package/dist/{composables → src/composables}/useHttp.d.ts +0 -0
- /package/dist/{composables → src/composables}/usePartner.d.ts +0 -0
- /package/dist/{composables → src/composables}/usePreviewMode.d.ts +0 -0
- /package/dist/{composables → src/composables}/useProvideInject.d.ts +0 -0
- /package/dist/{composables → src/composables}/useRecommendation.d.ts +0 -0
- /package/dist/{composables → src/composables}/useResponsivePreview.d.ts +0 -0
- /package/dist/{composables → src/composables}/useSave.d.ts +0 -0
- /package/dist/{composables → src/composables}/useStripo.d.ts +0 -0
- /package/dist/{composables → src/composables}/useStripoEventHandler.d.ts +0 -0
- /package/dist/{composables → src/composables}/useToaster.d.ts +0 -0
- /package/dist/{composables → src/composables}/useTranslations.d.ts +0 -0
- /package/dist/{composables → src/composables}/useValidation.d.ts +0 -0
- /package/dist/{composables → src/composables}/useVersionHistoryApi.d.ts +0 -0
- /package/dist/{composables → src/composables}/validators/saveAsTemplate.d.ts +0 -0
- /package/dist/{config → src/config}/compiler/htmlCompilerRules.d.ts +0 -0
- /package/dist/{config → src/config}/compiler/outlookCompilerRules.d.ts +0 -0
- /package/dist/{config → src/config}/compiler/recommendationCompilerRules.d.ts +0 -0
- /package/dist/{config → src/config}/compiler/socialCompilerRules.d.ts +0 -0
- /package/dist/{config → src/config}/compiler/unsubscribeCompilerRules.d.ts +0 -0
- /package/dist/{config → src/config}/migrator/checkboxMigrator.d.ts +0 -0
- /package/dist/{config → src/config}/migrator/couponBlockMigrator.d.ts +0 -0
- /package/dist/{config → src/config}/migrator/radioButtonMigrator.d.ts +0 -0
- /package/dist/{enums → src/enums}/defaults.d.ts +0 -0
- /package/dist/{enums → src/enums}/displayConditions.d.ts +0 -0
- /package/dist/{enums → src/enums}/html-validator.d.ts +0 -0
- /package/dist/{enums → src/enums}/onboarding.d.ts +0 -0
- /package/dist/{enums → src/enums}/preview.d.ts +0 -0
- /package/dist/{enums → src/enums}/recommendation.d.ts +0 -0
- /package/dist/{enums → src/enums}/toaster.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/block.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/control.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/extension.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/iconsRegistry.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/settingsPanel.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/Checkbox/template.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/CouponBlock/block.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/CouponBlock/extension.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/CouponBlock/iconsRegistry.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/CouponBlock/settingsPanel.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/CouponBlock/template.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/block.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/control.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/extension.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/iconsRegistry.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/settingsPanel.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/RadioButton/template.d.ts +0 -0
- /package/dist/{extensions/Blocks/_Boilerplate → src/extensions/Blocks/Unsubscribe}/extension.d.ts +0 -0
- /package/dist/{extensions/Blocks/_Boilerplate → src/extensions/Blocks/Unsubscribe}/settingsPanel.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/_Boilerplate/block.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/_Boilerplate/control.d.ts +0 -0
- /package/dist/{extensions/DynamicContent → src/extensions/Blocks/_Boilerplate}/extension.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/_Boilerplate/iconsRegistry.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/Blocks/_Boilerplate/template.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/DynamicContent/dynamic-content-modal.d.ts +0 -0
- /package/dist/{extensions → src/extensions}/DynamicContent/dynamic-content.d.ts +0 -0
- /package/dist/{library.d.ts → src/library.d.ts} +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
- /package/dist/{mock → src/mock}/api/auth.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/custom-fonts.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/default-template.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/template-library.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/unsubscribe.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/user-modal-state.d.ts +0 -0
- /package/dist/{mock → src/mock}/api/validator.d.ts +0 -0
- /package/dist/{mock → src/mock}/browser.d.ts +0 -0
- /package/dist/{mock → src/mock}/handlers.d.ts +0 -0
- /package/dist/{services → src/services}/onboardingApi.d.ts +0 -0
- /package/dist/{services → src/services}/stripoApi.d.ts +0 -0
- /package/dist/{services → src/services}/templateLibraryApi.d.ts +0 -0
- /package/dist/{stores → src/stores}/dynamic-content.d.ts +0 -0
- /package/dist/{stores → src/stores}/editor.d.ts +0 -0
- /package/dist/{stores → src/stores}/onboarding.d.ts +0 -0
- /package/dist/{stores → src/stores}/preview.d.ts +0 -0
- /package/dist/{stores → src/stores}/recommendation.d.ts +0 -0
- /package/dist/{stores → src/stores}/save-as-template.d.ts +0 -0
- /package/dist/{stores → src/stores}/toaster.d.ts +0 -0
- /package/dist/{stores → src/stores}/version-history.d.ts +0 -0
- /package/dist/{utils → src/utils}/arrayUtil.d.ts +0 -0
- /package/dist/{utils → src/utils}/base64.d.ts +0 -0
- /package/dist/{utils → src/utils}/dateUtil.d.ts +0 -0
- /package/dist/{utils → src/utils}/genericUtil.d.ts +0 -0
- /package/dist/{utils → src/utils}/htmlCompiler.d.ts +0 -0
- /package/dist/{utils → src/utils}/templatePreparation.d.ts +0 -0
- /package/dist/{utils → src/utils}/tooltipUtils.d.ts +0 -0
|
@@ -6,21 +6,23 @@ 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/CouponBlock/extension.js";
|
|
8
8
|
import b from "../extensions/Blocks/RadioButton/extension.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import V from "../extensions/Blocks/Unsubscribe/extension.js";
|
|
10
|
+
import _ from "../extensions/DynamicContent/extension.js";
|
|
11
|
+
import { useStripoApi as k } from "../services/stripoApi.js";
|
|
12
|
+
import B from "../static/styles/customEditorStyle.css.js";
|
|
13
|
+
import { useEditorStore as F } from "../stores/editor.js";
|
|
14
|
+
import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
|
|
15
|
+
import A from "../package.json.js";
|
|
16
|
+
const N = (a) => {
|
|
17
|
+
const { handleError: d } = C(), { getToken: u, getCustomFonts: m } = k(), { handleEvent: p } = E(), l = (r, i = []) => {
|
|
18
|
+
const t = F(), { html: n, css: c, forceRecreate: s } = r;
|
|
17
19
|
window.UIEditor.initEditor(
|
|
18
20
|
document.querySelector("#guido-editor"),
|
|
19
21
|
{
|
|
20
|
-
metadata:
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
22
|
+
metadata: a,
|
|
23
|
+
html: n,
|
|
24
|
+
css: c,
|
|
25
|
+
forceRecreate: s,
|
|
24
26
|
locale: "en",
|
|
25
27
|
undoButtonSelector: "#guido__undo-button",
|
|
26
28
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,7 +32,7 @@ const j = (s) => {
|
|
|
30
32
|
customAppearanceMergetags: !0,
|
|
31
33
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
34
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
35
|
+
customViewStyles: B,
|
|
34
36
|
conditionsEnabled: !0,
|
|
35
37
|
customConditionsEnabled: !0,
|
|
36
38
|
conditionCategories: y,
|
|
@@ -44,21 +46,21 @@ const j = (s) => {
|
|
|
44
46
|
},
|
|
45
47
|
mergeTags: [
|
|
46
48
|
{
|
|
47
|
-
entries:
|
|
49
|
+
entries: x(a.preselectedDynamicContentList)
|
|
48
50
|
}
|
|
49
51
|
],
|
|
50
52
|
async onTokenRefreshRequest(o) {
|
|
51
53
|
try {
|
|
52
|
-
const
|
|
53
|
-
o(
|
|
54
|
-
} catch (
|
|
55
|
-
d(
|
|
54
|
+
const e = await u();
|
|
55
|
+
o(e);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
d(e, "Failed to refresh token");
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
onTemplateLoaded() {
|
|
59
61
|
try {
|
|
60
|
-
const { importCss: o } = S(), { activateCustomViewStyles:
|
|
61
|
-
o(),
|
|
62
|
+
const { importCss: o } = S(), { activateCustomViewStyles: e } = f();
|
|
63
|
+
o(), e(), a.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
62
64
|
t.hasChanges = !1;
|
|
63
65
|
}, 1e3);
|
|
64
66
|
} catch (o) {
|
|
@@ -77,36 +79,41 @@ const j = (s) => {
|
|
|
77
79
|
onDataChanged() {
|
|
78
80
|
t.hasChanges = !0;
|
|
79
81
|
},
|
|
80
|
-
onEvent:
|
|
81
|
-
ignoreClickOutsideSelectors: [
|
|
82
|
+
onEvent: p,
|
|
83
|
+
ignoreClickOutsideSelectors: [
|
|
84
|
+
"#guido-dynamic-content-modal",
|
|
85
|
+
".in-on-board-wrapper",
|
|
86
|
+
".in-drawer__container"
|
|
87
|
+
],
|
|
82
88
|
extensions: [
|
|
83
|
-
|
|
89
|
+
_,
|
|
84
90
|
h,
|
|
85
91
|
b,
|
|
92
|
+
V,
|
|
86
93
|
w
|
|
87
94
|
]
|
|
88
95
|
}
|
|
89
96
|
);
|
|
90
|
-
},
|
|
97
|
+
}, g = (r) => new Promise((i, t) => {
|
|
98
|
+
var e;
|
|
91
99
|
if (document.getElementById("UiEditorScript")) {
|
|
92
100
|
r(), i();
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
95
|
-
const e = document.createElement("script");
|
|
96
|
-
|
|
103
|
+
const n = A.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");
|
|
104
|
+
o.id = "UiEditorScript", o.type = "module", o.src = s, o.onload = () => {
|
|
97
105
|
r(), i();
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, document.body.appendChild(e);
|
|
106
|
+
}, o.onerror = () => {
|
|
107
|
+
t(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
108
|
+
}, document.body.appendChild(o);
|
|
102
109
|
});
|
|
103
110
|
return { initPlugin: async (r) => {
|
|
104
|
-
await
|
|
105
|
-
const i = await
|
|
106
|
-
|
|
111
|
+
await g(async () => {
|
|
112
|
+
const i = await m();
|
|
113
|
+
l(r, i);
|
|
107
114
|
});
|
|
108
115
|
} };
|
|
109
116
|
};
|
|
110
117
|
export {
|
|
111
|
-
|
|
118
|
+
N as useStripo
|
|
112
119
|
};
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 = [
|
|
5
7
|
{
|
|
6
8
|
id: "add-unsubscribe-link-values",
|
|
7
9
|
description: "Adding unsubscribe link values",
|
|
8
10
|
type: "custom",
|
|
9
|
-
processor: (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
processor: (t) => {
|
|
12
|
+
const { getPartnerName: i } = U(), a = N(), n = I(), u = a.getVariationId;
|
|
13
|
+
if (!u)
|
|
14
|
+
return t;
|
|
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)
|
|
21
|
+
return;
|
|
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;
|
|
25
|
+
let s = E;
|
|
26
|
+
R && (s = s.replace(
|
|
27
|
+
l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
28
|
+
f.UNSUBSCRIBE_URL + e
|
|
29
|
+
)), _ && (s = s.replace(
|
|
30
|
+
l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
31
|
+
f.PREFERENCES_URL + e
|
|
32
|
+
)), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), o = o.replace(E, s);
|
|
33
|
+
}), o;
|
|
21
34
|
},
|
|
22
35
|
priority: 60
|
|
23
36
|
},
|
|
@@ -25,7 +38,7 @@ const S = [
|
|
|
25
38
|
id: "remove-data-ogsb-button-styles",
|
|
26
39
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
27
40
|
type: "regex",
|
|
28
|
-
pattern:
|
|
41
|
+
pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
29
42
|
replacement: "",
|
|
30
43
|
flags: "g",
|
|
31
44
|
priority: 61
|
|
@@ -34,25 +47,25 @@ const S = [
|
|
|
34
47
|
id: "format-comment-braces",
|
|
35
48
|
description: "Adding spaces around comment braces for proper formatting",
|
|
36
49
|
type: "custom",
|
|
37
|
-
processor: (
|
|
50
|
+
processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
38
51
|
priority: 62
|
|
39
52
|
},
|
|
40
53
|
{
|
|
41
54
|
id: "add-universal-link-flags",
|
|
42
55
|
description: "Adding universal link flags",
|
|
43
56
|
type: "custom",
|
|
44
|
-
processor: (
|
|
45
|
-
let i =
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
if (
|
|
57
|
+
processor: (t) => {
|
|
58
|
+
let i = t;
|
|
59
|
+
const a = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
60
|
+
return a && a.forEach((n) => {
|
|
61
|
+
if (n.includes("insEmail=1"))
|
|
49
62
|
return;
|
|
50
|
-
if (
|
|
51
|
-
const o =
|
|
52
|
-
const
|
|
53
|
-
return
|
|
63
|
+
if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
64
|
+
const o = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
|
|
65
|
+
const r = e.slice(6, e.length - 1).trim();
|
|
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`);
|
|
54
67
|
});
|
|
55
|
-
i = i.replace(
|
|
68
|
+
i = i.replace(n, o);
|
|
56
69
|
}
|
|
57
70
|
}), i;
|
|
58
71
|
},
|
|
@@ -60,5 +73,5 @@ const S = [
|
|
|
60
73
|
}
|
|
61
74
|
];
|
|
62
75
|
export {
|
|
63
|
-
|
|
76
|
+
T as unsubscribeCompilerRules
|
|
64
77
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
1
|
+
import { migrateCheckbox as o } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as m } from "./couponBlockMigrator.js";
|
|
3
|
-
import { migrateRadioButton as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { migrateRadioButton as i } from "./radioButtonMigrator.js";
|
|
4
|
+
import { migrateUnsubscribe as e } from "./unsubscribeMigrator.js";
|
|
5
|
+
const c = async (t) => {
|
|
6
|
+
let r = t;
|
|
7
|
+
return r = o(r), r = i(r), r = await e(r), r = m(r), r;
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
c as migrate
|
|
10
11
|
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var x = (l, e, t) => e in l ? h(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var S = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { MERGE_TAGS as k, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
|
|
5
|
+
import { DATA_ATTRIBUTES as A } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { useUnsubscribeStore as T } from "../../stores/unsubscribe.js";
|
|
7
|
+
class C {
|
|
8
|
+
constructor() {
|
|
9
|
+
S(this, "parser");
|
|
10
|
+
this.parser = new DOMParser();
|
|
11
|
+
}
|
|
12
|
+
async migrate(e) {
|
|
13
|
+
try {
|
|
14
|
+
const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.unsubscribe-block");
|
|
15
|
+
if (!i.length)
|
|
16
|
+
return e;
|
|
17
|
+
const o = T();
|
|
18
|
+
return await o.fetchTemplates(), i.forEach((r) => {
|
|
19
|
+
const c = r.getAttribute("id"), g = this.extractPaddingClass(r), u = r.getAttribute("bgcolor") || "", n = this.extractUnsubscribeContent(r), s = this.getCollectionTypeFromMergeTag(n.linkHref), b = o.getSelectedUnsubscribePagesByCollection(s);
|
|
20
|
+
console.debug("[UnsubscribeMigrator]", {
|
|
21
|
+
mergeTag: n.linkHref,
|
|
22
|
+
collectionType: s,
|
|
23
|
+
pageIds: b,
|
|
24
|
+
paddingClass: g,
|
|
25
|
+
bgColor: u
|
|
26
|
+
});
|
|
27
|
+
const f = this.buildUnsubscribeBlock(
|
|
28
|
+
n,
|
|
29
|
+
s,
|
|
30
|
+
b,
|
|
31
|
+
g,
|
|
32
|
+
u
|
|
33
|
+
), a = this.parser.parseFromString(
|
|
34
|
+
`<table id="tempDoc"><tbody><tr>${f}</tr></tbody></table>`,
|
|
35
|
+
"text/html"
|
|
36
|
+
).querySelector(".unsubscribe-block-v2");
|
|
37
|
+
a && r.parentNode && (a.setAttribute("id", c || ""), r.parentNode.replaceChild(a, r));
|
|
38
|
+
}), t.documentElement.outerHTML;
|
|
39
|
+
} catch (t) {
|
|
40
|
+
return console.error("UnsubscribeMigrator failed:", t), e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
extractPaddingClass(e) {
|
|
44
|
+
const i = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
|
|
45
|
+
return i ? i[0] : "";
|
|
46
|
+
}
|
|
47
|
+
extractUnsubscribeContent(e) {
|
|
48
|
+
var m;
|
|
49
|
+
const t = e.querySelector("p");
|
|
50
|
+
if (!t)
|
|
51
|
+
return {
|
|
52
|
+
textBefore: "You can ",
|
|
53
|
+
linkText: "unsubscribe",
|
|
54
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
55
|
+
linkStyle: "",
|
|
56
|
+
textAfter: " from our emails, if you need to.",
|
|
57
|
+
isBold: !1,
|
|
58
|
+
isItalic: !1,
|
|
59
|
+
align: "center",
|
|
60
|
+
paragraphStyle: ""
|
|
61
|
+
};
|
|
62
|
+
const i = e.getAttribute("align") || t.getAttribute("align") || "center", o = t.getAttribute("style") || "", r = t.querySelector("a.unsubscribe-link") || t.querySelector('a[href*="unsubscribe"]');
|
|
63
|
+
if (!r)
|
|
64
|
+
return {
|
|
65
|
+
textBefore: "You can ",
|
|
66
|
+
linkText: "unsubscribe",
|
|
67
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
68
|
+
linkStyle: "",
|
|
69
|
+
textAfter: " from our emails, if you need to.",
|
|
70
|
+
isBold: !1,
|
|
71
|
+
isItalic: !1,
|
|
72
|
+
align: i,
|
|
73
|
+
paragraphStyle: o
|
|
74
|
+
};
|
|
75
|
+
const c = ((m = r.textContent) == null ? void 0 : m.trim()) || "unsubscribe", g = r.getAttribute("href") || "{{ins-unsubscribe-link}}", u = r.getAttribute("style") || "", n = t.textContent || "", s = n.indexOf(c), b = s >= 0 ? n.substring(0, s).trim() : "You can ", f = s >= 0 ? n.substring(s + c.length).trim() : " from our emails, if you need to.", d = !!t.querySelector("b, strong"), a = !!t.querySelector("i, em");
|
|
76
|
+
return {
|
|
77
|
+
textBefore: b,
|
|
78
|
+
linkText: c,
|
|
79
|
+
linkHref: this.normalizeUnsubscribeHref(g),
|
|
80
|
+
linkStyle: u,
|
|
81
|
+
textAfter: f,
|
|
82
|
+
isBold: d,
|
|
83
|
+
isItalic: a,
|
|
84
|
+
align: i,
|
|
85
|
+
paragraphStyle: o
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
buildUnsubscribeBlock(e, t, i, o, r) {
|
|
89
|
+
const c = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${c}>${e.linkText}</a>`, n = [];
|
|
90
|
+
e.textBefore && n.push(e.textBefore), n.push(u), e.textAfter && n.push(e.textAfter);
|
|
91
|
+
let s = n.join(" ");
|
|
92
|
+
e.isBold && e.isItalic ? s = `<strong path="1,0"><em path="1,0,0">${s}</em></strong>` : e.isBold ? s = `<strong path="1,0">${s}</strong>` : e.isItalic && (s = `<em path="1,0">${s}</em>`);
|
|
93
|
+
const b = e.align ? ` align="${e.align}"` : "", f = r ? ` bgcolor="${r}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", a = i.length > 0 ? ` ${A.PAGE_LIST}="${i.join(",")}"` : "", m = ` ${A.PAGE_TYPE}="${t}"`, y = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
|
|
94
|
+
return `
|
|
95
|
+
<td
|
|
96
|
+
data-migration="true"
|
|
97
|
+
esd-extension-block-id="unsubscribe-block"
|
|
98
|
+
class="${o ? `${y} ${o}` : y}"
|
|
99
|
+
${b}${f}${m}${a}
|
|
100
|
+
>
|
|
101
|
+
<p path="1"${d}>
|
|
102
|
+
${s}
|
|
103
|
+
</p>
|
|
104
|
+
</td>
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
getCollectionTypeFromMergeTag(e) {
|
|
108
|
+
return e === k[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === k[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
|
|
109
|
+
}
|
|
110
|
+
normalizeUnsubscribeHref(e) {
|
|
111
|
+
if (Object.values(k).includes(e))
|
|
112
|
+
return e;
|
|
113
|
+
const i = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
|
|
114
|
+
return i ? i[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
|
|
115
|
+
`[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
|
|
116
|
+
), "{{ins-unsubscribe-link}}") : e;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function M(l) {
|
|
120
|
+
return new C().migrate(l);
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
M as migrateUnsubscribe
|
|
124
|
+
};
|
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
|
};
|
|
@@ -1,17 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
|
+
const s = e(), R = {
|
|
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
|
+
}, _ = {
|
|
14
|
+
name: "Global Unsubscribe",
|
|
15
|
+
sendGridId: "G"
|
|
16
|
+
}, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
|
|
17
|
+
GLOBAL_UNSUBSCRIBE: 1,
|
|
18
|
+
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
19
|
+
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
20
|
+
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
21
|
+
RESUBSCRIBE: 5
|
|
22
|
+
}, i = {
|
|
23
|
+
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
24
|
+
E.GLOBAL_UNSUBSCRIBE,
|
|
25
|
+
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
26
|
+
E.RESUBSCRIBE
|
|
27
|
+
],
|
|
28
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: [
|
|
29
|
+
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
30
|
+
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
31
|
+
]
|
|
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 = {
|
|
39
|
+
default: "{{ins-unsubscribe-link}}",
|
|
40
|
+
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
41
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
12
42
|
};
|
|
13
43
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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,
|
|
49
|
+
E as PAGE_TYPES,
|
|
50
|
+
i as TYPE_COLLECTIONS,
|
|
51
|
+
B as TYPE_TRANSLATIONS,
|
|
52
|
+
r as UNSUBSCRIBE_PAGES_LINK,
|
|
53
|
+
N as URLS
|
|
17
54
|
};
|
|
@@ -1,90 +1,92 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useHttp as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
3
|
+
var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
|
|
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", a = "select", { get: C } = L();
|
|
8
|
+
class S extends h {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
o(this, "currentNode");
|
|
12
|
+
o(this, "selectedUnsubGroup");
|
|
13
|
+
o(this, "unsubList", []);
|
|
13
14
|
}
|
|
14
15
|
getId() {
|
|
15
|
-
return
|
|
16
|
+
return m;
|
|
16
17
|
}
|
|
17
18
|
_setFormValues() {
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
|
+
const e = this.currentNode.getAttribute("id");
|
|
21
|
+
if (e) {
|
|
22
|
+
const s = e === u.sendGridId ? e : Number(e);
|
|
23
|
+
s && (this.selectedUnsubGroup = s, this.api.updateValues({
|
|
24
|
+
[a]: this.selectedUnsubGroup
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
|
-
_getLabel(
|
|
29
|
+
_getLabel(e, s = `${Math.random()}`) {
|
|
23
30
|
return `
|
|
24
|
-
<${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
</${
|
|
31
|
+
<${i.LABEL}
|
|
32
|
+
${t.LABEL.text}="${e}"
|
|
33
|
+
${t.LABEL.name}="${s}">
|
|
34
|
+
</${i.LABEL}>
|
|
28
35
|
`;
|
|
29
36
|
}
|
|
30
|
-
_getSelectItem(
|
|
37
|
+
_getSelectItem(e, s) {
|
|
31
38
|
return `
|
|
32
|
-
<${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
35
|
-
</${
|
|
39
|
+
<${i.SELECT_ITEM}
|
|
40
|
+
${t.SELECT_ITEM.text}="${e}"
|
|
41
|
+
${t.SELECT_ITEM.value}="${s}">
|
|
42
|
+
</${i.SELECT_ITEM}>`;
|
|
36
43
|
}
|
|
37
44
|
_getSelect() {
|
|
38
|
-
return this.unsubList.map((
|
|
45
|
+
return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
|
|
39
46
|
}
|
|
40
47
|
getTemplate() {
|
|
41
48
|
return `
|
|
42
49
|
<div class="checkbox-controls-container">
|
|
43
50
|
<div class="checkbox-select-container container two-columns stretch">
|
|
44
|
-
<${
|
|
45
|
-
${
|
|
46
|
-
${
|
|
47
|
-
</${
|
|
51
|
+
<${i.LABEL}
|
|
52
|
+
${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
|
|
53
|
+
${t.LABEL.name}="${Math.random()}">
|
|
54
|
+
</${i.LABEL}>
|
|
48
55
|
|
|
49
|
-
<${
|
|
50
|
-
${
|
|
51
|
-
${
|
|
56
|
+
<${i.SELECTPICKER}
|
|
57
|
+
${t.SELECTPICKER.name}="${a}"
|
|
58
|
+
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
52
59
|
${this._getSelect()}
|
|
53
|
-
</${
|
|
60
|
+
</${i.SELECTPICKER}>
|
|
54
61
|
</div>
|
|
55
62
|
</div>
|
|
56
63
|
`;
|
|
57
64
|
}
|
|
58
|
-
_onSelectChange(
|
|
59
|
-
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id",
|
|
65
|
+
_onSelectChange(e) {
|
|
66
|
+
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
60
67
|
}
|
|
61
68
|
_listenToFormUpdates() {
|
|
62
|
-
this.api.onValueChanged(
|
|
69
|
+
this.api.onValueChanged(a, (e) => this._onSelectChange(e));
|
|
63
70
|
}
|
|
64
|
-
onTemplateNodeUpdated(
|
|
65
|
-
|
|
66
|
-
const i = Number(t.getAttribute("id"));
|
|
67
|
-
i && (this.selectedUnsubGroup = i, this.api.updateValues({
|
|
68
|
-
[o]: this.selectedUnsubGroup
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
+
onTemplateNodeUpdated(e) {
|
|
72
|
+
this.currentNode = e;
|
|
71
73
|
}
|
|
72
74
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
73
75
|
async onRender() {
|
|
74
|
-
const
|
|
76
|
+
const e = await C(
|
|
75
77
|
"/unsubscribe-groups/unsubscribe-list"
|
|
76
|
-
),
|
|
77
|
-
[
|
|
78
|
-
[
|
|
78
|
+
), s = [u, ...e.data], E = s.map((c) => ({
|
|
79
|
+
[t.SELECT_ITEM.text]: c.name,
|
|
80
|
+
[t.SELECT_ITEM.value]: c.sendGridId
|
|
79
81
|
}));
|
|
80
|
-
this.unsubList =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
+
a,
|
|
84
|
+
t.SELECTPICKER.items,
|
|
85
|
+
E
|
|
84
86
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
m as CHECKBOX_CONTROL_BLOCK_ID,
|
|
91
|
+
S as CheckboxControl
|
|
90
92
|
};
|