@useinsider/guido 3.8.2 → 3.9.0-beta.08da4e6
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/@types/config/schemas.js +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +111 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +122 -106
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/config/migrator/recommendation/htmlBuilder.js +53 -52
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/enums/defaults.js +7 -4
- package/dist/enums/html-validator.js +6 -5
- package/dist/extensions/Blocks/Items/block.js +67 -28
- 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 +89 -64
- package/dist/extensions/Blocks/Recommendation/block.js +64 -42
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +461 -363
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +99 -87
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +162 -160
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -54
- package/dist/extensions/Blocks/Recommendation/templates/index.js +17 -14
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +30 -39
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
- package/dist/extensions/Blocks/controlFactories.js +76 -57
- package/dist/package.json.js +1 -1
- package/dist/services/blankTemplate.js +34 -0
- package/dist/services/stripoApi.js +13 -18
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/enums/defaults.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +17 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
- package/dist/src/services/blankTemplate.d.ts +11 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +2 -2
- package/dist/static/templates/empty/index.html.js +0 -74
- package/dist/static/templates/empty/style.css.js +0 -779
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
1
|
+
import { ModificationDescription as d, UIElementType as a, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as T } from "../../../common-control.js";
|
|
3
3
|
import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const I = l.NAME_TRIMMING, n = {
|
|
4
|
+
import { getItemsBlockConfig as o, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
|
|
5
|
+
const g = l.NAME_TRIMMING, i = {
|
|
7
6
|
TRIMMING: "trimming"
|
|
8
7
|
};
|
|
9
|
-
class
|
|
8
|
+
class y extends T {
|
|
10
9
|
getId() {
|
|
11
|
-
return
|
|
10
|
+
return g;
|
|
12
11
|
}
|
|
13
12
|
getTemplate() {
|
|
14
13
|
return `
|
|
@@ -18,41 +17,41 @@ class S extends d {
|
|
|
18
17
|
`;
|
|
19
18
|
}
|
|
20
19
|
onRender() {
|
|
21
|
-
const e =
|
|
22
|
-
this.api.updateValues({ [
|
|
20
|
+
const e = o(this.currentNode);
|
|
21
|
+
this.api.updateValues({ [i.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(i.TRIMMING, (t) => {
|
|
23
22
|
this._onTrimmingChange(t);
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
onTemplateNodeUpdated(e) {
|
|
27
26
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const t =
|
|
29
|
-
this.api.updateValues({ [
|
|
27
|
+
const t = o(this.currentNode);
|
|
28
|
+
this.api.updateValues({ [i.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
_onTrimmingChange(e) {
|
|
33
|
-
c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [
|
|
32
|
+
c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [i.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
34
33
|
}
|
|
35
34
|
_applyTrimmingStyles(e) {
|
|
36
35
|
var m;
|
|
37
36
|
const t = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
|
|
38
37
|
if (!t)
|
|
39
38
|
return;
|
|
40
|
-
const
|
|
41
|
-
|
|
39
|
+
const n = o(this.currentNode), s = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, r = this.api.getDocumentModifier().modifyHtml(t);
|
|
40
|
+
s ? r.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : r.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), r.setStyle("max-width", "100%").apply(new d(`Text Trimming ${s ? "Enabled" : "Disabled"}`));
|
|
42
41
|
}
|
|
43
42
|
_getTextTrimming() {
|
|
44
43
|
return `
|
|
45
44
|
<div class="display-flex align-items-center justify-content-between">
|
|
46
45
|
<${a.LABEL}
|
|
47
|
-
${
|
|
46
|
+
${p.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
48
47
|
>
|
|
49
48
|
</${a.LABEL}>
|
|
50
|
-
${this._GuToggle(
|
|
49
|
+
${this._GuToggle(i.TRIMMING)}
|
|
51
50
|
</div>
|
|
52
51
|
`;
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
g as CONTROL_BLOCK_ID,
|
|
56
|
+
y as NameTrimmingControl
|
|
58
57
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
1
|
+
import { ModificationDescription as y, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as k } from "../../common-control.js";
|
|
3
3
|
import { ItemsBlockId as I } from "../enums/controlEnums.js";
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { SETTINGS_ENUMS as d, ItemTypeOptions as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getDefaultTemplate as
|
|
9
|
-
import { getItemsBlockConfig as _, setItemsBlockConfig as
|
|
10
|
-
const
|
|
4
|
+
import { productPairs as N, templateFirstLine as D } from "../enums/productEnums.js";
|
|
5
|
+
import { SETTINGS_ENUMS as d, ItemTypeOptions as x, OrientationOptions as F, ItemInCartOptions as O, DefaultConfigValues as H } from "../enums/settingsEnums.js";
|
|
6
|
+
import $ from "../layouts/horizontal.html.js";
|
|
7
|
+
import q from "../layouts/vertical.html.js";
|
|
8
|
+
import { getDefaultTemplate as w, wrapInTableRow as C } from "../template.js";
|
|
9
|
+
import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as g, deriveItemNumber as V } from "../utils/nodeConfigUtils.js";
|
|
10
|
+
const B = "ui-elements-items-block", m = {
|
|
11
11
|
ITEMS_TYPE: "itemsType",
|
|
12
12
|
ORIENTATION: "orientation",
|
|
13
13
|
ITEM_IDS: "itemIds"
|
|
14
14
|
};
|
|
15
|
-
class Z extends
|
|
15
|
+
class Z extends k {
|
|
16
16
|
getId() {
|
|
17
|
-
return
|
|
17
|
+
return B;
|
|
18
18
|
}
|
|
19
19
|
getTemplate() {
|
|
20
20
|
return `
|
|
@@ -51,7 +51,7 @@ class Z extends U {
|
|
|
51
51
|
name: m.ITEMS_TYPE,
|
|
52
52
|
className: "es-100",
|
|
53
53
|
placeholder: "Select Item Type",
|
|
54
|
-
options:
|
|
54
|
+
options: x
|
|
55
55
|
})
|
|
56
56
|
])}
|
|
57
57
|
`;
|
|
@@ -62,7 +62,7 @@ class Z extends U {
|
|
|
62
62
|
this._GuLabel({ text: "Orientation" }),
|
|
63
63
|
this._GuRadioButton({
|
|
64
64
|
name: m.ORIENTATION,
|
|
65
|
-
buttons:
|
|
65
|
+
buttons: F
|
|
66
66
|
})
|
|
67
67
|
])}
|
|
68
68
|
`;
|
|
@@ -83,50 +83,50 @@ class Z extends U {
|
|
|
83
83
|
_onOrientationChange(e) {
|
|
84
84
|
this.api.updateValues({ [m.ORIENTATION]: e });
|
|
85
85
|
const r = this.api.getDocumentModifier();
|
|
86
|
-
|
|
86
|
+
M(this.currentNode, this.api, {
|
|
87
87
|
orientation: e,
|
|
88
88
|
priceOrientation: "horizontal"
|
|
89
|
-
}, r), r.apply(new
|
|
89
|
+
}, r), r.apply(new y("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
|
|
90
90
|
this._recalculateTrimming();
|
|
91
91
|
}, 50);
|
|
92
92
|
}
|
|
93
93
|
_onItemsTypeChange(e) {
|
|
94
|
-
const r = d.ITEMS_TYPE[e], t =
|
|
94
|
+
const r = d.ITEMS_TYPE[e], t = O[e], i = t == null ? void 0 : t[0];
|
|
95
95
|
if (!r || !i)
|
|
96
96
|
return;
|
|
97
97
|
const n = i.value, s = i.value.replace("Url}}", "Image}}"), o = this.api.getDocumentModifier();
|
|
98
|
-
|
|
98
|
+
M(this.currentNode, this.api, {
|
|
99
99
|
source: r,
|
|
100
100
|
type: r,
|
|
101
101
|
itemsSelectValue: i.value,
|
|
102
102
|
imageLink: s,
|
|
103
103
|
buttonLink: n
|
|
104
104
|
}, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
|
|
105
|
-
const
|
|
106
|
-
this._updateImageSrc(
|
|
105
|
+
const c = this._getTemplateData(r, i.value);
|
|
106
|
+
this._updateImageSrc(c.imageSrc, o), this._updateName(c.name, o), this._updatePrice(c.price, o), this._updateOriginalPrice(c.originalPrice, o), this._updateQuantity(c.quantity, r, o), o.apply(new y("Updated items type"));
|
|
107
107
|
}
|
|
108
108
|
_onItemIdsChange(e) {
|
|
109
109
|
this.api.updateValues({ [m.ITEM_IDS]: e });
|
|
110
110
|
const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
|
|
111
|
-
|
|
111
|
+
M(this.currentNode, this.api, {
|
|
112
112
|
itemsSelectValue: e,
|
|
113
113
|
imageLink: t,
|
|
114
114
|
buttonLink: r
|
|
115
115
|
}, i), this._updateDataNumberAttributes(e, i);
|
|
116
116
|
const n = this._getTemplateData(void 0, e);
|
|
117
|
-
this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new
|
|
117
|
+
this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new y("Updated item selection"));
|
|
118
118
|
}
|
|
119
119
|
_initializeSelectItems() {
|
|
120
120
|
this.api.setUIEAttribute(
|
|
121
121
|
m.ITEMS_TYPE,
|
|
122
122
|
L.SELECTPICKER.items,
|
|
123
|
-
|
|
123
|
+
x
|
|
124
124
|
);
|
|
125
125
|
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
|
|
126
126
|
this.api.updateValues({
|
|
127
127
|
[m.ITEMS_TYPE]: r
|
|
128
128
|
});
|
|
129
|
-
const i =
|
|
129
|
+
const i = O[r];
|
|
130
130
|
this.api.setUIEAttribute(
|
|
131
131
|
m.ITEM_IDS,
|
|
132
132
|
L.SELECTPICKER.items,
|
|
@@ -149,25 +149,25 @@ class Z extends U {
|
|
|
149
149
|
}
|
|
150
150
|
_renderTemplate() {
|
|
151
151
|
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
|
|
152
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
152
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(w({
|
|
153
153
|
orientation: r,
|
|
154
154
|
itemsType: t,
|
|
155
155
|
itemId: i,
|
|
156
156
|
currencySymbol: n,
|
|
157
157
|
currencyLocation: s,
|
|
158
158
|
formattedPrice: o
|
|
159
|
-
})).apply(new
|
|
159
|
+
})).apply(new y("Updated template"));
|
|
160
160
|
}
|
|
161
161
|
_getTemplateData(e, r) {
|
|
162
|
-
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1,
|
|
162
|
+
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, c = O[i].findIndex((h) => h.value === n), a = c > -1 ? c : 0, l = N.PAIRS_FOR_EXTENSION.price[i], T = N.PAIRS_FOR_EXTENSION.originalPrice[i];
|
|
163
163
|
let u, p;
|
|
164
|
-
return o ? (u = s ?
|
|
165
|
-
imageSrc:
|
|
166
|
-
name:
|
|
164
|
+
return o ? (u = s ? l.DEFAULT_SINGLE_PRICE_FORMATTED : l.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? l.DEFAULT_PRICE_FORMATTED : l.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
|
|
165
|
+
imageSrc: N.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
|
|
166
|
+
name: N.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
|
|
167
167
|
price: u,
|
|
168
168
|
originalPrice: p,
|
|
169
|
-
quantity:
|
|
170
|
-
button:
|
|
169
|
+
quantity: N.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
|
|
170
|
+
button: N.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
_updateImageSrc(e, r) {
|
|
@@ -182,18 +182,18 @@ class Z extends U {
|
|
|
182
182
|
return;
|
|
183
183
|
const i = t.getInnerText().trim();
|
|
184
184
|
let n = t.getInnerHTML().trim();
|
|
185
|
-
n = n.replace(i,
|
|
185
|
+
n = n.replace(i, g(e)), r.modifyHtml(t).setInnerHtml(n);
|
|
186
186
|
}
|
|
187
187
|
_updatePrice(e, r) {
|
|
188
188
|
var o;
|
|
189
189
|
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
190
190
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
191
191
|
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
192
|
-
t.forEach((
|
|
193
|
-
const a = this._getParagraphFromBlock(
|
|
192
|
+
t.forEach((c) => {
|
|
193
|
+
const a = this._getParagraphFromBlock(c);
|
|
194
194
|
if (!a)
|
|
195
195
|
return;
|
|
196
|
-
const
|
|
196
|
+
const l = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), S = l.replace(T, g(E));
|
|
197
197
|
r.modifyHtml(a).setInnerHtml(S);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
@@ -202,51 +202,51 @@ class Z extends U {
|
|
|
202
202
|
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
203
203
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
204
204
|
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
205
|
-
t.forEach((
|
|
206
|
-
const a = this._getParagraphFromBlock(
|
|
205
|
+
t.forEach((c) => {
|
|
206
|
+
const a = this._getParagraphFromBlock(c);
|
|
207
207
|
if (!a)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
209
|
+
const l = a.querySelector("s");
|
|
210
|
+
if (!l)
|
|
211
211
|
return;
|
|
212
|
-
const T =
|
|
212
|
+
const T = l.getInnerHTML().trim() || "", u = l.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, g(S))}</s>`;
|
|
213
213
|
r.modifyHtml(a).setInnerHtml(R);
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
_updateQuantity(e, r, t) {
|
|
217
217
|
var h;
|
|
218
|
-
const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1,
|
|
218
|
+
const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, c = s && o, a = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
|
|
219
219
|
if (!a)
|
|
220
220
|
return;
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
221
|
+
const l = this._getParagraphFromBlock(a);
|
|
222
|
+
if (!l)
|
|
223
223
|
return;
|
|
224
|
-
const T =
|
|
225
|
-
let u =
|
|
226
|
-
function p(E, S,
|
|
224
|
+
const T = l.getInnerText().trim();
|
|
225
|
+
let u = l.getInnerHTML().trim();
|
|
226
|
+
function p(E, S, A) {
|
|
227
227
|
return E.replace(
|
|
228
228
|
new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
|
|
229
|
-
`$1${
|
|
229
|
+
`$1${A}$2`
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
-
u = p(u, T, e), t.modifyHtml(
|
|
232
|
+
u = p(u, T, e), t.modifyHtml(l).setInnerHtml(u), t.modifyHtml(a).setStyle("display", c ? "table-cell" : "none");
|
|
233
233
|
}
|
|
234
234
|
_reOrderTemplate(e) {
|
|
235
|
-
var h, E, S,
|
|
235
|
+
var h, E, S, A, R, b;
|
|
236
236
|
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
|
|
237
237
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
238
|
-
)) || [], n = ((
|
|
238
|
+
)) || [], n = ((A = this.currentNode) == null ? void 0 : A.querySelectorAll(
|
|
239
239
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
240
|
-
)) || [], [s] = i, [o] = n,
|
|
241
|
-
if (!r || !t || !s || !o || !
|
|
240
|
+
)) || [], [s] = i, [o] = n, c = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), a = (b = this.currentNode) == null ? void 0 : b.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
|
|
241
|
+
if (!r || !t || !s || !o || !c || !a)
|
|
242
242
|
return;
|
|
243
|
-
const
|
|
244
|
-
let p = u ?
|
|
243
|
+
const l = _(this.currentNode), u = ((l == null ? void 0 : l.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
|
|
244
|
+
let p = u ? q : $;
|
|
245
245
|
setTimeout(() => {
|
|
246
|
-
const
|
|
247
|
-
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ?
|
|
246
|
+
const U = g(s.getOuterHTML()), f = g(o.getOuterHTML());
|
|
247
|
+
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? D : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(U)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(f)).replace("{-{-PRODUCT_QUANTITY-}-}", C(c.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(a.getOuterHTML())), p = p.trim().replace(D, "").slice(0, -5);
|
|
248
248
|
const P = e ?? this.api.getDocumentModifier();
|
|
249
|
-
P.modifyHtml(r.querySelector("img")).setAttribute("width",
|
|
249
|
+
P.modifyHtml(r.querySelector("img")).setAttribute("width", H.productImageWidth).setAttribute("height", H.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new y("Reordered template"));
|
|
250
250
|
}, 50);
|
|
251
251
|
}
|
|
252
252
|
_updateDataTypeAttributes(e, r) {
|
|
@@ -261,39 +261,28 @@ class Z extends U {
|
|
|
261
261
|
_updateDataNumberAttributes(e, r) {
|
|
262
262
|
if (!this.currentNode)
|
|
263
263
|
return;
|
|
264
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n =
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
else if (e) {
|
|
269
|
-
const a = e.match(/\((\d+)\)/);
|
|
270
|
-
if (a) {
|
|
271
|
-
const [, c] = a;
|
|
272
|
-
s = c;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
const o = this.currentNode.closest(".ins-product-td");
|
|
276
|
-
o && r.modifyHtml(o).setAttribute("data-number", s), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
|
|
277
|
-
const c = a;
|
|
278
|
-
r.modifyHtml(c).setAttribute("data-number", s);
|
|
264
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = V(e, i), s = this.currentNode.closest(".ins-product-td");
|
|
265
|
+
s && r.modifyHtml(s).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((c) => {
|
|
266
|
+
const a = c;
|
|
267
|
+
r.modifyHtml(a).setAttribute("data-number", n);
|
|
279
268
|
});
|
|
280
269
|
}
|
|
281
270
|
_reFillTemplate(e) {
|
|
282
271
|
const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
|
|
283
|
-
this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new
|
|
272
|
+
this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new y("Refilled template"));
|
|
284
273
|
}
|
|
285
274
|
_recalculateTrimming() {
|
|
286
|
-
var
|
|
275
|
+
var n;
|
|
287
276
|
if (!this.currentNode)
|
|
288
277
|
return;
|
|
289
|
-
const e = (
|
|
278
|
+
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
290
279
|
if (!e)
|
|
291
280
|
return;
|
|
292
281
|
const r = e.querySelector("p > a");
|
|
293
282
|
if (!r)
|
|
294
283
|
return;
|
|
295
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.
|
|
296
|
-
this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space",
|
|
284
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0;
|
|
285
|
+
this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", "100%").setStyle("width", "100%").apply(new y("Recalculated trimming after orientation change"));
|
|
297
286
|
}
|
|
298
287
|
_getParagraphFromBlock(e) {
|
|
299
288
|
return e.querySelector("p");
|
|
@@ -325,6 +314,6 @@ class Z extends U {
|
|
|
325
314
|
}
|
|
326
315
|
}
|
|
327
316
|
export {
|
|
328
|
-
|
|
317
|
+
B as CONTROL_BLOCK_ID,
|
|
329
318
|
Z as ItemsBlockControl
|
|
330
319
|
};
|
|
@@ -6,38 +6,42 @@ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
|
6
6
|
<table class="es-left esdev-disable-select" cellspacing="0" cellpadding="0" align="left" width="100%">
|
|
7
7
|
<tbody>
|
|
8
8
|
<tr>
|
|
9
|
-
<td class="product-image-class" data-slot-1>
|
|
10
|
-
|
|
9
|
+
<td class="product-image-class es-p10r" data-slot-1>
|
|
10
|
+
<table width="100%">
|
|
11
|
+
<tbody>
|
|
12
|
+
{-{-PRODUCT_IMAGE-}-}
|
|
13
|
+
</tbody>
|
|
14
|
+
</table>
|
|
11
15
|
</td>
|
|
12
|
-
<td class="product-name-class" data-slot-2>
|
|
13
|
-
<table>
|
|
16
|
+
<td class="product-name-class es-p10l es-p10r" data-slot-2>
|
|
17
|
+
<table width="100%" style="table-layout: fixed;">
|
|
14
18
|
<tbody>
|
|
15
19
|
{-{-PRODUCT_NAME-}-}
|
|
16
20
|
</tbody>
|
|
17
21
|
</table>
|
|
18
22
|
</td>
|
|
19
|
-
<td class="product-quantity-class" data-slot-3>
|
|
23
|
+
<td class="product-quantity-class es-p10l es-p10r" data-slot-3>
|
|
20
24
|
<table width="100%">
|
|
21
25
|
<tbody>
|
|
22
26
|
{-{-PRODUCT_QUANTITY-}-}
|
|
23
27
|
</tbody>
|
|
24
28
|
</table>
|
|
25
29
|
</td>
|
|
26
|
-
<td class="product-price-class horizontal-price" data-slot-4>
|
|
30
|
+
<td class="product-price-class horizontal-price es-p10l es-p10r" data-slot-4>
|
|
27
31
|
<table width="100%">
|
|
28
32
|
<tbody>
|
|
29
33
|
{-{-PRODUCT_PRICE-}-}
|
|
30
34
|
</tbody>
|
|
31
35
|
</table>
|
|
32
36
|
</td>
|
|
33
|
-
<td class="product-original-price-class horizontal-price" data-slot-5>
|
|
37
|
+
<td class="product-original-price-class horizontal-price es-p10l es-p10r" data-slot-5>
|
|
34
38
|
<table width="100%">
|
|
35
39
|
<tbody>
|
|
36
40
|
{-{-PRODUCT_ORIGINAL_PRICE-}-}
|
|
37
41
|
</tbody>
|
|
38
42
|
</table>
|
|
39
43
|
</td>
|
|
40
|
-
<td class="product-price-container vertical-price" data-slot-4 style="display: none;">
|
|
44
|
+
<td class="product-price-container vertical-price es-p10l es-p10r" data-slot-4 style="display: none;">
|
|
41
45
|
<table class="product-price-class" width="100%" data-slot-4>
|
|
42
46
|
<tbody>
|
|
43
47
|
{-{-PRODUCT_PRICE-}-}
|
|
@@ -50,7 +54,7 @@ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
|
50
54
|
</tbody>
|
|
51
55
|
</table>
|
|
52
56
|
</td>
|
|
53
|
-
<td class="product-button-class" data-slot-6>
|
|
57
|
+
<td class="product-button-class es-p10l" data-slot-6>
|
|
54
58
|
<table width="100%">
|
|
55
59
|
<tbody>
|
|
56
60
|
{-{-PRODUCT_BUTTON-}-}
|
|
@@ -3,7 +3,7 @@ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
|
3
3
|
<tbody>
|
|
4
4
|
<tr>
|
|
5
5
|
<td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">
|
|
6
|
-
<table class="ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
|
|
6
|
+
<table class="ins-product-cart" width="100%" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
|
|
7
7
|
<tr style="vertical-align: top">
|
|
8
8
|
<td colspan="2" width="100%" align="center" data-slot-1>
|
|
9
9
|
<table width="100%">
|
|
@@ -15,24 +15,36 @@ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
|
15
15
|
</tr>
|
|
16
16
|
{-{-PRODUCT_NAME-}-}
|
|
17
17
|
<tr>
|
|
18
|
-
<td
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</table>
|
|
24
|
-
</td>
|
|
25
|
-
<td width="50%" style=" width: 50%;display: block;float: left;"
|
|
26
|
-
class="product-original-price-class">
|
|
27
|
-
<table width="100%">
|
|
18
|
+
<td colspan="2" width="100%" align="center">
|
|
19
|
+
<!-- Nested auto-layout table so the float-based price orientation
|
|
20
|
+
(50/50 side-by-side ↔ 100% stacked) keeps working without
|
|
21
|
+
fighting the outer table-layout: fixed grid. -->
|
|
22
|
+
<table width="100%" cellspacing="0" cellpadding="0">
|
|
28
23
|
<tbody>
|
|
29
|
-
|
|
24
|
+
<tr>
|
|
25
|
+
<td width="50%" style="width: 50%;display: block;float: left;"
|
|
26
|
+
class="product-price-class">
|
|
27
|
+
<table width="100%">
|
|
28
|
+
<tbody>
|
|
29
|
+
{-{-PRODUCT_PRICE-}-}
|
|
30
|
+
</tbody>
|
|
31
|
+
</table>
|
|
32
|
+
</td>
|
|
33
|
+
<td width="50%" style="width: 50%;display: block;float: left;"
|
|
34
|
+
class="product-original-price-class">
|
|
35
|
+
<table width="100%">
|
|
36
|
+
<tbody>
|
|
37
|
+
{-{-PRODUCT_ORIGINAL_PRICE-}-}
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
30
42
|
</tbody>
|
|
31
43
|
</table>
|
|
32
44
|
</td>
|
|
33
45
|
</tr>
|
|
34
46
|
<tr>
|
|
35
|
-
<td width="100%" class="product-quantity-class" data-slot-3>
|
|
47
|
+
<td width="100%" colspan="2" class="product-quantity-class" data-slot-3>
|
|
36
48
|
<table width="100%">
|
|
37
49
|
<tbody>
|
|
38
50
|
{-{-PRODUCT_QUANTITY-}-}
|
|
@@ -41,7 +53,7 @@ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
|
41
53
|
</td>
|
|
42
54
|
</tr>
|
|
43
55
|
<tr>
|
|
44
|
-
<td width="100%" class="product-button-class" data-slot-6>
|
|
56
|
+
<td width="100%" colspan="2" class="product-button-class" data-slot-6>
|
|
45
57
|
<table width="100%">
|
|
46
58
|
<tbody>
|
|
47
59
|
{-{-PRODUCT_BUTTON-}-}
|