@useinsider/guido 3.13.1 → 3.14.0-beta.1e474dd

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 (29) hide show
  1. package/dist/components/organisms/header/ViewOptions.vue.js +1 -1
  2. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
  3. package/dist/composables/useHtmlValidator.js +50 -50
  4. package/dist/config/i18n/en/labels.json.js +7 -3
  5. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  7. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +346 -314
  9. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -43
  10. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  11. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  12. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  13. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  14. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  15. package/dist/extensions/Blocks/common-control.js +42 -35
  16. package/dist/guido.css +1 -1
  17. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +12 -12
  18. package/dist/package.json.js +1 -1
  19. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  20. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  21. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  22. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  23. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +22 -5
  24. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  25. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +52 -0
  26. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  27. package/dist/static/styles/components/wide-panel.css.js +7 -0
  28. package/dist/static/styles/customEditorStyle.css.js +8 -0
  29. package/package.json +4 -4
@@ -10,7 +10,7 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "195ab6d4"
13
+ "87033101"
14
14
  );
15
15
  const c = a.exports;
16
16
  export {
@@ -10,7 +10,7 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "d405ca59"
13
+ "6ebabfe4"
14
14
  );
15
15
  const d = a.exports;
16
16
  export {
@@ -6,7 +6,7 @@ import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
6
  import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
7
7
  import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
8
8
  import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { resolveProductAttrValue as Q } from "../extensions/Blocks/Recommendation/templates/utils.js";
9
+ import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
10
10
  import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
11
11
  import { useRecommendationStore as te } from "../stores/recommendation.js";
12
12
  import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
@@ -14,25 +14,25 @@ import { useHttp as se } from "./useHttp.js";
14
14
  import { useToaster as re } from "./useToaster.js";
15
15
  import { useTranslations as oe } from "./useTranslations.js";
16
16
  const ie = /recommendation-id="(\d+)"/g;
17
- function ae(t) {
18
- return [...t.matchAll(ie)].map((m) => m[1]);
17
+ function ae(n) {
18
+ return [...n.matchAll(ie)].map((m) => m[1]);
19
19
  }
20
- function ce(t, m) {
21
- return m.some((f) => t.startsWith(`${f}_`));
20
+ function ce(n, m) {
21
+ return m.some((f) => n.startsWith(`${f}_`));
22
22
  }
23
23
  const le = /^(\d+)_\d+_(.+)$/;
24
- function me(t) {
25
- const m = t.match(le);
24
+ function me(n) {
25
+ const m = n.match(le);
26
26
  return m ? { recoId: m[1], attribute: m[2] } : null;
27
27
  }
28
- function ue(t) {
28
+ function ue(n) {
29
29
  const m = new Set(Z);
30
- return Object.values(t).forEach((f) => {
31
- m.add(Q(f.attributeName, t).toLowerCase());
30
+ return Object.values(n).forEach((f) => {
31
+ m.add(Q(f).toLowerCase());
32
32
  }), m;
33
33
  }
34
- function de(t, m, f, o, d) {
35
- const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
34
+ function de(n, m, f, o, d) {
35
+ const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
36
36
  if (!u)
37
37
  return [];
38
38
  const p = new Set(m.map((h) => h.toLowerCase())), E = [];
@@ -50,15 +50,15 @@ function de(t, m, f, o, d) {
50
50
  ce(g, f) || g.includes(".") || E.push(g);
51
51
  }), E;
52
52
  }
53
- function fe(t) {
54
- return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
53
+ function fe(n) {
54
+ return (n.replace(U, "$1").match(j) ?? []).filter((o) => {
55
55
  const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
56
56
  return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
57
57
  });
58
58
  }
59
59
  const xe = () => {
60
60
  var b, S;
61
- const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
61
+ const { showToaster: n } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
62
62
  if (e.size === 0)
63
63
  return /* @__PURE__ */ new Set();
64
64
  try {
@@ -68,59 +68,59 @@ const xe = () => {
68
68
  }
69
69
  return ue(u.filterList);
70
70
  }, h = async (e) => {
71
- const n = await m(
71
+ const t = await m(
72
72
  "/newsletter/template-library/check-template-html-body",
73
73
  { html: ne(e) }
74
- ), { status: r, message: a } = n.data;
75
- return r || t({
74
+ ), { status: r, message: a } = t.data;
75
+ return r || n({
76
76
  type: c.Error,
77
77
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
78
- }), o($), a === o(Y) && t({
78
+ }), o($), a === o(Y) && n({
79
79
  type: c.Error,
80
80
  message: o("newsletter.already-in-progress")
81
81
  }), r;
82
82
  }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
83
- const n = e.match(/({%(.*?)%})/g);
83
+ const t = e.match(/({%(.*?)%})/g);
84
84
  let r = !0;
85
- return n !== null && !p && n.forEach((a) => {
85
+ return t !== null && !p && t.forEach((a) => {
86
86
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
87
87
  if (i && i.length > 0) {
88
88
  const [l] = i;
89
- g(l) && !s.includes(l) && (t({
89
+ g(l) && !s.includes(l) && (n({
90
90
  type: c.Warning,
91
91
  message: o("custom-fields.invalid-custom-fields")
92
92
  }), r = !1);
93
93
  }
94
94
  }), r;
95
- }, w = async (e, s, n) => {
96
- const r = n ? await h(e) : !0;
95
+ }, w = async (e, s, t) => {
96
+ const r = t ? await h(e) : !0;
97
97
  return T(e, s) && r;
98
- }, R = (e) => e.length > 0 ? !0 : (t({
98
+ }, R = (e) => e.length > 0 ? !0 : (n({
99
99
  type: c.Warning,
100
100
  message: o("newsletter.html-content-is-empty")
101
101
  }), !1), _ = (e) => {
102
- const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
103
- return s > n && t({
102
+ const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
103
+ return s > t && n({
104
104
  type: c.Warning,
105
105
  message: o("custom-fields.missing-closing-braces")
106
- }), s < n && t({
106
+ }), s < t && n({
107
107
  type: c.Warning,
108
108
  message: o("custom-fields.missing-opening-braces")
109
- }), s === n;
109
+ }), s === t;
110
110
  }, N = (e) => {
111
111
  const s = fe(e).length === 0;
112
- return s || t({
112
+ return s || n({
113
113
  type: c.Warning,
114
114
  message: o("custom-fields.invalid-custom-fields")
115
115
  }), s;
116
- }, x = (e, s, n, r) => {
116
+ }, x = (e, s, t, r) => {
117
117
  if (p)
118
118
  return !0;
119
119
  const a = de(
120
120
  e,
121
121
  s,
122
122
  ae(e),
123
- n,
123
+ t,
124
124
  r
125
125
  );
126
126
  if (a.length > 0) {
@@ -129,56 +129,56 @@ const xe = () => {
129
129
  ${a.map((l) => `<li>${l}</li>`).join("")}
130
130
  </ul>
131
131
  `;
132
- return t({
132
+ return n({
133
133
  type: c.Error,
134
134
  message: o("custom-fields.invalid-custom-fields") + i
135
135
  }), !1;
136
136
  }
137
137
  return !0;
138
138
  }, O = (e) => {
139
- const s = e.match(/{%(.*?)%}/g), n = [];
139
+ const s = e.match(/{%(.*?)%}/g), t = [];
140
140
  let r = !0;
141
141
  if (s && s.forEach((a) => {
142
142
  const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
143
- (!i || a !== v) && !l && (t({
143
+ (!i || a !== v) && !l && (n({
144
144
  type: c.Error,
145
145
  message: o("newsletter.display-conditions-invalid-syntax")
146
146
  }), r = !1), i && i.forEach((C) => {
147
- C.trim() === "=" && (t({
147
+ C.trim() === "=" && (n({
148
148
  type: c.Error,
149
149
  message: o("custom-conditions.wrong-equality-operators")
150
150
  }), r = !1);
151
151
  const I = C.match(/^[a-zA-Z]*$/g);
152
152
  I && I.forEach((A) => {
153
- y(A) && n.push(A);
153
+ y(A) && t.push(A);
154
154
  });
155
155
  });
156
- }), n.length) {
157
- const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
158
- a.length !== i.length && (t({
156
+ }), t.length) {
157
+ const a = t.filter((l) => l === "if"), i = t.filter((l) => l === "endif");
158
+ a.length !== i.length && (n({
159
159
  type: c.Error,
160
160
  message: o("custom-conditions.missing-if-endif-tag")
161
161
  }), r = !1);
162
162
  }
163
163
  return r;
164
164
  }, k = (e) => {
165
- const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
166
- return r || t({
165
+ const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, r = s === t;
166
+ return r || n({
167
167
  type: c.Warning,
168
168
  message: o("custom-conditions.no-space-after-braces")
169
169
  }), r;
170
- }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
170
+ }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, r) => t + r, 0) > 0 ? (n({
171
171
  type: c.Warning,
172
172
  message: o("custom-conditions.no-braces-inside-if-tag")
173
- }), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
173
+ }), !1) : !0, D = () => u.hasInvalidBlock() ? (n({
174
174
  type: c.Error,
175
175
  message: o(ee)
176
- }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
176
+ }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (n({
177
177
  type: c.Error,
178
178
  message: o("newsletter.fill-all-necessary-fields")
179
179
  }), !1) : !0, L = (e) => {
180
180
  const s = /src="[^"]*\.(svg|pst)"/gm;
181
- return e.match(s) === null ? !0 : (t({
181
+ return e.match(s) === null ? !0 : (n({
182
182
  type: c.Error,
183
183
  message: o("newsletter.invalid-image-type")
184
184
  }), !1);
@@ -187,7 +187,7 @@ const xe = () => {
187
187
  return Array.from(r).find((i) => {
188
188
  var l;
189
189
  return !((l = i.id) != null && l.trim());
190
- }) ? (t({
190
+ }) ? (n({
191
191
  type: c.Error,
192
192
  message: o("unsubscribe-templates.select-checkbox-groups")
193
193
  }), !1) : !0;
@@ -196,19 +196,19 @@ const xe = () => {
196
196
  return Array.from(r).find((i) => {
197
197
  var l;
198
198
  return !((l = i.id) != null && l.trim());
199
- }) ? (t({
199
+ }) ? (n({
200
200
  type: c.Error,
201
201
  message: o("unsubscribe-templates.select-radio-button-groups")
202
202
  }), !1) : !0;
203
203
  };
204
- return { validateHtml: async (e, s, n = !1) => {
204
+ return { validateHtml: async (e, s, t = !1) => {
205
205
  var v, C;
206
206
  const r = [
207
207
  ...s.map((I) => I.value),
208
208
  ...z,
209
209
  ...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
210
210
  ], a = G(e), i = await E(a);
211
- return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
211
+ return await w(e, r, t) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
212
212
  } };
213
213
  };
214
214
  export {
@@ -1,4 +1,4 @@
1
- const e = "Items", o = {
1
+ const e = "Items", o = "Default", t = "Custom", s = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
3
  "Structures & Modules": "Structures and Modules",
4
4
  "Recommendation Block": "Recommendation",
@@ -7,9 +7,13 @@ const e = "Items", o = {
7
7
  "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
8
  "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
9
  "OPT-IN SELECTION": "OPT-IN SELECTION",
10
- "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
10
+ "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
11
+ Default: o,
12
+ Custom: t
11
13
  };
12
14
  export {
15
+ t as Custom,
16
+ o as Default,
13
17
  e as Items,
14
- o as default
18
+ s as default
15
19
  };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_COMPOSITION as d, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
2
  import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
3
  import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
4
  const C = "__title__", a = "product_attribute.";
@@ -23,19 +23,22 @@ function N(r) {
23
23
  return { key: k, kind: "button" };
24
24
  default:
25
25
  if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
- const s = r.value ?? "", o = s.startsWith(a) ? s.slice(a.length) : s;
27
- return o ? {
28
- key: `${l}${o}`,
26
+ const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
27
+ if (!s)
28
+ return null;
29
+ const e = o || `${a}${s}`;
30
+ return {
31
+ key: `${l}${e}`,
29
32
  kind: "custom",
30
- customAttrName: o,
31
- customAttrValue: s || `${a}${o}`
32
- } : null;
33
+ customAttrName: s,
34
+ customAttrValue: e
35
+ };
33
36
  }
34
37
  return null;
35
38
  }
36
39
  }
37
- function p(r) {
38
- const t = d.indexOf(r);
40
+ function _(r) {
41
+ const t = p.indexOf(r);
39
42
  return t === -1 ? Number.POSITIVE_INFINITY : t;
40
43
  }
41
44
  function S(r) {
@@ -48,8 +51,8 @@ function S(r) {
48
51
  anyTextTrimming: !1
49
52
  };
50
53
  if (!r || r.length === 0)
51
- return t.composition = [...d], t;
52
- const s = [];
54
+ return t.composition = [...p], t;
55
+ const o = [];
53
56
  r.forEach((e, i) => {
54
57
  const n = N(e);
55
58
  if (n) {
@@ -57,7 +60,7 @@ function S(r) {
57
60
  t.titleVariable = e;
58
61
  return;
59
62
  }
60
- s.push({
63
+ o.push({
61
64
  key: n.key,
62
65
  kind: n.kind,
63
66
  hidden: e.hidden === !0,
@@ -68,30 +71,30 @@ function S(r) {
68
71
  originalIndex: i
69
72
  });
70
73
  }
71
- }), s.sort((e, i) => {
74
+ }), o.sort((e, i) => {
72
75
  if (e.positionIdx !== i.positionIdx)
73
76
  return e.positionIdx - i.positionIdx;
74
- const n = p(e.key), u = p(i.key);
77
+ const n = _(e.key), u = _(i.key);
75
78
  return n !== u ? n - u : e.originalIndex - i.originalIndex;
76
79
  });
77
- const o = {};
78
- return s.forEach((e) => {
79
- const { key: i, kind: n, hidden: u, legacy: m, customAttrName: c, customAttrValue: T } = e;
80
- switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && c && T && (t.customAttributes.includes(c) || t.customAttributes.push(c), t.customAttrValues[i] = T), n) {
80
+ const s = {};
81
+ return o.forEach((e) => {
82
+ const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
83
+ switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
81
84
  case "image":
82
- o[i] = b(m.theme);
85
+ s[i] = b(c.theme);
83
86
  break;
84
87
  case "button":
85
- o[i] = O(m.theme);
88
+ s[i] = O(c.theme);
86
89
  break;
87
90
  case "text":
88
91
  case "custom": {
89
- const _ = E(m.theme);
90
- o[i] = _, _.textTrimming && (t.anyTextTrimming = !0);
92
+ const T = E(c.theme);
93
+ s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
91
94
  break;
92
95
  }
93
96
  }
94
- }), t.perElementStyles = o, t;
97
+ }), t.perElementStyles = s, t;
95
98
  }
96
99
  export {
97
100
  S as mapComposition