@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29

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 (72) hide show
  1. package/dist/composables/useActionsApi.js +64 -80
  2. package/dist/composables/useFullStoryBridge.js +10 -9
  3. package/dist/composables/useGuidoStateBridge.js +3 -3
  4. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  5. package/dist/composables/useStripo.js +10 -11
  6. package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
  7. package/dist/config/migrator/index.js +11 -10
  8. package/dist/extensions/Blocks/Items/block.js +42 -43
  9. package/dist/extensions/Blocks/Recommendation/block.js +29 -33
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
  11. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
  12. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
  16. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
  17. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
  18. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
  19. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
  20. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
  22. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
  24. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
  27. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
  29. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
  30. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
  31. package/dist/package.json.js +1 -1
  32. package/dist/src/composables/useActionsApi.d.ts +1 -5
  33. package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
  35. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
  36. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
  37. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
  42. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
  43. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
  50. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
  51. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
  52. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
  53. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
  54. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
  55. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
  56. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
  57. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
  58. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
  59. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
  60. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
  61. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
  62. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
  63. package/dist/src/stores/editor.d.ts +1 -3
  64. package/dist/src/utils/fullStoryScripts.d.ts +6 -0
  65. package/dist/static/styles/components/button.css.js +0 -5
  66. package/dist/stores/editor.js +0 -5
  67. package/dist/utils/fullStoryScripts.js +8 -0
  68. package/package.json +3 -3
  69. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
  70. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
  71. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
  72. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
