@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,56 +1,60 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { RecommendationBlockId as f } from "../../constants/blockIds.js";
3
- import { MOBILE_CONTAINER_SELECTOR as P, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as q, CONTAINER_SELECTOR as $ } from "../../constants/selectors.js";
2
+ import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
+ import { MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as E } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
- import { prepareProductRows as T } from "../../templates/index.js";
7
- import { formatPrice as B } from "../../utils/priceFormatter.js";
8
- import { isTdNode as v } from "../../utils/tagName.js";
9
- import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as j } from "../../templates/utils.js";
10
- const h = "recommendation-block-v2";
11
- function M(t) {
6
+ import { prepareProductRows as _ } from "../../templates/index.js";
7
+ import { formatPrice as j } from "../../utils/priceFormatter.js";
8
+ import { isTdNode as F } from "../../utils/tagName.js";
9
+ import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as V } from "../../templates/utils.js";
10
+ const M = "recommendation-block-v2";
11
+ function h(t) {
12
12
  if (!t)
13
13
  return null;
14
14
  if ("getAttribute" in t) {
15
15
  const e = t.getAttribute("class");
16
- if (e && e.includes(h))
16
+ if (e && e.includes(M))
17
17
  return t;
18
18
  }
19
- return "querySelector" in t ? t.querySelector(`.${h}`) : null;
19
+ return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
20
20
  }
