@useinsider/guido 1.0.3-beta.f263f71 → 1.0.3-beta.f27e9ff
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/EmailSizeIndicator.vue.js +8 -8
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +92 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +94 -90
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +3 -2
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +3 -2
- package/dist/extensions/Blocks/Items/extension.js +7 -6
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +17 -5
- package/dist/extensions/Blocks/Items/settingsPanel.js +25 -24
- package/dist/extensions/Blocks/Items/store/items-block.js +8 -4
- package/dist/extensions/Blocks/Items/template.js +65 -59
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +35 -26
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +29 -27
- package/dist/extensions/Blocks/Unsubscribe/block.js +34 -30
- package/dist/guido.css +1 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +15 -0
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +6 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +3 -4
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import i from "./EmailSizeIndicator.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
3
|
+
import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var o = function() {
|
|
5
5
|
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
-
return e("div", { staticClass: "d-f a-i-c j-c-c" }, [e(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), e(t.
|
|
7
|
-
}, a = [], n = /* @__PURE__ */
|
|
6
|
+
return e("div", { staticClass: "d-f a-i-c j-c-c" }, [e(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), e(t.InTooltip, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", align: "center", position: "bottom", text: t.trans("email-editor.preview-design-size-tooltip") } })], 1);
|
|
7
|
+
}, a = [], n = /* @__PURE__ */ r(
|
|
8
8
|
i,
|
|
9
|
-
|
|
9
|
+
o,
|
|
10
10
|
a,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"c2adc57d"
|
|
14
14
|
);
|
|
15
|
-
const
|
|
15
|
+
const m = n.exports;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
m as default
|
|
18
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as c, ref as n, computed as l, watch as u } from "vue";
|
|
2
2
|
import { useTranslations as p } from "../../../../composables/useTranslations.js";
|
|
3
3
|
import { usePreviewStore as _ } from "../../../../stores/preview.js";
|
|
4
|
-
import {
|
|
4
|
+
import { InTooltip as v, InProgress as f } from "@useinsider/design-system-vue";
|
|
5
5
|
const S = /* @__PURE__ */ c({
|
|
6
6
|
__name: "EmailSizeIndicator",
|
|
7
7
|
setup(w) {
|
|
@@ -17,7 +17,7 @@ const S = /* @__PURE__ */ c({
|
|
|
17
17
|
}, i = p();
|
|
18
18
|
return u(() => t.previewHtml, () => {
|
|
19
19
|
r();
|
|
20
|
-
}, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f,
|
|
20
|
+
}, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltip: v };
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
export {
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
3
|
+
var n = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
-
import { ItemsBlockControlId as
|
|
6
|
+
import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
|
|
7
7
|
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
8
|
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
-
import { syncNameTrimmingFromAttributes as
|
|
10
|
-
import { updateConfigBlockAttributes as
|
|
11
|
-
const
|
|
9
|
+
import { syncNameTrimmingFromAttributes as M } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.js";
|
|
11
|
+
const y = p.NAME_TRIMMING, o = {
|
|
12
12
|
TRIMMING: "trimming"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class _ extends c {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
|
|
17
|
+
n(this, "store", N());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return y;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
24
|
-
<div class="${
|
|
24
|
+
<div class="${p.NAME_TRIMMING}">
|
|
25
25
|
${this._getTextTrimming()}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
onRender() {
|
|
30
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
|
|
31
31
|
this._onTrimmingChange(e);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
onTemplateNodeUpdated(e) {
|
|
35
35
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
36
|
-
() =>
|
|
36
|
+
() => M(this.currentNode),
|
|
37
37
|
() => {
|
|
38
|
-
this.api.updateValues({ [
|
|
38
|
+
this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
|
|
39
39
|
}
|
|
40
|
-
)
|
|
40
|
+
);
|
|
41
41
|
}
|
|
42
42
|
_onTrimmingChange(e) {
|
|
43
|
-
this.store.setNameTrimming(e),
|
|
43
|
+
this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
44
44
|
}
|
|
45
45
|
_applyTrimmingStyles(e) {
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
46
|
+
var s;
|
|
47
|
+
const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
|
|
48
|
+
if (!r)
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
51
|
+
T ? this.api.getDocumentModifier().modifyHtml(r).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(r).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Disabled"));
|
|
52
52
|
}
|
|
53
53
|
_getTextTrimming() {
|
|
54
54
|
return `
|
|
55
55
|
<div class="container">
|
|
56
56
|
<div class="display-flex align-items-center justify-content-between">
|
|
57
|
-
<${
|
|
57
|
+
<${l.LABEL}
|
|
58
58
|
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
59
|
>
|
|
60
|
-
</${
|
|
61
|
-
${this._GuToggle(
|
|
60
|
+
</${l.LABEL}>
|
|
61
|
+
${this._GuToggle(o.TRIMMING)}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
y as CONTROL_BLOCK_ID,
|
|
69
|
+
_ as NameTrimmingControl
|
|
70
70
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var y = (n, o, t) => o in n ? I(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
|
|
3
|
+
var m = (n, o, t) => y(n, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as E } from "../../../common-control.js";
|
|
6
|
+
import { ItemsBlockControlId as O } from "../../enums/controlEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as N } from "../../enums/settingsEnums.js";
|
|
8
|
+
import { useItemsBlockStore as f } from "../../store/items-block.js";
|
|
9
|
+
import { syncPriceOrientationFromAttributes as T } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as P } from "../../utils/updateAttributes.js";
|
|
11
|
+
const _ = O.PRICE_ORIENTATION, p = {
|
|
12
|
+
PRICE_ORIENTATION: "priceOrientation"
|
|
13
|
+
}, C = [
|
|
14
|
+
{ icon: "vertical-orientation", value: "vertical" },
|
|
15
|
+
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
16
|
+
];
|
|
17
|
+
class v extends E {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
m(this, "store", f());
|
|
21
|
+
}
|
|
22
|
+
getId() {
|
|
23
|
+
return _;
|
|
24
|
+
}
|
|
25
|
+
getTemplate() {
|
|
26
|
+
return `
|
|
27
|
+
<div class="${O.PRICE_ORIENTATION}">
|
|
28
|
+
${this._getPriceOrientation()}
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
onRender() {
|
|
33
|
+
this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation }), this.api.onValueChanged(p.PRICE_ORIENTATION, (t) => {
|
|
34
|
+
this._onPriceOrientationChange(t);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
onTemplateNodeUpdated(t) {
|
|
38
|
+
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
39
|
+
() => {
|
|
40
|
+
T(this.currentNode);
|
|
41
|
+
},
|
|
42
|
+
() => {
|
|
43
|
+
this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
_onPriceOrientationChange(t) {
|
|
48
|
+
if (console.debug("Price orientation changed to: ", t), this.store.setPriceOrientation(t), P(this.currentNode, this.api), !this.currentNode)
|
|
49
|
+
return;
|
|
50
|
+
const { orientation: i } = this.store, r = i === N.ORIENTATION.VERTICAL, e = t === "horizontal";
|
|
51
|
+
r ? this._updateVerticalLayout(e) : this._updateHorizontalLayout(e);
|
|
52
|
+
}
|
|
53
|
+
_updateHorizontalLayout(t) {
|
|
54
|
+
var c, l, d, a;
|
|
55
|
+
const i = ((l = (c = this.currentNode) == null ? void 0 : c.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((a = (d = this.currentNode) == null ? void 0 : d.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".product-original-price-class")) || [];
|
|
56
|
+
if (!i || !r)
|
|
57
|
+
return;
|
|
58
|
+
const e = t ? "50%" : "100%", s = this.api.getDocumentModifier();
|
|
59
|
+
i.forEach((u) => {
|
|
60
|
+
s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
|
|
61
|
+
}), r.forEach((u) => {
|
|
62
|
+
s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
|
|
63
|
+
}), s.apply(new h(`Updated original price element width to ${e}`));
|
|
64
|
+
}
|
|
65
|
+
_updateVerticalLayout(t) {
|
|
66
|
+
var s, c, l, d;
|
|
67
|
+
const i = ((c = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : c.querySelectorAll(".horizontal-price")) || [], r = (d = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : d.querySelector(".vertical-price");
|
|
68
|
+
if (!i || !r || i.length === 0)
|
|
69
|
+
return;
|
|
70
|
+
const e = this.api.getDocumentModifier();
|
|
71
|
+
t ? (i.forEach((a) => {
|
|
72
|
+
e.modifyHtml(a).setStyle("display", "table-cell");
|
|
73
|
+
}), e.modifyHtml(r).setStyle("display", "none").apply(new h("Hide vertical price element"))) : (i.forEach((a) => {
|
|
74
|
+
e.modifyHtml(a).setStyle("display", "none");
|
|
75
|
+
}), e.modifyHtml(r).setStyle("display", "table-cell").apply(new h("Show vertical price element")));
|
|
76
|
+
}
|
|
77
|
+
_getPriceOrientation() {
|
|
78
|
+
return `
|
|
79
|
+
${this._GuTwoColumns([
|
|
80
|
+
this._GuLabel({ text: "Price Orientation" }),
|
|
81
|
+
this._GuRadioButton({
|
|
82
|
+
name: p.PRICE_ORIENTATION,
|
|
83
|
+
buttons: C
|
|
84
|
+
})
|
|
85
|
+
])}
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
_ as CONTROL_BLOCK_ID,
|
|
91
|
+
v as PriceOrientationControl
|
|
92
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ItemsBlockId as
|
|
7
|
-
import { productPairs as
|
|
8
|
-
import { ItemTypeOptions as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { useItemsBlockStore as
|
|
12
|
-
import { getDefaultTemplate as
|
|
13
|
-
import { syncCurrencySymbolFromAttributes as
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var D = (h, p, e) => p in h ? M(h, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[p] = e;
|
|
3
|
+
var b = (h, p, e) => D(h, typeof p != "symbol" ? p + "" : p, e);
|
|
4
|
+
import { UEAttr as A, ModificationDescription as d } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as x } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as l } from "../enums/controlEnums.js";
|
|
7
|
+
import { productPairs as T, templateFirstLine as R } from "../enums/productEnums.js";
|
|
8
|
+
import { ItemTypeOptions as P, OrientationOptions as L, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as H } from "../enums/settingsEnums.js";
|
|
9
|
+
import U from "../layouts/horizontal.html.js";
|
|
10
|
+
import F from "../layouts/vertical.html.js";
|
|
11
|
+
import { useItemsBlockStore as $ } from "../store/items-block.js";
|
|
12
|
+
import { getDefaultTemplate as q } from "../template.js";
|
|
13
|
+
import { syncCurrencySymbolFromAttributes as k, syncCurrencyLocationFromAttributes as w, syncFormattedPriceFromAttributes as B } from "../utils/syncAttributesFromConfigBlock.js";
|
|
14
14
|
import { updateConfigBlockAttributes as f } from "../utils/updateAttributes.js";
|
|
15
|
-
const
|
|
15
|
+
const G = "ui-elements-items-block", s = {
|
|
16
16
|
ITEMS_TYPE: "itemsType",
|
|
17
17
|
ORIENTATION: "orientation",
|
|
18
18
|
ITEM_IDS: "itemIds"
|
|
19
19
|
};
|
|
20
|
-
class
|
|
20
|
+
class te extends x {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
|
-
|
|
23
|
+
b(this, "store", $());
|
|
24
24
|
}
|
|
25
25
|
getId() {
|
|
26
|
-
return
|
|
26
|
+
return G;
|
|
27
27
|
}
|
|
28
28
|
getTemplate() {
|
|
29
29
|
return `
|
|
@@ -36,21 +36,21 @@ class Z extends D {
|
|
|
36
36
|
}
|
|
37
37
|
onRender() {
|
|
38
38
|
this.api.updateValues({
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
39
|
+
[s.ORIENTATION]: this.store.orientation,
|
|
40
|
+
[s.ITEMS_TYPE]: this.store.itemsType,
|
|
41
|
+
[s.ITEM_IDS]: this.store.itemIds
|
|
42
42
|
}), this._listenToFormUpdates();
|
|
43
43
|
}
|
|
44
44
|
onTemplateNodeUpdated(e) {
|
|
45
45
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
46
46
|
() => {
|
|
47
|
-
|
|
47
|
+
k(this.currentNode), w(this.currentNode), B(this.currentNode);
|
|
48
48
|
},
|
|
49
49
|
() => {
|
|
50
50
|
this.api.updateValues({
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
51
|
+
[s.ORIENTATION]: this.store.orientation,
|
|
52
|
+
[s.ITEMS_TYPE]: this.store.itemsType,
|
|
53
|
+
[s.ITEM_IDS]: this.store.itemIds
|
|
54
54
|
}), this._initializeSelectItems();
|
|
55
55
|
}
|
|
56
56
|
);
|
|
@@ -64,10 +64,10 @@ class Z extends D {
|
|
|
64
64
|
${this._GuOneColumn([
|
|
65
65
|
this._GuLabel({ text: "Item Type" }),
|
|
66
66
|
this._GuSelect({
|
|
67
|
-
name:
|
|
67
|
+
name: s.ITEMS_TYPE,
|
|
68
68
|
className: "es-100",
|
|
69
69
|
placeholder: "Select Item Type",
|
|
70
|
-
options:
|
|
70
|
+
options: P
|
|
71
71
|
})
|
|
72
72
|
])}
|
|
73
73
|
`;
|
|
@@ -77,7 +77,7 @@ class Z extends D {
|
|
|
77
77
|
${this._GuTwoColumns([
|
|
78
78
|
this._GuLabel({ text: "Orientation" }),
|
|
79
79
|
this._GuRadioButton({
|
|
80
|
-
name:
|
|
80
|
+
name: s.ORIENTATION,
|
|
81
81
|
buttons: L
|
|
82
82
|
})
|
|
83
83
|
])}
|
|
@@ -88,7 +88,7 @@ class Z extends D {
|
|
|
88
88
|
${this._GuTwoColumns([
|
|
89
89
|
this._GuLabel({ text: "Item in Cart" }),
|
|
90
90
|
this._GuSelect({
|
|
91
|
-
name:
|
|
91
|
+
name: s.ITEM_IDS,
|
|
92
92
|
className: "es-100",
|
|
93
93
|
placeholder: "Select Item In Cart",
|
|
94
94
|
options: []
|
|
@@ -97,43 +97,45 @@ class Z extends D {
|
|
|
97
97
|
`;
|
|
98
98
|
}
|
|
99
99
|
_onOrientationChange(e) {
|
|
100
|
-
console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.api.updateValues({ [
|
|
100
|
+
console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.store.setPriceOrientation("horizontal"), this.api.updateValues({ [s.ORIENTATION]: e }), f(this.currentNode, this.api), this._reOrderTemplate(), setTimeout(() => {
|
|
101
|
+
this._recalculateTrimming();
|
|
102
|
+
}, 50);
|
|
101
103
|
}
|
|
102
104
|
_onItemsTypeChange(e) {
|
|
103
105
|
const i = S.ITEMS_TYPE[e], t = N[e], r = t == null ? void 0 : t[0];
|
|
104
106
|
!i || !r || (this.store.setItemsType(i), this.store.setItemIds(r.value), f(this.currentNode, this.api), this._updateDataTypeAttributes(i), this._initializeSelectItems(), this._reFillTemplate());
|
|
105
107
|
}
|
|
106
108
|
_onItemIdsChange(e) {
|
|
107
|
-
console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [
|
|
109
|
+
console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [s.ITEM_IDS]: e }), f(this.currentNode, this.api), this._updateDataNumberAttributes(e), this._reFillTemplate();
|
|
108
110
|
}
|
|
109
111
|
_initializeSelectItems() {
|
|
110
112
|
this.api.setUIEAttribute(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
s.ITEMS_TYPE,
|
|
114
|
+
A.SELECTPICKER.items,
|
|
115
|
+
P
|
|
114
116
|
);
|
|
115
117
|
const { itemsType: e, itemIds: i } = this.store;
|
|
116
118
|
this.api.updateValues({
|
|
117
|
-
[
|
|
119
|
+
[s.ITEMS_TYPE]: e
|
|
118
120
|
});
|
|
119
121
|
const t = N[e];
|
|
120
122
|
this.api.setUIEAttribute(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
s.ITEM_IDS,
|
|
124
|
+
A.SELECTPICKER.items,
|
|
123
125
|
t
|
|
124
126
|
), this.api.updateValues({
|
|
125
|
-
[
|
|
127
|
+
[s.ITEM_IDS]: i
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
_listenToFormUpdates() {
|
|
129
131
|
this.api.onValueChanged(
|
|
130
|
-
|
|
132
|
+
s.ITEMS_TYPE,
|
|
131
133
|
(e) => this._onItemsTypeChange(e)
|
|
132
134
|
), this.api.onValueChanged(
|
|
133
|
-
|
|
135
|
+
s.ORIENTATION,
|
|
134
136
|
(e) => this._onOrientationChange(e)
|
|
135
137
|
), this.api.onValueChanged(
|
|
136
|
-
|
|
138
|
+
s.ITEM_IDS,
|
|
137
139
|
(e) => this._onItemIdsChange(e)
|
|
138
140
|
);
|
|
139
141
|
}
|
|
@@ -144,36 +146,36 @@ class Z extends D {
|
|
|
144
146
|
itemIds: t,
|
|
145
147
|
currencySymbol: r,
|
|
146
148
|
currencyLocation: n,
|
|
147
|
-
formattedPrice:
|
|
149
|
+
formattedPrice: o
|
|
148
150
|
} = this.store;
|
|
149
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
151
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
|
|
150
152
|
orientation: e,
|
|
151
153
|
itemsType: i,
|
|
152
154
|
itemId: t,
|
|
153
155
|
currencySymbol: r,
|
|
154
156
|
currencyLocation: n,
|
|
155
|
-
formattedPrice:
|
|
157
|
+
formattedPrice: o
|
|
156
158
|
})).apply(new d("Updated template"));
|
|
157
159
|
}
|
|
158
160
|
_getTemplateData() {
|
|
159
|
-
const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((
|
|
161
|
+
const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((o) => o.value === i), n = r > -1 ? r : 0;
|
|
160
162
|
return {
|
|
161
|
-
imageSrc:
|
|
162
|
-
name:
|
|
163
|
-
price: t ?
|
|
164
|
-
originalPrice: t ?
|
|
165
|
-
quantity:
|
|
166
|
-
button:
|
|
163
|
+
imageSrc: T.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
|
|
164
|
+
name: T.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
|
|
165
|
+
price: t ? T.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : T.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
|
|
166
|
+
originalPrice: t ? T.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : T.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
|
|
167
|
+
quantity: T.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
|
|
168
|
+
button: T.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
|
|
167
169
|
};
|
|
168
170
|
}
|
|
169
171
|
_updateImageSrc(e) {
|
|
170
172
|
var t;
|
|
171
|
-
const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${
|
|
173
|
+
const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${l.IMAGE}"] img`);
|
|
172
174
|
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute("src", e).apply(new d("Updated image src"));
|
|
173
175
|
}
|
|
174
176
|
_updateName(e) {
|
|
175
177
|
var n;
|
|
176
|
-
const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${
|
|
178
|
+
const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
|
|
177
179
|
if (!i)
|
|
178
180
|
return;
|
|
179
181
|
const t = i.getInnerText().trim();
|
|
@@ -181,20 +183,20 @@ class Z extends D {
|
|
|
181
183
|
r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated name"));
|
|
182
184
|
}
|
|
183
185
|
_updatePrice(e) {
|
|
184
|
-
var
|
|
185
|
-
const i = (
|
|
186
|
+
var g;
|
|
187
|
+
const i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`);
|
|
186
188
|
if (!i)
|
|
187
189
|
return;
|
|
188
190
|
const t = this._getParagraphFromBlock(i);
|
|
189
191
|
if (!t)
|
|
190
192
|
return;
|
|
191
|
-
const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol:
|
|
193
|
+
const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol: o, currencyLocation: a } = this.store, c = (o == null ? void 0 : o.trim()) || "", m = this._removeCurrencySymbol(n, c), u = this._replacePriceNumber(m, e), I = this._buildPriceContent(u, c, a), _ = r.replace(n, I);
|
|
192
194
|
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(_).apply(new d("Updated price"));
|
|
193
195
|
}
|
|
194
196
|
_updateOriginalPrice(e) {
|
|
195
197
|
var y;
|
|
196
198
|
const i = (y = this.currentNode) == null ? void 0 : y.querySelector(
|
|
197
|
-
`[esd-extension-block-id="${
|
|
199
|
+
`[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
|
|
198
200
|
);
|
|
199
201
|
if (!i)
|
|
200
202
|
return;
|
|
@@ -204,78 +206,80 @@ class Z extends D {
|
|
|
204
206
|
const r = t.querySelector("s");
|
|
205
207
|
if (!r)
|
|
206
208
|
return;
|
|
207
|
-
const n = r.getInnerHTML() || "",
|
|
208
|
-
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(
|
|
209
|
+
const n = r.getInnerHTML() || "", o = r.getInnerText() || "", { currencySymbol: a, currencyLocation: c } = this.store, m = (a == null ? void 0 : a.trim()) || "", u = this._removeCurrencySymbol(o, m), I = this._replacePriceNumber(u, e), _ = this._buildPriceContent(I, m, c), E = `<s>${n.replace(o, _)}</s>`;
|
|
210
|
+
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(E).apply(new d("Updated original price"));
|
|
209
211
|
}
|
|
210
212
|
_updateQuantity(e) {
|
|
211
213
|
var a;
|
|
212
|
-
const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${
|
|
214
|
+
const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`);
|
|
213
215
|
if (!t)
|
|
214
216
|
return;
|
|
215
217
|
const r = t.getStyle("display") === "none", n = t.getInnerText().trim();
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
+
let o = t.getInnerHTML();
|
|
219
|
+
o = o.replace(n, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(o).setStyle("display", i && !r ? "table-cell" : "none").apply(new d("Updated quantity"));
|
|
218
220
|
}
|
|
219
221
|
/**
|
|
220
222
|
* @todo Optimize template reordering for performance.
|
|
221
223
|
* @description Reorders the template structure based on current orientation and visibility settings.
|
|
222
224
|
*/
|
|
223
225
|
_reOrderTemplate() {
|
|
224
|
-
var
|
|
225
|
-
const e = (
|
|
226
|
-
`[esd-extension-block-id="${
|
|
227
|
-
), n = (
|
|
228
|
-
if (!e || !i || !t || !r || !n || !
|
|
226
|
+
var I, _, g, E, y, O, C;
|
|
227
|
+
const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${l.IMAGE}"]`), i = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${l.NAME}"]`), t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
|
|
228
|
+
`[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
|
|
229
|
+
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`), o = (O = this.currentNode) == null ? void 0 : O.querySelector(`[esd-extension-block-id="${l.BUTTON}"]`), a = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
|
|
230
|
+
if (!e || !i || !t || !r || !n || !o || !a)
|
|
229
231
|
return;
|
|
230
|
-
const { orientation:
|
|
231
|
-
let
|
|
232
|
-
|
|
232
|
+
const { orientation: c } = this.store, m = c === S.ORIENTATION.VERTICAL;
|
|
233
|
+
let u = m ? F : U;
|
|
234
|
+
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", H.productImageWidth).apply(new d("Updated image width")), setTimeout(() => {
|
|
235
|
+
u = u.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? R : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", i.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", o.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", a.getOuterHTML()), u = u.trim().replace(R, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(u).apply(new d("Reordered template"));
|
|
236
|
+
}, 50);
|
|
233
237
|
}
|
|
234
238
|
_updateDataTypeAttributes(e) {
|
|
235
239
|
if (!this.currentNode)
|
|
236
240
|
return;
|
|
237
241
|
const i = this.currentNode.closest(".ins-product-td"), t = this.api.getDocumentModifier();
|
|
238
242
|
i && t.modifyHtml(i).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
239
|
-
const
|
|
240
|
-
t.modifyHtml(
|
|
243
|
+
const o = n;
|
|
244
|
+
t.modifyHtml(o).setAttribute("data-type", e);
|
|
241
245
|
}), t.apply(new d("Updated data-type attribute"));
|
|
242
246
|
}
|
|
243
247
|
_updateDataNumberAttributes(e) {
|
|
244
248
|
if (!this.currentNode)
|
|
245
249
|
return;
|
|
246
|
-
const { itemsType: i } = this.store, t = N[i].findIndex((
|
|
250
|
+
const { itemsType: i } = this.store, t = N[i].findIndex((c) => c.value === e);
|
|
247
251
|
let r = "1";
|
|
248
252
|
if (t >= 0)
|
|
249
253
|
r = String(t + 1);
|
|
250
254
|
else if (e) {
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const [,
|
|
254
|
-
r =
|
|
255
|
+
const c = e.match(/\((\d+)\)/);
|
|
256
|
+
if (c) {
|
|
257
|
+
const [, m] = c;
|
|
258
|
+
r = m;
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
|
-
const n = this.currentNode.closest(".ins-product-td"),
|
|
258
|
-
n &&
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
}),
|
|
261
|
+
const n = this.currentNode.closest(".ins-product-td"), o = this.api.getDocumentModifier();
|
|
262
|
+
n && o.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((c) => {
|
|
263
|
+
const m = c;
|
|
264
|
+
o.modifyHtml(m).setAttribute("data-number", r);
|
|
265
|
+
}), o.apply(new d("Updated data-number attribute"));
|
|
262
266
|
}
|
|
263
267
|
_reFillTemplate() {
|
|
264
268
|
const e = this._getTemplateData();
|
|
265
269
|
this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity);
|
|
266
270
|
}
|
|
267
271
|
_recalculateTrimming() {
|
|
268
|
-
var
|
|
269
|
-
if (!this.
|
|
272
|
+
var n;
|
|
273
|
+
if (!this.currentNode)
|
|
270
274
|
return;
|
|
271
|
-
const e = (
|
|
275
|
+
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
|
|
272
276
|
if (!e)
|
|
273
277
|
return;
|
|
274
|
-
const i = e.querySelector("p");
|
|
278
|
+
const i = e.querySelector("p > a");
|
|
275
279
|
if (!i)
|
|
276
280
|
return;
|
|
277
|
-
const t = this.store.orientation === S.ORIENTATION.VERTICAL;
|
|
278
|
-
this.api.getDocumentModifier().modifyHtml(i).setStyle("
|
|
281
|
+
const t = this.store.orientation === S.ORIENTATION.VERTICAL, r = this.store.nameTrimming;
|
|
282
|
+
this.api.getDocumentModifier().modifyHtml(i).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", t ? "130px" : "520px").setStyle("width", t ? "130px" : "520px").apply(new d("Recalculated trimming after orientation change"));
|
|
279
283
|
}
|
|
280
284
|
_getParagraphFromBlock(e) {
|
|
281
285
|
return e.querySelector("p");
|
|
@@ -292,7 +296,7 @@ class Z extends D {
|
|
|
292
296
|
} else {
|
|
293
297
|
const n = t.match(/([^0-9.,\s]+)/);
|
|
294
298
|
if (n && n[1]) {
|
|
295
|
-
const
|
|
299
|
+
const o = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(o)}\\s*`);
|
|
296
300
|
r = t.replace(a, "").trim();
|
|
297
301
|
}
|
|
298
302
|
}
|
|
@@ -307,6 +311,6 @@ class Z extends D {
|
|
|
307
311
|
}
|
|
308
312
|
}
|
|
309
313
|
export {
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
G as CONTROL_BLOCK_ID,
|
|
315
|
+
te as ItemsBlockControl
|
|
312
316
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var c = /* @__PURE__ */ ((i) => (i.BUTTON = "items-block-button", i.IMAGE = "items-block-image", i.ORIGINAL_PRICE = "items-block-original-price", i.PRICE = "items-block-price", i.QUANTITY = "items-block-quantity", i.NAME = "items-block-name", i))(c || {}),
|
|
1
|
+
var c = /* @__PURE__ */ ((i) => (i.BUTTON = "items-block-button", i.IMAGE = "items-block-image", i.ORIGINAL_PRICE = "items-block-original-price", i.PRICE = "items-block-price", i.QUANTITY = "items-block-quantity", i.NAME = "items-block-name", i))(c || {}), t = /* @__PURE__ */ ((i) => (i.BUTTON_ALIGN = "items-block-button-align-control", i.BUTTON_BORDER = "items-block-button-border-control", i.BUTTON_BORDER_RADIUS = "items-block-button-border-radius-control", i.BUTTON_COLOR = "items-block-button-color-control", i.BUTTON_FIT_TO_CONTENT = "items-block-button-fit-to-content-control", i.BUTTON_FONT_FAMILY = "items-block-button-font-family-control", i.BUTTON_MARGINS = "items-block-button-margins-control", i.BUTTON_PADDINGS = "items-block-button-paddings-control", i.BUTTON_TEXT = "items-block-button-text-control", i.BUTTON_TEXT_SIZE = "items-block-button-text-size-control", i.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "items-block-button-text-style-and-font-color-control", i.BUTTON_LINK = "items-block-button-link-control", i.IMAGE_SIZE = "items-block-image-size-control", i.IMAGE_MARGINS = "items-block-image-margins-control", i.IMAGE_LINK = "items-block-image-link-control", i.ORIGINAL_PRICE_ALIGN = "items-block-original-price-align-control", i.ORIGINAL_PRICE_COLOR = "items-block-original-price-color-control", i.ORIGINAL_PRICE_SIZE = "items-block-original-price-size-control", i.ORIGINAL_PRICE_STYLE = "items-block-original-price-style-control", i.ORIGINAL_PRICE_FONT_FAMILY = "items-block-original-price-font-family-control", i.ORIGINAL_PRICE_BACKGROUND = "items-block-original-price-background-control", i.ORIGINAL_PRICE_PADDINGS = "items-block-original-price-paddings-control", i.PRICE_ALIGN = "items-block-price-align-control", i.PRICE_COLOR = "items-block-price-color-control", i.PRICE_SIZE = "items-block-price-size-control", i.PRICE_STYLE = "items-block-price-style-control", i.PRICE_FONT_FAMILY = "items-block-price-font-family-control", i.PRICE_BACKGROUND = "items-block-price-background-control", i.PRICE_PADDINGS = "items-block-price-paddings-control", i.PRICE_HIDE_DISCOUNT = "items-block-price-hide-discount-control", i.PRICE_FORMATTED_PRICE = "items-block-price-formatted-price-control", i.PRICE_CURRENCY_SYMBOL = "items-block-price-currency-symbol-control", i.PRICE_CURRENCY_LOCATION = "items-block-price-currency-location-control", i.PRICE_ORIENTATION = "items-block-price-orientation-control", i.NAME_ALIGN = "items-block-name-align-control", i.NAME_COLOR = "items-block-name-color-control", i.NAME_SIZE = "items-block-name-size-control", i.NAME_STYLE = "items-block-name-style-control", i.NAME_FONT_FAMILY = "items-block-name-font-family-control", i.NAME_BACKGROUND = "items-block-name-background-control", i.NAME_TRIMMING = "items-block-name-trimming-control", i.NAME_PADDINGS = "items-block-name-paddings-control", i.QUANTITY_ALIGN = "items-block-quantity-align-control", i.QUANTITY_COLOR = "items-block-quantity-color-control", i.QUANTITY_FONT_FAMILY = "items-block-quantity-font-family-control", i.QUANTITY_PADDINGS = "items-block-quantity-paddings-control", i.QUANTITY_SIZE = "items-block-quantity-size-control", i.QUANTITY_STYLE = "items-block-quantity-style-control", i))(t || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
t as ItemsBlockControlId,
|
|
4
4
|
c as ItemsBlockId
|
|
5
5
|
};
|