@useinsider/guido 3.1.1 → 3.2.0-beta.1a9b724
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 +1 -0
- package/dist/@types/config/schemas.js +66 -54
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +23 -15
- package/dist/composables/useStripo.js +52 -47
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +162 -43
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +52 -46
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/extensions/recommendationBlock.js +14 -11
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +28 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +12 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/config.d.ts +108 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/static/templates/empty/style.css.js +0 -1
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +36 -25
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +4 -4
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { RecommendationBlockId as
|
|
4
|
-
import { RecommendationControlId as
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as u } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
|
|
6
|
+
import { CSS_CLASS_TEXT_TRIM as r, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
|
|
7
|
+
const s = {
|
|
7
8
|
TEXT_TRIM_ENABLED: "textTrimEnabled"
|
|
8
|
-
}
|
|
9
|
-
class N extends
|
|
9
|
+
};
|
|
10
|
+
class N extends u {
|
|
10
11
|
getId() {
|
|
11
|
-
return
|
|
12
|
+
return d.NAME_TEXT_TRIM;
|
|
12
13
|
}
|
|
13
14
|
getTemplate() {
|
|
14
15
|
return `
|
|
@@ -16,7 +17,7 @@ class N extends d {
|
|
|
16
17
|
<div class="name-text-trim-control-container">
|
|
17
18
|
${this._GuTwoColumns([
|
|
18
19
|
this._GuLabel({ text: this.api.translate("Trim Long Text") }),
|
|
19
|
-
this._GuToggle(
|
|
20
|
+
this._GuToggle(s.TEXT_TRIM_ENABLED)
|
|
20
21
|
])}
|
|
21
22
|
</div>
|
|
22
23
|
`;
|
|
@@ -30,76 +31,45 @@ class N extends d {
|
|
|
30
31
|
_setFormValues() {
|
|
31
32
|
const e = this._getCurrentTrimState();
|
|
32
33
|
this.api.updateValues({
|
|
33
|
-
[
|
|
34
|
+
[s.TEXT_TRIM_ENABLED]: e
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
_getCurrentTrimState() {
|
|
37
38
|
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
38
39
|
return !1;
|
|
39
|
-
if (this.currentNode.hasClass(
|
|
40
|
+
if (this.currentNode.hasClass(r))
|
|
40
41
|
return !0;
|
|
41
|
-
const e = this.currentNode.closest(
|
|
42
|
+
const e = this.currentNode.closest(m);
|
|
42
43
|
if (!e)
|
|
43
44
|
return !1;
|
|
44
45
|
const t = e.querySelector(
|
|
45
|
-
`[esd-extension-block-id="${
|
|
46
|
+
`[esd-extension-block-id="${a.NAME}"]`
|
|
46
47
|
);
|
|
47
|
-
return t && "hasClass" in t ? t.hasClass(
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Finds an existing CSS rule in the document stylesheet by exact query
|
|
51
|
-
* @param query - The CSS query to search for (uses Stripo's CSS query syntax)
|
|
52
|
-
* @returns The CSS rule node if found, undefined otherwise
|
|
53
|
-
*/
|
|
54
|
-
_findCssRule(e) {
|
|
55
|
-
const t = this.api.getDocumentRootCssNode();
|
|
56
|
-
if (t)
|
|
57
|
-
return t.querySelector(e);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
|
|
61
|
-
* This is needed because Stripo's CSS query syntax interprets spaces as path separators
|
|
62
|
-
* @returns true if the rule exists
|
|
63
|
-
*/
|
|
64
|
-
_hasParagraphRule() {
|
|
65
|
-
const e = this.api.getDocumentRootCssNode();
|
|
66
|
-
return e ? e.querySelectorAll(`*${o}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" ? s.getSelector() === T : !1) : !1;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Ensures the text-trim CSS rules exist in the document stylesheet
|
|
70
|
-
* Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
|
|
71
|
-
*/
|
|
72
|
-
_ensureCssRulesExist() {
|
|
73
|
-
const e = this.api.getDocumentRootCssNode();
|
|
74
|
-
if (!e)
|
|
75
|
-
return;
|
|
76
|
-
const t = this.api.getDocumentModifier();
|
|
77
|
-
let s = !1;
|
|
78
|
-
this._findCssRule(c) || (t.modifyCss(e).appendRule(p), s = !0), this._hasParagraphRule() || (t.modifyCss(e).appendRule(_), s = !0), s && t.apply(new a("Add text trim CSS rules"));
|
|
48
|
+
return t && "hasClass" in t ? t.hasClass(r) : !1;
|
|
79
49
|
}
|
|
80
50
|
_onTextTrimChange(e) {
|
|
81
51
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
82
52
|
return;
|
|
83
|
-
const t = this.currentNode.closest(
|
|
53
|
+
const t = this.currentNode.closest(m);
|
|
84
54
|
if (!t || !("querySelectorAll" in t))
|
|
85
55
|
return;
|
|
86
|
-
const
|
|
87
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
56
|
+
const i = Array.from(
|
|
57
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
|
|
88
58
|
);
|
|
89
|
-
if (!
|
|
59
|
+
if (!i.length)
|
|
90
60
|
return;
|
|
91
|
-
e && this.
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
e ?
|
|
95
|
-
}),
|
|
96
|
-
new
|
|
61
|
+
e && T(this.api);
|
|
62
|
+
const o = this.api.getDocumentModifier();
|
|
63
|
+
i.forEach((n) => {
|
|
64
|
+
e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
|
|
65
|
+
}), o.apply(
|
|
66
|
+
new l(
|
|
97
67
|
e ? "Enable product name text trimming" : "Disable product name text trimming"
|
|
98
68
|
)
|
|
99
69
|
);
|
|
100
70
|
}
|
|
101
71
|
_listenToFormUpdates() {
|
|
102
|
-
this.api.onValueChanged(
|
|
72
|
+
this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (e) => {
|
|
103
73
|
this._onTextTrimChange(e);
|
|
104
74
|
});
|
|
105
75
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModificationDescription as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const t = "text-trim-enabled", l = `.${t}`, c = `.${t} p`, S = `.${t} { max-width: 0; }`, T = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
|
|
3
|
+
function f(n) {
|
|
4
|
+
const e = n.getDocumentRootCssNode();
|
|
5
|
+
if (!e)
|
|
6
|
+
return;
|
|
7
|
+
const o = n.getDocumentModifier();
|
|
8
|
+
let i = !1;
|
|
9
|
+
e.querySelector(l) || (o.modifyCss(e).appendRule(S), i = !0), e.querySelectorAll(`*${t}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" && s.getSelector() === c) || (o.modifyCss(e).appendRule(T), i = !0), i && o.apply(new r("Add text trim CSS rules"));
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
t as CSS_CLASS_TEXT_TRIM,
|
|
13
|
+
f as ensureTextTrimCssRulesExist
|
|
14
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var G = Object.defineProperty;
|
|
2
|
-
var P = (u,
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
2
|
+
var P = (u, s, t) => s in u ? G(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
|
|
3
|
+
var C = (u, s, t) => P(u, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as M } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, DEFAULT_ROW_SPACING as E } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as p } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
12
|
-
import { useDebounceFn as
|
|
9
|
+
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
10
|
+
import { safeGetStyle as L, safeGetParent as V } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as f, getBlockElement as B } from "../main/utils.js";
|
|
12
|
+
import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
13
|
const U = "recommendation-spacing-control", n = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
15
15
|
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
@@ -19,46 +19,46 @@ const U = "recommendation-spacing-control", n = {
|
|
|
19
19
|
MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
|
|
20
20
|
MOBILE_ROW_SPACING: "mobileRowSpacing",
|
|
21
21
|
MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
|
|
22
|
-
},
|
|
22
|
+
}, A = {
|
|
23
23
|
COLUMN_SPACING: "data-column-spacing",
|
|
24
24
|
ROW_SPACING: "data-row-spacing",
|
|
25
25
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
26
26
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function I(u, s) {
|
|
29
29
|
if (!u)
|
|
30
|
-
return
|
|
30
|
+
return s;
|
|
31
31
|
const t = parseFloat(u);
|
|
32
|
-
return Number.isNaN(t) ?
|
|
32
|
+
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
34
|
class j extends R {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
C(this, "store", w());
|
|
38
|
+
C(this, "unsubscribeOrientation", null);
|
|
39
39
|
/**
|
|
40
40
|
* Debounced version of _onColumnSpacingChange
|
|
41
41
|
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
C(this, "_debouncedOnColumnSpacingChange", O((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
C(this, "_debouncedOnRowSpacingChange", O((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
C(this, "_debouncedOnMobileColumnSpacingChange", O((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
C(this, "_debouncedOnMobileRowSpacingChange", O((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
@@ -75,9 +75,9 @@ class j extends R {
|
|
|
75
75
|
}),
|
|
76
76
|
this._GuCounter({
|
|
77
77
|
name: n.COLUMN_SPACING,
|
|
78
|
-
minValue:
|
|
79
|
-
maxValue:
|
|
80
|
-
step:
|
|
78
|
+
minValue: b,
|
|
79
|
+
maxValue: N,
|
|
80
|
+
step: _
|
|
81
81
|
}),
|
|
82
82
|
this._GuLabel({
|
|
83
83
|
text: this.api.translate("Row Spacing (px)"),
|
|
@@ -85,9 +85,9 @@ class j extends R {
|
|
|
85
85
|
}),
|
|
86
86
|
this._GuCounter({
|
|
87
87
|
name: n.ROW_SPACING,
|
|
88
|
-
minValue:
|
|
89
|
-
maxValue:
|
|
90
|
-
step:
|
|
88
|
+
minValue: b,
|
|
89
|
+
maxValue: N,
|
|
90
|
+
step: _
|
|
91
91
|
}),
|
|
92
92
|
this._GuLabel({
|
|
93
93
|
text: this.api.translate("Column Spacing on Mobile (px)"),
|
|
@@ -95,9 +95,9 @@ class j extends R {
|
|
|
95
95
|
}),
|
|
96
96
|
this._GuCounter({
|
|
97
97
|
name: n.MOBILE_COLUMN_SPACING,
|
|
98
|
-
minValue:
|
|
99
|
-
maxValue:
|
|
100
|
-
step:
|
|
98
|
+
minValue: b,
|
|
99
|
+
maxValue: N,
|
|
100
|
+
step: _
|
|
101
101
|
}),
|
|
102
102
|
this._GuLabel({
|
|
103
103
|
text: this.api.translate("Row Spacing on Mobile (px)"),
|
|
@@ -105,9 +105,9 @@ class j extends R {
|
|
|
105
105
|
}),
|
|
106
106
|
this._GuCounter({
|
|
107
107
|
name: n.MOBILE_ROW_SPACING,
|
|
108
|
-
minValue:
|
|
109
|
-
maxValue:
|
|
110
|
-
step:
|
|
108
|
+
minValue: b,
|
|
109
|
+
maxValue: N,
|
|
110
|
+
step: _
|
|
111
111
|
})
|
|
112
112
|
])}
|
|
113
113
|
</div>
|
|
@@ -132,13 +132,13 @@ class j extends R {
|
|
|
132
132
|
_updateSpacingVisibility() {
|
|
133
133
|
if (!this.api)
|
|
134
134
|
return;
|
|
135
|
-
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e ||
|
|
135
|
+
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || f(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, c = t.mobileCardsInRow > 1;
|
|
136
136
|
this.api.setVisibility(n.COLUMN_SPACING, i && r), this.api.setVisibility(n.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(n.ROW_SPACING, !0), this.api.setVisibility(n.ROW_SPACING_LABEL, !0), this.api.setVisibility(
|
|
137
137
|
n.MOBILE_COLUMN_SPACING,
|
|
138
|
-
i && a &&
|
|
138
|
+
i && a && c
|
|
139
139
|
), this.api.setVisibility(
|
|
140
140
|
n.MOBILE_COLUMN_SPACING_LABEL,
|
|
141
|
-
i && a &&
|
|
141
|
+
i && a && c
|
|
142
142
|
), this.api.setVisibility(n.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(n.MOBILE_ROW_SPACING_LABEL, i && a);
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
@@ -165,20 +165,20 @@ class j extends R {
|
|
|
165
165
|
*/
|
|
166
166
|
_getStoredColumnSpacing() {
|
|
167
167
|
if (!this.currentNode)
|
|
168
|
-
return
|
|
169
|
-
const t = this.currentNode.querySelector(
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
if (!
|
|
173
|
-
return
|
|
174
|
-
const y =
|
|
175
|
-
return y.length < 2 ?
|
|
168
|
+
return g;
|
|
169
|
+
const t = this.currentNode.querySelector(S) ?? this.currentNode;
|
|
170
|
+
if (f(this.currentNode) === "grid") {
|
|
171
|
+
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = L(l, "padding");
|
|
172
|
+
if (!d)
|
|
173
|
+
return g;
|
|
174
|
+
const y = d.trim().split(/\s+/);
|
|
175
|
+
return y.length < 2 ? g : I(y[1], g / 2) * 2;
|
|
176
176
|
}
|
|
177
|
-
const o = t.querySelector(".product-card-wrapper"), i =
|
|
177
|
+
const o = t.querySelector(".product-card-wrapper") ?? null, i = V(o), a = L(i, "padding");
|
|
178
178
|
if (!a)
|
|
179
|
-
return
|
|
179
|
+
return g;
|
|
180
180
|
const r = a.trim().split(/\s+/);
|
|
181
|
-
return r.length < 2 ?
|
|
181
|
+
return r.length < 2 ? g : I(r[1], g / 2) * 2;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -187,8 +187,8 @@ class j extends R {
|
|
|
187
187
|
_getStoredRowSpacing() {
|
|
188
188
|
if (!this.currentNode)
|
|
189
189
|
return E;
|
|
190
|
-
const e = (this.currentNode.querySelector(
|
|
191
|
-
return
|
|
190
|
+
const e = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, o = L(e, "height");
|
|
191
|
+
return I(o, E);
|
|
192
192
|
}
|
|
193
193
|
// ========================================================================
|
|
194
194
|
// Desktop Spacing Handlers
|
|
@@ -205,17 +205,18 @@ class j extends R {
|
|
|
205
205
|
this.currentNode,
|
|
206
206
|
{ columnSpacing: t },
|
|
207
207
|
`Changed column spacing to ${t}px`
|
|
208
|
-
), this._storeDataAttribute(
|
|
209
|
-
const o = p.getConfig(this.currentNode).layout ||
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
).forEach((
|
|
213
|
-
i.modifyHtml(
|
|
208
|
+
), this._storeDataAttribute(A.COLUMN_SPACING, t);
|
|
209
|
+
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(S);
|
|
210
|
+
c && (o === "grid" ? Array.from(
|
|
211
|
+
c.querySelectorAll(".attribute-cell")
|
|
212
|
+
).forEach((l) => {
|
|
213
|
+
i.modifyHtml(l).setStyle("padding", r);
|
|
214
214
|
}) : Array.from(
|
|
215
|
-
|
|
216
|
-
).forEach((
|
|
217
|
-
"parent" in
|
|
218
|
-
|
|
215
|
+
c.querySelectorAll(".product-card-wrapper")
|
|
216
|
+
).forEach((l) => {
|
|
217
|
+
const d = "parent" in l ? l.parent() : void 0;
|
|
218
|
+
d && i.modifyHtml(d).setStyle("padding", r);
|
|
219
|
+
}), i.apply(new m(`Update column spacing to ${t}px`)));
|
|
219
220
|
}
|
|
220
221
|
/**
|
|
221
222
|
* Handles row spacing changes for desktop.
|
|
@@ -229,8 +230,8 @@ class j extends R {
|
|
|
229
230
|
this.currentNode,
|
|
230
231
|
{ rowSpacing: t },
|
|
231
232
|
`Changed row spacing to ${t}px`
|
|
232
|
-
), this._storeDataAttribute(
|
|
233
|
-
const e = this.currentNode.querySelector(
|
|
233
|
+
), this._storeDataAttribute(A.ROW_SPACING, t);
|
|
234
|
+
const e = this.currentNode.querySelector(S);
|
|
234
235
|
if (!e)
|
|
235
236
|
return;
|
|
236
237
|
const o = Array.from(
|
|
@@ -241,7 +242,7 @@ class j extends R {
|
|
|
241
242
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
242
243
|
o.forEach((r) => {
|
|
243
244
|
i.modifyHtml(r).setStyle("height", a);
|
|
244
|
-
}), i.apply(new
|
|
245
|
+
}), i.apply(new m(`Update row spacing to ${t}px`));
|
|
245
246
|
}
|
|
246
247
|
// ========================================================================
|
|
247
248
|
// Mobile Spacing Handlers
|
|
@@ -258,17 +259,18 @@ class j extends R {
|
|
|
258
259
|
this.currentNode,
|
|
259
260
|
{ mobileColumnSpacing: t },
|
|
260
261
|
`Changed mobile column spacing to ${t}px`
|
|
261
|
-
), this._storeDataAttribute(
|
|
262
|
-
const o = p.getConfig(this.currentNode).layout ||
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
).forEach((
|
|
266
|
-
i.modifyHtml(
|
|
262
|
+
), this._storeDataAttribute(A.MOBILE_COLUMN_SPACING, t);
|
|
263
|
+
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(M);
|
|
264
|
+
c && (o === "grid" ? Array.from(
|
|
265
|
+
c.querySelectorAll(".attribute-cell")
|
|
266
|
+
).forEach((l) => {
|
|
267
|
+
i.modifyHtml(l).setStyle("padding", r);
|
|
267
268
|
}) : Array.from(
|
|
268
|
-
|
|
269
|
-
).forEach((
|
|
270
|
-
"parent" in
|
|
271
|
-
|
|
269
|
+
c.querySelectorAll(".product-card-wrapper")
|
|
270
|
+
).forEach((l) => {
|
|
271
|
+
const d = "parent" in l ? l.parent() : void 0;
|
|
272
|
+
d && i.modifyHtml(d).setStyle("padding", r);
|
|
273
|
+
}), i.apply(new m(`Update mobile column spacing to ${t}px`)));
|
|
272
274
|
}
|
|
273
275
|
/**
|
|
274
276
|
* Handles row spacing changes for mobile.
|
|
@@ -282,7 +284,7 @@ class j extends R {
|
|
|
282
284
|
this.currentNode,
|
|
283
285
|
{ mobileRowSpacing: t },
|
|
284
286
|
`Changed mobile row spacing to ${t}px`
|
|
285
|
-
), this._storeDataAttribute(
|
|
287
|
+
), this._storeDataAttribute(A.MOBILE_ROW_SPACING, t);
|
|
286
288
|
const e = this.currentNode.querySelector(M);
|
|
287
289
|
if (!e)
|
|
288
290
|
return;
|
|
@@ -294,7 +296,7 @@ class j extends R {
|
|
|
294
296
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
295
297
|
o.forEach((r) => {
|
|
296
298
|
i.modifyHtml(r).setStyle("height", a);
|
|
297
|
-
}), i.apply(new
|
|
299
|
+
}), i.apply(new m(`Update mobile row spacing to ${t}px`));
|
|
298
300
|
}
|
|
299
301
|
// ========================================================================
|
|
300
302
|
// Data Attribute Storage
|
|
@@ -304,7 +306,7 @@ class j extends R {
|
|
|
304
306
|
*/
|
|
305
307
|
_storeDataAttribute(t, e) {
|
|
306
308
|
const o = B(this.currentNode);
|
|
307
|
-
o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new
|
|
309
|
+
o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new m(`Store ${t}`));
|
|
308
310
|
}
|
|
309
311
|
// ========================================================================
|
|
310
312
|
// Event Listeners
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, ContainerControls as C, TextControls as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { BLOCK_ID as U } from "./block.js";
|
|
3
|
-
import { RecommendationBlockId as
|
|
3
|
+
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
@@ -14,7 +14,7 @@ import "./controls/image/index.js";
|
|
|
14
14
|
import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
15
15
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
16
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
|
-
import { SYNC_INFO_MESSAGE_CONTROL_ID as
|
|
17
|
+
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
18
18
|
class Z extends E {
|
|
19
19
|
registerBlockControls(I) {
|
|
20
20
|
I[U] = [
|
|
@@ -39,11 +39,11 @@ class Z extends E {
|
|
|
39
39
|
B
|
|
40
40
|
]
|
|
41
41
|
).withLabel(this.api.translate("Card Composition"))
|
|
42
|
-
], I[
|
|
42
|
+
], I[S.NAME] = [
|
|
43
43
|
new _(
|
|
44
44
|
O.SETTINGS,
|
|
45
45
|
[
|
|
46
|
-
|
|
46
|
+
N,
|
|
47
47
|
T.NAME_STYLE,
|
|
48
48
|
T.NAME_ALIGN,
|
|
49
49
|
T.NAME_TEXT_TRIM,
|
|
@@ -59,11 +59,11 @@ class Z extends E {
|
|
|
59
59
|
T.NAME_COLOR
|
|
60
60
|
]
|
|
61
61
|
)
|
|
62
|
-
], I[
|
|
62
|
+
], I[S.PRICE] = [
|
|
63
63
|
new _(
|
|
64
64
|
O.SETTINGS,
|
|
65
65
|
[
|
|
66
|
-
|
|
66
|
+
N,
|
|
67
67
|
T.PRICE_STYLE,
|
|
68
68
|
T.PRICE_ALIGN,
|
|
69
69
|
T.PRICE_PADDINGS
|
|
@@ -78,11 +78,11 @@ class Z extends E {
|
|
|
78
78
|
T.PRICE_COLOR
|
|
79
79
|
]
|
|
80
80
|
)
|
|
81
|
-
], I[
|
|
81
|
+
], I[S.OLD_PRICE] = [
|
|
82
82
|
new _(
|
|
83
83
|
O.SETTINGS,
|
|
84
84
|
[
|
|
85
|
-
|
|
85
|
+
N,
|
|
86
86
|
T.OLD_PRICE_STYLE,
|
|
87
87
|
T.OLD_PRICE_ALIGN,
|
|
88
88
|
T.OLD_PRICE_PADDINGS
|
|
@@ -97,11 +97,11 @@ class Z extends E {
|
|
|
97
97
|
T.OLD_PRICE_COLOR
|
|
98
98
|
]
|
|
99
99
|
)
|
|
100
|
-
], I[
|
|
100
|
+
], I[S.OMNIBUS_PRICE] = [
|
|
101
101
|
new _(
|
|
102
102
|
O.SETTINGS,
|
|
103
103
|
[
|
|
104
|
-
|
|
104
|
+
N,
|
|
105
105
|
T.OMNIBUS_PRICE_TEXT_BEFORE,
|
|
106
106
|
T.OMNIBUS_PRICE_TEXT_AFTER,
|
|
107
107
|
T.OMNIBUS_PRICE_STYLE,
|
|
@@ -118,11 +118,11 @@ class Z extends E {
|
|
|
118
118
|
T.OMNIBUS_PRICE_COLOR
|
|
119
119
|
]
|
|
120
120
|
)
|
|
121
|
-
], I[
|
|
121
|
+
], I[S.OMNIBUS_DISCOUNT] = [
|
|
122
122
|
new _(
|
|
123
123
|
O.SETTINGS,
|
|
124
124
|
[
|
|
125
|
-
|
|
125
|
+
N,
|
|
126
126
|
T.OMNIBUS_DISCOUNT_TEXT_BEFORE,
|
|
127
127
|
T.OMNIBUS_DISCOUNT_TEXT_AFTER,
|
|
128
128
|
T.OMNIBUS_DISCOUNT_STYLE,
|
|
@@ -139,11 +139,11 @@ class Z extends E {
|
|
|
139
139
|
T.OMNIBUS_DISCOUNT_COLOR
|
|
140
140
|
]
|
|
141
141
|
)
|
|
142
|
-
], I[
|
|
142
|
+
], I[S.BUTTON] = [
|
|
143
143
|
new _(
|
|
144
144
|
O.SETTINGS,
|
|
145
145
|
[
|
|
146
|
-
|
|
146
|
+
N,
|
|
147
147
|
T.BUTTON_TEXT,
|
|
148
148
|
T.BUTTON_ALIGN,
|
|
149
149
|
T.BUTTON_PADDINGS,
|
|
@@ -162,12 +162,13 @@ class Z extends E {
|
|
|
162
162
|
T.BUTTON_BORDER
|
|
163
163
|
]
|
|
164
164
|
)
|
|
165
|
-
], I[
|
|
165
|
+
], I[S.CUSTOM_ATTRIBUTE] = [
|
|
166
166
|
new _(
|
|
167
167
|
O.SETTINGS,
|
|
168
168
|
[
|
|
169
169
|
T.CUSTOM_ATTR_STYLE,
|
|
170
170
|
T.CUSTOM_ATTR_ALIGN,
|
|
171
|
+
T.CUSTOM_ATTR_TEXT_TRIM,
|
|
171
172
|
T.CUSTOM_ATTR_PADDINGS
|
|
172
173
|
]
|
|
173
174
|
),
|
|
@@ -180,11 +181,11 @@ class Z extends E {
|
|
|
180
181
|
T.CUSTOM_ATTR_COLOR
|
|
181
182
|
]
|
|
182
183
|
)
|
|
183
|
-
], I[
|
|
184
|
+
], I[S.IMAGE] = [
|
|
184
185
|
new _(
|
|
185
186
|
O.SETTINGS,
|
|
186
187
|
[
|
|
187
|
-
|
|
188
|
+
N,
|
|
188
189
|
T.IMAGE_SIZE,
|
|
189
190
|
T.IMAGE_MARGINS
|
|
190
191
|
]
|