@useinsider/guido 3.19.0-beta.e110e88 → 3.19.0-beta.e424587

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 (81) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +6 -6
  3. package/dist/components/Guido.vue2.js +96 -85
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  6. package/dist/components/wrappers/WpModal.vue.js +1 -1
  7. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  8. package/dist/composables/useAuthError.js +52 -0
  9. package/dist/composables/useAutoSave.js +11 -11
  10. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  11. package/dist/composables/useEmailTemplateApplier.js +111 -50
  12. package/dist/composables/useHttp.js +64 -54
  13. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  14. package/dist/composables/useStripo.js +24 -20
  15. package/dist/composables/useToaster.js +17 -15
  16. package/dist/composables/validators/useLiquidValidator.js +15 -15
  17. package/dist/config/compiler/itemsCompilerRules.js +14 -5
  18. package/dist/config/compiler/utils/itemsCompilerUtils.js +48 -21
  19. package/dist/config/migrator/index.js +14 -13
  20. package/dist/config/migrator/itemsBlockMigrator.js +245 -253
  21. package/dist/config/migrator/recommendationMigrator.js +28 -21
  22. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  23. package/dist/enums/extensions/recommendationBlock.js +30 -29
  24. package/dist/extensions/Blocks/Items/block.js +78 -67
  25. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  26. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  27. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  29. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  30. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  31. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  32. package/dist/extensions/Blocks/Items/template.js +219 -204
  33. package/dist/extensions/Blocks/Recommendation/block.js +21 -22
  34. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +97 -107
  35. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  36. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +203 -209
  37. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +67 -91
  38. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +21 -26
  39. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  40. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  41. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +16 -55
  42. package/dist/guido.css +1 -1
  43. package/dist/src/@types/config/schemas.d.ts +16 -0
  44. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  45. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  46. package/dist/src/composables/useAuthError.d.ts +12 -0
  47. package/dist/src/composables/useConfig.d.ts +2 -0
  48. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  49. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  50. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  51. package/dist/src/composables/useHttp.d.ts +2 -0
  52. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +5 -0
  53. package/dist/src/config/migrator/index.d.ts +2 -1
  54. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  55. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  57. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  58. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  59. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  60. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  61. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
  62. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -13
  63. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  64. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +1 -3
  65. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  66. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -7
  67. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  68. package/dist/src/stores/config.d.ts +20 -0
  69. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  70. package/dist/src/stores/onboarding.d.ts +4 -0
  71. package/dist/src/stores/recommendation.d.ts +5 -0
  72. package/dist/src/utils/dateUtil.d.ts +10 -0
  73. package/dist/src/utils/genericUtil.d.ts +3 -0
  74. package/dist/src/utils/liquidProtection.d.ts +3 -0
  75. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  76. package/dist/static/styles/components/version-history.css.js +2 -6
  77. package/dist/stores/guido-email-editor.js +3 -1
  78. package/dist/stores/onboarding.js +4 -0
  79. package/dist/utils/liquidProtection.js +5 -0
  80. package/dist/utils/pairProductVariables.js +71 -71
  81. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- var b = Object.defineProperty;
2
- var C = (l, c, t) => c in l ? b(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
- var d = (l, c, t) => C(l, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as h } from "../../../composables/useConfig.js";
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
5
  import { BlockId as D } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
6
+ import { getMigrationBannerHtml as C } 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
8
  import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } from "./constants/defaultConfig.js";
9
9
  import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
@@ -12,21 +12,19 @@ import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLa
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
13
  import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
14
14
  import { getDefaultTemplate as T } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as x } from "./useRecommendationBlockWarning.js";
