@useinsider/guido 3.1.1 → 3.2.0-beta.1949a28
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 +66 -54
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- 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/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +23 -15
- package/dist/composables/useStripo.js +52 -47
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +162 -43
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +52 -46
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +66 -44
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/extensions/recommendationBlock.js +14 -11
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.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/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
- 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 +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +28 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +12 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -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/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -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/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -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/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/config.d.ts +108 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +36 -25
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +4 -4
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
+
function y(e, u, r, o, s = "") {
|
|
5
|
+
const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
|
|
4
6
|
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
5
7
|
}
|
|
6
|
-
function
|
|
8
|
+
function m(e, u, r, o, s, n) {
|
|
7
9
|
switch (u) {
|
|
8
10
|
case "productImage": {
|
|
9
11
|
const t = e.querySelector("img");
|
|
10
|
-
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
12
|
+
t && (t.setAttribute("src", `{{${n}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${r}_${o}_name}}`));
|
|
11
13
|
const c = e.querySelector("a");
|
|
12
|
-
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
14
|
+
c && c.setAttribute("href", `{{${n}${r}_${o}_url}}`);
|
|
13
15
|
break;
|
|
14
16
|
}
|
|
15
17
|
case "productName": {
|
|
16
18
|
const t = e.querySelector("p");
|
|
17
19
|
if (t) {
|
|
18
20
|
const c = t.querySelector("strong") || t;
|
|
19
|
-
c.textContent = `{{${r}_${o}_name}}`;
|
|
21
|
+
c.textContent = `{{${n}${r}_${o}_name}}`;
|
|
20
22
|
}
|
|
21
23
|
break;
|
|
22
24
|
}
|
|
@@ -24,7 +26,7 @@ function p(e, u, r, o, n) {
|
|
|
24
26
|
const t = e.querySelector("p");
|
|
25
27
|
if (t) {
|
|
26
28
|
const c = t.querySelector("strong") || t;
|
|
27
|
-
c.textContent =
|
|
29
|
+
c.textContent = y(r, o, "price", s, n);
|
|
28
30
|
}
|
|
29
31
|
break;
|
|
30
32
|
}
|
|
@@ -32,10 +34,11 @@ function p(e, u, r, o, n) {
|
|
|
32
34
|
const t = e.querySelector("p");
|
|
33
35
|
if (t) {
|
|
34
36
|
const c = t.querySelector("strong") || t;
|
|
35
|
-
c.textContent =
|
|
37
|
+
c.textContent = y(
|
|
36
38
|
r,
|
|
37
39
|
o,
|
|
38
40
|
"original_price",
|
|
41
|
+
s,
|
|
39
42
|
n
|
|
40
43
|
), t.setAttribute("product-attr", "discount");
|
|
41
44
|
}
|
|
@@ -43,13 +46,13 @@ function p(e, u, r, o, n) {
|
|
|
43
46
|
}
|
|
44
47
|
case "productButton": {
|
|
45
48
|
const t = e.querySelector("a");
|
|
46
|
-
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
49
|
+
t && t.setAttribute("href", `{{${n}${r}_${o}_url}}`);
|
|
47
50
|
break;
|
|
48
51
|
}
|
|
49
52
|
case "productOmnibusPrice": {
|
|
50
53
|
const t = e.querySelector(".omnibus-price-value");
|
|
51
54
|
if (t) {
|
|
52
|
-
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
55
|
+
t.textContent = `{{${n}${r}_${o}_omnibus_price}}`;
|
|
53
56
|
const c = t.closest("p");
|
|
54
57
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
55
58
|
}
|
|
@@ -58,7 +61,7 @@ function p(e, u, r, o, n) {
|
|
|
58
61
|
case "productOmnibusDiscount": {
|
|
59
62
|
const t = e.querySelector(".omnibus-discount-value");
|
|
60
63
|
if (t) {
|
|
61
|
-
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
64
|
+
t.textContent = `{{${n}${r}_${o}_omnibus_discount}}`;
|
|
62
65
|
const c = t.closest("p");
|
|
63
66
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
64
67
|
}
|
|
@@ -67,66 +70,69 @@ function p(e, u, r, o, n) {
|
|
|
67
70
|
default: {
|
|
68
71
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
69
72
|
if (t) {
|
|
70
|
-
const c = t.getAttribute("product-attr"),
|
|
71
|
-
if (
|
|
72
|
-
const i =
|
|
73
|
-
i.textContent = `{{${r}_${o}_${c}}}`;
|
|
73
|
+
const c = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
74
|
+
if (a) {
|
|
75
|
+
const i = a.querySelector("strong") || a;
|
|
76
|
+
i.textContent = `{{${n}${r}_${o}_${c}}}`;
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
break;
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
|
-
function
|
|
83
|
+
function q(e, u, r, o) {
|
|
81
84
|
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
82
|
-
n.querySelectorAll("[data-attribute-type]").forEach((
|
|
83
|
-
const i =
|
|
84
|
-
l.length > 0 ? l.forEach((
|
|
85
|
-
p
|
|
86
|
-
}) :
|
|
85
|
+
n.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
86
|
+
const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
|
|
87
|
+
l.length > 0 ? l.forEach((p) => {
|
|
88
|
+
m(p, i, u, t, r, o);
|
|
89
|
+
}) : m(a, i, u, t, r, o);
|
|
87
90
|
});
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
+
function g(e, u, r, o) {
|
|
94
|
+
const s = e.querySelectorAll(".recommendation-product-row");
|
|
95
|
+
if (!s.length)
|
|
93
96
|
return;
|
|
94
|
-
const [n] =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
97
|
+
const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
98
|
+
s.forEach((a, i) => {
|
|
99
|
+
a.querySelectorAll("[data-attribute-type]").forEach((p) => {
|
|
100
|
+
const b = p.getAttribute("data-attribute-type") || "";
|
|
101
|
+
p.querySelectorAll(".attribute-cell").forEach((f, $) => {
|
|
102
|
+
const A = i * c + $;
|
|
103
|
+
m(f, b, u, A, r, o);
|
|
101
104
|
});
|
|
102
105
|
});
|
|
103
106
|
});
|
|
104
107
|
}
|
|
105
|
-
function
|
|
108
|
+
function h(e, u, r, o) {
|
|
106
109
|
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
107
|
-
|
|
110
|
+
g(n, u, r, o);
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
+
function C(e, u, r) {
|
|
114
|
+
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
115
|
+
o === "list" ? q(e, u, s, r) : h(e, u, s, r);
|
|
113
116
|
}
|
|
114
|
-
function
|
|
117
|
+
function E(e, u) {
|
|
115
118
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
116
119
|
return (r ? `${r[0]}
|
|
117
120
|
` : "") + u.documentElement.outerHTML;
|
|
118
121
|
}
|
|
119
|
-
function
|
|
122
|
+
function T(e) {
|
|
120
123
|
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
121
124
|
if (!o.length)
|
|
122
125
|
return e;
|
|
123
|
-
const { buildCampaignUrl:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
const { buildCampaignUrl: s } = _(), n = d();
|
|
127
|
+
n.recommendationCampaignUrls = {};
|
|
128
|
+
const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
|
|
129
|
+
return o.forEach((i) => {
|
|
130
|
+
var p, b;
|
|
131
|
+
const l = i.getAttribute("recommendation-id");
|
|
132
|
+
l && ((p = i.parentNode) == null || p.insertBefore(r.createComment("REC_START"), i), (b = i.parentNode) == null || b.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
|
|
133
|
+
}), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
128
134
|
}
|
|
129
135
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
y as formatPriceVariable,
|
|
137
|
+
T as prepareRecommendationBlocks
|
|
132
138
|
};
|
|
@@ -75,7 +75,8 @@ const e = {
|
|
|
75
75
|
"The image with the invalid link cannot be saved to the image gallery": "Enter a valid image link to continue.",
|
|
76
76
|
"The data source link is unavailable. Please, make sure there is an access to the data source.": "Enter an accessible Data Source Link to contiue.",
|
|
77
77
|
"The file should not exceed the maximum resolution of {maxImageResolution}px.": "Upload files up to 1024x512 pixels to continue.",
|
|
78
|
-
"The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor."
|
|
78
|
+
"The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor.",
|
|
79
|
+
"Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit."
|
|
79
80
|
};
|
|
80
81
|
export {
|
|
81
82
|
e as default
|
|
@@ -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,32 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
class
|
|
1
|
+
var x = Object.defineProperty;
|
|
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
|
-
|
|
15
|
-
|
|
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"))
|
|
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"), 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>`,
|
|
16
21
|
"text/html"
|
|
17
22
|
).querySelector(".radio-button-v2");
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
} catch (
|
|
21
|
-
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;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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}`);
|
|
27
49
|
if (!i)
|
|
28
50
|
return {
|
|
29
|
-
text:
|
|
51
|
+
text: t === "ins-title" ? "Title" : "Description",
|
|
30
52
|
isBold: !1,
|
|
31
53
|
isItalic: !1,
|
|
32
54
|
align: "left",
|
|
@@ -36,51 +58,51 @@ class T {
|
|
|
36
58
|
const s = i.querySelector("p");
|
|
37
59
|
if (!s)
|
|
38
60
|
return {
|
|
39
|
-
text: ((
|
|
61
|
+
text: ((p = i.textContent) == null ? void 0 : p.trim()) || (t === "ins-title" ? "Title" : "Description"),
|
|
40
62
|
isBold: !1,
|
|
41
63
|
isItalic: !1,
|
|
42
64
|
align: i.getAttribute("align") || "left",
|
|
43
65
|
styles: "",
|
|
44
66
|
classList: ""
|
|
45
67
|
};
|
|
46
|
-
const o = ((
|
|
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") || "";
|
|
47
69
|
return {
|
|
48
70
|
text: o,
|
|
49
|
-
isBold:
|
|
50
|
-
isItalic:
|
|
51
|
-
align:
|
|
52
|
-
styles:
|
|
53
|
-
classList:
|
|
71
|
+
isBold: a,
|
|
72
|
+
isItalic: g,
|
|
73
|
+
align: n,
|
|
74
|
+
styles: u,
|
|
75
|
+
classList: d
|
|
54
76
|
};
|
|
55
77
|
}
|
|
56
|
-
buildTextBlock(
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
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('"', "'")}"` : "";
|
|
60
82
|
return `
|
|
61
|
-
<td class="esd-block-text ${
|
|
83
|
+
<td class="esd-block-text ${e.classList}" ${i}>
|
|
62
84
|
<p path="1" ${s}>
|
|
63
|
-
${
|
|
85
|
+
${t}
|
|
64
86
|
</p>
|
|
65
87
|
</td>
|
|
66
88
|
`;
|
|
67
89
|
}
|
|
68
|
-
removeStyleProperties(
|
|
69
|
-
return
|
|
70
|
-
const
|
|
71
|
-
return s.replace(
|
|
72
|
-
},
|
|
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() : "";
|
|
73
95
|
}
|
|
74
|
-
convertInlineToBlock(
|
|
75
|
-
if (!
|
|
96
|
+
convertInlineToBlock(e) {
|
|
97
|
+
if (!e)
|
|
76
98
|
return "";
|
|
77
|
-
let
|
|
78
|
-
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();
|
|
79
101
|
}
|
|
80
102
|
}
|
|
81
|
-
function
|
|
82
|
-
return new
|
|
103
|
+
function q(l) {
|
|
104
|
+
return new B().migrate(l);
|
|
83
105
|
}
|
|
84
106
|
export {
|
|
85
|
-
|
|
107
|
+
q as migrateRadioButton
|
|
86
108
|
};
|
|
@@ -13,7 +13,7 @@ class B {
|
|
|
13
13
|
migrate(e) {
|
|
14
14
|
try {
|
|
15
15
|
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
|
|
16
|
-
'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
|
|
16
|
+
'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
|
|
17
17
|
);
|
|
18
18
|
return w().$patch((i) => {
|
|
19
19
|
i.migrations = { ...i.migrations, [S]: s.length };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const s = {
|
|
2
2
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
3
|
-
}, i =
|
|
3
|
+
}, i = {
|
|
4
|
+
CLIENT_ID: "clientId"
|
|
5
|
+
}, u = [
|
|
4
6
|
{ id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
|
|
5
7
|
{ id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
|
|
6
8
|
{ id: 13, key: "userBased", name: "User Based", path: "user-based" },
|
|
@@ -11,13 +13,13 @@ const s = {
|
|
|
11
13
|
{ id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
|
|
12
14
|
{ id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
|
|
13
15
|
{ id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
|
|
14
|
-
],
|
|
16
|
+
], l = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], c = [
|
|
15
17
|
{ text: "before the amount", value: "0" },
|
|
16
18
|
{ text: "after the amount", value: "1" }
|
|
17
|
-
],
|
|
19
|
+
], d = [
|
|
18
20
|
{ text: "dot(.)", value: "." },
|
|
19
21
|
{ text: "comma(,)", value: "," }
|
|
20
|
-
],
|
|
22
|
+
], p = [
|
|
21
23
|
{ text: "0", value: "0" },
|
|
22
24
|
{ text: "1", value: "1" },
|
|
23
25
|
{ text: "2", value: "2" },
|
|
@@ -46,7 +48,7 @@ const s = {
|
|
|
46
48
|
], n = [
|
|
47
49
|
{ text: "true", value: "==" },
|
|
48
50
|
{ text: "false", value: "!=" }
|
|
49
|
-
],
|
|
51
|
+
], m = (t) => {
|
|
50
52
|
if (!t)
|
|
51
53
|
return e;
|
|
52
54
|
switch (t) {
|
|
@@ -65,13 +67,14 @@ const s = {
|
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
export {
|
|
68
|
-
|
|
69
|
-
i as
|
|
70
|
+
l as PriceAttributes,
|
|
71
|
+
i as QUERY_PARAMS,
|
|
72
|
+
u as RecommendationFeedSourceMaps,
|
|
70
73
|
s as URLS,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
p as currencyDecimalCounts,
|
|
75
|
+
c as currencyLocationMaps,
|
|
76
|
+
d as currencyOperators,
|
|
77
|
+
m as getOperatorOptions,
|
|
75
78
|
a as operatorOptionsForArrayOfStrings,
|
|
76
79
|
n as operatorOptionsForBooleans,
|
|
77
80
|
o as operatorOptionsForDates,
|
|
@@ -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: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
-
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
31
|
+
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
+
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[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
|
};
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { getItemsBlockConfig as I, setItemsBlockConfig as
|
|
6
|
-
const
|
|
1
|
+
import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as A } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as R } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const u = T.PRICE_SINGLE_PRICE, l = {
|
|
7
7
|
SINGLE_PRICE: "singlePrice"
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class k extends A {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return u;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
15
|
-
<div class="container ${
|
|
15
|
+
<div class="container ${T.PRICE_SINGLE_PRICE}">
|
|
16
16
|
${this._getSinglePrice()}
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
21
|
const e = I(this.currentNode);
|
|
22
|
-
this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (
|
|
23
|
-
this._onSinglePriceChange(
|
|
22
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
|
|
23
|
+
this._onSinglePriceChange(i);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
onTemplateNodeUpdated(e) {
|
|
27
27
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const
|
|
29
|
-
this.api.updateValues({ [l.SINGLE_PRICE]: (
|
|
28
|
+
const i = I(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
_onSinglePriceChange(e) {
|
|
33
|
-
if (console.debug("Single price changed to: ", e),
|
|
33
|
+
if (console.debug("Single price changed to: ", e), !this.currentNode)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
36
|
-
r ?
|
|
37
|
-
r ?
|
|
35
|
+
const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
|
|
36
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
|
|
37
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
|
|
38
38
|
] : [
|
|
39
|
-
r ?
|
|
40
|
-
r ?
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}), ((n == null ? void 0 : n.querySelectorAll(
|
|
47
|
-
`[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
|
|
39
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
|
|
40
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
|
|
41
|
+
], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
|
|
42
|
+
N(this.currentNode, this.api, { priceSinglePrice: e }, s);
|
|
43
|
+
const o = this.currentNode.closest(".items-block");
|
|
44
|
+
((o == null ? void 0 : o.querySelectorAll(
|
|
45
|
+
`[esd-extension-block-id="${p.PRICE}"]`
|
|
48
46
|
)) || []).forEach((a) => {
|
|
49
|
-
this._updatePriceBlock(
|
|
50
|
-
}),
|
|
47
|
+
this._updatePriceBlock(s, a, E, g, e);
|
|
48
|
+
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
49
|
+
`[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
|
|
50
|
+
)) || []).forEach((a) => {
|
|
51
|
+
this._updatePriceBlock(s, a, L, C, e);
|
|
52
|
+
}), s.apply(new S(
|
|
51
53
|
`Updated price to ${e ? "single" : "total"} price`
|
|
52
54
|
));
|
|
53
55
|
}
|
|
54
|
-
_updatePriceBlock(e,
|
|
55
|
-
const
|
|
56
|
-
e.modifyHtml(
|
|
57
|
-
e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
|
|
58
|
-
});
|
|
56
|
+
_updatePriceBlock(e, i, c, r, t) {
|
|
57
|
+
const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
|
|
58
|
+
e.modifyHtml(i).setInnerHtml(E);
|
|
59
59
|
}
|
|
60
60
|
_getSinglePrice() {
|
|
61
61
|
return `
|
|
62
62
|
<div class="display-flex align-items-center justify-content-between">
|
|
63
|
-
<${
|
|
64
|
-
${
|
|
63
|
+
<${d.LABEL}
|
|
64
|
+
${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
|
|
65
65
|
>
|
|
66
|
-
</${
|
|
66
|
+
</${d.LABEL}>
|
|
67
67
|
${this._GuToggle(l.SINGLE_PRICE)}
|
|
68
68
|
</div>
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
u as CONTROL_BLOCK_ID,
|
|
74
|
+
k as PriceSinglePriceControl
|
|
75
75
|
};
|