@useinsider/guido 3.17.0-beta.17c2940 → 3.17.0-beta.1f18d2d

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 (24) hide show
  1. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +6 -6
  2. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +40 -35
  3. package/dist/composables/useModuleRepair.js +33 -0
  4. package/dist/composables/useStripo.js +1 -1
  5. package/dist/config/i18n/en/labels.json.js +1 -1
  6. package/dist/extensions/Blocks/Items/block.js +118 -49
  7. package/dist/extensions/Blocks/Items/constants/currency.js +25 -0
  8. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  9. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  10. package/dist/extensions/Blocks/Items/template.js +153 -152
  11. package/dist/extensions/Blocks/Recommendation/block.js +12 -11
  12. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +14 -13
  13. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -106
  14. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +9 -9
  15. package/dist/src/composables/useModuleRepair.d.ts +18 -0
  16. package/dist/src/extensions/Blocks/Items/block.d.ts +35 -0
  17. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +43 -0
  18. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
  19. package/dist/src/utils/itemsCurrencyRepair.d.ts +17 -0
  20. package/dist/utils/itemsCurrencyRepair.js +39 -0
  21. package/dist/utils/pairProductVariables.js +58 -58
  22. package/package.json +1 -1
  23. package/dist/composables/useModuleDynamicContentRepair.js +0 -37
  24. package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -13
