@useinsider/guido 3.2.0-beta.066130b → 3.2.0-beta.080341b

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 (123) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +90 -88
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  8. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  9. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  10. package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
  11. package/dist/composables/useAutoSave.js +71 -0
  12. package/dist/composables/useRecommendation.js +46 -26
  13. package/dist/composables/useSave.js +19 -16
  14. package/dist/composables/useStripo.js +14 -16
  15. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  16. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  17. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  18. package/dist/config/compiler/utils/recommendationCompilerUtils.js +107 -71
  19. package/dist/config/migrator/index.js +9 -9
  20. package/dist/config/migrator/radioButtonMigrator.js +64 -44
  21. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  22. package/dist/config/migrator/recommendation/extractors.js +27 -0
  23. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  24. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  25. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  26. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  27. package/dist/config/migrator/recommendationMigrator.js +74 -290
  28. package/dist/enums/extensions/recommendationBlock.js +2 -1
  29. package/dist/enums/unsubscribe.js +34 -27
  30. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/block.js +60 -50
  32. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  33. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  34. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  35. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  36. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
  37. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  38. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  39. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  40. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  41. package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
  42. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  43. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
  44. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
  45. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  46. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
  47. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
  48. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  49. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  50. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  51. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  52. package/dist/guido.css +1 -1
  53. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
  54. package/dist/node_modules/valibot/dist/index.js +450 -235
  55. package/dist/package.json.js +1 -1
  56. package/dist/services/templateLibraryApi.js +5 -4
  57. package/dist/src/@types/config/defaults.d.ts +5 -1
  58. package/dist/src/@types/config/index.d.ts +3 -3
  59. package/dist/src/@types/config/schemas.d.ts +217 -0
  60. package/dist/src/@types/config/types.d.ts +9 -1
  61. package/dist/src/components/Guido.vue.d.ts +1 -1
  62. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  63. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  64. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  65. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  66. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  67. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  68. package/dist/src/composables/useAutoSave.d.ts +3 -0
  69. package/dist/src/composables/useConfig.d.ts +58 -0
  70. package/dist/src/composables/useRecommendation.d.ts +10 -1
  71. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  72. package/dist/src/composables/useSave.d.ts +1 -1
  73. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  74. package/dist/src/config/migrator/index.d.ts +2 -1
  75. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  76. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  77. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  78. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  79. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  80. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  81. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  82. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  83. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  84. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  85. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  86. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  87. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  88. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  89. package/dist/src/enums/unsubscribe.d.ts +5 -0
  90. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  91. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  96. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  97. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
  98. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  99. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  100. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  101. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  102. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  103. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  104. package/dist/src/library.d.ts +1 -1
  105. package/dist/src/stores/autosave.d.ts +12 -0
  106. package/dist/src/stores/config.d.ts +522 -0
  107. package/dist/src/stores/editor.d.ts +23 -0
  108. package/dist/src/utils/htmlEscape.d.ts +5 -0
  109. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  110. package/dist/src/utils/timeUtil.d.ts +8 -0
  111. package/dist/static/styles/components/button.css.js +16 -9
  112. package/dist/static/styles/components/loader.css.js +4 -0
  113. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  114. package/dist/stores/autosave.js +17 -0
  115. package/dist/stores/editor.js +3 -1
  116. package/dist/utils/htmlEscape.js +13 -0
  117. package/dist/utils/pairProductVariables.js +89 -88
  118. package/dist/utils/templatePreparation.js +72 -32
  119. package/dist/utils/timeUtil.js +19 -0
  120. package/package.json +7 -3
  121. package/dist/enums/displayConditions.js +0 -80
  122. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  123. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,14 +1,15 @@
