@useinsider/guido 3.19.0-beta.c8d2be8 → 3.19.0-beta.cd25cc8

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 (82) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +6 -6
  3. package/dist/components/Guido.vue2.js +96 -85
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  6. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  7. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  8. package/dist/components/wrappers/WpModal.vue.js +1 -1
  9. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  10. package/dist/composables/useActionsApi.js +52 -47
  11. package/dist/composables/useAuthError.js +52 -0
  12. package/dist/composables/useAutoSave.js +11 -11
  13. package/dist/composables/useCodeEditorApi.js +23 -9
  14. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  15. package/dist/composables/useEmailTemplateApplier.js +111 -50
  16. package/dist/composables/useHttp.js +48 -49
  17. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  18. package/dist/composables/useStripo.js +24 -20
  19. package/dist/composables/useToaster.js +17 -15
  20. package/dist/composables/useTranslations.js +3 -2
  21. package/dist/composables/useVersionHistoryApi.js +33 -24
  22. package/dist/composables/validators/useLiquidValidator.js +15 -15
  23. package/dist/config/migrator/index.js +14 -13
  24. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  25. package/dist/config/migrator/recommendationMigrator.js +28 -21
  26. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  27. package/dist/enums/extensions/recommendationBlock.js +30 -29
  28. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  29. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  31. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  32. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  33. package/dist/extensions/Blocks/Items/template.js +219 -204
  34. package/dist/extensions/Blocks/Recommendation/block.js +21 -18
  35. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +117 -93
  36. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  38. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -96
  39. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  40. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -21
  41. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  42. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +40 -17
  43. package/dist/guido.css +1 -1
  44. package/dist/src/@types/config/schemas.d.ts +16 -0
  45. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  46. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  47. package/dist/src/composables/useAuthError.d.ts +12 -0
  48. package/dist/src/composables/useConfig.d.ts +2 -0
  49. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  50. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  51. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  52. package/dist/src/composables/useHttp.d.ts +2 -0
  53. package/dist/src/config/migrator/index.d.ts +2 -1
  54. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  55. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  57. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  58. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  60. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -2
  61. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  62. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  63. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
  64. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  65. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  66. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  67. package/dist/src/stores/config.d.ts +20 -0
  68. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  69. package/dist/src/stores/onboarding.d.ts +4 -0
  70. package/dist/src/stores/recommendation.d.ts +5 -0
  71. package/dist/src/utils/dateUtil.d.ts +10 -0
  72. package/dist/src/utils/genericUtil.d.ts +3 -0
  73. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  74. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  75. package/dist/static/styles/components/version-history.css.js +2 -6
  76. package/dist/stores/guido-email-editor.js +3 -1
  77. package/dist/stores/onboarding.js +4 -0
  78. package/dist/stores/unsubscribe.js +3 -3
  79. package/dist/utils/pairProductVariables.js +71 -71
  80. package/dist/utils/stripoEditorApi.js +11 -0
  81. package/dist/utils/templatePreparation.js +61 -85
  82. package/package.json +2 -1
