@useinsider/guido 3.17.0-beta.3ff6ea0 → 3.17.0-beta.6255bfc

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 (76) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +12 -6
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +31 -30
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +18 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +66 -0
  7. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  8. package/dist/composables/useRecommendation.js +52 -44
  9. package/dist/composables/useStripo.js +14 -14
  10. package/dist/config/migrator/index.js +8 -9
  11. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  12. package/dist/config/migrator/recommendation/extractors.js +24 -29
  13. package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
  14. package/dist/config/migrator/recommendation/settingsMapper.js +19 -17
  15. package/dist/config/migrator/recommendationMigrator.js +15 -16
  16. package/dist/enums/academy.js +2 -1
  17. package/dist/enums/date.js +4 -3
  18. package/dist/enums/extensions/recommendationBlock.js +4 -1
  19. package/dist/extensions/Blocks/Recommendation/block.js +26 -21
  20. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  22. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +26 -25
  23. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +28 -34
  24. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +256 -323
  25. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +178 -165
  26. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +142 -0
  27. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -1
  28. package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
  29. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  30. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +251 -110
  32. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  33. package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
  34. package/dist/extensions/Blocks/common-control.js +22 -19
  35. package/dist/guido.css +1 -1
  36. package/dist/services/recommendationApi.js +75 -30
  37. package/dist/src/@types/config/schemas.d.ts +12 -0
  38. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  39. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  40. package/dist/src/composables/useConfig.d.ts +2 -0
  41. package/dist/src/composables/useRecommendation.d.ts +1 -0
  42. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
  43. package/dist/src/enums/academy.d.ts +1 -0
  44. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  45. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
  46. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
  47. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +7 -7
  48. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  49. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -10
  50. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -10
  51. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
  52. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +15 -3
  53. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +30 -0
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -1
  55. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +206 -10
  56. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  57. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  58. package/dist/src/mock/api/recommendation-strategies.d.ts +63 -0
  59. package/dist/src/services/recommendationApi.d.ts +4 -1
  60. package/dist/src/stores/config.d.ts +18 -0
  61. package/dist/src/utils/strategyInfoBox.d.ts +22 -0
  62. package/dist/static/assets/icons/line-change.svg.js +5 -0
  63. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  64. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  65. package/dist/static/styles/components/recommendation-strategy.css.js +188 -0
  66. package/dist/static/styles/customEditorStyle.css.js +1 -3
  67. package/dist/utils/dateUtil.js +29 -10
  68. package/dist/utils/strategyInfoBox.js +37 -0
  69. package/dist/utils/templatePreparation.js +37 -34
  70. package/package.json +2 -1
  71. package/dist/config/migrator/recommendationTitleMigrator.js +0 -119
  72. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
  73. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
  74. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -5
  75. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
  76. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
@@ -5,24 +5,23 @@ import { RecommendationBlockControl as i } from "./controls/main/index.js";
5
5
  import "./constants/selectors.js";
6
6
  import "./store/recommendation.js";
7
7
  import "./utils/captureStyleTemplates.js";
