@useinsider/guido 3.1.1 → 3.2.0-beta.080341b

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 (189) hide show
  1. package/README.md +117 -0
  2. package/dist/@types/config/schemas.js +166 -96
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +92 -80
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  9. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  10. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  11. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  12. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  13. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  14. package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
  15. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  16. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  17. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  18. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  19. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  20. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  21. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  22. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  23. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  24. package/dist/composables/useActionsApi.js +4 -4
  25. package/dist/composables/useAutoSave.js +71 -0
  26. package/dist/composables/useFullStoryBridge.js +14 -0
  27. package/dist/composables/useHtmlCompiler.js +23 -21
  28. package/dist/composables/useHtmlValidator.js +40 -38
  29. package/dist/composables/usePreviewMode.js +20 -16
  30. package/dist/composables/useRecommendation.js +46 -26
  31. package/dist/composables/useRibbonOffset.js +21 -0
  32. package/dist/composables/useSave.js +26 -15
  33. package/dist/composables/useStripo.js +48 -45
  34. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  35. package/dist/composables/validators/useLiquidValidator.js +42 -0
  36. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  37. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  38. package/dist/config/compiler/unsubscribeCompilerRules.js +48 -45
  39. package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -71
  40. package/dist/config/i18n/en/tooltips.json.js +2 -1
  41. package/dist/config/migrator/checkboxMigrator.js +5 -3
  42. package/dist/config/migrator/index.js +9 -9
  43. package/dist/config/migrator/radioButtonMigrator.js +66 -44
  44. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  45. package/dist/config/migrator/recommendation/extractors.js +27 -0
  46. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  47. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  48. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  49. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  50. package/dist/config/migrator/recommendationMigrator.js +74 -290
  51. package/dist/enums/extensions/recommendationBlock.js +16 -12
  52. package/dist/enums/onboarding.js +7 -2
  53. package/dist/enums/recommendation.js +2 -2
  54. package/dist/enums/unsubscribe.js +34 -27
  55. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  56. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  57. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  58. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  59. package/dist/extensions/Blocks/Recommendation/block.js +60 -50
  60. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  61. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  62. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  63. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  64. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  65. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  66. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
  67. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  68. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +211 -162
  69. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  70. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  71. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  72. package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
  73. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  74. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
  75. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -13
  76. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  77. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  78. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +27 -15
  79. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  80. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  81. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  82. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  83. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  84. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  85. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  86. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  87. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  88. package/dist/guido.css +1 -1
  89. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
  90. package/dist/node_modules/valibot/dist/index.js +450 -235
  91. package/dist/package.json.js +1 -1
  92. package/dist/services/recommendationApi.js +15 -15
  93. package/dist/services/stripoApi.js +9 -9
  94. package/dist/services/templateLibraryApi.js +49 -46
  95. package/dist/src/@types/config/defaults.d.ts +5 -1
  96. package/dist/src/@types/config/index.d.ts +3 -3
  97. package/dist/src/@types/config/schemas.d.ts +245 -0
  98. package/dist/src/@types/config/types.d.ts +11 -1
  99. package/dist/src/@types/generic.d.ts +0 -1
  100. package/dist/src/@types/save-as-template.d.ts +1 -0
  101. package/dist/src/components/Guido.vue.d.ts +1 -1
  102. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  103. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  104. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  105. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  106. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  107. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  108. package/dist/src/composables/useActionsApi.d.ts +1 -1
  109. package/dist/src/composables/useAutoSave.d.ts +3 -0
  110. package/dist/src/composables/useConfig.d.ts +70 -0
  111. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  112. package/dist/src/composables/useRecommendation.d.ts +10 -1
  113. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  114. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  115. package/dist/src/composables/useSave.d.ts +1 -1
  116. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  117. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  118. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  119. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  120. package/dist/src/config/migrator/index.d.ts +2 -1
  121. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  122. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  123. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  124. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  125. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  126. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  127. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  128. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  129. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  130. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  131. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  132. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  133. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  134. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  135. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  136. package/dist/src/enums/onboarding.d.ts +6 -0
  137. package/dist/src/enums/unsubscribe.d.ts +5 -0
  138. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  139. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  140. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  141. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  142. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  143. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  144. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  145. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  146. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  147. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  148. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  149. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
  150. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  151. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  152. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  153. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  154. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  155. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  156. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  157. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  158. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  159. package/dist/src/library.d.ts +1 -1
  160. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  161. package/dist/src/stores/autosave.d.ts +12 -0
  162. package/dist/src/stores/config.d.ts +630 -0
  163. package/dist/src/stores/editor.d.ts +23 -0
  164. package/dist/src/stores/onboarding.d.ts +4 -0
  165. package/dist/src/stores/preview.d.ts +3 -0
  166. package/dist/src/utils/genericUtil.d.ts +1 -1
  167. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  168. package/dist/src/utils/htmlEscape.d.ts +5 -0
  169. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  170. package/dist/src/utils/timeUtil.d.ts +8 -0
  171. package/dist/static/styles/base.css.js +7 -2
  172. package/dist/static/styles/components/button.css.js +16 -9
  173. package/dist/static/styles/components/loader.css.js +4 -0
  174. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  175. package/dist/stores/autosave.js +17 -0
  176. package/dist/stores/editor.js +3 -1
  177. package/dist/stores/onboarding.js +4 -0
  178. package/dist/stores/preview.js +4 -3
  179. package/dist/utils/genericUtil.js +42 -20
  180. package/dist/utils/htmlCompiler.js +48 -41
  181. package/dist/utils/htmlEscape.js +13 -0
  182. package/dist/utils/pairProductVariables.js +89 -88
  183. package/dist/utils/templatePreparation.js +75 -24
  184. package/dist/utils/timeUtil.js +19 -0
  185. package/dist/utils/tooltipUtils.js +4 -5
  186. package/package.json +8 -4
  187. package/dist/enums/displayConditions.js +0 -80
  188. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  189. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
