@useinsider/guido 2.1.0-beta.67fc452 → 2.1.0-beta.e13d291

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 (119) hide show
  1. package/dist/@types/config/schemas.js +17 -17
  2. package/dist/config/migrator/recommendationMigrator.js +2 -2
  3. package/dist/extensions/Blocks/Recommendation/block.js +40 -6
  4. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  5. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  6. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +64 -0
  7. package/dist/extensions/Blocks/Recommendation/constants/layout.js +20 -0
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +19 -0
  9. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  10. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
  12. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  13. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +96 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +110 -0
  15. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +204 -0
  16. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
  17. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +205 -0
  18. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +74 -0
  19. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +118 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +71 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
  24. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  25. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
  27. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
  28. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  29. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  30. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  31. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  32. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
  33. package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
  34. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
  35. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
  36. package/dist/extensions/Blocks/Recommendation/services/configService.js +239 -0
  37. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
  38. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +41 -36
  39. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +233 -0
  40. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  41. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +69 -0
  42. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  43. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +174 -0
  44. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
  45. package/dist/extensions/Blocks/Recommendation/templates/utils.js +121 -0
  46. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  47. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  48. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +27 -16
  49. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  50. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  51. package/dist/extensions/Blocks/controlFactories.js +125 -93
  52. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +223 -169
  53. package/dist/services/recommendationApi.js +10 -9
  54. package/dist/src/@types/config/schemas.d.ts +2 -2
  55. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +34 -0
  57. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  58. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
  59. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  60. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
  61. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +35 -0
  62. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +31 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  64. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
  65. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
  66. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
  68. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +45 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +57 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +42 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +214 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  78. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +16 -0
  79. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  80. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  81. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  87. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
  88. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  89. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  90. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  91. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +17 -16
  92. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
  93. package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
  94. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
  95. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
  96. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
  97. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
  98. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
  99. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +54 -0
  100. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  101. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +154 -0
  102. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  103. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  104. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  105. package/dist/static/styles/customEditorStyle.css.js +25 -2
  106. package/package.json +1 -1
  107. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
  108. package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
  109. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  110. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  111. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  112. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  113. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  114. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
  115. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  116. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  117. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  118. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  119. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