@@ -1,25 +1,13 @@
1
- var y = Object.defineProperty;
2
- var S = (s, i, e) => i in s ? y(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
- var C = (s, i, e) => S(s, typeof i != "symbol" ? i + "" : i, e);
4
- import { currencyLocationMaps as u, currencyOperators as a, currencyDecimalCounts as h } from "../../../../../enums/extensions/recommendationBlock.js";
5
- import { UEAttr as N, ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { CommonControl as g } from "../../../common-control.js";
7
- import { RecommendationConfigService as c } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
9
- import { toCurrencyConfig as U, toCurrencySettings as p } from "../../utils/currencySettings.js";
10
- import { setCurrencyAttributes as R, updatePricesInPlace as A, getCurrencyAttributesFromBlock as T } from "./utils.js";
11
- const f = "recommendation-currency-control", _ = [
12
- "code",
13
- "symbol",
14
- "alignment",
15
- "thousandSeparator",
16
- "decimalSeparator",
17
- "decimalCount"
18
- ];
19
- function m(s, i) {
20
- return _.every((e) => s[e] === i[e]);
21
- }
22
- const r = {
1
+ var p = Object.defineProperty;
2
+ var R = (o, a, e) => a in o ? p(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
3
+ var c = (o, a, e) => R(o, typeof a != "symbol" ? a + "" : a, e);
4
+ import { currencyLocationMaps as l, currencyOperators as i, currencyDecimalCounts as h } from "../../../../../enums/extensions/recommendationBlock.js";
5
+ import { UEAttr as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { CommonControl as m } from "../../../common-control.js";
7
+ import { RecommendationConfigService as s } from "../../services/configService.js";
8
+ import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
9
+ import { setCurrencyAttributes as S, updatePricesInPlace as N } from "./utils.js";
10
+ const E = "recommendation-currency-control", t = {
23
11
  CURRENCY: "currencyCode",
24
12
  CURRENCY_LOCATION: "currencyAlignment",
25
13
  CURRENCY_SYMBOL: "currencySymbol",
@@ -27,16 +15,16 @@ const r = {
27
15
  CURRENCY_DECIMAL_SEPARATOR: "currencyDecimalSeparator",
28
16
  CURRENCY_DECIMAL_COUNT: "currencyDecimalCount"
29
17
  };
30
- class P extends g {
18
+ class Y extends m {
31
19
  constructor() {
32
20
  super(...arguments);
33
21
  // Store is used ONLY for API-fetched data (currency list), not for config
34
- C(this, "store", E());
35
- C(this, "storeUnsubscription", () => {
22
+ c(this, "store", d());
23
+ c(this, "storeUnsubscription", () => {
36
24
  });
37
25
  }
38
26
  getId() {
39
- return f;
27
+ return E;
40
28
  }
41
29
  getTemplate() {
42
30
  return `
@@ -44,37 +32,37 @@ class P extends g {
44
32
  ${this._GuTwoColumns([
45
33
  this._GuLabel({ text: this.api.translate("Currency") }),
46
34
  this._GuSelect({
47
- name: r.CURRENCY,
35
+ name: t.CURRENCY,
48
36
  placeholder: this.api.translate("Select Currency"),
49
37
  options: this.store.currencyList
50
38
  }),
51
39
  this._GuLabel({ text: this.api.translate("Currency Location") }),
52
40
  this._GuSelect({
53
- name: r.CURRENCY_LOCATION,
41
+ name: t.CURRENCY_LOCATION,
54
42
  placeholder: this.api.translate("Select Currency Location"),
55
- options: u
43
+ options: l
56
44
  }),
57
45
  this._GuLabel({ text: this.api.translate("Currency Symbol") }),
58
46
  this._GuTextInput({
59
- name: r.CURRENCY_SYMBOL,
47
+ name: t.CURRENCY_SYMBOL,
60
48
  placeholder: this.api.translate("Enter Currency Symbol"),
61
49
  className: "es-180w"
62
50
  }),
63
51
  this._GuLabel({ text: this.api.translate("Thousand Separator") }),
64
52
  this._GuSelect({
65
- name: r.CURRENCY_THOUSAND_SEPARATOR,
53
+ name: t.CURRENCY_THOUSAND_SEPARATOR,
66
54
  placeholder: this.api.translate("Select Thousand Separator"),
67
- options: a
55
+ options: i
68
56
  }),
69
57
  this._GuLabel({ text: this.api.translate("Decimal Separator") }),
70
58
  this._GuSelect({
71
- name: r.CURRENCY_DECIMAL_SEPARATOR,
59
+ name: t.CURRENCY_DECIMAL_SEPARATOR,
72
60
  placeholder: this.api.translate("Select Decimal Separator"),
73
- options: a
61
+ options: i
74
62
  }),
75
63
  this._GuLabel({ text: this.api.translate("Decimal Count") }),
76
64
  this._GuSelect({
77
- name: r.CURRENCY_DECIMAL_COUNT,
65
+ name: t.CURRENCY_DECIMAL_COUNT,
78
66
  placeholder: this.api.translate("Select Decimal Count"),
79
67
  options: h
80
68
  })
@@ -94,79 +82,73 @@ class P extends g {
94
82
  this.storeUnsubscription();
95
83
  }
96
84
  _setFormValues() {
97
- const e = c.getConfig(this.currentNode), { currency: t } = e;
85
+ const e = s.getConfig(this.currentNode), { currency: r } = e;
98
86
  this.api.updateValues({
99
- [r.CURRENCY]: `price.${t.code}`,
100
- [r.CURRENCY_LOCATION]: t.alignment === "before" ? "0" : "1",
101
- [r.CURRENCY_SYMBOL]: t.symbol,
102
- [r.CURRENCY_THOUSAND_SEPARATOR]: t.thousandSeparator,
103
- [r.CURRENCY_DECIMAL_SEPARATOR]: t.decimalSeparator,
104
- [r.CURRENCY_DECIMAL_COUNT]: t.decimalCount.toString()
87
+ [t.CURRENCY]: `price.${r.code}`,
88
+ [t.CURRENCY_LOCATION]: r.alignment === "before" ? "0" : "1",
89
+ [t.CURRENCY_SYMBOL]: r.symbol,
90
+ [t.CURRENCY_THOUSAND_SEPARATOR]: r.thousandSeparator,
91
+ [t.CURRENCY_DECIMAL_SEPARATOR]: r.decimalSeparator,
92
+ [t.CURRENCY_DECIMAL_COUNT]: r.decimalCount.toString()
105
93
  });
106
94
  }
107
95
  _initializeSelectItems() {
108
- const { store: e } = this, t = {
109
- [r.CURRENCY]: e.currencyList,
110
- [r.CURRENCY_LOCATION]: u,
111
- [r.CURRENCY_THOUSAND_SEPARATOR]: a,
112
- [r.CURRENCY_DECIMAL_SEPARATOR]: a,
113
- [r.CURRENCY_DECIMAL_COUNT]: h
96
+ const { store: e } = this, r = {
97
+ [t.CURRENCY]: e.currencyList,
98
+ [t.CURRENCY_LOCATION]: l,
99
+ [t.CURRENCY_THOUSAND_SEPARATOR]: i,
100
+ [t.CURRENCY_DECIMAL_SEPARATOR]: i,
101
+ [t.CURRENCY_DECIMAL_COUNT]: h
114
102
  };
115
- Object.entries(t).forEach(([n, o]) => {
116
- this.api.setUIEAttribute(n, N.SELECTPICKER.items, o);
103
+ Object.entries(r).forEach(([C, n]) => {
104
+ this.api.setUIEAttribute(C, _.SELECTPICKER.items, n);
117
105
  });
118
106
  }
119
107
  /**
120
- * Applies a display-only currency change (symbol, separators, alignment, decimal count) to node
121
- * config, block attributes, store and the price text in ONE apply. No product refetch.
108
+ * Applies currency updates to node config, HTML attributes, Pinia store, and DOM.
122
109
  * @param updates - Partial currency config to merge
110
+ * @param triggerRefetch - Whether to trigger a product API refetch.
111
+ * true for currency code changes (different prices from API),
112
+ * false for display-only changes (symbol, separators, alignment, decimal count).
123
113
  */
124
- _updateCurrency(e) {
114
+ _updateCurrency(e, r = !1) {
125
115
  if (!this.currentNode)
126
116
  return;
127
- const t = U(this.store.recommendationConfigs.currencySettings), n = { ...t, ...e };
128
- if (m(n, t)) {
129
- m(n, c.getConfig(this.currentNode).currency) && this._repairCurrencyAttributes(n);
130
- return;
131
- }
132
- const o = this.api.getDocumentModifier();
133
- c.stageConfig(o, this.currentNode, { currency: n }), R({
117
+ const n = { ...s.getConfig(this.currentNode).currency, ...e };
118
+ s.updateConfig(
119
+ this.api,
120
+ this.currentNode,
121
+ { currency: n },
122
+ "Updated currency settings"
123
+ );
124
+ const u = this.api.getDocumentModifier();
125
+ S({
134
126
  currentNode: this.currentNode,
135
- documentModifier: o,
136
- currency: n,
137
- stageOnly: !0
138
- }), this.store.patchCurrentBlockConfig(
139
- { currencySettings: p(n) },
140
- { triggerRefetch: !1 }
141
- ), A({
127
+ documentModifier: u,
128
+ currency: n
129
+ }), this.store.patchCurrentBlockConfig({
130
+ currencySettings: {
131
+ name: n.code,
132
+ value: n.code,
133
+ symbol: n.symbol,
134
+ alignment: n.alignment === "before" ? "0" : "1",
135
+ decimalCount: n.decimalCount.toString(),
136
+ decimalSeparator: n.decimalSeparator,
137
+ thousandSeparator: n.thousandSeparator
138
+ }
139
+ }, { triggerRefetch: r }), N({
142
140
  currentNode: this.currentNode,
143
- documentModifier: o,
144
- configOverrides: { currency: n }
145
- }), o.apply(new l("Updated currency settings"));
146
- }
147
- /** Re-stamps the compiler-read block attributes where they drifted from the node config. */
148
- _repairCurrencyAttributes(e) {
149
- const t = T(this.currentNode);
150
- if (t && _.every((o) => t[o] === e[o]))
151
- return;
152
- const n = this.api.getDocumentModifier();
153
- R({ currentNode: this.currentNode, documentModifier: n, currency: e, stageOnly: !0 }) && n.apply(new l("Update currency attributes"));
141
+ documentModifier: u
142
+ });
154
143
  }
155
144
  _onCurrencyChange(e) {
156
- const [, t] = e.includes(".") ? e.split(".") : [null, e], n = c.getConfig(this.currentNode).currency, o = this.store.recommendationConfigs.currencySettings.value;
157
- if (n.code === t) {
158
- o !== t && this.store.patchCurrentBlockConfig({ currencySettings: p(n) });
159
- return;
160
- }
161
- if (o !== t) {
162
- const { currencySettings: d } = this.store.recommendationConfigs;
163
- this.store.patchCurrentBlockConfig({
164
- currencySettings: { ...d, name: t, value: t, symbol: t }
165
- });
166
- }
167
- this.api.updateValues({
168
- [r.CURRENCY_SYMBOL]: t
169
- });
145
+ const [, r] = e.includes(".") ? e.split(".") : [null, e];
146
+ s.getConfig(this.currentNode).currency.code !== r && (this._updateCurrency({
147
+ code: r,
148
+ symbol: r
149
+ }, !0), this.api.updateValues({
150
+ [t.CURRENCY_SYMBOL]: r
151
+ }));
170
152
  }
171
153
  _onCurrencyLocationChange(e) {
172
154
  this._updateCurrency({
@@ -187,23 +169,23 @@ class P extends g {
187
169
  });
188
170
  }
189
171
  _onDecimalCountChange(e) {
190
- const t = parseInt(e);
172
+ const r = parseInt(e);
191
173
  this._updateCurrency({
192
- decimalCount: Number.isNaN(t) ? 2 : t
174
+ decimalCount: Number.isNaN(r) ? 2 : r
193
175
  });
194
176
  }
195
177
  _listenToFormUpdates() {
196
- this.api.onValueChanged(r.CURRENCY, (e) => {
178
+ this.api.onValueChanged(t.CURRENCY, (e) => {
197
179
  this._onCurrencyChange(e);
198
- }), this.api.onValueChanged(r.CURRENCY_LOCATION, (e) => {
180
+ }), this.api.onValueChanged(t.CURRENCY_LOCATION, (e) => {
199
181
  this._onCurrencyLocationChange(e);
200
- }), this.api.onValueChanged(r.CURRENCY_SYMBOL, (e) => {
182
+ }), this.api.onValueChanged(t.CURRENCY_SYMBOL, (e) => {
201
183
  this._onCurrencySymbolChange(e);
202
- }), this.api.onValueChanged(r.CURRENCY_THOUSAND_SEPARATOR, (e) => {
184
+ }), this.api.onValueChanged(t.CURRENCY_THOUSAND_SEPARATOR, (e) => {
203
185
  this._onThousandSeparatorChange(e);
204
- }), this.api.onValueChanged(r.CURRENCY_DECIMAL_SEPARATOR, (e) => {
186
+ }), this.api.onValueChanged(t.CURRENCY_DECIMAL_SEPARATOR, (e) => {
205
187
  this._onDecimalSeparatorChange(e);
206
- }), this.api.onValueChanged(r.CURRENCY_DECIMAL_COUNT, (e) => {
188
+ }), this.api.onValueChanged(t.CURRENCY_DECIMAL_COUNT, (e) => {
207
189
  this._onDecimalCountChange(e);
208
190
  });
209
191
  }
@@ -214,12 +196,12 @@ class P extends g {
214
196
  _subscribeToStoreChanges() {
215
197
  let e = this.store.currencyList.length;
216
198
  this.storeUnsubscription = this.store.$subscribe(() => {
217
- const t = this.store.currencyList.length;
218
- t > 0 && t !== e && (e = t, this._initializeSelectItems(), this._setFormValues());
199
+ const r = this.store.currencyList.length;
200
+ r > 0 && r !== e && (e = r, this._initializeSelectItems(), this._setFormValues());
219
201
  });
220
202
  }
221
203
  }
222
204
  export {
223
- f as CURRENCY_CONTROL_ID,
224
- P as CurrencyControl
205
+ E as CURRENCY_CONTROL_ID,
206
+ Y as CurrencyControl
225
207
  };