@useinsider/guido 3.14.0 → 3.15.0-beta.0b5dc39

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 (48) hide show
  1. package/dist/composables/useEmailTemplateApplier.js +46 -32
  2. package/dist/composables/useHtmlValidator.js +105 -100
  3. package/dist/composables/useStripo.js +30 -29
  4. package/dist/config/compiler/itemsCompilerRules.js +25 -4
  5. package/dist/config/compiler/utils/itemsCompilerUtils.js +28 -0
  6. package/dist/config/i18n/en/labels.json.js +7 -3
  7. package/dist/config/migrator/index.js +9 -8
  8. package/dist/config/migrator/itemsBlockMigrator.js +47 -45
  9. package/dist/config/migrator/productNameLinkMigrator.js +27 -0
  10. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  12. package/dist/extensions/Blocks/Items/block.js +30 -30
  13. package/dist/extensions/Blocks/Items/controls/name/trimming.js +16 -16
  14. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +26 -22
  15. package/dist/extensions/Blocks/Items/controls/settingsControl.js +36 -35
  16. package/dist/extensions/Blocks/Items/template.js +228 -263
  17. package/dist/extensions/Blocks/Items/utils/nameNode.js +4 -0
  18. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
  19. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
  20. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
  22. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  23. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  24. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  25. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  26. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  27. package/dist/extensions/Blocks/common-control.js +42 -35
  28. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  29. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +12 -0
  30. package/dist/src/config/migrator/productNameLinkMigrator.d.ts +1 -0
  31. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Items/block.d.ts +1 -1
  33. package/dist/src/extensions/Blocks/Items/utils/nameNode.d.ts +9 -0
  34. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  35. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
  38. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  39. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
  40. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  41. package/dist/src/stores/dynamic-content.d.ts +8 -0
  42. package/dist/src/utils/registerUsedDynamicContent.d.ts +8 -0
  43. package/dist/src/utils/unwrapProductNameLink.d.ts +15 -0
  44. package/dist/stores/dynamic-content.js +12 -2
  45. package/dist/utils/pairProductVariables.js +75 -72
  46. package/dist/utils/registerUsedDynamicContent.js +23 -0
  47. package/dist/utils/unwrapProductNameLink.js +37 -0
  48. package/package.json +1 -1
@@ -1,14 +1,15 @@
1
1
  import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
3
  import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
