@useinsider/guido 2.0.0-beta.dd0d492 → 2.0.0-beta.faa7c5d
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 +55 -39
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.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/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/composables/useStripo.js +40 -40
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +342 -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 +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 +152 -143
- 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 -3
- package/dist/extensions/Blocks/Items/extension.js +7 -6
- 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 +366 -129
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +184 -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 +29 -30
- 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 +30 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +8 -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/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 -0
- 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 +73 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +9 -10
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +164 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/stores/config.js +7 -0
- package/dist/utils/pairProductVariables.js +61 -58
- package/package.json +3 -3
- 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
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ItemsBlockId as
|
|
7
|
-
import { productPairs as
|
|
8
|
-
import { ItemTypeOptions as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { useItemsBlockStore as
|
|
12
|
-
import { getDefaultTemplate as
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
const G = "ui-elements-items-block", s = {
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var M = (h, d, e) => d in h ? L(h, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[d] = e;
|
|
3
|
+
var O = (h, d, e) => M(h, typeof d != "symbol" ? d + "" : d, e);
|
|
4
|
+
import { UEAttr as C, ModificationDescription as u } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as D } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as m } from "../enums/controlEnums.js";
|
|
7
|
+
import { productPairs as p, templateFirstLine as b } from "../enums/productEnums.js";
|
|
8
|
+
import { ItemTypeOptions as R, OrientationOptions as x, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as A } from "../enums/settingsEnums.js";
|
|
9
|
+
import H from "../layouts/horizontal.html.js";
|
|
10
|
+
import k from "../layouts/vertical.html.js";
|
|
11
|
+
import { useItemsBlockStore as U } from "../store/items-block.js";
|
|
12
|
+
import { getDefaultTemplate as F } from "../template.js";
|
|
13
|
+
import { getItemsBlockConfig as P, setItemsBlockConfig as f } from "../utils/nodeConfigUtils.js";
|
|
14
|
+
const $ = "ui-elements-items-block", a = {
|
|
16
15
|
ITEMS_TYPE: "itemsType",
|
|
17
16
|
ORIENTATION: "orientation",
|
|
18
17
|
ITEM_IDS: "itemIds"
|
|
19
18
|
};
|
|
20
|
-
class
|
|
19
|
+
class K extends D {
|
|
21
20
|
constructor() {
|
|
22
21
|
super(...arguments);
|
|
23
|
-
|
|
22
|
+
O(this, "store", U());
|
|
24
23
|
}
|
|
25
24
|
getId() {
|
|
26
|
-
return
|
|
25
|
+
return $;
|
|
27
26
|
}
|
|
28
27
|
getTemplate() {
|
|
29
28
|
return `
|
|
@@ -36,21 +35,22 @@ class te extends x {
|
|
|
36
35
|
}
|
|
37
36
|
onRender() {
|
|
38
37
|
this.api.updateValues({
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
38
|
+
[a.ORIENTATION]: this.store.orientation,
|
|
39
|
+
[a.ITEMS_TYPE]: this.store.itemsType,
|
|
40
|
+
[a.ITEM_IDS]: this.store.itemIds
|
|
42
41
|
}), this._listenToFormUpdates();
|
|
43
42
|
}
|
|
44
43
|
onTemplateNodeUpdated(e) {
|
|
45
|
-
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
44
|
+
super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(
|
|
46
45
|
() => {
|
|
47
|
-
|
|
46
|
+
const t = P(this.currentNode);
|
|
47
|
+
t && (this.store.setItemsType(t.type), this.store.setItemIds(t.itemsSelectValue), this.store.setOrientation(t.orientation), this.store.setCurrencySymbol(t.priceCurrencySymbol), this.store.setCurrencyLocation(t.priceCurrencyLocation), this.store.setFormattedPrice(t.priceFormatted), this.store.setImageLink(t.imageLink), this.store.setButtonLink(t.buttonLink));
|
|
48
48
|
},
|
|
49
49
|
() => {
|
|
50
50
|
this.api.updateValues({
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
51
|
+
[a.ORIENTATION]: this.store.orientation,
|
|
52
|
+
[a.ITEMS_TYPE]: this.store.itemsType,
|
|
53
|
+
[a.ITEM_IDS]: this.store.itemIds
|
|
54
54
|
}), this._initializeSelectItems();
|
|
55
55
|
}
|
|
56
56
|
);
|
|
@@ -64,10 +64,10 @@ class te extends x {
|
|
|
64
64
|
${this._GuOneColumn([
|
|
65
65
|
this._GuLabel({ text: "Item Type" }),
|
|
66
66
|
this._GuSelect({
|
|
67
|
-
name:
|
|
67
|
+
name: a.ITEMS_TYPE,
|
|
68
68
|
className: "es-100",
|
|
69
69
|
placeholder: "Select Item Type",
|
|
70
|
-
options:
|
|
70
|
+
options: R
|
|
71
71
|
})
|
|
72
72
|
])}
|
|
73
73
|
`;
|
|
@@ -77,8 +77,8 @@ class te extends x {
|
|
|
77
77
|
${this._GuTwoColumns([
|
|
78
78
|
this._GuLabel({ text: "Orientation" }),
|
|
79
79
|
this._GuRadioButton({
|
|
80
|
-
name:
|
|
81
|
-
buttons:
|
|
80
|
+
name: a.ORIENTATION,
|
|
81
|
+
buttons: x
|
|
82
82
|
})
|
|
83
83
|
])}
|
|
84
84
|
`;
|
|
@@ -88,7 +88,7 @@ class te extends x {
|
|
|
88
88
|
${this._GuTwoColumns([
|
|
89
89
|
this._GuLabel({ text: "Item in Cart" }),
|
|
90
90
|
this._GuSelect({
|
|
91
|
-
name:
|
|
91
|
+
name: a.ITEM_IDS,
|
|
92
92
|
className: "es-100",
|
|
93
93
|
placeholder: "Select Item In Cart",
|
|
94
94
|
options: []
|
|
@@ -97,172 +97,181 @@ class te extends x {
|
|
|
97
97
|
`;
|
|
98
98
|
}
|
|
99
99
|
_onOrientationChange(e) {
|
|
100
|
-
|
|
100
|
+
this.store.setOrientation(e), this.store.setPriceOrientation("horizontal"), this.api.updateValues({ [a.ORIENTATION]: e }), f(this.currentNode, this.api, {
|
|
101
|
+
orientation: e,
|
|
102
|
+
priceOrientation: "horizontal"
|
|
103
|
+
}), this._reOrderTemplate(), setTimeout(() => {
|
|
101
104
|
this._recalculateTrimming();
|
|
102
105
|
}, 50);
|
|
103
106
|
}
|
|
104
107
|
_onItemsTypeChange(e) {
|
|
105
|
-
const
|
|
106
|
-
!
|
|
108
|
+
const t = S.ITEMS_TYPE[e], i = N[e], r = i == null ? void 0 : i[0];
|
|
109
|
+
!t || !r || (this.store.setItemsType(t), this.store.setItemIds(r.value), f(this.currentNode, this.api, {
|
|
110
|
+
source: t,
|
|
111
|
+
type: t,
|
|
112
|
+
itemsSelectValue: r.value,
|
|
113
|
+
imageLink: this.store.imageLink,
|
|
114
|
+
buttonLink: this.store.buttonLink
|
|
115
|
+
}), this._updateDataTypeAttributes(t), this._initializeSelectItems(), this._reFillTemplate());
|
|
107
116
|
}
|
|
108
117
|
_onItemIdsChange(e) {
|
|
109
|
-
|
|
118
|
+
this.store.setItemIds(e), this.api.updateValues({ [a.ITEM_IDS]: e }), f(this.currentNode, this.api, {
|
|
119
|
+
itemsSelectValue: e,
|
|
120
|
+
imageLink: this.store.imageLink,
|
|
121
|
+
buttonLink: this.store.buttonLink
|
|
122
|
+
}), this._updateDataNumberAttributes(e), this._reFillTemplate();
|
|
110
123
|
}
|
|
111
124
|
_initializeSelectItems() {
|
|
112
125
|
this.api.setUIEAttribute(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
a.ITEMS_TYPE,
|
|
127
|
+
C.SELECTPICKER.items,
|
|
128
|
+
R
|
|
116
129
|
);
|
|
117
|
-
const { itemsType: e, itemIds:
|
|
130
|
+
const { itemsType: e, itemIds: t } = this.store;
|
|
118
131
|
this.api.updateValues({
|
|
119
|
-
[
|
|
132
|
+
[a.ITEMS_TYPE]: e
|
|
120
133
|
});
|
|
121
|
-
const
|
|
134
|
+
const i = N[e];
|
|
122
135
|
this.api.setUIEAttribute(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
a.ITEM_IDS,
|
|
137
|
+
C.SELECTPICKER.items,
|
|
138
|
+
i
|
|
126
139
|
), this.api.updateValues({
|
|
127
|
-
[
|
|
140
|
+
[a.ITEM_IDS]: t
|
|
128
141
|
});
|
|
129
142
|
}
|
|
130
143
|
_listenToFormUpdates() {
|
|
131
144
|
this.api.onValueChanged(
|
|
132
|
-
|
|
145
|
+
a.ITEMS_TYPE,
|
|
133
146
|
(e) => this._onItemsTypeChange(e)
|
|
134
147
|
), this.api.onValueChanged(
|
|
135
|
-
|
|
148
|
+
a.ORIENTATION,
|
|
136
149
|
(e) => this._onOrientationChange(e)
|
|
137
150
|
), this.api.onValueChanged(
|
|
138
|
-
|
|
151
|
+
a.ITEM_IDS,
|
|
139
152
|
(e) => this._onItemIdsChange(e)
|
|
140
153
|
);
|
|
141
154
|
}
|
|
142
155
|
_renderTemplate() {
|
|
143
156
|
const {
|
|
144
157
|
orientation: e,
|
|
145
|
-
itemsType:
|
|
146
|
-
itemIds:
|
|
158
|
+
itemsType: t,
|
|
159
|
+
itemIds: i,
|
|
147
160
|
currencySymbol: r,
|
|
148
161
|
currencyLocation: n,
|
|
149
|
-
formattedPrice:
|
|
162
|
+
formattedPrice: s
|
|
150
163
|
} = this.store;
|
|
151
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
164
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(F({
|
|
152
165
|
orientation: e,
|
|
153
|
-
itemsType:
|
|
154
|
-
itemId:
|
|
166
|
+
itemsType: t,
|
|
167
|
+
itemId: i,
|
|
155
168
|
currencySymbol: r,
|
|
156
169
|
currencyLocation: n,
|
|
157
|
-
formattedPrice:
|
|
158
|
-
})).apply(new
|
|
170
|
+
formattedPrice: s
|
|
171
|
+
})).apply(new u("Updated template"));
|
|
159
172
|
}
|
|
160
173
|
_getTemplateData() {
|
|
161
|
-
const { itemsType: e, itemIds:
|
|
174
|
+
const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = N[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
|
|
162
175
|
return {
|
|
163
|
-
imageSrc:
|
|
164
|
-
name:
|
|
165
|
-
price:
|
|
166
|
-
originalPrice:
|
|
167
|
-
quantity:
|
|
168
|
-
button:
|
|
176
|
+
imageSrc: p.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
|
|
177
|
+
name: p.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
|
|
178
|
+
price: i ? p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
|
|
179
|
+
originalPrice: i ? p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
|
|
180
|
+
quantity: p.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
|
|
181
|
+
button: p.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
|
|
169
182
|
};
|
|
170
183
|
}
|
|
171
184
|
_updateImageSrc(e) {
|
|
172
|
-
var
|
|
173
|
-
const
|
|
174
|
-
|
|
185
|
+
var i;
|
|
186
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
|
|
187
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new u("Updated image src"));
|
|
175
188
|
}
|
|
176
189
|
_updateName(e) {
|
|
177
190
|
var n;
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
191
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
192
|
+
if (!t)
|
|
180
193
|
return;
|
|
181
|
-
const
|
|
182
|
-
let r =
|
|
183
|
-
r = r.replace(
|
|
194
|
+
const i = t.getInnerText().trim();
|
|
195
|
+
let r = t.getInnerHTML();
|
|
196
|
+
r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new u("Updated name"));
|
|
184
197
|
}
|
|
185
198
|
_updatePrice(e) {
|
|
186
199
|
var g;
|
|
187
|
-
const
|
|
188
|
-
if (!i)
|
|
189
|
-
return;
|
|
190
|
-
const t = this._getParagraphFromBlock(i);
|
|
200
|
+
const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
|
|
191
201
|
if (!t)
|
|
192
202
|
return;
|
|
193
|
-
const
|
|
194
|
-
|
|
203
|
+
const i = this._getParagraphFromBlock(t);
|
|
204
|
+
if (!i)
|
|
205
|
+
return;
|
|
206
|
+
const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: l } = this.store, o = (s == null ? void 0 : s.trim()) || "", c = this._removeCurrencySymbol(n, o), T = this._replacePriceNumber(c, e), I = this._buildPriceContent(T, o, l), _ = r.replace(n, I);
|
|
207
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new u("Updated price"));
|
|
195
208
|
}
|
|
196
209
|
_updateOriginalPrice(e) {
|
|
197
|
-
var
|
|
198
|
-
const
|
|
199
|
-
`[esd-extension-block-id="${
|
|
210
|
+
var E;
|
|
211
|
+
const t = (E = this.currentNode) == null ? void 0 : E.querySelector(
|
|
212
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
200
213
|
);
|
|
201
|
-
if (!i)
|
|
202
|
-
return;
|
|
203
|
-
const t = this._getParagraphFromBlock(i);
|
|
204
214
|
if (!t)
|
|
205
215
|
return;
|
|
206
|
-
const
|
|
216
|
+
const i = this._getParagraphFromBlock(t);
|
|
217
|
+
if (!i)
|
|
218
|
+
return;
|
|
219
|
+
const r = i.querySelector("s");
|
|
207
220
|
if (!r)
|
|
208
221
|
return;
|
|
209
|
-
const n = r.getInnerHTML() || "",
|
|
210
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
222
|
+
const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: l, currencyLocation: o } = this.store, c = (l == null ? void 0 : l.trim()) || "", T = this._removeCurrencySymbol(s, c), I = this._replacePriceNumber(T, e), _ = this._buildPriceContent(I, c, o), y = `<s>${n.replace(s, _)}</s>`;
|
|
223
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(y).apply(new u("Updated original price"));
|
|
211
224
|
}
|
|
212
225
|
_updateQuantity(e) {
|
|
213
|
-
var
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
226
|
+
var c;
|
|
227
|
+
const t = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, i = P(this.currentNode), r = (i == null ? void 0 : i.quantityControlEnabled) !== !1, n = t && r, s = (c = this.currentNode) == null ? void 0 : c.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
|
|
228
|
+
if (!s)
|
|
216
229
|
return;
|
|
217
|
-
const
|
|
218
|
-
let o =
|
|
219
|
-
o = o.replace(
|
|
230
|
+
const l = s.getInnerText().trim();
|
|
231
|
+
let o = s.getInnerHTML();
|
|
232
|
+
o = o.replace(l, e), this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(o).setStyle("display", n ? "table-cell" : "none").apply(new u("Updated quantity"));
|
|
220
233
|
}
|
|
221
|
-
/**
|
|
222
|
-
* @todo Optimize template reordering for performance.
|
|
223
|
-
* @description Reorders the template structure based on current orientation and visibility settings.
|
|
224
|
-
*/
|
|
225
234
|
_reOrderTemplate() {
|
|
226
|
-
var I, _, g,
|
|
227
|
-
const e = (
|
|
228
|
-
`[esd-extension-block-id="${
|
|
229
|
-
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${
|
|
230
|
-
if (!e || !
|
|
235
|
+
var T, I, _, g, y, E;
|
|
236
|
+
const e = (T = this.currentNode) == null ? void 0 : T.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), t = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.NAME}"]`), i = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (g = this.currentNode) == null ? void 0 : g.querySelector(
|
|
237
|
+
`[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
|
|
238
|
+
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), s = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`);
|
|
239
|
+
if (!e || !t || !i || !r || !n || !s)
|
|
231
240
|
return;
|
|
232
|
-
const { orientation:
|
|
233
|
-
let
|
|
234
|
-
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width",
|
|
235
|
-
|
|
241
|
+
const { orientation: l } = this.store, o = l === S.ORIENTATION.VERTICAL;
|
|
242
|
+
let c = o ? k : H;
|
|
243
|
+
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", A.productImageWidth).setAttribute("height", A.productImageWidth).apply(new u("Updated image width")), setTimeout(() => {
|
|
244
|
+
c = c.replace("{-{-TEMPLATE_FIRST_LINE-}-}", o ? b : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", i.getOuterHTML()).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()), c = c.trim().replace(b, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(c).apply(new u("Reordered template"));
|
|
236
245
|
}, 50);
|
|
237
246
|
}
|
|
238
247
|
_updateDataTypeAttributes(e) {
|
|
239
248
|
if (!this.currentNode)
|
|
240
249
|
return;
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
}),
|
|
250
|
+
const t = this.currentNode.closest(".ins-product-td"), i = this.api.getDocumentModifier();
|
|
251
|
+
t && i.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
252
|
+
const s = n;
|
|
253
|
+
i.modifyHtml(s).setAttribute("data-type", e);
|
|
254
|
+
}), i.apply(new u("Updated data-type attribute"));
|
|
246
255
|
}
|
|
247
256
|
_updateDataNumberAttributes(e) {
|
|
248
257
|
if (!this.currentNode)
|
|
249
258
|
return;
|
|
250
|
-
const { itemsType:
|
|
259
|
+
const { itemsType: t } = this.store, i = N[t].findIndex((o) => o.value === e);
|
|
251
260
|
let r = "1";
|
|
252
|
-
if (
|
|
253
|
-
r = String(
|
|
261
|
+
if (i >= 0)
|
|
262
|
+
r = String(i + 1);
|
|
254
263
|
else if (e) {
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
const [,
|
|
258
|
-
r =
|
|
264
|
+
const o = e.match(/\((\d+)\)/);
|
|
265
|
+
if (o) {
|
|
266
|
+
const [, c] = o;
|
|
267
|
+
r = c;
|
|
259
268
|
}
|
|
260
269
|
}
|
|
261
|
-
const n = this.currentNode.closest(".ins-product-td"),
|
|
262
|
-
n &&
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
}),
|
|
270
|
+
const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
|
|
271
|
+
n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((o) => {
|
|
272
|
+
const c = o;
|
|
273
|
+
s.modifyHtml(c).setAttribute("data-number", r);
|
|
274
|
+
}), s.apply(new u("Updated data-number attribute"));
|
|
266
275
|
}
|
|
267
276
|
_reFillTemplate() {
|
|
268
277
|
const e = this._getTemplateData();
|
|
@@ -272,14 +281,14 @@ class te extends x {
|
|
|
272
281
|
var n;
|
|
273
282
|
if (!this.currentNode)
|
|
274
283
|
return;
|
|
275
|
-
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${
|
|
284
|
+
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
|
|
276
285
|
if (!e)
|
|
277
286
|
return;
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
287
|
+
const t = e.querySelector("p > a");
|
|
288
|
+
if (!t)
|
|
280
289
|
return;
|
|
281
|
-
const
|
|
282
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
290
|
+
const i = this.store.orientation === S.ORIENTATION.HORIZONTAL, r = this.store.nameTrimming;
|
|
291
|
+
this.api.getDocumentModifier().modifyHtml(t).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new u("Recalculated trimming after orientation change"));
|
|
283
292
|
}
|
|
284
293
|
_getParagraphFromBlock(e) {
|
|
285
294
|
return e.querySelector("p");
|
|
@@ -287,30 +296,30 @@ class te extends x {
|
|
|
287
296
|
_escapeRegex(e) {
|
|
288
297
|
return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
|
|
289
298
|
}
|
|
290
|
-
_removeCurrencySymbol(e,
|
|
291
|
-
const
|
|
292
|
-
let r =
|
|
293
|
-
if (
|
|
294
|
-
const n = new RegExp(`\\s*${this._escapeRegex(
|
|
295
|
-
r =
|
|
299
|
+
_removeCurrencySymbol(e, t) {
|
|
300
|
+
const i = e || "";
|
|
301
|
+
let r = i;
|
|
302
|
+
if (t) {
|
|
303
|
+
const n = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
|
|
304
|
+
r = i.replace(n, "").trim();
|
|
296
305
|
} else {
|
|
297
|
-
const n =
|
|
306
|
+
const n = i.match(/([^0-9.,\s]+)/);
|
|
298
307
|
if (n && n[1]) {
|
|
299
|
-
const
|
|
300
|
-
r =
|
|
308
|
+
const s = n[1].trim(), l = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
309
|
+
r = i.replace(l, "").trim();
|
|
301
310
|
}
|
|
302
311
|
}
|
|
303
312
|
return r;
|
|
304
313
|
}
|
|
305
|
-
_replacePriceNumber(e,
|
|
306
|
-
const
|
|
307
|
-
return e.replace(
|
|
314
|
+
_replacePriceNumber(e, t) {
|
|
315
|
+
const i = /([0-9][0-9,.]*)/;
|
|
316
|
+
return e.replace(i, t).trim();
|
|
308
317
|
}
|
|
309
|
-
_buildPriceContent(e,
|
|
310
|
-
return
|
|
318
|
+
_buildPriceContent(e, t, i) {
|
|
319
|
+
return t ? i === "1" ? `${e} ${t} ` : `${t} ${e}` : e;
|
|
311
320
|
}
|
|
312
321
|
}
|
|
313
322
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
323
|
+
$ as CONTROL_BLOCK_ID,
|
|
324
|
+
K as ItemsBlockControl
|
|
316
325
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var c = /* @__PURE__ */ ((i) => (i.BUTTON = "items-block-button", i.IMAGE = "items-block-image", i.ORIGINAL_PRICE = "items-block-original-price", i.PRICE = "items-block-price", i.QUANTITY = "items-block-quantity", i.NAME = "items-block-name", i))(c || {}),
|
|
1
|
+
var c = /* @__PURE__ */ ((i) => (i.BUTTON = "items-block-button", i.IMAGE = "items-block-image", i.ORIGINAL_PRICE = "items-block-original-price", i.PRICE = "items-block-price", i.QUANTITY = "items-block-quantity", i.NAME = "items-block-name", i))(c || {}), _ = /* @__PURE__ */ ((i) => (i.BUTTON_ALIGN = "items-block-button-align-control", i.BUTTON_BORDER = "items-block-button-border-control", i.BUTTON_BORDER_RADIUS = "items-block-button-border-radius-control", i.BUTTON_COLOR = "items-block-button-color-control", i.BUTTON_FIT_TO_CONTENT = "items-block-button-fit-to-content-control", i.BUTTON_FONT_FAMILY = "items-block-button-font-family-control", i.BUTTON_MARGINS = "items-block-button-margins-control", i.BUTTON_PADDINGS = "items-block-button-paddings-control", i.BUTTON_TEXT = "items-block-button-text-control", i.BUTTON_TEXT_SIZE = "items-block-button-text-size-control", i.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "items-block-button-text-style-and-font-color-control", i.BUTTON_LINK = "items-block-button-link-control", i.IMAGE_SIZE = "items-block-image-size-control", i.IMAGE_MARGINS = "items-block-image-margins-control", i.IMAGE_LINK = "items-block-image-link-control", i.ORIGINAL_PRICE_ALIGN = "items-block-original-price-align-control", i.ORIGINAL_PRICE_COLOR = "items-block-original-price-color-control", i.ORIGINAL_PRICE_SIZE = "items-block-original-price-size-control", i.ORIGINAL_PRICE_STYLE = "items-block-original-price-style-control", i.ORIGINAL_PRICE_FONT_FAMILY = "items-block-original-price-font-family-control", i.ORIGINAL_PRICE_BACKGROUND = "items-block-original-price-background-control", i.ORIGINAL_PRICE_PADDINGS = "items-block-original-price-paddings-control", i.PRICE_ALIGN = "items-block-price-align-control", i.PRICE_COLOR = "items-block-price-color-control", i.PRICE_SIZE = "items-block-price-size-control", i.PRICE_STYLE = "items-block-price-style-control", i.PRICE_FONT_FAMILY = "items-block-price-font-family-control", i.PRICE_BACKGROUND = "items-block-price-background-control", i.PRICE_PADDINGS = "items-block-price-paddings-control", i.PRICE_HIDE_DISCOUNT = "items-block-price-hide-discount-control", i.PRICE_FORMATTED_PRICE = "items-block-price-formatted-price-control", i.PRICE_SINGLE_PRICE = "items-block-price-single-price-control", i.PRICE_CURRENCY_SYMBOL = "items-block-price-currency-symbol-control", i.PRICE_CURRENCY_LOCATION = "items-block-price-currency-location-control", i.PRICE_ORIENTATION = "items-block-price-orientation-control", i.NAME_ALIGN = "items-block-name-align-control", i.NAME_COLOR = "items-block-name-color-control", i.NAME_SIZE = "items-block-name-size-control", i.NAME_STYLE = "items-block-name-style-control", i.NAME_FONT_FAMILY = "items-block-name-font-family-control", i.NAME_BACKGROUND = "items-block-name-background-control", i.NAME_TRIMMING = "items-block-name-trimming-control", i.NAME_PADDINGS = "items-block-name-paddings-control", i.QUANTITY_ALIGN = "items-block-quantity-align-control", i.QUANTITY_COLOR = "items-block-quantity-color-control", i.QUANTITY_FONT_FAMILY = "items-block-quantity-font-family-control", i.QUANTITY_PADDINGS = "items-block-quantity-paddings-control", i.QUANTITY_SIZE = "items-block-quantity-size-control", i.QUANTITY_STYLE = "items-block-quantity-style-control", i))(_ || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
_ as ItemsBlockControlId,
|
|
4
4
|
c as ItemsBlockId
|
|
5
5
|
};
|