@useinsider/guido 2.0.0-beta.dbde199 → 2.0.0-beta.e66a90a

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 (117) hide show
  1. package/dist/@types/config/schemas.js +53 -39
  2. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
  3. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  4. package/dist/composables/useConfig.js +29 -27
  5. package/dist/composables/useSave.js +13 -11
  6. package/dist/config/migrator/recommendationMigrator.js +2 -2
  7. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  8. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  9. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  10. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -0
  11. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  12. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +100 -0
  13. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +243 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  15. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +104 -0
  16. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +86 -0
  17. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +134 -0
  18. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +106 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +64 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +123 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +60 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +112 -0
  24. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  25. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  28. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +15 -13
  29. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
  30. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  31. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  32. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  33. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  34. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +224 -0
  35. package/dist/extensions/Blocks/Recommendation/extension.js +40 -19
  36. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +5 -0
  37. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +46 -43
  38. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
  39. package/dist/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.js +157 -0
  40. package/dist/extensions/Blocks/Recommendation/templates/horizontal/template.js +72 -0
  41. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  42. package/dist/extensions/Blocks/Recommendation/templates/utils.js +173 -0
  43. package/dist/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.js +186 -0
  44. package/dist/extensions/Blocks/Recommendation/templates/vertical/migration.js +251 -0
  45. package/dist/extensions/Blocks/Recommendation/templates/vertical/template.js +61 -0
  46. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  47. package/dist/extensions/Blocks/common-control.js +6 -7
  48. package/dist/extensions/Blocks/controlFactories.js +156 -122
  49. package/dist/guido.css +1 -1
  50. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +110 -113
  51. package/dist/src/@types/config/index.d.ts +2 -2
  52. package/dist/src/@types/config/schemas.d.ts +26 -0
  53. package/dist/src/@types/config/types.d.ts +7 -1
  54. package/dist/src/composables/useConfig.d.ts +6 -0
  55. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  56. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +1 -33
  57. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
  58. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  60. package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +19 -3
  61. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -7
  62. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -651
  64. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +34 -0
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +17 -0
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +16 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  68. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +54 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +15 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +40 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +15 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +81 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
  75. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
  78. package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
  79. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  80. package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
  81. package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +26 -9
  84. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  85. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -16
  86. package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.d.ts +8 -0
  87. package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/migration.d.ts +25 -0
  88. package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/template.d.ts +18 -0
  89. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
  90. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +45 -0
  91. package/dist/src/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.d.ts +7 -0
  92. package/dist/src/extensions/Blocks/Recommendation/templates/vertical/migration.d.ts +23 -0
  93. package/dist/src/extensions/Blocks/Recommendation/templates/vertical/template.d.ts +33 -0
  94. package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
  95. package/dist/src/stores/config.d.ts +147 -1
  96. package/dist/static/styles/components/button.css.js +1 -1
  97. package/dist/static/styles/customEditorStyle.css.js +25 -2
  98. package/dist/stores/config.js +7 -0
  99. package/package.json +1 -1
  100. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
  101. package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
  102. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  103. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  104. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
  105. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  106. package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
  107. package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
  108. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  109. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
  110. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  111. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  112. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  113. package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
  114. package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
  115. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  116. package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
  117. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
