@useinsider/guido 2.0.0-beta.6e688eb → 2.0.0-beta.782343a
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/extensions/Blocks/Items/controls/cardComposition.js +13 -4
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.js → cardBackground/index.js} +2 -2
- package/dist/extensions/Blocks/Recommendation/{cardCompositionControl.js → controls/cardComposition/index.js} +18 -26
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/{control.js → controls/main/index.js} +44 -25
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/{spacingControl.js → spacing/index.js} +57 -62
- package/dist/extensions/Blocks/Recommendation/extension.js +37 -17
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -10
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +17 -16
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +62 -87
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -286
- 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/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +19 -589
- package/dist/src/extensions/Blocks/Recommendation/{control.d.ts → controls/main/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +2 -5
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/stores/config.d.ts +17 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
package/dist/extensions/Blocks/Recommendation/controls/{spacingControl.js → spacing/index.js}
RENAMED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var S = (
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { useDebounceFn as d } from "
|
|
7
|
-
const
|
|
2
|
+
var h = (n, r, e) => r in n ? C(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
|
|
3
|
+
var S = (n, r, e) => h(n, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as _ } from "../../../common-control.js";
|
|
6
|
+
import { useDebounceFn as d } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
7
|
+
const f = "recommendation-spacing-control", i = {
|
|
8
8
|
COLUMN_SPACING: "columnSpacing",
|
|
9
9
|
ROW_SPACING: "rowSpacing"
|
|
10
10
|
}, N = {
|
|
11
11
|
COLUMN_SPACING: "data-column-spacing",
|
|
12
12
|
ROW_SPACING: "data-row-spacing"
|
|
13
|
-
},
|
|
13
|
+
}, a = {
|
|
14
14
|
COLUMN_SPACING: 10,
|
|
15
15
|
// 5px on each side = 10px total
|
|
16
16
|
ROW_SPACING: 20
|
|
17
|
-
},
|
|
17
|
+
}, c = {
|
|
18
18
|
MIN_SPACING: 0,
|
|
19
19
|
MAX_SPACING: 50,
|
|
20
20
|
STEP: 5
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
function g(n, r) {
|
|
23
|
+
return !n || !("getStyle" in n) ? null : n.getStyle(r);
|
|
24
|
+
}
|
|
25
|
+
function A(n) {
|
|
26
|
+
return !n || !("parent" in n) || typeof n.parent != "function" ? null : n.parent();
|
|
27
|
+
}
|
|
28
|
+
function m(n, r) {
|
|
29
|
+
if (!n)
|
|
30
|
+
return r;
|
|
31
|
+
const e = parseFloat(n);
|
|
32
|
+
return Number.isNaN(e) ? r : e;
|
|
33
|
+
}
|
|
34
|
+
class M extends _ {
|
|
23
35
|
constructor() {
|
|
24
36
|
super(...arguments);
|
|
25
37
|
/**
|
|
@@ -38,7 +50,7 @@ class G extends m {
|
|
|
38
50
|
}, 300));
|
|
39
51
|
}
|
|
40
52
|
getId() {
|
|
41
|
-
return
|
|
53
|
+
return f;
|
|
42
54
|
}
|
|
43
55
|
getTemplate() {
|
|
44
56
|
return `
|
|
@@ -46,17 +58,17 @@ class G extends m {
|
|
|
46
58
|
${this._GuTwoColumns([
|
|
47
59
|
this._GuLabel({ text: "Column Spacing (px)" }),
|
|
48
60
|
this._GuCounter({
|
|
49
|
-
name:
|
|
50
|
-
minValue:
|
|
51
|
-
maxValue:
|
|
52
|
-
step:
|
|
61
|
+
name: i.COLUMN_SPACING,
|
|
62
|
+
minValue: c.MIN_SPACING,
|
|
63
|
+
maxValue: c.MAX_SPACING,
|
|
64
|
+
step: c.STEP
|
|
53
65
|
}),
|
|
54
66
|
this._GuLabel({ text: "Row Spacing (px)" }),
|
|
55
67
|
this._GuCounter({
|
|
56
|
-
name:
|
|
57
|
-
minValue:
|
|
58
|
-
maxValue:
|
|
59
|
-
step:
|
|
68
|
+
name: i.ROW_SPACING,
|
|
69
|
+
minValue: c.MIN_SPACING,
|
|
70
|
+
maxValue: c.MAX_SPACING,
|
|
71
|
+
step: c.STEP
|
|
60
72
|
})
|
|
61
73
|
])}
|
|
62
74
|
</div>
|
|
@@ -74,50 +86,32 @@ class G extends m {
|
|
|
74
86
|
_setFormValues() {
|
|
75
87
|
const e = this._getStoredColumnSpacing(), t = this._getStoredRowSpacing();
|
|
76
88
|
this.api.updateValues({
|
|
77
|
-
[
|
|
78
|
-
[
|
|
89
|
+
[i.COLUMN_SPACING]: e,
|
|
90
|
+
[i.ROW_SPACING]: t
|
|
79
91
|
});
|
|
80
92
|
}
|
|
81
93
|
/**
|
|
82
94
|
* Gets stored column spacing from the first product card wrapper's parent element's padding
|
|
83
|
-
* Reads the actual padding value instead of relying on data attributes
|
|
84
|
-
*
|
|
85
95
|
* The padding is applied as "0 {halfSpacing}px" on the parent TD element,
|
|
86
|
-
* so we
|
|
96
|
+
* so we extract the horizontal padding value and multiply by 2 to get total spacing.
|
|
87
97
|
*/
|
|
88
98
|
_getStoredColumnSpacing() {
|
|
89
99
|
if (!this.currentNode)
|
|
90
|
-
return
|
|
91
|
-
const e = this.currentNode.querySelector(".product-card-wrapper");
|
|
92
|
-
if (!e || !("parent" in e) || typeof e.parent != "function")
|
|
93
|
-
return n.COLUMN_SPACING;
|
|
94
|
-
const t = e.parent();
|
|
95
|
-
if (!t || !("getStyle" in t))
|
|
96
|
-
return n.COLUMN_SPACING;
|
|
97
|
-
const o = t.getStyle("padding");
|
|
100
|
+
return a.COLUMN_SPACING;
|
|
101
|
+
const e = this.currentNode.querySelector(".product-card-wrapper"), t = A(e), o = g(t, "padding");
|
|
98
102
|
if (!o)
|
|
99
|
-
return
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
return n.COLUMN_SPACING;
|
|
103
|
-
const [, a] = u, s = parseFloat(a);
|
|
104
|
-
return Number.isNaN(s) ? n.COLUMN_SPACING : s * 2;
|
|
103
|
+
return a.COLUMN_SPACING;
|
|
104
|
+
const s = o.trim().split(/\s+/);
|
|
105
|
+
return s.length < 2 ? a.COLUMN_SPACING : m(s[1], a.COLUMN_SPACING / 2) * 2;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* Gets stored row spacing from the first spacer element's height style
|
|
108
|
-
* Reads the actual height value instead of relying on data attributes
|
|
109
109
|
*/
|
|
110
110
|
_getStoredRowSpacing() {
|
|
111
111
|
if (!this.currentNode)
|
|
112
|
-
return
|
|
113
|
-
const e = this.currentNode.querySelector(".spacer");
|
|
114
|
-
|
|
115
|
-
return n.ROW_SPACING;
|
|
116
|
-
const t = e.getStyle("height");
|
|
117
|
-
if (!t)
|
|
118
|
-
return n.ROW_SPACING;
|
|
119
|
-
const o = parseFloat(t);
|
|
120
|
-
return Number.isNaN(o) ? n.ROW_SPACING : o;
|
|
112
|
+
return a.ROW_SPACING;
|
|
113
|
+
const e = this.currentNode.querySelector(".spacer"), t = g(e, "height");
|
|
114
|
+
return m(t, a.ROW_SPACING);
|
|
121
115
|
}
|
|
122
116
|
/**
|
|
123
117
|
* Handles column spacing changes
|
|
@@ -126,15 +120,16 @@ class G extends m {
|
|
|
126
120
|
_onColumnSpacingChange(e) {
|
|
127
121
|
if (!this.currentNode)
|
|
128
122
|
return;
|
|
123
|
+
this._storeColumnSpacing(e);
|
|
129
124
|
const t = Array.from(
|
|
130
125
|
this.currentNode.querySelectorAll(".product-card-wrapper")
|
|
131
126
|
);
|
|
132
127
|
if (!t)
|
|
133
128
|
return;
|
|
134
|
-
const o = this.api.getDocumentModifier(),
|
|
135
|
-
|
|
136
|
-
"parent" in
|
|
137
|
-
}), o.apply(new
|
|
129
|
+
const o = this.api.getDocumentModifier(), u = `0 ${e / 2}px`;
|
|
130
|
+
t.forEach((l) => {
|
|
131
|
+
"parent" in l && l.parent() && o.modifyHtml(l.parent()).setStyle("padding", u);
|
|
132
|
+
}), o.apply(new p(`Update column spacing to ${e}px`));
|
|
138
133
|
}
|
|
139
134
|
/**
|
|
140
135
|
* Handles row spacing changes
|
|
@@ -147,12 +142,12 @@ class G extends m {
|
|
|
147
142
|
const t = Array.from(
|
|
148
143
|
this.currentNode.querySelectorAll(".spacer")
|
|
149
144
|
);
|
|
150
|
-
if (
|
|
145
|
+
if (!t.length)
|
|
151
146
|
return;
|
|
152
|
-
const o = this.api.getDocumentModifier(),
|
|
153
|
-
t.forEach((
|
|
154
|
-
o.modifyHtml(
|
|
155
|
-
}), o.apply(new
|
|
147
|
+
const o = this.api.getDocumentModifier(), s = `${e}px`;
|
|
148
|
+
t.forEach((u) => {
|
|
149
|
+
o.modifyHtml(u).setStyle("height", s);
|
|
150
|
+
}), o.apply(new p(`Update row spacing to ${e}px`));
|
|
156
151
|
}
|
|
157
152
|
/**
|
|
158
153
|
* Stores column spacing value in block data attribute
|
|
@@ -161,7 +156,7 @@ class G extends m {
|
|
|
161
156
|
if (!this.currentNode)
|
|
162
157
|
return;
|
|
163
158
|
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
164
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.COLUMN_SPACING, e.toString()).apply(new
|
|
159
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.COLUMN_SPACING, e.toString()).apply(new p("Store column spacing"));
|
|
165
160
|
}
|
|
166
161
|
/**
|
|
167
162
|
* Stores row spacing value in block data attribute
|
|
@@ -170,19 +165,19 @@ class G extends m {
|
|
|
170
165
|
if (!this.currentNode)
|
|
171
166
|
return;
|
|
172
167
|
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
173
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.ROW_SPACING, e.toString()).apply(new
|
|
168
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.ROW_SPACING, e.toString()).apply(new p("Store row spacing"));
|
|
174
169
|
}
|
|
175
170
|
_listenToFormUpdates() {
|
|
176
|
-
this.api.onValueChanged(
|
|
171
|
+
this.api.onValueChanged(i.COLUMN_SPACING, (e) => {
|
|
177
172
|
const t = parseInt(e);
|
|
178
173
|
Number.isNaN(t) || this._debouncedOnColumnSpacingChange(t);
|
|
179
|
-
}), this.api.onValueChanged(
|
|
174
|
+
}), this.api.onValueChanged(i.ROW_SPACING, (e) => {
|
|
180
175
|
const t = parseInt(e);
|
|
181
176
|
Number.isNaN(t) || this._debouncedOnRowSpacingChange(t);
|
|
182
177
|
});
|
|
183
178
|
}
|
|
184
179
|
}
|
|
185
180
|
export {
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
f as SPACING_CONTROL_ID,
|
|
182
|
+
M as SpacingControl
|
|
188
183
|
};
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import { ExtensionBuilder as
|
|
2
|
-
import { RecommendationBlock as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
1
|
+
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RecommendationBlock as n } from "./block.js";
|
|
3
|
+
import { RecommendationBlockControl as m } from "./controls/main/index.js";
|
|
4
|
+
import { NameControls as i } from "./controls/name/index.js";
|
|
5
|
+
import { PriceControls as e } from "./controls/price/index.js";
|
|
6
|
+
import { OldPriceControls as l } from "./controls/oldPrice/index.js";
|
|
7
|
+
import { OmnibusPriceControls as s } from "./controls/omnibusPrice/index.js";
|
|
8
|
+
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
9
|
+
import { ButtonControls as c } from "./controls/button/index.js";
|
|
10
|
+
import { ImageControls as p } from "./controls/image/index.js";
|
|
11
|
+
import { SpacingControl as d } from "./controls/spacing/index.js";
|
|
12
|
+
import { CardBackgroundColorControl as C } from "./controls/cardBackground/index.js";
|
|
13
|
+
import { RecommendationCardCompositionControl as f } from "./controls/cardComposition/index.js";
|
|
14
|
+
import { RecommendationIconsRegistry as u } from "./iconsRegistry.js";
|
|
15
|
+
import g from "./recommendation.css.js";
|
|
16
|
+
import { SettingsPanel as R } from "./settingsPanel.js";
|
|
17
|
+
const B = [
|
|
18
|
+
i,
|
|
19
|
+
e,
|
|
20
|
+
l,
|
|
21
|
+
s,
|
|
22
|
+
a,
|
|
23
|
+
c,
|
|
24
|
+
p
|
|
25
|
+
], y = [
|
|
26
|
+
m,
|
|
27
|
+
C,
|
|
28
|
+
d,
|
|
29
|
+
f
|
|
30
|
+
], P = [
|
|
31
|
+
...y,
|
|
32
|
+
...B.flatMap((o) => Object.values(o))
|
|
33
|
+
], z = P.reduce(
|
|
34
|
+
(o, t) => o.addControl(t),
|
|
35
|
+
new r().addBlock(n).withSettingsPanelRegistry(R)
|
|
36
|
+
).addStyles(g).withIconsRegistry(u).build();
|
|
17
37
|
export {
|
|
18
|
-
|
|
38
|
+
z as default
|
|
19
39
|
};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { SettingsPanelRegistry as S, SettingsPanelTab as I, SettingsTab as T, ContainerControls as E, TextControls as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { BLOCK_ID as R } from "./block.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { CONTROL_BLOCK_ID as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
3
|
+
import { RecommendationBlockId as N } from "./constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as _ } from "./constants/controlIds.js";
|
|
5
|
+
import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
|
|
6
|
+
import "./controls/name/index.js";
|
|
7
|
+
import "./controls/price/index.js";
|
|
8
|
+
import "./controls/oldPrice/index.js";
|
|
9
|
+
import "./controls/omnibusPrice/index.js";
|
|
10
|
+
import "./controls/omnibusDiscount/index.js";
|
|
11
|
+
import "./controls/button/index.js";
|
|
12
|
+
import "./controls/image/index.js";
|
|
13
|
+
import { SPACING_CONTROL_ID as U } from "./controls/spacing/index.js";
|
|
14
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as B } from "./controls/cardBackground/index.js";
|
|
15
|
+
import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
|
|
16
|
+
class X extends S {
|
|
9
17
|
registerBlockControls(O) {
|
|
10
18
|
O[R] = [
|
|
11
19
|
new I(
|
|
12
20
|
T.SETTINGS,
|
|
13
21
|
[
|
|
14
|
-
|
|
22
|
+
L,
|
|
15
23
|
E.EXTERNAL_INDENTS
|
|
16
24
|
]
|
|
17
25
|
),
|
|
@@ -20,13 +28,13 @@ class m extends S {
|
|
|
20
28
|
[
|
|
21
29
|
C.TEXT_BLOCK_BACKGROUND_COLOR,
|
|
22
30
|
B,
|
|
23
|
-
|
|
31
|
+
U
|
|
24
32
|
]
|
|
25
33
|
),
|
|
26
34
|
new I(
|
|
27
35
|
"Card Composition",
|
|
28
36
|
[
|
|
29
|
-
|
|
37
|
+
D
|
|
30
38
|
]
|
|
31
39
|
).withLabel("Card Composition")
|
|
32
40
|
], O[N.NAME] = [
|
|
@@ -158,5 +166,5 @@ class m extends S {
|
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
export {
|
|
161
|
-
|
|
169
|
+
X as SettingsPanel
|
|
162
170
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { generateCompleteFilterQuery as
|
|
6
|
-
const
|
|
1
|
+
import { RecommendationFeedSourceMaps as u, PriceAttributes as c } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as p } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as m } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as d } from "pinia";
|
|
5
|
+
import { generateCompleteFilterQuery as l } from "../utils/filterUtil.js";
|
|
6
|
+
const n = p(), f = () => ({
|
|
7
7
|
recommendationCampaignUrls: {},
|
|
8
8
|
recommendationProducts: [],
|
|
9
9
|
recommendationConfigs: {
|
|
@@ -134,8 +134,8 @@ const a = l(), d = () => ({
|
|
|
134
134
|
filterSelectionDrawerStatus: !1,
|
|
135
135
|
filterList: {},
|
|
136
136
|
filterGroup: 1
|
|
137
|
-
}),
|
|
138
|
-
state: () =>
|
|
137
|
+
}), C = d("guidoRecommendationExtension", {
|
|
138
|
+
state: () => f(),
|
|
139
139
|
getters: {
|
|
140
140
|
hasFilters: (e) => !!e.recommendationConfigs.filters.length,
|
|
141
141
|
getFilterGroupCount: (e) => {
|
|
@@ -145,7 +145,7 @@ const a = l(), d = () => ({
|
|
|
145
145
|
getActivePredictiveAlgorithms: (e) => {
|
|
146
146
|
const t = [];
|
|
147
147
|
return e.activePredictiveAlgorithms.forEach((r) => {
|
|
148
|
-
t.push(...
|
|
148
|
+
t.push(...u.filter((i) => i.id === r));
|
|
149
149
|
}), t.map((r) => ({
|
|
150
150
|
text: r.name,
|
|
151
151
|
value: r.key
|
|
@@ -160,7 +160,7 @@ const a = l(), d = () => ({
|
|
|
160
160
|
value: t.text
|
|
161
161
|
})),
|
|
162
162
|
getFilterList: (e) => Object.values(e.filterList).map((t) => {
|
|
163
|
-
const r = t.type === "defaultAttribute", i =
|
|
163
|
+
const r = t.type === "defaultAttribute", i = c.includes(t.attributeName);
|
|
164
164
|
let o = r ? t.attributeName : `product_attributes.${t.attributeName}`;
|
|
165
165
|
return o = i ? `${o}.${e.recommendationConfigs.currencySettings.value}` : o, {
|
|
166
166
|
text: t.displayName,
|
|
@@ -178,13 +178,13 @@ const a = l(), d = () => ({
|
|
|
178
178
|
activePredictiveAlgorithms: e,
|
|
179
179
|
languages: t,
|
|
180
180
|
currencies: r
|
|
181
|
-
} = await
|
|
181
|
+
} = await n.fetchRecommendationCreateData();
|
|
182
182
|
this.activePredictiveAlgorithms = e, this.languages = t;
|
|
183
183
|
const [i] = r;
|
|
184
184
|
this.recommendationConfigs.currencySettings.name = i.text, this.recommendationConfigs.currencySettings.value = i.value, this.currencyList = r, this.filterStatus = !!this.recommendationConfigs.filters.length;
|
|
185
185
|
},
|
|
186
186
|
async fetchRecommendationFilters() {
|
|
187
|
-
const e = await
|
|
187
|
+
const e = await n.fetchRecommendationFilters();
|
|
188
188
|
this.filterList = e;
|
|
189
189
|
},
|
|
190
190
|
addFilterGroup(e) {
|
|
@@ -238,30 +238,30 @@ const a = l(), d = () => ({
|
|
|
238
238
|
});
|
|
239
239
|
},
|
|
240
240
|
generateFilterQuery() {
|
|
241
|
-
return
|
|
241
|
+
return l(this.recommendationConfigs.filters);
|
|
242
242
|
},
|
|
243
243
|
async fetchRecommendationProducts() {
|
|
244
|
-
var
|
|
245
|
-
const e = this.
|
|
246
|
-
|
|
244
|
+
var s;
|
|
245
|
+
const e = this.recommendationConfigs.filters.filter((a) => a.isValid), t = l(e), r = ((s = u.find((a) => a.key === this.recommendationConfigs.strategy)) == null ? void 0 : s.path) || "", i = m(), o = await n.fetchRecommendationProducts(
|
|
246
|
+
r,
|
|
247
247
|
{
|
|
248
248
|
// TODO: Here will be optimized and filled carefully
|
|
249
249
|
locale: this.recommendationConfigs.language,
|
|
250
250
|
currency: this.recommendationConfigs.currencySettings.value,
|
|
251
|
-
partnerName:
|
|
251
|
+
partnerName: i.partnerName,
|
|
252
252
|
productId: this.recommendationConfigs.strategy === "manualMerchandising" ? this.recommendationConfigs.productIds.join(",") : "{itemId}",
|
|
253
253
|
size: this.recommendationConfigs.size,
|
|
254
254
|
details: !0,
|
|
255
255
|
campaignId: "{campaignId}",
|
|
256
|
-
filter:
|
|
256
|
+
filter: t
|
|
257
257
|
}
|
|
258
258
|
);
|
|
259
259
|
this.$patch({
|
|
260
|
-
recommendationProducts:
|
|
260
|
+
recommendationProducts: o
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
export {
|
|
266
|
-
|
|
266
|
+
C as useRecommendationExtensionStore
|
|
267
267
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BlockType as e, BlockAttr as o } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { RecommendationBlockId as s
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { RecommendationBlockId as s } from "../constants/blockIds.js";
|
|
3
|
+
import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_OMNIBUS_DISCOUNT as c, ATTR_PRODUCT_OMNIBUS_PRICE as p, ATTR_PRODUCT_OLD_PRICE as i, ATTR_PRODUCT_PRICE as d, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_IMAGE as b } from "../constants/selectors.js";
|
|
4
|
+
import { prepareProductRows as _, generateTemplate as O, spacer as u, DEFAULTS as f, getDefaultProducts as C } from "./templateUtils.js";
|
|
5
|
+
import { DEFAULT_CARD_COMPOSITION as h, DEFAULT_CARD_VISIBILITY as A } from "./templateUtils.js";
|
|
6
|
+
const m = `
|
|
6
7
|
<td align="left" class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20">
|
|
7
8
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
8
9
|
<tr>
|
|
@@ -123,7 +124,7 @@ const g = `
|
|
|
123
124
|
</p>
|
|
124
125
|
</${e.BLOCK_TEXT}>
|
|
125
126
|
`,
|
|
126
|
-
[
|
|
127
|
+
[l]: () => `
|
|
127
128
|
<${e.BLOCK_BUTTON}
|
|
128
129
|
${o.BLOCK_BUTTON.href}="#"
|
|
129
130
|
class="product-button es-p10t es-p10b"
|
|
@@ -152,30 +153,30 @@ const g = `
|
|
|
152
153
|
</${e.BLOCK_BUTTON}>
|
|
153
154
|
`
|
|
154
155
|
};
|
|
155
|
-
function
|
|
156
|
+
function E() {
|
|
156
157
|
const t = C();
|
|
157
|
-
return
|
|
158
|
-
|
|
158
|
+
return O(
|
|
159
|
+
m,
|
|
159
160
|
t,
|
|
160
161
|
3,
|
|
161
162
|
n,
|
|
162
163
|
f.TITLE
|
|
163
164
|
);
|
|
164
165
|
}
|
|
165
|
-
function
|
|
166
|
-
return
|
|
166
|
+
function $(t, a, r) {
|
|
167
|
+
return _(
|
|
167
168
|
t,
|
|
168
169
|
a,
|
|
169
170
|
n,
|
|
170
|
-
|
|
171
|
+
r
|
|
171
172
|
);
|
|
172
173
|
}
|
|
173
174
|
export {
|
|
174
175
|
f as DEFAULTS,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
h as DEFAULT_CARD_COMPOSITION,
|
|
177
|
+
A as DEFAULT_CARD_VISIBILITY,
|
|
178
|
+
m as default,
|
|
178
179
|
C as getDefaultProducts,
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
E as getDefaultTemplate,
|
|
181
|
+
$ as prepareProductRows
|
|
181
182
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_BUTTON as o, ATTR_PRODUCT_OMNIBUS_DISCOUNT as a, ATTR_PRODUCT_OMNIBUS_PRICE as s, ATTR_PRODUCT_OLD_PRICE as l, ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_NAME as r, ATTR_PRODUCT_IMAGE as d } from "../constants.js";
|
|
1
|
+
import { ATTR_PRODUCT_BUTTON as o, ATTR_PRODUCT_OMNIBUS_DISCOUNT as a, ATTR_PRODUCT_OMNIBUS_PRICE as s, ATTR_PRODUCT_OLD_PRICE as l, ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_NAME as r, ATTR_PRODUCT_IMAGE as d } from "../constants/selectors.js";
|
|
2
2
|
import { prepareProductRows as i } from "./templateUtils.js";
|
|
3
3
|
import { DEFAULTS as k, getDefaultProducts as f } from "./templateUtils.js";
|
|
4
4
|
const g = `
|