@useinsider/guido 2.1.0-beta.411f2a9 → 2.1.0-beta.425dfd0
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/config/migrator/itemsBlockMigrator.js +123 -140
- package/dist/extensions/Blocks/Items/block.js +28 -19
- package/dist/extensions/Blocks/Items/controls/button/link.js +31 -19
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +81 -97
- package/dist/extensions/Blocks/Items/controls/image/link.js +31 -19
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +40 -28
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +46 -34
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +50 -45
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +51 -40
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +35 -23
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +57 -45
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +62 -42
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +191 -184
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -0
- package/dist/extensions/Blocks/Items/extension.js +9 -8
- package/dist/extensions/Blocks/Items/store/items-block.js +79 -0
- package/dist/extensions/Blocks/Items/template.js +175 -181
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +3 -3
- package/dist/extensions/Blocks/common-control.js +92 -91
- package/dist/src/extensions/Blocks/Items/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +5 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +12 -10
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +45 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -4
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ItemsBlockId as
|
|
7
|
-
import { SETTINGS_ENUMS as
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var y = (a, r, t) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
|
|
3
|
+
var P = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as I } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as s } from "../enums/controlEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
|
|
8
|
+
import { useItemsBlockStore as p } from "../store/items-block.js";
|
|
9
|
+
import { getItemsBlockConfig as R, setItemsBlockConfig as U } from "../utils/nodeConfigUtils.js";
|
|
10
|
+
const b = "ui-elements-items-card-composition-block", i = {
|
|
10
11
|
PRODUCT_IMAGE: "image",
|
|
11
12
|
PRODUCT_NAME: "name",
|
|
12
13
|
PRODUCT_QUANTITY: "quantity",
|
|
@@ -14,10 +15,11 @@ const m = "ui-elements-items-card-composition-block", i = {
|
|
|
14
15
|
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
15
16
|
PRODUCT_BUTTON: "button"
|
|
16
17
|
};
|
|
17
|
-
class S extends
|
|
18
|
+
class S extends I {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
|
-
|
|
21
|
+
P(this, "store", p());
|
|
22
|
+
P(this, "visibilityState", {
|
|
21
23
|
[i.PRODUCT_IMAGE]: !0,
|
|
22
24
|
[i.PRODUCT_NAME]: !0,
|
|
23
25
|
[i.PRODUCT_QUANTITY]: !0,
|
|
@@ -27,7 +29,7 @@ class S extends U {
|
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
getId() {
|
|
30
|
-
return
|
|
32
|
+
return b;
|
|
31
33
|
}
|
|
32
34
|
getTemplate() {
|
|
33
35
|
return `
|
|
@@ -39,7 +41,7 @@ class S extends U {
|
|
|
39
41
|
{ name: i.PRODUCT_PRICE, label: "Product Price" },
|
|
40
42
|
{ name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
|
|
41
43
|
{ name: i.PRODUCT_BUTTON, label: "Product Button" }
|
|
42
|
-
].map((
|
|
44
|
+
].map((e) => this._getToggleContainer(e)).join("")}
|
|
43
45
|
</div>
|
|
44
46
|
`;
|
|
45
47
|
}
|
|
@@ -47,15 +49,20 @@ class S extends U {
|
|
|
47
49
|
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._initializeToggles(), this._listenToFormUpdates();
|
|
48
50
|
}
|
|
49
51
|
onTemplateNodeUpdated(t) {
|
|
50
|
-
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
53
|
+
() => {
|
|
54
|
+
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._applyVisibilityStyles();
|
|
55
|
+
},
|
|
56
|
+
() => {
|
|
57
|
+
this._updateTogglesFromState();
|
|
58
|
+
}
|
|
59
|
+
);
|
|
53
60
|
}
|
|
54
|
-
_getToggleContainer({ name: t, label:
|
|
61
|
+
_getToggleContainer({ name: t, label: e }) {
|
|
55
62
|
return `
|
|
56
63
|
<div class="container" name="${t}Container">
|
|
57
64
|
<div class="display-flex align-items-center justify-content-between">
|
|
58
|
-
${this._GuLabel({ text:
|
|
65
|
+
${this._GuLabel({ text: e, name: `${t}Label` })}
|
|
59
66
|
${this._GuToggle(t)}
|
|
60
67
|
</div>
|
|
61
68
|
</div>
|
|
@@ -75,10 +82,10 @@ class S extends U {
|
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
_syncVisibilityFromAttributes() {
|
|
78
|
-
const t =
|
|
85
|
+
const t = R(this.currentNode);
|
|
79
86
|
if (!t)
|
|
80
87
|
return;
|
|
81
|
-
const
|
|
88
|
+
const e = {
|
|
82
89
|
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
83
90
|
[i.PRODUCT_NAME]: "nameVisible",
|
|
84
91
|
[i.PRODUCT_QUANTITY]: "quantityControlEnabled",
|
|
@@ -86,9 +93,9 @@ class S extends U {
|
|
|
86
93
|
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
87
94
|
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
88
95
|
};
|
|
89
|
-
Object.entries(
|
|
90
|
-
const
|
|
91
|
-
this.visibilityState[
|
|
96
|
+
Object.entries(e).forEach(([o, n]) => {
|
|
97
|
+
const c = t[n];
|
|
98
|
+
this.visibilityState[o] = c !== !1;
|
|
92
99
|
});
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
@@ -97,34 +104,32 @@ class S extends U {
|
|
|
97
104
|
* and mark it as '0'
|
|
98
105
|
*/
|
|
99
106
|
_handleBrowsedItemsQuantity() {
|
|
100
|
-
const t =
|
|
101
|
-
if (!
|
|
107
|
+
const t = this.store.itemsType !== h.ITEMS_TYPE.BROWSED_ITEMS, e = R(this.currentNode);
|
|
108
|
+
if (!e)
|
|
102
109
|
return;
|
|
103
|
-
const
|
|
104
|
-
this.visibilityState[i.PRODUCT_QUANTITY] =
|
|
110
|
+
const o = e.quantityControlEnabled !== !1;
|
|
111
|
+
this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
|
|
105
112
|
}
|
|
106
113
|
_applyVisibilityStyles() {
|
|
107
114
|
const t = {
|
|
108
|
-
[i.PRODUCT_IMAGE]:
|
|
109
|
-
[i.PRODUCT_NAME]:
|
|
110
|
-
[i.PRODUCT_QUANTITY]:
|
|
111
|
-
[i.PRODUCT_PRICE]:
|
|
112
|
-
[i.PRODUCT_ORIGINAL_PRICE]:
|
|
113
|
-
[i.PRODUCT_BUTTON]:
|
|
115
|
+
[i.PRODUCT_IMAGE]: s.IMAGE,
|
|
116
|
+
[i.PRODUCT_NAME]: s.NAME,
|
|
117
|
+
[i.PRODUCT_QUANTITY]: s.QUANTITY,
|
|
118
|
+
[i.PRODUCT_PRICE]: s.PRICE,
|
|
119
|
+
[i.PRODUCT_ORIGINAL_PRICE]: s.ORIGINAL_PRICE,
|
|
120
|
+
[i.PRODUCT_BUTTON]: s.BUTTON
|
|
114
121
|
};
|
|
115
|
-
Object.entries(t).forEach(([
|
|
116
|
-
var
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
122
|
+
Object.entries(t).forEach(([e, o]) => {
|
|
123
|
+
var d;
|
|
124
|
+
const n = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
|
|
125
|
+
if (!n)
|
|
119
126
|
return;
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
T.modifyHtml(d).setStyle("display", l ? "table-cell" : "none");
|
|
123
|
-
}), T.apply(new a("Applied visibility from attributes"));
|
|
127
|
+
const c = this.visibilityState[e];
|
|
128
|
+
this.api.getDocumentModifier().modifyHtml(n).setStyle("display", c ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
|
|
124
129
|
}), this._updatePriceCellWidthsForVerticalLayout();
|
|
125
130
|
}
|
|
126
|
-
_updateVisibilityAttribute(t,
|
|
127
|
-
const
|
|
131
|
+
_updateVisibilityAttribute(t, e) {
|
|
132
|
+
const n = {
|
|
128
133
|
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
129
134
|
[i.PRODUCT_NAME]: "nameVisible",
|
|
130
135
|
[i.PRODUCT_QUANTITY]: "quantityControlEnabled",
|
|
@@ -132,8 +137,8 @@ class S extends U {
|
|
|
132
137
|
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
133
138
|
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
134
139
|
}[t];
|
|
135
|
-
|
|
136
|
-
[
|
|
140
|
+
n && U(this.currentNode, this.api, {
|
|
141
|
+
[n]: e
|
|
137
142
|
});
|
|
138
143
|
}
|
|
139
144
|
_listenToFormUpdates() {
|
|
@@ -152,51 +157,35 @@ class S extends U {
|
|
|
152
157
|
});
|
|
153
158
|
}
|
|
154
159
|
_onProductImageChange(t) {
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
|
|
160
|
+
var o;
|
|
161
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
|
|
162
|
+
e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
|
|
158
163
|
}
|
|
159
164
|
_onProductNameChange(t) {
|
|
160
|
-
var
|
|
161
|
-
const
|
|
162
|
-
|
|
165
|
+
var o;
|
|
166
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
|
|
167
|
+
e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
|
|
163
168
|
}
|
|
164
169
|
_onProductQuantityChange(t) {
|
|
165
|
-
var
|
|
166
|
-
const
|
|
167
|
-
|
|
170
|
+
var o;
|
|
171
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
|
|
172
|
+
e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
|
|
168
173
|
`Product quantity visibility changed to ${t ? "visible" : "hidden"}`
|
|
169
174
|
)), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
|
|
170
175
|
}
|
|
171
176
|
_onProductPriceChange(t) {
|
|
172
|
-
var
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
);
|
|
176
|
-
if (!o)
|
|
177
|
-
return;
|
|
178
|
-
this.visibilityState[i.PRODUCT_PRICE] = t;
|
|
179
|
-
const e = this.api.getDocumentModifier();
|
|
180
|
-
o.forEach((l) => {
|
|
181
|
-
e.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
|
|
182
|
-
}), e.apply(
|
|
183
|
-
new a(`Product price visibility changed to ${t ? "visible" : "hidden"}`)
|
|
184
|
-
), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t), this._updatePriceCellWidthsForVerticalLayout();
|
|
177
|
+
var o;
|
|
178
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
|
|
179
|
+
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t), this._updatePriceCellWidthsForVerticalLayout());
|
|
185
180
|
}
|
|
186
181
|
_onProductOriginalPriceChange(t) {
|
|
187
|
-
var
|
|
188
|
-
const
|
|
189
|
-
`[esd-extension-block-id="${
|
|
182
|
+
var o;
|
|
183
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
|
|
184
|
+
`[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
|
|
190
185
|
);
|
|
191
|
-
|
|
192
|
-
return;
|
|
193
|
-
this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t;
|
|
194
|
-
const e = this.api.getDocumentModifier();
|
|
195
|
-
o.forEach((l) => {
|
|
196
|
-
e.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
|
|
197
|
-
}), e.apply(new a(
|
|
186
|
+
e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
|
|
198
187
|
`Product original price visibility changed to ${t ? "visible" : "hidden"}`
|
|
199
|
-
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t), this._updatePriceCellWidthsForVerticalLayout();
|
|
188
|
+
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t), this._updatePriceCellWidthsForVerticalLayout());
|
|
200
189
|
}
|
|
201
190
|
/**
|
|
202
191
|
* Updates both price cell widths in vertical layout based on priceOrientation and visibility.
|
|
@@ -207,32 +196,27 @@ class S extends U {
|
|
|
207
196
|
* - When both are visible, they share 50% each
|
|
208
197
|
*/
|
|
209
198
|
_updatePriceCellWidthsForVerticalLayout() {
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
if (!((t == null ? void 0 : t.orientation) === u.ORIENTATION.VERTICAL))
|
|
199
|
+
var u, _;
|
|
200
|
+
if (!(this.store.orientation === h.ORIENTATION.VERTICAL))
|
|
213
201
|
return;
|
|
214
|
-
const e = (
|
|
215
|
-
if (e
|
|
216
|
-
const
|
|
217
|
-
e.
|
|
218
|
-
d.modifyHtml(_).setStyle("width", P);
|
|
219
|
-
});
|
|
202
|
+
const e = (u = this.currentNode) == null ? void 0 : u.querySelector(".product-price-class"), o = (_ = this.currentNode) == null ? void 0 : _.querySelector(".product-original-price-class"), n = this.store.priceOrientation === "vertical", c = this.visibilityState[i.PRODUCT_PRICE], d = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = this.api.getDocumentModifier();
|
|
203
|
+
if (e) {
|
|
204
|
+
const C = n || !d ? "100%" : "50%";
|
|
205
|
+
T.modifyHtml(e).setStyle("width", C);
|
|
220
206
|
}
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
d.modifyHtml(_).setStyle("width", P);
|
|
225
|
-
});
|
|
207
|
+
if (o) {
|
|
208
|
+
const C = n || !c ? "100%" : "50%";
|
|
209
|
+
T.modifyHtml(o).setStyle("width", C);
|
|
226
210
|
}
|
|
227
|
-
|
|
211
|
+
T.apply(new l("Updated price cell widths for vertical layout"));
|
|
228
212
|
}
|
|
229
213
|
_onProductButtonChange(t) {
|
|
230
|
-
var
|
|
231
|
-
const
|
|
232
|
-
|
|
214
|
+
var o;
|
|
215
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
|
|
216
|
+
e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
|
|
233
217
|
}
|
|
234
218
|
}
|
|
235
219
|
export {
|
|
236
|
-
|
|
220
|
+
b as COMPOSITION_CONTROL_BLOCK_ID,
|
|
237
221
|
S as ItemsBlockCardCompositionControl
|
|
238
222
|
};
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var m = (t, e, n) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var s = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
5
|
+
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
+
import { useItemsBlockStore as L } from "../../store/items-block.js";
|
|
7
|
+
import { getItemsBlockConfig as p } from "../../utils/nodeConfigUtils.js";
|
|
8
|
+
const r = d.IMAGE_LINK, i = {
|
|
5
9
|
LINK: "link"
|
|
6
10
|
};
|
|
7
|
-
class
|
|
11
|
+
class g extends l {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
s(this, "store", L());
|
|
15
|
+
}
|
|
8
16
|
getId() {
|
|
9
|
-
return
|
|
17
|
+
return r;
|
|
10
18
|
}
|
|
11
19
|
getTemplate() {
|
|
12
20
|
return `
|
|
13
|
-
<div class="container ${
|
|
21
|
+
<div class="container ${r}">
|
|
14
22
|
${this._getLink()}
|
|
15
23
|
</div>
|
|
16
24
|
`;
|
|
17
25
|
}
|
|
18
26
|
onRender() {
|
|
19
|
-
const e = o(this.currentNode);
|
|
20
27
|
this.api.updateValues({
|
|
21
|
-
[
|
|
28
|
+
[i.LINK]: this.store.imageLink
|
|
22
29
|
});
|
|
23
30
|
}
|
|
24
|
-
onTemplateNodeUpdated(
|
|
25
|
-
super.onTemplateNodeUpdated(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
+
onTemplateNodeUpdated(n) {
|
|
32
|
+
super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
|
|
33
|
+
() => {
|
|
34
|
+
const o = p(this.currentNode);
|
|
35
|
+
o != null && o.imageLink && this.store.setImageLink(o.imageLink);
|
|
36
|
+
},
|
|
37
|
+
() => {
|
|
38
|
+
this.api.updateValues({
|
|
39
|
+
[i.LINK]: this.store.imageLink
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
);
|
|
31
43
|
}
|
|
32
44
|
_getLink() {
|
|
33
45
|
return `
|
|
34
46
|
${this._GuOneColumn([
|
|
35
47
|
this._GuLabel({ text: "Link" }),
|
|
36
48
|
this._GuTextInput({
|
|
37
|
-
name:
|
|
49
|
+
name: i.LINK,
|
|
38
50
|
placeholder: "Enter Link",
|
|
39
51
|
className: "es-100",
|
|
40
52
|
disabled: !0
|
|
@@ -44,6 +56,6 @@ class p extends a {
|
|
|
44
56
|
}
|
|
45
57
|
}
|
|
46
58
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
r as CONTROL_BLOCK_ID,
|
|
60
|
+
g as ImageLinkControl
|
|
49
61
|
};
|
|
@@ -1,58 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var g = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var s = (i, t, e) => g(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as a, UIElementType as l, UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
+
import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
|
+
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
+
import { getItemsBlockConfig as f, setItemsBlockConfig as M } from "../../utils/nodeConfigUtils.js";
|
|
10
|
+
const y = p.NAME_TRIMMING, m = {
|
|
7
11
|
TRIMMING: "trimming"
|
|
8
12
|
};
|
|
9
|
-
class
|
|
13
|
+
class _ extends c {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
s(this, "store", N());
|
|
17
|
+
}
|
|
10
18
|
getId() {
|
|
11
|
-
return
|
|
19
|
+
return y;
|
|
12
20
|
}
|
|
13
21
|
getTemplate() {
|
|
14
22
|
return `
|
|
15
|
-
<div class="container ${
|
|
23
|
+
<div class="container ${p.NAME_TRIMMING}">
|
|
16
24
|
${this._getTextTrimming()}
|
|
17
25
|
</div>
|
|
18
26
|
`;
|
|
19
27
|
}
|
|
20
28
|
onRender() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this._onTrimmingChange(t);
|
|
29
|
+
this.api.updateValues({ [m.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(m.TRIMMING, (e) => {
|
|
30
|
+
this._onTrimmingChange(e);
|
|
24
31
|
});
|
|
25
32
|
}
|
|
26
33
|
onTemplateNodeUpdated(e) {
|
|
27
|
-
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
35
|
+
() => {
|
|
36
|
+
const o = f(this.currentNode);
|
|
37
|
+
o && this.store.setNameTrimming(o.nameTrimming ?? !0);
|
|
38
|
+
},
|
|
39
|
+
() => {
|
|
40
|
+
this.api.updateValues({ [m.TRIMMING]: this.store.nameTrimming });
|
|
41
|
+
}
|
|
42
|
+
);
|
|
31
43
|
}
|
|
32
44
|
_onTrimmingChange(e) {
|
|
33
|
-
|
|
45
|
+
this.store.setNameTrimming(e), M(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [m.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
34
46
|
}
|
|
35
47
|
_applyTrimmingStyles(e) {
|
|
36
|
-
var
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
48
|
+
var r;
|
|
49
|
+
const o = (r = this.currentNode) == null ? void 0 : r.querySelector("p > a");
|
|
50
|
+
if (!o)
|
|
39
51
|
return;
|
|
40
|
-
const
|
|
41
|
-
|
|
52
|
+
const T = e !== void 0 ? e : this.store.nameTrimming, n = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
53
|
+
T ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", n ? "130px" : "520px").apply(new a("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", n ? "130px" : "520px").apply(new a("Text Trimming Disabled"));
|
|
42
54
|
}
|
|
43
55
|
_getTextTrimming() {
|
|
44
56
|
return `
|
|
45
57
|
<div class="display-flex align-items-center justify-content-between">
|
|
46
|
-
<${
|
|
47
|
-
${
|
|
58
|
+
<${l.LABEL}
|
|
59
|
+
${h.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
48
60
|
>
|
|
49
|
-
</${
|
|
50
|
-
${this._GuToggle(
|
|
61
|
+
</${l.LABEL}>
|
|
62
|
+
${this._GuToggle(m.TRIMMING)}
|
|
51
63
|
</div>
|
|
52
64
|
`;
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
y as CONTROL_BLOCK_ID,
|
|
69
|
+
_ as NameTrimmingControl
|
|
58
70
|
};
|
|
@@ -1,48 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var R = (i, o, e) => o in i ? y(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
+
var p = (i, o, e) => R(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
5
|
+
import { UEAttr as I, ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as T } from "../../../common-control.js";
|
|
7
|
+
import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
|
|
8
|
+
import { useItemsBlockStore as f } from "../../store/items-block.js";
|
|
9
|
+
import { getItemsBlockConfig as E, setItemsBlockConfig as O } from "../../utils/nodeConfigUtils.js";
|
|
10
|
+
const b = h.PRICE_CURRENCY_LOCATION, a = {
|
|
7
11
|
CURRENCY_LOCATION: "currencyLocation"
|
|
8
12
|
};
|
|
9
|
-
class
|
|
13
|
+
class B extends T {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
p(this, "store", f());
|
|
17
|
+
}
|
|
10
18
|
getId() {
|
|
11
|
-
return
|
|
19
|
+
return b;
|
|
12
20
|
}
|
|
13
21
|
getTemplate() {
|
|
14
22
|
return `
|
|
15
|
-
<div class="container ${
|
|
23
|
+
<div class="container ${h.PRICE_CURRENCY_LOCATION}">
|
|
16
24
|
${this._getCurrencyLocation()}
|
|
17
25
|
</div>
|
|
18
26
|
`;
|
|
19
27
|
}
|
|
20
28
|
onRender() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this._onCurrencyLocationChange(t);
|
|
29
|
+
this.api.setUIEAttribute(a.CURRENCY_LOCATION, I.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
|
|
30
|
+
this._onCurrencyLocationChange(e);
|
|
24
31
|
});
|
|
25
32
|
}
|
|
26
33
|
onTemplateNodeUpdated(e) {
|
|
27
|
-
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
35
|
+
() => {
|
|
36
|
+
const t = E(this.currentNode);
|
|
37
|
+
t && this.store.setCurrencyLocation(t.priceCurrencyLocation || "0");
|
|
38
|
+
},
|
|
39
|
+
() => {
|
|
40
|
+
this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
|
|
41
|
+
}
|
|
42
|
+
);
|
|
31
43
|
}
|
|
32
44
|
_onCurrencyLocationChange(e) {
|
|
33
|
-
if (console.debug("Currency location changed to: ", e),
|
|
45
|
+
if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), O(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
|
|
34
46
|
return;
|
|
35
47
|
const t = this._getPriceBlocks();
|
|
36
48
|
if (!t || t.length === 0)
|
|
37
49
|
return;
|
|
38
|
-
const r =
|
|
39
|
-
t.forEach((
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
50
|
+
const r = e || "0", { currencySymbol: n } = this.store;
|
|
51
|
+
t.forEach((c) => {
|
|
52
|
+
const s = this._getParagraph(c);
|
|
53
|
+
if (!s)
|
|
42
54
|
return;
|
|
43
|
-
const
|
|
44
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
45
|
-
`Updated currency location to ${
|
|
55
|
+
const C = s.getInnerHTML() || "", l = s.getInnerText() || "", u = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, u), g = this._detectSymbolInText(l) || u, _ = this._buildPriceContent(d, g, r), L = C.replace(l, _);
|
|
56
|
+
this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(L).apply(new N(
|
|
57
|
+
`Updated currency location to ${r === "1" ? "after" : "before"}`
|
|
46
58
|
));
|
|
47
59
|
});
|
|
48
60
|
}
|
|
@@ -60,13 +72,13 @@ class $ extends L {
|
|
|
60
72
|
const r = e || "";
|
|
61
73
|
let n = r;
|
|
62
74
|
if (t) {
|
|
63
|
-
const
|
|
64
|
-
n = r.replace(
|
|
75
|
+
const c = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
|
|
76
|
+
n = r.replace(c, "").trim();
|
|
65
77
|
} else {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const s =
|
|
69
|
-
n = r.replace(
|
|
78
|
+
const c = r.match(/([^0-9.,\s]+)/);
|
|
79
|
+
if (c && c[1]) {
|
|
80
|
+
const s = c[1].trim(), C = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
81
|
+
n = r.replace(C, "").trim();
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
return n;
|
|
@@ -83,15 +95,15 @@ class $ extends L {
|
|
|
83
95
|
${this._GuTwoColumns([
|
|
84
96
|
this._GuLabel({ text: "Currency Location" }),
|
|
85
97
|
this._GuSelect({
|
|
86
|
-
name:
|
|
98
|
+
name: a.CURRENCY_LOCATION,
|
|
87
99
|
placeholder: "",
|
|
88
|
-
options:
|
|
100
|
+
options: m
|
|
89
101
|
})
|
|
90
102
|
])}
|
|
91
103
|
`;
|
|
92
104
|
}
|
|
93
105
|
}
|
|
94
106
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
b as CONTROL_BLOCK_ID,
|
|
108
|
+
B as PriceCurrencyLocationControl
|
|
97
109
|
};
|