@useinsider/guido 1.0.3-beta.f2389d0 → 1.0.3-beta.f263f71
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/settingsControl.js +90 -94
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +2 -3
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -3
- package/dist/extensions/Blocks/Items/extension.js +6 -7
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +5 -17
- package/dist/extensions/Blocks/Items/settingsPanel.js +24 -25
- package/dist/extensions/Blocks/Items/store/items-block.js +4 -8
- package/dist/extensions/Blocks/Items/template.js +59 -65
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +26 -35
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +27 -29
- package/dist/extensions/Blocks/Unsubscribe/block.js +30 -34
- package/dist/guido.css +1 -1
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -6
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +4 -3
- package/package.json +1 -3
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +0 -92
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -15
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import i from "./EmailSizeIndicator.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
3
|
+
import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var r = 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.InTooltipV2, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", "dynamic-position": !1, "tooltip-alignment": "center", "static-position": "bottom center", text: t.trans("email-editor.preview-design-size-tooltip") } })], 1);
|
|
7
|
+
}, a = [], n = /* @__PURE__ */ o(
|
|
8
8
|
i,
|
|
9
|
-
|
|
9
|
+
r,
|
|
10
10
|
a,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"d562c73b"
|
|
14
14
|
);
|
|
15
|
-
const
|
|
15
|
+
const _ = n.exports;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
_ 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 { InTooltipV2 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, InTooltipV2: 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 s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as n, UIElementType as a, 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 l } 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 y } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
|
|
11
|
+
const f = l.NAME_TRIMMING, r = {
|
|
12
12
|
TRIMMING: "trimming"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class R extends c {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
|
|
17
|
+
s(this, "store", N());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return f;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
24
|
-
<div class="${
|
|
24
|
+
<div class="${l.NAME_TRIMMING}">
|
|
25
25
|
${this._getTextTrimming()}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
onRender() {
|
|
30
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
|
|
31
31
|
this._onTrimmingChange(e);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
onTemplateNodeUpdated(e) {
|
|
35
35
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
36
|
-
() =>
|
|
36
|
+
() => y(this.currentNode),
|
|
37
37
|
() => {
|
|
38
|
-
this.api.updateValues({ [
|
|
38
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
|
|
39
39
|
}
|
|
40
|
-
);
|
|
40
|
+
), this.store.nameTrimming && this._applyTrimmingStyles();
|
|
41
41
|
}
|
|
42
42
|
_onTrimmingChange(e) {
|
|
43
|
-
this.store.setNameTrimming(e),
|
|
43
|
+
this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
44
44
|
}
|
|
45
45
|
_applyTrimmingStyles(e) {
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
46
|
+
var m;
|
|
47
|
+
const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
|
|
48
|
+
if (!o)
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
51
|
+
p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "550px").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("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
|
+
<${a.LABEL}
|
|
58
58
|
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
59
|
>
|
|
60
|
-
</${
|
|
61
|
-
${this._GuToggle(
|
|
60
|
+
</${a.LABEL}>
|
|
61
|
+
${this._GuToggle(r.TRIMMING)}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
f as CONTROL_BLOCK_ID,
|
|
69
|
+
R as NameTrimmingControl
|
|
70
70
|
};
|
|
@@ -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 P = Object.defineProperty;
|
|
2
|
+
var M = (T, u, e) => u in T ? P(T, u, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[u] = e;
|
|
3
|
+
var C = (T, u, e) => M(T, typeof u != "symbol" ? u + "" : u, e);
|
|
4
|
+
import { UEAttr as b, ModificationDescription as d } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as D } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as m } from "../enums/controlEnums.js";
|
|
7
|
+
import { productPairs as p, templateFirstLine as A } from "../enums/productEnums.js";
|
|
8
|
+
import { ItemTypeOptions as R, OrientationOptions as L, ItemInCartOptions as N, SETTINGS_ENUMS as S } from "../enums/settingsEnums.js";
|
|
9
|
+
import x from "../layouts/horizontal.html.js";
|
|
10
|
+
import H from "../layouts/vertical.html.js";
|
|
11
|
+
import { useItemsBlockStore as U } from "../store/items-block.js";
|
|
12
|
+
import { getDefaultTemplate as F } from "../template.js";
|
|
13
|
+
import { syncCurrencySymbolFromAttributes as $, syncCurrencyLocationFromAttributes as k, syncFormattedPriceFromAttributes as q } from "../utils/syncAttributesFromConfigBlock.js";
|
|
14
14
|
import { updateConfigBlockAttributes as f } from "../utils/updateAttributes.js";
|
|
15
|
-
const
|
|
15
|
+
const w = "ui-elements-items-block", o = {
|
|
16
16
|
ITEMS_TYPE: "itemsType",
|
|
17
17
|
ORIENTATION: "orientation",
|
|
18
18
|
ITEM_IDS: "itemIds"
|
|
19
19
|
};
|
|
20
|
-
class
|
|
20
|
+
class Z extends D {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
|
-
|
|
23
|
+
C(this, "store", U());
|
|
24
24
|
}
|
|
25
25
|
getId() {
|
|
26
|
-
return
|
|
26
|
+
return w;
|
|
27
27
|
}
|
|
28
28
|
getTemplate() {
|
|
29
29
|
return `
|
|
@@ -36,21 +36,21 @@ class te extends x {
|
|
|
36
36
|
}
|
|
37
37
|
onRender() {
|
|
38
38
|
this.api.updateValues({
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
39
|
+
[o.ORIENTATION]: this.store.orientation,
|
|
40
|
+
[o.ITEMS_TYPE]: this.store.itemsType,
|
|
41
|
+
[o.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
|
+
$(this.currentNode), k(this.currentNode), q(this.currentNode);
|
|
48
48
|
},
|
|
49
49
|
() => {
|
|
50
50
|
this.api.updateValues({
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
51
|
+
[o.ORIENTATION]: this.store.orientation,
|
|
52
|
+
[o.ITEMS_TYPE]: this.store.itemsType,
|
|
53
|
+
[o.ITEM_IDS]: this.store.itemIds
|
|
54
54
|
}), this._initializeSelectItems();
|
|
55
55
|
}
|
|
56
56
|
);
|
|
@@ -64,10 +64,10 @@ class te extends x {
|
|
|
64
64
|
${this._GuOneColumn([
|
|
65
65
|
this._GuLabel({ text: "Item Type" }),
|
|
66
66
|
this._GuSelect({
|
|
67
|
-
name:
|
|
67
|
+
name: o.ITEMS_TYPE,
|
|
68
68
|
className: "es-100",
|
|
69
69
|
placeholder: "Select Item Type",
|
|
70
|
-
options:
|
|
70
|
+
options: R
|
|
71
71
|
})
|
|
72
72
|
])}
|
|
73
73
|
`;
|
|
@@ -77,7 +77,7 @@ class te extends x {
|
|
|
77
77
|
${this._GuTwoColumns([
|
|
78
78
|
this._GuLabel({ text: "Orientation" }),
|
|
79
79
|
this._GuRadioButton({
|
|
80
|
-
name:
|
|
80
|
+
name: o.ORIENTATION,
|
|
81
81
|
buttons: L
|
|
82
82
|
})
|
|
83
83
|
])}
|
|
@@ -88,7 +88,7 @@ class te extends x {
|
|
|
88
88
|
${this._GuTwoColumns([
|
|
89
89
|
this._GuLabel({ text: "Item in Cart" }),
|
|
90
90
|
this._GuSelect({
|
|
91
|
-
name:
|
|
91
|
+
name: o.ITEM_IDS,
|
|
92
92
|
className: "es-100",
|
|
93
93
|
placeholder: "Select Item In Cart",
|
|
94
94
|
options: []
|
|
@@ -97,45 +97,43 @@ class te extends x {
|
|
|
97
97
|
`;
|
|
98
98
|
}
|
|
99
99
|
_onOrientationChange(e) {
|
|
100
|
-
console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.
|
|
101
|
-
this._recalculateTrimming();
|
|
102
|
-
}, 50);
|
|
100
|
+
console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.api.updateValues({ [o.ORIENTATION]: e }), f(this.currentNode, this.api), this._reOrderTemplate(), this._recalculateTrimming();
|
|
103
101
|
}
|
|
104
102
|
_onItemsTypeChange(e) {
|
|
105
103
|
const i = S.ITEMS_TYPE[e], t = N[e], r = t == null ? void 0 : t[0];
|
|
106
104
|
!i || !r || (this.store.setItemsType(i), this.store.setItemIds(r.value), f(this.currentNode, this.api), this._updateDataTypeAttributes(i), this._initializeSelectItems(), this._reFillTemplate());
|
|
107
105
|
}
|
|
108
106
|
_onItemIdsChange(e) {
|
|
109
|
-
console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [
|
|
107
|
+
console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), f(this.currentNode, this.api), this._updateDataNumberAttributes(e), this._reFillTemplate();
|
|
110
108
|
}
|
|
111
109
|
_initializeSelectItems() {
|
|
112
110
|
this.api.setUIEAttribute(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
o.ITEMS_TYPE,
|
|
112
|
+
b.SELECTPICKER.items,
|
|
113
|
+
R
|
|
116
114
|
);
|
|
117
115
|
const { itemsType: e, itemIds: i } = this.store;
|
|
118
116
|
this.api.updateValues({
|
|
119
|
-
[
|
|
117
|
+
[o.ITEMS_TYPE]: e
|
|
120
118
|
});
|
|
121
119
|
const t = N[e];
|
|
122
120
|
this.api.setUIEAttribute(
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
o.ITEM_IDS,
|
|
122
|
+
b.SELECTPICKER.items,
|
|
125
123
|
t
|
|
126
124
|
), this.api.updateValues({
|
|
127
|
-
[
|
|
125
|
+
[o.ITEM_IDS]: i
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
128
|
_listenToFormUpdates() {
|
|
131
129
|
this.api.onValueChanged(
|
|
132
|
-
|
|
130
|
+
o.ITEMS_TYPE,
|
|
133
131
|
(e) => this._onItemsTypeChange(e)
|
|
134
132
|
), this.api.onValueChanged(
|
|
135
|
-
|
|
133
|
+
o.ORIENTATION,
|
|
136
134
|
(e) => this._onOrientationChange(e)
|
|
137
135
|
), this.api.onValueChanged(
|
|
138
|
-
|
|
136
|
+
o.ITEM_IDS,
|
|
139
137
|
(e) => this._onItemIdsChange(e)
|
|
140
138
|
);
|
|
141
139
|
}
|
|
@@ -146,36 +144,36 @@ class te extends x {
|
|
|
146
144
|
itemIds: t,
|
|
147
145
|
currencySymbol: r,
|
|
148
146
|
currencyLocation: n,
|
|
149
|
-
formattedPrice:
|
|
147
|
+
formattedPrice: s
|
|
150
148
|
} = this.store;
|
|
151
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
149
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(F({
|
|
152
150
|
orientation: e,
|
|
153
151
|
itemsType: i,
|
|
154
152
|
itemId: t,
|
|
155
153
|
currencySymbol: r,
|
|
156
154
|
currencyLocation: n,
|
|
157
|
-
formattedPrice:
|
|
155
|
+
formattedPrice: s
|
|
158
156
|
})).apply(new d("Updated template"));
|
|
159
157
|
}
|
|
160
158
|
_getTemplateData() {
|
|
161
|
-
const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((
|
|
159
|
+
const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((s) => s.value === i), n = r > -1 ? r : 0;
|
|
162
160
|
return {
|
|
163
|
-
imageSrc:
|
|
164
|
-
name:
|
|
165
|
-
price: t ?
|
|
166
|
-
originalPrice: t ?
|
|
167
|
-
quantity:
|
|
168
|
-
button:
|
|
161
|
+
imageSrc: p.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
|
|
162
|
+
name: p.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
|
|
163
|
+
price: t ? p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
|
|
164
|
+
originalPrice: t ? p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
|
|
165
|
+
quantity: p.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
|
|
166
|
+
button: p.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
|
|
169
167
|
};
|
|
170
168
|
}
|
|
171
169
|
_updateImageSrc(e) {
|
|
172
170
|
var t;
|
|
173
|
-
const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${
|
|
171
|
+
const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
|
|
174
172
|
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute("src", e).apply(new d("Updated image src"));
|
|
175
173
|
}
|
|
176
174
|
_updateName(e) {
|
|
177
175
|
var n;
|
|
178
|
-
const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${
|
|
176
|
+
const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
179
177
|
if (!i)
|
|
180
178
|
return;
|
|
181
179
|
const t = i.getInnerText().trim();
|
|
@@ -183,20 +181,20 @@ class te extends x {
|
|
|
183
181
|
r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated name"));
|
|
184
182
|
}
|
|
185
183
|
_updatePrice(e) {
|
|
186
|
-
var
|
|
187
|
-
const i = (
|
|
184
|
+
var E;
|
|
185
|
+
const i = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
|
|
188
186
|
if (!i)
|
|
189
187
|
return;
|
|
190
188
|
const t = this._getParagraphFromBlock(i);
|
|
191
189
|
if (!t)
|
|
192
190
|
return;
|
|
193
|
-
const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol:
|
|
191
|
+
const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol: s, currencyLocation: a } = this.store, l = (s == null ? void 0 : s.trim()) || "", c = this._removeCurrencySymbol(n, l), h = this._replacePriceNumber(c, e), I = this._buildPriceContent(h, l, a), _ = r.replace(n, I);
|
|
194
192
|
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(_).apply(new d("Updated price"));
|
|
195
193
|
}
|
|
196
194
|
_updateOriginalPrice(e) {
|
|
197
195
|
var y;
|
|
198
196
|
const i = (y = this.currentNode) == null ? void 0 : y.querySelector(
|
|
199
|
-
`[esd-extension-block-id="${
|
|
197
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
200
198
|
);
|
|
201
199
|
if (!i)
|
|
202
200
|
return;
|
|
@@ -206,80 +204,78 @@ class te extends x {
|
|
|
206
204
|
const r = t.querySelector("s");
|
|
207
205
|
if (!r)
|
|
208
206
|
return;
|
|
209
|
-
const n = r.getInnerHTML() || "",
|
|
210
|
-
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(
|
|
207
|
+
const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: a, currencyLocation: l } = this.store, c = (a == null ? void 0 : a.trim()) || "", h = this._removeCurrencySymbol(s, c), I = this._replacePriceNumber(h, e), _ = this._buildPriceContent(I, c, l), g = `<s>${n.replace(s, _)}</s>`;
|
|
208
|
+
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(g).apply(new d("Updated original price"));
|
|
211
209
|
}
|
|
212
210
|
_updateQuantity(e) {
|
|
213
211
|
var a;
|
|
214
|
-
const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${
|
|
212
|
+
const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
|
|
215
213
|
if (!t)
|
|
216
214
|
return;
|
|
217
215
|
const r = t.getStyle("display") === "none", n = t.getInnerText().trim();
|
|
218
|
-
let
|
|
219
|
-
|
|
216
|
+
let s = t.getInnerHTML();
|
|
217
|
+
s = s.replace(n, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(s).setStyle("display", i && !r ? "table-cell" : "none").apply(new d("Updated quantity"));
|
|
220
218
|
}
|
|
221
219
|
/**
|
|
222
220
|
* @todo Optimize template reordering for performance.
|
|
223
221
|
* @description Reorders the template structure based on current orientation and visibility settings.
|
|
224
222
|
*/
|
|
225
223
|
_reOrderTemplate() {
|
|
226
|
-
var I, _,
|
|
227
|
-
const e = (
|
|
228
|
-
`[esd-extension-block-id="${
|
|
229
|
-
), n = (
|
|
230
|
-
if (!e || !i || !t || !r || !n || !
|
|
224
|
+
var h, I, _, E, g, y, O;
|
|
225
|
+
const e = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), i = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.NAME}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
|
|
226
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
227
|
+
), n = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), s = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`), a = (O = this.currentNode) == null ? void 0 : O.querySelector("esd-config-block");
|
|
228
|
+
if (!e || !i || !t || !r || !n || !s || !a)
|
|
231
229
|
return;
|
|
232
|
-
const { orientation:
|
|
233
|
-
let
|
|
234
|
-
|
|
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);
|
|
230
|
+
const { orientation: l } = this.store;
|
|
231
|
+
let c = l === S.ORIENTATION.VERTICAL ? H : x;
|
|
232
|
+
c = c.replace("{-{-TEMPLATE_FIRST_LINE-}-}", A).replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", i.getOuterHTML()).replace("{-{-PRODUCT_PRICE-}-}", t.getOuterHTML()).replace("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", a.getOuterHTML()), c = c.trim().replace(A, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(c).apply(new d("Reordered template"));
|
|
237
233
|
}
|
|
238
234
|
_updateDataTypeAttributes(e) {
|
|
239
235
|
if (!this.currentNode)
|
|
240
236
|
return;
|
|
241
237
|
const i = this.currentNode.closest(".ins-product-td"), t = this.api.getDocumentModifier();
|
|
242
238
|
i && t.modifyHtml(i).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
243
|
-
const
|
|
244
|
-
t.modifyHtml(
|
|
239
|
+
const s = n;
|
|
240
|
+
t.modifyHtml(s).setAttribute("data-type", e);
|
|
245
241
|
}), t.apply(new d("Updated data-type attribute"));
|
|
246
242
|
}
|
|
247
243
|
_updateDataNumberAttributes(e) {
|
|
248
244
|
if (!this.currentNode)
|
|
249
245
|
return;
|
|
250
|
-
const { itemsType: i } = this.store, t = N[i].findIndex((
|
|
246
|
+
const { itemsType: i } = this.store, t = N[i].findIndex((l) => l.value === e);
|
|
251
247
|
let r = "1";
|
|
252
248
|
if (t >= 0)
|
|
253
249
|
r = String(t + 1);
|
|
254
250
|
else if (e) {
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
const [,
|
|
258
|
-
r =
|
|
251
|
+
const l = e.match(/\((\d+)\)/);
|
|
252
|
+
if (l) {
|
|
253
|
+
const [, c] = l;
|
|
254
|
+
r = c;
|
|
259
255
|
}
|
|
260
256
|
}
|
|
261
|
-
const n = this.currentNode.closest(".ins-product-td"),
|
|
262
|
-
n &&
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
}),
|
|
257
|
+
const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
|
|
258
|
+
n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
|
|
259
|
+
const c = l;
|
|
260
|
+
s.modifyHtml(c).setAttribute("data-number", r);
|
|
261
|
+
}), s.apply(new d("Updated data-number attribute"));
|
|
266
262
|
}
|
|
267
263
|
_reFillTemplate() {
|
|
268
264
|
const e = this._getTemplateData();
|
|
269
265
|
this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity);
|
|
270
266
|
}
|
|
271
267
|
_recalculateTrimming() {
|
|
272
|
-
var
|
|
273
|
-
if (!this.currentNode)
|
|
268
|
+
var r;
|
|
269
|
+
if (!this.store.nameTrimming || !this.currentNode)
|
|
274
270
|
return;
|
|
275
|
-
const e = (
|
|
271
|
+
const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
276
272
|
if (!e)
|
|
277
273
|
return;
|
|
278
|
-
const i = e.querySelector("p
|
|
274
|
+
const i = e.querySelector("p");
|
|
279
275
|
if (!i)
|
|
280
276
|
return;
|
|
281
|
-
const t = this.store.orientation === S.ORIENTATION.VERTICAL
|
|
282
|
-
this.api.getDocumentModifier().modifyHtml(i).setStyle("
|
|
277
|
+
const t = this.store.orientation === S.ORIENTATION.VERTICAL;
|
|
278
|
+
this.api.getDocumentModifier().modifyHtml(i).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", t ? "130px" : "100%").apply(new d("Recalculated trimming after orientation change"));
|
|
283
279
|
}
|
|
284
280
|
_getParagraphFromBlock(e) {
|
|
285
281
|
return e.querySelector("p");
|
|
@@ -296,7 +292,7 @@ class te extends x {
|
|
|
296
292
|
} else {
|
|
297
293
|
const n = t.match(/([^0-9.,\s]+)/);
|
|
298
294
|
if (n && n[1]) {
|
|
299
|
-
const
|
|
295
|
+
const s = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
300
296
|
r = t.replace(a, "").trim();
|
|
301
297
|
}
|
|
302
298
|
}
|
|
@@ -311,6 +307,6 @@ class te extends x {
|
|
|
311
307
|
}
|
|
312
308
|
}
|
|
313
309
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
w as CONTROL_BLOCK_ID,
|
|
311
|
+
Z as ItemsBlockControl
|
|
316
312
|
};
|
|
@@ -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 || {}), b = /* @__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.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))(b || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
b as ItemsBlockControlId,
|
|
4
4
|
c as ItemsBlockId
|
|
5
5
|
};
|
|
@@ -9,7 +9,6 @@ const o = '<td align="center" class="ins-product-td items-block items-block-v2">
|
|
|
9
9
|
PRODUCT_PRICE_FORMATTED: "data-product_price_formatted",
|
|
10
10
|
PRODUCT_PRICE_CURRENCY_SYMBOL: "data-product_price_currency_symbol",
|
|
11
11
|
PRODUCT_PRICE_CURRENCY_LOCATION: "data-product_price_currency_location",
|
|
12
|
-
PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION: "data-product_original_price_control_orientation",
|
|
13
12
|
PRODUCT_BUTTON_LINK: "data-product_button_link",
|
|
14
13
|
PRODUCT_IMAGE_LINK: "data-product_image_link",
|
|
15
14
|
PRODUCT_NAME_CONTROL_VALUE: "data-product_name_control_value",
|
|
@@ -215,7 +214,7 @@ const o = '<td align="center" class="ins-product-td items-block items-block-v2">
|
|
|
215
214
|
function m(e, a = 8) {
|
|
216
215
|
return i(1, a + 1).map((s) => `${e}_${s}`);
|
|
217
216
|
}
|
|
218
|
-
function
|
|
217
|
+
function E() {
|
|
219
218
|
const { PAIRS_FOR_EXTENSION: e } = t, a = [];
|
|
220
219
|
return a.push(
|
|
221
220
|
e.imageSrc.CART_ITEMS.ATTR,
|
|
@@ -263,7 +262,7 @@ function r() {
|
|
|
263
262
|
), a;
|
|
264
263
|
}
|
|
265
264
|
const p = _(
|
|
266
|
-
|
|
265
|
+
E(),
|
|
267
266
|
(e) => m(e)
|
|
268
267
|
);
|
|
269
268
|
export {
|
|
@@ -19,7 +19,7 @@ const e = {
|
|
|
19
19
|
itemsType: e.ITEMS_TYPE.CART_ITEMS,
|
|
20
20
|
cartItemsSelectControlValue: "{{Abandoned Cart Item (1) Url}}",
|
|
21
21
|
cardOrientationControlValue: e.ORIENTATION.HORIZONTAL,
|
|
22
|
-
productNameTrimmingControlValue: "
|
|
22
|
+
productNameTrimmingControlValue: "0",
|
|
23
23
|
productPriceHideDiscountControlValue: "0",
|
|
24
24
|
productPriceFormattedControlValue: "1",
|
|
25
25
|
productPriceCurrencySymbolControlValue: "USD",
|
|
@@ -34,8 +34,7 @@ const e = {
|
|
|
34
34
|
productQuantityVisible: "1",
|
|
35
35
|
productPriceVisible: "1",
|
|
36
36
|
productOriginalPriceVisible: "1",
|
|
37
|
-
productButtonVisible: "1"
|
|
38
|
-
productImageWidth: "70"
|
|
37
|
+
productButtonVisible: "1"
|
|
39
38
|
}, o = {
|
|
40
39
|
[e.ITEMS_TYPE.CART_ITEMS]: [
|
|
41
40
|
{ text: "Abandoned Cart Item (1)", value: "{{Abandoned Cart Item (1) Url}}" },
|
|
@@ -3,18 +3,17 @@ import { ItemsBlock as i } from "./block.js";
|
|
|
3
3
|
import { ButtonLinkControl as C } from "./controls/button/link.js";
|
|
4
4
|
import { ItemsBlockCardCompositionControl as e } from "./controls/cardComposition.js";
|
|
5
5
|
import { ImageLinkControl as m } from "./controls/image/link.js";
|
|
6
|
-
import { NameControls as
|
|
6
|
+
import { NameControls as t, QuantityControls as n, OriginalPriceControls as r, PriceControls as d, ImageControls as l, ButtonControls as o } from "./controls/index.js";
|
|
7
7
|
import { NameTrimmingControl as s } from "./controls/name/trimming.js";
|
|
8
8
|
import { PriceCurrencyLocationControl as c } from "./controls/price/currencyLocation.js";
|
|
9
9
|
import { PriceCurrencySymbolControl as g } from "./controls/price/currencySymbol.js";
|
|
10
10
|
import { PriceFormattedPriceControl as f } from "./controls/price/formattedPrice.js";
|
|
11
11
|
import { PriceHideDiscountControl as p } from "./controls/price/hideDiscount.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { ItemsIconsRegistry as P } from "./iconsRegistry.js";
|
|
12
|
+
import { ItemsBlockControl as y } from "./controls/settingsControl.js";
|
|
13
|
+
import { ItemsIconsRegistry as u } from "./iconsRegistry.js";
|
|
15
14
|
import k from "./items.css.js";
|
|
16
|
-
import { SettingsPanel as
|
|
17
|
-
const
|
|
15
|
+
import { SettingsPanel as P } from "./settingsPanel.js";
|
|
16
|
+
const E = new a().addBlock(i).withSettingsPanelRegistry(P).addControl(y).addControl(e).addControl(t.align).addControl(t.color).addControl(t.size).addControl(t.style).addControl(t.fontFamily).addControl(t.background).addControl(t.paddings).addControl(s).addControl(n.align).addControl(n.color).addControl(n.fontFamily).addControl(n.paddings).addControl(n.size).addControl(n.style).addControl(r.align).addControl(r.color).addControl(r.size).addControl(r.style).addControl(r.fontFamily).addControl(r.background).addControl(r.paddings).addControl(d.align).addControl(d.color).addControl(d.size).addControl(d.style).addControl(d.fontFamily).addControl(d.background).addControl(d.paddings).addControl(p).addControl(f).addControl(g).addControl(c).addControl(m).addControl(l.size).addControl(l.margins).addControl(C).addControl(o.align).addControl(o.border).addControl(o.borderRadius).addControl(o.color).addControl(o.fontFamily).addControl(o.margins).addControl(o.paddings).addControl(o.text).addControl(o.textSize).addControl(o.textStyleAndFontColor).addControl(o.fitToContent).addStyles(k).withIconsRegistry(u).build();
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
E as default
|
|
20
19
|
};
|