16
- import { registerNodeConfigWriter as H } from "./utils/nodeConfigWriter.js";
17
- import { refreshDuplicatedStrategyBlocks as $ } from "./utils/strategyCommit.js";
18
- const k = D.Recommendation, u = "recommendation-block-v2", y = "hide-price";
19
- let B = !1;
20
- class Y extends E {
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 {
21
19
  constructor() {
22
20
  super();
23
21
  /**
24
22
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
25
23
  * This avoids generating a new (different) ID in onCreated().
26
24
  */
27
- d(this, "_pendingBlockId", null);
25
+ h(this, "_pendingBlockId", null);
28
26
  /** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
29
- d(this, "_resetSourceIds", /* @__PURE__ */ new Set());
27
+ h(this, "_resetSourceIds", /* @__PURE__ */ new Set());
30
28
  }
31
29
  getId() {
32
30
  return k;
@@ -46,7 +44,7 @@ class Y extends E {
46
44
  );
47
45
  }
48
46
  getSettingsPanelTitleHtml() {
49
- return A(
47
+ return C(
50
48
  k,
51
49
  this.api.translate("Recommendation Block"),
52
50
  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.")
@@ -93,12 +91,13 @@ class Y extends E {
93
91
  }
94
92
  const i = this._pendingBlockId ?? this._generateNextId();
95
93
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
96
- const n = h().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
94
+ const n = d().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
97
95
  this.api,
98
96
  t,
99
97
  {
100
98
  recommendationId: i,
101
99
  configVersion: n ? N : O,
100
+ ...o ? { partnerName: d().partnerName.value } : {},
102
101
  // An RRS block picks a strategy, not an algorithm, and its algorithm control is
103
102
  // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
104
103
  // at save for a block the user never configured.
@@ -135,7 +134,7 @@ class Y extends E {
135
134
  }
136
135
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
137
136
  try {
138
- B || (I(this.api), B = !0);
137
+ b || (I(this.api), b = !0);
139
138
  const e = s.getConfig(t), i = this._getBlockElement(t);
140
139
  if (i) {
141
140
  const n = !e.mobileLayoutEnabled;
@@ -169,7 +168,7 @@ class Y extends E {
169
168
  */
170
169
  _warnIfMultipleBlocks() {
171
170
  try {
172
- x().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
171
+ v().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
173
172
  } catch {
174
173
  }
175
174
  }
@@ -199,7 +198,7 @@ class Y extends E {
199
198
  * the renamed one depending on where the module was dropped (SD-149916).
200
199
  */
201
200
  _scheduleArrivalReset(t) {
202
- h().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
201
+ d().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
203
202
  const e = this._getRecommendationId(t);
204
203
  e !== null && e > 0 && !this._resetSourceIds.delete(e) && g().resetArrivedBlock(e);
205
204
  }, 0);
@@ -258,7 +257,7 @@ class Y extends E {
258
257
  /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
259
258
  _handleDuplicate(t, e) {
260
259
  const i = this._reassignDuplicateId(t, e), n = g();
261
- n.cloneBlockState(e, i), n.setCurrentBlock(i), h().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();
260
+ n.cloneBlockState(e, i), n.setCurrentBlock(i), d().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
262
261
  }
263
262
  /**
264
263
  * Core id-reassignment for a duplicated block: rewrites the DOM
@@ -314,7 +313,7 @@ class Y extends E {
314
313
  */
315
314
  _stampHidePrice(t, e) {
316
315
  const i = this._getBlockElement(t);
317
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(y, String(e)).apply(new p("Stamp hide-price"));
316
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new p("Stamp hide-price"));
318
317
  }
319
318
  /**
320
319
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -322,7 +321,7 @@ class Y extends E {
322
321
  */
323
322
  _healHidePriceAttr(t) {
324
323
  const e = this._getBlockElement(t);
325
- if (!e || !("getAttribute" in e) || e.getAttribute(y) !== null)
324
+ if (!e || !("getAttribute" in e) || e.getAttribute(B) !== null)
326
325
  return;
327
326
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
328
327
  this._stampHidePrice(t, i);
@@ -360,5 +359,5 @@ class Y extends E {
360
359
  }
361
360
  export {
362
361
  k as BLOCK_ID,
363
- Y as RecommendationBlock
362
+ j as RecommendationBlock
364
363
  };
@@ -1,37 +1,37 @@
1
- var m = Object.defineProperty;
2
- var C = (g, c, t) => c in g ? m(g, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[c] = t;
3
- var i = (g, c, t) => C(g, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as p } from "../../../../../composables/useConfig.js";
1
+ var C = Object.defineProperty;
2
+ var p = (g, u, t) => u in g ? C(g, u, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[u] = t;
3
+ var i = (g, u, t) => p(g, typeof u != "symbol" ? u + "" : u, t);
4
+ import { useConfig as h } 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 { RRS_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
8
8
  import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
9
- import { RecommendationConfigService as l } from "../../services/configService.js";
9
+ import { RecommendationConfigService as c } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
11
11
  import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
12
- import { AlgorithmControl as P } from "./algorithm.js";
13
- import { ALGORITHM_CONTROL_ID as dt } from "./algorithm.js";
14
- import { CurrencyControl as T } from "./currency.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
15
  import { CURRENCY_CONTROL_ID as gt } from "./currency.js";
16
16
  import { FiltersControl as S } from "./filters.js";
17
17
  import { FILTERS_CONTROL_ID as ft } from "./filters.js";
18
18
  import { LayoutOrientationControl as O } from "./layoutOrientation.js";
19
19
  import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
20
- import { LocaleControl as k } from "./locale.js";
20
+ import { LocaleControl as L } from "./locale.js";
21
21
  import { LOCALE_CONTROL_ID as yt } from "./locale.js";
22
- import { PricePlacementControl as L } from "./pricePlacement.js";
22
+ import { PricePlacementControl as k } from "./pricePlacement.js";
23
23
  import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
24
24
  import { ProductCountControl as E } from "./productCount.js";
25
25
  import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
26
26
  import { ProductLayoutControl as F } from "./productLayout.js";
27
- import { PRODUCT_LAYOUT_CONTROL_ID as Pt } from "./productLayout.js";
27
+ import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
28
28
  import { ShuffleControl as D } from "./shuffle.js";
29
29
  import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
30
- import { StrategyControl as B } from "./strategy.js";
31
- import { STRATEGY_CONTROL_ID as kt } from "./strategy.js";
32
- import { setCurrencyAttributes as w, getBlockElement as A, isPartnerManagedBlock as v, updateProductContentInPlace as x, regenerateProductRowsWithStyles as U } from "./utils.js";
33
- import { adjustProductsToSize as Et, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as Bt, getMainContainerTbody as wt, regenerateMobileProductRows as At, updatePricesInPlace as vt, updateSingleProductContent as xt } from "./utils.js";
34
- import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
30
+ import { StrategyControl as w } from "./strategy.js";
31
+ import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
32
+ import { setCurrencyAttributes as v, getBlockElement as A, isPartnerManagedBlock as B, updateProductContentInPlace as x, regenerateProductRowsWithStyles as U } from "./utils.js";
33
+ import { adjustProductsToSize as Et, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as wt, getMainContainerTbody as vt, regenerateMobileProductRows as At, updatePricesInPlace as Bt, updateSingleProductContent as xt } from "./utils.js";
34
+ import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
35
35
  const W = "ui-elements-recommendation-block";
36
36
  class at extends N {
37
37
  constructor() {
@@ -58,7 +58,7 @@ class at extends N {
58
58
  /**
59
59
  * Debounced product fetch to prevent rapid API calls during config changes
60
60
  */
61
- i(this, "_debouncedFetchProducts", h(async () => {
61
+ i(this, "_debouncedFetchProducts", f(async () => {
62
62
  try {
63
63
  await this.store.fetchRecommendationProducts();
64
64
  } finally {
@@ -76,22 +76,24 @@ class at extends N {
76
76
  * count. The store pads products to the configured size, so in-place only
77
77
  * fails when the size actually changed.
78
78
  */
79
- i(this, "_debouncedRegenerateWithProducts", h(() => {
79
+ i(this, "_debouncedRegenerateWithProducts", f(() => {
80
+ const t = this.store.recommendationProducts;
80
81
  if (!this.currentNode || !this.api)
81
82
  return;
82
- const t = this._getRecommendationIdFromNode(this.currentNode), e = this.store.currentRecommendationId;
83
- if (t === null || e === null || t === e || !this.store.blockStates[t]) {
84
- this._regenerateWithProducts();
83
+ const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
84
+ if (B(this.currentNode)) {
85
+ o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
85
86
  return;
86
87
  }
87
- if (this.store.blockStates[t].recommendationProducts.length) {
88
- this.store.setCurrentBlock(t);
89
- try {
90
- this._regenerateWithProducts();
91
- } finally {
92
- this.store.setCurrentBlock(e);
93
- }
94
- }
88
+ x({
89
+ currentNode: this.currentNode,
90
+ documentModifier: e,
91
+ products: t
92
+ }) || U({
93
+ currentNode: this.currentNode,
94
+ documentModifier: e,
95
+ products: t
96
+ });
95
97
  }, 100));
96
98
  }
97
99
  getId() {
@@ -113,10 +115,10 @@ class at extends N {
113
115
  }
114
116
  getTemplate() {
115
117
  var t;
116
- return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
118
+ return this.rrsEnabled = h().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
117
119
  var o;
118
120
  return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
119
- }), this.algorithmControl = new P(), this.localeControl = new k(), this.currencyControl = new T(), this.productCountControl = new E(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new L(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new B() : null, this._subControls.forEach((e) => {
121
+ }), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new E(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new k(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
120
122
  e && (e.api = this.api);
121
123
  }), `
122
124
  <div class="recommendation-controls-container">
@@ -134,12 +136,12 @@ class at extends N {
134
136
  `;
135
137
  }
136
138
  _showControlsForBlock(t) {
137
- var n;
138
- const e = (n = this.getContainer()) == null ? void 0 : n.querySelector(".recommendation-controls-container");
139
+ var r;
140
+ const e = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
139
141
  if (!e)
140
142
  return;
141
- const o = this._getRecommendationIdFromNode(t) === null ? null : l.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _), s = this.rrsEnabled && !!o && !r;
142
- e.classList.toggle("strategy-block", r), e.classList.toggle("legacy-strategy-block", s);
143
+ 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) >= _), s = this.rrsEnabled && !!o && !n;
144
+ e.classList.toggle("strategy-block", n), e.classList.toggle("legacy-strategy-block", s);
143
145
  }
144
146
  async onRender() {
145
147
  var o;
@@ -157,9 +159,9 @@ class at extends N {
157
159
  const e = this._getRecommendationIdFromNode(t);
158
160
  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(() => {
159
161
  this._initializeSubControls();
160
- }), this._subControls.forEach((r) => {
162
+ }), this._subControls.forEach((n) => {
161
163
  var s;
162
- r != null && r.api && (r.currentNode = t, (s = r.onTemplateNodeUpdated) == null || s.call(r, t));
164
+ n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, t));
163
165
  });
164
166
  }
165
167
  onDestroy() {
@@ -207,23 +209,30 @@ class at extends N {
207
209
  const e = this.store.blockStates[t];
208
210
  if (!e)
209
211
  return;
210
- const o = JSON.stringify(l.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
211
- e.syncedConfigFingerprint = o, r !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
212
+ const o = JSON.stringify(c.getConfig(this.currentNode)), n = e.syncedConfigFingerprint;
213
+ e.syncedConfigFingerprint = o, n !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
212
214
  }
213
215
  /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
214
216
  _isPendingStrategyIdChange() {
215
217
  const t = this.pendingNodeConfigWrite;
216
- return t ? l.getConfig(this.currentNode).strategyId !== t.updates.strategyId : !1;
218
+ return t ? c.getConfig(this.currentNode).strategyId !== t.updates.strategyId : !1;
217
219
  }
218
220
  _capturePendingNodeConfigWrite() {
219
221
  const t = this.store.currentRecommendationId;
220
222
  if (!this.currentNode || !this.api || t === null)
221
223
  return;
222
- const { filters: e, strategy: o, strategyId: r, size: s, nodeConfigVersion: n } = this.store.recommendationConfigs;
224
+ const { filters: e, strategy: o, strategyId: n, size: s, nodeConfigVersion: r } = this.store.recommendationConfigs, { partnerName: l } = h();
223
225
  this.pendingNodeConfigWrite = {
224
226
  blockId: t,
225
227
  node: this.currentNode,
226
- updates: { filters: e, strategy: o, strategyId: r, size: s, configVersion: n }
228
+ updates: {
229
+ filters: e,
230
+ strategy: o,
231
+ strategyId: n,
232
+ size: s,
233
+ configVersion: r,
234
+ ...l.value ? { partnerName: l.value } : {}
235
+ }
227
236
  };
228
237
  }
229
238
  /**
@@ -238,7 +247,7 @@ class at extends N {
238
247
  */
239
248
  _stagePendingNodeConfig(t) {
240
249
  const e = this.pendingNodeConfigWrite;
241
- return !e || !this.currentNode ? !1 : (l.stageConfig(t, this.currentNode, e.updates), !0);
250
+ return !e || !this.currentNode ? !1 : (c.stageConfig(t, this.currentNode, e.updates), !0);
242
251
  }
243
252
  /**
244
253
  * Arms the guaranteed fallback write, once the product fetch has settled. The
@@ -262,12 +271,12 @@ class at extends N {
262
271
  const t = this.pendingNodeConfigWrite;
263
272
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !t || !this.api)
264
273
  return;
265
- const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = l.getConfig(e);
266
- JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategy === t.updates.strategy && o.strategyId === t.updates.strategyId && o.size === t.updates.size || l.updateConfig(this.api, e, t.updates, "Update recommendation filters");
274
+ const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = c.getConfig(e);
275
+ JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategy === t.updates.strategy && o.strategyId === t.updates.strategyId && o.size === t.updates.size || c.updateConfig(this.api, e, t.updates, "Update recommendation filters");
267
276
  }
268
277
  _syncNodeConfigToStore() {
269
- var r;
270
- const t = l.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
278
+ var n;
279
+ const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
271
280
  this.store.patchCurrentBlockConfig({
272
281
  strategy: t.strategy,
273
282
  strategyId: t.strategyId,
@@ -310,8 +319,8 @@ class at extends N {
310
319
  t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
311
320
  this.store.fetchRecommendationCreateData(),
312
321
  this.store.fetchRecommendationFilters()
313
- ])).forEach((o, r) => {
314
- o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
322
+ ])).forEach((o, n) => {
323
+ o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][n]} failed`, o.reason);
315
324
  }), this._applySmartDefaults();
316
325
  try {
317
326
  await this.store.fetchRecommendationProducts();
@@ -332,36 +341,36 @@ class at extends N {
332
341
  _applySmartDefaults() {
333
342
  if (!this.currentNode || !this.api)
334
343
  return;
335
- const t = l.getConfig(this.currentNode), e = {};
336
- let o = null, r = null, s = null;
344
+ const t = c.getConfig(this.currentNode), e = {};
345
+ let o = null, n = null, s = null;
337
346
  if (t.currency.code === a.currency.code) {
338
- const { currencyList: n } = this.store;
339
- n.length > 0 && (n.some(
340
- (u) => u.value === `price.${a.currency.code}`
341
- ) || (o = n[0].value.replace("price.", ""), e.currency = {
347
+ const { currencyList: r } = this.store;
348
+ r.length > 0 && (r.some(
349
+ (d) => d.value === `price.${a.currency.code}`
350
+ ) || (o = r[0].value.replace("price.", ""), e.currency = {
342
351
  ...a.currency,
343
352
  code: o,
344
353
  symbol: o
345
354
  }));
346
355
  }
347
356
  if (t.strategy === a.strategy) {
348
- const n = this.store.getActivePredictiveAlgorithms;
349
- n.length > 0 && (n.some(
350
- (u) => u.value === a.strategy
351
- ) || (r = n[0].value, e.strategy = r));
357
+ const r = this.store.getActivePredictiveAlgorithms;
358
+ r.length > 0 && (r.some(
359
+ (d) => d.value === a.strategy
360
+ ) || (n = r[0].value, e.strategy = n));
352
361
  }
353
362
  if (t.language === a.language) {
354
- const n = this.store.getLanguages;
355
- n.length > 0 && (n.some(
356
- (u) => u.value === a.language
357
- ) || (s = n[0].value, e.language = s));
363
+ const r = this.store.getLanguages;
364
+ r.length > 0 && (r.some(
365
+ (d) => d.value === a.language
366
+ ) || (s = r[0].value, e.language = s));
358
367
  }
359
- !o && !r && !s || (l.updateConfig(
368
+ !o && !n && !s || (c.updateConfig(
360
369
  this.api,
361
370
  this.currentNode,
362
371
  e,
363
372
  "Applied smart defaults"
364
- ), o && e.currency && w({
373
+ ), o && e.currency && v({
365
374
  currentNode: this.currentNode,
366
375
  documentModifier: this.api.getDocumentModifier(),
367
376
  currency: e.currency
@@ -377,7 +386,7 @@ class at extends N {
377
386
  thousandSeparator: a.currency.thousandSeparator
378
387
  }
379
388
  } : {},
380
- ...r ? { strategy: r } : {},
389
+ ...n ? { strategy: n } : {},
381
390
  ...s ? { language: s } : {}
382
391
  }, { triggerRefetch: !1 }));
383
392
  }
@@ -391,27 +400,8 @@ class at extends N {
391
400
  const o = e.getAttribute(I);
392
401
  if (!o)
393
402
  return null;
394
- const r = parseInt(o);
395
- return Number.isNaN(r) ? null : r;
396
- }
397
- /** Draws the current block's products into this panel's node. */
398
- _regenerateWithProducts() {
399
- if (!this.currentNode || !this.api)
400
- return;
401
- const t = this.store.recommendationProducts, e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
402
- if (v(this.currentNode)) {
403
- o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
404
- return;
405
- }
406
- x({
407
- currentNode: this.currentNode,
408
- documentModifier: e,
409
- products: t
410
- }) || U({
411
- currentNode: this.currentNode,
412
- documentModifier: e,
413
- products: t
414
- });
403
+ const n = parseInt(o);
404
+ return Number.isNaN(n) ? null : n;
415
405
  }
416
406
  /**
417
407
  * Listen to store changes that require product refresh or regeneration.
@@ -428,54 +418,54 @@ class at extends N {
428
418
  */
429
419
  _listenStateUpdates() {
430
420
  const { store: t } = this;
431
- let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
421
+ let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
432
422
  this.storeUnsubscription = t.$subscribe(() => {
433
423
  const s = t.currentRecommendationId;
434
- if (s !== r) {
435
- r = s, e = t.recommendationProducts, o = t.$state.configVersion;
424
+ if (s !== n) {
425
+ n = s, e = t.recommendationProducts, o = t.$state.configVersion;
436
426
  return;
437
427
  }
438
- const n = t.$state.configVersion;
439
- n !== o && (o = n, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts());
440
- const d = t.recommendationProducts, u = d !== e, f = Array.isArray(d) && d.length > 0;
441
- u && f && (e = d, this._debouncedRegenerateWithProducts());
428
+ const r = t.$state.configVersion;
429
+ r !== o && (o = r, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts());
430
+ const l = t.recommendationProducts, d = l !== e, m = Array.isArray(l) && l.length > 0;
431
+ d && m && (e = l, this._debouncedRegenerateWithProducts());
442
432
  });
443
433
  }
444
434
  }
445
435
  export {
446
- dt as ALGORITHM_CONTROL_ID,
447
- P as AlgorithmControl,
436
+ ut as ALGORITHM_CONTROL_ID,
437
+ T as AlgorithmControl,
448
438
  W as CONTROL_BLOCK_ID,
449
439
  gt as CURRENCY_CONTROL_ID,
450
- T as CurrencyControl,
440
+ P as CurrencyControl,
451
441
  ft as FILTERS_CONTROL_ID,
452
442
  S as FiltersControl,
453
443
  Ct as LAYOUT_ORIENTATION_CONTROL_ID,
454
444
  yt as LOCALE_CONTROL_ID,
455
445
  O as LayoutOrientationControl,
456
- k as LocaleControl,
446
+ L as LocaleControl,
457
447
  _t as PRICE_PLACEMENT_CONTROL_ID,
458
448
  Rt as PRODUCT_COUNT_CONTROL_ID,
459
- Pt as PRODUCT_LAYOUT_CONTROL_ID,
460
- L as PricePlacementControl,
449
+ Tt as PRODUCT_LAYOUT_CONTROL_ID,
450
+ k as PricePlacementControl,
461
451
  E as ProductCountControl,
462
452
  F as ProductLayoutControl,
463
453
  at as RecommendationBlockControl,
464
454
  St as SHUFFLE_CONTROL_ID,
465
- kt as STRATEGY_CONTROL_ID,
455
+ Lt as STRATEGY_CONTROL_ID,
466
456
  D as ShuffleControl,
467
- B as StrategyControl,
457
+ w as StrategyControl,
468
458
  Et as adjustProductsToSize,
469
459
  Ft as formatProductPrice,
470
460
  A as getBlockElement,
471
461
  Dt as getCardComposition,
472
- Bt as getCurrentLayout,
473
- wt as getMainContainerTbody,
474
- v as isPartnerManagedBlock,
462
+ wt as getCurrentLayout,
463
+ vt as getMainContainerTbody,
464
+ B as isPartnerManagedBlock,
475
465
  At as regenerateMobileProductRows,
476
466
  U as regenerateProductRowsWithStyles,
477
- w as setCurrencyAttributes,
478
- vt as updatePricesInPlace,
467
+ v as setCurrencyAttributes,
468
+ Bt as updatePricesInPlace,
479
469
  x as updateProductContentInPlace,
480
470
  xt as updateSingleProductContent
481
471
  };