@useinsider/guido 2.0.0-beta.dbde199 → 2.0.0-beta.e66a90a
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/@types/config/schemas.js +53 -39
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- 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/selectors.js +11 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +100 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +243 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +104 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +86 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +134 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +106 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +123 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +60 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +112 -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} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
- 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 +224 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +5 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +46 -43
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.js +157 -0
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/template.js +72 -0
- package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +173 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.js +186 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/template.js +61 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +6 -7
- package/dist/extensions/Blocks/controlFactories.js +156 -122
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +110 -113
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -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} +1 -33
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +19 -3
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -651
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +16 -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 +54 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +40 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +81 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
- 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/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +26 -9
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/migration.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/template.d.ts +18 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +45 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/migration.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/customEditorStyle.css.js +25 -2
- package/dist/stores/config.js +7 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
- 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 -272
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
- package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
- 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/controls/priceHideControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
|
@@ -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,10 +57,10 @@ 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) => {
|
|
@@ -67,5 +69,5 @@ class E extends m {
|
|
|
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 B 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,10 +57,10 @@ 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) => {
|
|
@@ -67,5 +69,5 @@ class C extends a {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
B 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,224 @@
|
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var y = (n, i, t) => i in n ? A(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
|
|
3
|
+
var p = (n, i, t) => y(n, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { ModificationDescription as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as b } from "../../../common-control.js";
|
|
6
|
+
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
7
|
+
import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
8
|
+
const O = "recommendation-spacing-control", a = {
|
|
9
|
+
COLUMN_SPACING: "columnSpacing",
|
|
10
|
+
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
11
|
+
ROW_SPACING: "rowSpacing"
|
|
12
|
+
}, _ = {
|
|
13
|
+
COLUMN_SPACING: "data-column-spacing",
|
|
14
|
+
ROW_SPACING: "data-row-spacing"
|
|
15
|
+
}, s = {
|
|
16
|
+
COLUMN_SPACING: 10,
|
|
17
|
+
// 5px on each side = 10px total
|
|
18
|
+
ROW_SPACING: 20
|
|
19
|
+
}, u = {
|
|
20
|
+
MIN_SPACING: 0,
|
|
21
|
+
MAX_SPACING: 50,
|
|
22
|
+
STEP: 5
|
|
23
|
+
};
|
|
24
|
+
function S(n, i) {
|
|
25
|
+
return !n || !("getStyle" in n) ? null : n.getStyle(i);
|
|
26
|
+
}
|
|
27
|
+
function I(n) {
|
|
28
|
+
return !n || !("parent" in n) || typeof n.parent != "function" ? null : n.parent();
|
|
29
|
+
}
|
|
30
|
+
function C(n, i) {
|
|
31
|
+
if (!n)
|
|
32
|
+
return i;
|
|
33
|
+
const t = parseFloat(n);
|
|
34
|
+
return Number.isNaN(t) ? i : t;
|
|
35
|
+
}
|
|
36
|
+
class w extends b {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
p(this, "store", P());
|
|
40
|
+
p(this, "unsubscribeOrientation", null);
|
|
41
|
+
/**
|
|
42
|
+
* Debounced version of _onColumnSpacingChange
|
|
43
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
44
|
+
*/
|
|
45
|
+
p(this, "_debouncedOnColumnSpacingChange", N((t) => {
|
|
46
|
+
this._onColumnSpacingChange(t);
|
|
47
|
+
}, 300));
|
|
48
|
+
/**
|
|
49
|
+
* Debounced version of _onRowSpacingChange
|
|
50
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
51
|
+
*/
|
|
52
|
+
p(this, "_debouncedOnRowSpacingChange", N((t) => {
|
|
53
|
+
this._onRowSpacingChange(t);
|
|
54
|
+
}, 300));
|
|
55
|
+
}
|
|
56
|
+
getId() {
|
|
57
|
+
return O;
|
|
58
|
+
}
|
|
59
|
+
getTemplate() {
|
|
60
|
+
return `
|
|
61
|
+
<div class="spacing-control-container">
|
|
62
|
+
${this._GuTwoColumns([
|
|
63
|
+
this._GuLabel({ text: "Column Spacing (px)", name: a.COLUMN_SPACING_LABEL }),
|
|
64
|
+
this._GuCounter({
|
|
65
|
+
name: a.COLUMN_SPACING,
|
|
66
|
+
minValue: u.MIN_SPACING,
|
|
67
|
+
maxValue: u.MAX_SPACING,
|
|
68
|
+
step: u.STEP
|
|
69
|
+
}),
|
|
70
|
+
this._GuLabel({ text: "Row Spacing (px)" }),
|
|
71
|
+
this._GuCounter({
|
|
72
|
+
name: a.ROW_SPACING,
|
|
73
|
+
minValue: u.MIN_SPACING,
|
|
74
|
+
maxValue: u.MAX_SPACING,
|
|
75
|
+
step: u.STEP
|
|
76
|
+
})
|
|
77
|
+
])}
|
|
78
|
+
</div>
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
onRender() {
|
|
82
|
+
this._setFormValues(), this._updateColumnSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges();
|
|
83
|
+
}
|
|
84
|
+
onTemplateNodeUpdated(t) {
|
|
85
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateColumnSpacingVisibility();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the current layout orientation from the block's data attribute
|
|
89
|
+
*/
|
|
90
|
+
_getCurrentLayout() {
|
|
91
|
+
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
92
|
+
return "vertical";
|
|
93
|
+
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
94
|
+
return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Updates column spacing visibility based on layout orientation
|
|
98
|
+
* Column spacing is hidden for horizontal layout (products are stacked vertically)
|
|
99
|
+
* Reads from store first for reliability, falls back to DOM
|
|
100
|
+
*/
|
|
101
|
+
_updateColumnSpacingVisibility() {
|
|
102
|
+
const r = (this.store.recommendationConfigs.orientation || this._getCurrentLayout()) === "vertical";
|
|
103
|
+
this.api.setVisibility(a.COLUMN_SPACING, r), this.api.setVisibility(a.COLUMN_SPACING_LABEL, r);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Reads spacing values from data attributes or returns defaults
|
|
107
|
+
*/
|
|
108
|
+
_setFormValues() {
|
|
109
|
+
const t = this._getStoredColumnSpacing(), e = this._getStoredRowSpacing();
|
|
110
|
+
this.api.updateValues({
|
|
111
|
+
[a.COLUMN_SPACING]: t,
|
|
112
|
+
[a.ROW_SPACING]: e
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets stored column spacing from the first attribute row cell's padding.
|
|
117
|
+
* For vertical layout: cells inside .recommendation-attribute-row have padding applied.
|
|
118
|
+
* For horizontal layout: the parent of .product-card-wrapper has the padding.
|
|
119
|
+
* The padding is applied as "0 {halfSpacing}px", so we extract and multiply by 2.
|
|
120
|
+
*/
|
|
121
|
+
_getStoredColumnSpacing() {
|
|
122
|
+
if (!this.currentNode)
|
|
123
|
+
return s.COLUMN_SPACING;
|
|
124
|
+
if (this._getCurrentLayout() === "vertical") {
|
|
125
|
+
const o = this.currentNode.querySelector(".recommendation-attribute-row"), f = o == null ? void 0 : o.querySelector("td"), g = S(f, "padding");
|
|
126
|
+
if (!g)
|
|
127
|
+
return s.COLUMN_SPACING;
|
|
128
|
+
const m = g.trim().split(/\s+/);
|
|
129
|
+
return m.length < 2 ? s.COLUMN_SPACING : C(m[1], s.COLUMN_SPACING / 2) * 2;
|
|
130
|
+
}
|
|
131
|
+
const e = this.currentNode.querySelector(".product-card-wrapper"), r = I(e), l = S(r, "padding");
|
|
132
|
+
if (!l)
|
|
133
|
+
return s.COLUMN_SPACING;
|
|
134
|
+
const c = l.trim().split(/\s+/);
|
|
135
|
+
return c.length < 2 ? s.COLUMN_SPACING : C(c[1], s.COLUMN_SPACING / 2) * 2;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets stored row spacing from the first spacer element's height style
|
|
139
|
+
*/
|
|
140
|
+
_getStoredRowSpacing() {
|
|
141
|
+
if (!this.currentNode)
|
|
142
|
+
return s.ROW_SPACING;
|
|
143
|
+
const t = this.currentNode.querySelector(".spacer"), e = S(t, "height");
|
|
144
|
+
return C(e, s.ROW_SPACING);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Handles column spacing changes.
|
|
148
|
+
* For vertical layout: applies horizontal padding to all cells inside attribute rows.
|
|
149
|
+
* For horizontal layout: applies padding to parent of product card wrappers.
|
|
150
|
+
*/
|
|
151
|
+
_onColumnSpacingChange(t) {
|
|
152
|
+
if (!this.currentNode)
|
|
153
|
+
return;
|
|
154
|
+
this._storeColumnSpacing(t);
|
|
155
|
+
const e = this._getCurrentLayout(), r = this.api.getDocumentModifier(), c = `0 ${t / 2}px`;
|
|
156
|
+
e === "vertical" ? Array.from(
|
|
157
|
+
this.currentNode.querySelectorAll(".attribute-cell")
|
|
158
|
+
).forEach((o) => {
|
|
159
|
+
r.modifyHtml(o).setStyle("padding", c);
|
|
160
|
+
}) : Array.from(
|
|
161
|
+
this.currentNode.querySelectorAll(".product-card-wrapper")
|
|
162
|
+
).forEach((o) => {
|
|
163
|
+
"parent" in o && o.parent() && r.modifyHtml(o.parent()).setStyle("padding", c);
|
|
164
|
+
}), r.apply(new d(`Update column spacing to ${t}px`));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Handles row spacing changes
|
|
168
|
+
* Applies height to all spacer elements between product rows
|
|
169
|
+
*/
|
|
170
|
+
_onRowSpacingChange(t) {
|
|
171
|
+
if (!this.currentNode)
|
|
172
|
+
return;
|
|
173
|
+
this._storeRowSpacing(t);
|
|
174
|
+
const e = Array.from(
|
|
175
|
+
this.currentNode.querySelectorAll(".spacer")
|
|
176
|
+
);
|
|
177
|
+
if (!e.length)
|
|
178
|
+
return;
|
|
179
|
+
const r = this.api.getDocumentModifier(), l = `${t}px`;
|
|
180
|
+
e.forEach((c) => {
|
|
181
|
+
r.modifyHtml(c).setStyle("height", l);
|
|
182
|
+
}), r.apply(new d(`Update row spacing to ${t}px`));
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Stores column spacing value in block data attribute
|
|
186
|
+
*/
|
|
187
|
+
_storeColumnSpacing(t) {
|
|
188
|
+
if (!this.currentNode)
|
|
189
|
+
return;
|
|
190
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
191
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(_.COLUMN_SPACING, t.toString()).apply(new d("Store column spacing"));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Stores row spacing value in block data attribute
|
|
195
|
+
*/
|
|
196
|
+
_storeRowSpacing(t) {
|
|
197
|
+
if (!this.currentNode)
|
|
198
|
+
return;
|
|
199
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
200
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(_.ROW_SPACING, t.toString()).apply(new d("Store row spacing"));
|
|
201
|
+
}
|
|
202
|
+
_listenToFormUpdates() {
|
|
203
|
+
this.api.onValueChanged(a.COLUMN_SPACING, (t) => {
|
|
204
|
+
const e = parseInt(t);
|
|
205
|
+
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
206
|
+
}), this.api.onValueChanged(a.ROW_SPACING, (t) => {
|
|
207
|
+
const e = parseInt(t);
|
|
208
|
+
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Subscribe to store orientation changes
|
|
213
|
+
* Updates column spacing visibility when layout changes via the layout control
|
|
214
|
+
*/
|
|
215
|
+
_subscribeToOrientationChanges() {
|
|
216
|
+
this.unsubscribeOrientation && this.unsubscribeOrientation(), this.unsubscribeOrientation = this.store.$subscribe((t) => {
|
|
217
|
+
t.type === "patch object" && this._updateColumnSpacingVisibility();
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
export {
|
|
222
|
+
O as SPACING_CONTROL_ID,
|
|
223
|
+
w as SpacingControl
|
|
224
|
+
};
|
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
import { ExtensionBuilder as
|
|
2
|
-
import { RecommendationBlock as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
1
|
+
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RecommendationBlock as m } from "./block.js";
|
|
3
|
+
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
|
+
import "./store/recommendation.js";
|
|
5
|
+
import { NameControls as i } from "./controls/name/index.js";
|
|
6
|
+
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
|
+
import { OldPriceControls as l } from "./controls/oldPrice/index.js";
|
|
8
|
+
import { OmnibusPriceControls as s } from "./controls/omnibusPrice/index.js";
|
|
9
|
+
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
10
|
+
import { ButtonControls as p } from "./controls/button/index.js";
|
|
11
|
+
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
|
+
import { SpacingControl as C } from "./controls/spacing/index.js";
|
|
13
|
+
import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
|
|
14
|
+
import { LayoutControl as f } from "./controls/layout/index.js";
|
|
15
|
+
import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
|
|
16
|
+
import { RecommendationIconsRegistry as g } from "./iconsRegistry.js";
|
|
17
|
+
import R from "./recommendation.css.js";
|
|
18
|
+
import { SettingsPanel as y } from "./settingsPanel.js";
|
|
19
|
+
const B = [
|
|
20
|
+
i,
|
|
21
|
+
e,
|
|
22
|
+
l,
|
|
23
|
+
s,
|
|
24
|
+
a,
|
|
25
|
+
p,
|
|
26
|
+
c
|
|
27
|
+
], P = [
|
|
28
|
+
n,
|
|
29
|
+
d,
|
|
30
|
+
f,
|
|
31
|
+
C,
|
|
32
|
+
u
|
|
33
|
+
], b = [
|
|
34
|
+
...P,
|
|
35
|
+
...B.flatMap((o) => Object.values(o))
|
|
36
|
+
], F = b.reduce(
|
|
37
|
+
(o, t) => o.addControl(t),
|
|
38
|
+
new r().addBlock(m).withSettingsPanelRegistry(y)
|
|
39
|
+
).addStyles(R).withIconsRegistry(g).build();
|
|
19
40
|
export {
|
|
20
|
-
|
|
41
|
+
F as default
|
|
21
42
|
};
|
|
@@ -13,6 +13,11 @@ const n = `/* Utils */
|
|
|
13
13
|
.container:has(.recommendation-controls-container) {
|
|
14
14
|
padding: 0
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/* Hide drag icon for horizontal layout (ordering disabled) */
|
|
18
|
+
ue-orderable.orderable-disabled .droppable-icon {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
16
21
|
`;
|
|
17
22
|
export {
|
|
18
23
|
n as default
|