@@ -0,0 +1,251 @@
1
+ import { ATTR_PRODUCT_BUTTON as s, ATTR_PRODUCT_OMNIBUS_DISCOUNT as d, ATTR_PRODUCT_OMNIBUS_PRICE as c, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as i, ATTR_PRODUCT_NAME as r, ATTR_PRODUCT_IMAGE as p } from "../../constants/selectors.js";
2
+ import { prepareVerticalProductRows as b } from "./template.js";
3
+ const u = `
4
+ <td
5
+ align="left"
6
+ esd-extension-block-id="recommendation-block"
7
+ esd-handler-name="esd-extension-RecommendationBlock"
8
+ class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block esd-extension-block es-p20"
9
+ >
10
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
11
+ <tr>
12
+ <td align="center">
13
+ <table
14
+ class="container"
15
+ width="100%"
16
+ cellpadding="0"
17
+ cellspacing="0"
18
+ border="0">
19
+ <tbody>
20
+ <tr>
21
+ <td>
22
+ <table
23
+ width="100%"
24
+ cellpadding="0"
25
+ cellspacing="0"
26
+ border="0">
27
+ <tbody>
28
+ <tr>
29
+ {-{-TITLE-}-}
30
+ </tr>
31
+ </tbody>
32
+ </table>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td class="spacer" style="height: 20px;"></td>
37
+ </tr>
38
+ <tr>
39
+ <td>
40
+ <table
41
+ class="ins-recommendation-product-container"
42
+ width="100%"
43
+ cellpadding="0"
44
+ cellspacing="0"
45
+ border="0"
46
+ >
47
+ {-{-PRODUCT_ROWS-}-}
48
+ </table>
49
+ </td>
50
+ </tr>
51
+ </tbody>
52
+ </table>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+ </td>
57
+ `, e = "0 5px", a = "attribute-cell", g = {
58
+ [p]: (t) => `
59
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
60
+ <table
61
+ class="product-card-segment"
62
+ width="100%"
63
+ height="100%"
64
+ cellpadding="0"
65
+ cellspacing="0"
66
+ border="0">
67
+ <tr>
68
+ <td
69
+ class="esd-block-image product-image"
70
+ esd-extension-block-id="recommendation-block-image"
71
+ align="center"
72
+ style="font-size: 0px;">
73
+ <a target="_blank" href="${t.url}">
74
+ <img
75
+ src="${t.image_url}"
76
+ alt="${t.name}"
77
+ width="120"
78
+ style="display: block; max-width: 100%; height: auto;"
79
+ class="adapt-img">
80
+ </a>
81
+ </td>
82
+ </tr>
83
+ </table>
84
+ </td>
85
+ `,
86
+ [r]: (t) => `
87
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
88
+ <table
89
+ class="product-card-segment"
90
+ width="100%"
91
+ height="100%"
92
+ cellpadding="0"
93
+ cellspacing="0"
94
+ border="0">
95
+ <tr>
96
+ <td
97
+ class="esd-block-text product-name"
98
+ esd-extension-block-id="recommendation-block-name"
99
+ align="center">
100
+ <p
101
+ path="1"
102
+ contenteditable="false"
103
+ style="font-size: 16px; color: #333333; font-weight: 600; text-align: center;">
104
+ <strong path="1,0">${t.name}</strong>
105
+ </p>
106
+ </td>
107
+ </tr>
108
+ </table>
109
+ </td>
110
+ `,
111
+ [i]: () => `
112
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
113
+ <table
114
+ class="product-card-segment"
115
+ width="100%"
116
+ height="100%"
117
+ cellpadding="0"
118
+ cellspacing="0"
119
+ border="0">
120
+ <tr>
121
+ <td
122
+ class="esd-block-text product-price"
123
+ esd-extension-block-id="recommendation-block-price"
124
+ align="center">
125
+ <p
126
+ path="1"
127
+ contenteditable="false"
128
+ style="font-size: 16px; color: #333333; font-weight: bold; text-align: center;">
129
+ <strong path="1,0">18,00 TRY</strong>
130
+ </p>
131
+ </td>
132
+ </tr>
133
+ </table>
134
+ </td>
135
+ `,
136
+ [o]: () => `
137
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
138
+ <table
139
+ class="product-card-segment"
140
+ width="100%"
141
+ height="100%"
142
+ cellpadding="0"
143
+ cellspacing="0"
144
+ border="0">
145
+ <tr>
146
+ <td
147
+ class="esd-block-text product-old-price"
148
+ esd-extension-block-id="recommendation-block-old-price"
149
+ align="center">
150
+ <p
151
+ path="1"
152
+ contenteditable="false"
153
+ style="font-size: 14px; color: #999999; text-decoration: line-through; text-align: center;">
154
+ <s path="1,0">20,00 TRY</s>
155
+ </p>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ </td>
160
+ `,
161
+ [c]: () => `
162
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
163
+ <table
164
+ class="product-card-segment"
165
+ width="100%"
166
+ height="100%"
167
+ cellpadding="0"
168
+ cellspacing="0"
169
+ border="0">
170
+ <tr>
171
+ <td
172
+ class="esd-block-text product-omnibus-price"
173
+ esd-extension-block-id="recommendation-block-omnibus-price"
174
+ data-text-before="Lowest 30-day price: "
175
+ data-text-after=""
176
+ align="center">
177
+ <p
178
+ path="1"
179
+ contenteditable="false"
180
+ style="font-size: 14px; color: #666666; text-align: center;"><span
181
+ class="omnibus-text-before">Lowest 30-day price: </span><span
182
+ class="omnibus-price-value">17,00 TRY</span><span
183
+ class="omnibus-text-after"></span></p>
184
+ </td>
185
+ </tr>
186
+ </table>
187
+ </td>
188
+ `,
189
+ [d]: () => `
190
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
191
+ <table
192
+ class="product-card-segment"
193
+ width="100%"
194
+ height="100%"
195
+ cellpadding="0"
196
+ cellspacing="0"
197
+ border="0">
198
+ <tr>
199
+ <td
200
+ class="esd-block-text product-omnibus-discount"
201
+ esd-extension-block-id="recommendation-block-omnibus-discount"
202
+ data-text-before=""
203
+ data-text-after=""
204
+ align="center">
205
+ <p
206
+ path="1"
207
+ contenteditable="false"
208
+ style="font-size: 14px; color: #666666; text-align: center;"><span
209
+ class="omnibus-text-before"></span><span
210
+ class="omnibus-discount-value">-6%</span><span
211
+ class="omnibus-text-after"></span></p>
212
+ </td>
213
+ </tr>
214
+ </table>
215
+ </td>
216
+ `,
217
+ [s]: (t) => `
218
+ <td class="${a}" style="padding: ${e}; height: 100%;" valign="top">
219
+ <table
220
+ class="product-card-segment"
221
+ width="100%"
222
+ height="100%"
223
+ cellpadding="0"
224
+ cellspacing="0"
225
+ border="0">
226
+ <tr>
227
+ <td
228
+ class="esd-block-button product-button"
229
+ esd-extension-block-id="recommendation-block-button"
230
+ align="center">
231
+ <span class="es-button-border" style="display: block;">
232
+ <a
233
+ href="${t.url}"
234
+ target="_blank"
235
+ class="es-button">
236
+ {-{-PRODUCT_BUTTON_TEXT-}-}
237
+ </a>
238
+ </span>
239
+ </td>
240
+ </tr>
241
+ </table>
242
+ </td>
243
+ `
244
+ };
245
+ function T(t, l, n) {
246
+ return b(t, l, g, n);
247
+ }
248
+ export {
249
+ u as default,
250
+ T as prepareProductRows
251
+ };
@@ -0,0 +1,69 @@
1
+ import { DEFAULT_PRODUCTS_PER_ROW as T } from "../../constants/layout.js";
2
+ import { DEFAULT_CARD_COMPOSITION as d, spacer as m, createBlockTemplate as R, DEFAULTS as I, getDefaultProducts as L, DEFAULT_CARD_VISIBILITY as b } from "../utils.js";
3
+ import { verticalElementRenderer as w } from "./elementRenderer.js";
4
+ const E = `
5
+ <tr class="recommendation-product-row">
6
+ <td>
7
+ <table
8
+ width="100%"
9
+ height="100%"
10
+ cellpadding="0"
11
+ cellspacing="0"
12
+ border="0"
13
+ class="product-card-wrapper"
14
+ style="table-layout: fixed;">
15
+ <tbody>
16
+ {-{-ATTRIBUTE_ROWS-}-}
17
+ </tbody>
18
+ </table>
19
+ </td>
20
+ </tr>
21
+ `, S = `
22
+ <tr
23
+ class="recommendation-attribute-row"
24
+ data-attribute-type="{-{-ATTR_TYPE-}-}"
25
+ data-visibility="{-{-VISIBILITY-}-}"
26
+ {-{-DISPLAY_STYLE-}-}>
27
+ {-{-CELLS-}-}
28
+ </tr>
29
+ `;
30
+ function _(r, e, o, i = d) {
31
+ const c = (100 / e).toFixed(2);
32
+ return i.filter((t) => o[t]).map((t) => {
33
+ const l = b[t] ?? !0, n = l ? "" : 'style="display: none;"', a = r.map((p) => {
34
+ const u = o[t];
35
+ return u(p).replace("<td", `<td width="${c}%"`);
36
+ }).join("");
37
+ return S.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", l ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", n).replace("{-{-CELLS-}-}", a);
38
+ }).join("");
39
+ }
40
+ function A(r, e, o, i) {
41
+ const c = [];
42
+ for (let t = 0; t < r.length; t += e)
43
+ c.push(r.slice(t, t + e));
44
+ return c.map((t, l) => {
45
+ const n = _(
46
+ t,
47
+ e,
48
+ o,
49
+ i
50
+ ), a = E.replace("{-{-ATTRIBUTE_ROWS-}-}", n);
51
+ return l > 0 ? m + a : a;
52
+ }).join("");
53
+ }
54
+ function f(r, e, o) {
55
+ return A(r, e, w, o);
56
+ }
57
+ function y() {
58
+ const r = R("grid"), e = f(
59
+ L(),
60
+ T
61
+ );
62
+ return r.replace("{-{-TITLE-}-}", I.TITLE).replace("{-{-PRODUCT_ROWS-}-}", e);
63
+ }
64
+ export {
65
+ y as getDefaultTemplate,
66
+ f as prepareProductRows,
67
+ _ as prepareVerticalAttributeRows,
68
+ A as prepareVerticalProductRows
69
+ };
@@ -0,0 +1,12 @@
1
+ import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
+ import { prepareProductRows as R } from "./grid/template.js";
3
+ import { prepareProductRows as c } from "./list/template.js";
4
+ function a(r, o, p = {}) {
5
+ if (o === "list")
6
+ return c(r);
7
+ const { productsPerRow: t = s, composition: e } = p;
8
+ return R(r, t, e);
9
+ }
10
+ export {
11
+ a as prepareProductRows
12
+ };
@@ -0,0 +1,174 @@
1
+ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as u, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
4
+ import { formatPrice as _ } from "../../utils/priceFormatter.js";
5
+ import { sanitizeImageUrl as y } from "../utils.js";
6
+ function p() {
7
+ const t = T(), { currencySettings: e } = t.recommendationConfigs;
8
+ return {
9
+ code: e.value,
10
+ symbol: e.symbol,
11
+ alignment: e.alignment === "0" ? "before" : "after",
12
+ decimalCount: parseInt(e.decimalCount) || 2,
13
+ decimalSeparator: e.decimalSeparator,
14
+ thousandSeparator: e.thousandSeparator
15
+ };
16
+ }
17
+ function a(t, e = "price") {
18
+ const n = p(), r = t[e], i = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
19
+ return _({
20
+ price: i,
21
+ currency: n
22
+ });
23
+ }
24
+ const P = {
25
+ /**
26
+ * Image cell - left column (120px fixed width)
27
+ * Has recommendation-attribute-row class and data attributes for Card Composition control
28
+ */
29
+ [d]: (t) => `
30
+ <td
31
+ width="120"
32
+ class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
33
+ esd-extension-block-id="${o.IMAGE}"
34
+ data-attribute-type="${d}"
35
+ data-visibility="1"
36
+ align="center"
37
+ valign="middle">
38
+ <div style="position: relative; width: 100%; padding-bottom: 100%; overflow: hidden;">
39
+ <a
40
+ target="_blank"
41
+ href="${t.url}"
42
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
43
+ <img
44
+ src="${y(t.image_url)}"
45
+ alt="${t.name}"
46
+ style="max-width: 100%; max-height: 100%; object-fit: contain; display: block;"
47
+ class="adapt-img product-image">
48
+ </a>
49
+ </div>
50
+ </td>
51
+ `,
52
+ /**
53
+ * Name element - row for info cell table
54
+ */
55
+ [x]: (t) => `
56
+ <tr>
57
+ <td
58
+ class="esd-block-text product-name"
59
+ esd-extension-block-id="${o.NAME}"
60
+ align="left">
61
+ <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
62
+ <strong>${t.name}</strong>
63
+ </p>
64
+ </td>
65
+ </tr>
66
+ `,
67
+ /**
68
+ * Price element - row for info cell table
69
+ */
70
+ [f]: (t) => `
71
+ <tr>
72
+ <td
73
+ class="esd-block-text product-price"
74
+ esd-extension-block-id="${o.PRICE}"
75
+ align="left">
76
+ <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
77
+ <strong>${a(t, "price")}</strong>
78
+ </p>
79
+ </td>
80
+ </tr>
81
+ `,
82
+ /**
83
+ * Old price element - row for info cell table
84
+ */
85
+ [g]: (t) => `
86
+ <tr>
87
+ <td
88
+ class="esd-block-text product-old-price"
89
+ esd-extension-block-id="${o.OLD_PRICE}"
90
+ align="left">
91
+ <p
92
+ contenteditable="false"
93
+ style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
94
+ <strong>${a(t, "original_price")}</strong>
95
+ </p>
96
+ </td>
97
+ </tr>
98
+ `,
99
+ /**
100
+ * Omnibus price element - row for info cell table
101
+ */
102
+ [u]: (t) => `
103
+ <tr>
104
+ <td
105
+ class="esd-block-text product-omnibus-price"
106
+ data-text-before="Lowest 30-day price: "
107
+ data-text-after=""
108
+ esd-extension-block-id="${o.OMNIBUS_PRICE}"
109
+ align="left">
110
+ <p style="font-size: 12px; color: #666666; margin: 0;">
111
+ <span class="omnibus-text-before">Lowest 30-day price: </span>
112
+ <span class="omnibus-price-value">${a(t, "original_price")}</span>
113
+ <span class="omnibus-text-after"></span>
114
+ </p>
115
+ </td>
116
+ </tr>
117
+ `,
118
+ /**
119
+ * Omnibus discount element - row for info cell table
120
+ */
121
+ [m]: (t) => {
122
+ var s, c;
123
+ const e = p(), n = ((s = t.original_price) == null ? void 0 : s[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = n > 0 ? Math.round((n - r) / n * 100) : 0, b = i > 0 ? `-${i}%` : "0%";
124
+ return `
125
+ <tr>
126
+ <td
127
+ class="esd-block-text product-omnibus-discount"
128
+ data-text-before=""
129
+ data-text-after=""
130
+ esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
131
+ align="left">
132
+ <p style="font-size: 12px; color: #666666; margin: 0;">
133
+ <span class="omnibus-text-before"></span>
134
+ <span class="omnibus-discount-value">${b}</span>
135
+ <span class="omnibus-text-after"></span>
136
+ </p>
137
+ </td>
138
+ </tr>
139
+ `;
140
+ },
141
+ /**
142
+ * Button cell - right column (100px fixed width)
143
+ * Has recommendation-attribute-row class and data attributes for Card Composition control
144
+ */
145
+ [l]: (t) => `
146
+ <td
147
+ width="100"
148
+ class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
149
+ esd-extension-block-id="${o.BUTTON}"
150
+ data-attribute-type="${l}"
151
+ data-visibility="1"
152
+ align="center"
153
+ valign="middle">
154
+ <span
155
+ class="es-button-border"
156
+ style="
157
+ border-width: 1px;
158
+ background: rgb(217, 234, 211);
159
+ border-color: rgb(106, 168, 79);
160
+ ">
161
+ <a
162
+ href="${t.url}"
163
+ target="_blank"
164
+ class="es-button buy-button"
165
+ style="color: rgb(56, 118, 29); background: rgb(217, 234, 211); padding: 5px 30px;">
166
+ Buy
167
+ </a>
168
+ </span>
169
+ </td>
170
+ `
171
+ };
172
+ export {
173
+ P as horizontalElementRenderer
174
+ };
@@ -0,0 +1,73 @@
1
+ import { ATTR_PRODUCT_IMAGE as E, ATTR_PRODUCT_NAME as s, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as a, ATTR_PRODUCT_OMNIBUS_PRICE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as T, ATTR_PRODUCT_BUTTON as N } from "../../constants/selectors.js";
2
+ import { spacer as $, DEFAULT_CARD_VISIBILITY as n } from "../utils.js";
3
+ import { horizontalElementRenderer as o } from "./elementRenderer.js";
4
+ const f = `
5
+ <tr class="recommendation-product-row">
6
+ <td style="padding: 0 5px;">
7
+ <table
8
+ width="100%"
9
+ cellpadding="0"
10
+ cellspacing="0"
11
+ border="0"
12
+ class="product-card-wrapper">
13
+ <tbody>
14
+ <tr>
15
+ {-{-PRODUCT_CONTENT-}-}
16
+ </tr>
17
+ </tbody>
18
+ </table>
19
+ </td>
20
+ </tr>
21
+ `;
22
+ function V(t) {
23
+ const i = o[E](t), l = n[s], r = n[c], R = n[a], C = n[d], b = n[T], e = (w, A, p) => {
24
+ const I = p ? "" : ' style="display: none;"', g = w.replace(/<tr>/, "").replace(/<\/tr>/, "");
25
+ return `<tr
26
+ class="recommendation-attribute-row"
27
+ data-attribute-type="${A}"
28
+ data-visibility="${p ? "1" : "0"}"${I}>${g}</tr>`;
29
+ }, m = e(
30
+ o[s](t),
31
+ s,
32
+ l
33
+ ), _ = e(
34
+ o[c](t),
35
+ c,
36
+ r
37
+ ), O = e(
38
+ o[a](t),
39
+ a,
40
+ R
41
+ ), P = e(
42
+ o[d](t),
43
+ d,
44
+ C
45
+ ), u = e(
46
+ o[T](t),
47
+ T,
48
+ b
49
+ ), D = `
50
+ <td class="product-info-cell" valign="middle" style="padding: 15px;">
51
+ <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
52
+ <tbody>
53
+ ${m}
54
+ ${_}
55
+ ${O}
56
+ ${P}
57
+ ${u}
58
+ </tbody>
59
+ </table>
60
+ </td>
61
+ `, U = o[N](t), y = i + D + U;
62
+ return f.replace("{-{-PRODUCT_CONTENT-}-}", y);
63
+ }
64
+ function M(t) {
65
+ return t.map((i, l) => {
66
+ const r = V(i);
67
+ return l > 0 ? $ + r : r;
68
+ }).join("");
69
+ }
70
+ export {
71
+ V as getHorizontalProductCard,
72
+ M as prepareProductRows
73
+ };