@useinsider/guido 2.0.0-beta.e68b206 → 2.0.0-beta.ecd6540
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/migrator/itemsBlockMigrator.js +64 -72
- package/dist/extensions/Blocks/Items/block.js +20 -23
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +29 -35
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +9 -8
- package/dist/extensions/Blocks/Items/template.js +219 -209
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +51 -61
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { DefaultConfigValues as
|
|
2
|
+
import { DefaultConfigValues as i, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
|
|
3
3
|
function d() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function E() {
|
|
7
7
|
return {
|
|
8
8
|
initialized: !0,
|
|
9
9
|
blockInstanceId: d(),
|
|
10
10
|
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
11
11
|
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
|
-
itemsSelectValue:
|
|
12
|
+
itemsSelectValue: i.cartItemsSelectControlValue,
|
|
13
13
|
orientation: n.ORIENTATION.VERTICAL,
|
|
14
|
-
nameTrimming:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
priceFormatted: r.productPriceFormattedControlValue === "1",
|
|
14
|
+
nameTrimming: i.productNameTrimmingControlValue === "1",
|
|
15
|
+
priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
|
|
16
|
+
priceFormatted: i.productPriceFormattedControlValue === "1",
|
|
18
17
|
priceSinglePrice: !1,
|
|
19
|
-
priceCurrencySymbol:
|
|
20
|
-
priceCurrencyLocation:
|
|
21
|
-
priceControlOpened: r.productPriceControlOpened === "1",
|
|
18
|
+
priceCurrencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
19
|
+
priceCurrencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
22
20
|
priceOrientation: "horizontal",
|
|
23
|
-
quantityControlEnabled:
|
|
24
|
-
buttonLink:
|
|
25
|
-
imageLink:
|
|
21
|
+
quantityControlEnabled: i.productQuantityControlEnabled === "1",
|
|
22
|
+
buttonLink: i.productButtonLinkControlValue,
|
|
23
|
+
imageLink: i.productImageLinkControlValue,
|
|
26
24
|
buttonLabel: "Buy",
|
|
27
25
|
buttonFullWidth: !0,
|
|
28
26
|
// Default to full width (es-fw class)
|
|
29
|
-
imageVisible:
|
|
30
|
-
nameVisible:
|
|
31
|
-
quantityVisible:
|
|
32
|
-
priceVisible:
|
|
33
|
-
originalPriceVisible:
|
|
34
|
-
buttonVisible:
|
|
27
|
+
imageVisible: i.productImageVisible === "1",
|
|
28
|
+
nameVisible: i.productNameVisible === "1",
|
|
29
|
+
quantityVisible: i.productQuantityVisible === "1",
|
|
30
|
+
priceVisible: i.productPriceVisible === "1",
|
|
31
|
+
originalPriceVisible: i.productOriginalPriceVisible === "1",
|
|
32
|
+
buttonVisible: i.productButtonVisible === "1"
|
|
35
33
|
};
|
|
36
34
|
}
|
|
37
|
-
function
|
|
35
|
+
function s(o) {
|
|
38
36
|
if (!o)
|
|
39
37
|
return null;
|
|
40
38
|
const t = o.closest(".items-block-v2");
|
|
@@ -51,41 +49,37 @@ function m(o) {
|
|
|
51
49
|
PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
|
|
52
50
|
}[o] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
|
|
53
51
|
}
|
|
54
|
-
function
|
|
52
|
+
function I(o, t) {
|
|
55
53
|
if (!o)
|
|
56
|
-
return
|
|
54
|
+
return i.cartItemsSelectControlValue;
|
|
57
55
|
if (o.includes("{{"))
|
|
58
56
|
return o;
|
|
59
57
|
if (/^\d+$/.test(o)) {
|
|
60
|
-
const e = parseInt(o) - 1,
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
58
|
+
const e = parseInt(o) - 1, r = g[t];
|
|
59
|
+
if (r && r[e])
|
|
60
|
+
return r[e].value;
|
|
63
61
|
}
|
|
64
|
-
return
|
|
62
|
+
return i.cartItemsSelectControlValue;
|
|
65
63
|
}
|
|
66
|
-
function
|
|
64
|
+
function C(o) {
|
|
67
65
|
const t = o.querySelector("esd-config-block");
|
|
68
66
|
if (!t)
|
|
69
67
|
return null;
|
|
70
|
-
const e = (c, a) => c == null ? a : c === "1" || c === "true",
|
|
68
|
+
const e = (c, a) => c == null ? a : c === "1" || c === "true", r = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), _ = t.getAttribute("data-cart_items_select_control_value"), p = I(_, u);
|
|
71
69
|
return {
|
|
72
70
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
73
|
-
blockInstanceId:
|
|
71
|
+
blockInstanceId: r(
|
|
74
72
|
t.getAttribute("data-block-instance-id"),
|
|
75
73
|
d()
|
|
76
74
|
),
|
|
77
75
|
source: u,
|
|
78
76
|
type: u,
|
|
79
|
-
itemsSelectValue:
|
|
77
|
+
itemsSelectValue: p,
|
|
80
78
|
orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
|
|
81
79
|
nameTrimming: e(
|
|
82
80
|
t.getAttribute("data-product_name_control_trim"),
|
|
83
81
|
!0
|
|
84
82
|
),
|
|
85
|
-
nameControlEnabled: e(
|
|
86
|
-
t.getAttribute("data-product_name_control_enabled"),
|
|
87
|
-
!0
|
|
88
|
-
),
|
|
89
83
|
priceHideDiscount: e(
|
|
90
84
|
t.getAttribute("data-product_price_control_nodup"),
|
|
91
85
|
!0
|
|
@@ -98,32 +92,28 @@ function I(o) {
|
|
|
98
92
|
t.getAttribute("data-product_price_control_single_price"),
|
|
99
93
|
!1
|
|
100
94
|
),
|
|
101
|
-
priceCurrencySymbol:
|
|
95
|
+
priceCurrencySymbol: r(
|
|
102
96
|
t.getAttribute("data-product_price_currency_symbol"),
|
|
103
|
-
|
|
97
|
+
i.productPriceCurrencySymbolControlValue
|
|
104
98
|
),
|
|
105
|
-
priceCurrencyLocation:
|
|
99
|
+
priceCurrencyLocation: r(
|
|
106
100
|
t.getAttribute("data-product_price_currency_location"),
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
priceControlOpened: e(
|
|
110
|
-
t.getAttribute("data-product_price_control_opened"),
|
|
111
|
-
!0
|
|
101
|
+
i.productPriceCurrencyLocationControlValue
|
|
112
102
|
),
|
|
113
103
|
priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
|
|
114
104
|
quantityControlEnabled: e(
|
|
115
105
|
t.getAttribute("data-product_quantity_control_enabled"),
|
|
116
106
|
!0
|
|
117
107
|
),
|
|
118
|
-
buttonLink:
|
|
108
|
+
buttonLink: r(
|
|
119
109
|
t.getAttribute("data-product_button_link"),
|
|
120
|
-
|
|
110
|
+
i.productButtonLinkControlValue
|
|
121
111
|
),
|
|
122
|
-
imageLink:
|
|
112
|
+
imageLink: r(
|
|
123
113
|
t.getAttribute("data-product_image_link"),
|
|
124
|
-
|
|
114
|
+
i.productImageLinkControlValue
|
|
125
115
|
),
|
|
126
|
-
buttonLabel:
|
|
116
|
+
buttonLabel: r(
|
|
127
117
|
t.getAttribute("data-product_button_control_label"),
|
|
128
118
|
"Buy"
|
|
129
119
|
),
|
|
@@ -141,11 +131,11 @@ function I(o) {
|
|
|
141
131
|
!0
|
|
142
132
|
),
|
|
143
133
|
quantityVisible: e(
|
|
144
|
-
t.getAttribute("data-
|
|
134
|
+
t.getAttribute("data-product_quantity_control_enabled"),
|
|
145
135
|
!0
|
|
146
136
|
),
|
|
147
137
|
priceVisible: e(
|
|
148
|
-
t.getAttribute("data-
|
|
138
|
+
t.getAttribute("data-product_price_control_enabled"),
|
|
149
139
|
!0
|
|
150
140
|
),
|
|
151
141
|
originalPriceVisible: e(
|
|
@@ -153,32 +143,32 @@ function I(o) {
|
|
|
153
143
|
!0
|
|
154
144
|
),
|
|
155
145
|
buttonVisible: e(
|
|
156
|
-
t.getAttribute("data-
|
|
146
|
+
t.getAttribute("data-product_button_control_enabled"),
|
|
157
147
|
!0
|
|
158
148
|
)
|
|
159
149
|
};
|
|
160
150
|
}
|
|
161
151
|
function S(o) {
|
|
162
|
-
const t =
|
|
152
|
+
const t = s(o);
|
|
163
153
|
if (!t)
|
|
164
154
|
return null;
|
|
165
155
|
const e = t.getNodeConfig();
|
|
166
156
|
if (e && e.initialized)
|
|
167
157
|
return e;
|
|
168
|
-
const
|
|
169
|
-
return
|
|
158
|
+
const r = C(t);
|
|
159
|
+
return r || null;
|
|
170
160
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
161
|
+
function y(o, t, e) {
|
|
162
|
+
const r = s(o);
|
|
163
|
+
if (!r)
|
|
174
164
|
return;
|
|
175
|
-
const u = { ...
|
|
176
|
-
t.getDocumentModifier().modifyHtml(
|
|
165
|
+
const u = { ...r.getNodeConfig() || {}, ...e };
|
|
166
|
+
t.getDocumentModifier().modifyHtml(r).setNodeConfig(u).apply(new b("Update Items block configuration"));
|
|
177
167
|
}
|
|
178
168
|
export {
|
|
179
169
|
d as generateBlockInstanceId,
|
|
180
|
-
|
|
170
|
+
E as getDefaultItemsBlockConfig,
|
|
181
171
|
S as getItemsBlockConfig,
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
s as getItemsBlockContainer,
|
|
173
|
+
y as setItemsBlockConfig
|
|
184
174
|
};
|
|
@@ -29,11 +29,9 @@ export declare const DefaultConfigValues: {
|
|
|
29
29
|
productPriceCurrencyLocationControlValue: string;
|
|
30
30
|
productButtonLinkControlValue: string;
|
|
31
31
|
productImageLinkControlValue: string;
|
|
32
|
-
productNameControlEnabled: string;
|
|
33
32
|
productQuantityControlOpened: string;
|
|
34
33
|
productNameControlTrim: string;
|
|
35
34
|
productQuantityControlEnabled: string;
|
|
36
|
-
productPriceControlOpened: string;
|
|
37
35
|
productImageVisible: string;
|
|
38
36
|
productNameVisible: string;
|
|
39
37
|
productQuantityVisible: string;
|
|
@@ -12,13 +12,11 @@ export interface ItemsBlockConfig {
|
|
|
12
12
|
itemsSelectValue: string;
|
|
13
13
|
orientation: OrientationType;
|
|
14
14
|
nameTrimming: boolean;
|
|
15
|
-
nameControlEnabled: boolean;
|
|
16
15
|
priceHideDiscount: boolean;
|
|
17
16
|
priceFormatted: boolean;
|
|
18
17
|
priceSinglePrice: boolean;
|
|
19
18
|
priceCurrencySymbol: string;
|
|
20
19
|
priceCurrencyLocation: string;
|
|
21
|
-
priceControlOpened: boolean;
|
|
22
20
|
priceOrientation: 'vertical' | 'horizontal';
|
|
23
21
|
quantityControlEnabled: boolean;
|
|
24
22
|
buttonLink: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.ecd6540",
|
|
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",
|