@useinsider/guido 2.0.0-beta.a3f32aa → 2.0.0-beta.b46bbf6

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 (40) hide show
  1. package/dist/@types/config/schemas.js +33 -45
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  3. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  4. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  5. package/dist/composables/useConfig.js +27 -29
  6. package/dist/composables/useSave.js +11 -13
  7. package/dist/composables/useStripo.js +54 -55
  8. package/dist/config/migrator/index.js +9 -8
  9. package/dist/config/migrator/itemsBlockMigrator.js +283 -0
  10. package/dist/extensions/Blocks/Items/block.js +39 -40
  11. package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
  12. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
  13. package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
  14. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
  15. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
  16. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
  17. package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
  18. package/dist/extensions/Blocks/Items/template.js +296 -123
  19. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
  20. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
  21. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  22. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  23. package/dist/extensions/Blocks/common-control.js +64 -53
  24. package/dist/guido.css +1 -1
  25. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
  26. package/dist/src/@types/config/index.d.ts +2 -2
  27. package/dist/src/@types/config/schemas.d.ts +4 -26
  28. package/dist/src/@types/config/types.d.ts +1 -7
  29. package/dist/src/composables/useConfig.d.ts +2 -6
  30. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  31. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  32. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  33. package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
  34. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
  35. package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
  36. package/dist/src/stores/config.d.ts +18 -145
  37. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  38. package/dist/stores/config.js +0 -7
  39. package/package.json +3 -3
  40. package/dist/package.json.js +0 -7
