@useinsider/guido 3.16.0-beta.9e5f533 → 3.16.0-beta.ca26c4e
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/config/migrator/index.js +8 -9
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +24 -29
- package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
- package/dist/config/migrator/recommendationMigrator.js +15 -18
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- 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 +22 -23
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -29
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +152 -203
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
- package/dist/static/styles/customEditorStyle.css.js +1 -3
- package/package.json +1 -1
- package/dist/config/migrator/recommendationTitleMigrator.js +0 -112
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
var u = Object.defineProperty;
|
|
2
|
-
var d = (r, t, e) => t in r ? u(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
-
var c = (r, t, e) => d(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { RecommendationBlockId as m } from "../../extensions/Blocks/Recommendation/constants/blockIds.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as _, CSS_CLASS_SKIP_COMPILE as f, ATTR_RECOMMENDATION_TITLE as a, CONTAINER_SELECTOR as T, CSS_CLASS_TITLE_CELL as R } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
|
-
const S = _.slice(1), E = `${_}:not(.${f})`, p = `[data-attribute-type="${a}"]`, g = "td.esd-block-text", b = "table.container > tbody", l = "esd-ext-config";
|
|
7
|
-
class y {
|
|
8
|
-
constructor() {
|
|
9
|
-
c(this, "parser");
|
|
10
|
-
this.parser = new DOMParser();
|
|
11
|
-
}
|
|
12
|
-
migrate(t) {
|
|
13
|
-
try {
|
|
14
|
-
if (!t.includes(S))
|
|
15
|
-
return t;
|
|
16
|
-
const e = this.parser.parseFromString(t, "text/html");
|
|
17
|
-
return Array.from(e.querySelectorAll(E)).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(p) || 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(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(g)).find((e) => !e.closest(T)) ?? null;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Stamps the attribute-row tagging onto the title's wrapper row and the spacer
|
|
38
|
-
* below it, so one toggle governs the pair and the compiler drops both when off.
|
|
39
|
-
*/
|
|
40
|
-
_tagExistingTitle(t) {
|
|
41
|
-
t.classList.add(R), t.setAttribute("esd-extension-block-id", m.TITLE);
|
|
42
|
-
const e = this._wrapperRowOf(t);
|
|
43
|
-
if (!e)
|
|
44
|
-
return;
|
|
45
|
-
this._tagRow(e);
|
|
46
|
-
const i = e.nextElementSibling;
|
|
47
|
-
i && this._isSpacerRow(i) && this._tagRow(i);
|
|
48
|
-
}
|
|
49
|
-
/** The `<tr>` inside `table.container > tbody` that wraps the title's own table. */
|
|
50
|
-
_wrapperRowOf(t) {
|
|
51
|
-
var e, i;
|
|
52
|
-
return ((i = (e = t == null ? void 0 : t.closest("table")) == null ? void 0 : e.parentElement) == null ? void 0 : i.closest("tr")) ?? null;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Direct children only — a product-container row holds spacer cells further down,
|
|
56
|
-
* and `querySelector` would happily reach them. (`:scope >` is unsupported in happy-dom.)
|
|
57
|
-
*/
|
|
58
|
-
_isSpacerRow(t) {
|
|
59
|
-
return Array.from(t.children).some((e) => e.classList.contains("spacer"));
|
|
60
|
-
}
|
|
61
|
-
_tagRow(t) {
|
|
62
|
-
t.classList.add("recommendation-attribute-row"), t.setAttribute("data-attribute-type", a), t.setAttribute("data-visibility", "1");
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* A deleted title leaves nothing to tag — the toggle re-injects the markup only
|
|
66
|
-
* when the user switches it back on. Its leftovers (an emptied wrapper row, the
|
|
67
|
-
* spacer that trailed it) would otherwise render as blank padding on top.
|
|
68
|
-
*/
|
|
69
|
-
_removeTitleRemnants(t, e) {
|
|
70
|
-
var o;
|
|
71
|
-
const i = this._wrapperRowOf(e), s = i == null ? void 0 : i.nextElementSibling;
|
|
72
|
-
if (s && this._isSpacerRow(s) && s.remove(), i) {
|
|
73
|
-
i.remove();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const n = (o = t.querySelector(b)) == null ? void 0 : o.firstElementChild;
|
|
77
|
-
n && this._isSpacerRow(n) && n.remove();
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Mirrors the resolved state into the persisted config blob, so a saved module
|
|
81
|
-
* whose `data-*` attributes Stripo strips on re-drop still restores the toggle.
|
|
82
|
-
*/
|
|
83
|
-
_writeVisibility(t, e) {
|
|
84
|
-
const i = this._readConfig(t);
|
|
85
|
-
if (!i)
|
|
86
|
-
return;
|
|
87
|
-
const s = typeof i.visibility == "object" && i.visibility !== null ? i.visibility : {};
|
|
88
|
-
i.visibility = { ...s, [a]: e }, t.setAttribute(l, JSON.stringify(i));
|
|
89
|
-
}
|
|
90
|
-
_hasRecordedTitleState(t) {
|
|
91
|
-
var i;
|
|
92
|
-
const e = (i = this._readConfig(t)) == null ? void 0 : i.visibility;
|
|
93
|
-
return typeof e == "object" && e !== null && a in e;
|
|
94
|
-
}
|
|
95
|
-
_readConfig(t) {
|
|
96
|
-
const e = t.getAttribute(l);
|
|
97
|
-
if (!e)
|
|
98
|
-
return null;
|
|
99
|
-
try {
|
|
100
|
-
const i = JSON.parse(e);
|
|
101
|
-
return typeof i == "object" && i !== null ? i : null;
|
|
102
|
-
} catch {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function h(r) {
|
|
108
|
-
return new y().migrate(r);
|
|
109
|
-
}
|
|
110
|
-
export {
|
|
111
|
-
h as migrateRecommendationTitle
|
|
112
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createPaddingsControl as r, createTextBackgroundColorControl as T, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as C, createTextColorControl as c, createTextAlignControl as I } from "../../../controlFactories.js";
|
|
2
|
-
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
-
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
-
import { BLOCK_ROOT_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
-
const L = I(
|
|
6
|
-
t.TITLE_ALIGN,
|
|
7
|
-
o.TITLE,
|
|
8
|
-
n
|
|
9
|
-
), a = c(
|
|
10
|
-
t.TITLE_COLOR,
|
|
11
|
-
o.TITLE,
|
|
12
|
-
n
|
|
13
|
-
), i = C(
|
|
14
|
-
t.TITLE_SIZE,
|
|
15
|
-
o.TITLE,
|
|
16
|
-
n
|
|
17
|
-
), E = l(
|
|
18
|
-
t.TITLE_STYLE,
|
|
19
|
-
o.TITLE,
|
|
20
|
-
n
|
|
21
|
-
), m = e(
|
|
22
|
-
t.TITLE_FONT_FAMILY,
|
|
23
|
-
o.TITLE,
|
|
24
|
-
n
|
|
25
|
-
), s = T(
|
|
26
|
-
t.TITLE_BACKGROUND,
|
|
27
|
-
o.TITLE,
|
|
28
|
-
n
|
|
29
|
-
), d = r(
|
|
30
|
-
t.TITLE_PADDINGS,
|
|
31
|
-
o.TITLE,
|
|
32
|
-
n
|
|
33
|
-
), x = {
|
|
34
|
-
align: L,
|
|
35
|
-
color: a,
|
|
36
|
-
size: i,
|
|
37
|
-
style: E,
|
|
38
|
-
fontFamily: m,
|
|
39
|
-
background: s,
|
|
40
|
-
paddings: d
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
x as TitleControls
|
|
44
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { RecommendationBlockId as i } from "../constants/blockIds.js";
|
|
2
|
-
import { DEFAULT_ROW_SPACING as l } from "../constants/layout.js";
|
|
3
|
-
import { ATTR_RECOMMENDATION_TITLE as n } from "../constants/selectors.js";
|
|
4
|
-
const p = "You May Also Like!", d = '<p style="font-size: 28px; color: #333333;"><strong>{-{-TITLE-}-}</strong></p>';
|
|
5
|
-
function m(r = d, t = !0, s = l) {
|
|
6
|
-
const e = `class="recommendation-attribute-row" data-attribute-type="${n}" data-visibility="${t ? "1" : "0"}"`, o = t ? "" : ' style="display: none;"';
|
|
7
|
-
return `
|
|
8
|
-
<tr ${e}${o}>
|
|
9
|
-
<td>
|
|
10
|
-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
11
|
-
<tbody>
|
|
12
|
-
<tr>
|
|
13
|
-
<td
|
|
14
|
-
class="esd-block-text ins-recommendation-title es-p10t es-p10b es-p20l es-p20r"
|
|
15
|
-
align="center"
|
|
16
|
-
esd-extension-block-id="${i.TITLE}">
|
|
17
|
-
${r}
|
|
18
|
-
</td>
|
|
19
|
-
</tr>
|
|
20
|
-
</tbody>
|
|
21
|
-
</table>
|
|
22
|
-
</td>
|
|
23
|
-
</tr>
|
|
24
|
-
<tr ${e}${o}>
|
|
25
|
-
<td class="spacer" style="height: ${s}px;"></td>
|
|
26
|
-
</tr>
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
d as DEFAULT_TITLE_PARAGRAPH,
|
|
31
|
-
p as DEFAULT_TITLE_TEXT,
|
|
32
|
-
m as buildTitleRows
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function migrateRecommendationTitle(html: string): string;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export declare const TitleControls: {
|
|
2
|
-
readonly align: {
|
|
3
|
-
new (): {
|
|
4
|
-
getId(): string;
|
|
5
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
6
|
-
getParentControlId(): string;
|
|
7
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
8
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
9
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
10
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
11
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
readonly color: {
|
|
15
|
-
new (): {
|
|
16
|
-
getId(): string;
|
|
17
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
18
|
-
getParentControlId(): string;
|
|
19
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
20
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
21
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
22
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
23
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
readonly size: {
|
|
27
|
-
new (): {
|
|
28
|
-
getId(): string;
|
|
29
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
30
|
-
getParentControlId(): string;
|
|
31
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
32
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
33
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
34
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
35
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
readonly style: {
|
|
39
|
-
new (): {
|
|
40
|
-
getId(): string;
|
|
41
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
42
|
-
getParentControlId(): string;
|
|
43
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
44
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
45
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
46
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
47
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
readonly fontFamily: {
|
|
51
|
-
new (): {
|
|
52
|
-
getId(): string;
|
|
53
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
54
|
-
getParentControlId(): string;
|
|
55
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
56
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
57
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
58
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
59
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
readonly background: {
|
|
63
|
-
new (): {
|
|
64
|
-
getId(): string;
|
|
65
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
66
|
-
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
67
|
-
getParentControlId(): string;
|
|
68
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
69
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
70
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
71
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
readonly paddings: {
|
|
75
|
-
new (): {
|
|
76
|
-
getId(): string;
|
|
77
|
-
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
78
|
-
getParentControlId(): string;
|
|
79
|
-
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
80
|
-
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
81
|
-
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
82
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
83
|
-
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_TITLE_TEXT = "You May Also Like!";
|
|
2
|
-
export declare const DEFAULT_TITLE_PARAGRAPH: string;
|
|
3
|
-
/**
|
|
4
|
-
* Builds the two block-level title rows: the title itself and the spacer below it.
|
|
5
|
-
* Both carry the same `recommendation-attribute-row` tagging a card attribute row has,
|
|
6
|
-
* so the Card Composition toggle hides the pair together and the compiler's
|
|
7
|
-
* `[data-visibility="0"]` sweep drops both — no leading gap when the title is off.
|
|
8
|
-
* @param paragraphHtml - Full `<p>` markup rendered inside the title cell
|
|
9
|
-
* @param visible - Whether the title starts visible
|
|
10
|
-
* @param spacerHeightPx - Height of the spacer row below the title
|
|
11
|
-
* @returns HTML string with the title row followed by its spacer row
|
|
12
|
-
*/
|
|
13
|
-
export declare function buildTitleRows(paragraphHtml?: string, visible?: boolean, spacerHeightPx?: number): string;
|