@useinsider/guido 3.20.0-beta.30c96fc → 3.20.0-beta.50a6ae9
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 +5 -14
- package/dist/config/compiler/utils/itemsCompilerUtils.js +21 -48
- package/dist/config/migrator/itemsBlockMigrator.js +108 -112
- package/dist/extensions/Blocks/Items/block.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +5 -3
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +2 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Items/constants/cardWidth.js +0 -20
- package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +0 -12
- package/dist/src/utils/liquidProtection.d.ts +0 -3
- package/dist/utils/liquidProtection.js +0 -5
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { pairProductVariables as o } from "../../utils/pairProductVariables.js";
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
{
|
|
5
|
-
id: "normalize-items-block-widths",
|
|
6
|
-
// Runs before the other items rules so they see non-zero widths; not AMP-safe.
|
|
7
|
-
description: "Normalize zero Items card widths in the compiled email",
|
|
8
|
-
type: "custom",
|
|
9
|
-
processor: r,
|
|
10
|
-
priority: 55
|
|
11
|
-
// Before pair-product-variables (60)
|
|
12
|
-
},
|
|
2
|
+
import { wrapHiddenPriceTdsForOutlook as r, MSO_ITEMS_HIDE_START as e, MSO_ITEMS_HIDE_END as t } from "./utils/itemsCompilerUtils.js";
|
|
3
|
+
const a = [
|
|
13
4
|
{
|
|
14
5
|
id: "pair-product-variables",
|
|
15
6
|
description: "Replace product default values with template variables",
|
|
@@ -25,7 +16,7 @@ const d = [
|
|
|
25
16
|
// with safe placeholder comments and collapse them inline for web-engine Outlook.
|
|
26
17
|
description: "Mark hidden Items price tds for Outlook conditional hiding",
|
|
27
18
|
type: "custom",
|
|
28
|
-
processor:
|
|
19
|
+
processor: r,
|
|
29
20
|
priority: 65
|
|
30
21
|
// After pair-product-variables (60), before outlook rules (70+)
|
|
31
22
|
},
|
|
@@ -35,10 +26,10 @@ const d = [
|
|
|
35
26
|
// and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
|
|
36
27
|
description: "Swap Items MSO markers into [if !mso] conditional comments",
|
|
37
28
|
type: "custom",
|
|
38
|
-
processor: (i) => i.replaceAll(`<!--${
|
|
29
|
+
processor: (i) => i.replaceAll(`<!--${e}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${t}-->`, "<!--<![endif]-->"),
|
|
39
30
|
priority: 101
|
|
40
31
|
}
|
|
41
32
|
];
|
|
42
33
|
export {
|
|
43
|
-
|
|
34
|
+
a as itemsCompilerRules
|
|
44
35
|
};
|
|
@@ -1,55 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var d, a;
|
|
11
|
-
const o = t.getAttribute("style") || "";
|
|
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") || "";
|
|
12
10
|
if (!/display\s*:\s*none/i.test(o))
|
|
13
11
|
return;
|
|
14
|
-
const
|
|
15
|
-
if (((
|
|
16
|
-
const
|
|
17
|
-
|
|
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}`);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
}), !
|
|
21
|
-
return
|
|
22
|
-
const
|
|
23
|
-
return ((
|
|
17
|
+
n = !0;
|
|
18
|
+
}), !n)
|
|
19
|
+
return t;
|
|
20
|
+
const l = i.match(/<!DOCTYPE[^>]*>/i);
|
|
21
|
+
return ((l ? `${l[0]}
|
|
24
22
|
` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
25
23
|
}
|
|
26
|
-
function I(e) {
|
|
27
|
-
if (!e.includes("ins-product-wrapper") && !e.includes("ins-product-td"))
|
|
28
|
-
return e;
|
|
29
|
-
const n = new DOMParser().parseFromString(m(e), "text/html");
|
|
30
|
-
let r = !1;
|
|
31
|
-
if (n.querySelectorAll(A).forEach((i) => {
|
|
32
|
-
const t = i.getAttribute("style") || "";
|
|
33
|
-
if (!E(t) && !u(i.getAttribute("width")))
|
|
34
|
-
return;
|
|
35
|
-
const o = h(t);
|
|
36
|
-
o !== t && (i.setAttribute("style", o), r = !0), u(i.getAttribute("width")) && (i.setAttribute("width", "100%"), r = !0);
|
|
37
|
-
}), n.querySelectorAll(S).forEach((i) => {
|
|
38
|
-
const t = i.getAttribute("style") || "";
|
|
39
|
-
if (E(t)) {
|
|
40
|
-
const o = _(t);
|
|
41
|
-
o ? i.setAttribute("style", o) : i.removeAttribute("style"), r = !0;
|
|
42
|
-
}
|
|
43
|
-
u(i.getAttribute("width")) && (i.removeAttribute("width"), r = !0);
|
|
44
|
-
}), !r)
|
|
45
|
-
return e;
|
|
46
|
-
const s = e.match(/<!DOCTYPE[^>]*>/i), c = s ? `${s[0]}
|
|
47
|
-
` : "";
|
|
48
|
-
return y(c + n.documentElement.outerHTML);
|
|
49
|
-
}
|
|
50
24
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
g as wrapHiddenPriceTdsForOutlook
|
|
25
|
+
E as MSO_ITEMS_HIDE_END,
|
|
26
|
+
p as MSO_ITEMS_HIDE_START,
|
|
27
|
+
T as wrapHiddenPriceTdsForOutlook
|
|
55
28
|
};
|
|
@@ -1,86 +1,84 @@
|
|
|
1
|
-
var
|
|
2
|
-
var v = (
|
|
3
|
-
var M = (
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var v = (c, t, e) => t in c ? q(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
3
|
+
var M = (c, t, e) => v(c, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { BLOCK_ID as R } from "../../extensions/Blocks/Items/block.js";
|
|
5
|
-
import { hasZeroWidthDeclaration as L, withoutZeroWidth as x } from "../../extensions/Blocks/Items/constants/cardWidth.js";
|
|
6
5
|
import { ItemInCartOptions as h, DefaultConfigValues as b, SETTINGS_ENUMS as _ } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
7
|
-
import { getDefaultTemplate as
|
|
8
|
-
import { useTemplateStore as
|
|
9
|
-
|
|
10
|
-
function F() {
|
|
6
|
+
import { getDefaultTemplate as L } from "../../extensions/Blocks/Items/template.js";
|
|
7
|
+
import { useTemplateStore as x } from "../../stores/template.js";
|
|
8
|
+
function O() {
|
|
11
9
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
12
10
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
11
|
+
function P(c) {
|
|
12
|
+
return c ? {
|
|
15
13
|
CartItems: _.ITEMS_TYPE.CART_ITEMS,
|
|
16
14
|
BrowsedItems: _.ITEMS_TYPE.BROWSED_ITEMS,
|
|
17
15
|
PurchasedItems: _.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
18
16
|
CART_ITEMS: _.ITEMS_TYPE.CART_ITEMS,
|
|
19
17
|
BROWSED_ITEMS: _.ITEMS_TYPE.BROWSED_ITEMS,
|
|
20
18
|
PURCHASED_ITEMS: _.ITEMS_TYPE.PURCHASED_ITEMS
|
|
21
|
-
}[
|
|
19
|
+
}[c] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
|
|
22
20
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
21
|
+
function V(c) {
|
|
22
|
+
return c.classList.contains("esd-browsed-items-block") ? _.ITEMS_TYPE.BROWSED_ITEMS : c.classList.contains("esd-purchased-items-block") ? _.ITEMS_TYPE.PURCHASED_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
|
|
25
23
|
}
|
|
26
|
-
function
|
|
24
|
+
function D(c) {
|
|
27
25
|
var o;
|
|
28
|
-
const t = (i,
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
31
|
-
const i = parseInt(
|
|
32
|
-
|
|
26
|
+
const t = (i, u) => i == null ? u : i === "1" || i === "true", e = (i, u) => i || u, a = c["data-type"] || c["data-source"], r = P(a), d = h[r];
|
|
27
|
+
let n = c["data-cart_items_select_control_value"] || ((o = d == null ? void 0 : d[0]) == null ? void 0 : o.value) || b.cartItemsSelectControlValue;
|
|
28
|
+
if (n && !n.includes("{{") && /^\d+$/.test(n)) {
|
|
29
|
+
const i = parseInt(n) - 1, u = h[r];
|
|
30
|
+
u && u[i] && (n = u[i].value);
|
|
33
31
|
}
|
|
34
32
|
return {
|
|
35
33
|
initialized: !0,
|
|
36
|
-
blockInstanceId: e(
|
|
34
|
+
blockInstanceId: e(c["data-block-instance-id"], O()),
|
|
37
35
|
source: r,
|
|
38
36
|
type: r,
|
|
39
|
-
itemsSelectValue:
|
|
40
|
-
orientation:
|
|
41
|
-
nameTrimming: t(
|
|
42
|
-
priceHideDiscount: t(
|
|
43
|
-
priceFormatted: t(
|
|
44
|
-
priceSinglePrice: t(
|
|
37
|
+
itemsSelectValue: n,
|
|
38
|
+
orientation: c["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
|
|
39
|
+
nameTrimming: t(c["data-product_name_control_trim"], !0),
|
|
40
|
+
priceHideDiscount: t(c["data-product_price_control_nodup"], !0),
|
|
41
|
+
priceFormatted: t(c["data-product_price_control_formated"], !0),
|
|
42
|
+
priceSinglePrice: t(c["data-product_price_control_single_price"], !1),
|
|
45
43
|
priceCurrencySymbol: e(
|
|
46
|
-
|
|
44
|
+
c["data-product_price_control_currency_symbol"],
|
|
47
45
|
b.productPriceCurrencySymbolControlValue
|
|
48
46
|
),
|
|
49
47
|
priceCurrencyLocation: e(
|
|
50
|
-
|
|
48
|
+
c["data-product_price_currency_location"],
|
|
51
49
|
b.productPriceCurrencyLocationControlValue
|
|
52
50
|
),
|
|
53
|
-
priceOrientation:
|
|
54
|
-
quantityControlEnabled: t(
|
|
55
|
-
buttonLink: e(
|
|
56
|
-
imageLink: e(
|
|
57
|
-
buttonLabel: e(
|
|
58
|
-
buttonFullWidth: t(
|
|
59
|
-
imageVisible: t(
|
|
60
|
-
nameVisible: t(
|
|
61
|
-
quantityVisible: t(
|
|
62
|
-
priceVisible: t(
|
|
63
|
-
originalPriceVisible: t(
|
|
64
|
-
buttonVisible: t(
|
|
51
|
+
priceOrientation: c["data-product_original_price_control_orientation"] || "horizontal",
|
|
52
|
+
quantityControlEnabled: t(c["data-product_quantity_control_enabled"], !0),
|
|
53
|
+
buttonLink: e(c["data-product_button_link"], b.productButtonLinkControlValue),
|
|
54
|
+
imageLink: e(c["data-product_image_link"], b.productImageLinkControlValue),
|
|
55
|
+
buttonLabel: e(c["data-product_button_control_label"], "Buy"),
|
|
56
|
+
buttonFullWidth: t(c["data-product_button_control_atw"], !0),
|
|
57
|
+
imageVisible: t(c["data-product_image_control_enabled"], !0),
|
|
58
|
+
nameVisible: t(c["data-product_name_control_enabled"], !0),
|
|
59
|
+
quantityVisible: t(c["data-product_quantity_control_enabled"], !0),
|
|
60
|
+
priceVisible: t(c["data-product_price_control_enabled"], !0),
|
|
61
|
+
originalPriceVisible: t(c["data-product_original_price_control_enabled"], !0),
|
|
62
|
+
buttonVisible: t(c["data-product_button_control_enabled"], !0)
|
|
65
63
|
};
|
|
66
64
|
}
|
|
67
|
-
function
|
|
65
|
+
function H(c, t) {
|
|
68
66
|
const e = {
|
|
69
67
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
|
|
70
68
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
|
|
71
69
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
|
|
72
70
|
};
|
|
73
|
-
return e[
|
|
71
|
+
return e[c] || e.CART_ITEMS;
|
|
74
72
|
}
|
|
75
|
-
function
|
|
73
|
+
function $(c, t) {
|
|
76
74
|
const e = {
|
|
77
75
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
|
|
78
76
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
|
|
79
77
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
|
|
80
78
|
};
|
|
81
|
-
return e[
|
|
79
|
+
return e[c] || e.CART_ITEMS;
|
|
82
80
|
}
|
|
83
|
-
class
|
|
81
|
+
class F {
|
|
84
82
|
constructor() {
|
|
85
83
|
M(this, "parser");
|
|
86
84
|
this.parser = new DOMParser();
|
|
@@ -92,10 +90,10 @@ class z {
|
|
|
92
90
|
const e = this.removeJinjaConditionals(t), a = this.parser.parseFromString(e, "text/html"), r = a.querySelectorAll(
|
|
93
91
|
"td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
|
|
94
92
|
);
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
}), r.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"),
|
|
98
|
-
const o = this.extractConfiguration(
|
|
93
|
+
return x().$patch((n) => {
|
|
94
|
+
n.migrations = { ...n.migrations, [R]: r.length };
|
|
95
|
+
}), r.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), e) : (r.forEach((n) => {
|
|
96
|
+
const o = this.extractConfiguration(n), i = L({
|
|
99
97
|
orientation: o.orientation,
|
|
100
98
|
itemsType: o.itemsType,
|
|
101
99
|
itemId: o.itemId,
|
|
@@ -109,18 +107,18 @@ class z {
|
|
|
109
107
|
priceStyles: o.priceStyles,
|
|
110
108
|
originalPriceStyles: o.originalPriceStyles,
|
|
111
109
|
quantityStyles: o.quantityStyles,
|
|
112
|
-
nodeConfig:
|
|
110
|
+
nodeConfig: D(o.configBlockAttributes)
|
|
113
111
|
}), l = this.parser.parseFromString(
|
|
114
112
|
`<table><tbody><tr>${i}</tr></tbody></table>`,
|
|
115
113
|
"text/html"
|
|
116
114
|
).querySelector("td");
|
|
117
|
-
if (l &&
|
|
118
|
-
const s =
|
|
115
|
+
if (l && n.parentNode) {
|
|
116
|
+
const s = D(o.configBlockAttributes);
|
|
119
117
|
l.setAttribute("esd-ext-config", JSON.stringify(s)), l.setAttribute("data-type", s.type);
|
|
120
118
|
const p = l.querySelector("esd-config-block");
|
|
121
|
-
p && p.remove(),
|
|
119
|
+
p && p.remove(), n.parentNode.replaceChild(l, n);
|
|
122
120
|
}
|
|
123
|
-
}),
|
|
121
|
+
}), a.documentElement.outerHTML);
|
|
124
122
|
} catch (e) {
|
|
125
123
|
return console.error("ItemsBlockMigrator failed:", e), t;
|
|
126
124
|
}
|
|
@@ -133,24 +131,24 @@ class z {
|
|
|
133
131
|
*/
|
|
134
132
|
extractConfiguration(t) {
|
|
135
133
|
var C;
|
|
136
|
-
const e =
|
|
137
|
-
this.readSelfOrDescendantAttribute(t, "data-type") ||
|
|
138
|
-
), a = this.readSelfOrDescendantAttribute(t, "data-number") || "1", r = parseInt(a) - 1,
|
|
134
|
+
const e = P(
|
|
135
|
+
this.readSelfOrDescendantAttribute(t, "data-type") || V(t)
|
|
136
|
+
), a = this.readSelfOrDescendantAttribute(t, "data-number") || "1", r = parseInt(a) - 1, d = h[e], n = ((C = d == null ? void 0 : d[r]) == null ? void 0 : C.value) || d[0].value, o = this.extractConfigBlockAttributes(t, e, a);
|
|
139
137
|
this.applyDomFallbacks(t, o);
|
|
140
|
-
const i = t.querySelector('[product-attr="price"]'),
|
|
138
|
+
const i = t.querySelector('[product-attr="price"]'), u = o["data-product_price_control_currency_symbol"], l = o["data-product_price_currency_location"] || "0", s = o["data-product_price_control_formated"], p = s !== "false" && s !== "0", S = o["data-card_orientation_control_value"] === "horizontal" ? "horizontal" : "vertical", y = t.querySelector('a[product-attr="name"]'), f = (y == null ? void 0 : y.getAttribute("style")) || void 0, g = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), I = (g == null ? void 0 : g.getAttribute("style")) || void 0, w = (i == null ? void 0 : i.getAttribute("style")) || void 0, m = t.querySelector("p.original-price") ?? t.querySelector('[product-attr="originalPrice"]'), A = m != null && m.getAttribute("style") ? m : (m == null ? void 0 : m.closest("p")) ?? m, k = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), B = (E == null ? void 0 : E.getAttribute("style")) || void 0;
|
|
141
139
|
return {
|
|
142
140
|
orientation: S,
|
|
143
141
|
itemsType: e,
|
|
144
|
-
itemId:
|
|
145
|
-
currencySymbol:
|
|
142
|
+
itemId: n,
|
|
143
|
+
currencySymbol: u,
|
|
146
144
|
currencyLocation: l,
|
|
147
145
|
formattedPrice: p,
|
|
148
146
|
configBlockAttributes: o,
|
|
149
|
-
nameStyles:
|
|
147
|
+
nameStyles: f,
|
|
150
148
|
buttonStyles: I,
|
|
151
|
-
priceStyles:
|
|
152
|
-
originalPriceStyles:
|
|
153
|
-
quantityStyles:
|
|
149
|
+
priceStyles: w,
|
|
150
|
+
originalPriceStyles: k,
|
|
151
|
+
quantityStyles: B
|
|
154
152
|
};
|
|
155
153
|
}
|
|
156
154
|
/**
|
|
@@ -161,8 +159,8 @@ class z {
|
|
|
161
159
|
* card migrates with the boilerplate defaults: caption "Buy", USD, full-width button.
|
|
162
160
|
*/
|
|
163
161
|
applyDomFallbacks(t, e) {
|
|
164
|
-
var S,
|
|
165
|
-
const a = t.querySelector("esd-config-block"), r = (...
|
|
162
|
+
var S, y;
|
|
163
|
+
const a = t.querySelector("esd-config-block"), r = (...f) => !a || f.every((g) => !(a.getAttribute(g) ?? "").trim());
|
|
166
164
|
Object.entries({
|
|
167
165
|
image: '[product-attr="imageSrc"]',
|
|
168
166
|
name: '[product-attr="name"]',
|
|
@@ -170,17 +168,17 @@ class z {
|
|
|
170
168
|
original_price: '[product-attr="originalPrice"], p.original-price',
|
|
171
169
|
quantity: '[product-attr="quantity"]',
|
|
172
170
|
button: '[product-attr="button"]'
|
|
173
|
-
}).forEach(([
|
|
174
|
-
const I = `data-product_${
|
|
171
|
+
}).forEach(([f, g]) => {
|
|
172
|
+
const I = `data-product_${f}_control_enabled`;
|
|
175
173
|
r(I) && (e[I] = t.querySelector(g) ? "true" : "false");
|
|
176
174
|
}), r("data-card_orientation_control_value") && (e["data-card_orientation_control_value"] = t.querySelector('[colspan="2"]') ? "vertical" : "horizontal");
|
|
177
|
-
const
|
|
175
|
+
const n = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), o = (S = n == null ? void 0 : n.textContent) == null ? void 0 : S.replace(/\s+/g, " ").trim();
|
|
178
176
|
o && r("data-product_button_control_label") && (e["data-product_button_control_label"] = o);
|
|
179
|
-
const i = (
|
|
177
|
+
const i = (n == null ? void 0 : n.getAttribute("style")) || "";
|
|
180
178
|
r("data-product_button_control_atw") && /display:\s*inline/.test(i) && !/(?:^|;)\s*width\s*:\s*100%/.test(i) && (e["data-product_button_control_atw"] = "false");
|
|
181
|
-
const
|
|
179
|
+
const u = t.querySelector('[product-attr="imageSrc"]'), l = u ? this.readImageSize(u) : null, s = (l == null ? void 0 : l.height) ?? (l == null ? void 0 : l.width), p = (l == null ? void 0 : l.width) ?? (l == null ? void 0 : l.height);
|
|
182
180
|
s && r("data-product_image_control_image-height") && (e["data-product_image_control_image-height"] = s), p && r("data-product_image_control_image-width") && (e["data-product_image_control_image-width"] = p), this.applyPriceDomFallbacks(t, e, r);
|
|
183
|
-
const T = ((
|
|
181
|
+
const T = ((y = t.querySelector('[product-attr="name"]')) == null ? void 0 : y.getAttribute("style")) || "";
|
|
184
182
|
r("data-product_name_control_trim") && /white-space:\s*normal/.test(T) && (e["data-product_name_control_trim"] = "0");
|
|
185
183
|
}
|
|
186
184
|
/**
|
|
@@ -191,15 +189,15 @@ class z {
|
|
|
191
189
|
* the default back over the real value.
|
|
192
190
|
*/
|
|
193
191
|
applyPriceDomFallbacks(t, e, a) {
|
|
194
|
-
var
|
|
192
|
+
var u;
|
|
195
193
|
const r = t.querySelector('[product-attr="price"]') ?? t.querySelector('[product-attr="originalPrice"]');
|
|
196
194
|
if (!r)
|
|
197
195
|
return;
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
const l =
|
|
196
|
+
const d = (u = r.getAttribute("data-currency_symbol")) == null ? void 0 : u.trim();
|
|
197
|
+
d && a("data-product_price_control_currency_symbol") && (e["data-product_price_control_currency_symbol"] = d);
|
|
198
|
+
const n = r.getAttribute("data-curency");
|
|
199
|
+
if (n && a("data-product_price_currency_location", "data-product_price_control_curency")) {
|
|
200
|
+
const l = n === "after" ? "1" : "0";
|
|
203
201
|
e["data-product_price_currency_location"] = l, e["data-product_price_control_curency"] = l;
|
|
204
202
|
}
|
|
205
203
|
const o = r.getAttribute("data-formated");
|
|
@@ -234,14 +232,14 @@ class z {
|
|
|
234
232
|
* to nothing, so only a positive integer counts as an answer.
|
|
235
233
|
*/
|
|
236
234
|
readImageDimension(t, e) {
|
|
237
|
-
var
|
|
235
|
+
var u;
|
|
238
236
|
const a = (l) => {
|
|
239
237
|
const s = (l ?? "").trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i), p = s ? Math.floor(parseFloat(s[1])) : 0;
|
|
240
238
|
return p > 0 ? String(p) : null;
|
|
241
|
-
}, r = a((
|
|
239
|
+
}, r = a((u = t.getAttribute(e)) == null ? void 0 : u.trim());
|
|
242
240
|
if (r)
|
|
243
241
|
return r;
|
|
244
|
-
const
|
|
242
|
+
const d = t.getAttribute("style") || "", n = new RegExp(`(?:^|;)\\s*${e}:\\s*(\\d+(?:\\.\\d+)?)px`), o = new RegExp(`max-${e}:\\s*(\\d+(?:\\.\\d+)?)px`), i = d.match(n) || d.match(o);
|
|
245
243
|
return a(i == null ? void 0 : i[1]);
|
|
246
244
|
}
|
|
247
245
|
/**
|
|
@@ -252,26 +250,26 @@ class z {
|
|
|
252
250
|
* @param itemNumber - The item number (1-based index)
|
|
253
251
|
*/
|
|
254
252
|
extractConfigBlockAttributes(t, e, a) {
|
|
255
|
-
const r = t.querySelector("esd-config-block"),
|
|
253
|
+
const r = t.querySelector("esd-config-block"), d = {};
|
|
256
254
|
if (r) {
|
|
257
255
|
if (Array.from(r.attributes).forEach((o) => {
|
|
258
|
-
o.name.startsWith("data-") && (
|
|
259
|
-
}),
|
|
260
|
-
const o =
|
|
256
|
+
o.name.startsWith("data-") && (d[o.name] = o.value);
|
|
257
|
+
}), d["data-cart_items_select_control_value"]) {
|
|
258
|
+
const o = d["data-cart_items_select_control_value"];
|
|
261
259
|
if (/^\d+$/.test(o)) {
|
|
262
|
-
const i = parseInt(o) - 1,
|
|
263
|
-
|
|
260
|
+
const i = parseInt(o) - 1, u = h[e];
|
|
261
|
+
u && u[i] && (d["data-cart_items_select_control_value"] = u[i].value);
|
|
264
262
|
}
|
|
265
263
|
}
|
|
266
|
-
if (
|
|
267
|
-
const o =
|
|
264
|
+
if (d["data-product_price_control_curency"]) {
|
|
265
|
+
const o = d["data-product_price_control_curency"];
|
|
268
266
|
let i = o;
|
|
269
|
-
o === "before" ? i = "0" : o === "after" && (i = "1"),
|
|
267
|
+
o === "before" ? i = "0" : o === "after" && (i = "1"), d["data-product_price_control_curency"] = i, d["data-product_price_currency_location"] = i;
|
|
270
268
|
}
|
|
271
|
-
(!
|
|
269
|
+
(!d["data-product_price_control_currency_symbol"] || d["data-product_price_control_currency_symbol"].trim() === "") && (d["data-product_price_control_currency_symbol"] = "USD");
|
|
272
270
|
}
|
|
273
|
-
const
|
|
274
|
-
return
|
|
271
|
+
const n = { ...this.getDefaultConfigBlockAttributes(), ...d };
|
|
272
|
+
return n["data-type"] = e, n["data-source"] = e, n["data-product_image_link"] = H(e, a), n["data-product_button_link"] = $(e, a), n;
|
|
275
273
|
}
|
|
276
274
|
/**
|
|
277
275
|
* Returns default esd-config-block attributes based on the old template structure
|
|
@@ -345,29 +343,27 @@ class z {
|
|
|
345
343
|
backfillV2ProductTdAttributes(t) {
|
|
346
344
|
if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
|
|
347
345
|
return t;
|
|
348
|
-
const e = this.parser.parseFromString(
|
|
346
|
+
const e = this.parser.parseFromString(t, "text/html");
|
|
349
347
|
let a = !1;
|
|
350
348
|
return e.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
351
|
-
r.hasAttribute("width") && (r.removeAttribute("width"), a = !0), r.classList.contains("esd-container-frame") && (r.classList.remove("esd-container-frame"), a = !0)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const u = r.getAttribute("esd-ext-config");
|
|
357
|
-
let c = null;
|
|
349
|
+
r.hasAttribute("width") && (r.removeAttribute("width"), a = !0), r.classList.contains("esd-container-frame") && (r.classList.remove("esd-container-frame"), a = !0);
|
|
350
|
+
const d = r.querySelector("table.ins-product-wrapper");
|
|
351
|
+
d != null && d.hasAttribute("width") && d.getAttribute("width") !== "100%" && (d.setAttribute("width", "100%"), a = !0);
|
|
352
|
+
const n = r.getAttribute("esd-ext-config");
|
|
353
|
+
let o = null;
|
|
358
354
|
try {
|
|
359
|
-
|
|
355
|
+
o = n ? JSON.parse(n) : null;
|
|
360
356
|
} catch {
|
|
361
357
|
}
|
|
362
|
-
if (!
|
|
358
|
+
if (!o || (!r.getAttribute("data-nodup") && typeof o.priceHideDiscount == "boolean" && (r.setAttribute("data-nodup", String(o.priceHideDiscount)), a = !0), r.getAttribute("data-type")))
|
|
363
359
|
return;
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
360
|
+
const i = o.type || o.source;
|
|
361
|
+
if (!i)
|
|
366
362
|
return;
|
|
367
|
-
r.setAttribute("data-type",
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
}), a ?
|
|
363
|
+
r.setAttribute("data-type", i), a = !0;
|
|
364
|
+
const u = typeof o.itemsSelectValue == "string" ? o.itemsSelectValue.match(/\((\d+)\)/) : null;
|
|
365
|
+
u && r.getAttribute("data-number") !== u[1] && r.setAttribute("data-number", u[1]);
|
|
366
|
+
}), a ? e.documentElement.outerHTML : t;
|
|
371
367
|
}
|
|
372
368
|
/**
|
|
373
369
|
* Fast check for the presence of any items block (cart / browsed / purchased)
|
|
@@ -401,9 +397,9 @@ class z {
|
|
|
401
397
|
`), r;
|
|
402
398
|
}
|
|
403
399
|
}
|
|
404
|
-
function
|
|
405
|
-
return new
|
|
400
|
+
function J(c) {
|
|
401
|
+
return new F().migrate(c);
|
|
406
402
|
}
|
|
407
403
|
export {
|
|
408
|
-
|
|
404
|
+
J as migrateItemsBlock
|
|
409
405
|
};
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BlockId as
|
|
2
|
+
var D = (l, a, t) => a in l ? k(l, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[a] = t;
|
|
3
|
+
var y = (l, a, t) => D(l, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import { BlockId as N } from "../../../enums/block.js";
|
|
5
5
|
import { useOnboardingStore as T } from "../../../stores/onboarding.js";
|
|
6
|
-
import { getMigrationBannerHtml as
|
|
7
|
-
import { Block as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { SETTINGS_ENUMS as b, DefaultConfigValues as p } from "./enums/settingsEnums.js";
|
|
6
|
+
import { getMigrationBannerHtml as S } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
+
import { Block as A, BlockCompositionType as M, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { currencyAttrTargets as H, ITEMS_CURRENCY_ATTR as m } from "./constants/currency.js";
|
|
9
|
+
import { ItemsBlockId as R } from "./enums/controlEnums.js";
|
|
10
|
+
import { SETTINGS_ENUMS as C, DefaultConfigValues as g } from "./enums/settingsEnums.js";
|
|
12
11
|
import { getDefaultTemplate as O } from "./template.js";
|
|
13
|
-
import { getItemsBlockContainer as
|
|
14
|
-
const
|
|
15
|
-
class
|
|
12
|
+
import { getItemsBlockContainer as b, getItemsBlockConfig as h, deriveItemNumber as B, generateBlockInstanceId as E, getDefaultItemsBlockConfig as w } from "./utils/nodeConfigUtils.js";
|
|
13
|
+
const _ = N.Items, P = "Reconcile Items currency DOM attributes";
|
|
14
|
+
class K extends A {
|
|
16
15
|
constructor() {
|
|
17
16
|
super(...arguments);
|
|
18
17
|
/** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
|
|
19
|
-
|
|
18
|
+
y(this, "_currencyHealed", /* @__PURE__ */ new Set());
|
|
20
19
|
/** blockInstanceIds already claimed by a live block this session (SD-147588 collision detection). */
|
|
21
|
-
|
|
20
|
+
y(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
|
|
22
21
|
}
|
|
23
22
|
getId() {
|
|
24
|
-
return
|
|
23
|
+
return _;
|
|
25
24
|
}
|
|
26
25
|
getIcon() {
|
|
27
26
|
return "items-icon";
|
|
28
27
|
}
|
|
29
28
|
getBlockCompositionType() {
|
|
30
|
-
return
|
|
29
|
+
return M.CONTAINER;
|
|
31
30
|
}
|
|
32
31
|
getName() {
|
|
33
32
|
return this.api.translate("Items");
|
|
@@ -36,20 +35,20 @@ class $ extends H {
|
|
|
36
35
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
37
36
|
}
|
|
38
37
|
getSettingsPanelTitleHtml() {
|
|
39
|
-
return
|
|
40
|
-
|
|
38
|
+
return S(
|
|
39
|
+
_,
|
|
41
40
|
this.api.translate("Items"),
|
|
42
41
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
|
|
43
42
|
);
|
|
44
43
|
}
|
|
45
44
|
getTemplate() {
|
|
46
45
|
return O({
|
|
47
|
-
orientation:
|
|
48
|
-
itemsType:
|
|
46
|
+
orientation: C.ORIENTATION.VERTICAL,
|
|
47
|
+
itemsType: C.ITEMS_TYPE.CART_ITEMS,
|
|
49
48
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
50
|
-
currencySymbol:
|
|
51
|
-
currencyLocation:
|
|
52
|
-
formattedPrice:
|
|
49
|
+
currencySymbol: g.productPriceCurrencySymbolControlValue,
|
|
50
|
+
currencyLocation: g.productPriceCurrencyLocationControlValue,
|
|
51
|
+
formattedPrice: g.productPriceFormattedControlValue === "1"
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
allowInnerBlocksDND() {
|
|
@@ -58,27 +57,27 @@ class $ extends H {
|
|
|
58
57
|
canBeSavedAsModule() {
|
|
59
58
|
return !0;
|
|
60
59
|
}
|
|
61
|
-
onCreated(
|
|
62
|
-
const
|
|
63
|
-
c.querySelector('[product-attr="imageSrc"] img') ||
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
60
|
+
onCreated(t) {
|
|
61
|
+
const o = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
|
|
62
|
+
c.querySelector('[product-attr="imageSrc"] img') || o.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
63
|
+
const i = b(t);
|
|
64
|
+
if (!i)
|
|
66
65
|
return;
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
66
|
+
const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, e = h(t);
|
|
67
|
+
if (e != null && e.initialized) {
|
|
69
68
|
if (!s) {
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
const d = this.api.getDocumentModifier();
|
|
70
|
+
d.modifyHtml(i).setNodeConfig(e), this._stampProductTdDomAttributes(i, e, d), this._shouldReconcileCurrency(e) && this._reconcileCurrencyDomAttributes(i, e, d), d.apply(new u("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(e.blockInstanceId);
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
73
|
} else {
|
|
75
|
-
const
|
|
76
|
-
|
|
74
|
+
const d = w(), p = this.api.getDocumentModifier();
|
|
75
|
+
p.modifyHtml(i).setNodeConfig(d), this._stampProductTdDomAttributes(i, d, p, !0), p.apply(new u("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
|
-
const n = this._resolveInstanceId(
|
|
80
|
-
let
|
|
81
|
-
n !==
|
|
78
|
+
const n = this._resolveInstanceId(e.blockInstanceId), f = this.api.getDocumentModifier();
|
|
79
|
+
let I = !1;
|
|
80
|
+
n !== e.blockInstanceId && (f.modifyHtml(i).setNodeConfig({ ...e, blockInstanceId: n }), I = !0), !this._currencyHealed.has(n) && this._reconcileCurrencyDomAttributes(i, e, f) && (I = !0), I && f.apply(new u("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
@@ -86,24 +85,24 @@ class $ extends H {
|
|
|
86
85
|
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
87
86
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
88
87
|
*/
|
|
89
|
-
onDocumentChanged(
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
88
|
+
onDocumentChanged(t) {
|
|
89
|
+
const o = b(t);
|
|
90
|
+
if (!o)
|
|
92
91
|
return;
|
|
93
|
-
const c =
|
|
92
|
+
const c = o.getNodeConfig();
|
|
94
93
|
if (c && Object.keys(c).length > 0) {
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
94
|
+
const e = h(t);
|
|
95
|
+
if (e != null && e.initialized && this._shouldReconcileCurrency(e)) {
|
|
97
96
|
const n = this.api.getDocumentModifier();
|
|
98
|
-
this._reconcileCurrencyDomAttributes(
|
|
97
|
+
this._reconcileCurrencyDomAttributes(o, e, n) && n.apply(new u(P)), this._markCurrencyHealed(e.blockInstanceId);
|
|
99
98
|
}
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
|
-
const
|
|
103
|
-
if (!(
|
|
101
|
+
const r = h(t);
|
|
102
|
+
if (!(r != null && r.initialized))
|
|
104
103
|
return;
|
|
105
104
|
const s = this.api.getDocumentModifier();
|
|
106
|
-
s.modifyHtml(
|
|
105
|
+
s.modifyHtml(o).setNodeConfig(r), this._stampProductTdDomAttributes(o, r, s), this._shouldReconcileCurrency(r) && this._reconcileCurrencyDomAttributes(o, r, s), s.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(r.blockInstanceId);
|
|
107
106
|
}
|
|
108
107
|
/**
|
|
109
108
|
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
|
|
@@ -113,21 +112,11 @@ class $ extends H {
|
|
|
113
112
|
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
114
113
|
* relies on this td-level fallback in pairProductVariables.
|
|
115
114
|
*/
|
|
116
|
-
_stampProductTdDomAttributes(
|
|
117
|
-
const
|
|
118
|
-
|
|
115
|
+
_stampProductTdDomAttributes(t, o, c, i = !1) {
|
|
116
|
+
const r = B(o.itemsSelectValue, o.type), s = (e, n) => {
|
|
117
|
+
i && t.getAttribute(e) || c.modifyHtml(t).setAttribute(e, n);
|
|
119
118
|
};
|
|
120
|
-
s("data-type",
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
|
|
124
|
-
* on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
|
|
125
|
-
*/
|
|
126
|
-
_healCollapsedWidths(e, t) {
|
|
127
|
-
const r = e.querySelectorAll(M).filter((o) => m(o.getAttribute("width")) || m(o.getStyle("width")));
|
|
128
|
-
return !m(e.getAttribute("width")) && !r.length ? !1 : (e.hasClass("esd-container-frame") && t.modifyHtml(e).removeClass("esd-container-frame"), e.getAttribute("width") !== null && t.modifyHtml(e).removeAttribute("width"), r.forEach((o) => {
|
|
129
|
-
m(o.getAttribute("width")) && t.modifyHtml(o).setAttribute("width", "100%"), m(o.getStyle("width")) && t.modifyHtml(o).setStyle("width", "100%");
|
|
130
|
-
}), !0);
|
|
119
|
+
s("data-type", o.type), s("data-number", r), s("data-nodup", String(o.priceHideDiscount));
|
|
131
120
|
}
|
|
132
121
|
/**
|
|
133
122
|
* Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
|
|
@@ -137,12 +126,12 @@ class $ extends H {
|
|
|
137
126
|
* the symbol write alone is skipped for the 'USD' sentinel — so we must NOT gate the whole pass
|
|
138
127
|
* on symbol customization here, or a default-symbol block with a toggled location never heals.
|
|
139
128
|
*/
|
|
140
|
-
_shouldReconcileCurrency(
|
|
141
|
-
return !
|
|
129
|
+
_shouldReconcileCurrency(t) {
|
|
130
|
+
return !t.blockInstanceId || !this._currencyHealed.has(t.blockInstanceId);
|
|
142
131
|
}
|
|
143
132
|
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
144
|
-
_markCurrencyHealed(
|
|
145
|
-
|
|
133
|
+
_markCurrencyHealed(t) {
|
|
134
|
+
t && this._currencyHealed.add(t);
|
|
146
135
|
}
|
|
147
136
|
/**
|
|
148
137
|
* Resolves the id for a just-created block to one that is unique per live instance.
|
|
@@ -151,13 +140,13 @@ class $ extends H {
|
|
|
151
140
|
* currency heal guard and settings-panel switch detection. Mint a fresh id on absence
|
|
152
141
|
* or collision, otherwise keep the existing one. Registers the result as claimed.
|
|
153
142
|
*/
|
|
154
|
-
_resolveInstanceId(
|
|
155
|
-
let
|
|
156
|
-
if (!
|
|
143
|
+
_resolveInstanceId(t) {
|
|
144
|
+
let o = t;
|
|
145
|
+
if (!o || this._seenInstanceIds.has(o))
|
|
157
146
|
do
|
|
158
|
-
|
|
159
|
-
while (this._seenInstanceIds.has(
|
|
160
|
-
return this._seenInstanceIds.add(
|
|
147
|
+
o = E();
|
|
148
|
+
while (this._seenInstanceIds.has(o));
|
|
149
|
+
return this._seenInstanceIds.add(o), o;
|
|
161
150
|
}
|
|
162
151
|
/**
|
|
163
152
|
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
@@ -170,15 +159,15 @@ class $ extends H {
|
|
|
170
159
|
* Returns true only when an attr actually changed, so the caller can skip an empty apply that
|
|
171
160
|
* would otherwise re-trigger onDocumentChanged and loop.
|
|
172
161
|
*/
|
|
173
|
-
_reconcileCurrencyDomAttributes(
|
|
174
|
-
const { position:
|
|
175
|
-
let
|
|
162
|
+
_reconcileCurrencyDomAttributes(t, o, c) {
|
|
163
|
+
const { position: i, symbol: r } = H(o), s = t.querySelectorAll(`.${R.PRICE} p`);
|
|
164
|
+
let e = !1;
|
|
176
165
|
return s.forEach((n) => {
|
|
177
|
-
|
|
178
|
-
}),
|
|
166
|
+
i !== void 0 && n.getAttribute(m.POSITION) !== i && (c.modifyHtml(n).setAttribute(m.POSITION, i), e = !0), r !== void 0 && n.getAttribute(m.SYMBOL) !== r && (c.modifyHtml(n).setAttribute(m.SYMBOL, r), e = !0);
|
|
167
|
+
}), e;
|
|
179
168
|
}
|
|
180
169
|
}
|
|
181
170
|
export {
|
|
182
|
-
|
|
183
|
-
|
|
171
|
+
_ as BLOCK_ID,
|
|
172
|
+
K as ItemsBlock
|
|
184
173
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
2
|
-
<table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%"
|
|
2
|
+
<table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%">
|
|
3
3
|
<tbody>
|
|
4
4
|
<tr>
|
|
5
5
|
<td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import "../constants/selectors.js";
|
|
2
2
|
import { RRS_CONFIG_VERSION as m } from "../constants/defaultConfig.js";
|
|
3
|
-
import { sanitizeProductIds as p } from "./productIds.js";
|
|
4
|
-
const
|
|
5
|
-
function
|
|
3
|
+
import { sanitizeProductIds as p, PRODUCT_ID_SEPARATOR as d } from "./productIds.js";
|
|
4
|
+
const u = "manualMerchandising";
|
|
5
|
+
function f({ strategyId: e, nodeConfigVersion: t }) {
|
|
6
6
|
return !e && t < m;
|
|
7
7
|
}
|
|
8
8
|
const o = (e) => {
|
|
9
9
|
const t = String(e ?? "").trim();
|
|
10
10
|
return /^[1-9]\d*$/.test(t) ? t : null;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function R({ campaignId: e, templateLibraryId: t }) {
|
|
13
13
|
if (o(e))
|
|
14
14
|
return { scope: "campaign" };
|
|
15
15
|
const n = o(t);
|
|
16
16
|
return n ? { scope: "template", templateId: n } : { scope: "campaign" };
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function S({
|
|
19
19
|
blockId: e,
|
|
20
20
|
url: t,
|
|
21
21
|
campaignId: n,
|
|
@@ -24,7 +24,7 @@ function y({
|
|
|
24
24
|
productIds: s,
|
|
25
25
|
target: r
|
|
26
26
|
}) {
|
|
27
|
-
const i = c ===
|
|
27
|
+
const i = c === u ? p(s).split(d).filter(Boolean) : [];
|
|
28
28
|
return {
|
|
29
29
|
...r.scope === "template" ? { templateId: Number.parseInt(r.templateId) } : {
|
|
30
30
|
campaignId: Number.parseInt(n) || 0,
|
|
@@ -36,7 +36,7 @@ function y({
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
S as buildLegacyMigrationPayload,
|
|
40
|
+
f as isLegacyStrategyConfig,
|
|
41
|
+
R as resolveMigrationTarget
|
|
42
42
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const i = ",";
|
|
2
|
+
function o(t) {
|
|
3
|
+
return t.map((n) => String(n ?? "").trim()).filter(Boolean).join(",");
|
|
3
4
|
}
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
i as PRODUCT_ID_SEPARATOR,
|
|
7
|
+
o as sanitizeProductIds
|
|
6
8
|
};
|
|
@@ -10,8 +10,3 @@ export declare const MSO_ITEMS_HIDE_END = "MSO_ITEMS_HIDE_END";
|
|
|
10
10
|
* and collapse them inline for web-engine Outlook.
|
|
11
11
|
*/
|
|
12
12
|
export declare function wrapHiddenPriceTdsForOutlook(html: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Export safety net for a zero Items width: the wrapper gets the 100% pin, the cell's zero is
|
|
15
|
-
* dropped so it keeps its column width (a pin there overflows 33%/50% columns).
|
|
16
|
-
*/
|
|
17
|
-
export declare function normalizeItemsBlockWidths(html: string): string;
|
|
@@ -46,11 +46,6 @@ export declare class ItemsBlock extends Block {
|
|
|
46
46
|
* relies on this td-level fallback in pairProductVariables.
|
|
47
47
|
*/
|
|
48
48
|
private _stampProductTdDomAttributes;
|
|
49
|
-
/**
|
|
50
|
-
* Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
|
|
51
|
-
* on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
|
|
52
|
-
*/
|
|
53
|
-
private _healCollapsedWidths;
|
|
54
49
|
/**
|
|
55
50
|
* Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
|
|
56
51
|
* once-per-session: heal each instance at most once, so the auto-fix can't fight undo (undo
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Joins product ids in the `productId` request value and splits them back apart. */
|
|
2
|
+
export declare const PRODUCT_ID_SEPARATOR = ",";
|
|
1
3
|
/**
|
|
2
4
|
* Builds the request/URL `productId` value from raw product ID segments.
|
|
3
5
|
* Trimming happens here — NOT on input change — so the user's in-progress
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.20.0-beta.
|
|
3
|
+
"version": "3.20.0-beta.50a6ae9",
|
|
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,20 +0,0 @@
|
|
|
1
|
-
const R = ".ins-product-td", T = ".ins-product-wrapper", s = "width: 100%", c = /(^|;)\s*width\s*:\s*0(?:px|%)?\s*(?:!important)?\s*(?=;|$)/i, n = new RegExp(c.source, "gi"), o = /(^|;)\s*width\s*:/i, _ = /^0(?:px|%)?$/i, a = (t) => _.test((t ?? "").trim()), E = (t) => c.test(t), h = (t) => {
|
|
2
|
-
if (E(t))
|
|
3
|
-
return t.replace(
|
|
4
|
-
n,
|
|
5
|
-
(i, e) => `${e}${e ? " " : ""}${s}`
|
|
6
|
-
);
|
|
7
|
-
if (o.test(t))
|
|
8
|
-
return t;
|
|
9
|
-
const r = t.trim();
|
|
10
|
-
return r ? r.endsWith(";") ? `${r} ${s};` : `${r}; ${s};` : `${s};`;
|
|
11
|
-
}, p = (t) => t.replace(n, (r, i) => i).replace(/;{2,}/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim();
|
|
12
|
-
export {
|
|
13
|
-
R as PRODUCT_TD_SELECTOR,
|
|
14
|
-
T as PRODUCT_WRAPPER_SELECTOR,
|
|
15
|
-
s as WIDTH_PIN_DECLARATION,
|
|
16
|
-
E as hasZeroWidthDeclaration,
|
|
17
|
-
a as isZeroWidthValue,
|
|
18
|
-
h as withWidthPin,
|
|
19
|
-
p as withoutZeroWidth
|
|
20
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const PRODUCT_TD_SELECTOR = ".ins-product-td";
|
|
2
|
-
export declare const PRODUCT_WRAPPER_SELECTOR = ".ins-product-wrapper";
|
|
3
|
-
/** The declaration `layouts/vertical.html` and `layouts/horizontal.html` ship inline. */
|
|
4
|
-
export declare const WIDTH_PIN_DECLARATION = "width: 100%";
|
|
5
|
-
/** True for a `width` attribute value that renders the card zero-wide (`0`, `0px`, `0%`). */
|
|
6
|
-
export declare const isZeroWidthValue: (value?: string | null) => boolean;
|
|
7
|
-
/** True when an inline style declares a zero `width` (ignores `max-width` / `min-width`). */
|
|
8
|
-
export declare const hasZeroWidthDeclaration: (style: string) => boolean;
|
|
9
|
-
/** Rewrites a zero width to the pin or appends it; a non-zero width is kept. Idempotent. */
|
|
10
|
-
export declare const withWidthPin: (style: string) => string;
|
|
11
|
-
/** Drops a zero `width` declaration; the product cell must inherit its column width, not be pinned. */
|
|
12
|
-
export declare const withoutZeroWidth: (style: string) => string;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const p = (l) => l.split(/(<!--[\s\S]*?-->)/).map((e, c) => c % 2 ? e : e.replaceAll("{%", "<!--lq{%").replaceAll("%}", "%}lq-->")).join(""), r = (l) => l.replaceAll("<!--lq{%", "{%").replaceAll("%}lq-->", "%}").replaceAll("<!--lq{%", "{%").replaceAll("%}lq-->", "%}");
|
|
2
|
-
export {
|
|
3
|
-
p as protectLiquid,
|
|
4
|
-
r as restoreLiquid
|
|
5
|
-
};
|