@useinsider/guido 2.2.0-beta.8abc7b6 → 2.2.0-beta.953ff70
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/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
- package/dist/composables/useHtmlValidator.js +104 -114
- package/dist/composables/useRecommendation.js +21 -54
- package/dist/config/compiler/recommendationCompilerRules.js +39 -45
- package/dist/config/migrator/itemsBlockMigrator.js +97 -101
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +15 -16
- package/dist/extensions/Blocks/Recommendation/block.js +9 -133
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
- package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
- package/dist/extensions/Blocks/Recommendation/control.js +336 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
- package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +207 -254
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
- package/dist/extensions/Blocks/controlFactories.js +93 -125
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +186 -242
- package/dist/services/recommendationApi.js +8 -11
- package/dist/services/templateLibraryApi.js +13 -16
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
- package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
- package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -138
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
- package/dist/static/styles/customEditorStyle.css.js +11 -35
- package/dist/utils/pairProductVariables.js +56 -57
- package/dist/utils/templatePreparation.js +14 -15
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -121
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -66
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -22
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -21
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -250
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -160
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -307
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +0 -21
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
- package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -228
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -66
- package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -169
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -134
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -41
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -79
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -60
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -221
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +0 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -41
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -66
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -166
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { CURRENT_CONFIG_VERSION as u, DEFAULT_NODE_CONFIG as e } from "../constants/defaultConfig.js";
|
|
3
|
-
import { setCurrencyAttributes as g } from "../controls/main/utils.js";
|
|
4
|
-
import { hasMinimalConfig as a } from "../types/nodeConfig.js";
|
|
5
|
-
class C {
|
|
6
|
-
// ========================================================================
|
|
7
|
-
// Read Operations
|
|
8
|
-
// ========================================================================
|
|
9
|
-
/**
|
|
10
|
-
* Get configuration from a node, with defaults for missing values
|
|
11
|
-
*
|
|
12
|
-
* This is the primary way to read configuration from a block.
|
|
13
|
-
* Always returns a complete config object with defaults merged in.
|
|
14
|
-
* @example
|
|
15
|
-
* const config = RecommendationConfigService.getConfig(this.currentNode);
|
|
16
|
-
* console.log(config.strategy); // 'mostPopular'
|
|
17
|
-
* @param node - The immutable HTML node to read config from
|
|
18
|
-
* @returns Complete configuration with defaults for missing values
|
|
19
|
-
*/
|
|
20
|
-
static getConfig(i) {
|
|
21
|
-
if (!i)
|
|
22
|
-
return this.cloneDefaults();
|
|
23
|
-
if (!("getNodeConfig" in i) || typeof i.getNodeConfig != "function")
|
|
24
|
-
return this.cloneDefaults();
|
|
25
|
-
try {
|
|
26
|
-
const t = i.getNodeConfig();
|
|
27
|
-
return t ? this.mergeWithDefaults(t) : this.cloneDefaults();
|
|
28
|
-
} catch {
|
|
29
|
-
return this.cloneDefaults();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Check if a node has valid configuration stored
|
|
34
|
-
*
|
|
35
|
-
* Used for migration detection - returns false for legacy templates
|
|
36
|
-
* that need their configuration migrated.
|
|
37
|
-
* @param node - The immutable HTML node to check
|
|
38
|
-
* @returns True if node has valid config with version number
|
|
39
|
-
*/
|
|
40
|
-
static hasConfig(i) {
|
|
41
|
-
if (!i || !("getNodeConfig" in i) || typeof i.getNodeConfig != "function")
|
|
42
|
-
return !1;
|
|
43
|
-
try {
|
|
44
|
-
const t = i.getNodeConfig();
|
|
45
|
-
return a(t);
|
|
46
|
-
} catch {
|
|
47
|
-
return !1;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get the configuration version from a node
|
|
52
|
-
* @param node - The immutable HTML node to check
|
|
53
|
-
* @returns Config version number, or 0 if no config exists
|
|
54
|
-
*/
|
|
55
|
-
static getConfigVersion(i) {
|
|
56
|
-
return this.hasConfig(i) && this.getConfig(i).configVersion || 0;
|
|
57
|
-
}
|
|
58
|
-
// ========================================================================
|
|
59
|
-
// Write Operations
|
|
60
|
-
// ========================================================================
|
|
61
|
-
/**
|
|
62
|
-
* Update specific configuration values
|
|
63
|
-
*
|
|
64
|
-
* Merges the updates with existing config and persists to node.
|
|
65
|
-
* This is the primary way to update configuration from controls.
|
|
66
|
-
* @example
|
|
67
|
-
* RecommendationConfigService.updateConfig(
|
|
68
|
-
* this.api,
|
|
69
|
-
* this.currentNode,
|
|
70
|
-
* { strategy: 'complementaryItems' },
|
|
71
|
-
* 'Changed recommendation algorithm'
|
|
72
|
-
* );
|
|
73
|
-
* @param api - Stripo extension API with document modifier
|
|
74
|
-
* @param node - The immutable HTML node to update
|
|
75
|
-
* @param updates - Partial config with values to update
|
|
76
|
-
* @param description - Human-readable description for undo/redo
|
|
77
|
-
* @returns The new complete configuration
|
|
78
|
-
*/
|
|
79
|
-
static updateConfig(i, t, o, n) {
|
|
80
|
-
const s = this.getConfig(t), r = this.deepMerge(s, o);
|
|
81
|
-
return this.saveConfig(i, t, r, n), r;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Initialize configuration for a new block
|
|
85
|
-
*
|
|
86
|
-
* Called when a block is first created (dropped into template).
|
|
87
|
-
* Can optionally merge in partial config from migration.
|
|
88
|
-
* @example
|
|
89
|
-
* // In Block.onCreated lifecycle
|
|
90
|
-
* RecommendationConfigService.initializeConfig(this.api, node);
|
|
91
|
-
* @param api - Stripo extension API with document modifier
|
|
92
|
-
* @param node - The immutable HTML node to initialize
|
|
93
|
-
* @param partialConfig - Optional partial config to merge with defaults
|
|
94
|
-
* @returns The initialized configuration
|
|
95
|
-
*/
|
|
96
|
-
static initializeConfig(i, t, o) {
|
|
97
|
-
const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
|
|
98
|
-
return this.saveConfig(i, t, n, "Initialize recommendation block"), g({
|
|
99
|
-
currentNode: t,
|
|
100
|
-
documentModifier: i.getDocumentModifier(),
|
|
101
|
-
currency: n.currency
|
|
102
|
-
}), n;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Save complete configuration to a node
|
|
106
|
-
*
|
|
107
|
-
* Low-level method - prefer `updateConfig` or `initializeConfig` in most cases.
|
|
108
|
-
* @param api - Stripo extension API with document modifier
|
|
109
|
-
* @param node - The immutable HTML node to save to
|
|
110
|
-
* @param config - Complete configuration to save
|
|
111
|
-
* @param description - Human-readable description for undo/redo
|
|
112
|
-
*/
|
|
113
|
-
static saveConfig(i, t, o, n) {
|
|
114
|
-
try {
|
|
115
|
-
i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new f(n));
|
|
116
|
-
} catch (s) {
|
|
117
|
-
console.warn("[RecommendationConfigService] Failed to save config:", s);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// ========================================================================
|
|
121
|
-
// Migration Helpers
|
|
122
|
-
// ========================================================================
|
|
123
|
-
/**
|
|
124
|
-
* Migrate configuration from legacy data-attributes
|
|
125
|
-
*
|
|
126
|
-
* Reads existing data-attributes and creates a proper node config.
|
|
127
|
-
* Used when loading templates created before node config was implemented.
|
|
128
|
-
* @param api - Stripo extension API with document modifier
|
|
129
|
-
* @param node - The block node to migrate
|
|
130
|
-
* @returns The migrated configuration
|
|
131
|
-
*/
|
|
132
|
-
static migrateFromDataAttributes(i, t) {
|
|
133
|
-
const o = {
|
|
134
|
-
configVersion: u
|
|
135
|
-
};
|
|
136
|
-
if ("getAttribute" in t && typeof t.getAttribute == "function") {
|
|
137
|
-
const n = t.getAttribute("data-layout");
|
|
138
|
-
n === "list" || n === "horizontal" ? o.layout = "list" : (n === "grid" || n === "vertical") && (o.layout = "grid");
|
|
139
|
-
const s = t.getAttribute("data-card-composition");
|
|
140
|
-
s && (o.composition = s.split(",").filter(Boolean));
|
|
141
|
-
const r = t.getAttribute("data-column-spacing");
|
|
142
|
-
r && (o.columnSpacing = parseInt(r) || e.columnSpacing);
|
|
143
|
-
const c = t.getAttribute("data-row-spacing");
|
|
144
|
-
c && (o.rowSpacing = parseInt(c) || e.rowSpacing);
|
|
145
|
-
}
|
|
146
|
-
return this.initializeConfig(i, t, o);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Check if configuration needs migration
|
|
150
|
-
* @param node - The block node to check
|
|
151
|
-
* @returns True if migration is needed
|
|
152
|
-
*/
|
|
153
|
-
static needsMigration(i) {
|
|
154
|
-
return i ? this.hasConfig(i) ? this.getConfigVersion(i) < u : !0 : !1;
|
|
155
|
-
}
|
|
156
|
-
// ========================================================================
|
|
157
|
-
// Internal Helpers
|
|
158
|
-
// ========================================================================
|
|
159
|
-
/**
|
|
160
|
-
* Clone default config to avoid mutations
|
|
161
|
-
*/
|
|
162
|
-
static cloneDefaults() {
|
|
163
|
-
return {
|
|
164
|
-
...e,
|
|
165
|
-
currency: { ...e.currency },
|
|
166
|
-
omnibusPrice: { ...e.omnibusPrice },
|
|
167
|
-
omnibusDiscount: { ...e.omnibusDiscount },
|
|
168
|
-
composition: [...e.composition],
|
|
169
|
-
visibility: { ...e.visibility },
|
|
170
|
-
filters: [],
|
|
171
|
-
productIds: [],
|
|
172
|
-
recommendationId: 0
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Merge partial config with defaults
|
|
177
|
-
*
|
|
178
|
-
* Deep merges nested objects like currency, omnibus settings.
|
|
179
|
-
*/
|
|
180
|
-
static mergeWithDefaults(i) {
|
|
181
|
-
const t = this.cloneDefaults();
|
|
182
|
-
return {
|
|
183
|
-
...t,
|
|
184
|
-
...i,
|
|
185
|
-
currency: {
|
|
186
|
-
...t.currency,
|
|
187
|
-
...i.currency || {}
|
|
188
|
-
},
|
|
189
|
-
omnibusPrice: {
|
|
190
|
-
...t.omnibusPrice,
|
|
191
|
-
...i.omnibusPrice || {}
|
|
192
|
-
},
|
|
193
|
-
omnibusDiscount: {
|
|
194
|
-
...t.omnibusDiscount,
|
|
195
|
-
...i.omnibusDiscount || {}
|
|
196
|
-
},
|
|
197
|
-
visibility: {
|
|
198
|
-
...t.visibility,
|
|
199
|
-
...i.visibility || {}
|
|
200
|
-
},
|
|
201
|
-
composition: i.composition || t.composition,
|
|
202
|
-
filters: i.filters || [],
|
|
203
|
-
productIds: i.productIds || []
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Deep merge for nested objects
|
|
208
|
-
*
|
|
209
|
-
* Recursively merges source into target, preserving existing values
|
|
210
|
-
* that aren't explicitly overwritten.
|
|
211
|
-
*/
|
|
212
|
-
static deepMerge(i, t) {
|
|
213
|
-
return {
|
|
214
|
-
...i,
|
|
215
|
-
...t,
|
|
216
|
-
currency: {
|
|
217
|
-
...i.currency,
|
|
218
|
-
...t.currency || {}
|
|
219
|
-
},
|
|
220
|
-
omnibusPrice: {
|
|
221
|
-
...i.omnibusPrice,
|
|
222
|
-
...t.omnibusPrice || {}
|
|
223
|
-
},
|
|
224
|
-
omnibusDiscount: {
|
|
225
|
-
...i.omnibusDiscount,
|
|
226
|
-
...t.omnibusDiscount || {}
|
|
227
|
-
},
|
|
228
|
-
visibility: {
|
|
229
|
-
...i.visibility,
|
|
230
|
-
...t.visibility || {}
|
|
231
|
-
},
|
|
232
|
-
composition: t.composition ?? i.composition,
|
|
233
|
-
filters: t.filters ?? i.filters,
|
|
234
|
-
productIds: t.productIds ?? i.productIds
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
export {
|
|
239
|
-
C as RecommendationConfigService
|
|
240
|
-
};
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { RecommendationBlockId as s } from "../../constants/blockIds.js";
|
|
2
|
-
import { ATTR_PRODUCT_BUTTON as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as m, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_PRICE as y, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
|
|
3
|
-
import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
|
|
4
|
-
import { formatPrice as _ } from "../../utils/priceFormatter.js";
|
|
5
|
-
import { sanitizeImageUrl as $ } from "../utils.js";
|
|
6
|
-
const a = "0 5px", o = "attribute-cell";
|
|
7
|
-
function p() {
|
|
8
|
-
const t = T(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
|
-
return {
|
|
10
|
-
code: e.value,
|
|
11
|
-
symbol: e.symbol,
|
|
12
|
-
alignment: e.alignment === "0" ? "before" : "after",
|
|
13
|
-
decimalCount: parseInt(e.decimalCount) || 2,
|
|
14
|
-
decimalSeparator: e.decimalSeparator,
|
|
15
|
-
thousandSeparator: e.thousandSeparator
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function c(t, e = "price") {
|
|
19
|
-
const n = p(), l = t[e], r = (l == null ? void 0 : l[n.code]) ?? Object.values(l ?? {})[0] ?? 0;
|
|
20
|
-
return _({
|
|
21
|
-
price: r,
|
|
22
|
-
currency: n
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const P = {
|
|
26
|
-
[x]: (t) => `
|
|
27
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
28
|
-
<table
|
|
29
|
-
class="product-card-segment"
|
|
30
|
-
width="100%"
|
|
31
|
-
height="100%"
|
|
32
|
-
cellpadding="0"
|
|
33
|
-
cellspacing="0"
|
|
34
|
-
border="0">
|
|
35
|
-
<tbody>
|
|
36
|
-
<tr valign="top">
|
|
37
|
-
<td
|
|
38
|
-
class="esd-block-image product-image"
|
|
39
|
-
align="center"
|
|
40
|
-
esd-extension-block-id="${s.IMAGE}">
|
|
41
|
-
<a target="_blank" href="${t.url}">
|
|
42
|
-
<img
|
|
43
|
-
src="${$(t.image_url)}"
|
|
44
|
-
alt="${t.name}"
|
|
45
|
-
style="display: block; max-width: 100%; height: auto;"
|
|
46
|
-
class="adapt-img">
|
|
47
|
-
</a>
|
|
48
|
-
</td>
|
|
49
|
-
</tr>
|
|
50
|
-
</tbody>
|
|
51
|
-
</table>
|
|
52
|
-
</td>
|
|
53
|
-
`,
|
|
54
|
-
[f]: (t) => `
|
|
55
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
56
|
-
<table
|
|
57
|
-
class="product-card-segment"
|
|
58
|
-
width="100%"
|
|
59
|
-
height="100%"
|
|
60
|
-
cellpadding="0"
|
|
61
|
-
cellspacing="0"
|
|
62
|
-
border="0"
|
|
63
|
-
style="table-layout: fixed;">
|
|
64
|
-
<tbody>
|
|
65
|
-
<tr valign="top">
|
|
66
|
-
<td
|
|
67
|
-
class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
|
|
68
|
-
align="center"
|
|
69
|
-
esd-extension-block-id="${s.NAME}">
|
|
70
|
-
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
71
|
-
<strong>${t.name}</strong>
|
|
72
|
-
</p>
|
|
73
|
-
</td>
|
|
74
|
-
</tr>
|
|
75
|
-
</tbody>
|
|
76
|
-
</table>
|
|
77
|
-
</td>
|
|
78
|
-
`,
|
|
79
|
-
[y]: (t) => `
|
|
80
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
81
|
-
<table
|
|
82
|
-
class="product-card-segment"
|
|
83
|
-
width="100%"
|
|
84
|
-
height="100%"
|
|
85
|
-
cellpadding="0"
|
|
86
|
-
cellspacing="0"
|
|
87
|
-
border="0">
|
|
88
|
-
<tbody>
|
|
89
|
-
<tr valign="top">
|
|
90
|
-
<td
|
|
91
|
-
class="esd-block-text product-price es-p15l es-p15r"
|
|
92
|
-
align="center"
|
|
93
|
-
esd-extension-block-id="${s.PRICE}">
|
|
94
|
-
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
95
|
-
<strong>${c(t, "price")}</strong>
|
|
96
|
-
</p>
|
|
97
|
-
</td>
|
|
98
|
-
</tr>
|
|
99
|
-
</tbody>
|
|
100
|
-
</table>
|
|
101
|
-
</td>
|
|
102
|
-
`,
|
|
103
|
-
[h]: (t) => `
|
|
104
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
105
|
-
<table
|
|
106
|
-
class="product-card-segment"
|
|
107
|
-
width="100%"
|
|
108
|
-
height="100%"
|
|
109
|
-
cellpadding="0"
|
|
110
|
-
cellspacing="0"
|
|
111
|
-
border="0">
|
|
112
|
-
<tbody>
|
|
113
|
-
<tr valign="top">
|
|
114
|
-
<td
|
|
115
|
-
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
116
|
-
align="center"
|
|
117
|
-
esd-extension-block-id="${s.OLD_PRICE}">
|
|
118
|
-
<p contenteditable="false" style="font-size: 14px; color: #999999;">
|
|
119
|
-
<strong>${c(t, "original_price")}</strong>
|
|
120
|
-
</p>
|
|
121
|
-
</td>
|
|
122
|
-
</tr>
|
|
123
|
-
</tbody>
|
|
124
|
-
</table>
|
|
125
|
-
</td>
|
|
126
|
-
`,
|
|
127
|
-
[m]: (t) => `
|
|
128
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
129
|
-
<table
|
|
130
|
-
class="product-card-segment"
|
|
131
|
-
width="100%"
|
|
132
|
-
height="100%"
|
|
133
|
-
cellpadding="0"
|
|
134
|
-
cellspacing="0"
|
|
135
|
-
border="0">
|
|
136
|
-
<tbody>
|
|
137
|
-
<tr valign="top">
|
|
138
|
-
<td
|
|
139
|
-
class="esd-block-text product-omnibus-price es-p15l es-p15r"
|
|
140
|
-
align="center"
|
|
141
|
-
data-text-before="Lowest 30-day price: "
|
|
142
|
-
data-text-after=""
|
|
143
|
-
esd-extension-block-id="${s.OMNIBUS_PRICE}">
|
|
144
|
-
<p style="font-size: 12px; color: #666666;">
|
|
145
|
-
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
146
|
-
<span class="omnibus-price-value">${c(t, "original_price")}</span>
|
|
147
|
-
<span class="omnibus-text-after"></span>
|
|
148
|
-
</p>
|
|
149
|
-
</td>
|
|
150
|
-
</tr>
|
|
151
|
-
</tbody>
|
|
152
|
-
</table>
|
|
153
|
-
</td>
|
|
154
|
-
`,
|
|
155
|
-
[u]: (t) => {
|
|
156
|
-
var d, i;
|
|
157
|
-
const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - l) / n * 100) : 0, g = r > 0 ? `-${r}%` : "0%";
|
|
158
|
-
return `
|
|
159
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
160
|
-
<table
|
|
161
|
-
class="product-card-segment"
|
|
162
|
-
width="100%"
|
|
163
|
-
height="100%"
|
|
164
|
-
cellpadding="0"
|
|
165
|
-
cellspacing="0"
|
|
166
|
-
border="0">
|
|
167
|
-
<tbody>
|
|
168
|
-
<tr valign="top">
|
|
169
|
-
<td
|
|
170
|
-
class="esd-block-text product-omnibus-discount es-p15l es-p15r"
|
|
171
|
-
align="center"
|
|
172
|
-
data-text-before=""
|
|
173
|
-
data-text-after=""
|
|
174
|
-
esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
|
|
175
|
-
<p style="font-size: 12px; color: #666666;">
|
|
176
|
-
<span class="omnibus-text-before"></span>
|
|
177
|
-
<span class="omnibus-discount-value">${g}</span>
|
|
178
|
-
<span class="omnibus-text-after"></span>
|
|
179
|
-
</p>
|
|
180
|
-
</td>
|
|
181
|
-
</tr>
|
|
182
|
-
</tbody>
|
|
183
|
-
</table>
|
|
184
|
-
</td>
|
|
185
|
-
`;
|
|
186
|
-
},
|
|
187
|
-
[b]: () => `
|
|
188
|
-
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
189
|
-
<table
|
|
190
|
-
class="product-card-segment"
|
|
191
|
-
width="100%"
|
|
192
|
-
height="100%"
|
|
193
|
-
cellpadding="0"
|
|
194
|
-
cellspacing="0"
|
|
195
|
-
border="0">
|
|
196
|
-
<tbody>
|
|
197
|
-
<tr valign="top">
|
|
198
|
-
<td
|
|
199
|
-
class="esd-block-button product-button es-p10t es-p10b"
|
|
200
|
-
align="center"
|
|
201
|
-
esd-extension-block-id="${s.BUTTON}">
|
|
202
|
-
<span
|
|
203
|
-
class="es-button-border"
|
|
204
|
-
style="
|
|
205
|
-
border-width: 1px;
|
|
206
|
-
background: rgb(217, 234, 211);
|
|
207
|
-
border-color: rgb(106, 168, 79);
|
|
208
|
-
">
|
|
209
|
-
<a
|
|
210
|
-
href="#"
|
|
211
|
-
class="es-button buy-button"
|
|
212
|
-
target="_blank"
|
|
213
|
-
style="color: rgb(56, 118, 29); background: rgb(217, 234, 211);">
|
|
214
|
-
Buy
|
|
215
|
-
</a>
|
|
216
|
-
</span>
|
|
217
|
-
</td>
|
|
218
|
-
</tr>
|
|
219
|
-
</tbody>
|
|
220
|
-
</table>
|
|
221
|
-
</td>
|
|
222
|
-
`
|
|
223
|
-
};
|
|
224
|
-
export {
|
|
225
|
-
o as ATTRIBUTE_CELL_CLASS,
|
|
226
|
-
a as DEFAULT_CELL_PADDING,
|
|
227
|
-
P as gridElementRenderer
|
|
228
|
-
};
|