@useinsider/guido 3.17.0-beta.58179dc → 3.17.0-beta.dc7f4d2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +78 -76
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +74 -43
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +46 -23
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +48 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +2 -0
- package/dist/composables/useSave.js +84 -41
- package/dist/composables/useSaveValidation.js +279 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/index.js +8 -9
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +24 -29
- package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
- package/dist/config/migrator/recommendationMigrator.js +15 -18
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +20 -49
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +22 -23
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +28 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +238 -306
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +8 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -1
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +33 -26
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
- package/dist/guido.css +1 -1
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/stores/config.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/static/styles/customEditorStyle.css.js +1 -3
- package/dist/stores/config.js +13 -6
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/templatePreparation.js +28 -25
- package/package.json +1 -1
- package/dist/config/migrator/recommendationTitleMigrator.js +0 -119
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
- package/dist/extensions/Blocks/Recommendation/utils/legacyTitle.js +0 -20
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyTitle.d.ts +0 -20
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
2
|
import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
3
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as p } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as l } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -12,30 +12,37 @@ const T = [
|
|
|
12
12
|
pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
13
13
|
messageKey: "unsubscription-preference.duplicate-pref-center"
|
|
14
14
|
}
|
|
15
|
-
], g = "unsubscription-preference.duplicate-both",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
|
|
16
|
+
function m(r) {
|
|
17
|
+
const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
|
|
18
|
+
return s.querySelectorAll(i).forEach((n) => {
|
|
19
|
+
const e = Number(n.getAttribute(a.PAGE_TYPE));
|
|
20
|
+
t.set(e, (t.get(e) ?? 0) + 1);
|
|
21
|
+
}), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
|
|
22
|
+
}
|
|
23
|
+
function b(r) {
|
|
24
|
+
const s = new DOMParser().parseFromString(r, "text/html");
|
|
25
|
+
return Array.from(s.querySelectorAll(i)).filter((t) => {
|
|
26
|
+
const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
|
|
27
|
+
return !n || !e;
|
|
28
|
+
}).length;
|
|
29
|
+
}
|
|
30
|
+
const y = () => {
|
|
31
|
+
const { showToaster: r } = p(), s = l();
|
|
32
|
+
return { validateUnsubscribeBlockUniqueness: (e) => {
|
|
33
|
+
const o = m(e);
|
|
34
|
+
return o.length ? (r({
|
|
35
|
+
type: c.Error,
|
|
36
|
+
message: s(o.length > 1 ? g : o[0].messageKey)
|
|
27
37
|
}), !1) : !0;
|
|
28
|
-
}, validateUnsubscribeBlockHasTemplate: (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return !e || !s;
|
|
33
|
-
}) ? (c({
|
|
34
|
-
type: i.Warning,
|
|
35
|
-
message: p(b)
|
|
36
|
-
}), !1) : !0;
|
|
37
|
-
} };
|
|
38
|
+
}, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
|
|
39
|
+
type: c.Warning,
|
|
40
|
+
message: s(E)
|
|
41
|
+
}), !1) };
|
|
38
42
|
};
|
|
39
43
|
export {
|
|
40
|
-
|
|
44
|
+
E as EMPTY_BLOCK_KEY,
|
|
45
|
+
b as countUnsubBlocksWithoutPage,
|
|
46
|
+
m as findDuplicateUnsubPageTypes,
|
|
47
|
+
y as useUnsubscribeBlockValidator
|
|
41
48
|
};
|
|
@@ -2,15 +2,14 @@ import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
|
2
2
|
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
4
|
import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
|
|
5
|
-
import { migrateRadioButton as
|
|
6
|
-
import { migrateRecommendation as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return m = t(m), m = n(m), m = await f(m), m = i(m), m = c(m, r), m = g(m), m = e(m), m = a(m), m = p(m), m;
|
|
5
|
+
import { migrateRadioButton as c } from "./radioButtonMigrator.js";
|
|
6
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
7
|
+
import { migrateSocialIcons as n } from "./socialIconMigrator.js";
|
|
8
|
+
import { migrateUnsubscribe as p } from "./unsubscribeMigrator.js";
|
|
9
|
+
const x = async (r, o = {}) => {
|
|
10
|
+
let m = r;
|
|
11
|
+
return m = t(m), m = c(m), m = await p(m), m = i(m), m = g(m, o), m = e(m), m = a(m), m = n(m), m;
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
x as migrate
|
|
16
15
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
2
|
-
import {
|
|
3
|
-
import { mapTextTheme as
|
|
4
|
-
const C = "__title__",
|
|
5
|
-
function
|
|
2
|
+
import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
|
+
import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
|
|
4
|
+
const C = "__title__", a = "product_attribute.";
|
|
5
|
+
function N(r) {
|
|
6
6
|
const t = r.variable ?? "";
|
|
7
7
|
switch (t) {
|
|
8
8
|
case "p_recommendation_title":
|
|
9
9
|
return { key: C, kind: "title" };
|
|
10
10
|
case "p_image":
|
|
11
|
-
return { key:
|
|
11
|
+
return { key: y, kind: "image" };
|
|
12
12
|
case "p_name":
|
|
13
|
-
return { key: E, kind: "text" };
|
|
14
|
-
case "p_price":
|
|
15
13
|
return { key: h, kind: "text" };
|
|
14
|
+
case "p_price":
|
|
15
|
+
return { key: R, kind: "text" };
|
|
16
16
|
case "p_original_price":
|
|
17
17
|
return { key: f, kind: "text" };
|
|
18
18
|
case "p_omnibus_price":
|
|
19
19
|
return { key: x, kind: "text" };
|
|
20
20
|
case "p_omnibus_discount":
|
|
21
|
-
return { key:
|
|
21
|
+
return { key: A, kind: "text" };
|
|
22
22
|
case "p_button":
|
|
23
|
-
return { key:
|
|
23
|
+
return { key: k, kind: "button" };
|
|
24
24
|
default:
|
|
25
25
|
if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
|
|
26
|
-
const o = r.value ?? "", s = o.startsWith(
|
|
26
|
+
const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
|
|
27
27
|
if (!s)
|
|
28
28
|
return null;
|
|
29
|
-
const e = o || `${
|
|
29
|
+
const e = o || `${a}${s}`;
|
|
30
30
|
return {
|
|
31
|
-
key: `${
|
|
31
|
+
key: `${l}${e}`,
|
|
32
32
|
kind: "custom",
|
|
33
33
|
customAttrName: s,
|
|
34
34
|
customAttrValue: e
|
|
@@ -41,7 +41,7 @@ function _(r) {
|
|
|
41
41
|
const t = p.indexOf(r);
|
|
42
42
|
return t === -1 ? Number.POSITIVE_INFINITY : t;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function S(r) {
|
|
45
45
|
const t = {
|
|
46
46
|
composition: [],
|
|
47
47
|
visibility: { ...I },
|
|
@@ -54,10 +54,10 @@ function V(r) {
|
|
|
54
54
|
return t.composition = [...p], t;
|
|
55
55
|
const o = [];
|
|
56
56
|
r.forEach((e, i) => {
|
|
57
|
-
const n =
|
|
57
|
+
const n = N(e);
|
|
58
58
|
if (n) {
|
|
59
59
|
if (n.kind === "title") {
|
|
60
|
-
t.titleVariable = e
|
|
60
|
+
t.titleVariable = e;
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
o.push({
|
|
@@ -82,20 +82,20 @@ function V(r) {
|
|
|
82
82
|
const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
|
|
83
83
|
switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
|
|
84
84
|
case "image":
|
|
85
|
-
s[i] =
|
|
85
|
+
s[i] = b(c.theme);
|
|
86
86
|
break;
|
|
87
87
|
case "button":
|
|
88
|
-
s[i] =
|
|
88
|
+
s[i] = O(c.theme);
|
|
89
89
|
break;
|
|
90
90
|
case "text":
|
|
91
91
|
case "custom": {
|
|
92
|
-
const
|
|
93
|
-
s[i] =
|
|
92
|
+
const T = E(c.theme);
|
|
93
|
+
s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}), t.perElementStyles = s, t;
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
S as mapComposition
|
|
101
101
|
};
|
|
@@ -1,54 +1,49 @@
|
|
|
1
1
|
import { CURRENCY_ATTR as n, CSS_CLASS_SKIP_COMPILE as c } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
2
|
const a = "You May Also Like!";
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
3
|
+
function l(t) {
|
|
4
|
+
var o;
|
|
5
|
+
const r = t.querySelector(".ext-recommendation-title");
|
|
6
|
+
if (!r)
|
|
7
7
|
return a;
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const e = (o = r.textContent) == null ? void 0 : o.trim();
|
|
9
|
+
return e && e.length > 0 ? e : a;
|
|
10
10
|
}
|
|
11
11
|
function m(t) {
|
|
12
|
-
const
|
|
13
|
-
return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
|
|
14
|
-
}
|
|
15
|
-
function d(t) {
|
|
16
|
-
const e = [
|
|
12
|
+
const r = [
|
|
17
13
|
t,
|
|
18
14
|
...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
19
15
|
];
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
25
|
-
const u = (
|
|
26
|
-
return u && u[1] ? (
|
|
27
|
-
}),
|
|
16
|
+
let e = "";
|
|
17
|
+
return r.some((o) => {
|
|
18
|
+
const i = o.getAttribute("bgcolor");
|
|
19
|
+
if (i && i.trim())
|
|
20
|
+
return e = i.trim(), !0;
|
|
21
|
+
const u = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
|
|
22
|
+
return u && u[1] ? (e = u[1].trim(), !0) : !1;
|
|
23
|
+
}), e;
|
|
28
24
|
}
|
|
29
25
|
function C(t) {
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
26
|
+
const r = t.getAttribute(n.CURRENCY);
|
|
27
|
+
if (!r)
|
|
32
28
|
return;
|
|
33
|
-
const
|
|
29
|
+
const e = t.getAttribute(n.SYMBOL);
|
|
34
30
|
return {
|
|
35
|
-
value:
|
|
31
|
+
value: r,
|
|
36
32
|
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
37
33
|
// the currency code as the symbol.
|
|
38
|
-
...
|
|
34
|
+
...e ? { symbol: e } : {},
|
|
39
35
|
alignment: t.getAttribute(n.ALIGNMENT) ?? "",
|
|
40
36
|
decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
|
|
41
37
|
decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
|
|
42
38
|
thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
|
|
43
39
|
};
|
|
44
40
|
}
|
|
45
|
-
function
|
|
41
|
+
function d(t) {
|
|
46
42
|
return t.classList.contains(c);
|
|
47
43
|
}
|
|
48
44
|
export {
|
|
49
|
-
|
|
45
|
+
m as extractCardBgColor,
|
|
50
46
|
C as extractCurrencyFromBlock,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
g as isPartnerManagedBlock
|
|
47
|
+
l as extractTitleText,
|
|
48
|
+
d as isPartnerManagedBlock
|
|
54
49
|
};
|