@useinsider/guido 3.13.1-beta.77f8a06 → 3.13.1-beta.88e4a0d
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 +4 -25
- package/dist/config/migrator/itemsBlockMigrator.js +45 -47
- package/dist/extensions/Blocks/Items/block.js +30 -30
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +22 -26
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +12 -12
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +1 -1
- package/dist/static/styles/components/wide-panel.css.js +7 -0
- package/dist/static/styles/customEditorStyle.css.js +8 -0
- package/dist/utils/pairProductVariables.js +60 -60
- package/package.json +3 -3
- package/dist/config/compiler/utils/itemsCompilerUtils.js +0 -28
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +0 -12
|
@@ -1,35 +1,14 @@
|
|
|
1
|
-
import { pairProductVariables as
|
|
2
|
-
|
|
3
|
-
const a = [
|
|
1
|
+
import { pairProductVariables as r } from "../../utils/pairProductVariables.js";
|
|
2
|
+
const t = [
|
|
4
3
|
{
|
|
5
4
|
id: "pair-product-variables",
|
|
6
5
|
description: "Replace product default values with template variables",
|
|
7
6
|
type: "custom",
|
|
8
|
-
processor:
|
|
7
|
+
processor: r,
|
|
9
8
|
priority: 60
|
|
10
9
|
// After recommendation rules (priority 50-53)
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: "wrap-hidden-price-mso-conditional",
|
|
14
|
-
// SD-147597: Outlook ignores display:none on <td>, so the horizontal layout's
|
|
15
|
-
// hidden price fallback renders too — duplicate price. Mark the hidden td(s)
|
|
16
|
-
// with safe placeholder comments and collapse them inline for web-engine Outlook.
|
|
17
|
-
description: "Mark hidden Items price tds for Outlook conditional hiding",
|
|
18
|
-
type: "custom",
|
|
19
|
-
processor: r,
|
|
20
|
-
priority: 65
|
|
21
|
-
// After pair-product-variables (60), before outlook rules (70+)
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: "swap-items-mso-markers",
|
|
25
|
-
// Injecting the delicate `<!-- -->` ghost token LAST (after reco minify P99
|
|
26
|
-
// and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
|
|
27
|
-
description: "Swap Items MSO markers into [if !mso] conditional comments",
|
|
28
|
-
type: "custom",
|
|
29
|
-
processor: (i) => i.replaceAll(`<!--${e}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${t}-->`, "<!--<![endif]-->"),
|
|
30
|
-
priority: 101
|
|
31
10
|
}
|
|
32
11
|
];
|
|
33
12
|
export {
|
|
34
|
-
|
|
13
|
+
t as itemsCompilerRules
|
|
35
14
|
};
|
|
@@ -88,11 +88,11 @@ function k(o) {
|
|
|
88
88
|
}
|
|
89
89
|
function h(o) {
|
|
90
90
|
var e;
|
|
91
|
-
const t = (
|
|
91
|
+
const t = (c, u) => c == null ? u : c === "1" || c === "true", r = (c, u) => c || u, l = o["data-type"] || o["data-source"], a = k(l), i = I[a];
|
|
92
92
|
let n = o["data-cart_items_select_control_value"] || ((e = i == null ? void 0 : i[0]) == null ? void 0 : e.value) || g.cartItemsSelectControlValue;
|
|
93
93
|
if (n && !n.includes("{{") && /^\d+$/.test(n)) {
|
|
94
|
-
const
|
|
95
|
-
u && u[
|
|
94
|
+
const c = parseInt(n) - 1, u = I[a];
|
|
95
|
+
u && u[c] && (n = u[c].value);
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
98
98
|
initialized: !0,
|
|
@@ -148,7 +148,7 @@ function N(o, t) {
|
|
|
148
148
|
};
|
|
149
149
|
return r[o] || r.CART_ITEMS;
|
|
150
150
|
}
|
|
151
|
-
class
|
|
151
|
+
class z {
|
|
152
152
|
constructor() {
|
|
153
153
|
M(this, "parser");
|
|
154
154
|
this.parser = new DOMParser();
|
|
@@ -159,13 +159,13 @@ class H {
|
|
|
159
159
|
return this.backfillV2ProductTdAttributes(t);
|
|
160
160
|
let r = this.removeJinjaConditionals(t);
|
|
161
161
|
r = this.replaceTemplateVariables(r);
|
|
162
|
-
const
|
|
162
|
+
const l = this.parser.parseFromString(r, "text/html"), a = l.querySelectorAll(
|
|
163
163
|
"td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
|
|
164
164
|
);
|
|
165
165
|
return q().$patch((n) => {
|
|
166
166
|
n.migrations = { ...n.migrations, [w]: a.length };
|
|
167
167
|
}), a.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (a.forEach((n) => {
|
|
168
|
-
const e = this.extractConfiguration(n),
|
|
168
|
+
const e = this.extractConfiguration(n), c = F({
|
|
169
169
|
orientation: e.orientation,
|
|
170
170
|
itemsType: e.itemsType,
|
|
171
171
|
itemId: e.itemId,
|
|
@@ -181,7 +181,7 @@ class H {
|
|
|
181
181
|
quantityStyles: e.quantityStyles,
|
|
182
182
|
nodeConfig: h(e.configBlockAttributes)
|
|
183
183
|
}), s = this.parser.parseFromString(
|
|
184
|
-
`<table><tbody><tr>${
|
|
184
|
+
`<table><tbody><tr>${c}</tr></tbody></table>`,
|
|
185
185
|
"text/html"
|
|
186
186
|
).querySelector("td");
|
|
187
187
|
if (s && n.parentNode) {
|
|
@@ -190,7 +190,7 @@ class H {
|
|
|
190
190
|
const d = s.querySelector("esd-config-block");
|
|
191
191
|
d && d.remove(), n.parentNode.replaceChild(s, n);
|
|
192
192
|
}
|
|
193
|
-
}),
|
|
193
|
+
}), l.documentElement.outerHTML);
|
|
194
194
|
} catch (r) {
|
|
195
195
|
return console.error("ItemsBlockMigrator failed:", r), t;
|
|
196
196
|
}
|
|
@@ -205,15 +205,15 @@ class H {
|
|
|
205
205
|
var C, D, P;
|
|
206
206
|
const r = k(
|
|
207
207
|
((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) ?? null
|
|
208
|
-
),
|
|
208
|
+
), l = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", a = parseInt(l) - 1, i = I[r], n = ((P = i == null ? void 0 : i[a]) == null ? void 0 : P.value) || i[0].value, e = t.querySelector('[product-attr="price"]'), c = (e == null ? void 0 : e.getAttribute("data-currency_symbol")) || "USD", s = ((e == null ? void 0 : e.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", _ = (e == null ? void 0 : e.getAttribute("data-formated")) !== "false", d = this.extractConfigBlockAttributes(t, r, l), b = d["data-card_orientation_control_value"];
|
|
209
209
|
let S;
|
|
210
210
|
b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
|
|
211
|
-
const y = t.querySelector('a[product-attr="name"]'), A = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, R = (e == null ? void 0 : e.getAttribute("style")) || void 0,
|
|
211
|
+
const y = t.querySelector('a[product-attr="name"]'), A = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, R = (e == null ? void 0 : e.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), L = (T == null ? void 0 : T.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), B = (E == null ? void 0 : E.getAttribute("style")) || void 0;
|
|
212
212
|
return {
|
|
213
213
|
orientation: S,
|
|
214
214
|
itemsType: r,
|
|
215
215
|
itemId: n,
|
|
216
|
-
currencySymbol:
|
|
216
|
+
currencySymbol: c,
|
|
217
217
|
currencyLocation: s,
|
|
218
218
|
formattedPrice: _,
|
|
219
219
|
configBlockAttributes: d,
|
|
@@ -231,7 +231,7 @@ class H {
|
|
|
231
231
|
* @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
|
|
232
232
|
* @param itemNumber - The item number (1-based index)
|
|
233
233
|
*/
|
|
234
|
-
extractConfigBlockAttributes(t, r,
|
|
234
|
+
extractConfigBlockAttributes(t, r, l) {
|
|
235
235
|
const a = t.querySelector("esd-config-block"), i = {};
|
|
236
236
|
if (!a)
|
|
237
237
|
return this.getDefaultConfigBlockAttributes();
|
|
@@ -240,18 +240,18 @@ class H {
|
|
|
240
240
|
}), i["data-cart_items_select_control_value"]) {
|
|
241
241
|
const e = i["data-cart_items_select_control_value"];
|
|
242
242
|
if (/^\d+$/.test(e)) {
|
|
243
|
-
const
|
|
244
|
-
u && u[
|
|
243
|
+
const c = parseInt(e) - 1, u = I[r];
|
|
244
|
+
u && u[c] && (i["data-cart_items_select_control_value"] = u[c].value);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
if (i["data-product_price_control_curency"]) {
|
|
248
248
|
const e = i["data-product_price_control_curency"];
|
|
249
|
-
let
|
|
250
|
-
e === "before" ?
|
|
249
|
+
let c = e;
|
|
250
|
+
e === "before" ? c = "0" : e === "after" && (c = "1"), i["data-product_price_control_curency"] = c, i["data-product_price_currency_location"] = c;
|
|
251
251
|
}
|
|
252
252
|
(!i["data-product_price_control_currency_symbol"] || i["data-product_price_control_currency_symbol"].trim() === "") && (i["data-product_price_control_currency_symbol"] = "USD");
|
|
253
253
|
const n = { ...this.getDefaultConfigBlockAttributes(), ...i };
|
|
254
|
-
return n["data-type"] = r, n["data-source"] = r, n["data-product_image_link"] = $(r,
|
|
254
|
+
return n["data-type"] = r, n["data-source"] = r, n["data-product_image_link"] = $(r, l), n["data-product_button_link"] = N(r, l), n;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
257
|
* Returns default esd-config-block attributes based on the old template structure
|
|
@@ -301,7 +301,7 @@ class H {
|
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
303
|
/**
|
|
304
|
-
* Backfills data-type (and data-number
|
|
304
|
+
* Backfills data-type (and data-number) onto v2 `.ins-product-td` elements
|
|
305
305
|
* from their persisted `esd-ext-config` nodeConfig, and strips the legacy
|
|
306
306
|
* static `width` that older builds baked onto the product-td.
|
|
307
307
|
*
|
|
@@ -326,24 +326,22 @@ class H {
|
|
|
326
326
|
if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
|
|
327
327
|
return t;
|
|
328
328
|
const r = this.parser.parseFromString(t, "text/html");
|
|
329
|
-
let
|
|
329
|
+
let l = !1;
|
|
330
330
|
return r.querySelectorAll(".ins-product-td").forEach((a) => {
|
|
331
|
-
a.hasAttribute("width") && (a.removeAttribute("width"),
|
|
332
|
-
const i = a.getAttribute("esd-ext-config");
|
|
333
|
-
let n = null;
|
|
334
|
-
try {
|
|
335
|
-
n = i ? JSON.parse(i) : null;
|
|
336
|
-
} catch {
|
|
337
|
-
}
|
|
338
|
-
if (!n || (!a.getAttribute("data-nodup") && typeof n.priceHideDiscount == "boolean" && (a.setAttribute("data-nodup", String(n.priceHideDiscount)), c = !0), a.getAttribute("data-type")))
|
|
339
|
-
return;
|
|
340
|
-
const e = n.type || n.source;
|
|
341
|
-
if (!e)
|
|
331
|
+
if (a.hasAttribute("width") && (a.removeAttribute("width"), l = !0), a.getAttribute("data-type"))
|
|
342
332
|
return;
|
|
343
|
-
a.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
333
|
+
const i = a.getAttribute("esd-ext-config");
|
|
334
|
+
if (i)
|
|
335
|
+
try {
|
|
336
|
+
const n = JSON.parse(i), e = n.type || n.source;
|
|
337
|
+
if (!e)
|
|
338
|
+
return;
|
|
339
|
+
a.setAttribute("data-type", e), l = !0;
|
|
340
|
+
const c = typeof n.itemsSelectValue == "string" ? n.itemsSelectValue.match(/\((\d+)\)/) : null;
|
|
341
|
+
c && a.getAttribute("data-number") !== c[1] && a.setAttribute("data-number", c[1]);
|
|
342
|
+
} catch {
|
|
343
|
+
}
|
|
344
|
+
}), l ? r.documentElement.outerHTML : t;
|
|
347
345
|
}
|
|
348
346
|
/**
|
|
349
347
|
* Fast check for the presence of any items block (cart / browsed / purchased)
|
|
@@ -364,15 +362,15 @@ class H {
|
|
|
364
362
|
* contains display condition Jinja scripts that should NOT be removed.
|
|
365
363
|
*/
|
|
366
364
|
removeJinjaConditionals(t) {
|
|
367
|
-
const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__",
|
|
368
|
-
let a =
|
|
365
|
+
const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", l = t.match(/esd-custom-display-conditions="[^"]*"/);
|
|
366
|
+
let a = l ? t.replace(l[0], r) : t;
|
|
369
367
|
return a = a.replace(
|
|
370
368
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}/g,
|
|
371
369
|
""
|
|
372
370
|
), a = a.replace(
|
|
373
371
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
|
|
374
372
|
""
|
|
375
|
-
), a = a.replace(/\{%\s*endif\s*%\}/g, ""),
|
|
373
|
+
), a = a.replace(/\{%\s*endif\s*%\}/g, ""), l && (a = a.replace(r, l[0])), a = a.replace(/\n\s*\n\s*\n/g, `
|
|
376
374
|
|
|
377
375
|
`), a;
|
|
378
376
|
}
|
|
@@ -387,30 +385,30 @@ class H {
|
|
|
387
385
|
*/
|
|
388
386
|
replaceTemplateVariables(t) {
|
|
389
387
|
const { PAIRS_FOR_EXTENSION: r } = K;
|
|
390
|
-
return t.replace(/{{([^}]+)}}/g, (
|
|
388
|
+
return t.replace(/{{([^}]+)}}/g, (l, a) => {
|
|
391
389
|
const i = a.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
|
|
392
390
|
if (!i)
|
|
393
|
-
return
|
|
394
|
-
const [, n, e,
|
|
391
|
+
return l;
|
|
392
|
+
const [, n, e, c] = i, u = V[n];
|
|
395
393
|
if (!u)
|
|
396
|
-
return console.warn(`Unknown variable prefix: ${n}`),
|
|
394
|
+
return console.warn(`Unknown variable prefix: ${n}`), l;
|
|
397
395
|
const s = x[e];
|
|
398
396
|
if (!s)
|
|
399
|
-
return console.warn(`Unknown variable suffix mapping for: ${e}`),
|
|
397
|
+
return console.warn(`Unknown variable suffix mapping for: ${e}`), l;
|
|
400
398
|
const { pairsKey: _, defaultKey: d, isArray: b } = s, y = r[_][u];
|
|
401
399
|
if (!y)
|
|
402
|
-
return console.warn(`No data found for: ${_}.${u}`),
|
|
400
|
+
return console.warn(`No data found for: ${_}.${u}`), l;
|
|
403
401
|
if (b) {
|
|
404
|
-
const f = parseInt(
|
|
405
|
-
return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`),
|
|
402
|
+
const f = parseInt(c) - 1, m = y[d];
|
|
403
|
+
return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`), l);
|
|
406
404
|
}
|
|
407
405
|
const A = y[d];
|
|
408
|
-
return A !== void 0 ? String(A) : (console.warn(`Default value not found: ${_}.${u}.${d}`),
|
|
406
|
+
return A !== void 0 ? String(A) : (console.warn(`Default value not found: ${_}.${u}.${d}`), l);
|
|
409
407
|
});
|
|
410
408
|
}
|
|
411
409
|
}
|
|
412
410
|
function Q(o) {
|
|
413
|
-
return new
|
|
411
|
+
return new z().migrate(o);
|
|
414
412
|
}
|
|
415
413
|
export {
|
|
416
414
|
Q as migrateItemsBlock
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BlockId as
|
|
2
|
-
import { useOnboardingStore as
|
|
1
|
+
import { BlockId as g } from "../../../enums/block.js";
|
|
2
|
+
import { useOnboardingStore as p } from "../../../stores/onboarding.js";
|
|
3
3
|
import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
|
|
4
4
|
import { Block as I, BlockCompositionType as C, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { SETTINGS_ENUMS as
|
|
5
|
+
import { SETTINGS_ENUMS as l, DefaultConfigValues as m } from "./enums/settingsEnums.js";
|
|
6
6
|
import { getDefaultTemplate as b } from "./template.js";
|
|
7
|
-
import { getItemsBlockContainer as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
7
|
+
import { getItemsBlockContainer as d, getItemsBlockConfig as u, deriveItemNumber as h, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
|
|
8
|
+
const f = g.Items;
|
|
9
|
+
class P extends I {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return f;
|
|
12
12
|
}
|
|
13
13
|
getIcon() {
|
|
14
14
|
return "items-icon";
|
|
@@ -24,15 +24,15 @@ class O extends I {
|
|
|
24
24
|
}
|
|
25
25
|
getSettingsPanelTitleHtml() {
|
|
26
26
|
return y(
|
|
27
|
-
|
|
27
|
+
f,
|
|
28
28
|
this.api.translate("Items"),
|
|
29
29
|
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.")
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
getTemplate() {
|
|
33
33
|
return b({
|
|
34
|
-
orientation:
|
|
35
|
-
itemsType:
|
|
34
|
+
orientation: l.ORIENTATION.VERTICAL,
|
|
35
|
+
itemsType: l.ITEMS_TYPE.CART_ITEMS,
|
|
36
36
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
37
37
|
currencySymbol: m.productPriceCurrencySymbolControlValue,
|
|
38
38
|
currencyLocation: m.productPriceCurrencyLocationControlValue,
|
|
@@ -45,23 +45,23 @@ class O extends I {
|
|
|
45
45
|
canBeSavedAsModule() {
|
|
46
46
|
return !0;
|
|
47
47
|
}
|
|
48
|
-
onCreated(
|
|
49
|
-
const t = this.api.getDocumentModifier(),
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
48
|
+
onCreated(o) {
|
|
49
|
+
const t = this.api.getDocumentModifier(), i = this.api.getDocumentRootCssNode();
|
|
50
|
+
i.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(i).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
51
|
+
const e = d(o);
|
|
52
|
+
if (!e)
|
|
53
53
|
return;
|
|
54
|
-
const r =
|
|
54
|
+
const r = e.getNodeConfig(), s = r && Object.keys(r).length > 0, n = u(o);
|
|
55
55
|
if (n != null && n.initialized)
|
|
56
56
|
if (s)
|
|
57
|
-
n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(
|
|
57
|
+
n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...n, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
|
|
58
58
|
else {
|
|
59
59
|
const a = this.api.getDocumentModifier();
|
|
60
|
-
a.modifyHtml(
|
|
60
|
+
a.modifyHtml(e).setNodeConfig(n), this._stampProductTdDomAttributes(e, n, a), a.apply(new c("Migrate legacy config to nodeConfig"));
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
const a = N();
|
|
64
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
64
|
+
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(a).apply(new c("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -70,33 +70,33 @@ class O extends I {
|
|
|
70
70
|
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
71
71
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
72
72
|
*/
|
|
73
|
-
onDocumentChanged(
|
|
74
|
-
const t =
|
|
73
|
+
onDocumentChanged(o) {
|
|
74
|
+
const t = d(o);
|
|
75
75
|
if (!t)
|
|
76
76
|
return;
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
77
|
+
const i = t.getNodeConfig();
|
|
78
|
+
if (i && Object.keys(i).length > 0)
|
|
79
79
|
return;
|
|
80
|
-
const r = u(
|
|
80
|
+
const r = u(o);
|
|
81
81
|
if (!(r != null && r.initialized))
|
|
82
82
|
return;
|
|
83
83
|
const s = this.api.getDocumentModifier();
|
|
84
84
|
s.modifyHtml(t).setNodeConfig(r), this._stampProductTdDomAttributes(t, r, s), s.apply(new c("Recover Items block config from saved module"));
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* Bakes the compiler-read DOM attributes (`data-type`, `data-number
|
|
87
|
+
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
|
|
88
88
|
* `.ins-product-td` container from the recovered config. Required for saved modules:
|
|
89
89
|
* `migrate()` (which backfills these) only runs at template load — never when a module
|
|
90
90
|
* is dropped into a live editor — so this is the one place the namespace + index get
|
|
91
91
|
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
92
92
|
* relies on this td-level fallback in pairProductVariables.
|
|
93
93
|
*/
|
|
94
|
-
_stampProductTdDomAttributes(
|
|
95
|
-
const
|
|
96
|
-
|
|
94
|
+
_stampProductTdDomAttributes(o, t, i) {
|
|
95
|
+
const e = h(t.itemsSelectValue, t.type);
|
|
96
|
+
i.modifyHtml(o).setAttribute("data-type", t.type), i.modifyHtml(o).setAttribute("data-number", e);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
f as BLOCK_ID,
|
|
101
|
+
P as ItemsBlock
|
|
102
102
|
};
|
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
4
|
-
import { getItemsBlockConfig as
|
|
5
|
-
const
|
|
1
|
+
import { UIElementType as o, UEAttr as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as r } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as n } from "../../enums/controlEnums.js";
|
|
4
|
+
import { getItemsBlockConfig as s, setItemsBlockConfig as a } from "../../utils/nodeConfigUtils.js";
|
|
5
|
+
const c = n.PRICE_HIDE_DISCOUNT, i = {
|
|
6
6
|
HIDE_DISCOUNT: "hideDiscount"
|
|
7
7
|
};
|
|
8
|
-
class
|
|
8
|
+
class C extends r {
|
|
9
9
|
getId() {
|
|
10
|
-
return
|
|
10
|
+
return c;
|
|
11
11
|
}
|
|
12
12
|
getTemplate() {
|
|
13
13
|
return `
|
|
14
|
-
<div class="container ${
|
|
14
|
+
<div class="container ${n.PRICE_HIDE_DISCOUNT}">
|
|
15
15
|
${this._getHideDiscount()}
|
|
16
16
|
</div>
|
|
17
17
|
`;
|
|
18
18
|
}
|
|
19
19
|
onRender() {
|
|
20
|
-
const
|
|
21
|
-
this.api.updateValues({ [i.HIDE_DISCOUNT]: (
|
|
22
|
-
this._onHideDiscountChange(
|
|
20
|
+
const e = s(this.currentNode);
|
|
21
|
+
this.api.updateValues({ [i.HIDE_DISCOUNT]: (e == null ? void 0 : e.priceHideDiscount) ?? !0 }), this.api.onValueChanged(i.HIDE_DISCOUNT, (t) => {
|
|
22
|
+
this._onHideDiscountChange(t);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
onTemplateNodeUpdated(
|
|
26
|
-
super.onTemplateNodeUpdated(
|
|
27
|
-
const
|
|
28
|
-
this.api.updateValues({ [i.HIDE_DISCOUNT]: (
|
|
25
|
+
onTemplateNodeUpdated(e) {
|
|
26
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
27
|
+
const t = s(this.currentNode);
|
|
28
|
+
this.api.updateValues({ [i.HIDE_DISCOUNT]: (t == null ? void 0 : t.priceHideDiscount) ?? !0 });
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
_onHideDiscountChange(
|
|
32
|
-
|
|
33
|
-
const e = this.api.getDocumentModifier();
|
|
34
|
-
u(this.currentNode, this.api, { priceHideDiscount: t }, e);
|
|
35
|
-
const o = (n = this.currentNode) == null ? void 0 : n.closest(".ins-product-td");
|
|
36
|
-
o && e.modifyHtml(o).setAttribute("data-nodup", String(t)), e.apply(new c("Update hide-discount setting")), this.api.updateValues({ [i.HIDE_DISCOUNT]: t });
|
|
31
|
+
_onHideDiscountChange(e) {
|
|
32
|
+
a(this.currentNode, this.api, { priceHideDiscount: e }), this.api.updateValues({ [i.HIDE_DISCOUNT]: e });
|
|
37
33
|
}
|
|
38
34
|
_getHideDiscount() {
|
|
39
35
|
return `
|
|
40
36
|
<div class="display-flex align-items-center justify-content-between">
|
|
41
|
-
<${
|
|
42
|
-
${
|
|
37
|
+
<${o.LABEL}
|
|
38
|
+
${d.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
|
|
43
39
|
>
|
|
44
|
-
</${
|
|
40
|
+
</${o.LABEL}>
|
|
45
41
|
${this._GuToggle(i.HIDE_DISCOUNT)}
|
|
46
42
|
</div>
|
|
47
43
|
</div>
|
|
@@ -49,6 +45,6 @@ class E extends p {
|
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
c as CONTROL_BLOCK_ID,
|
|
49
|
+
C as PriceHideDiscountControl
|
|
54
50
|
};
|
|
@@ -41,9 +41,9 @@ ${s.map((o) => ` - ${o}`).join(`
|
|
|
41
41
|
};
|
|
42
42
|
v.validatedClasses = /* @__PURE__ */ new Set();
|
|
43
43
|
v.validationErrors = /* @__PURE__ */ new Map();
|
|
44
|
-
var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e))(z || {}), P = class
|
|
44
|
+
var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e))(z || {}), P = class T extends i {
|
|
45
45
|
constructor() {
|
|
46
|
-
super(
|
|
46
|
+
super(T.REQUIRED_METHODS, T);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Determines if the block should be available for use in the editor.
|
|
@@ -222,9 +222,9 @@ var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAI
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
P.REQUIRED_METHODS = ["getId", "getTemplate", "getIcon", "getName", "getDescription"];
|
|
225
|
-
var qe = P, Z = class
|
|
225
|
+
var qe = P, Z = class c extends i {
|
|
226
226
|
constructor() {
|
|
227
|
-
super(
|
|
227
|
+
super(c.REQUIRED_METHODS, c);
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* @deprecated - use {@link getPreviewInnerHtml} instead
|
|
@@ -339,12 +339,12 @@ var j = {
|
|
|
339
339
|
height: "height"
|
|
340
340
|
}, Je = {
|
|
341
341
|
BLOCK_IMAGE: j
|
|
342
|
-
}, U = "esd-block-button", w = "esd-block-text", K = "esd-block-image", J = "esd-structure", ee = "esd-block-video", te = "esd-block-social", re = "esd-block-banner", ae = "esd-block-timer", ne = "esd-block-menu", se = "esd-block-html", ie = "esd-block-spacer", le = "esd-container-frame", Ee = "esd-stripe", oe = "esd-amp-form", I = ((e) => (e.BUTTON = `.${U}`, e.TEXT = `.${w}`, e.IMAGE = `.${K}`, e.STRUCTURE = `.${J}`, e.VIDEO = `.${ee}`, e.SOCIAL = `.${te}`, e.BANNER = `.${re}`, e.TIMER = `.${ae}`, e.MENU = `.${ne}`, e.HTML = `.${se}`, e.SPACER = `.${ie}`, e.CONTAINER = `.${le}`, e.STRIPE = `.${Ee}`, e.FORM = `.${oe}`, e))(I || {}), de = /* @__PURE__ */ ((e) => (e.BLOCK_IMAGE = "BLOCK_IMAGE", e.BLOCK_TEXT = "BLOCK_TEXT", e.BLOCK_BUTTON = "BLOCK_BUTTON", e.BLOCK_SPACER = "BLOCK_SPACER", e.BLOCK_VIDEO = "BLOCK_VIDEO", e.BLOCK_SOCIAL = "BLOCK_SOCIAL", e.BLOCK_BANNER = "BLOCK_BANNER", e.BLOCK_TIMER = "BLOCK_TIMER", e.BLOCK_MENU = "BLOCK_MENU", e.BLOCK_MENU_ITEM = "BLOCK_MENU_ITEM", e.BLOCK_HTML = "BLOCK_HTML", e.BLOCK_AMP_CAROUSEL = "BLOCK_AMP_CAROUSEL", e.BLOCK_AMP_ACCORDION = "BLOCK_AMP_ACCORDION", e.BLOCK_AMP_FORM = "BLOCK_AMP_FORM", e.CONTAINER = "CONTAINER", e.FORM_CONTAINER = "FORM_CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e.EMPTY_CONTAINER = "EMPTY_CONTAINER", e.CUSTOM_BLOCK_LINK = "CUSTOM_BLOCK_LINK", e.CUSTOM_BLOCK_IMAGE = "CUSTOM_BLOCK_IMAGE", e.CUSTOM_BLOCK_TEXT = "CUSTOM_BLOCK_TEXT", e))(de || {}), F = /* @__PURE__ */ ((e) => (e.ANCHOR_LINK_CONTAINER = "anchorLinkFormContainer", e.APPLY_CONDITION = "applyCondition", e.APPLY_CONDITION_SWITCHER = "applyConditionSwitcher", e.BACKGROUND_COLOR = "backgroundColor", e.BACKGROUND_IMAGE = "generalImageContainer", e.TEXT_COLOR = "textColor", e.TEXT_STYLE = "textStyle", e.TEXT_SIZE = "textSize", e.TEXT_LINE_SPACING = "textLineSpacing", e.TEXT_ALIGN = "textAlign", e.FIXED_HEIGHT_SWITCHER = "fixedHeightSwitcherForm", e.HIDDEN_NODE = "hiddenNode", e.SMART_BLOCK = "smartBlock", e.SYNCHRONIZED_MODULE = "synchronizedModuleForm", e.FONT_FAMILY = "generalFontFamilyForm", e.BLOCK_INTERNAL_INDENTS = "generalBlockInternalIndents", e.STRUCTURE_INTERNAL_INDENTS = "generalStructureInternalIndents", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.ADJUST_TO_WIDTH = "adjustToWidth", e.ALIGNMENT = "buttonAlignment", e.BORDER = "buttonBorder", e.BORDER_RADIUS = "buttonBorderRadius", e.COLOR = "buttonColor", e.BUTTON_BLOCK_BACKGROUND_COLOR = "buttonBlockBackgroundColor", e.EXTERNAL_INDENTS = "buttonExternalIndents", e.FIXED_HEIGHT = "buttonFixedHeightForm", e.FONT_COLOR = "buttonFontColor", e.FONT_FAMILY = "buttonFontFamily", e.FONT_SIZE = "buttonFontSize", e.ICON = "buttonIconContainer", e.ICON_ALIGN = "buttonIconAlign", e.ICON_INDENT = "buttonIconIndent", e.ICON_WIDTH = "buttonIconWidth", e.IMAGE = "buttonImageForm", e.INTERNAL_INDENTS = "buttonInternalIndents", e.LINK = "buttonLink", e.MIME_TYPE = "buttonMimeTypeForm", e.SWITCHER_HOVERED_STYLES = "buttonSwitcherHoveredStylesForm", e.TEXT = "buttonText", e.TEXT_STYLE_AND_COLOR = "buttonTextStyleAndColorForm", e.HOVERED_BORDER_COLOR = "hoveredStyleBorderButtonForm", e.HOVERED_COLOR = "hoveredButtonColorForm", e.HOVERED_TEXT_COLOR = "hoveredButtonTextColorForm", e))(H || {}), k = /* @__PURE__ */ ((e) => (e.HIDDEN_NODE = "hiddenNodeText", e.PARAGRAPH_STYLE = "paragraphStyleForm", e.ALIGN = "textAlignmentForm", e.ANCHOR_CONTAINER = "textAnchorForm", e.FONT_BACKGROUND_COLOR = "textBlockFontBackgroundColor", e.TEXT_BLOCK_BACKGROUND_COLOR = "textBlockBackgroundColor", e.FONT_COLOR = "textBlockFontColor", e.TEXT_BLOCK_FONT_FAMILY = "textBlockFontFamily", e.FONT_FAMILY = "textFontFamily", e.FONT_SIZE = "textBlockFontSize", e.FONT_WEIGHT = "textBlockFontWeight", e.DIRECTION = "textBlockDirectionForm", e.INSERT_FORM = "textBlockInsertForm", e.LINK_DATA = "textBlockLinkDataForm", e.FORMAT = "textBlockTextFormatForm", e.FIXED_HEIGHT = "textFixedHeightForm", e.INTERNAL_INDENTS = "textInternalIndents", e.LINE_HEIGHT = "textLineHeightForm", e.MIME_TYPE = "textMimeTypeForm", e.NO_LINE_WRAPS = "textNoLineWrapsForm", e))(k || {}), p = /* @__PURE__ */ ((e) => (e.ALT_TEXT = "altText", e.LINK = "blockLink", e.ALIGNMENT = "imageAlignment", e.ANCHOR_LINK_CONTAINER = "imageAnchorLinkContainerForm", e.BORDER_RADIUS = "imageBorderRadiusForm", e.IMAGE = "imageImageForm", e.EXTERNAL_INDENTS = "imageExternalIndents", e.MIME_TYPE = "imageMimeTypeForm", e.RESPONSIVE = "imageResponsive", e.ROLLOVER_IMAGE = "imageRolloverImageForm", e.ROLLOVER_SWITCHER = "imageRolloverSwitcherForm", e.SIZE = "imageSizeContainer", e))(p || {}), ue = /* @__PURE__ */ ((e) => (e.BACKGROUND_COLOR = "containerBackgroundColorForm", e.BORDER_FORM = "containerBorderForm", e.BORDER_RADIUS = "containerBorderRadiusForm", e.EXTERNAL_INDENTS = "containerExternalIndentsForm", e.IMAGE_CONTAINER = "containerImageContainerForm", e.MIME_TYPE = "containerMimeTypeForm", e.DISPLAY_CONDITIONS = "displayConditions", e.HIDDEN_NODE = "containerHiddenNodeForm", e))(ue || {}), n = {
|
|
342
|
+
}, U = "esd-block-button", w = "esd-block-text", K = "esd-block-image", J = "esd-structure", ee = "esd-block-video", te = "esd-block-social", re = "esd-block-banner", ae = "esd-block-timer", ne = "esd-block-menu", se = "esd-block-html", ie = "esd-block-spacer", le = "esd-container-frame", Ee = "esd-stripe", oe = "esd-amp-form", I = ((e) => (e.BUTTON = `.${U}`, e.TEXT = `.${w}`, e.IMAGE = `.${K}`, e.STRUCTURE = `.${J}`, e.VIDEO = `.${ee}`, e.SOCIAL = `.${te}`, e.BANNER = `.${re}`, e.TIMER = `.${ae}`, e.MENU = `.${ne}`, e.HTML = `.${se}`, e.SPACER = `.${ie}`, e.CONTAINER = `.${le}`, e.STRIPE = `.${Ee}`, e.FORM = `.${oe}`, e))(I || {}), de = /* @__PURE__ */ ((e) => (e.BLOCK_IMAGE = "BLOCK_IMAGE", e.BLOCK_TEXT = "BLOCK_TEXT", e.BLOCK_BUTTON = "BLOCK_BUTTON", e.BLOCK_SPACER = "BLOCK_SPACER", e.BLOCK_VIDEO = "BLOCK_VIDEO", e.BLOCK_SOCIAL = "BLOCK_SOCIAL", e.BLOCK_BANNER = "BLOCK_BANNER", e.BLOCK_TIMER = "BLOCK_TIMER", e.BLOCK_MENU = "BLOCK_MENU", e.BLOCK_MENU_ITEM = "BLOCK_MENU_ITEM", e.BLOCK_HTML = "BLOCK_HTML", e.BLOCK_AMP_CAROUSEL = "BLOCK_AMP_CAROUSEL", e.BLOCK_AMP_ACCORDION = "BLOCK_AMP_ACCORDION", e.BLOCK_AMP_FORM = "BLOCK_AMP_FORM", e.CONTAINER = "CONTAINER", e.FORM_CONTAINER = "FORM_CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e.EMPTY_CONTAINER = "EMPTY_CONTAINER", e.CUSTOM_BLOCK_LINK = "CUSTOM_BLOCK_LINK", e.CUSTOM_BLOCK_IMAGE = "CUSTOM_BLOCK_IMAGE", e.CUSTOM_BLOCK_TEXT = "CUSTOM_BLOCK_TEXT", e))(de || {}), F = /* @__PURE__ */ ((e) => (e.ANCHOR_LINK_CONTAINER = "anchorLinkFormContainer", e.APPLY_CONDITION = "applyCondition", e.APPLY_CONDITION_SWITCHER = "applyConditionSwitcher", e.BACKGROUND_COLOR = "backgroundColor", e.BACKGROUND_IMAGE = "generalImageContainer", e.TEXT_COLOR = "textColor", e.TEXT_STYLE = "textStyle", e.TEXT_SIZE = "textSize", e.TEXT_LINE_SPACING = "textLineSpacing", e.TEXT_ALIGN = "textAlign", e.FIXED_HEIGHT_SWITCHER = "fixedHeightSwitcherForm", e.HIDDEN_NODE = "hiddenNode", e.SMART_BLOCK = "smartBlock", e.SYNCHRONIZED_MODULE = "synchronizedModuleForm", e.FONT_FAMILY = "generalFontFamilyForm", e.BLOCK_INTERNAL_INDENTS = "generalBlockInternalIndents", e.STRUCTURE_INTERNAL_INDENTS = "generalStructureInternalIndents", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.ADJUST_TO_WIDTH = "adjustToWidth", e.ALIGNMENT = "buttonAlignment", e.BORDER = "buttonBorder", e.BORDER_RADIUS = "buttonBorderRadius", e.COLOR = "buttonColor", e.BUTTON_BLOCK_BACKGROUND_COLOR = "buttonBlockBackgroundColor", e.EXTERNAL_INDENTS = "buttonExternalIndents", e.FIXED_HEIGHT = "buttonFixedHeightForm", e.FONT_COLOR = "buttonFontColor", e.FONT_FAMILY = "buttonFontFamily", e.FONT_SIZE = "buttonFontSize", e.FONT_WEIGHT = "buttonFontWeight", e.ICON = "buttonIconContainer", e.ICON_ALIGN = "buttonIconAlign", e.ICON_INDENT = "buttonIconIndent", e.ICON_WIDTH = "buttonIconWidth", e.IMAGE = "buttonImageForm", e.INTERNAL_INDENTS = "buttonInternalIndents", e.LINK = "buttonLink", e.MIME_TYPE = "buttonMimeTypeForm", e.SWITCHER_HOVERED_STYLES = "buttonSwitcherHoveredStylesForm", e.TEXT = "buttonText", e.TEXT_STYLE_AND_COLOR = "buttonTextStyleAndColorForm", e.HOVERED_BORDER_COLOR = "hoveredStyleBorderButtonForm", e.HOVERED_COLOR = "hoveredButtonColorForm", e.HOVERED_TEXT_COLOR = "hoveredButtonTextColorForm", e))(H || {}), k = /* @__PURE__ */ ((e) => (e.HIDDEN_NODE = "hiddenNodeText", e.PARAGRAPH_STYLE = "paragraphStyleForm", e.ALIGN = "textAlignmentForm", e.ANCHOR_CONTAINER = "textAnchorForm", e.FONT_BACKGROUND_COLOR = "textBlockFontBackgroundColor", e.TEXT_BLOCK_BACKGROUND_COLOR = "textBlockBackgroundColor", e.FONT_COLOR = "textBlockFontColor", e.TEXT_BLOCK_FONT_FAMILY = "textBlockFontFamily", e.FONT_FAMILY = "textFontFamily", e.FONT_SIZE = "textBlockFontSize", e.FONT_WEIGHT = "textBlockFontWeight", e.DIRECTION = "textBlockDirectionForm", e.INSERT_FORM = "textBlockInsertForm", e.LINK_DATA = "textBlockLinkDataForm", e.FORMAT = "textBlockTextFormatForm", e.FIXED_HEIGHT = "textFixedHeightForm", e.INTERNAL_INDENTS = "textInternalIndents", e.LINE_HEIGHT = "textLineHeightForm", e.MIME_TYPE = "textMimeTypeForm", e.NO_LINE_WRAPS = "textNoLineWrapsForm", e))(k || {}), p = /* @__PURE__ */ ((e) => (e.ALT_TEXT = "altText", e.LINK = "blockLink", e.ALIGNMENT = "imageAlignment", e.ANCHOR_LINK_CONTAINER = "imageAnchorLinkContainerForm", e.BORDER_RADIUS = "imageBorderRadiusForm", e.IMAGE = "imageImageForm", e.EXTERNAL_INDENTS = "imageExternalIndents", e.MIME_TYPE = "imageMimeTypeForm", e.RESPONSIVE = "imageResponsive", e.ROLLOVER_IMAGE = "imageRolloverImageForm", e.ROLLOVER_SWITCHER = "imageRolloverSwitcherForm", e.SIZE = "imageSizeContainer", e))(p || {}), ue = /* @__PURE__ */ ((e) => (e.BACKGROUND_COLOR = "containerBackgroundColorForm", e.BORDER_FORM = "containerBorderForm", e.BORDER_RADIUS = "containerBorderRadiusForm", e.EXTERNAL_INDENTS = "containerExternalIndentsForm", e.IMAGE_CONTAINER = "containerImageContainerForm", e.MIME_TYPE = "containerMimeTypeForm", e.DISPLAY_CONDITIONS = "displayConditions", e.HIDDEN_NODE = "containerHiddenNodeForm", e))(ue || {}), n = {
|
|
343
343
|
BLOCK_BUTTON: H,
|
|
344
344
|
BLOCK_TEXT: k,
|
|
345
345
|
BLOCK_IMAGE: p,
|
|
346
346
|
GENERAL: F
|
|
347
|
-
}, Ie = /* @__PURE__ */ ((e) => (e.SAVE_AS_MODULE = "saveAsModule", e.IMPROVE_WITH_AI = "improveWithAI", e.MOVE = "move", e.COPY = "copy", e.REMOVE = "remove", e.CLEAR_CONTAINER = "clearContainer", e.EXTERNAL_DISPLAY_CONDITION = "externalDisplayCondition", e))(Ie || {}),
|
|
347
|
+
}, Ie = /* @__PURE__ */ ((e) => (e.SAVE_AS_MODULE = "saveAsModule", e.IMPROVE_WITH_AI = "improveWithAI", e.MOVE = "move", e.COPY = "copy", e.REMOVE = "remove", e.CLEAR_CONTAINER = "clearContainer", e.EXTERNAL_DISPLAY_CONDITION = "externalDisplayCondition", e))(Ie || {}), Te = /* @__PURE__ */ ((e) => (e.previewDeviceMode = "previewDeviceMode", e.panelPosition = "panelPosition", e.themeMode = "themeMode", e))(Te || {}), ce = /* @__PURE__ */ ((e) => (e.DESKTOP = "DESKTOP", e.MOBILE = "MOBILE", e))(ce || {}), be = /* @__PURE__ */ ((e) => (e.SETTINGS = "settings", e.STYLES = "styles", e.DATA = "data", e))(be || {}), a = {
|
|
348
348
|
name: "name",
|
|
349
349
|
disabled: "disabled"
|
|
350
350
|
}, he = {
|
|
@@ -619,7 +619,7 @@ var j = {
|
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
621
|
G.REQUIRED_METHODS = ["getId", "getTemplate"];
|
|
622
|
-
var
|
|
622
|
+
var Tt = G, Xe = class m extends i {
|
|
623
623
|
constructor() {
|
|
624
624
|
super(m.REQUIRED_METHODS, m);
|
|
625
625
|
}
|
|
@@ -694,7 +694,7 @@ var V = class extends x {
|
|
|
694
694
|
const t = e.querySelectorAll(I.IMAGE), r = e.asElement().hasClass(K) ? [e] : [];
|
|
695
695
|
return t.length ? t : r;
|
|
696
696
|
}
|
|
697
|
-
},
|
|
697
|
+
}, ct = class extends V {
|
|
698
698
|
getParentControlId() {
|
|
699
699
|
return n.BLOCK_IMAGE.EXTERNAL_INDENTS;
|
|
700
700
|
}
|
|
@@ -1215,17 +1215,17 @@ export {
|
|
|
1215
1215
|
It as ButtonTextStyleAndFontColorBuiltInControl,
|
|
1216
1216
|
ue as ContainerControls,
|
|
1217
1217
|
Ie as ContextActionType,
|
|
1218
|
-
|
|
1219
|
-
|
|
1218
|
+
Tt as Control,
|
|
1219
|
+
Te as EditorStatePropertyType,
|
|
1220
1220
|
Ve as Extension,
|
|
1221
1221
|
Nt as ExtensionBuilder,
|
|
1222
1222
|
F as GeneralControls,
|
|
1223
1223
|
Dt as IconsRegistry,
|
|
1224
1224
|
p as ImageControls,
|
|
1225
|
-
|
|
1225
|
+
ct as ImageMarginsBuiltInControl,
|
|
1226
1226
|
bt as ImageSizeBuiltInControl,
|
|
1227
1227
|
St as ModificationDescription,
|
|
1228
|
-
|
|
1228
|
+
ce as PreviewDeviceMode,
|
|
1229
1229
|
ht as SettingsPanelRegistry,
|
|
1230
1230
|
mt as SettingsPanelTab,
|
|
1231
1231
|
be as SettingsTab,
|
package/dist/package.json.js
CHANGED
|
@@ -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
|
|
@@ -103,6 +103,13 @@ ue-control-panel,
|
|
|
103
103
|
display: none !important;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/* Stripo 2.72 added a "Restore default styles" button to the settings header that does
|
|
107
|
+
nothing when clicked — styles are never reset. Reported upstream; hidden until fixed.
|
|
108
|
+
Scoped to Stripo's own e2e hook class so the sibling close (X) and level-up buttons stay. */
|
|
109
|
+
.control-panel-header .e2e-restore-default-styles {
|
|
110
|
+
display: none !important;
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
.container.droppable-header-container ue-button:last-child {
|
|
107
114
|
margin-right: 0;
|
|
108
115
|
}
|
|
@@ -47,6 +47,14 @@ const n = `.esd-x,
|
|
|
47
47
|
display: none !important;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/* Stripo 2.72 renders drag-to-resize handles over images. Product image size must come
|
|
51
|
+
from the Image Size control in the settings panel, not free-hand dragging, which breaks
|
|
52
|
+
the card layout. Grid layout uses .product-image, list layout .product-image-cell. */
|
|
53
|
+
.recommendation-block-v2 .product-image ue-image-resize-control,
|
|
54
|
+
.recommendation-block-v2 .product-image-cell ue-image-resize-control {
|
|
55
|
+
display: none !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
/* Mobile layout: hide mobile container by default in editor */
|
|
51
59
|
.ins-recommendation-mobile-container {
|
|
52
60
|
display: none;
|
|
@@ -1,85 +1,85 @@
|
|
|
1
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
|
-
import { preserveTextStyles as
|
|
4
|
-
function
|
|
5
|
-
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"),
|
|
3
|
+
import { preserveTextStyles as C } from "./preserveTextStyles.js";
|
|
4
|
+
function V(L) {
|
|
5
|
+
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), g = new DOMParser().parseFromString(H, "text/html"), m = N.PAIRS_FOR_EXTENSION;
|
|
6
6
|
Object.entries(m).forEach(([r, f]) => {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
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) => {
|
|
10
10
|
var F, I, w;
|
|
11
|
-
const T = t.getAttribute("data-type") ||
|
|
11
|
+
const T = t.getAttribute("data-type") || y, u = t.getAttribute("data-number") || A, d = f[T];
|
|
12
12
|
if (d)
|
|
13
13
|
switch (r) {
|
|
14
14
|
case "imageSrc": {
|
|
15
|
-
let e = null,
|
|
16
|
-
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)
|
|
17
17
|
break;
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
18
|
+
const a = d.DEFAULT, s = d.ATTR;
|
|
19
|
+
if (a && e.src) {
|
|
20
20
|
const o = e.src;
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
return o.includes(
|
|
21
|
+
a.some((h) => {
|
|
22
|
+
const l = h.split("/").pop() || "", $ = o.split("/").pop() || "";
|
|
23
|
+
return o.includes(h) || o.includes(l) || $ === l;
|
|
24
24
|
}) && (e.src = `{{${s}_${u}}}`);
|
|
25
25
|
}
|
|
26
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}}}`),
|
|
27
|
+
if (n && e.setAttribute("alt", `{{${n}_${u}}}`), i) {
|
|
28
28
|
const o = (w = m.itemLink) == null ? void 0 : w[T];
|
|
29
29
|
if (o) {
|
|
30
|
-
const
|
|
31
|
-
(
|
|
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}}}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
36
|
case "name": {
|
|
37
|
-
const e = d,
|
|
38
|
-
t.textContent && (t.innerHTML =
|
|
37
|
+
const e = d, i = e.ATTR, a = e.DEFAULT_HREF || "#!", s = e.HREF;
|
|
38
|
+
t.textContent && (t.innerHTML = C(t, `{{${i}_${u}}}`));
|
|
39
39
|
const n = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
40
40
|
if (n && s) {
|
|
41
|
-
const o = n.href,
|
|
42
|
-
(o ===
|
|
41
|
+
const o = n.href, E = `${window.location.href}${a}`;
|
|
42
|
+
(o === E || o.endsWith(a)) && (n.href = `{{${s}_${u}}}`);
|
|
43
43
|
}
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
case "price":
|
|
47
47
|
case "originalPrice": {
|
|
48
|
-
const e = d,
|
|
49
|
-
let
|
|
50
|
-
n ?
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
const
|
|
54
|
-
let
|
|
55
|
-
q ?
|
|
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);
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
case "quantity": {
|
|
59
|
-
const e = d,
|
|
60
|
-
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}}}`));
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
case "button": {
|
|
64
|
-
const e = d,
|
|
64
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t.tagName === "A" ? t : t.querySelector("a");
|
|
65
65
|
if (s) {
|
|
66
|
-
const n = s.href || "", o = `${window.location.href}${
|
|
67
|
-
(n === "" || n === "#" || n === o || n.endsWith(
|
|
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}}}`);
|
|
68
68
|
}
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
case "itemLink": {
|
|
72
|
-
const e = d,
|
|
72
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t;
|
|
73
73
|
if (s.href) {
|
|
74
|
-
const n = s.href, o = `${window.location.href}${
|
|
75
|
-
(n === o || n.endsWith(
|
|
74
|
+
const n = s.href, o = `${window.location.href}${a}`;
|
|
75
|
+
(n === o || n.endsWith(a)) && (s.href = `{{${i}_${u}}}`);
|
|
76
76
|
}
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
default: {
|
|
80
80
|
if ("ATTR" in d) {
|
|
81
81
|
const e = d.ATTR;
|
|
82
|
-
t.textContent && (t.innerHTML =
|
|
82
|
+
t.textContent && (t.innerHTML = C(t, `{{${e}_${u}}}`));
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
@@ -88,54 +88,54 @@ function v(L) {
|
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
|
|
91
|
-
` : "", D =
|
|
91
|
+
` : "", D = g.querySelectorAll(".ins-product-td"), M = [];
|
|
92
92
|
D.forEach((r) => {
|
|
93
|
-
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1",
|
|
93
|
+
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
94
94
|
M.push({
|
|
95
95
|
element: r,
|
|
96
|
-
outerHtml:
|
|
96
|
+
outerHtml: A,
|
|
97
97
|
type: f,
|
|
98
|
-
number: p
|
|
98
|
+
number: p,
|
|
99
|
+
nodup: c || void 0
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
|
-
let _ = P +
|
|
102
|
+
let _ = P + g.documentElement.outerHTML;
|
|
102
103
|
M.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
103
|
-
let
|
|
104
|
+
let c = "";
|
|
104
105
|
switch (f) {
|
|
105
106
|
case "CART_ITEMS":
|
|
106
|
-
|
|
107
|
+
c = "ins_apr_total_product_kind";
|
|
107
108
|
break;
|
|
108
109
|
case "BROWSED_ITEMS":
|
|
109
|
-
|
|
110
|
+
c = "browsed_item_total_product_kind";
|
|
110
111
|
break;
|
|
111
112
|
case "PURCHASED_ITEMS":
|
|
112
|
-
|
|
113
|
+
c = "purchased_item_total_product_kind";
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
116
|
+
if (c) {
|
|
117
|
+
const y = parseInt(p) - 1, T = `${`{% if ${c} > ${y} %}`}${r}{% endif %}`;
|
|
117
118
|
_ = _.replace(r, T);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const x =
|
|
121
|
+
const x = g.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
121
122
|
return x.forEach((r) => {
|
|
122
|
-
var $;
|
|
123
123
|
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
124
|
-
if (!f || p !== "CART_ITEMS"
|
|
124
|
+
if (!f || p !== "CART_ITEMS")
|
|
125
125
|
return;
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
|
|
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 });
|
|
130
130
|
}
|
|
131
|
-
}),
|
|
131
|
+
}), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
|
|
132
132
|
const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
|
|
133
133
|
if (!_.includes(p) && !r.includes("{% if")) {
|
|
134
|
-
const
|
|
135
|
-
_ = _.replace(r,
|
|
134
|
+
const A = `${p}${r}{% endif %}`;
|
|
135
|
+
_ = _.replace(r, A);
|
|
136
136
|
}
|
|
137
137
|
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
138
138
|
}
|
|
139
139
|
export {
|
|
140
|
-
|
|
140
|
+
V as pairProductVariables
|
|
141
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.13.1-beta.
|
|
3
|
+
"version": "3.13.1-beta.88e4a0d",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"author": "",
|
|
44
44
|
"license": "ISC",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@stripoinc/ui-editor-extensions": "3.
|
|
46
|
+
"@stripoinc/ui-editor-extensions": "3.9.0",
|
|
47
47
|
"@useinsider/design-system-vue": "1.3.0",
|
|
48
48
|
"@vueuse/core": "11.3.0",
|
|
49
49
|
"lodash-es": "4.17.21",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
"guido": {
|
|
115
115
|
"stripo": {
|
|
116
|
-
"version": "2.
|
|
116
|
+
"version": "2.72.1"
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -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,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;
|