@useinsider/guido 2.0.0-beta.143201d → 2.0.0-beta.1c331b8
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/README.md +2 -0
- package/dist/@types/config/schemas.js +3 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- package/dist/composables/useStripo.js +40 -40
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
- package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
- package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
- package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +13 -4
- 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/layout.js +7 -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 +80 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +238 -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 +134 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +124 -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/omnibusDiscount/textAfter.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +73 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +216 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -43
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +5 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +128 -72
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -25
- 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 +62 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +36 -0
- package/dist/extensions/Blocks/controlFactories.js +162 -117
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -291
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +6 -10
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
- 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} +19 -11
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +17 -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/cardBackground/index.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +24 -0
- 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 +43 -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/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 +72 -0
- 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/{migrationTemplate.d.ts → vertical/migration.d.ts} +11 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +19 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +17 -0
- package/dist/static/styles/components/wide-panel.css.js +0 -4
- package/dist/static/styles/customEditorStyle.css.js +38 -2
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -103
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -5
- package/dist/extensions/Blocks/Recommendation/control.js +0 -306
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -160
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -152
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -180
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -28
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -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
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 {
|
|
9
|
+
getId() {
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_AFTER;
|
|
11
|
+
}
|
|
12
|
+
getTemplate() {
|
|
13
|
+
return `
|
|
14
|
+
<div class="omnibus-discount-text-after-control-container">
|
|
15
|
+
${this._GuTwoColumns([
|
|
16
|
+
this._GuLabel({ text: "Text After" }),
|
|
17
|
+
this._GuTextInput({
|
|
18
|
+
name: "omnibusDiscountTextAfter",
|
|
19
|
+
placeholder: "e.g., off!",
|
|
20
|
+
className: "es-180w"
|
|
21
|
+
})
|
|
22
|
+
])}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
onRender() {
|
|
27
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
28
|
+
}
|
|
29
|
+
onTemplateNodeUpdated(t) {
|
|
30
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
31
|
+
}
|
|
32
|
+
_setFormValues() {
|
|
33
|
+
const t = this._getCurrentText();
|
|
34
|
+
this.api.updateValues({
|
|
35
|
+
omnibusDiscountTextAfter: t
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_getCurrentText() {
|
|
39
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
40
|
+
return u;
|
|
41
|
+
const t = this.currentNode.getAttribute(i);
|
|
42
|
+
return t === null ? u : t;
|
|
43
|
+
}
|
|
44
|
+
_onTextChange(t) {
|
|
45
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
46
|
+
return;
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
48
|
+
if (!e || !("querySelectorAll" in e))
|
|
49
|
+
return;
|
|
50
|
+
const n = Array.from(
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_DISCOUNT}"]`)
|
|
52
|
+
);
|
|
53
|
+
if (!n.length)
|
|
54
|
+
return;
|
|
55
|
+
const o = this.api.getDocumentModifier();
|
|
56
|
+
n.forEach((s) => {
|
|
57
|
+
o.modifyHtml(s).setAttribute(i, t);
|
|
58
|
+
const r = s.querySelector(p);
|
|
59
|
+
if (r) {
|
|
60
|
+
const m = f(r, t);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
62
|
+
}
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text after"));
|
|
64
|
+
}
|
|
65
|
+
_listenToFormUpdates() {
|
|
66
|
+
this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
|
|
67
|
+
this._onTextChange(t);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
b as OmnibusDiscountTextAfterControl
|
|
73
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 {
|
|
9
|
+
getId() {
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
|
|
11
|
+
}
|
|
12
|
+
getTemplate() {
|
|
13
|
+
return `
|
|
14
|
+
<div class="omnibus-discount-text-before-control-container">
|
|
15
|
+
${this._GuTwoColumns([
|
|
16
|
+
this._GuLabel({ text: "Text Before" }),
|
|
17
|
+
this._GuTextInput({
|
|
18
|
+
name: "omnibusDiscountTextBefore",
|
|
19
|
+
placeholder: "e.g., Save ",
|
|
20
|
+
className: "es-180w"
|
|
21
|
+
})
|
|
22
|
+
])}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
onRender() {
|
|
27
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
28
|
+
}
|
|
29
|
+
onTemplateNodeUpdated(e) {
|
|
30
|
+
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
31
|
+
}
|
|
32
|
+
_setFormValues() {
|
|
33
|
+
const e = this._getCurrentText();
|
|
34
|
+
this.api.updateValues({
|
|
35
|
+
omnibusDiscountTextBefore: e
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_getCurrentText() {
|
|
39
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
40
|
+
return u;
|
|
41
|
+
const e = this.currentNode.getAttribute(i);
|
|
42
|
+
return e === null ? u : e;
|
|
43
|
+
}
|
|
44
|
+
_onTextChange(e) {
|
|
45
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
46
|
+
return;
|
|
47
|
+
const t = this.currentNode.closest(T);
|
|
48
|
+
if (!t || !("querySelectorAll" in t))
|
|
49
|
+
return;
|
|
50
|
+
const n = Array.from(
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_DISCOUNT}"]`)
|
|
52
|
+
);
|
|
53
|
+
if (!n.length)
|
|
54
|
+
return;
|
|
55
|
+
const o = this.api.getDocumentModifier();
|
|
56
|
+
n.forEach((s) => {
|
|
57
|
+
o.modifyHtml(s).setAttribute(i, e);
|
|
58
|
+
const r = s.querySelector(p);
|
|
59
|
+
if (r) {
|
|
60
|
+
const m = f(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
62
|
+
}
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text before"));
|
|
64
|
+
}
|
|
65
|
+
_listenToFormUpdates() {
|
|
66
|
+
this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
|
|
67
|
+
this._onTextChange(e);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
B as OmnibusDiscountTextBeforeControl
|
|
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
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 {
|
|
9
|
+
getId() {
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_AFTER;
|
|
11
|
+
}
|
|
12
|
+
getTemplate() {
|
|
13
|
+
return `
|
|
14
|
+
<div class="omnibus-price-text-after-control-container">
|
|
15
|
+
${this._GuTwoColumns([
|
|
16
|
+
this._GuLabel({ text: "Text After" }),
|
|
17
|
+
this._GuTextInput({
|
|
18
|
+
name: "omnibusPriceTextAfter",
|
|
19
|
+
placeholder: "e.g., (incl. VAT)",
|
|
20
|
+
className: "es-180w"
|
|
21
|
+
})
|
|
22
|
+
])}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
onRender() {
|
|
27
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
28
|
+
}
|
|
29
|
+
onTemplateNodeUpdated(t) {
|
|
30
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
31
|
+
}
|
|
32
|
+
_setFormValues() {
|
|
33
|
+
const t = this._getCurrentText();
|
|
34
|
+
this.api.updateValues({
|
|
35
|
+
omnibusPriceTextAfter: t
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_getCurrentText() {
|
|
39
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
40
|
+
return m;
|
|
41
|
+
const t = this.currentNode.getAttribute(s);
|
|
42
|
+
return t === null ? m : t;
|
|
43
|
+
}
|
|
44
|
+
_onTextChange(t) {
|
|
45
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
46
|
+
return;
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
48
|
+
if (!e || !("querySelectorAll" in e))
|
|
49
|
+
return;
|
|
50
|
+
const n = Array.from(
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_PRICE}"]`)
|
|
52
|
+
);
|
|
53
|
+
if (!n.length)
|
|
54
|
+
return;
|
|
55
|
+
const r = this.api.getDocumentModifier();
|
|
56
|
+
n.forEach((i) => {
|
|
57
|
+
r.modifyHtml(i).setAttribute(s, t);
|
|
58
|
+
const o = i.querySelector(p);
|
|
59
|
+
if (o) {
|
|
60
|
+
const u = f(o, t);
|
|
61
|
+
r.modifyHtml(o).setInnerHtml(u);
|
|
62
|
+
}
|
|
63
|
+
}), r.apply(new c("Update omnibus price text after"));
|
|
64
|
+
}
|
|
65
|
+
_listenToFormUpdates() {
|
|
66
|
+
this.api.onValueChanged("omnibusPriceTextAfter", (t) => {
|
|
67
|
+
this._onTextChange(t);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
N as OmnibusPriceTextAfterControl
|
|
73
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 {
|
|
9
|
+
getId() {
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_BEFORE;
|
|
11
|
+
}
|
|
12
|
+
getTemplate() {
|
|
13
|
+
return `
|
|
14
|
+
<div class="omnibus-price-text-before-control-container">
|
|
15
|
+
${this._GuTwoColumns([
|
|
16
|
+
this._GuLabel({ text: "Text Before" }),
|
|
17
|
+
this._GuTextInput({
|
|
18
|
+
name: "omnibusPriceTextBefore",
|
|
19
|
+
placeholder: "e.g., Lowest 30-day price: ",
|
|
20
|
+
className: "es-180w"
|
|
21
|
+
})
|
|
22
|
+
])}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
onRender() {
|
|
27
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
28
|
+
}
|
|
29
|
+
onTemplateNodeUpdated(e) {
|
|
30
|
+
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
31
|
+
}
|
|
32
|
+
_setFormValues() {
|
|
33
|
+
const e = this._getCurrentText();
|
|
34
|
+
this.api.updateValues({
|
|
35
|
+
omnibusPriceTextBefore: e
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_getCurrentText() {
|
|
39
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
40
|
+
return c;
|
|
41
|
+
const e = this.currentNode.getAttribute(s);
|
|
42
|
+
return e === null ? c : e;
|
|
43
|
+
}
|
|
44
|
+
_onTextChange(e) {
|
|
45
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
46
|
+
return;
|
|
47
|
+
const t = this.currentNode.closest(p);
|
|
48
|
+
if (!t || !("querySelectorAll" in t))
|
|
49
|
+
return;
|
|
50
|
+
const n = Array.from(
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_PRICE}"]`)
|
|
52
|
+
);
|
|
53
|
+
if (!n.length)
|
|
54
|
+
return;
|
|
55
|
+
const o = this.api.getDocumentModifier();
|
|
56
|
+
n.forEach((i) => {
|
|
57
|
+
o.modifyHtml(i).setAttribute(s, e);
|
|
58
|
+
const r = i.querySelector(f);
|
|
59
|
+
if (r) {
|
|
60
|
+
const m = T(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
62
|
+
}
|
|
63
|
+
}), o.apply(new u("Update omnibus price text before"));
|
|
64
|
+
}
|
|
65
|
+
_listenToFormUpdates() {
|
|
66
|
+
this.api.onValueChanged("omnibusPriceTextBefore", (e) => {
|
|
67
|
+
this._onTextChange(e);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
N as OmnibusPriceTextBeforeControl
|
|
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,216 @@
|
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var O = (n, i, t) => i in n ? P(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
|
|
3
|
+
var p = (n, i, t) => O(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 I } from "../../store/recommendation.js";
|
|
7
|
+
import { getCurrentLayout as S } from "../main/utils.js";
|
|
8
|
+
import { useDebounceFn as _ } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
9
|
+
const y = "recommendation-spacing-control", a = {
|
|
10
|
+
COLUMN_SPACING: "columnSpacing",
|
|
11
|
+
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
12
|
+
ROW_SPACING: "rowSpacing"
|
|
13
|
+
}, f = {
|
|
14
|
+
COLUMN_SPACING: "data-column-spacing",
|
|
15
|
+
ROW_SPACING: "data-row-spacing"
|
|
16
|
+
}, s = {
|
|
17
|
+
COLUMN_SPACING: 10,
|
|
18
|
+
// 5px on each side = 10px total
|
|
19
|
+
ROW_SPACING: 20
|
|
20
|
+
}, u = {
|
|
21
|
+
MIN_SPACING: 0,
|
|
22
|
+
MAX_SPACING: 50,
|
|
23
|
+
STEP: 5
|
|
24
|
+
};
|
|
25
|
+
function C(n, i) {
|
|
26
|
+
return !n || !("getStyle" in n) ? null : n.getStyle(i);
|
|
27
|
+
}
|
|
28
|
+
function G(n) {
|
|
29
|
+
return !n || !("parent" in n) || typeof n.parent != "function" ? null : n.parent();
|
|
30
|
+
}
|
|
31
|
+
function m(n, i) {
|
|
32
|
+
if (!n)
|
|
33
|
+
return i;
|
|
34
|
+
const t = parseFloat(n);
|
|
35
|
+
return Number.isNaN(t) ? i : t;
|
|
36
|
+
}
|
|
37
|
+
class E extends b {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
p(this, "store", I());
|
|
41
|
+
p(this, "unsubscribeOrientation", null);
|
|
42
|
+
/**
|
|
43
|
+
* Debounced version of _onColumnSpacingChange
|
|
44
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
45
|
+
*/
|
|
46
|
+
p(this, "_debouncedOnColumnSpacingChange", _((t) => {
|
|
47
|
+
this._onColumnSpacingChange(t);
|
|
48
|
+
}, 300));
|
|
49
|
+
/**
|
|
50
|
+
* Debounced version of _onRowSpacingChange
|
|
51
|
+
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
52
|
+
*/
|
|
53
|
+
p(this, "_debouncedOnRowSpacingChange", _((t) => {
|
|
54
|
+
this._onRowSpacingChange(t);
|
|
55
|
+
}, 300));
|
|
56
|
+
}
|
|
57
|
+
getId() {
|
|
58
|
+
return y;
|
|
59
|
+
}
|
|
60
|
+
getTemplate() {
|
|
61
|
+
return `
|
|
62
|
+
<div class="spacing-control-container">
|
|
63
|
+
${this._GuTwoColumns([
|
|
64
|
+
this._GuLabel({ text: "Column Spacing (px)", name: a.COLUMN_SPACING_LABEL }),
|
|
65
|
+
this._GuCounter({
|
|
66
|
+
name: a.COLUMN_SPACING,
|
|
67
|
+
minValue: u.MIN_SPACING,
|
|
68
|
+
maxValue: u.MAX_SPACING,
|
|
69
|
+
step: u.STEP
|
|
70
|
+
}),
|
|
71
|
+
this._GuLabel({ text: "Row Spacing (px)" }),
|
|
72
|
+
this._GuCounter({
|
|
73
|
+
name: a.ROW_SPACING,
|
|
74
|
+
minValue: u.MIN_SPACING,
|
|
75
|
+
maxValue: u.MAX_SPACING,
|
|
76
|
+
step: u.STEP
|
|
77
|
+
})
|
|
78
|
+
])}
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
onRender() {
|
|
83
|
+
this._setFormValues(), this._updateColumnSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges();
|
|
84
|
+
}
|
|
85
|
+
onTemplateNodeUpdated(t) {
|
|
86
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateColumnSpacingVisibility();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Updates column spacing visibility based on layout orientation
|
|
90
|
+
* Column spacing is hidden for horizontal layout (products are stacked vertically)
|
|
91
|
+
* Reads from store first for reliability, falls back to DOM
|
|
92
|
+
*/
|
|
93
|
+
_updateColumnSpacingVisibility() {
|
|
94
|
+
const r = (this.store.recommendationConfigs.orientation || S(this.currentNode)) === "vertical";
|
|
95
|
+
this.api.setVisibility(a.COLUMN_SPACING, r), this.api.setVisibility(a.COLUMN_SPACING_LABEL, r);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads spacing values from data attributes or returns defaults
|
|
99
|
+
*/
|
|
100
|
+
_setFormValues() {
|
|
101
|
+
const t = this._getStoredColumnSpacing(), e = this._getStoredRowSpacing();
|
|
102
|
+
this.api.updateValues({
|
|
103
|
+
[a.COLUMN_SPACING]: t,
|
|
104
|
+
[a.ROW_SPACING]: e
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Gets stored column spacing from the first attribute row cell's padding.
|
|
109
|
+
* For vertical layout: cells inside .recommendation-attribute-row have padding applied.
|
|
110
|
+
* For horizontal layout: the parent of .product-card-wrapper has the padding.
|
|
111
|
+
* The padding is applied as "0 {halfSpacing}px", so we extract and multiply by 2.
|
|
112
|
+
*/
|
|
113
|
+
_getStoredColumnSpacing() {
|
|
114
|
+
if (!this.currentNode)
|
|
115
|
+
return s.COLUMN_SPACING;
|
|
116
|
+
if (S(this.currentNode) === "vertical") {
|
|
117
|
+
const o = this.currentNode.querySelector(".recommendation-attribute-row"), A = o == null ? void 0 : o.querySelector("td"), h = C(A, "padding");
|
|
118
|
+
if (!h)
|
|
119
|
+
return s.COLUMN_SPACING;
|
|
120
|
+
const g = h.trim().split(/\s+/);
|
|
121
|
+
return g.length < 2 ? s.COLUMN_SPACING : m(g[1], s.COLUMN_SPACING / 2) * 2;
|
|
122
|
+
}
|
|
123
|
+
const e = this.currentNode.querySelector(".product-card-wrapper"), r = G(e), l = C(r, "padding");
|
|
124
|
+
if (!l)
|
|
125
|
+
return s.COLUMN_SPACING;
|
|
126
|
+
const c = l.trim().split(/\s+/);
|
|
127
|
+
return c.length < 2 ? s.COLUMN_SPACING : m(c[1], s.COLUMN_SPACING / 2) * 2;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets stored row spacing from the first spacer element's height style
|
|
131
|
+
*/
|
|
132
|
+
_getStoredRowSpacing() {
|
|
133
|
+
if (!this.currentNode)
|
|
134
|
+
return s.ROW_SPACING;
|
|
135
|
+
const t = this.currentNode.querySelector(".spacer"), e = C(t, "height");
|
|
136
|
+
return m(e, s.ROW_SPACING);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Handles column spacing changes.
|
|
140
|
+
* For vertical layout: applies horizontal padding to all cells inside attribute rows.
|
|
141
|
+
* For horizontal layout: applies padding to parent of product card wrappers.
|
|
142
|
+
*/
|
|
143
|
+
_onColumnSpacingChange(t) {
|
|
144
|
+
if (!this.currentNode)
|
|
145
|
+
return;
|
|
146
|
+
this._storeColumnSpacing(t);
|
|
147
|
+
const e = S(this.currentNode), r = this.api.getDocumentModifier(), c = `0 ${t / 2}px`;
|
|
148
|
+
e === "vertical" ? Array.from(
|
|
149
|
+
this.currentNode.querySelectorAll(".attribute-cell")
|
|
150
|
+
).forEach((o) => {
|
|
151
|
+
r.modifyHtml(o).setStyle("padding", c);
|
|
152
|
+
}) : Array.from(
|
|
153
|
+
this.currentNode.querySelectorAll(".product-card-wrapper")
|
|
154
|
+
).forEach((o) => {
|
|
155
|
+
"parent" in o && o.parent() && r.modifyHtml(o.parent()).setStyle("padding", c);
|
|
156
|
+
}), r.apply(new d(`Update column spacing to ${t}px`));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Handles row spacing changes
|
|
160
|
+
* Applies height to all spacer elements between product rows
|
|
161
|
+
*/
|
|
162
|
+
_onRowSpacingChange(t) {
|
|
163
|
+
if (!this.currentNode)
|
|
164
|
+
return;
|
|
165
|
+
this._storeRowSpacing(t);
|
|
166
|
+
const e = Array.from(
|
|
167
|
+
this.currentNode.querySelectorAll(".spacer")
|
|
168
|
+
);
|
|
169
|
+
if (!e.length)
|
|
170
|
+
return;
|
|
171
|
+
const r = this.api.getDocumentModifier(), l = `${t}px`;
|
|
172
|
+
e.forEach((c) => {
|
|
173
|
+
r.modifyHtml(c).setStyle("height", l);
|
|
174
|
+
}), r.apply(new d(`Update row spacing to ${t}px`));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Stores column spacing value in block data attribute
|
|
178
|
+
*/
|
|
179
|
+
_storeColumnSpacing(t) {
|
|
180
|
+
if (!this.currentNode)
|
|
181
|
+
return;
|
|
182
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
183
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(f.COLUMN_SPACING, t.toString()).apply(new d("Store column spacing"));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Stores row spacing value in block data attribute
|
|
187
|
+
*/
|
|
188
|
+
_storeRowSpacing(t) {
|
|
189
|
+
if (!this.currentNode)
|
|
190
|
+
return;
|
|
191
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
192
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute(f.ROW_SPACING, t.toString()).apply(new d("Store row spacing"));
|
|
193
|
+
}
|
|
194
|
+
_listenToFormUpdates() {
|
|
195
|
+
this.api.onValueChanged(a.COLUMN_SPACING, (t) => {
|
|
196
|
+
const e = parseInt(t);
|
|
197
|
+
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
198
|
+
}), this.api.onValueChanged(a.ROW_SPACING, (t) => {
|
|
199
|
+
const e = parseInt(t);
|
|
200
|
+
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Subscribe to store orientation changes
|
|
205
|
+
* Updates column spacing visibility when layout changes via the layout control
|
|
206
|
+
*/
|
|
207
|
+
_subscribeToOrientationChanges() {
|
|
208
|
+
this.unsubscribeOrientation && this.unsubscribeOrientation(), this.unsubscribeOrientation = this.store.$subscribe((t) => {
|
|
209
|
+
t.type === "patch object" && this._updateColumnSpacingVisibility();
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
y as SPACING_CONTROL_ID,
|
|
215
|
+
E as SpacingControl
|
|
216
|
+
};
|