@useinsider/guido 2.0.0-beta.dbde199 → 2.0.0-beta.e68b206
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/@types/config/schemas.js +53 -39
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +342 -0
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +70 -59
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +159 -144
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -3
- package/dist/extensions/Blocks/Items/extension.js +7 -6
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
- package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
- package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
- package/dist/extensions/Blocks/Items/template.js +366 -129
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +184 -0
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +68 -158
- package/dist/extensions/Blocks/Recommendation/constants.js +1 -10
- package/dist/extensions/Blocks/Recommendation/control.js +61 -91
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -16
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +71 -124
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +65 -89
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +19 -56
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +45 -74
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +29 -30
- package/dist/extensions/Blocks/controlFactories.js +108 -98
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +46 -40
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +73 -0
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +3 -54
- package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +1 -41
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +7 -15
- package/dist/src/extensions/Blocks/common-control.d.ts +9 -10
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/components/wide-panel.css.js +4 -0
- package/dist/static/styles/customEditorStyle.css.js +0 -13
- package/dist/stores/config.js +7 -0
- package/dist/utils/pairProductVariables.js +61 -58
- package/package.json +1 -1
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
- package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -654
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
- package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { ModificationDescription as M } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { CommonControl as w } from "../../common-control.js";
|
|
3
|
-
import { RecommendationControlId as N, ATTR_DATA_PRICE_INLINE as E, RecommendationBlockId as g } from "../constants.js";
|
|
4
|
-
const k = N.PRICE_INLINE_LAYOUT, b = ".recommendation-attribute-row", B = "tr.recommendation-product-row", m = "data-attribute-type", T = "data-inline-merged", C = "data-visibility";
|
|
5
|
-
class V extends w {
|
|
6
|
-
getId() {
|
|
7
|
-
return k;
|
|
8
|
-
}
|
|
9
|
-
getTemplate() {
|
|
10
|
-
return `
|
|
11
|
-
<div class="container">
|
|
12
|
-
${this._GuTwoColumns([
|
|
13
|
-
this._GuLabel({ text: "Move to Next Line" }),
|
|
14
|
-
this._GuToggle("priceNextLine")
|
|
15
|
-
])}
|
|
16
|
-
<div style="color: #666; font-size: 12px; margin-top: 8px; padding-left: 8px;">
|
|
17
|
-
When disabled, Price and Old Price will appear side by side
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
22
|
-
onRender() {
|
|
23
|
-
this._initializePriceInlineState(), this._registerValueChangeListener();
|
|
24
|
-
}
|
|
25
|
-
onTemplateNodeUpdated(e) {
|
|
26
|
-
super.onTemplateNodeUpdated(e), this._initializePriceInlineState();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Reads the current price inline state from the block's data attribute
|
|
30
|
-
* and updates the toggle UI
|
|
31
|
-
* Note: Toggle ON = separate rows (next line), Toggle OFF = inline (same row)
|
|
32
|
-
*/
|
|
33
|
-
_initializePriceInlineState() {
|
|
34
|
-
const r = !this._readPriceInlineState();
|
|
35
|
-
this.api.updateValues({
|
|
36
|
-
priceNextLine: r
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Reads the price inline state from the block wrapper's data attribute
|
|
41
|
-
*/
|
|
42
|
-
_readPriceInlineState() {
|
|
43
|
-
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
44
|
-
return !1;
|
|
45
|
-
const e = this.currentNode.getAttribute(E);
|
|
46
|
-
return console.debug("inline attr", e), e === "1" || e === "true";
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Registers listener for toggle changes
|
|
50
|
-
*/
|
|
51
|
-
_registerValueChangeListener() {
|
|
52
|
-
this.api.onValueChanged("priceNextLine", (e) => {
|
|
53
|
-
const r = !e;
|
|
54
|
-
this._applyPriceInlineLayout(r);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Applies the price inline layout by restructuring the DOM
|
|
59
|
-
* When enabling inline: Merges Old Price content into Price row (side by side)
|
|
60
|
-
* When disabling inline: Separates them back into individual rows
|
|
61
|
-
*/
|
|
62
|
-
_applyPriceInlineLayout(e) {
|
|
63
|
-
if (!this.currentNode)
|
|
64
|
-
return;
|
|
65
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(E, e ? "1" : "0").apply(new M("Update price inline attribute"));
|
|
66
|
-
const r = this.currentNode.querySelectorAll(B);
|
|
67
|
-
if (!(r != null && r.length))
|
|
68
|
-
return;
|
|
69
|
-
const i = this.api.getDocumentModifier();
|
|
70
|
-
r.forEach((t) => {
|
|
71
|
-
e ? this._mergeOldPriceIntoPrice(t, i) : this._separateOldPriceFromPrice(t, i);
|
|
72
|
-
}), i.apply(new M(
|
|
73
|
-
e ? "Merge price rows into inline layout" : "Separate price rows"
|
|
74
|
-
));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Merges Old Price content into the same row as Price (inline layout)
|
|
78
|
-
* Creates a structure where both prices are side by side in one row
|
|
79
|
-
*/
|
|
80
|
-
_mergeOldPriceIntoPrice(e, r) {
|
|
81
|
-
const i = e.querySelector(
|
|
82
|
-
`${b}[${m}="productPrice"]`
|
|
83
|
-
), t = e.querySelector(
|
|
84
|
-
`${b}[${m}="productOldPrice"]`
|
|
85
|
-
);
|
|
86
|
-
if (!i || !t || "getAttribute" in t && t.getAttribute(T) === "1" || !("querySelectorAll" in i) || !("querySelectorAll" in t))
|
|
87
|
-
return;
|
|
88
|
-
const a = Array.from(i.querySelectorAll("table.product-card-wrapper")), u = Array.from(t.querySelectorAll("table.product-card-wrapper"));
|
|
89
|
-
a.length !== u.length || a.length === 0 || (a.forEach((o, _) => {
|
|
90
|
-
const s = u[_];
|
|
91
|
-
if (!o || !s || !("querySelector" in o) || !("querySelector" in s))
|
|
92
|
-
return;
|
|
93
|
-
const c = `[esd-extension-block-id="${g.PRICE}"]`, f = `[esd-extension-block-id="${g.OLD_PRICE}"]`, n = o.querySelector(c), l = s.querySelector(f);
|
|
94
|
-
if (!n || !l || !("getOuterHTML" in n) || !("getOuterHTML" in l))
|
|
95
|
-
return;
|
|
96
|
-
const h = n.getOuterHTML(), P = `
|
|
97
|
-
<tr data-inline-price-wrapper="1">
|
|
98
|
-
<td width="50%" style="vertical-align: middle;">
|
|
99
|
-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
100
|
-
<tbody>
|
|
101
|
-
<tr><td>${l.getOuterHTML()}</td></tr>
|
|
102
|
-
</tbody>
|
|
103
|
-
</table>
|
|
104
|
-
</td>
|
|
105
|
-
<td width="50%" style="vertical-align: middle;">
|
|
106
|
-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
107
|
-
<tbody>
|
|
108
|
-
<tr><td>${h}</td></tr>
|
|
109
|
-
</tbody>
|
|
110
|
-
</table>
|
|
111
|
-
</td>
|
|
112
|
-
</tr>
|
|
113
|
-
`, y = o.querySelector(".product-attribute-cell");
|
|
114
|
-
if (!y)
|
|
115
|
-
return;
|
|
116
|
-
const d = y.querySelector("tbody");
|
|
117
|
-
d && r.modifyHtml(d).setInnerHtml(P);
|
|
118
|
-
}), r.modifyHtml(t).setStyle("display", "none").setAttribute(T, "1"));
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Separates Old Price from Price row back into individual rows
|
|
122
|
-
* Restores the original separate row structure
|
|
123
|
-
*/
|
|
124
|
-
_separateOldPriceFromPrice(e, r) {
|
|
125
|
-
const i = e.querySelector(
|
|
126
|
-
`${b}[${m}="productPrice"]`
|
|
127
|
-
), t = e.querySelector(
|
|
128
|
-
`${b}[${m}="productOldPrice"]`
|
|
129
|
-
);
|
|
130
|
-
if (!i || !t || !("getAttribute" in t) || !(t.getAttribute(T) === "1") || !("querySelectorAll" in i) || !("querySelectorAll" in t))
|
|
131
|
-
return;
|
|
132
|
-
const u = Array.from(i.querySelectorAll("table.product-card-wrapper")), o = Array.from(t.querySelectorAll("table.product-card-wrapper"));
|
|
133
|
-
u.forEach((c, f) => {
|
|
134
|
-
if (!c || !("querySelector" in c))
|
|
135
|
-
return;
|
|
136
|
-
const n = o[f];
|
|
137
|
-
if (!n || !("querySelector" in n))
|
|
138
|
-
return;
|
|
139
|
-
const l = c.querySelector('[data-inline-price-wrapper="1"]');
|
|
140
|
-
if (!l || !("querySelectorAll" in l))
|
|
141
|
-
return;
|
|
142
|
-
const p = Array.from(l.querySelectorAll("td")).filter((O) => "getAttribute" in O && O.getAttribute("width") === "50%");
|
|
143
|
-
if (p.length !== 2)
|
|
144
|
-
return;
|
|
145
|
-
const P = `[esd-extension-block-id="${g.OLD_PRICE}"]`, y = `[esd-extension-block-id="${g.PRICE}"]`, d = p[0].querySelector(P), A = p[1].querySelector(y);
|
|
146
|
-
if (!d || !A || !("getOuterHTML" in d) || !("getOuterHTML" in A))
|
|
147
|
-
return;
|
|
148
|
-
const H = A.getOuterHTML(), R = d.getOuterHTML(), S = c.querySelector(".product-attribute-cell"), L = S == null ? void 0 : S.querySelector("tbody");
|
|
149
|
-
L && r.modifyHtml(L).setInnerHtml(`<tr><td>${H}</td></tr>`);
|
|
150
|
-
const I = n.querySelector(".product-attribute-cell"), q = I == null ? void 0 : I.querySelector("tbody");
|
|
151
|
-
q && r.modifyHtml(q).setInnerHtml(`<tr><td>${R}</td></tr>`);
|
|
152
|
-
});
|
|
153
|
-
const s = t.getAttribute(C) === "0" ? "none" : "table-row";
|
|
154
|
-
r.modifyHtml(t).setStyle("display", s).removeAttribute(T);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
export {
|
|
158
|
-
k as PRICE_INLINE_LAYOUT_CONTROL_ID,
|
|
159
|
-
V as PriceInlineLayoutControl
|
|
160
|
-
};
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
var C = Object.defineProperty;
|
|
2
|
-
var g = (i, r, e) => r in i ? C(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
|
-
var S = (i, r, e) => g(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as m } from "../../common-control.js";
|
|
6
|
-
import { useDebounceFn as d } from "../../../../node_modules/@vueuse/shared/index.js";
|
|
7
|
-
const _ = "recommendation-spacing-control", c = {
|
|
8
|
-
COLUMN_SPACING: "columnSpacing",
|
|
9
|
-
ROW_SPACING: "rowSpacing"
|
|
10
|
-
}, N = {
|
|
11
|
-
COLUMN_SPACING: "data-column-spacing",
|
|
12
|
-
ROW_SPACING: "data-row-spacing"
|
|
13
|
-
}, n = {
|
|
14
|
-
COLUMN_SPACING: 10,
|
|
15
|
-
// 5px on each side = 10px total
|
|
16
|
-
ROW_SPACING: 20
|
|
17
|
-
}, p = {
|
|
18
|
-
MIN_SPACING: 0,
|
|
19
|
-
MAX_SPACING: 50,
|
|
20
|
-
STEP: 5
|
|
21
|
-
};
|
|
22
|
-
class G extends m {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
/**
|
|
26
|
-
* Debounced version of _onColumnSpacingChange
|
|
27
|
-
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
28
|
-
*/
|
|
29
|
-
S(this, "_debouncedOnColumnSpacingChange", d((e) => {
|
|
30
|
-
this._onColumnSpacingChange(e);
|
|
31
|
-
}, 300));
|
|
32
|
-
/**
|
|
33
|
-
* Debounced version of _onRowSpacingChange
|
|
34
|
-
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
35
|
-
*/
|
|
36
|
-
S(this, "_debouncedOnRowSpacingChange", d((e) => {
|
|
37
|
-
this._onRowSpacingChange(e);
|
|
38
|
-
}, 300));
|
|
39
|
-
}
|
|
40
|
-
getId() {
|
|
41
|
-
return _;
|
|
42
|
-
}
|
|
43
|
-
getTemplate() {
|
|
44
|
-
return `
|
|
45
|
-
<div class="spacing-control-container">
|
|
46
|
-
${this._GuTwoColumns([
|
|
47
|
-
this._GuLabel({ text: "Column Spacing (px)" }),
|
|
48
|
-
this._GuCounter({
|
|
49
|
-
name: c.COLUMN_SPACING,
|
|
50
|
-
minValue: p.MIN_SPACING,
|
|
51
|
-
maxValue: p.MAX_SPACING,
|
|
52
|
-
step: p.STEP
|
|
53
|
-
}),
|
|
54
|
-
this._GuLabel({ text: "Row Spacing (px)" }),
|
|
55
|
-
this._GuCounter({
|
|
56
|
-
name: c.ROW_SPACING,
|
|
57
|
-
minValue: p.MIN_SPACING,
|
|
58
|
-
maxValue: p.MAX_SPACING,
|
|
59
|
-
step: p.STEP
|
|
60
|
-
})
|
|
61
|
-
])}
|
|
62
|
-
</div>
|
|
63
|
-
`;
|
|
64
|
-
}
|
|
65
|
-
onRender() {
|
|
66
|
-
this._setFormValues(), this._listenToFormUpdates();
|
|
67
|
-
}
|
|
68
|
-
onTemplateNodeUpdated(e) {
|
|
69
|
-
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Reads spacing values from data attributes or returns defaults
|
|
73
|
-
*/
|
|
74
|
-
_setFormValues() {
|
|
75
|
-
const e = this._getStoredColumnSpacing(), t = this._getStoredRowSpacing();
|
|
76
|
-
this.api.updateValues({
|
|
77
|
-
[c.COLUMN_SPACING]: e,
|
|
78
|
-
[c.ROW_SPACING]: t
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Gets stored column spacing from the first product card wrapper's parent element's padding
|
|
83
|
-
* Reads the actual padding value instead of relying on data attributes
|
|
84
|
-
*
|
|
85
|
-
* The padding is applied as "0 {halfSpacing}px" on the parent TD element,
|
|
86
|
-
* so we need to extract the horizontal padding value and multiply by 2 to get total spacing.
|
|
87
|
-
*/
|
|
88
|
-
_getStoredColumnSpacing() {
|
|
89
|
-
if (!this.currentNode)
|
|
90
|
-
return n.COLUMN_SPACING;
|
|
91
|
-
const e = this.currentNode.querySelector(".product-card-wrapper");
|
|
92
|
-
if (!e || !("parent" in e) || typeof e.parent != "function")
|
|
93
|
-
return n.COLUMN_SPACING;
|
|
94
|
-
const t = e.parent();
|
|
95
|
-
if (!t || !("getStyle" in t))
|
|
96
|
-
return n.COLUMN_SPACING;
|
|
97
|
-
const o = t.getStyle("padding");
|
|
98
|
-
if (!o)
|
|
99
|
-
return n.COLUMN_SPACING;
|
|
100
|
-
const u = o.trim().split(/\s+/);
|
|
101
|
-
if (u.length < 2)
|
|
102
|
-
return n.COLUMN_SPACING;
|
|
103
|
-
const [, a] = u, s = parseFloat(a);
|
|
104
|
-
return Number.isNaN(s) ? n.COLUMN_SPACING : s * 2;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Gets stored row spacing from the first spacer element's height style
|
|
108
|
-
* Reads the actual height value instead of relying on data attributes
|
|
109
|
-
*/
|
|
110
|
-
_getStoredRowSpacing() {
|
|
111
|
-
if (!this.currentNode)
|
|
112
|
-
return n.ROW_SPACING;
|
|
113
|
-
const e = this.currentNode.querySelector(".spacer");
|
|
114
|
-
if (!e || !("getStyle" in e))
|
|
115
|
-
return n.ROW_SPACING;
|
|
116
|
-
const t = e.getStyle("height");
|
|
117
|
-
if (!t)
|
|
118
|
-
return n.ROW_SPACING;
|
|
119
|
-
const o = parseFloat(t);
|
|
120
|
-
return Number.isNaN(o) ? n.ROW_SPACING : o;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Handles column spacing changes
|
|
124
|
-
* Applies horizontal padding to all product card wrappers
|
|
125
|
-
*/
|
|
126
|
-
_onColumnSpacingChange(e) {
|
|
127
|
-
if (!this.currentNode)
|
|
128
|
-
return;
|
|
129
|
-
const t = Array.from(
|
|
130
|
-
this.currentNode.querySelectorAll(".product-card-wrapper")
|
|
131
|
-
);
|
|
132
|
-
if (!t)
|
|
133
|
-
return;
|
|
134
|
-
const o = this.api.getDocumentModifier(), a = `0 ${e / 2}px`;
|
|
135
|
-
console.debug("padding", a), t.forEach((s) => {
|
|
136
|
-
"parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", a);
|
|
137
|
-
}), o.apply(new l(`Update column spacing to ${e}px`));
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Handles row spacing changes
|
|
141
|
-
* Applies height to all spacer elements between product rows
|
|
142
|
-
*/
|
|
143
|
-
_onRowSpacingChange(e) {
|
|
144
|
-
if (!this.currentNode)
|
|
145
|
-
return;
|
|
146
|
-
this._storeRowSpacing(e);
|
|
147
|
-
const t = Array.from(
|
|
148
|
-
this.currentNode.querySelectorAll(".spacer")
|
|
149
|
-
);
|
|
150
|
-
if (console.debug("spacerCells", t), console.debug("spacing", e), !t.length)
|
|
151
|
-
return;
|
|
152
|
-
const o = this.api.getDocumentModifier(), u = `${e}px`;
|
|
153
|
-
t.forEach((a) => {
|
|
154
|
-
o.modifyHtml(a).setStyle("height", u);
|
|
155
|
-
}), o.apply(new l(`Update row spacing to ${e}px`));
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Stores column spacing value in block data attribute
|
|
159
|
-
*/
|
|
160
|
-
_storeColumnSpacing(e) {
|
|
161
|
-
if (!this.currentNode)
|
|
162
|
-
return;
|
|
163
|
-
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
164
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.COLUMN_SPACING, e.toString()).apply(new l("Store column spacing"));
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Stores row spacing value in block data attribute
|
|
168
|
-
*/
|
|
169
|
-
_storeRowSpacing(e) {
|
|
170
|
-
if (!this.currentNode)
|
|
171
|
-
return;
|
|
172
|
-
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
173
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.ROW_SPACING, e.toString()).apply(new l("Store row spacing"));
|
|
174
|
-
}
|
|
175
|
-
_listenToFormUpdates() {
|
|
176
|
-
this.api.onValueChanged(c.COLUMN_SPACING, (e) => {
|
|
177
|
-
const t = parseInt(e);
|
|
178
|
-
Number.isNaN(t) || this._debouncedOnColumnSpacingChange(t);
|
|
179
|
-
}), this.api.onValueChanged(c.ROW_SPACING, (e) => {
|
|
180
|
-
const t = parseInt(e);
|
|
181
|
-
Number.isNaN(t) || this._debouncedOnRowSpacingChange(t);
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
export {
|
|
186
|
-
_ as SPACING_CONTROL_ID,
|
|
187
|
-
G as SpacingControl
|
|
188
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function a(n) {
|
|
2
|
-
return "getInnerHTML" in n && typeof n.getInnerHTML == "function" ? n.getInnerHTML() : "innerHTML" in n ? n.innerHTML : "";
|
|
3
|
-
}
|
|
4
|
-
function H(n, t) {
|
|
5
|
-
if (!n)
|
|
6
|
-
return t;
|
|
7
|
-
const r = a(n);
|
|
8
|
-
if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
|
|
9
|
-
return t;
|
|
10
|
-
const i = [], s = [];
|
|
11
|
-
let o = r.trim();
|
|
12
|
-
for (; ; ) {
|
|
13
|
-
const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
|
|
14
|
-
if (!u)
|
|
15
|
-
break;
|
|
16
|
-
const [, e, f = "", g] = u, c = new RegExp(`</${e}>$`, "i");
|
|
17
|
-
if (!c.test(g))
|
|
18
|
-
break;
|
|
19
|
-
i.push(`<${e}${f}>`), s.unshift(`</${e}>`), o = g.replace(c, "").trim();
|
|
20
|
-
}
|
|
21
|
-
return i.length > 0 ? i.join("") + t + s.join("") : t;
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
H as preserveTextStyles
|
|
25
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
/**
|
|
3
|
-
* Gets the esd-config-block element from the current node.
|
|
4
|
-
* Searches within the closest .items-block-v2 container.
|
|
5
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
6
|
-
* @returns The config block element or null if not found
|
|
7
|
-
*/
|
|
8
|
-
export declare function getConfigBlock(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
|
|
9
|
-
/**
|
|
10
|
-
* Converts an attribute value to a boolean.
|
|
11
|
-
* Handles string values '1', 'true', and null/undefined cases.
|
|
12
|
-
* @param value - The attribute value (string or null)
|
|
13
|
-
* @param defaultValue - Default value to return if value is null/undefined (default: false)
|
|
14
|
-
* @returns The boolean value
|
|
15
|
-
*/
|
|
16
|
-
export declare function attributeToBoolean(value: string | null, defaultValue?: boolean): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Gets a string attribute value with a default fallback.
|
|
19
|
-
* @param value - The attribute value (string or null)
|
|
20
|
-
* @param defaultValue - Default value to return if value is null/undefined (default: '')
|
|
21
|
-
* @returns The string value or default
|
|
22
|
-
*/
|
|
23
|
-
export declare function attributeToString(value: string | null, defaultValue?: string): string;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
import { configAttributes } from '../enums/productEnums';
|
|
3
|
-
type StoreSetter<T> = (value: T) => void;
|
|
4
|
-
interface SyncConfig<T> {
|
|
5
|
-
attributeName: keyof typeof configAttributes;
|
|
6
|
-
storeSetter: StoreSetter<T>;
|
|
7
|
-
converter: (value: string | null) => T;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Generic utility to sync an attribute value from esd-config-block to the store.
|
|
11
|
-
* This makes attribute values mutable by syncing them from the DOM.
|
|
12
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
13
|
-
* @param config - Configuration object with attribute name, store setter, and value converter
|
|
14
|
-
*/
|
|
15
|
-
export declare function syncAttributeFromConfigBlock<T>(currentNode: ImmutableHtmlNode | undefined, config: SyncConfig<T>): void;
|
|
16
|
-
/**
|
|
17
|
-
* Helper to create a sync config for boolean attributes.
|
|
18
|
-
* @param attributeName - The attribute name from configAttributes
|
|
19
|
-
* @param storeSetter - The store setter function
|
|
20
|
-
* @param defaultValue - Default value if attribute is not set (default: false)
|
|
21
|
-
* @returns Sync configuration object
|
|
22
|
-
*/
|
|
23
|
-
export declare function createBooleanSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<boolean>, defaultValue?: boolean): SyncConfig<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* Helper to create a sync config for string attributes.
|
|
26
|
-
* @param attributeName - The attribute name from configAttributes
|
|
27
|
-
* @param storeSetter - The store setter function
|
|
28
|
-
* @param defaultValue - Default value if attribute is not set (default: '')
|
|
29
|
-
* @returns Sync configuration object
|
|
30
|
-
*/
|
|
31
|
-
export declare function createStringSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<string>, defaultValue?: string): SyncConfig<string>;
|
|
32
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
/**
|
|
3
|
-
* Reads name trimming value from esd-config-block attribute and updates the store.
|
|
4
|
-
* This makes the trimming value mutable by syncing it from the DOM.
|
|
5
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
6
|
-
*/
|
|
7
|
-
export declare function syncNameTrimmingFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
8
|
-
/**
|
|
9
|
-
* Reads hide discount value from esd-config-block attribute and updates the store.
|
|
10
|
-
* This makes the hide discount value mutable by syncing it from the DOM.
|
|
11
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
12
|
-
*/
|
|
13
|
-
export declare function syncHideDiscountFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
14
|
-
/**
|
|
15
|
-
* Reads formatted price value from esd-config-block attribute and updates the store.
|
|
16
|
-
* This makes the formatted price value mutable by syncing it from the DOM.
|
|
17
|
-
* Defaults to true if not set, since formatted is the default.
|
|
18
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
19
|
-
*/
|
|
20
|
-
export declare function syncFormattedPriceFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
21
|
-
/**
|
|
22
|
-
* Reads currency symbol value from esd-config-block attribute and updates the store.
|
|
23
|
-
* This makes the currency symbol value mutable by syncing it from the DOM.
|
|
24
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
25
|
-
*/
|
|
26
|
-
export declare function syncCurrencySymbolFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
27
|
-
/**
|
|
28
|
-
* Reads currency location value from esd-config-block attribute and updates the store.
|
|
29
|
-
* This makes the currency location value mutable by syncing it from the DOM.
|
|
30
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
31
|
-
*/
|
|
32
|
-
export declare function syncCurrencyLocationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
33
|
-
/**
|
|
34
|
-
* Reads button link value from esd-config-block attribute and updates the store.
|
|
35
|
-
* This makes the button link value mutable by syncing it from the DOM.
|
|
36
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
37
|
-
*/
|
|
38
|
-
export declare function syncButtonLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
39
|
-
/**
|
|
40
|
-
* Reads image link value from esd-config-block attribute and updates the store.
|
|
41
|
-
* This makes the image link value mutable by syncing it from the DOM.
|
|
42
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
43
|
-
*/
|
|
44
|
-
export declare function syncImageLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
45
|
-
/**
|
|
46
|
-
* Reads price orientation value from esd-config-block attribute and updates the store.
|
|
47
|
-
* This makes the price orientation value mutable by syncing it from the DOM.
|
|
48
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
49
|
-
*/
|
|
50
|
-
export declare function syncPriceOrientationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ImmutableHtmlNode, ControlApi } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
/**
|
|
3
|
-
* Updates attributes on the esd-config-block element based on current store state.
|
|
4
|
-
* This utility can be called from controls whenever they change values that affect attributes.
|
|
5
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
6
|
-
* @param api - The API object from the control (usually this.api)
|
|
7
|
-
*/
|
|
8
|
-
export declare function updateConfigBlockAttributes(currentNode: ImmutableHtmlNode | undefined, api: ControlApi): void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
-
import { CommonControl } from '../../common-control';
|
|
3
|
-
export declare const CARD_BACKGROUND_COLOR_CONTROL_ID = "recommendation-card-background-color-control";
|
|
4
|
-
/**
|
|
5
|
-
* Control for managing recommendation card background color
|
|
6
|
-
* This control is displayed in the Styles tab
|
|
7
|
-
*/
|
|
8
|
-
export declare class CardBackgroundColorControl extends CommonControl {
|
|
9
|
-
getId(): string;
|
|
10
|
-
getTemplate(): string;
|
|
11
|
-
onRender(): void;
|
|
12
|
-
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
13
|
-
_setFormValues(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Reads the current background color from the first product card wrapper
|
|
16
|
-
* @returns The background color value or 'transparent' if not found
|
|
17
|
-
*/
|
|
18
|
-
_getCurrentCardBackgroundColor(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Handles card background color changes
|
|
21
|
-
* Applies the color to all product card wrapper elements
|
|
22
|
-
*/
|
|
23
|
-
_onCardBackgroundColorChange(color: string): void;
|
|
24
|
-
_listenToFormUpdates(): void;
|
|
25
|
-
}
|