@useinsider/guido 2.1.0-beta.01eaf27 → 2.1.0-beta.1d0cd94
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/useActionsApi.js +15 -13
- package/dist/extensions/Blocks/Items/block.js +27 -25
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +117 -94
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +164 -158
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/template.js +5 -4
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +16 -16
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -4
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +9 -9
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useToaster as w } from "./useToaster.js";
|
|
2
2
|
const v = () => {
|
|
3
|
-
const { handleError:
|
|
3
|
+
const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
|
|
4
4
|
const o = { ...{
|
|
5
5
|
minimize: !0,
|
|
6
6
|
utmEntity: {
|
|
@@ -21,9 +21,9 @@ const v = () => {
|
|
|
21
21
|
resetDataSavedFlag: !1,
|
|
22
22
|
disableLineHeightsReplace: !0
|
|
23
23
|
}, ...t }, s = {
|
|
24
|
-
callback: (
|
|
25
|
-
|
|
26
|
-
html:
|
|
24
|
+
callback: (l, r, d, c, u) => {
|
|
25
|
+
l ? a(l) : e({
|
|
26
|
+
html: r,
|
|
27
27
|
ampHtml: d,
|
|
28
28
|
ampErrors: c,
|
|
29
29
|
displayConditions: u
|
|
@@ -34,15 +34,15 @@ const v = () => {
|
|
|
34
34
|
window.StripoEditorApi.actionsApi.compileEmail(s);
|
|
35
35
|
});
|
|
36
36
|
return {
|
|
37
|
-
getCompiledEmail:
|
|
37
|
+
getCompiledEmail: m,
|
|
38
38
|
getTemplateData: () => new Promise((t) => {
|
|
39
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
39
|
+
const e = ({ html: a, css: i, width: o, height: p, utmParams: s, syncModulesIds: l }) => t({
|
|
40
40
|
html: a,
|
|
41
41
|
css: i,
|
|
42
42
|
width: o,
|
|
43
|
-
height:
|
|
43
|
+
height: p,
|
|
44
44
|
utmParams: s,
|
|
45
|
-
syncModulesIds:
|
|
45
|
+
syncModulesIds: l
|
|
46
46
|
});
|
|
47
47
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
48
48
|
}),
|
|
@@ -56,7 +56,7 @@ const v = () => {
|
|
|
56
56
|
displayConditions: a,
|
|
57
57
|
ampHtml: i = "",
|
|
58
58
|
ampErrors: o = []
|
|
59
|
-
} = await
|
|
59
|
+
} = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
60
60
|
return {
|
|
61
61
|
html: e,
|
|
62
62
|
ampHtml: i,
|
|
@@ -64,7 +64,7 @@ const v = () => {
|
|
|
64
64
|
displayConditions: a
|
|
65
65
|
};
|
|
66
66
|
} catch (e) {
|
|
67
|
-
return
|
|
67
|
+
return n(e, "Error loading preview"), {
|
|
68
68
|
html: "",
|
|
69
69
|
ampHtml: "",
|
|
70
70
|
ampErrors: [],
|
|
@@ -80,17 +80,19 @@ const v = () => {
|
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
82
|
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
|
|
83
|
-
i ? (
|
|
83
|
+
i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
84
84
|
});
|
|
85
85
|
} catch (i) {
|
|
86
|
-
|
|
86
|
+
n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
87
87
|
}
|
|
88
88
|
}),
|
|
89
89
|
updateHtmlAndCss: (t, e) => {
|
|
90
90
|
window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
|
|
91
91
|
},
|
|
92
92
|
editorSave: () => {
|
|
93
|
-
window.StripoEditorApi.actionsApi.save()
|
|
93
|
+
window.StripoEditorApi.actionsApi.save((t) => {
|
|
94
|
+
t && n(t, "Failed to save template");
|
|
95
|
+
});
|
|
94
96
|
}
|
|
95
97
|
};
|
|
96
98
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useOnboardingStore as
|
|
2
|
-
import { Block as
|
|
3
|
-
import { SETTINGS_ENUMS as
|
|
4
|
-
import { getDefaultTemplate as
|
|
5
|
-
import { getItemsBlockContainer as
|
|
6
|
-
const
|
|
7
|
-
class
|
|
1
|
+
import { useOnboardingStore as d } from "../../../stores/onboarding.js";
|
|
2
|
+
import { Block as g, BlockCompositionType as f, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { SETTINGS_ENUMS as c, DefaultConfigValues as i } from "./enums/settingsEnums.js";
|
|
4
|
+
import { getDefaultTemplate as p } from "./template.js";
|
|
5
|
+
import { getItemsBlockContainer as u, getItemsBlockConfig as C, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
|
|
6
|
+
const y = "items-block";
|
|
7
|
+
class B extends g {
|
|
8
8
|
getId() {
|
|
9
|
-
return
|
|
9
|
+
return y;
|
|
10
10
|
}
|
|
11
11
|
getIcon() {
|
|
12
12
|
return "items-icon";
|
|
13
13
|
}
|
|
14
14
|
getBlockCompositionType() {
|
|
15
|
-
return
|
|
15
|
+
return f.CONTAINER;
|
|
16
16
|
}
|
|
17
17
|
getName() {
|
|
18
18
|
return this.api.translate("Items");
|
|
@@ -21,32 +21,34 @@ class S extends m {
|
|
|
21
21
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
22
22
|
}
|
|
23
23
|
getTemplate() {
|
|
24
|
-
return
|
|
25
|
-
orientation:
|
|
26
|
-
itemsType:
|
|
24
|
+
return p({
|
|
25
|
+
orientation: c.ORIENTATION.VERTICAL,
|
|
26
|
+
itemsType: c.ITEMS_TYPE.CART_ITEMS,
|
|
27
27
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
28
|
-
currencySymbol:
|
|
29
|
-
currencyLocation:
|
|
30
|
-
formattedPrice:
|
|
28
|
+
currencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
29
|
+
currencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
30
|
+
formattedPrice: i.productPriceFormattedControlValue === "1"
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
allowInnerBlocksDND() {
|
|
34
34
|
return !1;
|
|
35
35
|
}
|
|
36
|
-
onCreated(
|
|
37
|
-
const
|
|
38
|
-
|
|
36
|
+
onCreated(n) {
|
|
37
|
+
const s = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
|
|
38
|
+
r.querySelector('[product-attr="imageSrc"] img') || s.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
39
|
+
const e = u(n);
|
|
40
|
+
if (!e)
|
|
39
41
|
return;
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
42
|
+
const a = e.getNodeConfig(), l = a && Object.keys(a).length > 0, t = C(n);
|
|
43
|
+
if (t != null && t.initialized)
|
|
44
|
+
l ? 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"));
|
|
43
45
|
else {
|
|
44
|
-
const
|
|
45
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
46
|
+
const m = I();
|
|
47
|
+
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new o("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
y as BLOCK_ID,
|
|
53
|
+
B as ItemsBlock
|
|
52
54
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var I = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ItemsBlockId as
|
|
7
|
-
import { SETTINGS_ENUMS as
|
|
8
|
-
import { getItemsBlockConfig as
|
|
9
|
-
const
|
|
2
|
+
var U = (d, a, t) => a in d ? I(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
|
|
3
|
+
var p = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import { ModificationDescription as c } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as b } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as r } from "../enums/controlEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
|
|
8
|
+
import { getItemsBlockConfig as R, setItemsBlockConfig as m } from "../utils/nodeConfigUtils.js";
|
|
9
|
+
const g = "ui-elements-items-card-composition-block", i = {
|
|
10
10
|
PRODUCT_IMAGE: "image",
|
|
11
11
|
PRODUCT_NAME: "name",
|
|
12
12
|
PRODUCT_QUANTITY: "quantity",
|
|
@@ -14,10 +14,10 @@ const m = "ui-elements-items-card-composition-block", i = {
|
|
|
14
14
|
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
15
15
|
PRODUCT_BUTTON: "button"
|
|
16
16
|
};
|
|
17
|
-
class
|
|
17
|
+
class M extends b {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
|
-
|
|
20
|
+
p(this, "visibilityState", {
|
|
21
21
|
[i.PRODUCT_IMAGE]: !0,
|
|
22
22
|
[i.PRODUCT_NAME]: !0,
|
|
23
23
|
[i.PRODUCT_QUANTITY]: !0,
|
|
@@ -27,7 +27,7 @@ class S extends U {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
getId() {
|
|
30
|
-
return
|
|
30
|
+
return g;
|
|
31
31
|
}
|
|
32
32
|
getTemplate() {
|
|
33
33
|
return `
|
|
@@ -39,7 +39,7 @@ class S extends U {
|
|
|
39
39
|
{ name: i.PRODUCT_PRICE, label: "Product Price" },
|
|
40
40
|
{ name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
|
|
41
41
|
{ name: i.PRODUCT_BUTTON, label: "Product Button" }
|
|
42
|
-
].map((
|
|
42
|
+
].map((e) => this._getToggleContainer(e)).join("")}
|
|
43
43
|
</div>
|
|
44
44
|
`;
|
|
45
45
|
}
|
|
@@ -48,14 +48,14 @@ class S extends U {
|
|
|
48
48
|
}
|
|
49
49
|
onTemplateNodeUpdated(t) {
|
|
50
50
|
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
|
|
51
|
-
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this.
|
|
51
|
+
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(!0), this._updateTogglesFromState();
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
_getToggleContainer({ name: t, label:
|
|
54
|
+
_getToggleContainer({ name: t, label: e }) {
|
|
55
55
|
return `
|
|
56
56
|
<div class="container" name="${t}Container">
|
|
57
57
|
<div class="display-flex align-items-center justify-content-between">
|
|
58
|
-
${this._GuLabel({ text:
|
|
58
|
+
${this._GuLabel({ text: e, name: `${t}Label` })}
|
|
59
59
|
${this._GuToggle(t)}
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
@@ -75,10 +75,10 @@ class S extends U {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
_syncVisibilityFromAttributes() {
|
|
78
|
-
const t =
|
|
78
|
+
const t = R(this.currentNode);
|
|
79
79
|
if (!t)
|
|
80
80
|
return;
|
|
81
|
-
const
|
|
81
|
+
const e = {
|
|
82
82
|
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
83
83
|
[i.PRODUCT_NAME]: "nameVisible",
|
|
84
84
|
[i.PRODUCT_QUANTITY]: "quantityControlEnabled",
|
|
@@ -86,44 +86,45 @@ class S extends U {
|
|
|
86
86
|
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
87
87
|
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
88
88
|
};
|
|
89
|
-
Object.entries(
|
|
90
|
-
const
|
|
91
|
-
this.visibilityState[
|
|
89
|
+
Object.entries(e).forEach(([o, n]) => {
|
|
90
|
+
const s = t[n];
|
|
91
|
+
this.visibilityState[o] = s !== !1;
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* If itemsType is not BROWSED_ITEMS, show quantity
|
|
96
96
|
* If itemsType is BROWSED_ITEMS, hide quantity
|
|
97
97
|
* and mark it as '0'
|
|
98
|
+
* @param syncOnly - If true, only sync local state and UI without modifying the document
|
|
98
99
|
*/
|
|
99
|
-
_handleBrowsedItemsQuantity() {
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
100
|
+
_handleBrowsedItemsQuantity(t = !1) {
|
|
101
|
+
const e = R(this.currentNode), n = ((e == null ? void 0 : e.type) ?? h.ITEMS_TYPE.CART_ITEMS) !== h.ITEMS_TYPE.BROWSED_ITEMS;
|
|
102
|
+
if (!e)
|
|
102
103
|
return;
|
|
103
|
-
const s =
|
|
104
|
-
this.visibilityState[i.PRODUCT_QUANTITY] =
|
|
105
|
-
}
|
|
106
|
-
_applyVisibilityStyles() {
|
|
107
|
-
const
|
|
108
|
-
[i.PRODUCT_IMAGE]:
|
|
109
|
-
[i.PRODUCT_NAME]:
|
|
110
|
-
[i.PRODUCT_QUANTITY]:
|
|
111
|
-
[i.PRODUCT_PRICE]:
|
|
112
|
-
[i.PRODUCT_ORIGINAL_PRICE]:
|
|
113
|
-
[i.PRODUCT_BUTTON]:
|
|
114
|
-
};
|
|
115
|
-
Object.entries(
|
|
104
|
+
const s = e.quantityControlEnabled !== !1;
|
|
105
|
+
this.visibilityState[i.PRODUCT_QUANTITY] = n && s, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, n), t || this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, n && s);
|
|
106
|
+
}
|
|
107
|
+
_applyVisibilityStyles(t) {
|
|
108
|
+
const e = {
|
|
109
|
+
[i.PRODUCT_IMAGE]: r.IMAGE,
|
|
110
|
+
[i.PRODUCT_NAME]: r.NAME,
|
|
111
|
+
[i.PRODUCT_QUANTITY]: r.QUANTITY,
|
|
112
|
+
[i.PRODUCT_PRICE]: r.PRICE,
|
|
113
|
+
[i.PRODUCT_ORIGINAL_PRICE]: r.ORIGINAL_PRICE,
|
|
114
|
+
[i.PRODUCT_BUTTON]: r.BUTTON
|
|
115
|
+
}, o = t ?? this.api.getDocumentModifier();
|
|
116
|
+
Object.entries(e).forEach(([n, s]) => {
|
|
116
117
|
var C;
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
118
|
+
const l = (C = this.currentNode) == null ? void 0 : C.querySelectorAll(`[esd-extension-block-id="${s}"]`);
|
|
119
|
+
if (!l)
|
|
119
120
|
return;
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
124
|
-
}), this._updatePriceCellWidthsForVerticalLayout();
|
|
121
|
+
const P = this.visibilityState[n];
|
|
122
|
+
l.forEach((T) => {
|
|
123
|
+
o.modifyHtml(T).setStyle("display", P ? "table-cell" : "none");
|
|
124
|
+
});
|
|
125
|
+
}), this._updatePriceCellWidthsForVerticalLayout(o), t || o.apply(new c("Applied visibility styles"));
|
|
125
126
|
}
|
|
126
|
-
_updateVisibilityAttribute(t, o) {
|
|
127
|
+
_updateVisibilityAttribute(t, e, o) {
|
|
127
128
|
const s = {
|
|
128
129
|
[i.PRODUCT_IMAGE]: "imageVisible",
|
|
129
130
|
[i.PRODUCT_NAME]: "nameVisible",
|
|
@@ -132,9 +133,9 @@ class S extends U {
|
|
|
132
133
|
[i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
|
|
133
134
|
[i.PRODUCT_BUTTON]: "buttonVisible"
|
|
134
135
|
}[t];
|
|
135
|
-
s &&
|
|
136
|
-
[s]:
|
|
137
|
-
});
|
|
136
|
+
s && m(this.currentNode, this.api, {
|
|
137
|
+
[s]: e
|
|
138
|
+
}, o);
|
|
138
139
|
}
|
|
139
140
|
_listenToFormUpdates() {
|
|
140
141
|
this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => {
|
|
@@ -152,51 +153,67 @@ class S extends U {
|
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
_onProductImageChange(t) {
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
var s;
|
|
157
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
|
|
158
|
+
if (!e)
|
|
159
|
+
return;
|
|
160
|
+
this.visibilityState[i.PRODUCT_IMAGE] = t;
|
|
161
|
+
const o = this.api.getDocumentModifier();
|
|
162
|
+
o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t, o);
|
|
163
|
+
const n = `Product image visibility changed to ${t ? "visible" : "hidden"}`;
|
|
164
|
+
o.apply(new c(n));
|
|
158
165
|
}
|
|
159
166
|
_onProductNameChange(t) {
|
|
160
|
-
var
|
|
161
|
-
const
|
|
162
|
-
|
|
167
|
+
var s;
|
|
168
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
|
|
169
|
+
if (!e)
|
|
170
|
+
return;
|
|
171
|
+
this.visibilityState[i.PRODUCT_NAME] = t;
|
|
172
|
+
const o = this.api.getDocumentModifier();
|
|
173
|
+
o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_NAME, t, o);
|
|
174
|
+
const n = `Product name visibility changed to ${t ? "visible" : "hidden"}`;
|
|
175
|
+
o.apply(new c(n));
|
|
163
176
|
}
|
|
164
177
|
_onProductQuantityChange(t) {
|
|
165
|
-
var
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
var s;
|
|
179
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
|
|
180
|
+
if (!e)
|
|
181
|
+
return;
|
|
182
|
+
this.visibilityState[i.PRODUCT_QUANTITY] = t;
|
|
183
|
+
const o = this.api.getDocumentModifier();
|
|
184
|
+
o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t, o);
|
|
185
|
+
const n = `Product quantity visibility changed to ${t ? "visible" : "hidden"}`;
|
|
186
|
+
o.apply(new c(n));
|
|
170
187
|
}
|
|
171
188
|
_onProductPriceChange(t) {
|
|
172
189
|
var s;
|
|
173
|
-
const
|
|
174
|
-
`[esd-extension-block-id="${
|
|
190
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
|
|
191
|
+
`[esd-extension-block-id="${r.PRICE}"]`
|
|
175
192
|
);
|
|
176
|
-
if (!
|
|
193
|
+
if (!e)
|
|
177
194
|
return;
|
|
178
195
|
this.visibilityState[i.PRODUCT_PRICE] = t;
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}),
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
const o = this.api.getDocumentModifier();
|
|
197
|
+
e.forEach((l) => {
|
|
198
|
+
o.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
|
|
199
|
+
}), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t, o), this._updatePriceCellWidthsForVerticalLayout(o);
|
|
200
|
+
const n = `Product price visibility changed to ${t ? "visible" : "hidden"}`;
|
|
201
|
+
o.apply(new c(n));
|
|
185
202
|
}
|
|
186
203
|
_onProductOriginalPriceChange(t) {
|
|
187
204
|
var s;
|
|
188
|
-
const
|
|
189
|
-
`[esd-extension-block-id="${
|
|
205
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
|
|
206
|
+
`[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`
|
|
190
207
|
);
|
|
191
|
-
if (!
|
|
208
|
+
if (!e)
|
|
192
209
|
return;
|
|
193
210
|
this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t;
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
|
|
211
|
+
const o = this.api.getDocumentModifier();
|
|
212
|
+
e.forEach((l) => {
|
|
213
|
+
o.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
|
|
214
|
+
}), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t, o), this._updatePriceCellWidthsForVerticalLayout(o);
|
|
215
|
+
const n = `Product original price visibility changed to ${t ? "visible" : "hidden"}`;
|
|
216
|
+
o.apply(new c(n));
|
|
200
217
|
}
|
|
201
218
|
/**
|
|
202
219
|
* Updates both price cell widths in vertical layout based on priceOrientation and visibility.
|
|
@@ -206,33 +223,39 @@ class S extends U {
|
|
|
206
223
|
* - When price is hidden, original price cell expands to 100%
|
|
207
224
|
* - When both are visible, they share 50% each
|
|
208
225
|
*/
|
|
209
|
-
_updatePriceCellWidthsForVerticalLayout() {
|
|
210
|
-
var
|
|
211
|
-
const
|
|
212
|
-
if (!((
|
|
226
|
+
_updatePriceCellWidthsForVerticalLayout(t) {
|
|
227
|
+
var O, y;
|
|
228
|
+
const e = R(this.currentNode);
|
|
229
|
+
if (!((e == null ? void 0 : e.orientation) === h.ORIENTATION.VERTICAL))
|
|
213
230
|
return;
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
const n = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-price-class"), s = (y = this.currentNode) == null ? void 0 : y.querySelectorAll(".product-original-price-class"), l = (e == null ? void 0 : e.priceOrientation) === "vertical", P = this.visibilityState[i.PRODUCT_PRICE], C = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = t ?? this.api.getDocumentModifier();
|
|
232
|
+
if (n && n.length > 0) {
|
|
233
|
+
const _ = l || !C ? "100%" : "50%";
|
|
234
|
+
n.forEach((u) => {
|
|
235
|
+
T.modifyHtml(u).setStyle("width", _);
|
|
219
236
|
});
|
|
220
237
|
}
|
|
221
238
|
if (s && s.length > 0) {
|
|
222
|
-
const
|
|
223
|
-
s.forEach((
|
|
224
|
-
|
|
239
|
+
const _ = l || !P ? "100%" : "50%";
|
|
240
|
+
s.forEach((u) => {
|
|
241
|
+
T.modifyHtml(u).setStyle("width", _);
|
|
225
242
|
});
|
|
226
243
|
}
|
|
227
|
-
|
|
244
|
+
t || T.apply(new c("Updated price cell widths for vertical layout"));
|
|
228
245
|
}
|
|
229
246
|
_onProductButtonChange(t) {
|
|
230
|
-
var
|
|
231
|
-
const
|
|
232
|
-
|
|
247
|
+
var s;
|
|
248
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
|
|
249
|
+
if (!e)
|
|
250
|
+
return;
|
|
251
|
+
this.visibilityState[i.PRODUCT_BUTTON] = t;
|
|
252
|
+
const o = this.api.getDocumentModifier();
|
|
253
|
+
o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t, o);
|
|
254
|
+
const n = `Product button visibility changed to ${t ? "visible" : "hidden"}`;
|
|
255
|
+
o.apply(new c(n));
|
|
233
256
|
}
|
|
234
257
|
}
|
|
235
258
|
export {
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
g as COMPOSITION_CONTROL_BLOCK_ID,
|
|
260
|
+
M as ItemsBlockCardCompositionControl
|
|
238
261
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModificationDescription as N, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CommonControl as U } from "../../common-control.js";
|
|
3
3
|
import { ItemsBlockId as I } from "../enums/controlEnums.js";
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { SETTINGS_ENUMS as d, ItemTypeOptions as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getDefaultTemplate as
|
|
9
|
-
import { getItemsBlockConfig as
|
|
10
|
-
const
|
|
4
|
+
import { productPairs as y, templateFirstLine as b } from "../enums/productEnums.js";
|
|
5
|
+
import { SETTINGS_ENUMS as d, ItemTypeOptions as D, OrientationOptions as k, ItemInCartOptions as g, DefaultConfigValues as x } from "../enums/settingsEnums.js";
|
|
6
|
+
import F from "../layouts/horizontal.html.js";
|
|
7
|
+
import $ from "../layouts/vertical.html.js";
|
|
8
|
+
import { getDefaultTemplate as q } from "../template.js";
|
|
9
|
+
import { getItemsBlockConfig as _, setItemsBlockConfig as O, escapeReplacement as A } from "../utils/nodeConfigUtils.js";
|
|
10
|
+
const w = "ui-elements-items-block", m = {
|
|
11
11
|
ITEMS_TYPE: "itemsType",
|
|
12
12
|
ORIENTATION: "orientation",
|
|
13
13
|
ITEM_IDS: "itemIds"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class Z extends U {
|
|
16
16
|
getId() {
|
|
17
|
-
return
|
|
17
|
+
return w;
|
|
18
18
|
}
|
|
19
19
|
getTemplate() {
|
|
20
20
|
return `
|
|
@@ -26,20 +26,20 @@ class X extends U {
|
|
|
26
26
|
`;
|
|
27
27
|
}
|
|
28
28
|
onRender() {
|
|
29
|
-
const e =
|
|
29
|
+
const e = _(this.currentNode);
|
|
30
30
|
this.api.updateValues({
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
31
|
+
[m.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL,
|
|
32
|
+
[m.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS,
|
|
33
|
+
[m.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
|
|
34
34
|
}), this._listenToFormUpdates();
|
|
35
35
|
}
|
|
36
36
|
onTemplateNodeUpdated(e) {
|
|
37
37
|
super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
|
|
38
|
-
const
|
|
38
|
+
const r = _(this.currentNode);
|
|
39
39
|
this.api.updateValues({
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
40
|
+
[m.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? d.ORIENTATION.VERTICAL,
|
|
41
|
+
[m.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? d.ITEMS_TYPE.CART_ITEMS,
|
|
42
|
+
[m.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
|
|
43
43
|
}), this._initializeSelectItems();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -48,10 +48,10 @@ class X extends U {
|
|
|
48
48
|
${this._GuOneColumn([
|
|
49
49
|
this._GuLabel({ text: "Item Type" }),
|
|
50
50
|
this._GuSelect({
|
|
51
|
-
name:
|
|
51
|
+
name: m.ITEMS_TYPE,
|
|
52
52
|
className: "es-100",
|
|
53
53
|
placeholder: "Select Item Type",
|
|
54
|
-
options:
|
|
54
|
+
options: D
|
|
55
55
|
})
|
|
56
56
|
])}
|
|
57
57
|
`;
|
|
@@ -61,8 +61,8 @@ class X extends U {
|
|
|
61
61
|
${this._GuTwoColumns([
|
|
62
62
|
this._GuLabel({ text: "Orientation" }),
|
|
63
63
|
this._GuRadioButton({
|
|
64
|
-
name:
|
|
65
|
-
buttons:
|
|
64
|
+
name: m.ORIENTATION,
|
|
65
|
+
buttons: k
|
|
66
66
|
})
|
|
67
67
|
])}
|
|
68
68
|
`;
|
|
@@ -72,7 +72,7 @@ class X extends U {
|
|
|
72
72
|
${this._GuTwoColumns([
|
|
73
73
|
this._GuLabel({ text: "Item in Cart" }),
|
|
74
74
|
this._GuSelect({
|
|
75
|
-
name:
|
|
75
|
+
name: m.ITEM_IDS,
|
|
76
76
|
className: "es-100",
|
|
77
77
|
placeholder: "Select Item In Cart",
|
|
78
78
|
options: []
|
|
@@ -81,213 +81,219 @@ class X extends U {
|
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
_onOrientationChange(e) {
|
|
84
|
-
this.api.updateValues({ [
|
|
84
|
+
this.api.updateValues({ [m.ORIENTATION]: e });
|
|
85
|
+
const r = this.api.getDocumentModifier();
|
|
86
|
+
O(this.currentNode, this.api, {
|
|
85
87
|
orientation: e,
|
|
86
88
|
priceOrientation: "horizontal"
|
|
87
|
-
}), this._reOrderTemplate(), setTimeout(() => {
|
|
89
|
+
}, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
|
|
88
90
|
this._recalculateTrimming();
|
|
89
91
|
}, 50);
|
|
90
92
|
}
|
|
91
93
|
_onItemsTypeChange(e) {
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
+
const r = d.ITEMS_TYPE[e], t = g[e], i = t == null ? void 0 : t[0];
|
|
95
|
+
if (!r || !i)
|
|
94
96
|
return;
|
|
95
|
-
const n = i.value,
|
|
97
|
+
const n = i.value, s = i.value.replace("Url}}", "Image}}"), o = this.api.getDocumentModifier();
|
|
96
98
|
O(this.currentNode, this.api, {
|
|
97
|
-
source:
|
|
98
|
-
type:
|
|
99
|
+
source: r,
|
|
100
|
+
type: r,
|
|
99
101
|
itemsSelectValue: i.value,
|
|
100
|
-
imageLink:
|
|
102
|
+
imageLink: s,
|
|
101
103
|
buttonLink: n
|
|
102
|
-
}), this._updateDataTypeAttributes(
|
|
104
|
+
}, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
|
|
105
|
+
const l = this._getTemplateData(r, i.value);
|
|
106
|
+
this._updateImageSrc(l.imageSrc, o), this._updateName(l.name, o), this._updatePrice(l.price, o), this._updateOriginalPrice(l.originalPrice, o), this._updateQuantity(l.quantity, r, o), o.apply(new N("Updated items type"));
|
|
103
107
|
}
|
|
104
108
|
_onItemIdsChange(e) {
|
|
105
|
-
this.api.updateValues({ [
|
|
106
|
-
const
|
|
109
|
+
this.api.updateValues({ [m.ITEM_IDS]: e });
|
|
110
|
+
const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
|
|
107
111
|
O(this.currentNode, this.api, {
|
|
108
112
|
itemsSelectValue: e,
|
|
109
|
-
imageLink:
|
|
110
|
-
buttonLink:
|
|
111
|
-
}), this._updateDataNumberAttributes(e
|
|
113
|
+
imageLink: t,
|
|
114
|
+
buttonLink: r
|
|
115
|
+
}, i), this._updateDataNumberAttributes(e, i);
|
|
116
|
+
const n = this._getTemplateData(void 0, e);
|
|
117
|
+
this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new N("Updated item selection"));
|
|
112
118
|
}
|
|
113
119
|
_initializeSelectItems() {
|
|
114
120
|
this.api.setUIEAttribute(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
m.ITEMS_TYPE,
|
|
122
|
+
L.SELECTPICKER.items,
|
|
123
|
+
D
|
|
118
124
|
);
|
|
119
|
-
const e =
|
|
125
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
|
|
120
126
|
this.api.updateValues({
|
|
121
|
-
[
|
|
127
|
+
[m.ITEMS_TYPE]: r
|
|
122
128
|
});
|
|
123
|
-
const i =
|
|
129
|
+
const i = g[r];
|
|
124
130
|
this.api.setUIEAttribute(
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
m.ITEM_IDS,
|
|
132
|
+
L.SELECTPICKER.items,
|
|
127
133
|
i
|
|
128
134
|
), this.api.updateValues({
|
|
129
|
-
[
|
|
135
|
+
[m.ITEM_IDS]: t
|
|
130
136
|
});
|
|
131
137
|
}
|
|
132
138
|
_listenToFormUpdates() {
|
|
133
139
|
this.api.onValueChanged(
|
|
134
|
-
|
|
140
|
+
m.ITEMS_TYPE,
|
|
135
141
|
(e) => this._onItemsTypeChange(e)
|
|
136
142
|
), this.api.onValueChanged(
|
|
137
|
-
|
|
143
|
+
m.ORIENTATION,
|
|
138
144
|
(e) => this._onOrientationChange(e)
|
|
139
145
|
), this.api.onValueChanged(
|
|
140
|
-
|
|
146
|
+
m.ITEM_IDS,
|
|
141
147
|
(e) => this._onItemIdsChange(e)
|
|
142
148
|
);
|
|
143
149
|
}
|
|
144
150
|
_renderTemplate() {
|
|
145
|
-
const e =
|
|
146
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
147
|
-
orientation:
|
|
148
|
-
itemsType:
|
|
151
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
|
|
152
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
|
|
153
|
+
orientation: r,
|
|
154
|
+
itemsType: t,
|
|
149
155
|
itemId: i,
|
|
150
156
|
currencySymbol: n,
|
|
151
|
-
currencyLocation:
|
|
152
|
-
formattedPrice:
|
|
153
|
-
})).apply(new
|
|
157
|
+
currencyLocation: s,
|
|
158
|
+
formattedPrice: o
|
|
159
|
+
})).apply(new N("Updated template"));
|
|
154
160
|
}
|
|
155
|
-
_getTemplateData(e) {
|
|
156
|
-
const t =
|
|
161
|
+
_getTemplateData(e, r) {
|
|
162
|
+
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = g[i].findIndex((h) => h.value === n), a = l > -1 ? l : 0, c = y.PAIRS_FOR_EXTENSION.price[i], T = y.PAIRS_FOR_EXTENSION.originalPrice[i];
|
|
157
163
|
let u, p;
|
|
158
|
-
return o ? (u =
|
|
159
|
-
imageSrc:
|
|
160
|
-
name:
|
|
164
|
+
return o ? (u = s ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
|
|
165
|
+
imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
|
|
166
|
+
name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
|
|
161
167
|
price: u,
|
|
162
168
|
originalPrice: p,
|
|
163
|
-
quantity:
|
|
164
|
-
button:
|
|
169
|
+
quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
|
|
170
|
+
button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
|
|
165
171
|
};
|
|
166
172
|
}
|
|
167
|
-
_updateImageSrc(e) {
|
|
168
|
-
var
|
|
169
|
-
const t = (
|
|
170
|
-
t &&
|
|
173
|
+
_updateImageSrc(e, r) {
|
|
174
|
+
var i;
|
|
175
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${I.IMAGE}"] img`);
|
|
176
|
+
t && r.modifyHtml(t).setAttribute("src", e);
|
|
171
177
|
}
|
|
172
|
-
_updateName(e) {
|
|
173
|
-
var
|
|
174
|
-
const t = (
|
|
178
|
+
_updateName(e, r) {
|
|
179
|
+
var s;
|
|
180
|
+
const t = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
175
181
|
if (!t)
|
|
176
182
|
return;
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
|
|
183
|
+
const i = t.getInnerText().trim();
|
|
184
|
+
let n = t.getInnerHTML().trim();
|
|
185
|
+
n = n.replace(i, A(e)), r.modifyHtml(t).setInnerHtml(n);
|
|
180
186
|
}
|
|
181
|
-
_updatePrice(e) {
|
|
187
|
+
_updatePrice(e, r) {
|
|
182
188
|
var o;
|
|
183
189
|
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
184
190
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
185
|
-
)) || [],
|
|
186
|
-
t.forEach((
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
191
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
192
|
+
t.forEach((l) => {
|
|
193
|
+
const a = this._getParagraphFromBlock(l);
|
|
194
|
+
if (!a)
|
|
189
195
|
return;
|
|
190
|
-
const
|
|
191
|
-
|
|
196
|
+
const c = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), S = c.replace(T, A(E));
|
|
197
|
+
r.modifyHtml(a).setInnerHtml(S);
|
|
192
198
|
});
|
|
193
199
|
}
|
|
194
|
-
_updateOriginalPrice(e) {
|
|
200
|
+
_updateOriginalPrice(e, r) {
|
|
195
201
|
var o;
|
|
196
202
|
const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
|
|
197
203
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
198
|
-
)) || [],
|
|
199
|
-
t.forEach((
|
|
200
|
-
const
|
|
201
|
-
if (!
|
|
204
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
205
|
+
t.forEach((l) => {
|
|
206
|
+
const a = this._getParagraphFromBlock(l);
|
|
207
|
+
if (!a)
|
|
202
208
|
return;
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
209
|
+
const c = a.querySelector("s");
|
|
210
|
+
if (!c)
|
|
205
211
|
return;
|
|
206
|
-
const
|
|
207
|
-
|
|
212
|
+
const T = c.getInnerHTML().trim() || "", u = c.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, A(S))}</s>`;
|
|
213
|
+
r.modifyHtml(a).setInnerHtml(R);
|
|
208
214
|
});
|
|
209
215
|
}
|
|
210
|
-
_updateQuantity(e, t) {
|
|
211
|
-
var
|
|
212
|
-
const
|
|
213
|
-
if (!
|
|
216
|
+
_updateQuantity(e, r, t) {
|
|
217
|
+
var h;
|
|
218
|
+
const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && o, a = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
|
|
219
|
+
if (!a)
|
|
214
220
|
return;
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
221
|
+
const c = this._getParagraphFromBlock(a);
|
|
222
|
+
if (!c)
|
|
217
223
|
return;
|
|
218
|
-
const
|
|
219
|
-
let u =
|
|
220
|
-
function p(
|
|
221
|
-
return
|
|
222
|
-
new RegExp(`(>\\s*)?${
|
|
223
|
-
`$1${
|
|
224
|
+
const T = c.getInnerText().trim();
|
|
225
|
+
let u = c.getInnerHTML().trim();
|
|
226
|
+
function p(E, S, C) {
|
|
227
|
+
return E.replace(
|
|
228
|
+
new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
|
|
229
|
+
`$1${C}$2`
|
|
224
230
|
);
|
|
225
231
|
}
|
|
226
|
-
u = p(u,
|
|
227
|
-
const T = this.api.getDocumentModifier();
|
|
228
|
-
T.modifyHtml(s).setInnerHtml(u), T.modifyHtml(c).setStyle("display", a ? "table-cell" : "none"), T.apply(new h("Updated quantity"));
|
|
232
|
+
u = p(u, T, e), t.modifyHtml(c).setInnerHtml(u), t.modifyHtml(a).setStyle("display", l ? "table-cell" : "none");
|
|
229
233
|
}
|
|
230
|
-
_reOrderTemplate() {
|
|
231
|
-
var
|
|
232
|
-
const
|
|
234
|
+
_reOrderTemplate(e) {
|
|
235
|
+
var h, E, S, C, R, M;
|
|
236
|
+
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
|
|
233
237
|
`[esd-extension-block-id="${I.PRICE}"]`
|
|
234
|
-
)) || [],
|
|
238
|
+
)) || [], n = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
|
|
235
239
|
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
236
|
-
)) || [], [
|
|
237
|
-
if (!
|
|
240
|
+
)) || [], [s] = i, [o] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), a = (M = this.currentNode) == null ? void 0 : M.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
|
|
241
|
+
if (!r || !t || !s || !o || !l || !a)
|
|
238
242
|
return;
|
|
239
|
-
const
|
|
240
|
-
let p = u ?
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ?
|
|
243
|
+
const c = _(this.currentNode), u = ((c == null ? void 0 : c.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
|
|
244
|
+
let p = u ? $ : F;
|
|
245
|
+
setTimeout(() => {
|
|
246
|
+
const H = A(s.getOuterHTML()), f = A(o.getOuterHTML());
|
|
247
|
+
p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? b : "").replace("{-{-PRODUCT_IMAGE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", H).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", f).replace("{-{-PRODUCT_QUANTITY-}-}", l.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", a.getOuterHTML()), p = p.trim().replace(b, "").slice(0, -5);
|
|
248
|
+
const P = e ?? this.api.getDocumentModifier();
|
|
249
|
+
P.modifyHtml(r.querySelector("img")).setAttribute("width", x.productImageWidth).setAttribute("height", x.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new N("Reordered template"));
|
|
244
250
|
}, 50);
|
|
245
251
|
}
|
|
246
|
-
_updateDataTypeAttributes(e) {
|
|
252
|
+
_updateDataTypeAttributes(e, r) {
|
|
247
253
|
if (!this.currentNode)
|
|
248
254
|
return;
|
|
249
|
-
const t = this.currentNode.closest(".ins-product-td")
|
|
255
|
+
const t = this.currentNode.closest(".ins-product-td");
|
|
250
256
|
t && r.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
251
|
-
const
|
|
252
|
-
r.modifyHtml(
|
|
253
|
-
})
|
|
257
|
+
const s = n;
|
|
258
|
+
r.modifyHtml(s).setAttribute("data-type", e);
|
|
259
|
+
});
|
|
254
260
|
}
|
|
255
|
-
_updateDataNumberAttributes(e) {
|
|
261
|
+
_updateDataNumberAttributes(e, r) {
|
|
256
262
|
if (!this.currentNode)
|
|
257
263
|
return;
|
|
258
|
-
const t =
|
|
259
|
-
let
|
|
260
|
-
if (
|
|
261
|
-
|
|
264
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = g[i].findIndex((a) => a.value === e);
|
|
265
|
+
let s = "1";
|
|
266
|
+
if (n >= 0)
|
|
267
|
+
s = String(n + 1);
|
|
262
268
|
else if (e) {
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
const [,
|
|
266
|
-
|
|
269
|
+
const a = e.match(/\((\d+)\)/);
|
|
270
|
+
if (a) {
|
|
271
|
+
const [, c] = a;
|
|
272
|
+
s = c;
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
|
-
const o = this.currentNode.closest(".ins-product-td")
|
|
270
|
-
o &&
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
})
|
|
275
|
+
const o = this.currentNode.closest(".ins-product-td");
|
|
276
|
+
o && r.modifyHtml(o).setAttribute("data-number", s), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
|
|
277
|
+
const c = a;
|
|
278
|
+
r.modifyHtml(c).setAttribute("data-number", s);
|
|
279
|
+
});
|
|
274
280
|
}
|
|
275
281
|
_reFillTemplate(e) {
|
|
276
|
-
const
|
|
277
|
-
this._updateImageSrc(
|
|
282
|
+
const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
|
|
283
|
+
this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new N("Refilled template"));
|
|
278
284
|
}
|
|
279
285
|
_recalculateTrimming() {
|
|
280
|
-
var
|
|
286
|
+
var s;
|
|
281
287
|
if (!this.currentNode)
|
|
282
288
|
return;
|
|
283
|
-
const e = (
|
|
289
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
284
290
|
if (!e)
|
|
285
291
|
return;
|
|
286
|
-
const
|
|
287
|
-
if (!
|
|
292
|
+
const r = e.querySelector("p > a");
|
|
293
|
+
if (!r)
|
|
288
294
|
return;
|
|
289
|
-
const
|
|
290
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
295
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.orientation) === d.ORIENTATION.HORIZONTAL, n = (t == null ? void 0 : t.nameTrimming) ?? !0;
|
|
296
|
+
this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", n ? "nowrap" : "normal").setStyle("text-overflow", n ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new N("Recalculated trimming after orientation change"));
|
|
291
297
|
}
|
|
292
298
|
_getParagraphFromBlock(e) {
|
|
293
299
|
return e.querySelector("p");
|
|
@@ -295,30 +301,30 @@ class X extends U {
|
|
|
295
301
|
_escapeRegex(e) {
|
|
296
302
|
return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
|
|
297
303
|
}
|
|
298
|
-
_removeCurrencySymbol(e,
|
|
299
|
-
const
|
|
300
|
-
let i =
|
|
301
|
-
if (
|
|
302
|
-
const n = new RegExp(`\\s*${this._escapeRegex(
|
|
303
|
-
i =
|
|
304
|
+
_removeCurrencySymbol(e, r) {
|
|
305
|
+
const t = e || "";
|
|
306
|
+
let i = t;
|
|
307
|
+
if (r) {
|
|
308
|
+
const n = new RegExp(`\\s*${this._escapeRegex(r)}\\s*`);
|
|
309
|
+
i = t.replace(n, "").trim();
|
|
304
310
|
} else {
|
|
305
|
-
const n =
|
|
311
|
+
const n = t.match(/([^0-9.,\s]+)/);
|
|
306
312
|
if (n && n[1]) {
|
|
307
|
-
const
|
|
308
|
-
i =
|
|
313
|
+
const s = n[1].trim(), o = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
314
|
+
i = t.replace(o, "").trim();
|
|
309
315
|
}
|
|
310
316
|
}
|
|
311
317
|
return i;
|
|
312
318
|
}
|
|
313
|
-
_replacePriceNumber(e,
|
|
314
|
-
const
|
|
315
|
-
return e.replace(
|
|
319
|
+
_replacePriceNumber(e, r) {
|
|
320
|
+
const t = /([0-9][0-9,.]*)/;
|
|
321
|
+
return e.replace(t, r).trim();
|
|
316
322
|
}
|
|
317
|
-
_buildPriceContent(e,
|
|
318
|
-
return
|
|
323
|
+
_buildPriceContent(e, r, t) {
|
|
324
|
+
return r ? t === "1" ? `${e} ${r}` : `${r} ${e}` : e;
|
|
319
325
|
}
|
|
320
326
|
}
|
|
321
327
|
export {
|
|
322
|
-
|
|
323
|
-
|
|
328
|
+
w as CONTROL_BLOCK_ID,
|
|
329
|
+
Z as ItemsBlockControl
|
|
324
330
|
};
|
|
@@ -3,20 +3,19 @@ import { ItemsBlock as i } from "./block.js";
|
|
|
3
3
|
import { ButtonLinkControl as C } from "./controls/button/link.js";
|
|
4
4
|
import { ItemsBlockCardCompositionControl as e } from "./controls/cardComposition.js";
|
|
5
5
|
import { ImageLinkControl as m } from "./controls/image/link.js";
|
|
6
|
-
import { NameControls as
|
|
6
|
+
import { NameControls as r, QuantityControls as n, OriginalPriceControls as t, PriceControls as d, ImageControls as l, ButtonControls as o } from "./controls/index.js";
|
|
7
7
|
import { NameTrimmingControl as s } from "./controls/name/trimming.js";
|
|
8
8
|
import { PriceCurrencyLocationControl as c } from "./controls/price/currencyLocation.js";
|
|
9
|
-
import { PriceCurrencySymbolControl as
|
|
10
|
-
import { PriceFormattedPriceControl as
|
|
9
|
+
import { PriceCurrencySymbolControl as g } from "./controls/price/currencySymbol.js";
|
|
10
|
+
import { PriceFormattedPriceControl as f } from "./controls/price/formattedPrice.js";
|
|
11
11
|
import { PriceHideDiscountControl as p } from "./controls/price/hideDiscount.js";
|
|
12
12
|
import { PriceOrientationControl as y } from "./controls/price/priceOrientation.js";
|
|
13
13
|
import { PriceSinglePriceControl as u } from "./controls/price/singlePrice.js";
|
|
14
14
|
import { ItemsBlockControl as P } from "./controls/settingsControl.js";
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import b from "./
|
|
18
|
-
|
|
19
|
-
const M = new a().addBlock(i).withSettingsPanelRegistry(B).addControl(P).addControl(e).addControl(t.align).addControl(t.color).addControl(t.size).addControl(t.style).addControl(t.fontFamily).addControl(t.background).addControl(t.paddings).addControl(s).addControl(n.align).addControl(n.color).addControl(n.fontFamily).addControl(n.paddings).addControl(n.size).addControl(n.style).addControl(r.align).addControl(r.color).addControl(r.size).addControl(r.style).addControl(r.fontFamily).addControl(r.background).addControl(r.paddings).addControl(d.align).addControl(d.color).addControl(d.size).addControl(d.style).addControl(d.fontFamily).addControl(d.background).addControl(d.paddings).addControl(p).addControl(g).addControl(u).addControl(f).addControl(c).addControl(y).addControl(m).addControl(l.size).addControl(l.margins).addControl(C).addControl(o.align).addControl(o.border).addControl(o.borderRadius).addControl(o.color).addControl(o.fontFamily).addControl(o.margins).addControl(o.paddings).addControl(o.text).addControl(o.textSize).addControl(o.textStyleAndFontColor).addControl(o.fitToContent).addStyles(b).withPreviewStyles(`[esd-extension-block-id="${k.IMAGE}"] img {object-fit: contain;}`).withIconsRegistry(I).build();
|
|
15
|
+
import { ItemsIconsRegistry as k } from "./iconsRegistry.js";
|
|
16
|
+
import I from "./items.css.js";
|
|
17
|
+
import { SettingsPanel as b } from "./settingsPanel.js";
|
|
18
|
+
const j = new a().addBlock(i).withSettingsPanelRegistry(b).addControl(P).addControl(e).addControl(r.align).addControl(r.color).addControl(r.size).addControl(r.style).addControl(r.fontFamily).addControl(r.background).addControl(r.paddings).addControl(s).addControl(n.align).addControl(n.color).addControl(n.fontFamily).addControl(n.paddings).addControl(n.size).addControl(n.style).addControl(t.align).addControl(t.color).addControl(t.size).addControl(t.style).addControl(t.fontFamily).addControl(t.background).addControl(t.paddings).addControl(d.align).addControl(d.color).addControl(d.size).addControl(d.style).addControl(d.fontFamily).addControl(d.background).addControl(d.paddings).addControl(p).addControl(f).addControl(u).addControl(g).addControl(c).addControl(y).addControl(m).addControl(l.size).addControl(l.margins).addControl(C).addControl(o.align).addControl(o.border).addControl(o.borderRadius).addControl(o.color).addControl(o.fontFamily).addControl(o.margins).addControl(o.paddings).addControl(o.text).addControl(o.textSize).addControl(o.textStyleAndFontColor).addControl(o.fitToContent).addStyles(I).withIconsRegistry(k).build();
|
|
20
19
|
export {
|
|
21
|
-
|
|
20
|
+
j as default
|
|
22
21
|
};
|
|
@@ -2,8 +2,8 @@ import { BlockType as b, BlockAttr as N } from "../../../node_modules/@stripoinc
|
|
|
2
2
|
import { ItemsBlockId as O } from "./enums/controlEnums.js";
|
|
3
3
|
import { productPairs as A, templateFirstLine as C } from "./enums/productEnums.js";
|
|
4
4
|
import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as D } from "./enums/settingsEnums.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import j from "./layouts/horizontal.html.js";
|
|
6
|
+
import q from "./layouts/vertical.html.js";
|
|
7
7
|
import { escapeReplacement as V } from "./utils/nodeConfigUtils.js";
|
|
8
8
|
let [g] = A.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [L] = A.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [m] = A.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [S] = A.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [M] = A.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
|
|
9
9
|
const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), F = (s) => U(s, "text-align"), w = (s, e) => {
|
|
@@ -27,6 +27,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
27
27
|
target="_blank"
|
|
28
28
|
href="#!">
|
|
29
29
|
<img class="adapt-img document-node-component ng-star-inserted"
|
|
30
|
+
style="object-fit: contain;"
|
|
30
31
|
src="${g}"
|
|
31
32
|
alt="${L}"
|
|
32
33
|
width="${i}"
|
|
@@ -402,7 +403,7 @@ function Tt({
|
|
|
402
403
|
d ? (m = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, S = o ? I.DEFAULT_SINGLE_PRICE_FORMATTED : I.DEFAULT_SINGLE_PRICE) : (m = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, S = o ? I.DEFAULT_PRICE_FORMATTED : I.DEFAULT_PRICE), M = A.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
|
|
403
404
|
const h = P || (l == null ? void 0 : l.priceOrientation) || "horizontal";
|
|
404
405
|
return s === x.ORIENTATION.VERTICAL ? z(
|
|
405
|
-
|
|
406
|
+
q,
|
|
406
407
|
e,
|
|
407
408
|
R,
|
|
408
409
|
s,
|
|
@@ -422,7 +423,7 @@ function Tt({
|
|
|
422
423
|
u,
|
|
423
424
|
d
|
|
424
425
|
) : z(
|
|
425
|
-
|
|
426
|
+
j,
|
|
426
427
|
e,
|
|
427
428
|
R,
|
|
428
429
|
s,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { DefaultConfigValues as o, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
|
|
3
|
-
function
|
|
3
|
+
function _() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
6
|
const E = (r) => r.replace(/\$/g, "$$$$");
|
|
7
7
|
function S() {
|
|
8
8
|
return {
|
|
9
9
|
initialized: !0,
|
|
10
|
-
blockInstanceId:
|
|
10
|
+
blockInstanceId: _(),
|
|
11
11
|
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
12
|
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
13
13
|
itemsSelectValue: o.cartItemsSelectControlValue,
|
|
@@ -33,7 +33,7 @@ function S() {
|
|
|
33
33
|
buttonVisible: o.productButtonVisible === "1"
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function p(r) {
|
|
37
37
|
if (!r)
|
|
38
38
|
return null;
|
|
39
39
|
const t = r.closest(".items-block-v2");
|
|
@@ -66,16 +66,16 @@ function C(r) {
|
|
|
66
66
|
const t = r.querySelector("esd-config-block");
|
|
67
67
|
if (!t)
|
|
68
68
|
return null;
|
|
69
|
-
const e = (c,
|
|
69
|
+
const e = (c, s) => c == null ? s : c === "1" || c === "true", i = (c, s) => c || s, u = t.getAttribute("data-type"), a = m(u), d = t.getAttribute("data-cart_items_select_control_value"), l = I(d, a);
|
|
70
70
|
return {
|
|
71
71
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
72
|
blockInstanceId: i(
|
|
73
73
|
t.getAttribute("data-block-instance-id"),
|
|
74
|
-
|
|
74
|
+
_()
|
|
75
75
|
),
|
|
76
|
-
source:
|
|
77
|
-
type:
|
|
78
|
-
itemsSelectValue:
|
|
76
|
+
source: a,
|
|
77
|
+
type: a,
|
|
78
|
+
itemsSelectValue: l,
|
|
79
79
|
orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
|
|
80
80
|
nameTrimming: e(
|
|
81
81
|
t.getAttribute("data-product_name_control_trim"),
|
|
@@ -150,7 +150,7 @@ function C(r) {
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
function y(r) {
|
|
153
|
-
const t =
|
|
153
|
+
const t = p(r);
|
|
154
154
|
if (!t)
|
|
155
155
|
return null;
|
|
156
156
|
const e = t.getNodeConfig();
|
|
@@ -159,18 +159,18 @@ function y(r) {
|
|
|
159
159
|
const i = C(t);
|
|
160
160
|
return i || null;
|
|
161
161
|
}
|
|
162
|
-
function A(r, t, e) {
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
162
|
+
function A(r, t, e, i) {
|
|
163
|
+
const u = p(r);
|
|
164
|
+
if (!u)
|
|
165
165
|
return;
|
|
166
|
-
const
|
|
167
|
-
|
|
166
|
+
const d = { ...u.getNodeConfig() || {}, ...e }, l = i ?? t.getDocumentModifier();
|
|
167
|
+
l.modifyHtml(u).setNodeConfig(d), i || l.apply(new b("Update Items block configuration"));
|
|
168
168
|
}
|
|
169
169
|
export {
|
|
170
170
|
E as escapeReplacement,
|
|
171
|
-
|
|
171
|
+
_ as generateBlockInstanceId,
|
|
172
172
|
S as getDefaultItemsBlockConfig,
|
|
173
173
|
y as getItemsBlockConfig,
|
|
174
|
-
|
|
174
|
+
p as getItemsBlockContainer,
|
|
175
175
|
A as setItemsBlockConfig
|
|
176
176
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -18,10 +18,11 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
|
|
|
18
18
|
* If itemsType is not BROWSED_ITEMS, show quantity
|
|
19
19
|
* If itemsType is BROWSED_ITEMS, hide quantity
|
|
20
20
|
* and mark it as '0'
|
|
21
|
+
* @param syncOnly - If true, only sync local state and UI without modifying the document
|
|
21
22
|
*/
|
|
22
|
-
_handleBrowsedItemsQuantity(): void;
|
|
23
|
-
_applyVisibilityStyles(): void;
|
|
24
|
-
_updateVisibilityAttribute(elementName: string, isVisible: boolean): void;
|
|
23
|
+
_handleBrowsedItemsQuantity(syncOnly?: boolean): void;
|
|
24
|
+
_applyVisibilityStyles(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
25
|
+
_updateVisibilityAttribute(elementName: string, isVisible: boolean, modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
25
26
|
_listenToFormUpdates(): void;
|
|
26
27
|
_onProductImageChange(value: boolean): void;
|
|
27
28
|
_onProductNameChange(value: boolean): void;
|
|
@@ -36,6 +37,6 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
|
|
|
36
37
|
* - When price is hidden, original price cell expands to 100%
|
|
37
38
|
* - When both are visible, they share 50% each
|
|
38
39
|
*/
|
|
39
|
-
_updatePriceCellWidthsForVerticalLayout(): void;
|
|
40
|
+
_updatePriceCellWidthsForVerticalLayout(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
40
41
|
_onProductButtonChange(value: boolean): void;
|
|
41
42
|
}
|
|
@@ -16,7 +16,7 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
16
16
|
_initializeSelectItems(): void;
|
|
17
17
|
_listenToFormUpdates(): void;
|
|
18
18
|
_renderTemplate(): void;
|
|
19
|
-
_getTemplateData(itemsTypeOverride?: ProductType): {
|
|
19
|
+
_getTemplateData(itemsTypeOverride?: ProductType, itemIdOverride?: string): {
|
|
20
20
|
imageSrc: string;
|
|
21
21
|
name: string;
|
|
22
22
|
price: string;
|
|
@@ -24,14 +24,14 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
24
24
|
quantity: string;
|
|
25
25
|
button: string;
|
|
26
26
|
};
|
|
27
|
-
_updateImageSrc(imageSrc: string): void;
|
|
28
|
-
_updateName(name: string): void;
|
|
29
|
-
_updatePrice(price: string): void;
|
|
30
|
-
_updateOriginalPrice(originalPrice: string): void;
|
|
31
|
-
_updateQuantity(quantity: string, itemsTypeOverride
|
|
32
|
-
_reOrderTemplate(): void;
|
|
33
|
-
_updateDataTypeAttributes(itemsType: ProductType): void;
|
|
34
|
-
_updateDataNumberAttributes(itemId: string): void;
|
|
27
|
+
_updateImageSrc(imageSrc: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
28
|
+
_updateName(name: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
29
|
+
_updatePrice(price: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
30
|
+
_updateOriginalPrice(originalPrice: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
31
|
+
_updateQuantity(quantity: string, itemsTypeOverride: ProductType | undefined, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
32
|
+
_reOrderTemplate(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
33
|
+
_updateDataTypeAttributes(itemsType: ProductType, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
34
|
+
_updateDataNumberAttributes(itemId: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
35
35
|
_reFillTemplate(itemsType?: ProductType): void;
|
|
36
36
|
_recalculateTrimming(): void;
|
|
37
37
|
private _getParagraphFromBlock;
|
|
@@ -66,8 +66,9 @@ export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | und
|
|
|
66
66
|
* @param currentNode - The current node from the control
|
|
67
67
|
* @param api - The API object (ControlApi or BlockApi)
|
|
68
68
|
* @param config - The configuration to set (partial update supported)
|
|
69
|
+
* @param modifier - Optional document modifier for batching updates
|
|
69
70
|
*/
|
|
70
|
-
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
|
|
71
|
+
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>, modifier?: ReturnType<typeof api.getDocumentModifier>): void;
|
|
71
72
|
/**
|
|
72
73
|
* Gets the block instance ID from the node config.
|
|
73
74
|
* @param currentNode - The current node from the control
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.1d0cd94",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"guido": {
|
|
87
87
|
"stripo": {
|
|
88
|
-
"version": "2.
|
|
88
|
+
"version": "2.54.0"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|