@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.
Files changed (28) hide show
  1. package/dist/components/Guido.vue.js +4 -4
  2. package/dist/components/Guido.vue2.js +91 -81
  3. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  4. package/dist/components/organisms/header/EditorActions.vue2.js +20 -15
  5. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  6. package/dist/composables/useRecommendation.js +2 -2
  7. package/dist/composables/useStripo.js +6 -6
  8. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  9. package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
  10. package/dist/enums/displayConditions.js +82 -78
  11. package/dist/enums/extensions/recommendationBlock.js +96 -39
  12. package/dist/enums/recommendation.js +2 -2
  13. package/dist/enums/unsubscribe.js +17 -16
  14. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  15. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
  17. package/dist/guido.css +1 -1
  18. package/dist/services/recommendationApi.js +12 -14
  19. package/dist/services/templateLibraryApi.js +48 -46
  20. package/dist/src/@types/save-as-template.d.ts +1 -0
  21. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  22. package/dist/src/enums/displayConditions.d.ts +5 -1
  23. package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
  24. package/dist/src/enums/unsubscribe.d.ts +8 -3
  25. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  26. package/dist/static/styles/base.css.js +7 -2
  27. package/dist/utils/templatePreparation.js +34 -25
  28. package/package.json +1 -2
@@ -1,18 +1,18 @@
1
- import { useRecommendation as f } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as P, REGEX as m, VerticalOrientation as g, CSS as e, ATTRIBUTES as a, CONDITIONS as A, HTML as h } from "../../enums/recommendation.js";
3
- import { prepareRecommendationBlocks as D } from "./utils/recommendationCompilerUtils.js";
4
- const G = [
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: (s) => {
10
- let t = s;
11
- return Object.entries(P).forEach(([, l]) => {
12
- Object.entries(l).forEach(([n, o]) => {
13
- t = t.replaceAll(o, `{{${n}}}`);
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
- }), t;
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: (s) => {
33
- const { calculateCardWidth: t, getRecommendationCampaignData: l } = f();
34
- let n = s;
35
- const o = n.match(m.ID);
36
- if (o) {
37
- const d = [];
38
- if (o.forEach((c) => {
39
- const E = /recommendation-id="(.*?)"/i.exec(c), I = E ? E[1].trim() : "", p = l(I);
40
- p.textTrimming && p.orientation === g && d.push(t(p));
41
- }), d.length) {
42
- const c = `width:${Math.min(...d)}px!important;`;
43
- n = n.replace(e.REGULAR_NAME_HEIGHT, `${e.TRIMMED_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.REGULAR_NAME_CONTAINER_HEIGHT, e.TRIMMED_NAME_CONTAINER_CSS).replace(e.RESPONSIVE_NAME_SIZE, `${e.RESPONSIVE_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.RESPONSIVE_NAME_CONTAINER_HEIGHT, e.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
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 n;
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: (s) => D(s),
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: (s) => {
62
- let t = s;
63
- const l = t.match(m.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = f();
64
- return l !== null && l.forEach((o) => {
65
- const d = o.match(m.CUSTOM_FIELD);
66
- if (!d)
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 [c] = d, E = c.match(m.CUSTOM_FIELD_INDEXES_PART), I = c.match(m.CUSTOM_FIELD_NAME_PART), p = o.match(m.ATTRIBUTE_PARAGRAPH_START_TAG);
69
- if (!E || !I || !p)
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 [u] = E, [R] = I, [_] = p, T = R.substring(1, R.length - 2), S = _.match(m.COMPOSITION) !== null;
72
- let i = c;
73
- if (S) {
74
- const $ = u.substring(2, u.length - 3), r = n($);
75
- T === a.OMNIBUS_PRICE && (r.priceBeforeTextValue && (i = `${r.priceBeforeTextValue}${i}`), r.priceAfterTextValue && (i = `${i}${r.priceAfterTextValue}`)), T === a.OMNIBUS_DISCOUNT && (r.discountBeforeTextValue && (i = `${r.discountBeforeTextValue}${i}`), r.discountAfterTextValue && (i = `${i}${r.discountAfterTextValue}`));
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 N = u.substring(2);
78
- let M = "";
79
- T in A.IF && (M = A.IF[T].replaceAll(`{${a.DISCOUNT}}`, `${N}${a.DISCOUNT}`).replaceAll(`{${a.OMNIBUS_DISCOUNT}}`, `${N}${a.OMNIBUS_DISCOUNT}`).replaceAll(`{${a.OMNIBUS_PRICE}}`, `${N}${a.OMNIBUS_PRICE}`));
80
- const O = `${_}${i}${h.PARAGRAPH_END_TAG}`, C = `${M}${S ? O : o}${A.ELSE}${_}${h.PARAGRAPH_END_TAG}${A.END_IF}`;
81
- t = t.replace(o, C);
82
- }), t;
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
- G as recommendationCompilerRules
202
+ w as recommendationCompilerRules
89
203
  };
@@ -1,22 +1,23 @@
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}}`;
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 = b(r, o, "price", n);
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 = b(
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"), s = t.querySelector("p");
71
- if (s) {
72
- const i = s.querySelector("strong") || s;
73
- i.textContent = `{{${r}_${o}_${c}}}`;
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 S(e, u, r) {
82
+ function d(e, u, r, o) {
81
83
  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);
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 _(e, u, r) {
91
- const o = e.querySelectorAll(".recommendation-product-row");
92
- if (!o.length)
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] = 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);
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 q(e, u, r) {
107
+ function g(e, u, r, o) {
106
108
  e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
107
- _(n, u, r);
109
+ q(n, u, r, o);
108
110
  });
109
111
  }
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);
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 g(e, u) {
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 E(e) {
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((c) => {
125
- const s = c.getAttribute("recommendation-id");
126
- s && (n(s), d(c, s));
127
- }), g(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
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("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
128
131
  }
129
132
  export {
130
- b as formatPriceVariable,
131
- E as prepareRecommendationBlocks
133
+ y as formatPriceVariable,
134
+ P as prepareRecommendationBlocks
132
135
  };
@@ -1,80 +1,84 @@
1
- const e = [
2
- {
3
- category: "Demographics",
4
- conditions: [
5
- {
6
- id: 1,
7
- name: "Language",
8
- description: "Users who are in the English will see the banner",
9
- beforeScript: '{% if language == "en_US" %}',
10
- afterScript: "{% endif %}"
11
- },
12
- {
13
- id: 2,
14
- name: "Country",
15
- description: "Only people who live in Australia will see the banner",
16
- beforeScript: '{% if country == "Australia" %}',
17
- afterScript: "{% endif %}"
18
- },
19
- {
20
- id: 3,
21
- name: "Country & City",
22
- description: "Only people who are located in that country and city",
23
- beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
24
- afterScript: "{% endif %}"
25
- },
26
- {
27
- id: 4,
28
- name: "Age (Less than operator)",
29
- description: "Users whose age is less than 18",
30
- beforeScript: "{% if age < 18 %}",
31
- afterScript: "{% endif %}"
32
- },
33
- {
34
- id: 5,
35
- name: "Age (Equal and greater than operator)",
36
- description: "Users whose age is equal or greater than 25",
37
- beforeScript: "{% if age >= 25 %}",
38
- afterScript: "{% endif %}"
39
- },
40
- {
41
- id: 6,
42
- name: "Age (Greater than & less than operators)",
43
- description: "Users whose age is between 18 and 25",
44
- beforeScript: "{% if age > 18 and age < 25 %}",
45
- afterScript: "{% endif %}"
46
- },
47
- {
48
- id: 7,
49
- name: "Gender",
50
- description: "Users whose gender is Female",
51
- beforeScript: '{% if gender == "Female" %}',
52
- afterScript: "{% endif %}"
53
- },
54
- {
55
- id: 8,
56
- name: "State",
57
- description: "Users whose state is one of the followings. c_state is a custom attribute. Use this condition if you have the attribute with the same naming. ",
58
- beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
59
- afterScript: "{% endif %}"
60
- },
61
- {
62
- id: 9,
63
- name: "VIP User",
64
- description: "Users who are VIP users for that brand. c_is_vip_user = true. c_is_vip_user is a custom attribute. Use this condition if you have the attribute with the same naming.",
65
- beforeScript: "{% if c_is_vip_user %}",
66
- afterScript: "{% endif %}"
67
- },
68
- {
69
- id: 10,
70
- name: "Membership Type",
71
- description: "Users who belong to gold or silver membership type. c_is_gold_member = true, c_is_silver_member = true. These are custom attributes. Use this condition if you have the attribute with the same naming.",
72
- beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
73
- afterScript: "{% endif %}"
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
- e as displayConditions
83
+ t as getDisplayConditions
80
84
  };