@useinsider/guido 2.0.0-beta.b46bbf6 → 2.0.0-beta.b889d81
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/useStripo.js +37 -35
- package/dist/config/migrator/index.js +8 -9
- 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 +40 -39
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +49 -46
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -28
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +127 -132
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +48 -58
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +58 -48
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +123 -296
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +20 -11
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/common-control.js +53 -64
- package/dist/extensions/Blocks/controlFactories.js +122 -111
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +290 -364
- package/dist/package.json.js +7 -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/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +1 -20
- package/dist/src/extensions/Blocks/common-control.d.ts +8 -13
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/package.json +3 -3
- package/dist/config/migrator/itemsBlockMigrator.js +0 -283
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +0 -172
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +0 -6
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -71
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { ModificationDescription as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { DefaultConfigValues as e, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
|
|
3
|
-
function d() {
|
|
4
|
-
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
|
-
}
|
|
6
|
-
function f() {
|
|
7
|
-
return {
|
|
8
|
-
initialized: !0,
|
|
9
|
-
blockInstanceId: d(),
|
|
10
|
-
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
11
|
-
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
|
-
itemsSelectValue: e.cartItemsSelectControlValue,
|
|
13
|
-
orientation: n.ORIENTATION.VERTICAL,
|
|
14
|
-
nameTrimming: e.productNameTrimmingControlValue === "1",
|
|
15
|
-
nameControlEnabled: e.productNameControlEnabled === "1",
|
|
16
|
-
priceHideDiscount: e.productPriceHideDiscountControlValue === "1",
|
|
17
|
-
priceFormatted: e.productPriceFormattedControlValue === "1",
|
|
18
|
-
priceCurrencySymbol: e.productPriceCurrencySymbolControlValue,
|
|
19
|
-
priceCurrencyLocation: e.productPriceCurrencyLocationControlValue,
|
|
20
|
-
priceControlOpened: e.productPriceControlOpened === "1",
|
|
21
|
-
priceOrientation: "horizontal",
|
|
22
|
-
quantityControlEnabled: e.productQuantityControlEnabled === "1",
|
|
23
|
-
buttonLink: e.productButtonLinkControlValue,
|
|
24
|
-
imageLink: e.productImageLinkControlValue,
|
|
25
|
-
buttonLabel: "Buy",
|
|
26
|
-
imageVisible: e.productImageVisible === "1",
|
|
27
|
-
nameVisible: e.productNameVisible === "1",
|
|
28
|
-
quantityVisible: e.productQuantityVisible === "1",
|
|
29
|
-
priceVisible: e.productPriceVisible === "1",
|
|
30
|
-
originalPriceVisible: e.productOriginalPriceVisible === "1",
|
|
31
|
-
buttonVisible: e.productButtonVisible === "1"
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function s(r) {
|
|
35
|
-
if (!r)
|
|
36
|
-
return null;
|
|
37
|
-
const t = r.closest(".items-block-v2");
|
|
38
|
-
return t || r.closest(".esd-cart-items-block");
|
|
39
|
-
}
|
|
40
|
-
function m(r) {
|
|
41
|
-
return r ? {
|
|
42
|
-
CartItems: n.ITEMS_TYPE.CART_ITEMS,
|
|
43
|
-
BrowsedItems: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
44
|
-
PurchasedItems: n.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
45
|
-
// Also handle already correct formats
|
|
46
|
-
CART_ITEMS: n.ITEMS_TYPE.CART_ITEMS,
|
|
47
|
-
BROWSED_ITEMS: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
48
|
-
PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
|
|
49
|
-
}[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
|
|
50
|
-
}
|
|
51
|
-
function C(r, t) {
|
|
52
|
-
if (!r)
|
|
53
|
-
return e.cartItemsSelectControlValue;
|
|
54
|
-
if (r.includes("{{"))
|
|
55
|
-
return r;
|
|
56
|
-
if (/^\d+$/.test(r)) {
|
|
57
|
-
const i = parseInt(r) - 1, o = g[t];
|
|
58
|
-
if (o && o[i])
|
|
59
|
-
return o[i].value;
|
|
60
|
-
}
|
|
61
|
-
return e.cartItemsSelectControlValue;
|
|
62
|
-
}
|
|
63
|
-
function I(r) {
|
|
64
|
-
const t = r.querySelector("esd-config-block");
|
|
65
|
-
if (!t)
|
|
66
|
-
return null;
|
|
67
|
-
const i = (c, a) => c == null ? a : c === "1" || c === "true", o = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), p = t.getAttribute("data-cart_items_select_control_value"), b = C(p, u);
|
|
68
|
-
return {
|
|
69
|
-
initialized: i(t.getAttribute("data-initialized"), !1),
|
|
70
|
-
blockInstanceId: o(
|
|
71
|
-
t.getAttribute("data-block-instance-id"),
|
|
72
|
-
d()
|
|
73
|
-
),
|
|
74
|
-
source: u,
|
|
75
|
-
type: u,
|
|
76
|
-
itemsSelectValue: b,
|
|
77
|
-
orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
|
|
78
|
-
nameTrimming: i(
|
|
79
|
-
t.getAttribute("data-product_name_trimming"),
|
|
80
|
-
!0
|
|
81
|
-
),
|
|
82
|
-
nameControlEnabled: i(
|
|
83
|
-
t.getAttribute("data-product_name_control_enabled"),
|
|
84
|
-
!0
|
|
85
|
-
),
|
|
86
|
-
priceHideDiscount: i(
|
|
87
|
-
t.getAttribute("data-product_price_hide_discount"),
|
|
88
|
-
!0
|
|
89
|
-
),
|
|
90
|
-
priceFormatted: i(
|
|
91
|
-
t.getAttribute("data-product_price_formatted"),
|
|
92
|
-
!0
|
|
93
|
-
),
|
|
94
|
-
priceCurrencySymbol: o(
|
|
95
|
-
t.getAttribute("data-product_price_currency_symbol"),
|
|
96
|
-
e.productPriceCurrencySymbolControlValue
|
|
97
|
-
),
|
|
98
|
-
priceCurrencyLocation: o(
|
|
99
|
-
t.getAttribute("data-product_price_currency_location"),
|
|
100
|
-
e.productPriceCurrencyLocationControlValue
|
|
101
|
-
),
|
|
102
|
-
priceControlOpened: i(
|
|
103
|
-
t.getAttribute("data-product_price_control_opened"),
|
|
104
|
-
!0
|
|
105
|
-
),
|
|
106
|
-
priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
|
|
107
|
-
quantityControlEnabled: i(
|
|
108
|
-
t.getAttribute("data-product_quantity_control_enabled"),
|
|
109
|
-
!0
|
|
110
|
-
),
|
|
111
|
-
buttonLink: o(
|
|
112
|
-
t.getAttribute("data-product_button_link"),
|
|
113
|
-
e.productButtonLinkControlValue
|
|
114
|
-
),
|
|
115
|
-
imageLink: o(
|
|
116
|
-
t.getAttribute("data-product_image_link"),
|
|
117
|
-
e.productImageLinkControlValue
|
|
118
|
-
),
|
|
119
|
-
buttonLabel: o(
|
|
120
|
-
t.getAttribute("data-product_button_control_label"),
|
|
121
|
-
"Buy"
|
|
122
|
-
),
|
|
123
|
-
imageVisible: i(
|
|
124
|
-
t.getAttribute("data-product_image_visible"),
|
|
125
|
-
!0
|
|
126
|
-
),
|
|
127
|
-
nameVisible: i(
|
|
128
|
-
t.getAttribute("data-product_name_visible"),
|
|
129
|
-
!0
|
|
130
|
-
),
|
|
131
|
-
quantityVisible: i(
|
|
132
|
-
t.getAttribute("data-product_quantity_visible"),
|
|
133
|
-
!0
|
|
134
|
-
),
|
|
135
|
-
priceVisible: i(
|
|
136
|
-
t.getAttribute("data-product_price_visible"),
|
|
137
|
-
!0
|
|
138
|
-
),
|
|
139
|
-
originalPriceVisible: i(
|
|
140
|
-
t.getAttribute("data-product_original_price_control_enabled"),
|
|
141
|
-
!0
|
|
142
|
-
),
|
|
143
|
-
buttonVisible: i(
|
|
144
|
-
t.getAttribute("data-product_button_visible"),
|
|
145
|
-
!0
|
|
146
|
-
)
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
function S(r) {
|
|
150
|
-
const t = s(r);
|
|
151
|
-
if (!t)
|
|
152
|
-
return null;
|
|
153
|
-
const i = t.getNodeConfig();
|
|
154
|
-
if (i && i.initialized)
|
|
155
|
-
return i;
|
|
156
|
-
const o = I(t);
|
|
157
|
-
return o || null;
|
|
158
|
-
}
|
|
159
|
-
function y(r, t, i) {
|
|
160
|
-
const o = s(r);
|
|
161
|
-
if (!o)
|
|
162
|
-
return;
|
|
163
|
-
const u = { ...o.getNodeConfig() || {}, ...i };
|
|
164
|
-
t.getDocumentModifier().modifyHtml(o).setNodeConfig(u).apply(new _("Update Items block configuration"));
|
|
165
|
-
}
|
|
166
|
-
export {
|
|
167
|
-
d as generateBlockInstanceId,
|
|
168
|
-
f as getDefaultItemsBlockConfig,
|
|
169
|
-
S as getItemsBlockConfig,
|
|
170
|
-
s as getItemsBlockContainer,
|
|
171
|
-
y as setItemsBlockConfig
|
|
172
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { OrientationType, ProductType } from '@@/Types/extensions/items';
|
|
2
|
-
import { ImmutableHtmlNode, ImmutableHtmlElementNode, ControlApi, BlockApi } from '@stripoinc/ui-editor-extensions';
|
|
3
|
-
/**
|
|
4
|
-
* Typed configuration object for Items Block.
|
|
5
|
-
* Replaces the deprecated esd-config-block data-* attributes approach.
|
|
6
|
-
* Configuration is stored directly on the block node using Stripo V2's getNodeConfig/setNodeConfig API.
|
|
7
|
-
*/
|
|
8
|
-
export interface ItemsBlockConfig {
|
|
9
|
-
initialized: boolean;
|
|
10
|
-
blockInstanceId: string;
|
|
11
|
-
source: ProductType;
|
|
12
|
-
type: ProductType;
|
|
13
|
-
itemsSelectValue: string;
|
|
14
|
-
orientation: OrientationType;
|
|
15
|
-
nameTrimming: boolean;
|
|
16
|
-
nameControlEnabled: boolean;
|
|
17
|
-
priceHideDiscount: boolean;
|
|
18
|
-
priceFormatted: boolean;
|
|
19
|
-
priceCurrencySymbol: string;
|
|
20
|
-
priceCurrencyLocation: string;
|
|
21
|
-
priceControlOpened: boolean;
|
|
22
|
-
priceOrientation: 'vertical' | 'horizontal';
|
|
23
|
-
quantityControlEnabled: boolean;
|
|
24
|
-
buttonLink: string;
|
|
25
|
-
imageLink: string;
|
|
26
|
-
buttonLabel: string;
|
|
27
|
-
imageVisible: boolean;
|
|
28
|
-
nameVisible: boolean;
|
|
29
|
-
quantityVisible: boolean;
|
|
30
|
-
priceVisible: boolean;
|
|
31
|
-
originalPriceVisible: boolean;
|
|
32
|
-
buttonVisible: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Generates a unique block instance ID.
|
|
36
|
-
*/
|
|
37
|
-
export declare function generateBlockInstanceId(): string;
|
|
38
|
-
/**
|
|
39
|
-
* Returns default ItemsBlockConfig values.
|
|
40
|
-
* These are used when initializing a new block or when migrating from legacy format.
|
|
41
|
-
*/
|
|
42
|
-
export declare function getDefaultItemsBlockConfig(): ItemsBlockConfig;
|
|
43
|
-
/**
|
|
44
|
-
* Gets the Items block container element from the current node.
|
|
45
|
-
* The container is identified by the `.items-block-v2` class (new) or `.esd-cart-items-block` (legacy).
|
|
46
|
-
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
47
|
-
* @returns The container element or null if not found
|
|
48
|
-
*/
|
|
49
|
-
export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
|
|
50
|
-
/**
|
|
51
|
-
* Gets the node configuration from the Items block.
|
|
52
|
-
* Uses Stripo V2's getNodeConfig() API.
|
|
53
|
-
* Falls back to migrating from legacy esd-config-block if nodeConfig is empty.
|
|
54
|
-
* @param currentNode - The current node from the control
|
|
55
|
-
* @returns The ItemsBlockConfig object or null if not found
|
|
56
|
-
*/
|
|
57
|
-
export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined): ItemsBlockConfig | null;
|
|
58
|
-
/**
|
|
59
|
-
* Sets the node configuration on the Items block.
|
|
60
|
-
* Uses Stripo V2's setNodeConfig() API.
|
|
61
|
-
* @param currentNode - The current node from the control
|
|
62
|
-
* @param api - The API object (ControlApi or BlockApi)
|
|
63
|
-
* @param config - The configuration to set (partial update supported)
|
|
64
|
-
*/
|
|
65
|
-
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
|
|
66
|
-
/**
|
|
67
|
-
* Gets the block instance ID from the node config.
|
|
68
|
-
* @param currentNode - The current node from the control
|
|
69
|
-
* @returns The block instance ID or null if not found
|
|
70
|
-
*/
|
|
71
|
-
export declare function getBlockInstanceIdFromConfig(currentNode: ImmutableHtmlNode | undefined): string | null;
|