@useinsider/guido 3.20.1-beta.8a05319 → 3.20.1
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.
- package/dist/config/compiler/itemsCompilerRules.js +12 -5
- package/dist/config/compiler/utils/itemsCompilerUtils.js +65 -45
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pairProductVariables as o } from "../../utils/pairProductVariables.js";
|
|
2
|
-
import { normalizeItemsBlockWidths as r, wrapHiddenPriceTdsForOutlook as e, MSO_ITEMS_HIDE_START as
|
|
3
|
-
const
|
|
2
|
+
import { normalizeItemsBlockWidths as r, wrapHiddenPriceTdsForOutlook as t, lockHorizontalItemImageWidths as e, MSO_ITEMS_HIDE_START as s, MSO_ITEMS_HIDE_END as p } from "./utils/itemsCompilerUtils.js";
|
|
3
|
+
const c = [
|
|
4
4
|
{
|
|
5
5
|
id: "normalize-items-block-widths",
|
|
6
6
|
// Runs before the other items rules so they see non-zero widths; not AMP-safe.
|
|
@@ -25,20 +25,27 @@ const d = [
|
|
|
25
25
|
// with safe placeholder comments and collapse them inline for web-engine Outlook.
|
|
26
26
|
description: "Mark hidden Items price tds for Outlook conditional hiding",
|
|
27
27
|
type: "custom",
|
|
28
|
-
processor:
|
|
28
|
+
processor: t,
|
|
29
29
|
priority: 65
|
|
30
30
|
// After pair-product-variables (60), before outlook rules (70+)
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
id: "lock-horizontal-item-image-widths",
|
|
34
|
+
description: "Pin horizontal Items thumbnails to their width so narrow rows cannot collapse them",
|
|
35
|
+
type: "custom",
|
|
36
|
+
processor: e,
|
|
37
|
+
priority: 66
|
|
38
|
+
},
|
|
32
39
|
{
|
|
33
40
|
id: "swap-items-mso-markers",
|
|
34
41
|
// Injecting the delicate `<!-- -->` ghost token LAST (after reco minify P99
|
|
35
42
|
// and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
|
|
36
43
|
description: "Swap Items MSO markers into [if !mso] conditional comments",
|
|
37
44
|
type: "custom",
|
|
38
|
-
processor: (i) => i.replaceAll(`<!--${
|
|
45
|
+
processor: (i) => i.replaceAll(`<!--${s}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${p}-->`, "<!--<![endif]-->"),
|
|
39
46
|
priority: 101
|
|
40
47
|
}
|
|
41
48
|
];
|
|
42
49
|
export {
|
|
43
|
-
|
|
50
|
+
c as itemsCompilerRules
|
|
44
51
|
};
|
|
@@ -1,55 +1,75 @@
|
|
|
1
|
-
import { PRODUCT_WRAPPER_SELECTOR as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { PRODUCT_WRAPPER_SELECTOR as h, hasZeroWidthDeclaration as E, isZeroWidthValue as f, withWidthPin as T, PRODUCT_TD_SELECTOR as _, withoutZeroWidth as y } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
|
|
2
|
+
import { DefaultConfigValues as D } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
3
|
+
import { protectLiquid as p, restoreLiquid as A } from "../../../utils/liquidProtection.js";
|
|
4
|
+
const m = "MSO_ITEMS_HIDE_START", S = "MSO_ITEMS_HIDE_END", M = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", I = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", O = ".ins-product-td td.product-image-class img[width]", g = Number(D.productImageWidth);
|
|
5
|
+
function C(t) {
|
|
6
|
+
if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
|
|
7
|
+
return t;
|
|
8
|
+
const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
|
|
9
|
+
let n = !1;
|
|
10
|
+
if (o.querySelectorAll(I).forEach((e) => {
|
|
11
|
+
var d, u;
|
|
12
|
+
const r = e.getAttribute("style") || "";
|
|
13
|
+
if (!/display\s*:\s*none/i.test(r))
|
|
13
14
|
return;
|
|
14
|
-
const l =
|
|
15
|
-
if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !==
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
const l = e.previousSibling;
|
|
16
|
+
if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== m) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(m), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(S), e.nextSibling)), !/mso-hide/i.test(r)) {
|
|
17
|
+
const a = r.trim().endsWith(";") ? " " : "; ";
|
|
18
|
+
e.setAttribute("style", `${r}${a}${M}`);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
}), !
|
|
21
|
-
return
|
|
22
|
-
const c =
|
|
20
|
+
n = !0;
|
|
21
|
+
}), !n)
|
|
22
|
+
return t;
|
|
23
|
+
const c = s.match(/<!DOCTYPE[^>]*>/i);
|
|
23
24
|
return ((c ? `${c[0]}
|
|
24
|
-
` : "") +
|
|
25
|
+
` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
if (!
|
|
28
|
-
return
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
if (!E(
|
|
27
|
+
function N(t) {
|
|
28
|
+
if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
|
|
29
|
+
return t;
|
|
30
|
+
const s = new DOMParser().parseFromString(p(t), "text/html");
|
|
31
|
+
let o = !1;
|
|
32
|
+
if (s.querySelectorAll(h).forEach((i) => {
|
|
33
|
+
const e = i.getAttribute("style") || "";
|
|
34
|
+
if (!E(e) && !f(i.getAttribute("width")))
|
|
34
35
|
return;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
}),
|
|
38
|
-
const
|
|
39
|
-
if (E(
|
|
40
|
-
const
|
|
41
|
-
|
|
36
|
+
const r = T(e);
|
|
37
|
+
r !== e && (i.setAttribute("style", r), o = !0), f(i.getAttribute("width")) && (i.setAttribute("width", "100%"), o = !0);
|
|
38
|
+
}), s.querySelectorAll(_).forEach((i) => {
|
|
39
|
+
const e = i.getAttribute("style") || "";
|
|
40
|
+
if (E(e)) {
|
|
41
|
+
const r = y(e);
|
|
42
|
+
r ? i.setAttribute("style", r) : i.removeAttribute("style"), o = !0;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
}), !
|
|
45
|
-
return
|
|
46
|
-
const
|
|
44
|
+
f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
|
|
45
|
+
}), !o)
|
|
46
|
+
return t;
|
|
47
|
+
const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
|
|
47
48
|
` : "";
|
|
48
|
-
return
|
|
49
|
+
return A(c + s.documentElement.outerHTML);
|
|
50
|
+
}
|
|
51
|
+
function L(t) {
|
|
52
|
+
if (!t.includes("product-image-class"))
|
|
53
|
+
return t;
|
|
54
|
+
const s = new DOMParser().parseFromString(p(t), "text/html");
|
|
55
|
+
let o = !1;
|
|
56
|
+
if (s.querySelectorAll(O).forEach((i) => {
|
|
57
|
+
var u, a;
|
|
58
|
+
const e = ((u = i.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", r = ((a = i.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
|
|
59
|
+
if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(r))
|
|
60
|
+
return;
|
|
61
|
+
const l = r && !r.endsWith(";") ? ";" : "", d = Math.min(Number(e), g);
|
|
62
|
+
i.setAttribute("style", `${r}${l}min-width:${d}px;max-width:${e}px`), o = !0;
|
|
63
|
+
}), !o)
|
|
64
|
+
return t;
|
|
65
|
+
const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
|
|
66
|
+
` : "";
|
|
67
|
+
return A(c + s.documentElement.outerHTML);
|
|
49
68
|
}
|
|
50
69
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
S as MSO_ITEMS_HIDE_END,
|
|
71
|
+
m as MSO_ITEMS_HIDE_START,
|
|
72
|
+
L as lockHorizontalItemImageWidths,
|
|
73
|
+
N as normalizeItemsBlockWidths,
|
|
74
|
+
C as wrapHiddenPriceTdsForOutlook
|
|
55
75
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
|
-
var ct = (
|
|
3
|
-
var
|
|
2
|
+
var ct = (_, g, t) => g in _ ? at(_, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[g] = t;
|
|
3
|
+
var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
|
-
import { UIElementType as
|
|
5
|
+
import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { CommonControl as ut } from "../../../common-control.js";
|
|
7
|
-
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as
|
|
7
|
+
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as z, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as G, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
8
8
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
9
|
-
import { RecommendationConfigService as
|
|
9
|
+
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
11
11
|
import { ATTRIBUTE_CELL_CLASS as bt, gridElementRenderer as yt, DEFAULT_CELL_PADDING as Tt, buildFillerCell as Ct } from "../../templates/grid/elementRenderer.js";
|
|
12
12
|
import { listElementRenderer as St } from "../../templates/list/elementRenderer.js";
|
|
13
13
|
import { buildTitleRows as At, DEFAULT_TITLE_PARAGRAPH as It, DEFAULT_TITLE_TEXT as $t } from "../../templates/titleRows.js";
|
|
14
14
|
import { resolveInlinePriceOrder as vt, toDisplayName as Nt, toDisplayableAttributeValue as Et, buildElementRenderer as J } from "../../templates/utils.js";
|
|
15
|
-
import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as Lt, compositionKeyToProductAttr as k,
|
|
15
|
+
import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as Lt, compositionKeyToProductAttr as k, resolveRowVisibilityKeys as Ot, filterToProductAttrValue as C, findAttributeRow as Dt, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Ht, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
|
|
16
16
|
import { getTableDisplayValue as Pt } from "../../utils/tagName.js";
|
|
17
17
|
import { isPartnerManagedBlock as wt, regenerateProductRowsWithStyles as Bt, getMainContainerTbody as kt, getCurrentLayout as Mt } from "../main/utils.js";
|
|
18
18
|
const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
|
|
19
19
|
ADD_ATTRIBUTE: "addAttribute"
|
|
20
|
-
},
|
|
20
|
+
}, b = 5, P = "reorderIcon_", qt = '<svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2.5" r="1.2"/><circle cx="7" cy="2.5" r="1.2"/><circle cx="12" cy="2.5" r="1.2"/><circle cx="2" cy="7.5" r="1.2"/><circle cx="7" cy="7.5" r="1.2"/><circle cx="12" cy="7.5" r="1.2"/></svg>', m = [
|
|
21
21
|
{ key: q, label: "Product Image" },
|
|
22
22
|
{ key: mt, label: "Product Name" },
|
|
23
|
-
{ key:
|
|
24
|
-
{ key:
|
|
23
|
+
{ key: p, label: "Product Price" },
|
|
24
|
+
{ key: I, label: "Product Original Price" },
|
|
25
25
|
{ key: ht, label: "Omnibus Price" },
|
|
26
26
|
{ key: pt, label: "Omnibus Discount" },
|
|
27
|
-
{ key:
|
|
28
|
-
],
|
|
27
|
+
{ key: F, label: "Product Button" }
|
|
28
|
+
], L = { key: $, label: "Title" }, Ft = new Set(m.map((_) => _.key)), A = "customAttr_", w = "deleteAttr_";
|
|
29
29
|
class se extends ut {
|
|
30
30
|
constructor() {
|
|
31
31
|
super(...arguments);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
v(this, "store", ft());
|
|
33
|
+
v(this, "unsubscribeStore", null);
|
|
34
|
+
v(this, "eventController", null);
|
|
35
35
|
/**
|
|
36
36
|
* Guard flag: when true, onTemplateNodeUpdated skips _initializeComposition.
|
|
37
37
|
* Used during _onReorder to prevent multiple intermediate rebuilds.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
v(this, "reorderInProgress", !1);
|
|
40
40
|
}
|
|
41
41
|
getId() {
|
|
42
42
|
return Ut;
|
|
@@ -50,7 +50,7 @@ class se extends ut {
|
|
|
50
50
|
${this._GuToggle(`visibility_${d.key}`)}
|
|
51
51
|
</div>
|
|
52
52
|
`).join(""), e = Array.from(
|
|
53
|
-
{ length:
|
|
53
|
+
{ length: b },
|
|
54
54
|
(d, c) => `
|
|
55
55
|
<div data-custom-select-key="${A}${c}" style="display: none;">
|
|
56
56
|
${this._GuSelect({
|
|
@@ -62,34 +62,34 @@ class se extends ut {
|
|
|
62
62
|
})}
|
|
63
63
|
</div>
|
|
64
64
|
`
|
|
65
|
-
).join(""), r = m.length +
|
|
65
|
+
).join(""), r = m.length + b, i = Array.from(
|
|
66
66
|
{ length: r },
|
|
67
67
|
(d, c) => `
|
|
68
68
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
69
|
-
<${
|
|
69
|
+
<${f.BUTTON}
|
|
70
70
|
class="guido-drag-handle-btn flat-inline flat-white"
|
|
71
71
|
${O.BUTTON.name}="${P}${c}"
|
|
72
72
|
>
|
|
73
|
-
<${
|
|
73
|
+
<${f.ICON}
|
|
74
74
|
src="reorder"
|
|
75
75
|
class="icon-button"
|
|
76
|
-
></${
|
|
77
|
-
</${
|
|
76
|
+
></${f.ICON}>
|
|
77
|
+
</${f.BUTTON}>
|
|
78
78
|
</div>
|
|
79
79
|
`
|
|
80
80
|
).join(""), s = Array.from(
|
|
81
|
-
{ length:
|
|
81
|
+
{ length: b },
|
|
82
82
|
(d, c) => `
|
|
83
83
|
<div data-custom-delete-key="${w}${c}" style="display: none;">
|
|
84
|
-
<${
|
|
84
|
+
<${f.BUTTON}
|
|
85
85
|
class="custom-attr-delete flat-inline flat-white"
|
|
86
86
|
${O.BUTTON.name}="${w}${c}"
|
|
87
87
|
>
|
|
88
|
-
<${
|
|
88
|
+
<${f.ICON}
|
|
89
89
|
src="delete"
|
|
90
90
|
class="icon-button"
|
|
91
|
-
></${
|
|
92
|
-
</${
|
|
91
|
+
></${f.ICON}>
|
|
92
|
+
</${f.BUTTON}>
|
|
93
93
|
</div>
|
|
94
94
|
`
|
|
95
95
|
).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
|
|
@@ -123,10 +123,10 @@ class se extends ut {
|
|
|
123
123
|
</div>
|
|
124
124
|
|
|
125
125
|
<div class="orderable-list">
|
|
126
|
-
<div class="orderable-item title-item" data-key="${
|
|
127
|
-
<span class="item-label">${this.api.translate(
|
|
126
|
+
<div class="orderable-item title-item" data-key="${L.key}">
|
|
127
|
+
<span class="item-label">${this.api.translate(L.label)}</span>
|
|
128
128
|
<div class="item-action">
|
|
129
|
-
${this._GuToggle(`visibility_${
|
|
129
|
+
${this._GuToggle(`visibility_${L.key}`)}
|
|
130
130
|
</div>
|
|
131
131
|
</div>
|
|
132
132
|
</div>
|
|
@@ -172,12 +172,12 @@ class se extends ut {
|
|
|
172
172
|
this.api.updateValues(s), i && this._initializeCustomSelects(e), this._updateAddButtonState();
|
|
173
173
|
}
|
|
174
174
|
_registerValueChangeListeners() {
|
|
175
|
-
[
|
|
175
|
+
[L, ...m].forEach((t) => {
|
|
176
176
|
this.api.onValueChanged(`visibility_${t.key}`, (e) => {
|
|
177
177
|
this._applyVisibilityToBlock(t.key, e);
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
|
-
for (let t = 0; t <
|
|
180
|
+
for (let t = 0; t < b; t++) {
|
|
181
181
|
const e = `${A}${t}`, r = t;
|
|
182
182
|
this.api.onValueChanged(e, (i) => {
|
|
183
183
|
this._onCustomAttributeChanged(r, i);
|
|
@@ -193,7 +193,7 @@ class se extends ut {
|
|
|
193
193
|
const t = this.currentNode.getAttribute(K);
|
|
194
194
|
if (t)
|
|
195
195
|
return this._normalizeComposition(t.split(",").filter(Boolean));
|
|
196
|
-
const { composition: e } =
|
|
196
|
+
const { composition: e } = T.getConfig(this.currentNode);
|
|
197
197
|
return e != null && e.length ? this._normalizeComposition([...e]) : [...Y];
|
|
198
198
|
}
|
|
199
199
|
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
@@ -214,19 +214,19 @@ class se extends ut {
|
|
|
214
214
|
} catch {
|
|
215
215
|
return [];
|
|
216
216
|
}
|
|
217
|
-
return this._readCompositionFromNode().filter((e) => e.startsWith(
|
|
217
|
+
return this._readCompositionFromNode().filter((e) => e.startsWith(N)).map(k);
|
|
218
218
|
}
|
|
219
219
|
_readVisibilityFromRows() {
|
|
220
220
|
if (!this.currentNode)
|
|
221
221
|
return this._getDefaultVisibilities();
|
|
222
|
-
const t = Array.from(this.currentNode.querySelectorAll(
|
|
222
|
+
const t = Array.from(this.currentNode.querySelectorAll(E)), e = this._extractVisibilityFromRows(t);
|
|
223
223
|
if (Object.keys(e).length > 0)
|
|
224
224
|
return this._withTitlePresence(this._mergeWithDefaults(e));
|
|
225
|
-
const r =
|
|
225
|
+
const r = T.getConfig(this.currentNode).visibility;
|
|
226
226
|
return this._withTitlePresence(this._mergeWithDefaults({ ...r }));
|
|
227
227
|
}
|
|
228
228
|
_withTitlePresence(t) {
|
|
229
|
-
return t[
|
|
229
|
+
return t[$] = this._hasTitle(), t;
|
|
230
230
|
}
|
|
231
231
|
_hasTitle() {
|
|
232
232
|
var t;
|
|
@@ -240,8 +240,10 @@ class se extends ut {
|
|
|
240
240
|
return t.forEach((r) => {
|
|
241
241
|
if (!("getAttribute" in r))
|
|
242
242
|
return;
|
|
243
|
-
const i =
|
|
244
|
-
i
|
|
243
|
+
const i = r.getAttribute(D);
|
|
244
|
+
i !== null && Ot(r).forEach((s) => {
|
|
245
|
+
e[s] = this._parseVisibilityValue(i);
|
|
246
|
+
});
|
|
245
247
|
}), e;
|
|
246
248
|
}
|
|
247
249
|
_parseVisibilityValue(t) {
|
|
@@ -253,7 +255,7 @@ class se extends ut {
|
|
|
253
255
|
}), t;
|
|
254
256
|
}
|
|
255
257
|
_buildVisibilityValues(t) {
|
|
256
|
-
return [
|
|
258
|
+
return [L, ...m].reduce((e, r) => (e[`visibility_${r.key}`] = t[r.key] ?? !0, e), {});
|
|
257
259
|
}
|
|
258
260
|
// ========================================================================
|
|
259
261
|
// UI Rendering (Orderable List)
|
|
@@ -270,22 +272,22 @@ class se extends ut {
|
|
|
270
272
|
const i = r.querySelector("[data-composition-list]");
|
|
271
273
|
if (!i)
|
|
272
274
|
return !1;
|
|
273
|
-
const s =
|
|
275
|
+
const s = this._isInlinePrices();
|
|
274
276
|
if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
|
|
275
277
|
return !1;
|
|
276
278
|
i.dataset.inlinePrices = String(s);
|
|
277
279
|
const n = new Set(e), l = vt(t);
|
|
278
280
|
let a = 0, d = 0;
|
|
279
281
|
const c = t.map((u) => {
|
|
280
|
-
if (s && (u ===
|
|
282
|
+
if (s && (u === p || u === I))
|
|
281
283
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
return this._createBuiltInItemHtml(
|
|
284
|
+
if (Ft.has(u)) {
|
|
285
|
+
const h = m.find((S) => S.key === u);
|
|
286
|
+
return this._createBuiltInItemHtml(h, d++);
|
|
285
287
|
}
|
|
286
|
-
if (u.startsWith(
|
|
287
|
-
const
|
|
288
|
-
if (n.has(
|
|
288
|
+
if (u.startsWith(N)) {
|
|
289
|
+
const h = k(u);
|
|
290
|
+
if (n.has(h))
|
|
289
291
|
return this._createCustomItemHtml(u, a++, d++);
|
|
290
292
|
}
|
|
291
293
|
return "";
|
|
@@ -306,7 +308,7 @@ class se extends ut {
|
|
|
306
308
|
if (i.length !== e.length)
|
|
307
309
|
return !1;
|
|
308
310
|
const s = [...i].sort().join(","), o = [...e].sort().join(",");
|
|
309
|
-
if (s !== o || e.some((a) => a.startsWith(
|
|
311
|
+
if (s !== o || e.some((a) => a.startsWith(N)))
|
|
310
312
|
return !1;
|
|
311
313
|
const n = /* @__PURE__ */ new Map();
|
|
312
314
|
r.forEach((a) => {
|
|
@@ -344,18 +346,18 @@ class se extends ut {
|
|
|
344
346
|
*/
|
|
345
347
|
_createPriceGroupItemHtml(t, e) {
|
|
346
348
|
var n, l;
|
|
347
|
-
const r = ((n = m.find((a) => a.key ===
|
|
349
|
+
const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === I)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
|
|
348
350
|
<div class="price-suborderable-item" draggable="true" data-subkey="${a}">
|
|
349
351
|
<span class="sub-drag-handle">${qt}</span>
|
|
350
352
|
<span class="item-label">${this.api.translate(d)}</span>
|
|
351
|
-
</div>`, o = e ? s(
|
|
353
|
+
</div>`, o = e ? s(I, i) + s(p, r) : s(p, r) + s(I, i);
|
|
352
354
|
return `
|
|
353
355
|
<div class="orderable-item price-group-item" draggable="true"
|
|
354
|
-
data-key="${
|
|
356
|
+
data-key="${p}" data-group="prices">
|
|
355
357
|
<div class="price-group-header">
|
|
356
358
|
<span class="guido-drag-handle" data-reorder-icon-slot="${t}"></span>
|
|
357
359
|
<span class="item-label">${this.api.translate("Product Prices")}</span>
|
|
358
|
-
<div class="item-action" data-action-for="${
|
|
360
|
+
<div class="item-action" data-action-for="${p}"></div>
|
|
359
361
|
</div>
|
|
360
362
|
<div class="price-suborderable-list">${o}</div>
|
|
361
363
|
</div>
|
|
@@ -395,13 +397,13 @@ class se extends ut {
|
|
|
395
397
|
const i = /* @__PURE__ */ new Map();
|
|
396
398
|
r.forEach((o) => i.set(o.attributeName, (i.get(o.attributeName) ?? 0) + 1));
|
|
397
399
|
const s = new Set(e);
|
|
398
|
-
return s.delete(t), r.filter((o) => !s.has(
|
|
400
|
+
return s.delete(t), r.filter((o) => !s.has(C(o))).map((o) => ({
|
|
399
401
|
text: this._toOptionLabel(
|
|
400
402
|
o.displayName,
|
|
401
403
|
o.type === "defaultAttribute",
|
|
402
404
|
(i.get(o.attributeName) ?? 0) > 1
|
|
403
405
|
),
|
|
404
|
-
value:
|
|
406
|
+
value: C(o)
|
|
405
407
|
}));
|
|
406
408
|
}
|
|
407
409
|
/**
|
|
@@ -463,7 +465,7 @@ class se extends ut {
|
|
|
463
465
|
* Same rescue pattern as _rescueTogglesToStore — prevents innerHTML from destroying them.
|
|
464
466
|
*/
|
|
465
467
|
_rescueSelectsToStore(t) {
|
|
466
|
-
for (let e = 0; e <
|
|
468
|
+
for (let e = 0; e < b; e++) {
|
|
467
469
|
const r = `${A}${e}`, i = t.querySelector(`[data-custom-select-key="${r}"]`), s = t.querySelector(`[data-custom-select-slot="${e}"]`);
|
|
468
470
|
if (s) {
|
|
469
471
|
const o = s.querySelector("ue-select");
|
|
@@ -489,7 +491,7 @@ class se extends ut {
|
|
|
489
491
|
* Same rescue pattern as _rescueSelectsToStore — prevents innerHTML from destroying them.
|
|
490
492
|
*/
|
|
491
493
|
_rescueDeleteButtonsToStore(t) {
|
|
492
|
-
for (let e = 0; e <
|
|
494
|
+
for (let e = 0; e < b; e++) {
|
|
493
495
|
const r = `${w}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
|
|
494
496
|
if (s) {
|
|
495
497
|
const o = s.querySelector("ue-button");
|
|
@@ -515,7 +517,7 @@ class se extends ut {
|
|
|
515
517
|
* Same rescue pattern as _rescueDeleteButtonsToStore — prevents innerHTML from destroying them.
|
|
516
518
|
*/
|
|
517
519
|
_rescueReorderIconsToStore(t) {
|
|
518
|
-
const e = m.length +
|
|
520
|
+
const e = m.length + b;
|
|
519
521
|
for (let r = 0; r < e; r++) {
|
|
520
522
|
const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
|
|
521
523
|
if (o) {
|
|
@@ -534,8 +536,8 @@ class se extends ut {
|
|
|
534
536
|
return;
|
|
535
537
|
const r = e.querySelector("[data-composition-list]"), i = e.querySelector("#guido__btn-add-attribute");
|
|
536
538
|
r && (this._setupDragAndDrop(r, t), this._setupDeleteHandler(r, t)), i && i.addEventListener("click", () => {
|
|
537
|
-
const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(
|
|
538
|
-
o && this._onAddAttribute(
|
|
539
|
+
const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(C(n)));
|
|
540
|
+
o && this._onAddAttribute(C(o), o.displayName);
|
|
539
541
|
}, { signal: t });
|
|
540
542
|
}
|
|
541
543
|
/**
|
|
@@ -646,11 +648,11 @@ class se extends ut {
|
|
|
646
648
|
this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
|
|
647
649
|
}
|
|
648
650
|
_onReorder(t) {
|
|
649
|
-
const e = t.filter((r) => r.startsWith(
|
|
651
|
+
const e = t.filter((r) => r.startsWith(N)).map(k);
|
|
650
652
|
this.reorderInProgress = !0;
|
|
651
653
|
try {
|
|
652
654
|
this._updateBothAttributes(t, e);
|
|
653
|
-
const r =
|
|
655
|
+
const r = this._isInlinePrices();
|
|
654
656
|
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Bt({
|
|
655
657
|
currentNode: this.currentNode,
|
|
656
658
|
documentModifier: this.api.getDocumentModifier()
|
|
@@ -673,7 +675,7 @@ class se extends ut {
|
|
|
673
675
|
if (r && "getOuterHTML" in r)
|
|
674
676
|
return Q(r.getOuterHTML(), e);
|
|
675
677
|
const i = t.querySelector(
|
|
676
|
-
`${
|
|
678
|
+
`${E}[${R}="${e}"]`
|
|
677
679
|
);
|
|
678
680
|
return i && "getOuterHTML" in i ? Q(i.getOuterHTML(), e) : "";
|
|
679
681
|
}
|
|
@@ -686,15 +688,15 @@ class se extends ut {
|
|
|
686
688
|
const s = this.currentNode.querySelectorAll(U);
|
|
687
689
|
if (!(s != null && s.length))
|
|
688
690
|
return;
|
|
689
|
-
const o =
|
|
691
|
+
const o = T.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
|
|
690
692
|
let c = 0;
|
|
691
693
|
s.forEach((u) => {
|
|
692
694
|
var V;
|
|
693
|
-
const
|
|
695
|
+
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, x = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
|
|
694
696
|
if (j === r) {
|
|
695
697
|
const st = Array.from(
|
|
696
698
|
{ length: B },
|
|
697
|
-
(
|
|
699
|
+
(xt, nt) => {
|
|
698
700
|
const lt = this._resolveAttributeContent(
|
|
699
701
|
t,
|
|
700
702
|
e,
|
|
@@ -703,14 +705,14 @@ class se extends ut {
|
|
|
703
705
|
return this._getGridCellHtml(
|
|
704
706
|
t,
|
|
705
707
|
lt,
|
|
706
|
-
|
|
708
|
+
x,
|
|
707
709
|
et,
|
|
708
710
|
rt,
|
|
709
711
|
l
|
|
710
712
|
);
|
|
711
713
|
}
|
|
712
|
-
).join(""), ot = Ct(
|
|
713
|
-
return `<tr class="${G}" ${
|
|
714
|
+
).join(""), ot = Ct(x, l).repeat(S - B);
|
|
715
|
+
return `<tr class="${G}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
714
716
|
}
|
|
715
717
|
return this._getExistingRowHtml(u, j);
|
|
716
718
|
}).join("");
|
|
@@ -721,7 +723,7 @@ class se extends ut {
|
|
|
721
723
|
const s = this.currentNode.querySelectorAll(Z);
|
|
722
724
|
if (!(s != null && s.length))
|
|
723
725
|
return;
|
|
724
|
-
const o = i.filter((l) => l !== q && l !==
|
|
726
|
+
const o = i.filter((l) => l !== q && l !== F), n = this.api.getDocumentModifier();
|
|
725
727
|
s.forEach((l, a) => {
|
|
726
728
|
const d = o.map((c) => {
|
|
727
729
|
if (c === r) {
|
|
@@ -748,7 +750,7 @@ class se extends ut {
|
|
|
748
750
|
r.modifyHtml(s).setInnerHtml(o);
|
|
749
751
|
});
|
|
750
752
|
} else {
|
|
751
|
-
const i = t.filter((o) => o !== q && o !==
|
|
753
|
+
const i = t.filter((o) => o !== q && o !== F), s = this.currentNode.querySelectorAll(Z);
|
|
752
754
|
s == null || s.forEach((o) => {
|
|
753
755
|
const n = this._buildCompositionHtml(o, i);
|
|
754
756
|
r.modifyHtml(o).setInnerHtml(n);
|
|
@@ -770,7 +772,7 @@ class se extends ut {
|
|
|
770
772
|
if (!this.currentNode)
|
|
771
773
|
return;
|
|
772
774
|
const r = {
|
|
773
|
-
...
|
|
775
|
+
...T.getConfig(this.currentNode),
|
|
774
776
|
composition: t
|
|
775
777
|
};
|
|
776
778
|
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(K, t.join(",")).setAttribute(W, JSON.stringify(e)).setNodeConfig(r).apply(new y(this.api.translate("Update card composition")));
|
|
@@ -804,37 +806,47 @@ class se extends ut {
|
|
|
804
806
|
_applyVisibilityToBlock(t, e) {
|
|
805
807
|
if (!this.currentNode)
|
|
806
808
|
return;
|
|
807
|
-
if (t ===
|
|
809
|
+
if (t === $) {
|
|
808
810
|
this._applyTitleVisibilityToBlock(e);
|
|
809
811
|
return;
|
|
810
812
|
}
|
|
811
|
-
const r = this.currentNode.querySelectorAll(`${
|
|
812
|
-
if (!
|
|
813
|
+
const r = this._resolveVisibilityKeys(t), { currentNode: i } = this, s = r.flatMap((c) => Array.from(i.querySelectorAll(`${E}[${R}="${c}"]`) ?? []));
|
|
814
|
+
if (!s.length)
|
|
813
815
|
return;
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
|
|
816
|
+
const o = e ? "1" : "0", n = e ? this.api.translate("visible") : this.api.translate("hidden"), l = `${this.api.translate("Set visibility")}: ${t} → ${n}`, a = this.api.getDocumentModifier();
|
|
817
|
+
s.forEach((c) => {
|
|
818
|
+
const u = Pt(c), h = e ? u : "none";
|
|
819
|
+
a.modifyHtml(c).setStyle("display", h).setAttribute(D, o);
|
|
818
820
|
});
|
|
819
|
-
const
|
|
820
|
-
...
|
|
821
|
-
visibility: {
|
|
821
|
+
const d = {
|
|
822
|
+
...T.getConfig(this.currentNode),
|
|
823
|
+
visibility: {
|
|
824
|
+
...this._readVisibilityFromRows(),
|
|
825
|
+
...Object.fromEntries(r.map((c) => [c, e]))
|
|
826
|
+
}
|
|
822
827
|
};
|
|
823
|
-
|
|
828
|
+
a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new y(l));
|
|
829
|
+
}
|
|
830
|
+
/** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
|
|
831
|
+
_resolveVisibilityKeys(t) {
|
|
832
|
+
return this._isInlinePrices() && t === p ? [p, I] : [t];
|
|
833
|
+
}
|
|
834
|
+
_isInlinePrices() {
|
|
835
|
+
return !T.getConfig(this.currentNode).priceMovedToNextLine;
|
|
824
836
|
}
|
|
825
837
|
_applyTitleVisibilityToBlock(t) {
|
|
826
|
-
const e =
|
|
838
|
+
const e = T.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
|
|
827
839
|
if (!this.currentNode || s)
|
|
828
840
|
return;
|
|
829
841
|
const o = this.api.getDocumentModifier();
|
|
830
842
|
r ? o.modifyHtml(r.containerBody).setInnerHtml(r.html) : i.forEach((l) => o.modifyHtml(l).delete()), o.modifyHtml(this.currentNode).setNodeConfig({
|
|
831
843
|
...e,
|
|
832
844
|
previousTitleHtml: t ? e.previousTitleHtml : this._readTitleHtml(i),
|
|
833
|
-
visibility: { ...this._readVisibilityFromRows(), [
|
|
845
|
+
visibility: { ...this._readVisibilityFromRows(), [$]: t }
|
|
834
846
|
});
|
|
835
847
|
const n = t ? this.api.translate("visible") : this.api.translate("hidden");
|
|
836
848
|
o.apply(new y(
|
|
837
|
-
`${this.api.translate("Set visibility")}: ${
|
|
849
|
+
`${this.api.translate("Set visibility")}: ${$} → ${n}`
|
|
838
850
|
));
|
|
839
851
|
}
|
|
840
852
|
_resolveTitleInjection(t) {
|
|
@@ -850,7 +862,7 @@ class se extends ut {
|
|
|
850
862
|
_findTitleRows() {
|
|
851
863
|
var e;
|
|
852
864
|
const t = Array.from(((e = this.currentNode) == null ? void 0 : e.querySelectorAll(
|
|
853
|
-
`${
|
|
865
|
+
`${E}[${R}="${$}"]`
|
|
854
866
|
)) ?? []);
|
|
855
867
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
856
868
|
}
|
|
@@ -884,7 +896,7 @@ class se extends ut {
|
|
|
884
896
|
_findNthCustomKeyIndex(t, e) {
|
|
885
897
|
let r = 0;
|
|
886
898
|
for (let i = 0; i < t.length; i++)
|
|
887
|
-
if (t[i].startsWith(
|
|
899
|
+
if (t[i].startsWith(N)) {
|
|
888
900
|
if (r === e)
|
|
889
901
|
return i;
|
|
890
902
|
r++;
|
|
@@ -944,7 +956,7 @@ class se extends ut {
|
|
|
944
956
|
* or when all available filters have already been added (no unused attributes left).
|
|
945
957
|
*/
|
|
946
958
|
_updateAddButtonState() {
|
|
947
|
-
const t = this._readCustomAttributesFromNode(), e = t.length >=
|
|
959
|
+
const t = this._readCustomAttributesFromNode(), e = t.length >= b, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(C(o)));
|
|
948
960
|
this.api.setUIEAttribute(
|
|
949
961
|
tt.ADD_ATTRIBUTE,
|
|
950
962
|
O.BUTTON.disabled,
|
|
@@ -977,7 +989,7 @@ class se extends ut {
|
|
|
977
989
|
_getAddableFilters() {
|
|
978
990
|
const t = /* @__PURE__ */ new Set();
|
|
979
991
|
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && gt.has(e.attributeName))).filter((e) => {
|
|
980
|
-
const r =
|
|
992
|
+
const r = C(e);
|
|
981
993
|
return t.has(r) ? !1 : (t.add(r), !0);
|
|
982
994
|
});
|
|
983
995
|
}
|
|
@@ -987,7 +999,7 @@ class se extends ut {
|
|
|
987
999
|
* resolve to their own entry. Falls back to Title Case of the bare name.
|
|
988
1000
|
*/
|
|
989
1001
|
_getDisplayNameForAttribute(t) {
|
|
990
|
-
const e = Object.values(this.store.filterList).find((r) =>
|
|
1002
|
+
const e = Object.values(this.store.filterList).find((r) => C(r) === t);
|
|
991
1003
|
return e ? e.displayName : Nt(H(t));
|
|
992
1004
|
}
|
|
993
1005
|
/**
|
|
@@ -1015,7 +1027,7 @@ class se extends ut {
|
|
|
1015
1027
|
[i]: e,
|
|
1016
1028
|
product_attributes: { [i]: e }
|
|
1017
1029
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1018
|
-
return `<tr class="${G}" ${
|
|
1030
|
+
return `<tr class="${G}" ${R}="${r}" ${D}="1">${l}</tr>`;
|
|
1019
1031
|
}
|
|
1020
1032
|
}
|
|
1021
1033
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { extractWrapperTags as
|
|
1
|
+
import { extractWrapperTags as A } from "../../../../utils/preserveTextStyles.js";
|
|
2
2
|
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
3
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
4
|
-
import { CSS_CLASS_TEXT_TRIM as
|
|
5
|
-
import { toCustomCompositionKey as
|
|
6
|
-
import {
|
|
7
|
-
import { hasQuerySelectorAll as
|
|
3
|
+
import { DESKTOP_CONTAINER_SELECTOR as b, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as y, ATTR_PRODUCT_OLD_PRICE as p, ATTR_PRODUCT_OMNIBUS_PRICE as R, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as x, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
|
|
4
|
+
import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
|
|
5
|
+
import { toCustomCompositionKey as U } from "../templates/utils.js";
|
|
6
|
+
import { resolveRowVisibilityKeys as N, isMergedInlinePriceRow as C } from "./compositionKeys.js";
|
|
7
|
+
import { hasQuerySelectorAll as I, hasGetAttribute as l, hasGetStyle as O, hasGetComputedStyle as M } from "./tagName.js";
|
|
8
8
|
const s = [
|
|
9
9
|
"font-size",
|
|
10
10
|
"font-family",
|
|
@@ -14,14 +14,14 @@ const s = [
|
|
|
14
14
|
"text-align",
|
|
15
15
|
"line-height",
|
|
16
16
|
"text-decoration"
|
|
17
|
-
],
|
|
17
|
+
], D = [
|
|
18
18
|
"background",
|
|
19
19
|
"background-color",
|
|
20
20
|
"border-width",
|
|
21
21
|
"border-color",
|
|
22
22
|
"border-style",
|
|
23
23
|
"border-radius"
|
|
24
|
-
],
|
|
24
|
+
], w = [
|
|
25
25
|
...s,
|
|
26
26
|
"background",
|
|
27
27
|
"background-color",
|
|
@@ -40,47 +40,47 @@ const s = [
|
|
|
40
40
|
"border-radius",
|
|
41
41
|
"margin"
|
|
42
42
|
], g = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), L = [
|
|
43
|
-
{ attrKey:
|
|
44
|
-
{ attrKey:
|
|
45
|
-
{ attrKey:
|
|
46
|
-
{ attrKey:
|
|
47
|
-
{ attrKey:
|
|
48
|
-
{ attrKey:
|
|
43
|
+
{ attrKey: k, blockId: c.NAME, kind: "text" },
|
|
44
|
+
{ attrKey: y, blockId: c.PRICE, kind: "text" },
|
|
45
|
+
{ attrKey: p, blockId: c.OLD_PRICE, kind: "text" },
|
|
46
|
+
{ attrKey: R, blockId: c.OMNIBUS_PRICE, kind: "text" },
|
|
47
|
+
{ attrKey: _, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
|
|
48
|
+
{ attrKey: x, blockId: c.BUTTON, kind: "button" },
|
|
49
49
|
{ attrKey: q, blockId: c.IMAGE, kind: "image" }
|
|
50
50
|
];
|
|
51
|
-
function
|
|
51
|
+
function h(t) {
|
|
52
52
|
return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function K(t) {
|
|
55
55
|
return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
|
|
56
56
|
}
|
|
57
57
|
function a(t, e, r) {
|
|
58
|
-
!e || !
|
|
58
|
+
!e || !O(e) || r.forEach((n) => {
|
|
59
59
|
const o = e.getStyle(n);
|
|
60
60
|
o && o !== "inherit" && o !== "initial" && (t[n] = o);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function E(t) {
|
|
64
64
|
return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
if (!t || !
|
|
66
|
+
function P(t) {
|
|
67
|
+
if (!t || !O(t))
|
|
68
68
|
return;
|
|
69
69
|
const e = t.getStyle("background-color") || t.getStyle("background");
|
|
70
70
|
return e && !g.has(e) ? e : void 0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function S(t, e) {
|
|
73
73
|
const r = {};
|
|
74
|
-
return a(r, t, e),
|
|
74
|
+
return a(r, t, e), E(r);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function $(t) {
|
|
77
77
|
const e = t.querySelector("p"), r = {};
|
|
78
78
|
a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
|
|
79
|
-
const n =
|
|
79
|
+
const n = E(r), { openTags: o, closeTags: i } = A(h(e));
|
|
80
80
|
return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n =
|
|
82
|
+
function H(t) {
|
|
83
|
+
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = S(e, D), o = S(r, w), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = A(h(r)), m = K(r);
|
|
84
84
|
return !n && !o && !u && !T && !m ? null : {
|
|
85
85
|
buttonBorderStyle: n || void 0,
|
|
86
86
|
buttonAnchorStyle: o || void 0,
|
|
@@ -90,44 +90,44 @@ function $(t) {
|
|
|
90
90
|
closeTags: d
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
93
|
+
function F(t) {
|
|
94
|
+
const e = S(t.querySelector("img"), G);
|
|
95
95
|
return e ? { imgStyle: e } : null;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return e === "button" ?
|
|
97
|
+
function j(t, e) {
|
|
98
|
+
return e === "button" ? H(t) : e === "image" ? F(t) : $(t);
|
|
99
99
|
}
|
|
100
100
|
function f(t, e) {
|
|
101
101
|
if (!t || !("querySelector" in t))
|
|
102
102
|
return;
|
|
103
|
-
const r = t.querySelector(
|
|
103
|
+
const r = t.querySelector(b) ?? t;
|
|
104
104
|
if (L.forEach(({ attrKey: i, blockId: u, kind: T }) => {
|
|
105
105
|
const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
|
|
106
106
|
d && e(d, i, T);
|
|
107
|
-
}), !
|
|
107
|
+
}), !I(r))
|
|
108
108
|
return;
|
|
109
109
|
const n = /* @__PURE__ */ new Set();
|
|
110
110
|
r.querySelectorAll(
|
|
111
111
|
`[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
|
|
112
112
|
).forEach((i) => {
|
|
113
|
-
const u = l(i) ? i.getAttribute(
|
|
114
|
-
!u || n.has(u) || (n.add(u), e(i,
|
|
113
|
+
const u = l(i) ? i.getAttribute(v) : null;
|
|
114
|
+
!u || n.has(u) || (n.add(u), e(i, U(u), "text"));
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function V(t) {
|
|
118
118
|
const e = {};
|
|
119
119
|
return f(t, (r, n, o) => {
|
|
120
120
|
if (!("querySelector" in r))
|
|
121
121
|
return;
|
|
122
|
-
const i =
|
|
122
|
+
const i = j(r, o);
|
|
123
123
|
i && (e[n] = i);
|
|
124
124
|
}), e;
|
|
125
125
|
}
|
|
126
126
|
function X(t) {
|
|
127
127
|
if (!t || !("querySelector" in t))
|
|
128
128
|
return;
|
|
129
|
-
const e = t.querySelector(
|
|
130
|
-
return
|
|
129
|
+
const e = t.querySelector(b) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
|
|
130
|
+
return P(r);
|
|
131
131
|
}
|
|
132
132
|
function z(t) {
|
|
133
133
|
if (!t)
|
|
@@ -135,10 +135,10 @@ function z(t) {
|
|
|
135
135
|
const e = l(t) ? t.getAttribute("bgcolor") : null;
|
|
136
136
|
if (e && !g.has(e))
|
|
137
137
|
return e;
|
|
138
|
-
const r =
|
|
138
|
+
const r = P(t);
|
|
139
139
|
if (r)
|
|
140
140
|
return r;
|
|
141
|
-
const n =
|
|
141
|
+
const n = M(t) ? t.getComputedStyle("background-color") : void 0;
|
|
142
142
|
return n && !g.has(n) ? n : void 0;
|
|
143
143
|
}
|
|
144
144
|
function Q(t) {
|
|
@@ -150,7 +150,7 @@ function Q(t) {
|
|
|
150
150
|
i && (e[n] = i);
|
|
151
151
|
}), e;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function W(t) {
|
|
154
154
|
const e = {};
|
|
155
155
|
return f(t, (r, n, o) => {
|
|
156
156
|
if (o === "image")
|
|
@@ -159,68 +159,70 @@ function V(t) {
|
|
|
159
159
|
i && (e[n] = i);
|
|
160
160
|
}), e;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
function
|
|
162
|
+
const Y = /^es-[pm]\d+[trbl]?$/;
|
|
163
|
+
function J(t) {
|
|
164
164
|
const e = l(t) ? t.getAttribute("class") : null;
|
|
165
165
|
if (!e)
|
|
166
166
|
return;
|
|
167
|
-
const r = e.split(/\s+/).filter((n) =>
|
|
167
|
+
const r = e.split(/\s+/).filter((n) => Y.test(n) || n === B);
|
|
168
168
|
return r.length ? r.join(" ") : void 0;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Z(t) {
|
|
171
171
|
if (!t || !("querySelector" in t))
|
|
172
172
|
return !1;
|
|
173
|
-
const e = t.querySelector(
|
|
174
|
-
return
|
|
173
|
+
const e = t.querySelector(b) ?? t;
|
|
174
|
+
return C(e.querySelector(`[data-attribute-type="${y}"]`)) || C(e.querySelector(`[data-attribute-type="${p}"]`));
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
const e = {}, r =
|
|
176
|
+
function tt(t) {
|
|
177
|
+
const e = {}, r = Z(t);
|
|
178
178
|
return f(t, (n, o, i) => {
|
|
179
|
-
if (i === "image" || r && (o ===
|
|
179
|
+
if (i === "image" || r && (o === y || o === p))
|
|
180
180
|
return;
|
|
181
|
-
const u =
|
|
181
|
+
const u = J(n);
|
|
182
182
|
u && (e[o] = u);
|
|
183
183
|
}), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function et(t) {
|
|
186
186
|
const e = {};
|
|
187
187
|
return f(t, (r, n) => {
|
|
188
|
-
if (n !==
|
|
188
|
+
if (n !== R && n !== _ || !l(r))
|
|
189
189
|
return;
|
|
190
190
|
const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
|
|
191
191
|
(o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
|
|
192
192
|
}), e;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function rt(t) {
|
|
195
195
|
const e = {};
|
|
196
196
|
if (!t || !("querySelector" in t))
|
|
197
197
|
return e;
|
|
198
|
-
const r = t.querySelector(
|
|
199
|
-
return
|
|
198
|
+
const r = t.querySelector(b) ?? t;
|
|
199
|
+
return I(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
|
|
200
200
|
if (!l(n))
|
|
201
201
|
return;
|
|
202
|
-
const o =
|
|
203
|
-
o
|
|
202
|
+
const o = n.getAttribute("data-visibility");
|
|
203
|
+
o != null && N(n).forEach((i) => {
|
|
204
|
+
e[i] = o !== "0";
|
|
205
|
+
});
|
|
204
206
|
}), e;
|
|
205
207
|
}
|
|
206
|
-
function
|
|
208
|
+
function lt(t) {
|
|
207
209
|
return {
|
|
208
|
-
styleTemplates:
|
|
210
|
+
styleTemplates: V(t),
|
|
209
211
|
cardBackgroundColor: X(t),
|
|
210
212
|
cellBackgroundColors: Q(t),
|
|
211
|
-
cellAlignments:
|
|
212
|
-
cellClasses:
|
|
213
|
-
omnibusTexts:
|
|
214
|
-
visibility:
|
|
213
|
+
cellAlignments: W(t),
|
|
214
|
+
cellClasses: tt(t),
|
|
215
|
+
omnibusTexts: et(t),
|
|
216
|
+
visibility: rt(t)
|
|
215
217
|
};
|
|
216
218
|
}
|
|
217
219
|
export {
|
|
218
|
-
|
|
220
|
+
V as captureAttributeStyleTemplates,
|
|
219
221
|
X as captureCardBackgroundColor,
|
|
220
|
-
|
|
222
|
+
W as captureCellAlignments,
|
|
221
223
|
Q as captureCellBackgroundColors,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
tt as captureCellClasses,
|
|
225
|
+
et as captureOmnibusTexts,
|
|
226
|
+
lt as captureStyles,
|
|
227
|
+
rt as captureVisibility
|
|
226
228
|
};
|
|
@@ -1,89 +1,98 @@
|
|
|
1
|
-
import { ATTR_CUSTOM_PREFIX as
|
|
2
|
-
function
|
|
3
|
-
return !t.startsWith(
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as o, ATTR_PRODUCT_PRICE as g, ATTR_PRODUCT_OLD_PRICE as d, PRODUCT_ATTRIBUTE_PREFIX as a, ATTR_DATA_ATTRIBUTE_TYPE as f, ATTR_PRODUCT_ATTR as c, SELECTOR_ATTRIBUTE_ROW as y } from "../constants/selectors.js";
|
|
2
|
+
function q(t) {
|
|
3
|
+
return !t.startsWith(a);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return t.startsWith(
|
|
7
|
-
}
|
|
8
|
-
function T(t) {
|
|
9
|
-
return t.startsWith(s) ? t.substring(s.length) : t;
|
|
5
|
+
function $(t) {
|
|
6
|
+
return t.startsWith(a) ? t.substring(a.length) : t;
|
|
10
7
|
}
|
|
11
8
|
function A(t) {
|
|
12
|
-
return
|
|
9
|
+
return t.startsWith(o) ? t.substring(o.length) : t;
|
|
10
|
+
}
|
|
11
|
+
function T(t) {
|
|
12
|
+
return `${o}${t}`;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return t.type === "defaultAttribute" ? t.attributeName : `${
|
|
14
|
+
function C(t) {
|
|
15
|
+
return t.type === "defaultAttribute" ? t.attributeName : `${a}${t.attributeName}`;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function h(t, r) {
|
|
18
18
|
const n = Object.values(r).filter((e) => e.attributeName === t);
|
|
19
19
|
return n.find((e) => e.type === "defaultAttribute") ?? n[0];
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function l(t, r) {
|
|
22
22
|
return t && "getAttribute" in t ? t.getAttribute(r) : null;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const e = `${
|
|
26
|
-
`${
|
|
27
|
-
),
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
30
|
-
const
|
|
31
|
-
return
|
|
24
|
+
function S(t, r, n = {}) {
|
|
25
|
+
const e = `${o}${t}`, u = r == null ? void 0 : r.querySelector(
|
|
26
|
+
`${y}[${f}="${e}"]`
|
|
27
|
+
), i = l(u, c) ?? l(u == null ? void 0 : u.querySelector(`[${c}]`), c);
|
|
28
|
+
if (i)
|
|
29
|
+
return i;
|
|
30
|
+
const s = h(t, n);
|
|
31
|
+
return s ? C(s) : t;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return t.startsWith(
|
|
33
|
+
function P(t, r, n = {}) {
|
|
34
|
+
return t.startsWith(a) ? t : S(t, r, n);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function O(t, r, n = {}) {
|
|
37
37
|
return t.map((e) => {
|
|
38
|
-
if (!e.startsWith(
|
|
38
|
+
if (!e.startsWith(o))
|
|
39
39
|
return e;
|
|
40
|
-
const u =
|
|
41
|
-
return
|
|
40
|
+
const u = A(e);
|
|
41
|
+
return T(P(u, r, n));
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return t.map((e) =>
|
|
44
|
+
function p(t, r, n = {}) {
|
|
45
|
+
return t.map((e) => P(e, r, n));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const r =
|
|
49
|
-
if (!(r != null && r.startsWith(
|
|
47
|
+
function b(t) {
|
|
48
|
+
const r = l(t, f);
|
|
49
|
+
if (!(r != null && r.startsWith(o)))
|
|
50
50
|
return r;
|
|
51
|
-
const n = "querySelector" in t ? t.querySelector(`[${
|
|
52
|
-
return e ?
|
|
51
|
+
const n = "querySelector" in t ? t.querySelector(`[${c}]`) : void 0, e = l(n, c);
|
|
52
|
+
return e ? T(e) : r;
|
|
53
|
+
}
|
|
54
|
+
function m(t) {
|
|
55
|
+
return !!(t && "querySelector" in t && t.querySelector(".product-price") && t.querySelector(".product-old-price"));
|
|
56
|
+
}
|
|
57
|
+
function D(t) {
|
|
58
|
+
const r = b(t);
|
|
59
|
+
return r ? m(t) ? [g, d] : [r] : [];
|
|
53
60
|
}
|
|
54
|
-
function
|
|
55
|
-
const e =
|
|
56
|
-
return
|
|
61
|
+
function R(t, r, n) {
|
|
62
|
+
const e = l(t, c), u = l(t.querySelector(`[${c}]`), c), i = e ?? u;
|
|
63
|
+
return i === null ? n : i === r;
|
|
57
64
|
}
|
|
58
|
-
function
|
|
59
|
-
const n = (
|
|
60
|
-
`${
|
|
65
|
+
function I(t, r) {
|
|
66
|
+
const n = (_) => t.querySelector(
|
|
67
|
+
`${y}[${f}="${_}"]`
|
|
61
68
|
);
|
|
62
|
-
if (!r.startsWith(
|
|
69
|
+
if (!r.startsWith(o))
|
|
63
70
|
return n(r) ?? null;
|
|
64
|
-
const e =
|
|
65
|
-
if (u &&
|
|
71
|
+
const e = A(r), u = n(r);
|
|
72
|
+
if (u && R(u, e, !0))
|
|
66
73
|
return u;
|
|
67
|
-
const
|
|
68
|
-
return
|
|
74
|
+
const i = T($(e)), s = i === r ? void 0 : n(i);
|
|
75
|
+
return s && R(s, e, !1) ? s : null;
|
|
69
76
|
}
|
|
70
|
-
function
|
|
71
|
-
const n =
|
|
77
|
+
function U(t, r) {
|
|
78
|
+
const n = A(r), e = T($(n));
|
|
72
79
|
return e === r ? t : t.replace(
|
|
73
|
-
`${
|
|
74
|
-
`${
|
|
80
|
+
`${f}="${e}"`,
|
|
81
|
+
`${f}="${r}"`
|
|
75
82
|
);
|
|
76
83
|
}
|
|
77
84
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
$ as bareAttributeName,
|
|
86
|
+
A as compositionKeyToProductAttr,
|
|
87
|
+
C as filterToProductAttrValue,
|
|
88
|
+
I as findAttributeRow,
|
|
89
|
+
h as findFilterByBareName,
|
|
90
|
+
q as isDefaultProductAttr,
|
|
91
|
+
m as isMergedInlinePriceRow,
|
|
92
|
+
O as normalizeCompositionKeys,
|
|
93
|
+
p as normalizeCustomAttrValues,
|
|
94
|
+
T as productAttrToCompositionKey,
|
|
95
|
+
b as resolveRowCompositionKey,
|
|
96
|
+
D as resolveRowVisibilityKeys,
|
|
97
|
+
U as rewriteLegacyRowKeyHtml
|
|
89
98
|
};
|
|
@@ -15,3 +15,8 @@ export declare function wrapHiddenPriceTdsForOutlook(html: string): string;
|
|
|
15
15
|
* dropped so it keeps its column width (a pin there overflows 33%/50% columns).
|
|
16
16
|
*/
|
|
17
17
|
export declare function normalizeItemsBlockWidths(html: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* The mobile `.adapt-img { width: 100% }` rule sizes the horizontal thumbnail by its auto-width column,
|
|
20
|
+
* so it grows in a roomy row and collapses to nothing in a crowded one — bound it to [default, width].
|
|
21
|
+
*/
|
|
22
|
+
export declare function lockHorizontalItemImageWidths(html: string): string;
|
|
@@ -189,6 +189,9 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
189
189
|
*/
|
|
190
190
|
private _buildCompositionHtml;
|
|
191
191
|
private _applyVisibilityToBlock;
|
|
192
|
+
/** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
|
|
193
|
+
private _resolveVisibilityKeys;
|
|
194
|
+
private _isInlinePrices;
|
|
192
195
|
private _applyTitleVisibilityToBlock;
|
|
193
196
|
private _resolveTitleInjection;
|
|
194
197
|
private _readTitleHtml;
|
|
@@ -33,6 +33,10 @@ export declare function normalizeCustomAttrValues(values: string[], blockNode?:
|
|
|
33
33
|
* value, which stays correct on rows still tagged with a legacy bare name.
|
|
34
34
|
*/
|
|
35
35
|
export declare function resolveRowCompositionKey(row: ImmutableHtmlNode): string | null;
|
|
36
|
+
/** Inline price mode renders sale + original price in ONE row, tagged with whichever comes first. */
|
|
37
|
+
export declare function isMergedInlinePriceRow(row: ImmutableHtmlNode | null | undefined): boolean;
|
|
38
|
+
/** Keys whose visibility a row carries: the merged inline price row stands for both prices. */
|
|
39
|
+
export declare function resolveRowVisibilityKeys(row: ImmutableHtmlNode): string[];
|
|
36
40
|
/**
|
|
37
41
|
* Finds an attribute row by composition key, tolerating rows still tagged with the
|
|
38
42
|
* legacy bare-name key. Custom candidates are validated against their `product-attr`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.20.1
|
|
3
|
+
"version": "3.20.1",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|