@useinsider/guido 3.0.0 → 3.1.0

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 (101) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +10 -8
  2. package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
  3. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
  4. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
  5. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
  7. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
  9. package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
  10. package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
  11. package/dist/config/i18n/en/labels.json.js +8 -3
  12. package/dist/config/migrator/itemsBlockMigrator.js +135 -131
  13. package/dist/config/migrator/recommendationMigrator.js +58 -54
  14. package/dist/enums/block.js +4 -0
  15. package/dist/extensions/Blocks/Items/block.js +30 -21
  16. package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
  17. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  18. package/dist/extensions/Blocks/Recommendation/block.js +64 -34
  19. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  20. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  22. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
  23. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  24. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
  25. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  27. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  28. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
  30. package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +34 -23
  31. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  32. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
  34. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  35. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +202 -200
  36. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
  37. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
  38. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  39. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  40. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  41. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  42. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +94 -100
  43. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
  44. package/dist/extensions/Blocks/Recommendation/extension.js +20 -18
  45. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +5 -4
  46. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +209 -2
  47. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +135 -111
  48. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -7
  49. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +25 -28
  51. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
  52. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
  53. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
  54. package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
  55. package/dist/extensions/Blocks/common-control.js +96 -39
  56. package/dist/guido.css +1 -1
  57. package/dist/src/@types/extensions/block.d.ts +2 -0
  58. package/dist/src/App.vue.d.ts +3 -1
  59. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  60. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
  61. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  62. package/dist/src/enums/block.d.ts +4 -0
  63. package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
  64. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +4 -1
  65. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  66. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +9 -1
  67. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  68. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
  70. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -2
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  73. package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -2
  77. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
  78. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
  79. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
  80. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  81. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
  83. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
  84. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
  85. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
  86. package/dist/src/extensions/Blocks/common-control.d.ts +29 -2
  87. package/dist/src/stores/template.d.ts +29 -0
  88. package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
  89. package/dist/static/assets/info.svg.js +5 -0
  90. package/dist/static/styles/components/wide-panel.css.js +1 -0
  91. package/dist/static/styles/customEditorStyle.css.js +9 -0
  92. package/dist/static/styles/variables.css.js +3 -0
  93. package/dist/stores/template.js +15 -0
  94. package/dist/utils/migrationBannerHtml.js +21 -0
  95. package/package.json +3 -2
  96. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  97. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  98. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  99. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  100. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  101. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
