@useinsider/guido 3.2.0-beta.22a0c4c → 3.2.0-beta.294ea63
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/composables/useActionsApi.js +4 -4
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useSave.js +1 -1
- package/dist/composables/useStripo.js +44 -42
- package/dist/config/compiler/recommendationCompilerRules.js +72 -67
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +30 -33
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +18 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +1 -3
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +57 -27
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +17 -18
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +25 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +20 -3
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +0 -99
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +0 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +0 -29
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { getItemsBlockConfig as I, setItemsBlockConfig as
|
|
6
|
-
const
|
|
1
|
+
import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as A } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as R } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const u = T.PRICE_SINGLE_PRICE, l = {
|
|
7
7
|
SINGLE_PRICE: "singlePrice"
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class k extends A {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return u;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
15
|
-
<div class="container ${
|
|
15
|
+
<div class="container ${T.PRICE_SINGLE_PRICE}">
|
|
16
16
|
${this._getSinglePrice()}
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
21
|
const e = I(this.currentNode);
|
|
22
|
-
this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (
|
|
23
|
-
this._onSinglePriceChange(
|
|
22
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
|
|
23
|
+
this._onSinglePriceChange(i);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
onTemplateNodeUpdated(e) {
|
|
27
27
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const
|
|
29
|
-
this.api.updateValues({ [l.SINGLE_PRICE]: (
|
|
28
|
+
const i = I(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
_onSinglePriceChange(e) {
|
|
33
|
-
if (console.debug("Single price changed to: ", e),
|
|
33
|
+
if (console.debug("Single price changed to: ", e), !this.currentNode)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
36
|
-
r ?
|
|
37
|
-
r ?
|
|
35
|
+
const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
|
|
36
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
|
|
37
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
|
|
38
38
|
] : [
|
|
39
|
-
r ?
|
|
40
|
-
r ?
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}), ((n == null ? void 0 : n.querySelectorAll(
|
|
47
|
-
`[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
|
|
39
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
|
|
40
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
|
|
41
|
+
], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
|
|
42
|
+
N(this.currentNode, this.api, { priceSinglePrice: e }, s);
|
|
43
|
+
const o = this.currentNode.closest(".items-block");
|
|
44
|
+
((o == null ? void 0 : o.querySelectorAll(
|
|
45
|
+
`[esd-extension-block-id="${p.PRICE}"]`
|
|
48
46
|
)) || []).forEach((a) => {
|
|
49
|
-
this._updatePriceBlock(
|
|
50
|
-
}),
|
|
47
|
+
this._updatePriceBlock(s, a, E, g, e);
|
|
48
|
+
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
49
|
+
`[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
|
|
50
|
+
)) || []).forEach((a) => {
|
|
51
|
+
this._updatePriceBlock(s, a, L, C, e);
|
|
52
|
+
}), s.apply(new S(
|
|
51
53
|
`Updated price to ${e ? "single" : "total"} price`
|
|
52
54
|
));
|
|
53
55
|
}
|
|
54
|
-
_updatePriceBlock(e,
|
|
55
|
-
const
|
|
56
|
-
e.modifyHtml(
|
|
57
|
-
e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
|
|
58
|
-
});
|
|
56
|
+
_updatePriceBlock(e, i, c, r, t) {
|
|
57
|
+
const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
|
|
58
|
+
e.modifyHtml(i).setInnerHtml(E);
|
|
59
59
|
}
|
|
60
60
|
_getSinglePrice() {
|
|
61
61
|
return `
|
|
62
62
|
<div class="display-flex align-items-center justify-content-between">
|
|
63
|
-
<${
|
|
64
|
-
${
|
|
63
|
+
<${d.LABEL}
|
|
64
|
+
${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
|
|
65
65
|
>
|
|
66
|
-
</${
|
|
66
|
+
</${d.LABEL}>
|
|
67
67
|
${this._GuToggle(l.SINGLE_PRICE)}
|
|
68
68
|
</div>
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
u as CONTROL_BLOCK_ID,
|
|
74
|
+
k as PriceSinglePriceControl
|
|
75
75
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "../../../../node_modules/lodash-es/flatMap.js";
|
|
2
|
-
import
|
|
3
|
-
const T = '<td align="center" class="ins-product-td items-block items-block-v2">',
|
|
2
|
+
import E from "../../../../node_modules/lodash-es/range.js";
|
|
3
|
+
const T = '<td align="center" class="ins-product-td items-block items-block-v2">', a = { PAIRS_FOR_EXTENSION: {
|
|
4
4
|
imageSrc: {
|
|
5
5
|
CART_ITEMS: {
|
|
6
6
|
ATTR: "ins_apr_img",
|
|
@@ -212,10 +212,10 @@ const T = '<td align="center" class="ins-product-td items-block items-block-v2">
|
|
|
212
212
|
}
|
|
213
213
|
} };
|
|
214
214
|
function m(e, s = 8) {
|
|
215
|
-
return
|
|
215
|
+
return E(1, s + 1).map((i) => `${e}_${i}`);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
const { PAIRS_FOR_EXTENSION: e } =
|
|
217
|
+
function r() {
|
|
218
|
+
const { PAIRS_FOR_EXTENSION: e } = a, s = [];
|
|
219
219
|
return s.push(
|
|
220
220
|
e.imageSrc.CART_ITEMS.ATTR,
|
|
221
221
|
e.imageSrc.BROWSED_ITEMS.ATTR,
|
|
@@ -234,22 +234,34 @@ function t() {
|
|
|
234
234
|
), s.push(
|
|
235
235
|
e.price.CART_ITEMS.PRICE,
|
|
236
236
|
e.price.CART_ITEMS.PRICE_FORMATTED,
|
|
237
|
+
e.price.CART_ITEMS.SINGLE_PRICE,
|
|
238
|
+
e.price.CART_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
237
239
|
e.price.CART_ITEMS.CURRENCY,
|
|
238
240
|
e.price.BROWSED_ITEMS.PRICE,
|
|
239
241
|
e.price.BROWSED_ITEMS.PRICE_FORMATTED,
|
|
242
|
+
e.price.BROWSED_ITEMS.SINGLE_PRICE,
|
|
243
|
+
e.price.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
240
244
|
e.price.BROWSED_ITEMS.CURRENCY,
|
|
241
245
|
e.price.PURCHASED_ITEMS.PRICE,
|
|
242
246
|
e.price.PURCHASED_ITEMS.PRICE_FORMATTED,
|
|
247
|
+
e.price.PURCHASED_ITEMS.SINGLE_PRICE,
|
|
248
|
+
e.price.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
243
249
|
e.price.PURCHASED_ITEMS.CURRENCY
|
|
244
250
|
), s.push(
|
|
245
251
|
e.originalPrice.CART_ITEMS.PRICE,
|
|
246
252
|
e.originalPrice.CART_ITEMS.PRICE_FORMATTED,
|
|
253
|
+
e.originalPrice.CART_ITEMS.SINGLE_PRICE,
|
|
254
|
+
e.originalPrice.CART_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
247
255
|
e.originalPrice.CART_ITEMS.CURRENCY,
|
|
248
256
|
e.originalPrice.BROWSED_ITEMS.PRICE,
|
|
249
257
|
e.originalPrice.BROWSED_ITEMS.PRICE_FORMATTED,
|
|
258
|
+
e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE,
|
|
259
|
+
e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
250
260
|
e.originalPrice.BROWSED_ITEMS.CURRENCY,
|
|
251
261
|
e.originalPrice.PURCHASED_ITEMS.PRICE,
|
|
252
262
|
e.originalPrice.PURCHASED_ITEMS.PRICE_FORMATTED,
|
|
263
|
+
e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE,
|
|
264
|
+
e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
|
|
253
265
|
e.originalPrice.PURCHASED_ITEMS.CURRENCY
|
|
254
266
|
), s.push(
|
|
255
267
|
e.button.CART_ITEMS.HREF,
|
|
@@ -262,11 +274,11 @@ function t() {
|
|
|
262
274
|
), s;
|
|
263
275
|
}
|
|
264
276
|
const o = _(
|
|
265
|
-
|
|
277
|
+
r(),
|
|
266
278
|
(e) => m(e)
|
|
267
279
|
);
|
|
268
280
|
export {
|
|
269
281
|
o as itemsBlockDynamicVariables,
|
|
270
|
-
|
|
282
|
+
a as productPairs,
|
|
271
283
|
T as templateFirstLine
|
|
272
284
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.
|
|
1
|
+
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
|
|
2
2
|
export {
|
|
3
3
|
o as RecommendationControlId
|
|
4
4
|
};
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as
|
|
1
|
+
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
3
3
|
import { RecommendationControlId as e } from "../../constants/controlIds.js";
|
|
4
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
5
|
-
import { CustomAttributeTextTrimControl as I } from "./textTrim.js";
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
|
|
6
5
|
function o(t) {
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
6
|
+
const n = t.closest(I);
|
|
7
|
+
if (!n)
|
|
9
8
|
return [];
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${
|
|
13
|
-
return
|
|
9
|
+
const r = t.asElement().getAttribute(s);
|
|
10
|
+
if (r) {
|
|
11
|
+
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
|
|
12
|
+
return n.querySelectorAll(T);
|
|
14
13
|
}
|
|
15
|
-
return
|
|
14
|
+
return n.querySelectorAll(
|
|
16
15
|
`[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
|
|
17
16
|
);
|
|
18
17
|
}
|
|
19
|
-
const
|
|
18
|
+
const A = class extends a {
|
|
20
19
|
getId() {
|
|
21
20
|
return e.CUSTOM_ATTR_ALIGN;
|
|
22
21
|
}
|
|
@@ -37,7 +36,7 @@ const m = class extends a {
|
|
|
37
36
|
getTargetNodes(t) {
|
|
38
37
|
return o(t);
|
|
39
38
|
}
|
|
40
|
-
},
|
|
39
|
+
}, m = class extends i {
|
|
41
40
|
getId() {
|
|
42
41
|
return e.CUSTOM_ATTR_STYLE;
|
|
43
42
|
}
|
|
@@ -51,31 +50,29 @@ const m = class extends a {
|
|
|
51
50
|
getTargetNodes(t) {
|
|
52
51
|
return o(t);
|
|
53
52
|
}
|
|
54
|
-
}, R = class extends
|
|
53
|
+
}, R = class extends c {
|
|
55
54
|
getId() {
|
|
56
55
|
return e.CUSTOM_ATTR_BACKGROUND;
|
|
57
56
|
}
|
|
58
57
|
getTargetNodes(t) {
|
|
59
58
|
return o(t);
|
|
60
59
|
}
|
|
61
|
-
},
|
|
60
|
+
}, x = class extends d {
|
|
62
61
|
getId() {
|
|
63
62
|
return e.CUSTOM_ATTR_PADDINGS;
|
|
64
63
|
}
|
|
65
64
|
getTargetNodes(t) {
|
|
66
65
|
return o(t);
|
|
67
66
|
}
|
|
68
|
-
},
|
|
69
|
-
align:
|
|
67
|
+
}, k = {
|
|
68
|
+
align: A,
|
|
70
69
|
color: _,
|
|
71
70
|
size: S,
|
|
72
|
-
style:
|
|
71
|
+
style: m,
|
|
73
72
|
fontFamily: O,
|
|
74
73
|
background: R,
|
|
75
|
-
paddings:
|
|
76
|
-
textTrim: I
|
|
74
|
+
paddings: x
|
|
77
75
|
};
|
|
78
76
|
export {
|
|
79
|
-
|
|
80
|
-
I as CustomAttributeTextTrimControl
|
|
77
|
+
k as CustomAttributeControls
|
|
81
78
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (s, i, t) =>
|
|
4
|
-
import { UEAttr as
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var h = (s, i, t) => i in s ? c(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
3
|
+
var a = (s, i, t) => h(s, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as d } from "../../../common-control.js";
|
|
6
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
|
|
@@ -42,7 +42,7 @@ class T extends d {
|
|
|
42
42
|
this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
|
|
43
43
|
}
|
|
44
44
|
onTemplateNodeUpdated(t) {
|
|
45
|
-
super.onTemplateNodeUpdated(t), this.
|
|
45
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
46
46
|
}
|
|
47
47
|
_setFormValues() {
|
|
48
48
|
const t = n.getConfig(this.currentNode);
|
|
@@ -58,7 +58,7 @@ class T extends d {
|
|
|
58
58
|
try {
|
|
59
59
|
this.api.setUIEAttribute(
|
|
60
60
|
e.ALGORITHM,
|
|
61
|
-
|
|
61
|
+
l.SELECTPICKER.items,
|
|
62
62
|
t
|
|
63
63
|
);
|
|
64
64
|
} catch (r) {
|
|
@@ -114,9 +114,7 @@ class H extends g {
|
|
|
114
114
|
var r;
|
|
115
115
|
super.onTemplateNodeUpdated(t);
|
|
116
116
|
const e = this._getRecommendationIdFromNode(t);
|
|
117
|
-
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e),
|
|
118
|
-
this._initializeSubControls();
|
|
119
|
-
}), [
|
|
117
|
+
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
|
|
120
118
|
this.layoutOrientationControl,
|
|
121
119
|
this.productCountControl,
|
|
122
120
|
this.algorithmControl,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { RecommendationBlockId as
|
|
4
|
-
import { RecommendationControlId as
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
6
|
-
|
|
7
|
-
const s = {
|
|
1
|
+
import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as d } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as m } from "../../constants/controlIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as u } from "../../constants/selectors.js";
|
|
6
|
+
const i = {
|
|
8
7
|
TEXT_TRIM_ENABLED: "textTrimEnabled"
|
|
9
|
-
};
|
|
10
|
-
class N extends
|
|
8
|
+
}, o = "text-trim-enabled", c = `.${o}`, T = `.${o} p`, p = `.${o} { max-width: 0; }`, _ = `.${o} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
|
|
9
|
+
class N extends d {
|
|
11
10
|
getId() {
|
|
12
|
-
return
|
|
11
|
+
return m.NAME_TEXT_TRIM;
|
|
13
12
|
}
|
|
14
13
|
getTemplate() {
|
|
15
14
|
return `
|
|
@@ -17,7 +16,7 @@ class N extends u {
|
|
|
17
16
|
<div class="name-text-trim-control-container">
|
|
18
17
|
${this._GuTwoColumns([
|
|
19
18
|
this._GuLabel({ text: this.api.translate("Trim Long Text") }),
|
|
20
|
-
this._GuToggle(
|
|
19
|
+
this._GuToggle(i.TEXT_TRIM_ENABLED)
|
|
21
20
|
])}
|
|
22
21
|
</div>
|
|
23
22
|
`;
|
|
@@ -31,45 +30,76 @@ class N extends u {
|
|
|
31
30
|
_setFormValues() {
|
|
32
31
|
const e = this._getCurrentTrimState();
|
|
33
32
|
this.api.updateValues({
|
|
34
|
-
[
|
|
33
|
+
[i.TEXT_TRIM_ENABLED]: e
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
_getCurrentTrimState() {
|
|
38
37
|
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
39
38
|
return !1;
|
|
40
|
-
if (this.currentNode.hasClass(
|
|
39
|
+
if (this.currentNode.hasClass(o))
|
|
41
40
|
return !0;
|
|
42
|
-
const e = this.currentNode.closest(
|
|
41
|
+
const e = this.currentNode.closest(u);
|
|
43
42
|
if (!e)
|
|
44
43
|
return !1;
|
|
45
44
|
const t = e.querySelector(
|
|
46
|
-
`[esd-extension-block-id="${
|
|
45
|
+
`[esd-extension-block-id="${l.NAME}"]`
|
|
47
46
|
);
|
|
48
|
-
return t && "hasClass" in t ? t.hasClass(
|
|
47
|
+
return t && "hasClass" in t ? t.hasClass(o) : !1;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Finds an existing CSS rule in the document stylesheet by exact query
|
|
51
|
+
* @param query - The CSS query to search for (uses Stripo's CSS query syntax)
|
|
52
|
+
* @returns The CSS rule node if found, undefined otherwise
|
|
53
|
+
*/
|
|
54
|
+
_findCssRule(e) {
|
|
55
|
+
const t = this.api.getDocumentRootCssNode();
|
|
56
|
+
if (t)
|
|
57
|
+
return t.querySelector(e);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
|
|
61
|
+
* This is needed because Stripo's CSS query syntax interprets spaces as path separators
|
|
62
|
+
* @returns true if the rule exists
|
|
63
|
+
*/
|
|
64
|
+
_hasParagraphRule() {
|
|
65
|
+
const e = this.api.getDocumentRootCssNode();
|
|
66
|
+
return e ? e.querySelectorAll(`*${o}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" ? s.getSelector() === T : !1) : !1;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ensures the text-trim CSS rules exist in the document stylesheet
|
|
70
|
+
* Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
|
|
71
|
+
*/
|
|
72
|
+
_ensureCssRulesExist() {
|
|
73
|
+
const e = this.api.getDocumentRootCssNode();
|
|
74
|
+
if (!e)
|
|
75
|
+
return;
|
|
76
|
+
const t = this.api.getDocumentModifier();
|
|
77
|
+
let s = !1;
|
|
78
|
+
this._findCssRule(c) || (t.modifyCss(e).appendRule(p), s = !0), this._hasParagraphRule() || (t.modifyCss(e).appendRule(_), s = !0), s && t.apply(new a("Add text trim CSS rules"));
|
|
49
79
|
}
|
|
50
80
|
_onTextTrimChange(e) {
|
|
51
81
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
52
82
|
return;
|
|
53
|
-
const t = this.currentNode.closest(
|
|
83
|
+
const t = this.currentNode.closest(u);
|
|
54
84
|
if (!t || !("querySelectorAll" in t))
|
|
55
85
|
return;
|
|
56
|
-
const
|
|
57
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
86
|
+
const s = Array.from(
|
|
87
|
+
t.querySelectorAll(`[esd-extension-block-id="${l.NAME}"]`)
|
|
58
88
|
);
|
|
59
|
-
if (!
|
|
89
|
+
if (!s.length)
|
|
60
90
|
return;
|
|
61
|
-
e &&
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
e ?
|
|
65
|
-
}),
|
|
66
|
-
new
|
|
91
|
+
e && this._ensureCssRulesExist();
|
|
92
|
+
const r = this.api.getDocumentModifier();
|
|
93
|
+
s.forEach((n) => {
|
|
94
|
+
e ? r.modifyHtml(n).setClass(o) : r.modifyHtml(n).removeClass(o);
|
|
95
|
+
}), r.apply(
|
|
96
|
+
new a(
|
|
67
97
|
e ? "Enable product name text trimming" : "Disable product name text trimming"
|
|
68
98
|
)
|
|
69
99
|
);
|
|
70
100
|
}
|
|
71
101
|
_listenToFormUpdates() {
|
|
72
|
-
this.api.onValueChanged(
|
|
102
|
+
this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (e) => {
|
|
73
103
|
this._onTextTrimChange(e);
|
|
74
104
|
});
|
|
75
105
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, ContainerControls as C, TextControls as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { BLOCK_ID as U } from "./block.js";
|
|
3
|
-
import { RecommendationBlockId as
|
|
3
|
+
import { RecommendationBlockId as N } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
@@ -14,7 +14,7 @@ import "./controls/image/index.js";
|
|
|
14
14
|
import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
15
15
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
16
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
|
-
import { SYNC_INFO_MESSAGE_CONTROL_ID as
|
|
17
|
+
import { SYNC_INFO_MESSAGE_CONTROL_ID as S } from "./controls/syncInfoMessage.js";
|
|
18
18
|
class Z extends E {
|
|
19
19
|
registerBlockControls(I) {
|
|
20
20
|
I[U] = [
|
|
@@ -39,11 +39,11 @@ class Z extends E {
|
|
|
39
39
|
B
|
|
40
40
|
]
|
|
41
41
|
).withLabel(this.api.translate("Card Composition"))
|
|
42
|
-
], I[
|
|
42
|
+
], I[N.NAME] = [
|
|
43
43
|
new _(
|
|
44
44
|
O.SETTINGS,
|
|
45
45
|
[
|
|
46
|
-
|
|
46
|
+
S,
|
|
47
47
|
T.NAME_STYLE,
|
|
48
48
|
T.NAME_ALIGN,
|
|
49
49
|
T.NAME_TEXT_TRIM,
|
|
@@ -59,11 +59,11 @@ class Z extends E {
|
|
|
59
59
|
T.NAME_COLOR
|
|
60
60
|
]
|
|
61
61
|
)
|
|
62
|
-
], I[
|
|
62
|
+
], I[N.PRICE] = [
|
|
63
63
|
new _(
|
|
64
64
|
O.SETTINGS,
|
|
65
65
|
[
|
|
66
|
-
|
|
66
|
+
S,
|
|
67
67
|
T.PRICE_STYLE,
|
|
68
68
|
T.PRICE_ALIGN,
|
|
69
69
|
T.PRICE_PADDINGS
|
|
@@ -78,11 +78,11 @@ class Z extends E {
|
|
|
78
78
|
T.PRICE_COLOR
|
|
79
79
|
]
|
|
80
80
|
)
|
|
81
|
-
], I[
|
|
81
|
+
], I[N.OLD_PRICE] = [
|
|
82
82
|
new _(
|
|
83
83
|
O.SETTINGS,
|
|
84
84
|
[
|
|
85
|
-
|
|
85
|
+
S,
|
|
86
86
|
T.OLD_PRICE_STYLE,
|
|
87
87
|
T.OLD_PRICE_ALIGN,
|
|
88
88
|
T.OLD_PRICE_PADDINGS
|
|
@@ -97,11 +97,11 @@ class Z extends E {
|
|
|
97
97
|
T.OLD_PRICE_COLOR
|
|
98
98
|
]
|
|
99
99
|
)
|
|
100
|
-
], I[
|
|
100
|
+
], I[N.OMNIBUS_PRICE] = [
|
|
101
101
|
new _(
|
|
102
102
|
O.SETTINGS,
|
|
103
103
|
[
|
|
104
|
-
|
|
104
|
+
S,
|
|
105
105
|
T.OMNIBUS_PRICE_TEXT_BEFORE,
|
|
106
106
|
T.OMNIBUS_PRICE_TEXT_AFTER,
|
|
107
107
|
T.OMNIBUS_PRICE_STYLE,
|
|
@@ -118,11 +118,11 @@ class Z extends E {
|
|
|
118
118
|
T.OMNIBUS_PRICE_COLOR
|
|
119
119
|
]
|
|
120
120
|
)
|
|
121
|
-
], I[
|
|
121
|
+
], I[N.OMNIBUS_DISCOUNT] = [
|
|
122
122
|
new _(
|
|
123
123
|
O.SETTINGS,
|
|
124
124
|
[
|
|
125
|
-
|
|
125
|
+
S,
|
|
126
126
|
T.OMNIBUS_DISCOUNT_TEXT_BEFORE,
|
|
127
127
|
T.OMNIBUS_DISCOUNT_TEXT_AFTER,
|
|
128
128
|
T.OMNIBUS_DISCOUNT_STYLE,
|
|
@@ -139,11 +139,11 @@ class Z extends E {
|
|
|
139
139
|
T.OMNIBUS_DISCOUNT_COLOR
|
|
140
140
|
]
|
|
141
141
|
)
|
|
142
|
-
], I[
|
|
142
|
+
], I[N.BUTTON] = [
|
|
143
143
|
new _(
|
|
144
144
|
O.SETTINGS,
|
|
145
145
|
[
|
|
146
|
-
|
|
146
|
+
S,
|
|
147
147
|
T.BUTTON_TEXT,
|
|
148
148
|
T.BUTTON_ALIGN,
|
|
149
149
|
T.BUTTON_PADDINGS,
|
|
@@ -162,13 +162,12 @@ class Z extends E {
|
|
|
162
162
|
T.BUTTON_BORDER
|
|
163
163
|
]
|
|
164
164
|
)
|
|
165
|
-
], I[
|
|
165
|
+
], I[N.CUSTOM_ATTRIBUTE] = [
|
|
166
166
|
new _(
|
|
167
167
|
O.SETTINGS,
|
|
168
168
|
[
|
|
169
169
|
T.CUSTOM_ATTR_STYLE,
|
|
170
170
|
T.CUSTOM_ATTR_ALIGN,
|
|
171
|
-
T.CUSTOM_ATTR_TEXT_TRIM,
|
|
172
171
|
T.CUSTOM_ATTR_PADDINGS
|
|
173
172
|
]
|
|
174
173
|
),
|
|
@@ -181,11 +180,11 @@ class Z extends E {
|
|
|
181
180
|
T.CUSTOM_ATTR_COLOR
|
|
182
181
|
]
|
|
183
182
|
)
|
|
184
|
-
], I[
|
|
183
|
+
], I[N.IMAGE] = [
|
|
185
184
|
new _(
|
|
186
185
|
O.SETTINGS,
|
|
187
186
|
[
|
|
188
|
-
|
|
187
|
+
S,
|
|
189
188
|
T.IMAGE_SIZE,
|
|
190
189
|
T.IMAGE_MARGINS
|
|
191
190
|
]
|