@useinsider/guido 3.30.0-beta.578752b → 3.30.0-beta.64ede62
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/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +11 -16
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/composables/useExport.js +8 -7
- package/dist/composables/useHtmlValidator.js +102 -100
- package/dist/composables/useToaster.js +11 -10
- package/dist/composables/useVersionHistoryApi.js +22 -21
- package/dist/composables/validators/useLiquidValidator.js +26 -24
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +64 -59
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +40 -39
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +33 -32
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +79 -78
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +50 -41
- package/dist/guido.css +1 -1
- package/dist/package.json.js +4 -4
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +2 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/ampPreviewSanitizer.d.ts +5 -0
- package/dist/stores/preview.js +21 -15
- package/dist/utils/ampPreviewSanitizer.js +46 -0
- package/dist/utils/pairProductVariables.js +108 -98
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
|
-
import { useToasterStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { useToasterStore as c } from "../stores/toaster.js";
|
|
3
|
+
import { escapeHtml as u } from "../utils/htmlEscape.js";
|
|
4
|
+
import { nextTick as d } from "vue";
|
|
5
|
+
const s = /* @__PURE__ */ new WeakMap(), l = () => {
|
|
6
|
+
const t = c(), o = () => {
|
|
6
7
|
const e = s.get(t);
|
|
7
8
|
e && (clearTimeout(e), s.delete(t));
|
|
8
9
|
};
|
|
9
10
|
function i(e = { message: "" }) {
|
|
10
|
-
o(), t.hideToaster(),
|
|
11
|
+
o(), t.hideToaster(), d(() => {
|
|
11
12
|
t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
|
|
12
13
|
t.hideToaster(), o();
|
|
13
14
|
}, 6e3));
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function a() {
|
|
17
18
|
o(), t.hideToaster();
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function n(e, r) {
|
|
20
21
|
if (e != null && e.authReported)
|
|
21
22
|
return;
|
|
22
23
|
const m = e instanceof Error ? e.message : String(e);
|
|
23
|
-
i({ type: T.Error, message: `${r}: ${m}` });
|
|
24
|
+
i({ type: T.Error, message: `${r}: ${u(m)}` });
|
|
24
25
|
}
|
|
25
|
-
return { showToaster: i, hideToaster:
|
|
26
|
+
return { showToaster: i, hideToaster: a, handleError: n };
|
|
26
27
|
};
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
+
l as useToaster
|
|
29
30
|
};
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useVersionHistoryStore as w } from "../stores/version-history.js";
|
|
3
|
+
import { escapeHtml as p } from "../utils/htmlEscape.js";
|
|
4
|
+
import { findEditorApi as y, EDITOR_NOT_READY_MESSAGE as V } from "../utils/stripoEditorApi.js";
|
|
5
|
+
import { useToaster as l } from "./useToaster.js";
|
|
6
|
+
const P = () => {
|
|
7
|
+
const n = w(), { showToaster: i } = l(), s = (e) => {
|
|
8
|
+
var o;
|
|
9
|
+
const r = (o = y()) == null ? void 0 : o.versionHistoryApi;
|
|
9
10
|
if (!r) {
|
|
10
|
-
i({ type: t.Error, message:
|
|
11
|
+
i({ type: t.Error, message: V });
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
e(r);
|
|
14
|
-
},
|
|
15
|
+
}, m = (e) => {
|
|
15
16
|
n.$reset(), n.updateState(e);
|
|
16
17
|
}, a = () => {
|
|
17
18
|
n.$reset();
|
|
18
19
|
};
|
|
19
20
|
return {
|
|
20
21
|
openVersionHistory: () => {
|
|
21
|
-
|
|
22
|
+
s((e) => e.openVersionHistory(m, a));
|
|
22
23
|
},
|
|
23
24
|
closeVersionHistory: () => {
|
|
24
|
-
|
|
25
|
+
s((e) => e.closeVersionHistory());
|
|
25
26
|
},
|
|
26
27
|
switchToDesktopPreview: () => {
|
|
27
|
-
|
|
28
|
+
s((e) => e.switchToDesktopPreview());
|
|
28
29
|
},
|
|
29
30
|
switchToMobilePreview: () => {
|
|
30
|
-
|
|
31
|
+
s((e) => e.switchToMobilePreview());
|
|
31
32
|
},
|
|
32
33
|
previewVersion: (e) => {
|
|
33
|
-
|
|
34
|
-
const c =
|
|
34
|
+
s((r) => r.previewVersion(e, (o) => {
|
|
35
|
+
const c = o instanceof Error ? o.message : String(o);
|
|
35
36
|
i({
|
|
36
37
|
type: t.Error,
|
|
37
|
-
message: `Error compiling email: ${c}`
|
|
38
|
+
message: `Error compiling email: ${p(c)}`
|
|
38
39
|
});
|
|
39
40
|
}));
|
|
40
41
|
},
|
|
41
42
|
restoreVersion: (e) => {
|
|
42
|
-
|
|
43
|
+
s((r) => r.restoreVersion(
|
|
43
44
|
e,
|
|
44
45
|
() => {
|
|
45
46
|
i({
|
|
@@ -47,11 +48,11 @@ const d = () => {
|
|
|
47
48
|
message: "Your version has been restored successfully."
|
|
48
49
|
});
|
|
49
50
|
},
|
|
50
|
-
(
|
|
51
|
-
const c =
|
|
51
|
+
(o) => {
|
|
52
|
+
const c = o instanceof Error ? o.message : String(o);
|
|
52
53
|
i({
|
|
53
54
|
type: t.Error,
|
|
54
|
-
message: `Error compiling email: ${c}`
|
|
55
|
+
message: `Error compiling email: ${p(c)}`
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
));
|
|
@@ -59,5 +60,5 @@ const d = () => {
|
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
P as useVersionHistoryApi
|
|
63
64
|
};
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { base64EncodeWithSpecialChars as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as s } from "../../enums/toaster.js";
|
|
2
|
+
import { base64EncodeWithSpecialChars as d } from "../../utils/base64.js";
|
|
3
|
+
import { asText as m } from "../../utils/genericUtil.js";
|
|
4
|
+
import { escapeHtml as o } from "../../utils/htmlEscape.js";
|
|
5
|
+
import { useHttp as p } from "../useHttp.js";
|
|
6
|
+
import { useToaster as c } from "../useToaster.js";
|
|
7
|
+
import { useTranslations as f } from "../useTranslations.js";
|
|
8
|
+
const j = () => {
|
|
9
|
+
const { post: l } = p(), { showToaster: a } = c(), i = f();
|
|
10
|
+
return { validateLiquidSyntax: async (u) => {
|
|
9
11
|
try {
|
|
10
|
-
const
|
|
12
|
+
const t = await l("/newsletter/contents/validate-syntax", [{
|
|
11
13
|
identifier: "default",
|
|
12
14
|
syntax: "liquid",
|
|
13
15
|
contents: {
|
|
14
16
|
subject: null,
|
|
15
17
|
preheader: null,
|
|
16
|
-
html: u
|
|
18
|
+
html: d(u),
|
|
17
19
|
ampHtml: null
|
|
18
20
|
}
|
|
19
21
|
}]);
|
|
20
|
-
if (!Array.isArray(
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
type:
|
|
24
|
-
message:
|
|
22
|
+
if (!Array.isArray(t.data)) {
|
|
23
|
+
const e = t.data;
|
|
24
|
+
return a({
|
|
25
|
+
type: s.Warning,
|
|
26
|
+
message: typeof (e == null ? void 0 : e.message) == "string" ? o(e.message) : i("journey-builder.liquid-validation-failed")
|
|
25
27
|
}), !1;
|
|
26
28
|
}
|
|
27
|
-
const [
|
|
28
|
-
return n.length ? (
|
|
29
|
-
type:
|
|
30
|
-
message: n[0].replace(/^line \d+:\s*/, "")
|
|
29
|
+
const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
|
|
30
|
+
return n.length ? (a({
|
|
31
|
+
type: s.Warning,
|
|
32
|
+
message: o(m(n[0]).replace(/^line \d+:\s*/, ""))
|
|
31
33
|
}), !1) : !0;
|
|
32
|
-
} catch (
|
|
33
|
-
return
|
|
34
|
-
type:
|
|
35
|
-
message:
|
|
34
|
+
} catch (t) {
|
|
35
|
+
return t != null && t.authReported || a({
|
|
36
|
+
type: s.Error,
|
|
37
|
+
message: i("journey-builder.liquid-validation-failed")
|
|
36
38
|
}), !1;
|
|
37
39
|
}
|
|
38
40
|
} };
|
|
39
41
|
};
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
j as useLiquidValidator
|
|
42
44
|
};
|
|
@@ -134,7 +134,7 @@ class tt {
|
|
|
134
134
|
if (F().$patch((c) => {
|
|
135
135
|
c.migrations = { ...c.migrations, [H]: a.length };
|
|
136
136
|
}), a.length === 0)
|
|
137
|
-
return console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), this.backfillV2ProductTdAttributes(
|
|
137
|
+
return console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), this.backfillV2ProductTdAttributes(e);
|
|
138
138
|
const n = new Set(Array.from(a).filter(q));
|
|
139
139
|
return a.forEach((c) => {
|
|
140
140
|
const r = this.extractConfiguration(c), i = $({
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
|
-
var ct = (_,
|
|
3
|
-
var v = (_,
|
|
2
|
+
var ct = (_, f, t) => f in _ ? at(_, f, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[f] = t;
|
|
3
|
+
var v = (_, f, t) => ct(_, typeof f != "symbol" ? f + "" : f, t);
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { escapeHtml as ut } from "../../../../../utils/htmlEscape.js";
|
|
6
|
+
import { UIElementType as g, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { CommonControl as mt } from "../../../common-control.js";
|
|
8
|
+
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as ht, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as pt, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _t, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as ft, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
8
9
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
9
10
|
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { ATTRIBUTE_CELL_CLASS as
|
|
12
|
-
import { listElementRenderer as
|
|
13
|
-
import { buildTitleRows as
|
|
14
|
-
import { toDisplayName as
|
|
15
|
-
import { normalizeCompositionKeys as
|
|
16
|
-
import { getTableDisplayValue as
|
|
17
|
-
import { isPartnerManagedBlock as
|
|
18
|
-
import { resolveInlinePriceOrder as
|
|
19
|
-
const
|
|
11
|
+
import { useRecommendationExtensionStore as bt } from "../../store/recommendation.js";
|
|
12
|
+
import { ATTRIBUTE_CELL_CLASS as yt, gridElementRenderer as Tt, DEFAULT_CELL_PADDING as Ct, buildFillerCell as St } from "../../templates/grid/elementRenderer.js";
|
|
13
|
+
import { listElementRenderer as At } from "../../templates/list/elementRenderer.js";
|
|
14
|
+
import { buildTitleRows as It, DEFAULT_TITLE_PARAGRAPH as $t, DEFAULT_TITLE_TEXT as vt } from "../../templates/titleRows.js";
|
|
15
|
+
import { toDisplayName as Nt, toDisplayableAttributeValue as Et, buildElementRenderer as J } from "../../templates/utils.js";
|
|
16
|
+
import { normalizeCompositionKeys as Rt, dropMalformedCompositionKeys as Lt, normalizeCustomAttrValues as Ot, isWellFormedProductAttr as Dt, compositionKeyToProductAttr as k, resolveRowVisibilityKeys as Ht, filterToProductAttrValue as C, findAttributeRow as Pt, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as wt, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
|
|
17
|
+
import { getTableDisplayValue as Bt } from "../../utils/tagName.js";
|
|
18
|
+
import { isPartnerManagedBlock as kt, regenerateProductRowsWithStyles as Mt, getMainContainerTbody as Ut, getCurrentLayout as qt } from "../main/utils.js";
|
|
19
|
+
import { resolveInlinePriceOrder as Ft } from "../../utils/inlinePriceOrder.js";
|
|
20
|
+
const xt = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
|
|
20
21
|
ADD_ATTRIBUTE: "addAttribute"
|
|
21
|
-
}, b = 5, P = "reorderIcon_",
|
|
22
|
+
}, b = 5, P = "reorderIcon_", Vt = '<svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2.5" r="1.2"/><circle cx="7" cy="2.5" r="1.2"/><circle cx="12" cy="2.5" r="1.2"/><circle cx="2" cy="7.5" r="1.2"/><circle cx="7" cy="7.5" r="1.2"/><circle cx="12" cy="7.5" r="1.2"/></svg>', m = [
|
|
22
23
|
{ key: q, label: "Product Image" },
|
|
23
|
-
{ key:
|
|
24
|
+
{ key: ht, label: "Product Name" },
|
|
24
25
|
{ key: p, label: "Product Price" },
|
|
25
26
|
{ key: I, label: "Product Original Price" },
|
|
26
|
-
{ key:
|
|
27
|
-
{ key:
|
|
27
|
+
{ key: pt, label: "Omnibus Price" },
|
|
28
|
+
{ key: _t, label: "Omnibus Discount" },
|
|
28
29
|
{ key: F, label: "Product Button" }
|
|
29
|
-
], L = { key: $, label: "Title" },
|
|
30
|
-
class
|
|
30
|
+
], L = { key: $, label: "Title" }, jt = new Set(m.map((_) => _.key)), A = "customAttr_", w = "deleteAttr_";
|
|
31
|
+
class ce extends mt {
|
|
31
32
|
constructor() {
|
|
32
33
|
super(...arguments);
|
|
33
|
-
v(this, "store",
|
|
34
|
+
v(this, "store", bt());
|
|
34
35
|
v(this, "unsubscribeStore", null);
|
|
35
36
|
v(this, "eventController", null);
|
|
36
37
|
/**
|
|
@@ -40,7 +41,7 @@ class oe extends ut {
|
|
|
40
41
|
v(this, "reorderInProgress", !1);
|
|
41
42
|
}
|
|
42
43
|
getId() {
|
|
43
|
-
return
|
|
44
|
+
return xt;
|
|
44
45
|
}
|
|
45
46
|
// ========================================================================
|
|
46
47
|
// Lifecycle
|
|
@@ -67,30 +68,30 @@ class oe extends ut {
|
|
|
67
68
|
{ length: r },
|
|
68
69
|
(d, c) => `
|
|
69
70
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
70
|
-
<${
|
|
71
|
+
<${g.BUTTON}
|
|
71
72
|
class="guido-drag-handle-btn flat-inline flat-white"
|
|
72
73
|
${O.BUTTON.name}="${P}${c}"
|
|
73
74
|
>
|
|
74
|
-
<${
|
|
75
|
+
<${g.ICON}
|
|
75
76
|
src="reorder"
|
|
76
77
|
class="icon-button"
|
|
77
|
-
></${
|
|
78
|
-
</${
|
|
78
|
+
></${g.ICON}>
|
|
79
|
+
</${g.BUTTON}>
|
|
79
80
|
</div>
|
|
80
81
|
`
|
|
81
82
|
).join(""), s = Array.from(
|
|
82
83
|
{ length: b },
|
|
83
84
|
(d, c) => `
|
|
84
85
|
<div data-custom-delete-key="${w}${c}" style="display: none;">
|
|
85
|
-
<${
|
|
86
|
+
<${g.BUTTON}
|
|
86
87
|
class="custom-attr-delete flat-inline flat-white"
|
|
87
88
|
${O.BUTTON.name}="${w}${c}"
|
|
88
89
|
>
|
|
89
|
-
<${
|
|
90
|
+
<${g.ICON}
|
|
90
91
|
src="delete"
|
|
91
92
|
class="icon-button"
|
|
92
|
-
></${
|
|
93
|
-
</${
|
|
93
|
+
></${g.ICON}>
|
|
94
|
+
</${g.BUTTON}>
|
|
94
95
|
</div>
|
|
95
96
|
`
|
|
96
97
|
).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
|
|
@@ -156,7 +157,7 @@ class oe extends ut {
|
|
|
156
157
|
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
|
|
157
158
|
if (!t)
|
|
158
159
|
return;
|
|
159
|
-
const e =
|
|
160
|
+
const e = kt(this.currentNode);
|
|
160
161
|
t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
|
|
161
162
|
}
|
|
162
163
|
onTemplateNodeUpdated(t) {
|
|
@@ -199,7 +200,11 @@ class oe extends ut {
|
|
|
199
200
|
}
|
|
200
201
|
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
201
202
|
_normalizeComposition(t) {
|
|
202
|
-
return
|
|
203
|
+
return Rt(
|
|
204
|
+
Lt(t),
|
|
205
|
+
this.currentNode,
|
|
206
|
+
this.store.filterList
|
|
207
|
+
);
|
|
203
208
|
}
|
|
204
209
|
_readCustomAttributesFromNode() {
|
|
205
210
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
@@ -207,8 +212,8 @@ class oe extends ut {
|
|
|
207
212
|
const t = this.currentNode.getAttribute(W);
|
|
208
213
|
if (t)
|
|
209
214
|
try {
|
|
210
|
-
return
|
|
211
|
-
JSON.parse(t).map((e) => String(e)),
|
|
215
|
+
return Ot(
|
|
216
|
+
JSON.parse(t).map((e) => String(e)).filter(Dt),
|
|
212
217
|
this.currentNode,
|
|
213
218
|
this.store.filterList
|
|
214
219
|
);
|
|
@@ -242,7 +247,7 @@ class oe extends ut {
|
|
|
242
247
|
if (!("getAttribute" in r))
|
|
243
248
|
return;
|
|
244
249
|
const i = r.getAttribute(D);
|
|
245
|
-
i !== null &&
|
|
250
|
+
i !== null && Ht(r).forEach((s) => {
|
|
246
251
|
e[s] = this._parseVisibilityValue(i);
|
|
247
252
|
});
|
|
248
253
|
}), e;
|
|
@@ -277,12 +282,12 @@ class oe extends ut {
|
|
|
277
282
|
if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
|
|
278
283
|
return !1;
|
|
279
284
|
i.dataset.inlinePrices = String(s);
|
|
280
|
-
const n = new Set(e), l =
|
|
285
|
+
const n = new Set(e), l = Ft(t);
|
|
281
286
|
let a = 0, d = 0;
|
|
282
287
|
const c = t.map((u) => {
|
|
283
288
|
if (s && (u === p || u === I))
|
|
284
289
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
285
|
-
if (
|
|
290
|
+
if (jt.has(u)) {
|
|
286
291
|
const h = m.find((S) => S.key === u);
|
|
287
292
|
return this._createBuiltInItemHtml(h, d++);
|
|
288
293
|
}
|
|
@@ -349,7 +354,7 @@ class oe extends ut {
|
|
|
349
354
|
var n, l;
|
|
350
355
|
const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === I)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
|
|
351
356
|
<div class="price-suborderable-item" draggable="true" data-subkey="${a}">
|
|
352
|
-
<span class="sub-drag-handle">${
|
|
357
|
+
<span class="sub-drag-handle">${Vt}</span>
|
|
353
358
|
<span class="item-label">${this.api.translate(d)}</span>
|
|
354
359
|
</div>`, o = e ? s(I, i) + s(p, r) : s(p, r) + s(I, i);
|
|
355
360
|
return `
|
|
@@ -367,7 +372,7 @@ class oe extends ut {
|
|
|
367
372
|
_createCustomItemHtml(t, e, r) {
|
|
368
373
|
return `
|
|
369
374
|
<div class="orderable-item" draggable="true"
|
|
370
|
-
data-key="${t}" data-custom-index="${e}">
|
|
375
|
+
data-key="${ut(t)}" data-custom-index="${e}">
|
|
371
376
|
<span class="guido-drag-handle" data-reorder-icon-slot="${r}"></span>
|
|
372
377
|
<div class="custom-attr-select-wrap"
|
|
373
378
|
data-custom-select-slot="${e}"></div>
|
|
@@ -654,7 +659,7 @@ class oe extends ut {
|
|
|
654
659
|
try {
|
|
655
660
|
this._updateBothAttributes(t, e);
|
|
656
661
|
const r = this._isInlinePrices();
|
|
657
|
-
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode &&
|
|
662
|
+
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Mt({
|
|
658
663
|
currentNode: this.currentNode,
|
|
659
664
|
documentModifier: this.api.getDocumentModifier()
|
|
660
665
|
});
|
|
@@ -672,7 +677,7 @@ class oe extends ut {
|
|
|
672
677
|
* DOM converge on the next composition change without writing on open.
|
|
673
678
|
*/
|
|
674
679
|
_getExistingRowHtml(t, e) {
|
|
675
|
-
const r =
|
|
680
|
+
const r = Pt(t, e);
|
|
676
681
|
if (r && "getOuterHTML" in r)
|
|
677
682
|
return Q(r.getOuterHTML(), e);
|
|
678
683
|
const i = t.querySelector(
|
|
@@ -693,11 +698,11 @@ class oe extends ut {
|
|
|
693
698
|
let c = 0;
|
|
694
699
|
s.forEach((u) => {
|
|
695
700
|
var V;
|
|
696
|
-
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${
|
|
701
|
+
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${yt}`)) == null ? void 0 : V.length) || 1, x = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
|
|
697
702
|
if (j === r) {
|
|
698
703
|
const st = Array.from(
|
|
699
704
|
{ length: B },
|
|
700
|
-
(
|
|
705
|
+
(Kt, nt) => {
|
|
701
706
|
const lt = this._resolveAttributeContent(
|
|
702
707
|
t,
|
|
703
708
|
e,
|
|
@@ -712,7 +717,7 @@ class oe extends ut {
|
|
|
712
717
|
l
|
|
713
718
|
);
|
|
714
719
|
}
|
|
715
|
-
).join(""), ot =
|
|
720
|
+
).join(""), ot = St(x, l).repeat(S - B);
|
|
716
721
|
return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
717
722
|
}
|
|
718
723
|
return this._getExistingRowHtml(u, j);
|
|
@@ -816,7 +821,7 @@ class oe extends ut {
|
|
|
816
821
|
return;
|
|
817
822
|
const o = e ? "1" : "0", n = e ? this.api.translate("visible") : this.api.translate("hidden"), l = `${this.api.translate("Set visibility")}: ${t} → ${n}`, a = this.api.getDocumentModifier();
|
|
818
823
|
s.forEach((c) => {
|
|
819
|
-
const u =
|
|
824
|
+
const u = Bt(c), h = e ? u : "none";
|
|
820
825
|
a.modifyHtml(c).setStyle("display", h).setAttribute(D, o);
|
|
821
826
|
});
|
|
822
827
|
const d = {
|
|
@@ -854,7 +859,7 @@ class oe extends ut {
|
|
|
854
859
|
const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
|
|
855
860
|
if (!e || r === null)
|
|
856
861
|
return null;
|
|
857
|
-
const i = t.previousTitleHtml ||
|
|
862
|
+
const i = t.previousTitleHtml || It(this._defaultTitleParagraph(), !0, t.rowSpacing);
|
|
858
863
|
return { containerBody: e, html: i + r };
|
|
859
864
|
}
|
|
860
865
|
_readTitleHtml(t) {
|
|
@@ -875,16 +880,16 @@ class oe extends ut {
|
|
|
875
880
|
return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
|
|
876
881
|
}
|
|
877
882
|
_isSpacerRow(t) {
|
|
878
|
-
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(
|
|
883
|
+
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(ft));
|
|
879
884
|
}
|
|
880
885
|
_findTitleContainerBody() {
|
|
881
|
-
return (this.currentNode ?
|
|
886
|
+
return (this.currentNode ? Ut(this.currentNode) : null) ?? void 0;
|
|
882
887
|
}
|
|
883
888
|
_readInnerHtml(t) {
|
|
884
889
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
|
|
885
890
|
}
|
|
886
891
|
_defaultTitleParagraph() {
|
|
887
|
-
return
|
|
892
|
+
return $t.replace("{-{-TITLE-}-}", this.api.translate(vt));
|
|
888
893
|
}
|
|
889
894
|
// ========================================================================
|
|
890
895
|
// Utilities
|
|
@@ -905,7 +910,7 @@ class oe extends ut {
|
|
|
905
910
|
return -1;
|
|
906
911
|
}
|
|
907
912
|
_getCurrentLayout() {
|
|
908
|
-
return this.store.recommendationConfigs.orientation ||
|
|
913
|
+
return this.store.recommendationConfigs.orientation || qt(this.currentNode);
|
|
909
914
|
}
|
|
910
915
|
/**
|
|
911
916
|
* Extracts background color properties from existing card elements.
|
|
@@ -1001,7 +1006,7 @@ class oe extends ut {
|
|
|
1001
1006
|
*/
|
|
1002
1007
|
_getDisplayNameForAttribute(t) {
|
|
1003
1008
|
const e = Object.values(this.store.filterList).find((r) => C(r) === t);
|
|
1004
|
-
return e ? e.displayName :
|
|
1009
|
+
return e ? e.displayName : Nt(H(t));
|
|
1005
1010
|
}
|
|
1006
1011
|
/**
|
|
1007
1012
|
* Resolves the display content for a custom attribute cell.
|
|
@@ -1009,22 +1014,22 @@ class oe extends ut {
|
|
|
1009
1014
|
*/
|
|
1010
1015
|
_resolveAttributeContent(t, e, r) {
|
|
1011
1016
|
var l;
|
|
1012
|
-
const s = this.store.recommendationProducts[r], o = H(t), n =
|
|
1013
|
-
return
|
|
1017
|
+
const s = this.store.recommendationProducts[r], o = H(t), n = wt(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
|
|
1018
|
+
return Et(n) ?? e;
|
|
1014
1019
|
}
|
|
1015
1020
|
_getGridCellHtml(t, e, r, i = "", s = "", o = "") {
|
|
1016
|
-
const n = M(t), l = H(t), a = J(
|
|
1021
|
+
const n = M(t), l = H(t), a = J(Tt, [n], this.store.filterList), d = {
|
|
1017
1022
|
[l]: e,
|
|
1018
1023
|
product_attributes: { [l]: e }
|
|
1019
1024
|
};
|
|
1020
1025
|
let c = a[n](d);
|
|
1021
1026
|
return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
|
|
1022
|
-
`padding: ${
|
|
1027
|
+
`padding: ${Ct}`,
|
|
1023
1028
|
`padding: ${o}`
|
|
1024
1029
|
)), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
|
|
1025
1030
|
}
|
|
1026
1031
|
_getListRowHtml(t, e, r) {
|
|
1027
|
-
const i = H(t), s = J(
|
|
1032
|
+
const i = H(t), s = J(At, [r], this.store.filterList), o = {
|
|
1028
1033
|
[i]: e,
|
|
1029
1034
|
product_attributes: { [i]: e }
|
|
1030
1035
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
@@ -1032,6 +1037,6 @@ class oe extends ut {
|
|
|
1032
1037
|
}
|
|
1033
1038
|
}
|
|
1034
1039
|
export {
|
|
1035
|
-
|
|
1036
|
-
|
|
1040
|
+
xt as COMPOSITION_CONTROL_BLOCK_ID,
|
|
1041
|
+
ce as RecommendationCardCompositionControl
|
|
1037
1042
|
};
|