@@ -0,0 +1,78 @@
1
+ import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { RecommendationBlockId as l } from "../../constants/blockIds.js";
3
+ import { RecommendationControlId as e } from "../../constants/controlIds.js";
4
+ import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
5
+ function o(t) {
6
+ const n = t.closest(I);
7
+ if (!n)
8
+ return [];
9
+ const r = t.asElement().getAttribute(s);
10
+ if (r) {
11
+ const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
12
+ return n.querySelectorAll(T);
13
+ }
14
+ return n.querySelectorAll(
15
+ `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
16
+ );
17
+ }
18
+ const A = class extends a {
19
+ getId() {
20
+ return e.CUSTOM_ATTR_ALIGN;
21
+ }
22
+ getTargetNodes(t) {
23
+ return o(t);
24
+ }
25
+ }, _ = class extends g {
26
+ getId() {
27
+ return e.CUSTOM_ATTR_COLOR;
28
+ }
29
+ getTargetNodes(t) {
30
+ return o(t);
31
+ }
32
+ }, S = class extends C {
33
+ getId() {
34
+ return e.CUSTOM_ATTR_SIZE;
35
+ }
36
+ getTargetNodes(t) {
37
+ return o(t);
38
+ }
39
+ }, m = class extends i {
40
+ getId() {
41
+ return e.CUSTOM_ATTR_STYLE;
42
+ }
43
+ getTargetNodes(t) {
44
+ return o(t);
45
+ }
46
+ }, O = class extends u {
47
+ getId() {
48
+ return e.CUSTOM_ATTR_FONT_FAMILY;
49
+ }
50
+ getTargetNodes(t) {
51
+ return o(t);
52
+ }
53
+ }, R = class extends c {
54
+ getId() {
55
+ return e.CUSTOM_ATTR_BACKGROUND;
56
+ }
57
+ getTargetNodes(t) {
58
+ return o(t);
59
+ }
60
+ }, x = class extends d {
61
+ getId() {
62
+ return e.CUSTOM_ATTR_PADDINGS;
63
+ }
64
+ getTargetNodes(t) {
65
+ return o(t);
66
+ }
67
+ }, k = {
68
+ align: A,
69
+ color: _,
70
+ size: S,
71
+ style: m,
72
+ fontFamily: O,
73
+ background: R,
74
+ paddings: x
75
+ };
76
+ export {
77
+ k as CustomAttributeControls
78
+ };
@@ -1,15 +1,15 @@
1
1
  var c = Object.defineProperty;
2
- var d = (r, i, t) => i in r ? c(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
- var a = (r, i, t) => d(r, typeof i != "symbol" ? i + "" : i, t);
4
- import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as l } from "../../../common-control.js";
2
+ var h = (s, i, t) => i in s ? c(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
3
+ var a = (s, i, t) => h(s, typeof i != "symbol" ? i + "" : i, t);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as d } from "../../../common-control.js";
6
6
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
8
8
  const g = "recommendation-algorithm-control", e = {
9
9
  ALGORITHM: "strategy",
10
10
  PRODUCT_IDS: "productIds"
11
11
  };
12
- class T extends l {
12
+ class T extends d {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  // Store is used ONLY for API-fetched data (algorithms list), not for config
@@ -22,16 +22,16 @@ class T extends l {
22
22
  return `
23
23
  <div class="algorithm-control-container">
24
24
  ${this._GuTwoColumns([
25
- this._GuLabel({ text: "Recommendation Algorithm" }),
25
+ this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
26
26
  this._GuSelect({
27
27
  name: e.ALGORITHM,
28
- placeholder: "Select Recommendation Algorithm",
28
+ placeholder: this.api.translate("Select Recommendation Algorithm"),
29
29
  options: this.store.getActivePredictiveAlgorithms
30
30
  }),
31
- this._GuLabel({ text: "Product Ids", name: `${e.PRODUCT_IDS}_label` }),
31
+ this._GuLabel({ text: this.api.translate("Product Ids"), name: `${e.PRODUCT_IDS}_label` }),
32
32
  this._GuTextInput({
33
33
  name: e.PRODUCT_IDS,
34
- placeholder: "Enter Product Ids",
34
+ placeholder: this.api.translate("Enter Product Ids"),
35
35
  className: "es-180w"
36
36
  })
37
37
  ])}
@@ -58,16 +58,16 @@ class T extends l {
58
58
  try {
59
59
  this.api.setUIEAttribute(
60
60
  e.ALGORITHM,
61
- h.SELECTPICKER.items,
61
+ l.SELECTPICKER.items,
62
62
  t
63
63
  );
64
- } catch (s) {
65
- console.warn("[AlgorithmControl] Failed to set algorithm options:", s);
64
+ } catch (r) {
65
+ console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
66
66
  }
67
67
  }
68
68
  _setProductIdsVisibility(t) {
69
- const s = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
70
- this.api.setVisibility(e.PRODUCT_IDS, s), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, s);
69
+ const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
70
+ this.api.setVisibility(e.PRODUCT_IDS, r), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, r);
71
71
  }
