@useinsider/guido 3.2.1-beta.d58ee72 → 3.3.0-beta.1d2853a

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 (161) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +91 -87
  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/header/AiStatusPill.vue.js +18 -0
  8. package/dist/components/organisms/header/AiStatusPill.vue2.js +13 -0
  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/MiddleSlot.vue.js +7 -7
  12. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  13. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  14. package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
  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/composables/useAutoSave.js +71 -0
  24. package/dist/composables/useCortexBlueprintBridge.js +91 -0
  25. package/dist/composables/useEmailTemplateApplier.js +41 -0
  26. package/dist/composables/useFullStoryBridge.js +14 -0
  27. package/dist/composables/useGuidoStateBridge.js +48 -0
  28. package/dist/composables/useHtmlValidator.js +41 -36
  29. package/dist/composables/useRecommendation.js +46 -26
  30. package/dist/composables/useRibbonOffset.js +21 -0
  31. package/dist/composables/useSave.js +19 -16
  32. package/dist/composables/useStripo.js +40 -40
  33. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  34. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  35. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  36. package/dist/config/compiler/utils/recommendationCompilerUtils.js +107 -71
  37. package/dist/config/migrator/index.js +9 -9
  38. package/dist/config/migrator/radioButtonMigrator.js +64 -44
  39. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  40. package/dist/config/migrator/recommendation/extractors.js +27 -0
  41. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  42. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  43. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  44. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  45. package/dist/config/migrator/recommendationMigrator.js +74 -290
  46. package/dist/enums/extensions/recommendationBlock.js +97 -42
  47. package/dist/enums/onboarding.js +7 -2
  48. package/dist/enums/unsubscribe.js +39 -31
  49. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  50. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  51. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  52. package/dist/extensions/Blocks/Recommendation/block.js +60 -50
  53. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  54. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  55. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  56. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  57. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
  58. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  59. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  60. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  61. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  62. package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
  63. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  64. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +144 -91
  65. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
  66. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  67. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
  68. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
  69. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  70. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  71. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  72. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  73. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
  74. package/dist/guido.css +1 -1
  75. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
  76. package/dist/node_modules/valibot/dist/index.js +450 -235
  77. package/dist/package.json.js +1 -1
  78. package/dist/services/templateLibraryApi.js +5 -4
  79. package/dist/services/unsubscribeApi.js +6 -6
  80. package/dist/src/@types/config/defaults.d.ts +5 -1
  81. package/dist/src/@types/config/index.d.ts +3 -3
  82. package/dist/src/@types/config/schemas.d.ts +217 -0
  83. package/dist/src/@types/config/types.d.ts +9 -1
  84. package/dist/src/components/Guido.vue.d.ts +1 -1
  85. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  86. package/dist/src/components/organisms/header/AiStatusPill.vue.d.ts +2 -0
  87. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  88. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  89. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  90. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  91. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  92. package/dist/src/composables/useAutoSave.d.ts +3 -0
  93. package/dist/src/composables/useConfig.d.ts +58 -0
  94. package/dist/src/composables/useCortexBlueprintBridge.d.ts +28 -0
  95. package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
  96. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  97. package/dist/src/composables/useGuidoStateBridge.d.ts +22 -0
  98. package/dist/src/composables/useRecommendation.d.ts +10 -1
  99. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  100. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  101. package/dist/src/composables/useSave.d.ts +1 -1
  102. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  103. package/dist/src/config/migrator/index.d.ts +2 -1
  104. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  105. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  106. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  107. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  108. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  109. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  110. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  111. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  112. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  113. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  114. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  115. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  116. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  117. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  118. package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
  119. package/dist/src/enums/onboarding.d.ts +6 -0
  120. package/dist/src/enums/unsubscribe.d.ts +13 -3
  121. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  122. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  123. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  124. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  125. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  126. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  127. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  128. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
  129. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  130. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +41 -1
  131. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  132. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  133. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  134. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  135. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
  136. package/dist/src/library.d.ts +1 -1
  137. package/dist/src/stores/ai-status.d.ts +41 -0
  138. package/dist/src/stores/autosave.d.ts +12 -0
  139. package/dist/src/stores/config.d.ts +522 -0
  140. package/dist/src/stores/editor.d.ts +23 -0
  141. package/dist/src/stores/guido-email-editor.d.ts +41 -0
  142. package/dist/src/stores/onboarding.d.ts +4 -0
  143. package/dist/src/utils/htmlEscape.d.ts +5 -0
  144. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  145. package/dist/src/utils/timeUtil.d.ts +8 -0
  146. package/dist/static/styles/components/button.css.js +16 -9
  147. package/dist/static/styles/components/loader.css.js +4 -0
  148. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  149. package/dist/stores/ai-status.js +25 -0
  150. package/dist/stores/autosave.js +17 -0
  151. package/dist/stores/editor.js +3 -1
  152. package/dist/stores/guido-email-editor.js +20 -0
  153. package/dist/stores/onboarding.js +4 -0
  154. package/dist/utils/htmlEscape.js +13 -0
  155. package/dist/utils/pairProductVariables.js +89 -88
  156. package/dist/utils/templatePreparation.js +72 -32
  157. package/dist/utils/timeUtil.js +19 -0
  158. package/package.json +7 -3
  159. package/dist/enums/displayConditions.js +0 -80
  160. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  161. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,180 +1,184 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } 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";
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 L, 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 : 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 _(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
- (l) => "getType" in l && l.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) {
47
+ function U(t, e) {
44
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,
57
61
  products: n,
58
62
  layout: i,
59
- composition: l
63
+ composition: c
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 c = C(), a = x(n, c.recommendationProducts), f = 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: f,
74
- filterList: c.filterList
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
75
79
  })}</table></td>`;
76
- 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"));
77
81
  }
78
- function G(t) {
82
+ function K(t) {
79
83
  const {
80
84
  currentNode: e,
81
85
  documentModifier: o,
82
86
  afterRegenerate: n,
83
87
  products: i,
84
- layout: l,
88
+ layout: c,
85
89
  composition: r
86
90
  } = t;
87
91
  if (!e || !("querySelector" in e))
88
92
  return;
89
- const u = e.querySelector(q) ?? e.querySelector($);
90
- if (!u)
93
+ const s = e.querySelector(P) ?? e.querySelector(v);
94
+ if (!s)
91
95
  return;
92
- const s = C(), c = x(i, s.recommendationProducts), { cardsInRow: a } = s.recommendationConfigs, f = r ?? _(e), d = l ?? g(e), S = T(c, d, {
93
- productsPerRow: a,
94
- composition: f,
95
- filterList: s.filterList
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
96
100
  });
97
- 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();
98
102
  }
99
- function I(t, e, o, n) {
100
- const l = `0 ${Math.floor(o / 2)}px`;
103
+ function T(t, e, o, n) {
104
+ const c = `0 ${Math.floor(o / 2)}px`;
101
105
  let r = !1;
102
106
  return n === "grid" ? Array.from(
103
107
  t.querySelectorAll(".attribute-cell")
104
- ).forEach((s) => {
105
- e.modifyHtml(s).setStyle("padding", l), r = !0;
108
+ ).forEach((u) => {
109
+ e.modifyHtml(u).setStyle("padding", c), r = !0;
106
110
  }) : Array.from(
107
111
  t.querySelectorAll(".product-card-wrapper")
108
- ).forEach((s) => {
109
- const c = "parentNode" in s ? s.parentNode : null;
110
- c && v(c) && (e.modifyHtml(c).setStyle("padding", l), 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);
111
115
  }), r;
112
116
  }
113
- function O(t, e, o) {
117
+ function I(t, e, o) {
114
118
  const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
115
- let l = !1;
119
+ let c = !1;
116
120
  return i.forEach((r) => {
117
- e.modifyHtml(r).setStyle("height", n), l = !0;
118
- }), l;
121
+ e.modifyHtml(r).setStyle("height", n), c = !0;
122
+ }), c;
119
123
  }
120
- function Y(t) {
124
+ function X(t) {
121
125
  const { currentNode: e, documentModifier: o } = t;
122
126
  if (!e)
123
127
  return;
124
- const n = E.getConfig(e), i = g(e);
125
- let l = !1;
126
- const r = e.querySelector(q);
128
+ const n = E.getConfig(e), i = b(e);
129
+ let c = !1;
130
+ const r = e.querySelector(P);
127
131
  if (r) {
128
- l = I(
132
+ c = T(
129
133
  r,
130
134
  o,
131
135
  n.columnSpacing,
132
136
  i
133
137
  );
134
- const c = O(
138
+ const l = I(
135
139
  r,
136
140
  o,
137
141
  n.rowSpacing
138
142
  );
139
- l = l || c;
143
+ c = c || l;
140
144
  }
141
- const u = e.querySelector(P);
142
- if (u) {
143
- const s = I(
144
- u,
145
+ const s = e.querySelector(q);
146
+ if (s) {
147
+ const u = T(
148
+ s,
145
149
  o,
146
150
  n.mobileColumnSpacing,
147
151
  i
148
152
  );
149
- l = l || s;
150
- const c = O(
151
- u,
153
+ c = c || u;
154
+ const l = I(
155
+ s,
152
156
  o,
153
157
  n.mobileRowSpacing
154
158
  );
155
- l = l || c;
159
+ c = c || l;
156
160
  }
157
- l && o.apply(new p("Reapply spacing after regeneration"));
161
+ c && o.apply(new p("Reapply spacing after regeneration"));
158
162
  }
159
- function re(t) {
160
- const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: l, composition: r } = t;
161
- e && G({
163
+ function se(t) {
164
+ const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
165
+ e && K({
162
166
  currentNode: e,
163
167
  documentModifier: o,
164
168
  products: i,
165
- layout: l,
169
+ layout: c,
166
170
  composition: r,
167
171
  afterRegenerate: () => {
168
172
  setTimeout(() => {
169
- Y({ currentNode: e, documentModifier: o });
173
+ X({ currentNode: e, documentModifier: o });
170
174
  }, 0), n == null || n();
171
175
  }
172
176
  });
173
177
  }
174
- function ie(t, e) {
178
+ function ae(t, e) {
175
179
  return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
176
180
  }
177
- function D() {
181
+ function H() {
178
182
  const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
179
183
  return {
180
184
  code: e.value,
@@ -186,76 +190,119 @@ function D() {
186
190
  };
187
191
  }
188
192
  function A(t, e = "price") {
189
- const o = D(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
190
- 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({
191
195
  price: i,
192
196
  currency: o
193
197
  });
194
198
  }
195
- function F(t) {
196
- var l, r;
197
- const e = D(), o = ((l = t.original_price) == null ? void 0 : l[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;
199
+ function z(t) {
200
+ var c, r;
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;
198
202
  return i > 0 ? `-${i}%` : "0%";
199
203
  }
200
- function H(t) {
201
- const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: l, omnibusDiscountEl: r } = t;
202
- let u = !1;
204
+ function $(t) {
205
+ const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
206
+ let s = !1;
203
207
  if (n && "querySelector" in n) {
204
- const s = n.querySelector("strong") ?? null, c = A(o, "price");
205
- b(e, s, c) && (u = !0);
208
+ const u = n.querySelector("strong") ?? n.querySelector("p"), l = A(o, "price");
209
+ S(e, u ?? null, l) && (s = !0);
206
210
  }
207
211
  if (i && "querySelector" in i) {
208
- const s = i.querySelector("strong") ?? null, c = A(o, "original_price");
209
- b(e, s, c) && (u = !0);
212
+ const u = i.querySelector("strong") ?? i.querySelector("p"), l = A(o, "original_price");
213
+ S(e, u ?? null, l) && (s = !0);
210
214
  }
211
- if (l && "querySelector" in l) {
212
- const s = l.querySelector(".omnibus-price-value") ?? null, c = A(o, "original_price");
213
- b(e, s, c) && (u = !0);
215
+ if (c && "querySelector" in c) {
216
+ const u = c.querySelector(".omnibus-price-value") ?? null, l = A(o, "original_price");
217
+ S(e, u, l) && (s = !0);
214
218
  }
215
219
  if (r && "querySelector" in r) {
216
- const s = r.querySelector(".omnibus-discount-value") ?? null, c = F(o);
217
- b(e, s, c) && (u = !0);
220
+ const u = r.querySelector(".omnibus-discount-value") ?? null, l = z(o);
221
+ S(e, u, l) && (s = !0);
218
222
  }
219
- return u;
223
+ return s;
220
224
  }
221
- function K(t) {
225
+ function J(t) {
222
226
  const {
223
227
  documentModifier: e,
224
228
  product: o,
225
229
  imageEl: n,
226
230
  nameEl: i,
227
- priceEl: l,
231
+ priceEl: c,
228
232
  oldPriceEl: r,
229
- omnibusPriceEl: u,
230
- omnibusDiscountEl: s,
231
- buttonEl: c
233
+ omnibusPriceEl: s,
234
+ omnibusDiscountEl: u,
235
+ buttonEl: l
232
236
  } = t;
233
- let a = !1;
237
+ let d = !1;
234
238
  if (n && "querySelector" in n) {
235
- const f = n.querySelector("img");
236
- f && (e.modifyHtml(f).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), a = !0);
237
- const d = n.querySelector("a");
238
- 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);
239
243
  }
240
244
  if (i && "querySelector" in i) {
241
- const f = i.querySelector("strong") ?? null;
242
- b(e, f, o.name) && (a = !0);
245
+ const a = i.querySelector("strong") ?? i.querySelector("p");
246
+ S(e, a ?? null, o.name) && (d = !0);
243
247
  }
244
- if (H({
248
+ if ($({
245
249
  documentModifier: e,
246
250
  product: o,
247
- priceEl: l,
251
+ priceEl: c,
248
252
  oldPriceEl: r,
249
- omnibusPriceEl: u,
250
- omnibusDiscountEl: s
251
- }) && (a = !0), c && "querySelector" in c) {
252
- const f = c.querySelector("a.es-button") || c.querySelector("a");
253
- f && (e.modifyHtml(f).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);
254
258
  }
255
- return a;
259
+ return d;
260
+ }
261
+ function B(t) {
262
+ return "querySelector" in t ? t.querySelector(P) ?? t : t;
256
263
  }
257
- function U(t) {
258
- return "querySelector" in t ? t.querySelector(q) ?? t : t;
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;
259
306
  }
260
307
  function w(t, e, o) {
261
308
  if (!("querySelectorAll" in t))
@@ -264,54 +311,54 @@ function w(t, e, o) {
264
311
  `[esd-extension-block-id="${m.IMAGE}"]`
265
312
  ), i = t.querySelectorAll(
266
313
  `[esd-extension-block-id="${m.NAME}"]`
267
- ), l = t.querySelectorAll(
314
+ ), c = t.querySelectorAll(
268
315
  `[esd-extension-block-id="${m.PRICE}"]`
269
316
  ), r = t.querySelectorAll(
270
317
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
271
- ), u = t.querySelectorAll(
272
- `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
273
318
  ), s = t.querySelectorAll(
319
+ `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
320
+ ), u = t.querySelectorAll(
274
321
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
275
- ), c = t.querySelectorAll(
322
+ ), l = t.querySelectorAll(
276
323
  `[esd-extension-block-id="${m.BUTTON}"]`
277
- ), a = Math.min(n.length, o.length);
278
- let f = !1;
279
- for (let d = 0; d < a; d++) {
280
- const S = K({
324
+ ), d = Math.min(n.length, o.length);
325
+ let a = !1;
326
+ for (let f = 0; f < d; f++) {
327
+ const g = J({
281
328
  documentModifier: e,
282
- product: o[d],
283
- imageEl: n[d] ?? null,
284
- nameEl: i[d] ?? null,
285
- priceEl: l[d] ?? null,
286
- oldPriceEl: r[d] ?? null,
287
- omnibusPriceEl: u[d] ?? null,
288
- omnibusDiscountEl: s[d] ?? null,
289
- buttonEl: c[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
290
337
  });
291
- f = f || S;
338
+ a = a || g;
292
339
  }
293
- return f;
340
+ return Z(t, e, o) && (a = !0), a;
294
341
  }
295
- function le(t) {
342
+ function de(t) {
296
343
  const { currentNode: e, documentModifier: o, products: n } = t;
297
344
  if (!e || !("querySelectorAll" in e))
298
345
  return !1;
299
- const i = U(e);
346
+ const i = B(e);
300
347
  if (!("querySelectorAll" in i) || i.querySelectorAll(
301
348
  `[esd-extension-block-id="${m.IMAGE}"]`
302
349
  ).length !== n.length)
303
350
  return !1;
304
351
  let r = w(i, o, n);
305
- const u = g(e), s = E.getConfig(e);
306
- if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
307
- const c = e.querySelector(P);
308
- if (c) {
309
- const a = w(
310
- c,
352
+ const s = b(e), u = E.getConfig(e);
353
+ if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
354
+ const l = e.querySelector(q);
355
+ if (l) {
356
+ const d = w(
357
+ l,
311
358
  o,
312
359
  n
313
360
  );
314
- r = r || a;
361
+ r = r || d;
315
362
  }
316
363
  }
317
364
  return r && o.apply(new p("Updated product content in-place")), !0;
@@ -323,63 +370,63 @@ function N(t, e, o) {
323
370
  `[esd-extension-block-id="${m.PRICE}"]`
324
371
  ), i = t.querySelectorAll(
325
372
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
326
- ), l = t.querySelectorAll(
373
+ ), c = t.querySelectorAll(
327
374
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
328
375
  ), r = t.querySelectorAll(
329
376
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
330
- ), u = Math.min(n.length, o.length);
331
- let s = !1;
332
- for (let c = 0; c < u; c++)
333
- H({
377
+ ), s = Math.min(n.length, o.length);
378
+ let u = !1;
379
+ for (let l = 0; l < s; l++)
380
+ $({
334
381
  documentModifier: e,
335
- product: o[c],
336
- priceEl: n[c] ?? null,
337
- oldPriceEl: i[c] ?? null,
338
- omnibusPriceEl: l[c] ?? null,
339
- omnibusDiscountEl: r[c] ?? null
340
- }) && (s = !0);
341
- return s;
382
+ product: o[l],
383
+ priceEl: n[l] ?? null,
384
+ oldPriceEl: i[l] ?? null,
385
+ omnibusPriceEl: c[l] ?? null,
386
+ omnibusDiscountEl: r[l] ?? null
387
+ }) && (u = !0);
388
+ return u;
342
389
  }
343
- function ce(t) {
390
+ function fe(t) {
344
391
  const { currentNode: e, documentModifier: o } = t;
345
392
  if (!e || !("querySelectorAll" in e))
346
393
  return !1;
347
394
  const i = C().recommendationProducts;
348
395
  if (i.length === 0)
349
396
  return !1;
350
- const l = U(e);
351
- let r = N(l, o, i);
352
- const u = g(e), s = E.getConfig(e);
353
- if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
354
- const c = e.querySelector(P);
355
- if (c) {
356
- const a = N(c, o, i);
357
- r = r || a;
397
+ const c = B(e);
398
+ let r = N(c, o, i);
399
+ const s = b(e), u = E.getConfig(e);
400
+ if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
401
+ const l = e.querySelector(q);
402
+ if (l) {
403
+ const d = N(l, o, i);
404
+ r = r || d;
358
405
  }
359
406
  }
360
407
  return r && o.apply(new p("Updated price formatting in-place")), r;
361
408
  }
362
- function se(t) {
363
- 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);
364
411
  if (!i)
365
412
  return;
366
- const l = n.alignment === "before" ? "0" : "1", r = (u, s) => {
367
- o.modifyHtml(i).setAttribute(u, s);
413
+ const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
414
+ o.modifyHtml(i).setAttribute(s, u);
368
415
  };
369
- r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, l), 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"));
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"));
370
417
  }
371
418
  export {
372
- ie as adjustProductsToSize,
419
+ ae as adjustProductsToSize,
373
420
  A as formatProductPrice,
374
- M as getBlockElement,
375
- _ as getCardComposition,
376
- g as getCurrentLayout,
377
- Y as reapplySpacing,
378
- W as regenerateMobileProductRows,
379
- G as regenerateProductRows,
380
- re as regenerateProductRowsWithStyles,
381
- se as setCurrencyAttributes,
382
- ce as updatePricesInPlace,
383
- le as updateProductContentInPlace,
384
- 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
385
432
  };