@@ -1,11 +1,11 @@
1
- const c = ".recommendation-block-v2", n = ".ins-recommendation-product-container", _ = ".ins-recommendation-desktop-container", R = ".ins-recommendation-mobile-container", r = ".ins-recommendation-mobile-row", e = "reco-v3-button", A = "ins-skip-compile", E = {
1
+ const c = ".recommendation-block-v2", n = ".ins-recommendation-product-container", _ = ".ins-recommendation-desktop-container", R = ".ins-recommendation-mobile-container", e = ".ins-recommendation-mobile-row", r = "reco-v3-button", A = "ins-skip-compile", E = {
2
2
  CURRENCY: "currency",
3
3
  SYMBOL: "currency-symbol",
4
4
  ALIGNMENT: "currency-alignment",
5
5
  THOUSAND_SEPARATOR: "currency-thousand-separator",
6
6
  DECIMAL_SEPARATOR: "currency-decimal-separator",
7
7
  DECIMAL_COUNT: "currency-decimal-count"
8
- }, s = "productImage", O = "productName", i = "productPrice", C = "productOldPrice", S = "productOmnibusPrice", I = "productOmnibusDiscount", a = "productButton", u = "recommendationTitle", T = "ins-recommendation-title", m = `.${T}`, L = "customAttr:", d = "data-custom-attributes", U = "data-card-composition", N = "product-attr", t = "recommendation-attribute-row", P = `.${t}`, D = "data-attribute-type", p = "data-visibility", B = "spacer", M = "product_attribute.", o = /* @__PURE__ */ new Set([
8
+ }, s = "productImage", O = "productName", i = "productPrice", C = "productOldPrice", S = "productOmnibusPrice", I = "productOmnibusDiscount", a = "productButton", m = "recommendationTitle", T = "ins-recommendation-title", u = `.${T}`, L = "customAttr:", d = "data-custom-attributes", U = "data-card-composition", N = "recommendation-id", D = "product-attr", t = "recommendation-attribute-row", P = `.${t}`, p = "data-attribute-type", B = "data-visibility", M = "spacer", l = "product_attribute.", o = /* @__PURE__ */ new Set([
9
9
  "name",
10
10
  // productName
11
11
  "price",
@@ -20,18 +20,18 @@ const c = ".recommendation-block-v2", n = ".ins-recommendation-product-container
20
20
  // productOmnibusPrice
21
21
  "omnibus_discount"
22
22
  // productOmnibusDiscount
23
- ]), l = /* @__PURE__ */ new Set([
23
+ ]), b = /* @__PURE__ */ new Set([
24
24
  ...o,
25
25
  "currency",
26
26
  "discount"
27
27
  ]);
28
28
  export {
29
29
  L as ATTR_CUSTOM_PREFIX,
30
- D as ATTR_DATA_ATTRIBUTE_TYPE,
30
+ p as ATTR_DATA_ATTRIBUTE_TYPE,
31
31
  U as ATTR_DATA_CARD_COMPOSITION,
32
32
  d as ATTR_DATA_CUSTOM_ATTRIBUTES,
33
- p as ATTR_DATA_VISIBILITY,
34
- N as ATTR_PRODUCT_ATTR,
33
+ B as ATTR_DATA_VISIBILITY,
34
+ D as ATTR_PRODUCT_ATTR,
35
35
  a as ATTR_PRODUCT_BUTTON,
36
36
  s as ATTR_PRODUCT_IMAGE,
37
37
  O as ATTR_PRODUCT_NAME,
@@ -39,21 +39,22 @@ export {
39
39
  I as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
40
40
  S as ATTR_PRODUCT_OMNIBUS_PRICE,
41
41
  i as ATTR_PRODUCT_PRICE,
42
- u as ATTR_RECOMMENDATION_TITLE,
42
+ m as ATTR_RECOMMENDATION_TITLE,
43
43
  c as BLOCK_ROOT_SELECTOR,
44
44
  o as BUILT_IN_DEFAULT_ATTRIBUTES,
45
45
  n as CONTAINER_SELECTOR,
46
46
  t as CSS_CLASS_ATTRIBUTE_ROW,
47
- e as CSS_CLASS_RECO_BUTTON,
47
+ r as CSS_CLASS_RECO_BUTTON,
48
48
  A as CSS_CLASS_SKIP_COMPILE,
49
- B as CSS_CLASS_SPACER,
49
+ M as CSS_CLASS_SPACER,
50
50
  T as CSS_CLASS_TITLE_CELL,
51
51
  E as CURRENCY_ATTR,
52
52
  _ as DESKTOP_CONTAINER_SELECTOR,
53
53
  R as MOBILE_CONTAINER_SELECTOR,
54
- r as MOBILE_ROW_SELECTOR,
55
- M as PRODUCT_ATTRIBUTE_PREFIX,
56
- l as RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES,
54
+ e as MOBILE_ROW_SELECTOR,
55
+ l as PRODUCT_ATTRIBUTE_PREFIX,
56
+ N as RECOMMENDATION_ID_ATTR,
57
+ b as RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES,
57
58
  P as SELECTOR_ATTRIBUTE_ROW,
58
- m as SELECTOR_TITLE_CELL
59
+ u as SELECTOR_TITLE_CELL
59
60
  };
@@ -1,65 +1,66 @@
1
1
  var m = Object.defineProperty;
2
2
  var C = (h, l, t) => l in h ? m(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
3
- var r = (h, l, t) => C(h, typeof l != "symbol" ? l + "" : l, t);
3
+ var n = (h, l, t) => C(h, typeof l != "symbol" ? l + "" : l, t);
4
4
  import { useConfig as p } from "../../../../../composables/useConfig.js";
5
5
  import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as N } from "../../../common-control.js";
7
7
  import { CURRENT_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
8
+ import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
8
9
  import { RecommendationConfigService as c } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as I } from "../../store/recommendation.js";
10
- import { registerNodeConfigWriter as R } from "../../utils/nodeConfigWriter.js";
11
- import { AlgorithmControl as b } from "./algorithm.js";
12
- import { ALGORITHM_CONTROL_ID as ct } from "./algorithm.js";
13
- import { CurrencyControl as T } from "./currency.js";
14
- import { CURRENCY_CONTROL_ID as dt } from "./currency.js";
15
- import { FiltersControl as P } from "./filters.js";
16
- import { FILTERS_CONTROL_ID as ft } from "./filters.js";
17
- import { LayoutOrientationControl as S } from "./layoutOrientation.js";
18
- import { LAYOUT_ORIENTATION_CONTROL_ID as mt } from "./layoutOrientation.js";
19
- import { LocaleControl as O } from "./locale.js";
20
- import { LOCALE_CONTROL_ID as pt } from "./locale.js";
21
- import { PricePlacementControl as L } from "./pricePlacement.js";
22
- import { PRICE_PLACEMENT_CONTROL_ID as Nt } from "./pricePlacement.js";
23
- import { ProductCountControl as E } from "./productCount.js";
24
- import { PRODUCT_COUNT_CONTROL_ID as It } from "./productCount.js";
25
- import { ProductLayoutControl as k } from "./productLayout.js";
26
- import { PRODUCT_LAYOUT_CONTROL_ID as bt } from "./productLayout.js";
27
- import { ShuffleControl as D } from "./shuffle.js";
28
- import { SHUFFLE_CONTROL_ID as Pt } from "./shuffle.js";
29
- import { StrategyControl as F } from "./strategy.js";
30
- import { STRATEGY_CONTROL_ID as Ot } from "./strategy.js";
31
- import { setCurrencyAttributes as w, getBlockElement as A, isPartnerManagedBlock as v, updateProductContentInPlace as x, regenerateProductRowsWithStyles as B } from "./utils.js";
32
- import { adjustProductsToSize as Et, formatProductPrice as kt, getCardComposition as Dt, getCurrentLayout as Ft, getMainContainerTbody as wt, regenerateMobileProductRows as At, updatePricesInPlace as vt, updateSingleProductContent as xt } from "./utils.js";
10
+ import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
11
+ import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
12
+ import { AlgorithmControl as T } from "./algorithm.js";
13
+ import { ALGORITHM_CONTROL_ID as ut } from "./algorithm.js";
14
+ import { CurrencyControl as P } from "./currency.js";
15
+ import { CURRENCY_CONTROL_ID as ht } from "./currency.js";
16
+ import { FiltersControl as S } from "./filters.js";
17
+ import { FILTERS_CONTROL_ID as gt } from "./filters.js";
18
+ import { LayoutOrientationControl as O } from "./layoutOrientation.js";
19
+ import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
20
+ import { LocaleControl as L } from "./locale.js";
21
+ import { LOCALE_CONTROL_ID as yt } from "./locale.js";
22
+ import { PricePlacementControl as E } from "./pricePlacement.js";
23
+ import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
24
+ import { ProductCountControl as k } from "./productCount.js";
25
+ import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
26
+ import { ProductLayoutControl as D } from "./productLayout.js";
27
+ import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
28
+ import { ShuffleControl as F } from "./shuffle.js";
29
+ import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
30
+ import { StrategyControl as w } from "./strategy.js";
31
+ import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
32
+ import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
33
+ import { adjustProductsToSize as kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
33
34
  import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
34
- const U = "recommendation-id", $ = "ui-elements-recommendation-block";
35
- class st extends N {
35
+ const $ = "ui-elements-recommendation-block";
36
+ class at extends N {
36
37
  constructor() {
37
38
  super(...arguments);
38
- r(this, "store", I());
39
- r(this, "storeUnsubscription", () => {
39
+ n(this, "store", R());
40
+ n(this, "storeUnsubscription", () => {
40
41
  });
41
42
  // blockId -> fingerprint of the node config as it looked at the last sync.
42
- r(this, "syncedConfigs", /* @__PURE__ */ new Map());
43
+ n(this, "syncedConfigs", /* @__PURE__ */ new Map());
43
44
  // A config change waiting to reach the node config. Deferred so it can ride the
44
45
  // re-render's single apply() — one user action must cost one undo press.
45
- r(this, "pendingNodeConfigWrite", null);
46
- r(this, "pendingConfigFlushTimer", null);
46
+ n(this, "pendingNodeConfigWrite", null);
47
+ n(this, "pendingConfigFlushTimer", null);
47
48
  // Sub-control instances for lifecycle management
48
- r(this, "algorithmControl", null);
49
- r(this, "localeControl", null);
50
- r(this, "currencyControl", null);
51
- r(this, "productCountControl", null);
52
- r(this, "productLayoutControl", null);
53
- r(this, "filtersControl", null);
54
- r(this, "shuffleControl", null);
55
- r(this, "pricePlacementControl", null);
56
- r(this, "layoutOrientationControl", null);
57
- r(this, "strategyControl", null);
58
- r(this, "rrsEnabled", !1);
49
+ n(this, "algorithmControl", null);
50
+ n(this, "localeControl", null);
51
+ n(this, "currencyControl", null);
52
+ n(this, "productCountControl", null);
53
+ n(this, "productLayoutControl", null);
54
+ n(this, "filtersControl", null);
55
+ n(this, "shuffleControl", null);
56
+ n(this, "pricePlacementControl", null);
57
+ n(this, "layoutOrientationControl", null);
58
+ n(this, "strategyControl", null);
59
+ n(this, "rrsEnabled", !1);
59
60
  /**
60
61
  * Debounced product fetch to prevent rapid API calls during config changes
61
62
  */
62
- r(this, "_debouncedFetchProducts", f(async () => {
63
+ n(this, "_debouncedFetchProducts", f(async () => {
63
64
  try {
64
65
  await this.store.fetchRecommendationProducts();
65
66
  } finally {
@@ -77,20 +78,20 @@ class st extends N {
77
78
  * count. The store pads products to the configured size, so in-place only
78
79
  * fails when the size actually changed.
79
80
  */
80
- r(this, "_debouncedRegenerateWithProducts", f(() => {
81
+ n(this, "_debouncedRegenerateWithProducts", f(() => {
81
82
  const t = this.store.recommendationProducts;
82
83
  if (!this.currentNode || !this.api)
83
84
  return;
84
85
  const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
85
- if (v(this.currentNode)) {
86
+ if (x(this.currentNode)) {
86
87
  o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
87
88
  return;
88
89
  }
89
- x({
90
+ B({
90
91
  currentNode: this.currentNode,
91
92
  documentModifier: e,
92
93
  products: t
93
- }) || B({
94
+ }) || U({
94
95
  currentNode: this.currentNode,
95
96
  documentModifier: e,
96
97
  products: t
@@ -119,7 +120,7 @@ class st extends N {
119
120
  return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
120
121
  var o;
121
122
  return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
122
- }), this.algorithmControl = new b(), this.localeControl = new O(), this.currencyControl = new T(), this.productCountControl = new E(), this.productLayoutControl = new k(), this.filtersControl = new P(), this.shuffleControl = new D(), this.pricePlacementControl = new L(), this.layoutOrientationControl = new S(), this.strategyControl = this.rrsEnabled ? new F() : null, this._subControls.forEach((e) => {
123
+ }), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new k(), this.productLayoutControl = new D(), this.filtersControl = new S(), this.shuffleControl = new F(), this.pricePlacementControl = new E(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
123
124
  e && (e.api = this.api);
124
125
  }), `
125
126
  <div class="recommendation-controls-container">
@@ -141,12 +142,12 @@ class st extends N {
141
142
  const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
142
143
  if (!e)
143
144
  return;
144
- const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
145
- e.classList.toggle("strategy-block", n);
145
+ const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
146
+ e.classList.toggle("strategy-block", r);
146
147
  }
147
148
  async onRender() {
148
149
  var o;
149
- R(this.api);
150
+ b(this.api);
150
151
  const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
151
152
  if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
152
153
  this._initializeSubControls();
@@ -160,9 +161,9 @@ class st extends N {
160
161
  const e = this._getRecommendationIdFromNode(t);
161
162
  e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigIfChanged(e), this._showControlsForBlock(t), e !== null && !((o = this.store.blockStates[e]) != null && o.isInitialized) && this._fetchBlockData(e).then(() => {
162
163
  this._initializeSubControls();
163
- }), this._subControls.forEach((n) => {
164
+ }), this._subControls.forEach((r) => {
164
165
  var i;
165
- n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
166
+ r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
166
167
  });
167
168
  }
168
169
  onDestroy() {
@@ -209,11 +210,11 @@ class st extends N {
209
210
  const t = this.store.currentRecommendationId;
210
211
  if (!this.currentNode || !this.api || t === null)
211
212
  return;
212
- const { filters: e, strategyId: o, size: n } = this.store.recommendationConfigs;
213
+ const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
213
214
  this.pendingNodeConfigWrite = {
214
215
  blockId: t,
215
216
  node: this.currentNode,
216
- updates: { filters: e, strategyId: o, size: n }
217
+ updates: { filters: e, strategyId: o, size: r }
217
218
  };
218
219
  }
219
220
  /**
@@ -256,8 +257,8 @@ class st extends N {
256
257
  JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategyId === t.updates.strategyId && o.size === t.updates.size || c.updateConfig(this.api, e, t.updates, "Update recommendation filters");
257
258
  }
258
259
  _syncNodeConfigToStore() {
259
- var n;
260
- const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
260
+ var r;
261
+ const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
261
262
  this.store.patchCurrentBlockConfig({
262
263
  strategy: t.strategy,
263
264
  strategyId: t.strategyId,
@@ -299,8 +300,8 @@ class st extends N {
299
300
  t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
300
301
  this.store.fetchRecommendationCreateData(),
301
302
  this.store.fetchRecommendationFilters()
302
- ])).forEach((o, n) => {
303
- o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][n]} failed`, o.reason);
303
+ ])).forEach((o, r) => {
304
+ o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
304
305
  }), this._applySmartDefaults();
305
306
  try {
306
307
  await this.store.fetchRecommendationProducts();
@@ -322,7 +323,7 @@ class st extends N {
322
323
  if (!this.currentNode || !this.api)
323
324
  return;
324
325
  const t = c.getConfig(this.currentNode), e = {};
325
- let o = null, n = null, i = null;
326
+ let o = null, r = null, i = null;
326
327
  if (t.currency.code === a.currency.code) {
327
328
  const { currencyList: s } = this.store;
328
329
  s.length > 0 && (s.some(
@@ -337,7 +338,7 @@ class st extends N {
337
338
  const s = this.store.getActivePredictiveAlgorithms;
338
339
  s.length > 0 && (s.some(
339
340
  (d) => d.value === a.strategy
340
- ) || (n = s[0].value, e.strategy = n));
341
+ ) || (r = s[0].value, e.strategy = r));
341
342
  }
342
343
  if (t.language === a.language) {
343
344
  const s = this.store.getLanguages;
@@ -345,12 +346,12 @@ class st extends N {
345
346
  (d) => d.value === a.language
346
347
  ) || (i = s[0].value, e.language = i));
347
348
  }
348
- !o && !n && !i || (c.updateConfig(
349
+ !o && !r && !i || (c.updateConfig(
349
350
  this.api,
350
351
  this.currentNode,
351
352
  e,
352
353
  "Applied smart defaults"
353
- ), o && e.currency && w({
354
+ ), o && e.currency && A({
354
355
  currentNode: this.currentNode,
355
356
  documentModifier: this.api.getDocumentModifier(),
356
357
  currency: e.currency
@@ -366,7 +367,7 @@ class st extends N {
366
367
  thousandSeparator: a.currency.thousandSeparator
367
368
  }
368
369
  } : {},
369
- ...n ? { strategy: n } : {},
370
+ ...r ? { strategy: r } : {},
370
371
  ...i ? { language: i } : {}
371
372
  }, { triggerRefetch: !1 }));
372
373
  }
@@ -374,14 +375,14 @@ class st extends N {
374
375
  * Reads the recommendation-id attribute from the block element within the node
375
376
  */
376
377
  _getRecommendationIdFromNode(t) {
377
- const e = A(t);
378
+ const e = v(t);
378
379
  if (!e || !("getAttribute" in e))
379
380
  return null;
380
- const o = e.getAttribute(U);
381
+ const o = e.getAttribute(I);
381
382
  if (!o)
382
383
  return null;
383
- const n = parseInt(o);
384
- return Number.isNaN(n) ? null : n;
384
+ const r = parseInt(o);
385
+ return Number.isNaN(r) ? null : r;
385
386
  }
386
387
  /**
387
388
  * Listen to store changes that require product refresh or regeneration.
@@ -398,11 +399,11 @@ class st extends N {
398
399
  */
399
400
  _listenStateUpdates() {
400
401
  const { store: t } = this;
401
- let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
402
+ let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
402
403
  this.storeUnsubscription = t.$subscribe(() => {
403
404
  const i = t.currentRecommendationId;
404
- if (i !== n) {
405
- n = i, e = t.recommendationProducts, o = t.$state.configVersion;
405
+ if (i !== r) {
406
+ r = i, e = t.recommendationProducts, o = t.$state.configVersion;
406
407
  return;
407
408
  }
408
409
  const s = t.$state.configVersion;
@@ -413,39 +414,39 @@ class st extends N {
413
414
  }
414
415
  }
415
416
  export {
416
- ct as ALGORITHM_CONTROL_ID,
417
- b as AlgorithmControl,
417
+ ut as ALGORITHM_CONTROL_ID,
418
+ T as AlgorithmControl,
418
419
  $ as CONTROL_BLOCK_ID,
419
- dt as CURRENCY_CONTROL_ID,
420
- T as CurrencyControl,
421
- ft as FILTERS_CONTROL_ID,
422
- P as FiltersControl,
423
- mt as LAYOUT_ORIENTATION_CONTROL_ID,
424
- pt as LOCALE_CONTROL_ID,
425
- S as LayoutOrientationControl,
426
- O as LocaleControl,
427
- Nt as PRICE_PLACEMENT_CONTROL_ID,
428
- It as PRODUCT_COUNT_CONTROL_ID,
429
- bt as PRODUCT_LAYOUT_CONTROL_ID,
430
- L as PricePlacementControl,
431
- E as ProductCountControl,
432
- k as ProductLayoutControl,
433
- st as RecommendationBlockControl,
434
- Pt as SHUFFLE_CONTROL_ID,
435
- Ot as STRATEGY_CONTROL_ID,
436
- D as ShuffleControl,
437
- F as StrategyControl,
438
- Et as adjustProductsToSize,
439
- kt as formatProductPrice,
440
- A as getBlockElement,
441
- Dt as getCardComposition,
442
- Ft as getCurrentLayout,
443
- wt as getMainContainerTbody,
444
- v as isPartnerManagedBlock,
445
- At as regenerateMobileProductRows,
446
- B as regenerateProductRowsWithStyles,
447
- w as setCurrencyAttributes,
448
- vt as updatePricesInPlace,
449
- x as updateProductContentInPlace,
450
- xt as updateSingleProductContent
420
+ ht as CURRENCY_CONTROL_ID,
421
+ P as CurrencyControl,
422
+ gt as FILTERS_CONTROL_ID,
423
+ S as FiltersControl,
424
+ Ct as LAYOUT_ORIENTATION_CONTROL_ID,
425
+ yt as LOCALE_CONTROL_ID,
426
+ O as LayoutOrientationControl,
427
+ L as LocaleControl,
428
+ _t as PRICE_PLACEMENT_CONTROL_ID,
429
+ Rt as PRODUCT_COUNT_CONTROL_ID,
430
+ Tt as PRODUCT_LAYOUT_CONTROL_ID,
431
+ E as PricePlacementControl,
432
+ k as ProductCountControl,
433
+ D as ProductLayoutControl,
434
+ at as RecommendationBlockControl,
435
+ St as SHUFFLE_CONTROL_ID,
436
+ Lt as STRATEGY_CONTROL_ID,
437
+ F as ShuffleControl,
438
+ w as StrategyControl,
439
+ kt as adjustProductsToSize,
440
+ Dt as formatProductPrice,
441
+ v as getBlockElement,
442
+ Ft as getCardComposition,
443
+ wt as getCurrentLayout,
444
+ At as getMainContainerTbody,
445
+ x as isPartnerManagedBlock,
446
+ vt as regenerateMobileProductRows,
447
+ U as regenerateProductRowsWithStyles,
448
+ A as setCurrencyAttributes,
449
+ xt as updatePricesInPlace,
450
+ B as updateProductContentInPlace,
451
+ Bt as updateSingleProductContent
451
452
  };
@@ -1,22 +1,22 @@
1
1
  import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { isPartnerManagedBlock as d, updateProductContentInPlace as m, regenerateProductRowsWithStyles as a } from "../controls/main/utils.js";
3
- import { RecommendationConfigService as l } from "../services/configService.js";
4
- const s = "recommendation-id";
2
+ import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
3
+ import { isPartnerManagedBlock as a, updateProductContentInPlace as d, regenerateProductRowsWithStyles as l } from "../controls/main/utils.js";
4
+ import { RecommendationConfigService as s } from "../services/configService.js";
5
5
  let e = null;
6
- function M(r) {
6
+ function N(r) {
7
7
  e = r;
8
8
  }
9
- function N(r, c, i, u) {
9
+ function D(r, c, i, u) {
10
10
  const n = e == null ? void 0 : e.getDocumentRootHtmlNode();
11
11
  if (!e || !n || !("querySelector" in n))
12
12
  return !1;
13
- const t = n.querySelector(`[${s}="${r}"]`);
13
+ const t = n.querySelector(`[${m}="${r}"]`);
14
14
  if (!t)
15
15
  return !1;
16
16
  const o = e.getDocumentModifier();
17
- return l.stageConfig(o, t, c), d(t) ? (o.apply(new f(u)), !0) : (m({ currentNode: t, documentModifier: o, products: i }) || a({ currentNode: t, documentModifier: o, products: i }), !0);
17
+ return s.stageConfig(o, t, c), a(t) ? (o.apply(new f(u)), !0) : (d({ currentNode: t, documentModifier: o, products: i }) || l({ currentNode: t, documentModifier: o, products: i }), !0);
18
18
  }
19
19
  export {
20
- N as commitBlockChangeOutsidePanel,
21
- M as registerNodeConfigWriter
20
+ D as commitBlockChangeOutsidePanel,
21
+ N as registerNodeConfigWriter
22
22
  };
@@ -0,0 +1,18 @@
1
+ import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
2
+ export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
3
+ /**
4
+ * Repairs saved modules as they are dropped or copied into the editor, in one pass
5
+ * over the module HTML. Two independent repairs run through a single write-back:
6
+ *
7
+ * - Dynamic content: saved modules serialize merge-tag chips by their display label
8
+ * (`{{ Phone Number }}`); this maps them back to their canonical token
9
+ * (`{{phone_number}}`) using the account's dynamic-content list.
10
+ * - Items currency: v2 Items blocks can carry price `data-curency` /
11
+ * `data-currency_symbol` attrs that drifted from their `esd-ext-config`; these are
12
+ * healed from config (the export contract reads those exact attrs).
13
+ *
14
+ * Wired into Stripo via the `onModuleAdd` init callback (see `useStripo`).
15
+ */
16
+ export declare const useModuleRepair: () => {
17
+ handleModuleAdd: (data: ModuleAddData, modifier: ModuleModifier) => void;
18
+ };
@@ -16,6 +16,10 @@ export declare const BLOCK_ID: BlockId;
16
16
  * - Onboarding support
17
17
  */
18
18
  export declare class ItemsBlock extends Block {
19
+ /** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
20
+ private _currencyHealed;
21
+ /** blockInstanceIds already claimed by a live block this session (SD-147588 collision detection). */
22
+ private _seenInstanceIds;
19
23
  getId(): string;
20
24
  getIcon(): string;
21
25
  getBlockCompositionType(): BlockCompositionType;
@@ -42,4 +46,35 @@ export declare class ItemsBlock extends Block {
42
46
  * relies on this td-level fallback in pairProductVariables.
43
47
  */
44
48
  private _stampProductTdDomAttributes;
49
+ /**
50
+ * Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
51
+ * once-per-session: heal each instance at most once, so the auto-fix can't fight undo (undo
52
+ * re-drifts the attr, which would otherwise re-trigger the heal forever). The position-vs-symbol
53
+ * authority split lives in `_reconcileCurrencyDomAttributes` — position is always authoritative,
54
+ * the symbol write alone is skipped for the 'USD' sentinel — so we must NOT gate the whole pass
55
+ * on symbol customization here, or a default-symbol block with a toggled location never heals.
56
+ */
57
+ private _shouldReconcileCurrency;
58
+ /** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
59
+ private _markCurrencyHealed;
60
+ /**
61
+ * Resolves the id for a just-created block to one that is unique per live instance.
62
+ * A saved module serializes its blockInstanceId, so every re-drop of the same module
63
+ * arrives with an id already owned by a live instance — reusing it collides both the
64
+ * currency heal guard and settings-panel switch detection. Mint a fresh id on absence
65
+ * or collision, otherwise keep the existing one. Registers the result as claimed.
66
+ */
67
+ private _resolveInstanceId;
68
+ /**
69
+ * Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
70
+ * attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
71
+ * Config is the source of truth — never derive from visible text.
72
+ *
73
+ * Authority split lives in `currencyAttrTargets` (SD-147588) — position only when a location
74
+ * is recorded, symbol only when customized — so this heal and the module-drop repair can't drift.
75
+ *
76
+ * Returns true only when an attr actually changed, so the caller can skip an empty apply that
77
+ * would otherwise re-trigger onDocumentChanged and loop.
78
+ */
79
+ private _reconcileCurrencyDomAttributes;
45
80
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Single owner for the Items price currency export contract (SD-147588).
3
+ *
4
+ * `data-curency` is deliberately misspelled (one `r`) — it is the attribute the
5
+ * server-side export transform (pairProductVariables) actually reads, so every
6
+ * layer that writes it and the live reader (template, controls, block self-heal,
7
+ * pairProductVariables) MUST go through these constants. A typo fix or mapping change
8
+ * in one of them would otherwise silently break sync with the others and ship the wrong
9
+ * currency position/token to the inbox. Mirrors the Recommendation block's `CURRENCY_ATTR`.
10
+ *
11
+ * Exception: the legacy migrator reads the raw misspelled string on purpose — it parses
12
+ * old templates frozen with that exact attr name, so it must NOT follow a future rename here.
13
+ */
14
+ export declare const ITEMS_CURRENCY_ATTR: {
15
+ readonly POSITION: "data-curency";
16
+ readonly SYMBOL: "data-currency_symbol";
17
+ };
18
+ /** Currency location select value `'1'` = after (price then symbol), anything else = before. */
19
+ export declare function currencyPositionFromLocation(location: string | undefined): 'after' | 'before';
20
+ /**
21
+ * Whether a currency symbol is a partner customization vs the 'USD' default sentinel (SD-144644).
22
+ * The default value means "use the catalog currency", so it is treated as NOT customized — the one
23
+ * rule shared by the export transform (pairProductVariables) and the block self-heal, kept here so
24
+ * the two layers can never drift. Trims first so a whitespace-only value is not read as custom.
25
+ */
26
+ export declare function isCustomCurrencySymbol(symbol: string | null | undefined): boolean;
27
+ export interface CurrencyAttrTargets {
28
+ /** Desired `data-curency`; `undefined` = leave the DOM attr as-is (no location recorded). */
29
+ position?: 'before' | 'after';
30
+ /** Desired `data-currency_symbol`; `undefined` = leave it (empty / the 'USD' sentinel). */
31
+ symbol?: string;
32
+ }
33
+ /**
34
+ * The single authority rule for which price currency attrs a config wants written,
35
+ * shared by the block self-heal (Items/block.ts) and the module-drop repair
36
+ * (itemsCurrencyRepair) so the two can never drift (SD-147588). Position is authoritative
37
+ * only when a location is explicitly recorded (an absent value is "unknown", not 'before');
38
+ * the symbol is written only for a custom value (never the 'USD' default sentinel).
39
+ */
40
+ export declare function currencyAttrTargets(config: {
41
+ priceCurrencyLocation?: string;
42
+ priceCurrencySymbol?: string;
43
+ }): CurrencyAttrTargets;
@@ -72,6 +72,8 @@ export declare const ATTR_CUSTOM_PREFIX = "customAttr:";
72
72
  export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
73
73
  /** HTML data attribute on the block root holding the comma-joined composition order */
74
74
  export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
75
+ /** HTML attribute on the block root carrying its per-document unique id */
76
+ export declare const RECOMMENDATION_ID_ATTR = "recommendation-id";
75
77
  /** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
76
78
  export declare const ATTR_PRODUCT_ATTR = "product-attr";
77
79
  /** Class every composition attribute row carries — the visibility toggle and the compiler both key on it */
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Heals stale price currency attributes on every v2 Items block inside a dropped
3
+ * saved module, driving `data-curency` / `data-currency_symbol` from each block's
4
+ * `esd-ext-config`. A saved module can serialize attrs that no longer match its
5
+ * config; the server-side export reads those exact attrs, so left stale they ship
6
+ * the wrong currency position/symbol.
7
+ *
8
+ * Pure `string → string`. Returns the original string untouched when nothing needs
9
+ * healing (0 blocks, all in sync) so the caller's `html !== currentHtml` guard stays
10
+ * meaningful. Fail-open: any parse fault returns the input unchanged.
11
+ *
12
+ * The module `<td>` stripe has no table context, so it is wrapped before parsing —
13
+ * a bare `<td>` root is otherwise dropped by the HTML parser (same reason
14
+ * recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
15
+ * root foster-parented out), it bails to the original string.
16
+ */
17
+ export declare function repairItemsCurrencyAttributes(html: string): string;
@@ -0,0 +1,39 @@
1
+ import { currencyAttrTargets as u, ITEMS_CURRENCY_ATTR as c } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { ItemsBlockId as l } from "../extensions/Blocks/Items/enums/controlEnums.js";
3
+ const s = "items-block-v2";
4
+ function f(e) {
5
+ const i = e.getAttribute("esd-ext-config");
6
+ if (!i)
7
+ return !1;
8
+ let t, r;
9
+ try {
10
+ ({ position: t, symbol: r } = u(JSON.parse(i)));
11
+ } catch {
12
+ return !1;
13
+ }
14
+ let o = !1;
15
+ return e.querySelectorAll(`.${l.PRICE} p`).forEach((n) => {
16
+ t !== void 0 && n.getAttribute(c.POSITION) !== t && (n.setAttribute(c.POSITION, t), o = !0), r !== void 0 && n.getAttribute(c.SYMBOL) !== r && (n.setAttribute(c.SYMBOL, r), o = !0);
17
+ }), o;
18
+ }
19
+ function S(e) {
20
+ if (typeof e != "string" || !e.includes(s))
21
+ return e;
22
+ try {
23
+ const t = new DOMParser().parseFromString(
24
+ `<table><tbody><tr>${e}</tr></tbody></table>`,
25
+ "text/html"
26
+ ).querySelector("tr"), r = t.querySelectorAll(`.${s}`);
27
+ if (r.length === 0)
28
+ return e;
29
+ let o = !1;
30
+ return r.forEach((n) => {
31
+ f(n) && (o = !0);
32
+ }), o ? t.innerHTML : e;
33
+ } catch (i) {
34
+ return console.error("Failed to repair items currency on module add:", i), e;
35
+ }
36
+ }
37
+ export {
38
+ S as repairItemsCurrencyAttributes
39
+ };