@useinsider/guido 2.1.0-beta.1d0cd94 → 2.1.0-beta.3129837

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 (135) hide show
  1. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +15 -14
  2. package/dist/composables/useHtmlValidator.js +106 -84
  3. package/dist/composables/useRecommendation.js +54 -21
  4. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  5. package/dist/config/compiler/utils/recommendationCompilerUtils.js +147 -0
  6. package/dist/config/migrator/recommendationMigrator.js +2 -2
  7. package/dist/enums/recommendation.js +16 -15
  8. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +29 -29
  9. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +29 -29
  10. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +31 -29
  11. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +0 -1
  12. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +29 -27
  13. package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
  14. package/dist/extensions/Blocks/Recommendation/block.js +130 -9
  15. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  16. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  17. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +65 -0
  18. package/dist/extensions/Blocks/Recommendation/constants/layout.js +20 -0
  19. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +19 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  24. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +92 -0
  25. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +209 -0
  27. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
  28. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +217 -0
  29. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
  30. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +110 -0
  31. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
  32. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  34. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +108 -0
  35. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  36. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  37. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
  38. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
  39. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  41. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  42. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  43. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
  44. package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
  45. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
  46. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
  47. package/dist/extensions/Blocks/Recommendation/services/configService.js +240 -0
  48. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
  49. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +230 -193
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +233 -0
  51. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  52. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +69 -0
  53. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  54. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +174 -0
  55. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
  56. package/dist/extensions/Blocks/Recommendation/templates/utils.js +122 -0
  57. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  58. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  59. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +26 -15
  60. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  61. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  62. package/dist/extensions/Blocks/controlFactories.js +125 -93
  63. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +223 -169
  64. package/dist/services/recommendationApi.js +10 -9
  65. package/dist/services/templateLibraryApi.js +16 -13
  66. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  67. package/dist/src/composables/useRecommendation.d.ts +1 -0
  68. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  69. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +67 -0
  70. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  71. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
  72. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  73. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
  74. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +35 -0
  75. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +31 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
  78. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
  79. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  80. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
  81. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +52 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +68 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
  87. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +42 -0
  88. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
  89. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +214 -0
  90. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  91. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +34 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
  96. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  97. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
  98. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
  99. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  100. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
  101. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  102. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  103. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  104. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +131 -468
  105. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
  106. package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
  107. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
  108. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
  109. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
  110. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
  111. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
  112. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +57 -0
  113. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  114. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +160 -0
  115. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  116. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  117. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  118. package/dist/static/styles/customEditorStyle.css.js +25 -2
  119. package/dist/utils/pairProductVariables.js +57 -56
  120. package/dist/utils/templatePreparation.js +15 -14
  121. package/package.json +1 -1
  122. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
  123. package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
  124. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  125. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  126. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  127. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  128. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  129. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
  130. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  131. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  132. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  133. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  134. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  135. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
