@useinsider/guido 3.17.0-beta.77567eb → 3.17.0-beta.978ff7e
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/composables/useStripo.js +14 -14
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendationMigrator.js +30 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +19 -17
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +310 -238
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +9 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/package.json.js +1 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/package.json +2 -2
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { BlockId as f } from "../../enums/block.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { DEFAULT_NODE_CONFIG as b } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
3
|
+
import { ATTR_RECOMMENDATION_TITLE as T } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useTemplateStore as y } from "../../stores/template.js";
|
|
5
|
+
import { mapComposition as v } from "./recommendation/compositionMapper.js";
|
|
6
|
+
import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
|
|
5
7
|
import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
|
|
6
|
-
import { parseRecommendationId as x, parseLegacyConfig as
|
|
7
|
-
import { mapSettings as
|
|
8
|
-
const
|
|
9
|
-
function B(
|
|
10
|
-
var
|
|
8
|
+
import { parseRecommendationId as x, parseLegacyConfig as E } from "./recommendation/parseLegacyConfig.js";
|
|
9
|
+
import { mapSettings as A } from "./recommendation/settingsMapper.js";
|
|
10
|
+
const H = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
|
|
11
|
+
function B(n, t, a) {
|
|
12
|
+
var l;
|
|
11
13
|
const o = x(t);
|
|
12
14
|
if (o === null)
|
|
13
15
|
return console.warn(
|
|
14
16
|
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
15
17
|
), !1;
|
|
16
|
-
const r =
|
|
18
|
+
const r = E(t);
|
|
17
19
|
if (!r)
|
|
18
20
|
return console.warn(
|
|
19
21
|
`[RecommendationMigrator] Aborting block id=${o} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
20
22
|
), !1;
|
|
21
|
-
const
|
|
22
|
-
currencySettings:
|
|
23
|
-
}, c =
|
|
23
|
+
const i = a[String(o)] ?? {
|
|
24
|
+
currencySettings: C(t)
|
|
25
|
+
}, c = A(i, r, o), e = v((l = r.composition) == null ? void 0 : l.variables), d = M(t);
|
|
26
|
+
e.titleVariable || (e.visibility[T] = R(t));
|
|
27
|
+
const p = S(t), g = {
|
|
24
28
|
...c,
|
|
25
29
|
composition: e.composition,
|
|
26
30
|
visibility: e.visibility,
|
|
31
|
+
previousTitleHtml: b.previousTitleHtml,
|
|
27
32
|
textTrimming: e.anyTextTrimming
|
|
28
|
-
}, m =
|
|
33
|
+
}, m = h(t), u = `
|
|
29
34
|
<table>
|
|
30
35
|
<tbody>
|
|
31
36
|
<tr>
|
|
@@ -33,10 +38,10 @@ function B(i, t, a) {
|
|
|
33
38
|
<table width="100%" cellpadding="0" cellspacing="0">
|
|
34
39
|
<tbody>
|
|
35
40
|
<tr>${w({
|
|
36
|
-
nodeConfig:
|
|
41
|
+
nodeConfig: g,
|
|
37
42
|
composition: e,
|
|
38
|
-
cardBg:
|
|
39
|
-
titleText:
|
|
43
|
+
cardBg: p,
|
|
44
|
+
titleText: d,
|
|
40
45
|
legacyId: t.getAttribute("id") ?? void 0,
|
|
41
46
|
legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
|
|
42
47
|
preserveInnerHtml: m ? t.innerHTML : void 0,
|
|
@@ -48,15 +53,15 @@ function B(i, t, a) {
|
|
|
48
53
|
</tr>
|
|
49
54
|
</tbody>
|
|
50
55
|
</table>
|
|
51
|
-
`, s =
|
|
56
|
+
`, s = n.parseFromString(u, "text/html").querySelector("td.esd-structure");
|
|
52
57
|
return !s || !t.parentNode ? (console.warn(
|
|
53
58
|
`[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
|
|
54
59
|
), !1) : (t.parentNode.replaceChild(s, t), !0);
|
|
55
60
|
}
|
|
56
|
-
function
|
|
57
|
-
const a = new DOMParser(), o = a.parseFromString(
|
|
61
|
+
function G(n, t = {}) {
|
|
62
|
+
const a = new DOMParser(), o = a.parseFromString(n, "text/html"), r = Array.from(o.querySelectorAll(H));
|
|
58
63
|
try {
|
|
59
|
-
|
|
64
|
+
y().$patch((e) => {
|
|
60
65
|
e.migrations = {
|
|
61
66
|
...e.migrations,
|
|
62
67
|
[f.Recommendation]: r.length
|
|
@@ -65,16 +70,16 @@ function q(i, t = {}) {
|
|
|
65
70
|
} catch {
|
|
66
71
|
}
|
|
67
72
|
if (r.length === 0)
|
|
68
|
-
return
|
|
69
|
-
let
|
|
73
|
+
return n;
|
|
74
|
+
let i = 0;
|
|
70
75
|
return r.forEach((c) => {
|
|
71
76
|
try {
|
|
72
|
-
B(a, c, t) && (
|
|
77
|
+
B(a, c, t) && (i += 1);
|
|
73
78
|
} catch (e) {
|
|
74
79
|
console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
|
|
75
80
|
}
|
|
76
|
-
}),
|
|
81
|
+
}), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), o.documentElement.outerHTML;
|
|
77
82
|
}
|
|
78
83
|
export {
|
|
79
|
-
|
|
84
|
+
G as migrateRecommendation
|
|
80
85
|
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var f = (s, t, e) => t in s ? R(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var a = (s, t, e) => f(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { RecommendationBlockId as d } from "../../extensions/Blocks/Recommendation/constants/blockIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as u, CSS_CLASS_SKIP_COMPILE as m, ATTR_DATA_ATTRIBUTE_TYPE as S, ATTR_RECOMMENDATION_TITLE as l, CONTAINER_SELECTOR as E, CSS_CLASS_TITLE_CELL as c, CSS_CLASS_SPACER as C, CSS_CLASS_ATTRIBUTE_ROW as A, ATTR_DATA_VISIBILITY as L } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
|
+
const p = u.slice(1), g = `${u}:not(.${m})`, O = `[${S}="${l}"]`, h = "td.esd-block-text", _ = "table.container > tbody", T = "esd-ext-config";
|
|
7
|
+
class y {
|
|
8
|
+
constructor() {
|
|
9
|
+
a(this, "parser");
|
|
10
|
+
this.parser = new DOMParser();
|
|
11
|
+
}
|
|
12
|
+
migrate(t) {
|
|
13
|
+
try {
|
|
14
|
+
if (!t.includes(p))
|
|
15
|
+
return t;
|
|
16
|
+
const e = this.parser.parseFromString(t, "text/html");
|
|
17
|
+
return Array.from(e.querySelectorAll(g)).reduce(
|
|
18
|
+
(n, o) => this._migrateBlock(o) || n,
|
|
19
|
+
!1
|
|
20
|
+
) ? e.documentElement.outerHTML : t;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return console.error("RecommendationTitleMigrator failed:", e), t;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Migrates one block. Returns `true` when the block was changed. */
|
|
26
|
+
_migrateBlock(t) {
|
|
27
|
+
if (t.querySelector(O) || this._hasRecordedTitleState(t))
|
|
28
|
+
return !1;
|
|
29
|
+
const e = this._findTitleCell(t), i = e !== null && (e.textContent ?? "").trim().length > 0;
|
|
30
|
+
return i ? this._tagExistingTitle(t, e) : this._removeTitleRemnants(t, e), this._writeVisibility(t, i), !0;
|
|
31
|
+
}
|
|
32
|
+
/** The only `esd-block-text` cell outside the product containers is the title. */
|
|
33
|
+
_findTitleCell(t) {
|
|
34
|
+
return Array.from(t.querySelectorAll(h)).find((e) => !e.closest(E) && this._isTitlePosition(t, e)) ?? null;
|
|
35
|
+
}
|
|
36
|
+
_isTitlePosition(t, e) {
|
|
37
|
+
var r;
|
|
38
|
+
const i = this._wrapperRowOf(t, e);
|
|
39
|
+
return e.classList.contains(c) || i !== null && i === ((r = i.parentElement) == null ? void 0 : r.firstElementChild);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Stamps the attribute-row tagging onto the title's wrapper row and the spacer
|
|
43
|
+
* below it, so one toggle governs the pair and the compiler drops both when off.
|
|
44
|
+
*/
|
|
45
|
+
_tagExistingTitle(t, e) {
|
|
46
|
+
e.classList.add(c), e.setAttribute("esd-extension-block-id", d.TITLE);
|
|
47
|
+
const i = this._wrapperRowOf(t, e);
|
|
48
|
+
if (!i)
|
|
49
|
+
return;
|
|
50
|
+
this._tagRow(i);
|
|
51
|
+
const r = i.nextElementSibling;
|
|
52
|
+
r && this._isSpacerRow(r) && this._tagRow(r);
|
|
53
|
+
}
|
|
54
|
+
/** The `<tr>` inside `table.container > tbody` that wraps the title's own table. */
|
|
55
|
+
_wrapperRowOf(t, e) {
|
|
56
|
+
if (!e)
|
|
57
|
+
return null;
|
|
58
|
+
const i = t.querySelector(_);
|
|
59
|
+
return Array.from((i == null ? void 0 : i.children) ?? []).find((r) => r.contains(e)) ?? null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Direct children only — a product-container row holds spacer cells further down,
|
|
63
|
+
* and `querySelector` would happily reach them. (`:scope >` is unsupported in happy-dom.)
|
|
64
|
+
*/
|
|
65
|
+
_isSpacerRow(t) {
|
|
66
|
+
return Array.from(t.children).some((e) => e.classList.contains(C));
|
|
67
|
+
}
|
|
68
|
+
_tagRow(t) {
|
|
69
|
+
t.classList.add(A), t.setAttribute(S, l), t.setAttribute(L, "1");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A deleted title leaves nothing to tag — the toggle re-injects the markup only
|
|
73
|
+
* when the user switches it back on. Its leftovers (an emptied wrapper row, the
|
|
74
|
+
* spacer that trailed it) would otherwise render as blank padding on top.
|
|
75
|
+
*/
|
|
76
|
+
_removeTitleRemnants(t, e) {
|
|
77
|
+
var o;
|
|
78
|
+
const i = this._wrapperRowOf(t, e), r = i == null ? void 0 : i.nextElementSibling;
|
|
79
|
+
if (r && this._isSpacerRow(r) && r.remove(), i) {
|
|
80
|
+
i.remove();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const n = (o = t.querySelector(_)) == null ? void 0 : o.firstElementChild;
|
|
84
|
+
n && this._isSpacerRow(n) && n.remove();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Mirrors the resolved state into the persisted config blob, so a saved module
|
|
88
|
+
* whose `data-*` attributes Stripo strips on re-drop still restores the toggle.
|
|
89
|
+
*/
|
|
90
|
+
_writeVisibility(t, e) {
|
|
91
|
+
const i = this._readConfig(t);
|
|
92
|
+
if (!i)
|
|
93
|
+
return;
|
|
94
|
+
const r = typeof i.visibility == "object" && i.visibility !== null ? i.visibility : {};
|
|
95
|
+
i.visibility = { ...r, [l]: e }, t.setAttribute(T, JSON.stringify(i));
|
|
96
|
+
}
|
|
97
|
+
_hasRecordedTitleState(t) {
|
|
98
|
+
var i;
|
|
99
|
+
const e = (i = this._readConfig(t)) == null ? void 0 : i.visibility;
|
|
100
|
+
return typeof e == "object" && e !== null && l in e;
|
|
101
|
+
}
|
|
102
|
+
_readConfig(t) {
|
|
103
|
+
const e = t.getAttribute(T);
|
|
104
|
+
if (!e)
|
|
105
|
+
return null;
|
|
106
|
+
try {
|
|
107
|
+
const i = JSON.parse(e);
|
|
108
|
+
return typeof i == "object" && i !== null ? i : null;
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function v(s) {
|
|
115
|
+
return new y().migrate(s);
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
v as migrateRecommendationTitle
|
|
119
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var b = /* @__PURE__ */ ((r) => (r.BUTTON = "recommendation-block-button", r.NAME = "recommendation-block-name", r.PRICE = "recommendation-block-price", r.OLD_PRICE = "recommendation-block-old-price", r.OMNIBUS_PRICE = "recommendation-block-omnibus-price", r.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", r.IMAGE = "recommendation-block-image", r.CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute", r))(b || {});
|
|
1
|
+
var b = /* @__PURE__ */ ((r) => (r.BUTTON = "recommendation-block-button", r.NAME = "recommendation-block-name", r.PRICE = "recommendation-block-price", r.OLD_PRICE = "recommendation-block-old-price", r.OMNIBUS_PRICE = "recommendation-block-omnibus-price", r.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", r.IMAGE = "recommendation-block-image", r.CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute", r.TITLE = "recommendation-block-title", r))(b || {});
|
|
2
2
|
export {
|
|
3
3
|
b as RecommendationBlockId
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var o = /* @__PURE__ */ ((c) => (c.BLOCK_BACKGROUND = "recommendation-block-background-color-control", c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
|
|
1
|
+
var o = /* @__PURE__ */ ((c) => (c.BLOCK_BACKGROUND = "recommendation-block-background-color-control", c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.TITLE_ALIGN = "recommendation-block-title-align-control", c.TITLE_BACKGROUND = "recommendation-block-title-background-control", c.TITLE_COLOR = "recommendation-block-title-color-control", c.TITLE_FONT_FAMILY = "recommendation-block-title-font-family-control", c.TITLE_PADDINGS = "recommendation-block-title-paddings-control", c.TITLE_SIZE = "recommendation-block-title-size-control", c.TITLE_STYLE = "recommendation-block-title-style-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
|
|
2
2
|
export {
|
|
3
3
|
o as RecommendationControlId
|
|
4
4
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { DEFAULT_COLUMN_SPACING as n, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as i, ATTR_PRODUCT_BUTTON as I } from "./selectors.js";
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as n, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as U } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as i, ATTR_PRODUCT_BUTTON as I, ATTR_RECOMMENDATION_TITLE as A } from "./selectors.js";
|
|
3
|
+
const C = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, D = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
13
|
}, a = {
|
|
14
14
|
textBefore: "",
|
|
15
15
|
textAfter: ""
|
|
16
|
-
},
|
|
16
|
+
}, E = [
|
|
17
17
|
o,
|
|
18
18
|
t,
|
|
19
19
|
_,
|
|
@@ -22,6 +22,7 @@ const D = {
|
|
|
22
22
|
i,
|
|
23
23
|
I
|
|
24
24
|
], c = {
|
|
25
|
+
[A]: !0,
|
|
25
26
|
[o]: !0,
|
|
26
27
|
[t]: !0,
|
|
27
28
|
[T]: !0,
|
|
@@ -29,30 +30,31 @@ const D = {
|
|
|
29
30
|
[r]: !1,
|
|
30
31
|
[i]: !1,
|
|
31
32
|
[I]: !0
|
|
32
|
-
},
|
|
33
|
+
}, S = {
|
|
33
34
|
// Settings
|
|
34
35
|
strategy: "mostPopular",
|
|
35
36
|
productIds: [],
|
|
36
37
|
size: "6",
|
|
37
38
|
shuffleProducts: !1,
|
|
38
39
|
language: "en_US",
|
|
39
|
-
currency:
|
|
40
|
+
currency: C,
|
|
40
41
|
filters: [],
|
|
41
42
|
// Layout
|
|
42
43
|
layout: "grid",
|
|
43
|
-
cardsInRow:
|
|
44
|
+
cardsInRow: U,
|
|
44
45
|
mobileCardsInRow: e,
|
|
45
46
|
mobileLayoutEnabled: !1,
|
|
46
47
|
previousMobileCardsInRow: e,
|
|
47
48
|
columnSpacing: n,
|
|
48
49
|
rowSpacing: s,
|
|
49
|
-
mobileColumnSpacing:
|
|
50
|
+
mobileColumnSpacing: O,
|
|
50
51
|
mobileRowSpacing: R,
|
|
51
52
|
// Composition
|
|
52
|
-
composition:
|
|
53
|
+
composition: E,
|
|
53
54
|
visibility: c,
|
|
55
|
+
previousTitleHtml: "",
|
|
54
56
|
// Element settings
|
|
55
|
-
omnibusPrice:
|
|
57
|
+
omnibusPrice: D,
|
|
56
58
|
omnibusDiscount: a,
|
|
57
59
|
textTrimming: !1,
|
|
58
60
|
// Price placement (block-level, affects all cards)
|
|
@@ -67,14 +69,14 @@ const D = {
|
|
|
67
69
|
// defaults, so no data transform (and no needsMigration trigger) is required.
|
|
68
70
|
configVersion: 1,
|
|
69
71
|
recommendationId: 0
|
|
70
|
-
},
|
|
72
|
+
}, u = [11, 12], m = 1;
|
|
71
73
|
export {
|
|
72
74
|
m as CURRENT_CONFIG_VERSION,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
E as DEFAULT_COMPOSITION,
|
|
76
|
+
C as DEFAULT_CURRENCY,
|
|
77
|
+
S as DEFAULT_NODE_CONFIG,
|
|
76
78
|
a as DEFAULT_OMNIBUS_DISCOUNT,
|
|
77
|
-
|
|
79
|
+
D as DEFAULT_OMNIBUS_PRICE,
|
|
78
80
|
c as DEFAULT_VISIBILITY,
|
|
79
|
-
|
|
81
|
+
u as EXCLUDED_ALGORITHM_IDS
|
|
80
82
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = ".recommendation-block-v2", n = ".ins-recommendation-product-container", _ = ".ins-recommendation-desktop-container", R = ".ins-recommendation-mobile-container", r = ".ins-recommendation-mobile-row", e = "reco-v3-button", A = "ins-skip-compile", E = {
|
|
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
|
+
}, s = "productImage", O = "productName", i = "productPrice", C = "productOldPrice", S = "productOmnibusPrice", I = "productOmnibusDiscount", a = "productButton", u = "recommendationTitle", T = "ins-recommendation-title", m = `.${T}`, L = "customAttr:", d = "data-custom-attributes", U = "data-card-composition", N = "product-attr", t = "recommendation-attribute-row", P = `.${t}`, D = "data-attribute-type", p = "data-visibility", B = "spacer", M = "product_attribute.", o = /* @__PURE__ */ new Set([
|
|
9
9
|
"name",
|
|
10
10
|
// productName
|
|
11
11
|
"price",
|
|
@@ -20,34 +20,40 @@ const t = ".recommendation-block-v2", c = ".ins-recommendation-product-container
|
|
|
20
20
|
// productOmnibusPrice
|
|
21
21
|
"omnibus_discount"
|
|
22
22
|
// productOmnibusDiscount
|
|
23
|
-
]),
|
|
24
|
-
...
|
|
23
|
+
]), l = /* @__PURE__ */ new Set([
|
|
24
|
+
...o,
|
|
25
25
|
"currency",
|
|
26
26
|
"discount"
|
|
27
27
|
]);
|
|
28
28
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
C as
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
c as
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
L as ATTR_CUSTOM_PREFIX,
|
|
30
|
+
D as ATTR_DATA_ATTRIBUTE_TYPE,
|
|
31
|
+
U as ATTR_DATA_CARD_COMPOSITION,
|
|
32
|
+
d as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
33
|
+
p as ATTR_DATA_VISIBILITY,
|
|
34
|
+
N as ATTR_PRODUCT_ATTR,
|
|
35
|
+
a as ATTR_PRODUCT_BUTTON,
|
|
36
|
+
s as ATTR_PRODUCT_IMAGE,
|
|
37
|
+
O as ATTR_PRODUCT_NAME,
|
|
38
|
+
C as ATTR_PRODUCT_OLD_PRICE,
|
|
39
|
+
I as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
40
|
+
S as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
41
|
+
i as ATTR_PRODUCT_PRICE,
|
|
42
|
+
u as ATTR_RECOMMENDATION_TITLE,
|
|
43
|
+
c as BLOCK_ROOT_SELECTOR,
|
|
44
|
+
o as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
45
|
+
n as CONTAINER_SELECTOR,
|
|
46
|
+
t as CSS_CLASS_ATTRIBUTE_ROW,
|
|
47
|
+
e as CSS_CLASS_RECO_BUTTON,
|
|
48
|
+
A as CSS_CLASS_SKIP_COMPILE,
|
|
49
|
+
B as CSS_CLASS_SPACER,
|
|
50
|
+
T as CSS_CLASS_TITLE_CELL,
|
|
51
|
+
E as CURRENCY_ATTR,
|
|
52
|
+
_ as DESKTOP_CONTAINER_SELECTOR,
|
|
53
|
+
R as MOBILE_CONTAINER_SELECTOR,
|
|
54
|
+
r as MOBILE_ROW_SELECTOR,
|
|
55
|
+
M as PRODUCT_ATTRIBUTE_PREFIX,
|
|
56
|
+
l as RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES,
|
|
57
|
+
P as SELECTOR_ATTRIBUTE_ROW,
|
|
58
|
+
m as SELECTOR_TITLE_CELL
|
|
53
59
|
};
|