@@ -0,0 +1,106 @@
1
+ var l = Object.defineProperty;
2
+ var a = (s, n, t) => n in s ? l(s, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[n] = t;
3
+ var r = (s, n, t) => a(s, typeof n != "symbol" ? n + "" : n, t);
4
+ import { CommonControl as m } from "../../../common-control.js";
5
+ import { useRecommendationExtensionStore as c } from "../../store/recommendation.js";
6
+ import { AlgorithmControl as C } from "./algorithm.js";
7
+ import { ALGORITHM_CONTROL_ID as U } from "./algorithm.js";
8
+ import { CurrencyControl as h } from "./currency.js";
9
+ import { CURRENCY_CONTROL_ID as $ } from "./currency.js";
10
+ import { FiltersControl as u } from "./filters.js";
11
+ import { FILTERS_CONTROL_ID as F } from "./filters.js";
12
+ import { LocaleControl as f } from "./locale.js";
13
+ import { LOCALE_CONTROL_ID as A } from "./locale.js";
14
+ import { ProductLayoutControl as d } from "./productLayout.js";
15
+ import { PRODUCT_LAYOUT_CONTROL_ID as v } from "./productLayout.js";
16
+ import { ShuffleControl as p } from "./shuffle.js";
17
+ import { SHUFFLE_CONTROL_ID as B } from "./shuffle.js";
18
+ const R = "ui-elements-recommendation-block";
19
+ class I extends m {
20
+ constructor() {
21
+ super(...arguments);
22
+ r(this, "store", c());
23
+ r(this, "storeUnsubscription", () => {
24
+ });
25
+ // Sub-control instances for lifecycle management
26
+ r(this, "algorithmControl", null);
27
+ r(this, "localeControl", null);
28
+ r(this, "currencyControl", null);
29
+ r(this, "productLayoutControl", null);
30
+ r(this, "filtersControl", null);
31
+ r(this, "shuffleControl", null);
32
+ }
33
+ getId() {
34
+ return R;
35
+ }
36
+ getTemplate() {
37
+ return this.algorithmControl = new C(), this.localeControl = new f(), this.currencyControl = new h(), this.productLayoutControl = new d(), this.filtersControl = new u(), this.shuffleControl = new p(), `
38
+ <div class="recommendation-controls-container">
39
+ ${this.algorithmControl.getTemplate()}
40
+ ${this.localeControl.getTemplate()}
41
+ ${this.currencyControl.getTemplate()}
42
+ ${this.filtersControl.getTemplate()}
43
+ ${this.productLayoutControl.getTemplate()}
44
+ ${this.shuffleControl.getTemplate()}
45
+ </div>
46
+ `;
47
+ }
48
+ async onRender() {
49
+ (await Promise.allSettled([
50
+ this.store.fetchRecommendationFilters(),
51
+ this.store.fetchRecommendationCreateData(),
52
+ this.store.fetchRecommendationProducts()
53
+ ])).forEach((o, e) => {
54
+ o.status === "rejected" && console.warn(`Recommendation block: ${[
55
+ "fetchRecommendationFilters",
56
+ "fetchRecommendationCreateData",
57
+ "fetchRecommendationProducts"
58
+ ][e]} failed`, o.reason);
59
+ }), this._initializeSubControls(), this._listenStateUpdates();
60
+ }
61
+ onDestroy() {
62
+ var t, o, e, i;
63
+ this.storeUnsubscription(), (o = (t = this.filtersControl) == null ? void 0 : t.onDestroy) == null || o.call(t), (i = (e = this.productLayoutControl) == null ? void 0 : e.onDestroy) == null || i.call(e);
64
+ }
65
+ /**
66
+ * Initialize all sub-controls with the shared API context
67
+ * Each sub-control manages its own form values and event listeners
68
+ */
69
+ _initializeSubControls() {
70
+ [
71
+ this.algorithmControl,
72
+ this.localeControl,
73
+ this.currencyControl,
74
+ this.productLayoutControl,
75
+ this.filtersControl,
76
+ this.shuffleControl
77
+ ].forEach((o) => {
78
+ var e;
79
+ o && (o.api = this.api, o.currentNode = this.currentNode, (e = o.onRender) == null || e.call(o));
80
+ });
81
+ }
82
+ /**
83
+ * Listen to store changes that require product refresh
84
+ */
85
+ _listenStateUpdates() {
86
+ this.storeUnsubscription = this.store.$subscribe((t) => {
87
+ "payload" in t && t.payload.recommendationConfigs && this.store.fetchRecommendationProducts();
88
+ });
89
+ }
90
+ }
91
+ export {
92
+ U as ALGORITHM_CONTROL_ID,
93
+ C as AlgorithmControl,
94
+ R as CONTROL_BLOCK_ID,
95
+ $ as CURRENCY_CONTROL_ID,
96
+ h as CurrencyControl,
97
+ F as FILTERS_CONTROL_ID,
98
+ u as FiltersControl,
99
+ A as LOCALE_CONTROL_ID,
100
+ f as LocaleControl,
101
+ v as PRODUCT_LAYOUT_CONTROL_ID,
102
+ d as ProductLayoutControl,
103
+ I as RecommendationBlockControl,
104
+ B as SHUFFLE_CONTROL_ID,
105
+ p as ShuffleControl
106
+ };
@@ -0,0 +1,64 @@
1
+ var a = Object.defineProperty;
2
+ var i = (o, t, e) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var s = (o, t, e) => i(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as r } from "../../../common-control.js";
6
+ import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
7
+ const c = "recommendation-locale-control", n = {
8
+ LOCALE: "language"
9
+ };
10
+ class C extends r {
11
+ constructor() {
12
+ super(...arguments);
13
+ s(this, "store", m());
14
+ }
15
+ getId() {
16
+ return c;
17
+ }
18
+ getTemplate() {
19
+ return `
20
+ <div class="locale-control-container">
21
+ ${this._GuTwoColumns([
22
+ this._GuLabel({ text: "Recommendation Locale" }),
23
+ this._GuSelect({
24
+ name: n.LOCALE,
25
+ placeholder: "Select Recommendation Locale",
26
+ options: this.store.getLanguages
27
+ })
28
+ ])}
29
+ </div>
30
+ `;
31
+ }
32
+ onRender() {
33
+ this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
34
+ }
35
+ _setFormValues() {
36
+ const { recommendationConfigs: e } = this.store;
37
+ this.api.updateValues({
38
+ [n.LOCALE]: e.language
39
+ });
40
+ }
41
+ _initializeSelectItems() {
42
+ this.api.setUIEAttribute(
43
+ n.LOCALE,
44
+ l.SELECTPICKER.items,
45
+ this.store.getLanguages
46
+ );
47
+ }
48
+ _onLocaleChange(e) {
49
+ this.store.$patch({
50
+ recommendationConfigs: {
51
+ language: e
52
+ }
53
+ });
54
+ }
55
+ _listenToFormUpdates() {
56
+ this.api.onValueChanged(n.LOCALE, (e) => {
57
+ this._onLocaleChange(e);
58
+ });
59
+ }
60
+ }
61
+ export {
62
+ c as LOCALE_CONTROL_ID,
63
+ C as LocaleControl
64
+ };
@@ -0,0 +1,123 @@
1
+ var u = Object.defineProperty;
2
+ var d = (i, o, t) => o in i ? u(i, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[o] = t;
3
+ var s = (i, o, t) => d(i, typeof o != "symbol" ? o + "" : o, t);
4
+ import { UEAttr as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
+ import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
7
+ import { getCurrentLayout as m, regenerateProductRows as R, reapplySpacing as C } from "./utils.js";
8
+ import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
9
+ const l = "recommendation-product-layout-control", e = {
10
+ PRODUCT_COUNT: "size",
11
+ PRODUCT_IN_ROW: "cardsInRow",
12
+ PRODUCT_IN_ROW_LABEL: "cardsInRowLabel"
13
+ };
14
+ class I extends c {
15
+ constructor() {
16
+ super(...arguments);
17
+ s(this, "store", _());
18
+ s(this, "storeUnsubscription", () => {
19
+ });
20
+ s(this, "_debouncedRegenerateProductRows", h(() => {
21
+ this._regenerateProductRows();
22
+ }, 500));
23
+ }
24
+ getId() {
25
+ return l;
26
+ }
27
+ getTemplate() {
28
+ return `
29
+ <div class="product-layout-control-container">
30
+ ${this._GuTwoColumns([
31
+ this._GuLabel({ text: "Number of Products" }),
32
+ this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: 9 }),
33
+ this._GuLabel({ text: "Products in One Row", name: e.PRODUCT_IN_ROW_LABEL }),
34
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: 4 })
35
+ ])}
36
+ </div>
37
+ `;
38
+ }
39
+ onRender() {
40
+ this._initializeCounterValues(), this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates();
41
+ }
42
+ onTemplateNodeUpdated(t) {
43
+ super.onTemplateNodeUpdated(t), this._updateProductsInRowVisibility();
44
+ }
45
+ onDestroy() {
46
+ this.storeUnsubscription();
47
+ }
48
+ _setFormValues() {
49
+ const { recommendationConfigs: t } = this.store;
50
+ this.api.updateValues({
51
+ [e.PRODUCT_COUNT]: t.size,
52
+ [e.PRODUCT_IN_ROW]: t.cardsInRow
53
+ });
54
+ }
55
+ _initializeCounterValues() {
56
+ const { recommendationConfigs: t } = this.store;
57
+ this.api.setUIEAttribute(
58
+ e.PRODUCT_COUNT,
59
+ a.SELECTPICKER.items,
60
+ Number(t.size)
61
+ ), this.api.setUIEAttribute(
62
+ e.PRODUCT_IN_ROW,
63
+ a.SELECTPICKER.items,
64
+ t.cardsInRow
65
+ );
66
+ }
67
+ /**
68
+ * Updates "Products in One Row" visibility based on layout orientation
69
+ * This control is hidden for horizontal layout (products always take full width)
70
+ * Reads from store first (reliable during state transitions), falls back to DOM
71
+ */
72
+ _updateProductsInRowVisibility() {
73
+ const r = (this.store.recommendationConfigs.orientation || m(this.currentNode)) === "vertical";
74
+ this.api.setVisibility(e.PRODUCT_IN_ROW, r), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, r);
75
+ }
76
+ _onProductCountChange(t) {
77
+ this.store.$patch({
78
+ recommendationConfigs: {
79
+ size: t
80
+ }
81
+ }), this._debouncedRegenerateProductRows();
82
+ }
83
+ _onProductsInRowChange(t) {
84
+ this.store.$patch({
85
+ recommendationConfigs: {
86
+ cardsInRow: t
87
+ }
88
+ }), this._debouncedRegenerateProductRows();
89
+ }
90
+ _regenerateProductRows() {
91
+ R({
92
+ currentNode: this.currentNode,
93
+ documentModifier: this.api.getDocumentModifier(),
94
+ afterRegenerate: () => {
95
+ C({
96
+ currentNode: this.currentNode,
97
+ documentModifier: this.api.getDocumentModifier()
98
+ });
99
+ }
100
+ });
101
+ }
102
+ _listenToFormUpdates() {
103
+ this.api.onValueChanged(e.PRODUCT_COUNT, (t) => {
104
+ this._onProductCountChange(t.toString());
105
+ }), this.api.onValueChanged(e.PRODUCT_IN_ROW, (t) => {
106
+ this._onProductsInRowChange(Number(t));
107
+ });
108
+ }
109
+ /**
110
+ * Subscribe to store changes to update visibility when layout changes
111
+ */
112
+ _listenStateUpdates() {
113
+ let t = this.store.recommendationConfigs.orientation;
114
+ this.storeUnsubscription = this.store.$subscribe(() => {
115
+ const n = this.store.recommendationConfigs.orientation;
116
+ n !== t && (t = n, this._updateProductsInRowVisibility());
117
+ });
118
+ }
119
+ }
120
+ export {
121
+ l as PRODUCT_LAYOUT_CONTROL_ID,
122
+ I as ProductLayoutControl
123
+ };
@@ -0,0 +1,60 @@
1
+ var n = Object.defineProperty;
2
+ var r = (o, t, e) => t in o ? n(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var i = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as u } from "../../../common-control.js";
6
+ import { useRecommendationExtensionStore as a } from "../../store/recommendation.js";
7
+ const h = "recommendation-shuffle-control", s = {
8
+ SHUFFLE_PRODUCTS: "shuffleProducts"
9
+ };
10
+ class C extends u {
11
+ constructor() {
12
+ super(...arguments);
13
+ i(this, "store", a());
14
+ }
15
+ getId() {
16
+ return h;
17
+ }
18
+ getTemplate() {
19
+ return `
20
+ <div class="shuffle-control-container">
21
+ ${this._GuTwoColumns([
22
+ this._GuLabel({ text: "Shuffle Recommended Products" }),
23
+ this._GuToggle(s.SHUFFLE_PRODUCTS)
24
+ ])}
25
+ </div>
26
+ `;
27
+ }
28
+ onRender() {
29
+ this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
30
+ }
31
+ _setFormValues() {
32
+ const { recommendationConfigs: e } = this.store;
33
+ this.api.updateValues({
34
+ [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
35
+ });
36
+ }
37
+ _initializeToggle() {
38
+ this.api.setUIEAttribute(
39
+ s.SHUFFLE_PRODUCTS,
40
+ l.SELECTPICKER.items,
41
+ this.store.recommendationConfigs.shuffleProducts
42
+ );
43
+ }
44
+ _onShuffleChange(e) {
45
+ this.store.$patch({
46
+ recommendationConfigs: {
47
+ shuffleProducts: e
48
+ }
49
+ });
50
+ }
51
+ _listenToFormUpdates() {
52
+ this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
53
+ this._onShuffleChange(!!e);
54
+ });
55
+ }
56
+ }
57
+ export {
58
+ h as SHUFFLE_CONTROL_ID,
59
+ C as ShuffleControl
60
+ };
@@ -0,0 +1,112 @@
1
+ import { ModificationDescription as s } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CONTAINER_SELECTOR as y } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as S } from "../../store/recommendation.js";
4
+ import { prepareProductRows as A } from "../../templates/index.js";
5
+ import { DEFAULT_CARD_COMPOSITION as d, getDefaultProducts as b } from "../../templates/utils.js";
6
+ const f = "ins-recommendation-v3-block-v2";
7
+ function p(e) {
8
+ if (!e)
9
+ return null;
10
+ if ("getAttribute" in e) {
11
+ const t = e.getAttribute("class");
12
+ if (t && t.includes(f))
13
+ return e;
14
+ }
15
+ return "querySelector" in e ? e.querySelector(`.${f}`) : null;
16
+ }
17
+ function m(e) {
18
+ const t = p(e);
19
+ return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
20
+ }
21
+ function C(e) {
22
+ const t = p(e);
23
+ if (!t || !("getAttribute" in t))
24
+ return d;
25
+ const r = t.getAttribute("data-card-composition");
26
+ return r ? r.split(",").filter(Boolean) : d;
27
+ }
28
+ function R(e) {
29
+ const { currentNode: t, documentModifier: r, afterRegenerate: o } = e;
30
+ if (!t || !("querySelector" in t))
31
+ return;
32
+ const a = t.querySelector(y);
33
+ if (!a)
34
+ return;
35
+ const c = S(), i = c.recommendationProducts.length > 0 ? c.recommendationProducts : b(), { cardsInRow: l } = c.recommendationConfigs, n = C(t), u = m(t), g = A(i, u, {
36
+ productsPerRow: l,
37
+ composition: n
38
+ });
39
+ r.modifyHtml(a).setInnerHtml(g).apply(new s("Updated product")), o == null || o();
40
+ }
41
+ function h(e, t, r, o) {
42
+ const c = `0 ${Math.floor(r / 2)}px`;
43
+ let i = !1;
44
+ return o === "vertical" ? Array.from(
45
+ e.querySelectorAll(".attribute-cell")
46
+ ).forEach((n) => {
47
+ t.modifyHtml(n).setStyle("padding", c), i = !0;
48
+ }) : Array.from(
49
+ e.querySelectorAll(".product-card-wrapper")
50
+ ).forEach((n) => {
51
+ "parentNode" in n && n.parentNode && typeof n.parentNode == "object" && "tagName" in n.parentNode && n.parentNode.tagName === "TD" && (t.modifyHtml(n.parentNode).setStyle("padding", c), i = !0);
52
+ }), i;
53
+ }
54
+ function E(e, t, r) {
55
+ const o = `${r}px`, a = Array.from(e.querySelectorAll(".spacer"));
56
+ let c = !1;
57
+ return a.forEach((i) => {
58
+ t.modifyHtml(i).setStyle("height", o), c = !0;
59
+ }), c;
60
+ }
61
+ function P(e) {
62
+ const { currentNode: t, documentModifier: r } = e;
63
+ if (!t)
64
+ return;
65
+ const o = p(t);
66
+ if (!o || !("getAttribute" in o))
67
+ return;
68
+ const a = o.getAttribute("data-column-spacing"), c = o.getAttribute("data-row-spacing"), i = m(t);
69
+ let l = !1;
70
+ if (a) {
71
+ const n = parseInt(a);
72
+ Number.isNaN(n) || (l = h(
73
+ t,
74
+ r,
75
+ n,
76
+ i
77
+ ));
78
+ }
79
+ if (c) {
80
+ const n = parseInt(c);
81
+ if (!Number.isNaN(n)) {
82
+ const u = E(t, r, n);
83
+ l = l || u;
84
+ }
85
+ }
86
+ l && r.apply(new s("Reapply spacing after regeneration"));
87
+ }
88
+ function H(e) {
89
+ if (!e)
90
+ return null;
91
+ const t = e.querySelector(".product-card-segment"), r = e.querySelector(".product-card-wrapper");
92
+ let o = null;
93
+ return t && "getStyle" in t && (o = t.getStyle("background-color")), (!o || o === "transparent") && r && "getStyle" in r && (o = r.getStyle("background-color")), o;
94
+ }
95
+ function I(e) {
96
+ const { currentNode: t, documentModifier: r, bgColor: o, layout: a } = e;
97
+ if (!o || o === "transparent" || !t)
98
+ return;
99
+ const c = a === "vertical" ? ".product-card-segment" : ".product-card-wrapper", i = Array.from(t.querySelectorAll(c));
100
+ i.length !== 0 && (i.forEach((l) => {
101
+ r.modifyHtml(l).setStyle("background-color", o);
102
+ }), r.apply(new s("Apply card background color")));
103
+ }
104
+ export {
105
+ I as applyCardBackgroundColor,
106
+ p as getBlockElement,
107
+ C as getCardComposition,
108
+ H as getCurrentCardBackgroundColor,
109
+ m as getCurrentLayout,
110
+ P as reapplySpacing,
111
+ R as regenerateProductRows
112
+ };
@@ -0,0 +1,46 @@
1
+ import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as l, createTextStyleControl as C, createTextSizeControl as c, createTextColorControl as N, createTextAlignControl as a } from "../../../controlFactories.js";
2
+ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
+ import { RecommendationControlId as t } from "../../constants/controlIds.js";
4
+ import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
5
+ import { NameTextTrimControl as i } from "./textTrim.js";
6
+ const m = a(
7
+ t.NAME_ALIGN,
8
+ o.NAME,
9
+ r
10
+ ), A = N(
11
+ t.NAME_COLOR,
12
+ o.NAME,
13
+ r
14
+ ), E = c(
15
+ t.NAME_SIZE,
16
+ o.NAME,
17
+ r
18
+ ), M = C(
19
+ t.NAME_STYLE,
20
+ o.NAME,
21
+ r
22
+ ), s = l(
23
+ t.NAME_FONT_FAMILY,
24
+ o.NAME,
25
+ r
26
+ ), d = e(
27
+ t.NAME_BACKGROUND,
28
+ o.NAME,
29
+ r
30
+ ), T = n(
31
+ t.NAME_PADDINGS,
32
+ o.NAME,
33
+ r
34
+ ), F = {
35
+ align: m,
36
+ color: A,
37
+ size: E,
38
+ style: M,
39
+ fontFamily: s,
40
+ background: d,
41
+ paddings: T,
42
+ textTrim: i
43
+ };
44
+ export {
45
+ F as NameControls
46
+ };
@@ -0,0 +1,76 @@
1
+ import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as c } from "../../../common-control.js";
3
+ import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
+ import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
+ import { CONTAINER_SELECTOR as m } from "../../constants/selectors.js";
6
+ const s = {
7
+ TEXT_TRIM_ENABLED: "textTrimEnabled"
8
+ }, r = "text-trim-enabled";
9
+ class p extends c {
10
+ getId() {
11
+ return d.NAME_TEXT_TRIM;
12
+ }
13
+ getTemplate() {
14
+ return `
15
+ <div class="name-text-trim-control-container">
16
+ ${this._GuTwoColumns([
17
+ this._GuLabel({ text: "Trim Long Text" }),
18
+ this._GuToggle(s.TEXT_TRIM_ENABLED)
19
+ ])}
20
+ </div>
21
+ `;
22
+ }
23
+ onRender() {
24
+ this._setFormValues(), this._listenToFormUpdates();
25
+ }
26
+ onTemplateNodeUpdated(t) {
27
+ super.onTemplateNodeUpdated(t), this._setFormValues();
28
+ }
29
+ _setFormValues() {
30
+ const t = this._getCurrentTrimState();
31
+ this.api.updateValues({
32
+ [s.TEXT_TRIM_ENABLED]: t
33
+ });
34
+ }
35
+ _getCurrentTrimState() {
36
+ if (!this.currentNode || !("hasClass" in this.currentNode))
37
+ return !1;
38
+ if (this.currentNode.hasClass(r))
39
+ return !0;
40
+ const t = this.currentNode.closest(m);
41
+ if (!t)
42
+ return !1;
43
+ const e = t.querySelector(
44
+ `[esd-extension-block-id="${a.NAME}"]`
45
+ );
46
+ return e && "hasClass" in e ? e.hasClass(r) : !1;
47
+ }
48
+ _onTextTrimChange(t) {
49
+ if (!this.currentNode || !("closest" in this.currentNode))
50
+ return;
51
+ const e = this.currentNode.closest(m);
52
+ if (!e || !("querySelectorAll" in e))
53
+ return;
54
+ const i = Array.from(
55
+ e.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
56
+ );
57
+ if (!i.length)
58
+ return;
59
+ const o = this.api.getDocumentModifier();
60
+ i.forEach((n) => {
61
+ t ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
62
+ }), o.apply(
63
+ new l(
64
+ t ? "Enable product name text trimming" : "Disable product name text trimming"
65
+ )
66
+ );
67
+ }
68
+ _listenToFormUpdates() {
69
+ this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (t) => {
70
+ this._onTextTrimChange(t);
71
+ });
72
+ }
73
+ }
74
+ export {
75
+ p as NameTextTrimControl
76
+ };
@@ -0,0 +1,44 @@
1
+ import { createPaddingsControl as r, createTextBackgroundColorControl as C, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as c, createTextColorControl as _, createTextAlignControl as I } from "../../../controlFactories.js";
2
+ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
+ import { RecommendationControlId as t } from "../../constants/controlIds.js";
4
+ import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
5
+ const O = I(
6
+ t.OLD_PRICE_ALIGN,
7
+ o.OLD_PRICE,
8
+ n
9
+ ), R = _(
10
+ t.OLD_PRICE_COLOR,
11
+ o.OLD_PRICE,
12
+ n
13
+ ), a = c(
14
+ t.OLD_PRICE_SIZE,
15
+ o.OLD_PRICE,
16
+ n
17
+ ), i = l(
18
+ t.OLD_PRICE_STYLE,
19
+ o.OLD_PRICE,
20
+ n
21
+ ), E = e(
22
+ t.OLD_PRICE_FONT_FAMILY,
23
+ o.OLD_PRICE,
24
+ n
25
+ ), L = C(
26
+ t.OLD_PRICE_BACKGROUND,
27
+ o.OLD_PRICE,
28
+ n
29
+ ), P = r(
30
+ t.OLD_PRICE_PADDINGS,
31
+ o.OLD_PRICE,
32
+ n
33
+ ), T = {
34
+ align: O,
35
+ color: R,
36
+ size: a,
37
+ style: i,
38
+ fontFamily: E,
39
+ background: L,
40
+ paddings: P
41
+ };
42
+ export {
43
+ T as OldPriceControls
44
+ };
@@ -0,0 +1,48 @@
1
+ import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as C, createTextStyleControl as O, createTextSizeControl as S, createTextColorControl as I, createTextAlignControl as N } from "../../../controlFactories.js";
2
+ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
+ import { RecommendationControlId as t } from "../../constants/controlIds.js";
4
+ import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
5
+ import { OmnibusDiscountTextAfterControl as l } from "./textAfter.js";
6
+ import { OmnibusDiscountTextBeforeControl as U } from "./textBefore.js";
7
+ const i = N(
8
+ t.OMNIBUS_DISCOUNT_ALIGN,
9
+ o.OMNIBUS_DISCOUNT,
10
+ r
11
+ ), T = I(
12
+ t.OMNIBUS_DISCOUNT_COLOR,
13
+ o.OMNIBUS_DISCOUNT,
14
+ r
15
+ ), c = S(
16
+ t.OMNIBUS_DISCOUNT_SIZE,
17
+ o.OMNIBUS_DISCOUNT,
18
+ r
19
+ ), _ = O(
20
+ t.OMNIBUS_DISCOUNT_STYLE,
21
+ o.OMNIBUS_DISCOUNT,
22
+ r
23
+ ), m = C(
24
+ t.OMNIBUS_DISCOUNT_FONT_FAMILY,
25
+ o.OMNIBUS_DISCOUNT,
26
+ r
27
+ ), s = e(
28
+ t.OMNIBUS_DISCOUNT_BACKGROUND,
29
+ o.OMNIBUS_DISCOUNT,
30
+ r
31
+ ), B = n(
32
+ t.OMNIBUS_DISCOUNT_PADDINGS,
33
+ o.OMNIBUS_DISCOUNT,
34
+ r
35
+ ), g = {
36
+ align: i,
37
+ color: T,
38
+ size: c,
39
+ style: _,
40
+ fontFamily: m,
41
+ background: s,
42
+ paddings: B,
43
+ textBefore: U,
44
+ textAfter: l
45
+ };
46
+ export {
47
+ g as OmnibusDiscountControls
48
+ };