@useinsider/guido 3.0.0-beta.de55333 → 3.0.0-beta.e7bc91a
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/header/EditorActions.vue.js +10 -8
- package/dist/components/organisms/header/EditorActions.vue2.js +40 -30
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
- package/dist/config/i18n/en/labels.json.js +8 -3
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/itemsBlockMigrator.js +135 -131
- package/dist/config/migrator/recommendationMigrator.js +58 -54
- package/dist/enums/block.js +4 -0
- package/dist/extensions/Blocks/Items/block.js +30 -21
- package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
- package/dist/extensions/Blocks/Items/items.css.js +48 -0
- package/dist/extensions/Blocks/Recommendation/block.js +23 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +73 -71
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +5 -4
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +48 -0
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/extensions/Blocks/common-control.js +12 -4
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/src/@types/extensions/block.d.ts +2 -0
- package/dist/src/App.vue.d.ts +3 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/enums/block.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -0
- package/dist/src/main.d.ts +1 -3
- package/dist/src/stores/template.d.ts +29 -0
- package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
- package/dist/static/assets/info.svg.js +5 -0
- package/dist/static/styles/components/button.css.js +13 -7
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/stores/template.js +15 -0
- package/dist/utils/migrationBannerHtml.js +21 -0
- package/package.json +5 -4
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { BlockId as g } from "../../../enums/block.js";
|
|
2
|
+
import { useOnboardingStore as p } from "../../../stores/onboarding.js";
|
|
3
|
+
import { getMigrationBannerHtml as f } from "../../../utils/migrationBannerHtml.js";
|
|
4
|
+
import { Block as u, BlockCompositionType as I, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { SETTINGS_ENUMS as a, DefaultConfigValues as i } from "./enums/settingsEnums.js";
|
|
6
|
+
import { getDefaultTemplate as C } from "./template.js";
|
|
7
|
+
import { getItemsBlockContainer as y, getItemsBlockConfig as b, getDefaultItemsBlockConfig as h } from "./utils/nodeConfigUtils.js";
|
|
8
|
+
const c = g.Items;
|
|
9
|
+
class E extends u {
|
|
8
10
|
getId() {
|
|
9
|
-
return
|
|
11
|
+
return c;
|
|
10
12
|
}
|
|
11
13
|
getIcon() {
|
|
12
14
|
return "items-icon";
|
|
13
15
|
}
|
|
14
16
|
getBlockCompositionType() {
|
|
15
|
-
return
|
|
17
|
+
return I.CONTAINER;
|
|
16
18
|
}
|
|
17
19
|
getName() {
|
|
18
20
|
return this.api.translate("Items");
|
|
@@ -20,10 +22,17 @@ class B extends g {
|
|
|
20
22
|
getDescription() {
|
|
21
23
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
22
24
|
}
|
|
25
|
+
getSettingsPanelTitleHtml() {
|
|
26
|
+
return f(
|
|
27
|
+
c,
|
|
28
|
+
this.api.translate("Items"),
|
|
29
|
+
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
|
|
30
|
+
);
|
|
31
|
+
}
|
|
23
32
|
getTemplate() {
|
|
24
|
-
return
|
|
25
|
-
orientation:
|
|
26
|
-
itemsType:
|
|
33
|
+
return C({
|
|
34
|
+
orientation: a.ORIENTATION.VERTICAL,
|
|
35
|
+
itemsType: a.ITEMS_TYPE.CART_ITEMS,
|
|
27
36
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
28
37
|
currencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
29
38
|
currencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
@@ -34,21 +43,21 @@ class B extends g {
|
|
|
34
43
|
return !1;
|
|
35
44
|
}
|
|
36
45
|
onCreated(n) {
|
|
37
|
-
const
|
|
38
|
-
r.querySelector('[product-attr="imageSrc"] img') ||
|
|
39
|
-
const e =
|
|
46
|
+
const l = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
|
|
47
|
+
r.querySelector('[product-attr="imageSrc"] img') || l.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
48
|
+
const e = y(n);
|
|
40
49
|
if (!e)
|
|
41
50
|
return;
|
|
42
|
-
const
|
|
51
|
+
const s = e.getNodeConfig(), m = s && Object.keys(s).length > 0, t = b(n);
|
|
43
52
|
if (t != null && t.initialized)
|
|
44
|
-
|
|
53
|
+
m ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
|
|
45
54
|
else {
|
|
46
|
-
const
|
|
47
|
-
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(
|
|
55
|
+
const d = h();
|
|
56
|
+
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(d).apply(new o("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
c as BLOCK_ID,
|
|
62
|
+
E as ItemsBlock
|
|
54
63
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import o from "../../../static/assets/info.svg.js";
|
|
2
|
+
import { IconsRegistry as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
class s extends r {
|
|
3
4
|
registerIconsSvg(t) {
|
|
4
5
|
t["items-icon"] = `
|
|
5
6
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -19,14 +20,14 @@ class i extends o {
|
|
|
19
20
|
</svg>
|
|
20
21
|
`, t["horizontal-orientation"] = `
|
|
21
22
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
22
|
-
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
23
|
+
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
23
24
|
stroke-width="2" fill="none"/>
|
|
24
|
-
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
25
|
+
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
25
26
|
stroke-width="2" fill="none"/>
|
|
26
27
|
</svg>
|
|
27
|
-
|
|
28
|
+
`, t["migration-info-icon"] = o;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
s as ItemsIconsRegistry
|
|
32
33
|
};
|
|
@@ -17,6 +17,54 @@ const n = `/* Utils */
|
|
|
17
17
|
.container:has(.items-controls-container) {
|
|
18
18
|
padding: 0
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
22
|
+
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
23
|
+
|
|
24
|
+
/* Layout variables for positioning the absolutely-placed info box */
|
|
25
|
+
:host {
|
|
26
|
+
--items-migration-padding: 16px;
|
|
27
|
+
--items-migration-title-height: 61px;
|
|
28
|
+
--items-migration-box-height: 98px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Push tabs down when info box is present inside the control panel header */
|
|
32
|
+
.control-panel-header:has(.items-block-migration-info) {
|
|
33
|
+
position: relative;
|
|
34
|
+
margin-bottom: calc(2 * var(--items-migration-padding) + var(--items-migration-box-height));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Info box container */
|
|
38
|
+
.items-block-migration-info {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: flex-start;
|
|
41
|
+
gap: 8px;
|
|
42
|
+
padding: 12px;
|
|
43
|
+
background: var(--guido-color-background-onpage-message-info);
|
|
44
|
+
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
45
|
+
border-radius: 4px;
|
|
46
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
47
|
+
position: absolute;
|
|
48
|
+
left: var(--items-migration-padding);
|
|
49
|
+
right: var(--items-migration-padding);
|
|
50
|
+
top: calc(var(--items-migration-padding) + var(--items-migration-title-height));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Icon — 18x19 icon inside a 24x24 bounding box (matches Figma) */
|
|
54
|
+
.items-block-migration-info__icon {
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
width: 24px;
|
|
57
|
+
height: 24px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Text content */
|
|
61
|
+
.items-block-migration-info__text {
|
|
62
|
+
margin: 4px 0;
|
|
63
|
+
white-space: normal;
|
|
64
|
+
font-size: 13px;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
line-height: 16px;
|
|
67
|
+
}
|
|
20
68
|
`;
|
|
21
69
|
export {
|
|
22
70
|
n as default
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (r, o, t) =>
|
|
4
|
-
import {
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var h = (r, o, t) => o in r ? f(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
|
|
3
|
+
var g = (r, o, t) => h(r, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { BlockId as I } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as k } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as B, BlockCompositionType as _, ModificationDescription as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
7
|
import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules.js";
|
|
6
8
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
7
9
|
import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
|
|
8
|
-
import { getDefaultTemplate as
|
|
9
|
-
const
|
|
10
|
-
class
|
|
10
|
+
import { getDefaultTemplate as A } from "./templates/grid/template.js";
|
|
11
|
+
const p = I.Recommendation, c = "recommendation-block-v2", a = "recommendation-id";
|
|
12
|
+
class T extends B {
|
|
11
13
|
constructor() {
|
|
12
14
|
super();
|
|
13
15
|
/**
|
|
@@ -17,13 +19,13 @@ class y extends h {
|
|
|
17
19
|
g(this, "_pendingBlockId", null);
|
|
18
20
|
}
|
|
19
21
|
getId() {
|
|
20
|
-
return
|
|
22
|
+
return p;
|
|
21
23
|
}
|
|
22
24
|
getIcon() {
|
|
23
25
|
return "recommendation-icon";
|
|
24
26
|
}
|
|
25
27
|
getBlockCompositionType() {
|
|
26
|
-
return
|
|
28
|
+
return _.CONTAINER;
|
|
27
29
|
}
|
|
28
30
|
getName() {
|
|
29
31
|
return this.api.translate("Recommendation Block");
|
|
@@ -31,6 +33,13 @@ class y extends h {
|
|
|
31
33
|
getDescription() {
|
|
32
34
|
return this.api.translate("Recommendation Block Title Description");
|
|
33
35
|
}
|
|
36
|
+
getSettingsPanelTitleHtml() {
|
|
37
|
+
return k(
|
|
38
|
+
p,
|
|
39
|
+
this.api.translate("Recommendation Block"),
|
|
40
|
+
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
41
|
+
);
|
|
42
|
+
}
|
|
34
43
|
/**
|
|
35
44
|
* Returns the template HTML for a new recommendation block.
|
|
36
45
|
* Generates a unique recommendation ID and embeds the instance class
|
|
@@ -40,7 +49,7 @@ class y extends h {
|
|
|
40
49
|
*/
|
|
41
50
|
getTemplate() {
|
|
42
51
|
const t = this._generateNextId();
|
|
43
|
-
return this._pendingBlockId = t,
|
|
52
|
+
return this._pendingBlockId = t, A(t);
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
46
55
|
* Called when a new block is dropped into the template
|
|
@@ -115,7 +124,7 @@ class y extends h {
|
|
|
115
124
|
if (!n)
|
|
116
125
|
return;
|
|
117
126
|
const i = this.api.getDocumentModifier();
|
|
118
|
-
i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new
|
|
127
|
+
i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new R(`Assign recommendation ID ${e}`));
|
|
119
128
|
}
|
|
120
129
|
/**
|
|
121
130
|
* Gets the recommendation-id from a block node
|
|
@@ -139,7 +148,7 @@ class y extends h {
|
|
|
139
148
|
if (e && e.includes(c))
|
|
140
149
|
return t;
|
|
141
150
|
}
|
|
142
|
-
return "querySelector" in t ? t.querySelector(`.${c}`) : null;
|
|
151
|
+
return "querySelector" in t ? t.querySelector(`.${c}`) ?? null : null;
|
|
143
152
|
}
|
|
144
153
|
/**
|
|
145
154
|
* Migrate configuration from legacy format
|
|
@@ -149,6 +158,6 @@ class y extends h {
|
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
export {
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
p as BLOCK_ID,
|
|
162
|
+
T as RecommendationBlock
|
|
154
163
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var G = Object.defineProperty;
|
|
2
|
-
var R = (p,
|
|
3
|
-
var
|
|
4
|
-
import { EditorStatePropertyType as y, PreviewDeviceMode as w, ModificationDescription as
|
|
2
|
+
var R = (p, s, t) => s in p ? G(p, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[s] = t;
|
|
3
|
+
var C = (p, s, t) => R(p, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { EditorStatePropertyType as y, PreviewDeviceMode as w, ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as V } from "../../../common-control.js";
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, DEFAULT_ROW_SPACING as P } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as d } from "../../services/configService.js";
|
|
9
9
|
import { useRecommendationExtensionStore as B } from "../../store/recommendation.js";
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
12
|
-
import { useDebounceFn as
|
|
10
|
+
import { safeGetStyle as L, safeGetParent as U } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as f, getBlockElement as x } from "../main/utils.js";
|
|
12
|
+
import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
13
|
const W = "recommendation-spacing-control", i = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
15
15
|
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
@@ -19,46 +19,46 @@ const W = "recommendation-spacing-control", i = {
|
|
|
19
19
|
MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
|
|
20
20
|
MOBILE_ROW_SPACING: "mobileRowSpacing",
|
|
21
21
|
MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
|
|
22
|
-
},
|
|
22
|
+
}, A = {
|
|
23
23
|
COLUMN_SPACING: "data-column-spacing",
|
|
24
24
|
ROW_SPACING: "data-row-spacing",
|
|
25
25
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
26
26
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function I(p, s) {
|
|
29
29
|
if (!p)
|
|
30
|
-
return
|
|
30
|
+
return s;
|
|
31
31
|
const t = parseFloat(p);
|
|
32
|
-
return Number.isNaN(t) ?
|
|
32
|
+
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
34
|
class X extends V {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
C(this, "store", B());
|
|
38
|
+
C(this, "unsubscribeOrientation", null);
|
|
39
39
|
/**
|
|
40
40
|
* Debounced version of _onColumnSpacingChange
|
|
41
41
|
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
C(this, "_debouncedOnColumnSpacingChange", O((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
C(this, "_debouncedOnRowSpacingChange", O((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
C(this, "_debouncedOnMobileColumnSpacingChange", O((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
C(this, "_debouncedOnMobileRowSpacingChange", O((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
@@ -72,16 +72,16 @@ class X extends V {
|
|
|
72
72
|
this._GuLabel({ text: "Column Spacing on Desktop (px)", name: i.COLUMN_SPACING_LABEL }),
|
|
73
73
|
this._GuCounter({
|
|
74
74
|
name: i.COLUMN_SPACING,
|
|
75
|
-
minValue:
|
|
76
|
-
maxValue:
|
|
77
|
-
step:
|
|
75
|
+
minValue: b,
|
|
76
|
+
maxValue: N,
|
|
77
|
+
step: _
|
|
78
78
|
}),
|
|
79
79
|
this._GuLabel({ text: "Row Spacing on Desktop (px)", name: i.ROW_SPACING_LABEL }),
|
|
80
80
|
this._GuCounter({
|
|
81
81
|
name: i.ROW_SPACING,
|
|
82
|
-
minValue:
|
|
83
|
-
maxValue:
|
|
84
|
-
step:
|
|
82
|
+
minValue: b,
|
|
83
|
+
maxValue: N,
|
|
84
|
+
step: _
|
|
85
85
|
}),
|
|
86
86
|
this._GuLabel({
|
|
87
87
|
text: "Column Spacing on Mobile (px)",
|
|
@@ -89,16 +89,16 @@ class X extends V {
|
|
|
89
89
|
}),
|
|
90
90
|
this._GuCounter({
|
|
91
91
|
name: i.MOBILE_COLUMN_SPACING,
|
|
92
|
-
minValue:
|
|
93
|
-
maxValue:
|
|
94
|
-
step:
|
|
92
|
+
minValue: b,
|
|
93
|
+
maxValue: N,
|
|
94
|
+
step: _
|
|
95
95
|
}),
|
|
96
96
|
this._GuLabel({ text: "Row Spacing on Mobile (px)", name: i.MOBILE_ROW_SPACING_LABEL }),
|
|
97
97
|
this._GuCounter({
|
|
98
98
|
name: i.MOBILE_ROW_SPACING,
|
|
99
|
-
minValue:
|
|
100
|
-
maxValue:
|
|
101
|
-
step:
|
|
99
|
+
minValue: b,
|
|
100
|
+
maxValue: N,
|
|
101
|
+
step: _
|
|
102
102
|
})
|
|
103
103
|
])}
|
|
104
104
|
</div>
|
|
@@ -132,8 +132,8 @@ class X extends V {
|
|
|
132
132
|
_updateSpacingVisibility() {
|
|
133
133
|
if (!this.api)
|
|
134
134
|
return;
|
|
135
|
-
const t = d.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, n = t.layout || e ||
|
|
136
|
-
this.api.setVisibility(i.COLUMN_SPACING, o && !r &&
|
|
135
|
+
const t = d.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, n = t.layout || e || f(this.currentNode), o = n === "grid", a = n === "list", r = this._isMobileMode(), c = t.cardsInRow > 1, u = t.mobileCardsInRow > 1;
|
|
136
|
+
this.api.setVisibility(i.COLUMN_SPACING, o && !r && c), this.api.setVisibility(i.COLUMN_SPACING_LABEL, o && !r && c), this.api.setVisibility(i.ROW_SPACING, a || !r), this.api.setVisibility(i.ROW_SPACING_LABEL, a || !r), this.api.setVisibility(i.MOBILE_COLUMN_SPACING, o && r && u), this.api.setVisibility(i.MOBILE_COLUMN_SPACING_LABEL, o && r && u), this.api.setVisibility(i.MOBILE_ROW_SPACING, !a && r), this.api.setVisibility(i.MOBILE_ROW_SPACING_LABEL, !a && r);
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Reads spacing values from node config first, falls back to DOM styles.
|
|
@@ -159,20 +159,20 @@ class X extends V {
|
|
|
159
159
|
*/
|
|
160
160
|
_getStoredColumnSpacing() {
|
|
161
161
|
if (!this.currentNode)
|
|
162
|
-
return
|
|
163
|
-
const t = this.currentNode.querySelector(
|
|
164
|
-
if (
|
|
165
|
-
const u = t.querySelector(".recommendation-attribute-row"),
|
|
166
|
-
if (!
|
|
167
|
-
return
|
|
168
|
-
const M =
|
|
169
|
-
return M.length < 2 ?
|
|
162
|
+
return g;
|
|
163
|
+
const t = this.currentNode.querySelector(S) ?? this.currentNode;
|
|
164
|
+
if (f(this.currentNode) === "grid") {
|
|
165
|
+
const u = t.querySelector(".recommendation-attribute-row"), l = (u == null ? void 0 : u.querySelector("td")) ?? null, h = L(l, "padding");
|
|
166
|
+
if (!h)
|
|
167
|
+
return g;
|
|
168
|
+
const M = h.trim().split(/\s+/);
|
|
169
|
+
return M.length < 2 ? g : I(M[1], g / 2) * 2;
|
|
170
170
|
}
|
|
171
|
-
const n = t.querySelector(".product-card-wrapper"), o = U(n), a =
|
|
171
|
+
const n = t.querySelector(".product-card-wrapper") ?? null, o = U(n), a = L(o, "padding");
|
|
172
172
|
if (!a)
|
|
173
|
-
return
|
|
173
|
+
return g;
|
|
174
174
|
const r = a.trim().split(/\s+/);
|
|
175
|
-
return r.length < 2 ?
|
|
175
|
+
return r.length < 2 ? g : I(r[1], g / 2) * 2;
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -181,8 +181,8 @@ class X extends V {
|
|
|
181
181
|
_getStoredRowSpacing() {
|
|
182
182
|
if (!this.currentNode)
|
|
183
183
|
return P;
|
|
184
|
-
const e = (this.currentNode.querySelector(
|
|
185
|
-
return
|
|
184
|
+
const e = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, n = L(e, "height");
|
|
185
|
+
return I(n, P);
|
|
186
186
|
}
|
|
187
187
|
// ========================================================================
|
|
188
188
|
// Desktop Spacing Handlers
|
|
@@ -199,17 +199,18 @@ class X extends V {
|
|
|
199
199
|
this.currentNode,
|
|
200
200
|
{ columnSpacing: t },
|
|
201
201
|
`Changed column spacing to ${t}px`
|
|
202
|
-
), this._storeDataAttribute(
|
|
203
|
-
const n = d.getConfig(this.currentNode).layout ||
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
).forEach((
|
|
207
|
-
o.modifyHtml(
|
|
202
|
+
), this._storeDataAttribute(A.COLUMN_SPACING, t);
|
|
203
|
+
const n = d.getConfig(this.currentNode).layout || f(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(S);
|
|
204
|
+
c && (n === "grid" ? Array.from(
|
|
205
|
+
c.querySelectorAll(".attribute-cell")
|
|
206
|
+
).forEach((l) => {
|
|
207
|
+
o.modifyHtml(l).setStyle("padding", r);
|
|
208
208
|
}) : Array.from(
|
|
209
|
-
|
|
210
|
-
).forEach((
|
|
211
|
-
"parent" in
|
|
212
|
-
|
|
209
|
+
c.querySelectorAll(".product-card-wrapper")
|
|
210
|
+
).forEach((l) => {
|
|
211
|
+
const h = "parent" in l ? l.parent() : void 0;
|
|
212
|
+
h && o.modifyHtml(h).setStyle("padding", r);
|
|
213
|
+
}), o.apply(new m(`Update column spacing to ${t}px`)));
|
|
213
214
|
}
|
|
214
215
|
/**
|
|
215
216
|
* Handles row spacing changes for desktop.
|
|
@@ -223,8 +224,8 @@ class X extends V {
|
|
|
223
224
|
this.currentNode,
|
|
224
225
|
{ rowSpacing: t },
|
|
225
226
|
`Changed row spacing to ${t}px`
|
|
226
|
-
), this._storeDataAttribute(
|
|
227
|
-
const e = this.currentNode.querySelector(
|
|
227
|
+
), this._storeDataAttribute(A.ROW_SPACING, t);
|
|
228
|
+
const e = this.currentNode.querySelector(S);
|
|
228
229
|
if (!e)
|
|
229
230
|
return;
|
|
230
231
|
const n = Array.from(
|
|
@@ -235,7 +236,7 @@ class X extends V {
|
|
|
235
236
|
const o = this.api.getDocumentModifier(), a = `${t}px`;
|
|
236
237
|
n.forEach((r) => {
|
|
237
238
|
o.modifyHtml(r).setStyle("height", a);
|
|
238
|
-
}), o.apply(new
|
|
239
|
+
}), o.apply(new m(`Update row spacing to ${t}px`));
|
|
239
240
|
}
|
|
240
241
|
// ========================================================================
|
|
241
242
|
// Mobile Spacing Handlers
|
|
@@ -252,17 +253,18 @@ class X extends V {
|
|
|
252
253
|
this.currentNode,
|
|
253
254
|
{ mobileColumnSpacing: t },
|
|
254
255
|
`Changed mobile column spacing to ${t}px`
|
|
255
|
-
), this._storeDataAttribute(
|
|
256
|
-
const n = d.getConfig(this.currentNode).layout ||
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
).forEach((
|
|
260
|
-
o.modifyHtml(
|
|
256
|
+
), this._storeDataAttribute(A.MOBILE_COLUMN_SPACING, t);
|
|
257
|
+
const n = d.getConfig(this.currentNode).layout || f(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(E);
|
|
258
|
+
c && (n === "grid" ? Array.from(
|
|
259
|
+
c.querySelectorAll(".attribute-cell")
|
|
260
|
+
).forEach((l) => {
|
|
261
|
+
o.modifyHtml(l).setStyle("padding", r);
|
|
261
262
|
}) : Array.from(
|
|
262
|
-
|
|
263
|
-
).forEach((
|
|
264
|
-
"parent" in
|
|
265
|
-
|
|
263
|
+
c.querySelectorAll(".product-card-wrapper")
|
|
264
|
+
).forEach((l) => {
|
|
265
|
+
const h = "parent" in l ? l.parent() : void 0;
|
|
266
|
+
h && o.modifyHtml(h).setStyle("padding", r);
|
|
267
|
+
}), o.apply(new m(`Update mobile column spacing to ${t}px`)));
|
|
266
268
|
}
|
|
267
269
|
/**
|
|
268
270
|
* Handles row spacing changes for mobile.
|
|
@@ -276,7 +278,7 @@ class X extends V {
|
|
|
276
278
|
this.currentNode,
|
|
277
279
|
{ mobileRowSpacing: t },
|
|
278
280
|
`Changed mobile row spacing to ${t}px`
|
|
279
|
-
), this._storeDataAttribute(
|
|
281
|
+
), this._storeDataAttribute(A.MOBILE_ROW_SPACING, t);
|
|
280
282
|
const e = this.currentNode.querySelector(E);
|
|
281
283
|
if (!e)
|
|
282
284
|
return;
|
|
@@ -288,7 +290,7 @@ class X extends V {
|
|
|
288
290
|
const o = this.api.getDocumentModifier(), a = `${t}px`;
|
|
289
291
|
n.forEach((r) => {
|
|
290
292
|
o.modifyHtml(r).setStyle("height", a);
|
|
291
|
-
}), o.apply(new
|
|
293
|
+
}), o.apply(new m(`Update mobile row spacing to ${t}px`));
|
|
292
294
|
}
|
|
293
295
|
// ========================================================================
|
|
294
296
|
// Data Attribute Storage
|
|
@@ -298,7 +300,7 @@ class X extends V {
|
|
|
298
300
|
*/
|
|
299
301
|
_storeDataAttribute(t, e) {
|
|
300
302
|
const n = x(this.currentNode);
|
|
301
|
-
n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new
|
|
303
|
+
n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new m(`Store ${t}`));
|
|
302
304
|
}
|
|
303
305
|
// ========================================================================
|
|
304
306
|
// Event Listeners
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import r from "../../../static/assets/info.svg.js";
|
|
2
|
+
import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
class h extends t {
|
|
3
4
|
registerIconsSvg(C) {
|
|
4
5
|
C["recommendation-icon"] = `
|
|
5
6
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
@@ -59,9 +60,9 @@ class o extends r {
|
|
|
59
60
|
<circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
|
|
60
61
|
<rect x="7" y="15" width="11" height="2" rx="1"/>
|
|
61
62
|
</svg>
|
|
62
|
-
|
|
63
|
+
`, C["migration-info-icon"] = r;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
h as RecommendationIconsRegistry
|
|
67
68
|
};
|
|
@@ -22,6 +22,54 @@ const n = `/* Utils */
|
|
|
22
22
|
ue-orderable.orderable-disabled .droppable-icon {
|
|
23
23
|
display: none;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
27
|
+
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
28
|
+
|
|
29
|
+
/* Layout variables for positioning the absolutely-placed info box */
|
|
30
|
+
:host {
|
|
31
|
+
--rec-migration-padding: 16px;
|
|
32
|
+
--rec-migration-title-height: 61px;
|
|
33
|
+
--rec-migration-box-height: 98px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Push tabs down when info box is present inside the control panel header */
|
|
37
|
+
.control-panel-header:has(.recommendation-block-migration-info) {
|
|
38
|
+
position: relative;
|
|
39
|
+
margin-bottom: calc(2 * var(--rec-migration-padding) + var(--rec-migration-box-height));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Info box container */
|
|
43
|
+
.recommendation-block-migration-info {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: flex-start;
|
|
46
|
+
gap: 8px;
|
|
47
|
+
padding: 12px;
|
|
48
|
+
background: var(--guido-color-background-onpage-message-info);
|
|
49
|
+
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: var(--rec-migration-padding);
|
|
54
|
+
right: var(--rec-migration-padding);
|
|
55
|
+
top: calc(var(--rec-migration-padding) + var(--rec-migration-title-height));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Icon — 18x19 icon inside a 24x24 bounding box (matches Figma) */
|
|
59
|
+
.recommendation-block-migration-info__icon {
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
width: 24px;
|
|
62
|
+
height: 24px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Text content */
|
|
66
|
+
.recommendation-block-migration-info__text {
|
|
67
|
+
margin: 4px 0;
|
|
68
|
+
white-space: normal;
|
|
69
|
+
font-size: 13px;
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
}
|
|
25
73
|
`;
|
|
26
74
|
export {
|
|
27
75
|
n as default
|