@useinsider/guido 3.1.1-beta.cdcd41d → 3.1.1-beta.d3c42de
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 +1 -0
- package/dist/@types/config/schemas.js +69 -61
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +23 -15
- package/dist/composables/useStripo.js +32 -32
- package/dist/composables/validators/useLiquidValidator.js +36 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +53 -55
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/composables/useConfig.d.ts +8 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/stores/config.d.ts +72 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/stores/preview.js +4 -3
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +20 -20
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { localePatch as
|
|
8
|
-
import { displayConditions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import
|
|
1
|
+
import { useActionsApi as F } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as D } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as I } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as P } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as U } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as R } from "./useToaster.js";
|
|
7
|
+
import { localePatch as H } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as q } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as x } from "../services/stripoApi.js";
|
|
10
|
+
import O from "../static/styles/customEditorStyle.css.js";
|
|
11
11
|
import { useEditorStore as S } from "../stores/editor.js";
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { features: l, template: E } =
|
|
12
|
+
import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
|
|
13
|
+
import $ from "../package.json.js";
|
|
14
|
+
const ie = (C, c) => {
|
|
15
|
+
const { features: l, template: E, isFeatureEnabled: h } = I(), { handleError: u } = R(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = x(), { handleEvent: T } = U(), { getStripoBlocksConfig: V } = D(), _ = async (i, n = [], r = !1) => {
|
|
16
16
|
var f, g, y;
|
|
17
|
-
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await
|
|
17
|
+
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await V(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, v = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, M = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
18
|
window.UIEditor.initEditor(
|
|
19
19
|
document.querySelector("#guido-editor"),
|
|
20
20
|
{
|
|
21
21
|
metadata: C,
|
|
22
22
|
html: m,
|
|
23
23
|
css: a,
|
|
24
|
-
forceRecreate:
|
|
24
|
+
forceRecreate: M,
|
|
25
25
|
locale: "en",
|
|
26
26
|
undoButtonSelector: "#guido__undo-button",
|
|
27
27
|
redoButtonSelector: "#guido__redo-button",
|
|
28
28
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
29
29
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
30
30
|
codeEditorButtonSelector: "#guido__code-button",
|
|
31
|
-
customAppearanceMergetags: !
|
|
31
|
+
customAppearanceMergetags: !h("liquidSyntax"),
|
|
32
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: O,
|
|
35
35
|
conditionsEnabled: p,
|
|
36
36
|
customConditionsEnabled: p,
|
|
37
|
-
conditionCategories:
|
|
37
|
+
conditionCategories: q,
|
|
38
38
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
39
|
+
modulesDisabled: v,
|
|
40
40
|
syncModulesEnabled: r,
|
|
41
41
|
messageSettingsEnabled: !0,
|
|
42
42
|
displayGmailAnnotations: !0,
|
|
@@ -52,12 +52,12 @@ const oe = (C, c) => {
|
|
|
52
52
|
},
|
|
53
53
|
mergeTags: [
|
|
54
54
|
{
|
|
55
|
-
entries:
|
|
55
|
+
entries: L(c.preselectedDynamicContentList)
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
58
|
async onTokenRefreshRequest(t) {
|
|
59
59
|
try {
|
|
60
|
-
const s = await
|
|
60
|
+
const s = await b();
|
|
61
61
|
t(s);
|
|
62
62
|
} catch (s) {
|
|
63
63
|
u(s, "Failed to refresh token");
|
|
@@ -65,8 +65,8 @@ const oe = (C, c) => {
|
|
|
65
65
|
},
|
|
66
66
|
onTemplateLoaded() {
|
|
67
67
|
try {
|
|
68
|
-
const { importCss: t } =
|
|
69
|
-
t(), s(),
|
|
68
|
+
const { importCss: t } = P(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: A } = F();
|
|
69
|
+
t(), s(), A(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
70
70
|
e.hasChanges = !1;
|
|
71
71
|
}, 1e3);
|
|
72
72
|
} catch (t) {
|
|
@@ -85,23 +85,23 @@ const oe = (C, c) => {
|
|
|
85
85
|
onDataChanged() {
|
|
86
86
|
e.hasChanges = !0;
|
|
87
87
|
},
|
|
88
|
-
onEvent:
|
|
88
|
+
onEvent: T,
|
|
89
89
|
ignoreClickOutsideSelectors: [
|
|
90
90
|
"#guido-dynamic-content-modal",
|
|
91
91
|
".in-on-board-wrapper",
|
|
92
92
|
".in-drawer__container"
|
|
93
93
|
],
|
|
94
94
|
extensions: d,
|
|
95
|
-
localePatch:
|
|
95
|
+
localePatch: H
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
|
-
},
|
|
98
|
+
}, B = (i) => new Promise((n, r) => {
|
|
99
99
|
var d;
|
|
100
100
|
if (document.getElementById("UiEditorScript")) {
|
|
101
101
|
i(), n();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const e =
|
|
104
|
+
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");
|
|
105
105
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
106
106
|
i(), n();
|
|
107
107
|
}, o.onerror = () => {
|
|
@@ -109,15 +109,15 @@ const oe = (C, c) => {
|
|
|
109
109
|
}, document.body.appendChild(o);
|
|
110
110
|
});
|
|
111
111
|
return { initPlugin: async (i) => {
|
|
112
|
-
await
|
|
112
|
+
await B(async () => {
|
|
113
113
|
const n = S(), [r, e] = await Promise.all([
|
|
114
114
|
w(),
|
|
115
|
-
|
|
115
|
+
k()
|
|
116
116
|
]);
|
|
117
|
-
n.syncModulesEnabled = e, await
|
|
117
|
+
n.syncModulesEnabled = e, await _(i, r, e);
|
|
118
118
|
});
|
|
119
119
|
} };
|
|
120
120
|
};
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
ie as useStripo
|
|
123
123
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ToasterTypeOptions as i } from "../../enums/toaster.js";
|
|
2
|
+
import { base64EncodeWithSpecialChars as d } from "../../utils/base64.js";
|
|
3
|
+
import { useHttp as u } from "../useHttp.js";
|
|
4
|
+
import { useToaster as m } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
6
|
+
const x = () => {
|
|
7
|
+
const { post: o } = u(), { showToaster: a } = m(), r = p();
|
|
8
|
+
return { validateLiquidSyntax: async (n) => {
|
|
9
|
+
var s;
|
|
10
|
+
const e = await o("/newsletter/contents/validate-syntax", [{
|
|
11
|
+
identifier: "default",
|
|
12
|
+
syntax: "liquid",
|
|
13
|
+
contents: {
|
|
14
|
+
subject: null,
|
|
15
|
+
preheader: null,
|
|
16
|
+
html: d(n),
|
|
17
|
+
ampHtml: null
|
|
18
|
+
}
|
|
19
|
+
}]);
|
|
20
|
+
if (!Array.isArray(e.data)) {
|
|
21
|
+
const l = e.data;
|
|
22
|
+
return a({
|
|
23
|
+
type: i.Alert,
|
|
24
|
+
message: l.message ?? r("journey-builder.liquid-validation-failed")
|
|
25
|
+
}), !1;
|
|
26
|
+
}
|
|
27
|
+
const [t] = e.data;
|
|
28
|
+
return t != null && t.success ? !0 : (a({
|
|
29
|
+
type: i.Alert,
|
|
30
|
+
message: ((s = t == null ? void 0 : t.errors) == null ? void 0 : s.html) ?? r("journey-builder.liquid-validation-failed")
|
|
31
|
+
}), !1);
|
|
32
|
+
} };
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
x as useLiquidValidator
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
2
|
+
const o = [
|
|
3
|
+
{
|
|
4
|
+
id: "liquid-coupon-code",
|
|
5
|
+
description: "Replace legacy coupon placeholder with liquid syntax",
|
|
6
|
+
type: "replace",
|
|
7
|
+
search: i,
|
|
8
|
+
replacement: e,
|
|
9
|
+
replaceAll: !0,
|
|
10
|
+
priority: 50
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
export {
|
|
14
|
+
o as liquidCompilerRules
|
|
15
|
+
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return o === "before" ? `${t} ${u}` : `${u} ${t}`;
|
|
1
|
+
import { useRecommendation as $ } from "../../../composables/useRecommendation.js";
|
|
2
|
+
function b(e, u, r, o) {
|
|
3
|
+
const n = `{{${e}_${u}_${r}}}`, t = `{{${e}_${u}_currency}}`;
|
|
4
|
+
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
6
5
|
}
|
|
7
|
-
function p(e,
|
|
8
|
-
switch (
|
|
6
|
+
function p(e, u, r, o, n) {
|
|
7
|
+
switch (u) {
|
|
9
8
|
case "productImage": {
|
|
10
9
|
const t = e.querySelector("img");
|
|
11
|
-
t && (t.setAttribute("src", `{{${
|
|
10
|
+
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
12
11
|
const c = e.querySelector("a");
|
|
13
|
-
c && c.setAttribute("href", `{{${
|
|
12
|
+
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
14
13
|
break;
|
|
15
14
|
}
|
|
16
15
|
case "productName": {
|
|
17
16
|
const t = e.querySelector("p");
|
|
18
17
|
if (t) {
|
|
19
18
|
const c = t.querySelector("strong") || t;
|
|
20
|
-
c.textContent = `{{${
|
|
19
|
+
c.textContent = `{{${r}_${o}_name}}`;
|
|
21
20
|
}
|
|
22
21
|
break;
|
|
23
22
|
}
|
|
@@ -25,7 +24,7 @@ function p(e, n, r, o, s, u) {
|
|
|
25
24
|
const t = e.querySelector("p");
|
|
26
25
|
if (t) {
|
|
27
26
|
const c = t.querySelector("strong") || t;
|
|
28
|
-
c.textContent =
|
|
27
|
+
c.textContent = b(r, o, "price", n);
|
|
29
28
|
}
|
|
30
29
|
break;
|
|
31
30
|
}
|
|
@@ -33,25 +32,24 @@ function p(e, n, r, o, s, u) {
|
|
|
33
32
|
const t = e.querySelector("p");
|
|
34
33
|
if (t) {
|
|
35
34
|
const c = t.querySelector("strong") || t;
|
|
36
|
-
c.textContent =
|
|
35
|
+
c.textContent = b(
|
|
37
36
|
r,
|
|
38
37
|
o,
|
|
39
38
|
"original_price",
|
|
40
|
-
|
|
41
|
-
u
|
|
39
|
+
n
|
|
42
40
|
), t.setAttribute("product-attr", "discount");
|
|
43
41
|
}
|
|
44
42
|
break;
|
|
45
43
|
}
|
|
46
44
|
case "productButton": {
|
|
47
45
|
const t = e.querySelector("a");
|
|
48
|
-
t && t.setAttribute("href", `{{${
|
|
46
|
+
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
49
47
|
break;
|
|
50
48
|
}
|
|
51
49
|
case "productOmnibusPrice": {
|
|
52
50
|
const t = e.querySelector(".omnibus-price-value");
|
|
53
51
|
if (t) {
|
|
54
|
-
t.textContent = `{{${
|
|
52
|
+
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
55
53
|
const c = t.closest("p");
|
|
56
54
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
57
55
|
}
|
|
@@ -60,7 +58,7 @@ function p(e, n, r, o, s, u) {
|
|
|
60
58
|
case "productOmnibusDiscount": {
|
|
61
59
|
const t = e.querySelector(".omnibus-discount-value");
|
|
62
60
|
if (t) {
|
|
63
|
-
t.textContent = `{{${
|
|
61
|
+
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
64
62
|
const c = t.closest("p");
|
|
65
63
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
66
64
|
}
|
|
@@ -69,66 +67,66 @@ function p(e, n, r, o, s, u) {
|
|
|
69
67
|
default: {
|
|
70
68
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
71
69
|
if (t) {
|
|
72
|
-
const c = t.getAttribute("product-attr"),
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
70
|
+
const c = t.getAttribute("product-attr"), s = t.querySelector("p");
|
|
71
|
+
if (s) {
|
|
72
|
+
const i = s.querySelector("strong") || s;
|
|
73
|
+
i.textContent = `{{${r}_${o}_${c}}}`;
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
break;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
function
|
|
83
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
p(
|
|
88
|
-
}) : p(
|
|
80
|
+
function S(e, u, r) {
|
|
81
|
+
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
82
|
+
n.querySelectorAll("[data-attribute-type]").forEach((s) => {
|
|
83
|
+
const i = s.getAttribute("data-attribute-type") || "", l = s.querySelectorAll(".attribute-cell");
|
|
84
|
+
l.length > 0 ? l.forEach((a) => {
|
|
85
|
+
p(a, i, u, t, r);
|
|
86
|
+
}) : p(s, i, u, t, r);
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
89
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
90
|
+
function _(e, u, r) {
|
|
91
|
+
const o = e.querySelectorAll(".recommendation-product-row");
|
|
92
|
+
if (!o.length)
|
|
95
93
|
return;
|
|
96
|
-
const [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const m =
|
|
102
|
-
p(
|
|
94
|
+
const [n] = o, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
95
|
+
o.forEach((s, i) => {
|
|
96
|
+
s.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
97
|
+
const f = a.getAttribute("data-attribute-type") || "";
|
|
98
|
+
a.querySelectorAll(".attribute-cell").forEach((y, A) => {
|
|
99
|
+
const m = i * c + A;
|
|
100
|
+
p(y, f, u, m, r);
|
|
103
101
|
});
|
|
104
102
|
});
|
|
105
103
|
});
|
|
106
104
|
}
|
|
107
|
-
function
|
|
108
|
-
e.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
109
|
-
|
|
105
|
+
function q(e, u, r) {
|
|
106
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
107
|
+
_(n, u, r);
|
|
110
108
|
});
|
|
111
109
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
|
|
110
|
+
function d(e, u) {
|
|
111
|
+
const r = e.getAttribute("data-layout") || "grid", o = e.getAttribute("currency-alignment") || "after";
|
|
112
|
+
r === "list" ? S(e, u, o) : q(e, u, o);
|
|
115
113
|
}
|
|
116
|
-
function
|
|
114
|
+
function g(e, u) {
|
|
117
115
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
118
116
|
return (r ? `${r[0]}
|
|
119
|
-
` : "") +
|
|
117
|
+
` : "") + u.documentElement.outerHTML;
|
|
120
118
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
119
|
+
function E(e) {
|
|
120
|
+
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
123
121
|
if (!o.length)
|
|
124
122
|
return e;
|
|
125
|
-
const { buildCampaignUrl:
|
|
126
|
-
return o.forEach((
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
}),
|
|
123
|
+
const { buildCampaignUrl: n } = $();
|
|
124
|
+
return o.forEach((c) => {
|
|
125
|
+
const s = c.getAttribute("recommendation-id");
|
|
126
|
+
s && (n(s), d(c, s));
|
|
127
|
+
}), g(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
130
128
|
}
|
|
131
129
|
export {
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
b as formatPriceVariable,
|
|
131
|
+
E as prepareRecommendationBlocks
|
|
134
132
|
};
|
|
@@ -11,6 +11,8 @@ class f {
|
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((r) => {
|
|
14
|
+
if (r.classList.contains("checkbox-block-v2"))
|
|
15
|
+
return;
|
|
14
16
|
const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
|
|
15
17
|
`<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
|
|
16
18
|
"text/html"
|
|
@@ -22,7 +24,7 @@ class f {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
extractTextFromElement(t, e) {
|
|
25
|
-
var o,
|
|
27
|
+
var o, d;
|
|
26
28
|
const i = t.querySelector(`.${e}`);
|
|
27
29
|
if (!i)
|
|
28
30
|
return {
|
|
@@ -41,13 +43,13 @@ class f {
|
|
|
41
43
|
align: i.getAttribute("align") || "left",
|
|
42
44
|
styles: ""
|
|
43
45
|
};
|
|
44
|
-
const n = ((
|
|
46
|
+
const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
|
|
45
47
|
return {
|
|
46
48
|
text: n,
|
|
47
49
|
isBold: a,
|
|
48
50
|
isItalic: p,
|
|
49
51
|
align: c,
|
|
50
|
-
styles:
|
|
52
|
+
styles: u
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
buildTextBlock(t) {
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var f = (r, t, e) => t in r ?
|
|
3
|
-
var
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var f = (r, t, e) => t in r ? x(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var b = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import h from "../../extensions/Blocks/RadioButton/template.js";
|
|
5
5
|
class T {
|
|
6
6
|
constructor() {
|
|
7
|
-
|
|
7
|
+
b(this, "parser");
|
|
8
8
|
this.parser = new DOMParser();
|
|
9
9
|
}
|
|
10
10
|
migrate(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
|
-
|
|
14
|
+
if (s.classList.contains("radio-button-v2"))
|
|
15
|
+
return;
|
|
16
|
+
const n = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), o = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", o), y = this.parser.parseFromString(
|
|
15
17
|
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
16
18
|
"text/html"
|
|
17
19
|
).querySelector(".radio-button-v2");
|
|
18
|
-
y && s.parentNode && (y.setAttribute("id",
|
|
20
|
+
y && s.parentNode && (y.setAttribute("id", n || ""), s.parentNode.replaceChild(y, s));
|
|
19
21
|
}), e.documentElement.outerHTML);
|
|
20
22
|
} catch (e) {
|
|
21
23
|
return console.error("RadioButtonMigrator failed:", e), t;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
extractTextFromElement(t, e) {
|
|
25
|
-
var
|
|
27
|
+
var o, c;
|
|
26
28
|
const i = t.querySelector(`.${e}`);
|
|
27
29
|
if (!i)
|
|
28
30
|
return {
|
|
@@ -36,16 +38,16 @@ class T {
|
|
|
36
38
|
const s = i.querySelector("p");
|
|
37
39
|
if (!s)
|
|
38
40
|
return {
|
|
39
|
-
text: ((
|
|
41
|
+
text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
|
|
40
42
|
isBold: !1,
|
|
41
43
|
isItalic: !1,
|
|
42
44
|
align: i.getAttribute("align") || "left",
|
|
43
45
|
styles: "",
|
|
44
46
|
classList: ""
|
|
45
47
|
};
|
|
46
|
-
const
|
|
48
|
+
const n = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
|
|
47
49
|
return {
|
|
48
|
-
text:
|
|
50
|
+
text: n,
|
|
49
51
|
isBold: p,
|
|
50
52
|
isItalic: u,
|
|
51
53
|
align: a,
|
|
@@ -66,8 +68,8 @@ class T {
|
|
|
66
68
|
`;
|
|
67
69
|
}
|
|
68
70
|
removeStyleProperties(t, e) {
|
|
69
|
-
return t ? e.reduce((s,
|
|
70
|
-
const l = new RegExp(`${
|
|
71
|
+
return t ? e.reduce((s, n) => {
|
|
72
|
+
const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
71
73
|
return s.replace(l, "");
|
|
72
74
|
}, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
73
75
|
}
|
|
@@ -28,8 +28,8 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
30
30
|
COMPOSITION: /composition="true"/gm,
|
|
31
|
-
CUSTOM_FIELD: /{{
|
|
32
|
-
CUSTOM_FIELD_INDEXES_PART: /{{
|
|
31
|
+
CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
+
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
34
|
}, n = {
|
|
35
35
|
PARAGRAPH_END_TAG: "</p>"
|
|
@@ -1,29 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useConfig as n } from "../../../composables/useConfig.js";
|
|
2
|
+
import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { COUPON_BLOCK_ID as t } from "./block.js";
|
|
4
|
+
const c = "{@COUPON_CODE}", s = "{{ins_coupon_code}}";
|
|
5
|
+
function l() {
|
|
6
|
+
const { isFeatureEnabled: o } = n();
|
|
7
|
+
return o("liquidSyntax") ? s : c;
|
|
8
|
+
}
|
|
9
|
+
function i(o) {
|
|
10
|
+
return `
|
|
11
|
+
<${e.BLOCK_TEXT}
|
|
5
12
|
class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
|
|
6
13
|
align="center"
|
|
7
|
-
esd-extension-block-id="${
|
|
14
|
+
esd-extension-block-id="${t}">
|
|
8
15
|
<p
|
|
9
16
|
path="1"
|
|
10
17
|
contenteditable="false"
|
|
11
18
|
style="font-size: 16px; color: #333333;">
|
|
12
|
-
<strong path="1,0"
|
|
19
|
+
<strong path="1,0">${o}</strong>
|
|
13
20
|
</p>
|
|
14
|
-
</${
|
|
15
|
-
|
|
21
|
+
</${e.BLOCK_TEXT}>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
const u = `
|
|
16
25
|
<td
|
|
17
26
|
class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
|
|
18
|
-
esd-extension-block-id="${
|
|
27
|
+
esd-extension-block-id="${t}"
|
|
19
28
|
>
|
|
20
29
|
<p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
|
|
21
30
|
</td>
|
|
22
31
|
`;
|
|
23
|
-
function
|
|
24
|
-
return
|
|
32
|
+
function d() {
|
|
33
|
+
return i(l());
|
|
25
34
|
}
|
|
26
35
|
export {
|
|
27
|
-
|
|
28
|
-
s as
|
|
36
|
+
c as COUPON_PLACEHOLDER_DEFAULT,
|
|
37
|
+
s as COUPON_PLACEHOLDER_LIQUID,
|
|
38
|
+
u as default,
|
|
39
|
+
d as getDefaultTemplate
|
|
29
40
|
};
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container",
|
|
1
|
+
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", n = ".ins-recommendation-mobile-container", t = ".ins-recommendation-mobile-row", r = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
},
|
|
8
|
+
}, R = "productImage", _ = "productName", e = "productPrice", O = "productOldPrice", s = "productOmnibusPrice", i = "productOmnibusDiscount", E = "productButton", A = "customAttr:", C = "data-custom-attributes", u = "product-attr", m = /* @__PURE__ */ new Set([
|
|
9
|
+
"name",
|
|
10
|
+
// productName
|
|
11
|
+
"price",
|
|
12
|
+
// productPrice
|
|
13
|
+
"original_price",
|
|
14
|
+
// productOldPrice
|
|
15
|
+
"image_url",
|
|
16
|
+
// productImage
|
|
17
|
+
"url",
|
|
18
|
+
// productButton
|
|
19
|
+
"omnibus_price",
|
|
20
|
+
// productOmnibusPrice
|
|
21
|
+
"omnibus_discount"
|
|
22
|
+
// productOmnibusDiscount
|
|
23
|
+
]);
|
|
9
24
|
export {
|
|
10
25
|
A as ATTR_CUSTOM_PREFIX,
|
|
11
|
-
|
|
26
|
+
C as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
12
27
|
u as ATTR_PRODUCT_ATTR,
|
|
13
28
|
E as ATTR_PRODUCT_BUTTON,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
R as ATTR_PRODUCT_IMAGE,
|
|
30
|
+
_ as ATTR_PRODUCT_NAME,
|
|
31
|
+
O as ATTR_PRODUCT_OLD_PRICE,
|
|
32
|
+
i as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
18
33
|
s as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
19
|
-
|
|
34
|
+
e as ATTR_PRODUCT_PRICE,
|
|
20
35
|
T as BLOCK_ROOT_SELECTOR,
|
|
36
|
+
m as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
21
37
|
c as CONTAINER_SELECTOR,
|
|
22
|
-
|
|
38
|
+
r as CURRENCY_ATTR,
|
|
23
39
|
o as DESKTOP_CONTAINER_SELECTOR,
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
n as MOBILE_CONTAINER_SELECTOR,
|
|
41
|
+
t as MOBILE_ROW_SELECTOR
|
|
26
42
|
};
|