21
- function g(t) {
22
- const e = M(t);
21
+ function b(t) {
22
+ const e = h(t);
23
23
  if (!e || !("getAttribute" in e))
24
24
  return "grid";
25
25
  const o = e.getAttribute("data-layout");
26
26
  return o === "list" || o === "horizontal" ? "list" : "grid";
27
27
  }
28
- function L(t) {
29
- const e = M(t);
28
+ function x(t) {
29
+ const e = h(t);
30
30
  if (!e || !("getAttribute" in e))
31
31
  return R;
32
32
  const o = e.getAttribute("data-card-composition");
33
33
  return o ? o.split(",").filter(Boolean) : R;
34
34
  }
35
- function b(t, e, o) {
36
- if (!e || !("childNodes" in e))
37
- return !1;
38
- const i = e.childNodes().find(
39
- (c) => "getType" in c && c.getType() === "text"
35
+ function D(t) {
36
+ if (!t || !("childNodes" in t))
37
+ return null;
38
+ const e = t.childNodes(), o = e.find(
39
+ (n) => "getType" in n && n.getType() === "text"
40
40
  );
41
- return i ? (t.modifyHtml(i).setText(o), !0) : !1;
41
+ return o || e.reduce((n, i) => n || !("getType" in i) || i.getType() === "text" ? n : D(i), null);
42
+ }
43
+ function S(t, e, o) {
44
+ const n = D(e);
45
+ return n ? (t.modifyHtml(n).setText(o), !0) : !1;
42
46
  }
43
- function x(t, e) {
44
- return t && t.length > 0 ? t : e.length > 0 ? e : _();
47
+ function U(t, e) {
48
+ return t && t.length > 0 ? t : e.length > 0 ? e : L();
45
49
  }
46
- function V(t) {
50
+ function G(t) {
47
51
  const { currentNode: e, documentModifier: o } = t;
48
52
  if (!e || !("querySelector" in e))
49
53
  return;
50
54
  const n = e.querySelector(k);
51
55
  n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
52
56
  }
53
- function W(t) {
57
+ function Y(t) {
54
58
  const {
55
59
  currentNode: e,
56
60
  documentModifier: o,
@@ -60,21 +64,22 @@ function W(t) {
60
64
  } = t;
61
65
  if (!e || !("querySelector" in e))
62
66
  return;
63
- const r = i ?? g(e), u = E.getConfig(e);
64
- if (r === "list" || !u.mobileLayoutEnabled) {
65
- V({ currentNode: e, documentModifier: o });
67
+ const r = i ?? b(e), s = E.getConfig(e);
68
+ if (r === "list" || !s.mobileLayoutEnabled) {
69
+ G({ currentNode: e, documentModifier: o });
66
70
  return;
67
71
  }
68
- const s = e.querySelector(k);
69
- if (!s)
72
+ const u = e.querySelector(k);
73
+ if (!u)
70
74
  return;
71
- const l = C(), a = x(n, l.recommendationProducts), m = c ?? L(e), S = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${T(a, r, {
72
- productsPerRow: u.mobileCardsInRow,
73
- composition: m
75
+ const l = C(), d = U(n, l.recommendationProducts), a = c ?? x(e), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(d, r, {
76
+ productsPerRow: s.mobileCardsInRow,
77
+ composition: a,
78
+ filterList: l.filterList
74
79
  })}</table></td>`;
75
- o.modifyHtml(s).setInnerHtml(S), o.apply(new p("Updated mobile product rows"));
80
+ o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
76
81
  }
77
- function G(t) {
82
+ function K(t) {
78
83
  const {
79
84
  currentNode: e,
80
85
  documentModifier: o,
@@ -85,68 +90,69 @@ function G(t) {
85
90
  } = t;
86
91
  if (!e || !("querySelector" in e))
87
92
  return;
88
- const u = e.querySelector(q) ?? e.querySelector($);
89
- if (!u)
93
+ const s = e.querySelector(P) ?? e.querySelector(v);
94
+ if (!s)
90
95
  return;
91
- const s = C(), l = x(i, s.recommendationProducts), { cardsInRow: a } = s.recommendationConfigs, m = r ?? L(e), d = c ?? g(e), S = T(l, d, {
92
- productsPerRow: a,
93
- composition: m
96
+ const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ?? b(e), g = _(l, f, {
97
+ productsPerRow: d,
98
+ composition: a,
99
+ filterList: u.filterList
94
100
  });
95
- o.modifyHtml(u).setInnerHtml(S).apply(new p("Updated product")), W(t), n == null || n();
101
+ o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), Y(t), n == null || n();
96
102
  }
97
- function I(t, e, o, n) {
103
+ function T(t, e, o, n) {
98
104
  const c = `0 ${Math.floor(o / 2)}px`;
99
105
  let r = !1;
100
106
  return n === "grid" ? Array.from(
101
107
  t.querySelectorAll(".attribute-cell")
102
- ).forEach((s) => {
103
- e.modifyHtml(s).setStyle("padding", c), r = !0;
108
+ ).forEach((u) => {
109
+ e.modifyHtml(u).setStyle("padding", c), r = !0;
104
110
  }) : Array.from(
105
111
  t.querySelectorAll(".product-card-wrapper")
106
- ).forEach((s) => {
107
- const l = "parentNode" in s ? s.parentNode : null;
108
- l && v(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
112
+ ).forEach((u) => {
113
+ const l = "parentNode" in u ? u.parentNode : null;
114
+ l && F(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
109
115
  }), r;
110
116
  }
111
- function O(t, e, o) {
117
+ function I(t, e, o) {
112
118
  const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
113
119
  let c = !1;
114
120
  return i.forEach((r) => {
115
121
  e.modifyHtml(r).setStyle("height", n), c = !0;
116
122
  }), c;
117
123
  }
118
- function Y(t) {
124
+ function X(t) {
119
125
  const { currentNode: e, documentModifier: o } = t;
120
126
  if (!e)
121
127
  return;
122
- const n = E.getConfig(e), i = g(e);
128
+ const n = E.getConfig(e), i = b(e);
123
129
  let c = !1;
124
- const r = e.querySelector(q);
130
+ const r = e.querySelector(P);
125
131
  if (r) {
126
- c = I(
132
+ c = T(
127
133
  r,
128
134
  o,
129
135
  n.columnSpacing,
130
136
  i
131
137
  );
132
- const l = O(
138
+ const l = I(
133
139
  r,
134
140
  o,
135
141
  n.rowSpacing
136
142
  );
137
143
  c = c || l;
138
144
  }
139
- const u = e.querySelector(P);
140
- if (u) {
141
- const s = I(
142
- u,
145
+ const s = e.querySelector(q);
146
+ if (s) {
147
+ const u = T(
148
+ s,
143
149
  o,
144
150
  n.mobileColumnSpacing,
145
151
  i
146
152
  );
147
- c = c || s;
148
- const l = O(
149
- u,
153
+ c = c || u;
154
+ const l = I(
155
+ s,
150
156
  o,
151
157
  n.mobileRowSpacing
152
158
  );
@@ -154,9 +160,9 @@ function Y(t) {
154
160
  }
155
161
  c && o.apply(new p("Reapply spacing after regeneration"));
156
162
  }
157
- function re(t) {
163
+ function se(t) {
158
164
  const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
159
- e && G({
165
+ e && K({
160
166
  currentNode: e,
161
167
  documentModifier: o,
162
168
  products: i,
@@ -164,15 +170,15 @@ function re(t) {
164
170
  composition: r,
165
171
  afterRegenerate: () => {
166
172
  setTimeout(() => {
167
- Y({ currentNode: e, documentModifier: o });
173
+ X({ currentNode: e, documentModifier: o });
168
174
  }, 0), n == null || n();
169
175
  }
170
176
  });
171
177
  }
172
- function ie(t, e) {
173
- return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ..._(e - t.length)];
178
+ function ae(t, e) {
179
+ return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
174
180
  }
175
- function D() {
181
+ function H() {
176
182
  const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
177
183
  return {
178
184
  code: e.value,
@@ -184,39 +190,39 @@ function D() {
184
190
  };
185
191
  }
186
192
  function A(t, e = "price") {
187
- const o = D(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
188
- return B({
193
+ const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
194
+ return j({
189
195
  price: i,
190
196
  currency: o
191
197
  });
192
198
  }
193
- function F(t) {
199
+ function z(t) {
194
200
  var c, r;
195
- const e = D(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
201
+ const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
196
202
  return i > 0 ? `-${i}%` : "0%";
197
203
  }
198
- function H(t) {
204
+ function $(t) {
199
205
  const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
200
- let u = !1;
206
+ let s = !1;
201
207
  if (n && "querySelector" in n) {
202
- const s = n.querySelector("strong"), l = A(o, "price");
203
- b(e, s, l) && (u = !0);
208
+ const u = n.querySelector("strong") ?? n.querySelector("p"), l = A(o, "price");
209
+ S(e, u ?? null, l) && (s = !0);
204
210
  }
205
211
  if (i && "querySelector" in i) {
206
- const s = i.querySelector("strong"), l = A(o, "original_price");
207
- b(e, s, l) && (u = !0);
212
+ const u = i.querySelector("strong") ?? i.querySelector("p"), l = A(o, "original_price");
213
+ S(e, u ?? null, l) && (s = !0);
208
214
  }
209
215
  if (c && "querySelector" in c) {
210
- const s = c.querySelector(".omnibus-price-value"), l = A(o, "original_price");
211
- b(e, s, l) && (u = !0);
216
+ const u = c.querySelector(".omnibus-price-value") ?? null, l = A(o, "original_price");
217
+ S(e, u, l) && (s = !0);
212
218
  }
213
219
  if (r && "querySelector" in r) {
214
- const s = r.querySelector(".omnibus-discount-value"), l = F(o);
215
- b(e, s, l) && (u = !0);
220
+ const u = r.querySelector(".omnibus-discount-value") ?? null, l = z(o);
221
+ S(e, u, l) && (s = !0);
216
222
  }
217
- return u;
223
+ return s;
218
224
  }
219
- function K(t) {
225
+ function J(t) {
220
226
  const {
221
227
  documentModifier: e,
222
228
  product: o,
@@ -224,92 +230,135 @@ function K(t) {
224
230
  nameEl: i,
225
231
  priceEl: c,
226
232
  oldPriceEl: r,
227
- omnibusPriceEl: u,
228
- omnibusDiscountEl: s,
233
+ omnibusPriceEl: s,
234
+ omnibusDiscountEl: u,
229
235
  buttonEl: l
230
236
  } = t;
231
- let a = !1;
237
+ let d = !1;
232
238
  if (n && "querySelector" in n) {
233
- const m = n.querySelector("img");
234
- m && (e.modifyHtml(m).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), a = !0);
235
- const d = n.querySelector("a");
236
- d && (e.modifyHtml(d).setAttribute("href", o.url), a = !0);
239
+ const a = n.querySelector("img");
240
+ a && (e.modifyHtml(a).setAttribute("src", V(o.image_url)).setAttribute("alt", o.name), d = !0);
241
+ const f = n.querySelector("a");
242
+ f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
237
243
  }
238
244
  if (i && "querySelector" in i) {
239
- const m = i.querySelector("strong");
240
- b(e, m, o.name) && (a = !0);
245
+ const a = i.querySelector("strong") ?? i.querySelector("p");
246
+ S(e, a ?? null, o.name) && (d = !0);
241
247
  }
242
- if (H({
248
+ if ($({
243
249
  documentModifier: e,
244
250
  product: o,
245
251
  priceEl: c,
246
252
  oldPriceEl: r,
247
- omnibusPriceEl: u,
248
- omnibusDiscountEl: s
249
- }) && (a = !0), l && "querySelector" in l) {
250
- const m = l.querySelector("a.es-button") || l.querySelector("a");
251
- m && (e.modifyHtml(m).setAttribute("href", o.url), a = !0);
253
+ omnibusPriceEl: s,
254
+ omnibusDiscountEl: u
255
+ }) && (d = !0), l && "querySelector" in l) {
256
+ const a = l.querySelector("a.es-button") || l.querySelector("a");
257
+ a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
252
258
  }
253
- return a;
259
+ return d;
254
260
  }
255
- function U(t) {
256
- return "querySelector" in t ? t.querySelector(q) ?? t : t;
261
+ function B(t) {
262
+ return "querySelector" in t ? t.querySelector(P) ?? t : t;
263
+ }
264
+ const O = "product_attribute.";
265
+ function Q(t, e) {
266
+ var n;
267
+ let o;
268
+ if (t.startsWith(O)) {
269
+ const i = t.slice(O.length);
270
+ o = (n = e.product_attributes) == null ? void 0 : n[i];
271
+ } else
272
+ o = e[t];
273
+ return typeof o == "string" && o.length > 0 ? o : typeof o == "number" ? String(o) : null;
274
+ }
275
+ function Z(t, e, o) {
276
+ if (!("querySelectorAll" in t))
277
+ return !1;
278
+ const n = t.querySelectorAll(
279
+ `[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
280
+ );
281
+ if (n.length === 0)
282
+ return !1;
283
+ const i = /* @__PURE__ */ new Map();
284
+ n.forEach((r) => {
285
+ if (!("getAttribute" in r))
286
+ return;
287
+ const s = r.getAttribute(W);
288
+ if (!s)
289
+ return;
290
+ const u = i.get(s) ?? [];
291
+ u.push(r), i.set(s, u);
292
+ });
293
+ let c = !1;
294
+ return i.forEach((r, s) => {
295
+ const u = Math.min(r.length, o.length);
296
+ r.slice(0, u).forEach((l, d) => {
297
+ if (!("querySelector" in l))
298
+ return;
299
+ const a = Q(s, o[d]);
300
+ if (a === null)
301
+ return;
302
+ const f = l.querySelector("p") ?? null;
303
+ S(e, f, a) && (c = !0);
304
+ });
305
+ }), c;
257
306
  }
258
307
  function w(t, e, o) {
259
308
  if (!("querySelectorAll" in t))
260
309
  return !1;
261
310
  const n = t.querySelectorAll(
262
- `[esd-extension-block-id="${f.IMAGE}"]`
311
+ `[esd-extension-block-id="${m.IMAGE}"]`
263
312
  ), i = t.querySelectorAll(
264
- `[esd-extension-block-id="${f.NAME}"]`
313
+ `[esd-extension-block-id="${m.NAME}"]`
265
314
  ), c = t.querySelectorAll(
266
- `[esd-extension-block-id="${f.PRICE}"]`
315
+ `[esd-extension-block-id="${m.PRICE}"]`
267
316
  ), r = t.querySelectorAll(
268
- `[esd-extension-block-id="${f.OLD_PRICE}"]`
269
- ), u = t.querySelectorAll(
270
- `[esd-extension-block-id="${f.OMNIBUS_PRICE}"]`
317
+ `[esd-extension-block-id="${m.OLD_PRICE}"]`
271
318
  ), s = t.querySelectorAll(
272
- `[esd-extension-block-id="${f.OMNIBUS_DISCOUNT}"]`
319
+ `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
320
+ ), u = t.querySelectorAll(
321
+ `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
273
322
  ), l = t.querySelectorAll(
274
- `[esd-extension-block-id="${f.BUTTON}"]`
275
- ), a = Math.min(n.length, o.length);
276
- let m = !1;
277
- for (let d = 0; d < a; d++) {
278
- const S = K({
323
+ `[esd-extension-block-id="${m.BUTTON}"]`
324
+ ), d = Math.min(n.length, o.length);
325
+ let a = !1;
326
+ for (let f = 0; f < d; f++) {
327
+ const g = J({
279
328
  documentModifier: e,
280
- product: o[d],
281
- imageEl: n[d] ?? null,
282
- nameEl: i[d] ?? null,
283
- priceEl: c[d] ?? null,
284
- oldPriceEl: r[d] ?? null,
285
- omnibusPriceEl: u[d] ?? null,
286
- omnibusDiscountEl: s[d] ?? null,
287
- buttonEl: l[d] ?? null
329
+ product: o[f],
330
+ imageEl: n[f] ?? null,
331
+ nameEl: i[f] ?? null,
332
+ priceEl: c[f] ?? null,
333
+ oldPriceEl: r[f] ?? null,
334
+ omnibusPriceEl: s[f] ?? null,
335
+ omnibusDiscountEl: u[f] ?? null,
336
+ buttonEl: l[f] ?? null
288
337
  });
289
- m = m || S;
338
+ a = a || g;
290
339
  }
291
- return m;
340
+ return Z(t, e, o) && (a = !0), a;
292
341
  }
293
- function ce(t) {
342
+ function de(t) {
294
343
  const { currentNode: e, documentModifier: o, products: n } = t;
295
344
  if (!e || !("querySelectorAll" in e))
296
345
  return !1;
297
- const i = U(e);
346
+ const i = B(e);
298
347
  if (!("querySelectorAll" in i) || i.querySelectorAll(
299
- `[esd-extension-block-id="${f.IMAGE}"]`
348
+ `[esd-extension-block-id="${m.IMAGE}"]`
300
349
  ).length !== n.length)
301
350
  return !1;
302
351
  let r = w(i, o, n);
303
- const u = g(e), s = E.getConfig(e);
304
- if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
305
- const l = e.querySelector(P);
352
+ const s = b(e), u = E.getConfig(e);
353
+ if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
354
+ const l = e.querySelector(q);
306
355
  if (l) {
307
- const a = w(
356
+ const d = w(
308
357
  l,
309
358
  o,
310
359
  n
311
360
  );
312
- r = r || a;
361
+ r = r || d;
313
362
  }
314
363
  }
315
364
  return r && o.apply(new p("Updated product content in-place")), !0;
@@ -318,66 +367,66 @@ function N(t, e, o) {
318
367
  if (!("querySelectorAll" in t))
319
368
  return !1;
320
369
  const n = t.querySelectorAll(
321
- `[esd-extension-block-id="${f.PRICE}"]`
370
+ `[esd-extension-block-id="${m.PRICE}"]`
322
371
  ), i = t.querySelectorAll(
323
- `[esd-extension-block-id="${f.OLD_PRICE}"]`
372
+ `[esd-extension-block-id="${m.OLD_PRICE}"]`
324
373
  ), c = t.querySelectorAll(
325
- `[esd-extension-block-id="${f.OMNIBUS_PRICE}"]`
374
+ `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
326
375
  ), r = t.querySelectorAll(
327
- `[esd-extension-block-id="${f.OMNIBUS_DISCOUNT}"]`
328
- ), u = Math.min(n.length, o.length);
329
- let s = !1;
330
- for (let l = 0; l < u; l++)
331
- H({
376
+ `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
377
+ ), s = Math.min(n.length, o.length);
378
+ let u = !1;
379
+ for (let l = 0; l < s; l++)
380
+ $({
332
381
  documentModifier: e,
333
382
  product: o[l],
334
383
  priceEl: n[l] ?? null,
335
384
  oldPriceEl: i[l] ?? null,
336
385
  omnibusPriceEl: c[l] ?? null,
337
386
  omnibusDiscountEl: r[l] ?? null
338
- }) && (s = !0);
339
- return s;
387
+ }) && (u = !0);
388
+ return u;
340
389
  }
341
- function le(t) {
390
+ function fe(t) {
342
391
  const { currentNode: e, documentModifier: o } = t;
343
392
  if (!e || !("querySelectorAll" in e))
344
393
  return !1;
345
394
  const i = C().recommendationProducts;
346
395
  if (i.length === 0)
347
396
  return !1;
348
- const c = U(e);
397
+ const c = B(e);
349
398
  let r = N(c, o, i);
350
- const u = g(e), s = E.getConfig(e);
351
- if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
352
- const l = e.querySelector(P);
399
+ const s = b(e), u = E.getConfig(e);
400
+ if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
401
+ const l = e.querySelector(q);
353
402
  if (l) {
354
- const a = N(l, o, i);
355
- r = r || a;
403
+ const d = N(l, o, i);
404
+ r = r || d;
356
405
  }
357
406
  }
358
407
  return r && o.apply(new p("Updated price formatting in-place")), r;
359
408
  }
360
- function se(t) {
361
- const { currentNode: e, documentModifier: o, currency: n } = t, i = M(e);
409
+ function me(t) {
410
+ const { currentNode: e, documentModifier: o, currency: n } = t, i = h(e);
362
411
  if (!i)
363
412
  return;
364
- const c = n.alignment === "before" ? "0" : "1", r = (u, s) => {
365
- o.modifyHtml(i).setAttribute(u, s);
413
+ const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
414
+ o.modifyHtml(i).setAttribute(s, u);
366
415
  };
367
416
  r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
368
417
  }
369
418
  export {
370
- ie as adjustProductsToSize,
419
+ ae as adjustProductsToSize,
371
420
  A as formatProductPrice,
372
- M as getBlockElement,
373
- L as getCardComposition,
374
- g as getCurrentLayout,
375
- Y as reapplySpacing,
376
- W as regenerateMobileProductRows,
377
- G as regenerateProductRows,
378
- re as regenerateProductRowsWithStyles,
379
- se as setCurrencyAttributes,
380
- le as updatePricesInPlace,
381
- ce as updateProductContentInPlace,
382
- K as updateSingleProductContent
421
+ h as getBlockElement,
422
+ x as getCardComposition,
423
+ b as getCurrentLayout,
424
+ X as reapplySpacing,
425
+ Y as regenerateMobileProductRows,
426
+ K as regenerateProductRows,
427
+ se as regenerateProductRowsWithStyles,
428
+ me as setCurrencyAttributes,
429
+ fe as updatePricesInPlace,
430
+ de as updateProductContentInPlace,
431
+ J as updateSingleProductContent
383
432
  };