@useinsider/guido 1.4.4 → 2.0.0-beta.087a24f
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 +295 -664
- package/dist/@types/config/defaults.js +44 -0
- package/dist/@types/config/schemas.js +231 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -86
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
- package/dist/composables/useActionsApi.js +42 -25
- package/dist/composables/useBlocksConfig.js +23 -20
- package/dist/composables/useConfig.js +51 -5
- package/dist/composables/useHtmlCompiler.js +20 -19
- package/dist/composables/useHtmlValidator.js +41 -41
- package/dist/composables/usePartner.js +19 -9
- package/dist/composables/useStripo.js +55 -56
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/enums/defaults.js +4 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
- 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/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +296 -123
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/stripoApi.js +13 -14
- package/dist/services/templateLibraryApi.js +18 -18
- package/dist/src/@types/config/defaults.d.ts +68 -0
- package/dist/src/@types/config/index.d.ts +14 -0
- package/dist/src/@types/config/schemas.d.ts +509 -0
- package/dist/src/@types/config/types.d.ts +142 -0
- package/dist/src/@types/config/validator.d.ts +119 -0
- package/dist/src/@types/generic.d.ts +4 -45
- package/dist/src/components/Guido.vue.d.ts +13 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +186 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +5 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- 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/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1564 -102
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +141 -9
- package/package.json +3 -3
- package/dist/node_modules/lodash-es/_apply.js +0 -16
- package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
- package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
- package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/lodash-es/_copyArray.js +0 -9
- package/dist/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
- package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
- package/dist/node_modules/lodash-es/_overRest.js +0 -15
- package/dist/node_modules/lodash-es/_safeGet.js +0 -7
- package/dist/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/lodash-es/_shortOut.js +0 -16
- package/dist/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
- package/dist/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/package.json.js +0 -7
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var x = (T, u, e) => u in T ? D(T, u, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[u] = e;
|
|
3
|
+
var b = (T, u, e) => x(T, typeof u != "symbol" ? u + "" : u, e);
|
|
4
|
+
import { UEAttr as R, ModificationDescription as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as L } from "../../common-control.js";
|
|
6
6
|
import { ItemsBlockId as l } from "../enums/controlEnums.js";
|
|
7
|
-
import { productPairs as
|
|
8
|
-
import { ItemTypeOptions as P, OrientationOptions as
|
|
7
|
+
import { productPairs as h, templateFirstLine as A } from "../enums/productEnums.js";
|
|
8
|
+
import { ItemTypeOptions as P, OrientationOptions as H, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as M } from "../enums/settingsEnums.js";
|
|
9
9
|
import U from "../layouts/horizontal.html.js";
|
|
10
10
|
import F from "../layouts/vertical.html.js";
|
|
11
11
|
import { useItemsBlockStore as $ } from "../store/items-block.js";
|
|
12
12
|
import { getDefaultTemplate as q } from "../template.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
const G = "ui-elements-items-block", s = {
|
|
13
|
+
import { getItemsBlockConfig as k, setItemsBlockConfig as f } from "../utils/nodeConfigUtils.js";
|
|
14
|
+
const w = "ui-elements-items-block", o = {
|
|
16
15
|
ITEMS_TYPE: "itemsType",
|
|
17
16
|
ORIENTATION: "orientation",
|
|
18
17
|
ITEM_IDS: "itemIds"
|
|
19
18
|
};
|
|
20
|
-
class
|
|
19
|
+
class j extends L {
|
|
21
20
|
constructor() {
|
|
22
21
|
super(...arguments);
|
|
23
22
|
b(this, "store", $());
|
|
24
23
|
}
|
|
25
24
|
getId() {
|
|
26
|
-
return
|
|
25
|
+
return w;
|
|
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
|
+
[o.ORIENTATION]: this.store.orientation,
|
|
39
|
+
[o.ITEMS_TYPE]: this.store.itemsType,
|
|
40
|
+
[o.ITEM_IDS]: this.store.itemIds
|
|
42
41
|
}), this._listenToFormUpdates();
|
|
43
42
|
}
|
|
44
43
|
onTemplateNodeUpdated(e) {
|
|
45
44
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
46
45
|
() => {
|
|
47
|
-
|
|
46
|
+
const t = k(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));
|
|
48
48
|
},
|
|
49
49
|
() => {
|
|
50
50
|
this.api.updateValues({
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
51
|
+
[o.ORIENTATION]: this.store.orientation,
|
|
52
|
+
[o.ITEMS_TYPE]: this.store.itemsType,
|
|
53
|
+
[o.ITEM_IDS]: this.store.itemIds
|
|
54
54
|
}), this._initializeSelectItems();
|
|
55
55
|
}
|
|
56
56
|
);
|
|
@@ -64,7 +64,7 @@ class te extends x {
|
|
|
64
64
|
${this._GuOneColumn([
|
|
65
65
|
this._GuLabel({ text: "Item Type" }),
|
|
66
66
|
this._GuSelect({
|
|
67
|
-
name:
|
|
67
|
+
name: o.ITEMS_TYPE,
|
|
68
68
|
className: "es-100",
|
|
69
69
|
placeholder: "Select Item Type",
|
|
70
70
|
options: P
|
|
@@ -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: o.ORIENTATION,
|
|
81
|
+
buttons: H
|
|
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: o.ITEM_IDS,
|
|
92
92
|
className: "es-100",
|
|
93
93
|
placeholder: "Select Item In Cart",
|
|
94
94
|
options: []
|
|
@@ -97,172 +97,177 @@ 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({ [o.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
|
+
}), this._updateDataTypeAttributes(t), this._initializeSelectItems(), this._reFillTemplate());
|
|
107
114
|
}
|
|
108
115
|
_onItemIdsChange(e) {
|
|
109
|
-
|
|
116
|
+
this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), f(this.currentNode, this.api, {
|
|
117
|
+
itemsSelectValue: e
|
|
118
|
+
}), this._updateDataNumberAttributes(e), this._reFillTemplate();
|
|
110
119
|
}
|
|
111
120
|
_initializeSelectItems() {
|
|
112
121
|
this.api.setUIEAttribute(
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
o.ITEMS_TYPE,
|
|
123
|
+
R.SELECTPICKER.items,
|
|
115
124
|
P
|
|
116
125
|
);
|
|
117
|
-
const { itemsType: e, itemIds:
|
|
126
|
+
const { itemsType: e, itemIds: t } = this.store;
|
|
118
127
|
this.api.updateValues({
|
|
119
|
-
[
|
|
128
|
+
[o.ITEMS_TYPE]: e
|
|
120
129
|
});
|
|
121
|
-
const
|
|
130
|
+
const i = N[e];
|
|
122
131
|
this.api.setUIEAttribute(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
o.ITEM_IDS,
|
|
133
|
+
R.SELECTPICKER.items,
|
|
134
|
+
i
|
|
126
135
|
), this.api.updateValues({
|
|
127
|
-
[
|
|
136
|
+
[o.ITEM_IDS]: t
|
|
128
137
|
});
|
|
129
138
|
}
|
|
130
139
|
_listenToFormUpdates() {
|
|
131
140
|
this.api.onValueChanged(
|
|
132
|
-
|
|
141
|
+
o.ITEMS_TYPE,
|
|
133
142
|
(e) => this._onItemsTypeChange(e)
|
|
134
143
|
), this.api.onValueChanged(
|
|
135
|
-
|
|
144
|
+
o.ORIENTATION,
|
|
136
145
|
(e) => this._onOrientationChange(e)
|
|
137
146
|
), this.api.onValueChanged(
|
|
138
|
-
|
|
147
|
+
o.ITEM_IDS,
|
|
139
148
|
(e) => this._onItemIdsChange(e)
|
|
140
149
|
);
|
|
141
150
|
}
|
|
142
151
|
_renderTemplate() {
|
|
143
152
|
const {
|
|
144
153
|
orientation: e,
|
|
145
|
-
itemsType:
|
|
146
|
-
itemIds:
|
|
154
|
+
itemsType: t,
|
|
155
|
+
itemIds: i,
|
|
147
156
|
currencySymbol: r,
|
|
148
157
|
currencyLocation: n,
|
|
149
|
-
formattedPrice:
|
|
158
|
+
formattedPrice: s
|
|
150
159
|
} = this.store;
|
|
151
160
|
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
|
|
152
161
|
orientation: e,
|
|
153
|
-
itemsType:
|
|
154
|
-
itemId:
|
|
162
|
+
itemsType: t,
|
|
163
|
+
itemId: i,
|
|
155
164
|
currencySymbol: r,
|
|
156
165
|
currencyLocation: n,
|
|
157
|
-
formattedPrice:
|
|
158
|
-
})).apply(new
|
|
166
|
+
formattedPrice: s
|
|
167
|
+
})).apply(new p("Updated template"));
|
|
159
168
|
}
|
|
160
169
|
_getTemplateData() {
|
|
161
|
-
const { itemsType: e, itemIds:
|
|
170
|
+
const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = N[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
|
|
162
171
|
return {
|
|
163
|
-
imageSrc:
|
|
164
|
-
name:
|
|
165
|
-
price:
|
|
166
|
-
originalPrice:
|
|
167
|
-
quantity:
|
|
168
|
-
button:
|
|
172
|
+
imageSrc: h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
|
|
173
|
+
name: h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
|
|
174
|
+
price: i ? h.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : h.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
|
|
175
|
+
originalPrice: i ? h.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : h.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
|
|
176
|
+
quantity: h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
|
|
177
|
+
button: h.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
|
|
169
178
|
};
|
|
170
179
|
}
|
|
171
180
|
_updateImageSrc(e) {
|
|
172
|
-
var
|
|
173
|
-
const
|
|
174
|
-
|
|
181
|
+
var i;
|
|
182
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${l.IMAGE}"] img`);
|
|
183
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new p("Updated image src"));
|
|
175
184
|
}
|
|
176
185
|
_updateName(e) {
|
|
177
186
|
var n;
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
187
|
+
const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
|
|
188
|
+
if (!t)
|
|
180
189
|
return;
|
|
181
|
-
const
|
|
182
|
-
let r =
|
|
183
|
-
r = r.replace(
|
|
190
|
+
const i = t.getInnerText().trim();
|
|
191
|
+
let r = t.getInnerHTML();
|
|
192
|
+
r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new p("Updated name"));
|
|
184
193
|
}
|
|
185
194
|
_updatePrice(e) {
|
|
186
195
|
var g;
|
|
187
|
-
const
|
|
188
|
-
if (!i)
|
|
189
|
-
return;
|
|
190
|
-
const t = this._getParagraphFromBlock(i);
|
|
196
|
+
const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`);
|
|
191
197
|
if (!t)
|
|
192
198
|
return;
|
|
193
|
-
const
|
|
194
|
-
|
|
199
|
+
const i = this._getParagraphFromBlock(t);
|
|
200
|
+
if (!i)
|
|
201
|
+
return;
|
|
202
|
+
const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: c } = this.store, a = (s == null ? void 0 : s.trim()) || "", m = this._removeCurrencySymbol(n, a), d = this._replacePriceNumber(m, e), I = this._buildPriceContent(d, a, c), _ = r.replace(n, I);
|
|
203
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new p("Updated price"));
|
|
195
204
|
}
|
|
196
205
|
_updateOriginalPrice(e) {
|
|
197
206
|
var y;
|
|
198
|
-
const
|
|
207
|
+
const t = (y = this.currentNode) == null ? void 0 : y.querySelector(
|
|
199
208
|
`[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
|
|
200
209
|
);
|
|
201
|
-
if (!i)
|
|
202
|
-
return;
|
|
203
|
-
const t = this._getParagraphFromBlock(i);
|
|
204
210
|
if (!t)
|
|
205
211
|
return;
|
|
206
|
-
const
|
|
212
|
+
const i = this._getParagraphFromBlock(t);
|
|
213
|
+
if (!i)
|
|
214
|
+
return;
|
|
215
|
+
const r = i.querySelector("s");
|
|
207
216
|
if (!r)
|
|
208
217
|
return;
|
|
209
|
-
const n = r.getInnerHTML() || "",
|
|
210
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
218
|
+
const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: c, currencyLocation: a } = this.store, m = (c == null ? void 0 : c.trim()) || "", d = this._removeCurrencySymbol(s, m), I = this._replacePriceNumber(d, e), _ = this._buildPriceContent(I, m, a), E = `<s>${n.replace(s, _)}</s>`;
|
|
219
|
+
this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(E).apply(new p("Updated original price"));
|
|
211
220
|
}
|
|
212
221
|
_updateQuantity(e) {
|
|
213
|
-
var
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
222
|
+
var s;
|
|
223
|
+
const t = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, i = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`);
|
|
224
|
+
if (!i)
|
|
216
225
|
return;
|
|
217
|
-
const r =
|
|
218
|
-
let
|
|
219
|
-
|
|
226
|
+
const r = i.getInnerText().trim();
|
|
227
|
+
let n = i.getInnerHTML();
|
|
228
|
+
n = n.replace(r, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(n).setStyle("display", t ? "table-cell" : "none").apply(new p("Updated quantity"));
|
|
220
229
|
}
|
|
221
|
-
/**
|
|
222
|
-
* @todo Optimize template reordering for performance.
|
|
223
|
-
* @description Reorders the template structure based on current orientation and visibility settings.
|
|
224
|
-
*/
|
|
225
230
|
_reOrderTemplate() {
|
|
226
231
|
var I, _, g, E, y, O, C;
|
|
227
|
-
const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${l.IMAGE}"]`),
|
|
232
|
+
const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${l.IMAGE}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${l.NAME}"]`), i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
|
|
228
233
|
`[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
|
|
229
|
-
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`),
|
|
230
|
-
if (!e || !
|
|
234
|
+
), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`), s = (O = this.currentNode) == null ? void 0 : O.querySelector(`[esd-extension-block-id="${l.BUTTON}"]`), c = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
|
|
235
|
+
if (!e || !t || !i || !r || !n || !s)
|
|
231
236
|
return;
|
|
232
|
-
const { orientation:
|
|
233
|
-
let
|
|
234
|
-
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width",
|
|
235
|
-
|
|
237
|
+
const { orientation: a } = this.store, m = a === S.ORIENTATION.VERTICAL;
|
|
238
|
+
let d = m ? F : U;
|
|
239
|
+
this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", M.productImageWidth).setAttribute("height", M.productImageWidth).apply(new p("Updated image width")), setTimeout(() => {
|
|
240
|
+
d = d.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? A : "").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()).replace("{-{-CONFIG_BLOCK-}-}", (c == null ? void 0 : c.getOuterHTML()) || ""), d = d.trim().replace(A, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(d).apply(new p("Reordered template"));
|
|
236
241
|
}, 50);
|
|
237
242
|
}
|
|
238
243
|
_updateDataTypeAttributes(e) {
|
|
239
244
|
if (!this.currentNode)
|
|
240
245
|
return;
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
}),
|
|
246
|
+
const t = this.currentNode.closest(".ins-product-td"), i = this.api.getDocumentModifier();
|
|
247
|
+
t && i.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
248
|
+
const s = n;
|
|
249
|
+
i.modifyHtml(s).setAttribute("data-type", e);
|
|
250
|
+
}), i.apply(new p("Updated data-type attribute"));
|
|
246
251
|
}
|
|
247
252
|
_updateDataNumberAttributes(e) {
|
|
248
253
|
if (!this.currentNode)
|
|
249
254
|
return;
|
|
250
|
-
const { itemsType:
|
|
255
|
+
const { itemsType: t } = this.store, i = N[t].findIndex((a) => a.value === e);
|
|
251
256
|
let r = "1";
|
|
252
|
-
if (
|
|
253
|
-
r = String(
|
|
257
|
+
if (i >= 0)
|
|
258
|
+
r = String(i + 1);
|
|
254
259
|
else if (e) {
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
const [, m] =
|
|
260
|
+
const a = e.match(/\((\d+)\)/);
|
|
261
|
+
if (a) {
|
|
262
|
+
const [, m] = a;
|
|
258
263
|
r = m;
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
|
-
const n = this.currentNode.closest(".ins-product-td"),
|
|
262
|
-
n &&
|
|
263
|
-
const m =
|
|
264
|
-
|
|
265
|
-
}),
|
|
266
|
+
const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
|
|
267
|
+
n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
|
|
268
|
+
const m = a;
|
|
269
|
+
s.modifyHtml(m).setAttribute("data-number", r);
|
|
270
|
+
}), s.apply(new p("Updated data-number attribute"));
|
|
266
271
|
}
|
|
267
272
|
_reFillTemplate() {
|
|
268
273
|
const e = this._getTemplateData();
|
|
@@ -275,11 +280,11 @@ class te extends x {
|
|
|
275
280
|
const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
|
|
276
281
|
if (!e)
|
|
277
282
|
return;
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
283
|
+
const t = e.querySelector("p > a");
|
|
284
|
+
if (!t)
|
|
280
285
|
return;
|
|
281
|
-
const
|
|
282
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
286
|
+
const i = this.store.orientation === S.ORIENTATION.HORIZONTAL, r = this.store.nameTrimming;
|
|
287
|
+
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 p("Recalculated trimming after orientation change"));
|
|
283
288
|
}
|
|
284
289
|
_getParagraphFromBlock(e) {
|
|
285
290
|
return e.querySelector("p");
|
|
@@ -287,30 +292,30 @@ class te extends x {
|
|
|
287
292
|
_escapeRegex(e) {
|
|
288
293
|
return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
|
|
289
294
|
}
|
|
290
|
-
_removeCurrencySymbol(e,
|
|
291
|
-
const
|
|
292
|
-
let r =
|
|
293
|
-
if (
|
|
294
|
-
const n = new RegExp(`\\s*${this._escapeRegex(
|
|
295
|
-
r =
|
|
295
|
+
_removeCurrencySymbol(e, t) {
|
|
296
|
+
const i = e || "";
|
|
297
|
+
let r = i;
|
|
298
|
+
if (t) {
|
|
299
|
+
const n = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
|
|
300
|
+
r = i.replace(n, "").trim();
|
|
296
301
|
} else {
|
|
297
|
-
const n =
|
|
302
|
+
const n = i.match(/([^0-9.,\s]+)/);
|
|
298
303
|
if (n && n[1]) {
|
|
299
|
-
const
|
|
300
|
-
r =
|
|
304
|
+
const s = n[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
305
|
+
r = i.replace(c, "").trim();
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
return r;
|
|
304
309
|
}
|
|
305
|
-
_replacePriceNumber(e,
|
|
306
|
-
const
|
|
307
|
-
return e.replace(
|
|
310
|
+
_replacePriceNumber(e, t) {
|
|
311
|
+
const i = /([0-9][0-9,.]*)/;
|
|
312
|
+
return e.replace(i, t).trim();
|
|
308
313
|
}
|
|
309
|
-
_buildPriceContent(e,
|
|
310
|
-
return
|
|
314
|
+
_buildPriceContent(e, t, i) {
|
|
315
|
+
return t ? i === "1" ? `${e} ${t} ` : `${t} ${e}` : e;
|
|
311
316
|
}
|
|
312
317
|
}
|
|
313
318
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
319
|
+
w as CONTROL_BLOCK_ID,
|
|
320
|
+
j as ItemsBlockControl
|
|
316
321
|
};
|
|
@@ -18,9 +18,9 @@ const e = {
|
|
|
18
18
|
], a = {
|
|
19
19
|
itemsType: e.ITEMS_TYPE.CART_ITEMS,
|
|
20
20
|
cartItemsSelectControlValue: "{{Abandoned Cart Item (1) Url}}",
|
|
21
|
-
cardOrientationControlValue: e.ORIENTATION.
|
|
21
|
+
cardOrientationControlValue: e.ORIENTATION.VERTICAL,
|
|
22
22
|
productNameTrimmingControlValue: "1",
|
|
23
|
-
productPriceHideDiscountControlValue: "
|
|
23
|
+
productPriceHideDiscountControlValue: "1",
|
|
24
24
|
productPriceFormattedControlValue: "1",
|
|
25
25
|
productPriceCurrencySymbolControlValue: "USD",
|
|
26
26
|
productPriceCurrencyLocationControlValue: "0",
|
|
@@ -1,55 +1,65 @@
|
|
|
1
1
|
const t = `{-{-TEMPLATE_FIRST_LINE-}-}
|
|
2
|
-
<table class="es-left ins-product-wrapper"
|
|
2
|
+
<table class="es-left ins-product-wrapper ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
|
|
3
3
|
{-{-CONFIG_BLOCK-}-}
|
|
4
4
|
<tbody>
|
|
5
5
|
<tr>
|
|
6
|
-
<td
|
|
7
|
-
<table class="
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class="product-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
6
|
+
<td style="padding: 16px 9px;">
|
|
7
|
+
<table class="es-left esdev-disable-select" cellspacing="0" cellpadding="0" align="left" width="100%">
|
|
8
|
+
<tbody>
|
|
9
|
+
<tr>
|
|
10
|
+
<td class="product-image-class" data-slot-1>
|
|
11
|
+
{-{-PRODUCT_IMAGE-}-}
|
|
12
|
+
</td>
|
|
13
|
+
<td class="product-name-class" data-slot-2>
|
|
14
|
+
<table>
|
|
15
|
+
<tbody>
|
|
16
|
+
{-{-PRODUCT_NAME-}-}
|
|
17
|
+
</tbody>
|
|
18
|
+
</table>
|
|
19
|
+
</td>
|
|
20
|
+
<td class="product-quantity-class" data-slot-3>
|
|
21
|
+
<table width="100%">
|
|
22
|
+
<tbody>
|
|
23
|
+
{-{-PRODUCT_QUANTITY-}-}
|
|
24
|
+
</tbody>
|
|
25
|
+
</table>
|
|
26
|
+
</td>
|
|
27
|
+
<td class="product-price-class horizontal-price" data-slot-4>
|
|
28
|
+
<table width="100%">
|
|
29
|
+
<tbody>
|
|
30
|
+
{-{-PRODUCT_PRICE-}-}
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
33
|
+
</td>
|
|
34
|
+
<td class="product-original-price-class horizontal-price" data-slot-5>
|
|
35
|
+
<table width="100%">
|
|
36
|
+
<tbody>
|
|
37
|
+
{-{-PRODUCT_ORIGINAL_PRICE-}-}
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
40
|
+
</td>
|
|
41
|
+
<td class="product-price-container vertical-price" data-slot-4 style="display: none;">
|
|
42
|
+
<table class="product-price-class" width="100%" data-slot-4>
|
|
43
|
+
<tbody>
|
|
44
|
+
{-{-PRODUCT_PRICE-}-}
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
<table class="product-original-price-class product-original-price-container"
|
|
48
|
+
width="100%" data-slot-5>
|
|
49
|
+
<tbody>
|
|
50
|
+
{-{-PRODUCT_ORIGINAL_PRICE-}-}
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
</td>
|
|
54
|
+
<td class="product-button-class" data-slot-6>
|
|
55
|
+
<table width="100%">
|
|
56
|
+
<tbody>
|
|
57
|
+
{-{-PRODUCT_BUTTON-}-}
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
</tbody>
|
|
53
63
|
</table>
|
|
54
64
|
</td>
|
|
55
65
|
</tr>
|