2
- import { DEFAULT_CARD_COMPOSITION as L, spacer as E, getDefaultProducts as I, createBlockTemplate as _, DEFAULTS as S, buildElementRenderer as b, DEFAULT_CARD_VISIBILITY as A } from "../utils.js";
3
- import { gridElementRenderer as f, ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D } from "./elementRenderer.js";
4
- const C = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
2
+ import { getDefaultProducts as E, createBlockTemplate as I, DEFAULTS as _, DEFAULT_CARD_COMPOSITION as S, spacer as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
3
+ import { ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D, gridElementRenderer as C } from "./elementRenderer.js";
4
+ const O = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const C = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, O = `
21
+ `, g = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,37 +27,38 @@ const C = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function g(t, e, l, n = L) {
31
- const o = (100 / e).toFixed(2), a = e - t.length, r = `<td class="${w}" style="padding: ${D};" width="${o}%"></td>`, i = a > 0 ? r.repeat(a) : "", s = b(l, n);
32
- return n.filter((c) => s[c]).map((c) => {
33
- const p = A[c] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => s[c](R).replace("<td", `<td width="${o}%"`)).join("");
34
- return O.replace("{-{-ATTR_TYPE-}-}", c).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
30
+ function P(t, e, o, r = S, n = {}) {
31
+ const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${w}" style="padding: ${D};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
32
+ return r.filter((s) => a[s]).map((s) => {
33
+ const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
34
+ return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
35
35
  }).join("");
36
36
  }
37
- function P(t, e, l, n) {
38
- const o = [];
39
- for (let r = 0; r < t.length; r += e)
40
- o.push(t.slice(r, r + e));
41
- return o.map((r, i) => {
42
- const s = g(
43
- r,
44
- e,
37
+ function U(t, e, o, r, n = {}) {
38
+ const c = [];
39
+ for (let l = 0; l < t.length; l += e)
40
+ c.push(t.slice(l, l + e));
41
+ return c.map((l, d) => {
42
+ const a = P(
45
43
  l,
44
+ e,
45
+ o,
46
+ r,
46
47
  n
47
- ), d = C.replace("{-{-ATTRIBUTE_ROWS-}-}", s);
48
- return i > 0 ? E + d : d;
48
+ ), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
49
+ return d > 0 ? b + p : p;
49
50
  }).join("");
50
51
  }
51
- function U(t, e, l) {
52
- return P(t, e, f, l);
52
+ function h(t, e, o, r = {}) {
53
+ return U(t, e, C, o, r);
53
54
  }
54
- function W(t) {
55
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, l = _("grid", e), n = I(), o = U(n, m);
56
- return l.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", o).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
55
+ function F(t) {
56
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = I("grid", e), r = E(), n = h(r, L);
57
+ return o.replace("{-{-TITLE-}-}", _.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
57
58
  }
58
59
  export {
59
- W as getDefaultTemplate,
60
- g as prepareGridAttributeRows,
61
- P as prepareGridProductRows,
62
- U as prepareProductRows
60
+ F as getDefaultTemplate,
61
+ P as prepareGridAttributeRows,
62
+ U as prepareGridProductRows,
63
+ h as prepareProductRows
63
64
  };
@@ -1,12 +1,12 @@
1
1
  import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
2
  import { prepareProductRows as c } from "./grid/template.js";
3
- import { prepareProductRows as i } from "./list/template.js";
4
- function P(r, p, o = {}) {
5
- if (p === "list")
6
- return i(r, o.composition);
7
- const { productsPerRow: t = s, composition: e } = o;
8
- return c(r, t, e);
3
+ import { prepareProductRows as R } from "./list/template.js";
4
+ function a(o, t, r = {}) {
5
+ if (t === "list")
6
+ return R(o, r.composition, r.filterList);
7
+ const { productsPerRow: e = s, composition: p, filterList: i } = r;
8
+ return c(o, e, p, i);
9
9
  }
10
10
  export {
11
- P as prepareProductRows
11
+ a as prepareProductRows
12
12
  };
@@ -1,8 +1,8 @@
1
1
  import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as u, ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
2
+ import { ATTR_PRODUCT_ATTR as m, ATTR_PRODUCT_BUTTON as c, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
3
3
  import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
4
4
  import { formatPrice as R } from "../../utils/priceFormatter.js";
5
- import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as y } from "../utils.js";
5
+ import { sanitizeImageUrl as y, CUSTOM_CELL_HTML as C } from "../utils.js";
6
6
  function p() {
7
7
  const t = _(), { currencySettings: e } = t.recommendationConfigs;
8
8
  return {
@@ -15,13 +15,13 @@ function p() {
15
15
  };
16
16
  }
17
17
  function s(t, e = "price") {
18
- const n = p(), r = t[e], a = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
18
+ const n = p(), a = t[e], r = (a == null ? void 0 : a[n.code]) ?? Object.values(a ?? {})[0] ?? 0;
19
19
  return R({
20
- price: a,
20
+ price: r,
21
21
  currency: n
22
22
  });
23
23
  }
24
- const I = {
24
+ const U = {
25
25
  /**
26
26
  * Image cell - left column (120px fixed width)
27
27
  * Has recommendation-attribute-row class and data attributes for Card Composition control
@@ -37,7 +37,7 @@ const I = {
37
37
  valign="middle">
38
38
  <a target="_blank" href="${t.url}">
39
39
  <img
40
- src="${C(t.image_url)}"
40
+ src="${y(t.image_url)}"
41
41
  alt="${t.name}"
42
42
  style="display: block; max-width: 100%; height: auto;"
43
43
  class="adapt-img product-image">
@@ -113,9 +113,9 @@ const I = {
113
113
  /**
114
114
  * Omnibus discount element - row for info cell table
115
115
  */
116
- [m]: (t) => {
117
- var i, c;
118
- const e = p(), n = ((i = t.original_price) == null ? void 0 : i[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, a = n > 0 ? Math.round((n - r) / n * 100) : 0, b = a > 0 ? `-${a}%` : "0%";
116
+ [u]: (t) => {
117
+ var i, l;
118
+ const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, a = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - a) / n * 100) : 0, b = r > 0 ? `-${r}%` : "0%";
119
119
  return `
120
120
  <tr>
121
121
  <td
@@ -137,12 +137,12 @@ const I = {
137
137
  * Button cell - right column (100px fixed width)
138
138
  * Has recommendation-attribute-row class and data attributes for Card Composition control
139
139
  */
140
- [l]: (t) => `
140
+ [c]: (t) => `
141
141
  <td
142
142
  width="100"
143
143
  class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
144
144
  esd-extension-block-id="${o.BUTTON}"
145
- data-attribute-type="${l}"
145
+ data-attribute-type="${c}"
146
146
  data-visibility="1"
147
147
  align="center"
148
148
  valign="middle">
@@ -157,7 +157,17 @@ const I = {
157
157
  href="${t.url}"
158
158
  target="_blank"
159
159
  class="es-button buy-button"
160
- style="color: rgb(56, 118, 29); background: rgb(217, 234, 211); padding: 5px 30px;">
160
+ style="
161
+ color: rgb(56, 118, 29);
162
+ background: rgb(217, 234, 211);
163
+ font-family: arial, 'helvetica neue', helvetica, sans-serif;
164
+ font-size: 16px;
165
+ font-weight: normal;
166
+ line-height: 120%;
167
+ padding: 5px 30px;
168
+ mso-border-alt: 10px solid rgb(217, 234, 211);
169
+ mso-padding-alt: 0;
170
+ ">
161
171
  Buy
162
172
  </a>
163
173
  </span>
@@ -166,11 +176,13 @@ const I = {
166
176
  /**
167
177
  * Custom attribute row template — same tr-td structure as Name, Price, etc.
168
178
  * Used by `buildElementRenderer` for `customAttr:*` composition entries.
179
+ * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
180
+ * @param content - Display content for the cell
169
181
  */
170
- [y]: (t, e) => `
182
+ [C]: (t, e) => `
171
183
  <tr>
172
184
  <td
173
- ${u}="product_attribute.${t}"
185
+ ${m}="${t}"
174
186
  class="esd-block-text product-custom-attribute"
175
187
  esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
176
188
  align="left">
@@ -180,5 +192,5 @@ const I = {
180
192
  `
181
193
  };
182
194
  export {
183
- I as listElementRenderer
195
+ U as listElementRenderer
184
196
  };
@@ -1,14 +1,14 @@
1
- import { ATTR_PRODUCT_IMAGE as i, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
- import { DEFAULT_CARD_COMPOSITION as u, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as b } from "../utils.js";
3
- import { listElementRenderer as T } from "./elementRenderer.js";
4
- function R(r, n, t) {
5
- const l = t ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
1
+ import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
+ import { DEFAULT_CARD_COMPOSITION as b, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
3
+ import { listElementRenderer as f } from "./elementRenderer.js";
4
+ function R(r, n, l) {
5
+ const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
6
6
  return `<tr
7
7
  class="recommendation-attribute-row"
8
8
  data-attribute-type="${n}"
9
- data-visibility="${t ? "1" : "0"}"${l}>${o}</tr>`;
9
+ data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
10
10
  }
11
- const f = `
11
+ const y = `
12
12
  <tr class="recommendation-product-row">
13
13
  <td style="padding: 0 5px;">
14
14
  <table
@@ -26,29 +26,29 @@ const f = `
26
26
  </td>
27
27
  </tr>
28
28
  `;
29
- function y(r, n = u) {
30
- const t = C(T, n), l = t[i](r), a = `
29
+ function O(r, n = b, l = {}) {
30
+ const t = C(f, n, l), o = t[a](r), c = `
31
31
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
32
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
32
+ <table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
33
33
  <tbody>
34
- ${n.filter((e) => e !== i && e !== d).filter((e) => t[e]).map((e) => {
35
- const p = b[e] ?? !0;
36
- return R(t[e](r), e, p);
34
+ ${n.filter((e) => e !== a && e !== d).filter((e) => t[e]).map((e) => {
35
+ const u = T[e] ?? !0;
36
+ return R(t[e](r), e, u);
37
37
  }).join(`
38
38
  `)}
39
39
  </tbody>
40
40
  </table>
41
41
  </td>
42
- `, c = t[d](r), s = l + a + c;
43
- return f.replace("{-{-PRODUCT_CONTENT-}-}", s);
42
+ `, s = t[d](r), p = o + c + s;
43
+ return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
44
44
  }
45
- function w(r, n) {
46
- return r.map((t, l) => {
47
- const o = y(t, n);
48
- return l > 0 ? m + o : o;
45
+ function D(r, n, l = {}) {
46
+ return r.map((t, o) => {
47
+ const i = O(t, n, l);
48
+ return o > 0 ? m + i : i;
49
49
  }).join("");
50
50
  }
51
51
  export {
52
- y as getListProductCard,
53
- w as prepareProductRows
52
+ O as getListProductCard,
53
+ D as prepareProductRows
54
54
  };
@@ -1,55 +1,60 @@
1
- import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as u, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as b, ATTR_PRODUCT_BUTTON as g, ATTR_CUSTOM_PREFIX as d } from "../constants/selectors.js";
2
- function R(t) {
1
+ import { ATTR_CUSTOM_PREFIX as u, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OMNIBUS_DISCOUNT as C, ATTR_PRODUCT_BUTTON as f } from "../constants/selectors.js";
2
+ function U(t) {
3
3
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
4
  }
5
- const O = Symbol("customCellHtml");
6
- function f(t, e) {
7
- const n = t[O];
8
- if (!n)
5
+ function R(t, e) {
6
+ const n = Object.values(e).find((r) => r.attributeName === t);
7
+ return (n == null ? void 0 : n.type) === "defaultAttribute";
8
+ }
9
+ function y(t, e) {
10
+ return R(t, e) ? t : `product_attribute.${t}`;
11
+ }
12
+ const P = Symbol("customCellHtml");
13
+ function S(t, e, n = {}) {
14
+ const r = t[P];
15
+ if (!r)
9
16
  return { ...t };
10
- const r = { ...t };
11
- return e.filter((o) => o.startsWith(d) && !r[o]).forEach((o) => {
12
- const s = o.substring(d.length), l = R(s);
13
- r[o] = (i) => {
14
- var a;
15
- const c = (a = i.product_attributes) == null ? void 0 : a[s];
16
- return n(
17
- s,
18
- c != null ? String(c) : l
19
- );
17
+ const l = { ...t };
18
+ return e.filter((o) => o.startsWith(u) && !l[o]).forEach((o) => {
19
+ const s = o.substring(u.length), a = U(s), D = y(s, n), O = R(s, n);
20
+ l[o] = (d) => {
21
+ var p;
22
+ const i = O ? d[s] : (p = d.product_attributes) == null ? void 0 : p[s];
23
+ let c = a;
24
+ return typeof i == "string" ? c = i : typeof i == "number" && (c = String(i)), r(D, c);
20
25
  };
21
- }), r;
26
+ }), l;
22
27
  }
23
- const h = {
28
+ const L = {
24
29
  TITLE: "You May Also Like!"
25
- }, I = [
30
+ }, M = [
26
31
  m,
27
- p,
32
+ b,
28
33
  T,
29
- u,
30
34
  _,
31
- b,
32
- g
33
- ], P = {
35
+ g,
36
+ C,
37
+ f
38
+ ], $ = {
34
39
  [m]: !0,
35
- [p]: !0,
36
- [u]: !0,
40
+ [b]: !0,
41
+ [_]: !0,
37
42
  [T]: !0,
38
- [_]: !1,
39
- [b]: !1,
40
- [g]: !0
41
- }, U = `
43
+ [g]: !1,
44
+ [C]: !1,
45
+ [f]: !0
46
+ }, h = `
42
47
  <tr>
43
48
  <td class="spacer" style="height: 10px;"></td>
44
49
  </tr>
45
- `, C = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
46
- function E(t) {
47
- return !t || typeof t != "string" || t.trim() === "" ? C : t.startsWith("http://") ? t.replace("http://", "https://") : t;
50
+ `, A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
51
+ function w(t) {
52
+ return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
48
53
  }
49
- function D(t) {
54
+ function I(t) {
50
55
  return {
51
56
  name: "Product Name",
52
- image_url: C,
57
+ image_url: A,
53
58
  price: { USD: 18 },
54
59
  original_price: { USD: 20 },
55
60
  discount: { USD: 2 },
@@ -61,13 +66,13 @@ function D(t) {
61
66
  category: []
62
67
  };
63
68
  }
64
- function S(t = 6) {
69
+ function N(t = 6) {
65
70
  return Array.from(
66
71
  { length: t },
67
- (e, n) => D(String(n + 1))
72
+ (e, n) => I(String(n + 1))
68
73
  );
69
74
  }
70
- function y(t = "grid", e) {
75
+ function k(t = "grid", e) {
71
76
  const n = t === "list" ? `
72
77
  data-layout="list"` : "", r = e ? ` ${e}` : "";
73
78
  return `
@@ -105,7 +110,7 @@ function y(t = "grid", e) {
105
110
  </table>
106
111
  </td>
107
112
  </tr>
108
- ${U}
113
+ ${h}
109
114
  <tr>
110
115
  <td>
111
116
  <table
@@ -144,15 +149,17 @@ function y(t = "grid", e) {
144
149
  `;
145
150
  }
146
151
  export {
147
- O as CUSTOM_CELL_HTML,
148
- h as DEFAULTS,
149
- I as DEFAULT_CARD_COMPOSITION,
150
- P as DEFAULT_CARD_VISIBILITY,
151
- C as PLACEHOLDER_IMAGE,
152
- f as buildElementRenderer,
153
- y as createBlockTemplate,
154
- S as getDefaultProducts,
155
- E as sanitizeImageUrl,
156
- U as spacer,
157
- R as toDisplayName
152
+ P as CUSTOM_CELL_HTML,
153
+ L as DEFAULTS,
154
+ M as DEFAULT_CARD_COMPOSITION,
155
+ $ as DEFAULT_CARD_VISIBILITY,
156
+ A as PLACEHOLDER_IMAGE,
157
+ S as buildElementRenderer,
158
+ k as createBlockTemplate,
159
+ N as getDefaultProducts,
160
+ R as isDefaultAttribute,
161
+ y as resolveProductAttrValue,
162
+ w as sanitizeImageUrl,
163
+ h as spacer,
164
+ U as toDisplayName
158
165
  };
@@ -1,28 +1,31 @@
1
1
  function l(t) {
2
2
  if (t.length === 0)
3
3
  return "";
4
- const o = t.sort((r, e) => r.filterNumber - e.filterNumber), n = o.map((r) => `[${r.attribute}][${r.operator}][${r.value}]`), [p, ...i] = n;
5
- let u = p;
6
- for (let r = 0; r < i.length; r++) {
4
+ const o = t.sort((r, e) => r.filterNumber - e.filterNumber), u = o.map((r) => {
5
+ const e = r.operator === "||", a = e ? "=" : r.operator, c = e ? decodeURIComponent(r.value).split(",").join("||") : r.value;
6
+ return `[${r.attribute}][${a}][${c}]`;
7
+ }), [s, ...p] = u;
8
+ let n = s;
9
+ for (let r = 0; r < p.length; r++) {
7
10
  const e = o[r].innerGroupOperator;
8
- u += `${e}${i[r]}`;
11
+ n += `${e}${p[r]}`;
9
12
  }
10
- return `(${u})`;
13
+ return `(${n})`;
11
14
  }
12
- function f(t) {
15
+ function G(t) {
13
16
  if (!t || t.length === 0)
14
17
  return "";
15
- const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), n = Object.keys(o).map(Number).sort((r, e) => r - e), p = n.map((r) => {
18
+ const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e), s = u.map((r) => {
16
19
  const e = o[r];
17
20
  return l(e);
18
- }), [i, ...u] = p;
19
- let s = i;
20
- for (let r = 0; r < u.length; r++) {
21
- const e = n[r + 1], c = o[e][0].outerGroupOperator;
22
- s += `${c}${u[r]}`;
21
+ }), [p, ...n] = s;
22
+ let i = p;
23
+ for (let r = 0; r < n.length; r++) {
24
+ const e = u[r + 1], c = o[e][0].outerGroupOperator;
25
+ i += `${c}${n[r]}`;
23
26
  }
24
- return s.trim();
27
+ return i.trim();
25
28
  }
26
29
  export {
27
- f as generateCompleteFilterQuery
30
+ G as generateCompleteFilterQuery
28
31
  };
@@ -0,0 +1,21 @@
1
+ function r(e) {
2
+ if (!e)
3
+ return e;
4
+ switch (e) {
5
+ case "viewedTogether":
6
+ return "similarViewed";
7
+ case "purchasedTogether":
8
+ return "similarBought";
9
+ case "trending":
10
+ return "trendingProducts";
11
+ case "mostValuable":
12
+ return "mostValuableOfPartner";
13
+ case "topSellers":
14
+ return "mostPurchased";
15
+ default:
16
+ return e;
17
+ }
18
+ }
19
+ export {
20
+ r as mapLegacyStrategy
21
+ };
@@ -1,36 +1,27 @@
1
- function m(t) {
2
- const e = {
3
- "&": "&amp;",
4
- "<": "&lt;",
5
- ">": "&gt;",
6
- '"': "&quot;",
7
- "'": "&#39;"
8
- };
9
- return t.replace(/[&<>"']/g, (n) => e[n]);
10
- }
11
- function p(t) {
1
+ import { escapeHtml as m } from "../../../../utils/htmlEscape.js";
2
+ function T(t) {
12
3
  return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
13
4
  }
14
- function T(t, e) {
15
- const n = m(e);
5
+ function H(t, f) {
6
+ const n = m(f);
16
7
  if (!t)
17
8
  return n;
18
- const r = p(t);
9
+ const r = T(t);
19
10
  if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
20
11
  return n;
21
- const i = [], o = [];
22
- let c = r.trim();
12
+ const e = [], s = [];
13
+ let o = r.trim();
23
14
  for (; ; ) {
24
- const u = c.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
15
+ const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
25
16
  if (!u)
26
17
  break;
27
- const [, s, f = "", g] = u, a = new RegExp(`</${s}>$`, "i");
28
- if (!a.test(g))
18
+ const [, i, a = "", c] = u, g = new RegExp(`</${i}>$`, "i");
19
+ if (!g.test(c))
29
20
  break;
30
- i.push(`<${s}${f}>`), o.unshift(`</${s}>`), c = g.replace(a, "").trim();
21
+ e.push(`<${i}${a}>`), s.unshift(`</${i}>`), o = c.replace(g, "").trim();
31
22
  }
32
- return i.length > 0 ? i.join("") + n + o.join("") : n;
23
+ return e.length > 0 ? e.join("") + n + s.join("") : n;
33
24
  }
34
25
  export {
35
- T as preserveTextStyles
26
+ H as preserveTextStyles
36
27
  };
@@ -1,10 +1,10 @@
1
1
  function a(t) {
2
2
  return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
3
3
  }
4
- function r(t) {
4
+ function n(t) {
5
5
  return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
6
6
  }
7
- function n(t) {
7
+ function r(t) {
8
8
  return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
9
9
  }
10
10
  function u(t) {
@@ -14,13 +14,13 @@ function g(t) {
14
14
  return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
15
15
  }
16
16
  function p(t, e) {
17
- return !t || !n(t) ? null : t.getStyle(e);
17
+ return !t || !r(t) ? null : t.getStyle(e);
18
18
  }
19
19
  function N(t) {
20
- return !t || !u(t) ? null : t.parent();
20
+ return !t || !u(t) ? null : t.parent() ?? null;
21
21
  }
22
22
  function l(t, e = "UNKNOWN") {
23
- return t ? a(t) ? t.tagName.toUpperCase() : r(t) ? t.getTagName().toUpperCase() : e : e;
23
+ return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
24
24
  }
25
25
  const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
26
26
  function i(t) {
@@ -36,7 +36,7 @@ function s(t) {
36
36
  export {
37
37
  s as getTableDisplayValue,
38
38
  l as getTagName,
39
- n as hasGetStyle,
39
+ r as hasGetStyle,
40
40
  u as hasParent,
41
41
  c as isTableCellNode,
42
42
  i as isTableCellTag,