@useinsider/guido 3.15.0-beta.f5247a0 → 3.15.0-beta.fcabbea

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 (58) hide show
  1. package/dist/@types/config/schemas.js +108 -92
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +78 -75
  4. package/dist/composables/useActionsApi.js +30 -22
  5. package/dist/composables/useEmailTemplateApplier.js +25 -23
  6. package/dist/composables/useHtmlValidator.js +50 -50
  7. package/dist/composables/useRecommendation.js +20 -19
  8. package/dist/composables/useTimerClone.js +21 -19
  9. package/dist/config/i18n/en/labels.json.js +7 -3
  10. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  12. package/dist/extensions/Blocks/Items/block.js +44 -42
  13. package/dist/extensions/Blocks/Items/template.js +86 -86
  14. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
  15. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +9 -5
  16. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
  17. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +21 -21
  19. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
  20. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
  21. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -98
  22. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +0 -21
  23. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -12
  24. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  25. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  26. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  27. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  28. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  29. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  30. package/dist/extensions/Blocks/common-control.js +42 -35
  31. package/dist/guido.css +1 -1
  32. package/dist/library.js +11 -7
  33. package/dist/node_modules/valibot/dist/index.js +230 -216
  34. package/dist/public/trackingIds.js +8 -0
  35. package/dist/src/@types/config/schemas.d.ts +20 -0
  36. package/dist/src/composables/useActionsApi.d.ts +1 -1
  37. package/dist/src/composables/useConfig.d.ts +4 -0
  38. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  39. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  40. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  41. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
  42. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
  44. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -5
  45. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  46. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
  47. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  48. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  49. package/dist/src/library.d.ts +1 -0
  50. package/dist/src/public/trackingIds.d.ts +9 -0
  51. package/dist/src/stores/config.d.ts +36 -0
  52. package/dist/src/stores/editor.d.ts +25 -0
  53. package/dist/src/utils/linkTrackingIds.d.ts +30 -0
  54. package/dist/stores/editor.js +4 -1
  55. package/dist/utils/linkTrackingIds.js +56 -0
  56. package/dist/utils/pairProductVariables.js +105 -99
  57. package/dist/utils/templatePreparation.js +72 -61
  58. package/package.json +5 -1
@@ -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