@useinsider/guido 3.20.0 → 3.20.1-beta.07e0277

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 (113) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +11 -10
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +114 -103
  5. package/dist/components/organisms/AutoSaveController.vue2.js +19 -9
  6. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  7. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +25 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  9. package/dist/components/organisms/header/EditorActions.vue2.js +57 -72
  10. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  11. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +98 -0
  12. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  13. package/dist/components/organisms/header/HeaderWrapper.vue2.js +9 -17
  14. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  15. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  18. package/dist/components/organisms/header/RightSlot.vue.js +11 -10
  19. package/dist/components/organisms/header/RightSlot.vue2.js +13 -18
  20. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  21. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  22. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +22 -0
  23. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  24. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +19 -0
  25. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +90 -0
  26. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  27. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +60 -35
  28. package/dist/composables/useAccessibilityApi.js +51 -0
  29. package/dist/composables/useCustomInterfaceAppearance.js +42 -41
  30. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  31. package/dist/composables/useStripo.js +4 -3
  32. package/dist/config/compiler/itemsCompilerRules.js +21 -5
  33. package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
  34. package/dist/config/i18n/en/labels.json.js +36 -4
  35. package/dist/config/i18n/en/tooltips.json.js +2 -1
  36. package/dist/config/migrator/itemsBlockMigrator.js +112 -108
  37. package/dist/extensions/Blocks/Items/block.js +76 -64
  38. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  39. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  40. package/dist/extensions/Blocks/Recommendation/block.js +51 -44
  41. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
  42. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +308 -218
  43. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  44. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +232 -186
  45. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
  46. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  47. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
  48. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
  49. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +63 -27
  50. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
  51. package/dist/guido.css +1 -1
  52. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  53. package/dist/package.json.js +1 -1
  54. package/dist/sprite.svg +10 -0
  55. package/dist/src/@types/config/schemas.d.ts +2 -0
  56. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +19 -1
  57. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  58. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -19
  59. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -19
  60. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  61. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  62. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  63. package/dist/src/composables/useAccessibilityApi.d.ts +13 -0
  64. package/dist/src/composables/useActionsApi.d.ts +2 -2
  65. package/dist/src/composables/useConfig.d.ts +2 -0
  66. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
  67. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  68. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  69. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  70. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  71. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  72. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  73. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  78. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  79. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +20 -3
  80. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  81. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  86. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -6
  87. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
  88. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  89. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
  90. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +10 -1
  91. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  92. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  93. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  94. package/dist/src/stores/autosave.d.ts +73 -1
  95. package/dist/src/stores/config.d.ts +20 -0
  96. package/dist/src/stores/editor.d.ts +109 -0
  97. package/dist/src/stores/onboarding.d.ts +966 -35
  98. package/dist/src/stores/version-history.d.ts +1 -1
  99. package/dist/src/utils/liquidProtection.d.ts +3 -0
  100. package/dist/src/utils/timeUtil.d.ts +5 -8
  101. package/dist/static/styles/components/accessibility.css.js +234 -0
  102. package/dist/static/styles/components/button.css.js +5 -0
  103. package/dist/static/styles/variables.css.js +2 -0
  104. package/dist/stores/autosave.js +12 -7
  105. package/dist/stores/editor.js +8 -3
  106. package/dist/stores/onboarding.js +48 -22
  107. package/dist/utils/liquidProtection.js +5 -0
  108. package/dist/utils/templatePreparation.js +61 -85
  109. package/dist/utils/timeUtil.js +6 -17
  110. package/package.json +3 -3
  111. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  112. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  113. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
