@useinsider/guido 3.2.0-beta.8513411 → 3.2.0-beta.87303ed
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/useSave.js +21 -18
- package/dist/composables/useStripo.js +17 -19
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/migrator/radioButtonMigrator.js +64 -44
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/package.json +1 -1
- package/dist/enums/displayConditions.js +0 -84
- package/dist/src/enums/displayConditions.d.ts +0 -6
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useActionsApi as V } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as x } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as y, useSaveComplete as w } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as q } from "./useHtmlValidator.js";
|
|
8
|
+
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
+
const h = () => {
|
|
11
|
+
const o = y(), s = w(), { validateHtml: r } = q(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { callbacks: a, isFeatureEnabled: d } = x(), { extractSyncModuleData: u } = C(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = V();
|
|
12
|
+
return { save: async (p = !1) => {
|
|
12
13
|
var i;
|
|
13
14
|
o();
|
|
14
|
-
const { prepareTemplateDetails:
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
const { prepareTemplateDetails: f } = b(), t = await f();
|
|
16
|
+
if (!n(t.compiledHtml))
|
|
17
|
+
return;
|
|
18
|
+
if (d("liquidSyntax")) {
|
|
19
|
+
if (!await l(t.compiledHtml))
|
|
17
20
|
return;
|
|
18
21
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
19
22
|
return;
|
|
20
23
|
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
21
24
|
return;
|
|
22
|
-
await
|
|
23
|
-
const { unsubscribePayload:
|
|
24
|
-
return await
|
|
25
|
+
await m();
|
|
26
|
+
const { unsubscribePayload: v, stripoModules: S } = u(t.rawHtml);
|
|
27
|
+
return await c(v), t.modules = S, p || s(t), t;
|
|
25
28
|
} };
|
|
26
29
|
};
|
|
27
30
|
export {
|
|
28
|
-
|
|
31
|
+
h as useSave
|
|
29
32
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as D } from "./useActionsApi.js";
|
|
2
2
|
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
3
|
import { useConfig as P } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
@@ -6,20 +6,19 @@ import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
|
6
6
|
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
7
|
import { useToaster as x } from "./useToaster.js";
|
|
8
8
|
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
9
|
+
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
+
import j from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
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 e =
|
|
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
|
-
metadata:
|
|
21
|
+
metadata: C,
|
|
23
22
|
html: p,
|
|
24
23
|
css: a,
|
|
25
24
|
forceRecreate: v,
|
|
@@ -32,10 +31,9 @@ const ae = (E, l) => {
|
|
|
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
|
-
conditionCategories: O(),
|
|
39
37
|
enableXSSSecurity: !0,
|
|
40
38
|
modulesDisabled: F,
|
|
41
39
|
syncModulesEnabled: s,
|
|
@@ -54,7 +52,7 @@ const ae = (E, l) => {
|
|
|
54
52
|
},
|
|
55
53
|
mergeTags: [
|
|
56
54
|
{
|
|
57
|
-
entries:
|
|
55
|
+
entries: L(
|
|
58
56
|
l.preselectedDynamicContentList,
|
|
59
57
|
u("liquidSyntax")
|
|
60
58
|
)
|
|
@@ -70,8 +68,8 @@ const ae = (E, l) => {
|
|
|
70
68
|
},
|
|
71
69
|
onTemplateLoaded() {
|
|
72
70
|
try {
|
|
73
|
-
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate:
|
|
74
|
-
t(), n(),
|
|
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(() => {
|
|
75
73
|
e.hasChanges = !1;
|
|
76
74
|
}, 1e3);
|
|
77
75
|
} catch (t) {
|
|
@@ -106,7 +104,7 @@ const ae = (E, l) => {
|
|
|
106
104
|
i(), r();
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
|
-
const e =
|
|
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 = () => {
|
|
@@ -115,7 +113,7 @@ const ae = (E, l) => {
|
|
|
115
113
|
});
|
|
116
114
|
return { initPlugin: async (i) => {
|
|
117
115
|
await _(async () => {
|
|
118
|
-
const r =
|
|
116
|
+
const r = E(), [s, e] = await Promise.all([
|
|
119
117
|
b(),
|
|
120
118
|
k()
|
|
121
119
|
]);
|
|
@@ -124,5 +122,5 @@ const ae = (E, l) => {
|
|
|
124
122
|
} };
|
|
125
123
|
};
|
|
126
124
|
export {
|
|
127
|
-
|
|
125
|
+
se as useStripo
|
|
128
126
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
|
+
import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
3
|
+
import { useToaster as m } from "../useToaster.js";
|
|
4
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
5
|
+
const u = /* @__PURE__ */ new Set([
|
|
6
|
+
i,
|
|
7
|
+
l
|
|
8
|
+
]), A = () => {
|
|
9
|
+
const { showToaster: t } = m(), r = p();
|
|
10
|
+
return { validateCouponBlockTags: (e) => {
|
|
11
|
+
const n = new DOMParser().parseFromString(e, "text/html");
|
|
12
|
+
return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
|
|
13
|
+
var o;
|
|
14
|
+
const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
|
|
15
|
+
return !u.has(a);
|
|
16
|
+
}) ? (t({
|
|
17
|
+
type: c.Warning,
|
|
18
|
+
message: r("newsletter.coupon-tag-modified")
|
|
19
|
+
}), !1) : !0;
|
|
20
|
+
} };
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
A as useCouponBlockValidator
|
|
24
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as y, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as h } from "../../enums/recommendation.js";
|
|
3
3
|
import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
|
|
4
4
|
const w = [
|
|
5
5
|
{
|
|
@@ -8,7 +8,7 @@ const w = [
|
|
|
8
8
|
type: "custom",
|
|
9
9
|
processor: (c) => {
|
|
10
10
|
let e = c;
|
|
11
|
-
return Object.entries(
|
|
11
|
+
return Object.entries(y).forEach(([, l]) => {
|
|
12
12
|
Object.entries(l).forEach(([n, s]) => {
|
|
13
13
|
e = e.replaceAll(s, `{{${n}}}`);
|
|
14
14
|
});
|
|
@@ -30,13 +30,13 @@ const w = [
|
|
|
30
30
|
description: "Adding recommendation unresponsive css",
|
|
31
31
|
type: "custom",
|
|
32
32
|
processor: (c) => {
|
|
33
|
-
const { calculateCardWidth: e, getRecommendationCampaignData: l } =
|
|
33
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: l } = N();
|
|
34
34
|
let n = c;
|
|
35
35
|
const s = n.match(T.ID);
|
|
36
36
|
if (s) {
|
|
37
37
|
const a = [];
|
|
38
38
|
if (s.forEach((i) => {
|
|
39
|
-
const
|
|
39
|
+
const u = /recommendation-id="(.*?)"/i.exec(i), _ = u ? u[1].trim() : "", R = l(_);
|
|
40
40
|
R.textTrimming && R.orientation === M && a.push(e(R));
|
|
41
41
|
}), a.length) {
|
|
42
42
|
const i = `width:${Math.min(...a)}px!important;`;
|
|
@@ -60,25 +60,25 @@ const w = [
|
|
|
60
60
|
type: "custom",
|
|
61
61
|
processor: (c) => {
|
|
62
62
|
let e = c;
|
|
63
|
-
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } =
|
|
63
|
+
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = N();
|
|
64
64
|
return l !== null && l.forEach((s) => {
|
|
65
65
|
const a = s.match(T.CUSTOM_FIELD);
|
|
66
66
|
if (!a)
|
|
67
67
|
return;
|
|
68
|
-
const [i] = a,
|
|
69
|
-
if (!
|
|
68
|
+
const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
|
+
if (!u || !_ || !R)
|
|
70
70
|
return;
|
|
71
|
-
const [S] =
|
|
71
|
+
const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
|
|
72
72
|
let t = i;
|
|
73
73
|
if (r) {
|
|
74
|
-
const I = S.substring(2, S.length - 3),
|
|
75
|
-
o === A.OMNIBUS_PRICE && (
|
|
74
|
+
const I = S.substring(2, S.length - 3), m = n(I);
|
|
75
|
+
o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const p = S.substring(2);
|
|
78
78
|
let f = "";
|
|
79
|
-
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${
|
|
80
|
-
const $ = `${
|
|
81
|
-
e = e.replace(s,
|
|
79
|
+
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
|
|
80
|
+
const $ = `${d}${t}${h.PARAGRAPH_END_TAG}`, C = `${f}${r ? $ : s}${g.ELSE}${d}${h.PARAGRAPH_END_TAG}${g.END_IF}`;
|
|
81
|
+
e = e.replace(s, C);
|
|
82
82
|
}), e;
|
|
83
83
|
},
|
|
84
84
|
priority: 53
|
|
@@ -136,7 +136,7 @@ const w = [
|
|
|
136
136
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
137
137
|
(l, n) => {
|
|
138
138
|
const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
139
|
-
return s.every((
|
|
139
|
+
return s.every((u) => a.test(u)) ? "" : l;
|
|
140
140
|
}
|
|
141
141
|
)), e;
|
|
142
142
|
},
|
|
@@ -151,7 +151,7 @@ const w = [
|
|
|
151
151
|
/<a\b[^>]*\bes-button\b[^>]*>/g,
|
|
152
152
|
(o) => o.replace(
|
|
153
153
|
/([;"]color:)([^;"]+)/g,
|
|
154
|
-
(r, t,
|
|
154
|
+
(r, t, p) => p.includes("!important") ? r : `${t}${p} !important`
|
|
155
155
|
)
|
|
156
156
|
), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
|
|
157
157
|
let a = l.exec(e);
|
|
@@ -163,12 +163,12 @@ const w = [
|
|
|
163
163
|
}
|
|
164
164
|
n.lastIndex = 0, a = l.exec(e);
|
|
165
165
|
}
|
|
166
|
-
const i = /* @__PURE__ */ new Map(),
|
|
166
|
+
const i = /* @__PURE__ */ new Map(), u = [];
|
|
167
167
|
let _ = 0;
|
|
168
168
|
if (s.forEach((o, r) => {
|
|
169
169
|
if (o >= 6) {
|
|
170
|
-
const t = `rc${_++}
|
|
171
|
-
i.set(r, t),
|
|
170
|
+
const t = `rc${_++}`, p = r.endsWith(";") ? r : `${r};`;
|
|
171
|
+
i.set(r, t), u.push(`.${t}{${p}}`);
|
|
172
172
|
}
|
|
173
173
|
}), i.size === 0) {
|
|
174
174
|
let o = e;
|
|
@@ -182,23 +182,23 @@ const w = [
|
|
|
182
182
|
caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
-
let
|
|
186
|
-
return
|
|
185
|
+
let d = e.replace("</style>", `${u.join("")}</style>`);
|
|
186
|
+
return d = d.replace(
|
|
187
187
|
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
188
188
|
(o, r) => {
|
|
189
189
|
let t = r;
|
|
190
|
-
return i.forEach((
|
|
190
|
+
return i.forEach((p, f) => {
|
|
191
191
|
const $ = b.get(f);
|
|
192
192
|
t = t.replace(
|
|
193
193
|
$.caseA,
|
|
194
|
-
(
|
|
194
|
+
(C, I, m) => S(I, p) + m
|
|
195
195
|
), t = t.replace(
|
|
196
196
|
$.caseB,
|
|
197
|
-
(
|
|
198
|
-
), t = t.replaceAll(` style="${f}"`, ` class="${
|
|
197
|
+
(C, I, m) => I + S(m, p)
|
|
198
|
+
), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
|
|
199
199
|
}), t;
|
|
200
200
|
}
|
|
201
|
-
),
|
|
201
|
+
), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
|
|
202
202
|
},
|
|
203
203
|
priority: 58
|
|
204
204
|
}
|
|
@@ -1,34 +1,54 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var b = (
|
|
4
|
-
import
|
|
5
|
-
class
|
|
2
|
+
var T = (l, e, t) => e in l ? x(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var b = (l, e, t) => T(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import S from "../../extensions/Blocks/RadioButton/template.js";
|
|
5
|
+
class B {
|
|
6
6
|
constructor() {
|
|
7
7
|
b(this, "parser");
|
|
8
8
|
this.parser = new DOMParser();
|
|
9
9
|
}
|
|
10
|
-
migrate(
|
|
10
|
+
migrate(e) {
|
|
11
11
|
try {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.radio-button-block"), s = t.querySelectorAll("td.radio-button-v2");
|
|
13
|
+
if (i.length === 0 && s.length === 0)
|
|
14
|
+
return e;
|
|
15
|
+
let o = !1;
|
|
16
|
+
return i.forEach((r) => {
|
|
17
|
+
if (r.classList.contains("radio-button-v2"))
|
|
15
18
|
return;
|
|
16
|
-
const n =
|
|
17
|
-
`<table id="tempDoc"><tbody><tr>${
|
|
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"), d = this.buildTextBlock(a), p = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", p).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
|
|
20
|
+
`<table id="tempDoc"><tbody><tr>${h}</tr></tbody></table>`,
|
|
18
21
|
"text/html"
|
|
19
22
|
).querySelector(".radio-button-v2");
|
|
20
|
-
|
|
21
|
-
}),
|
|
22
|
-
} catch (
|
|
23
|
-
return console.error("RadioButtonMigrator failed:",
|
|
23
|
+
m && r.parentNode && (m.setAttribute("id", n || ""), r.parentNode.replaceChild(m, r), o = !0);
|
|
24
|
+
}), o = this.healRadioButtonV2(t) || o, o ? t.documentElement.outerHTML : e;
|
|
25
|
+
} catch (t) {
|
|
26
|
+
return console.error("RadioButtonMigrator failed:", t), e;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
healRadioButtonV2(e) {
|
|
30
|
+
let t = !1;
|
|
31
|
+
return e.querySelectorAll("td.radio-button-v2").forEach((i) => {
|
|
32
|
+
var p;
|
|
33
|
+
const s = i.querySelector("input#radioYes"), o = i.querySelector("input#radioNo");
|
|
34
|
+
if (!s || !o)
|
|
35
|
+
return;
|
|
36
|
+
const r = ((p = s.parentElement) == null ? void 0 : p.querySelector(":scope > p")) || null;
|
|
37
|
+
if (!r && !s.hasAttribute("align"))
|
|
38
|
+
return;
|
|
39
|
+
const n = s.closest("tr"), a = o.closest("tr");
|
|
40
|
+
if (!n || !a || n === a || !n.parentNode)
|
|
41
|
+
return;
|
|
42
|
+
const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), d = c.querySelector("p");
|
|
43
|
+
u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), d && (d.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
|
|
44
|
+
}), t;
|
|
45
|
+
}
|
|
46
|
+
extractTextFromElement(e, t) {
|
|
47
|
+
var p, y;
|
|
48
|
+
const i = e.querySelector(`.${t}`);
|
|
29
49
|
if (!i)
|
|
30
50
|
return {
|
|
31
|
-
text:
|
|
51
|
+
text: t === "ins-title" ? "Title" : "Description",
|
|
32
52
|
isBold: !1,
|
|
33
53
|
isItalic: !1,
|
|
34
54
|
align: "left",
|
|
@@ -38,51 +58,51 @@ class T {
|
|
|
38
58
|
const s = i.querySelector("p");
|
|
39
59
|
if (!s)
|
|
40
60
|
return {
|
|
41
|
-
text: ((
|
|
61
|
+
text: ((p = i.textContent) == null ? void 0 : p.trim()) || (t === "ins-title" ? "Title" : "Description"),
|
|
42
62
|
isBold: !1,
|
|
43
63
|
isItalic: !1,
|
|
44
64
|
align: i.getAttribute("align") || "left",
|
|
45
65
|
styles: "",
|
|
46
66
|
classList: ""
|
|
47
67
|
};
|
|
48
|
-
const
|
|
68
|
+
const o = ((y = s.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = s.getAttribute("style") || "", n = i.getAttribute("align") || s.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), d = i.getAttribute("class") || "";
|
|
49
69
|
return {
|
|
50
|
-
text:
|
|
51
|
-
isBold:
|
|
52
|
-
isItalic:
|
|
53
|
-
align:
|
|
54
|
-
styles:
|
|
55
|
-
classList:
|
|
70
|
+
text: o,
|
|
71
|
+
isBold: a,
|
|
72
|
+
isItalic: g,
|
|
73
|
+
align: n,
|
|
74
|
+
styles: u,
|
|
75
|
+
classList: d
|
|
56
76
|
};
|
|
57
77
|
}
|
|
58
|
-
buildTextBlock(
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
const i =
|
|
78
|
+
buildTextBlock(e) {
|
|
79
|
+
let t = e.text;
|
|
80
|
+
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 i = e.align ? ` align="${e.align}"` : "", s = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
|
|
62
82
|
return `
|
|
63
|
-
<td class="esd-block-text ${
|
|
83
|
+
<td class="esd-block-text ${e.classList}" ${i}>
|
|
64
84
|
<p path="1" ${s}>
|
|
65
|
-
${
|
|
85
|
+
${t}
|
|
66
86
|
</p>
|
|
67
87
|
</td>
|
|
68
88
|
`;
|
|
69
89
|
}
|
|
70
|
-
removeStyleProperties(
|
|
71
|
-
return
|
|
72
|
-
const
|
|
73
|
-
return s.replace(
|
|
74
|
-
},
|
|
90
|
+
removeStyleProperties(e, t) {
|
|
91
|
+
return e ? t.reduce((s, o) => {
|
|
92
|
+
const r = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
|
|
93
|
+
return s.replace(r, "");
|
|
94
|
+
}, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
75
95
|
}
|
|
76
|
-
convertInlineToBlock(
|
|
77
|
-
if (!
|
|
96
|
+
convertInlineToBlock(e) {
|
|
97
|
+
if (!e)
|
|
78
98
|
return "";
|
|
79
|
-
let
|
|
80
|
-
return /display\s*:/i.test(
|
|
99
|
+
let t = e.replace(/display\s*:\s*inline/gi, "display: block");
|
|
100
|
+
return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
|
-
function
|
|
84
|
-
return new
|
|
103
|
+
function q(l) {
|
|
104
|
+
return new B().migrate(l);
|
|
85
105
|
}
|
|
86
106
|
export {
|
|
87
|
-
|
|
107
|
+
q as migrateRadioButton
|
|
88
108
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle
|
|
1
|
+
declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
|
|
2
2
|
/**
|
|
3
3
|
* @returns The template for the default checkbox block
|
|
4
4
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.2.0-beta.
|
|
3
|
+
"version": "3.2.0-beta.87303ed",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { useTranslations as i } from "../composables/useTranslations.js";
|
|
2
|
-
const t = () => {
|
|
3
|
-
const e = i();
|
|
4
|
-
return [
|
|
5
|
-
{
|
|
6
|
-
category: e("journey-builder.demographics"),
|
|
7
|
-
conditions: [
|
|
8
|
-
{
|
|
9
|
-
id: 1,
|
|
10
|
-
name: e("condition.language"),
|
|
11
|
-
description: e("journey-builder.display-condition-language-description"),
|
|
12
|
-
beforeScript: '{% if language == "en_US" %}',
|
|
13
|
-
afterScript: "{% endif %}"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: 2,
|
|
17
|
-
name: e("condition.country"),
|
|
18
|
-
description: e("journey-builder.display-condition-country-description"),
|
|
19
|
-
beforeScript: '{% if country == "Australia" %}',
|
|
20
|
-
afterScript: "{% endif %}"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 3,
|
|
24
|
-
name: e("stripo-editor.country-and-city"),
|
|
25
|
-
description: e("journey-builder.display-condition-country-city-description"),
|
|
26
|
-
beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
|
|
27
|
-
afterScript: "{% endif %}"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 4,
|
|
31
|
-
name: e("stripo-editor.age-less-than-operator"),
|
|
32
|
-
description: e("journey-builder.display-condition-age-less-than"),
|
|
33
|
-
beforeScript: "{% if age < 18 %}",
|
|
34
|
-
afterScript: "{% endif %}"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 5,
|
|
38
|
-
name: e("stripo-editor.age-equal-greater-operator"),
|
|
39
|
-
description: e("journey-builder.display-condition-age-equal-greater"),
|
|
40
|
-
beforeScript: "{% if age >= 25 %}",
|
|
41
|
-
afterScript: "{% endif %}"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 6,
|
|
45
|
-
name: e("stripo-editor.age-greater-less-operators"),
|
|
46
|
-
description: e("journey-builder.display-condition-age-between"),
|
|
47
|
-
beforeScript: "{% if age > 18 and age < 25 %}",
|
|
48
|
-
afterScript: "{% endif %}"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: 7,
|
|
52
|
-
name: e("condition.gender"),
|
|
53
|
-
description: e("journey-builder.display-condition-gender-female"),
|
|
54
|
-
beforeScript: '{% if gender == "Female" %}',
|
|
55
|
-
afterScript: "{% endif %}"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 8,
|
|
59
|
-
name: e("journey-builder.state"),
|
|
60
|
-
description: e("stripo-editor.state-description"),
|
|
61
|
-
beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
|
|
62
|
-
afterScript: "{% endif %}"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: 9,
|
|
66
|
-
name: e("journey-builder.vip-user"),
|
|
67
|
-
description: e("stripo-editor.vip-user-description"),
|
|
68
|
-
beforeScript: "{% if c_is_vip_user %}",
|
|
69
|
-
afterScript: "{% endif %}"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: 10,
|
|
73
|
-
name: e("journey-builder.membership-type"),
|
|
74
|
-
description: e("stripo-editor.membership-type-description"),
|
|
75
|
-
beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
|
|
76
|
-
afterScript: "{% endif %}"
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
};
|
|
82
|
-
export {
|
|
83
|
-
t as getDisplayConditions
|
|
84
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ConditionCategories } from '@@/Types/condition-categories';
|
|
2
|
-
/**
|
|
3
|
-
* Get display conditions lazily so translations resolve at access time.
|
|
4
|
-
* Must be called within a Vue component context or after Pinia is initialized.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getDisplayConditions: () => ConditionCategories;
|