@useinsider/guido 2.0.0-beta.dbde199 → 2.0.0-beta.e66a90a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +53 -39
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +100 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +243 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +104 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +86 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +134 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +106 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +123 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +60 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +112 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +224 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +5 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +46 -43
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.js +157 -0
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/template.js +72 -0
- package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +173 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.js +186 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/vertical/template.js +61 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +6 -7
- package/dist/extensions/Blocks/controlFactories.js +156 -122
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +110 -113
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +1 -33
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +19 -3
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -651
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +54 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +40 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +81 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +26 -9
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/migration.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/horizontal/template.d.ts +18 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +45 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/migration.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/vertical/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/customEditorStyle.css.js +25 -2
- package/dist/stores/config.js +7 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
- package/dist/extensions/Blocks/Recommendation/control.js +0 -336
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
- package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
- package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as
|
|
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
|
-
import
|
|
9
|
-
|
|
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 "./store/recommendation.js";
|
|
7
|
+
import "./controls/name/index.js";
|
|
8
|
+
import "./controls/price/index.js";
|
|
9
|
+
import "./controls/oldPrice/index.js";
|
|
10
|
+
import "./controls/omnibusPrice/index.js";
|
|
11
|
+
import "./controls/omnibusDiscount/index.js";
|
|
12
|
+
import "./controls/button/index.js";
|
|
13
|
+
import "./controls/image/index.js";
|
|
14
|
+
import { SPACING_CONTROL_ID as U } from "./controls/spacing/index.js";
|
|
15
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as B } from "./controls/cardBackground/index.js";
|
|
16
|
+
import { LAYOUT_CONTROL_ID as D } from "./controls/layout/index.js";
|
|
17
|
+
import { COMPOSITION_CONTROL_BLOCK_ID as A } from "./controls/cardComposition/index.js";
|
|
18
|
+
class s extends S {
|
|
10
19
|
registerBlockControls(O) {
|
|
11
20
|
O[R] = [
|
|
12
21
|
new I(
|
|
13
|
-
|
|
22
|
+
T.SETTINGS,
|
|
14
23
|
[
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
S.EXTERNAL_INDENTS
|
|
24
|
+
L,
|
|
25
|
+
E.EXTERNAL_INDENTS
|
|
18
26
|
]
|
|
19
27
|
),
|
|
20
28
|
new I(
|
|
21
|
-
|
|
29
|
+
T.STYLES,
|
|
22
30
|
[
|
|
23
31
|
C.TEXT_BLOCK_BACKGROUND_COLOR,
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
B,
|
|
33
|
+
D,
|
|
34
|
+
U
|
|
26
35
|
]
|
|
27
36
|
),
|
|
28
37
|
new I(
|
|
29
38
|
"Card Composition",
|
|
30
39
|
[
|
|
31
|
-
|
|
40
|
+
A
|
|
32
41
|
]
|
|
33
42
|
).withLabel("Card Composition")
|
|
34
|
-
], O[
|
|
43
|
+
], O[N.NAME] = [
|
|
35
44
|
new I(
|
|
36
|
-
|
|
45
|
+
T.SETTINGS,
|
|
37
46
|
[
|
|
38
47
|
_.NAME_STYLE,
|
|
39
48
|
_.NAME_ALIGN,
|
|
@@ -42,38 +51,35 @@ class Y extends E {
|
|
|
42
51
|
]
|
|
43
52
|
),
|
|
44
53
|
new I(
|
|
45
|
-
|
|
54
|
+
T.STYLES,
|
|
46
55
|
[
|
|
47
56
|
_.NAME_BACKGROUND,
|
|
48
57
|
_.NAME_FONT_FAMILY,
|
|
49
|
-
_.NAME_LINE_SPACING,
|
|
50
58
|
_.NAME_SIZE,
|
|
51
59
|
_.NAME_COLOR
|
|
52
60
|
]
|
|
53
61
|
)
|
|
54
|
-
], O[
|
|
62
|
+
], O[N.PRICE] = [
|
|
55
63
|
new I(
|
|
56
|
-
|
|
64
|
+
T.SETTINGS,
|
|
57
65
|
[
|
|
58
66
|
_.PRICE_STYLE,
|
|
59
67
|
_.PRICE_ALIGN,
|
|
60
|
-
_.PRICE_HIDE_IF_SAME,
|
|
61
68
|
_.PRICE_PADDINGS
|
|
62
69
|
]
|
|
63
70
|
),
|
|
64
71
|
new I(
|
|
65
|
-
|
|
72
|
+
T.STYLES,
|
|
66
73
|
[
|
|
67
74
|
_.PRICE_BACKGROUND,
|
|
68
75
|
_.PRICE_FONT_FAMILY,
|
|
69
|
-
_.PRICE_LINE_SPACING,
|
|
70
76
|
_.PRICE_SIZE,
|
|
71
77
|
_.PRICE_COLOR
|
|
72
78
|
]
|
|
73
79
|
)
|
|
74
|
-
], O[
|
|
80
|
+
], O[N.OLD_PRICE] = [
|
|
75
81
|
new I(
|
|
76
|
-
|
|
82
|
+
T.SETTINGS,
|
|
77
83
|
[
|
|
78
84
|
_.OLD_PRICE_STYLE,
|
|
79
85
|
_.OLD_PRICE_ALIGN,
|
|
@@ -81,18 +87,17 @@ class Y extends E {
|
|
|
81
87
|
]
|
|
82
88
|
),
|
|
83
89
|
new I(
|
|
84
|
-
|
|
90
|
+
T.STYLES,
|
|
85
91
|
[
|
|
86
92
|
_.OLD_PRICE_BACKGROUND,
|
|
87
93
|
_.OLD_PRICE_FONT_FAMILY,
|
|
88
|
-
_.OLD_PRICE_LINE_SPACING,
|
|
89
94
|
_.OLD_PRICE_SIZE,
|
|
90
95
|
_.OLD_PRICE_COLOR
|
|
91
96
|
]
|
|
92
97
|
)
|
|
93
|
-
], O[
|
|
98
|
+
], O[N.OMNIBUS_PRICE] = [
|
|
94
99
|
new I(
|
|
95
|
-
|
|
100
|
+
T.SETTINGS,
|
|
96
101
|
[
|
|
97
102
|
_.OMNIBUS_PRICE_TEXT_BEFORE,
|
|
98
103
|
_.OMNIBUS_PRICE_TEXT_AFTER,
|
|
@@ -102,18 +107,17 @@ class Y extends E {
|
|
|
102
107
|
]
|
|
103
108
|
),
|
|
104
109
|
new I(
|
|
105
|
-
|
|
110
|
+
T.STYLES,
|
|
106
111
|
[
|
|
107
112
|
_.OMNIBUS_PRICE_BACKGROUND,
|
|
108
113
|
_.OMNIBUS_PRICE_FONT_FAMILY,
|
|
109
|
-
_.OMNIBUS_PRICE_LINE_SPACING,
|
|
110
114
|
_.OMNIBUS_PRICE_SIZE,
|
|
111
115
|
_.OMNIBUS_PRICE_COLOR
|
|
112
116
|
]
|
|
113
117
|
)
|
|
114
|
-
], O[
|
|
118
|
+
], O[N.OMNIBUS_DISCOUNT] = [
|
|
115
119
|
new I(
|
|
116
|
-
|
|
120
|
+
T.SETTINGS,
|
|
117
121
|
[
|
|
118
122
|
_.OMNIBUS_DISCOUNT_TEXT_BEFORE,
|
|
119
123
|
_.OMNIBUS_DISCOUNT_TEXT_AFTER,
|
|
@@ -123,18 +127,17 @@ class Y extends E {
|
|
|
123
127
|
]
|
|
124
128
|
),
|
|
125
129
|
new I(
|
|
126
|
-
|
|
130
|
+
T.STYLES,
|
|
127
131
|
[
|
|
128
132
|
_.OMNIBUS_DISCOUNT_BACKGROUND,
|
|
129
133
|
_.OMNIBUS_DISCOUNT_FONT_FAMILY,
|
|
130
|
-
_.OMNIBUS_DISCOUNT_LINE_SPACING,
|
|
131
134
|
_.OMNIBUS_DISCOUNT_SIZE,
|
|
132
135
|
_.OMNIBUS_DISCOUNT_COLOR
|
|
133
136
|
]
|
|
134
137
|
)
|
|
135
|
-
], O[
|
|
138
|
+
], O[N.BUTTON] = [
|
|
136
139
|
new I(
|
|
137
|
-
|
|
140
|
+
T.SETTINGS,
|
|
138
141
|
[
|
|
139
142
|
_.BUTTON_TEXT,
|
|
140
143
|
_.BUTTON_ALIGN,
|
|
@@ -143,7 +146,7 @@ class Y extends E {
|
|
|
143
146
|
]
|
|
144
147
|
),
|
|
145
148
|
new I(
|
|
146
|
-
|
|
149
|
+
T.STYLES,
|
|
147
150
|
[
|
|
148
151
|
_.BUTTON_COLOR,
|
|
149
152
|
_.BUTTON_FONT_FAMILY,
|
|
@@ -154,9 +157,9 @@ class Y extends E {
|
|
|
154
157
|
_.BUTTON_BORDER
|
|
155
158
|
]
|
|
156
159
|
)
|
|
157
|
-
], O[
|
|
160
|
+
], O[N.IMAGE] = [
|
|
158
161
|
new I(
|
|
159
|
-
|
|
162
|
+
T.SETTINGS,
|
|
160
163
|
[
|
|
161
164
|
_.IMAGE_SIZE,
|
|
162
165
|
_.IMAGE_MARGINS
|
|
@@ -166,5 +169,5 @@ class Y extends E {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
export {
|
|
169
|
-
|
|
172
|
+
s as SettingsPanel
|
|
170
173
|
};
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { RecommendationBlockId as e } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_BUTTON as a, ATTR_PRODUCT_IMAGE as s, ATTR_PRODUCT_OMNIBUS_DISCOUNT as o, ATTR_PRODUCT_OMNIBUS_PRICE as n, ATTR_PRODUCT_OLD_PRICE as l, ATTR_PRODUCT_PRICE as i, ATTR_PRODUCT_NAME as r } from "../../constants/selectors.js";
|
|
3
|
+
const p = {
|
|
4
|
+
/**
|
|
5
|
+
* Image cell - left column (120px fixed width)
|
|
6
|
+
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
7
|
+
*/
|
|
8
|
+
[s]: (t) => `
|
|
9
|
+
<td
|
|
10
|
+
width="120"
|
|
11
|
+
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
12
|
+
esd-extension-block-id="${e.IMAGE}"
|
|
13
|
+
data-attribute-type="${s}"
|
|
14
|
+
data-visibility="1"
|
|
15
|
+
align=center
|
|
16
|
+
valign="middle">
|
|
17
|
+
<a target="_blank" href="${t.url}">
|
|
18
|
+
<img
|
|
19
|
+
src="${t.image_url}"
|
|
20
|
+
alt="${t.name}"
|
|
21
|
+
style="display: block; max-width: 100%;"
|
|
22
|
+
class="adapt-img product-image">
|
|
23
|
+
</a>
|
|
24
|
+
</td>
|
|
25
|
+
`,
|
|
26
|
+
/**
|
|
27
|
+
* Name element - row for info cell table
|
|
28
|
+
*/
|
|
29
|
+
[r]: (t) => `
|
|
30
|
+
<tr>
|
|
31
|
+
<td
|
|
32
|
+
class="esd-block-text product-name"
|
|
33
|
+
esd-extension-block-id="${e.NAME}"
|
|
34
|
+
align="left">
|
|
35
|
+
<p
|
|
36
|
+
path="1"
|
|
37
|
+
contenteditable="false"
|
|
38
|
+
style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
|
|
39
|
+
<strong path="1,0">${t.name}</strong>
|
|
40
|
+
</p>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
`,
|
|
44
|
+
/**
|
|
45
|
+
* Price element - row for info cell table
|
|
46
|
+
*/
|
|
47
|
+
[i]: () => `
|
|
48
|
+
<tr>
|
|
49
|
+
<td
|
|
50
|
+
class="esd-block-text product-price"
|
|
51
|
+
esd-extension-block-id="${e.PRICE}"
|
|
52
|
+
align="left">
|
|
53
|
+
<p
|
|
54
|
+
path="1"
|
|
55
|
+
contenteditable="false"
|
|
56
|
+
style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
57
|
+
<strong path="1,0">18,00 TRY</strong>
|
|
58
|
+
</p>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
`,
|
|
62
|
+
/**
|
|
63
|
+
* Old price element - row for info cell table
|
|
64
|
+
*/
|
|
65
|
+
[l]: () => `
|
|
66
|
+
<tr>
|
|
67
|
+
<td
|
|
68
|
+
class="esd-block-text product-old-price"
|
|
69
|
+
esd-extension-block-id="${e.OLD_PRICE}"
|
|
70
|
+
align="left">
|
|
71
|
+
<p
|
|
72
|
+
path="1"
|
|
73
|
+
contenteditable="false"
|
|
74
|
+
style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
|
|
75
|
+
<s path="1,0">20,00 TRY</s>
|
|
76
|
+
</p>
|
|
77
|
+
</td>
|
|
78
|
+
</tr>
|
|
79
|
+
`,
|
|
80
|
+
/**
|
|
81
|
+
* Omnibus price element - row for info cell table
|
|
82
|
+
*/
|
|
83
|
+
[n]: () => `
|
|
84
|
+
<tr>
|
|
85
|
+
<td
|
|
86
|
+
class="esd-block-text product-omnibus-price"
|
|
87
|
+
data-text-before="Lowest 30-day price: "
|
|
88
|
+
data-text-after=""
|
|
89
|
+
esd-extension-block-id="${e.OMNIBUS_PRICE}"
|
|
90
|
+
align="left">
|
|
91
|
+
<p
|
|
92
|
+
path="1"
|
|
93
|
+
contenteditable="false"
|
|
94
|
+
style="font-size: 12px; color: #666666; margin: 0;">
|
|
95
|
+
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
96
|
+
<span class="omnibus-price-value">17,00 TRY</span>
|
|
97
|
+
<span class="omnibus-text-after"></span>
|
|
98
|
+
</p>
|
|
99
|
+
</td>
|
|
100
|
+
</tr>
|
|
101
|
+
`,
|
|
102
|
+
/**
|
|
103
|
+
* Omnibus discount element - row for info cell table
|
|
104
|
+
*/
|
|
105
|
+
[o]: () => `
|
|
106
|
+
<tr>
|
|
107
|
+
<td
|
|
108
|
+
class="esd-block-text product-omnibus-discount"
|
|
109
|
+
data-text-before=""
|
|
110
|
+
data-text-after=""
|
|
111
|
+
esd-extension-block-id="${e.OMNIBUS_DISCOUNT}"
|
|
112
|
+
align="left">
|
|
113
|
+
<p
|
|
114
|
+
path="1"
|
|
115
|
+
contenteditable="false"
|
|
116
|
+
style="font-size: 12px; color: #666666; margin: 0;">
|
|
117
|
+
<span class="omnibus-text-before"></span>
|
|
118
|
+
<span class="omnibus-discount-value">-6%</span>
|
|
119
|
+
<span class="omnibus-text-after"></span>
|
|
120
|
+
</p>
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
`,
|
|
124
|
+
/**
|
|
125
|
+
* Button cell - right column (100px fixed width)
|
|
126
|
+
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
127
|
+
*/
|
|
128
|
+
[a]: (t) => `
|
|
129
|
+
<td
|
|
130
|
+
width="100"
|
|
131
|
+
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
132
|
+
esd-extension-block-id="${e.BUTTON}"
|
|
133
|
+
data-attribute-type="${a}"
|
|
134
|
+
data-visibility="1"
|
|
135
|
+
align="center"
|
|
136
|
+
valign="middle">
|
|
137
|
+
<span
|
|
138
|
+
class="es-button-border"
|
|
139
|
+
style="
|
|
140
|
+
border-width: 1px;
|
|
141
|
+
background: rgb(217, 234, 211);
|
|
142
|
+
border-color: rgb(106, 168, 79);
|
|
143
|
+
">
|
|
144
|
+
<a
|
|
145
|
+
href="${t.url}"
|
|
146
|
+
target="_blank"
|
|
147
|
+
class="es-button buy-button"
|
|
148
|
+
style="color: rgb(56, 118, 29); background: rgb(217, 234, 211); padding: 5px 30px;">
|
|
149
|
+
Buy
|
|
150
|
+
</a>
|
|
151
|
+
</span>
|
|
152
|
+
</td>
|
|
153
|
+
`
|
|
154
|
+
};
|
|
155
|
+
export {
|
|
156
|
+
p as horizontalElementRenderer
|
|
157
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as g, ATTR_PRODUCT_NAME as s, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as a, ATTR_PRODUCT_OMNIBUS_PRICE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as T, ATTR_PRODUCT_BUTTON as E } from "../../constants/selectors.js";
|
|
2
|
+
import { spacer as N, DEFAULT_CARD_VISIBILITY as n } from "../utils.js";
|
|
3
|
+
import { horizontalElementRenderer as o } from "./elementRenderer.js";
|
|
4
|
+
const $ = `
|
|
5
|
+
<tr class="recommendation-product-row">
|
|
6
|
+
<td style="padding: 0 5px;">
|
|
7
|
+
<table
|
|
8
|
+
width="100%"
|
|
9
|
+
cellpadding="0"
|
|
10
|
+
cellspacing="0"
|
|
11
|
+
border="0"
|
|
12
|
+
class="product-card-wrapper"
|
|
13
|
+
style="background-color: #f8f8f8;">
|
|
14
|
+
<tr>
|
|
15
|
+
{-{-PRODUCT_CONTENT-}-}
|
|
16
|
+
</tr>
|
|
17
|
+
</table>
|
|
18
|
+
</td>
|
|
19
|
+
</tr>
|
|
20
|
+
`;
|
|
21
|
+
function V(t) {
|
|
22
|
+
const i = o[g](t), l = n[s], r = n[c], R = n[a], C = n[d], b = n[T], e = (y, A, p) => {
|
|
23
|
+
const I = p ? "" : ' style="display: none;"', f = y.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
24
|
+
return `<tr
|
|
25
|
+
class="recommendation-attribute-row"
|
|
26
|
+
data-attribute-type="${A}"
|
|
27
|
+
data-visibility="${p ? "1" : "0"}"${I}>${f}</tr>`;
|
|
28
|
+
}, m = e(
|
|
29
|
+
o[s](t),
|
|
30
|
+
s,
|
|
31
|
+
l
|
|
32
|
+
), _ = e(
|
|
33
|
+
o[c](t),
|
|
34
|
+
c,
|
|
35
|
+
r
|
|
36
|
+
), u = e(
|
|
37
|
+
o[a](t),
|
|
38
|
+
a,
|
|
39
|
+
R
|
|
40
|
+
), O = e(
|
|
41
|
+
o[d](t),
|
|
42
|
+
d,
|
|
43
|
+
C
|
|
44
|
+
), P = e(
|
|
45
|
+
o[T](t),
|
|
46
|
+
T,
|
|
47
|
+
b
|
|
48
|
+
), D = `
|
|
49
|
+
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
50
|
+
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
51
|
+
<tbody>
|
|
52
|
+
${m}
|
|
53
|
+
${_}
|
|
54
|
+
${u}
|
|
55
|
+
${O}
|
|
56
|
+
${P}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>
|
|
59
|
+
</td>
|
|
60
|
+
`, U = o[E](t), w = i + D + U;
|
|
61
|
+
return $.replace("{-{-PRODUCT_CONTENT-}-}", w);
|
|
62
|
+
}
|
|
63
|
+
function M(t) {
|
|
64
|
+
return t.map((i, l) => {
|
|
65
|
+
const r = V(i);
|
|
66
|
+
return l > 0 ? N + r : r;
|
|
67
|
+
}).join("");
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
V as getHorizontalProductCard,
|
|
71
|
+
M as prepareProductRows
|
|
72
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { prepareProductRows as s } from "./horizontal/template.js";
|
|
2
|
+
import { prepareProductRows as c } from "./vertical/template.js";
|
|
3
|
+
const R = 3;
|
|
4
|
+
function u(r, o, t = {}) {
|
|
5
|
+
if (o === "horizontal")
|
|
6
|
+
return s(r);
|
|
7
|
+
const { productsPerRow: e = R, composition: p } = t;
|
|
8
|
+
return c(r, e, p);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
u as prepareProductRows
|
|
12
|
+
};
|