72
72
  _onAlgorithmChange(t) {
73
73
  !this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
@@ -80,7 +80,7 @@ class T extends l {
80
80
  _onProductIdsChange(t) {
81
81
  if (!this.currentNode)
82
82
  return;
83
- const o = t.split(",").map((s) => s.trim()).filter(Boolean);
83
+ const o = t.split(",").map((r) => r.trim()).filter(Boolean);
84
84
  n.updateConfig(
85
85
  this.api,
86
86
  this.currentNode,
@@ -1,9 +1,9 @@
1
- var R = Object.defineProperty;
2
- var _ = (i, o, e) => o in i ? R(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
3
- var c = (i, o, e) => _(i, typeof o != "symbol" ? o + "" : o, e);
4
- import { currencyLocationMaps as l, currencyOperators as a, currencyDecimalCounts as h } from "../../../../../enums/extensions/recommendationBlock.js";
5
- import { UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { CommonControl as p } from "../../../common-control.js";
1
+ var p = Object.defineProperty;
2
+ var R = (o, a, e) => a in o ? p(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
3
+ var c = (o, a, e) => R(o, typeof a != "symbol" ? a + "" : a, e);
4
+ import { currencyLocationMaps as l, currencyOperators as i, currencyDecimalCounts as h } from "../../../../../enums/extensions/recommendationBlock.js";
5
+ import { UEAttr as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { CommonControl as m } from "../../../common-control.js";
7
7
  import { RecommendationConfigService as s } from "../../services/configService.js";
8
8
  import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
9
9
  import { setCurrencyAttributes as S, updatePricesInPlace as N } from "./utils.js";
@@ -15,7 +15,7 @@ const E = "recommendation-currency-control", t = {
15
15
  CURRENCY_DECIMAL_SEPARATOR: "currencyDecimalSeparator",
16
16
  CURRENCY_DECIMAL_COUNT: "currencyDecimalCount"
17
17
  };
18
- class Y extends p {
18
+ class Y extends m {
19
19
  constructor() {
20
20
  super(...arguments);
21
21
  // Store is used ONLY for API-fetched data (currency list), not for config
@@ -30,40 +30,40 @@ class Y extends p {
30
30
  return `
31
31
  <div class="currency-control-container">
32
32
  ${this._GuTwoColumns([
33
- this._GuLabel({ text: "Currency" }),
33
+ this._GuLabel({ text: this.api.translate("Currency") }),
34
34
  this._GuSelect({
35
35
  name: t.CURRENCY,
36
- placeholder: "Select Currency",
36
+ placeholder: this.api.translate("Select Currency"),
37
37
  options: this.store.currencyList
38
38
  }),
39
- this._GuLabel({ text: "Currency Location" }),
39
+ this._GuLabel({ text: this.api.translate("Currency Location") }),
40
40
  this._GuSelect({
41
41
  name: t.CURRENCY_LOCATION,
42
- placeholder: "Select Currency Location",
42
+ placeholder: this.api.translate("Select Currency Location"),
43
43
  options: l
44
44
  }),
45
- this._GuLabel({ text: "Currency Symbol" }),
45
+ this._GuLabel({ text: this.api.translate("Currency Symbol") }),
46
46
  this._GuTextInput({
47
47
  name: t.CURRENCY_SYMBOL,
48
- placeholder: "Enter Currency Symbol",
48
+ placeholder: this.api.translate("Enter Currency Symbol"),
49
49
  className: "es-180w"
50
50
  }),
51
- this._GuLabel({ text: "Thousand Separator" }),
51
+ this._GuLabel({ text: this.api.translate("Thousand Separator") }),
52
52
  this._GuSelect({
53
53
  name: t.CURRENCY_THOUSAND_SEPARATOR,
54
- placeholder: "Select Thousand Separator",
55
- options: a
54
+ placeholder: this.api.translate("Select Thousand Separator"),
55
+ options: i
56
56
  }),
57
- this._GuLabel({ text: "Decimal Separator" }),
57
+ this._GuLabel({ text: this.api.translate("Decimal Separator") }),
58
58
  this._GuSelect({
59
59
  name: t.CURRENCY_DECIMAL_SEPARATOR,
60
- placeholder: "Select Decimal Separator",
61
- options: a
60
+ placeholder: this.api.translate("Select Decimal Separator"),
61
+ options: i
62
62
  }),
63
- this._GuLabel({ text: "Decimal Count" }),
63
+ this._GuLabel({ text: this.api.translate("Decimal Count") }),
64
64
  this._GuSelect({
65
65
  name: t.CURRENCY_DECIMAL_COUNT,
66
- placeholder: "Select Decimal Count",
66
+ placeholder: this.api.translate("Select Decimal Count"),
67
67
  options: h
68
68
  })
69
69
  ])}
@@ -96,12 +96,12 @@ class Y extends p {
96
96
  const { store: e } = this, r = {
97
97
  [t.CURRENCY]: e.currencyList,
98
98
  [t.CURRENCY_LOCATION]: l,
99
- [t.CURRENCY_THOUSAND_SEPARATOR]: a,
100
- [t.CURRENCY_DECIMAL_SEPARATOR]: a,
99
+ [t.CURRENCY_THOUSAND_SEPARATOR]: i,
100
+ [t.CURRENCY_DECIMAL_SEPARATOR]: i,
101
101
  [t.CURRENCY_DECIMAL_COUNT]: h
102
102
  };
103
103
  Object.entries(r).forEach(([C, n]) => {
104
- this.api.setUIEAttribute(C, m.SELECTPICKER.items, n);
104
+ this.api.setUIEAttribute(C, _.SELECTPICKER.items, n);
105
105
  });
106
106
  }
107
107
  /**
@@ -21,10 +21,10 @@ class h extends s {
21
21
  return `
22
22
  <div class="filters-control-container">
23
23
  ${this._GuTwoColumns([
24
- this._GuLabel({ text: "Filters" }),
24
+ this._GuLabel({ text: this.api.translate("Filters") }),
25
25
  this._GuButton({
26
26
  name: a.FILTERS,
27
- label: "Add Filter",
27
+ label: this.api.translate("Add Filter"),
28
28
  id: "guido__btn-add-filter"
29
29
  })
30
30
  ])}
@@ -1,43 +1,49 @@
1
- var g = Object.defineProperty;
2
- var C = (d, c, t) => c in d ? g(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
3
- var i = (d, c, t) => C(d, typeof c != "symbol" ? c + "" : c, t);
4
- import { CommonControl as p } from "../../../common-control.js";
1
+ var f = Object.defineProperty;
2
+ var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
+ var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
4
+ import { CommonControl as g } from "../../../common-control.js";
5
5
  import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
6
- import { RecommendationConfigService as m } from "../../services/configService.js";
6
+ import { RecommendationConfigService as h } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
8
8
  import { AlgorithmControl as R } from "./algorithm.js";
9
- import { ALGORITHM_CONTROL_ID as H } from "./algorithm.js";
9
+ import { ALGORITHM_CONTROL_ID as J } from "./algorithm.js";
10
10
  import { CurrencyControl as N } from "./currency.js";
11
- import { CURRENCY_CONTROL_ID as K } from "./currency.js";
12
- import { FiltersControl as b } from "./filters.js";
13
- import { FILTERS_CONTROL_ID as J } from "./filters.js";
14
- import { LocaleControl as _ } from "./locale.js";
15
- import { LOCALE_CONTROL_ID as X } from "./locale.js";
16
- import { ProductLayoutControl as I } from "./productLayout.js";
17
- import { PRODUCT_LAYOUT_CONTROL_ID as tt } from "./productLayout.js";
11
+ import { CURRENCY_CONTROL_ID as X } from "./currency.js";
12
+ import { FiltersControl as _ } from "./filters.js";
13
+ import { FILTERS_CONTROL_ID as tt } from "./filters.js";
14
+ import { LayoutOrientationControl as b } from "./layoutOrientation.js";
15
+ import { LAYOUT_ORIENTATION_CONTROL_ID as ot } from "./layoutOrientation.js";
16
+ import { LocaleControl as O } from "./locale.js";
17
+ import { LOCALE_CONTROL_ID as nt } from "./locale.js";
18
+ import { ProductCountControl as I } from "./productCount.js";
19
+ import { PRODUCT_COUNT_CONTROL_ID as st } from "./productCount.js";
20
+ import { ProductLayoutControl as T } from "./productLayout.js";
21
+ import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
18
22
  import { ShuffleControl as S } from "./shuffle.js";
19
- import { SHUFFLE_CONTROL_ID as ot } from "./shuffle.js";
20
- import { getBlockElement as P, updateProductContentInPlace as T, regenerateProductRowsWithStyles as L } from "./utils.js";
21
- import { adjustProductsToSize as nt, formatProductPrice as st, getCardComposition as it, getCurrentLayout as at, reapplySpacing as ct, regenerateMobileProductRows as lt, regenerateProductRows as ut, setCurrencyAttributes as dt, updatePricesInPlace as mt, updateSingleProductContent as ht } from "./utils.js";
22
- import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
23
- const k = "recommendation-id", D = "ui-elements-recommendation-block";
24
- class W extends p {
23
+ import { SHUFFLE_CONTROL_ID as ut } from "./shuffle.js";
24
+ import { getBlockElement as L, updateProductContentInPlace as P, regenerateProductRowsWithStyles as D } from "./utils.js";
25
+ import { adjustProductsToSize as ht, formatProductPrice as mt, getCardComposition as Ct, getCurrentLayout as ft, reapplySpacing as pt, regenerateMobileProductRows as gt, regenerateProductRows as yt, setCurrencyAttributes as Rt, updatePricesInPlace as Nt, updateSingleProductContent as _t } from "./utils.js";
26
+ import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
27
+ const k = "recommendation-id", E = "ui-elements-recommendation-block";
28
+ class H extends g {
25
29
  constructor() {
26
30
  super(...arguments);
27
- i(this, "store", y());
28
- i(this, "storeUnsubscription", () => {
31
+ s(this, "store", y());
32
+ s(this, "storeUnsubscription", () => {
29
33
  });
30
34
  // Sub-control instances for lifecycle management
31
- i(this, "algorithmControl", null);
32
- i(this, "localeControl", null);
33
- i(this, "currencyControl", null);
34
- i(this, "productLayoutControl", null);
35
- i(this, "filtersControl", null);
36
- i(this, "shuffleControl", null);
35
+ s(this, "algorithmControl", null);
36
+ s(this, "localeControl", null);
37
+ s(this, "currencyControl", null);
38
+ s(this, "productCountControl", null);
39
+ s(this, "productLayoutControl", null);
40
+ s(this, "filtersControl", null);
41
+ s(this, "shuffleControl", null);
42
+ s(this, "layoutOrientationControl", null);
37
43
  /**
38
44
  * Debounced product fetch to prevent rapid API calls during config changes
39
45
  */
40
- i(this, "_debouncedFetchProducts", h(() => {
46
+ s(this, "_debouncedFetchProducts", m(() => {
41
47
  this.store.fetchRecommendationProducts();
42
48
  }, 500));
43
49
  /**
@@ -51,16 +57,16 @@ class W extends p {
51
57
  * count. The store pads products to the configured size, so in-place only
52
58
  * fails when the size actually changed.
53
59
  */
54
- i(this, "_debouncedRegenerateWithProducts", h(() => {
60
+ s(this, "_debouncedRegenerateWithProducts", m(() => {
55
61
  const t = this.store.recommendationProducts;
56
62
  if (!this.currentNode || !this.api)
57
63
  return;
58
64
  const e = this.api.getDocumentModifier();
59
- T({
65
+ P({
60
66
  currentNode: this.currentNode,
61
67
  documentModifier: e,
62
68
  products: t
63
- }) || L({
69
+ }) || D({
64
70
  currentNode: this.currentNode,
65
71
  documentModifier: e,
66
72
  products: t
@@ -68,16 +74,29 @@ class W extends p {
68
74
  }, 100));
69
75
  }
70
76
  getId() {
71
- return D;
77
+ return E;
72
78
  }
73
79
  getTemplate() {
74
- return this.algorithmControl = new R(), this.localeControl = new _(), this.currencyControl = new N(), this.productLayoutControl = new I(), this.filtersControl = new b(), this.shuffleControl = new S(), `
80
+ return this.algorithmControl = new R(), this.localeControl = new O(), this.currencyControl = new N(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
81
+ this.algorithmControl,
82
+ this.localeControl,
83
+ this.currencyControl,
84
+ this.productCountControl,
85
+ this.productLayoutControl,
86
+ this.filtersControl,
87
+ this.shuffleControl,
88
+ this.layoutOrientationControl
89
+ ].forEach((e) => {
90
+ e.api = this.api;
91
+ }), `
75
92
  <div class="recommendation-controls-container">
93
+ ${this.layoutOrientationControl.getTemplate()}
94
+ ${this.productCountControl.getTemplate()}
95
+ ${this.productLayoutControl.getTemplate()}
76
96
  ${this.algorithmControl.getTemplate()}
77
97
  ${this.localeControl.getTemplate()}
78
98
  ${this.currencyControl.getTemplate()}
79
99
  ${this.filtersControl.getTemplate()}
80
- ${this.productLayoutControl.getTemplate()}
81
100
  ${this.shuffleControl.getTemplate()}
82
101
  </div>
83
102
  `;
@@ -96,6 +115,8 @@ class W extends p {
96
115
  super.onTemplateNodeUpdated(t);
97
116
  const e = this._getRecommendationIdFromNode(t);
98
117
  e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
118
+ this.layoutOrientationControl,
119
+ this.productCountControl,
99
120
  this.algorithmControl,
100
121
  this.localeControl,
101
122
  this.currencyControl,
@@ -103,12 +124,14 @@ class W extends p {
103
124
  this.filtersControl,
104
125
  this.shuffleControl
105
126
  ].forEach((n) => {
106
- var s;
107
- n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, t));
127
+ var i;
128
+ n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
108
129
  });
109
130
  }
110
131
  onDestroy() {
111
132
  this.storeUnsubscription(), [
133
+ this.layoutOrientationControl,
134
+ this.productCountControl,
112
135
  this.algorithmControl,
113
136
  this.localeControl,
114
137
  this.currencyControl,
@@ -126,6 +149,8 @@ class W extends p {
126
149
  */
127
150
  _initializeSubControls() {
128
151
  [
152
+ this.layoutOrientationControl,
153
+ this.productCountControl,
129
154
  this.algorithmControl,
130
155
  this.localeControl,
131
156
  this.currencyControl,
@@ -150,7 +175,7 @@ class W extends p {
150
175
  */
151
176
  _syncNodeConfigToStore() {
152
177
  var r;
153
- const t = m.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
178
+ const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
154
179
  this.store.patchCurrentBlockConfig({
155
180
  strategy: t.strategy,
156
181
  language: t.language,
@@ -207,31 +232,31 @@ class W extends p {
207
232
  _applySmartDefaults() {
208
233
  if (!this.currentNode || !this.api)
209
234
  return;
210
- const t = m.getConfig(this.currentNode), e = {};
235
+ const t = h.getConfig(this.currentNode), e = {};
211
236
  let o = null, r = null, n = null;
212
237
  if (t.currency.code === a.currency.code) {
213
- const { currencyList: s } = this.store;
214
- s.length > 0 && (s.some(
238
+ const { currencyList: i } = this.store;
239
+ i.length > 0 && (i.some(
215
240
  (u) => u.value === `price.${a.currency.code}`
216
- ) || (o = s[0].value.replace("price.", ""), e.currency = {
241
+ ) || (o = i[0].value.replace("price.", ""), e.currency = {
217
242
  ...a.currency,
218
243
  code: o,
219
244
  symbol: o
220
245
  }));
221
246
  }
222
247
  if (t.strategy === a.strategy) {
223
- const s = this.store.getActivePredictiveAlgorithms;
224
- s.length > 0 && (s.some(
248
+ const i = this.store.getActivePredictiveAlgorithms;
249
+ i.length > 0 && (i.some(
225
250
  (u) => u.value === a.strategy
226
- ) || (r = s[0].value, e.strategy = r));
251
+ ) || (r = i[0].value, e.strategy = r));
227
252
  }
228
253
  if (t.language === a.language) {
229
- const s = this.store.getLanguages;
230
- s.length > 0 && (s.some(
254
+ const i = this.store.getLanguages;
255
+ i.length > 0 && (i.some(
231
256
  (u) => u.value === a.language
232
- ) || (n = s[0].value, e.language = n));
257
+ ) || (n = i[0].value, e.language = n));
233
258
  }
234
- !o && !r && !n || (m.updateConfig(
259
+ !o && !r && !n || (h.updateConfig(
235
260
  this.api,
236
261
  this.currentNode,
237
262
  e,
@@ -256,7 +281,7 @@ class W extends p {
256
281
  * Reads the recommendation-id attribute from the block element within the node
257
282
  */
258
283
  _getRecommendationIdFromNode(t) {
259
- const e = P(t);
284
+ const e = L(t);
260
285
  if (!e || !("getAttribute" in e))
261
286
  return null;
262
287
  const o = e.getAttribute(k);
@@ -287,10 +312,10 @@ class W extends p {
287
312
  r = n, e = t.recommendationProducts, o = t.$state.configVersion;
288
313
  return;
289
314
  }
290
- const s = t.$state.configVersion;
291
- s !== o && (o = s, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
292
- const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
293
- u && f && (e = l, this._debouncedRegenerateWithProducts());
315
+ const i = t.$state.configVersion;
316
+ i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
317
+ const c = t.recommendationProducts, u = c !== e, C = Array.isArray(c) && c.length > 0;
318
+ u && C && (e = c, this._debouncedRegenerateWithProducts());
294
319
  });
295
320
  }
296
321
  /**
@@ -301,7 +326,7 @@ class W extends p {
301
326
  if (!this.currentNode || !this.api)
302
327
  return;
303
328
  const { filters: t } = this.store.recommendationConfigs;
304
- m.updateConfig(
329
+ h.updateConfig(
305
330
  this.api,
306
331
  this.currentNode,
307
332
  { filters: t },
@@ -310,31 +335,35 @@ class W extends p {
310
335
  }
311
336
  }
312
337
  export {
313
- H as ALGORITHM_CONTROL_ID,
338
+ J as ALGORITHM_CONTROL_ID,
314
339
  R as AlgorithmControl,
315
- D as CONTROL_BLOCK_ID,
316
- K as CURRENCY_CONTROL_ID,
340
+ E as CONTROL_BLOCK_ID,
341
+ X as CURRENCY_CONTROL_ID,
317
342
  N as CurrencyControl,
318
- J as FILTERS_CONTROL_ID,
319
- b as FiltersControl,
320
- X as LOCALE_CONTROL_ID,
321
- _ as LocaleControl,
322
- tt as PRODUCT_LAYOUT_CONTROL_ID,
323
- I as ProductLayoutControl,
324
- W as RecommendationBlockControl,
325
- ot as SHUFFLE_CONTROL_ID,
343
+ tt as FILTERS_CONTROL_ID,
344
+ _ as FiltersControl,
345
+ ot as LAYOUT_ORIENTATION_CONTROL_ID,
346
+ nt as LOCALE_CONTROL_ID,
347
+ b as LayoutOrientationControl,
348
+ O as LocaleControl,
349
+ st as PRODUCT_COUNT_CONTROL_ID,
350
+ lt as PRODUCT_LAYOUT_CONTROL_ID,
351
+ I as ProductCountControl,
352
+ T as ProductLayoutControl,
353
+ H as RecommendationBlockControl,
354
+ ut as SHUFFLE_CONTROL_ID,
326
355
  S as ShuffleControl,
327
- nt as adjustProductsToSize,
328
- st as formatProductPrice,
329
- P as getBlockElement,
330
- it as getCardComposition,
331
- at as getCurrentLayout,
332
- ct as reapplySpacing,
333
- lt as regenerateMobileProductRows,
334
- ut as regenerateProductRows,
335
- L as regenerateProductRowsWithStyles,
336
- dt as setCurrencyAttributes,
337
- mt as updatePricesInPlace,
338
- T as updateProductContentInPlace,
339
- ht as updateSingleProductContent
356
+ ht as adjustProductsToSize,
357
+ mt as formatProductPrice,
358
+ L as getBlockElement,
359
+ Ct as getCardComposition,
360
+ ft as getCurrentLayout,
361
+ pt as reapplySpacing,
362
+ gt as regenerateMobileProductRows,
363
+ yt as regenerateProductRows,
364
+ D as regenerateProductRowsWithStyles,
365
+ Rt as setCurrencyAttributes,
366
+ Nt as updatePricesInPlace,
367
+ P as updateProductContentInPlace,
368
+ _t as updateSingleProductContent
340
369
  };