1
- import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as d } from "../../../common-control.js";
3
- import { RecommendationBlockId as l } from "../../constants/blockIds.js";
4
- import { RecommendationControlId as m } from "../../constants/controlIds.js";
5
- import { BLOCK_ROOT_SELECTOR as u } from "../../constants/selectors.js";
6
- const i = {
1
+ import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as u } from "../../../common-control.js";
3
+ import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
+ import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
+ import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
6
+ import { CSS_CLASS_TEXT_TRIM as r, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
7
+ const s = {
7
8
  TEXT_TRIM_ENABLED: "textTrimEnabled"
8
- }, o = "text-trim-enabled", c = `.${o}`, T = `.${o} p`, p = `.${o} { max-width: 0; }`, _ = `.${o} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
9
- class N extends d {
9
+ };
10
+ class N extends u {
10
11
  getId() {
11
- return m.NAME_TEXT_TRIM;
12
+ return d.NAME_TEXT_TRIM;
12
13
  }
13
14
  getTemplate() {
14
15
  return `
@@ -16,7 +17,7 @@ class N extends d {
16
17
  <div class="name-text-trim-control-container">
17
18
  ${this._GuTwoColumns([
18
19
  this._GuLabel({ text: this.api.translate("Trim Long Text") }),
19
- this._GuToggle(i.TEXT_TRIM_ENABLED)
20
+ this._GuToggle(s.TEXT_TRIM_ENABLED)
20
21
  ])}
21
22
  </div>
22
23
  `;
@@ -30,76 +31,45 @@ class N extends d {
30
31
  _setFormValues() {
31
32
  const e = this._getCurrentTrimState();
32
33
  this.api.updateValues({
33
- [i.TEXT_TRIM_ENABLED]: e
34
+ [s.TEXT_TRIM_ENABLED]: e
34
35
  });
35
36
  }
36
37
  _getCurrentTrimState() {
37
38
  if (!this.currentNode || !("hasClass" in this.currentNode))
38
39
  return !1;
39
- if (this.currentNode.hasClass(o))
40
+ if (this.currentNode.hasClass(r))
40
41
  return !0;
41
- const e = this.currentNode.closest(u);
42
+ const e = this.currentNode.closest(m);
42
43
  if (!e)
43
44
  return !1;
44
45
  const t = e.querySelector(
45
- `[esd-extension-block-id="${l.NAME}"]`
46
+ `[esd-extension-block-id="${a.NAME}"]`
46
47
  );
47
- return t && "hasClass" in t ? t.hasClass(o) : !1;
48
- }
49
- /**
50
- * Finds an existing CSS rule in the document stylesheet by exact query
51
- * @param query - The CSS query to search for (uses Stripo's CSS query syntax)
52
- * @returns The CSS rule node if found, undefined otherwise
53
- */
54
- _findCssRule(e) {
55
- const t = this.api.getDocumentRootCssNode();
56
- if (t)
57
- return t.querySelector(e);
58
- }
59
- /**
60
- * Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
61
- * This is needed because Stripo's CSS query syntax interprets spaces as path separators
62
- * @returns true if the rule exists
63
- */
64
- _hasParagraphRule() {
65
- const e = this.api.getDocumentRootCssNode();
66
- return e ? e.querySelectorAll(`*${o}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" ? s.getSelector() === T : !1) : !1;
67
- }
68
- /**
69
- * Ensures the text-trim CSS rules exist in the document stylesheet
70
- * Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
71
- */
72
- _ensureCssRulesExist() {
73
- const e = this.api.getDocumentRootCssNode();
74
- if (!e)
75
- return;
76
- const t = this.api.getDocumentModifier();
77
- let s = !1;
78
- this._findCssRule(c) || (t.modifyCss(e).appendRule(p), s = !0), this._hasParagraphRule() || (t.modifyCss(e).appendRule(_), s = !0), s && t.apply(new a("Add text trim CSS rules"));
48
+ return t && "hasClass" in t ? t.hasClass(r) : !1;
79
49
  }
80
50
  _onTextTrimChange(e) {
81
51
  if (!this.currentNode || !("closest" in this.currentNode))
82
52
  return;
83
- const t = this.currentNode.closest(u);
53
+ const t = this.currentNode.closest(m);
84
54
  if (!t || !("querySelectorAll" in t))
85
55
  return;
86
- const s = Array.from(
87
- t.querySelectorAll(`[esd-extension-block-id="${l.NAME}"]`)
56
+ const i = Array.from(
57
+ t.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
88
58
  );
89
- if (!s.length)
59
+ if (!i.length)
90
60
  return;
91
- e && this._ensureCssRulesExist();
92
- const r = this.api.getDocumentModifier();
93
- s.forEach((n) => {
94
- e ? r.modifyHtml(n).setClass(o) : r.modifyHtml(n).removeClass(o);
95
- }), r.apply(
96
- new a(
61
+ e && T(this.api);
62
+ const o = this.api.getDocumentModifier();
63
+ i.forEach((n) => {
64
+ e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
65
+ }), o.apply(
66
+ new l(
97
67
  e ? "Enable product name text trimming" : "Disable product name text trimming"
98
68
  )
99
69
  );
100
70
  }
101
71
  _listenToFormUpdates() {
102
- this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (e) => {
72
+ this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (e) => {
103
73
  this._onTextTrimChange(e);
104
74
  });
105
75
  }
@@ -0,0 +1,14 @@
1
+ import { ModificationDescription as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const t = "text-trim-enabled", l = `.${t}`, c = `.${t} p`, S = `.${t} { max-width: 0; }`, T = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
3
+ function f(n) {
4
+ const e = n.getDocumentRootCssNode();
5
+ if (!e)
6
+ return;
7
+ const o = n.getDocumentModifier();
8
+ let i = !1;
9
+ e.querySelector(l) || (o.modifyCss(e).appendRule(S), i = !0), e.querySelectorAll(`*${t}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" && s.getSelector() === c) || (o.modifyCss(e).appendRule(T), i = !0), i && o.apply(new r("Add text trim CSS rules"));
10
+ }
11
+ export {
12
+ t as CSS_CLASS_TEXT_TRIM,
13
+ f as ensureTextTrimCssRulesExist
14
+ };
@@ -1,8 +1,14 @@
1
- import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CURRENT_CONFIG_VERSION as u, DEFAULT_NODE_CONFIG as e } from "../constants/defaultConfig.js";
3
- import { setCurrencyAttributes as g } from "../controls/main/utils.js";
4
- import { hasMinimalConfig as a } from "../types/nodeConfig.js";
5
- class C {
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";
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 === " ";
7
+ }
8
+ function N(e) {
9
+ return e === "." || e === "," || e === " " || e === "";
10
+ }
11
+ class M {
6
12
  // ========================================================================
7
13
  // Read Operations
8
14
  // ========================================================================
@@ -42,7 +48,7 @@ class C {
42
48
  return !1;
43
49
  try {
44
50
  const t = i.getNodeConfig();
45
- return a(t);
51
+ return A(t);
46
52
  } catch {
47
53
  return !1;
48
54
  }
@@ -77,29 +83,36 @@ class C {
77
83
  * @returns The new complete configuration
78
84
  */
79
85
  static updateConfig(i, t, o, n) {
80
- const s = this.getConfig(t), r = this.deepMerge(s, o);
81
- return this.saveConfig(i, t, r, n), r;
86
+ const r = this.getConfig(t), u = this.deepMerge(r, o);
87
+ return this.saveConfig(i, t, u, n), u;
82
88
  }
83
89
  /**
84
90
  * Initialize configuration for a new block
85
91
  *
86
92
  * Called when a block is first created (dropped into template).
87
93
  * Can optionally merge in partial config from migration.
94
+ *
95
+ * The `wasFreshDrop` flag distinguishes a brand-new drop (no prior config)
96
+ * from a clone (Stripo replays the source's setNodeConfig payload before
97
+ * onCreated fires). Callers use this to skip side-effects already inherited
98
+ * from the source.
88
99
  * @example
89
100
  * // In Block.onCreated lifecycle
90
- * RecommendationConfigService.initializeConfig(this.api, node);
101
+ * const { config, wasFreshDrop } = RecommendationConfigService.initializeConfig(this.api, node);
91
102
  * @param api - Stripo extension API with document modifier
92
103
  * @param node - The immutable HTML node to initialize
93
104
  * @param partialConfig - Optional partial config to merge with defaults
94
- * @returns The initialized configuration
105
+ * @returns The initialized configuration and whether the node was a fresh drop
95
106
  */
96
107
  static initializeConfig(i, t, o) {
108
+ if (this.hasConfig(t))
109
+ return { config: o ? this.updateConfig(i, t, o, "Initialize recommendation block") : this.getConfig(t), wasFreshDrop: !1 };
97
110
  const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
98
- return this.saveConfig(i, t, n, "Initialize recommendation block"), g({
111
+ return this.saveConfig(i, t, n, "Initialize recommendation block"), D({
99
112
  currentNode: t,
100
113
  documentModifier: i.getDocumentModifier(),
101
114
  currency: n.currency
102
- }), n;
115
+ }), { config: n, wasFreshDrop: !0 };
103
116
  }
104
117
  /**
105
118
  * Save complete configuration to a node
@@ -112,9 +125,9 @@ class C {
112
125
  */
113
126
  static saveConfig(i, t, o, n) {
114
127
  try {
115
- i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new f(n));
116
- } catch (s) {
117
- console.warn("[RecommendationConfigService] Failed to save config:", s);
128
+ i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new C(n));
129
+ } catch (r) {
130
+ console.warn("[RecommendationConfigService] Failed to save config:", r);
118
131
  }
119
132
  }
120
133
  // ========================================================================
@@ -125,25 +138,55 @@ class C {
125
138
  *
126
139
  * Reads existing data-attributes and creates a proper node config.
127
140
  * Used when loading templates created before node config was implemented.
141
+ *
142
+ * Sources, in priority order (later overrides earlier):
143
+ * 1. `esd-ext-config` JSON blob — emitted by the recommendation migrator and
144
+ * by hand-authored new templates. Carries the full RecommendationNodeConfig
145
+ * (strategy, language, currency, filters, productIds, etc.) which the
146
+ * discrete data-* attrs below cannot capture.
147
+ * 2. Discrete `data-*` attributes — runtime source of truth for
148
+ * layout/composition/spacing; controls keep these in sync as the user
149
+ * edits, so we let them override the JSON blob if they disagree.
150
+ * 3. `currency-*` attributes — durable currency source on the block element.
128
151
  * @param api - Stripo extension API with document modifier
129
152
  * @param node - The block node to migrate
130
153
  * @returns The migrated configuration
131
154
  */
132
155
  static migrateFromDataAttributes(i, t) {
133
156
  const o = {
134
- configVersion: u
157
+ configVersion: l
135
158
  };
136
159
  if ("getAttribute" in t && typeof t.getAttribute == "function") {
137
- const n = t.getAttribute("data-layout");
138
- n === "list" || n === "horizontal" ? o.layout = "list" : (n === "grid" || n === "vertical") && (o.layout = "grid");
139
- const s = t.getAttribute("data-card-composition");
140
- s && (o.composition = s.split(",").filter(Boolean));
141
- const r = t.getAttribute("data-column-spacing");
142
- r && (o.columnSpacing = parseInt(r) || e.columnSpacing);
143
- const c = t.getAttribute("data-row-spacing");
144
- c && (o.rowSpacing = parseInt(c) || e.rowSpacing);
160
+ const n = t.getAttribute("esd-ext-config");
161
+ if (n)
162
+ try {
163
+ const s = JSON.parse(n);
164
+ s && typeof s == "object" && (Object.assign(o, s), o.configVersion = l);
165
+ } catch {
166
+ }
167
+ const r = t.getAttribute("data-layout");
168
+ r === "list" || r === "horizontal" ? o.layout = "list" : (r === "grid" || r === "vertical") && (o.layout = "grid");
169
+ const u = t.getAttribute("data-card-composition");
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;
178
+ o.currency = {
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,
184
+ thousandSeparator: N(f) ? f : a.thousandSeparator
185
+ };
186
+ }
187
+ }
145
188
  }
146
- return this.initializeConfig(i, t, o);
189
+ return this.initializeConfig(i, t, o).config;
147
190
  }
148
191
  /**
149
192
  * Check if configuration needs migration
@@ -151,7 +194,7 @@ class C {
151
194
  * @returns True if migration is needed
152
195
  */
153
196
  static needsMigration(i) {
154
- return i ? this.hasConfig(i) ? this.getConfigVersion(i) < u : !0 : !1;
197
+ return i ? this.hasConfig(i) ? this.getConfigVersion(i) < l : !0 : !1;
155
198
  }
156
199
  // ========================================================================
157
200
  // Internal Helpers
@@ -161,12 +204,12 @@ class C {
161
204
  */
162
205
  static cloneDefaults() {
163
206
  return {
164
- ...e,
165
- currency: { ...e.currency },
166
- omnibusPrice: { ...e.omnibusPrice },
167
- omnibusDiscount: { ...e.omnibusDiscount },
168
- composition: [...e.composition],
169
- visibility: { ...e.visibility },
207
+ ...c,
208
+ currency: { ...c.currency },
209
+ omnibusPrice: { ...c.omnibusPrice },
210
+ omnibusDiscount: { ...c.omnibusDiscount },
211
+ composition: [...c.composition],
212
+ visibility: { ...c.visibility },
170
213
  filters: [],
171
214
  productIds: [],
172
215
  recommendationId: 0
@@ -236,5 +279,5 @@ class C {
236
279
  }
237
280
  }
238
281
  export {
239
- C as RecommendationConfigService
282
+ M as RecommendationConfigService
240
283
  };
@@ -1,6 +1,6 @@
1
1
  import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, ContainerControls as C, TextControls as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { BLOCK_ID as U } from "./block.js";
3
- import { RecommendationBlockId as N } from "./constants/blockIds.js";
3
+ import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
6
6
  import "./store/recommendation.js";
@@ -14,7 +14,7 @@ import "./controls/image/index.js";
14
14
  import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
15
15
  import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
16
16
  import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
17
- import { SYNC_INFO_MESSAGE_CONTROL_ID as S } from "./controls/syncInfoMessage.js";
17
+ import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
18
18
  class Z extends E {
19
19
  registerBlockControls(I) {
20
20
  I[U] = [
@@ -39,11 +39,11 @@ class Z extends E {
39
39
  B
40
40
  ]
41
41
  ).withLabel(this.api.translate("Card Composition"))
42
- ], I[N.NAME] = [
42
+ ], I[S.NAME] = [
43
43
  new _(
44
44
  O.SETTINGS,
45
45
  [
46
- S,
46
+ N,
47
47
  T.NAME_STYLE,
48
48
  T.NAME_ALIGN,
49
49
  T.NAME_TEXT_TRIM,
@@ -59,11 +59,11 @@ class Z extends E {
59
59
  T.NAME_COLOR
60
60
  ]
61
61
  )
62
- ], I[N.PRICE] = [
62
+ ], I[S.PRICE] = [
63
63
  new _(
64
64
  O.SETTINGS,
65
65
  [
66
- S,
66
+ N,
67
67
  T.PRICE_STYLE,
68
68
  T.PRICE_ALIGN,
69
69
  T.PRICE_PADDINGS
@@ -78,11 +78,11 @@ class Z extends E {
78
78
  T.PRICE_COLOR
79
79
  ]
80
80
  )
81
- ], I[N.OLD_PRICE] = [
81
+ ], I[S.OLD_PRICE] = [
82
82
  new _(
83
83
  O.SETTINGS,
84
84
  [
85
- S,
85
+ N,
86
86
  T.OLD_PRICE_STYLE,
87
87
  T.OLD_PRICE_ALIGN,
88
88
  T.OLD_PRICE_PADDINGS
@@ -97,11 +97,11 @@ class Z extends E {
97
97
  T.OLD_PRICE_COLOR
98
98
  ]
99
99
  )
100
- ], I[N.OMNIBUS_PRICE] = [
100
+ ], I[S.OMNIBUS_PRICE] = [
101
101
  new _(
102
102
  O.SETTINGS,
103
103
  [
104
- S,
104
+ N,
105
105
  T.OMNIBUS_PRICE_TEXT_BEFORE,
106
106
  T.OMNIBUS_PRICE_TEXT_AFTER,
107
107
  T.OMNIBUS_PRICE_STYLE,
@@ -118,11 +118,11 @@ class Z extends E {
118
118
  T.OMNIBUS_PRICE_COLOR
119
119
  ]
120
120
  )
121
- ], I[N.OMNIBUS_DISCOUNT] = [
121
+ ], I[S.OMNIBUS_DISCOUNT] = [
122
122
  new _(
123
123
  O.SETTINGS,
124
124
  [
125
- S,
125
+ N,
126
126
  T.OMNIBUS_DISCOUNT_TEXT_BEFORE,
127
127
  T.OMNIBUS_DISCOUNT_TEXT_AFTER,
128
128
  T.OMNIBUS_DISCOUNT_STYLE,
@@ -139,11 +139,11 @@ class Z extends E {
139
139
  T.OMNIBUS_DISCOUNT_COLOR
140
140
  ]
141
141
  )
142
- ], I[N.BUTTON] = [
142
+ ], I[S.BUTTON] = [
143
143
  new _(
144
144
  O.SETTINGS,
145
145
  [
146
- S,
146
+ N,
147
147
  T.BUTTON_TEXT,
148
148
  T.BUTTON_ALIGN,
149
149
  T.BUTTON_PADDINGS,
@@ -162,12 +162,13 @@ class Z extends E {
162
162
  T.BUTTON_BORDER
163
163
  ]
164
164
  )
165
- ], I[N.CUSTOM_ATTRIBUTE] = [
165
+ ], I[S.CUSTOM_ATTRIBUTE] = [
166
166
  new _(
167
167
  O.SETTINGS,
168
168
  [
169
169
  T.CUSTOM_ATTR_STYLE,
170
170
  T.CUSTOM_ATTR_ALIGN,
171
+ T.CUSTOM_ATTR_TEXT_TRIM,
171
172
  T.CUSTOM_ATTR_PADDINGS
172
173
  ]
173
174
  ),
@@ -180,11 +181,11 @@ class Z extends E {
180
181
  T.CUSTOM_ATTR_COLOR
181
182
  ]
182
183
  )
183
- ], I[N.IMAGE] = [
184
+ ], I[S.IMAGE] = [
184
185
  new _(
185
186
  O.SETTINGS,
186
187
  [
187
- S,
188
+ N,
188
189
  T.IMAGE_SIZE,
189
190
  T.IMAGE_MARGINS
190
191
  ]