@useinsider/guido 2.1.0-beta.a720424 → 2.1.0-beta.e13d291
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/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +40 -6
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +64 -0
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +20 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +96 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +110 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +204 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +205 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +118 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +71 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
- package/dist/extensions/Blocks/Recommendation/services/configService.js +239 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +41 -36
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +233 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +69 -0
- package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +174 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +121 -0
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +27 -16
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/controlFactories.js +125 -93
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +223 -169
- package/dist/services/recommendationApi.js +10 -9
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +45 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +57 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +42 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +214 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +17 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +54 -0
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +154 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/dist/static/styles/customEditorStyle.css.js +25 -2
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
- package/dist/extensions/Blocks/Recommendation/control.js +0 -336
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createPaddingsControl as r, createTextBackgroundColorControl as C, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as c, createTextColorControl as _, createTextAlignControl as I } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const O = I(
|
|
6
|
+
t.OLD_PRICE_ALIGN,
|
|
7
|
+
o.OLD_PRICE,
|
|
8
|
+
n
|
|
9
|
+
), R = _(
|
|
10
|
+
t.OLD_PRICE_COLOR,
|
|
11
|
+
o.OLD_PRICE,
|
|
12
|
+
n
|
|
13
|
+
), a = c(
|
|
14
|
+
t.OLD_PRICE_SIZE,
|
|
15
|
+
o.OLD_PRICE,
|
|
16
|
+
n
|
|
17
|
+
), i = l(
|
|
18
|
+
t.OLD_PRICE_STYLE,
|
|
19
|
+
o.OLD_PRICE,
|
|
20
|
+
n
|
|
21
|
+
), E = e(
|
|
22
|
+
t.OLD_PRICE_FONT_FAMILY,
|
|
23
|
+
o.OLD_PRICE,
|
|
24
|
+
n
|
|
25
|
+
), L = C(
|
|
26
|
+
t.OLD_PRICE_BACKGROUND,
|
|
27
|
+
o.OLD_PRICE,
|
|
28
|
+
n
|
|
29
|
+
), P = r(
|
|
30
|
+
t.OLD_PRICE_PADDINGS,
|
|
31
|
+
o.OLD_PRICE,
|
|
32
|
+
n
|
|
33
|
+
), T = {
|
|
34
|
+
align: O,
|
|
35
|
+
color: R,
|
|
36
|
+
size: a,
|
|
37
|
+
style: i,
|
|
38
|
+
fontFamily: E,
|
|
39
|
+
background: L,
|
|
40
|
+
paddings: P
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
T as OldPriceControls
|
|
44
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as C, createTextStyleControl as O, createTextSizeControl as S, createTextColorControl as I, createTextAlignControl as N } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { OmnibusDiscountTextAfterControl as l } from "./textAfter.js";
|
|
6
|
+
import { OmnibusDiscountTextBeforeControl as U } from "./textBefore.js";
|
|
7
|
+
const i = N(
|
|
8
|
+
t.OMNIBUS_DISCOUNT_ALIGN,
|
|
9
|
+
o.OMNIBUS_DISCOUNT,
|
|
10
|
+
r
|
|
11
|
+
), T = I(
|
|
12
|
+
t.OMNIBUS_DISCOUNT_COLOR,
|
|
13
|
+
o.OMNIBUS_DISCOUNT,
|
|
14
|
+
r
|
|
15
|
+
), c = S(
|
|
16
|
+
t.OMNIBUS_DISCOUNT_SIZE,
|
|
17
|
+
o.OMNIBUS_DISCOUNT,
|
|
18
|
+
r
|
|
19
|
+
), _ = O(
|
|
20
|
+
t.OMNIBUS_DISCOUNT_STYLE,
|
|
21
|
+
o.OMNIBUS_DISCOUNT,
|
|
22
|
+
r
|
|
23
|
+
), m = C(
|
|
24
|
+
t.OMNIBUS_DISCOUNT_FONT_FAMILY,
|
|
25
|
+
o.OMNIBUS_DISCOUNT,
|
|
26
|
+
r
|
|
27
|
+
), s = e(
|
|
28
|
+
t.OMNIBUS_DISCOUNT_BACKGROUND,
|
|
29
|
+
o.OMNIBUS_DISCOUNT,
|
|
30
|
+
r
|
|
31
|
+
), B = n(
|
|
32
|
+
t.OMNIBUS_DISCOUNT_PADDINGS,
|
|
33
|
+
o.OMNIBUS_DISCOUNT,
|
|
34
|
+
r
|
|
35
|
+
), g = {
|
|
36
|
+
align: i,
|
|
37
|
+
color: T,
|
|
38
|
+
size: c,
|
|
39
|
+
style: _,
|
|
40
|
+
fontFamily: m,
|
|
41
|
+
background: s,
|
|
42
|
+
paddings: B,
|
|
43
|
+
textBefore: U,
|
|
44
|
+
textAfter: l
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
g as OmnibusDiscountControls
|
|
48
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as a } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const i = "data-text-after", u = "", p = ".omnibus-text-after";
|
|
8
|
+
class b extends a {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_AFTER;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -42,11 +44,11 @@ class E extends m {
|
|
|
42
44
|
_onTextChange(t) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const e = this.currentNode.closest(
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
46
48
|
if (!e || !("querySelectorAll" in e))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
e.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_DISCOUNT}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,17 +57,17 @@ class E extends m {
|
|
|
55
57
|
o.modifyHtml(s).setAttribute(i, t);
|
|
56
58
|
const r = s.querySelector(p);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = f(r, t);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text after"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
|
|
65
|
-
this._onTextChange(t);
|
|
67
|
+
typeof t == "string" && this._onTextChange(t);
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
b as OmnibusDiscountTextAfterControl
|
|
71
73
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const i = "data-text-before", u = "", p = ".omnibus-text-before";
|
|
8
|
+
class g extends l {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -42,11 +44,11 @@ class C extends a {
|
|
|
42
44
|
_onTextChange(e) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const t = this.currentNode.closest(
|
|
47
|
+
const t = this.currentNode.closest(T);
|
|
46
48
|
if (!t || !("querySelectorAll" in t))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_DISCOUNT}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,17 +57,17 @@ class C extends a {
|
|
|
55
57
|
o.modifyHtml(s).setAttribute(i, e);
|
|
56
58
|
const r = s.querySelector(p);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = f(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text before"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
|
|
65
|
-
this._onTextChange(e);
|
|
67
|
+
typeof e == "string" && this._onTextChange(e);
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
g as OmnibusDiscountTextBeforeControl
|
|
71
73
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as C, createTextStyleControl as I, createTextSizeControl as l, createTextColorControl as i, createTextAlignControl as c } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { OmnibusPriceTextAfterControl as O } from "./textAfter.js";
|
|
6
|
+
import { OmnibusPriceTextBeforeControl as _ } from "./textBefore.js";
|
|
7
|
+
const m = c(
|
|
8
|
+
t.OMNIBUS_PRICE_ALIGN,
|
|
9
|
+
o.OMNIBUS_PRICE,
|
|
10
|
+
r
|
|
11
|
+
), S = i(
|
|
12
|
+
t.OMNIBUS_PRICE_COLOR,
|
|
13
|
+
o.OMNIBUS_PRICE,
|
|
14
|
+
r
|
|
15
|
+
), B = l(
|
|
16
|
+
t.OMNIBUS_PRICE_SIZE,
|
|
17
|
+
o.OMNIBUS_PRICE,
|
|
18
|
+
r
|
|
19
|
+
), N = I(
|
|
20
|
+
t.OMNIBUS_PRICE_STYLE,
|
|
21
|
+
o.OMNIBUS_PRICE,
|
|
22
|
+
r
|
|
23
|
+
), P = C(
|
|
24
|
+
t.OMNIBUS_PRICE_FONT_FAMILY,
|
|
25
|
+
o.OMNIBUS_PRICE,
|
|
26
|
+
r
|
|
27
|
+
), R = e(
|
|
28
|
+
t.OMNIBUS_PRICE_BACKGROUND,
|
|
29
|
+
o.OMNIBUS_PRICE,
|
|
30
|
+
r
|
|
31
|
+
), a = n(
|
|
32
|
+
t.OMNIBUS_PRICE_PADDINGS,
|
|
33
|
+
o.OMNIBUS_PRICE,
|
|
34
|
+
r
|
|
35
|
+
), f = {
|
|
36
|
+
align: m,
|
|
37
|
+
color: S,
|
|
38
|
+
size: B,
|
|
39
|
+
style: N,
|
|
40
|
+
fontFamily: P,
|
|
41
|
+
background: R,
|
|
42
|
+
paddings: a,
|
|
43
|
+
textBefore: _,
|
|
44
|
+
textAfter: O
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
f as OmnibusPriceControls
|
|
48
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as a } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const s = "data-text-after", m = "", p = ".omnibus-text-after";
|
|
8
|
+
class N extends a {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_AFTER;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -35,18 +37,18 @@ class C extends m {
|
|
|
35
37
|
}
|
|
36
38
|
_getCurrentText() {
|
|
37
39
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
38
|
-
return
|
|
40
|
+
return m;
|
|
39
41
|
const t = this.currentNode.getAttribute(s);
|
|
40
|
-
return t === null ?
|
|
42
|
+
return t === null ? m : t;
|
|
41
43
|
}
|
|
42
44
|
_onTextChange(t) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const e = this.currentNode.closest(
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
46
48
|
if (!e || !("querySelectorAll" in e))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
e.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_PRICE}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class C extends m {
|
|
|
55
57
|
r.modifyHtml(i).setAttribute(s, t);
|
|
56
58
|
const o = i.querySelector(p);
|
|
57
59
|
if (o) {
|
|
58
|
-
const u =
|
|
60
|
+
const u = f(o, t);
|
|
59
61
|
r.modifyHtml(o).setInnerHtml(u);
|
|
60
62
|
}
|
|
61
|
-
}), r.apply(new
|
|
63
|
+
}), r.apply(new c("Update omnibus price text after"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusPriceTextAfter", (t) => {
|
|
@@ -67,5 +69,5 @@ class C extends m {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
N as OmnibusPriceTextAfterControl
|
|
71
73
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as p } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as T } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const s = "data-text-before", c = "Lowest 30-day price: ", f = ".omnibus-text-before";
|
|
8
|
+
class N extends l {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_BEFORE;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -46,7 +48,7 @@ class C extends a {
|
|
|
46
48
|
if (!t || !("querySelectorAll" in t))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_PRICE}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class C extends a {
|
|
|
55
57
|
o.modifyHtml(i).setAttribute(s, e);
|
|
56
58
|
const r = i.querySelector(f);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = T(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new u("Update omnibus price text before"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusPriceTextBefore", (e) => {
|
|
@@ -67,5 +69,5 @@ class C extends a {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
N as OmnibusPriceTextBeforeControl
|
|
71
73
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createPaddingsControl as r, createTextBackgroundColorControl as C, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as c, createTextColorControl as I, createTextAlignControl as R } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const a = R(
|
|
6
|
+
t.PRICE_ALIGN,
|
|
7
|
+
o.PRICE,
|
|
8
|
+
n
|
|
9
|
+
), i = I(
|
|
10
|
+
t.PRICE_COLOR,
|
|
11
|
+
o.PRICE,
|
|
12
|
+
n
|
|
13
|
+
), E = c(
|
|
14
|
+
t.PRICE_SIZE,
|
|
15
|
+
o.PRICE,
|
|
16
|
+
n
|
|
17
|
+
), P = l(
|
|
18
|
+
t.PRICE_STYLE,
|
|
19
|
+
o.PRICE,
|
|
20
|
+
n
|
|
21
|
+
), m = e(
|
|
22
|
+
t.PRICE_FONT_FAMILY,
|
|
23
|
+
o.PRICE,
|
|
24
|
+
n
|
|
25
|
+
), s = C(
|
|
26
|
+
t.PRICE_BACKGROUND,
|
|
27
|
+
o.PRICE,
|
|
28
|
+
n
|
|
29
|
+
), d = r(
|
|
30
|
+
t.PRICE_PADDINGS,
|
|
31
|
+
o.PRICE,
|
|
32
|
+
n
|
|
33
|
+
), x = {
|
|
34
|
+
align: a,
|
|
35
|
+
color: i,
|
|
36
|
+
size: E,
|
|
37
|
+
style: P,
|
|
38
|
+
fontFamily: m,
|
|
39
|
+
background: s,
|
|
40
|
+
paddings: d
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
x as PriceControls
|
|
44
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var I = (o, n, t) => n in o ? G(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
|
|
3
|
+
var l = (o, n, t) => I(o, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as L } from "../../../common-control.js";
|
|
6
|
+
import { SPACING_STEP as b, MAX_SPACING as y, MIN_SPACING as A, DEFAULT_COLUMN_SPACING as a, DEFAULT_ROW_SPACING as m } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as d } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
9
|
+
import { safeGetStyle as S, safeGetParent as V } from "../../utils/tagName.js";
|
|
10
|
+
import { getCurrentLayout as C } from "../main/utils.js";
|
|
11
|
+
import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const R = "recommendation-spacing-control", s = {
|
|
13
|
+
COLUMN_SPACING: "columnSpacing",
|
|
14
|
+
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
15
|
+
ROW_SPACING: "rowSpacing"
|
|
16
|
+
}, P = {
|
|
17
|
+
COLUMN_SPACING: "data-column-spacing",
|
|
18
|
+
ROW_SPACING: "data-row-spacing"
|
|
19
|
+
};
|
|
20
|
+
function N(o, n) {
|
|
21
|
+
if (!o)
|
|
22
|
+
return n;
|
|
23
|
+
const t = parseFloat(o);
|
|
24
|
+
return Number.isNaN(t) ? n : t;
|
|
25
|
+
}
|
|
26
|
+
class $ extends L {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
l(this, "store", w());
|
|
30
|
+
l(this, "unsubscribeOrientation", null);
|
|
31
|
+
/**
|
|
32
|
+
* Debounced version of _onColumnSpacingChange
|
|
33
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
34
|
+
*/
|
|
35
|
+
l(this, "_debouncedOnColumnSpacingChange", O((t) => {
|
|
36
|
+
this._onColumnSpacingChange(t);
|
|
37
|
+
}, 300));
|
|
38
|
+
/**
|
|
39
|
+
* Debounced version of _onRowSpacingChange
|
|
40
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
41
|
+
*/
|
|
42
|
+
l(this, "_debouncedOnRowSpacingChange", O((t) => {
|
|
43
|
+
this._onRowSpacingChange(t);
|
|
44
|
+
}, 300));
|
|
45
|
+
}
|
|
46
|
+
getId() {
|
|
47
|
+
return R;
|
|
48
|
+
}
|
|
49
|
+
getTemplate() {
|
|
50
|
+
return `
|
|
51
|
+
<div class="spacing-control-container">
|
|
52
|
+
${this._GuTwoColumns([
|
|
53
|
+
this._GuLabel({ text: "Column Spacing (px)", name: s.COLUMN_SPACING_LABEL }),
|
|
54
|
+
this._GuCounter({
|
|
55
|
+
name: s.COLUMN_SPACING,
|
|
56
|
+
minValue: A,
|
|
57
|
+
maxValue: y,
|
|
58
|
+
step: b
|
|
59
|
+
}),
|
|
60
|
+
this._GuLabel({ text: "Row Spacing (px)" }),
|
|
61
|
+
this._GuCounter({
|
|
62
|
+
name: s.ROW_SPACING,
|
|
63
|
+
minValue: A,
|
|
64
|
+
maxValue: y,
|
|
65
|
+
step: b
|
|
66
|
+
})
|
|
67
|
+
])}
|
|
68
|
+
</div>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
onRender() {
|
|
72
|
+
this._setFormValues(), this._updateColumnSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges();
|
|
73
|
+
}
|
|
74
|
+
onTemplateNodeUpdated(t) {
|
|
75
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateColumnSpacingVisibility();
|
|
76
|
+
}
|
|
77
|
+
onDestroy() {
|
|
78
|
+
this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Updates column spacing visibility based on layout orientation
|
|
82
|
+
* Column spacing is hidden for list layout (products are stacked vertically)
|
|
83
|
+
* Reads from node config first, falls back to store then DOM
|
|
84
|
+
*/
|
|
85
|
+
_updateColumnSpacingVisibility() {
|
|
86
|
+
if (!this.api)
|
|
87
|
+
return;
|
|
88
|
+
const t = d.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || C(this.currentNode)) === "grid";
|
|
89
|
+
this.api.setVisibility(s.COLUMN_SPACING, i), this.api.setVisibility(s.COLUMN_SPACING_LABEL, i);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Reads spacing values from node config first, falls back to DOM styles
|
|
93
|
+
*/
|
|
94
|
+
_setFormValues() {
|
|
95
|
+
if (!this.api)
|
|
96
|
+
return;
|
|
97
|
+
const t = d.getConfig(this.currentNode), e = t.columnSpacing !== a ? t.columnSpacing : this._getStoredColumnSpacing(), r = t.rowSpacing !== m ? t.rowSpacing : this._getStoredRowSpacing();
|
|
98
|
+
this.api.updateValues({
|
|
99
|
+
[s.COLUMN_SPACING]: e,
|
|
100
|
+
[s.ROW_SPACING]: r
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Gets stored column spacing from the first attribute row cell's padding.
|
|
105
|
+
* For grid layout: cells inside .recommendation-attribute-row have padding applied.
|
|
106
|
+
* For list layout: the parent of .product-card-wrapper has the padding.
|
|
107
|
+
* The padding is applied as "0 {halfSpacing}px", so we extract and multiply by 2.
|
|
108
|
+
*/
|
|
109
|
+
_getStoredColumnSpacing() {
|
|
110
|
+
if (!this.currentNode)
|
|
111
|
+
return a;
|
|
112
|
+
if (C(this.currentNode) === "grid") {
|
|
113
|
+
const p = this.currentNode.querySelector(".recommendation-attribute-row"), c = p == null ? void 0 : p.querySelector("td"), f = S(c, "padding");
|
|
114
|
+
if (!f)
|
|
115
|
+
return a;
|
|
116
|
+
const _ = f.trim().split(/\s+/);
|
|
117
|
+
return _.length < 2 ? a : N(_[1], a / 2) * 2;
|
|
118
|
+
}
|
|
119
|
+
const e = this.currentNode.querySelector(".product-card-wrapper"), r = V(e), i = S(r, "padding");
|
|
120
|
+
if (!i)
|
|
121
|
+
return a;
|
|
122
|
+
const u = i.trim().split(/\s+/);
|
|
123
|
+
return u.length < 2 ? a : N(u[1], a / 2) * 2;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets stored row spacing from the first spacer element's height style
|
|
127
|
+
*/
|
|
128
|
+
_getStoredRowSpacing() {
|
|
129
|
+
if (!this.currentNode)
|
|
130
|
+
return m;
|
|
131
|
+
const t = this.currentNode.querySelector(".spacer"), e = S(t, "height");
|
|
132
|
+
return N(e, m);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Handles column spacing changes.
|
|
136
|
+
* For vertical layout: applies horizontal padding to all cells inside attribute rows.
|
|
137
|
+
* For horizontal layout: applies padding to parent of product card wrappers.
|
|
138
|
+
*/
|
|
139
|
+
_onColumnSpacingChange(t) {
|
|
140
|
+
if (!this.currentNode)
|
|
141
|
+
return;
|
|
142
|
+
d.updateConfig(
|
|
143
|
+
this.api,
|
|
144
|
+
this.currentNode,
|
|
145
|
+
{ columnSpacing: t },
|
|
146
|
+
`Changed column spacing to ${t}px`
|
|
147
|
+
), this._storeColumnSpacing(t);
|
|
148
|
+
const r = d.getConfig(this.currentNode).layout || C(this.currentNode), i = this.api.getDocumentModifier(), h = `0 ${t / 2}px`;
|
|
149
|
+
r === "grid" ? Array.from(
|
|
150
|
+
this.currentNode.querySelectorAll(".attribute-cell")
|
|
151
|
+
).forEach((c) => {
|
|
152
|
+
i.modifyHtml(c).setStyle("padding", h);
|
|
153
|
+
}) : Array.from(
|
|
154
|
+
this.currentNode.querySelectorAll(".product-card-wrapper")
|
|
155
|
+
).forEach((c) => {
|
|
156
|
+
"parent" in c && c.parent() && i.modifyHtml(c.parent()).setStyle("padding", h);
|
|
157
|
+
}), i.apply(new g(`Update column spacing to ${t}px`));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Handles row spacing changes
|
|
161
|
+
* Applies height to all spacer elements between product rows
|
|
162
|
+
*/
|
|
163
|
+
_onRowSpacingChange(t) {
|
|
164
|
+
if (!this.currentNode)
|
|
165
|
+
return;
|
|
166
|
+
d.updateConfig(
|
|
167
|
+
this.api,
|
|
168
|
+
this.currentNode,
|
|
169
|
+
{ rowSpacing: t },
|
|
170
|
+
`Changed row spacing to ${t}px`
|
|
171
|
+
), this._storeRowSpacing(t);
|
|
172
|
+
const e = Array.from(
|
|
173
|
+
this.currentNode.querySelectorAll(".spacer")
|
|
174
|
+
);
|
|
175
|
+
if (!e.length)
|
|
176
|
+
return;
|
|
177
|
+
const r = this.api.getDocumentModifier(), i = `${t}px`;
|
|
178
|
+
e.forEach((u) => {
|
|
179
|
+
r.modifyHtml(u).setStyle("height", i);
|
|
180
|
+
}), r.apply(new g(`Update row spacing to ${t}px`));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Stores column spacing value in block data attribute
|
|
184
|
+
*/
|
|
185
|
+
_storeColumnSpacing(t) {
|
|
186
|
+
if (!this.currentNode)
|
|
187
|
+
return;
|
|
188
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
189
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(P.COLUMN_SPACING, t.toString()).apply(new g("Store column spacing"));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Stores row spacing value in block data attribute
|
|
193
|
+
*/
|
|
194
|
+
_storeRowSpacing(t) {
|
|
195
|
+
if (!this.currentNode)
|
|
196
|
+
return;
|
|
197
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
198
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(P.ROW_SPACING, t.toString()).apply(new g("Store row spacing"));
|
|
199
|
+
}
|
|
200
|
+
_listenToFormUpdates() {
|
|
201
|
+
this.api.onValueChanged(s.COLUMN_SPACING, (t) => {
|
|
202
|
+
const e = parseInt(t);
|
|
203
|
+
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
204
|
+
}), this.api.onValueChanged(s.ROW_SPACING, (t) => {
|
|
205
|
+
const e = parseInt(t);
|
|
206
|
+
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Subscribe to store orientation changes
|
|
211
|
+
* Updates column spacing visibility when layout changes via the layout control
|
|
212
|
+
*/
|
|
213
|
+
_subscribeToOrientationChanges() {
|
|
214
|
+
this.unsubscribeOrientation && this.unsubscribeOrientation(), this.unsubscribeOrientation = this.store.$subscribe((t) => {
|
|
215
|
+
t.type === "patch object" && this._updateColumnSpacingVisibility();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
R as SPACING_CONTROL_ID,
|
|
221
|
+
$ as SpacingControl
|
|
222
|
+
};
|