@useinsider/guido 3.1.1-beta.e00a22b → 3.1.1-beta.e4aa789
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/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +20 -15
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useRecommendation.js +2 -2
- package/dist/composables/useStripo.js +6 -6
- package/dist/config/compiler/recommendationCompilerRules.js +158 -44
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
- package/dist/enums/displayConditions.js +82 -78
- package/dist/enums/extensions/recommendationBlock.js +96 -39
- package/dist/enums/recommendation.js +2 -2
- package/dist/enums/unsubscribe.js +17 -16
- package/dist/extensions/Blocks/Checkbox/control.js +23 -23
- package/dist/extensions/Blocks/RadioButton/control.js +15 -15
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +12 -14
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/enums/displayConditions.d.ts +5 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/utils/templatePreparation.js +34 -25
- package/package.json +1 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
3
|
-
import { prepareRecommendationBlocks as
|
|
4
|
-
const
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as C, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as R, CONDITIONS as $, HTML as h } from "../../enums/recommendation.js";
|
|
3
|
+
import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
|
|
4
|
+
const w = [
|
|
5
5
|
{
|
|
6
6
|
id: "replace-images-with-variable-names",
|
|
7
7
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
8
|
type: "custom",
|
|
9
|
-
processor: (
|
|
10
|
-
let
|
|
11
|
-
return Object.entries(
|
|
12
|
-
Object.entries(
|
|
13
|
-
|
|
9
|
+
processor: (i) => {
|
|
10
|
+
let e = i;
|
|
11
|
+
return Object.entries(C).forEach(([, p]) => {
|
|
12
|
+
Object.entries(p).forEach(([c, n]) => {
|
|
13
|
+
e = e.replaceAll(n, `{{${c}}}`);
|
|
14
14
|
});
|
|
15
|
-
}),
|
|
15
|
+
}), e;
|
|
16
16
|
},
|
|
17
17
|
priority: 50
|
|
18
18
|
},
|
|
@@ -29,21 +29,21 @@ const G = [
|
|
|
29
29
|
id: "add-recommendation-unresponsive-css",
|
|
30
30
|
description: "Adding recommendation unresponsive css",
|
|
31
31
|
type: "custom",
|
|
32
|
-
processor: (
|
|
33
|
-
const { calculateCardWidth:
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
const
|
|
43
|
-
|
|
32
|
+
processor: (i) => {
|
|
33
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: p } = N();
|
|
34
|
+
let c = i;
|
|
35
|
+
const n = c.match(T.ID);
|
|
36
|
+
if (n) {
|
|
37
|
+
const a = [];
|
|
38
|
+
if (n.forEach((s) => {
|
|
39
|
+
const d = /recommendation-id="(.*?)"/i.exec(s), _ = d ? d[1].trim() : "", A = p(_);
|
|
40
|
+
A.textTrimming && A.orientation === M && a.push(e(A));
|
|
41
|
+
}), a.length) {
|
|
42
|
+
const s = `width:${Math.min(...a)}px!important;`;
|
|
43
|
+
c = c.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return c;
|
|
47
47
|
},
|
|
48
48
|
priority: 52
|
|
49
49
|
},
|
|
@@ -51,39 +51,153 @@ const G = [
|
|
|
51
51
|
id: "prepare-recommendations",
|
|
52
52
|
description: "Replacing product data with template variables in recommendation blocks",
|
|
53
53
|
type: "custom",
|
|
54
|
-
processor: (
|
|
54
|
+
processor: (i) => x(i),
|
|
55
55
|
priority: 48
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
id: "add-discount-conditions",
|
|
59
59
|
description: "Adding discount conditions to the recommendation block",
|
|
60
60
|
type: "custom",
|
|
61
|
-
processor: (
|
|
62
|
-
let
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
61
|
+
processor: (i) => {
|
|
62
|
+
let e = i;
|
|
63
|
+
const p = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: c } = N();
|
|
64
|
+
return p !== null && p.forEach((n) => {
|
|
65
|
+
const a = n.match(T.CUSTOM_FIELD);
|
|
66
|
+
if (!a)
|
|
67
67
|
return;
|
|
68
|
-
const [
|
|
69
|
-
if (!
|
|
68
|
+
const [s] = a, d = s.match(T.CUSTOM_FIELD_INDEXES_PART), _ = s.match(T.CUSTOM_FIELD_NAME_PART), A = n.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
|
+
if (!d || !_ || !A)
|
|
70
70
|
return;
|
|
71
|
-
const [
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
71
|
+
const [I] = d, [S] = _, [m] = A, o = S.substring(1, S.length - 2), r = m.match(T.COMPOSITION) !== null;
|
|
72
|
+
let t = s;
|
|
73
|
+
if (r) {
|
|
74
|
+
const b = I.substring(2, I.length - 3), l = c(b);
|
|
75
|
+
o === R.OMNIBUS_PRICE && (l.priceBeforeTextValue && (t = `${l.priceBeforeTextValue}${t}`), l.priceAfterTextValue && (t = `${t}${l.priceAfterTextValue}`)), o === R.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (t = `${l.discountBeforeTextValue}${t}`), l.discountAfterTextValue && (t = `${t}${l.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
}),
|
|
77
|
+
const u = I.substring(2);
|
|
78
|
+
let f = "";
|
|
79
|
+
o in $.IF && (f = $.IF[o].replaceAll(`{${R.DISCOUNT}}`, `${u}${R.DISCOUNT}`).replaceAll(`{${R.OMNIBUS_DISCOUNT}}`, `${u}${R.OMNIBUS_DISCOUNT}`).replaceAll(`{${R.OMNIBUS_PRICE}}`, `${u}${R.OMNIBUS_PRICE}`));
|
|
80
|
+
const g = `${m}${t}${h.PARAGRAPH_END_TAG}`, y = `${f}${r ? g : n}${$.ELSE}${m}${h.PARAGRAPH_END_TAG}${$.END_IF}`;
|
|
81
|
+
e = e.replace(n, y);
|
|
82
|
+
}), e;
|
|
83
83
|
},
|
|
84
84
|
priority: 53
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "strip-empty-omnibus-spans",
|
|
88
|
+
description: "Remove empty omnibus text-before and text-after span elements",
|
|
89
|
+
type: "regex",
|
|
90
|
+
pattern: '<span class="omnibus-text-(?:before|after)">\\s*</span>',
|
|
91
|
+
replacement: "",
|
|
92
|
+
flags: "g",
|
|
93
|
+
priority: 54
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "strip-recommendation-editor-attributes",
|
|
97
|
+
description: "Strip editor-only attributes from compiled recommendation output",
|
|
98
|
+
type: "regex",
|
|
99
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
100
|
+
pattern: '\\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"',
|
|
101
|
+
replacement: "",
|
|
102
|
+
flags: "g",
|
|
103
|
+
priority: 55
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "strip-unused-recommendation-classes",
|
|
107
|
+
description: "Remove CSS classes not referenced by any style rule from recommendation elements",
|
|
108
|
+
type: "custom",
|
|
109
|
+
processor: (i) => {
|
|
110
|
+
let e = i.replace(
|
|
111
|
+
/ class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
|
|
112
|
+
""
|
|
113
|
+
);
|
|
114
|
+
return e = e.replaceAll("es-button buy-button", "es-button"), e = e.replaceAll("ins-recommendation-product-container ", ""), e;
|
|
115
|
+
},
|
|
116
|
+
priority: 56
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "remove-empty-mobile-layout-artifacts",
|
|
120
|
+
description: "Remove empty mobile container rows and unused mobile layout CSS",
|
|
121
|
+
type: "custom",
|
|
122
|
+
processor: (i) => {
|
|
123
|
+
let e = i;
|
|
124
|
+
return e = e.replace(
|
|
125
|
+
/<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
|
|
126
|
+
""
|
|
127
|
+
), /class="[^"]*ins-recommendation-mobile-container/.test(e) || (e = e.replace(
|
|
128
|
+
/\.ins-recommendation-mobile-container\s*\{\s*display\s*:\s*none\s*;?\s*\}/g,
|
|
129
|
+
""
|
|
130
|
+
), e = e.replace(
|
|
131
|
+
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
132
|
+
(p, c) => {
|
|
133
|
+
const n = c.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
134
|
+
return n.every((d) => a.test(d)) ? "" : p;
|
|
135
|
+
}
|
|
136
|
+
)), e;
|
|
137
|
+
},
|
|
138
|
+
priority: 57
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "deduplicate-inline-styles",
|
|
142
|
+
description: "Replace repeated inline styles with CSS class references within recommendation blocks",
|
|
143
|
+
type: "custom",
|
|
144
|
+
processor: (i) => {
|
|
145
|
+
const e = i.replace(
|
|
146
|
+
/<a\b[^>]*\bes-button\b[^>]*>/g,
|
|
147
|
+
(o) => o.replace(
|
|
148
|
+
/([;"]color:)([^;"]+)/g,
|
|
149
|
+
(r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
|
|
150
|
+
)
|
|
151
|
+
), p = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, c = / style="([^"]*)"/g, n = /* @__PURE__ */ new Map();
|
|
152
|
+
let a = p.exec(e);
|
|
153
|
+
for (; a !== null; ) {
|
|
154
|
+
let o = c.exec(a[1]);
|
|
155
|
+
for (; o !== null; ) {
|
|
156
|
+
const [, r] = o;
|
|
157
|
+
n.set(r, (n.get(r) || 0) + 1), o = c.exec(a[1]);
|
|
158
|
+
}
|
|
159
|
+
c.lastIndex = 0, a = p.exec(e);
|
|
160
|
+
}
|
|
161
|
+
const s = /* @__PURE__ */ new Map(), d = [];
|
|
162
|
+
let _ = 0;
|
|
163
|
+
if (n.forEach((o, r) => {
|
|
164
|
+
if (o >= 6) {
|
|
165
|
+
const t = `rc${_++}`;
|
|
166
|
+
s.set(r, t), d.push(`.${t}{${r}}`);
|
|
167
|
+
}
|
|
168
|
+
}), s.size === 0) {
|
|
169
|
+
let o = e;
|
|
170
|
+
return o = o.replaceAll("<!--REC_START-->", ""), o = o.replaceAll("<!--REC_END-->", ""), o;
|
|
171
|
+
}
|
|
172
|
+
const A = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), I = (o, r) => `${o.slice(0, -1)} ${r}"`, S = /* @__PURE__ */ new Map();
|
|
173
|
+
s.forEach((o, r) => {
|
|
174
|
+
const t = A(r);
|
|
175
|
+
S.set(r, {
|
|
176
|
+
caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${t}"`, "g"),
|
|
177
|
+
caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
let m = e.replace("</style>", `${d.join("")}</style>`);
|
|
181
|
+
return m = m.replace(
|
|
182
|
+
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
183
|
+
(o, r) => {
|
|
184
|
+
let t = r;
|
|
185
|
+
return s.forEach((u, f) => {
|
|
186
|
+
const g = S.get(f);
|
|
187
|
+
t = t.replace(
|
|
188
|
+
g.caseA,
|
|
189
|
+
(y, b, l) => I(b, u) + l
|
|
190
|
+
), t = t.replace(
|
|
191
|
+
g.caseB,
|
|
192
|
+
(y, b, l) => b + I(l, u)
|
|
193
|
+
), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
|
|
194
|
+
}), t;
|
|
195
|
+
}
|
|
196
|
+
), m = m.replaceAll("<!--REC_START-->", ""), m = m.replaceAll("<!--REC_END-->", ""), m;
|
|
197
|
+
},
|
|
198
|
+
priority: 58
|
|
85
199
|
}
|
|
86
200
|
];
|
|
87
201
|
export {
|
|
88
|
-
|
|
202
|
+
w as recommendationCompilerRules
|
|
89
203
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
function y(e, u, r, o, s = "") {
|
|
4
|
+
const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
|
|
4
5
|
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
5
6
|
}
|
|
6
|
-
function p(e, u, r, o, n) {
|
|
7
|
+
function p(e, u, r, o, s, n) {
|
|
7
8
|
switch (u) {
|
|
8
9
|
case "productImage": {
|
|
9
10
|
const t = e.querySelector("img");
|
|
10
|
-
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
11
|
+
t && (t.setAttribute("src", `{{${n}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${r}_${o}_name}}`));
|
|
11
12
|
const c = e.querySelector("a");
|
|
12
|
-
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
13
|
+
c && c.setAttribute("href", `{{${n}${r}_${o}_url}}`);
|
|
13
14
|
break;
|
|
14
15
|
}
|
|
15
16
|
case "productName": {
|
|
16
17
|
const t = e.querySelector("p");
|
|
17
18
|
if (t) {
|
|
18
19
|
const c = t.querySelector("strong") || t;
|
|
19
|
-
c.textContent = `{{${r}_${o}_name}}`;
|
|
20
|
+
c.textContent = `{{${n}${r}_${o}_name}}`;
|
|
20
21
|
}
|
|
21
22
|
break;
|
|
22
23
|
}
|
|
@@ -24,7 +25,7 @@ function p(e, u, r, o, n) {
|
|
|
24
25
|
const t = e.querySelector("p");
|
|
25
26
|
if (t) {
|
|
26
27
|
const c = t.querySelector("strong") || t;
|
|
27
|
-
c.textContent =
|
|
28
|
+
c.textContent = y(r, o, "price", s, n);
|
|
28
29
|
}
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
@@ -32,10 +33,11 @@ function p(e, u, r, o, n) {
|
|
|
32
33
|
const t = e.querySelector("p");
|
|
33
34
|
if (t) {
|
|
34
35
|
const c = t.querySelector("strong") || t;
|
|
35
|
-
c.textContent =
|
|
36
|
+
c.textContent = y(
|
|
36
37
|
r,
|
|
37
38
|
o,
|
|
38
39
|
"original_price",
|
|
40
|
+
s,
|
|
39
41
|
n
|
|
40
42
|
), t.setAttribute("product-attr", "discount");
|
|
41
43
|
}
|
|
@@ -43,13 +45,13 @@ function p(e, u, r, o, n) {
|
|
|
43
45
|
}
|
|
44
46
|
case "productButton": {
|
|
45
47
|
const t = e.querySelector("a");
|
|
46
|
-
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
48
|
+
t && t.setAttribute("href", `{{${n}${r}_${o}_url}}`);
|
|
47
49
|
break;
|
|
48
50
|
}
|
|
49
51
|
case "productOmnibusPrice": {
|
|
50
52
|
const t = e.querySelector(".omnibus-price-value");
|
|
51
53
|
if (t) {
|
|
52
|
-
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
54
|
+
t.textContent = `{{${n}${r}_${o}_omnibus_price}}`;
|
|
53
55
|
const c = t.closest("p");
|
|
54
56
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
55
57
|
}
|
|
@@ -58,7 +60,7 @@ function p(e, u, r, o, n) {
|
|
|
58
60
|
case "productOmnibusDiscount": {
|
|
59
61
|
const t = e.querySelector(".omnibus-discount-value");
|
|
60
62
|
if (t) {
|
|
61
|
-
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
63
|
+
t.textContent = `{{${n}${r}_${o}_omnibus_discount}}`;
|
|
62
64
|
const c = t.closest("p");
|
|
63
65
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
64
66
|
}
|
|
@@ -67,66 +69,67 @@ function p(e, u, r, o, n) {
|
|
|
67
69
|
default: {
|
|
68
70
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
69
71
|
if (t) {
|
|
70
|
-
const c = t.getAttribute("product-attr"),
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const c = t.getAttribute("product-attr"), i = t.querySelector("p");
|
|
73
|
+
if (i) {
|
|
74
|
+
const a = i.querySelector("strong") || i;
|
|
75
|
+
a.textContent = `{{${n}${r}_${o}_${c}}}`;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
break;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
function
|
|
82
|
+
function d(e, u, r, o) {
|
|
81
83
|
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
82
|
-
n.querySelectorAll("[data-attribute-type]").forEach((
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
p(
|
|
86
|
-
}) : p(
|
|
84
|
+
n.querySelectorAll("[data-attribute-type]").forEach((i) => {
|
|
85
|
+
const a = i.getAttribute("data-attribute-type") || "", b = i.querySelectorAll(".attribute-cell");
|
|
86
|
+
b.length > 0 ? b.forEach((l) => {
|
|
87
|
+
p(l, a, u, t, r, o);
|
|
88
|
+
}) : p(i, a, u, t, r, o);
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
92
|
+
function q(e, u, r, o) {
|
|
93
|
+
const s = e.querySelectorAll(".recommendation-product-row");
|
|
94
|
+
if (!s.length)
|
|
93
95
|
return;
|
|
94
|
-
const [n] =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
p(
|
|
96
|
+
const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
97
|
+
s.forEach((i, a) => {
|
|
98
|
+
i.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
99
|
+
const m = l.getAttribute("data-attribute-type") || "";
|
|
100
|
+
l.querySelectorAll(".attribute-cell").forEach(($, f) => {
|
|
101
|
+
const A = a * c + f;
|
|
102
|
+
p($, m, u, A, r, o);
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
|
-
function
|
|
107
|
+
function g(e, u, r, o) {
|
|
106
108
|
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
107
|
-
|
|
109
|
+
q(n, u, r, o);
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
112
|
+
function h(e, u, r) {
|
|
113
|
+
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
114
|
+
o === "list" ? d(e, u, s, r) : g(e, u, s, r);
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function C(e, u) {
|
|
115
117
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
116
118
|
return (r ? `${r[0]}
|
|
117
119
|
` : "") + u.documentElement.outerHTML;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
121
|
+
function P(e) {
|
|
120
122
|
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
121
123
|
if (!o.length)
|
|
122
124
|
return e;
|
|
123
|
-
const { buildCampaignUrl: n } =
|
|
124
|
-
return o.forEach((
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const { buildCampaignUrl: s } = _(), { isFeatureEnabled: n } = S(), t = n("liquidSyntax") ? "reco_" : "";
|
|
126
|
+
return o.forEach((i) => {
|
|
127
|
+
var b, l;
|
|
128
|
+
const a = i.getAttribute("recommendation-id");
|
|
129
|
+
a && ((b = i.parentNode) == null || b.insertBefore(r.createComment("REC_START"), i), (l = i.parentNode) == null || l.insertBefore(r.createComment("REC_END"), i.nextSibling), s(a), h(i, a, t));
|
|
130
|
+
}), C(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
128
131
|
}
|
|
129
132
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
y as formatPriceVariable,
|
|
134
|
+
P as prepareRecommendationBlocks
|
|
132
135
|
};
|
|
@@ -1,80 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
+
};
|
|
78
82
|
export {
|
|
79
|
-
|
|
83
|
+
t as getDisplayConditions
|
|
80
84
|
};
|