@useinsider/guido 1.0.3-beta.57a56eb → 1.0.3-beta.59b0ae1
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 +3 -140
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +73 -79
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
- package/dist/components/organisms/header/RightSlot.vue.js +11 -11
- package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
- package/dist/composables/useGuidoActions.js +9 -19
- package/dist/composables/useStripo.js +57 -44
- package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
- package/dist/enums/defaults.js +9 -16
- package/dist/enums/unsubscribe.js +25 -27
- package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +147 -68
- package/dist/extensions/Blocks/Recommendation/constants.js +6 -0
- package/dist/extensions/Blocks/Recommendation/control.js +4 -10
- package/dist/extensions/Blocks/Recommendation/controls/index.js +175 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -39
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +45 -45
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +17 -16
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +47 -40
- package/dist/extensions/Blocks/controlFactories.js +223 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +60 -60
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +1 -1
- package/dist/src/@types/generic.d.ts +6 -36
- package/dist/src/components/Guido.vue.d.ts +2 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useGuidoActions.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +50 -3
- package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +43 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +7 -6
- package/dist/src/extensions/Blocks/controlFactories.d.ts +91 -0
- package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
- package/dist/src/stores/config.d.ts +2 -9
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +1 -1
- package/dist/src/stores/onboarding.d.ts +1 -1
- package/dist/src/stores/preview.d.ts +1 -1
- package/dist/src/stores/recommendation.d.ts +1 -1
- package/dist/src/stores/save-as-template.d.ts +1 -1
- package/dist/src/stores/toaster.d.ts +1 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -1
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/genericUtil.d.ts +0 -1
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/static/styles/components/wide-panel.css.js +0 -4
- package/dist/stores/config.js +5 -5
- package/dist/stores/dynamic-content.js +2 -2
- package/dist/stores/editor.js +1 -1
- package/dist/stores/onboarding.js +27 -27
- package/dist/stores/preview.js +1 -1
- package/dist/stores/recommendation.js +3 -3
- package/dist/stores/save-as-template.js +2 -2
- package/dist/stores/toaster.js +1 -1
- package/dist/stores/unsubscribe.js +1 -1
- package/dist/stores/version-history.js +4 -4
- package/dist/utils/genericUtil.js +9 -20
- package/package.json +2 -2
- package/dist/composables/useBlocksConfig.js +0 -49
- 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/src/composables/useBlocksConfig.d.ts +0 -11
- 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/utils/environmentUtil.d.ts +0 -5
- package/dist/utils/environmentUtil.js +0 -4
|
@@ -1,103 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
var y = (n, o, i) => o in n ? m(n, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[o] = i;
|
|
3
|
-
var a = (n, o, i) => y(n, typeof o != "symbol" ? o + "" : o, i);
|
|
4
|
-
import { ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
1
|
+
import { ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
2
|
import { CommonControl as b } from "../common-control.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{ key:
|
|
9
|
-
{ key:
|
|
10
|
-
{ key:
|
|
11
|
-
{ key:
|
|
3
|
+
import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_PRICE as m, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_BUTTON as h } from "./constants.js";
|
|
4
|
+
const C = "ui-elements-recommendation-card-composition", l = ".recommendation-attribute-row", g = "tr.recommendation-product-row", u = "data-card-composition", a = "data-attribute-type", c = "data-visibility", s = [
|
|
5
|
+
{ key: _, label: "Product Image", visible: !0 },
|
|
6
|
+
{ key: y, label: "Product Name", visible: !0 },
|
|
7
|
+
{ key: m, label: "Product Price", visible: !0 },
|
|
8
|
+
{ key: T, label: "Product Original Price", visible: !0 },
|
|
9
|
+
{ key: h, label: "Product Button", visible: !0 }
|
|
12
10
|
];
|
|
13
|
-
class
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
a(this, "currentComposition", []);
|
|
17
|
-
a(this, "currentVisibility", {});
|
|
18
|
-
}
|
|
11
|
+
class V extends b {
|
|
19
12
|
getId() {
|
|
20
|
-
return
|
|
13
|
+
return C;
|
|
21
14
|
}
|
|
22
15
|
getTemplate() {
|
|
23
|
-
const
|
|
24
|
-
key:
|
|
25
|
-
label:
|
|
26
|
-
content:
|
|
27
|
-
<div style="display: flex; align-items: center; justify-content: space-between;
|
|
28
|
-
padding: 8px; gap: 8px;">
|
|
29
|
-
<span style="flex: 1;">${e.label}</span>
|
|
30
|
-
${this._GuToggle(`visibility_${e.key}`)}
|
|
31
|
-
</div>
|
|
32
|
-
`
|
|
16
|
+
const t = s.map((i) => ({
|
|
17
|
+
key: i.key,
|
|
18
|
+
label: i.label,
|
|
19
|
+
content: this._createItemContent(i.label, i.key)
|
|
33
20
|
}));
|
|
34
21
|
return `
|
|
35
22
|
<div class="container">
|
|
36
23
|
${this._GuLabel({ text: "Card Element Order & Visibility" })}
|
|
37
|
-
${this._GuOrderable("cardComposition",
|
|
24
|
+
${this._GuOrderable("cardComposition", t)}
|
|
38
25
|
</div>
|
|
39
26
|
`;
|
|
40
27
|
}
|
|
41
28
|
onRender() {
|
|
42
|
-
this._initializeComposition(), this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
this._initializeComposition(), this._registerValueChangeListeners();
|
|
30
|
+
}
|
|
31
|
+
onTemplateNodeUpdated(t) {
|
|
32
|
+
super.onTemplateNodeUpdated(t), this._initializeComposition();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates the HTML content for an orderable item with label and toggle
|
|
36
|
+
*/
|
|
37
|
+
_createItemContent(t, i) {
|
|
38
|
+
return `
|
|
39
|
+
<div style="display: flex; align-items: center; justify-content: space-between;
|
|
40
|
+
padding: 8px; gap: 8px;">
|
|
41
|
+
<span style="flex: 1;">${t}</span>
|
|
42
|
+
${this._GuToggle(`visibility_${i}`)}
|
|
43
|
+
</div>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Registers event listeners for composition and visibility changes
|
|
48
|
+
*/
|
|
49
|
+
_registerValueChangeListeners() {
|
|
50
|
+
this.api.onValueChanged("cardComposition", (t) => {
|
|
51
|
+
this._applyCompositionToBlock(t);
|
|
52
|
+
}), s.forEach((t) => {
|
|
53
|
+
this.api.onValueChanged(`visibility_${t.key}`, (i) => {
|
|
54
|
+
this._applyVisibilityToBlock(t.key, i);
|
|
47
55
|
});
|
|
48
56
|
});
|
|
49
57
|
}
|
|
50
|
-
onTemplateNodeUpdated(i) {
|
|
51
|
-
super.onTemplateNodeUpdated(i), this._initializeComposition();
|
|
52
|
-
}
|
|
53
58
|
/**
|
|
54
|
-
*
|
|
59
|
+
* Initializes composition order and visibility state from the current node
|
|
55
60
|
*/
|
|
56
61
|
_initializeComposition() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (i && "getAttribute" in i && (e = i.getAttribute("data-card-composition"), l = i.getAttribute("data-card-visibility")), e) {
|
|
61
|
-
const t = e.split(",").filter(Boolean), r = s.map((c) => c.key);
|
|
62
|
-
t.every((c) => r.includes(c)) && t.length > 0 ? this.currentComposition = t : this.currentComposition = r;
|
|
63
|
-
} else
|
|
64
|
-
this.currentComposition = s.map((t) => t.key);
|
|
65
|
-
if (l)
|
|
66
|
-
try {
|
|
67
|
-
const t = JSON.parse(l);
|
|
68
|
-
this.currentVisibility = t;
|
|
69
|
-
} catch {
|
|
70
|
-
this.currentVisibility = s.reduce((t, r) => (t[r.key] = r.visible, t), {});
|
|
71
|
-
}
|
|
72
|
-
else
|
|
73
|
-
this.currentVisibility = s.reduce((t, r) => (t[r.key] = r.visible, t), {});
|
|
74
|
-
const d = {
|
|
75
|
-
cardComposition: this.currentComposition
|
|
62
|
+
const t = this._readCompositionFromNode(), i = this._readVisibilityFromRows(), e = {
|
|
63
|
+
cardComposition: t,
|
|
64
|
+
...this._buildVisibilityValues(i)
|
|
76
65
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
this.api.updateValues(e);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reads composition order from node's data-card-composition attribute
|
|
70
|
+
* Falls back to default order if attribute is not present
|
|
71
|
+
*/
|
|
72
|
+
_readCompositionFromNode() {
|
|
73
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
74
|
+
return s.map((i) => i.key);
|
|
75
|
+
const t = this.currentNode.getAttribute(u);
|
|
76
|
+
return t ? t.split(",").filter(Boolean) : s.map((i) => i.key);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Builds visibility values object from the visibility map
|
|
80
|
+
*/
|
|
81
|
+
_buildVisibilityValues(t) {
|
|
82
|
+
return s.reduce((i, e) => (i[`visibility_${e.key}`] = t[e.key] ?? !0, i), {});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Read visibility state from individual row elements' data-visibility attributes
|
|
86
|
+
* This ensures toggles reflect the actual DOM state
|
|
87
|
+
*/
|
|
88
|
+
_readVisibilityFromRows() {
|
|
89
|
+
if (!this.currentNode)
|
|
90
|
+
return this._getDefaultVisibilities();
|
|
91
|
+
const t = Array.from(this.currentNode.querySelectorAll(l));
|
|
92
|
+
console.debug("_readVisibilityFromRows - found attribute rows:", t.length);
|
|
93
|
+
const i = this._extractVisibilityFromRows(t);
|
|
94
|
+
return this._mergeWithDefaults(i);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns default visibility values for all items
|
|
98
|
+
*/
|
|
99
|
+
_getDefaultVisibilities() {
|
|
100
|
+
return s.reduce((t, i) => (t[i.key] = i.visible, t), {});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Extracts visibility values from DOM nodes
|
|
104
|
+
*/
|
|
105
|
+
_extractVisibilityFromRows(t) {
|
|
106
|
+
const i = {};
|
|
107
|
+
return t.forEach((e) => {
|
|
108
|
+
if (!("getAttribute" in e))
|
|
109
|
+
return;
|
|
110
|
+
const o = e.getAttribute(a), r = e.getAttribute(c);
|
|
111
|
+
o && r !== null && (i[o] = this._parseVisibilityValue(r), console.debug(
|
|
112
|
+
`_readVisibilityFromRows - ${o}: ${i[o]} (raw: ${r})`
|
|
113
|
+
));
|
|
114
|
+
}), i;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Parses visibility value from string to boolean
|
|
118
|
+
* Accepts "1", "true" as true, everything else as false
|
|
119
|
+
*/
|
|
120
|
+
_parseVisibilityValue(t) {
|
|
121
|
+
return t === "1" || t === "true";
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Merges extracted visibilities with default values for missing keys
|
|
125
|
+
*/
|
|
126
|
+
_mergeWithDefaults(t) {
|
|
127
|
+
return s.forEach((i) => {
|
|
128
|
+
i.key in t || (t[i.key] = i.visible, console.debug(`_readVisibilityFromRows - ${i.key}: using default ${i.visible}`));
|
|
129
|
+
}), t;
|
|
80
130
|
}
|
|
81
131
|
/**
|
|
82
132
|
* Apply the reordered composition to the block's HTML structure
|
|
133
|
+
* Updates the data-card-composition attribute and reorders product attributes
|
|
83
134
|
*/
|
|
84
|
-
_applyCompositionToBlock(
|
|
135
|
+
_applyCompositionToBlock(t) {
|
|
136
|
+
if (console.debug("_applyCompositionToBlock - composition:", t), !this.currentNode) {
|
|
137
|
+
console.debug("_applyCompositionToBlock - no current node");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(u, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Reorders attribute rows within each product row based on composition order
|
|
144
|
+
*/
|
|
145
|
+
_reorderProductAttributes(t) {
|
|
85
146
|
if (!this.currentNode)
|
|
86
147
|
return;
|
|
87
|
-
const
|
|
88
|
-
|
|
148
|
+
const i = this.currentNode.querySelectorAll(g);
|
|
149
|
+
i != null && i.length && i.forEach((e) => {
|
|
150
|
+
const o = this._buildCompositionHtml(e, t);
|
|
151
|
+
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(o).apply(new n("Reorder product attributes"));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Builds HTML string with attributes ordered according to composition
|
|
156
|
+
*/
|
|
157
|
+
_buildCompositionHtml(t, i) {
|
|
158
|
+
return i.reduce((e, o) => {
|
|
159
|
+
const r = t.querySelector(`${l}[${a}="${o}"]`);
|
|
160
|
+
return r && "getOuterHTML" in r ? e + r.getOuterHTML() : e;
|
|
161
|
+
}, "");
|
|
89
162
|
}
|
|
90
163
|
/**
|
|
91
164
|
* Apply visibility changes to the block's HTML structure
|
|
165
|
+
* Updates display style and data-visibility attribute for all matching rows
|
|
92
166
|
*/
|
|
93
|
-
_applyVisibilityToBlock() {
|
|
94
|
-
if (!this.currentNode)
|
|
167
|
+
_applyVisibilityToBlock(t, i) {
|
|
168
|
+
if (console.debug("_applyVisibilityToBlock", t, i), !this.currentNode)
|
|
95
169
|
return;
|
|
96
|
-
const
|
|
97
|
-
|
|
170
|
+
const e = this.currentNode.querySelectorAll(`${l}[${a}="${t}"]`);
|
|
171
|
+
if (!(e != null && e.length))
|
|
172
|
+
return;
|
|
173
|
+
const o = i ? "table-row" : "none", r = i ? "1" : "0", d = `Set ${t} visibility to ${i ? "visible" : "hidden"}`;
|
|
174
|
+
e.forEach((p) => {
|
|
175
|
+
this.api.getDocumentModifier().modifyHtml(p).setStyle("display", o).setAttribute(c, r).apply(new n(d));
|
|
176
|
+
});
|
|
98
177
|
}
|
|
99
178
|
}
|
|
100
179
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
180
|
+
C as COMPOSITION_CONTROL_BLOCK_ID,
|
|
181
|
+
V as RecommendationCardCompositionControl
|
|
103
182
|
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
const _ = "productImage", l = "productName", t = "productPrice", T = "productOldPrice", b = "productButton";
|
|
1
2
|
var o = /* @__PURE__ */ ((c) => (c.BUTTON = "recommendation-block-button", c.NAME = "recommendation-block-name", c.PRICE = "recommendation-block-price", c.OLD_PRICE = "recommendation-block-old-price", c.IMAGE = "recommendation-block-image", c))(o || {}), r = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c))(r || {});
|
|
2
3
|
export {
|
|
4
|
+
b as ATTR_PRODUCT_BUTTON,
|
|
5
|
+
_ as ATTR_PRODUCT_IMAGE,
|
|
6
|
+
l as ATTR_PRODUCT_NAME,
|
|
7
|
+
T as ATTR_PRODUCT_OLD_PRICE,
|
|
8
|
+
t as ATTR_PRODUCT_PRICE,
|
|
3
9
|
o as RecommendationBlockId,
|
|
4
10
|
r as RecommendationControlId
|
|
5
11
|
};
|
|
@@ -2,8 +2,8 @@ var _ = Object.defineProperty;
|
|
|
2
2
|
var R = (s, n, e) => n in s ? _(s, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[n] = e;
|
|
3
3
|
var r = (s, n, e) => R(s, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { currencyDecimalCounts as l, currencyOperators as c, currencyLocationMaps as h } from "../../../enums/extensions/recommendationBlock.js";
|
|
5
|
-
import { UEAttr as m, ModificationDescription as
|
|
6
|
-
import { CommonControl as
|
|
5
|
+
import { UEAttr as m, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as S } from "../common-control.js";
|
|
7
7
|
import { useRecommendationExtensionStore as O } from "./store/recommendation.js";
|
|
8
8
|
import { prepareProductRows as p } from "./templates/blockTemplate.js";
|
|
9
9
|
import { DEFAULT_CARD_COMPOSITION as C, getDefaultProducts as E } from "./templates/templateUtils.js";
|
|
@@ -24,7 +24,7 @@ const L = "ui-elements-recommendation-block", t = {
|
|
|
24
24
|
SHUFFLE_PRODUCTS: "shuffleProducts",
|
|
25
25
|
RESPONSIVE: "unresponsive"
|
|
26
26
|
};
|
|
27
|
-
class b extends
|
|
27
|
+
class b extends S {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
30
|
r(this, "store", O());
|
|
@@ -212,12 +212,6 @@ class b extends g {
|
|
|
212
212
|
])}
|
|
213
213
|
`;
|
|
214
214
|
}
|
|
215
|
-
_onFilterChange(e) {
|
|
216
|
-
this.currentNode && this.store.$patch({
|
|
217
|
-
filterStatus: e,
|
|
218
|
-
filterSelectionDrawerStatus: e
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
215
|
_onFilterSelectClick() {
|
|
222
216
|
this.store.$patch({
|
|
223
217
|
filterSelectionDrawerStatus: !0
|
|
@@ -251,7 +245,7 @@ class b extends g {
|
|
|
251
245
|
return;
|
|
252
246
|
}
|
|
253
247
|
const o = this.store.recommendationProducts.length > 0 ? this.store.recommendationProducts : E(), { cardsInRow: i } = this.store.recommendationConfigs, a = this._getCardComposition(), u = p(o, i, a);
|
|
254
|
-
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(u).apply(new
|
|
248
|
+
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(u).apply(new g("Updated product"));
|
|
255
249
|
}
|
|
256
250
|
_onCurrencyConfigChange(e, o) {
|
|
257
251
|
this.currentNode && this.store.$patch({
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { createTextAlignControl as r, createTextColorControl as e, createTextSizeControl as C, createTextStyleControl as l, createTextFontFamilyControl as c, createTextBackgroundColorControl as T, createPaddingsControl as O, createButtonAlignControl as N, createButtonBorderControl as E, createButtonBorderRadiusControl as _, createButtonColorControl as I, createButtonFontFamilyControl as a, createButtonMarginsControl as B, createButtonPaddingsControl as i, createButtonTextControl as P, createButtonTextSizeControl as R, createButtonTextStyleAndFontColorControl as s, createButtonFitToContainerControl as A, createImageSizeControl as d, createImageMarginsControl as L } from "../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o, RecommendationControlId as t } from "../constants.js";
|
|
3
|
+
const n = ".ins-recommendation-product-container", D = r(
|
|
4
|
+
t.NAME_ALIGN,
|
|
5
|
+
o.NAME,
|
|
6
|
+
n
|
|
7
|
+
), M = e(
|
|
8
|
+
t.NAME_COLOR,
|
|
9
|
+
o.NAME,
|
|
10
|
+
n
|
|
11
|
+
), m = C(
|
|
12
|
+
t.NAME_SIZE,
|
|
13
|
+
o.NAME,
|
|
14
|
+
n
|
|
15
|
+
), F = l(
|
|
16
|
+
t.NAME_STYLE,
|
|
17
|
+
o.NAME,
|
|
18
|
+
n
|
|
19
|
+
), U = c(
|
|
20
|
+
t.NAME_FONT_FAMILY,
|
|
21
|
+
o.NAME,
|
|
22
|
+
n
|
|
23
|
+
), g = T(
|
|
24
|
+
t.NAME_BACKGROUND,
|
|
25
|
+
o.NAME,
|
|
26
|
+
n
|
|
27
|
+
), G = O(
|
|
28
|
+
t.NAME_PADDINGS,
|
|
29
|
+
o.NAME,
|
|
30
|
+
n
|
|
31
|
+
), x = r(
|
|
32
|
+
t.PRICE_ALIGN,
|
|
33
|
+
o.PRICE,
|
|
34
|
+
n
|
|
35
|
+
), y = e(
|
|
36
|
+
t.PRICE_COLOR,
|
|
37
|
+
o.PRICE,
|
|
38
|
+
n
|
|
39
|
+
), z = C(
|
|
40
|
+
t.PRICE_SIZE,
|
|
41
|
+
o.PRICE,
|
|
42
|
+
n
|
|
43
|
+
), Y = l(
|
|
44
|
+
t.PRICE_STYLE,
|
|
45
|
+
o.PRICE,
|
|
46
|
+
n
|
|
47
|
+
), k = c(
|
|
48
|
+
t.PRICE_FONT_FAMILY,
|
|
49
|
+
o.PRICE,
|
|
50
|
+
n
|
|
51
|
+
), Z = T(
|
|
52
|
+
t.PRICE_BACKGROUND,
|
|
53
|
+
o.PRICE,
|
|
54
|
+
n
|
|
55
|
+
), p = O(
|
|
56
|
+
t.PRICE_PADDINGS,
|
|
57
|
+
o.PRICE,
|
|
58
|
+
n
|
|
59
|
+
), K = r(
|
|
60
|
+
t.OLD_PRICE_ALIGN,
|
|
61
|
+
o.OLD_PRICE,
|
|
62
|
+
n
|
|
63
|
+
), X = e(
|
|
64
|
+
t.OLD_PRICE_COLOR,
|
|
65
|
+
o.OLD_PRICE,
|
|
66
|
+
n
|
|
67
|
+
), f = C(
|
|
68
|
+
t.OLD_PRICE_SIZE,
|
|
69
|
+
o.OLD_PRICE,
|
|
70
|
+
n
|
|
71
|
+
), b = l(
|
|
72
|
+
t.OLD_PRICE_STYLE,
|
|
73
|
+
o.OLD_PRICE,
|
|
74
|
+
n
|
|
75
|
+
), h = c(
|
|
76
|
+
t.OLD_PRICE_FONT_FAMILY,
|
|
77
|
+
o.OLD_PRICE,
|
|
78
|
+
n
|
|
79
|
+
), j = T(
|
|
80
|
+
t.OLD_PRICE_BACKGROUND,
|
|
81
|
+
o.OLD_PRICE,
|
|
82
|
+
n
|
|
83
|
+
), q = O(
|
|
84
|
+
t.OLD_PRICE_PADDINGS,
|
|
85
|
+
o.OLD_PRICE,
|
|
86
|
+
n
|
|
87
|
+
), v = N(
|
|
88
|
+
t.BUTTON_ALIGN,
|
|
89
|
+
o.BUTTON,
|
|
90
|
+
n
|
|
91
|
+
), w = E(
|
|
92
|
+
t.BUTTON_BORDER,
|
|
93
|
+
o.BUTTON,
|
|
94
|
+
n
|
|
95
|
+
), H = _(
|
|
96
|
+
t.BUTTON_BORDER_RADIUS,
|
|
97
|
+
o.BUTTON,
|
|
98
|
+
n
|
|
99
|
+
), J = I(
|
|
100
|
+
t.BUTTON_COLOR,
|
|
101
|
+
o.BUTTON,
|
|
102
|
+
n
|
|
103
|
+
), Q = a(
|
|
104
|
+
t.BUTTON_FONT_FAMILY,
|
|
105
|
+
o.BUTTON,
|
|
106
|
+
n
|
|
107
|
+
), V = B(
|
|
108
|
+
t.BUTTON_MARGINS,
|
|
109
|
+
o.BUTTON,
|
|
110
|
+
n
|
|
111
|
+
), W = i(
|
|
112
|
+
t.BUTTON_PADDINGS,
|
|
113
|
+
o.BUTTON,
|
|
114
|
+
n
|
|
115
|
+
), $ = P(
|
|
116
|
+
t.BUTTON_TEXT,
|
|
117
|
+
o.BUTTON,
|
|
118
|
+
n
|
|
119
|
+
), oo = R(
|
|
120
|
+
t.BUTTON_TEXT_SIZE,
|
|
121
|
+
o.BUTTON,
|
|
122
|
+
n
|
|
123
|
+
), to = s(
|
|
124
|
+
t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
125
|
+
o.BUTTON,
|
|
126
|
+
n
|
|
127
|
+
), no = A(
|
|
128
|
+
t.BUTTON_FIT_TO_CONTENT,
|
|
129
|
+
o.BUTTON,
|
|
130
|
+
n
|
|
131
|
+
), ro = d(
|
|
132
|
+
t.IMAGE_SIZE,
|
|
133
|
+
o.IMAGE,
|
|
134
|
+
n
|
|
135
|
+
), eo = L(
|
|
136
|
+
t.IMAGE_MARGINS,
|
|
137
|
+
o.IMAGE,
|
|
138
|
+
n
|
|
139
|
+
);
|
|
140
|
+
export {
|
|
141
|
+
v as ButtonAlignControl,
|
|
142
|
+
w as ButtonBorderControl,
|
|
143
|
+
H as ButtonBorderRadiusControl,
|
|
144
|
+
J as ButtonColorControl,
|
|
145
|
+
no as ButtonFitToContentControl,
|
|
146
|
+
Q as ButtonFontFamilyControl,
|
|
147
|
+
V as ButtonMarginsControl,
|
|
148
|
+
W as ButtonPaddingsControl,
|
|
149
|
+
$ as ButtonTextControl,
|
|
150
|
+
oo as ButtonTextSizeControl,
|
|
151
|
+
to as ButtonTextStyleAndFontColorControl,
|
|
152
|
+
eo as ImageMarginsControl,
|
|
153
|
+
ro as ImageSizeControl,
|
|
154
|
+
D as NameAlignControl,
|
|
155
|
+
g as NameBackgroundControl,
|
|
156
|
+
M as NameColorControl,
|
|
157
|
+
U as NameFontFamilyControl,
|
|
158
|
+
G as NamePaddingsControl,
|
|
159
|
+
m as NameSizeControl,
|
|
160
|
+
F as NameStyleControl,
|
|
161
|
+
K as OldPriceAlignControl,
|
|
162
|
+
j as OldPriceBackgroundControl,
|
|
163
|
+
X as OldPriceColorControl,
|
|
164
|
+
h as OldPriceFontFamilyControl,
|
|
165
|
+
q as OldPricePaddingsControl,
|
|
166
|
+
f as OldPriceSizeControl,
|
|
167
|
+
b as OldPriceStyleControl,
|
|
168
|
+
x as PriceAlignControl,
|
|
169
|
+
Z as PriceBackgroundControl,
|
|
170
|
+
y as PriceColorControl,
|
|
171
|
+
k as PriceFontFamilyControl,
|
|
172
|
+
p as PricePaddingsControl,
|
|
173
|
+
z as PriceSizeControl,
|
|
174
|
+
Y as PriceStyleControl
|
|
175
|
+
};
|
|
@@ -1,45 +1,12 @@
|
|
|
1
1
|
import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { RecommendationBlock as
|
|
3
|
-
import { RecommendationCardCompositionControl as
|
|
4
|
-
import { RecommendationBlockControl as
|
|
5
|
-
import { ButtonAlignControl as d } from "./controls/
|
|
6
|
-
import { ButtonBorderControl as l } from "./controls/button/border.js";
|
|
7
|
-
import { ButtonBorderRadiusControl as m } from "./controls/button/borderRadius.js";
|
|
8
|
-
import { ButtonColorControl as i } from "./controls/button/color.js";
|
|
9
|
-
import { ButtonFitToContentControl as C } from "./controls/button/fitToContent.js";
|
|
10
|
-
import { ButtonFontFamilyControl as a } from "./controls/button/fontFamily.js";
|
|
11
|
-
import { ButtonMarginsControl as e } from "./controls/button/margins.js";
|
|
12
|
-
import { ButtonPaddingsControl as p } from "./controls/button/paddings.js";
|
|
13
|
-
import { ButtonTextControl as f } from "./controls/button/text.js";
|
|
14
|
-
import { ButtonTextSizeControl as c } from "./controls/button/textSize.js";
|
|
15
|
-
import { ButtonTextStyleAndFontColorControl as s } from "./controls/button/textStyleAndFontColor.js";
|
|
16
|
-
import { ImageMarginsControl as g } from "./controls/image/margins.js";
|
|
17
|
-
import { ImageSizeControl as B } from "./controls/image/size.js";
|
|
18
|
-
import { NameAlignControl as P } from "./controls/name/align.js";
|
|
19
|
-
import { NameBackgroundControl as u } from "./controls/name/background.js";
|
|
20
|
-
import { NameColorControl as y } from "./controls/name/color.js";
|
|
21
|
-
import { NameFontFamilyControl as S } from "./controls/name/fontFamily.js";
|
|
22
|
-
import { NamePaddingsControl as F } from "./controls/name/paddings.js";
|
|
23
|
-
import { NameSizeControl as R } from "./controls/name/size.js";
|
|
24
|
-
import { NameStyleControl as N } from "./controls/name/style.js";
|
|
25
|
-
import { OldPriceAlignControl as O } from "./controls/oldPrice/align.js";
|
|
26
|
-
import { OldPriceBackgroundControl as k } from "./controls/oldPrice/background.js";
|
|
27
|
-
import { OldPriceColorControl as x } from "./controls/oldPrice/color.js";
|
|
28
|
-
import { OldPriceFontFamilyControl as z } from "./controls/oldPrice/fontFamily.js";
|
|
29
|
-
import { OldPricePaddingsControl as A } from "./controls/oldPrice/paddings.js";
|
|
30
|
-
import { OldPriceSizeControl as I } from "./controls/oldPrice/size.js";
|
|
31
|
-
import { OldPriceStyleControl as T } from "./controls/oldPrice/style.js";
|
|
32
|
-
import { PriceAlignControl as w } from "./controls/price/align.js";
|
|
33
|
-
import { PriceBackgroundControl as h } from "./controls/price/background.js";
|
|
34
|
-
import { PriceColorControl as M } from "./controls/price/color.js";
|
|
35
|
-
import { PriceFontFamilyControl as b } from "./controls/price/fontFamily.js";
|
|
36
|
-
import { PricePaddingsControl as E } from "./controls/price/paddings.js";
|
|
37
|
-
import { PriceSizeControl as j } from "./controls/price/size.js";
|
|
38
|
-
import { PriceStyleControl as q } from "./controls/price/style.js";
|
|
2
|
+
import { RecommendationBlock as t } from "./block.js";
|
|
3
|
+
import { RecommendationCardCompositionControl as n } from "./cardCompositionControl.js";
|
|
4
|
+
import { RecommendationBlockControl as r } from "./control.js";
|
|
5
|
+
import { ButtonAlignControl as d, ButtonBorderControl as l, ButtonBorderRadiusControl as C, ButtonColorControl as a, ButtonFitToContentControl as e, ButtonFontFamilyControl as i, ButtonMarginsControl as m, ButtonPaddingsControl as c, ButtonTextControl as s, ButtonTextSizeControl as g, ButtonTextStyleAndFontColorControl as B, ImageMarginsControl as P, ImageSizeControl as u, NameAlignControl as y, NameBackgroundControl as S, NameColorControl as p, NameFontFamilyControl as F, NamePaddingsControl as f, NameSizeControl as R, NameStyleControl as N, OldPriceAlignControl as O, OldPriceBackgroundControl as k, OldPriceColorControl as x, OldPriceFontFamilyControl as z, OldPricePaddingsControl as A, OldPriceSizeControl as I, OldPriceStyleControl as T, PriceAlignControl as w, PriceBackgroundControl as h, PriceColorControl as E, PriceFontFamilyControl as M, PricePaddingsControl as b, PriceSizeControl as j, PriceStyleControl as q } from "./controls/index.js";
|
|
39
6
|
import { RecommendationIconsRegistry as v } from "./iconsRegistry.js";
|
|
40
7
|
import D from "./recommendation.css.js";
|
|
41
8
|
import { SettingsPanel as G } from "./settingsPanel.js";
|
|
42
|
-
const
|
|
9
|
+
const X = new o().addBlock(t).withSettingsPanelRegistry(G).addControl(r).addControl(d).addControl(l).addControl(C).addControl(a).addControl(e).addControl(i).addControl(m).addControl(c).addControl(s).addControl(g).addControl(B).addControl(P).addControl(u).addControl(y).addControl(S).addControl(p).addControl(F).addControl(f).addControl(R).addControl(N).addControl(O).addControl(k).addControl(x).addControl(z).addControl(A).addControl(I).addControl(T).addControl(w).addControl(h).addControl(E).addControl(M).addControl(b).addControl(j).addControl(q).addControl(n).addStyles(D).withIconsRegistry(v).build();
|
|
43
10
|
export {
|
|
44
|
-
|
|
11
|
+
X as default
|
|
45
12
|
};
|
|
@@ -133,7 +133,7 @@ const a = c(), d = () => ({
|
|
|
133
133
|
filterSelectionDrawerStatus: !1,
|
|
134
134
|
filterList: {},
|
|
135
135
|
filterGroup: 1
|
|
136
|
-
}), G = p("
|
|
136
|
+
}), G = p("recommendationExtension", {
|
|
137
137
|
state: () => d(),
|
|
138
138
|
getters: {
|
|
139
139
|
hasFilters: (e) => !!e.recommendationConfigs.filters.length,
|