@useinsider/guido 3.17.0-beta.e6704da → 3.17.0-beta.eae947f

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 (49) hide show
  1. package/README.md +5 -6
  2. package/dist/@types/config/schemas.js +6 -12
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +61 -63
  5. package/dist/composables/useCustomInterfaceAppearance.js +16 -19
  6. package/dist/composables/useRecommendation.js +34 -41
  7. package/dist/config/migrator/recommendationMigrator.js +4 -6
  8. package/dist/enums/academy.js +1 -2
  9. package/dist/enums/date.js +3 -4
  10. package/dist/enums/extensions/recommendationBlock.js +23 -25
  11. package/dist/extensions/Blocks/Items/block.js +98 -49
  12. package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
  13. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  14. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  15. package/dist/extensions/Blocks/Items/template.js +153 -152
  16. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +11 -13
  17. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +154 -156
  19. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +68 -216
  20. package/dist/extensions/Blocks/common-control.js +19 -22
  21. package/dist/guido.css +1 -1
  22. package/dist/services/recommendationApi.js +29 -78
  23. package/dist/src/@types/config/schemas.d.ts +0 -12
  24. package/dist/src/composables/useConfig.d.ts +0 -2
  25. package/dist/src/composables/useRecommendation.d.ts +0 -1
  26. package/dist/src/enums/academy.d.ts +0 -1
  27. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  28. package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
  29. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -14
  31. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -214
  32. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  33. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  34. package/dist/src/services/recommendationApi.d.ts +1 -4
  35. package/dist/src/stores/config.d.ts +0 -18
  36. package/dist/utils/dateUtil.js +10 -23
  37. package/dist/utils/pairProductVariables.js +60 -59
  38. package/dist/utils/templatePreparation.js +34 -37
  39. package/package.json +2 -3
  40. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
  41. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -70
  42. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
  43. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
  44. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -141
  45. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  46. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -29
  48. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
  49. package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
@@ -2,11 +2,10 @@ import { useTranslations as r } from "../../composables/useTranslations.js";
2
2
  const l = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
- PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
- RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies"
7
- }, c = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", d = {
5
+ PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
6
+ }, c = {
8
7
  CLIENT_ID: "clientId"
9
- }, m = () => {
8
+ }, d = () => {
10
9
  const e = r();
11
10
  return [
12
11
  {
@@ -70,14 +69,14 @@ const l = {
70
69
  path: "top-sellers"
71
70
  }
72
71
  ];
73
- }, p = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], v = [
72
+ }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
74
73
  { text: "before the amount", value: "0" },
75
74
  { text: "after the amount", value: "1" }
