@useinsider/guido 1.0.3-beta.9332823 → 1.0.3-beta.9440b5f
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 +2 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -61
- package/dist/composables/useStripo.js +37 -35
- package/dist/config/migrator/radioButtonMigrator.js +5 -5
- package/dist/enums/defaults.js +2 -1
- package/dist/enums/unsubscribe.js +27 -26
- package/dist/extensions/Blocks/Checkbox/control.js +15 -14
- package/dist/extensions/Blocks/RadioButton/control.js +18 -17
- package/dist/extensions/Blocks/RadioButton/template.js +10 -9
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +25 -19
- package/dist/extensions/DynamicContent/dynamic-content.js +128 -33
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/generic.d.ts +27 -6
- package/dist/src/components/Guido.vue.d.ts +2 -2
- 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 +9 -2
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +52 -2
- package/dist/src/stores/config.d.ts +3 -2
- 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/environmentUtil.d.ts +2 -5
- package/dist/src/utils/genericUtil.d.ts +1 -0
- 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/environmentUtil.js +4 -0
- package/dist/utils/genericUtil.js +20 -9
- package/package.json +2 -2
- package/dist/src/enums/environment.d.ts +0 -5
package/README.md
CHANGED
|
@@ -198,6 +198,7 @@ interface GuidoConfig {
|
|
|
198
198
|
saveAsTemplate: boolean;
|
|
199
199
|
versionHistory: boolean;
|
|
200
200
|
testMessage: boolean;
|
|
201
|
+
displayConditions: boolean;
|
|
201
202
|
};
|
|
202
203
|
blocks?: {
|
|
203
204
|
excludeDefaults?: GuidoBlockType[];
|
|
@@ -216,6 +217,7 @@ interface GuidoConfig {
|
|
|
216
217
|
| `features.dynamicContent` | `boolean` | `true` | Enable dynamic content insertion feature |
|
|
217
218
|
| `features.saveAsTemplate` | `boolean` | `true` | Enable save as template feature |
|
|
218
219
|
| `features.versionHistory` | `boolean` | `true` | Enable version history feature |
|
|
220
|
+
| `features.displayConditions` | `boolean` | `true` | Enable display conditions |
|
|
219
221
|
| `blocks` | `BlocksConfig` | `{ excludeDefaults: [], includeCustoms: [] }` | Block configuration for excluding default blocks and including custom blocks. See [Blocks Configuration](#-blocks-configuration) section below |
|
|
220
222
|
| `blocks.excludeDefaults` | `GuidoBlockType[]` | `[]` | Array of default Stripo blocks to exclude from the editor |
|
|
221
223
|
| `blocks.includeCustoms` | `GuidoCustomBlockType[]` | `[]` | Array of custom blocks to include in the editor |
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import { migrate as
|
|
6
|
-
import { DefaultUsername as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { useStripoApi as
|
|
14
|
-
import { useConfigStore as
|
|
15
|
-
import { useDynamicContentStore as
|
|
16
|
-
import { useEditorStore as
|
|
17
|
-
import { usePreviewStore as
|
|
18
|
-
import { useUnsubscribeStore as
|
|
19
|
-
import
|
|
20
|
-
const
|
|
1
|
+
import { defineComponent as O, defineAsyncComponent as I, ref as z, computed as U, watch as B, onMounted as K, onUnmounted as j } from "vue";
|
|
2
|
+
import { provideGuidoActions as q } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as J } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as Q } from "../composables/useStripo.js";
|
|
5
|
+
import { migrate as L } from "../config/migrator/index.js";
|
|
6
|
+
import { DefaultUsername as V, DefaultMessageType as X, DefaultGuidoConfig as Y } from "../enums/defaults.js";
|
|
7
|
+
import Z from "./organisms/base/Toaster.vue.js";
|
|
8
|
+
import $ from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
9
|
+
import ee from "./organisms/header/HeaderWrapper.vue.js";
|
|
10
|
+
import oe from "./organisms/LoadingWrapper.vue.js";
|
|
11
|
+
import te from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
12
|
+
import ne from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
13
|
+
import { useStripoApi as re } from "../services/stripoApi.js";
|
|
14
|
+
import { useConfigStore as ie } from "../stores/config.js";
|
|
15
|
+
import { useDynamicContentStore as se } from "../stores/dynamic-content.js";
|
|
16
|
+
import { useEditorStore as ae } from "../stores/editor.js";
|
|
17
|
+
import { usePreviewStore as ce } from "../stores/preview.js";
|
|
18
|
+
import { useUnsubscribeStore as me } from "../stores/unsubscribe.js";
|
|
19
|
+
import de from "../node_modules/lodash-es/merge.js";
|
|
20
|
+
const Ue = /* @__PURE__ */ O({
|
|
21
21
|
__name: "Guido",
|
|
22
22
|
props: {
|
|
23
23
|
templateId: null,
|
|
@@ -33,45 +33,45 @@ const ke = /* @__PURE__ */ R({
|
|
|
33
33
|
},
|
|
34
34
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
35
35
|
setup(W, { expose: _, emit: o }) {
|
|
36
|
-
const
|
|
36
|
+
const u = W, A = I(
|
|
37
37
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
38
|
-
),
|
|
38
|
+
), N = I(
|
|
39
39
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
40
|
-
),
|
|
40
|
+
), p = z(), i = se(), g = me(), f = ie(), s = ae(), F = ce(), n = U(() => s.hasChanges), { getPartnerName: y, getProductType: v, isTestPartner: H } = J(), b = () => {
|
|
41
41
|
var e;
|
|
42
|
-
return (e =
|
|
42
|
+
return (e = p.value) == null ? void 0 : e.handleSave(!0);
|
|
43
43
|
}, {
|
|
44
44
|
templateId: a,
|
|
45
|
-
userId:
|
|
46
|
-
guidoConfig:
|
|
45
|
+
userId: C,
|
|
46
|
+
guidoConfig: h,
|
|
47
47
|
templateConfig: t,
|
|
48
48
|
html: r = "",
|
|
49
|
-
css:
|
|
50
|
-
partnerName: c =
|
|
51
|
-
productType:
|
|
52
|
-
messageType:
|
|
53
|
-
username:
|
|
54
|
-
} =
|
|
55
|
-
s.templateId = a, window.GuidoConfig =
|
|
49
|
+
css: S = "",
|
|
50
|
+
partnerName: c = y(),
|
|
51
|
+
productType: m = v(),
|
|
52
|
+
messageType: w = X,
|
|
53
|
+
username: D = V
|
|
54
|
+
} = u, d = (t == null ? void 0 : t.preselectedDynamicContentList) || [];
|
|
55
|
+
s.templateId = a, window.GuidoConfig = de(Y, h), window.GuidoConfig.partner = {
|
|
56
56
|
partnerName: c,
|
|
57
|
-
productType:
|
|
58
|
-
messageType:
|
|
59
|
-
},
|
|
60
|
-
const { initPlugin:
|
|
57
|
+
productType: m,
|
|
58
|
+
messageType: w
|
|
59
|
+
}, f.templateConfig = t;
|
|
60
|
+
const { initPlugin: E } = Q({
|
|
61
61
|
emailId: a,
|
|
62
|
-
userId:
|
|
63
|
-
username:
|
|
62
|
+
userId: C,
|
|
63
|
+
username: D,
|
|
64
64
|
partnerName: c,
|
|
65
|
-
productType:
|
|
66
|
-
preselectedDynamicContentList:
|
|
65
|
+
productType: m,
|
|
66
|
+
preselectedDynamicContentList: d,
|
|
67
67
|
onReady: () => {
|
|
68
68
|
console.debug("guido:ready"), o("ready");
|
|
69
69
|
}
|
|
70
|
-
}), { getDefaultTemplate: T } =
|
|
70
|
+
}), { getDefaultTemplate: T } = re(), R = U(() => {
|
|
71
71
|
var e;
|
|
72
72
|
return !((e = window.GuidoConfig) != null && e.useHeader);
|
|
73
73
|
});
|
|
74
|
-
|
|
74
|
+
q({
|
|
75
75
|
onBack: () => {
|
|
76
76
|
console.debug("guido:back"), o("back");
|
|
77
77
|
},
|
|
@@ -85,32 +85,35 @@ const ke = /* @__PURE__ */ R({
|
|
|
85
85
|
console.debug("guido:test-email:click"), o("test-email:click");
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
const
|
|
88
|
+
const P = (e) => {
|
|
89
89
|
console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
90
|
-
},
|
|
90
|
+
}, k = () => {
|
|
91
91
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
B(() => n.value, () => {
|
|
94
94
|
o("on-change", n.value);
|
|
95
|
-
})
|
|
95
|
+
});
|
|
96
|
+
const l = (e) => {
|
|
97
|
+
const G = e, { attribute: x, position: M } = G.detail;
|
|
98
|
+
console.debug("dynamic-content:open", G.detail), o("dynamic-content:open", x, M);
|
|
99
|
+
};
|
|
100
|
+
return K(async () => {
|
|
96
101
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
97
102
|
try {
|
|
98
|
-
|
|
103
|
+
g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
|
|
99
104
|
let e = {
|
|
100
|
-
html: r && await
|
|
101
|
-
css:
|
|
105
|
+
html: r && await L(r),
|
|
106
|
+
css: S,
|
|
102
107
|
forceRecreate: !0
|
|
103
108
|
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
104
109
|
};
|
|
105
|
-
e.html || (e = await T(), e.html = await
|
|
110
|
+
e.html || (e = await T(), e.html = await L(e.html)), await E(e), i.selectedDynamicContentList = d;
|
|
106
111
|
} catch (e) {
|
|
107
112
|
console.error("Failed to initialize Stripo editor:", e);
|
|
108
113
|
}
|
|
109
|
-
document.addEventListener("dynamic-content:open",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
}), B(() => {
|
|
114
|
+
document.addEventListener("dynamic-content:open", l);
|
|
115
|
+
}), j(() => {
|
|
116
|
+
document.removeEventListener("dynamic-content:open", l);
|
|
114
117
|
try {
|
|
115
118
|
window.UIEditor.removeEditor();
|
|
116
119
|
} catch {
|
|
@@ -118,14 +121,14 @@ const ke = /* @__PURE__ */ R({
|
|
|
118
121
|
}
|
|
119
122
|
}), _({
|
|
120
123
|
dynamicContent: {
|
|
121
|
-
insert:
|
|
122
|
-
close:
|
|
124
|
+
insert: P,
|
|
125
|
+
close: k
|
|
123
126
|
},
|
|
124
127
|
hasChanges: n,
|
|
125
|
-
saveSilent:
|
|
126
|
-
}), { __sfc: !0, PreviewContainer:
|
|
128
|
+
saveSilent: b
|
|
129
|
+
}), { __sfc: !0, PreviewContainer: A, OnboardingWrapper: N, headerWrapperRef: p, dynamicContentStore: i, unsubscribeStore: g, props: u, configStore: f, editorStore: s, previewStore: F, hasChanges: n, getPartnerName: y, getProductType: v, isTestPartner: H, saveSilent: b, templateId: a, userId: C, guidoConfig: h, templateConfig: t, html: r, css: S, partnerName: c, productType: m, messageType: w, username: D, preselectedDynamicContentList: d, emit: o, initPlugin: E, getDefaultTemplate: T, noHeader: R, insertDynamicContent: P, closeDynamicContent: k, handleDynamicContentOpen: l, Toaster: Z, FilterSelectionDrawer: $, HeaderWrapper: ee, LoadingWrapper: oe, SaveAsTemplateDrawer: te, UnsubscribeWrapper: ne };
|
|
127
130
|
}
|
|
128
131
|
});
|
|
129
132
|
export {
|
|
130
|
-
|
|
133
|
+
Ue as default
|
|
131
134
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { useActionsApi as h } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as b } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as k } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as V } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as _ } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as F } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as A } from "../services/stripoApi.js";
|
|
9
|
+
import T from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as v } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as I } from "../utils/genericUtil.js";
|
|
12
|
+
import M from "../package.json.js";
|
|
13
|
+
const N = (d) => {
|
|
14
|
+
const { config: u } = k(), { handleError: l } = _(), { getToken: f, getCustomFonts: S } = A(), { handleEvent: C } = V(), { getStripoBlocksConfig: y } = b(), E = async (i, r = []) => {
|
|
15
|
+
var m, g;
|
|
16
|
+
const t = v(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: c } = await y();
|
|
15
17
|
window.UIEditor.initEditor(
|
|
16
18
|
document.querySelector("#guido-editor"),
|
|
17
19
|
{
|
|
18
20
|
metadata: d,
|
|
19
21
|
html: n,
|
|
20
|
-
css:
|
|
22
|
+
css: p,
|
|
21
23
|
forceRecreate: a,
|
|
22
24
|
locale: "en",
|
|
23
25
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -28,10 +30,10 @@ const L = (d) => {
|
|
|
28
30
|
customAppearanceMergetags: !0,
|
|
29
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
30
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
31
|
-
customViewStyles:
|
|
32
|
-
conditionsEnabled: !0,
|
|
33
|
-
customConditionsEnabled: !0,
|
|
34
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: T,
|
|
34
|
+
conditionsEnabled: ((m = u.features) == null ? void 0 : m.displayConditions) ?? !0,
|
|
35
|
+
customConditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
|
|
36
|
+
conditionCategories: F,
|
|
35
37
|
enableXSSSecurity: !0,
|
|
36
38
|
messageSettingsEnabled: !1,
|
|
37
39
|
selectBlockAfterDropFromSettingsPanel: !0,
|
|
@@ -39,29 +41,29 @@ const L = (d) => {
|
|
|
39
41
|
editorFonts: {
|
|
40
42
|
showDefaultStandardFonts: !0,
|
|
41
43
|
showDefaultNotStandardFonts: !0,
|
|
42
|
-
customFonts:
|
|
44
|
+
customFonts: r
|
|
43
45
|
},
|
|
44
46
|
mergeTags: [
|
|
45
47
|
{
|
|
46
|
-
entries:
|
|
48
|
+
entries: I(d.preselectedDynamicContentList)
|
|
47
49
|
}
|
|
48
50
|
],
|
|
49
51
|
async onTokenRefreshRequest(o) {
|
|
50
52
|
try {
|
|
51
|
-
const s = await
|
|
53
|
+
const s = await f();
|
|
52
54
|
o(s);
|
|
53
55
|
} catch (s) {
|
|
54
|
-
|
|
56
|
+
l(s, "Failed to refresh token");
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
onTemplateLoaded() {
|
|
58
60
|
try {
|
|
59
|
-
const { importCss: o } =
|
|
61
|
+
const { importCss: o } = B(), { activateCustomViewStyles: s } = h();
|
|
60
62
|
o(), s(), d.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
61
63
|
t.hasChanges = !1;
|
|
62
64
|
}, 1e3);
|
|
63
65
|
} catch (o) {
|
|
64
|
-
|
|
66
|
+
l(o, "Failed to load custom interface appearance");
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
69
|
onCodeEditorVisibilityChanged(o) {
|
|
@@ -76,7 +78,7 @@ const L = (d) => {
|
|
|
76
78
|
onDataChanged() {
|
|
77
79
|
t.hasChanges = !0;
|
|
78
80
|
},
|
|
79
|
-
onEvent:
|
|
81
|
+
onEvent: C,
|
|
80
82
|
ignoreClickOutsideSelectors: [
|
|
81
83
|
"#guido-dynamic-content-modal",
|
|
82
84
|
".in-on-board-wrapper",
|
|
@@ -85,26 +87,26 @@ const L = (d) => {
|
|
|
85
87
|
extensions: c
|
|
86
88
|
}
|
|
87
89
|
);
|
|
88
|
-
},
|
|
90
|
+
}, w = (i) => new Promise((r, t) => {
|
|
89
91
|
var c;
|
|
90
92
|
if (document.getElementById("UiEditorScript")) {
|
|
91
|
-
|
|
93
|
+
i(), r();
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
|
-
const n =
|
|
96
|
+
const n = M.guido, a = `https://email-static.useinsider.com/guido/${(c = n == null ? void 0 : n.stripo) == null ? void 0 : c.version}/UIEditor.js`, e = document.createElement("script");
|
|
95
97
|
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
96
|
-
|
|
98
|
+
i(), r();
|
|
97
99
|
}, e.onerror = () => {
|
|
98
100
|
t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
99
101
|
}, document.body.appendChild(e);
|
|
100
102
|
});
|
|
101
|
-
return { initPlugin: async (
|
|
102
|
-
await
|
|
103
|
-
const
|
|
104
|
-
await
|
|
103
|
+
return { initPlugin: async (i) => {
|
|
104
|
+
await w(async () => {
|
|
105
|
+
const r = await S();
|
|
106
|
+
await E(i, r);
|
|
105
107
|
});
|
|
106
108
|
} };
|
|
107
109
|
};
|
|
108
110
|
export {
|
|
109
|
-
|
|
111
|
+
N as useStripo
|
|
110
112
|
};
|
|
@@ -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"), g = this.buildTextBlock(l), d = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", g).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n).replace(/{BLOCK_ID}/g, o || ""), 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"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g), 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: d,
|
|
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 I(r) {
|
|
82
82
|
return new T().migrate(r);
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
85
|
+
I as migrateRadioButton
|
|
86
86
|
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
|
|
1
|
+
import { useTranslations as n } from "../composables/useTranslations.js";
|
|
2
|
+
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
+
const e = n(), I = {
|
|
3
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
4
5
|
PREFERENCES_LINK_TYPE: 3
|
|
5
|
-
},
|
|
6
|
+
}, r = {
|
|
6
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
7
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
8
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
9
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
10
|
-
},
|
|
11
|
-
UNSUBSCRIBE_URL:
|
|
12
|
-
PREFERENCES_URL:
|
|
13
|
-
},
|
|
11
|
+
}, s = R(), _ = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
|
|
14
|
+
}, i = "iid", B = {
|
|
14
15
|
name: "Global Unsubscribe",
|
|
15
16
|
sendGridId: "G"
|
|
16
|
-
},
|
|
17
|
+
}, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
|
|
17
18
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
18
19
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
19
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
20
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
21
22
|
RESUBSCRIBE: 5
|
|
22
|
-
},
|
|
23
|
+
}, t = {
|
|
23
24
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
24
25
|
E.GLOBAL_UNSUBSCRIBE,
|
|
25
26
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -29,27 +30,27 @@ const s = e(), R = {
|
|
|
29
30
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
30
31
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
31
32
|
]
|
|
32
|
-
},
|
|
33
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
34
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
35
|
-
[E.RESUBSCRIBE]:
|
|
36
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
37
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
38
|
-
},
|
|
33
|
+
}, U = {
|
|
34
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
35
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
36
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
37
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
38
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
39
|
+
}, o = {
|
|
39
40
|
default: "{{ins-unsubscribe-link}}",
|
|
40
41
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
41
42
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
42
43
|
};
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
C as ACADEMY_LINK,
|
|
46
|
+
B as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
47
|
+
i as INSIDER_ID,
|
|
48
|
+
r as LINK_REGEXES,
|
|
49
|
+
I as LINK_TYPES,
|
|
50
|
+
o as MERGE_TAGS,
|
|
50
51
|
E as PAGE_TYPES,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
t as TYPE_COLLECTIONS,
|
|
53
|
+
U as TYPE_TRANSLATIONS,
|
|
54
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
55
|
+
_ as URLS
|
|
55
56
|
};
|
|
@@ -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 c } 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", u = "select", { get: C } = L();
|
|
8
8
|
class S extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -16,14 +16,15 @@ class S extends h {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
19
|
+
if (this.selectedUnsubGroup = "", 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
|
|
24
|
-
[a]: this.selectedUnsubGroup
|
|
25
|
-
}));
|
|
22
|
+
const s = e === c.sendGridId ? e : Number(e);
|
|
23
|
+
s && (this.selectedUnsubGroup = s);
|
|
26
24
|
}
|
|
25
|
+
this.api.updateValues({
|
|
26
|
+
[u]: this.selectedUnsubGroup
|
|
27
|
+
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
_getLabel(e, s = `${Math.random()}`) {
|
|
@@ -54,7 +55,7 @@ class S extends h {
|
|
|
54
55
|
</${i.LABEL}>
|
|
55
56
|
|
|
56
57
|
<${i.SELECTPICKER}
|
|
57
|
-
${t.SELECTPICKER.name}="${
|
|
58
|
+
${t.SELECTPICKER.name}="${u}"
|
|
58
59
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
59
60
|
${this._getSelect()}
|
|
60
61
|
</${i.SELECTPICKER}>
|
|
@@ -66,21 +67,21 @@ class S extends h {
|
|
|
66
67
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
67
68
|
}
|
|
68
69
|
_listenToFormUpdates() {
|
|
69
|
-
this.api.onValueChanged(
|
|
70
|
+
this.api.onValueChanged(u, (e) => this._onSelectChange(e));
|
|
70
71
|
}
|
|
71
72
|
onTemplateNodeUpdated(e) {
|
|
72
|
-
this.currentNode = e;
|
|
73
|
+
this.currentNode = e, this._setFormValues();
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
75
76
|
async onRender() {
|
|
76
77
|
const e = await C(
|
|
77
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
78
|
-
), s = [
|
|
79
|
-
[t.SELECT_ITEM.text]:
|
|
80
|
-
[t.SELECT_ITEM.value]:
|
|
79
|
+
), s = [c, ...e.data], E = s.map((a) => ({
|
|
80
|
+
[t.SELECT_ITEM.text]: a.name,
|
|
81
|
+
[t.SELECT_ITEM.value]: a.sendGridId
|
|
81
82
|
}));
|
|
82
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
-
|
|
84
|
+
u,
|
|
84
85
|
t.SELECTPICKER.items,
|
|
85
86
|
E
|
|
86
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
@@ -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 c } 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", u = "select", { get: $ } = L();
|
|
8
|
+
class S extends p {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -16,15 +16,16 @@ class _ extends p {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
19
|
+
if (this.selectedUnsubGroup = "", 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
|
|
24
|
-
[a]: this.selectedUnsubGroup
|
|
25
|
-
}));
|
|
22
|
+
const s = t === c.sendGridId ? t : Number(t);
|
|
23
|
+
s && (this.selectedUnsubGroup = s);
|
|
26
24
|
}
|
|
27
25
|
}
|
|
26
|
+
this.api.updateValues({
|
|
27
|
+
[u]: this.selectedUnsubGroup
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
_getLabel(t, s = `${Math.random()}`) {
|
|
30
31
|
return `
|
|
@@ -54,7 +55,7 @@ class _ extends p {
|
|
|
54
55
|
</${i.LABEL}>
|
|
55
56
|
|
|
56
57
|
<${i.SELECTPICKER}
|
|
57
|
-
${e.SELECTPICKER.name}="${
|
|
58
|
+
${e.SELECTPICKER.name}="${u}"
|
|
58
59
|
${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
59
60
|
${this._getSelect()}
|
|
60
61
|
</${i.SELECTPICKER}>
|
|
@@ -66,27 +67,27 @@ class _ extends p {
|
|
|
66
67
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
|
|
67
68
|
}
|
|
68
69
|
_listenToFormUpdates() {
|
|
69
|
-
this.api.onValueChanged(
|
|
70
|
+
this.api.onValueChanged(u, (t) => this._onSelectChange(t));
|
|
70
71
|
}
|
|
71
72
|
onTemplateNodeUpdated(t) {
|
|
72
|
-
this.currentNode = t;
|
|
73
|
+
this.currentNode = t, this._setFormValues();
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
75
76
|
async onRender() {
|
|
76
77
|
const t = await $(
|
|
77
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
78
|
-
), s = [
|
|
79
|
-
[e.SELECT_ITEM.text]:
|
|
80
|
-
[e.SELECT_ITEM.value]:
|
|
79
|
+
), s = [c, ...t.data], E = s.map((a) => ({
|
|
80
|
+
[e.SELECT_ITEM.text]: a.name,
|
|
81
|
+
[e.SELECT_ITEM.value]: a.sendGridId
|
|
81
82
|
}));
|
|
82
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
-
|
|
84
|
+
u,
|
|
84
85
|
e.SELECTPICKER.items,
|
|
85
|
-
|
|
86
|
+
E
|
|
86
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
export {
|
|
90
91
|
m as CONTROL_BLOCK_ID,
|
|
91
|
-
|
|
92
|
+
S as RadioButtonControl
|
|
92
93
|
};
|