@@ -1,32 +1,33 @@
1
1
  var k = Object.defineProperty;
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";
2
+ var S = (d, l, t) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
+ var g = (d, l, t) => S(d, typeof l != "symbol" ? l + "" : l, t);
4
+ import { BlockId as D } from "../../../enums/block.js";
5
5
  import { useOnboardingStore as T } from "../../../stores/onboarding.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";
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";
11
12
  import { getDefaultTemplate as O } from "./template.js";
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 {
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 {
15
16
  constructor() {
16
17
  super(...arguments);
17
18
  /** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
18
- y(this, "_currencyHealed", /* @__PURE__ */ new Set());
19
+ g(this, "_currencyHealed", /* @__PURE__ */ new Set());
19
20
  /** blockInstanceIds already claimed by a live block this session (SD-147588 collision detection). */
20
- y(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
21
+ g(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
21
22
  }
22
23
  getId() {
23
- return _;
24
+ return A;
24
25
  }
25
26
  getIcon() {
26
27
  return "items-icon";
27
28
  }
28
29
  getBlockCompositionType() {
29
- return M.CONTAINER;
30
+ return R.CONTAINER;
30
31
  }
31
32
  getName() {
32
33
  return this.api.translate("Items");
@@ -35,20 +36,20 @@ class K extends A {
35
36
  return this.api.translate("Items lets you display personalized products based on user behavior.");
36
37
  }
37
38
  getSettingsPanelTitleHtml() {
38
- return S(
39
- _,
39
+ return N(
40
+ A,
40
41
  this.api.translate("Items"),
41
42
  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.")
42
43
  );
43
44
  }
44
45
  getTemplate() {
45
46
  return O({
46
- orientation: C.ORIENTATION.VERTICAL,
47
- itemsType: C.ITEMS_TYPE.CART_ITEMS,
47
+ orientation: b.ORIENTATION.VERTICAL,
48
+ itemsType: b.ITEMS_TYPE.CART_ITEMS,
48
49
  itemId: "{{Abandoned Cart Item (1) Url}}",
49
- currencySymbol: g.productPriceCurrencySymbolControlValue,
50
- currencyLocation: g.productPriceCurrencyLocationControlValue,
51
- formattedPrice: g.productPriceFormattedControlValue === "1"
50
+ currencySymbol: p.productPriceCurrencySymbolControlValue,
51
+ currencyLocation: p.productPriceCurrencyLocationControlValue,
52
+ formattedPrice: p.productPriceFormattedControlValue === "1"
52
53
  });
53
54
  }
54
55
  allowInnerBlocksDND() {
@@ -58,26 +59,26 @@ class K extends A {
58
59
  return !0;
59
60
  }
60
61
  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)
62
+ const e = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
63
+ c.querySelector('[product-attr="imageSrc"] img') || e.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
64
+ const r = _(t);
65
+ if (!r)
65
66
  return;
66
- const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, e = h(t);
67
- if (e != null && e.initialized) {
68
- if (!s) {
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);
67
+ const o = r.getNodeConfig(), n = o && Object.keys(o).length > 0, i = C(t);
68
+ if (i != null && i.initialized) {
69
+ if (!n) {
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);
71
72
  return;
72
73
  }
73
74
  } else {
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");
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");
76
77
  return;
77
78
  }
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);
79
+ const s = this._resolveInstanceId(i.blockInstanceId), f = this.api.getDocumentModifier();
80
+ let h = !1;
81
+ s !== i.blockInstanceId && (f.modifyHtml(r).setNodeConfig({ ...i, blockInstanceId: s }), h = !0), !this._currencyHealed.has(s) && 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(s);
81
82
  }
82
83
  /**
83
84
  * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
@@ -86,23 +87,23 @@ class K extends A {
86
87
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
87
88
  */
88
89
  onDocumentChanged(t) {
89
- const o = b(t);
90
- if (!o)
90
+ const e = _(t);
91
+ if (!e)
91
92
  return;
92
- const c = o.getNodeConfig();
93
+ const c = e.getNodeConfig();
93
94
  if (c && Object.keys(c).length > 0) {
94
- const e = h(t);
95
- if (e != null && e.initialized && this._shouldReconcileCurrency(e)) {
96
- const n = this.api.getDocumentModifier();
97
- this._reconcileCurrencyDomAttributes(o, e, n) && n.apply(new u(P)), this._markCurrencyHealed(e.blockInstanceId);
95
+ const i = C(t);
96
+ if (i != null && i.initialized && this._shouldReconcileCurrency(i)) {
97
+ const s = this.api.getDocumentModifier();
98
+ this._reconcileCurrencyDomAttributes(e, i, s) && s.apply(new u(V)), this._markCurrencyHealed(i.blockInstanceId);
98
99
  }
99
100
  return;
100
101
  }
101
- const r = h(t);
102
- if (!(r != null && r.initialized))
102
+ const o = C(t);
103
+ if (!(o != null && o.initialized))
103
104
  return;
104
- const s = this.api.getDocumentModifier();
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);
105
+ const n = this.api.getDocumentModifier();
106
+ n.modifyHtml(e).setNodeConfig(o), this._stampProductTdDomAttributes(e, o, n), this._healCollapsedWidths(e, n), this._shouldReconcileCurrency(o) && this._reconcileCurrencyDomAttributes(e, o, n), n.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(o.blockInstanceId);
106
107
  }
107
108
  /**
108
109
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -112,11 +113,22 @@ class K extends A {
112
113
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
113
114
  * relies on this td-level fallback in pairProductVariables.
114
115
  */
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);
116
+ _stampProductTdDomAttributes(t, e, c, r = !1) {
117
+ const o = B(e.itemsSelectValue, e.type), n = (i, s) => {
118
+ r && t.getAttribute(i) || c.modifyHtml(t).setAttribute(i, s);
118
119
  };
119
- s("data-type", o.type), s("data-number", r), s("data-nodup", String(o.priceHideDiscount));
120
+ n("data-type", e.type), n("data-number", o), n("data-nodup", String(e.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(t, e) {
127
+ const r = t.querySelectorAll(M).filter((o) => m(o.getAttribute("width")) || m(o.getStyle("width")));
128
+ return !m(t.getAttribute("width")) && !r.length ? !1 : (t.hasClass("esd-container-frame") && e.modifyHtml(t).removeClass("esd-container-frame"), t.getAttribute("width") !== null && e.modifyHtml(t).removeAttribute("width"), r.forEach((o) => {
129
+ const n = o.getAttribute("width");
130
+ (n === null || m(n)) && e.modifyHtml(o).setAttribute("width", "100%"), m(o.getStyle("width")) && e.modifyHtml(o).setStyle("width", "100%");
131
+ }), !0);
120
132
  }
121
133
  /**
122
134
  * Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
@@ -141,12 +153,12 @@ class K extends A {
141
153
  * or collision, otherwise keep the existing one. Registers the result as claimed.
142
154
  */
143
155
  _resolveInstanceId(t) {
144
- let o = t;
145
- if (!o || this._seenInstanceIds.has(o))
156
+ let e = t;
157
+ if (!e || this._seenInstanceIds.has(e))
146
158
  do
147
- o = E();
148
- while (this._seenInstanceIds.has(o));
149
- return this._seenInstanceIds.add(o), o;
159
+ e = P();
160
+ while (this._seenInstanceIds.has(e));
161
+ return this._seenInstanceIds.add(e), e;
150
162
  }
151
163
  /**
152
164
  * Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
@@ -159,15 +171,15 @@ class K extends A {
159
171
  * Returns true only when an attr actually changed, so the caller can skip an empty apply that
160
172
  * would otherwise re-trigger onDocumentChanged and loop.
161
173
  */
162
- _reconcileCurrencyDomAttributes(t, o, c) {
163
- const { position: i, symbol: r } = H(o), s = t.querySelectorAll(`.${R.PRICE} p`);
164
- let e = !1;
165
- return s.forEach((n) => {
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;
174
+ _reconcileCurrencyDomAttributes(t, e, c) {
175
+ const { position: r, symbol: o } = w(e), n = t.querySelectorAll(`.${E.PRICE} p`);
176
+ let i = !1;
177
+ return n.forEach((s) => {
178
+ r !== void 0 && s.getAttribute(y.POSITION) !== r && (c.modifyHtml(s).setAttribute(y.POSITION, r), i = !0), o !== void 0 && s.getAttribute(y.SYMBOL) !== o && (c.modifyHtml(s).setAttribute(y.SYMBOL, o), i = !0);
179
+ }), i;
168
180
  }
169
181
  }
170
182
  export {
171
- _ as BLOCK_ID,
172
- K as ItemsBlock
183
+ A as BLOCK_ID,
184
+ $ as ItemsBlock
173
185
  };
@@ -0,0 +1,20 @@
1
+ const R = ".ins-product-td", T = ".ins-product-wrapper", s = "width: 100%", c = /(^|;)\s*width\s*:\s*0(?:px|%)?\s*(?:!important)?\s*(?=;|$)/i, n = new RegExp(c.source, "gi"), o = /(^|;)\s*width\s*:/i, _ = /^0(?:px|%)?$/i, a = (t) => _.test((t ?? "").trim()), E = (t) => c.test(t), h = (t) => {
2
+ if (E(t))
3
+ return t.replace(
4
+ n,
5
+ (i, e) => `${e}${e ? " " : ""}${s}`
6
+ );
7
+ if (o.test(t))
8
+ return t;
9
+ const r = t.trim();
10
+ return r ? r.endsWith(";") ? `${r} ${s};` : `${r}; ${s};` : `${s};`;
11
+ }, p = (t) => t.replace(n, (r, i) => i).replace(/;{2,}/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim();
12
+ export {
13
+ R as PRODUCT_TD_SELECTOR,
14
+ T as PRODUCT_WRAPPER_SELECTOR,
15
+ s as WIDTH_PIN_DECLARATION,
16
+ E as hasZeroWidthDeclaration,
17
+ a as isZeroWidthValue,
18
+ h as withWidthPin,
19
+ p as withoutZeroWidth
20
+ };
@@ -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%">
2
+ <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%" style="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">
@@ -1,30 +1,34 @@
1
- var y = Object.defineProperty;
2
- var A = (l, c, t) => c in l ? y(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
- var h = (l, c, t) => A(l, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as d } from "../../../composables/useConfig.js";
5
- import { BlockId as D } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
1
+ var B = Object.defineProperty;
2
+ var b = (a, l, t) => l in a ? B(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
3
+ var d = (a, l, t) => b(a, typeof l != "symbol" ? l + "" : l, t);
4
+ import { useConfig as g } from "../../../composables/useConfig.js";
5
+ import { BlockId as C } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
7
7
  import { Block as E, BlockCompositionType as S, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } from "./constants/defaultConfig.js";
8
+ import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as w } from "./constants/defaultConfig.js";
9
9
  import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
10
10
  import { regenerateMobileProductRows as M } from "./controls/main/utils.js";
11
- import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as w } from "./controls/mobileLayout/cssRules.js";
11
+ import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
- import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
14
- import { getDefaultTemplate as T } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as v } from "./useRecommendationBlockWarning.js";
16
- const k = D.Recommendation, u = "recommendation-block-v2", B = "hide-price";
17
- let b = !1;
18
- class j extends E {
13
+ import { useRecommendationExtensionStore as h } from "./store/recommendation.js";
14
+ import { getDefaultTemplate as x } from "./templates/grid/template.js";
15
+ import { useRecommendationBlockWarning as T } from "./useRecommendationBlockWarning.js";
16
+ import { registerNodeConfigWriter as H } from "./utils/nodeConfigWriter.js";
17
+ import { refreshDuplicatedStrategyBlocks as $ } from "./utils/strategyCommit.js";
18
+ const k = C.Recommendation, u = "recommendation-block-v2", D = "hide-price";
19
+ let y = !1;
20
+ class Y extends E {
19
21
  constructor() {
20
22
  super();
21
23
  /**
22
24
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
23
25
  * This avoids generating a new (different) ID in onCreated().
24
26
  */
25
- h(this, "_pendingBlockId", null);
27
+ d(this, "_pendingBlockId", null);
26
28
  /** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
27
- h(this, "_resetSourceIds", /* @__PURE__ */ new Set());
29
+ d(this, "_resetSourceIds", /* @__PURE__ */ new Set());
30
+ /** Ids handed to duplicates the document root does not show yet: a copied module renames all its blocks at once. */
31
+ d(this, "_unsettledDuplicateIds", /* @__PURE__ */ new Set());
28
32
  }
29
33
  getId() {
30
34
  return k;
@@ -44,7 +48,7 @@ class j extends E {
44
48
  );
45
49
  }
46
50
  getSettingsPanelTitleHtml() {
47
- return C(
51
+ return A(
48
52
  k,
49
53
  this.api.translate("Recommendation Block"),
50
54
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
@@ -68,7 +72,7 @@ class j extends E {
68
72
  */
69
73
  getTemplate() {
70
74
  const t = this._generateNextId();
71
- return this._pendingBlockId = t, T(t);
75
+ return this._pendingBlockId = t, x(t);
72
76
  }
73
77
  /**
74
78
  * Called when a new block is dropped into the template
@@ -91,20 +95,20 @@ class j extends E {
91
95
  }
92
96
  const i = this._pendingBlockId ?? this._generateNextId();
93
97
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
94
- const n = d().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
98
+ const n = g().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: c } = s.initializeConfig(
95
99
  this.api,
96
100
  t,
97
101
  {
98
102
  recommendationId: i,
99
- configVersion: n ? N : O,
100
- ...o ? { partnerName: d().partnerName.value } : {},
103
+ configVersion: n ? N : w,
104
+ ...o ? { partnerName: g().partnerName.value } : {},
101
105
  // An RRS block picks a strategy, not an algorithm, and its algorithm control is
102
106
  // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
103
107
  // at save for a block the user never configured.
104
108
  ...o ? { strategy: "" } : {}
105
109
  }
106
- ), f = g();
107
- if (f.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
110
+ ), f = h();
111
+ if (f.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), c) {
108
112
  I(this.api);
109
113
  const _ = this._getBlockElement(t);
110
114
  _ && (R(this.api, _, !0), M({
@@ -134,11 +138,11 @@ class j extends E {
134
138
  }
135
139
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
136
140
  try {
137
- b || (I(this.api), b = !0);
141
+ y || (I(this.api), y = !0);
138
142
  const e = s.getConfig(t), i = this._getBlockElement(t);
139
143
  if (i) {
140
144
  const n = !e.mobileLayoutEnabled;
141
- w(i) !== n && R(this.api, i, n);
145
+ O(i) !== n && R(this.api, i, n);
142
146
  }
143
147
  } catch {
144
148
  }
@@ -152,7 +156,7 @@ class j extends E {
152
156
  */
153
157
  onDelete(t) {
154
158
  const e = this._getRecommendationId(t);
155
- e && g().removeBlockState(e);
159
+ e && h().removeBlockState(e);
156
160
  }
157
161
  /**
158
162
  * Warns (dark advisory toaster) when the design holds more than one live
@@ -168,7 +172,7 @@ class j extends E {
168
172
  */
169
173
  _warnIfMultipleBlocks() {
170
174
  try {
171
- v().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
175
+ T().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
172
176
  } catch {
173
177
  }
174
178
  }
@@ -178,17 +182,20 @@ class j extends E {
178
182
  */
179
183
  _generateNextId() {
180
184
  let t = 0;
185
+ const e = /* @__PURE__ */ new Set();
181
186
  try {
182
- const e = this.api.getDocumentRoot();
183
- e && "querySelectorAll" in e && e.querySelectorAll(`.${u}`).forEach((n) => {
184
- if ("getAttribute" in n) {
185
- const o = n.getAttribute(m), r = o ? parseInt(o) : 0;
186
- r > t && (t = r);
187
+ const i = this.api.getDocumentRoot();
188
+ i && "querySelectorAll" in i && i.querySelectorAll(`.${u}`).forEach((o) => {
189
+ if ("getAttribute" in o) {
190
+ const r = o.getAttribute(m), c = r ? parseInt(r) : 0;
191
+ e.add(c), c > t && (t = c);
187
192
  }
188
193
  });
189
194
  } catch {
190
195
  }
191
- return t + 1;
196
+ return this._unsettledDuplicateIds.forEach((i) => {
197
+ e.has(i) && this._unsettledDuplicateIds.delete(i);
198
+ }), Math.max(t, ...this._unsettledDuplicateIds) + 1;
192
199
  }
193
200
  /**
194
201
  * Drops the "already fetched" claims of a block that arrived holding a baked id
@@ -198,9 +205,9 @@ class j extends E {
198
205
  * the renamed one depending on where the module was dropped (SD-149916).
199
206
  */
200
207
  _scheduleArrivalReset(t) {
201
- d().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
208
+ g().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
202
209
  const e = this._getRecommendationId(t);
203
- e !== null && e > 0 && !this._resetSourceIds.delete(e) && g().resetArrivedBlock(e);
210
+ e !== null && e > 0 && !this._resetSourceIds.delete(e) && h().resetArrivedBlock(e);
204
211
  }, 0);
205
212
  }
206
213
  /**
@@ -231,9 +238,9 @@ class j extends E {
231
238
  if (!o)
232
239
  return;
233
240
  let r = -1;
234
- for (let a = 0; a < n.length; a++)
235
- if (n[a] === o) {
236
- r = a;
241
+ for (let c = 0; c < n.length; c++)
242
+ if (n[c] === o) {
243
+ r = c;
237
244
  break;
238
245
  }
239
246
  if (r <= 0)
@@ -256,8 +263,8 @@ class j extends E {
256
263
  }
257
264
  /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
258
265
  _handleDuplicate(t, e) {
259
- const i = this._reassignDuplicateId(t, e), n = g();
260
- n.cloneBlockState(e, i), n.setCurrentBlock(i), d().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
266
+ const i = this._reassignDuplicateId(t, e), n = h();
267
+ n.cloneBlockState(e, i), n.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), H(this.api), $(e, i, s.getConfig(t)).catch((o) => console.error("[recommendation] refreshing a duplicated strategy failed", o))), this._warnIfMultipleBlocks();
261
268
  }
262
269
  /**
263
270
  * Core id-reassignment for a duplicated block: rewrites the DOM
@@ -272,7 +279,7 @@ class j extends E {
272
279
  */
273
280
  _reassignDuplicateId(t, e) {
274
281
  const i = this._generateNextId(), n = this._getBlockElement(t);
275
- return this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), s.hasConfig(t) && s.updateConfig(
282
+ return this._unsettledDuplicateIds.add(i), this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), s.hasConfig(t) && s.updateConfig(
276
283
  this.api,
277
284
  t,
278
285
  { recommendationId: i },
@@ -313,7 +320,7 @@ class j extends E {
313
320
  */
314
321
  _stampHidePrice(t, e) {
315
322
  const i = this._getBlockElement(t);
316
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new p("Stamp hide-price"));
323
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(D, String(e)).apply(new p("Stamp hide-price"));
317
324
  }
318
325
  /**
319
326
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -321,7 +328,7 @@ class j extends E {
321
328
  */
322
329
  _healHidePriceAttr(t) {
323
330
  const e = this._getBlockElement(t);
324
- if (!e || !("getAttribute" in e) || e.getAttribute(B) !== null)
331
+ if (!e || !("getAttribute" in e) || e.getAttribute(D) !== null)
325
332
  return;
326
333
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
327
334
  this._stampHidePrice(t, i);
@@ -359,5 +366,5 @@ class j extends E {
359
366
  }
360
367
  export {
361
368
  k as BLOCK_ID,
362
- j as RecommendationBlock
369
+ Y as RecommendationBlock
363
370
  };