76
- ], h = [
75
+ ], v = [
77
76
  { text: "dot(.)", value: "." },
78
77
  { text: "comma(,)", value: "," },
79
78
  { text: "space( )", value: " " }
80
- ], x = [
79
+ ], h = [
81
80
  { text: "0", value: "0" },
82
81
  { text: "1", value: "1" },
83
82
  { text: "2", value: "2" },
@@ -89,55 +88,54 @@ const l = {
89
88
  { text: "contains", value: "~" },
90
89
  { text: "does not contain", value: "!~" },
91
90
  { text: "any of", value: a }
92
- ], s = [
91
+ ], n = [
93
92
  { text: "is exactly", value: "=" },
94
93
  { text: "is not exactly", value: "!==" },
95
94
  { text: "contains", value: "~" },
96
95
  { text: "does not contain", value: "!~" },
97
96
  { text: "any of", value: a }
98
- ], n = [
97
+ ], o = [
99
98
  { text: "is equal to", value: "=" },
100
99
  { text: "is greater than", value: ">" },
101
100
  { text: "is less than", value: "<" }
102
- ], o = [
101
+ ], s = [
103
102
  { text: "is equal to", value: "=" },
104
103
  { text: "after", value: ">" },
105
104
  { text: "before", value: "<" }
106
105
  ], i = [
107
106
  { text: "true", value: "==" },
108
107
  { text: "false", value: "!=" }
109
- ], b = (e) => {
108
+ ], x = (e) => {
110
109
  if (!e)
111
110
  return t;
112
111
  switch (e) {
113
112
  case "Boolean":
114
113
  return i;
115
114
  case "Date":
116
- return o;
115
+ return s;
117
116
  case "Number":
118
- return n;
117
+ return o;
119
118
  case "String":
120
119
  return t;
121
120
  case "Strings":
122
- return s;
121
+ return n;
123
122
  default:
124
123
  return t;
125
124
  }
126
125
  };
127
126
  export {
128
127
  a as OP_ANY_OF,
129
- p as PriceAttributes,
130
- d as QUERY_PARAMS,
131
- c as RRS_ACTIVE_EMAIL_FILTER,
128
+ m as PriceAttributes,
129
+ c as QUERY_PARAMS,
132
130
  l as URLS,
133
- x as currencyDecimalCounts,
134
- v as currencyLocationMaps,
135
- h as currencyOperators,
136
- b as getOperatorOptions,
137
- m as getRecommendationFeedSourceMaps,
138
- s as operatorOptionsForArrayOfStrings,
131
+ h as currencyDecimalCounts,
132
+ p as currencyLocationMaps,
133
+ v as currencyOperators,
134
+ x as getOperatorOptions,
135
+ d as getRecommendationFeedSourceMaps,
136
+ n as operatorOptionsForArrayOfStrings,
139
137
  i as operatorOptionsForBooleans,
140
- o as operatorOptionsForDates,
141
- n as operatorOptionsForNumbers,
138
+ s as operatorOptionsForDates,
139
+ o as operatorOptionsForNumbers,
142
140
  t as operatorOptionsForStrings
143
141
  };
@@ -1,20 +1,30 @@
1
- import { BlockId as g } from "../../../enums/block.js";
2
- import { useOnboardingStore as y } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as I } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as C, BlockCompositionType as b, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as l, DefaultConfigValues as d } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as h } from "./template.js";
7
- import { getItemsBlockContainer as u, getItemsBlockConfig as f, deriveItemNumber as D, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
- const p = g.Items;
9
- class E extends C {
1
+ var D = Object.defineProperty;
2
+ var k = (l, a, t) => a in l ? D(l, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[a] = t;
3
+ var I = (l, a, t) => k(l, typeof a != "symbol" ? a + "" : a, t);
4
+ import { BlockId as N } from "../../../enums/block.js";
5
+ import { useOnboardingStore as T } from "../../../stores/onboarding.js";
6
+ import { getMigrationBannerHtml as _ } from "../../../utils/migrationBannerHtml.js";
7
+ import { Block as A, BlockCompositionType as M, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { currencyPositionFromLocation as O, ITEMS_CURRENCY_ATTR as d } from "./constants/currency.js";
9
+ import { ItemsBlockId as R } from "./enums/controlEnums.js";
10
+ import { SETTINGS_ENUMS as b, DefaultConfigValues as f } from "./enums/settingsEnums.js";
11
+ import { getDefaultTemplate as E } from "./template.js";
12
+ import { getItemsBlockContainer as h, getItemsBlockConfig as C, deriveItemNumber as H, getDefaultItemsBlockConfig as B } from "./utils/nodeConfigUtils.js";
13
+ const S = N.Items, P = "Reconcile Items currency DOM attributes";
14
+ class G extends A {
15
+ constructor() {
16
+ super(...arguments);
17
+ /** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
18
+ I(this, "_currencyHealed", /* @__PURE__ */ new Set());
19
+ }
10
20
  getId() {
11
- return p;
21
+ return S;
12
22
  }
13
23
  getIcon() {
14
24
  return "items-icon";
15
25
  }
16
26
  getBlockCompositionType() {
17
- return b.CONTAINER;
27
+ return M.CONTAINER;
18
28
  }
19
29
  getName() {
20
30
  return this.api.translate("Items");
@@ -23,20 +33,20 @@ class E extends C {
23
33
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
34
  }
25
35
  getSettingsPanelTitleHtml() {
26
- return I(
27
- p,
36
+ return _(
37
+ S,
28
38
  this.api.translate("Items"),
29
39
  this.api.translate("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.")
30
40
  );
31
41
  }
32
42
  getTemplate() {
33
- return h({
34
- orientation: l.ORIENTATION.VERTICAL,
35
- itemsType: l.ITEMS_TYPE.CART_ITEMS,
43
+ return E({
44
+ orientation: b.ORIENTATION.VERTICAL,
45
+ itemsType: b.ITEMS_TYPE.CART_ITEMS,
36
46
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: d.productPriceCurrencySymbolControlValue,
38
- currencyLocation: d.productPriceCurrencyLocationControlValue,
39
- formattedPrice: d.productPriceFormattedControlValue === "1"
47
+ currencySymbol: f.productPriceCurrencySymbolControlValue,
48
+ currencyLocation: f.productPriceCurrencyLocationControlValue,
49
+ formattedPrice: f.productPriceFormattedControlValue === "1"
40
50
  });
41
51
  }
42
52
  allowInnerBlocksDND() {
@@ -45,24 +55,27 @@ class E extends C {
45
55
  canBeSavedAsModule() {
46
56
  return !0;
47
57
  }
48
- onCreated(n) {
49
- const t = this.api.getDocumentModifier(), a = this.api.getDocumentRootCssNode();
50
- a.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(a).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
- const e = u(n);
52
- if (!e)
58
+ onCreated(t) {
59
+ const o = this.api.getDocumentModifier(), s = this.api.getDocumentRootCssNode();
60
+ s.querySelector('[product-attr="imageSrc"] img') || o.modifyCss(s).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
61
+ const r = h(t);
62
+ if (!r)
53
63
  return;
54
- const o = e.getNodeConfig(), r = o && Object.keys(o).length > 0, i = f(n);
55
- if (i != null && i.initialized)
56
- if (r)
57
- i.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...i, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
58
- else {
59
- const s = this.api.getDocumentModifier();
60
- s.modifyHtml(e).setNodeConfig(i), this._stampProductTdDomAttributes(e, i, s), s.apply(new c("Migrate legacy config to nodeConfig"));
64
+ const i = r.getNodeConfig(), c = i && Object.keys(i).length > 0, e = C(t);
65
+ if (e != null && e.initialized) {
66
+ if (!c) {
67
+ const u = this.api.getDocumentModifier();
68
+ u.modifyHtml(r).setNodeConfig(e), this._stampProductTdDomAttributes(r, e, u), u.apply(new m("Migrate legacy config to nodeConfig"));
69
+ return;
61
70
  }
62
- else {
63
- const s = N(), m = this.api.getDocumentModifier();
64
- m.modifyHtml(e).setNodeConfig(s), this._stampProductTdDomAttributes(e, s, m, !0), m.apply(new c("Initialize Items block with default configuration")), y().startOnboarding("itemsOnboarding");
71
+ } else {
72
+ const u = B(), g = this.api.getDocumentModifier();
73
+ g.modifyHtml(r).setNodeConfig(u), this._stampProductTdDomAttributes(r, u, g, !0), g.apply(new m("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
74
+ return;
65
75
  }
76
+ const n = e.blockInstanceId || String(Date.now()), p = this.api.getDocumentModifier();
77
+ let y = !1;
78
+ e.blockInstanceId || (p.modifyHtml(r).setNodeConfig({ ...e, blockInstanceId: n }), y = !0), this._shouldReconcileCurrency(e) && this._reconcileCurrencyDomAttributes(r, e, p) && (y = !0), y && p.apply(new m("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
66
79
  }
67
80
  /**
68
81
  * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
@@ -70,18 +83,24 @@ class E extends C {
70
83
  * into nodeConfig, so without this a reused module would reset to defaults.
71
84
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
72
85
  */
73
- onDocumentChanged(n) {
74
- const t = u(n);
75
- if (!t)
86
+ onDocumentChanged(t) {
87
+ const o = h(t);
88
+ if (!o)
76
89
  return;
77
- const a = t.getNodeConfig();
78
- if (a && Object.keys(a).length > 0)
90
+ const s = o.getNodeConfig();
91
+ if (s && Object.keys(s).length > 0) {
92
+ const e = C(t);
93
+ if (e != null && e.initialized && this._shouldReconcileCurrency(e)) {
94
+ const n = this.api.getDocumentModifier();
95
+ this._reconcileCurrencyDomAttributes(o, e, n) && n.apply(new m(P)), this._markCurrencyHealed(e.blockInstanceId);
96
+ }
79
97
  return;
80
- const o = f(n);
81
- if (!(o != null && o.initialized))
98
+ }
99
+ const i = C(t);
100
+ if (!(i != null && i.initialized))
82
101
  return;
83
- const r = this.api.getDocumentModifier();
84
- r.modifyHtml(t).setNodeConfig(o), this._stampProductTdDomAttributes(t, o, r), r.apply(new c("Recover Items block config from saved module"));
102
+ const c = this.api.getDocumentModifier();
103
+ c.modifyHtml(o).setNodeConfig(i), this._stampProductTdDomAttributes(o, i, c), c.apply(new m("Recover Items block config from saved module"));
85
104
  }
86
105
  /**
87
106
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -91,14 +110,44 @@ class E extends C {
91
110
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
92
111
  * relies on this td-level fallback in pairProductVariables.
93
112
  */
94
- _stampProductTdDomAttributes(n, t, a, e = !1) {
95
- const o = D(t.itemsSelectValue, t.type), r = (i, s) => {
96
- e && n.getAttribute(i) || a.modifyHtml(n).setAttribute(i, s);
113
+ _stampProductTdDomAttributes(t, o, s, r = !1) {
114
+ const i = H(o.itemsSelectValue, o.type), c = (e, n) => {
115
+ r && t.getAttribute(e) || s.modifyHtml(t).setAttribute(e, n);
97
116
  };
98
- r("data-type", t.type), r("data-number", o), r("data-nodup", String(t.priceHideDiscount));
117
+ c("data-type", o.type), c("data-number", i), c("data-nodup", String(o.priceHideDiscount));
118
+ }
119
+ /**
120
+ * Whether the currency self-heal should run for this block. Two guards (SD-147588):
121
+ * 1. Config is only authoritative when the symbol was actually customized — a symbol still at
122
+ * the 'USD' sentinel may be a migrator default, so we trust the DOM's real value over a
123
+ * defaulted config and never overwrite it.
124
+ * 2. Heal each instance at most once per session, so the auto-fix can't fight undo (undo
125
+ * re-drifts the attr, which would otherwise re-trigger the heal forever).
126
+ */
127
+ _shouldReconcileCurrency(t) {
128
+ const o = (t.priceCurrencySymbol ?? "").trim();
129
+ return !o || o === f.productPriceCurrencySymbolControlValue ? !1 : !t.blockInstanceId || !this._currencyHealed.has(t.blockInstanceId);
130
+ }
131
+ /** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
132
+ _markCurrencyHealed(t) {
133
+ t && this._currencyHealed.add(t);
134
+ }
135
+ /**
136
+ * Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
137
+ * attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
138
+ * Config is the source of truth — never derive from visible text. Callers gate this with
139
+ * `_shouldReconcileCurrency`. Returns true only when an attr actually changed, so the caller can
140
+ * skip an empty apply that would otherwise re-trigger onDocumentChanged and loop (SD-147588).
141
+ */
142
+ _reconcileCurrencyDomAttributes(t, o, s) {
143
+ const r = O(o.priceCurrencyLocation), i = (o.priceCurrencySymbol ?? "").trim(), c = t.querySelectorAll(`.${R.PRICE} p`);
144
+ let e = !1;
145
+ return c.forEach((n) => {
146
+ n.getAttribute(d.POSITION) !== r && (s.modifyHtml(n).setAttribute(d.POSITION, r), e = !0), i && n.getAttribute(d.SYMBOL) !== i && (s.modifyHtml(n).setAttribute(d.SYMBOL, i), e = !0);
147
+ }), e;
99
148
  }
100
149
  }
101
150
  export {
102
- p as BLOCK_ID,
103
- E as ItemsBlock
151
+ S as BLOCK_ID,
152
+ G as ItemsBlock
104
153
  };
@@ -0,0 +1,11 @@
1
+ const o = {
2
+ POSITION: "data-curency",
3
+ SYMBOL: "data-currency_symbol"
4
+ };
5
+ function c(r) {
6
+ return r === "1" ? "after" : "before";
7
+ }
8
+ export {
9
+ o as ITEMS_CURRENCY_ATTR,
10
+ c as currencyPositionFromLocation
11
+ };
@@ -1,14 +1,15 @@
1
- import { currencyLocationMaps as u } from "../../../../../enums/extensions/recommendationBlock.js";
2
- import { UEAttr as R, ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { CommonControl as N } from "../../../common-control.js";
1
+ import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
2
+ import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { CommonControl as L } from "../../../common-control.js";
4
+ import { ITEMS_CURRENCY_ATTR as T, currencyPositionFromLocation as E } from "../../constants/currency.js";
4
5
  import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
5
- import { getItemsBlockConfig as C, setItemsBlockConfig as I, escapeReplacement as T } from "../../utils/nodeConfigUtils.js";
6
- const E = m.PRICE_CURRENCY_LOCATION, c = {
6
+ import { getItemsBlockConfig as l, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
7
+ const b = m.PRICE_CURRENCY_LOCATION, c = {
7
8
  CURRENCY_LOCATION: "currencyLocation"
8
9
  };
9
- class A extends N {
10
+ class Y extends L {
10
11
  getId() {
11
- return E;
12
+ return b;
12
13
  }
13
14
  getTemplate() {
14
15
  return `
@@ -18,32 +19,32 @@ class A extends N {
18
19
  `;
19
20
  }
20
21
  onRender() {
21
- const e = C(this.currentNode);
22
- this.api.setUIEAttribute(c.CURRENCY_LOCATION, R.SELECTPICKER.items, u), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
22
+ const e = l(this.currentNode);
23
+ this.api.setUIEAttribute(c.CURRENCY_LOCATION, N.SELECTPICKER.items, p), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
23
24
  this._onCurrencyLocationChange(t);
24
25
  });
25
26
  }
26
27
  onTemplateNodeUpdated(e) {
27
28
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = C(this.currentNode);
29
+ const t = l(this.currentNode);
29
30
  this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
30
31
  });
31
32
  }
32
33
  _onCurrencyLocationChange(e) {
33
- if (console.debug("Currency location changed to: ", e), I(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
34
+ if (console.debug("Currency location changed to: ", e), O(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
34
35
  return;
35
36
  const t = this._getPriceBlocks();
36
37
  if (!t || t.length === 0)
37
38
  return;
38
- const r = C(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = this.api.getDocumentModifier();
39
- t.forEach((a) => {
40
- const s = this._getParagraph(a);
41
- if (!s)
39
+ const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = E(n), s = this.api.getDocumentModifier();
40
+ t.forEach((h) => {
41
+ const a = this._getParagraph(h);
42
+ if (!a)
42
43
  return;
43
- const h = s.getInnerHTML().trim() || "", l = s.getInnerText().trim() || "", p = (o == null ? void 0 : o.trim()) || "", d = this._removeCurrencySymbol(l, p), g = this._detectSymbolInText(l) || p, _ = this._buildPriceContent(d, g, n), y = h.replace(l, T(_));
44
- i.modifyHtml(s).setInnerHtml(y);
45
- }), i.apply(new L(
46
- `Updated currency location to ${n === "1" ? "after" : "before"}`
44
+ const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", u = (o == null ? void 0 : o.trim()) || "", _ = this._removeCurrencySymbol(C, u), g = this._detectSymbolInText(C) || u, R = this._buildPriceContent(_, g, n), y = d.replace(C, f(R));
45
+ s.modifyHtml(a).setInnerHtml(y).setAttribute(T.POSITION, i);
46
+ }), s.apply(new I(
47
+ `Updated currency location to ${i}`
47
48
  ));
48
49
  }
49
50
  _getPriceBlocks() {
@@ -65,8 +66,8 @@ class A extends N {
65
66
  } else {
66
67
  const o = r.match(/([^0-9.,\s]+)/);
67
68
  if (o && o[1]) {
68
- const i = o[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
69
- n = r.replace(a, "").trim();
69
+ const i = o[1].trim(), s = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
70
+ n = r.replace(s, "").trim();
70
71
  }
71
72
  }
72
73
  return n;
@@ -85,13 +86,13 @@ class A extends N {
85
86
  this._GuSelect({
86
87
  name: c.CURRENCY_LOCATION,
87
88
  placeholder: "",
88
- options: u
89
+ options: p
89
90
  })
90
91
  ])}
91
92
  `;
92
93
  }
93
94
  }
94
95
  export {
95
- E as CONTROL_BLOCK_ID,
96
- A as PriceCurrencyLocationControl
96
+ b as CONTROL_BLOCK_ID,
97
+ Y as PriceCurrencyLocationControl
97
98
  };
@@ -1,20 +1,21 @@
1
1
  var R = Object.defineProperty;
2
2
  var N = (s, c, e) => c in s ? R(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
3
  var h = (s, c, e) => N(s, typeof c != "symbol" ? c + "" : c, e);
4
- import { ModificationDescription as B } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as E } from "../../../common-control.js";
4
+ import { ModificationDescription as E } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as B } from "../../../common-control.js";
6
+ import { ITEMS_CURRENCY_ATTR as T } from "../../constants/currency.js";
6
7
  import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
7
- import { getItemsBlockConfig as p, setItemsBlockConfig as x, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
8
- const I = y.PRICE_CURRENCY_SYMBOL, u = {
8
+ import { getItemsBlockConfig as p, setItemsBlockConfig as Y, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
9
+ const x = y.PRICE_CURRENCY_SYMBOL, u = {
9
10
  CURRENCY_SYMBOL: "currencySymbol"
10
11
  };
11
- class P extends E {
12
+ class $ extends B {
12
13
  constructor() {
13
14
  super(...arguments);
14
15
  h(this, "originalPriceContents", /* @__PURE__ */ new Map());
15
16
  }
16
17
  getId() {
17
- return I;
18
+ return x;
18
19
  }
19
20
  getTemplate() {
20
21
  return `
@@ -42,7 +43,7 @@ class P extends E {
42
43
  var a;
43
44
  console.debug("Currency symbol changed to: ", e);
44
45
  const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
45
- if (x(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
+ if (Y(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
47
  return;
47
48
  const r = this._getPriceBlocks();
48
49
  if (!r || r.length === 0)
@@ -53,8 +54,8 @@ class P extends E {
53
54
  if (!m)
54
55
  return;
55
56
  const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
- i.modifyHtml(m).setInnerHtml(b).setAttribute("data-currency_symbol", n);
57
- }), i.apply(new B(
57
+ i.modifyHtml(m).setInnerHtml(b).setAttribute(T.SYMBOL, n);
58
+ }), i.apply(new E(
58
59
  `Updated currency symbol to ${n || "removed"}`
59
60
  ));
60
61
  }
@@ -115,6 +116,6 @@ class P extends E {
115
116
  }
116
117
  }
117
118
  export {
118
- I as CONTROL_BLOCK_ID,
119
- P as PriceCurrencySymbolControl
119
+ x as CONTROL_BLOCK_ID,
120
+ $ as PriceCurrencySymbolControl
120
121
  };