@@ -1,83 +1,91 @@
1
- import { escapeHtml as m } from "../../../utils/htmlEscape.js";
2
- import { BlockType as R, BlockAttr as w } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { ITEMS_CURRENCY_ATTR as U, currencyPositionFromLocation as z } from "./constants/currency.js";
4
- import { ItemsBlockId as _ } from "./enums/controlEnums.js";
5
- import { productPairs as h, templateFirstLine as j } from "./enums/productEnums.js";
6
- import { ItemInCartOptions as J, SETTINGS_ENUMS as y, DefaultConfigValues as k } from "./enums/settingsEnums.js";
7
- import Z from "./layouts/horizontal.html.js";
8
- import f from "./layouts/vertical.html.js";
9
- import { deriveItemNumber as tt, escapeReplacement as g } from "./utils/nodeConfigUtils.js";
10
- let [G] = h.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [F] = h.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [L] = h.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [x] = h.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [v] = h.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
11
- const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), V = (a) => M(a, "text-align"), S = (a, e) => {
12
- const r = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), s = a.match(r);
1
+ import { escapeHtml as b } from "../../../utils/htmlEscape.js";
2
+ import { BlockType as R, BlockAttr as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { blockCellPadMarker as U, NAME_VERTICAL_MAX_WIDTH as Z, nameMaxWidthFor as tt, blockCellPaddingFor as Q } from "./constants/cardLayout.js";
4
+ import { ITEMS_CURRENCY_ATTR as k, currencyPositionFromLocation as Y } from "./constants/currency.js";
5
+ import { ItemsBlockId as m } from "./enums/controlEnums.js";
6
+ import { productPairs as P, templateFirstLine as et } from "./enums/productEnums.js";
7
+ import { ItemInCartOptions as at, SETTINGS_ENUMS as S, DefaultConfigValues as g } from "./enums/settingsEnums.js";
8
+ import st from "./layouts/horizontal.html.js";
9
+ import lt from "./layouts/vertical.html.js";
10
+ import { deriveItemNumber as rt, escapeReplacement as z } from "./utils/nodeConfigUtils.js";
11
+ let [B] = P.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [M] = P.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [F] = P.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [x] = P.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [G] = P.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
12
+ const L = (a, t) => a.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCase().startsWith(t.toLowerCase())).join("; ").replace(/;\s*$/, ""), v = (a) => L(a, "text-align"), D = (a, t) => {
13
+ const l = new RegExp(`${t}\\s*:\\s*([^;]+)`, "i"), s = a.match(l);
13
14
  return s ? s[1].trim() : null;
14
- }, N = (a) => `<tr>${a}</tr>`, et = (a, e, r, s) => {
15
- const i = r || k.productImageHeight, d = (s == null ? void 0 : s.imageVisible) === !1 ? "display: none; " : "";
16
- return N(`
15
+ }, V = (a) => {
16
+ var l;
17
+ const t = (l = D(a || "", "text-align")) == null ? void 0 : l.toLowerCase();
18
+ return t && ["left", "center", "right", "justify"].includes(t) ? t : "center";
19
+ }, ct = (a, t, l = Z) => {
20
+ const s = ["white-space", "overflow", "text-overflow", "max-width"].reduce((c, i) => L(c, i), a), o = t ? `white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${l}` : `max-width: ${l}`;
21
+ return [s, o].map((c) => c.trim().replace(/;\s*$/, "")).filter(Boolean).join("; ");
22
+ }, w = (a) => `<tr>${a}</tr>`, it = (a, t, l, s) => {
23
+ const o = l || g.productImageHeight, c = (s == null ? void 0 : s.imageVisible) === !1 ? "display: none; " : "";
24
+ return w(`
17
25
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
18
26
  align="center"
19
- esd-extension-block-id="${_.IMAGE}"
27
+ esd-extension-block-id="${m.IMAGE}"
20
28
  data-slot-1=""
21
29
  product-attr="imageSrc"
22
30
  data-type="${a}"
23
- data-number="${e}"
24
- style="${d}font-size: 0px;">
31
+ data-number="${t}"
32
+ style="${c}font-size: 0px;">
25
33
  <a class="document-node-component ng-star-inserted"
26
34
  target="_blank"
27
35
  href="#!">
28
36
  <img class="adapt-img document-node-component ng-star-inserted"
29
37
  style="object-fit: contain;"
30
- src="${G}"
31
- alt="${F}"
32
- width="${i}"
33
- height="${i}">
38
+ src="${B}"
39
+ alt="${M}"
40
+ width="${o}"
41
+ height="${o}">
34
42
  </a>
35
43
  </td>
36
44
  `);
37
- }, at = (a, e) => `
45
+ }, nt = (a, t) => `
38
46
  <${R.BLOCK_IMAGE}
39
- ${w.BLOCK_IMAGE.src}="${G}"
40
- ${w.BLOCK_IMAGE.alt}="${F}"
41
- ${w.BLOCK_IMAGE.href}="#!"
42
- ${w.BLOCK_IMAGE.width}="${k.productImageWidth}"
43
- ${w.BLOCK_IMAGE.height}="${k.productImageWidth}"
44
- esd-extension-block-id="${_.IMAGE}"
47
+ ${N.BLOCK_IMAGE.src}="${B}"
48
+ ${N.BLOCK_IMAGE.alt}="${M}"
49
+ ${N.BLOCK_IMAGE.href}="#!"
50
+ ${N.BLOCK_IMAGE.width}="${g.productImageWidth}"
51
+ ${N.BLOCK_IMAGE.height}="${g.productImageWidth}"
52
+ esd-extension-block-id="${m.IMAGE}"
45
53
  data-slot-1
46
54
  product-attr="imageSrc"
47
55
  data-type="${a}"
48
- data-number="${e}"
56
+ data-number="${t}"
49
57
  />
50
- `, st = (a, e, r, s) => {
51
- const i = `
58
+ `, ot = (a, t, l, s, o) => {
59
+ const c = tt(o), i = `
52
60
  word-wrap: break-word;
53
61
  white-space: nowrap;
54
62
  overflow: hidden;
55
63
  text-overflow: ellipsis;
56
64
  width: 100%;
57
- max-width: 100%;
65
+ max-width: ${c};
58
66
  `;
59
- if (e) {
60
- const d = S(r || "", "text-align") || "center", n = V(r || i), c = S(n, "font-weight"), l = S(n, "font-style"), o = c === "bold" || c === "700", t = l === "italic", p = M(
61
- M(
62
- M(n, "font-weight"),
67
+ if (t) {
68
+ const n = V(l), r = v(l || i), p = D(r, "font-weight"), e = D(r, "font-style"), E = p === "bold" || p === "700", u = e === "italic", _ = L(
69
+ L(
70
+ L(r, "font-weight"),
63
71
  "font-style"
64
72
  ),
65
73
  "text-decoration"
66
- ), T = (s == null ? void 0 : s.nameVisible) === !1 ? "display: none;" : "display: table-cell;", u = p ? ` style="${m(p)}"` : "";
67
- let $ = F;
68
- return o && ($ = `<strong>${$}</strong>`), t && ($ = `<em>${$}</em>`), N(`
69
- <td class="esd-block-text es-p10"
70
- align="${d}"
74
+ ), I = (s == null ? void 0 : s.nameVisible) === !1 ? "display: none;" : "display: table-cell;", $ = ct(_, (s == null ? void 0 : s.nameTrimming) ?? !0, c), T = ` style="${b($)}"`;
75
+ let d = M;
76
+ return E && (d = `<strong>${d}</strong>`), u && (d = `<em>${d}</em>`), w(`
77
+ <td class="esd-block-text es-p5"
78
+ align="${n}"
71
79
  width="100%"
72
80
  colspan="2"
73
81
  data-type="${a}"
74
- esd-extension-block-id="${_.NAME}"
75
- style="${T}">
82
+ esd-extension-block-id="${m.NAME}"
83
+ style="${I}">
76
84
  <p contenteditable="false"
77
85
  path="1"
78
86
  product-attr="name"
79
- data-slot-2${u}>
80
- ${$}
87
+ data-slot-2${T}>
88
+ ${d}
81
89
  </p>
82
90
  </td>
83
91
  `);
@@ -86,52 +94,54 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
86
94
  width="100%"
87
95
  align="center"
88
96
  colspan="2"
89
- class="es-p10"
97
+ class="es-p5"
90
98
  data-type="${a}"
91
- esd-extension-block-id="${_.NAME}"
99
+ esd-extension-block-id="${m.NAME}"
92
100
  >
93
101
  <p contenteditable="false"
94
102
  product-attr="name"
95
103
  data-slot-2
96
104
  style="${i}">
97
- ${F}
105
+ ${M}
98
106
  </p>
99
107
  </${R.BLOCK_TEXT}>
100
108
  `;
101
- }, lt = (a, e, r, s, i, d, n, c, l, o) => {
102
- let t = L;
109
+ }, dt = (a, t, l, s, o, c, i, n, r, p) => {
110
+ let e = F;
103
111
  if (s && s.trim()) {
104
- const E = `${s.trim()}`;
105
- t = (i || "0") === "1" ? `${L}&nbsp;${E}` : `${E}&nbsp;${L}`;
112
+ const O = `${s.trim()}`;
113
+ e = (o || "0") === "1" ? `${F}&nbsp;${O}` : `${O}&nbsp;${F}`;
106
114
  }
107
- const p = z(i), T = `data-formated="${r ? "true" : "false"}"`, u = `${U.POSITION}="${p}"`, $ = s ? `${U.SYMBOL}="${s}"` : "", O = `data-single_price="${c ? "true" : "false"}"`, b = l === y.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
108
- if (d) {
109
- const I = V(n || "color: #060606; white-space: nowrap; font-size: 20px;"), P = o ? "" : ' style="display: none;"';
110
- return N(`
111
- <td class="esd-block-text items-block-price${b}"
112
- align="center"
113
- esd-extension-block-id="${_.PRICE}"
115
+ const E = Y(o), u = `data-formated="${l ? "true" : "false"}"`, _ = `${k.POSITION}="${E}"`, I = s ? `${k.SYMBOL}="${s}"` : "", $ = `data-single_price="${n ? "true" : "false"}"`, T = r === S.ORIENTATION.VERTICAL, d = Q(T);
116
+ if (c) {
117
+ const h = v(i || "color: #060606; white-space: nowrap; font-size: 20px;"), A = V(i), y = p ? "" : ' style="display: none;"';
118
+ return w(`
119
+ <td class="esd-block-text items-block-price${d}"
120
+ align="${A}"
121
+ esd-extension-block-id="${m.PRICE}"
122
+ ${U(T)}
114
123
  width="100%"
115
- ${P}>
124
+ ${y}>
116
125
  <p product-attr="price"
117
126
  contenteditable="false"
118
127
  data-slot-4
119
128
  data-type="${a}"
120
- data-number="${e}"
121
- ${T}
129
+ data-number="${t}"
122
130
  ${u}
131
+ ${_}
132
+ ${I}
123
133
  ${$}
124
- ${O}
125
- style="${m(I)}">
126
- ${t}
134
+ style="${b(h)}">
135
+ ${e}
127
136
  </p>
128
137
  </td>
129
138
  `);
130
139
  }
131
140
  return `
132
141
  <${R.BLOCK_TEXT}
133
- esd-extension-block-id="${_.PRICE}"
134
- class="items-block-price ${b}"
142
+ esd-extension-block-id="${m.PRICE}"
143
+ class="items-block-price ${d}"
144
+ ${U(T)}
135
145
  width="100%"
136
146
  align="center"
137
147
  >
@@ -140,53 +150,55 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
140
150
  contenteditable="false"
141
151
  data-slot-4
142
152
  data-type="${a}"
143
- data-number="${e}"
144
- ${T}
153
+ data-number="${t}"
145
154
  ${u}
155
+ ${_}
156
+ ${I}
146
157
  ${$}
147
- ${O}
148
158
  >
149
- ${t}
159
+ ${e}
150
160
  </p>
151
161
  </${R.BLOCK_TEXT}>
152
162
  `;
153
- }, rt = (a, e, r, s, i, d, n = !0, c, l, o) => {
154
- let t = x;
163
+ }, pt = (a, t, l, s, o, c, i = !0, n, r, p) => {
164
+ let e = x;
155
165
  if (s && s.trim()) {
156
- const I = `${s.trim()}`;
157
- t = (i || "0") === "1" ? `${x}&nbsp;${I}` : `${I}&nbsp;${x}`;
166
+ const h = `${s.trim()}`;
167
+ e = (o || "0") === "1" ? `${x}&nbsp;${h}` : `${h}&nbsp;${x}`;
158
168
  }
159
- const p = z(i), T = `data-formated="${r ? "true" : "false"}"`, u = `${U.POSITION}="${p}"`, $ = s ? `${U.SYMBOL}="${s}"` : "", O = n ? "" : ' style="display: none;"', A = `data-single_price="${l ? "true" : "false"}"`, E = o === y.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
160
- if (d) {
161
- const P = V(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
162
- return N(`
163
- <td class="esd-block-text items-block-price${E}"
164
- esd-extension-block-id="${_.ORIGINAL_PRICE}"
169
+ const E = Y(o), u = `data-formated="${l ? "true" : "false"}"`, _ = `${k.POSITION}="${E}"`, I = s ? `${k.SYMBOL}="${s}"` : "", $ = i ? "" : ' style="display: none;"', T = `data-single_price="${r ? "true" : "false"}"`, d = p === S.ORIENTATION.VERTICAL, O = Q(d);
170
+ if (c) {
171
+ const A = v(n || "color: #cc0000; white-space: nowrap; font-size: 19px;"), y = V(n);
172
+ return w(`
173
+ <td class="esd-block-text items-block-price${O}"
174
+ esd-extension-block-id="${m.ORIGINAL_PRICE}"
175
+ ${U(d)}
165
176
  width="100%"
166
- align="center"${O}>
177
+ align="${y}"${$}>
167
178
  <p
168
179
  product-attr="originalPrice"
169
180
  contenteditable="false"
170
181
  data-slot-5
171
182
  data-type="${a}"
172
- data-number="${e}"
173
- ${T}
183
+ data-number="${t}"
174
184
  ${u}
175
- ${$}
176
- ${A}
177
- style="${m(P)}">
178
- <s>${t}</s>
185
+ ${_}
186
+ ${I}
187
+ ${T}
188
+ style="${b(A)}">
189
+ <s>${e}</s>
179
190
  </p>
180
191
  </td>
181
192
  `);
182
193
  }
183
194
  return `
184
195
  <${R.BLOCK_TEXT}
185
- class="items-block-price ${E}"
186
- esd-extension-block-id="${_.ORIGINAL_PRICE}"
196
+ class="items-block-price ${O}"
197
+ esd-extension-block-id="${m.ORIGINAL_PRICE}"
198
+ ${U(d)}
187
199
  width="100%"
188
200
  align="center"
189
- ${n ? "" : 'style="display: none;"'}
201
+ ${i ? "" : 'style="display: none;"'}
190
202
  >
191
203
  <p
192
204
  product-attr="originalPrice"
@@ -194,32 +206,32 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
194
206
  data-slot-5
195
207
  style="color: #cc0000"
196
208
  data-type="${a}"
197
- data-number="${e}"
198
- ${T}
209
+ data-number="${t}"
199
210
  ${u}
200
- ${$}
201
- ${A}
211
+ ${_}
212
+ ${I}
213
+ ${T}
202
214
  >
203
- <s>${t}</s>
215
+ <s>${e}</s>
204
216
  </p>
205
217
  </${R.BLOCK_TEXT}>
206
218
  `;
207
- }, ct = (a = !0, e, r) => {
219
+ }, $t = (a = !0, t, l) => {
208
220
  const s = a ? "" : 'style="display: none;"';
209
- if (e) {
210
- const i = "font-size: 14px;", d = S(r || "", "text-align") || "center", n = V(r || i);
211
- return N(`
212
- <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
213
- width="100%" align="${d}"
214
- esd-extension-block-id="${_.QUANTITY}"
221
+ if (t) {
222
+ const o = "font-size: 14px;", c = V(l), i = v(l || o);
223
+ return w(`
224
+ <td class="esd-block-text es-p5 document-node-component default-block-component selectable"
225
+ width="100%" align="${c}"
226
+ esd-extension-block-id="${m.QUANTITY}"
215
227
  ${s}>
216
228
  <p product-attr="quantity"
217
229
  data-slot-3=""
218
230
  contenteditable="false"
219
231
  width="100%"
220
232
  path="1"
221
- style="${m(n)}">
222
- ${v}
233
+ style="${b(i)}">
234
+ ${G}
223
235
  </p>
224
236
  </td>
225
237
  `);
@@ -228,8 +240,8 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
228
240
  <${R.BLOCK_TEXT}
229
241
  width="100%"
230
242
  align="center"
231
- class="es-p10"
232
- esd-extension-block-id="${_.QUANTITY}"
243
+ class="es-p5"
244
+ esd-extension-block-id="${m.QUANTITY}"
233
245
  ${a ? "" : 'style="display: none;"'}
234
246
  >
235
247
  <p
@@ -237,28 +249,30 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
237
249
  data-slot-3
238
250
  contenteditable="false"
239
251
  width="100%">
240
- ${v}
252
+ ${G}
241
253
  </p>
242
254
  </${R.BLOCK_TEXT}>
243
255
  `;
244
- }, it = (a, e, r = "Buy", s, i, d = !0, n = !0) => {
256
+ }, Et = (a, t, l = "Buy", s, o, c = !0, i = !0) => {
245
257
  if (s) {
246
- const c = S(i || "", "background") || S(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", o = d ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
247
- return N(`
258
+ const n = D(o || "", "background") || D(o || "", "background-color"), r = n ? `border-width: 0px; background: ${n};` : "border-width: 0px;", p = c ? "es-fw" : "es-il", e = (o || "").replace("border-width: 0;", ""), u = /(?:^|;)\s*padding(?:-(?:top|right|bottom|left))?\s*:/.test(e) ? "" : " padding: 5px 12px;", I = /(?:^|;)\s*font-family\s*:/.test(e) ? "" : " font-family: inherit;", $ = e.trim(), T = $ && !$.endsWith(";") ? ";" : "";
259
+ return w(`
248
260
  <td class="esd-block-button ins-button default-block-component selectable"
249
- align="center" width="100%" name="buy-button" caption="${r}"
250
- esd-extension-block-id="${_.BUTTON}"
251
- product-attr="button" data-slot-6="" data-type="${a}" data-number="${e}"
252
- ${n ? "" : ' style="display: none;"'}>
253
- <span class="es-button-border ${o}" style="${m(l)}">
261
+ align="center" width="100%" name="buy-button" caption="${b(l)}"
262
+ esd-extension-block-id="${m.BUTTON}"
263
+ product-attr="button" data-slot-6="" data-type="${a}" data-number="${t}"
264
+ ${i ? "" : ' style="display: none;"'}>
265
+ <p style="margin: 0; line-height: unset;">
266
+ <span class="es-button-border ${p}" style="${b(r)}">
254
267
  <a
255
268
  class="es-button"
256
269
  href="#!"
257
270
  target="_blank"
258
- style="${m(t)} padding: 5px 12px;">
259
- ${r}
271
+ style="${b($)}${T}${u}${I}">
272
+ ${b(l)}
260
273
  </a>
261
274
  </span>
275
+ </p>
262
276
  </td>
263
277
  `);
264
278
  }
@@ -267,147 +281,148 @@ const M = (a, e) => a.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
267
281
  width="100%"
268
282
  class="ins-button"
269
283
  name="buy-button"
270
- caption="${r}"
284
+ caption="${b(l)}"
271
285
  align="center"
272
- esd-extension-block-id="${_.BUTTON}"
286
+ esd-extension-block-id="${m.BUTTON}"
273
287
  product-attr="button"
274
288
  data-slot-6
275
289
  data-type="${a}"
276
- data-number="${e}"
277
- >${r}
290
+ data-number="${t}"
291
+ >${b(l)}
278
292
  </${R.BLOCK_BUTTON}>
279
293
  `;
280
- }, nt = (a, e, r, s = !0, i = !0) => {
281
- const d = e === y.ORIENTATION.VERTICAL, n = r === "horizontal";
282
- if (d) {
283
- const c = !n, l = c || !i ? "100%" : "50%", o = c || !s ? "100%" : "50%";
284
- let t = a.replace(
294
+ }, Tt = (a, t, l, s = !0, o = !0) => {
295
+ const c = t === S.ORIENTATION.VERTICAL, i = l === "horizontal";
296
+ if (c) {
297
+ const n = !i, r = n || !o ? "100%" : "50%", p = n || !s ? "100%" : "50%";
298
+ let e = a.replace(
285
299
  /<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
286
- (p) => p.replace(/width="[^"]*"/gi, `width="${l}"`).replace(/width:\s*[^;]+;/gi, `width: ${l};`)
300
+ (E) => E.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
287
301
  );
288
- return t = t.replace(
302
+ return e = e.replace(
289
303
  /<td\s+[^>]*class="([^"]*product-original-price-class[^"]*)"[^>]*>/gi,
290
- (p) => p.replace(/width="[^"]*"/gi, `width="${o}"`).replace(/width:\s*[^;]+;/gi, `width: ${o};`)
291
- ), t;
304
+ (E) => E.replace(/width="[^"]*"/gi, `width="${p}"`).replace(/width:\s*[^;]+;/gi, `width: ${p};`)
305
+ ), e;
292
306
  }
293
- return n ? a : a.replace(
307
+ return i ? a : a.replace(
294
308
  /<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
295
- (c) => /style\s*=\s*"/i.test(c) ? c.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : c.replace(/>$/, ' style="display: none;">')
309
+ (n) => /style\s*=\s*"/i.test(n) ? n.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : n.replace(/>$/, ' style="display: none;">')
296
310
  ).replace(
297
311
  /<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
298
- (c) => c.replace(/display:\s*none;?/gi, "display: table-cell;")
312
+ (n) => n.replace(/display:\s*none;?/gi, "display: table-cell;")
299
313
  );
300
- }, dt = (a) => a ? `<td align="center"
314
+ }, ut = (a) => a ? `<td align="center"
301
315
  esd-extension-block-id="items-block"
302
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : j, W = (a, e, r, s, i, d, n, c, l, o, t, p, T, u = "horizontal", $, O, A, b) => {
303
- const E = o !== void 0 ? ` data-nodup="${o}"` : "", P = `${`data-type="${e}" data-number="${r}"`} data-orientation="${s}"${E}`, D = l == null ? void 0 : l["data-product_image_control_image-height"], X = d ? et(e, r, D, t) : at(e, r), H = (t == null ? void 0 : t.buttonLabel) || "Buy", Q = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, Y = e === y.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, q = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (l == null ? void 0 : l["data-product_button_control_enabled"]) !== "false", K = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (l == null ? void 0 : l["data-product_price_control_enabled"]) !== "false", B = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (l == null ? void 0 : l["data-product_original_price_control_enabled"]) !== "false", C = a.replace("{-{-TEMPLATE_FIRST_LINE-}-}", dt(d)).replace("{-{-PRODUCT_IMAGE-}-}", X).replace("{-{-PRODUCT_NAME-}-}", st(e, d, p, t)).replaceAll(
316
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block">` : et, H = (a, t, l, s, o, c, i, n, r, p, e, E, u, _ = "horizontal", I, $, T, d) => {
317
+ const O = p !== void 0 ? ` data-nodup="${p}"` : "", A = `${`data-type="${t}" data-number="${l}"`} data-orientation="${s}"${O}`, y = r == null ? void 0 : r["data-product_image_control_image-height"], X = c ? it(t, l, y, e) : nt(t, l), j = (e == null ? void 0 : e.buttonLabel) || "Buy", q = (e == null ? void 0 : e.buttonFullWidth) !== void 0 ? e.buttonFullWidth : !0, C = t === S.ITEMS_TYPE.BROWSED_ITEMS ? !1 : e == null ? void 0 : e.quantityControlEnabled, f = (e == null ? void 0 : e.buttonVisible) !== void 0 ? e.buttonVisible : (r == null ? void 0 : r["data-product_button_control_enabled"]) !== "false", K = (e == null ? void 0 : e.priceVisible) !== void 0 ? e.priceVisible : (r == null ? void 0 : r["data-product_price_control_enabled"]) !== "false", W = (e == null ? void 0 : e.originalPriceVisible) !== void 0 ? e.originalPriceVisible : (r == null ? void 0 : r["data-product_original_price_control_enabled"]) !== "false", J = a.replace("{-{-TEMPLATE_FIRST_LINE-}-}", ut(c)).replace("{-{-PRODUCT_IMAGE-}-}", X).replace("{-{-PRODUCT_NAME-}-}", ot(t, c, E, e, s)).replaceAll(
304
318
  "{-{-PRODUCT_PRICE-}-}",
305
- g(lt(
306
- e,
307
- r,
319
+ z(dt(
320
+ t,
321
+ l,
322
+ o,
308
323
  i,
309
324
  n,
310
325
  c,
326
+ I,
311
327
  d,
312
- $,
313
- b,
314
328
  s,
315
329
  K
316
330
  ))
317
331
  ).replaceAll(
318
332
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
319
- g(rt(
320
- e,
321
- r,
333
+ z(pt(
334
+ t,
335
+ l,
336
+ o,
322
337
  i,
323
338
  n,
324
339
  c,
340
+ W,
341
+ $,
325
342
  d,
326
- B,
327
- O,
328
- b,
329
343
  s
330
344
  ))
331
- ).replace("{-{-PRODUCT_QUANTITY-}-}", ct(Y, d, A)).replace(
345
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", $t(C, c, T)).replace(
332
346
  "{-{-PRODUCT_BUTTON-}-}",
333
- it(e, r, H, d, T, Q, q)
347
+ Et(t, l, j, c, u, q, f)
334
348
  ).replace(
335
349
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
336
- `<td$1 ${P}>`
350
+ `<td$1 ${A}>`
337
351
  );
338
- return nt(
339
- C,
352
+ return Tt(
353
+ J,
340
354
  s,
341
- u,
355
+ _,
342
356
  K,
343
- B
357
+ W
344
358
  );
345
359
  };
346
- function bt({
360
+ function wt({
347
361
  orientation: a,
348
- itemsType: e = y.ITEMS_TYPE.CART_ITEMS,
349
- itemId: r,
362
+ itemsType: t = S.ITEMS_TYPE.CART_ITEMS,
363
+ itemId: l,
350
364
  currencySymbol: s,
351
- currencyLocation: i,
352
- migrate: d = !1,
353
- formattedPrice: n = !0,
354
- configBlockAttributes: c,
355
- nodeConfig: l,
356
- nameStyles: o,
357
- buttonStyles: t,
358
- priceStyles: p,
359
- originalPriceStyles: T,
360
- quantityStyles: u,
361
- priceOrientation: $
365
+ currencyLocation: o,
366
+ migrate: c = !1,
367
+ formattedPrice: i = !0,
368
+ configBlockAttributes: n,
369
+ nodeConfig: r,
370
+ nameStyles: p,
371
+ buttonStyles: e,
372
+ priceStyles: E,
373
+ originalPriceStyles: u,
374
+ quantityStyles: _,
375
+ priceOrientation: I
362
376
  }) {
363
- const O = J[e].findIndex((X) => X.value === r), A = tt(r, e), b = (l == null ? void 0 : l.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
364
- G = h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[O >= 0 ? O : 0], F = h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[O >= 0 ? O : 0];
365
- const E = h.PAIRS_FOR_EXTENSION.price[e], I = h.PAIRS_FOR_EXTENSION.originalPrice[e];
366
- b ? (L = n ? E.DEFAULT_SINGLE_PRICE_FORMATTED : E.DEFAULT_SINGLE_PRICE, x = n ? I.DEFAULT_SINGLE_PRICE_FORMATTED : I.DEFAULT_SINGLE_PRICE) : (L = n ? E.DEFAULT_PRICE_FORMATTED : E.DEFAULT_PRICE, x = n ? I.DEFAULT_PRICE_FORMATTED : I.DEFAULT_PRICE), v = h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
367
- const P = $ || (l == null ? void 0 : l.priceOrientation) || "horizontal", D = (l == null ? void 0 : l.priceHideDiscount) ?? k.productPriceHideDiscountControlValue === "1";
368
- return a === y.ORIENTATION.VERTICAL ? W(
369
- f,
370
- e,
371
- A,
377
+ const $ = at[t].findIndex((X) => X.value === l), T = rt(l, t), d = (r == null ? void 0 : r.priceSinglePrice) ?? (n == null ? void 0 : n["data-product_price_control_single_price"]) === "1" ?? !1;
378
+ B = P.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[$ >= 0 ? $ : 0], M = P.PAIRS_FOR_EXTENSION.name[t].DEFAULT[$ >= 0 ? $ : 0];
379
+ const O = P.PAIRS_FOR_EXTENSION.price[t], h = P.PAIRS_FOR_EXTENSION.originalPrice[t];
380
+ d ? (F = i ? O.DEFAULT_SINGLE_PRICE_FORMATTED : O.DEFAULT_SINGLE_PRICE, x = i ? h.DEFAULT_SINGLE_PRICE_FORMATTED : h.DEFAULT_SINGLE_PRICE) : (F = i ? O.DEFAULT_PRICE_FORMATTED : O.DEFAULT_PRICE, x = i ? h.DEFAULT_PRICE_FORMATTED : h.DEFAULT_PRICE), G = P.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT;
381
+ const A = I || (r == null ? void 0 : r.priceOrientation) || "horizontal", y = (r == null ? void 0 : r.priceHideDiscount) ?? g.productPriceHideDiscountControlValue === "1";
382
+ return a === S.ORIENTATION.VERTICAL ? H(
383
+ lt,
384
+ t,
385
+ T,
372
386
  a,
373
- n,
374
- d,
375
- s,
376
387
  i,
377
388
  c,
378
- String(D),
379
- // nodup
380
- l,
389
+ s,
381
390
  o,
382
- t,
383
- P,
391
+ n,
392
+ String(y),
393
+ // nodup
394
+ r,
384
395
  p,
385
- T,
386
- u,
387
- b
388
- ) : W(
389
- Z,
390
396
  e,
391
397
  A,
398
+ E,
399
+ u,
400
+ _,
401
+ d
402
+ ) : H(
403
+ st,
404
+ t,
405
+ T,
392
406
  a,
393
- n,
394
- d,
395
- s,
396
407
  i,
397
408
  c,
398
- String(D),
399
- // nodup
400
- l,
409
+ s,
401
410
  o,
402
- t,
403
- P,
411
+ n,
412
+ String(y),
413
+ // nodup
414
+ r,
404
415
  p,
405
- T,
416
+ e,
417
+ A,
418
+ E,
406
419
  u,
407
- b
420
+ _,
421
+ d
408
422
  );
409
423
  }
410
424
  export {
411
- bt as getDefaultTemplate,
412
- N as wrapInTableRow
425
+ Tt as applyPriceOrientationStyles,
426
+ wt as getDefaultTemplate,
427
+ w as wrapInTableRow
413
428
  };