@useinsider/guido 3.1.1 → 3.2.0-beta.565bfaf

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 (82) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +91 -81
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  7. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  8. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  9. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  10. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  11. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  12. package/dist/composables/useHtmlCompiler.js +23 -21
  13. package/dist/composables/useHtmlValidator.js +40 -38
  14. package/dist/composables/usePreviewMode.js +20 -16
  15. package/dist/composables/useRecommendation.js +2 -2
  16. package/dist/composables/useSave.js +23 -15
  17. package/dist/composables/useStripo.js +44 -41
  18. package/dist/composables/validators/useLiquidValidator.js +42 -0
  19. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  20. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  21. package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
  22. package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
  23. package/dist/config/i18n/en/tooltips.json.js +2 -1
  24. package/dist/config/migrator/checkboxMigrator.js +5 -3
  25. package/dist/config/migrator/radioButtonMigrator.js +14 -12
  26. package/dist/enums/displayConditions.js +82 -78
  27. package/dist/enums/extensions/recommendationBlock.js +96 -39
  28. package/dist/enums/recommendation.js +2 -2
  29. package/dist/enums/unsubscribe.js +17 -16
  30. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  31. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  32. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  33. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  34. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  35. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  36. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
  37. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  38. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
  39. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  40. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  41. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  42. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  43. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
  44. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  45. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  46. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  47. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  48. package/dist/guido.css +1 -1
  49. package/dist/services/recommendationApi.js +15 -15
  50. package/dist/services/stripoApi.js +9 -9
  51. package/dist/services/templateLibraryApi.js +48 -46
  52. package/dist/src/@types/config/index.d.ts +1 -1
  53. package/dist/src/@types/config/schemas.d.ts +28 -0
  54. package/dist/src/@types/config/types.d.ts +3 -1
  55. package/dist/src/@types/generic.d.ts +0 -1
  56. package/dist/src/@types/save-as-template.d.ts +1 -0
  57. package/dist/src/composables/useConfig.d.ts +12 -0
  58. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  59. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  60. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  61. package/dist/src/enums/displayConditions.d.ts +5 -1
  62. package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
  63. package/dist/src/enums/unsubscribe.d.ts +8 -3
  64. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  65. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  66. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  68. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  69. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  70. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  71. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  72. package/dist/src/stores/config.d.ts +108 -0
  73. package/dist/src/stores/preview.d.ts +3 -0
  74. package/dist/src/utils/genericUtil.d.ts +1 -1
  75. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  76. package/dist/static/styles/base.css.js +7 -2
  77. package/dist/stores/preview.js +4 -3
  78. package/dist/utils/genericUtil.js +42 -20
  79. package/dist/utils/htmlCompiler.js +48 -41
  80. package/dist/utils/templatePreparation.js +36 -25
  81. package/dist/utils/tooltipUtils.js +4 -5
  82. package/package.json +2 -2
@@ -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
  };
@@ -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, u;
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 = ((u = r.textContent) == null ? void 0 : u.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"]), d = this.convertInlineToBlock(g);
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: d
52
+ styles: u
51
53
  };
52
54
  }
