@useinsider/guido 3.14.0-beta.38ef0be → 3.14.0-beta.5d003b0
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/composables/useHtmlValidator.js +106 -111
- package/dist/config/compiler/itemsCompilerRules.js +4 -25
- package/dist/config/migrator/index.js +8 -9
- package/dist/config/migrator/itemsBlockMigrator.js +45 -47
- package/dist/extensions/Blocks/Items/block.js +30 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +16 -16
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +22 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +35 -36
- package/dist/extensions/Blocks/Items/template.js +263 -228
- package/dist/src/extensions/Blocks/Items/block.d.ts +1 -1
- package/dist/utils/pairProductVariables.js +72 -75
- package/package.json +1 -1
- package/dist/config/compiler/utils/itemsCompilerUtils.js +0 -28
- package/dist/config/migrator/productNameLinkMigrator.js +0 -27
- package/dist/extensions/Blocks/Items/utils/nameNode.js +0 -4
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +0 -12
- package/dist/src/config/migrator/productNameLinkMigrator.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/utils/nameNode.d.ts +0 -9
- package/dist/src/utils/unwrapProductNameLink.d.ts +0 -15
- package/dist/utils/unwrapProductNameLink.js +0 -37
|
@@ -34,7 +34,7 @@ export declare class ItemsBlock extends Block {
|
|
|
34
34
|
*/
|
|
35
35
|
onDocumentChanged(node: ImmutableHtmlNode): void;
|
|
36
36
|
/**
|
|
37
|
-
* Bakes the compiler-read DOM attributes (`data-type`, `data-number
|
|
37
|
+
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
|
|
38
38
|
* `.ins-product-td` container from the recovered config. Required for saved modules:
|
|
39
39
|
* `migrate()` (which backfills these) only runs at template load — never when a module
|
|
40
40
|
* is dropped into a live editor — so this is the one place the namespace + index get
|
|
@@ -1,88 +1,85 @@
|
|
|
1
|
-
import { productPairs as
|
|
1
|
+
import { productPairs as N } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
2
|
import { DefaultConfigValues as O } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
3
3
|
import { preserveTextStyles as C } from "./preserveTextStyles.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
b.querySelectorAll(".ins-product-td").forEach((l) => {
|
|
11
|
-
const h = l.getAttribute("data-number") || "1", $ = l.getAttribute("data-type") || "CART_ITEMS";
|
|
12
|
-
l.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
4
|
+
function V(L) {
|
|
5
|
+
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), g = new DOMParser().parseFromString(H, "text/html"), m = N.PAIRS_FOR_EXTENSION;
|
|
6
|
+
Object.entries(m).forEach(([r, f]) => {
|
|
7
|
+
g.querySelectorAll(".ins-product-td").forEach((c) => {
|
|
8
|
+
const A = c.getAttribute("data-number") || "1", y = c.getAttribute("data-type") || "CART_ITEMS";
|
|
9
|
+
c.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
13
10
|
var F, I, w;
|
|
14
|
-
const T = t.getAttribute("data-type") ||
|
|
11
|
+
const T = t.getAttribute("data-type") || y, u = t.getAttribute("data-number") || A, d = f[T];
|
|
15
12
|
if (d)
|
|
16
13
|
switch (r) {
|
|
17
14
|
case "imageSrc": {
|
|
18
|
-
let e = null,
|
|
19
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
15
|
+
let e = null, i = null;
|
|
16
|
+
if (t.tagName === "IMG" ? (e = t, i = e.closest("a")) : (e = t.querySelector("img"), i = t.querySelector("a") || t.closest("a")), !e)
|
|
20
17
|
break;
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
18
|
+
const a = d.DEFAULT, s = d.ATTR;
|
|
19
|
+
if (a && e.src) {
|
|
23
20
|
const o = e.src;
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
return o.includes(
|
|
27
|
-
}) && (e.src = `{{${
|
|
21
|
+
a.some((h) => {
|
|
22
|
+
const l = h.split("/").pop() || "", $ = o.split("/").pop() || "";
|
|
23
|
+
return o.includes(h) || o.includes(l) || $ === l;
|
|
24
|
+
}) && (e.src = `{{${s}_${u}}}`);
|
|
28
25
|
}
|
|
29
|
-
const n = (I = (F =
|
|
30
|
-
if (n && e.setAttribute("alt", `{{${n}_${
|
|
31
|
-
const o = (w =
|
|
26
|
+
const n = (I = (F = m.name) == null ? void 0 : F[T]) == null ? void 0 : I.ATTR;
|
|
27
|
+
if (n && e.setAttribute("alt", `{{${n}_${u}}}`), i) {
|
|
28
|
+
const o = (w = m.itemLink) == null ? void 0 : w[T];
|
|
32
29
|
if (o) {
|
|
33
|
-
const
|
|
34
|
-
(
|
|
30
|
+
const E = o.HREF, h = o.DEFAULT_HREF || "#!", l = i.href;
|
|
31
|
+
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${u}}}`);
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
break;
|
|
38
35
|
}
|
|
39
36
|
case "name": {
|
|
40
|
-
const e = d,
|
|
41
|
-
t.textContent && (t.innerHTML = C(t, `{{${
|
|
37
|
+
const e = d, i = e.ATTR, a = e.DEFAULT_HREF || "#!", s = e.HREF;
|
|
38
|
+
t.textContent && (t.innerHTML = C(t, `{{${i}_${u}}}`));
|
|
42
39
|
const n = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
43
|
-
if (n &&
|
|
44
|
-
const o = n.href,
|
|
45
|
-
(o ===
|
|
40
|
+
if (n && s) {
|
|
41
|
+
const o = n.href, E = `${window.location.href}${a}`;
|
|
42
|
+
(o === E || o.endsWith(a)) && (n.href = `{{${s}_${u}}}`);
|
|
46
43
|
}
|
|
47
44
|
break;
|
|
48
45
|
}
|
|
49
46
|
case "price":
|
|
50
47
|
case "originalPrice": {
|
|
51
|
-
const e = d,
|
|
52
|
-
let
|
|
53
|
-
n ?
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
const
|
|
57
|
-
let
|
|
58
|
-
|
|
48
|
+
const e = d, i = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), s = i === "true", n = a === "true", o = t.getAttribute("data-curency") || "before";
|
|
49
|
+
let E;
|
|
50
|
+
n ? E = s ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : E = s ? e.PRICE_FORMATTED : e.PRICE;
|
|
51
|
+
const h = e.CURRENCY;
|
|
52
|
+
let l = `{{${E}_${u}}}`;
|
|
53
|
+
const $ = (t.getAttribute("data-currency_symbol") || "").trim(), q = $ !== "" && $ !== O.productPriceCurrencySymbolControlValue;
|
|
54
|
+
let b = "";
|
|
55
|
+
q ? b = $ : h && (b = `{{${h}_${u}}}`), b && (l = o === "after" ? `${l} ${b}` : `${b} ${l}`), t.innerHTML = C(t, l);
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
61
58
|
case "quantity": {
|
|
62
|
-
const e = d,
|
|
63
|
-
t.textContent && t.textContent.trim() ===
|
|
59
|
+
const e = d, i = e.ATTR, a = e.DEFAULT;
|
|
60
|
+
t.textContent && t.textContent.trim() === a && (t.innerHTML = C(t, `{{${i}_${u}}}`));
|
|
64
61
|
break;
|
|
65
62
|
}
|
|
66
63
|
case "button": {
|
|
67
|
-
const e = d,
|
|
68
|
-
if (
|
|
69
|
-
const n =
|
|
70
|
-
(n === "" || n === "#" || n === o || n.endsWith(
|
|
64
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t.tagName === "A" ? t : t.querySelector("a");
|
|
65
|
+
if (s) {
|
|
66
|
+
const n = s.href || "", o = `${window.location.href}${a}`;
|
|
67
|
+
(n === "" || n === "#" || n === o || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${u}}}`);
|
|
71
68
|
}
|
|
72
69
|
break;
|
|
73
70
|
}
|
|
74
71
|
case "itemLink": {
|
|
75
|
-
const e = d,
|
|
76
|
-
if (
|
|
77
|
-
const n =
|
|
78
|
-
(n === o || n.endsWith(
|
|
72
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t;
|
|
73
|
+
if (s.href) {
|
|
74
|
+
const n = s.href, o = `${window.location.href}${a}`;
|
|
75
|
+
(n === o || n.endsWith(a)) && (s.href = `{{${i}_${u}}}`);
|
|
79
76
|
}
|
|
80
77
|
break;
|
|
81
78
|
}
|
|
82
79
|
default: {
|
|
83
80
|
if ("ATTR" in d) {
|
|
84
81
|
const e = d.ATTR;
|
|
85
|
-
t.textContent && (t.innerHTML = C(t, `{{${e}_${
|
|
82
|
+
t.textContent && (t.innerHTML = C(t, `{{${e}_${u}}}`));
|
|
86
83
|
}
|
|
87
84
|
break;
|
|
88
85
|
}
|
|
@@ -91,54 +88,54 @@ function Y(L) {
|
|
|
91
88
|
});
|
|
92
89
|
});
|
|
93
90
|
const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
|
|
94
|
-
` : "", D =
|
|
91
|
+
` : "", D = g.querySelectorAll(".ins-product-td"), M = [];
|
|
95
92
|
D.forEach((r) => {
|
|
96
|
-
const
|
|
93
|
+
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
97
94
|
M.push({
|
|
98
95
|
element: r,
|
|
99
|
-
outerHtml:
|
|
100
|
-
type:
|
|
101
|
-
number: p
|
|
96
|
+
outerHtml: A,
|
|
97
|
+
type: f,
|
|
98
|
+
number: p,
|
|
99
|
+
nodup: c || void 0
|
|
102
100
|
});
|
|
103
101
|
});
|
|
104
|
-
let _ = P +
|
|
105
|
-
M.reverse().forEach(({ outerHtml: r, type:
|
|
106
|
-
let
|
|
107
|
-
switch (
|
|
102
|
+
let _ = P + g.documentElement.outerHTML;
|
|
103
|
+
M.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
104
|
+
let c = "";
|
|
105
|
+
switch (f) {
|
|
108
106
|
case "CART_ITEMS":
|
|
109
|
-
|
|
107
|
+
c = "ins_apr_total_product_kind";
|
|
110
108
|
break;
|
|
111
109
|
case "BROWSED_ITEMS":
|
|
112
|
-
|
|
110
|
+
c = "browsed_item_total_product_kind";
|
|
113
111
|
break;
|
|
114
112
|
case "PURCHASED_ITEMS":
|
|
115
|
-
|
|
113
|
+
c = "purchased_item_total_product_kind";
|
|
116
114
|
break;
|
|
117
115
|
}
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
116
|
+
if (c) {
|
|
117
|
+
const y = parseInt(p) - 1, T = `${`{% if ${c} > ${y} %}`}${r}{% endif %}`;
|
|
120
118
|
_ = _.replace(r, T);
|
|
121
119
|
}
|
|
122
120
|
});
|
|
123
|
-
const x =
|
|
121
|
+
const x = g.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
124
122
|
return x.forEach((r) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (!u || p !== "CART_ITEMS" || (($ = r.closest(".ins-product-td")) == null ? void 0 : $.getAttribute("data-nodup")) === "false")
|
|
123
|
+
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
124
|
+
if (!f || p !== "CART_ITEMS")
|
|
128
125
|
return;
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
|
|
126
|
+
const c = r.closest(".product-original-price-class");
|
|
127
|
+
if (c) {
|
|
128
|
+
const A = c.outerHTML;
|
|
129
|
+
R.some((S) => S.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
|
|
133
130
|
}
|
|
134
|
-
}),
|
|
135
|
-
const p = `{% if ins_apr_price_${
|
|
131
|
+
}), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
|
|
132
|
+
const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
|
|
136
133
|
if (!_.includes(p) && !r.includes("{% if")) {
|
|
137
|
-
const
|
|
138
|
-
_ = _.replace(r,
|
|
134
|
+
const A = `${p}${r}{% endif %}`;
|
|
135
|
+
_ = _.replace(r, A);
|
|
139
136
|
}
|
|
140
137
|
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
141
138
|
}
|
|
142
139
|
export {
|
|
143
|
-
|
|
140
|
+
V as pairProductVariables
|
|
144
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.14.0-beta.
|
|
3
|
+
"version": "3.14.0-beta.5d003b0",
|
|
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",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const p = "MSO_ITEMS_HIDE_START", E = "MSO_ITEMS_HIDE_END", u = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", _ = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price";
|
|
2
|
-
function T(t) {
|
|
3
|
-
if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
|
|
4
|
-
return t;
|
|
5
|
-
const i = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(i, "text/html");
|
|
6
|
-
let n = !1;
|
|
7
|
-
if (r.querySelectorAll(_).forEach((e) => {
|
|
8
|
-
var s, a;
|
|
9
|
-
const o = e.getAttribute("style") || "";
|
|
10
|
-
if (!/display\s*:\s*none/i.test(o))
|
|
11
|
-
return;
|
|
12
|
-
const c = e.previousSibling;
|
|
13
|
-
if (((c == null ? void 0 : c.nodeType) !== Node.COMMENT_NODE || c.data !== p) && ((s = e.parentNode) == null || s.insertBefore(r.createComment(p), e), (a = e.parentNode) == null || a.insertBefore(r.createComment(E), e.nextSibling)), !/mso-hide/i.test(o)) {
|
|
14
|
-
const d = o.trim().endsWith(";") ? " " : "; ";
|
|
15
|
-
e.setAttribute("style", `${o}${d}${u}`);
|
|
16
|
-
}
|
|
17
|
-
n = !0;
|
|
18
|
-
}), !n)
|
|
19
|
-
return t;
|
|
20
|
-
const l = i.match(/<!DOCTYPE[^>]*>/i);
|
|
21
|
-
return ((l ? `${l[0]}
|
|
22
|
-
` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
E as MSO_ITEMS_HIDE_END,
|
|
26
|
-
p as MSO_ITEMS_HIDE_START,
|
|
27
|
-
T as wrapHiddenPriceTdsForOutlook
|
|
28
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
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,12 +0,0 @@
|
|
|
1
|
-
export declare const MSO_ITEMS_HIDE_START = "MSO_ITEMS_HIDE_START";
|
|
2
|
-
export declare const MSO_ITEMS_HIDE_END = "MSO_ITEMS_HIDE_END";
|
|
3
|
-
/**
|
|
4
|
-
* SD-147597: the horizontal Items layout ships a second copy of price +
|
|
5
|
-
* original price in a `td.vertical-price` fallback hidden only by inline
|
|
6
|
-
* `display:none` (and vice versa for the vertical price orientation). Outlook's
|
|
7
|
-
* Word engine ignores `display:none` on `<td>`, so it paints BOTH copies —
|
|
8
|
-
* duplicate price. Wrap whichever price td(s) are hidden at export time in safe
|
|
9
|
-
* placeholder comments (swapped into `<!--[if !mso]>` by the priority-101 rule)
|
|
10
|
-
* and collapse them inline for web-engine Outlook.
|
|
11
|
-
*/
|
|
12
|
-
export declare function wrapHiddenPriceTdsForOutlook(html: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function migrateProductNameLink(html: string): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the element carrying the product name text.
|
|
4
|
-
*
|
|
5
|
-
* New blocks put `product-attr="name"` on the `<p>`; blocks saved before SD-147616 still
|
|
6
|
-
* carry it on the inner `<a>`, and the oldest ones have no attribute at all — hence the
|
|
7
|
-
* `p > a` fallback. Without it, trimming silently no-ops on legacy blocks.
|
|
8
|
-
*/
|
|
9
|
-
export declare const findNameTextNode: (container?: ImmutableHtmlNode) => ImmutableHtmlElementNode | undefined;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unwraps the `<a>` around an Items-block product name so the name compiles as plain text.
|
|
3
|
-
*
|
|
4
|
-
* Outlook's Word engine ignores `color: inherit` on an `<a>` and paints its own blue link
|
|
5
|
-
* color (SD-147616). New blocks no longer emit the anchor, but templates saved before the
|
|
6
|
-
* fix still carry it in their stored HTML — this heals them at compile time.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Removes the product-name link from every `.ins-product-td` in the document, in place.
|
|
10
|
-
*
|
|
11
|
-
* Scoped like `pairProductVariables` so partner or legacy recommendation markup outside a
|
|
12
|
-
* product cell is never touched. Idempotent.
|
|
13
|
-
* @param doc - Parsed template document, mutated in place
|
|
14
|
-
*/
|
|
15
|
-
export declare function unwrapProductNameLinks(doc: Document): void;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const f = "text-decoration", A = /(?:[^;"'()]|"[^"]*"|'[^']*'|\([^)]*\))+/g, c = (e) => (e.match(A) || []).map((r) => r.trim()).filter(Boolean), l = (e) => e.slice(0, e.indexOf(":")).trim().toLowerCase(), m = (e) => e.slice(e.indexOf(":") + 1).trim().toLowerCase(), u = (e, r) => {
|
|
2
|
-
const s = e.getAttribute("style");
|
|
3
|
-
if (!s)
|
|
4
|
-
return;
|
|
5
|
-
const t = c(r.getAttribute("style") || ""), i = new Set(t.map(l)), o = c(s).filter((n) => {
|
|
6
|
-
const a = l(n);
|
|
7
|
-
return !a || i.has(a) ? !1 : !a.startsWith(f) && m(n) !== "inherit";
|
|
8
|
-
});
|
|
9
|
-
o.length && r.setAttribute("style", [...t, ...o].join("; "));
|
|
10
|
-
}, y = ["product-attr", "data-type", "data-number", "data-slot-2"], p = (e, r) => {
|
|
11
|
-
y.forEach((s) => {
|
|
12
|
-
const t = e.getAttribute(s);
|
|
13
|
-
t !== null && !r.hasAttribute(s) && r.setAttribute(s, t);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
function E(e) {
|
|
17
|
-
e.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
18
|
-
const s = /* @__PURE__ */ new Set();
|
|
19
|
-
r.querySelectorAll('[product-attr="name"]').forEach((t) => {
|
|
20
|
-
const i = t.closest("a");
|
|
21
|
-
i && r.contains(i) && s.add(i);
|
|
22
|
-
}), s.forEach((t) => {
|
|
23
|
-
if (t.querySelector("img") || Array.from(t.querySelectorAll("[product-attr]")).some((a) => a.getAttribute("product-attr") !== "name"))
|
|
24
|
-
return;
|
|
25
|
-
const o = t.closest("p");
|
|
26
|
-
if (o && r.contains(o)) {
|
|
27
|
-
p(t, o), u(t, o), t.replaceWith(...Array.from(t.childNodes));
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const n = e.createElement("span");
|
|
31
|
-
p(t, n), u(t, n), n.append(...Array.from(t.childNodes)), t.replaceWith(n);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
E as unwrapProductNameLinks
|
|
37
|
-
};
|