@useinsider/guido 2.0.0-beta.6e688eb → 2.0.0-beta.782343a
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 +3 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- package/dist/composables/useStripo.js +40 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +13 -4
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.js → cardBackground/index.js} +2 -2
- package/dist/extensions/Blocks/Recommendation/{cardCompositionControl.js → controls/cardComposition/index.js} +18 -26
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/{control.js → controls/main/index.js} +44 -25
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/{spacingControl.js → spacing/index.js} +57 -62
- package/dist/extensions/Blocks/Recommendation/extension.js +37 -17
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -10
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +17 -16
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +62 -87
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -286
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +6 -10
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +19 -589
- package/dist/src/extensions/Blocks/Recommendation/{control.d.ts → controls/main/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +2 -5
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/stores/config.d.ts +17 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
2
|
var S = (a, s, e) => s in a ? p(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
|
|
3
3
|
var u = (a, s, e) => S(a, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import { currencyDecimalCounts as _, currencyOperators as C, currencyLocationMaps as R } from "
|
|
5
|
-
import { UEAttr as O, ModificationDescription as g } from "
|
|
6
|
-
import { CommonControl as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
4
|
+
import { currencyDecimalCounts as _, currencyOperators as C, currencyLocationMaps as R } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
5
|
+
import { UEAttr as O, ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as N } from "../../../common-control.js";
|
|
7
|
+
import { CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as U } from "../../store/recommendation.js";
|
|
9
|
+
import { prepareProductRows as f } from "../../templates/blockTemplate.js";
|
|
10
|
+
import { DEFAULT_CARD_COMPOSITION as d, getDefaultProducts as L } from "../../templates/templateUtils.js";
|
|
11
|
+
import { useDebounceFn as T } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const A = "ui-elements-recommendation-block", t = {
|
|
12
13
|
ALGORITHM: "strategy",
|
|
13
14
|
PRODUCT_IDS: "productIds",
|
|
14
15
|
LOCALE: "language",
|
|
@@ -23,10 +24,10 @@ const f = "ui-elements-recommendation-block", t = {
|
|
|
23
24
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
24
25
|
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
25
26
|
};
|
|
26
|
-
class
|
|
27
|
+
class w extends N {
|
|
27
28
|
constructor() {
|
|
28
29
|
super(...arguments);
|
|
29
|
-
u(this, "store",
|
|
30
|
+
u(this, "store", U());
|
|
30
31
|
u(this, "storeUnsubscription", () => {
|
|
31
32
|
});
|
|
32
33
|
u(this, "addFilterListener", () => {
|
|
@@ -37,7 +38,7 @@ class Y extends U {
|
|
|
37
38
|
}, 500));
|
|
38
39
|
}
|
|
39
40
|
getId() {
|
|
40
|
-
return
|
|
41
|
+
return A;
|
|
41
42
|
}
|
|
42
43
|
getTemplate() {
|
|
43
44
|
return `
|
|
@@ -52,12 +53,17 @@ class Y extends U {
|
|
|
52
53
|
`;
|
|
53
54
|
}
|
|
54
55
|
async onRender() {
|
|
55
|
-
await Promise.
|
|
56
|
+
(await Promise.allSettled([
|
|
56
57
|
this.store.fetchRecommendationFilters(),
|
|
57
58
|
this.store.fetchRecommendationCreateData(),
|
|
58
59
|
this.store.fetchRecommendationProducts()
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
])).forEach((o, i) => {
|
|
61
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${[
|
|
62
|
+
"fetchRecommendationFilters",
|
|
63
|
+
"fetchRecommendationCreateData",
|
|
64
|
+
"fetchRecommendationProducts"
|
|
65
|
+
][i]} failed`, o.reason);
|
|
66
|
+
}), this._listenStateUpdates(), this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
|
|
61
67
|
}
|
|
62
68
|
onDestroy() {
|
|
63
69
|
var e;
|
|
@@ -227,12 +233,10 @@ class Y extends U {
|
|
|
227
233
|
_regenerateProductRows() {
|
|
228
234
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
229
235
|
return;
|
|
230
|
-
const e = this.currentNode.querySelector(
|
|
231
|
-
if (!e)
|
|
232
|
-
console.error("Could not find container table for product rows");
|
|
236
|
+
const e = this.currentNode.querySelector(E);
|
|
237
|
+
if (!e)
|
|
233
238
|
return;
|
|
234
|
-
}
|
|
235
|
-
const o = this.store.recommendationProducts.length > 0 ? this.store.recommendationProducts : L(), { cardsInRow: i } = this.store.recommendationConfigs, n = this._getCardComposition(), r = E(o, i, n);
|
|
239
|
+
const o = this.store.recommendationProducts.length > 0 ? this.store.recommendationProducts : L(), { cardsInRow: i } = this.store.recommendationConfigs, n = this._getCardComposition(), r = f(o, i, n);
|
|
236
240
|
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(r).apply(new g("Updated product")), this._reapplySpacing();
|
|
237
241
|
}
|
|
238
242
|
/**
|
|
@@ -295,16 +299,31 @@ class Y extends U {
|
|
|
295
299
|
_listenToFormUpdates() {
|
|
296
300
|
var o;
|
|
297
301
|
this.api.onValueChanged(t.ALGORITHM, (i) => {
|
|
298
|
-
|
|
299
|
-
|
|
302
|
+
const n = i;
|
|
303
|
+
this._onDataChange(t.ALGORITHM, n), this._setProductIdsVisibility();
|
|
304
|
+
}), this.api.onValueChanged(t.PRODUCT_IDS, (i) => {
|
|
305
|
+
this._onDataChange(t.PRODUCT_IDS, i.split(",") || []);
|
|
306
|
+
}), this.api.onValueChanged(t.LOCALE, (i) => {
|
|
307
|
+
this._onDataChange(t.LOCALE, i);
|
|
308
|
+
}), this.api.onValueChanged(t.CURRENCY, (i) => {
|
|
309
|
+
this._onCurrencyChange(i);
|
|
310
|
+
}), [
|
|
300
311
|
t.CURRENCY_LOCATION,
|
|
301
312
|
t.CURRENCY_SYMBOL,
|
|
302
313
|
t.CURRENCY_THOUSAND_SEPARATOR,
|
|
303
314
|
t.CURRENCY_DECIMAL_SEPARATOR,
|
|
304
315
|
t.CURRENCY_DECIMAL_COUNT
|
|
305
316
|
].forEach((i) => {
|
|
306
|
-
this.api.onValueChanged(i, (n) =>
|
|
307
|
-
|
|
317
|
+
this.api.onValueChanged(i, (n) => {
|
|
318
|
+
this._onCurrencyConfigChange(i, n);
|
|
319
|
+
});
|
|
320
|
+
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => {
|
|
321
|
+
this._onDataChange(t.PRODUCT_COUNT, i.toString());
|
|
322
|
+
}), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => {
|
|
323
|
+
this._onDataChange(t.PRODUCT_IN_ROW, i);
|
|
324
|
+
}), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => {
|
|
325
|
+
this._onDataChange(t.SHUFFLE_PRODUCTS, i);
|
|
326
|
+
}), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (o = this.addFilterButton) == null || o.addEventListener("click", this.addFilterListener);
|
|
308
327
|
}
|
|
309
328
|
_listenStateUpdates() {
|
|
310
329
|
this.storeUnsubscription = this.store.$subscribe((e) => {
|
|
@@ -316,6 +335,6 @@ class Y extends U {
|
|
|
316
335
|
}
|
|
317
336
|
}
|
|
318
337
|
export {
|
|
319
|
-
|
|
320
|
-
|
|
338
|
+
A as CONTROL_BLOCK_ID,
|
|
339
|
+
w as RecommendationBlockControl
|
|
321
340
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as l, createTextStyleControl as C, createTextSizeControl as c, createTextColorControl as N, createTextAlignControl as a } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { NameTextTrimControl as i } from "./textTrim.js";
|
|
6
|
+
const m = a(
|
|
7
|
+
t.NAME_ALIGN,
|
|
8
|
+
o.NAME,
|
|
9
|
+
r
|
|
10
|
+
), A = N(
|
|
11
|
+
t.NAME_COLOR,
|
|
12
|
+
o.NAME,
|
|
13
|
+
r
|
|
14
|
+
), E = c(
|
|
15
|
+
t.NAME_SIZE,
|
|
16
|
+
o.NAME,
|
|
17
|
+
r
|
|
18
|
+
), M = C(
|
|
19
|
+
t.NAME_STYLE,
|
|
20
|
+
o.NAME,
|
|
21
|
+
r
|
|
22
|
+
), s = l(
|
|
23
|
+
t.NAME_FONT_FAMILY,
|
|
24
|
+
o.NAME,
|
|
25
|
+
r
|
|
26
|
+
), d = e(
|
|
27
|
+
t.NAME_BACKGROUND,
|
|
28
|
+
o.NAME,
|
|
29
|
+
r
|
|
30
|
+
), T = n(
|
|
31
|
+
t.NAME_PADDINGS,
|
|
32
|
+
o.NAME,
|
|
33
|
+
r
|
|
34
|
+
), F = {
|
|
35
|
+
align: m,
|
|
36
|
+
color: A,
|
|
37
|
+
size: E,
|
|
38
|
+
style: M,
|
|
39
|
+
fontFamily: s,
|
|
40
|
+
background: d,
|
|
41
|
+
paddings: T,
|
|
42
|
+
textTrim: i
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
F as NameControls
|
|
46
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as c } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as m } from "../../constants/selectors.js";
|
|
6
|
+
const s = {
|
|
7
|
+
TEXT_TRIM_ENABLED: "textTrimEnabled"
|
|
8
|
+
}, r = "text-trim-enabled";
|
|
9
|
+
class p extends c {
|
|
10
|
+
getId() {
|
|
11
|
+
return d.NAME_TEXT_TRIM;
|
|
12
|
+
}
|
|
13
|
+
getTemplate() {
|
|
14
|
+
return `
|
|
15
|
+
<div class="name-text-trim-control-container">
|
|
16
|
+
${this._GuTwoColumns([
|
|
17
|
+
this._GuLabel({ text: "Trim Long Text" }),
|
|
18
|
+
this._GuToggle(s.TEXT_TRIM_ENABLED)
|
|
19
|
+
])}
|
|
20
|
+
</div>
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
onRender() {
|
|
24
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
25
|
+
}
|
|
26
|
+
onTemplateNodeUpdated(t) {
|
|
27
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
28
|
+
}
|
|
29
|
+
_setFormValues() {
|
|
30
|
+
const t = this._getCurrentTrimState();
|
|
31
|
+
this.api.updateValues({
|
|
32
|
+
[s.TEXT_TRIM_ENABLED]: t
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
_getCurrentTrimState() {
|
|
36
|
+
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
37
|
+
return !1;
|
|
38
|
+
if (this.currentNode.hasClass(r))
|
|
39
|
+
return !0;
|
|
40
|
+
const t = this.currentNode.closest(m);
|
|
41
|
+
if (!t)
|
|
42
|
+
return !1;
|
|
43
|
+
const e = t.querySelector(
|
|
44
|
+
`[esd-extension-block-id="${a.NAME}"]`
|
|
45
|
+
);
|
|
46
|
+
return e && "hasClass" in e ? e.hasClass(r) : !1;
|
|
47
|
+
}
|
|
48
|
+
_onTextTrimChange(t) {
|
|
49
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
50
|
+
return;
|
|
51
|
+
const e = this.currentNode.closest(m);
|
|
52
|
+
if (!e || !("querySelectorAll" in e))
|
|
53
|
+
return;
|
|
54
|
+
const i = Array.from(
|
|
55
|
+
e.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
|
|
56
|
+
);
|
|
57
|
+
if (!i.length)
|
|
58
|
+
return;
|
|
59
|
+
const o = this.api.getDocumentModifier();
|
|
60
|
+
i.forEach((n) => {
|
|
61
|
+
t ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
|
|
62
|
+
}), o.apply(
|
|
63
|
+
new l(
|
|
64
|
+
t ? "Enable product name text trimming" : "Disable product name text trimming"
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
_listenToFormUpdates() {
|
|
69
|
+
this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (t) => {
|
|
70
|
+
this._onTextTrimChange(t);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
p as NameTextTrimControl
|
|
76
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createPaddingsControl as r, createTextBackgroundColorControl as C, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as c, createTextColorControl as _, createTextAlignControl as I } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const O = I(
|
|
6
|
+
t.OLD_PRICE_ALIGN,
|
|
7
|
+
o.OLD_PRICE,
|
|
8
|
+
n
|
|
9
|
+
), R = _(
|
|
10
|
+
t.OLD_PRICE_COLOR,
|
|
11
|
+
o.OLD_PRICE,
|
|
12
|
+
n
|
|
13
|
+
), a = c(
|
|
14
|
+
t.OLD_PRICE_SIZE,
|
|
15
|
+
o.OLD_PRICE,
|
|
16
|
+
n
|
|
17
|
+
), i = l(
|
|
18
|
+
t.OLD_PRICE_STYLE,
|
|
19
|
+
o.OLD_PRICE,
|
|
20
|
+
n
|
|
21
|
+
), E = e(
|
|
22
|
+
t.OLD_PRICE_FONT_FAMILY,
|
|
23
|
+
o.OLD_PRICE,
|
|
24
|
+
n
|
|
25
|
+
), L = C(
|
|
26
|
+
t.OLD_PRICE_BACKGROUND,
|
|
27
|
+
o.OLD_PRICE,
|
|
28
|
+
n
|
|
29
|
+
), P = r(
|
|
30
|
+
t.OLD_PRICE_PADDINGS,
|
|
31
|
+
o.OLD_PRICE,
|
|
32
|
+
n
|
|
33
|
+
), T = {
|
|
34
|
+
align: O,
|
|
35
|
+
color: R,
|
|
36
|
+
size: a,
|
|
37
|
+
style: i,
|
|
38
|
+
fontFamily: E,
|
|
39
|
+
background: L,
|
|
40
|
+
paddings: P
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
T as OldPriceControls
|
|
44
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as C, createTextStyleControl as O, createTextSizeControl as S, createTextColorControl as I, createTextAlignControl as N } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { OmnibusDiscountTextAfterControl as l } from "./textAfter.js";
|
|
6
|
+
import { OmnibusDiscountTextBeforeControl as U } from "./textBefore.js";
|
|
7
|
+
const i = N(
|
|
8
|
+
t.OMNIBUS_DISCOUNT_ALIGN,
|
|
9
|
+
o.OMNIBUS_DISCOUNT,
|
|
10
|
+
r
|
|
11
|
+
), T = I(
|
|
12
|
+
t.OMNIBUS_DISCOUNT_COLOR,
|
|
13
|
+
o.OMNIBUS_DISCOUNT,
|
|
14
|
+
r
|
|
15
|
+
), c = S(
|
|
16
|
+
t.OMNIBUS_DISCOUNT_SIZE,
|
|
17
|
+
o.OMNIBUS_DISCOUNT,
|
|
18
|
+
r
|
|
19
|
+
), _ = O(
|
|
20
|
+
t.OMNIBUS_DISCOUNT_STYLE,
|
|
21
|
+
o.OMNIBUS_DISCOUNT,
|
|
22
|
+
r
|
|
23
|
+
), m = C(
|
|
24
|
+
t.OMNIBUS_DISCOUNT_FONT_FAMILY,
|
|
25
|
+
o.OMNIBUS_DISCOUNT,
|
|
26
|
+
r
|
|
27
|
+
), s = e(
|
|
28
|
+
t.OMNIBUS_DISCOUNT_BACKGROUND,
|
|
29
|
+
o.OMNIBUS_DISCOUNT,
|
|
30
|
+
r
|
|
31
|
+
), B = n(
|
|
32
|
+
t.OMNIBUS_DISCOUNT_PADDINGS,
|
|
33
|
+
o.OMNIBUS_DISCOUNT,
|
|
34
|
+
r
|
|
35
|
+
), g = {
|
|
36
|
+
align: i,
|
|
37
|
+
color: T,
|
|
38
|
+
size: c,
|
|
39
|
+
style: _,
|
|
40
|
+
fontFamily: m,
|
|
41
|
+
background: s,
|
|
42
|
+
paddings: B,
|
|
43
|
+
textBefore: U,
|
|
44
|
+
textAfter: l
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
g as OmnibusDiscountControls
|
|
48
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as a } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const i = "data-text-after", u = "", p = ".omnibus-text-after";
|
|
8
|
+
class b extends a {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_AFTER;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -42,11 +44,11 @@ class E extends m {
|
|
|
42
44
|
_onTextChange(t) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const e = this.currentNode.closest(
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
46
48
|
if (!e || !("querySelectorAll" in e))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
e.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_DISCOUNT}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class E extends m {
|
|
|
55
57
|
o.modifyHtml(s).setAttribute(i, t);
|
|
56
58
|
const r = s.querySelector(p);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = f(r, t);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text after"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
|
|
@@ -67,5 +69,5 @@ class E extends m {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
b as OmnibusDiscountTextAfterControl
|
|
71
73
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const i = "data-text-before", u = "", p = ".omnibus-text-before";
|
|
8
|
+
class B extends l {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -42,11 +44,11 @@ class C extends a {
|
|
|
42
44
|
_onTextChange(e) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const t = this.currentNode.closest(
|
|
47
|
+
const t = this.currentNode.closest(T);
|
|
46
48
|
if (!t || !("querySelectorAll" in t))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_DISCOUNT}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class C extends a {
|
|
|
55
57
|
o.modifyHtml(s).setAttribute(i, e);
|
|
56
58
|
const r = s.querySelector(p);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = f(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new c("Update omnibus discount text before"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
|
|
@@ -67,5 +69,5 @@ class C extends a {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
B as OmnibusDiscountTextBeforeControl
|
|
71
73
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as C, createTextStyleControl as I, createTextSizeControl as l, createTextColorControl as i, createTextAlignControl as c } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { OmnibusPriceTextAfterControl as O } from "./textAfter.js";
|
|
6
|
+
import { OmnibusPriceTextBeforeControl as _ } from "./textBefore.js";
|
|
7
|
+
const m = c(
|
|
8
|
+
t.OMNIBUS_PRICE_ALIGN,
|
|
9
|
+
o.OMNIBUS_PRICE,
|
|
10
|
+
r
|
|
11
|
+
), S = i(
|
|
12
|
+
t.OMNIBUS_PRICE_COLOR,
|
|
13
|
+
o.OMNIBUS_PRICE,
|
|
14
|
+
r
|
|
15
|
+
), B = l(
|
|
16
|
+
t.OMNIBUS_PRICE_SIZE,
|
|
17
|
+
o.OMNIBUS_PRICE,
|
|
18
|
+
r
|
|
19
|
+
), N = I(
|
|
20
|
+
t.OMNIBUS_PRICE_STYLE,
|
|
21
|
+
o.OMNIBUS_PRICE,
|
|
22
|
+
r
|
|
23
|
+
), P = C(
|
|
24
|
+
t.OMNIBUS_PRICE_FONT_FAMILY,
|
|
25
|
+
o.OMNIBUS_PRICE,
|
|
26
|
+
r
|
|
27
|
+
), R = e(
|
|
28
|
+
t.OMNIBUS_PRICE_BACKGROUND,
|
|
29
|
+
o.OMNIBUS_PRICE,
|
|
30
|
+
r
|
|
31
|
+
), a = n(
|
|
32
|
+
t.OMNIBUS_PRICE_PADDINGS,
|
|
33
|
+
o.OMNIBUS_PRICE,
|
|
34
|
+
r
|
|
35
|
+
), f = {
|
|
36
|
+
align: m,
|
|
37
|
+
color: S,
|
|
38
|
+
size: B,
|
|
39
|
+
style: N,
|
|
40
|
+
fontFamily: P,
|
|
41
|
+
background: R,
|
|
42
|
+
paddings: a,
|
|
43
|
+
textBefore: _,
|
|
44
|
+
textAfter: O
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
f as OmnibusPriceControls
|
|
48
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as a } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const s = "data-text-after", m = "", p = ".omnibus-text-after";
|
|
8
|
+
class N extends a {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_AFTER;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -35,18 +37,18 @@ class C extends m {
|
|
|
35
37
|
}
|
|
36
38
|
_getCurrentText() {
|
|
37
39
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
38
|
-
return
|
|
40
|
+
return m;
|
|
39
41
|
const t = this.currentNode.getAttribute(s);
|
|
40
|
-
return t === null ?
|
|
42
|
+
return t === null ? m : t;
|
|
41
43
|
}
|
|
42
44
|
_onTextChange(t) {
|
|
43
45
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
44
46
|
return;
|
|
45
|
-
const e = this.currentNode.closest(
|
|
47
|
+
const e = this.currentNode.closest(T);
|
|
46
48
|
if (!e || !("querySelectorAll" in e))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
e.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_PRICE}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class C extends m {
|
|
|
55
57
|
r.modifyHtml(i).setAttribute(s, t);
|
|
56
58
|
const o = i.querySelector(p);
|
|
57
59
|
if (o) {
|
|
58
|
-
const u =
|
|
60
|
+
const u = f(o, t);
|
|
59
61
|
r.modifyHtml(o).setInnerHtml(u);
|
|
60
62
|
}
|
|
61
|
-
}), r.apply(new
|
|
63
|
+
}), r.apply(new c("Update omnibus price text after"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusPriceTextAfter", (t) => {
|
|
@@ -67,5 +69,5 @@ class C extends m {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
N as OmnibusPriceTextAfterControl
|
|
71
73
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
|
+
import { CONTAINER_SELECTOR as p } from "../../constants/selectors.js";
|
|
6
|
+
import { preserveTextStyles as T } from "../../utils/preserveTextStyles.js";
|
|
7
|
+
const s = "data-text-before", c = "Lowest 30-day price: ", f = ".omnibus-text-before";
|
|
8
|
+
class N extends l {
|
|
7
9
|
getId() {
|
|
8
|
-
return
|
|
10
|
+
return d.OMNIBUS_PRICE_TEXT_BEFORE;
|
|
9
11
|
}
|
|
10
12
|
getTemplate() {
|
|
11
13
|
return `
|
|
@@ -46,7 +48,7 @@ class C extends a {
|
|
|
46
48
|
if (!t || !("querySelectorAll" in t))
|
|
47
49
|
return;
|
|
48
50
|
const n = Array.from(
|
|
49
|
-
t.querySelectorAll(`[esd-extension-block-id="${
|
|
51
|
+
t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_PRICE}"]`)
|
|
50
52
|
);
|
|
51
53
|
if (!n.length)
|
|
52
54
|
return;
|
|
@@ -55,10 +57,10 @@ class C extends a {
|
|
|
55
57
|
o.modifyHtml(i).setAttribute(s, e);
|
|
56
58
|
const r = i.querySelector(f);
|
|
57
59
|
if (r) {
|
|
58
|
-
const
|
|
59
|
-
o.modifyHtml(r).setInnerHtml(
|
|
60
|
+
const m = T(r, e);
|
|
61
|
+
o.modifyHtml(r).setInnerHtml(m);
|
|
60
62
|
}
|
|
61
|
-
}), o.apply(new
|
|
63
|
+
}), o.apply(new u("Update omnibus price text before"));
|
|
62
64
|
}
|
|
63
65
|
_listenToFormUpdates() {
|
|
64
66
|
this.api.onValueChanged("omnibusPriceTextBefore", (e) => {
|
|
@@ -67,5 +69,5 @@ class C extends a {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
N as OmnibusPriceTextBeforeControl
|
|
71
73
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createPaddingsControl as r, createTextBackgroundColorControl as C, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as c, createTextColorControl as I, createTextAlignControl as R } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const a = R(
|
|
6
|
+
t.PRICE_ALIGN,
|
|
7
|
+
o.PRICE,
|
|
8
|
+
n
|
|
9
|
+
), i = I(
|
|
10
|
+
t.PRICE_COLOR,
|
|
11
|
+
o.PRICE,
|
|
12
|
+
n
|
|
13
|
+
), E = c(
|
|
14
|
+
t.PRICE_SIZE,
|
|
15
|
+
o.PRICE,
|
|
16
|
+
n
|
|
17
|
+
), P = l(
|
|
18
|
+
t.PRICE_STYLE,
|
|
19
|
+
o.PRICE,
|
|
20
|
+
n
|
|
21
|
+
), m = e(
|
|
22
|
+
t.PRICE_FONT_FAMILY,
|
|
23
|
+
o.PRICE,
|
|
24
|
+
n
|
|
25
|
+
), s = C(
|
|
26
|
+
t.PRICE_BACKGROUND,
|
|
27
|
+
o.PRICE,
|
|
28
|
+
n
|
|
29
|
+
), d = r(
|
|
30
|
+
t.PRICE_PADDINGS,
|
|
31
|
+
o.PRICE,
|
|
32
|
+
n
|
|
33
|
+
), x = {
|
|
34
|
+
align: a,
|
|
35
|
+
color: i,
|
|
36
|
+
size: E,
|
|
37
|
+
style: P,
|
|
38
|
+
fontFamily: m,
|
|
39
|
+
background: s,
|
|
40
|
+
paddings: d
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
x as PriceControls
|
|
44
|
+
};
|