@useinsider/guido 2.0.0-beta.bf65edd → 2.0.0-beta.c0d8594
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/README.md +2 -0
- package/dist/@types/config/schemas.js +3 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +57 -61
- package/dist/components/organisms/base/Toaster.vue.js +6 -6
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +6 -6
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.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/composables/useStripo.js +40 -40
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
- package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
- package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
- package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
- 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 +46 -49
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +145 -136
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
- package/dist/extensions/Blocks/Items/settingsPanel.js +4 -4
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +312 -125
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +17 -44
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/extensions/Blocks/controlFactories.js +139 -118
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +370 -286
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +6 -10
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
- 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/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +17 -0
- package/package.json +3 -3
|
@@ -1,76 +1,49 @@
|
|
|
1
|
-
import { useItemsBlockStore as
|
|
2
|
-
import { syncAttributeFromConfigBlock as
|
|
3
|
-
function
|
|
4
|
-
const o =
|
|
1
|
+
import { useItemsBlockStore as r } from "../store/items-block.js";
|
|
2
|
+
import { syncAttributeFromConfigBlock as e, createBooleanSyncConfig as s, createStringSyncConfig as i } from "./syncAttributeFromConfigBlock.js";
|
|
3
|
+
function u(t) {
|
|
4
|
+
const o = r(), n = s(
|
|
5
5
|
"PRODUCT_NAME_TRIMMING",
|
|
6
6
|
(c) => o.setNameTrimming(c),
|
|
7
7
|
!1
|
|
8
8
|
);
|
|
9
|
-
|
|
9
|
+
e(t, n);
|
|
10
10
|
}
|
|
11
11
|
function f(t) {
|
|
12
|
-
const o =
|
|
12
|
+
const o = r(), n = s(
|
|
13
13
|
"PRODUCT_PRICE_HIDE_DISCOUNT",
|
|
14
14
|
(c) => o.setHideDiscount(c),
|
|
15
|
-
!
|
|
15
|
+
!0
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
e(t, n);
|
|
18
18
|
}
|
|
19
19
|
function R(t) {
|
|
20
|
-
const o =
|
|
20
|
+
const o = r(), n = s(
|
|
21
21
|
"PRODUCT_PRICE_FORMATTED",
|
|
22
22
|
(c) => o.setFormattedPrice(c),
|
|
23
23
|
!0
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
e(t, n);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const o =
|
|
27
|
+
function y(t) {
|
|
28
|
+
const o = r(), n = i(
|
|
29
29
|
"PRODUCT_PRICE_CURRENCY_SYMBOL",
|
|
30
30
|
(c) => o.setCurrencySymbol(c),
|
|
31
31
|
""
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
e(t, n);
|
|
34
34
|
}
|
|
35
35
|
function _(t) {
|
|
36
|
-
const o =
|
|
36
|
+
const o = r(), n = i(
|
|
37
37
|
"PRODUCT_PRICE_CURRENCY_LOCATION",
|
|
38
38
|
(c) => o.setCurrencyLocation(c),
|
|
39
39
|
"0"
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
function I(t) {
|
|
44
|
-
const o = e(), n = s(
|
|
45
|
-
"PRODUCT_BUTTON_LINK",
|
|
46
|
-
(c) => o.setButtonLink(c),
|
|
47
|
-
""
|
|
48
|
-
);
|
|
49
|
-
r(t, n);
|
|
50
|
-
}
|
|
51
|
-
function T(t) {
|
|
52
|
-
const o = e(), n = s(
|
|
53
|
-
"PRODUCT_IMAGE_LINK",
|
|
54
|
-
(c) => o.setImageLink(c),
|
|
55
|
-
""
|
|
56
|
-
);
|
|
57
|
-
r(t, n);
|
|
58
|
-
}
|
|
59
|
-
function y(t) {
|
|
60
|
-
const o = e(), n = s(
|
|
61
|
-
"PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION",
|
|
62
|
-
(c) => o.setPriceOrientation(c),
|
|
63
|
-
"horizontal"
|
|
64
|
-
);
|
|
65
|
-
r(t, n);
|
|
41
|
+
e(t, n);
|
|
66
42
|
}
|
|
67
43
|
export {
|
|
68
|
-
I as syncButtonLinkFromAttributes,
|
|
69
44
|
_ as syncCurrencyLocationFromAttributes,
|
|
70
|
-
|
|
45
|
+
y as syncCurrencySymbolFromAttributes,
|
|
71
46
|
R as syncFormattedPriceFromAttributes,
|
|
72
47
|
f as syncHideDiscountFromAttributes,
|
|
73
|
-
|
|
74
|
-
m as syncNameTrimmingFromAttributes,
|
|
75
|
-
y as syncPriceOrientationFromAttributes
|
|
48
|
+
u as syncNameTrimmingFromAttributes
|
|
76
49
|
};
|
|
@@ -289,7 +289,7 @@ class b extends g {
|
|
|
289
289
|
t.CURRENCY_DECIMAL_COUNT
|
|
290
290
|
].forEach((i) => {
|
|
291
291
|
this.api.onValueChanged(i, (a) => this._onCurrencyConfigChange(i, a));
|
|
292
|
-
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, i
|
|
292
|
+
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, String(i))), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (o = this.addFilterButton) == null || o.addEventListener("click", this.addFilterListener);
|
|
293
293
|
}
|
|
294
294
|
_listenStateUpdates() {
|
|
295
295
|
this.storeUnsubscription = this.store.$subscribe((e) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
|
-
var I = (
|
|
3
|
-
var l = (
|
|
4
|
-
import { Control as
|
|
5
|
-
class
|
|
2
|
+
var I = (T, r, e) => r in T ? c(T, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[r] = e;
|
|
3
|
+
var l = (T, r, e) => I(T, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { Control as s, UIElementType as t, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
class B extends s {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
l(this, "currentNode");
|
|
@@ -19,43 +19,54 @@ class _ extends O {
|
|
|
19
19
|
this.lastBlockInstanceId = null;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Gets the
|
|
22
|
+
* Gets the Items block container element from the current node.
|
|
23
|
+
* @returns The container element or null if not found
|
|
24
|
+
*/
|
|
25
|
+
getItemsBlockContainer() {
|
|
26
|
+
return this.currentNode ? this.currentNode.closest(".items-block-v2") : null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the config block element from the current node (legacy support).
|
|
30
|
+
* @deprecated Use getNodeConfig() from nodeConfigUtils instead for Stripo V2
|
|
23
31
|
* @returns The config block element or null if not found
|
|
24
32
|
*/
|
|
25
33
|
getConfigBlock() {
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
const e = this.currentNode.closest(".items-block-v2");
|
|
34
|
+
const e = this.getItemsBlockContainer();
|
|
29
35
|
return e ? e.querySelector("esd-config-block") : null;
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
|
-
* Gets the current block instance ID from the config block.
|
|
33
|
-
* @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
|
|
38
|
+
* Gets the current block instance ID from the node config (Stripo V2) or legacy config block.
|
|
34
39
|
* @returns The block instance ID or null if not found
|
|
35
40
|
*/
|
|
36
|
-
getBlockInstanceId(
|
|
37
|
-
const
|
|
38
|
-
|
|
41
|
+
getBlockInstanceId() {
|
|
42
|
+
const e = this.getItemsBlockContainer();
|
|
43
|
+
if (!e)
|
|
44
|
+
return null;
|
|
45
|
+
const n = e.getNodeConfig();
|
|
46
|
+
if (n && typeof n.blockInstanceId == "string")
|
|
47
|
+
return n.blockInstanceId;
|
|
48
|
+
const o = this.getConfigBlock();
|
|
49
|
+
return o ? o.getAttribute("data-block-instance-id") : null;
|
|
39
50
|
}
|
|
40
51
|
/**
|
|
41
52
|
* Handles block instance change detection and syncing.
|
|
42
|
-
* This is a helper method for controls that need to sync
|
|
43
|
-
*
|
|
53
|
+
* This is a helper method for controls that need to sync config when switching between block instances.
|
|
54
|
+
* Uses Stripo V2 nodeConfig API for block instance tracking.
|
|
55
|
+
* @param syncFunction - Function to call when block instance changes (to sync from node config)
|
|
44
56
|
* @param updateUI - Function to call to update the UI (called both on change and when same block)
|
|
45
|
-
* @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
|
|
46
57
|
* @returns true if block instance changed, false otherwise
|
|
47
58
|
*/
|
|
48
|
-
handleBlockInstanceChange(e, n
|
|
49
|
-
const o = this.getBlockInstanceId(
|
|
59
|
+
handleBlockInstanceChange(e, n) {
|
|
60
|
+
const o = this.getBlockInstanceId();
|
|
50
61
|
if (!o)
|
|
51
62
|
return !1;
|
|
52
|
-
const
|
|
53
|
-
return
|
|
63
|
+
const E = o !== this.lastBlockInstanceId;
|
|
64
|
+
return E ? (this.currentNode && e(this.currentNode), n(), this.lastBlockInstanceId = o) : n(), E;
|
|
54
65
|
}
|
|
55
|
-
_GuLabel({ text: e, name: n = "", position:
|
|
66
|
+
_GuLabel({ text: e, name: n = "", position: o = "top" }) {
|
|
56
67
|
return `
|
|
57
68
|
<${t.LABEL}
|
|
58
|
-
style="${
|
|
69
|
+
style="${o === "top" ? "margin-bottom: 8px;" : ""}"
|
|
59
70
|
${$.LABEL.text}="${e}"
|
|
60
71
|
${$.LABEL.name}="${n || `${e} Label`}">
|
|
61
72
|
</${t.LABEL}>
|
|
@@ -75,59 +86,59 @@ class _ extends O {
|
|
|
75
86
|
${$.SELECT_ITEM.value}="${n}">
|
|
76
87
|
</${t.SELECT_ITEM}>`;
|
|
77
88
|
}
|
|
78
|
-
_GuSelect({ name: e, placeholder: n, options:
|
|
89
|
+
_GuSelect({ name: e, placeholder: n, options: o, className: E = "es-180w" }) {
|
|
79
90
|
return `
|
|
80
91
|
<${t.SELECTPICKER}
|
|
81
|
-
class="${
|
|
92
|
+
class="${E}"
|
|
82
93
|
${$.SELECTPICKER.name}="${e}"
|
|
83
94
|
${$.SELECTPICKER.placeholder}="${n}">
|
|
84
|
-
${
|
|
95
|
+
${o.map((a) => this._GuSelectItem(a)).join("")}
|
|
85
96
|
</${t.SELECTPICKER}>
|
|
86
97
|
`;
|
|
87
98
|
}
|
|
88
|
-
_GuTextInput({ name: e, placeholder: n, className:
|
|
99
|
+
_GuTextInput({ name: e, placeholder: n, className: o = "", disabled: E = !1 }) {
|
|
89
100
|
return `
|
|
90
101
|
<${t.TEXT}
|
|
91
|
-
class=${
|
|
102
|
+
class=${o}
|
|
92
103
|
${$.TEXT.name}="${e}"
|
|
93
104
|
placeholder="${n || e}"
|
|
94
|
-
${
|
|
105
|
+
${E ? `${$.TEXT.disabled}="true"` : ""}>
|
|
95
106
|
</${t.TEXT}>
|
|
96
107
|
`;
|
|
97
108
|
}
|
|
98
|
-
_GuCounter({ name: e, maxValue: n, minValue:
|
|
109
|
+
_GuCounter({ name: e, maxValue: n, minValue: o = 1, step: E = 1 }) {
|
|
99
110
|
return `
|
|
100
111
|
<${t.COUNTER}
|
|
101
112
|
${$.COUNTER.name}="${e}"
|
|
102
|
-
${$.COUNTER.minValue}="${
|
|
113
|
+
${$.COUNTER.minValue}="${o}"
|
|
103
114
|
${$.COUNTER.maxValue}="${n}"
|
|
104
|
-
${$.COUNTER.step}="${
|
|
115
|
+
${$.COUNTER.step}="${E}">
|
|
105
116
|
</${t.COUNTER}>
|
|
106
117
|
`;
|
|
107
118
|
}
|
|
108
|
-
_GuRadioButtonItem({ text: e, value: n, icon:
|
|
119
|
+
_GuRadioButtonItem({ text: e, value: n, icon: o }) {
|
|
109
120
|
return `
|
|
110
121
|
<${t.RADIO_ITEM}
|
|
111
122
|
${$.RADIO_ITEM.value}="${n}"
|
|
112
123
|
${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
|
|
113
|
-
${
|
|
124
|
+
${o ? `${$.RADIO_ITEM.icon}="${o}"` : ""}>
|
|
114
125
|
</${t.RADIO_ITEM}>
|
|
115
126
|
`;
|
|
116
127
|
}
|
|
117
|
-
_GuRadioButton({ name: e, buttons: n, id:
|
|
128
|
+
_GuRadioButton({ name: e, buttons: n, id: o = "" }) {
|
|
118
129
|
return `
|
|
119
130
|
<${t.RADIO_BUTTONS}
|
|
120
|
-
${
|
|
131
|
+
${o ? `id="${o}"` : ""}
|
|
121
132
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
122
|
-
${n.map((
|
|
133
|
+
${n.map((E) => this._GuRadioButtonItem(E)).join("")}
|
|
123
134
|
</${t.RADIO_BUTTONS}>
|
|
124
135
|
`;
|
|
125
136
|
}
|
|
126
|
-
_GuButton({ name: e, label: n, id:
|
|
137
|
+
_GuButton({ name: e, label: n, id: o = "" }) {
|
|
127
138
|
return `
|
|
128
139
|
<${t.BUTTON}
|
|
129
140
|
${$.BUTTON.name}="${e}"
|
|
130
|
-
${
|
|
141
|
+
${o ? `id="${o}"` : ""}
|
|
131
142
|
${$.BUTTON.caption}="${n}"}>
|
|
132
143
|
</${t.BUTTON}>
|
|
133
144
|
`;
|
|
@@ -137,10 +148,10 @@ class _ extends O {
|
|
|
137
148
|
* @param param0
|
|
138
149
|
* @returns It returns a button with an icon.
|
|
139
150
|
*/
|
|
140
|
-
_GuIconButton({ name: e, icon: n, className:
|
|
151
|
+
_GuIconButton({ name: e, icon: n, className: o = "" }) {
|
|
141
152
|
return `
|
|
142
153
|
<${t.BUTTON}
|
|
143
|
-
class="${
|
|
154
|
+
class="${o}"
|
|
144
155
|
${$.BUTTON.name}="${e}"
|
|
145
156
|
${$.BUTTON.icon}="${n}">
|
|
146
157
|
</${t.BUTTON}>
|
|
@@ -168,19 +179,19 @@ class _ extends O {
|
|
|
168
179
|
* @returns HTML string for the orderable control
|
|
169
180
|
*/
|
|
170
181
|
_GuOrderable(e, n) {
|
|
171
|
-
let
|
|
172
|
-
n.forEach((
|
|
182
|
+
let o = "";
|
|
183
|
+
n.forEach((a) => {
|
|
173
184
|
const u = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
174
|
-
|
|
175
|
-
<${t.ORDERABLE_ITEM} ${u}="${
|
|
176
|
-
${
|
|
185
|
+
o += `
|
|
186
|
+
<${t.ORDERABLE_ITEM} ${u}="${a.key}">
|
|
187
|
+
${a.content}
|
|
177
188
|
</${t.ORDERABLE_ITEM}>
|
|
178
189
|
`;
|
|
179
190
|
});
|
|
180
|
-
const
|
|
191
|
+
const E = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
|
|
181
192
|
return `
|
|
182
|
-
<${t.ORDERABLE} ${
|
|
183
|
-
${
|
|
193
|
+
<${t.ORDERABLE} ${E}="${e}">
|
|
194
|
+
${o}
|
|
184
195
|
</${t.ORDERABLE}>
|
|
185
196
|
`;
|
|
186
197
|
}
|
|
@@ -221,16 +232,16 @@ class _ extends O {
|
|
|
221
232
|
`;
|
|
222
233
|
}
|
|
223
234
|
_GuRadioButtons(e, n) {
|
|
224
|
-
const
|
|
235
|
+
const o = n.map((E) => `
|
|
225
236
|
<${t.RADIO_ITEM}
|
|
226
|
-
${$.RADIO_ITEM.text}="${
|
|
227
|
-
${$.RADIO_ITEM.value}="${
|
|
237
|
+
${$.RADIO_ITEM.text}="${E.text}"
|
|
238
|
+
${$.RADIO_ITEM.value}="${E.value}">
|
|
228
239
|
</${t.RADIO_ITEM}>
|
|
229
240
|
`).join("");
|
|
230
241
|
return `
|
|
231
242
|
<${t.RADIO_BUTTONS}
|
|
232
243
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
233
|
-
${
|
|
244
|
+
${o}
|
|
234
245
|
</${t.RADIO_BUTTONS}>
|
|
235
246
|
`;
|
|
236
247
|
}
|
|
@@ -244,5 +255,5 @@ class _ extends O {
|
|
|
244
255
|
}
|
|
245
256
|
}
|
|
246
257
|
export {
|
|
247
|
-
|
|
258
|
+
B as CommonControl
|
|
248
259
|
};
|