@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.4bcb91b

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 (149) hide show
  1. package/README.md +3 -1
  2. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
  3. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
  4. package/dist/composables/useHtmlValidator.js +84 -106
  5. package/dist/composables/useRecommendation.js +21 -54
  6. package/dist/composables/useSave.js +16 -12
  7. package/dist/composables/useStripo.js +58 -54
  8. package/dist/composables/useStripoEventHandler.js +27 -12
  9. package/dist/composables/useSyncModuleExtractor.js +33 -0
  10. package/dist/config/compiler/recommendationCompilerRules.js +39 -45
  11. package/dist/config/migrator/recommendationMigrator.js +2 -2
  12. package/dist/enums/extensions/recommendationBlock.js +1 -1
  13. package/dist/enums/recommendation.js +15 -16
  14. package/dist/enums/unsubscribe.js +25 -21
  15. package/dist/extensions/Blocks/Recommendation/block.js +9 -130
  16. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
  17. package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
  18. package/dist/extensions/Blocks/Recommendation/control.js +336 -0
  19. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
  23. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
  24. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
  25. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
  26. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
  27. package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
  28. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
  29. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
  30. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +193 -230
  32. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
  33. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
  34. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
  35. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  36. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
  37. package/dist/extensions/Blocks/controlFactories.js +93 -125
  38. package/dist/guido.css +1 -1
  39. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
  40. package/dist/services/recommendationApi.js +9 -10
  41. package/dist/services/stripoApi.js +50 -14
  42. package/dist/services/templateLibraryApi.js +13 -16
  43. package/dist/src/@types/events.d.ts +34 -2
  44. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  45. package/dist/src/composables/useRecommendation.d.ts +0 -1
  46. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  47. package/dist/src/enums/unsubscribe.d.ts +3 -0
  48. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
  49. package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
  50. package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
  51. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
  52. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
  53. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
  54. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
  55. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -131
  56. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
  57. package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
  58. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
  59. package/dist/src/mock/api/settings.d.ts +2 -0
  60. package/dist/src/services/stripoApi.d.ts +5 -0
  61. package/dist/src/stores/editor.d.ts +23 -0
  62. package/dist/static/styles/components/notification.css.js +1 -0
  63. package/dist/static/styles/components/version-history.css.js +10 -2
  64. package/dist/static/styles/components/wide-panel.css.js +18 -2
  65. package/dist/static/styles/customEditorStyle.css.js +2 -25
  66. package/dist/stores/editor.js +2 -1
  67. package/dist/utils/pairProductVariables.js +56 -57
  68. package/dist/utils/templatePreparation.js +14 -15
  69. package/package.json +1 -1
  70. package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -116
  71. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
  72. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
  73. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -65
  74. package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
  75. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
  76. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
  77. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
  78. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
  79. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
  80. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
  81. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
  82. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
  83. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
  84. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -217
  85. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
  86. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -110
  87. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
  88. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
  89. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
  90. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
  91. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
  92. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
  93. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
  94. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
  95. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
  96. package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
  97. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
  98. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  99. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
  100. package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
  101. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
  102. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
  103. package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -122
  104. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
  105. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
  106. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
  107. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
  108. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
  109. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
  110. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
  111. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
  112. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
  113. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
  114. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
  115. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
  116. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
  117. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
  118. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
  119. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
  120. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -68
  121. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
  122. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
  123. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
  124. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
  125. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
  126. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
  127. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
  128. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
  129. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
  130. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
  131. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
  132. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
  133. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
  134. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
  135. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
  136. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
  137. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
  138. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
  139. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
  140. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
  141. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
  142. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
  143. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
  144. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -57
  145. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
  146. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -160
  147. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
  148. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
  149. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
