@useinsider/guido 2.0.0-beta.087a24f → 2.0.0-beta.13a02f6
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/header/LeftSlot.vue.js +12 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
- package/dist/composables/useStripo.js +37 -35
- package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +53 -49
- package/dist/extensions/Blocks/Items/settingsPanel.js +4 -4
- package/dist/extensions/Blocks/Items/template.js +154 -140
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +18 -36
- package/dist/extensions/Blocks/controlFactories.js +91 -81
- package/dist/guido.css +1 -1
- package/dist/package.json.js +7 -0
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var D = Object.defineProperty;
|
|
2
|
-
var x = (T,
|
|
3
|
-
var b = (T,
|
|
4
|
-
import { UEAttr as R, ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ItemsBlockId as
|
|
2
|
+
var x = (T, p, e) => p in T ? D(T, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[p] = e;
|
|
3
|
+
var b = (T, p, e) => x(T, typeof p != "symbol" ? p + "" : p, e);
|
|
4
|
+
import { UEAttr as R, ModificationDescription as u } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as H } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as m } from "../enums/controlEnums.js";
|
|
7
7
|
import { productPairs as h, templateFirstLine as A } from "../enums/productEnums.js";
|
|
8
|
-
import { ItemTypeOptions as P, OrientationOptions as
|
|
8
|
+
import { ItemTypeOptions as P, OrientationOptions as k, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as L } from "../enums/settingsEnums.js";
|
|
9
9
|
import U from "../layouts/horizontal.html.js";
|
|
10
10
|
import F from "../layouts/vertical.html.js";
|
|
11
|
-
import { useItemsBlockStore as
|
|
12
|
-
import { getDefaultTemplate as
|
|
13
|
-
import { getItemsBlockConfig as
|
|
11
|
+
import { useItemsBlockStore as q } from "../store/items-block.js";
|
|
12
|
+
import { getDefaultTemplate as $ } from "../template.js";
|
|
13
|
+
import { getItemsBlockConfig as M, setItemsBlockConfig as f } from "../utils/nodeConfigUtils.js";
|
|
14
14
|
const w = "ui-elements-items-block", o = {
|
|
15
15
|
ITEMS_TYPE: "itemsType",
|
|
16
16
|
ORIENTATION: "orientation",
|
|
17
17
|
ITEM_IDS: "itemIds"
|
|
18
18
|
};
|
|
19
|
-
class j extends
|
|
19
|
+
class j extends H {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
|
-
b(this, "store",
|
|
22
|
+
b(this, "store", q());
|
|
23
23
|
}
|
|
24
24
|
getId() {
|
|
25
25
|
return w;
|
|
@@ -43,8 +43,8 @@ class j extends L {
|
|
|
43
43
|
onTemplateNodeUpdated(e) {
|
|
44
44
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
45
45
|
() => {
|
|
46
|
-
const t =
|
|
47
|
-
t && (this.store.setItemsType(t.type), this.store.setItemIds(t.itemsSelectValue), this.store.setOrientation(t.orientation), this.store.setCurrencySymbol(t.priceCurrencySymbol), this.store.setCurrencyLocation(t.priceCurrencyLocation), this.store.setFormattedPrice(t.priceFormatted));
|
|
46
|
+
const t = M(this.currentNode);
|
|
47
|
+
t && (this.store.setItemsType(t.type), this.store.setItemIds(t.itemsSelectValue), this.store.setOrientation(t.orientation), this.store.setCurrencySymbol(t.priceCurrencySymbol), this.store.setCurrencyLocation(t.priceCurrencyLocation), this.store.setFormattedPrice(t.priceFormatted), this.store.setImageLink(t.imageLink), this.store.setButtonLink(t.buttonLink));
|
|
48
48
|
},
|
|
49
49
|
() => {
|
|
50
50
|
this.api.updateValues({
|
|
@@ -78,7 +78,7 @@ class j extends L {
|
|
|
78
78
|
this._GuLabel({ text: "Orientation" }),
|
|
79
79
|
this._GuRadioButton({
|
|
80
80
|
name: o.ORIENTATION,
|
|
81
|
-
buttons:
|
|
81
|
+
buttons: k
|
|
82
82
|
})
|
|
83
83
|
])}
|
|
84
84
|
`;
|
|
@@ -109,12 +109,16 @@ class j extends L {
|
|
|
109
109
|
!t || !r || (this.store.setItemsType(t), this.store.setItemIds(r.value), f(this.currentNode, this.api, {
|
|
110
110
|
source: t,
|
|
111
111
|
type: t,
|
|
112
|
-
itemsSelectValue: r.value
|
|
112
|
+
itemsSelectValue: r.value,
|
|
113
|
+
imageLink: this.store.imageLink,
|
|
114
|
+
buttonLink: this.store.buttonLink
|
|
113
115
|
}), this._updateDataTypeAttributes(t), this._initializeSelectItems(), this._reFillTemplate());
|
|
114
116
|
}
|
|
115
117
|
_onItemIdsChange(e) {
|
|
116
118
|
this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), f(this.currentNode, this.api, {
|
|
117
|
-
itemsSelectValue: e
|
|
119
|
+
itemsSelectValue: e,
|
|
120
|
+
imageLink: this.store.imageLink,
|
|
121
|
+
buttonLink: this.store.buttonLink
|
|
118
122
|
}), this._updateDataNumberAttributes(e), this._reFillTemplate();
|
|
119
123
|
}
|
|
120
124
|
_initializeSelectItems() {
|
|
@@ -157,14 +161,14 @@ class j extends L {
|
|
|
157
161
|
currencyLocation: n,
|
|
158
162
|
formattedPrice: s
|
|
159
163
|
} = this.store;
|
|
160
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
164
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml($({
|
|
161
165
|
orientation: e,
|
|
162
166
|
itemsType: t,
|
|
163
167
|
itemId: i,
|
|
164
168
|
currencySymbol: r,
|
|
165
169
|
currencyLocation: n,
|
|
166
170
|
formattedPrice: s
|
|
167
|
-
})).apply(new
|
|
171
|
+
})).apply(new u("Updated template"));
|
|
168
172
|
}
|
|
169
173
|
_getTemplateData() {
|
|
170
174
|
const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = N[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
|
|
@@ -179,33 +183,33 @@ class j extends L {
|
|
|
179
183
|
}
|
|
180
184
|
_updateImageSrc(e) {
|
|
181
185
|
var i;
|
|
182
|
-
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${
|
|
183
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new
|
|
186
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
|
|
187
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new u("Updated image src"));
|
|
184
188
|
}
|
|
185
189
|
_updateName(e) {
|
|
186
190
|
var n;
|
|
187
|
-
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${
|
|
191
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
188
192
|
if (!t)
|
|
189
193
|
return;
|
|
190
194
|
const i = t.getInnerText().trim();
|
|
191
195
|
let r = t.getInnerHTML();
|
|
192
|
-
r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new
|
|
196
|
+
r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new u("Updated name"));
|
|
193
197
|
}
|
|
194
198
|
_updatePrice(e) {
|
|
195
199
|
var g;
|
|
196
|
-
const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${
|
|
200
|
+
const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
|
|
197
201
|
if (!t)
|
|
198
202
|
return;
|
|
199
203
|
const i = this._getParagraphFromBlock(t);
|
|
200
204
|
if (!i)
|
|
201
205
|
return;
|
|
202
|
-
const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: c } = this.store, a = (s == null ? void 0 : s.trim()) || "",
|
|
203
|
-
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new
|
|
206
|
+
const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: c } = this.store, a = (s == null ? void 0 : s.trim()) || "", l = this._removeCurrencySymbol(n, a), d = this._replacePriceNumber(l, e), I = this._buildPriceContent(d, a, c), _ = r.replace(n, I);
|
|
207
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new u("Updated price"));
|
|
204
208
|
}
|
|
205
209
|
_updateOriginalPrice(e) {
|
|
206
210
|
var y;
|
|
207
211
|
const t = (y = this.currentNode) == null ? void 0 : y.querySelector(
|
|
208
|
-
`[esd-extension-block-id="${
|
|
212
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
209
213
|
);
|
|
210
214
|
if (!t)
|
|
211
215
|
return;
|
|
@@ -215,29 +219,29 @@ class j extends L {
|
|
|
215
219
|
const r = i.querySelector("s");
|
|
216
220
|
if (!r)
|
|
217
221
|
return;
|
|
218
|
-
const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: c, currencyLocation: a } = this.store,
|
|
219
|
-
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(E).apply(new
|
|
222
|
+
const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: c, currencyLocation: a } = this.store, l = (c == null ? void 0 : c.trim()) || "", d = this._removeCurrencySymbol(s, l), I = this._replacePriceNumber(d, e), _ = this._buildPriceContent(I, l, a), E = `<s>${n.replace(s, _)}</s>`;
|
|
223
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(E).apply(new u("Updated original price"));
|
|
220
224
|
}
|
|
221
225
|
_updateQuantity(e) {
|
|
222
|
-
var
|
|
223
|
-
const t = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, i = (s = this.currentNode) == null ? void 0 :
|
|
224
|
-
if (!
|
|
226
|
+
var l;
|
|
227
|
+
const t = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, i = M(this.currentNode), r = (i == null ? void 0 : i.quantityControlEnabled) !== !1, n = t && r, s = (l = this.currentNode) == null ? void 0 : l.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
|
|
228
|
+
if (!s)
|
|
225
229
|
return;
|
|
226
|
-
const
|
|
227
|
-
let
|
|
228
|
-
|
|
230
|
+
const c = s.getInnerText().trim();
|
|
231
|
+
let a = s.getInnerHTML();
|
|
232
|
+
a = a.replace(c, e), this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(a).setStyle("display", n ? "table-cell" : "none").apply(new u("Updated quantity"));
|
|
229
233
|
}
|
|
230
234
|
_reOrderTemplate() {
|
|
231
235
|
var I, _, g, E, y, O, C;
|
|
232
|
-
const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${
|
|
233
|
-
`[esd-extension-block-id="${
|
|
234
|
-
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${
|
|
236
|
+
const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.NAME}"]`), i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
|
|
237
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
238
|
+
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), s = (O = this.currentNode) == null ? void 0 : O.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`), c = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
|
|
235
239
|
if (!e || !t || !i || !r || !n || !s)
|
|
236
240
|
return;
|
|
237
|
-
const { orientation: a } = this.store,
|
|
238
|
-
let d =
|
|
239
|
-
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width",
|
|
240
|
-
d = d.replace("{-{-TEMPLATE_FIRST_LINE-}-}",
|
|
241
|
+
const { orientation: a } = this.store, l = a === S.ORIENTATION.VERTICAL;
|
|
242
|
+
let d = l ? F : U;
|
|
243
|
+
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", L.productImageWidth).setAttribute("height", L.productImageWidth).apply(new u("Updated image width")), setTimeout(() => {
|
|
244
|
+
d = d.replace("{-{-TEMPLATE_FIRST_LINE-}-}", l ? A : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", i.getOuterHTML()).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", (c == null ? void 0 : c.getOuterHTML()) || ""), d = d.trim().replace(A, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(d).apply(new u("Reordered template"));
|
|
241
245
|
}, 50);
|
|
242
246
|
}
|
|
243
247
|
_updateDataTypeAttributes(e) {
|
|
@@ -247,7 +251,7 @@ class j extends L {
|
|
|
247
251
|
t && i.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
248
252
|
const s = n;
|
|
249
253
|
i.modifyHtml(s).setAttribute("data-type", e);
|
|
250
|
-
}), i.apply(new
|
|
254
|
+
}), i.apply(new u("Updated data-type attribute"));
|
|
251
255
|
}
|
|
252
256
|
_updateDataNumberAttributes(e) {
|
|
253
257
|
if (!this.currentNode)
|
|
@@ -259,15 +263,15 @@ class j extends L {
|
|
|
259
263
|
else if (e) {
|
|
260
264
|
const a = e.match(/\((\d+)\)/);
|
|
261
265
|
if (a) {
|
|
262
|
-
const [,
|
|
263
|
-
r =
|
|
266
|
+
const [, l] = a;
|
|
267
|
+
r = l;
|
|
264
268
|
}
|
|
265
269
|
}
|
|
266
270
|
const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
|
|
267
271
|
n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
|
|
268
|
-
const
|
|
269
|
-
s.modifyHtml(
|
|
270
|
-
}), s.apply(new
|
|
272
|
+
const l = a;
|
|
273
|
+
s.modifyHtml(l).setAttribute("data-number", r);
|
|
274
|
+
}), s.apply(new u("Updated data-number attribute"));
|
|
271
275
|
}
|
|
272
276
|
_reFillTemplate() {
|
|
273
277
|
const e = this._getTemplateData();
|
|
@@ -277,14 +281,14 @@ class j extends L {
|
|
|
277
281
|
var n;
|
|
278
282
|
if (!this.currentNode)
|
|
279
283
|
return;
|
|
280
|
-
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${
|
|
284
|
+
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
281
285
|
if (!e)
|
|
282
286
|
return;
|
|
283
287
|
const t = e.querySelector("p > a");
|
|
284
288
|
if (!t)
|
|
285
289
|
return;
|
|
286
290
|
const i = this.store.orientation === S.ORIENTATION.HORIZONTAL, r = this.store.nameTrimming;
|
|
287
|
-
this.api.getDocumentModifier().modifyHtml(t).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new
|
|
291
|
+
this.api.getDocumentModifier().modifyHtml(t).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new u("Recalculated trimming after orientation change"));
|
|
288
292
|
}
|
|
289
293
|
_getParagraphFromBlock(e) {
|
|
290
294
|
return e.querySelector("p");
|
|
@@ -22,14 +22,14 @@ class U extends O {
|
|
|
22
22
|
new T(
|
|
23
23
|
N.SETTINGS,
|
|
24
24
|
[
|
|
25
|
-
I.ORIGINAL_PRICE_STYLE,
|
|
26
|
-
I.ORIGINAL_PRICE_ALIGN,
|
|
27
25
|
I.ORIGINAL_PRICE_PADDINGS
|
|
28
26
|
]
|
|
29
27
|
),
|
|
30
28
|
new T(
|
|
31
29
|
N.STYLES,
|
|
32
30
|
[
|
|
31
|
+
I.ORIGINAL_PRICE_STYLE,
|
|
32
|
+
I.ORIGINAL_PRICE_ALIGN,
|
|
33
33
|
I.ORIGINAL_PRICE_COLOR,
|
|
34
34
|
I.ORIGINAL_PRICE_FONT_FAMILY,
|
|
35
35
|
I.ORIGINAL_PRICE_SIZE
|
|
@@ -39,8 +39,6 @@ class U extends O {
|
|
|
39
39
|
new T(
|
|
40
40
|
N.SETTINGS,
|
|
41
41
|
[
|
|
42
|
-
I.PRICE_STYLE,
|
|
43
|
-
I.PRICE_ALIGN,
|
|
44
42
|
I.PRICE_HIDE_DISCOUNT,
|
|
45
43
|
I.PRICE_FORMATTED_PRICE,
|
|
46
44
|
I.PRICE_CURRENCY_SYMBOL,
|
|
@@ -52,6 +50,8 @@ class U extends O {
|
|
|
52
50
|
new T(
|
|
53
51
|
N.STYLES,
|
|
54
52
|
[
|
|
53
|
+
I.PRICE_STYLE,
|
|
54
|
+
I.PRICE_ALIGN,
|
|
55
55
|
I.PRICE_COLOR,
|
|
56
56
|
I.PRICE_FONT_FAMILY,
|
|
57
57
|
I.PRICE_SIZE
|