8
- import { TitleControls as e } from "./controls/title/index.js";
9
- import { NameControls as l } from "./controls/name/index.js";
10
- import { PriceControls as s } from "./controls/price/index.js";
11
- import { OldPriceControls as p } from "./controls/oldPrice/index.js";
12
- import { OmnibusPriceControls as a } from "./controls/omnibusPrice/index.js";
13
- import { OmnibusDiscountControls as c } from "./controls/omnibusDiscount/index.js";
14
- import { ButtonControls as C } from "./controls/button/index.js";
15
- import { ImageControls as f } from "./controls/image/index.js";
16
- import { CustomAttributeControls as d } from "./controls/customAttribute/index.js";
17
- import { SpacingControl as u } from "./controls/spacing/index.js";
18
- import { BlockBackgroundColorControl as g } from "./controls/blockBackground/index.js";
19
- import { CardBackgroundColorControl as y } from "./controls/cardBackground/index.js";
20
- import { RecommendationCardCompositionControl as B } from "./controls/cardComposition/index.js";
21
- import { SyncInfoMessageControl as P } from "./controls/syncInfoMessage.js";
22
- import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
23
- import S from "./recommendation.css.js";
24
- import { SettingsPanel as k } from "./settingsPanel.js";
25
- const w = [
8
+ import { NameControls as e } from "./controls/name/index.js";
9
+ import { PriceControls as l } from "./controls/price/index.js";
10
+ import { OldPriceControls as s } from "./controls/oldPrice/index.js";
11
+ import { OmnibusPriceControls as p } from "./controls/omnibusPrice/index.js";
12
+ import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
13
+ import { ButtonControls as c } from "./controls/button/index.js";
14
+ import { ImageControls as C } from "./controls/image/index.js";
15
+ import { CustomAttributeControls as f } from "./controls/customAttribute/index.js";
16
+ import { SpacingControl as d } from "./controls/spacing/index.js";
17
+ import { BlockBackgroundColorControl as u } from "./controls/blockBackground/index.js";
18
+ import { CardBackgroundColorControl as g } from "./controls/cardBackground/index.js";
19
+ import { RecommendationCardCompositionControl as y } from "./controls/cardComposition/index.js";
20
+ import { SyncInfoMessageControl as B } from "./controls/syncInfoMessage.js";
21
+ import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
22
+ import R from "./recommendation.css.js";
23
+ import { SettingsPanel as S } from "./settingsPanel.js";
24
+ const k = [
26
25
  e,
27
26
  l,
28
27
  s,
@@ -30,22 +29,21 @@ const w = [
30
29
  a,
31
30
  c,
32
31
  C,
33
- f,
34
- d
35
- ], b = [
32
+ f
33
+ ], w = [
36
34
  i,
35
+ u,
37
36
  g,
37
+ d,
38
38
  y,
39
- u,
40
- B,
41
- P
42
- ], v = [
43
- ...b,
44
- ...w.flatMap((o) => Object.values(o))
45
- ], Y = v.reduce(
39
+ B
40
+ ], b = [
41
+ ...w,
42
+ ...k.flatMap((o) => Object.values(o))
43
+ ], W = b.reduce(
46
44
  (o, r) => o.addControl(r),
47
- new t().addBlock(m).withSettingsPanelRegistry(k)
48
- ).addStyles(S).withPreviewStyles(n).withIconsRegistry(R).build();
45
+ new t().addBlock(m).withSettingsPanelRegistry(S)
46
+ ).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
49
47
  export {
50
- Y as default
48
+ W as default
51
49
  };
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as C } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CURRENT_CONFIG_VERSION as l, DEFAULT_NODE_CONFIG as c } from "../constants/defaultConfig.js";
1
+ import { ModificationDescription as h } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { PRE_RRS_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as c } from "../constants/defaultConfig.js";
3
3
  import { setCurrencyAttributes as D } from "../controls/main/utils.js";