@@ -1,174 +0,0 @@
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 listElementRenderer
174
- };
@@ -1,73 +0,0 @@
1
- import { ATTR_PRODUCT_IMAGE as E, ATTR_PRODUCT_NAME as l, 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 o } from "../utils.js";
3
- import { listElementRenderer as e } 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 r = e[E](t), s = o[l], i = o[c], R = o[a], C = o[d], b = o[T], n = (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 = n(
30
- e[l](t),
31
- l,
32
- s
33
- ), _ = n(
34
- e[c](t),
35
- c,
36
- i
37
- ), O = n(
38
- e[a](t),
39
- a,
40
- R
41
- ), P = n(
42
- e[d](t),
43
- d,
44
- C
45
- ), u = n(
46
- e[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 = e[N](t), y = r + D + U;
62
- return f.replace("{-{-PRODUCT_CONTENT-}-}", y);
63
- }
64
- function M(t) {
65
- return t.map((r, s) => {
66
- const i = V(r);
67
- return s > 0 ? $ + i : i;
68
- }).join("");
69
- }
70
- export {
71
- V as getListProductCard,
72
- M as prepareProductRows
73
- };
@@ -1,122 +0,0 @@
1
- import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as s, ATTR_PRODUCT_OMNIBUS_PRICE as l, ATTR_PRODUCT_OMNIBUS_DISCOUNT as n, ATTR_PRODUCT_BUTTON as i } from "../constants/selectors.js";
2
- const m = {
3
- TITLE: "You May Also Like!"
4
- }, g = [
5
- a,
6
- o,
7
- c,
8
- s,
9
- l,
10
- n,
11
- i
12
- ], b = {
13
- [a]: !0,
14
- [o]: !0,
15
- [s]: !0,
16
- [c]: !0,
17
- [l]: !1,
18
- [n]: !1,
19
- [i]: !0
20
- }, T = `
21
- <tr>
22
- <td class="spacer" style="height: 10px;"></td>
23
- </tr>
24
- `, d = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
25
- function R(t) {
26
- return !t || typeof t != "string" || t.trim() === "" ? d : t.startsWith("http://") ? t.replace("http://", "https://") : t;
27
- }
28
- function e(t) {
29
- return {
30
- name: "Product Name",
31
- image_url: d,
32
- price: { USD: 18 },
33
- original_price: { USD: 20 },
34
- discount: { USD: 2 },
35
- url: `https://example.com/product/${t}`,
36
- item_id: t,
37
- in_stock: 1,
38
- locale: "en",
39
- product_attributes: {},
40
- category: []
41
- };
42
- }
43
- function D() {
44
- return [
45
- e("1"),
46
- e("2"),
47
- e("3"),
48
- e("4"),
49
- e("5"),
50
- e("6")
51
- ];
52
- }
53
- function U(t = "grid", r) {
54
- const p = t === "list" ? `
55
- data-layout="list"` : "";
56
- return `
57
- <td
58
- align="left"
59
- class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20${r ? ` ${r}` : ""}"${p}>
60
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
61
- <tr>
62
- <td align="center">
63
- <table
64
- class="container"
65
- width="100%"
66
- cellpadding="0"
67
- cellspacing="0"
68
- border="0">
69
- <tbody>
70
- <tr>
71
- <td>
72
- <table
73
- width="100%"
74
- cellpadding="0"
75
- cellspacing="0"
76
- border="0">
77
- <tbody>
78
- <tr>
79
- <td
80
- class="esd-block-text es-p10t es-p10b es-p20l es-p20r"
81
- align="center">
82
- <p style="font-size: 28px; color: #333333;">
83
- <strong>{-{-TITLE-}-}</strong>
84
- </p>
85
- </td>
86
- </tr>
87
- </tbody>
88
- </table>
89
- </td>
90
- </tr>
91
- ${T}
92
- <tr>
93
- <td>
94
- <table
95
- class="ins-recommendation-product-container"
96
- width="100%"
97
- cellpadding="0"
98
- cellspacing="0"
99
- border="0"
100
- >
101
- {-{-PRODUCT_ROWS-}-}
102
- </table>
103
- </td>
104
- </tr>
105
- </tbody>
106
- </table>
107
- </td>
108
- </tr>
109
- </table>
110
- </td>
111
- `;
112
- }
113
- export {
114
- m as DEFAULTS,
115
- g as DEFAULT_CARD_COMPOSITION,
116
- b as DEFAULT_CARD_VISIBILITY,
117
- d as PLACEHOLDER_IMAGE,
118
- U as createBlockTemplate,
119
- D as getDefaultProducts,
120
- R as sanitizeImageUrl,
121
- T as spacer
122
- };
@@ -1,6 +0,0 @@
1
- function f(n) {
2
- return !n || typeof n != "object" ? !1 : typeof n.configVersion == "number";
3
- }
4
- export {
5
- f as hasMinimalConfig
6
- };
@@ -1,29 +0,0 @@
1
- function d(a, t) {
2
- const { thousandSeparator: s, decimalSeparator: e, decimalCount: r } = t, u = Math.abs(a).toFixed(r), [c, o] = u.split("."), n = c.replace(
3
- /\B(?=(\d{3})+(?!\d))/g,
4
- s
5
- ), i = a < 0 ? "-" : "";
6
- return r > 0 && o ? `${i}${n}${e}${o}` : `${i}${n}`;
7
- }
8
- function m(a) {
9
- const { price: t, currency: s } = a, {
10
- symbol: e,
11
- alignment: r,
12
- thousandSeparator: u,
13
- decimalSeparator: c,
14
- decimalCount: o
15
- } = s;
16
- if (typeof t != "number" || Number.isNaN(t)) {
17
- const i = "0".repeat(o), $ = `0${c}${i}`;
18
- return r === "before" ? `${e} ${$}` : `${$} ${e}`;
19
- }
20
- const n = d(t, {
21
- thousandSeparator: u,
22
- decimalSeparator: c,
23
- decimalCount: o
24
- });
25
- return r === "before" ? `${e} ${n}` : `${n} ${e}`;
26
- }
27
- export {
28
- m as formatPrice
29
- };
@@ -1,46 +0,0 @@
1
- function a(t) {
2
- return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
3
- }
4
- function r(t) {
5
- return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
6
- }
7
- function n(t) {
8
- return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
9
- }
10
- function u(t) {
11
- return typeof t == "object" && t !== null && "parent" in t && typeof t.parent == "function";
12
- }
13
- function g(t) {
14
- return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
15
- }
16
- function p(t, e) {
17
- return !t || !n(t) ? null : t.getStyle(e);
18
- }
19
- function N(t) {
20
- return !t || !u(t) ? null : t.parent();
21
- }
22
- function l(t, e = "UNKNOWN") {
23
- return t ? a(t) ? t.tagName.toUpperCase() : r(t) ? t.getTagName().toUpperCase() : e : e;
24
- }
25
- const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
26
- function i(t) {
27
- return f.has(t.toUpperCase());
28
- }
29
- function c(t) {
30
- const e = l(t);
31
- return i(e);
32
- }
33
- function s(t) {
34
- return c(t) ? "table-cell" : "table-row";
35
- }
36
- export {
37
- s as getTableDisplayValue,
38
- l as getTagName,
39
- n as hasGetStyle,
40
- u as hasParent,
41
- c as isTableCellNode,
42
- i as isTableCellTag,
43
- g as isTdNode,
44
- N as safeGetParent,
45
- p as safeGetStyle
46
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * Formats a price template variable with the correct currency alignment.
3
- * @param campaignId - The recommendation block campaign ID
4
- * @param productIndex - Zero-based product index
5
- * @param attribute - Price attribute name (e.g., 'price', 'original_price')
6
- * @param alignment - Currency alignment from block config: 'before' or 'after'
7
- * @returns Formatted price string with currency variable in correct position
8
- */
9
- export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string): string;
10
- /**
11
- * Transforms recommendation block HTML by replacing product data with
12
- * template variables.
13
- * Preserves the full document structure (DOCTYPE, html, head, body).
14
- * @param html - The raw template HTML
15
- * @returns HTML with template variables replacing product data
16
- */
17
- export declare function prepareRecommendationBlocks(html: string): string;
@@ -1,13 +0,0 @@
1
- /**
2
- * Block IDs used in the Recommendation Extension
3
- * These IDs are used in the esd-extension-block-id attribute to identify specific blocks
4
- */
5
- export declare enum RecommendationBlockId {
6
- BUTTON = "recommendation-block-button",
7
- NAME = "recommendation-block-name",
8
- PRICE = "recommendation-block-price",
9
- OLD_PRICE = "recommendation-block-old-price",
10
- OMNIBUS_PRICE = "recommendation-block-omnibus-price",
11
- OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
12
- IMAGE = "recommendation-block-image"
13
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Default Configuration for Recommendation Block
3
- *
4
- * This module provides the default values for RecommendationNodeConfig.
5
- * These values are used when:
6
- * - A new block is dropped into the template
7
- * - Migrating legacy templates without stored config
8
- * - Merging partial updates with existing config
9
- */
10
- import type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig } from '../types/nodeConfig';
11
- /**
12
- * Default currency configuration
13
- * Uses USD as the base currency with standard formatting
14
- * Note: symbol stores the currency code (e.g., 'USD'), not the symbol character ('$')
15
- * This matches the Currency Symbol dropdown which shows currency codes
16
- */
17
- export declare const DEFAULT_CURRENCY: CurrencyConfig;
18
- /**
19
- * Default omnibus price text configuration
20
- * Pre-filled with common EU Omnibus Directive text
21
- */
22
- export declare const DEFAULT_OMNIBUS_PRICE: OmnibusTextConfig;
23
- /**
24
- * Default omnibus discount text configuration
25
- */
26
- export declare const DEFAULT_OMNIBUS_DISCOUNT: OmnibusTextConfig;
27
- /**
28
- * Default card composition order
29
- * Defines the visual order of elements in product cards
30
- */
31
- export declare const DEFAULT_COMPOSITION: string[];
32
- /**
33
- * Default visibility settings for card elements
34
- * Omnibus elements are hidden by default (not all regions require them)
35
- */
36
- export declare const DEFAULT_VISIBILITY: Record<string, boolean>;
37
- /**
38
- * Complete default configuration for Recommendation Block
39
- *
40
- * This is the single source of truth for default values.
41
- * All other code should import and use this constant.
42
- */
43
- export declare const DEFAULT_NODE_CONFIG: RecommendationNodeConfig;
44
- /**
45
- * Current configuration version
46
- * Increment this when making breaking changes to the schema
47
- * Used for migration detection
48
- */
49
- export declare const CURRENT_CONFIG_VERSION = 1;
@@ -1,13 +0,0 @@
1
- /**
2
- * Recommendation Extension Constants
3
- *
4
- * This module re-exports all constants for the Recommendation extension.
5
- * Import from this file for cleaner imports.
6
- * @example
7
- * import { RecommendationBlockId, CONTAINER_SELECTOR } from './constants';
8
- */
9
- export { RecommendationBlockId } from './blockIds';
10
- export { RecommendationControlId } from './controlIds';
11
- export { CONTAINER_SELECTOR, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, } from './selectors';
12
- export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
- export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, } from './defaultConfig';
@@ -1,35 +0,0 @@
1
- /** Type-safe layout orientation values */
2
- export declare const LAYOUT_VALUES: {
3
- GRID: "grid";
4
- LIST: "list";
5
- };
6
- /** Layout options for radio button UI control */
7
- export declare const LAYOUT_OPTIONS: ({
8
- icon: string;
9
- value: "grid";
10
- } | {
11
- icon: string;
12
- value: "list";
13
- })[];
14
- /** Default number of products displayed per row in grid layout */
15
- export declare const DEFAULT_PRODUCTS_PER_ROW = 3;
16
- /** Default number of cards in a row (used in store initialization) */
17
- export declare const DEFAULT_CARDS_IN_ROW = 3;
18
- /** Maximum number of products that can be displayed */
19
- export declare const MAX_PRODUCT_COUNT = 9;
20
- /** Minimum number of products that can be displayed */
21
- export declare const MIN_PRODUCT_COUNT = 1;
22
- /** Maximum number of products per row in grid layout */
23
- export declare const MAX_PRODUCTS_PER_ROW = 4;
24
- /** Minimum number of products per row in grid layout */
25
- export declare const MIN_PRODUCTS_PER_ROW = 1;
26
- /** Default column spacing between product cards (5px on each side = 10px total) */
27
- export declare const DEFAULT_COLUMN_SPACING = 10;
28
- /** Default row spacing between product rows */
29
- export declare const DEFAULT_ROW_SPACING = 20;
30
- /** Minimum spacing value */
31
- export declare const MIN_SPACING = 0;
32
- /** Maximum spacing value */
33
- export declare const MAX_SPACING = 50;
34
- /** Spacing adjustment step */
35
- export declare const SPACING_STEP = 5;
@@ -1,31 +0,0 @@
1
- /**
2
- * CSS selectors and data attributes used across the Recommendation extension
3
- */
4
- /**
5
- * Container selector for the product container element
6
- * Used across controls to target elements within the recommendation block
7
- */
8
- export declare const CONTAINER_SELECTOR = ".ins-recommendation-product-container";
9
- /**
10
- * Currency HTML attributes set on the block element
11
- * These are read by the HTML compiler at runtime to format prices
12
- */
13
- export declare const CURRENCY_ATTR: {
14
- readonly CURRENCY: "currency";
15
- readonly SYMBOL: "currency-symbol";
16
- readonly ALIGNMENT: "currency-alignment";
17
- readonly THOUSAND_SEPARATOR: "currency-thousand-separator";
18
- readonly DECIMAL_SEPARATOR: "currency-decimal-separator";
19
- readonly DECIMAL_COUNT: "currency-decimal-count";
20
- };
21
- /**
22
- * Attribute type constants used in templates
23
- * These are used as keys in ElementRenderer and composition arrays
24
- */
25
- export declare const ATTR_PRODUCT_IMAGE = "productImage";
26
- export declare const ATTR_PRODUCT_NAME = "productName";
27
- export declare const ATTR_PRODUCT_PRICE = "productPrice";
28
- export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
29
- export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
30
- export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
31
- export declare const ATTR_PRODUCT_BUTTON = "productButton";