@@ -0,0 +1,147 @@
1
+ import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
2
+ function m(o, n, c, e) {
3
+ const s = `{{${o}_${n}_${c}}}`, t = `{{${o}_${n}_currency}}`;
4
+ return e === "before" ? `${t} ${s}` : `${s} ${t}`;
5
+ }
6
+ function b(o, n, c, e, s) {
7
+ switch (n) {
8
+ case "productImage": {
9
+ const t = o.querySelector("img");
10
+ t && t.setAttribute("src", `{{${c}_${e}_img}}`);
11
+ const r = o.querySelector("a");
12
+ r && r.setAttribute("href", `{{${c}_${e}_url}}`);
13
+ break;
14
+ }
15
+ case "productName": {
16
+ const t = o.querySelector("p");
17
+ if (t) {
18
+ const r = t.querySelector("strong") || t;
19
+ r.textContent = `{{${c}_${e}_name}}`;
20
+ }
21
+ break;
22
+ }
23
+ case "productPrice": {
24
+ const t = o.querySelector("p");
25
+ if (t) {
26
+ const r = t.querySelector("strong") || t;
27
+ r.textContent = m(c, e, "price", s);
28
+ }
29
+ break;
30
+ }
31
+ case "productOldPrice": {
32
+ const t = o.querySelector("p");
33
+ if (t) {
34
+ const r = t.querySelector("strong") || t;
35
+ r.textContent = m(
36
+ c,
37
+ e,
38
+ "original_price",
39
+ s
40
+ ), t.setAttribute("product-attr", "discount");
41
+ }
42
+ break;
43
+ }
44
+ case "productButton": {
45
+ const t = o.querySelector("a");
46
+ t && t.setAttribute("href", `{{${c}_${e}_url}}`);
47
+ break;
48
+ }
49
+ case "productOmnibusPrice": {
50
+ const t = o.querySelector(".omnibus-price-value");
51
+ if (t) {
52
+ t.textContent = `{{${c}_${e}_omnibus_price}}`;
53
+ const r = t.closest("p");
54
+ r && (r.setAttribute("product-attr", "omnibus_price"), r.setAttribute("composition", "true"));
55
+ }
56
+ break;
57
+ }
58
+ case "productOmnibusDiscount": {
59
+ const t = o.querySelector(".omnibus-discount-value");
60
+ if (t) {
61
+ t.textContent = `{{${c}_${e}_omnibus_discount}}`;
62
+ const r = t.closest("p");
63
+ r && (r.setAttribute("product-attr", "omnibus_discount"), r.setAttribute("composition", "true"));
64
+ }
65
+ break;
66
+ }
67
+ }
68
+ }
69
+ function $(o, n, c) {
70
+ o.querySelectorAll(".recommendation-product-row").forEach((s, t) => {
71
+ s.querySelectorAll("[data-attribute-type]").forEach((u) => {
72
+ const l = u.getAttribute("data-attribute-type") || "", a = u.querySelectorAll(".attribute-cell");
73
+ a.length > 0 ? a.forEach((i) => {
74
+ b(i, l, n, t, c);
75
+ }) : b(u, l, n, t, c);
76
+ });
77
+ });
78
+ }
79
+ function h(o, n, c) {
80
+ const e = o.querySelectorAll(".recommendation-product-row");
81
+ if (!e.length)
82
+ return;
83
+ const [s] = e, t = s.querySelector("[data-attribute-type]"), r = t ? t.querySelectorAll(".attribute-cell").length : 1;
84
+ e.forEach((u, l) => {
85
+ u.querySelectorAll("[data-attribute-type]").forEach((i) => {
86
+ const f = i.getAttribute("data-attribute-type") || "";
87
+ i.querySelectorAll(".attribute-cell").forEach((y, d) => {
88
+ const A = l * r + d;
89
+ b(y, f, n, A, c);
90
+ });
91
+ });
92
+ });
93
+ }
94
+ function S(o, n) {
95
+ const c = o.getAttribute("data-layout") || "grid", e = o.getAttribute("currency-alignment") || "after";
96
+ c === "list" ? $(o, n, e) : h(o, n, e);
97
+ }
98
+ function q(o, n, c) {
99
+ let e = o;
100
+ if ((n.getAttribute("data-layout") || "grid") === "list") {
101
+ const t = n.querySelectorAll(".recommendation-product-row");
102
+ Array.from(t).reverse().forEach((u, l) => {
103
+ const a = t.length - 1 - l, i = u.outerHTML, p = `${`{% if ins_reco_total_product_kind_${c} > ${a} %}`}${i}{% endif %}`;
104
+ e = e.replace(i, p);
105
+ });
106
+ } else {
107
+ const t = n.querySelectorAll(".recommendation-product-row");
108
+ if (!t.length)
109
+ return e;
110
+ const [r] = t, u = r.querySelector("[data-attribute-type]"), l = u ? u.querySelectorAll(".attribute-cell").length : 1, a = [];
111
+ t.forEach((i, f) => {
112
+ const p = i.querySelector(".product-card-wrapper") || i;
113
+ a.push({
114
+ element: p,
115
+ productThreshold: f * l
116
+ });
117
+ }), a.reverse().forEach(({ element: i, productThreshold: f }) => {
118
+ const p = i.outerHTML, d = `${`{% if ins_reco_total_product_kind_${c} > ${f} %}`}${p}{% endif %}`;
119
+ e = e.replace(p, d);
120
+ });
121
+ }
122
+ return e;
123
+ }
124
+ function g(o, n) {
125
+ const c = o.match(/<!DOCTYPE[^>]*>/i);
126
+ return (c ? `${c[0]}
127
+ ` : "") + n.documentElement.outerHTML;
128
+ }
129
+ function E(o) {
130
+ const n = o.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), c = new DOMParser().parseFromString(n, "text/html"), e = c.querySelectorAll(".ins-recommendation-v3-block-v2");
131
+ if (!e.length)
132
+ return o;
133
+ const { buildCampaignUrl: s } = _();
134
+ e.forEach((r) => {
135
+ const u = r.getAttribute("recommendation-id");
136
+ u && (s(u), S(r, u));
137
+ });
138
+ let t = g(n, c);
139
+ return e.forEach((r) => {
140
+ const u = r.getAttribute("recommendation-id");
141
+ u && (t = q(t, r, u));
142
+ }), t.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
143
+ }
144
+ export {
145
+ m as formatPriceVariable,
146
+ E as prepareRecommendationBlocks
147
+ };
@@ -1,8 +1,8 @@
1
1
  var h = Object.defineProperty;
