@useinsider/guido 2.0.0 → 2.1.0-beta.3c29284
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 +57 -39
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- package/dist/components/organisms/email-preview/PreviewContainer.vue.js +3 -3
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +6 -6
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +17 -13
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +6 -6
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +14 -12
- package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.js +18 -0
- package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue2.js +15 -0
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -15
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +14 -22
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +12 -11
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +12 -10
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +11 -10
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
- package/dist/components/organisms/header/EditorActions.vue.js +21 -0
- package/dist/components/organisms/header/EditorActions.vue2.js +41 -0
- package/dist/components/organisms/header/EditorToolbar.vue.js +18 -0
- package/dist/components/organisms/header/EditorToolbar.vue2.js +17 -0
- package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -5
- package/dist/components/organisms/header/LeftSlot.vue.js +9 -9
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -13
- package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
- package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -15
- package/dist/components/organisms/header/RightSlot.vue.js +11 -14
- package/dist/components/organisms/header/RightSlot.vue2.js +13 -30
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +5 -5
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +15 -15
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +20 -19
- package/dist/composables/useActionsApi.js +33 -30
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/composables/useStripo.js +57 -56
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +334 -0
- package/dist/enums/academy.js +8 -0
- package/dist/enums/onboarding.js +1 -2
- package/dist/enums/unsubscribe.js +20 -21
- 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 +36 -40
- package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +66 -46
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +146 -131
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -5
- package/dist/extensions/Blocks/Items/extension.js +11 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
- package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
- package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
- package/dist/extensions/Blocks/Items/template.js +389 -141
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +176 -0
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +30 -32
- 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/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +34 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +4 -0
- package/dist/src/components/organisms/header/EditorToolbar.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -0
- package/dist/src/composables/useConfig.d.ts +10 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/enums/academy.d.ts +12 -0
- package/dist/src/enums/onboarding.d.ts +0 -1
- package/dist/src/enums/unsubscribe.d.ts +0 -1
- 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/cardComposition.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -2
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +76 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +10 -11
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +181 -1
- package/dist/src/stores/editor.d.ts +21 -0
- package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
- package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
- package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/static/styles/components/wide-panel.css.js +1 -1
- package/dist/stores/config.js +7 -0
- package/dist/stores/editor.js +1 -0
- package/dist/utils/pairProductVariables.js +61 -58
- package/dist/utils/templatePreparation.js +17 -17
- package/package.json +3 -3
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
- package/dist/static/assets/inbox-mockup.svg.js +0 -4
- package/dist/static/assets/phone-mockup.svg.js +0 -4
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { DefaultConfigValues as i, 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
|
+
const E = (o) => o.replace(/\$/g, "$$$$");
|
|
7
|
+
function S() {
|
|
8
|
+
return {
|
|
9
|
+
initialized: !0,
|
|
10
|
+
blockInstanceId: d(),
|
|
11
|
+
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
|
+
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
13
|
+
itemsSelectValue: i.cartItemsSelectControlValue,
|
|
14
|
+
orientation: n.ORIENTATION.VERTICAL,
|
|
15
|
+
nameTrimming: i.productNameTrimmingControlValue === "1",
|
|
16
|
+
priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
|
|
17
|
+
priceFormatted: i.productPriceFormattedControlValue === "1",
|
|
18
|
+
priceSinglePrice: !1,
|
|
19
|
+
priceCurrencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
20
|
+
priceCurrencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
21
|
+
priceOrientation: "horizontal",
|
|
22
|
+
quantityControlEnabled: i.productQuantityControlEnabled === "1",
|
|
23
|
+
buttonLink: i.productButtonLinkControlValue,
|
|
24
|
+
imageLink: i.productImageLinkControlValue,
|
|
25
|
+
buttonLabel: "Buy",
|
|
26
|
+
buttonFullWidth: !0,
|
|
27
|
+
// Default to full width (es-fw class)
|
|
28
|
+
imageVisible: i.productImageVisible === "1",
|
|
29
|
+
nameVisible: i.productNameVisible === "1",
|
|
30
|
+
quantityVisible: i.productQuantityVisible === "1",
|
|
31
|
+
priceVisible: i.productPriceVisible === "1",
|
|
32
|
+
originalPriceVisible: i.productOriginalPriceVisible === "1",
|
|
33
|
+
buttonVisible: i.productButtonVisible === "1"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function s(o) {
|
|
37
|
+
if (!o)
|
|
38
|
+
return null;
|
|
39
|
+
const t = o.closest(".items-block-v2");
|
|
40
|
+
return t || o.closest(".esd-cart-items-block");
|
|
41
|
+
}
|
|
42
|
+
function m(o) {
|
|
43
|
+
return o ? {
|
|
44
|
+
CartItems: n.ITEMS_TYPE.CART_ITEMS,
|
|
45
|
+
BrowsedItems: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
46
|
+
PurchasedItems: n.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
47
|
+
// Also handle already correct formats
|
|
48
|
+
CART_ITEMS: n.ITEMS_TYPE.CART_ITEMS,
|
|
49
|
+
BROWSED_ITEMS: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
50
|
+
PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
|
|
51
|
+
}[o] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
|
|
52
|
+
}
|
|
53
|
+
function I(o, t) {
|
|
54
|
+
if (!o)
|
|
55
|
+
return i.cartItemsSelectControlValue;
|
|
56
|
+
if (o.includes("{{"))
|
|
57
|
+
return o;
|
|
58
|
+
if (/^\d+$/.test(o)) {
|
|
59
|
+
const e = parseInt(o) - 1, r = g[t];
|
|
60
|
+
if (r && r[e])
|
|
61
|
+
return r[e].value;
|
|
62
|
+
}
|
|
63
|
+
return i.cartItemsSelectControlValue;
|
|
64
|
+
}
|
|
65
|
+
function C(o) {
|
|
66
|
+
const t = o.querySelector("esd-config-block");
|
|
67
|
+
if (!t)
|
|
68
|
+
return null;
|
|
69
|
+
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);
|
|
70
|
+
return {
|
|
71
|
+
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
|
+
blockInstanceId: r(
|
|
73
|
+
t.getAttribute("data-block-instance-id"),
|
|
74
|
+
d()
|
|
75
|
+
),
|
|
76
|
+
source: u,
|
|
77
|
+
type: u,
|
|
78
|
+
itemsSelectValue: p,
|
|
79
|
+
orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
|
|
80
|
+
nameTrimming: e(
|
|
81
|
+
t.getAttribute("data-product_name_control_trim"),
|
|
82
|
+
!0
|
|
83
|
+
),
|
|
84
|
+
priceHideDiscount: e(
|
|
85
|
+
t.getAttribute("data-product_price_control_nodup"),
|
|
86
|
+
!0
|
|
87
|
+
),
|
|
88
|
+
priceFormatted: e(
|
|
89
|
+
t.getAttribute("data-product_price_control_formated"),
|
|
90
|
+
!0
|
|
91
|
+
),
|
|
92
|
+
priceSinglePrice: e(
|
|
93
|
+
t.getAttribute("data-product_price_control_single_price"),
|
|
94
|
+
!1
|
|
95
|
+
),
|
|
96
|
+
priceCurrencySymbol: r(
|
|
97
|
+
t.getAttribute("data-product_price_currency_symbol"),
|
|
98
|
+
i.productPriceCurrencySymbolControlValue
|
|
99
|
+
),
|
|
100
|
+
priceCurrencyLocation: r(
|
|
101
|
+
t.getAttribute("data-product_price_currency_location"),
|
|
102
|
+
i.productPriceCurrencyLocationControlValue
|
|
103
|
+
),
|
|
104
|
+
priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
|
|
105
|
+
quantityControlEnabled: e(
|
|
106
|
+
t.getAttribute("data-product_quantity_control_enabled"),
|
|
107
|
+
!0
|
|
108
|
+
),
|
|
109
|
+
buttonLink: r(
|
|
110
|
+
t.getAttribute("data-product_button_link"),
|
|
111
|
+
i.productButtonLinkControlValue
|
|
112
|
+
),
|
|
113
|
+
imageLink: r(
|
|
114
|
+
t.getAttribute("data-product_image_link"),
|
|
115
|
+
i.productImageLinkControlValue
|
|
116
|
+
),
|
|
117
|
+
buttonLabel: r(
|
|
118
|
+
t.getAttribute("data-product_button_control_label"),
|
|
119
|
+
"Buy"
|
|
120
|
+
),
|
|
121
|
+
buttonFullWidth: e(
|
|
122
|
+
t.getAttribute("data-product_button_control_atw"),
|
|
123
|
+
!0
|
|
124
|
+
// Default to full width
|
|
125
|
+
),
|
|
126
|
+
imageVisible: e(
|
|
127
|
+
t.getAttribute("data-product_image_control_enabled"),
|
|
128
|
+
!0
|
|
129
|
+
),
|
|
130
|
+
nameVisible: e(
|
|
131
|
+
t.getAttribute("data-product_name_control_enabled"),
|
|
132
|
+
!0
|
|
133
|
+
),
|
|
134
|
+
quantityVisible: e(
|
|
135
|
+
t.getAttribute("data-product_quantity_control_enabled"),
|
|
136
|
+
!0
|
|
137
|
+
),
|
|
138
|
+
priceVisible: e(
|
|
139
|
+
t.getAttribute("data-product_price_control_enabled"),
|
|
140
|
+
!0
|
|
141
|
+
),
|
|
142
|
+
originalPriceVisible: e(
|
|
143
|
+
t.getAttribute("data-product_original_price_control_enabled"),
|
|
144
|
+
!0
|
|
145
|
+
),
|
|
146
|
+
buttonVisible: e(
|
|
147
|
+
t.getAttribute("data-product_button_control_enabled"),
|
|
148
|
+
!0
|
|
149
|
+
)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function y(o) {
|
|
153
|
+
const t = s(o);
|
|
154
|
+
if (!t)
|
|
155
|
+
return null;
|
|
156
|
+
const e = t.getNodeConfig();
|
|
157
|
+
if (e && e.initialized)
|
|
158
|
+
return e;
|
|
159
|
+
const r = C(t);
|
|
160
|
+
return r || null;
|
|
161
|
+
}
|
|
162
|
+
function A(o, t, e) {
|
|
163
|
+
const r = s(o);
|
|
164
|
+
if (!r)
|
|
165
|
+
return;
|
|
166
|
+
const u = { ...r.getNodeConfig() || {}, ...e };
|
|
167
|
+
t.getDocumentModifier().modifyHtml(r).setNodeConfig(u).apply(new b("Update Items block configuration"));
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
E as escapeReplacement,
|
|
171
|
+
d as generateBlockInstanceId,
|
|
172
|
+
S as getDefaultItemsBlockConfig,
|
|
173
|
+
y as getItemsBlockConfig,
|
|
174
|
+
s as getItemsBlockContainer,
|
|
175
|
+
A as setItemsBlockConfig
|
|
176
|
+
};
|
|
@@ -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,21 +1,21 @@
|
|
|
1
1
|
import { ExtensionBuilder as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { UnsubscribeBlock as i } from "./block.js";
|
|
3
3
|
import { UnsubscribeControl as t } from "./control.js";
|
|
4
|
-
import { PreviewUIElement as
|
|
5
|
-
import { UnsubscribeIconsRegistry as
|
|
6
|
-
import { SettingsPanel as
|
|
4
|
+
import { PreviewUIElement as s } from "./elements/preview.js";
|
|
5
|
+
import { UnsubscribeIconsRegistry as o } from "./iconsRegistry.js";
|
|
6
|
+
import { SettingsPanel as r } from "./settingsPanel.js";
|
|
7
7
|
import n from "./styles.css.js";
|
|
8
|
-
import { UnsubscribeTagRegistry as
|
|
9
|
-
const
|
|
8
|
+
import { UnsubscribeTagRegistry as c } from "./tagRegistry.js";
|
|
9
|
+
const g = new e().addBlock(i).withSettingsPanelRegistry(r).addControl(t).addUiElement(s).addStyles(n).withLocalization({
|
|
10
10
|
en: {
|
|
11
|
-
"Unsubscribe Block": "Unsubscribe
|
|
12
|
-
"Unsubscribe Block Description": "
|
|
11
|
+
"Unsubscribe Block": "Unsubscribe",
|
|
12
|
+
"Unsubscribe Block Description": "Unsubscribe lets you add an Unsubscribe Link to direct users to opt out of receiving your messages.",
|
|
13
13
|
"Select Template": "Select Template",
|
|
14
14
|
"Unsubscribe Template": "Unsubscribe Template",
|
|
15
15
|
Showing: "Showing",
|
|
16
16
|
of: "of"
|
|
17
17
|
}
|
|
18
|
-
}).withUiElementTagRegistry(
|
|
18
|
+
}).withUiElementTagRegistry(c).withIconsRegistry(o).build();
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
g as default
|
|
21
21
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var c = (T, r, e) => r in T ? I(T, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[r] = e;
|
|
3
|
+
var u = (T, r, e) => c(T, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import { Control as O, UIElementType as t, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
class _ extends O {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
u(this, "currentNode");
|
|
9
|
+
u(this, "lastBlockInstanceId", null);
|
|
10
10
|
}
|
|
11
11
|
getContainer() {
|
|
12
12
|
var e;
|
|
@@ -19,43 +19,41 @@ class _ extends O {
|
|
|
19
19
|
this.lastBlockInstanceId = null;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Gets the
|
|
23
|
-
* @returns The
|
|
22
|
+
* Gets the Items block container element from the current node.
|
|
23
|
+
* @returns The container element or null if not found
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
const e = this.currentNode.closest(".items-block-v2");
|
|
29
|
-
return e ? e.querySelector("esd-config-block") : null;
|
|
25
|
+
getItemsBlockContainer() {
|
|
26
|
+
return this.currentNode ? this.currentNode.closest(".items-block-v2") : null;
|
|
30
27
|
}
|
|
31
28
|
/**
|
|
32
|
-
* Gets the current block instance ID from the config
|
|
33
|
-
* @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
|
|
29
|
+
* Gets the current block instance ID from the node config (Stripo V2).
|
|
34
30
|
* @returns The block instance ID or null if not found
|
|
35
31
|
*/
|
|
36
|
-
getBlockInstanceId(
|
|
37
|
-
const
|
|
38
|
-
|
|
32
|
+
getBlockInstanceId() {
|
|
33
|
+
const e = this.getItemsBlockContainer();
|
|
34
|
+
if (!e)
|
|
35
|
+
return null;
|
|
36
|
+
const n = e.getNodeConfig();
|
|
37
|
+
return n && typeof n.blockInstanceId == "string" ? n.blockInstanceId : null;
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* Handles block instance change detection and syncing.
|
|
42
|
-
* This is a helper method for controls that need to sync
|
|
43
|
-
*
|
|
41
|
+
* This is a helper method for controls that need to sync config when switching between block instances.
|
|
42
|
+
* Uses Stripo V2 nodeConfig API for block instance tracking.
|
|
43
|
+
* @param syncFunction - Function to call when block instance changes (to sync from node config)
|
|
44
44
|
* @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
45
|
* @returns true if block instance changed, false otherwise
|
|
47
46
|
*/
|
|
48
|
-
handleBlockInstanceChange(e, n
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
47
|
+
handleBlockInstanceChange(e, n) {
|
|
48
|
+
const E = this.getBlockInstanceId();
|
|
49
|
+
if (!E)
|
|
51
50
|
return !1;
|
|
52
|
-
const
|
|
53
|
-
return
|
|
51
|
+
const o = E !== this.lastBlockInstanceId;
|
|
52
|
+
return o ? (this.currentNode && e(this.currentNode), n(), this.lastBlockInstanceId = E) : n(), o;
|
|
54
53
|
}
|
|
55
|
-
_GuLabel({ text: e, name: n = ""
|
|
54
|
+
_GuLabel({ text: e, name: n = "" }) {
|
|
56
55
|
return `
|
|
57
56
|
<${t.LABEL}
|
|
58
|
-
style="${E === "top" ? "margin-bottom: 8px;" : ""}"
|
|
59
57
|
${$.LABEL.text}="${e}"
|
|
60
58
|
${$.LABEL.name}="${n || `${e} Label`}">
|
|
61
59
|
</${t.LABEL}>
|
|
@@ -81,7 +79,7 @@ class _ extends O {
|
|
|
81
79
|
class="${o}"
|
|
82
80
|
${$.SELECTPICKER.name}="${e}"
|
|
83
81
|
${$.SELECTPICKER.placeholder}="${n}">
|
|
84
|
-
${E.map((
|
|
82
|
+
${E.map((a) => this._GuSelectItem(a)).join("")}
|
|
85
83
|
</${t.SELECTPICKER}>
|
|
86
84
|
`;
|
|
87
85
|
}
|
|
@@ -169,11 +167,11 @@ class _ extends O {
|
|
|
169
167
|
*/
|
|
170
168
|
_GuOrderable(e, n) {
|
|
171
169
|
let E = "";
|
|
172
|
-
n.forEach((
|
|
173
|
-
const
|
|
170
|
+
n.forEach((a) => {
|
|
171
|
+
const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
174
172
|
E += `
|
|
175
|
-
<${t.ORDERABLE_ITEM} ${
|
|
176
|
-
${
|
|
173
|
+
<${t.ORDERABLE_ITEM} ${l}="${a.key}">
|
|
174
|
+
${a.content}
|
|
177
175
|
</${t.ORDERABLE_ITEM}>
|
|
178
176
|
`;
|
|
179
177
|
});
|