@useinsider/guido 3.9.0 → 3.9.1-beta.4718ccb
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/useCortexBlueprintBridge.js +34 -30
- package/dist/composables/useEmailTemplateApplier.js +11 -9
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -126
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/config/migrator/unsubscribeMigrator.js +89 -67
- package/dist/extensions/Blocks/Items/block.js +57 -37
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +53 -45
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +15 -15
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +75 -69
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +5 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +8 -3
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +6 -0
- package/package.json +2 -2
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ItemInCartOptions as p, DefaultConfigValues as i, SETTINGS_ENUMS as c } from "../enums/settingsEnums.js";
|
|
3
3
|
function _() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
|
-
const
|
|
7
|
-
function y() {
|
|
6
|
+
const S = (r) => r.replace(/\$/g, "$$$$");
|
|
7
|
+
function y(r, t) {
|
|
8
|
+
const e = p[t], n = e ? e.findIndex((u) => u.value === r) : -1;
|
|
9
|
+
if (n >= 0)
|
|
10
|
+
return String(n + 1);
|
|
11
|
+
const o = typeof r == "string" ? r.match(/\((\d+)\)/) : null;
|
|
12
|
+
return (o == null ? void 0 : o[1]) ?? "1";
|
|
13
|
+
}
|
|
14
|
+
function A() {
|
|
8
15
|
return {
|
|
9
16
|
initialized: !0,
|
|
10
17
|
blockInstanceId: _(),
|
|
11
|
-
source:
|
|
12
|
-
type:
|
|
18
|
+
source: c.ITEMS_TYPE.CART_ITEMS,
|
|
19
|
+
type: c.ITEMS_TYPE.CART_ITEMS,
|
|
13
20
|
itemsSelectValue: i.cartItemsSelectControlValue,
|
|
14
|
-
orientation:
|
|
21
|
+
orientation: c.ORIENTATION.VERTICAL,
|
|
15
22
|
nameTrimming: i.productNameTrimmingControlValue === "1",
|
|
16
23
|
priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
|
|
17
24
|
priceFormatted: i.productPriceFormattedControlValue === "1",
|
|
@@ -33,7 +40,7 @@ function y() {
|
|
|
33
40
|
buttonVisible: i.productButtonVisible === "1"
|
|
34
41
|
};
|
|
35
42
|
}
|
|
36
|
-
function
|
|
43
|
+
function g(r) {
|
|
37
44
|
if (!r)
|
|
38
45
|
return null;
|
|
39
46
|
const t = r.closest(".items-block-v2");
|
|
@@ -41,14 +48,14 @@ function p(r) {
|
|
|
41
48
|
}
|
|
42
49
|
function m(r) {
|
|
43
50
|
return r ? {
|
|
44
|
-
CartItems:
|
|
45
|
-
BrowsedItems:
|
|
46
|
-
PurchasedItems:
|
|
51
|
+
CartItems: c.ITEMS_TYPE.CART_ITEMS,
|
|
52
|
+
BrowsedItems: c.ITEMS_TYPE.BROWSED_ITEMS,
|
|
53
|
+
PurchasedItems: c.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
47
54
|
// Also handle already correct formats
|
|
48
|
-
CART_ITEMS:
|
|
49
|
-
BROWSED_ITEMS:
|
|
50
|
-
PURCHASED_ITEMS:
|
|
51
|
-
}[r] ||
|
|
55
|
+
CART_ITEMS: c.ITEMS_TYPE.CART_ITEMS,
|
|
56
|
+
BROWSED_ITEMS: c.ITEMS_TYPE.BROWSED_ITEMS,
|
|
57
|
+
PURCHASED_ITEMS: c.ITEMS_TYPE.PURCHASED_ITEMS
|
|
58
|
+
}[r] || c.ITEMS_TYPE.CART_ITEMS : c.ITEMS_TYPE.CART_ITEMS;
|
|
52
59
|
}
|
|
53
60
|
function f(r, t) {
|
|
54
61
|
if (!r)
|
|
@@ -56,27 +63,27 @@ function f(r, t) {
|
|
|
56
63
|
if (r.includes("{{"))
|
|
57
64
|
return r;
|
|
58
65
|
if (/^\d+$/.test(r)) {
|
|
59
|
-
const e = parseInt(r) - 1,
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
66
|
+
const e = parseInt(r) - 1, n = p[t];
|
|
67
|
+
if (n && n[e])
|
|
68
|
+
return n[e].value;
|
|
62
69
|
}
|
|
63
70
|
return i.cartItemsSelectControlValue;
|
|
64
71
|
}
|
|
65
|
-
function
|
|
72
|
+
function I(r) {
|
|
66
73
|
const t = r.querySelector("esd-config-block");
|
|
67
74
|
if (!t)
|
|
68
75
|
return null;
|
|
69
|
-
const e = (
|
|
76
|
+
const e = (a, s) => a == null ? s : a === "1" || a === "true", n = (a, s) => a || s, o = t.getAttribute("data-type"), u = m(o), d = t.getAttribute("data-cart_items_select_control_value"), l = f(d, u);
|
|
70
77
|
return {
|
|
71
78
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
|
-
blockInstanceId:
|
|
79
|
+
blockInstanceId: n(
|
|
73
80
|
t.getAttribute("data-block-instance-id"),
|
|
74
81
|
_()
|
|
75
82
|
),
|
|
76
|
-
source:
|
|
77
|
-
type:
|
|
83
|
+
source: u,
|
|
84
|
+
type: u,
|
|
78
85
|
itemsSelectValue: l,
|
|
79
|
-
orientation: t.getAttribute("data-card_orientation_control_value") ||
|
|
86
|
+
orientation: t.getAttribute("data-card_orientation_control_value") || c.ORIENTATION.VERTICAL,
|
|
80
87
|
nameTrimming: e(
|
|
81
88
|
t.getAttribute("data-product_name_control_trim"),
|
|
82
89
|
!0
|
|
@@ -93,11 +100,11 @@ function C(r) {
|
|
|
93
100
|
t.getAttribute("data-product_price_control_single_price"),
|
|
94
101
|
!1
|
|
95
102
|
),
|
|
96
|
-
priceCurrencySymbol:
|
|
103
|
+
priceCurrencySymbol: n(
|
|
97
104
|
t.getAttribute("data-product_price_control_currency_symbol"),
|
|
98
105
|
i.productPriceCurrencySymbolControlValue
|
|
99
106
|
),
|
|
100
|
-
priceCurrencyLocation:
|
|
107
|
+
priceCurrencyLocation: n(
|
|
101
108
|
t.getAttribute("data-product_price_currency_location"),
|
|
102
109
|
i.productPriceCurrencyLocationControlValue
|
|
103
110
|
),
|
|
@@ -106,15 +113,15 @@ function C(r) {
|
|
|
106
113
|
t.getAttribute("data-product_quantity_control_enabled"),
|
|
107
114
|
!0
|
|
108
115
|
),
|
|
109
|
-
buttonLink:
|
|
116
|
+
buttonLink: n(
|
|
110
117
|
t.getAttribute("data-product_button_link"),
|
|
111
118
|
i.productButtonLinkControlValue
|
|
112
119
|
),
|
|
113
|
-
imageLink:
|
|
120
|
+
imageLink: n(
|
|
114
121
|
t.getAttribute("data-product_image_link"),
|
|
115
122
|
i.productImageLinkControlValue
|
|
116
123
|
),
|
|
117
|
-
buttonLabel:
|
|
124
|
+
buttonLabel: n(
|
|
118
125
|
t.getAttribute("data-product_button_control_label"),
|
|
119
126
|
"Buy"
|
|
120
127
|
),
|
|
@@ -149,7 +156,7 @@ function C(r) {
|
|
|
149
156
|
)
|
|
150
157
|
};
|
|
151
158
|
}
|
|
152
|
-
function
|
|
159
|
+
function C(r) {
|
|
153
160
|
if (typeof r.getAttribute != "function")
|
|
154
161
|
return null;
|
|
155
162
|
const t = r.getAttribute("esd-ext-config");
|
|
@@ -163,31 +170,32 @@ function I(r) {
|
|
|
163
170
|
}
|
|
164
171
|
return null;
|
|
165
172
|
}
|
|
166
|
-
function
|
|
167
|
-
const t =
|
|
173
|
+
function V(r) {
|
|
174
|
+
const t = g(r);
|
|
168
175
|
if (!t)
|
|
169
176
|
return null;
|
|
170
177
|
const e = t.getNodeConfig();
|
|
171
178
|
if (e && e.initialized)
|
|
172
179
|
return e;
|
|
180
|
+
const n = C(t);
|
|
181
|
+
if (n)
|
|
182
|
+
return n;
|
|
173
183
|
const o = I(t);
|
|
174
|
-
|
|
175
|
-
return o;
|
|
176
|
-
const c = C(t);
|
|
177
|
-
return c || null;
|
|
184
|
+
return o || null;
|
|
178
185
|
}
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
186
|
+
function M(r, t, e, n) {
|
|
187
|
+
const o = g(r);
|
|
188
|
+
if (!o)
|
|
182
189
|
return;
|
|
183
|
-
const d = { ...
|
|
184
|
-
l.modifyHtml(
|
|
190
|
+
const d = { ...o.getNodeConfig() || {}, ...e }, l = n ?? t.getDocumentModifier();
|
|
191
|
+
l.modifyHtml(o).setNodeConfig(d), n || l.apply(new b("Update Items block configuration"));
|
|
185
192
|
}
|
|
186
193
|
export {
|
|
187
|
-
|
|
194
|
+
y as deriveItemNumber,
|
|
195
|
+
S as escapeReplacement,
|
|
188
196
|
_ as generateBlockInstanceId,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
A as getDefaultItemsBlockConfig,
|
|
198
|
+
V as getItemsBlockConfig,
|
|
199
|
+
g as getItemsBlockContainer,
|
|
200
|
+
M as setItemsBlockConfig
|
|
193
201
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as
|
|
2
|
-
import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as g, buildElementRenderer as E, buildCellOptions as
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as A, ATTR_PRODUCT_PRICE as m } from "../../constants/selectors.js";
|
|
2
|
+
import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as g, buildElementRenderer as E, buildCellOptions as i, resolveInlinePriceOrder as w, DEFAULT_CARD_VISIBILITY as y } from "../utils.js";
|
|
3
3
|
import { listElementRenderer as L, renderInlineListPriceRow as O } from "./elementRenderer.js";
|
|
4
4
|
const S = "0 5px";
|
|
5
5
|
function U(l, r, n) {
|
|
@@ -27,40 +27,40 @@ const N = `
|
|
|
27
27
|
</td>
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
30
|
+
function x(l, r = g, n = {}, e = {}) {
|
|
31
31
|
const {
|
|
32
32
|
cellPadding: o = S,
|
|
33
33
|
cardBackgroundColor: d,
|
|
34
34
|
visibility: c,
|
|
35
|
-
priceInline:
|
|
36
|
-
} = e, u = d ? ` style="background-color: ${d};"` : "", s = E(L, r, n), P = s[p](l,
|
|
35
|
+
priceInline: a = !1
|
|
36
|
+
} = e, u = d ? ` style="table-layout: fixed; background-color: ${d};"` : ' style="table-layout: fixed;"', s = E(L, r, n), P = s[p](l, i(p, e)), R = w(r), T = `
|
|
37
37
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
38
38
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
39
39
|
<tbody>
|
|
40
|
-
${r.filter((t) => t !== p && t !== C).filter((t) => !(
|
|
41
|
-
const b = (c == null ? void 0 : c[t]) ?? y[t] ?? !0,
|
|
40
|
+
${r.filter((t) => t !== p && t !== C).filter((t) => !(a && t === R.skip)).filter((t) => s[t]).map((t) => {
|
|
41
|
+
const b = (c == null ? void 0 : c[t]) ?? y[t] ?? !0, f = a && t === R.anchor ? O(
|
|
42
42
|
l,
|
|
43
43
|
R.originalFirst,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
) : s[t](l,
|
|
47
|
-
return U(
|
|
44
|
+
i(m, e),
|
|
45
|
+
i(A, e)
|
|
46
|
+
) : s[t](l, i(t, e));
|
|
47
|
+
return U(f, t, b);
|
|
48
48
|
}).join(`
|
|
49
49
|
`)}
|
|
50
50
|
</tbody>
|
|
51
51
|
</table>
|
|
52
52
|
</td>
|
|
53
|
-
`, _ = s[C](l,
|
|
53
|
+
`, _ = s[C](l, i(C, e)), D = P + T + _;
|
|
54
54
|
return N.replace("{-{-CARD_PADDING-}-}", o).replace("{-{-WRAPPER_STYLE-}-}", u).replace("{-{-PRODUCT_CONTENT-}-}", D);
|
|
55
55
|
}
|
|
56
56
|
function W(l, r, n = {}, e = {}) {
|
|
57
57
|
const o = I(e.rowSpacingPx);
|
|
58
58
|
return l.map((d, c) => {
|
|
59
|
-
const
|
|
60
|
-
return c > 0 ? o +
|
|
59
|
+
const a = x(d, r, n, e);
|
|
60
|
+
return c > 0 ? o + a : a;
|
|
61
61
|
}).join("");
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
x as getListProductCard,
|
|
65
65
|
W as prepareProductRows
|
|
66
66
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
2
|
-
import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as
|
|
2
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
|
|
3
3
|
import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
|
|
4
|
-
import { toCustomCompositionKey as
|
|
5
|
-
import { extractWrapperTags as
|
|
6
|
-
import { hasQuerySelectorAll as
|
|
4
|
+
import { toCustomCompositionKey as v } from "../templates/utils.js";
|
|
5
|
+
import { extractWrapperTags as R } from "./preserveTextStyles.js";
|
|
6
|
+
import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as U } from "./tagName.js";
|
|
7
7
|
const s = [
|
|
8
8
|
"font-size",
|
|
9
9
|
"font-family",
|
|
@@ -39,94 +39,94 @@ const s = [
|
|
|
39
39
|
"border-radius",
|
|
40
40
|
"margin"
|
|
41
41
|
], b = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
|
|
42
|
-
{ attrKey:
|
|
43
|
-
{ attrKey:
|
|
44
|
-
{ attrKey:
|
|
45
|
-
{ attrKey:
|
|
46
|
-
{ attrKey:
|
|
42
|
+
{ attrKey: E, blockId: c.NAME, kind: "text" },
|
|
43
|
+
{ attrKey: p, blockId: c.PRICE, kind: "text" },
|
|
44
|
+
{ attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
|
|
45
|
+
{ attrKey: C, blockId: c.OMNIBUS_PRICE, kind: "text" },
|
|
46
|
+
{ attrKey: A, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
|
|
47
47
|
{ attrKey: P, blockId: c.BUTTON, kind: "button" },
|
|
48
|
-
{ attrKey:
|
|
48
|
+
{ attrKey: q, blockId: c.IMAGE, kind: "image" }
|
|
49
49
|
];
|
|
50
|
-
function
|
|
50
|
+
function O(t) {
|
|
51
51
|
return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
|
|
52
52
|
}
|
|
53
53
|
function L(t) {
|
|
54
54
|
return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
|
|
55
55
|
}
|
|
56
56
|
function a(t, e, r) {
|
|
57
|
-
!e || !
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
!e || !I(e) || r.forEach((n) => {
|
|
58
|
+
const o = e.getStyle(n);
|
|
59
|
+
o && o !== "inherit" && o !== "initial" && (t[n] = o);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function h(t) {
|
|
63
63
|
return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
if (!t || !
|
|
65
|
+
function k(t) {
|
|
66
|
+
if (!t || !I(t))
|
|
67
67
|
return;
|
|
68
68
|
const e = t.getStyle("background-color") || t.getStyle("background");
|
|
69
69
|
return e && !b.has(e) ? e : void 0;
|
|
70
70
|
}
|
|
71
71
|
function g(t, e) {
|
|
72
72
|
const r = {};
|
|
73
|
-
return a(r, t, e),
|
|
73
|
+
return a(r, t, e), h(r);
|
|
74
74
|
}
|
|
75
75
|
function w(t) {
|
|
76
76
|
const e = t.querySelector("p"), r = {};
|
|
77
77
|
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);
|
|
78
|
-
const n =
|
|
79
|
-
return !n && !
|
|
78
|
+
const n = h(r), { openTags: o, closeTags: i } = R(O(e));
|
|
79
|
+
return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N),
|
|
83
|
-
return !n && !
|
|
81
|
+
function $(t) {
|
|
82
|
+
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), o = g(r, M), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = R(O(r)), m = L(r);
|
|
83
|
+
return !n && !o && !u && !T && !m ? null : {
|
|
84
84
|
buttonBorderStyle: n || void 0,
|
|
85
|
-
buttonAnchorStyle:
|
|
85
|
+
buttonAnchorStyle: o || void 0,
|
|
86
86
|
buttonFitToContainer: u || void 0,
|
|
87
|
-
buttonText:
|
|
87
|
+
buttonText: m || void 0,
|
|
88
88
|
openTags: T,
|
|
89
89
|
closeTags: d
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function K(t) {
|
|
93
93
|
const e = g(t.querySelector("img"), D);
|
|
94
94
|
return e ? { imgStyle: e } : null;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return e === "button" ?
|
|
96
|
+
function H(t, e) {
|
|
97
|
+
return e === "button" ? $(t) : e === "image" ? K(t) : w(t);
|
|
98
98
|
}
|
|
99
99
|
function f(t, e) {
|
|
100
100
|
if (!t || !("querySelector" in t))
|
|
101
101
|
return;
|
|
102
102
|
const r = t.querySelector(S) ?? t;
|
|
103
|
-
if (G.forEach(({ attrKey:
|
|
103
|
+
if (G.forEach(({ attrKey: i, blockId: u, kind: T }) => {
|
|
104
104
|
const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
|
|
105
|
-
d && e(d,
|
|
106
|
-
}), !
|
|
105
|
+
d && e(d, i, T);
|
|
106
|
+
}), !_(r))
|
|
107
107
|
return;
|
|
108
108
|
const n = /* @__PURE__ */ new Set();
|
|
109
109
|
r.querySelectorAll(
|
|
110
110
|
`[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
|
|
111
|
-
).forEach((
|
|
112
|
-
const u = l(
|
|
113
|
-
!u || n.has(u) || (n.add(u), e(
|
|
111
|
+
).forEach((i) => {
|
|
112
|
+
const u = l(i) ? i.getAttribute(x) : null;
|
|
113
|
+
!u || n.has(u) || (n.add(u), e(i, v(u), "text"));
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
function F(t) {
|
|
117
117
|
const e = {};
|
|
118
|
-
return f(t, (r, n,
|
|
118
|
+
return f(t, (r, n, o) => {
|
|
119
119
|
if (!("querySelector" in r))
|
|
120
120
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
121
|
+
const i = H(r, o);
|
|
122
|
+
i && (e[n] = i);
|
|
123
123
|
}), e;
|
|
124
124
|
}
|
|
125
125
|
function j(t) {
|
|
126
126
|
if (!t || !("querySelector" in t))
|
|
127
127
|
return;
|
|
128
128
|
const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
|
|
129
|
-
return
|
|
129
|
+
return k(r);
|
|
130
130
|
}
|
|
131
131
|
function X(t) {
|
|
132
132
|
if (!t)
|
|
@@ -134,28 +134,28 @@ function X(t) {
|
|
|
134
134
|
const e = l(t) ? t.getAttribute("bgcolor") : null;
|
|
135
135
|
if (e && !b.has(e))
|
|
136
136
|
return e;
|
|
137
|
-
const r =
|
|
137
|
+
const r = k(t);
|
|
138
138
|
if (r)
|
|
139
139
|
return r;
|
|
140
|
-
const n =
|
|
140
|
+
const n = U(t) ? t.getComputedStyle("background-color") : void 0;
|
|
141
141
|
return n && !b.has(n) ? n : void 0;
|
|
142
142
|
}
|
|
143
143
|
function z(t) {
|
|
144
144
|
const e = {};
|
|
145
|
-
return f(t, (r, n,
|
|
146
|
-
if (
|
|
145
|
+
return f(t, (r, n, o) => {
|
|
146
|
+
if (o !== "text")
|
|
147
147
|
return;
|
|
148
|
-
const
|
|
149
|
-
|
|
148
|
+
const i = X(r);
|
|
149
|
+
i && (e[n] = i);
|
|
150
150
|
}), e;
|
|
151
151
|
}
|
|
152
152
|
function Q(t) {
|
|
153
153
|
const e = {};
|
|
154
|
-
return f(t, (r, n,
|
|
155
|
-
if (
|
|
154
|
+
return f(t, (r, n, o) => {
|
|
155
|
+
if (o === "image")
|
|
156
156
|
return;
|
|
157
|
-
const
|
|
158
|
-
|
|
157
|
+
const i = l(r) ? r.getAttribute("align") : null;
|
|
158
|
+
i && (e[n] = i);
|
|
159
159
|
}), e;
|
|
160
160
|
}
|
|
161
161
|
const V = /^es-[pm]\d+[trbl]?$/;
|
|
@@ -167,44 +167,50 @@ function W(t) {
|
|
|
167
167
|
return r.length ? r.join(" ") : void 0;
|
|
168
168
|
}
|
|
169
169
|
function Y(t) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
if (!t || !("querySelector" in t))
|
|
171
|
+
return !1;
|
|
172
|
+
const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
|
|
173
|
+
return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
|
|
174
|
+
}
|
|
175
|
+
function J(t) {
|
|
176
|
+
const e = {}, r = Y(t);
|
|
177
|
+
return f(t, (n, o, i) => {
|
|
178
|
+
if (i === "image" || r && (o === p || o === y))
|
|
173
179
|
return;
|
|
174
|
-
const
|
|
175
|
-
|
|
180
|
+
const u = W(n);
|
|
181
|
+
u && (e[o] = u);
|
|
176
182
|
}), e;
|
|
177
183
|
}
|
|
178
|
-
function
|
|
184
|
+
function Z(t) {
|
|
179
185
|
const e = {};
|
|
180
186
|
return f(t, (r, n) => {
|
|
181
|
-
if (n !==
|
|
187
|
+
if (n !== C && n !== A || !l(r))
|
|
182
188
|
return;
|
|
183
|
-
const
|
|
184
|
-
(
|
|
189
|
+
const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
|
|
190
|
+
(o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
|
|
185
191
|
}), e;
|
|
186
192
|
}
|
|
187
|
-
function
|
|
193
|
+
function tt(t) {
|
|
188
194
|
const e = {};
|
|
189
195
|
if (!t || !("querySelector" in t))
|
|
190
196
|
return e;
|
|
191
197
|
const r = t.querySelector(S) ?? t;
|
|
192
|
-
return
|
|
198
|
+
return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
|
|
193
199
|
if (!l(n))
|
|
194
200
|
return;
|
|
195
|
-
const
|
|
196
|
-
|
|
201
|
+
const o = n.getAttribute("data-attribute-type"), i = n.getAttribute("data-visibility");
|
|
202
|
+
o && i != null && (e[o] = i !== "0");
|
|
197
203
|
}), e;
|
|
198
204
|
}
|
|
199
|
-
function
|
|
205
|
+
function ct(t) {
|
|
200
206
|
return {
|
|
201
207
|
styleTemplates: F(t),
|
|
202
208
|
cardBackgroundColor: j(t),
|
|
203
209
|
cellBackgroundColors: z(t),
|
|
204
210
|
cellAlignments: Q(t),
|
|
205
|
-
cellClasses:
|
|
206
|
-
omnibusTexts:
|
|
207
|
-
visibility:
|
|
211
|
+
cellClasses: J(t),
|
|
212
|
+
omnibusTexts: Z(t),
|
|
213
|
+
visibility: tt(t)
|
|
208
214
|
};
|
|
209
215
|
}
|
|
210
216
|
export {
|
|
@@ -212,8 +218,8 @@ export {
|
|
|
212
218
|
j as captureCardBackgroundColor,
|
|
213
219
|
Q as captureCellAlignments,
|
|
214
220
|
z as captureCellBackgroundColors,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
221
|
+
J as captureCellClasses,
|
|
222
|
+
Z as captureOmnibusTexts,
|
|
223
|
+
ct as captureStyles,
|
|
224
|
+
tt as captureVisibility
|
|
219
225
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
* The bridge handles two segment shapes:
|
|
10
10
|
*
|
|
11
11
|
* - `blueprint` segments with `blueprintType === 'email_template'` are
|
|
12
|
-
* applied to the Stripo editor
|
|
13
|
-
*
|
|
12
|
+
* applied to the Stripo editor, but ONLY after the user clicks
|
|
13
|
+
* "Apply to editor" in cortex-fe (which sets `applyRequested` on the
|
|
14
|
+
* segment). Before that the template is marked `pending` and nothing is
|
|
15
|
+
* written to Stripo. Once applied, refines flow through debounced;
|
|
16
|
+
* identical-html no-ops.
|
|
14
17
|
* - `error` segments (and message-level `isError` / `isCancelled`) trigger
|
|
15
18
|
* a localized toaster.
|
|
16
19
|
*
|
|
@@ -2,12 +2,17 @@ type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
|
|
|
2
2
|
/**
|
|
3
3
|
* Applies email_template blueprints from the chat agent to the Stripo editor.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The first apply is gated behind the user's "Apply to editor" click — until
|
|
6
|
+
* then a blueprint is only marked `pending` (see `markPending`) and nothing is
|
|
7
|
+
* written to the editor.
|
|
8
|
+
*
|
|
9
|
+
* - manual Apply click (first apply): immediate.
|
|
10
|
+
* - blueprint_update after the user has applied once: debounced 250 ms trailing
|
|
11
|
+
* so rapid mid-stream updates don't thrash updateHtmlAndCss.
|
|
8
12
|
*/
|
|
9
13
|
export declare const useEmailTemplateApplier: () => {
|
|
10
14
|
applyStatus: import("vue").Ref<Record<string, ApplyStatus>>;
|
|
15
|
+
markPending: (blueprintId: string) => void;
|
|
11
16
|
applyTemplate: (blueprintId: string, data: {
|
|
12
17
|
html?: string;
|
|
13
18
|
css?: string;
|
|
@@ -33,4 +33,13 @@ export declare class ItemsBlock extends Block {
|
|
|
33
33
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
34
34
|
*/
|
|
35
35
|
onDocumentChanged(node: ImmutableHtmlNode): void;
|
|
36
|
+
/**
|
|
37
|
+
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
|
|
38
|
+
* `.ins-product-td` container from the recovered config. Required for saved modules:
|
|
39
|
+
* `migrate()` (which backfills these) only runs at template load — never when a module
|
|
40
|
+
* is dropped into a live editor — so this is the one place the namespace + index get
|
|
41
|
+
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
42
|
+
* relies on this td-level fallback in pairProductVariables.
|
|
43
|
+
*/
|
|
44
|
+
private _stampProductTdDomAttributes;
|
|
36
45
|
}
|
|
@@ -3,6 +3,13 @@ declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
|
|
|
3
3
|
type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
|
|
4
4
|
type OrientationType = 'vertical' | 'horizontal';
|
|
5
5
|
type PriceOrientationType = 'vertical' | 'horizontal';
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a bare migrate-block `<td>` in a `<tr>` so it forms a valid table row.
|
|
8
|
+
* Stripo renders its `BlockType.*` tags as full rows, so both the migrate template
|
|
9
|
+
* (here) and the orientation-change rebuild (settingsControl._reOrderTemplate) must
|
|
10
|
+
* emit `<tr><td>` — otherwise the code editor flags the bare cell as invalid.
|
|
11
|
+
*/
|
|
12
|
+
export declare const wrapInTableRow: (html: string) => string;
|
|
6
13
|
type TemplateParameters = {
|
|
7
14
|
orientation: OrientationType;
|
|
8
15
|
itemsType: ProductType;
|
|
@@ -40,6 +40,18 @@ export declare function generateBlockInstanceId(): string;
|
|
|
40
40
|
* Prevents currency symbols like "$", "R$", "HK$" from being interpreted as special replacement patterns.
|
|
41
41
|
*/
|
|
42
42
|
export declare const escapeReplacement: (str: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Derives a card's 1-based product index from its `itemsSelectValue`.
|
|
45
|
+
* Prefers the position within ItemInCartOptions for the type; falls back to the
|
|
46
|
+
* `(N)` token in the value (e.g. "{{Browsed Item (3) Url}}" -> "3"); defaults to "1".
|
|
47
|
+
*
|
|
48
|
+
* Single source of truth so block.ts, settingsControl and template.ts stay in sync —
|
|
49
|
+
* the number feeds `data-number`, which pairProductVariables reads to index merge tags.
|
|
50
|
+
*
|
|
51
|
+
* `itemsSelectValue` is typed loosely because callers pass it straight from parsed
|
|
52
|
+
* configs where the field can be absent — the runtime guard below is load-bearing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveItemNumber(itemsSelectValue: string | undefined, itemsType: ProductType): string;
|
|
43
55
|
/**
|
|
44
56
|
* Returns default ItemsBlockConfig values.
|
|
45
57
|
* These are used when initializing a new block or when migrating from legacy format.
|
|
@@ -51,6 +51,12 @@ export declare function captureCellAlignments(node: ImmutableHtmlNode | null | u
|
|
|
51
51
|
* text-trim) keyed by composition key, so a regeneration can re-bake them
|
|
52
52
|
* instead of resetting to the renderer's hardcoded spacing classes. Stripo stores padding
|
|
53
53
|
* and margin as these classes (NOT inline style), so an inline-style capture misses them.
|
|
54
|
+
*
|
|
55
|
+
* Inline price mode: the merged columns carry POSITIONAL spacing classes
|
|
56
|
+
* (`es-p15l es-p5r` / `es-p5l es-p15r`) that build the side-by-side gap — layout
|
|
57
|
+
* mechanics, not user padding. Skip the price cells then, so toggling back to
|
|
58
|
+
* stacked resets them to the renderer defaults instead of baking the lopsided
|
|
59
|
+
* inline paddings (SD-145161).
|
|
54
60
|
*/
|
|
55
61
|
export declare function captureCellClasses(node: ImmutableHtmlNode | null | undefined): Record<string, string>;
|
|
56
62
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.1-beta.4718ccb",
|
|
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",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"guido": {
|
|
106
106
|
"stripo": {
|
|
107
|
-
"version": "2.
|
|
107
|
+
"version": "2.68.0"
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|