@useinsider/guido 3.21.2-beta.4b0fed7 → 3.21.2-beta.4c14c74

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 (45) hide show
  1. package/dist/composables/useSave.js +75 -68
  2. package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  4. package/dist/config/migrator/recommendation/compositionMapper.js +49 -56
  5. package/dist/config/migrator/recommendation/extractors.js +29 -68
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +200 -283
  7. package/dist/config/migrator/recommendation/settingsMapper.js +32 -35
  8. package/dist/config/migrator/recommendationMigrator.js +29 -32
  9. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  10. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  11. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  12. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  13. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  14. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
  15. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
  16. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  17. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  18. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
  19. package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
  20. package/dist/extensions/Blocks/Recommendation/block.js +24 -33
  21. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  22. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
  23. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  24. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +229 -208
  25. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  26. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  28. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  29. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  30. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -1
  32. package/dist/extensions/Blocks/common-control.js +62 -55
  33. package/dist/services/templateLibraryApi.js +36 -31
  34. package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
  35. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +1 -3
  36. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -20
  37. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +11 -4
  40. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -3
  41. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  42. package/dist/src/utils/templatePreparation.d.ts +2 -1
  43. package/dist/utils/pairProductVariables.js +98 -90
  44. package/dist/utils/templatePreparation.js +30 -30
  45. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { PRE_RRS_CONFIG_VERSION as p, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { DEFAULT_CARDS_IN_ROW as d, DEFAULT_MOBILE_ROW_SPACING as S, DEFAULT_MOBILE_COLUMN_SPACING as c, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as s } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
- import { mapLegacyStrategy as _ } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
- function I(t) {
1
+ import { PRE_RRS_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as S, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
+ import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
+ function c(t) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function A(t) {
7
+ function _(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
@@ -14,54 +14,51 @@ function A(t) {
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function R(t) {
17
+ function I(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function N(t) {
20
+ function A(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
23
  function L(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
- const o = t, n = o.value ?? o.name ?? i.code, e = o.symbol ?? n;
26
+ const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
27
27
  return {
28
28
  code: n,
29
- symbol: e,
30
- alignment: I(o.alignment),
31
- decimalCount: A(o.decimalCount),
32
- decimalSeparator: N(o.decimalSeparator),
33
- thousandSeparator: R(o.thousandSeparator)
29
+ symbol: r,
30
+ alignment: c(o.alignment),
31
+ decimalCount: _(o.decimalCount),
32
+ decimalSeparator: A(o.decimalSeparator),
33
+ thousandSeparator: I(o.thousandSeparator)
34
34
  };
35
35
  }
36
- function b(t) {
36
+ function N(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
- const D = ["similarViewed", "similarBought"];
40
- function E(t) {
41
- const o = _(t);
42
- return o && !D.includes(o) ? o : "mostPopular";
39
+ function R(t) {
40
+ return l(t) || "mostPopular";
43
41
  }
44
- function P(t, o, n) {
45
- var a, u;
46
- const e = o.rowCount ?? t.cardsInRow ?? d, m = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
42
+ function O(t, o, n) {
43
+ const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
47
44
  return {
48
45
  recommendationId: n,
49
- strategy: E(t.strategy),
50
- productIds: (t.productIds ?? []).map((r) => String(r)),
51
- size: String(m),
46
+ strategy: R(t.strategy),
47
+ productIds: (t.productIds ?? []).map((e) => String(e)),
48
+ size: String(u),
52
49
  shuffleProducts: !!t.shuffleProducts,
53
50
  language: t.language ?? "en_US",
54
51
  currency: L(t.currencySettings),
55
- filters: (t.filters ?? []).map((r) => ({ ...r })),
56
- layout: b(t.orientation ?? o.orientation),
57
- cardsInRow: e,
58
- mobileCardsInRow: s,
59
- mobileLayoutEnabled: ((u = (a = o.theme) == null ? void 0 : a.blockAdapt) == null ? void 0 : u.adapt) === !0,
60
- previousMobileCardsInRow: s,
52
+ filters: (t.filters ?? []).map((e) => ({ ...e })),
53
+ layout: N(t.orientation ?? o.orientation),
54
+ cardsInRow: r,
55
+ mobileCardsInRow: a,
56
+ mobileLayoutEnabled: !1,
57
+ previousMobileCardsInRow: a,
61
58
  columnSpacing: f,
62
- rowSpacing: l,
63
- mobileColumnSpacing: c,
64
- mobileRowSpacing: S,
59
+ rowSpacing: S,
60
+ mobileColumnSpacing: d,
61
+ mobileRowSpacing: p,
65
62
  omnibusPrice: { textBefore: "", textAfter: "" },
66
63
  omnibusDiscount: { textBefore: "", textAfter: "" },
67
64
  // Preserve the legacy price-placement toggles. Absent legacy keys map to
@@ -69,10 +66,10 @@ function P(t, o, n) {
69
66
  // gated). New Guido blocks default differently (see DEFAULT_NODE_CONFIG).
70
67
  priceMovedToNextLine: !!t.isPriceMovedToNextLine,
71
68
  priceHideIfSameAsDiscounted: !!t.isPriceDeletedForZeroSale,
72
- configVersion: p
69
+ configVersion: s
73
70
  };
74
71
  }
75
72
  export {
76
73
  L as mapCurrency,
77
- P as mapSettings
74
+ O as mapSettings
78
75
  };
@@ -1,51 +1,48 @@
1
- import { BlockId as y } from "../../enums/block.js";
2
- import { DEFAULT_NODE_CONFIG as T } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as d } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useTemplateStore as v } from "../../stores/template.js";
5
- import { mapComposition as b } from "./recommendation/compositionMapper.js";
6
- import { extractCurrencyFromBlock as C, isOldPriceFirst as M, withRenderedTextTheme as R, extractTitleText as h, hasEmptyTitle as w, hasVisibleTitle as x, extractCardBgColor as E, isPartnerManagedBlock as S } from "./recommendation/extractors.js";
7
- import { buildBlockHtml as A } from "./recommendation/htmlBuilder.js";
8
- import { parseRecommendationId as H, parseLegacyConfig as B } from "./recommendation/parseLegacyConfig.js";
9
- import { mapSettings as L } from "./recommendation/settingsMapper.js";
10
- const F = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
11
- function I(n, t, c) {
1
+ import { BlockId as f } from "../../enums/block.js";
2
+ import { DEFAULT_NODE_CONFIG as y } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_RECOMMENDATION_TITLE as b } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useTemplateStore as T } from "../../stores/template.js";
5
+ import { mapComposition as v } from "./recommendation/compositionMapper.js";
6
+ import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
7
+ import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
8
+ import { parseRecommendationId as x, parseLegacyConfig as E } from "./recommendation/parseLegacyConfig.js";
9
+ import { mapSettings as A } from "./recommendation/settingsMapper.js";
10
+ const H = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
11
+ function B(n, t, c) {
12
12
  var l;
13
- const r = H(t);
13
+ const r = x(t);
14
14
  if (r === null)
15
15
  return console.warn(
16
16
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
17
17
  ), !1;
18
- const o = B(t);
18
+ const o = E(t);
19
19
  if (!o)
20
20
  return console.warn(
21
21
  `[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
22
22
  ), !1;
23
23
  const a = c[String(r)] ?? {
24
24
  currencySettings: C(t)
25
- }, i = L(a, o, r), e = b(
26
- R((l = o.composition) == null ? void 0 : l.variables, t),
27
- { oldPriceFirst: M(t) }
28
- ), p = h(t);
29
- w(t) ? e.visibility[d] = !1 : e.titleVariable || (e.visibility[d] = x(t));
30
- const g = E(t), u = {
25
+ }, i = A(a, o, r), e = v((l = o.composition) == null ? void 0 : l.variables), d = M(t);
26
+ e.titleVariable || (e.visibility[b] = R(t));
27
+ const p = S(t), g = {
31
28
  ...i,
32
29
  strategyId: "",
33
30
  composition: e.composition,
34
31
  visibility: e.visibility,
35
- previousTitleHtml: T.previousTitleHtml,
32
+ previousTitleHtml: y.previousTitleHtml,
36
33
  textTrimming: e.anyTextTrimming
37
- }, m = S(t), f = `
34
+ }, m = h(t), u = `
38
35
  <table>
39
36
  <tbody>
40
37
  <tr>
41
38
  <td class="esd-structure" align="left">
42
39
  <table width="100%" cellpadding="0" cellspacing="0">
43
40
  <tbody>
44
- <tr>${A({
45
- nodeConfig: u,
41
+ <tr>${w({
42
+ nodeConfig: g,
46
43
  composition: e,
47
- cardBg: g,
48
- titleText: p,
44
+ cardBg: p,
45
+ titleText: d,
49
46
  legacyId: t.getAttribute("id") ?? void 0,
50
47
  legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
51
48
  preserveInnerHtml: m ? t.innerHTML : void 0,
@@ -57,12 +54,12 @@ function I(n, t, c) {
57
54
  </tr>
58
55
  </tbody>
59
56
  </table>
60
- `, s = n.parseFromString(f, "text/html").querySelector("td.esd-structure");
57
+ `, s = n.parseFromString(u, "text/html").querySelector("td.esd-structure");
61
58
  return !s || !t.parentNode ? (console.warn(
62
59
  `[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
63
60
  ), !1) : (t.parentNode.replaceChild(s, t), !0);
64
61
  }
65
- function K(n, t = {}) {
62
+ function G(n, t = {}) {
66
63
  const c = new DOMParser();
67
64
  let r;
68
65
  try {
@@ -70,12 +67,12 @@ function K(n, t = {}) {
70
67
  } catch (i) {
71
68
  return console.error("[RecommendationMigrator] Failed to parse template:", i), n;
72
69
  }
73
- const o = Array.from(r.querySelectorAll(F));
70
+ const o = Array.from(r.querySelectorAll(H));
74
71
  try {
75
- v().$patch((e) => {
72
+ T().$patch((e) => {
76
73
  e.migrations = {
77
74
  ...e.migrations,
78
- [y.Recommendation]: o.length
75
+ [f.Recommendation]: o.length
79
76
  };
80
77
  });
81
78
  } catch {
@@ -85,12 +82,12 @@ function K(n, t = {}) {
85
82
  let a = 0;
86
83
  return o.forEach((i) => {
87
84
  try {
88
- I(c, i, t) && (a += 1);
85
+ B(c, i, t) && (a += 1);
89
86
  } catch (e) {
90
87
  console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
91
88
  }
92
89
  }), a > 0 && console.info(`[RecommendationMigrator] Migrated ${a} legacy Recommendation block(s)`), r.documentElement.outerHTML;
93
90
  }
94
91
  export {
95
- K as migrateRecommendation
92
+ G as migrateRecommendation
96
93
  };
@@ -1,31 +1,28 @@
1
- import { CommonControl as r } from "../../../common-control.js";
2
- import { ItemsBlockControlId as i } from "../../enums/controlEnums.js";
3
- import { getItemsBlockConfig as o } from "../../utils/nodeConfigUtils.js";
4
- const s = i.BUTTON_LINK, n = {
1
+ import { CommonControl as s } from "../../../common-control.js";
2
+ import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
3
+ import { getItemsBlockConfig as a } from "../../utils/nodeConfigUtils.js";
4
+ const e = r.BUTTON_LINK, n = {
5
5
  LINK: "link"
6
6
  };
7
- class m extends r {
7
+ class L extends s {
8
8
  getId() {
9
- return s;
9
+ return e;
10
10
  }
11
11
  getTemplate() {
12
12
  return `
13
- <div class="container ${s}">
13
+ <div class="container ${e}">
14
14
  ${this._getLink()}
15
15
  </div>
16
16
  `;
17
17
  }
18
18
  onRender() {
19
- const t = o(this.currentNode);
20
- this.api.updateValues({
21
- [n.LINK]: (t == null ? void 0 : t.buttonLink) ?? ""
22
- });
19
+ this.forgetLastPanelNode();
23
20
  }
24
- onTemplateNodeUpdated(t) {
25
- super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
26
- const e = o(this.currentNode);
21
+ onTemplateNodeUpdated(o) {
22
+ super.onTemplateNodeUpdated(o), this.handleBlockInstanceChange(() => {
23
+ const t = a(this.currentNode);
27
24
  this.api.updateValues({
28
- [n.LINK]: (e == null ? void 0 : e.buttonLink) ?? ""
25
+ [n.LINK]: (t == null ? void 0 : t.buttonLink) ?? ""
29
26
  });
30
27
  });
31
28
  }
@@ -44,6 +41,6 @@ class m extends r {
44
41
  }
45
42
  }
46
43
  export {
47
- m as ButtonLinkControl,
48
- s as CONTROL_BLOCK_ID
44
+ L as ButtonLinkControl,
45
+ e as CONTROL_BLOCK_ID
49
46
  };
@@ -1,12 +1,12 @@
1
1
  var I = Object.defineProperty;
2
2
  var U = (d, a, t) => a in d ? I(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
3
- var p = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
3
+ var y = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
4
4
  import { ModificationDescription as c } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as b } from "../../common-control.js";
6
6
  import { ItemsBlockId as r } from "../enums/controlEnums.js";
7
7
  import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
8
8
  import { getItemsBlockConfig as R, setItemsBlockConfig as m } from "../utils/nodeConfigUtils.js";
9
- const g = "ui-elements-items-card-composition-block", i = {
9
+ const N = "ui-elements-items-card-composition-block", i = {
10
10
  PRODUCT_IMAGE: "image",
11
11
  PRODUCT_NAME: "name",
12
12
  PRODUCT_QUANTITY: "quantity",
@@ -17,7 +17,7 @@ const g = "ui-elements-items-card-composition-block", i = {
17
17
  class M extends b {
18
18
  constructor() {
19
19
  super(...arguments);
20
- p(this, "visibilityState", {
20
+ y(this, "visibilityState", {
21
21
  [i.PRODUCT_IMAGE]: !0,
22
22
  [i.PRODUCT_NAME]: !0,
23
23
  [i.PRODUCT_QUANTITY]: !0,
@@ -27,7 +27,7 @@ class M extends b {
27
27
  });
28
28
  }
29
29
  getId() {
30
- return g;
30
+ return N;
31
31
  }
32
32
  getTemplate() {
33
33
  return `
@@ -44,7 +44,7 @@ class M extends b {
44
44
  `;
45
45
  }
46
46
  onRender() {
47
- this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._initializeToggles(), this._listenToFormUpdates();
47
+ this.forgetLastPanelNode(), this._listenToFormUpdates();
48
48
  }
49
49
  onTemplateNodeUpdated(t) {
50
50
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
@@ -61,9 +61,6 @@ class M extends b {
61
61
  </div>
62
62
  `;
63
63
  }
64
- _initializeToggles() {
65
- this._updateTogglesFromState();
66
- }
67
64
  _updateTogglesFromState() {
68
65
  this.api.updateValues({
69
66
  [i.PRODUCT_IMAGE]: this.visibilityState[i.PRODUCT_IMAGE],
@@ -224,21 +221,21 @@ class M extends b {
224
221
  * - When both are visible, they share 50% each
225
222
  */
226
223
  _updatePriceCellWidthsForVerticalLayout(t) {
227
- var O, y;
224
+ var O, p;
228
225
  const e = R(this.currentNode);
229
226
  if (!((e == null ? void 0 : e.orientation) === h.ORIENTATION.VERTICAL))
230
227
  return;
231
- const n = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-price-class"), s = (y = this.currentNode) == null ? void 0 : y.querySelectorAll(".product-original-price-class"), l = (e == null ? void 0 : e.priceOrientation) === "vertical", P = this.visibilityState[i.PRODUCT_PRICE], C = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = t ?? this.api.getDocumentModifier();
228
+ const n = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-price-class"), s = (p = this.currentNode) == null ? void 0 : p.querySelectorAll(".product-original-price-class"), l = (e == null ? void 0 : e.priceOrientation) === "vertical", P = this.visibilityState[i.PRODUCT_PRICE], C = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = t ?? this.api.getDocumentModifier();
232
229
  if (n && n.length > 0) {
233
- const _ = l || !C ? "100%" : "50%";
234
- n.forEach((u) => {
235
- T.modifyHtml(u).setStyle("width", _);
230
+ const u = l || !C ? "100%" : "50%";
231
+ n.forEach((_) => {
232
+ T.modifyHtml(_).setStyle("width", u);
236
233
  });
237
234
  }
238
235
  if (s && s.length > 0) {
239
- const _ = l || !P ? "100%" : "50%";
240
- s.forEach((u) => {
241
- T.modifyHtml(u).setStyle("width", _);
236
+ const u = l || !P ? "100%" : "50%";
237
+ s.forEach((_) => {
238
+ T.modifyHtml(_).setStyle("width", u);
242
239
  });
243
240
  }
244
241
  t || T.apply(new c("Updated price cell widths for vertical layout"));
@@ -256,6 +253,6 @@ class M extends b {
256
253
  }
257
254
  }
258
255
  export {
259
- g as COMPOSITION_CONTROL_BLOCK_ID,
256
+ N as COMPOSITION_CONTROL_BLOCK_ID,
260
257
  M as ItemsBlockCardCompositionControl
261
258
  };
@@ -1,31 +1,28 @@
1
- import { CommonControl as a } from "../../../common-control.js";
2
- import { ItemsBlockControlId as i } from "../../enums/controlEnums.js";
3
- import { getItemsBlockConfig as o } from "../../utils/nodeConfigUtils.js";
4
- const s = i.IMAGE_LINK, n = {
1
+ import { CommonControl as s } from "../../../common-control.js";
2
+ import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
3
+ import { getItemsBlockConfig as a } from "../../utils/nodeConfigUtils.js";
4
+ const t = r.IMAGE_LINK, n = {
5
5
  LINK: "link"
6
6
  };
7
- class p extends a {
7
+ class L extends s {
8
8
  getId() {
9
- return s;
9
+ return t;
10
10
  }
11
11
  getTemplate() {
12
12
  return `
13
- <div class="container ${s}">
13
+ <div class="container ${t}">
14
14
  ${this._getLink()}
15
15
  </div>
16
16
  `;
17
17
  }
18
18
  onRender() {
19
- const e = o(this.currentNode);
20
- this.api.updateValues({
21
- [n.LINK]: (e == null ? void 0 : e.imageLink) ?? ""
22
- });
19
+ this.forgetLastPanelNode();
23
20
  }
24
- onTemplateNodeUpdated(e) {
25
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
26
- const t = o(this.currentNode);
21
+ onTemplateNodeUpdated(o) {
22
+ super.onTemplateNodeUpdated(o), this.handleBlockInstanceChange(() => {
23
+ const e = a(this.currentNode);
27
24
  this.api.updateValues({
28
- [n.LINK]: (t == null ? void 0 : t.imageLink) ?? ""
25
+ [n.LINK]: (e == null ? void 0 : e.imageLink) ?? ""
29
26
  });
30
27
  });
31
28
  }
@@ -44,6 +41,6 @@ class p extends a {
44
41
  }
45
42
  }
46
43
  export {
47
- s as CONTROL_BLOCK_ID,
48
- p as ImageLinkControl
44
+ t as CONTROL_BLOCK_ID,
45
+ L as ImageLinkControl
49
46
  };
@@ -1,9 +1,9 @@
1
- import { ModificationDescription as d, UIElementType as s, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as d, UIElementType as m, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as T } from "../../../common-control.js";
3
3
  import { nameMaxWidthFor as h } from "../../constants/cardLayout.js";
4
4
  import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
5
5
  import { findNameTextNode as c } from "../../utils/nameNode.js";
6
- import { getItemsBlockConfig as r, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
6
+ import { getItemsBlockConfig as s, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
7
7
  const I = a.NAME_TRIMMING, n = {
8
8
  TRIMMING: "trimming"
9
9
  };
@@ -19,14 +19,13 @@ class E extends T {
19
19
  `;
20
20
  }
21
21
  onRender() {
22
- const e = r(this.currentNode);
23
- this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
24
- this._onTrimmingChange(t);
22
+ this.forgetLastPanelNode(), this.api.onValueChanged(n.TRIMMING, (e) => {
23
+ this._onTrimmingChange(e);
25
24
  });
26
25
  }
27
26
  onTemplateNodeUpdated(e) {
28
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
29
- const t = r(this.currentNode);
28
+ const t = s(this.currentNode);
30
29
  this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
31
30
  });
32
31
  }
@@ -37,16 +36,16 @@ class E extends T {
37
36
  const t = c(this.currentNode);
38
37
  if (!t)
39
38
  return;
40
- const i = r(this.currentNode), m = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
41
- m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
39
+ const i = s(this.currentNode), r = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
40
+ r ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${r ? "Enabled" : "Disabled"}`));
42
41
  }
43
42
  _getTextTrimming() {
44
43
  return `
45
44
  <div class="display-flex align-items-center justify-content-between">
46
- <${s.LABEL}
45
+ <${m.LABEL}
47
46
  ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
48
47
  >
49
- </${s.LABEL}>
48
+ </${m.LABEL}>
50
49
  ${this._GuToggle(n.TRIMMING)}
51
50
  </div>
52
51
  `;
@@ -1,33 +1,32 @@
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";
1
+ import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
2
+ import { UEAttr as I, ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { CommonControl as N } from "../../../common-control.js";
4
4
  import { ITEMS_CURRENCY_ATTR as T, currencyPositionFromLocation as E } from "../../constants/currency.js";
5
- import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
6
- import { getItemsBlockConfig as l, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
7
- const b = m.PRICE_CURRENCY_LOCATION, c = {
5
+ import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
6
+ import { getItemsBlockConfig as u, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
7
+ const b = p.PRICE_CURRENCY_LOCATION, a = {
8
8
  CURRENCY_LOCATION: "currencyLocation"
9
9
  };
10
- class Y extends L {
10
+ class B extends N {
11
11
  getId() {
12
12
  return b;
13
13
  }
14
14
  getTemplate() {
15
15
  return `
16
- <div class="container ${m.PRICE_CURRENCY_LOCATION}">
16
+ <div class="container ${p.PRICE_CURRENCY_LOCATION}">
17
17
  ${this._getCurrencyLocation()}
18
18
  </div>
19
19
  `;
20
20
  }
21
21
  onRender() {
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) => {
24
- this._onCurrencyLocationChange(t);
22
+ this.forgetLastPanelNode(), this.api.setUIEAttribute(a.CURRENCY_LOCATION, I.SELECTPICKER.items, m), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
23
+ this._onCurrencyLocationChange(e);
25
24
  });
26
25
  }
27
26
  onTemplateNodeUpdated(e) {
28
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
29
- const t = l(this.currentNode);
30
- this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
28
+ const t = u(this.currentNode);
29
+ this.api.updateValues({ [a.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
31
30
  });
32
31
  }
33
32
  _onCurrencyLocationChange(e) {
@@ -36,15 +35,15 @@ class Y extends L {
36
35
  const t = this._getPriceBlocks();
37
36
  if (!t || t.length === 0)
38
37
  return;
39
- const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = E(n), s = this.api.getDocumentModifier();
38
+ const r = u(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", c = E(n), i = this.api.getDocumentModifier();
40
39
  t.forEach((h) => {
41
- const a = this._getParagraph(h);
42
- if (!a)
40
+ const s = this._getParagraph(h);
41
+ if (!s)
43
42
  return;
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}`
43
+ const d = s.getInnerHTML().trim() || "", l = s.getInnerText().trim() || "", C = (o == null ? void 0 : o.trim()) || "", g = this._removeCurrencySymbol(l, C), _ = this._detectSymbolInText(l) || C, y = this._buildPriceContent(g, _, n), R = d.replace(l, f(y));
44
+ i.modifyHtml(s).setInnerHtml(R).setAttribute(T.POSITION, c);
45
+ }), i.apply(new L(
46
+ `Updated currency location to ${c}`
48
47
  ));
49
48
  }
50
49
  _getPriceBlocks() {
@@ -66,8 +65,8 @@ class Y extends L {
66
65
  } else {
67
66
  const o = r.match(/([^0-9.,\s]+)/);
68
67
  if (o && o[1]) {
69
- const i = o[1].trim(), s = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
70
- n = r.replace(s, "").trim();
68
+ const c = o[1].trim(), i = new RegExp(`\\s*${this._escapeRegex(c)}\\s*`);
69
+ n = r.replace(i, "").trim();
71
70
  }
72
71
  }
73
72
  return n;
@@ -84,9 +83,9 @@ class Y extends L {
84
83
  ${this._GuTwoColumns([
85
84
  this._GuLabel({ text: "Currency Location" }),
86
85
  this._GuSelect({
87
- name: c.CURRENCY_LOCATION,
86
+ name: a.CURRENCY_LOCATION,
88
87
  placeholder: "",
89
- options: p
88
+ options: m
90
89
  })
91
90
  ])}
92
91
  `;
@@ -94,5 +93,5 @@ class Y extends L {
94
93
  }
95
94
  export {
96
95
  b as CONTROL_BLOCK_ID,
97
- Y as PriceCurrencyLocationControl
96
+ B as PriceCurrencyLocationControl
98
97
  };
@@ -2,20 +2,20 @@ 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
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";
5
+ import { CommonControl as f } from "../../../common-control.js";
6
+ import { ITEMS_CURRENCY_ATTR as B } from "../../constants/currency.js";
7
7
  import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
8
- import { getItemsBlockConfig as p, setItemsBlockConfig as Y, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
9
- const x = y.PRICE_CURRENCY_SYMBOL, u = {
8
+ import { getItemsBlockConfig as p, setItemsBlockConfig as T, escapeReplacement as x } from "../../utils/nodeConfigUtils.js";
9
+ const I = y.PRICE_CURRENCY_SYMBOL, u = {
10
10
  CURRENCY_SYMBOL: "currencySymbol"
11
11
  };
12
- class $ extends B {
12
+ class $ extends f {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  h(this, "originalPriceContents", /* @__PURE__ */ new Map());
16
16
  }
17
17
  getId() {
18
- return x;
18
+ return I;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
@@ -25,9 +25,8 @@ class $ extends B {
25
25
  `;
26
26
  }
27
27
  onRender() {
28
- const e = p(this.currentNode);
29
- this.api.updateValues({ [u.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (t) => {
30
- this._onCurrencySymbolChange(t);
28
+ this.forgetLastPanelNode(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (e) => {
29
+ this._onCurrencySymbolChange(e);
31
30
  });
32
31
  }
33
32
  onDestroy() {
@@ -43,7 +42,7 @@ class $ extends B {
43
42
  var a;
44
43
  console.debug("Currency symbol changed to: ", e);
45
44
  const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
46
- if (Y(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
45
+ if (T(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
47
46
  return;
48
47
  const r = this._getPriceBlocks();
49
48
  if (!r || r.length === 0)
@@ -53,8 +52,8 @@ class $ extends B {
53
52
  const m = this._getParagraph(d);
54
53
  if (!m)
55
54
  return;
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));
57
- i.modifyHtml(m).setInnerHtml(b).setAttribute(T.SYMBOL, n);
55
+ const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, x(S));
56
+ i.modifyHtml(m).setInnerHtml(b).setAttribute(B.SYMBOL, n);
58
57
  }), i.apply(new E(
59
58
  `Updated currency symbol to ${n || "removed"}`
60
59
  ));
@@ -116,6 +115,6 @@ class $ extends B {
116
115
  }
117
116
  }
118
117
  export {
119
- x as CONTROL_BLOCK_ID,
118
+ I as CONTROL_BLOCK_ID,
120
119
  $ as PriceCurrencySymbolControl
121
120
  };