53
55
  buildTextBlock(t) {
@@ -1,28 +1,30 @@
1
- var b = Object.defineProperty;
2
- var f = (r, t, e) => t in r ? b(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var x = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
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
- x(this, "parser");
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
- const o = 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: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), y = this.parser.parseFromString(
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", o || ""), s.parentNode.replaceChild(y, s));
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 n, c;
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: ((n = i.textContent) == null ? void 0 : n.trim()) || (e === "ins-title" ? "Title" : "Description"),
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 o = ((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") || "";
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: o,
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, o) => {
70
- const l = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
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
  }
@@ -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
  };
@@ -1,41 +1,97 @@
1
- const s = {
1
+ import { useTranslations as a } from "../../composables/useTranslations.js";
2
+ const u = {
2
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
3
- }, i = [
4
- { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
5
- { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
6
- { id: 13, key: "userBased", name: "User Based", path: "user-based" },
7
- { id: 36, key: "highestDiscounted", name: "Highest Discounted Items", path: "highest-discounted" },
8
- { id: 38, key: "manualMerchandising", name: "Manual Merchandising", path: "manual-merchandising" },
9
- { id: 39, key: "newArrivals", name: "New Arrivals", path: "new-arrivals" },
10
- { id: 40, key: "trendingProducts", name: "Trending Products", path: "trending" },
11
- { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
12
- { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
13
- { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
14
- ], u = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], l = [
4
+ }, l = {
5
+ CLIENT_ID: "clientId"
6
+ }, c = () => {
7
+ const e = a();
8
+ return [
9
+ {
10
+ id: 11,
11
+ key: "similarViewed",
12
+ name: e("action-builder.similar-viewed"),
13
+ path: "viewed-together"
14
+ },
15
+ {
16
+ id: 12,
17
+ key: "similarBought",
18
+ name: e("action-builder.similar-bought"),
19
+ path: "purchased-together"
20
+ },
21
+ {
22
+ id: 13,
23
+ key: "userBased",
24
+ name: e("action-builder.user-based"),
25
+ path: "user-based"
26
+ },
27
+ {
28
+ id: 36,
29
+ key: "highestDiscounted",
30
+ name: e("journey-builder.highest-discounted-items"),
31
+ path: "highest-discounted"
32
+ },
33
+ {
34
+ id: 38,
35
+ key: "manualMerchandising",
36
+ name: e("action-builder.manual-merchandising"),
37
+ path: "manual-merchandising"
38
+ },
39
+ {
40
+ id: 39,
41
+ key: "newArrivals",
42
+ name: e("action-builder.new-arrivals"),
43
+ path: "new-arrivals"
44
+ },
45
+ {
46
+ id: 40,
47
+ key: "trendingProducts",
48
+ name: e("journey-builder.trending-products"),
49
+ path: "trending"
50
+ },
51
+ {
52
+ id: 46,
53
+ key: "mostValuableOfPartner",
54
+ name: e("journey-builder.most-valuable-products"),
55
+ path: "most-valuable"
56
+ },
57
+ {
58
+ id: 61,
59
+ key: "mostPopular",
60
+ name: e("journey-builder.most-popular-items"),
61
+ path: "most-popular"
62
+ },
63
+ {
64
+ id: 62,
65
+ key: "mostPurchased",
66
+ name: e("action-builder.most-purchased"),
67
+ path: "top-sellers"
68
+ }
69
+ ];
70
+ }, d = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], m = [
15
71
  { text: "before the amount", value: "0" },
16
72
  { text: "after the amount", value: "1" }
17
- ], c = [
73
+ ], p = [
18
74
  { text: "dot(.)", value: "." },
19
75
  { text: "comma(,)", value: "," }
20
- ], d = [
76
+ ], v = [
21
77
  { text: "0", value: "0" },
22
78
  { text: "1", value: "1" },
23
79
  { text: "2", value: "2" },
24
80
  { text: "3", value: "3" },
25
81
  { text: "4", value: "4" },
26
82
  { text: "5", value: "5" }
27
- ], e = [
83
+ ], t = [
28
84
  { text: "is exactly", value: "=" },
29
85
  { text: "contains", value: "~" },
30
86
  { text: "does not contain", value: "!~" },
31
87
  { text: "any of", value: "||" }
32
- ], a = [
88
+ ], r = [
33
89
  { text: "is exactly", value: "=" },
34
90
  { text: "is not exactly", value: "!==" },
35
91
  { text: "contains", value: "~" },
36
92
  { text: "does not contain", value: "!~" },
37
93
  { text: "any of", value: "||" }
38
- ], r = [
94
+ ], n = [
39
95
  { text: "is equal to", value: "=" },
40
96
  { text: "is greater than", value: ">" },
41
97
  { text: "is less than", value: "<" }
@@ -43,38 +99,39 @@ const s = {
43
99
  { text: "is equal to", value: "=" },
44
100
  { text: "after", value: ">" },
45
101
  { text: "before", value: "<" }
46
- ], n = [
102
+ ], s = [
47
103
  { text: "true", value: "==" },
48
104
  { text: "false", value: "!=" }
49
- ], p = (t) => {
50
- if (!t)
51
- return e;
52
- switch (t) {
105
+ ], h = (e) => {
106
+ if (!e)
107
+ return t;
108
+ switch (e) {
53
109
  case "Boolean":
54
- return n;
110
+ return s;
55
111
  case "Date":
56
112
  return o;
57
113
  case "Number":
58
- return r;
114
+ return n;
59
115
  case "String":
60
- return e;
116
+ return t;
61
117
  case "Strings":
62
- return a;
118
+ return r;
63
119
  default:
64
- return e;
120
+ return t;
65
121
  }
66
122
  };
67
123
  export {
68
- u as PriceAttributes,
69
- i as RecommendationFeedSourceMaps,
70
- s as URLS,
71
- d as currencyDecimalCounts,
72
- l as currencyLocationMaps,
73
- c as currencyOperators,
74
- p as getOperatorOptions,
75
- a as operatorOptionsForArrayOfStrings,
76
- n as operatorOptionsForBooleans,
124
+ d as PriceAttributes,
125
+ l as QUERY_PARAMS,
126
+ u as URLS,
127
+ v as currencyDecimalCounts,
128
+ m as currencyLocationMaps,
129
+ p as currencyOperators,
130
+ h as getOperatorOptions,
131
+ c as getRecommendationFeedSourceMaps,
132
+ r as operatorOptionsForArrayOfStrings,
133
+ s as operatorOptionsForBooleans,
77
134
  o as operatorOptionsForDates,
78
- r as operatorOptionsForNumbers,
79
- e as operatorOptionsForStrings
135
+ n as operatorOptionsForNumbers,
136
+ t as operatorOptionsForStrings
80
137
  };