4
- import { hasMinimalConfig as A } from "../types/nodeConfig.js";
5
- function S(e) {
6
- return e === "." || e === "," || e === " ";
4
+ import { hasMinimalConfig as S } from "../types/nodeConfig.js";
5
+ function A(n) {
6
+ return n === "." || n === "," || n === " ";
7
7
  }
8
- function N(e) {
9
- return e === "." || e === "," || e === " " || e === "";
8
+ function N(n) {
9
+ return n === "." || n === "," || n === " " || n === "";
10
10
  }
11
- class M {
11
+ class F {
12
12
  // ========================================================================
13
13
  // Read Operations
14
14
  // ========================================================================
@@ -48,7 +48,7 @@ class M {
48
48
  return !1;
49
49
  try {
50
50
  const t = i.getNodeConfig();
51
- return A(t);
51
+ return S(t);
52
52
  } catch {
53
53
  return !1;
54
54
  }
@@ -82,9 +82,9 @@ class M {
82
82
  * @param description - Human-readable description for undo/redo
83
83
  * @returns The new complete configuration
84
84
  */
85
- static updateConfig(i, t, o, n) {
85
+ static updateConfig(i, t, o, e) {
86
86
  const r = this.getConfig(t), u = this.deepMerge(r, o);
87
- return this.saveConfig(i, t, u, n), u;
87
+ return this.saveConfig(i, t, u, e), u;
88
88
  }
89
89
  /**
90
90
  * Initialize configuration for a new block
@@ -107,12 +107,12 @@ class M {
107
107
  static initializeConfig(i, t, o) {
108
108
  if (this.hasConfig(t))
109
109
  return { config: o ? this.updateConfig(i, t, o, "Initialize recommendation block") : this.getConfig(t), wasFreshDrop: !1 };
110
- const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
111
- return this.saveConfig(i, t, n, "Initialize recommendation block"), D({
110
+ const e = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
111
+ return this.saveConfig(i, t, e, "Initialize recommendation block"), D({
112
112
  currentNode: t,
113
113
  documentModifier: i.getDocumentModifier(),
114
- currency: n.currency
115
- }), { config: n, wasFreshDrop: !0 };
114
+ currency: e.currency
115
+ }), { config: e, wasFreshDrop: !0 };
116
116
  }
117
117
  /**
118
118
  * Save complete configuration to a node
@@ -123,9 +123,9 @@ class M {
123
123
  * @param config - Complete configuration to save
124
124
  * @param description - Human-readable description for undo/redo
125
125
  */
126
- static saveConfig(i, t, o, n) {
126
+ static saveConfig(i, t, o, e) {
127
127
  try {
128
- i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new C(n));
128
+ i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new h(e));
129
129
  } catch (r) {
130
130
  console.warn("[RecommendationConfigService] Failed to save config:", r);
131
131
  }
@@ -154,33 +154,33 @@ class M {
154
154
  */
155
155
  static migrateFromDataAttributes(i, t) {
156
156
  const o = {
157
- configVersion: l
157
+ configVersion: C
158
158
  };
159
159
  if ("getAttribute" in t && typeof t.getAttribute == "function") {
160
- const n = t.getAttribute("esd-ext-config");
161
- if (n)
160
+ const e = t.getAttribute("esd-ext-config");
161
+ if (e)
162
162
  try {
163
- const s = JSON.parse(n);
164
- s && typeof s == "object" && (Object.assign(o, s), o.configVersion = l);
163
+ const s = JSON.parse(e);
164
+ s && typeof s == "object" && Object.assign(o, s);
165
165
  } catch {
166
166
  }
167
167
  const r = t.getAttribute("data-layout");
168
168
  r === "list" || r === "horizontal" ? o.layout = "list" : (r === "grid" || r === "vertical") && (o.layout = "grid");
169
169
  const u = t.getAttribute("data-card-composition");
170
170
  u && (o.composition = u.split(",").filter(Boolean));
171
- const b = t.getAttribute("data-column-spacing");
172
- b && (o.columnSpacing = parseInt(b) || c.columnSpacing);
173
- const p = t.getAttribute("data-row-spacing");
174
- if (p && (o.rowSpacing = parseInt(p) || c.rowSpacing), !o.currency) {
175
- const s = t.getAttribute("currency"), y = t.getAttribute("currency-symbol"), d = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
176
- if (s || y || d || f || g || m) {
177
- const a = c.currency, h = m ? parseInt(m) : NaN;
171
+ const l = t.getAttribute("data-column-spacing");
172
+ l && (o.columnSpacing = parseInt(l) || c.columnSpacing);
173
+ const b = t.getAttribute("data-row-spacing");
174
+ if (b && (o.rowSpacing = parseInt(b) || c.rowSpacing), !o.currency) {
175
+ const s = t.getAttribute("currency"), p = t.getAttribute("currency-symbol"), y = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
176
+ if (s || p || y || f || g || m) {
177
+ const a = c.currency, d = m ? parseInt(m) : NaN;
178
178
  o.currency = {
179
179
  code: s ?? a.code,
180
- symbol: y ?? a.symbol,
181
- alignment: d === "0" ? "before" : "after",
182
- decimalCount: Number.isFinite(h) ? h : a.decimalCount,
183
- decimalSeparator: S(g) ? g : a.decimalSeparator,
180
+ symbol: p ?? a.symbol,
181
+ alignment: y === "0" ? "before" : "after",
182
+ decimalCount: Number.isFinite(d) ? d : a.decimalCount,
183
+ decimalSeparator: A(g) ? g : a.decimalSeparator,
184
184
  thousandSeparator: N(f) ? f : a.thousandSeparator
185
185
  };
186
186
  }
@@ -194,7 +194,7 @@ class M {
194
194
  * @returns True if migration is needed
195
195
  */
196
196
  static needsMigration(i) {
197
- return i ? this.hasConfig(i) ? this.getConfigVersion(i) < l : !0 : !1;
197
+ return i ? !this.hasConfig(i) : !1;
198
198
  }
199
199
  // ========================================================================
200
200
  // Internal Helpers
@@ -279,5 +279,5 @@ class M {
279
279
  }
280
280
  }
281
281
  export {
282
- M as RecommendationConfigService
282
+ F as RecommendationConfigService
283
283
  };
@@ -3,10 +3,9 @@ import { BLOCK_ID as R } from "./block.js";
3
3
  import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import "./constants/selectors.js";
6
- import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
6
+ import { CONTROL_BLOCK_ID as U } from "./controls/main/index.js";
7
7
  import "./store/recommendation.js";
8
8
  import "./utils/captureStyleTemplates.js";
9
- import "./controls/title/index.js";
10
9
  import "./controls/name/index.js";
11
10
  import "./controls/price/index.js";
12
11
  import "./controls/oldPrice/index.js";
@@ -16,7 +15,7 @@ import "./controls/button/index.js";
16
15
  import "./controls/image/index.js";
17
16
  import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
18
17
  import "./controls/blockBackground/index.js";
19
- import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackground/index.js";
18
+ import { CARD_BACKGROUND_COLOR_CONTROL_ID as L } from "./controls/cardBackground/index.js";
20
19
  import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
21
20
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
22
21
  class s extends E {
@@ -25,7 +24,7 @@ class s extends E {
25
24
  new _(
26
25
  I.SETTINGS,
27
26
  [
28
- L,
27
+ U,
29
28
  C.EXTERNAL_INDENTS
30
29
  ]
31
30
  ),
@@ -33,7 +32,7 @@ class s extends E {
33
32
  I.STYLES,
34
33
  [
35
34
  T.BLOCK_BACKGROUND,
36
- U,
35
+ L,
37
36
  A
38
37
  ]
39
38
  ),
@@ -43,24 +42,6 @@ class s extends E {
43
42
  D
44
43
  ]
45
44
  ).withLabel(this.api.translate("Card Composition"))
46
- ], O[S.TITLE] = [
47
- new _(
48
- I.SETTINGS,
49
- [
50
- T.TITLE_STYLE,
51
- T.TITLE_ALIGN,
52
- T.TITLE_PADDINGS
53
- ]
54
- ),
55
- new _(
56
- I.STYLES,
57
- [
58
- T.TITLE_BACKGROUND,
59
- T.TITLE_FONT_FAMILY,
60
- T.TITLE_SIZE,
61
- T.TITLE_COLOR
62
- ]
63
- )
64
45
  ], O[S.NAME] = [
65
46
  new _(
66
47
  I.SETTINGS,