@useinsider/guido 3.3.0-beta.c1e1d7e → 3.3.0-beta.f723108
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/composables/useCustomInterfaceAppearance.js +18 -16
- package/dist/composables/useHtmlValidator.js +41 -36
- package/dist/composables/useRecommendation.js +2 -2
- package/dist/composables/useStripo.js +41 -43
- package/dist/config/migrator/radioButtonMigrator.js +30 -29
- package/dist/enums/extensions/recommendationBlock.js +95 -41
- package/dist/enums/unsubscribe.js +25 -24
- package/dist/extensions/Blocks/Checkbox/control.js +23 -23
- package/dist/extensions/Blocks/RadioButton/control.js +15 -15
- package/dist/extensions/Blocks/RadioButton/template.js +6 -6
- package/dist/extensions/Blocks/Recommendation/block.js +43 -36
- package/dist/extensions/Blocks/Recommendation/services/configService.js +33 -26
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +35 -26
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
- package/dist/services/unsubscribeApi.js +6 -6
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +11 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
- package/dist/static/styles/components/notification.css.js +74 -0
- package/package.json +1 -1
- package/dist/composables/useStripoNotifications.js +0 -30
- package/dist/src/composables/useStripoNotifications.d.ts +0 -4
|
@@ -4,20 +4,21 @@ import e from "../static/styles/components/amp-block.css.js";
|
|
|
4
4
|
import i from "../static/styles/components/base-input.css.js";
|
|
5
5
|
import p from "../static/styles/components/button-group.css.js";
|
|
6
6
|
import n from "../static/styles/components/button.css.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import C from "../static/styles/components/combobox.css.js";
|
|
8
|
+
import s from "../static/styles/components/counter.css.js";
|
|
9
9
|
import f from "../static/styles/components/dropdown-menu.css.js";
|
|
10
10
|
import a from "../static/styles/components/loader.css.js";
|
|
11
11
|
import u from "../static/styles/components/narrow-panel.css.js";
|
|
12
|
-
import c from "../static/styles/components/
|
|
13
|
-
import d from "../static/styles/components/
|
|
14
|
-
import l from "../static/styles/components/
|
|
15
|
-
import h from "../static/styles/components/
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/components/
|
|
18
|
-
import B from "../static/styles/
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
import c from "../static/styles/components/notification.css.js";
|
|
13
|
+
import d from "../static/styles/components/popup.css.js";
|
|
14
|
+
import l from "../static/styles/components/switcher.css.js";
|
|
15
|
+
import h from "../static/styles/components/tabs.css.js";
|
|
16
|
+
import w from "../static/styles/components/tools.css.js";
|
|
17
|
+
import y from "../static/styles/components/version-history.css.js";
|
|
18
|
+
import B from "../static/styles/components/wide-panel.css.js";
|
|
19
|
+
import b from "../static/styles/variables.css.js";
|
|
20
|
+
const A = [
|
|
21
|
+
b,
|
|
21
22
|
// Must be on top
|
|
22
23
|
S,
|
|
23
24
|
// Must be on top
|
|
@@ -26,8 +27,8 @@ const b = [
|
|
|
26
27
|
i,
|
|
27
28
|
p,
|
|
28
29
|
n,
|
|
29
|
-
s,
|
|
30
30
|
C,
|
|
31
|
+
s,
|
|
31
32
|
f,
|
|
32
33
|
a,
|
|
33
34
|
u,
|
|
@@ -36,12 +37,13 @@ const b = [
|
|
|
36
37
|
l,
|
|
37
38
|
h,
|
|
38
39
|
w,
|
|
39
|
-
y
|
|
40
|
+
y,
|
|
41
|
+
B
|
|
40
42
|
].join(`
|
|
41
43
|
|
|
42
|
-
`),
|
|
44
|
+
`), F = () => ({ importCss: () => {
|
|
43
45
|
const o = new CSSStyleSheet();
|
|
44
|
-
o.replaceSync(
|
|
46
|
+
o.replaceSync(A);
|
|
45
47
|
const r = document.querySelector("ui-editor");
|
|
46
48
|
if (!r)
|
|
47
49
|
return;
|
|
@@ -49,5 +51,5 @@ const b = [
|
|
|
49
51
|
t && (t.adoptedStyleSheets = [o]);
|
|
50
52
|
} });
|
|
51
53
|
export {
|
|
52
|
-
|
|
54
|
+
F as useCustomInterfaceAppearance
|
|
53
55
|
};
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { TemplateTypes as
|
|
3
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
1
|
+
import { useConfig as _ } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as G, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
|
|
4
4
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
5
|
-
import { itemsBlockDynamicVariables as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
6
|
+
import { useRecommendationExtensionStore as X } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
7
|
+
import { RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
8
|
+
import { useRecommendationStore as K } from "../stores/recommendation.js";
|
|
9
|
+
import { base64EncodeWithSpecialChars as z } from "../utils/base64.js";
|
|
10
|
+
import { useHttp as U } from "./useHttp.js";
|
|
11
|
+
import { useToaster as Y } from "./useToaster.js";
|
|
12
|
+
import { useTranslations as Z } from "./useTranslations.js";
|
|
13
|
+
const J = /recommendation-id="(\d+)"/g;
|
|
14
|
+
function Q(a) {
|
|
15
|
+
return [...a.matchAll(J)].map((u) => u[1]);
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function ee(a, u) {
|
|
16
18
|
return u.some((d) => a.startsWith(`${d}_`));
|
|
17
19
|
}
|
|
18
|
-
const
|
|
20
|
+
const ge = () => {
|
|
19
21
|
var y, h;
|
|
20
|
-
const { showToaster: a } =
|
|
22
|
+
const { showToaster: a } = Y(), { post: u } = U(), { config: d } = _(), r = Z(), g = K(), S = X(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === H.transactional, b = async (e) => {
|
|
21
23
|
const t = await u(
|
|
22
24
|
"/newsletter/template-library/check-template-html-body",
|
|
23
|
-
{ html:
|
|
25
|
+
{ html: z(e) }
|
|
24
26
|
), { status: n, message: l } = t.data;
|
|
25
27
|
return n || a({
|
|
26
28
|
type: c.Alert,
|
|
27
29
|
message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
|
|
28
|
-
}), r(
|
|
30
|
+
}), r(M), l === r($) && a({
|
|
29
31
|
type: c.Alert,
|
|
30
32
|
message: r("newsletter.already-in-progress")
|
|
31
33
|
}), n;
|
|
32
|
-
}, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()),
|
|
34
|
+
}, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), E = (e) => ["if", "endif"].includes(e.toLowerCase()), A = (e, s) => {
|
|
33
35
|
const t = e.match(/({%(.*?)%})/g);
|
|
34
36
|
let n = !0;
|
|
35
37
|
return t !== null && !p && t.forEach((l) => {
|
|
@@ -42,13 +44,13 @@ const ce = () => {
|
|
|
42
44
|
}), n = !1);
|
|
43
45
|
}
|
|
44
46
|
}), n;
|
|
45
|
-
},
|
|
47
|
+
}, k = async (e, s, t) => {
|
|
46
48
|
const n = t ? await b(e) : !0;
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
+
return A(e, s) && n;
|
|
50
|
+
}, x = (e) => e.length > 0 ? !0 : (a({
|
|
49
51
|
type: c.Warning,
|
|
50
52
|
message: r("newsletter.html-content-is-empty")
|
|
51
|
-
}), !1),
|
|
53
|
+
}), !1), I = (e) => {
|
|
52
54
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
53
55
|
return s > t && a({
|
|
54
56
|
type: c.Warning,
|
|
@@ -57,7 +59,7 @@ const ce = () => {
|
|
|
57
59
|
type: c.Warning,
|
|
58
60
|
message: r("custom-fields.missing-opening-braces")
|
|
59
61
|
}), s === t;
|
|
60
|
-
},
|
|
62
|
+
}, F = (e) => {
|
|
61
63
|
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
62
64
|
return s || a({
|
|
63
65
|
type: c.Warning,
|
|
@@ -66,10 +68,10 @@ const ce = () => {
|
|
|
66
68
|
}, T = (e, s) => {
|
|
67
69
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
68
70
|
if (t && !p) {
|
|
69
|
-
const n = new Set(s.map((i) => i.toLowerCase())), l =
|
|
71
|
+
const n = new Set(s.map((i) => i.toLowerCase())), l = Q(e), o = [];
|
|
70
72
|
if (t.forEach((i) => {
|
|
71
73
|
const m = i.slice(2, -2).trim().toLowerCase();
|
|
72
|
-
(!n.has(m) || m === "") && !
|
|
74
|
+
(!n.has(m) || m === "") && !ee(m, l) && o.push(m);
|
|
73
75
|
}), o.length > 0) {
|
|
74
76
|
const i = `
|
|
75
77
|
<ul>
|
|
@@ -83,11 +85,11 @@ const ce = () => {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
return !0;
|
|
86
|
-
},
|
|
88
|
+
}, R = (e) => {
|
|
87
89
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
88
90
|
let n = !0;
|
|
89
91
|
if (s && s.forEach((l) => {
|
|
90
|
-
const o = l.match(
|
|
92
|
+
const o = l.match(P), i = l.match(G), m = (o == null ? void 0 : o.join("")) || "";
|
|
91
93
|
(!o || l !== m) && !i && (a({
|
|
92
94
|
type: c.Alert,
|
|
93
95
|
message: r("newsletter.display-conditions-invalid-syntax")
|
|
@@ -98,7 +100,7 @@ const ce = () => {
|
|
|
98
100
|
}), n = !1);
|
|
99
101
|
const v = f.match(/^[a-zA-Z]*$/g);
|
|
100
102
|
v && v.forEach((C) => {
|
|
101
|
-
|
|
103
|
+
E(C) && t.push(C);
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
}), t.length) {
|
|
@@ -109,25 +111,28 @@ const ce = () => {
|
|
|
109
111
|
}), n = !1);
|
|
110
112
|
}
|
|
111
113
|
return n;
|
|
112
|
-
},
|
|
114
|
+
}, B = (e) => {
|
|
113
115
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
114
116
|
return n || a({
|
|
115
117
|
type: c.Warning,
|
|
116
118
|
message: r("custom-conditions.no-space-after-braces")
|
|
117
119
|
}), n;
|
|
118
|
-
},
|
|
120
|
+
}, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
|
|
119
121
|
type: c.Warning,
|
|
120
122
|
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
123
|
+
}), !1) : !0, N = () => S.hasInvalidBlock() ? (a({
|
|
124
|
+
type: c.Alert,
|
|
125
|
+
message: r(j)
|
|
121
126
|
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
|
|
122
127
|
type: c.Alert,
|
|
123
128
|
message: r("newsletter.fill-all-necessary-fields")
|
|
124
|
-
}), !1) : !0,
|
|
129
|
+
}), !1) : !0, D = (e) => {
|
|
125
130
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
126
131
|
return e.match(s) === null ? !0 : (a({
|
|
127
132
|
type: c.Alert,
|
|
128
133
|
message: r("newsletter.invalid-image-type")
|
|
129
134
|
}), !1);
|
|
130
|
-
},
|
|
135
|
+
}, L = (e) => {
|
|
131
136
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
132
137
|
return Array.from(n).find((o) => {
|
|
133
138
|
var i;
|
|
@@ -136,7 +141,7 @@ const ce = () => {
|
|
|
136
141
|
type: c.Alert,
|
|
137
142
|
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
138
143
|
}), !1) : !0;
|
|
139
|
-
},
|
|
144
|
+
}, V = (e) => {
|
|
140
145
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
141
146
|
return Array.from(n).find((o) => {
|
|
142
147
|
var i;
|
|
@@ -150,12 +155,12 @@ const ce = () => {
|
|
|
150
155
|
var o, i;
|
|
151
156
|
const n = [
|
|
152
157
|
...s.map((m) => m.value),
|
|
153
|
-
...
|
|
158
|
+
...q,
|
|
154
159
|
...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
|
|
155
160
|
];
|
|
156
|
-
return await
|
|
161
|
+
return await k(e, n, t) && x(e) && I(e) && F(e) && T(e, n) && R(e) && B(e) && W(e) && N() && O() && D(e) && L(e) && V(e);
|
|
157
162
|
} };
|
|
158
163
|
};
|
|
159
164
|
export {
|
|
160
|
-
|
|
165
|
+
ge as useHtmlValidator
|
|
161
166
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
3
|
import { useRecommendationExtensionStore as m } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
@@ -63,7 +63,7 @@ const w = () => ({
|
|
|
63
63
|
shuffleProducts: o.shuffleProducts
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
const f = ((l = I.find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
66
|
+
const f = ((l = I().find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
67
67
|
if (t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising") {
|
|
68
68
|
const i = parseInt(e.size) || 6;
|
|
69
69
|
t.set("productId", e.productIds.slice(0, i).join(","));
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useStripoEventHandler as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import L from "../static/styles/customEditorStyle.css.js";
|
|
1
|
+
import { useActionsApi as D } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as P } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
|
+
import { useToaster as x } from "./useToaster.js";
|
|
8
|
+
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
+
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
+
import j from "../static/styles/customEditorStyle.css.js";
|
|
12
11
|
import { useEditorStore as E } from "../stores/editor.js";
|
|
13
|
-
import { dynamicContentToMergeTags as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
const { features:
|
|
12
|
+
import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
|
|
13
|
+
import $ from "../package.json.js";
|
|
14
|
+
const se = (C, l) => {
|
|
15
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
17
16
|
var g, S, y;
|
|
18
|
-
const
|
|
17
|
+
const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
19
18
|
window.UIEditor.initEditor(
|
|
20
19
|
document.querySelector("#guido-editor"),
|
|
21
20
|
{
|
|
22
21
|
metadata: C,
|
|
23
22
|
html: p,
|
|
24
23
|
css: a,
|
|
25
|
-
forceRecreate:
|
|
24
|
+
forceRecreate: v,
|
|
26
25
|
locale: "en",
|
|
27
26
|
undoButtonSelector: "#guido__undo-button",
|
|
28
27
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -32,11 +31,11 @@ const dt = (C, c) => {
|
|
|
32
31
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
33
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
34
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
35
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: j,
|
|
36
35
|
conditionsEnabled: f,
|
|
37
36
|
customConditionsEnabled: f,
|
|
38
37
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
38
|
+
modulesDisabled: F,
|
|
40
39
|
syncModulesEnabled: s,
|
|
41
40
|
messageSettingsEnabled: !0,
|
|
42
41
|
displayGmailAnnotations: !0,
|
|
@@ -53,60 +52,59 @@ const dt = (C, c) => {
|
|
|
53
52
|
},
|
|
54
53
|
mergeTags: [
|
|
55
54
|
{
|
|
56
|
-
entries:
|
|
57
|
-
|
|
55
|
+
entries: L(
|
|
56
|
+
l.preselectedDynamicContentList,
|
|
58
57
|
u("liquidSyntax")
|
|
59
58
|
)
|
|
60
59
|
}
|
|
61
60
|
],
|
|
62
|
-
async onTokenRefreshRequest(
|
|
61
|
+
async onTokenRefreshRequest(t) {
|
|
63
62
|
try {
|
|
64
63
|
const n = await w();
|
|
65
|
-
|
|
64
|
+
t(n);
|
|
66
65
|
} catch (n) {
|
|
67
66
|
m(n, "Failed to refresh token");
|
|
68
67
|
}
|
|
69
68
|
},
|
|
70
69
|
onTemplateLoaded() {
|
|
71
70
|
try {
|
|
72
|
-
const { importCss:
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
|
|
72
|
+
t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
73
|
+
e.hasChanges = !1;
|
|
75
74
|
}, 1e3);
|
|
76
|
-
} catch (
|
|
77
|
-
m(
|
|
75
|
+
} catch (t) {
|
|
76
|
+
m(t, "Failed to load custom interface appearance");
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
|
-
onCodeEditorVisibilityChanged(
|
|
81
|
-
|
|
79
|
+
onCodeEditorVisibilityChanged(t) {
|
|
80
|
+
e.isCodeEditorOpen = t;
|
|
82
81
|
},
|
|
83
|
-
onEditorVisualModeChanged(
|
|
84
|
-
|
|
82
|
+
onEditorVisualModeChanged(t) {
|
|
83
|
+
e.editorVisualMode = t.toLowerCase();
|
|
85
84
|
},
|
|
86
|
-
onVersionHistoryVisibilityChanged(
|
|
87
|
-
|
|
85
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
86
|
+
e.isVersionHistoryOpen = t;
|
|
88
87
|
},
|
|
89
88
|
onDataChanged() {
|
|
90
|
-
|
|
89
|
+
e.hasChanges = !0;
|
|
91
90
|
},
|
|
92
91
|
onEvent: B,
|
|
93
|
-
notifications: T(),
|
|
94
92
|
ignoreClickOutsideSelectors: [
|
|
95
93
|
"#guido-dynamic-content-modal",
|
|
96
94
|
".in-on-board-wrapper",
|
|
97
95
|
".in-drawer__container"
|
|
98
96
|
],
|
|
99
97
|
extensions: d,
|
|
100
|
-
localePatch:
|
|
98
|
+
localePatch: H
|
|
101
99
|
}
|
|
102
100
|
);
|
|
103
|
-
},
|
|
101
|
+
}, _ = (i) => new Promise((r, s) => {
|
|
104
102
|
var d;
|
|
105
103
|
if (document.getElementById("UiEditorScript")) {
|
|
106
104
|
i(), r();
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
|
-
const
|
|
107
|
+
const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
110
108
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
111
109
|
i(), r();
|
|
112
110
|
}, o.onerror = () => {
|
|
@@ -114,15 +112,15 @@ const dt = (C, c) => {
|
|
|
114
112
|
}, document.body.appendChild(o);
|
|
115
113
|
});
|
|
116
114
|
return { initPlugin: async (i) => {
|
|
117
|
-
await
|
|
118
|
-
const r = E(), [s,
|
|
115
|
+
await _(async () => {
|
|
116
|
+
const r = E(), [s, e] = await Promise.all([
|
|
119
117
|
b(),
|
|
120
118
|
k()
|
|
121
119
|
]);
|
|
122
|
-
r.syncModulesEnabled =
|
|
120
|
+
r.syncModulesEnabled = e, await V(i, s, e);
|
|
123
121
|
});
|
|
124
122
|
} };
|
|
125
123
|
};
|
|
126
124
|
export {
|
|
127
|
-
|
|
125
|
+
se as useStripo
|
|
128
126
|
};
|
|
@@ -9,14 +9,14 @@ class B {
|
|
|
9
9
|
}
|
|
10
10
|
migrate(e) {
|
|
11
11
|
try {
|
|
12
|
-
const t = this.parser.parseFromString(e, "text/html"),
|
|
13
|
-
if (
|
|
12
|
+
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll("td.radio-button-block"), i = t.querySelectorAll("td.radio-button-v2");
|
|
13
|
+
if (s.length === 0 && i.length === 0)
|
|
14
14
|
return e;
|
|
15
15
|
let o = !1;
|
|
16
|
-
return
|
|
16
|
+
return s.forEach((r) => {
|
|
17
17
|
if (r.classList.contains("radio-button-v2"))
|
|
18
18
|
return;
|
|
19
|
-
const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"),
|
|
19
|
+
const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"), p = this.buildTextBlock(a), d = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", p).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
|
|
20
20
|
`<table id="tempDoc"><tbody><tr>${h}</tr></tbody></table>`,
|
|
21
21
|
"text/html"
|
|
22
22
|
).querySelector(".radio-button-v2");
|
|
@@ -28,25 +28,26 @@ class B {
|
|
|
28
28
|
}
|
|
29
29
|
healRadioButtonV2(e) {
|
|
30
30
|
let t = !1;
|
|
31
|
-
return e.querySelectorAll("td.radio-button-v2").forEach((
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return e.querySelectorAll("td.radio-button-v2").forEach((s) => {
|
|
32
|
+
var d;
|
|
33
|
+
s.classList.contains("radio-button-block") || (s.classList.add("radio-button-block"), t = !0);
|
|
34
|
+
const i = s.querySelector("input#radioYes"), o = s.querySelector("input#radioNo");
|
|
35
|
+
if (!i || !o)
|
|
35
36
|
return;
|
|
36
|
-
const r = ((
|
|
37
|
-
if (!r && !
|
|
37
|
+
const r = ((d = i.parentElement) == null ? void 0 : d.querySelector(":scope > p")) || null;
|
|
38
|
+
if (!r && !i.hasAttribute("align"))
|
|
38
39
|
return;
|
|
39
|
-
const n =
|
|
40
|
+
const n = i.closest("tr"), a = o.closest("tr");
|
|
40
41
|
if (!n || !a || n === a || !n.parentNode)
|
|
41
42
|
return;
|
|
42
|
-
const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"),
|
|
43
|
-
u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")),
|
|
43
|
+
const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), p = c.querySelector("p");
|
|
44
|
+
u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), p && (p.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
|
|
44
45
|
}), t;
|
|
45
46
|
}
|
|
46
47
|
extractTextFromElement(e, t) {
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
var d, y;
|
|
49
|
+
const s = e.querySelector(`.${t}`);
|
|
50
|
+
if (!s)
|
|
50
51
|
return {
|
|
51
52
|
text: t === "ins-title" ? "Title" : "Description",
|
|
52
53
|
isBold: !1,
|
|
@@ -55,42 +56,42 @@ class B {
|
|
|
55
56
|
styles: "",
|
|
56
57
|
classList: ""
|
|
57
58
|
};
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
59
|
+
const i = s.querySelector("p");
|
|
60
|
+
if (!i)
|
|
60
61
|
return {
|
|
61
|
-
text: ((
|
|
62
|
+
text: ((d = s.textContent) == null ? void 0 : d.trim()) || (t === "ins-title" ? "Title" : "Description"),
|
|
62
63
|
isBold: !1,
|
|
63
64
|
isItalic: !1,
|
|
64
|
-
align:
|
|
65
|
+
align: s.getAttribute("align") || "left",
|
|
65
66
|
styles: "",
|
|
66
67
|
classList: ""
|
|
67
68
|
};
|
|
68
|
-
const o = ((y =
|
|
69
|
+
const o = ((y = i.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = i.getAttribute("style") || "", n = s.getAttribute("align") || i.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!i.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!i.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), p = s.getAttribute("class") || "";
|
|
69
70
|
return {
|
|
70
71
|
text: o,
|
|
71
72
|
isBold: a,
|
|
72
73
|
isItalic: g,
|
|
73
74
|
align: n,
|
|
74
75
|
styles: u,
|
|
75
|
-
classList:
|
|
76
|
+
classList: p
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
buildTextBlock(e) {
|
|
79
80
|
let t = e.text;
|
|
80
81
|
e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
|
|
81
|
-
const
|
|
82
|
+
const s = e.align ? ` align="${e.align}"` : "", i = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
|
|
82
83
|
return `
|
|
83
|
-
<td class="esd-block-text ${e.classList}" ${
|
|
84
|
-
<p path="1" ${
|
|
84
|
+
<td class="esd-block-text ${e.classList}" ${s}>
|
|
85
|
+
<p path="1" ${i}>
|
|
85
86
|
${t}
|
|
86
87
|
</p>
|
|
87
88
|
</td>
|
|
88
89
|
`;
|
|
89
90
|
}
|
|
90
91
|
removeStyleProperties(e, t) {
|
|
91
|
-
return e ? t.reduce((
|
|
92
|
+
return e ? t.reduce((i, o) => {
|
|
92
93
|
const r = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
|
|
93
|
-
return
|
|
94
|
+
return i.replace(r, "");
|
|
94
95
|
}, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
95
96
|
}
|
|
96
97
|
convertInlineToBlock(e) {
|
|
@@ -100,9 +101,9 @@ class B {
|
|
|
100
101
|
return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function L(l) {
|
|
104
105
|
return new B().migrate(l);
|
|
105
106
|
}
|
|
106
107
|
export {
|
|
107
|
-
|
|
108
|
+
L as migrateRadioButton
|
|
108
109
|
};
|