@useinsider/guido 3.20.0-beta.30c96fc → 3.20.0-beta.3ad13f5

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 (32) hide show
  1. package/dist/composables/useStripo.js +4 -3
  2. package/dist/config/compiler/itemsCompilerRules.js +5 -14
  3. package/dist/config/compiler/utils/itemsCompilerUtils.js +21 -48
  4. package/dist/config/migrator/itemsBlockMigrator.js +108 -112
  5. package/dist/extensions/Blocks/Items/block.js +67 -78
  6. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  7. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  8. package/dist/package.json.js +1 -1
  9. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +0 -5
  10. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  11. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  12. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -5
  13. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  14. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  15. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  16. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  17. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  18. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  19. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  20. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  21. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  23. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  24. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  25. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  26. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  27. package/dist/static/styles/components/button.css.js +5 -0
  28. package/package.json +3 -3
  29. package/dist/extensions/Blocks/Items/constants/cardWidth.js +0 -20
  30. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +0 -12
  31. package/dist/src/utils/liquidProtection.d.ts +0 -3
  32. package/dist/utils/liquidProtection.js +0 -5
@@ -1,33 +1,32 @@
1
1
  var k = Object.defineProperty;
2
- var S = (d, l, e) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[l] = e;
3
- var g = (d, l, e) => S(d, typeof l != "symbol" ? l + "" : l, e);
4
- import { BlockId as D } from "../../../enums/block.js";
2
+ var D = (l, a, t) => a in l ? k(l, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[a] = t;
3
+ var y = (l, a, t) => D(l, typeof a != "symbol" ? a + "" : a, t);
4
+ import { BlockId as N } from "../../../enums/block.js";
5
5
  import { useOnboardingStore as T } from "../../../stores/onboarding.js";
6
- import { getMigrationBannerHtml as N } from "../../../utils/migrationBannerHtml.js";
7
- import { Block as H, BlockCompositionType as R, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { PRODUCT_WRAPPER_SELECTOR as M, isZeroWidthValue as m } from "./constants/cardWidth.js";
9
- import { currencyAttrTargets as w, ITEMS_CURRENCY_ATTR as y } from "./constants/currency.js";
10
- import { ItemsBlockId as E } from "./enums/controlEnums.js";
11
- import { SETTINGS_ENUMS as b, DefaultConfigValues as p } from "./enums/settingsEnums.js";
6
+ import { getMigrationBannerHtml as S } from "../../../utils/migrationBannerHtml.js";
7
+ import { Block as A, BlockCompositionType as M, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { currencyAttrTargets as H, ITEMS_CURRENCY_ATTR as m } from "./constants/currency.js";
9
+ import { ItemsBlockId as R } from "./enums/controlEnums.js";
10
+ import { SETTINGS_ENUMS as C, DefaultConfigValues as g } from "./enums/settingsEnums.js";
12
11
  import { getDefaultTemplate as O } from "./template.js";
13
- import { getItemsBlockContainer as _, getItemsBlockConfig as C, deriveItemNumber as B, generateBlockInstanceId as P, getDefaultItemsBlockConfig as v } from "./utils/nodeConfigUtils.js";
14
- const A = D.Items, V = "Reconcile Items currency DOM attributes";
15
- class $ extends H {
12
+ import { getItemsBlockContainer as b, getItemsBlockConfig as h, deriveItemNumber as B, generateBlockInstanceId as E, getDefaultItemsBlockConfig as w } from "./utils/nodeConfigUtils.js";
13
+ const _ = N.Items, P = "Reconcile Items currency DOM attributes";
14
+ class K extends A {
16
15
  constructor() {
17
16
  super(...arguments);
18
17
  /** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
19
- g(this, "_currencyHealed", /* @__PURE__ */ new Set());
18
+ y(this, "_currencyHealed", /* @__PURE__ */ new Set());
20
19
  /** blockInstanceIds already claimed by a live block this session (SD-147588 collision detection). */
21
- g(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
20
+ y(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
22
21
  }
23
22
  getId() {
24
- return A;
23
+ return _;
25
24
  }
26
25
  getIcon() {
27
26
  return "items-icon";
28
27
  }
29
28
  getBlockCompositionType() {
30
- return R.CONTAINER;
29
+ return M.CONTAINER;
31
30
  }
32
31
  getName() {
33
32
  return this.api.translate("Items");
@@ -36,20 +35,20 @@ class $ extends H {
36
35
  return this.api.translate("Items lets you display personalized products based on user behavior.");
37
36
  }
38
37
  getSettingsPanelTitleHtml() {
39
- return N(
40
- A,
38
+ return S(
39
+ _,
41
40
  this.api.translate("Items"),
42
41
  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.")
43
42
  );
44
43
  }
45
44
  getTemplate() {
46
45
  return O({
47
- orientation: b.ORIENTATION.VERTICAL,
48
- itemsType: b.ITEMS_TYPE.CART_ITEMS,
46
+ orientation: C.ORIENTATION.VERTICAL,
47
+ itemsType: C.ITEMS_TYPE.CART_ITEMS,
49
48
  itemId: "{{Abandoned Cart Item (1) Url}}",
50
- currencySymbol: p.productPriceCurrencySymbolControlValue,
51
- currencyLocation: p.productPriceCurrencyLocationControlValue,
52
- formattedPrice: p.productPriceFormattedControlValue === "1"
49
+ currencySymbol: g.productPriceCurrencySymbolControlValue,
50
+ currencyLocation: g.productPriceCurrencyLocationControlValue,
51
+ formattedPrice: g.productPriceFormattedControlValue === "1"
53
52
  });
54
53
  }
55
54
  allowInnerBlocksDND() {
@@ -58,27 +57,27 @@ class $ extends H {
58
57
  canBeSavedAsModule() {
59
58
  return !0;
60
59
  }
61
- onCreated(e) {
62
- const t = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
63
- c.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
64
- const r = _(e);
65
- if (!r)
60
+ onCreated(t) {
61
+ const o = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
62
+ c.querySelector('[product-attr="imageSrc"] img') || o.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
63
+ const i = b(t);
64
+ if (!i)
66
65
  return;
67
- const o = r.getNodeConfig(), s = o && Object.keys(o).length > 0, i = C(e);
68
- if (i != null && i.initialized) {
66
+ const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, e = h(t);
67
+ if (e != null && e.initialized) {
69
68
  if (!s) {
70
- const a = this.api.getDocumentModifier();
71
- a.modifyHtml(r).setNodeConfig(i), this._stampProductTdDomAttributes(r, i, a), this._healCollapsedWidths(r, a), this._shouldReconcileCurrency(i) && this._reconcileCurrencyDomAttributes(r, i, a), a.apply(new u("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(i.blockInstanceId);
69
+ const d = this.api.getDocumentModifier();
70
+ d.modifyHtml(i).setNodeConfig(e), this._stampProductTdDomAttributes(i, e, d), this._shouldReconcileCurrency(e) && this._reconcileCurrencyDomAttributes(i, e, d), d.apply(new u("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(e.blockInstanceId);
72
71
  return;
73
72
  }
74
73
  } else {
75
- const a = v(), I = this.api.getDocumentModifier();
76
- I.modifyHtml(r).setNodeConfig(a), this._stampProductTdDomAttributes(r, a, I, !0), I.apply(new u("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
74
+ const d = w(), p = this.api.getDocumentModifier();
75
+ p.modifyHtml(i).setNodeConfig(d), this._stampProductTdDomAttributes(i, d, p, !0), p.apply(new u("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
77
76
  return;
78
77
  }
79
- const n = this._resolveInstanceId(i.blockInstanceId), f = this.api.getDocumentModifier();
80
- let h = !1;
81
- n !== i.blockInstanceId && (f.modifyHtml(r).setNodeConfig({ ...i, blockInstanceId: n }), h = !0), !this._currencyHealed.has(n) && this._reconcileCurrencyDomAttributes(r, i, f) && (h = !0), this._healCollapsedWidths(r, f) && (h = !0), h && f.apply(new u("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
78
+ const n = this._resolveInstanceId(e.blockInstanceId), f = this.api.getDocumentModifier();
79
+ let I = !1;
80
+ n !== e.blockInstanceId && (f.modifyHtml(i).setNodeConfig({ ...e, blockInstanceId: n }), I = !0), !this._currencyHealed.has(n) && this._reconcileCurrencyDomAttributes(i, e, f) && (I = !0), I && f.apply(new u("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
82
81
  }
83
82
  /**
84
83
  * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
@@ -86,24 +85,24 @@ class $ extends H {
86
85
  * into nodeConfig, so without this a reused module would reset to defaults.
87
86
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
88
87
  */
89
- onDocumentChanged(e) {
90
- const t = _(e);
91
- if (!t)
88
+ onDocumentChanged(t) {
89
+ const o = b(t);
90
+ if (!o)
92
91
  return;
93
- const c = t.getNodeConfig();
92
+ const c = o.getNodeConfig();
94
93
  if (c && Object.keys(c).length > 0) {
95
- const i = C(e);
96
- if (i != null && i.initialized && this._shouldReconcileCurrency(i)) {
94
+ const e = h(t);
95
+ if (e != null && e.initialized && this._shouldReconcileCurrency(e)) {
97
96
  const n = this.api.getDocumentModifier();
98
- this._reconcileCurrencyDomAttributes(t, i, n) && n.apply(new u(V)), this._markCurrencyHealed(i.blockInstanceId);
97
+ this._reconcileCurrencyDomAttributes(o, e, n) && n.apply(new u(P)), this._markCurrencyHealed(e.blockInstanceId);
99
98
  }
100
99
  return;
101
100
  }
102
- const o = C(e);
103
- if (!(o != null && o.initialized))
101
+ const r = h(t);
102
+ if (!(r != null && r.initialized))
104
103
  return;
105
104
  const s = this.api.getDocumentModifier();
106
- s.modifyHtml(t).setNodeConfig(o), this._stampProductTdDomAttributes(t, o, s), this._healCollapsedWidths(t, s), this._shouldReconcileCurrency(o) && this._reconcileCurrencyDomAttributes(t, o, s), s.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(o.blockInstanceId);
105
+ s.modifyHtml(o).setNodeConfig(r), this._stampProductTdDomAttributes(o, r, s), this._shouldReconcileCurrency(r) && this._reconcileCurrencyDomAttributes(o, r, s), s.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(r.blockInstanceId);
107
106
  }
108
107
  /**
109
108
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -113,21 +112,11 @@ class $ extends H {
113
112
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
114
113
  * relies on this td-level fallback in pairProductVariables.
115
114
  */
116
- _stampProductTdDomAttributes(e, t, c, r = !1) {
117
- const o = B(t.itemsSelectValue, t.type), s = (i, n) => {
118
- r && e.getAttribute(i) || c.modifyHtml(e).setAttribute(i, n);
115
+ _stampProductTdDomAttributes(t, o, c, i = !1) {
116
+ const r = B(o.itemsSelectValue, o.type), s = (e, n) => {
117
+ i && t.getAttribute(e) || c.modifyHtml(t).setAttribute(e, n);
119
118
  };
120
- s("data-type", t.type), s("data-number", o), s("data-nodup", String(t.priceHideDiscount));
121
- }
122
- /**
123
- * Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
124
- * on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
125
- */
126
- _healCollapsedWidths(e, t) {
127
- const r = e.querySelectorAll(M).filter((o) => m(o.getAttribute("width")) || m(o.getStyle("width")));
128
- return !m(e.getAttribute("width")) && !r.length ? !1 : (e.hasClass("esd-container-frame") && t.modifyHtml(e).removeClass("esd-container-frame"), e.getAttribute("width") !== null && t.modifyHtml(e).removeAttribute("width"), r.forEach((o) => {
129
- m(o.getAttribute("width")) && t.modifyHtml(o).setAttribute("width", "100%"), m(o.getStyle("width")) && t.modifyHtml(o).setStyle("width", "100%");
130
- }), !0);
119
+ s("data-type", o.type), s("data-number", r), s("data-nodup", String(o.priceHideDiscount));
131
120
  }
132
121
  /**
133
122
  * Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
@@ -137,12 +126,12 @@ class $ extends H {
137
126
  * the symbol write alone is skipped for the 'USD' sentinel — so we must NOT gate the whole pass
138
127
  * on symbol customization here, or a default-symbol block with a toggled location never heals.
139
128
  */
140
- _shouldReconcileCurrency(e) {
141
- return !e.blockInstanceId || !this._currencyHealed.has(e.blockInstanceId);
129
+ _shouldReconcileCurrency(t) {
130
+ return !t.blockInstanceId || !this._currencyHealed.has(t.blockInstanceId);
142
131
  }
143
132
  /** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
144
- _markCurrencyHealed(e) {
145
- e && this._currencyHealed.add(e);
133
+ _markCurrencyHealed(t) {
134
+ t && this._currencyHealed.add(t);
146
135
  }
147
136
  /**
148
137
  * Resolves the id for a just-created block to one that is unique per live instance.
@@ -151,13 +140,13 @@ class $ extends H {
151
140
  * currency heal guard and settings-panel switch detection. Mint a fresh id on absence
152
141
  * or collision, otherwise keep the existing one. Registers the result as claimed.
153
142
  */
154
- _resolveInstanceId(e) {
155
- let t = e;
156
- if (!t || this._seenInstanceIds.has(t))
143
+ _resolveInstanceId(t) {
144
+ let o = t;
145
+ if (!o || this._seenInstanceIds.has(o))
157
146
  do
158
- t = P();
159
- while (this._seenInstanceIds.has(t));
160
- return this._seenInstanceIds.add(t), t;
147
+ o = E();
148
+ while (this._seenInstanceIds.has(o));
149
+ return this._seenInstanceIds.add(o), o;
161
150
  }
162
151
  /**
163
152
  * Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
@@ -170,15 +159,15 @@ class $ extends H {
170
159
  * Returns true only when an attr actually changed, so the caller can skip an empty apply that
171
160
  * would otherwise re-trigger onDocumentChanged and loop.
172
161
  */
173
- _reconcileCurrencyDomAttributes(e, t, c) {
174
- const { position: r, symbol: o } = w(t), s = e.querySelectorAll(`.${E.PRICE} p`);
175
- let i = !1;
162
+ _reconcileCurrencyDomAttributes(t, o, c) {
163
+ const { position: i, symbol: r } = H(o), s = t.querySelectorAll(`.${R.PRICE} p`);
164
+ let e = !1;
176
165
  return s.forEach((n) => {
177
- r !== void 0 && n.getAttribute(y.POSITION) !== r && (c.modifyHtml(n).setAttribute(y.POSITION, r), i = !0), o !== void 0 && n.getAttribute(y.SYMBOL) !== o && (c.modifyHtml(n).setAttribute(y.SYMBOL, o), i = !0);
178
- }), i;
166
+ i !== void 0 && n.getAttribute(m.POSITION) !== i && (c.modifyHtml(n).setAttribute(m.POSITION, i), e = !0), r !== void 0 && n.getAttribute(m.SYMBOL) !== r && (c.modifyHtml(n).setAttribute(m.SYMBOL, r), e = !0);
167
+ }), e;
179
168
  }
180
169
  }
181
170
  export {
182
- A as BLOCK_ID,
183
- $ as ItemsBlock
171
+ _ as BLOCK_ID,
172
+ K as ItemsBlock
184
173
  };
@@ -1,5 +1,5 @@
1
1
  const t = `{-{-TEMPLATE_FIRST_LINE-}-}
2
- <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%" style="width: 100%;">
2
+ <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%">
3
3
  <tbody>
4
4
  <tr>
5
5
  <td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">