- import { migrateRadioButton as a } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as c } from "./recommendationMigrator.js";
6
- import { migrateSocialIcons as g } from "./socialIconMigrator.js";
7
- import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
8
- const k = async (o, r = {}) => {
9
- let m = o;
10
- return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
4
+ import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
5
+ import { migrateRadioButton as c } from "./radioButtonMigrator.js";
6
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
7
+ import { migrateSocialIcons as n } from "./socialIconMigrator.js";
8
+ import { migrateUnsubscribe as p } from "./unsubscribeMigrator.js";
9
+ const x = async (r, o = {}) => {
10
+ let m = r;
11
+ return m = t(m), m = c(m), m = await p(m), m = i(m), m = g(m, o), m = e(m), m = a(m), m = n(m), m;
11
12
  };
12
13
  export {
13
- k as migrate
14
+ x as migrate
14
15
  };
@@ -88,11 +88,11 @@ function k(o) {
88
88
  }
89
89
  function h(o) {
90
90
  var e;
91
- const t = (c, u) => c == null ? u : c === "1" || c === "true", r = (c, u) => c || u, l = o["data-type"] || o["data-source"], a = k(l), i = I[a];
91
+ const t = (l, u) => l == null ? u : l === "1" || l === "true", r = (l, u) => l || u, c = o["data-type"] || o["data-source"], a = k(c), i = I[a];
92
92
  let n = o["data-cart_items_select_control_value"] || ((e = i == null ? void 0 : i[0]) == null ? void 0 : e.value) || g.cartItemsSelectControlValue;
93
93
  if (n && !n.includes("{{") && /^\d+$/.test(n)) {
94
- const c = parseInt(n) - 1, u = I[a];
95
- u && u[c] && (n = u[c].value);
94
+ const l = parseInt(n) - 1, u = I[a];
95
+ u && u[l] && (n = u[l].value);
96
96
  }
97
97
  return {
98
98
  initialized: !0,
@@ -148,7 +148,7 @@ function N(o, t) {
148
148
  };
149
149
  return r[o] || r.CART_ITEMS;
150
150
  }
151
- class z {
151
+ class H {
152
152
  constructor() {
153
153
  M(this, "parser");
154
154
  this.parser = new DOMParser();
@@ -159,13 +159,13 @@ class z {
159
159
  return this.backfillV2ProductTdAttributes(t);
160
160
  let r = this.removeJinjaConditionals(t);
161
161
  r = this.replaceTemplateVariables(r);
162
- const l = this.parser.parseFromString(r, "text/html"), a = l.querySelectorAll(
162
+ const c = this.parser.parseFromString(r, "text/html"), a = c.querySelectorAll(
163
163
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
164
164
  );
165
165
  return q().$patch((n) => {
166
166
  n.migrations = { ...n.migrations, [w]: a.length };
167
167
  }), a.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (a.forEach((n) => {
168
- const e = this.extractConfiguration(n), c = F({
168
+ const e = this.extractConfiguration(n), l = F({
169
169
  orientation: e.orientation,
170
170
  itemsType: e.itemsType,
171
171
  itemId: e.itemId,
@@ -181,7 +181,7 @@ class z {
181
181
  quantityStyles: e.quantityStyles,
182
182
  nodeConfig: h(e.configBlockAttributes)
183
183
  }), s = this.parser.parseFromString(
184
- `<table><tbody><tr>${c}</tr></tbody></table>`,
184
+ `<table><tbody><tr>${l}</tr></tbody></table>`,
185
185
  "text/html"
186
186
  ).querySelector("td");
187
187
  if (s && n.parentNode) {
@@ -190,7 +190,7 @@ class z {
190
190
  const d = s.querySelector("esd-config-block");
191
191
  d && d.remove(), n.parentNode.replaceChild(s, n);
192
192
  }
193
- }), l.documentElement.outerHTML);
193
+ }), c.documentElement.outerHTML);
194
194
  } catch (r) {
195
195
  return console.error("ItemsBlockMigrator failed:", r), t;
196
196
  }
@@ -205,15 +205,15 @@ class z {
205
205
  var C, D, P;
206
206
  const r = k(
207
207
  ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) ?? null
208
- ), l = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", a = parseInt(l) - 1, i = I[r], n = ((P = i == null ? void 0 : i[a]) == null ? void 0 : P.value) || i[0].value, e = t.querySelector('[product-attr="price"]'), c = (e == null ? void 0 : e.getAttribute("data-currency_symbol")) || "USD", s = ((e == null ? void 0 : e.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", _ = (e == null ? void 0 : e.getAttribute("data-formated")) !== "false", d = this.extractConfigBlockAttributes(t, r, l), b = d["data-card_orientation_control_value"];
208
+ ), c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", a = parseInt(c) - 1, i = I[r], n = ((P = i == null ? void 0 : i[a]) == null ? void 0 : P.value) || i[0].value, e = t.querySelector('[product-attr="price"]'), l = (e == null ? void 0 : e.getAttribute("data-currency_symbol")) || "USD", s = ((e == null ? void 0 : e.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", _ = (e == null ? void 0 : e.getAttribute("data-formated")) !== "false", d = this.extractConfigBlockAttributes(t, r, c), b = d["data-card_orientation_control_value"];
209
209
  let S;
210
210
  b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
211
- const y = t.querySelector('a[product-attr="name"]'), A = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, R = (e == null ? void 0 : e.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), L = (T == null ? void 0 : T.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), B = (E == null ? void 0 : E.getAttribute("style")) || void 0;
211
+ const y = t.querySelector('a[product-attr="name"]'), A = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, R = (e == null ? void 0 : e.getAttribute("style")) || void 0, E = t.querySelector("p.original-price"), L = (E == null ? void 0 : E.getAttribute("style")) || void 0, T = t.querySelector('[product-attr="quantity"]'), B = (T == null ? void 0 : T.getAttribute("style")) || void 0;
212
212
  return {
213
213
  orientation: S,
214
214
  itemsType: r,
215
215
  itemId: n,
216
- currencySymbol: c,
216
+ currencySymbol: l,
217
217
  currencyLocation: s,
218
218
  formattedPrice: _,
219
219
  configBlockAttributes: d,
@@ -231,7 +231,7 @@ class z {
231
231
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
232
232
  * @param itemNumber - The item number (1-based index)
233
233
  */
234
- extractConfigBlockAttributes(t, r, l) {
234
+ extractConfigBlockAttributes(t, r, c) {
235
235
  const a = t.querySelector("esd-config-block"), i = {};
236
236
  if (!a)
237
237
  return this.getDefaultConfigBlockAttributes();
@@ -240,18 +240,18 @@ class z {
240
240
  }), i["data-cart_items_select_control_value"]) {
241
241
  const e = i["data-cart_items_select_control_value"];
242
242
  if (/^\d+$/.test(e)) {
243
- const c = parseInt(e) - 1, u = I[r];
244
- u && u[c] && (i["data-cart_items_select_control_value"] = u[c].value);
243
+ const l = parseInt(e) - 1, u = I[r];
244
+ u && u[l] && (i["data-cart_items_select_control_value"] = u[l].value);
245
245
  }
246
246
  }
247
247
  if (i["data-product_price_control_curency"]) {
248
248
  const e = i["data-product_price_control_curency"];
249
- let c = e;
250
- e === "before" ? c = "0" : e === "after" && (c = "1"), i["data-product_price_control_curency"] = c, i["data-product_price_currency_location"] = c;
249
+ let l = e;
250
+ e === "before" ? l = "0" : e === "after" && (l = "1"), i["data-product_price_control_curency"] = l, i["data-product_price_currency_location"] = l;
251
251
  }
252
252
  (!i["data-product_price_control_currency_symbol"] || i["data-product_price_control_currency_symbol"].trim() === "") && (i["data-product_price_control_currency_symbol"] = "USD");
253
253
  const n = { ...this.getDefaultConfigBlockAttributes(), ...i };
254
- return n["data-type"] = r, n["data-source"] = r, n["data-product_image_link"] = $(r, l), n["data-product_button_link"] = N(r, l), n;
254
+ return n["data-type"] = r, n["data-source"] = r, n["data-product_image_link"] = $(r, c), n["data-product_button_link"] = N(r, c), n;
255
255
  }
256
256
  /**
257
257
  * Returns default esd-config-block attributes based on the old template structure
@@ -301,7 +301,7 @@ class z {
301
301
  };
302
302
  }
303
303
  /**
304
- * Backfills data-type (and data-number) onto v2 `.ins-product-td` elements
304
+ * Backfills data-type (and data-number, data-nodup) onto v2 `.ins-product-td` elements
305
305
  * from their persisted `esd-ext-config` nodeConfig, and strips the legacy
306
306
  * static `width` that older builds baked onto the product-td.
307
307
  *
@@ -326,22 +326,24 @@ class z {
326
326
  if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
327
327
  return t;
328
328
  const r = this.parser.parseFromString(t, "text/html");
329
- let l = !1;
329
+ let c = !1;
330
330
  return r.querySelectorAll(".ins-product-td").forEach((a) => {
331
- if (a.hasAttribute("width") && (a.removeAttribute("width"), l = !0), a.getAttribute("data-type"))
332
- return;
331
+ a.hasAttribute("width") && (a.removeAttribute("width"), c = !0);
333
332
  const i = a.getAttribute("esd-ext-config");
334
- if (i)
335
- try {
336
- const n = JSON.parse(i), e = n.type || n.source;
337
- if (!e)
338
- return;
339
- a.setAttribute("data-type", e), l = !0;
340
- const c = typeof n.itemsSelectValue == "string" ? n.itemsSelectValue.match(/\((\d+)\)/) : null;
341
- c && a.getAttribute("data-number") !== c[1] && a.setAttribute("data-number", c[1]);
342
- } catch {
343
- }
344
- }), l ? r.documentElement.outerHTML : t;
333
+ let n = null;
334
+ try {
335
+ n = i ? JSON.parse(i) : null;
336
+ } catch {
337
+ }
338
+ if (!n || (!a.getAttribute("data-nodup") && typeof n.priceHideDiscount == "boolean" && (a.setAttribute("data-nodup", String(n.priceHideDiscount)), c = !0), a.getAttribute("data-type")))
339
+ return;
340
+ const e = n.type || n.source;
341
+ if (!e)
342
+ return;
343
+ a.setAttribute("data-type", e), c = !0;
344
+ const l = typeof n.itemsSelectValue == "string" ? n.itemsSelectValue.match(/\((\d+)\)/) : null;
345
+ l && a.getAttribute("data-number") !== l[1] && a.setAttribute("data-number", l[1]);
346
+ }), c ? r.documentElement.outerHTML : t;
345
347
  }
346
348
  /**
347
349
  * Fast check for the presence of any items block (cart / browsed / purchased)
@@ -362,15 +364,15 @@ class z {
362
364
  * contains display condition Jinja scripts that should NOT be removed.
363
365
  */
364
366
  removeJinjaConditionals(t) {
365
- const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", l = t.match(/esd-custom-display-conditions="[^"]*"/);
366
- let a = l ? t.replace(l[0], r) : t;
367
+ const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
368
+ let a = c ? t.replace(c[0], r) : t;
367
369
  return a = a.replace(
368
370
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
369
371
  ""
370
372
  ), a = a.replace(
371
373
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
372
374
  ""
373
- ), a = a.replace(/\{%\s*endif\s*%\}/g, ""), l && (a = a.replace(r, l[0])), a = a.replace(/\n\s*\n\s*\n/g, `
375
+ ), a = a.replace(/\{%\s*endif\s*%\}/g, ""), c && (a = a.replace(r, c[0])), a = a.replace(/\n\s*\n\s*\n/g, `
374
376
 
375
377
  `), a;
376
378
  }
@@ -385,30 +387,30 @@ class z {
385
387
  */
386
388
  replaceTemplateVariables(t) {
387
389
  const { PAIRS_FOR_EXTENSION: r } = K;
388
- return t.replace(/{{([^}]+)}}/g, (l, a) => {
390
+ return t.replace(/{{([^}]+)}}/g, (c, a) => {
389
391
  const i = a.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
390
392
  if (!i)
391
- return l;
392
- const [, n, e, c] = i, u = V[n];
393
+ return c;
394
+ const [, n, e, l] = i, u = V[n];
393
395
  if (!u)
394
- return console.warn(`Unknown variable prefix: ${n}`), l;
396
+ return console.warn(`Unknown variable prefix: ${n}`), c;
395
397
  const s = x[e];
396
398
  if (!s)
397
- return console.warn(`Unknown variable suffix mapping for: ${e}`), l;
399
+ return console.warn(`Unknown variable suffix mapping for: ${e}`), c;
398
400
  const { pairsKey: _, defaultKey: d, isArray: b } = s, y = r[_][u];
399
401
  if (!y)
400
- return console.warn(`No data found for: ${_}.${u}`), l;
402
+ return console.warn(`No data found for: ${_}.${u}`), c;
401
403
  if (b) {
402
- const f = parseInt(c) - 1, m = y[d];
403
- return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`), l);
404
+ const f = parseInt(l) - 1, m = y[d];
405
+ return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`), c);
404
406
  }
405
407
  const A = y[d];
406
- return A !== void 0 ? String(A) : (console.warn(`Default value not found: ${_}.${u}.${d}`), l);
408
+ return A !== void 0 ? String(A) : (console.warn(`Default value not found: ${_}.${u}.${d}`), c);
407
409
  });
408
410
  }
409
411
  }
410
412
  function Q(o) {
411
- return new z().migrate(o);
413
+ return new H().migrate(o);
412
414
  }
413
415
  export {
414
416
  Q as migrateItemsBlock
@@ -0,0 +1,27 @@
1
+ var n = Object.defineProperty;
2
+ var a = (e, r, t) => r in e ? n(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var o = (e, r, t) => a(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { unwrapProductNameLinks as i } from "../../utils/unwrapProductNameLink.js";
5
+ const c = /<a[^>]*product-attr="name"/i;
6
+ class s {
7
+ constructor() {
8
+ o(this, "parser");
9
+ this.parser = new DOMParser();
10
+ }
11
+ migrate(r) {
12
+ try {
13
+ if (!r.includes("items-block-v2") || !c.test(r))
14
+ return r;
15
+ const t = this.parser.parseFromString(r, "text/html");
16
+ return i(t), t.documentElement.outerHTML;
17
+ } catch (t) {
18
+ return console.error("ProductNameLinkMigrator failed:", t), r;
19
+ }
20
+ }
21
+ }
22
+ function d(e) {
23
+ return new s().migrate(e);
24
+ }
25
+ export {
26
+ d as migrateProductNameLink
27
+ };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_COMPOSITION as d, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
2
  import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
3
  import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
4
  const C = "__title__", a = "product_attribute.";
@@ -23,19 +23,22 @@ function N(r) {
23
23
  return { key: k, kind: "button" };
24
24
  default:
25
25
  if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
- const s = r.value ?? "", o = s.startsWith(a) ? s.slice(a.length) : s;
27
- return o ? {
28
- key: `${l}${o}`,
26
+ const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
27
+ if (!s)
28
+ return null;
29
+ const e = o || `${a}${s}`;
30
+ return {
31
+ key: `${l}${e}`,
29
32
  kind: "custom",
30
- customAttrName: o,
31
- customAttrValue: s || `${a}${o}`
32
- } : null;
33
+ customAttrName: s,
34
+ customAttrValue: e
35
+ };
33
36
  }
34
37
  return null;
35
38
  }
36
39
  }
37
- function p(r) {
38
- const t = d.indexOf(r);
40
+ function _(r) {
41
+ const t = p.indexOf(r);
39
42
  return t === -1 ? Number.POSITIVE_INFINITY : t;
40
43
  }
41
44
  function S(r) {
@@ -48,8 +51,8 @@ function S(r) {
48
51
  anyTextTrimming: !1
49
52
  };
50
53
  if (!r || r.length === 0)
51
- return t.composition = [...d], t;
52
- const s = [];
54
+ return t.composition = [...p], t;
55
+ const o = [];
53
56
  r.forEach((e, i) => {
54
57
  const n = N(e);
55
58
  if (n) {
@@ -57,7 +60,7 @@ function S(r) {
57
60
  t.titleVariable = e;
58
61
  return;
59
62
  }
60
- s.push({
63
+ o.push({
61
64
  key: n.key,
62
65
  kind: n.kind,
63
66
  hidden: e.hidden === !0,
@@ -68,30 +71,30 @@ function S(r) {
68
71
  originalIndex: i
69
72
  });
70
73
  }
71
- }), s.sort((e, i) => {
74
+ }), o.sort((e, i) => {
72
75
  if (e.positionIdx !== i.positionIdx)
73
76
  return e.positionIdx - i.positionIdx;
74
- const n = p(e.key), u = p(i.key);
77
+ const n = _(e.key), u = _(i.key);
75
78
  return n !== u ? n - u : e.originalIndex - i.originalIndex;
76
79
  });
77
- const o = {};
78
- return s.forEach((e) => {
79
- const { key: i, kind: n, hidden: u, legacy: m, customAttrName: c, customAttrValue: T } = e;
80
- switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && c && T && (t.customAttributes.includes(c) || t.customAttributes.push(c), t.customAttrValues[i] = T), n) {
80
+ const s = {};
81
+ return o.forEach((e) => {
82
+ const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
83
+ switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
81
84
  case "image":
82
- o[i] = b(m.theme);
85
+ s[i] = b(c.theme);
83
86
  break;
84
87
  case "button":
85
- o[i] = O(m.theme);
88
+ s[i] = O(c.theme);
86
89
  break;
87
90
  case "text":
88
91
  case "custom": {
89
- const _ = E(m.theme);
90
- o[i] = _, _.textTrimming && (t.anyTextTrimming = !0);
92
+ const T = E(c.theme);
93
+ s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
91
94
  break;
92
95
  }
93
96
  }
94
- }), t.perElementStyles = o, t;
97
+ }), t.perElementStyles = s, t;
95
98
  }
96
99
  export {
97
100
  S as mapComposition