2
2
  var T = (A, e, t) => e in A ? h(A, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : A[e] = t;
3
3
  var m = (A, e, t) => T(A, typeof e != "symbol" ? e + "" : e, t);
4
- import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/migrationTemplate.js";
5
- import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/templateUtils.js";
4
+ import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/grid/migration.js";
5
+ import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/utils.js";
6
6
  class w {
7
7
  constructor() {
8
8
  m(this, "parser");
@@ -1,4 +1,4 @@
1
- const s = 20, e = 320, t = {
1
+ const e = 20, s = 320, t = "vertical", m = {
2
2
  CART_ABANDONMENT: {
3
3
  ins_apr_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
4
4
  ins_apr_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
@@ -15,7 +15,7 @@ const s = 20, e = 320, t = {
15
15
  DISCOUNT: "discount",
16
16
  OMNIBUS_DISCOUNT: "omnibus_discount",
17
17
  OMNIBUS_PRICE: "omnibus_price"
18
- }, m = {
18
+ }, _ = {
19
19
  IF: {
20
20
  discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" %}`,
21
21
  omnibus_discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" and {${i.OMNIBUS_DISCOUNT}} != "0%" and {${i.OMNIBUS_DISCOUNT}} != "" %}`,
@@ -23,17 +23,17 @@ const s = 20, e = 320, t = {
23
23
  },
24
24
  ELSE: "{% else %}",
25
25
  END_IF: "{% endif %}"
26
- }, _ = {
27
- ID: /ins-recommendation-v3-campaign-id="(.*?)"/gi,
28
- ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">[\S\s]*?<\/p>/gm,
29
- ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">/gm,
26
+ }, a = {
27
+ ID: /recommendation-id="(.*?)"/gi,
28
+ ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
29
+ ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
30
30
  COMPOSITION: /composition="true"/gm,
31
31
  CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
32
  CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
33
33
  CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
34
- }, a = {
35
- PARAGRAPH_END_TAG: "</p>"
36
34
  }, n = {
35
+ PARAGRAPH_END_TAG: "</p>"
36
+ }, o = {
37
37
  REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
38
38
  TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
39
39
  ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
@@ -46,11 +46,12 @@ const s = 20, e = 320, t = {
46
46
  };
47
47
  export {
48
48
  i as ATTRIBUTES,
49
- m as CONDITIONS,
50
- n as CSS,
51
- t as DUMMY_IMAGE_MAPPINGS,
52
- s as DefaultPadding,
53
- a as HTML,
54
- e as MinDeviceViewport,
55
- _ as REGEX
49
+ _ as CONDITIONS,
50
+ o as CSS,
51
+ m as DUMMY_IMAGE_MAPPINGS,
52
+ e as DefaultPadding,
53
+ n as HTML,
54
+ s as MinDeviceViewport,
55
+ a as REGEX,
56
+ t as VerticalOrientation
56
57
  };
@@ -1,50 +1,50 @@
1
- import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
2
- import { UEAttr as y, ModificationDescription as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { CommonControl as L } from "../../../common-control.js";
4
- import { ItemsBlockControlId as u } from "../../enums/controlEnums.js";
5
- import { getItemsBlockConfig as l, setItemsBlockConfig as N, escapeReplacement as I } from "../../utils/nodeConfigUtils.js";
6
- const T = u.PRICE_CURRENCY_LOCATION, i = {
1
+ import { currencyLocationMaps as u } from "../../../../../enums/extensions/recommendationBlock.js";
2
+ import { UEAttr as R, ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { CommonControl as N } from "../../../common-control.js";
4
+ import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
5
+ import { getItemsBlockConfig as C, setItemsBlockConfig as I, escapeReplacement as T } from "../../utils/nodeConfigUtils.js";
6
+ const E = m.PRICE_CURRENCY_LOCATION, c = {
7
7
  CURRENCY_LOCATION: "currencyLocation"
8
8
  };
9
- class $ extends L {
9
+ class A extends N {
10
10
  getId() {
11
- return T;
11
+ return E;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${u.PRICE_CURRENCY_LOCATION}">
15
+ <div class="container ${m.PRICE_CURRENCY_LOCATION}">
16
16
  ${this._getCurrencyLocation()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = l(this.currentNode);
22
- this.api.setUIEAttribute(i.CURRENCY_LOCATION, y.SELECTPICKER.items, p), this.api.updateValues({ [i.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(i.CURRENCY_LOCATION, (t) => {
21
+ const e = C(this.currentNode);
22
+ this.api.setUIEAttribute(c.CURRENCY_LOCATION, R.SELECTPICKER.items, u), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
23
23
  this._onCurrencyLocationChange(t);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = l(this.currentNode);
29
- this.api.updateValues({ [i.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
28
+ const t = C(this.currentNode);
29
+ this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
30
30
  });
31
31
  }
32
32
  _onCurrencyLocationChange(e) {
33
- if (console.debug("Currency location changed to: ", e), N(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
33
+ if (console.debug("Currency location changed to: ", e), I(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
34
34
  return;
35
35
  const t = this._getPriceBlocks();
36
36
  if (!t || t.length === 0)
37
37
  return;
38
- const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "";
39
- t.forEach((s) => {
40
- const c = this._getParagraph(s);
41
- if (!c)
38
+ const r = C(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = this.api.getDocumentModifier();
39
+ t.forEach((a) => {
40
+ const s = this._getParagraph(a);
41
+ if (!s)
42
42
  return;
43
- const m = c.getInnerHTML().trim() || "", a = c.getInnerText().trim() || "", C = (o == null ? void 0 : o.trim()) || "", h = this._removeCurrencySymbol(a, C), d = this._detectSymbolInText(a) || C, g = this._buildPriceContent(h, d, n), _ = m.replace(a, I(g));
44
- this.api.getDocumentModifier().modifyHtml(c).setInnerHtml(_).apply(new R(
45
- `Updated currency location to ${n === "1" ? "after" : "before"}`
46
- ));
47
- });
43
+ const h = s.getInnerHTML().trim() || "", l = s.getInnerText().trim() || "", p = (o == null ? void 0 : o.trim()) || "", d = this._removeCurrencySymbol(l, p), g = this._detectSymbolInText(l) || p, _ = this._buildPriceContent(d, g, n), y = h.replace(l, T(_));
44
+ i.modifyHtml(s).setInnerHtml(y);
45
+ }), i.apply(new L(
46
+ `Updated currency location to ${n === "1" ? "after" : "before"}`
47
+ ));
48
48
  }
49
49
  _getPriceBlocks() {
50
50
  var e, t;
@@ -65,8 +65,8 @@ class $ extends L {
65
65
  } else {
66
66
  const o = r.match(/([^0-9.,\s]+)/);
67
67
  if (o && o[1]) {
68
- const s = o[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
69
- n = r.replace(c, "").trim();
68
+ const i = o[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
69
+ n = r.replace(a, "").trim();
70
70
  }
71
71
  }
72
72
  return n;
@@ -83,15 +83,15 @@ class $ extends L {
83
83
  ${this._GuTwoColumns([
84
84
  this._GuLabel({ text: "Currency Location" }),
85
85
  this._GuSelect({
86
- name: i.CURRENCY_LOCATION,
86
+ name: c.CURRENCY_LOCATION,
87
87
  placeholder: "",
88
- options: p
88
+ options: u
89
89
  })
90
90
  ])}
91
91
  `;
92
92
  }
93
93
  }
94
94
  export {
95
- T as CONTROL_BLOCK_ID,
96
- $ as PriceCurrencyLocationControl
95
+ E as CONTROL_BLOCK_ID,
96
+ A as PriceCurrencyLocationControl
97
97
  };
@@ -1,14 +1,14 @@
1
- var b = Object.defineProperty;
2
- var R = (s, c, e) => c in s ? b(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
- var h = (s, c, e) => R(s, typeof c != "symbol" ? c + "" : c, e);
4
- import { ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as B } from "../../../common-control.js";
1
+ var R = Object.defineProperty;
2
+ var N = (s, c, e) => c in s ? R(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
+ var h = (s, c, e) => N(s, typeof c != "symbol" ? c + "" : c, e);
4
+ import { ModificationDescription as B } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as E } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
7
- import { getItemsBlockConfig as m, setItemsBlockConfig as E, escapeReplacement as x } from "../../utils/nodeConfigUtils.js";
8
- const I = y.PRICE_CURRENCY_SYMBOL, p = {
7
+ import { getItemsBlockConfig as p, setItemsBlockConfig as x, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
8
+ const I = y.PRICE_CURRENCY_SYMBOL, u = {
9
9
  CURRENCY_SYMBOL: "currencySymbol"
10
10
  };
11
- class O extends B {
11
+ class P extends E {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  h(this, "originalPriceContents", /* @__PURE__ */ new Map());
@@ -24,8 +24,8 @@ class O extends B {
24
24
  `;
25
25
  }
26
26
  onRender() {
27
- const e = m(this.currentNode);
28
- this.api.updateValues({ [p.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(p.CURRENCY_SYMBOL, (t) => {
27
+ const e = p(this.currentNode);
28
+ this.api.updateValues({ [u.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (t) => {
29
29
  this._onCurrencySymbolChange(t);
30
30
  });
31
31
  }
@@ -34,42 +34,42 @@ class O extends B {
34
34
  }
35
35
  onTemplateNodeUpdated(e) {
36
36
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
37
- const t = m(this.currentNode);
38
- this.api.updateValues({ [p.CURRENCY_SYMBOL]: (t == null ? void 0 : t.priceCurrencySymbol) ?? "" }), this._storeOriginalContents();
37
+ const t = p(this.currentNode);
38
+ this.api.updateValues({ [u.CURRENCY_SYMBOL]: (t == null ? void 0 : t.priceCurrencySymbol) ?? "" }), this._storeOriginalContents();
39
39
  });
40
40
  }
41
41
  _onCurrencySymbolChange(e) {
42
- var i;
42
+ var a;
43
43
  console.debug("Currency symbol changed to: ", e);
44
- const t = m(this.currentNode), o = ((i = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : i.trim()) || "";
45
- if (E(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
44
+ const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
45
+ if (x(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
46
  return;
47
47
  const r = this._getPriceBlocks();
48
48
  if (!r || r.length === 0)
49
49
  return;
50
- const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0";
51
- r.forEach((u) => {
52
- const a = this._getParagraph(u);
53
- if (!a)
50
+ const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0", i = this.api.getDocumentModifier();
51
+ r.forEach((d) => {
52
+ const m = this._getParagraph(d);
53
+ if (!m)
54
54
  return;
55
- const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", g = this._removeCurrencySymbol(C, o), _ = this._buildPriceContent(g, n, l), S = d.replace(C, x(_));
56
- this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(S).apply(new N(
57
- `Updated currency symbol to ${n || "removed"}`
58
- ));
59
- });
55
+ const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
+ i.modifyHtml(m).setInnerHtml(b);
57
+ }), i.apply(new B(
58
+ `Updated currency symbol to ${n || "removed"}`
59
+ ));
60
60
  }
61
61
  _storeOriginalContents() {
62
62
  if (!this.currentNode)
63
63
  return;
64
- const e = m(this.currentNode);
64
+ const e = p(this.currentNode);
65
65
  this.currentNode.querySelectorAll(
66
66
  ".items-block-price"
67
67
  ).forEach((o) => {
68
68
  var n;
69
69
  const r = o.querySelector("p");
70
70
  if (r && !this.originalPriceContents.has(r)) {
71
- const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "", u = this._removeCurrencySymbol(l, i);
72
- this.originalPriceContents.set(r, u);
71
+ const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "", a = this._removeCurrencySymbol(l, i);
72
+ this.originalPriceContents.set(r, a);
73
73
  }
74
74
  });
75
75
  }
@@ -106,7 +106,7 @@ class O extends B {
106
106
  ${this._GuTwoColumns([
107
107
  this._GuLabel({ text: "Currency Symbol" }),
108
108
  this._GuTextInput({
109
- name: p.CURRENCY_SYMBOL,
109
+ name: u.CURRENCY_SYMBOL,
110
110
  placeholder: "Enter Currency Symbol",
111
111
  className: "es-180w"
112
112
  })
@@ -116,5 +116,5 @@ class O extends B {
116
116
  }
117
117
  export {
118
118
  I as CONTROL_BLOCK_ID,
119
- O as PriceCurrencySymbolControl
119
+ P as PriceCurrencySymbolControl
120
120
  };
@@ -1,63 +1,65 @@
1
- import { ModificationDescription as A, UIElementType as P, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as L } from "../../../common-control.js";
3
- import { ItemsBlockControlId as p, ItemsBlockId as _ } from "../../enums/controlEnums.js";
1
+ import { ModificationDescription as L, UIElementType as P, UEAttr as D } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as h } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as R, ItemsBlockId as _ } from "../../enums/controlEnums.js";
4
4
  import { productPairs as I } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as d, setItemsBlockConfig as D, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
- const g = p.PRICE_FORMATTED_PRICE, s = {
5
+ import { getItemsBlockConfig as d, setItemsBlockConfig as u, escapeReplacement as O } from "../../utils/nodeConfigUtils.js";
6
+ const g = R.PRICE_FORMATTED_PRICE, s = {
7
7
  FORMATTED_PRICE: "formattedPrice"
8
8
  };
9
- class $ extends L {
9
+ class k extends h {
10
10
  getId() {
11
11
  return g;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${p.PRICE_FORMATTED_PRICE}">
15
+ <div class="container ${R.PRICE_FORMATTED_PRICE}">
16
16
  ${this._getFormattedPrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = d(this.currentNode);
22
- this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
23
- this._onFormattedPriceChange(t);
21
+ const t = d(this.currentNode);
22
+ this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (e) => {
23
+ this._onFormattedPriceChange(e);
24
24
  });
25
25
  }
26
- onTemplateNodeUpdated(e) {
27
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = d(this.currentNode);
29
- this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
26
+ onTemplateNodeUpdated(t) {
27
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
28
+ const e = d(this.currentNode);
29
+ this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 });
30
30
  });
31
31
  }
32
- _onFormattedPriceChange(e) {
33
- if (console.debug("Formatted price changed to: ", e), D(this.currentNode, this.api, { priceFormatted: e }), !this.currentNode)
32
+ _onFormattedPriceChange(t) {
33
+ if (console.debug("Formatted price changed to: ", t), u(this.currentNode, this.api, { priceFormatted: t }), !this.currentNode)
34
34
  return;
35
- const t = d(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", i = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], o = I.PAIRS_FOR_EXTENSION.originalPrice[n], [E, R] = e ? [
35
+ const e = d(this.currentNode), n = (e == null ? void 0 : e.type) ?? "CART_ITEMS", i = (e == null ? void 0 : e.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], c = I.PAIRS_FOR_EXTENSION.originalPrice[n], [p, m] = t ? [
36
36
  i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
37
  i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
38
38
  ] : [
39
39
  i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
40
  i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
- ], l = i ? o.DEFAULT_SINGLE_PRICE : o.DEFAULT_PRICE, T = i ? o.DEFAULT_SINGLE_PRICE_FORMATTED : o.DEFAULT_PRICE_FORMATTED, [m, F] = e ? [l, T] : [T, l], c = this.currentNode.closest(".items-block");
42
- ((c == null ? void 0 : c.querySelectorAll(
41
+ ], l = i ? c.DEFAULT_SINGLE_PRICE : c.DEFAULT_PRICE, T = i ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_PRICE_FORMATTED, [F, A] = t ? [l, T] : [T, l], o = this.currentNode.closest(".items-block"), C = (o == null ? void 0 : o.querySelectorAll(
43
42
  `[esd-extension-block-id="${_.PRICE}"]`
44
- )) || []).forEach((a) => {
45
- this._updatePriceBlock(a, E, R, e, "price");
46
- }), ((c == null ? void 0 : c.querySelectorAll(
43
+ )) || [], E = this.api.getDocumentModifier();
44
+ C.forEach((a) => {
45
+ this._updatePriceBlock(E, a, p, m);
46
+ }), ((o == null ? void 0 : o.querySelectorAll(
47
47
  `[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
48
48
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(a, m, F, e, "original price");
50
- });
49
+ this._updatePriceBlock(E, a, F, A);
50
+ }), E.apply(new L(
51
+ `Updated price to ${t ? "formatted" : "unformatted"}`
52
+ ));
51
53
  }
52
- _updatePriceBlock(e, t, n, i, r) {
53
- const o = e.getInnerHTML().trim().replace(t, h(n)), E = `Updated ${r} to ${i ? "formatted" : "unformatted"}`;
54
- this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(o).apply(new A(E));
54
+ _updatePriceBlock(t, e, n, i) {
55
+ const r = e.getInnerHTML().trim().replace(n, O(i));
56
+ t.modifyHtml(e).setInnerHtml(r);
55
57
  }
56
58
  _getFormattedPrice() {
57
59
  return `
58
60
  <div class="display-flex align-items-center justify-content-between">
59
61
  <${P.LABEL}
60
- ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
62
+ ${D.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
61
63
  >
62
64
  </${P.LABEL}>
63
65
  ${this._GuToggle(s.FORMATTED_PRICE)}
@@ -67,5 +69,5 @@ class $ extends L {
67
69
  }
68
70
  export {
69
71
  g as CONTROL_BLOCK_ID,
70
- $ as PriceFormattedPriceControl
72
+ k as PriceFormattedPriceControl
71
73
  };
@@ -33,7 +33,6 @@ class C extends r {
33
33
  }
34
34
  _getHideDiscount() {
35
35
  return `
36
-
37
36
  <div class="display-flex align-items-center justify-content-between">
38
37
  <${o.LABEL}
39
38
  ${d.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
@@ -1,18 +1,18 @@
1
- import { ModificationDescription as P, UIElementType as _, UEAttr as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as m } from "../../../common-control.js";
3
- import { ItemsBlockControlId as T, ItemsBlockId as g } from "../../enums/controlEnums.js";
4
- import { productPairs as R } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as A } from "../../utils/nodeConfigUtils.js";
6
- const h = T.PRICE_SINGLE_PRICE, l = {
1
+ import { ModificationDescription as m, UIElementType as _, UEAttr as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as h } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as L, ItemsBlockId as R } from "../../enums/controlEnums.js";
4
+ import { productPairs as T } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as N } from "../../utils/nodeConfigUtils.js";
6
+ const D = L.PRICE_SINGLE_PRICE, l = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class M extends m {
9
+ class y extends h {
10
10
  getId() {
11
- return h;
11
+ return D;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${T.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${L.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
@@ -32,34 +32,36 @@ class M extends m {
32
32
  _onSinglePriceChange(e) {
33
33
  if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = R.PAIRS_FOR_EXTENSION.price[n], c = R.PAIRS_FOR_EXTENSION.originalPrice[n], [E, d] = e ? [
35
+ const t = I(this.currentNode), o = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = T.PAIRS_FOR_EXTENSION.price[o], c = T.PAIRS_FOR_EXTENSION.originalPrice[o], [P, p] = e ? [
36
36
  r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
37
  r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
39
  r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
40
  r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], a = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, s = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [L, C] = e ? [a, s] : [s, a], o = this.currentNode.closest(".items-block");
42
- ((o == null ? void 0 : o.querySelectorAll(
43
- `[esd-extension-block-id="${g.PRICE}"]`
44
- )) || []).forEach((p) => {
45
- this._updatePriceBlock(p, E, d, e, "price");
46
- }), ((o == null ? void 0 : o.querySelectorAll(
47
- `[esd-extension-block-id="${g.ORIGINAL_PRICE}"]`
48
- )) || []).forEach((p) => {
49
- this._updatePriceBlock(p, L, C, e, "original price");
50
- });
41
+ ], s = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, d = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [g, C] = e ? [s, d] : [d, s], n = this.currentNode.closest(".items-block"), S = (n == null ? void 0 : n.querySelectorAll(
42
+ `[esd-extension-block-id="${R.PRICE}"]`
43
+ )) || [], E = this.api.getDocumentModifier();
44
+ S.forEach((a) => {
45
+ this._updatePriceBlock(E, a, P, p, e);
46
+ }), ((n == null ? void 0 : n.querySelectorAll(
47
+ `[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
48
+ )) || []).forEach((a) => {
49
+ this._updatePriceBlock(E, a, g, C, e);
50
+ }), E.apply(new m(
51
+ `Updated price to ${e ? "single" : "total"} price`
52
+ ));
51
53
  }
52
- _updatePriceBlock(e, t, n, r, i) {
53
- const c = e.getInnerHTML().trim().replace(t, A(n)), E = `Updated ${i} to ${r ? "single" : "total"} price`;
54
- this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(c).apply(new P(E)), e.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
55
- this.api.getDocumentModifier().modifyHtml(s).setAttribute("data-single_price", r ? "true" : "false").apply(new P("Update single price attribute"));
54
+ _updatePriceBlock(e, t, o, r, i) {
55
+ const c = t.getInnerHTML().trim().replace(o, N(r));
56
+ e.modifyHtml(t).setInnerHtml(c), t.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
57
+ e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
56
58
  });
57
59
  }
58
60
  _getSinglePrice() {
59
61
  return `
60
62
  <div class="display-flex align-items-center justify-content-between">
61
63
  <${_.LABEL}
62
- ${S.LABEL.text}="${this.api.translate("Show Single Product Price")}"
64
+ ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
65
  >
64
66
  </${_.LABEL}>
65
67
  ${this._GuToggle(l.SINGLE_PRICE)}
@@ -68,6 +70,6 @@ class M extends m {
68
70
  }
69
71
  }
70
72
  export {
71
- h as CONTROL_BLOCK_ID,
72
- M as PriceSinglePriceControl
73
+ D as CONTROL_BLOCK_ID,
74
+ y as PriceSinglePriceControl
73
75
  };