@@ -1,29 +1,86 @@
1
- import { BlockType as l, BlockAttr as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { ItemsBlockId as T } from "./enums/controlEnums.js";
3
- import { productPairs as i, templateFirstLine as N } from "./enums/productEnums.js";
4
- import { ItemInCartOptions as f, SETTINGS_ENUMS as O, DefaultConfigValues as P } from "./enums/settingsEnums.js";
5
- import B from "./layouts/horizontal.html.js";
6
- import g from "./layouts/vertical.html.js";
7
- let [C] = i.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [A] = i.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [p] = i.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [I] = i.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [u] = i.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
8
- const h = (a, t) => `
9
- <${l.BLOCK_IMAGE}
10
- ${_.BLOCK_IMAGE.src}="${C}"
11
- ${_.BLOCK_IMAGE.alt}="${A}"
12
- ${_.BLOCK_IMAGE.href}="#!"
13
- ${_.BLOCK_IMAGE.width}=${P.productImageWidth}
14
- esd-extension-block-id="${T.IMAGE}"
1
+ import { BlockType as $, BlockAttr as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { ItemsBlockId as b } from "./enums/controlEnums.js";
3
+ import { productPairs as c, templateFirstLine as v } from "./enums/productEnums.js";
4
+ import { ItemInCartOptions as X, SETTINGS_ENUMS as y, DefaultConfigValues as P } from "./enums/settingsEnums.js";
5
+ import K from "./layouts/horizontal.html.js";
6
+ import z from "./layouts/vertical.html.js";
7
+ let [N] = c.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [A] = c.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [f] = c.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [k] = c.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [m] = c.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
8
+ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase().startsWith("text-align")).join("; ").replace(/;\s*$/, ""), G = (e, t, n) => {
9
+ const a = n || P.productImageWidth;
10
+ return `
11
+ <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
12
+ align="center"
13
+ esd-extension-block-id="items-block-image"
14
+ data-slot-1=""
15
+ product-attr="imageSrc"
16
+ data-type="${e}"
17
+ data-number="${t}"
18
+ style="font-size: 0px;">
19
+ <a class="document-node-component ng-star-inserted"
20
+ target="_blank"
21
+ href="#!">
22
+ <img class="adapt-img document-node-component ng-star-inserted"
23
+ src="${N}"
24
+ alt="${A}"
25
+ width="${a}">
26
+ </a>
27
+ </td>
28
+ `;
29
+ }, Q = (e, t) => `
30
+ <${$.BLOCK_IMAGE}
31
+ ${R.BLOCK_IMAGE.src}="${N}"
32
+ ${R.BLOCK_IMAGE.alt}="${A}"
33
+ ${R.BLOCK_IMAGE.href}="#!"
34
+ ${R.BLOCK_IMAGE.width}="${P.productImageWidth}"
35
+ ${R.BLOCK_IMAGE.height}="${P.productImageWidth}"
36
+ esd-extension-block-id="${b.IMAGE}"
15
37
  data-slot-1
16
38
  product-attr="imageSrc"
17
- data-type="${a}"
39
+ data-type="${e}"
18
40
  data-number="${t}"
19
41
  />
20
- `, F = (a) => `
21
- <${l.BLOCK_TEXT}
42
+ `, W = (e, t, n, a) => {
43
+ const l = `
44
+ text-decoration:none;
45
+ font-size: inherit;
46
+ font-weight: inherit;
47
+ line-height: inherit;
48
+ font-family: inherit;
49
+ color: inherit;
50
+ display: block;
51
+ word-wrap:break-word;
52
+ white-space: nowrap;
53
+ width: ${n === y.ORIENTATION.HORIZONTAL ? "130px" : "520px"};
54
+ overflow: hidden;
55
+ text-overflow: ellipsis;
56
+ `, o = a || l;
57
+ return t ? `
58
+ <td class="esd-block-text es-p10"
59
+ align="center"
60
+ width="100%"
61
+ data-type="${e}"
62
+ esd-extension-block-id="${b.NAME}"
63
+ style="display: table-cell;">
64
+ <div id="renderedContent" class="service-element text-block-input-area text-block-preview-area"
65
+ style="outline: none;" contenteditable="">
66
+ <p contenteditable="false" path="1">
67
+ <a
68
+ href="#!"
69
+ style="${o}"
70
+ product-attr="name"
71
+ data-slot-2
72
+ width="100%">
73
+ ${A}
74
+ </a>
75
+ </p>
76
+ </div>
77
+ </td>
78
+ ` : `<${$.BLOCK_TEXT}
22
79
  width="100%"
23
80
  align="center"
24
81
  class="es-p10"
25
- data-type="${a}"
26
- esd-extension-block-id="${T.NAME}"
82
+ data-type="${e}"
83
+ esd-extension-block-id="${b.NAME}"
27
84
  >
28
85
  <p contenteditable="false">
29
86
  <a
@@ -48,148 +105,264 @@ const h = (a, t) => `
48
105
  ${A}
49
106
  </a>
50
107
  </p>
51
- </${l.BLOCK_TEXT}>
52
- `, S = (a, t, o, e, c) => {
53
- let n = p;
54
- if (e && e.trim()) {
55
- const E = `&nbsp;${e.trim()}&nbsp;`;
56
- n = (c || "0") === "1" ? `${p}${E}` : `${E}${p}`;
108
+ </${$.BLOCK_TEXT}>
109
+ `;
110
+ }, q = (e, t, n, a, r, l, o) => {
111
+ let d = f;
112
+ if (a && a.trim()) {
113
+ const u = `&nbsp;${a.trim()}&nbsp;`;
114
+ d = (r || "0") === "1" ? `${f}${u}` : `${u}${f}`;
115
+ }
116
+ const s = r === "1" ? "after" : "before", T = `data-formated="${n ? "true" : "false"}"`, i = `data-curency="${s}"`, E = a ? `data-currency_symbol="${a}"` : "";
117
+ if (l) {
118
+ const p = S(o || "color: #060606; white-space: nowrap; font-size: 20px;");
119
+ return `
120
+ <td class="esd-block-text items-block-price"
121
+ align="center"
122
+ esd-extension-block-id="items-block-price"
123
+ width="100%">
124
+ <p product-attr="price"
125
+ contenteditable="false"
126
+ data-slot-4
127
+ data-type="${e}"
128
+ data-number="${t}"
129
+ ${T}
130
+ ${i}
131
+ ${E}
132
+ style="${p}">
133
+ ${d}
134
+ </p>
135
+ </td>`;
57
136
  }
58
- const r = c === "1" ? "after" : "before", d = `data-formated="${o ? "true" : "false"}"`, s = `data-curency="${r}"`;
59
137
  return `
60
- <${l.BLOCK_TEXT}
61
- esd-extension-block-id="${T.PRICE}"
138
+ <${$.BLOCK_TEXT}
139
+ esd-extension-block-id="${b.PRICE}"
62
140
  class="items-block-price"
63
- width="100%"
64
- align="center"
141
+ width="100%"
142
+ align="center"
65
143
  >
66
- <p
144
+ <p
67
145
  product-attr="price"
68
146
  contenteditable="false"
69
147
  data-slot-4
70
- data-type="${a}"
148
+ data-type="${e}"
71
149
  data-number="${t}"
72
- ${d}
73
- ${s}
74
- ${e ? `data-currency_symbol="${e}"` : ""}
150
+ ${T}
151
+ ${i}
152
+ ${a ? `data-currency_symbol="${a}"` : ""}
75
153
  >
76
- ${n}
154
+ ${d}
77
155
  </p>
78
- </${l.BLOCK_TEXT}>
156
+ </${$.BLOCK_TEXT}>
79
157
  `;
80
- }, L = (a, t, o, e, c) => {
81
- let n = I;
82
- if (e && e.trim()) {
83
- const E = `&nbsp;${e.trim()}&nbsp;`;
84
- n = (c || "0") === "1" ? `${I}${E}` : `${E}${I}`;
158
+ }, V = (e, t, n, a, r, l, o = !0, d) => {
159
+ let s = k;
160
+ if (a && a.trim()) {
161
+ const p = `&nbsp;${a.trim()}&nbsp;`;
162
+ s = (r || "0") === "1" ? `${k}${p}` : `${p}${k}`;
163
+ }
164
+ const T = r === "1" ? "after" : "before", i = `data-formated="${n ? "true" : "false"}"`, E = `data-curency="${T}"`, u = o ? "" : ' style="display: none;"';
165
+ if (l) {
166
+ const O = S(d || "color: #cc0000; white-space: nowrap; font-size: 19px;");
167
+ return `
168
+ <td class="esd-block-text items-block-price"
169
+ esd-extension-block-id="items-block-original-price"
170
+ width="100%"
171
+ align="center"${u}>
172
+ <p
173
+ product-attr="originalPrice"
174
+ contenteditable="false"
175
+ data-slot-5
176
+ data-type="${e}"
177
+ data-number="${t}"
178
+ ${i}
179
+ ${E}
180
+ ${a ? `data-currency_symbol="${a}"` : ""}
181
+ style="${O}">
182
+ <s>${s}</s>
183
+ </p>
184
+ </td>`;
85
185
  }
86
- const r = c === "1" ? "after" : "before", d = `data-formated="${o ? "true" : "false"}"`, s = `data-curency="${r}"`;
87
186
  return `
88
- <${l.BLOCK_TEXT}
187
+ <${$.BLOCK_TEXT}
89
188
  class="items-block-price"
90
- esd-extension-block-id="${T.ORIGINAL_PRICE}"
91
- width="100%"
92
- align="center"
189
+ esd-extension-block-id="${b.ORIGINAL_PRICE}"
190
+ width="100%"
191
+ align="center"
192
+ ${o ? "" : 'style="display: none;"'}
93
193
  >
94
194
  <p
95
195
  product-attr="originalPrice"
96
- contenteditable="false"
196
+ contenteditable="false"
97
197
  data-slot-5
98
198
  style="color: #cc0000"
99
- data-type="${a}"
199
+ data-type="${e}"
100
200
  data-number="${t}"
101
- ${d}
102
- ${s}
103
- ${e ? `data-currency_symbol="${e}"` : ""}
201
+ ${i}
202
+ ${E}
203
+ ${a ? `data-currency_symbol="${a}"` : ""}
104
204
  >
105
- <s>${n}</s>
205
+ <s>${s}</s>
106
206
  </p>
107
- </${l.BLOCK_TEXT}>
207
+ </${$.BLOCK_TEXT}>
108
208
  `;
109
- }, b = () => `
110
- <${l.BLOCK_TEXT}
111
- width="100%"
112
- align="center"
113
- class="es-p10"
114
- esd-extension-block-id="${T.QUANTITY}"
115
- >
116
- <p
117
- product-attr="quantity"
118
- data-slot-3
119
- contenteditable="false"
120
- width="100%">
121
- ${u}
122
- </p>
123
- </${l.BLOCK_TEXT}>
124
- `, U = (a, t) => `
125
- <${l.BLOCK_BUTTON}
126
- width="100%"
127
- class="ins-button"
128
- name="buy-button"
129
- caption="Buy"
130
- align="center"
131
- esd-extension-block-id="${T.BUTTON}"
132
- product-attr="button"
133
- data-slot-6
134
- data-type="${a}"
135
- data-number="${t}"
136
- >Buy
137
- </${l.BLOCK_BUTTON}>
138
- `, D = () => `
139
- <esd-config-block style="display: none;"></esd-config-block>
140
- `, R = (a, t, o, e, c, n, r, d) => {
141
- const $ = `${`data-type="${t}" data-number="${o}"`} data-orientation="${e}"`;
142
- return a.replace(
209
+ }, H = (e = !0, t, n) => {
210
+ const a = e ? "" : 'style="display: none;"';
211
+ return t ? `
212
+ <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
213
+ width="100%" align="center" esd-extension-block-id="items-block-quantity" ${a}>
214
+ <div class="service-element text-block-input-area text-block-preview-area"
215
+ style="outline: none;" contenteditable="">
216
+ <p product-attr="quantity" data-slot-3="" contenteditable="false" width="100%" path="1"
217
+ style="${n || "text-align: center; font-size: 14px;"}">
218
+ ${m}
219
+ </p>
220
+ </div>
221
+ </td>` : `
222
+ <${$.BLOCK_TEXT}
223
+ width="100%"
224
+ align="center"
225
+ class="es-p10"
226
+ esd-extension-block-id="${b.QUANTITY}"
227
+ ${e ? "" : 'style="display: none;"'}
228
+ >
229
+ <p
230
+ product-attr="quantity"
231
+ data-slot-3
232
+ contenteditable="false"
233
+ width="100%">
234
+ ${m}
235
+ </p>
236
+ </${$.BLOCK_TEXT}>
237
+ `;
238
+ }, j = (e, t, n = "Buy", a, r) => a ? `
239
+ <td class="esd-block-button ins-button default-block-component selectable"
240
+ align="center" width="100%" name="buy-button" caption="${n}"
241
+ esd-extension-block-id="items-block-button"
242
+ product-attr="button" data-slot-6="" data-type="${e}" data-number="${t}">
243
+ <span class="es-button-border" style="border-width: 0px;">
244
+ <a class="es-button" href="#!" target="_blank" style="${r || ""}">
245
+ ${n}
246
+ </a>
247
+ </span>
248
+ </td>` : `
249
+ <${$.BLOCK_BUTTON}
250
+ width="100%"
251
+ class="ins-button"
252
+ name="buy-button"
253
+ caption="${n}"
254
+ align="center"
255
+ esd-extension-block-id="${b.BUTTON}"
256
+ product-attr="button"
257
+ data-slot-6
258
+ data-type="${e}"
259
+ data-number="${t}"
260
+ >${n}
261
+ </${$.BLOCK_BUTTON}>
262
+ `, Y = (e) => !e || Object.keys(e).length === 0 ? '<esd-config-block style="display: none;"></esd-config-block>' : `<esd-config-block style="display: none;" ${Object.entries(e).map(([n, a]) => `${n}="${a}"`).join(" ")}></esd-config-block>`, Z = (e, t, n) => {
263
+ const a = t === y.ORIENTATION.VERTICAL, r = n === "horizontal";
264
+ return a ? r ? e : e.replace(
265
+ /<td\s+[^>]*class="[^"]*product-(?:original-)?price-class[^"]*"[^>]*>/gi,
266
+ (l) => l.replace(/width="50%"/gi, 'width="100%"').replace(/width:\s*50%;/gi, "width: 100%;")
267
+ ) : r ? e : e.replace(
268
+ /<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
269
+ (l) => /style\s*=\s*"/i.test(l) ? l.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : l.replace(/>$/, ' style="display: none;">')
270
+ ).replace(
271
+ /<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
272
+ (l) => l.replace(/display:\s*none;?/gi, "display: table-cell;")
273
+ );
274
+ }, J = (e) => e ? `<td align="center"
275
+ esd-extension-block-id="items-block" width="560"
276
+ data-number="4"
277
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : v, g = (e, t, n, a, r, l, o, d, s, T, i, E, u, p = "horizontal", O, _, I) => {
278
+ const x = `${`data-type="${t}" data-number="${n}"`} data-orientation="${a}"`, L = e.replace(
143
279
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
144
- `<td$1 ${$}>`
145
- ).replace("{-{-TEMPLATE_FIRST_LINE-}-}", N).replace("{-{-PRODUCT_IMAGE-}-}", h(t, o)).replace("{-{-PRODUCT_NAME-}-}", F(t)).replaceAll(
280
+ `<td$1 ${x}>`
281
+ ), F = s == null ? void 0 : s["data-product_image_control_image-width"], C = l ? G(t, n, F) : Q(t, n), M = (i == null ? void 0 : i.buttonLabel) || "Buy", U = (i == null ? void 0 : i.quantityControlEnabled) !== void 0 ? i.quantityControlEnabled : !0, D = (i == null ? void 0 : i.originalPriceVisible) !== void 0 ? i.originalPriceVisible : (s == null ? void 0 : s["data-product_original_price_control_enabled"]) !== "false", B = L.replace("{-{-TEMPLATE_FIRST_LINE-}-}", J(l)).replace("{-{-PRODUCT_IMAGE-}-}", C).replace("{-{-PRODUCT_NAME-}-}", W(t, l, a, E)).replaceAll(
146
282
  "{-{-PRODUCT_PRICE-}-}",
147
- S(t, o, c, n, r)
283
+ q(t, n, r, o, d, l, O)
148
284
  ).replaceAll(
149
285
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
150
- L(
286
+ V(
151
287
  t,
152
- o,
153
- c,
154
288
  n,
155
- r
289
+ r,
290
+ o,
291
+ d,
292
+ l,
293
+ D,
294
+ _
156
295
  )
157
- ).replace("{-{-PRODUCT_QUANTITY-}-}", b()).replace("{-{-PRODUCT_BUTTON-}-}", U(t, o)).replace("{-{-CONFIG_BLOCK-}-}", D());
296
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", H(U, l, I)).replace("{-{-PRODUCT_BUTTON-}-}", j(t, n, M, l, u)).replace("{-{-CONFIG_BLOCK-}-}", Y(s));
297
+ return Z(B, a, p);
158
298
  };
159
- function G({
160
- orientation: a,
161
- itemsType: t = O.ITEMS_TYPE.CART_ITEMS,
162
- itemId: o,
163
- currencySymbol: e,
164
- currencyLocation: c,
165
- formattedPrice: n = !0
299
+ function st({
300
+ orientation: e,
301
+ itemsType: t = y.ITEMS_TYPE.CART_ITEMS,
302
+ itemId: n,
303
+ currencySymbol: a,
304
+ currencyLocation: r,
305
+ migrate: l = !1,
306
+ formattedPrice: o = !0,
307
+ configBlockAttributes: d,
308
+ nodeConfig: s,
309
+ nameStyles: T,
310
+ buttonStyles: i,
311
+ priceStyles: E,
312
+ originalPriceStyles: u,
313
+ quantityStyles: p,
314
+ priceOrientation: O
166
315
  }) {
167
- const r = f[t].findIndex((s) => s.value === o);
168
- let d = "1";
169
- if (r >= 0)
170
- d = String(r + 1);
171
- else if (o) {
172
- const s = o.match(/\((\d+)\)/);
173
- s && s[1] && ([, d] = s);
316
+ const _ = X[t].findIndex((h) => h.value === n);
317
+ let I = "1";
318
+ if (_ >= 0)
319
+ I = String(_ + 1);
320
+ else if (n) {
321
+ const h = n.match(/\((\d+)\)/);
322
+ h && h[1] && ([, I] = h);
174
323
  }
175
- return C = i.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[r >= 0 ? r : 0], A = i.PAIRS_FOR_EXTENSION.name[t].DEFAULT[r >= 0 ? r : 0], p = n ? i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, I = n ? i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, u = i.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT, a === O.ORIENTATION.VERTICAL ? R(
176
- g,
324
+ N = c.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[_ >= 0 ? _ : 0], A = c.PAIRS_FOR_EXTENSION.name[t].DEFAULT[_ >= 0 ? _ : 0], f = o ? c.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : c.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, k = o ? c.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : c.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, m = c.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT;
325
+ const w = O || (s == null ? void 0 : s.priceOrientation) || "horizontal";
326
+ return e === y.ORIENTATION.VERTICAL ? g(
327
+ z,
177
328
  t,
178
- d,
179
- a,
180
- n,
329
+ I,
181
330
  e,
182
- c
183
- ) : R(
184
- B,
185
- t,
186
- d,
331
+ o,
332
+ l,
187
333
  a,
188
- n,
334
+ r,
335
+ d,
336
+ void 0,
337
+ // nodup
338
+ s,
339
+ T,
340
+ i,
341
+ w,
342
+ E,
343
+ u,
344
+ p
345
+ ) : g(
346
+ K,
347
+ t,
348
+ I,
189
349
  e,
190
- c
350
+ o,
351
+ l,
352
+ a,
353
+ r,
354
+ d,
355
+ void 0,
356
+ // nodup
357
+ s,
358
+ T,
359
+ i,
360
+ w,
361
+ E,
362
+ u,
363
+ p
191
364
  );
192
365
  }
193
366
  export {
194
- G as getDefaultTemplate
367
+ st as getDefaultTemplate
195
368
  };
@@ -0,0 +1,172 @@
1
+ import { ModificationDescription as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { DefaultConfigValues as e, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
3
+ function d() {
4
+ return String(Date.now() + Math.floor(Math.random() * 1e3));
5
+ }
6
+ function f() {
7
+ return {
8
+ initialized: !0,
9
+ blockInstanceId: d(),
10
+ source: n.ITEMS_TYPE.CART_ITEMS,
11
+ type: n.ITEMS_TYPE.CART_ITEMS,
12
+ itemsSelectValue: e.cartItemsSelectControlValue,
13
+ orientation: n.ORIENTATION.VERTICAL,
14
+ nameTrimming: e.productNameTrimmingControlValue === "1",
15
+ nameControlEnabled: e.productNameControlEnabled === "1",
16
+ priceHideDiscount: e.productPriceHideDiscountControlValue === "1",
17
+ priceFormatted: e.productPriceFormattedControlValue === "1",
18
+ priceCurrencySymbol: e.productPriceCurrencySymbolControlValue,
19
+ priceCurrencyLocation: e.productPriceCurrencyLocationControlValue,
20
+ priceControlOpened: e.productPriceControlOpened === "1",
21
+ priceOrientation: "horizontal",
22
+ quantityControlEnabled: e.productQuantityControlEnabled === "1",
23
+ buttonLink: e.productButtonLinkControlValue,
24
+ imageLink: e.productImageLinkControlValue,
25
+ buttonLabel: "Buy",
26
+ imageVisible: e.productImageVisible === "1",
27
+ nameVisible: e.productNameVisible === "1",
28
+ quantityVisible: e.productQuantityVisible === "1",
29
+ priceVisible: e.productPriceVisible === "1",
30
+ originalPriceVisible: e.productOriginalPriceVisible === "1",
31
+ buttonVisible: e.productButtonVisible === "1"
32
+ };
33
+ }
34
+ function s(r) {
35
+ if (!r)
36
+ return null;
37
+ const t = r.closest(".items-block-v2");
38
+ return t || r.closest(".esd-cart-items-block");
39
+ }
40
+ function m(r) {
41
+ return r ? {
42
+ CartItems: n.ITEMS_TYPE.CART_ITEMS,
43
+ BrowsedItems: n.ITEMS_TYPE.BROWSED_ITEMS,
44
+ PurchasedItems: n.ITEMS_TYPE.PURCHASED_ITEMS,
45
+ // Also handle already correct formats
46
+ CART_ITEMS: n.ITEMS_TYPE.CART_ITEMS,
47
+ BROWSED_ITEMS: n.ITEMS_TYPE.BROWSED_ITEMS,
48
+ PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
49
+ }[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
50
+ }
51
+ function C(r, t) {
52
+ if (!r)
53
+ return e.cartItemsSelectControlValue;
54
+ if (r.includes("{{"))
55
+ return r;
56
+ if (/^\d+$/.test(r)) {
57
+ const i = parseInt(r) - 1, o = g[t];
58
+ if (o && o[i])
59
+ return o[i].value;
60
+ }
61
+ return e.cartItemsSelectControlValue;
62
+ }
63
+ function I(r) {
64
+ const t = r.querySelector("esd-config-block");
65
+ if (!t)
66
+ return null;
67
+ const i = (c, a) => c == null ? a : c === "1" || c === "true", o = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), p = t.getAttribute("data-cart_items_select_control_value"), b = C(p, u);
68
+ return {
69
+ initialized: i(t.getAttribute("data-initialized"), !1),
70
+ blockInstanceId: o(
71
+ t.getAttribute("data-block-instance-id"),
72
+ d()
73
+ ),
74
+ source: u,
75
+ type: u,
76
+ itemsSelectValue: b,
77
+ orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
78
+ nameTrimming: i(
79
+ t.getAttribute("data-product_name_trimming"),
80
+ !0
81
+ ),
82
+ nameControlEnabled: i(
83
+ t.getAttribute("data-product_name_control_enabled"),
84
+ !0
85
+ ),
86
+ priceHideDiscount: i(
87
+ t.getAttribute("data-product_price_hide_discount"),
88
+ !0
89
+ ),
90
+ priceFormatted: i(
91
+ t.getAttribute("data-product_price_formatted"),
92
+ !0
93
+ ),
94
+ priceCurrencySymbol: o(
95
+ t.getAttribute("data-product_price_currency_symbol"),
96
+ e.productPriceCurrencySymbolControlValue
97
+ ),
98
+ priceCurrencyLocation: o(
99
+ t.getAttribute("data-product_price_currency_location"),
100
+ e.productPriceCurrencyLocationControlValue
101
+ ),
102
+ priceControlOpened: i(
103
+ t.getAttribute("data-product_price_control_opened"),
104
+ !0
105
+ ),
106
+ priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
107
+ quantityControlEnabled: i(
108
+ t.getAttribute("data-product_quantity_control_enabled"),
109
+ !0
110
+ ),
111
+ buttonLink: o(
112
+ t.getAttribute("data-product_button_link"),
113
+ e.productButtonLinkControlValue
114
+ ),
115
+ imageLink: o(
116
+ t.getAttribute("data-product_image_link"),
117
+ e.productImageLinkControlValue
118
+ ),
119
+ buttonLabel: o(
120
+ t.getAttribute("data-product_button_control_label"),
121
+ "Buy"
122
+ ),
123
+ imageVisible: i(
124
+ t.getAttribute("data-product_image_visible"),
125
+ !0
126
+ ),
127
+ nameVisible: i(
128
+ t.getAttribute("data-product_name_visible"),
129
+ !0
130
+ ),
131
+ quantityVisible: i(
132
+ t.getAttribute("data-product_quantity_visible"),
133
+ !0
134
+ ),
135
+ priceVisible: i(
136
+ t.getAttribute("data-product_price_visible"),
137
+ !0
138
+ ),
139
+ originalPriceVisible: i(
140
+ t.getAttribute("data-product_original_price_control_enabled"),
141
+ !0
142
+ ),
143
+ buttonVisible: i(
144
+ t.getAttribute("data-product_button_visible"),
145
+ !0
146
+ )
147
+ };
148
+ }
149
+ function S(r) {
150
+ const t = s(r);
151
+ if (!t)
152
+ return null;
153
+ const i = t.getNodeConfig();
154
+ if (i && i.initialized)
155
+ return i;
156
+ const o = I(t);
157
+ return o || null;
158
+ }
159
+ function y(r, t, i) {
160
+ const o = s(r);
161
+ if (!o)
162
+ return;
163
+ const u = { ...o.getNodeConfig() || {}, ...i };
164
+ t.getDocumentModifier().modifyHtml(o).setNodeConfig(u).apply(new _("Update Items block configuration"));
165
+ }
166
+ export {
167
+ d as generateBlockInstanceId,
168
+ f as getDefaultItemsBlockConfig,
169
+ S as getItemsBlockConfig,
170
+ s as getItemsBlockContainer,
171
+ y as setItemsBlockConfig
172
+ };