@useinsider/guido 2.1.0-beta.2ad77c6 → 2.1.0-beta.2d0ecb3
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/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +1 -1
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/config/migrator/itemsBlockMigrator.js +65 -64
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +173 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +291 -217
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +94 -53
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +32 -32
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/guido.css +1 -1
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +33 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +27 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/static/styles/components/notification.css.js +18 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/customEditorStyle.css.js +50 -23
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/stores/unsubscribe.js +37 -34
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var M = (e, t, r) =>
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { ItemInCartOptions as
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var B = (e, t, r) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var M = (e, t, r) => B(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { productPairs as U } from "../../extensions/Blocks/Items/enums/productEnums.js";
|
|
5
|
+
import { ItemInCartOptions as T, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
6
6
|
import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
|
|
7
7
|
const w = {
|
|
8
8
|
img: {
|
|
@@ -85,18 +85,19 @@ function q(e) {
|
|
|
85
85
|
}[e] || u.ITEMS_TYPE.CART_ITEMS : u.ITEMS_TYPE.CART_ITEMS;
|
|
86
86
|
}
|
|
87
87
|
function R(e) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
var a;
|
|
89
|
+
const t = (_, c) => _ == null ? c : _ === "1" || _ === "true", r = (_, c) => _ || c, l = e["data-type"] || e["data-source"], i = q(l), n = T[i];
|
|
90
|
+
let o = e["data-cart_items_select_control_value"] || ((a = n == null ? void 0 : n[0]) == null ? void 0 : a.value) || g.cartItemsSelectControlValue;
|
|
91
|
+
if (o && !o.includes("{{") && /^\d+$/.test(o)) {
|
|
92
|
+
const _ = parseInt(o) - 1, c = T[i];
|
|
93
|
+
c && c[_] && (o = c[_].value);
|
|
93
94
|
}
|
|
94
95
|
return {
|
|
95
96
|
initialized: !0,
|
|
96
97
|
blockInstanceId: r(e["data-block-instance-id"], F()),
|
|
97
98
|
source: i,
|
|
98
99
|
type: i,
|
|
99
|
-
itemsSelectValue:
|
|
100
|
+
itemsSelectValue: o,
|
|
100
101
|
orientation: e["data-card_orientation_control_value"] || u.ORIENTATION.VERTICAL,
|
|
101
102
|
nameTrimming: t(e["data-product_name_control_trim"], !0),
|
|
102
103
|
priceHideDiscount: t(e["data-product_price_control_nodup"], !0),
|
|
@@ -154,36 +155,36 @@ class V {
|
|
|
154
155
|
try {
|
|
155
156
|
let r = this.removeJinjaConditionals(t);
|
|
156
157
|
r = this.replaceTemplateVariables(r);
|
|
157
|
-
const
|
|
158
|
+
const l = this.parser.parseFromString(r, "text/html"), i = l.querySelectorAll(
|
|
158
159
|
"td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
|
|
159
160
|
);
|
|
160
161
|
return i.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (i.forEach((n) => {
|
|
161
|
-
const
|
|
162
|
-
orientation:
|
|
163
|
-
itemsType:
|
|
164
|
-
itemId:
|
|
165
|
-
currencySymbol:
|
|
166
|
-
currencyLocation:
|
|
167
|
-
formattedPrice:
|
|
168
|
-
configBlockAttributes:
|
|
162
|
+
const o = this.extractConfiguration(n), a = K({
|
|
163
|
+
orientation: o.orientation,
|
|
164
|
+
itemsType: o.itemsType,
|
|
165
|
+
itemId: o.itemId,
|
|
166
|
+
currencySymbol: o.currencySymbol,
|
|
167
|
+
currencyLocation: o.currencyLocation,
|
|
168
|
+
formattedPrice: o.formattedPrice,
|
|
169
|
+
configBlockAttributes: o.configBlockAttributes,
|
|
169
170
|
migrate: !0,
|
|
170
|
-
nameStyles:
|
|
171
|
-
buttonStyles:
|
|
172
|
-
priceStyles:
|
|
173
|
-
originalPriceStyles:
|
|
174
|
-
quantityStyles:
|
|
175
|
-
nodeConfig: R(
|
|
176
|
-
}),
|
|
177
|
-
`<table><tbody><tr>${
|
|
171
|
+
nameStyles: o.nameStyles,
|
|
172
|
+
buttonStyles: o.buttonStyles,
|
|
173
|
+
priceStyles: o.priceStyles,
|
|
174
|
+
originalPriceStyles: o.originalPriceStyles,
|
|
175
|
+
quantityStyles: o.quantityStyles,
|
|
176
|
+
nodeConfig: R(o.configBlockAttributes)
|
|
177
|
+
}), c = this.parser.parseFromString(
|
|
178
|
+
`<table><tbody><tr>${a}</tr></tbody></table>`,
|
|
178
179
|
"text/html"
|
|
179
180
|
).querySelector("td");
|
|
180
|
-
if (
|
|
181
|
-
const f = R(
|
|
182
|
-
|
|
183
|
-
const d =
|
|
184
|
-
d && d.remove(), n.parentNode.replaceChild(
|
|
181
|
+
if (c && n.parentNode) {
|
|
182
|
+
const f = R(o.configBlockAttributes);
|
|
183
|
+
c.setAttribute("esd-ext-config", JSON.stringify(f));
|
|
184
|
+
const d = c.querySelector("esd-config-block");
|
|
185
|
+
d && d.remove(), n.parentNode.replaceChild(c, n);
|
|
185
186
|
}
|
|
186
|
-
}),
|
|
187
|
+
}), l.documentElement.outerHTML);
|
|
187
188
|
} catch (r) {
|
|
188
189
|
return console.error("ItemsBlockMigrator failed:", r), t;
|
|
189
190
|
}
|
|
@@ -196,14 +197,14 @@ class V {
|
|
|
196
197
|
*/
|
|
197
198
|
extractConfiguration(t) {
|
|
198
199
|
var C, D, P;
|
|
199
|
-
const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS",
|
|
200
|
+
const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", l = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", i = parseInt(l) - 1, n = T[r], o = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, a = t.querySelector('[product-attr="price"]'), _ = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, l), S = s["data-card_orientation_control_value"];
|
|
200
201
|
let b;
|
|
201
202
|
S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
|
|
202
|
-
const p = t.querySelector('a[product-attr="name"]'), I = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (
|
|
203
|
+
const p = t.querySelector('a[product-attr="name"]'), I = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), k = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), L = (E == null ? void 0 : E.getAttribute("style")) || void 0;
|
|
203
204
|
return {
|
|
204
205
|
orientation: b,
|
|
205
206
|
itemsType: r,
|
|
206
|
-
itemId:
|
|
207
|
+
itemId: o,
|
|
207
208
|
currencySymbol: _,
|
|
208
209
|
currencyLocation: f,
|
|
209
210
|
formattedPrice: d,
|
|
@@ -222,27 +223,27 @@ class V {
|
|
|
222
223
|
* @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
|
|
223
224
|
* @param itemNumber - The item number (1-based index)
|
|
224
225
|
*/
|
|
225
|
-
extractConfigBlockAttributes(t, r,
|
|
226
|
+
extractConfigBlockAttributes(t, r, l) {
|
|
226
227
|
const i = t.querySelector("esd-config-block"), n = {};
|
|
227
228
|
if (!i)
|
|
228
229
|
return this.getDefaultConfigBlockAttributes();
|
|
229
|
-
if (Array.from(i.attributes).forEach((
|
|
230
|
-
|
|
230
|
+
if (Array.from(i.attributes).forEach((a) => {
|
|
231
|
+
a.name.startsWith("data-") && (n[a.name] = a.value);
|
|
231
232
|
}), n["data-cart_items_select_control_value"]) {
|
|
232
|
-
const
|
|
233
|
-
if (/^\d+$/.test(
|
|
234
|
-
const _ = parseInt(
|
|
235
|
-
|
|
233
|
+
const a = n["data-cart_items_select_control_value"];
|
|
234
|
+
if (/^\d+$/.test(a)) {
|
|
235
|
+
const _ = parseInt(a) - 1, c = T[r];
|
|
236
|
+
c && c[_] && (n["data-cart_items_select_control_value"] = c[_].value);
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
if (n["data-product_price_control_curency"]) {
|
|
239
|
-
const
|
|
240
|
-
let _ =
|
|
241
|
-
|
|
240
|
+
const a = n["data-product_price_control_curency"];
|
|
241
|
+
let _ = a;
|
|
242
|
+
a === "before" ? _ = "0" : a === "after" && (_ = "1"), n["data-product_price_control_curency"] = _, n["data-product_price_currency_location"] = _;
|
|
242
243
|
}
|
|
243
244
|
(!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
|
|
244
|
-
const
|
|
245
|
-
return
|
|
245
|
+
const o = { ...this.getDefaultConfigBlockAttributes(), ...n };
|
|
246
|
+
return o["data-type"] = r, o["data-source"] = r, o["data-product_image_link"] = $(r, l), o["data-product_button_link"] = x(r, l), o;
|
|
246
247
|
}
|
|
247
248
|
/**
|
|
248
249
|
* Returns default esd-config-block attributes based on the old template structure
|
|
@@ -302,15 +303,15 @@ class V {
|
|
|
302
303
|
* contains display condition Jinja scripts that should NOT be removed.
|
|
303
304
|
*/
|
|
304
305
|
removeJinjaConditionals(t) {
|
|
305
|
-
const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__",
|
|
306
|
-
let i =
|
|
306
|
+
const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", l = t.match(/esd-custom-display-conditions="[^"]*"/);
|
|
307
|
+
let i = l ? t.replace(l[0], r) : t;
|
|
307
308
|
return i = i.replace(
|
|
308
309
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}/g,
|
|
309
310
|
""
|
|
310
311
|
), i = i.replace(
|
|
311
312
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
|
|
312
313
|
""
|
|
313
|
-
), i = i.replace(/\{%\s*endif\s*%\}/g, ""),
|
|
314
|
+
), i = i.replace(/\{%\s*endif\s*%\}/g, ""), l && (i = i.replace(r, l[0])), i = i.replace(/\n\s*\n\s*\n/g, `
|
|
314
315
|
|
|
315
316
|
`), i;
|
|
316
317
|
}
|
|
@@ -324,26 +325,26 @@ class V {
|
|
|
324
325
|
* - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
|
|
325
326
|
*/
|
|
326
327
|
replaceTemplateVariables(t) {
|
|
327
|
-
const { PAIRS_FOR_EXTENSION: r } =
|
|
328
|
-
return t.replace(/{{([^}]+)}}/g, (
|
|
328
|
+
const { PAIRS_FOR_EXTENSION: r } = U;
|
|
329
|
+
return t.replace(/{{([^}]+)}}/g, (l, i) => {
|
|
329
330
|
const n = i.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
|
|
330
331
|
if (!n)
|
|
331
|
-
return
|
|
332
|
-
const [,
|
|
333
|
-
if (!
|
|
334
|
-
return console.warn(`Unknown variable prefix: ${
|
|
335
|
-
const f = w[
|
|
332
|
+
return l;
|
|
333
|
+
const [, o, a, _] = n, c = O[o];
|
|
334
|
+
if (!c)
|
|
335
|
+
return console.warn(`Unknown variable prefix: ${o}`), l;
|
|
336
|
+
const f = w[a];
|
|
336
337
|
if (!f)
|
|
337
|
-
return console.warn(`Unknown variable suffix mapping for: ${
|
|
338
|
-
const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][
|
|
338
|
+
return console.warn(`Unknown variable suffix mapping for: ${a}`), l;
|
|
339
|
+
const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][c];
|
|
339
340
|
if (!p)
|
|
340
|
-
return console.warn(`No data found for: ${d}.${
|
|
341
|
+
return console.warn(`No data found for: ${d}.${c}`), l;
|
|
341
342
|
if (S) {
|
|
342
343
|
const y = parseInt(_) - 1, m = p[s];
|
|
343
|
-
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${
|
|
344
|
+
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${c}.${s}[${y}]`), l);
|
|
344
345
|
}
|
|
345
346
|
const I = p[s];
|
|
346
|
-
return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${
|
|
347
|
+
return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${c}.${s}`), l);
|
|
347
348
|
});
|
|
348
349
|
}
|
|
349
350
|
}
|
|
@@ -17,7 +17,7 @@ class w {
|
|
|
17
17
|
const l = o.getAttribute("id"), r = this.extractBgColor(o), i = this.extractTitle(o), u = this.extractProductRows(o), c = P.replace("{-{-TITLE-}-}", i).replace("{-{-PRODUCT_ROWS-}-}", u), a = this.parser.parseFromString(
|
|
18
18
|
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
19
19
|
"text/html"
|
|
20
|
-
).querySelector(".
|
|
20
|
+
).querySelector(".recommendation-block-v2");
|
|
21
21
|
a && o.parentNode && (l && a.setAttribute("id", l), r && a.setAttribute("bgcolor", r), o.parentNode.replaceChild(a, o));
|
|
22
22
|
}), t.documentElement.outerHTML);
|
|
23
23
|
} catch (t) {
|
|
@@ -6,7 +6,7 @@ import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules
|
|
|
6
6
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
|
|
8
8
|
import { getDefaultTemplate as k } from "./templates/grid/template.js";
|
|
9
|
-
const B = "recommendation-block", c = "
|
|
9
|
+
const B = "recommendation-block", c = "recommendation-block-v2", a = "recommendation-id";
|
|
10
10
|
class y extends h {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_MOBILE_ROW_SPACING as U, DEFAULT_MOBILE_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as n, DEFAULT_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as C, DEFAULT_CARDS_IN_ROW as D } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as t, ATTR_PRODUCT_PRICE as e, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as r } from "./selectors.js";
|
|
3
|
+
const i = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, A = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
|
-
},
|
|
13
|
+
}, s = {
|
|
14
14
|
textBefore: "",
|
|
15
15
|
textAfter: ""
|
|
16
|
-
},
|
|
16
|
+
}, E = [
|
|
17
|
+
_,
|
|
18
|
+
o,
|
|
17
19
|
t,
|
|
18
20
|
e,
|
|
19
|
-
o,
|
|
20
|
-
_,
|
|
21
21
|
T,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
],
|
|
25
|
-
[t]: !0,
|
|
26
|
-
[e]: !0,
|
|
22
|
+
I,
|
|
23
|
+
r
|
|
24
|
+
], c = {
|
|
27
25
|
[_]: !0,
|
|
28
26
|
[o]: !0,
|
|
27
|
+
[e]: !0,
|
|
28
|
+
[t]: !0,
|
|
29
29
|
[T]: !1,
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
},
|
|
30
|
+
[I]: !1,
|
|
31
|
+
[r]: !0
|
|
32
|
+
}, N = {
|
|
33
33
|
// Settings
|
|
34
34
|
strategy: "mostPopular",
|
|
35
35
|
productIds: [],
|
|
36
36
|
size: "6",
|
|
37
37
|
shuffleProducts: !1,
|
|
38
38
|
language: "en_US",
|
|
39
|
-
currency:
|
|
39
|
+
currency: i,
|
|
40
40
|
filters: [],
|
|
41
41
|
// Layout
|
|
42
42
|
layout: "grid",
|
|
43
|
-
cardsInRow:
|
|
44
|
-
mobileCardsInRow:
|
|
45
|
-
columnSpacing:
|
|
46
|
-
rowSpacing:
|
|
43
|
+
cardsInRow: D,
|
|
44
|
+
mobileCardsInRow: C,
|
|
45
|
+
columnSpacing: O,
|
|
46
|
+
rowSpacing: n,
|
|
47
|
+
mobileColumnSpacing: R,
|
|
48
|
+
mobileRowSpacing: U,
|
|
47
49
|
// Composition
|
|
48
|
-
composition:
|
|
49
|
-
visibility:
|
|
50
|
+
composition: E,
|
|
51
|
+
visibility: c,
|
|
50
52
|
// Element settings
|
|
51
|
-
omnibusPrice:
|
|
52
|
-
omnibusDiscount:
|
|
53
|
+
omnibusPrice: A,
|
|
54
|
+
omnibusDiscount: s,
|
|
53
55
|
textTrimming: !1,
|
|
54
56
|
// Meta
|
|
55
57
|
configVersion: 1,
|
|
56
58
|
recommendationId: 0
|
|
57
|
-
},
|
|
59
|
+
}, m = [11, 12], L = 1;
|
|
58
60
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
L as CURRENT_CONFIG_VERSION,
|
|
62
|
+
E as DEFAULT_COMPOSITION,
|
|
63
|
+
i as DEFAULT_CURRENCY,
|
|
64
|
+
N as DEFAULT_NODE_CONFIG,
|
|
65
|
+
s as DEFAULT_OMNIBUS_DISCOUNT,
|
|
66
|
+
A as DEFAULT_OMNIBUS_PRICE,
|
|
67
|
+
c as DEFAULT_VISIBILITY,
|
|
68
|
+
m as EXCLUDED_ALGORITHM_IDS
|
|
66
69
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
const _ = {
|
|
2
2
|
GRID: "grid",
|
|
3
3
|
LIST: "list"
|
|
4
|
-
},
|
|
4
|
+
}, A = [
|
|
5
5
|
{ icon: "grid-orientation", value: _.GRID },
|
|
6
6
|
{ icon: "list-orientation", value: _.LIST }
|
|
7
|
-
],
|
|
7
|
+
], o = 3, t = 3, O = 9, n = 4, I = 1, L = 2, R = 10, T = 10, c = 10, s = 10, S = 0, U = 50, C = 5;
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
s as
|
|
14
|
-
o as
|
|
9
|
+
t as DEFAULT_CARDS_IN_ROW,
|
|
10
|
+
R as DEFAULT_COLUMN_SPACING,
|
|
11
|
+
I as DEFAULT_MOBILE_CARDS_IN_ROW,
|
|
12
|
+
c as DEFAULT_MOBILE_COLUMN_SPACING,
|
|
13
|
+
s as DEFAULT_MOBILE_ROW_SPACING,
|
|
14
|
+
o as DEFAULT_PRODUCTS_PER_ROW,
|
|
15
|
+
T as DEFAULT_ROW_SPACING,
|
|
16
|
+
A as LAYOUT_OPTIONS,
|
|
15
17
|
_ as LAYOUT_VALUES,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
L as MAX_MOBILE_PRODUCTS_PER_ROW,
|
|
19
|
+
n as MAX_PRODUCTS_PER_ROW,
|
|
20
|
+
O as MAX_PRODUCT_COUNT,
|
|
21
|
+
U as MAX_SPACING,
|
|
22
|
+
S as MIN_SPACING,
|
|
23
|
+
C as SPACING_STEP
|
|
22
24
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
const c = ".ins-recommendation-product-container",
|
|
1
|
+
const c = ".recommendation-block-v2", n = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", T = ".ins-recommendation-mobile-container", t = ".ins-recommendation-mobile-row", r = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
},
|
|
8
|
+
}, R = "productImage", O = "productName", e = "productPrice", _ = "productOldPrice", E = "productOmnibusPrice", C = "productOmnibusDiscount", s = "productButton";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
c as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
o as
|
|
10
|
+
s as ATTR_PRODUCT_BUTTON,
|
|
11
|
+
R as ATTR_PRODUCT_IMAGE,
|
|
12
|
+
O as ATTR_PRODUCT_NAME,
|
|
13
|
+
_ as ATTR_PRODUCT_OLD_PRICE,
|
|
14
|
+
C as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
15
|
+
E as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
16
|
+
e as ATTR_PRODUCT_PRICE,
|
|
17
|
+
c as BLOCK_ROOT_SELECTOR,
|
|
18
|
+
n as CONTAINER_SELECTOR,
|
|
19
|
+
r as CURRENCY_ATTR,
|
|
20
|
+
o as DESKTOP_CONTAINER_SELECTOR,
|
|
21
|
+
T as MOBILE_CONTAINER_SELECTOR,
|
|
22
|
+
t as MOBILE_ROW_SELECTOR
|
|
21
23
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createButtonFitToContainerControl as T, createButtonTextStyleAndFontColorControl as r, createButtonTextSizeControl as e, createButtonTextControl as B, createButtonPaddingsControl as l, createButtonMarginsControl as C, createButtonFontFamilyControl as O, createButtonColorControl as N, createButtonBorderRadiusControl as i, createButtonBorderControl as a, createButtonAlignControl as c } from "../../../controlFactories.js";
|
|
2
2
|
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
3
|
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
5
|
const U = c(
|
|
6
6
|
t.BUTTON_ALIGN,
|
|
7
7
|
o.BUTTON,
|
|
@@ -34,19 +34,19 @@ const U = c(
|
|
|
34
34
|
t.BUTTON_TEXT,
|
|
35
35
|
o.BUTTON,
|
|
36
36
|
n
|
|
37
|
-
),
|
|
37
|
+
), S = e(
|
|
38
38
|
t.BUTTON_TEXT_SIZE,
|
|
39
39
|
o.BUTTON,
|
|
40
40
|
n
|
|
41
|
-
),
|
|
41
|
+
), A = r(
|
|
42
42
|
t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
43
43
|
o.BUTTON,
|
|
44
44
|
n
|
|
45
|
-
),
|
|
45
|
+
), x = T(
|
|
46
46
|
t.BUTTON_FIT_TO_CONTENT,
|
|
47
47
|
o.BUTTON,
|
|
48
48
|
n
|
|
49
|
-
),
|
|
49
|
+
), f = {
|
|
50
50
|
align: U,
|
|
51
51
|
border: d,
|
|
52
52
|
borderRadius: s,
|
|
@@ -55,10 +55,10 @@ const U = c(
|
|
|
55
55
|
margins: u,
|
|
56
56
|
paddings: R,
|
|
57
57
|
text: F,
|
|
58
|
-
textSize:
|
|
59
|
-
textStyleAndFontColor:
|
|
60
|
-
fitToContent:
|
|
58
|
+
textSize: S,
|
|
59
|
+
textStyleAndFontColor: A,
|
|
60
|
+
fitToContent: x
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
f as ButtonControls
|
|
64
64
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createImageMarginsControl as m, createImageSizeControl as n } from "../../../controlFactories.js";
|
|
2
2
|
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
3
|
import { RecommendationControlId as r } from "../../constants/controlIds.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as t } from "../../constants/selectors.js";
|
|
5
5
|
const e = n(
|
|
6
6
|
r.IMAGE_SIZE,
|
|
7
7
|
o.IMAGE,
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var _ = (o, e, t) => e in o ? L(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var r = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as h } from "../../../common-control.js";
|
|
6
|
-
import { LAYOUT_OPTIONS as g } from "../../constants/layout.js";
|
|
7
|
-
import { RecommendationConfigService as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getCurrentLayout as
|
|
10
|
-
const
|
|
6
|
+
import { LAYOUT_OPTIONS as N, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as A } from "../../store/recommendation.js";
|
|
9
|
+
import { getCurrentLayout as C, getBlockElement as O, regenerateProductRowsWithStyles as f } from "../main/utils.js";
|
|
10
|
+
const S = "recommendation-layout-control", a = {
|
|
11
11
|
LAYOUT: "layout"
|
|
12
|
-
},
|
|
13
|
-
LAYOUT: "data-layout"
|
|
12
|
+
}, n = {
|
|
13
|
+
LAYOUT: "data-layout",
|
|
14
|
+
COLUMN_SPACING: "data-column-spacing",
|
|
15
|
+
ROW_SPACING: "data-row-spacing",
|
|
16
|
+
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
17
|
+
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
14
18
|
};
|
|
15
|
-
class
|
|
19
|
+
class G extends h {
|
|
16
20
|
constructor() {
|
|
17
21
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
r(this, "store", A());
|
|
23
|
+
r(this, "isChangingLayout", !1);
|
|
20
24
|
}
|
|
21
25
|
getId() {
|
|
22
|
-
return
|
|
26
|
+
return S;
|
|
23
27
|
}
|
|
24
28
|
getTemplate() {
|
|
25
29
|
return `
|
|
@@ -27,8 +31,8 @@ class Y extends h {
|
|
|
27
31
|
${this._GuTwoColumns([
|
|
28
32
|
this._GuLabel({ text: "Layout Orientation" }),
|
|
29
33
|
this._GuRadioButton({
|
|
30
|
-
name:
|
|
31
|
-
buttons:
|
|
34
|
+
name: a.LAYOUT,
|
|
35
|
+
buttons: N
|
|
32
36
|
})
|
|
33
37
|
])}
|
|
34
38
|
</div>
|
|
@@ -41,9 +45,9 @@ class Y extends h {
|
|
|
41
45
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
42
46
|
}
|
|
43
47
|
_setFormValues() {
|
|
44
|
-
const
|
|
48
|
+
const u = s.getConfig(this.currentNode).layout || C(this.currentNode);
|
|
45
49
|
this.api.updateValues({
|
|
46
|
-
[
|
|
50
|
+
[a.LAYOUT]: u
|
|
47
51
|
});
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
@@ -51,18 +55,26 @@ class Y extends h {
|
|
|
51
55
|
* Updates node config, data attribute and regenerates product rows
|
|
52
56
|
*/
|
|
53
57
|
_onLayoutChange(t) {
|
|
54
|
-
if (this.isChangingLayout || !this.currentNode || (
|
|
58
|
+
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
|
|
55
59
|
return;
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
60
|
+
const c = O(this.currentNode);
|
|
61
|
+
if (c) {
|
|
58
62
|
this.isChangingLayout = !0;
|
|
59
63
|
try {
|
|
60
|
-
|
|
64
|
+
s.updateConfig(
|
|
61
65
|
this.api,
|
|
62
66
|
this.currentNode,
|
|
63
|
-
{
|
|
67
|
+
{
|
|
68
|
+
layout: t,
|
|
69
|
+
columnSpacing: g,
|
|
70
|
+
rowSpacing: l,
|
|
71
|
+
mobileColumnSpacing: d,
|
|
72
|
+
mobileRowSpacing: m
|
|
73
|
+
},
|
|
64
74
|
`Changed layout to ${t}`
|
|
65
|
-
), this.store.patchCurrentBlockConfig({ orientation: t })
|
|
75
|
+
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
76
|
+
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
|
|
77
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.apply(new p(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
66
78
|
} finally {
|
|
67
79
|
this.isChangingLayout = !1;
|
|
68
80
|
}
|
|
@@ -74,19 +86,19 @@ class Y extends h {
|
|
|
74
86
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
75
87
|
*/
|
|
76
88
|
_regenerateProductRows(t) {
|
|
77
|
-
this.currentNode &&
|
|
89
|
+
this.currentNode && f({
|
|
78
90
|
currentNode: this.currentNode,
|
|
79
91
|
documentModifier: this.api.getDocumentModifier(),
|
|
80
92
|
layout: t
|
|
81
93
|
});
|
|
82
94
|
}
|
|
83
95
|
_listenToFormUpdates() {
|
|
84
|
-
this.api.onValueChanged(
|
|
96
|
+
this.api.onValueChanged(a.LAYOUT, (t) => {
|
|
85
97
|
this._onLayoutChange(t);
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
}
|
|
89
101
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
S as LAYOUT_CONTROL_ID,
|
|
103
|
+
G as LayoutControl
|
|
92
104
|
};
|