@useinsider/guido 3.16.0-beta.efbb91f → 3.16.0-beta.fe1df65
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 +76 -78
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +23 -45
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useHtmlValidator.js +0 -1
- package/dist/composables/useRecommendation.js +20 -19
- package/dist/composables/useSave.js +41 -84
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendationMigrator.js +18 -15
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- 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 +23 -22
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +29 -26
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +29 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -32
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/composables/useHtmlValidator.d.ts +0 -14
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/dist/src/stores/config.d.ts +0 -5
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/stores/config.js +6 -13
- package/dist/utils/templatePreparation.js +25 -28
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -61
- package/dist/composables/useSaveValidation.js +0 -276
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
|
@@ -3,20 +3,21 @@ import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommenda
|
|
|
3
3
|
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
5
|
import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
|
+
import { useConfigStore as P } from "../stores/config.js";
|
|
8
|
+
const B = () => ({
|
|
8
9
|
calculateCardWidth: ({
|
|
9
10
|
mobileLeftPadding: a,
|
|
10
11
|
mobileRightPadding: s,
|
|
11
12
|
cardsInRow: c,
|
|
12
|
-
unresponsive:
|
|
13
|
+
unresponsive: n
|
|
13
14
|
}) => {
|
|
14
|
-
const r =
|
|
15
|
+
const r = n ? c : 1, e = a + s + (r - 1) * b;
|
|
15
16
|
return (C - e) / r;
|
|
16
17
|
},
|
|
17
18
|
getRecommendationCampaignData: (a) => {
|
|
18
|
-
const s = l(), c = Number(a),
|
|
19
|
-
if (!
|
|
19
|
+
const s = l(), c = Number(a), n = s.blockStates[c];
|
|
20
|
+
if (!n)
|
|
20
21
|
return {
|
|
21
22
|
textTrimming: !1,
|
|
22
23
|
orientation: "vertical",
|
|
@@ -29,7 +30,7 @@ const k = () => ({
|
|
|
29
30
|
discountBeforeTextValue: "",
|
|
30
31
|
discountAfterTextValue: ""
|
|
31
32
|
};
|
|
32
|
-
const { recommendationConfigs: r } =
|
|
33
|
+
const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
33
34
|
return {
|
|
34
35
|
textTrimming: r.textTrimming,
|
|
35
36
|
orientation: e,
|
|
@@ -45,7 +46,7 @@ const k = () => ({
|
|
|
45
46
|
},
|
|
46
47
|
buildCampaignUrl: (a, s) => {
|
|
47
48
|
var m;
|
|
48
|
-
const c = l(),
|
|
49
|
+
const c = l(), n = P(), r = Number(a);
|
|
49
50
|
let e;
|
|
50
51
|
if (s)
|
|
51
52
|
e = s;
|
|
@@ -53,25 +54,25 @@ const k = () => ({
|
|
|
53
54
|
const i = c.blockStates[r];
|
|
54
55
|
if (!i)
|
|
55
56
|
return "";
|
|
56
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: o } = i;
|
|
57
58
|
e = {
|
|
58
|
-
strategy:
|
|
59
|
-
language:
|
|
60
|
-
currencyCode:
|
|
61
|
-
size:
|
|
62
|
-
productIds:
|
|
63
|
-
filters:
|
|
64
|
-
shuffleProducts:
|
|
59
|
+
strategy: o.strategy,
|
|
60
|
+
language: o.language,
|
|
61
|
+
currencyCode: o.currencySettings.value,
|
|
62
|
+
size: o.size,
|
|
63
|
+
productIds: o.productIds,
|
|
64
|
+
filters: o.filters,
|
|
65
|
+
shuffleProducts: o.shuffleProducts
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
68
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
69
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
69
70
|
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
70
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(
|
|
71
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
|
|
71
72
|
const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
72
73
|
return c.recommendationCampaignUrls[a] = u, u;
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
export {
|
|
76
|
-
|
|
77
|
+
B as useRecommendation
|
|
77
78
|
};
|
|
@@ -1,94 +1,51 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useSyncModuleExtractor as O } from "./useSyncModuleExtractor.js";
|
|
7
|
-
import { ToasterTypeOptions as W } from "../enums/toaster.js";
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as k } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as B, useSaveComplete as E } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { ToasterTypeOptions as C } from "../enums/toaster.js";
|
|
8
6
|
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const n = A(), d = q(), { validateHtml: u } = K(), { validateLiquidSyntax: f } = X(), { validateCouponBlockTags: p } = Q(), { validateUnsubscribeBlockUniqueness: v, validateUnsubscribeBlockHasTemplate: y } = Y(), { callbacks: a, isFeatureEnabled: c } = L(), { extractSyncModuleData: S } = O(), { setSyncModuleUnsubscriptionPages: b } = D(), { editorSave: g, getTemplateData: w } = h(), { showToaster: H } = N(), { getBlockedDomains: V, resolveToast: C } = J(), { prepareTemplateDetails: m } = G(), { collectSaveValidationErrors: E } = M(), { isEnabled: x } = R(), k = z(), T = j(), B = F(), r = async (t, e, o) => {
|
|
21
|
-
if (!c("allowlistEnabled"))
|
|
22
|
-
return !1;
|
|
23
|
-
const i = await V(t, e);
|
|
24
|
-
if (!i.length)
|
|
25
|
-
return !1;
|
|
26
|
-
if (!o) {
|
|
27
|
-
const s = await C(i);
|
|
28
|
-
s != null && s.message && H({
|
|
29
|
-
type: W.Warning,
|
|
30
|
-
message: s.message,
|
|
31
|
-
actionButton: s.actionButton
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return !0;
|
|
35
|
-
}, P = async (t) => !p(t.compiledHtml) || !v(t.compiledHtml) || !y(t.compiledHtml) ? !1 : c("liquidSyntax") ? f(t.compiledHtml) : u(t.compiledHtml, t.dynamicContentList, !0), l = async (t, e) => {
|
|
36
|
-
if (!await g())
|
|
37
|
-
return;
|
|
38
|
-
const { unsubscribePayload: i, stripoModules: s } = S(t.rawHtml);
|
|
39
|
-
if (await b(i), t.modules = s, !e.suppress) {
|
|
40
|
-
const U = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
41
|
-
d({ ...t, ...U, silent: e.silent });
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
};
|
|
45
|
-
return { save: async (t = !1, e = !1) => {
|
|
46
|
-
var i;
|
|
7
|
+
import { useTemplatePreparation as L } from "../utils/templatePreparation.js";
|
|
8
|
+
import { useAllowlist as P } from "./useAllowlist.js";
|
|
9
|
+
import { useHtmlValidator as U } from "./useHtmlValidator.js";
|
|
10
|
+
import { useToaster as A } from "./useToaster.js";
|
|
11
|
+
import { useCouponBlockValidator as M } from "./validators/useCouponBlockValidator.js";
|
|
12
|
+
import { useLiquidValidator as h } from "./validators/useLiquidValidator.js";
|
|
13
|
+
import { useUnsubscribeBlockValidator as F } from "./validators/useUnsubscribeBlockValidator.js";
|
|
14
|
+
const $ = () => {
|
|
15
|
+
const n = B(), l = E(), { validateHtml: c } = U(), { validateLiquidSyntax: d } = h(), { validateCouponBlockTags: m } = M(), { validateUnsubscribeBlockUniqueness: u, validateUnsubscribeBlockHasTemplate: p } = F(), { callbacks: e, isFeatureEnabled: a } = k(), { extractSyncModuleData: f } = q(), { setSyncModuleUnsubscriptionPages: v } = D(), { editorSave: S } = T(), { showToaster: b } = A(), { getBlockedDomains: w, resolveToast: V } = P();
|
|
16
|
+
return { save: async (y = !1, s = !1) => {
|
|
17
|
+
var r;
|
|
47
18
|
n();
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
if (s.length) {
|
|
55
|
-
k.open(s, "save");
|
|
19
|
+
const { prepareTemplateDetails: H } = L(), t = await H();
|
|
20
|
+
if (!m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
|
|
21
|
+
return;
|
|
22
|
+
if (a("liquidSyntax")) {
|
|
23
|
+
if (!await d(t.compiledHtml))
|
|
56
24
|
return;
|
|
57
|
-
|
|
58
|
-
} else if (!await P(o))
|
|
25
|
+
} else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
|
|
59
26
|
return;
|
|
60
|
-
if (
|
|
61
|
-
return l(o, { silent: e, suppress: t });
|
|
62
|
-
}, saveWithErrors: async () => {
|
|
63
|
-
var e;
|
|
64
|
-
if (B.isTransactional)
|
|
27
|
+
if ((r = e.value) != null && r.externalValidation && !await e.value.externalValidation(t))
|
|
65
28
|
return;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rawHtml: t,
|
|
79
|
-
css: e,
|
|
80
|
-
ampHtml: "",
|
|
81
|
-
ampErrors: [],
|
|
82
|
-
modules: [],
|
|
83
|
-
recommendation: { campaignUrls: {}, configs: {} },
|
|
84
|
-
unsubscribe: {
|
|
85
|
-
status: o.length > 0,
|
|
86
|
-
config: o
|
|
29
|
+
if (a("allowlistEnabled")) {
|
|
30
|
+
const i = await w(t.compiledHtml, t.css);
|
|
31
|
+
if (i.length) {
|
|
32
|
+
if (!s) {
|
|
33
|
+
const o = await V(i);
|
|
34
|
+
o != null && o.message && b({
|
|
35
|
+
type: C.Warning,
|
|
36
|
+
message: o.message,
|
|
37
|
+
actionButton: o.actionButton
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
87
41
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
42
|
+
}
|
|
43
|
+
if (!await S())
|
|
44
|
+
return;
|
|
45
|
+
const { unsubscribePayload: g, stripoModules: x } = f(t.rawHtml);
|
|
46
|
+
return await v(g), t.modules = x, y || l({ ...t, silent: s }), t;
|
|
90
47
|
} };
|
|
91
48
|
};
|
|
92
49
|
export {
|
|
93
|
-
|
|
50
|
+
$ as useSave
|
|
94
51
|
};
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { COUPON_PLACEHOLDER_DEFAULT as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
]),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), !1) : !0 };
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
|
+
import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
3
|
+
import { useToaster as m } from "../useToaster.js";
|
|
4
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
5
|
+
const u = /* @__PURE__ */ new Set([
|
|
6
|
+
i,
|
|
7
|
+
l
|
|
8
|
+
]), A = () => {
|
|
9
|
+
const { showToaster: t } = m(), r = p();
|
|
10
|
+
return { validateCouponBlockTags: (e) => {
|
|
11
|
+
const n = new DOMParser().parseFromString(e, "text/html");
|
|
12
|
+
return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
|
|
13
|
+
var o;
|
|
14
|
+
const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
|
|
15
|
+
return !u.has(a);
|
|
16
|
+
}) ? (t({
|
|
17
|
+
type: c.Warning,
|
|
18
|
+
message: r("newsletter.coupon-tag-modified")
|
|
19
|
+
}), !1) : !0;
|
|
20
|
+
} };
|
|
22
21
|
};
|
|
23
22
|
export {
|
|
24
|
-
|
|
25
|
-
u as findInvalidCouponBlocks,
|
|
26
|
-
T as useCouponBlockValidator
|
|
23
|
+
A as useCouponBlockValidator
|
|
27
24
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as i } 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 l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as E } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as m } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -12,37 +12,30 @@ 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
|
-
|
|
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)
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
|
|
16
|
+
const { showToaster: c } = E(), p = m();
|
|
17
|
+
return { validateUnsubscribeBlockUniqueness: (n) => {
|
|
18
|
+
const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
|
|
19
|
+
o.querySelectorAll(l).forEach((e) => {
|
|
20
|
+
const s = Number(e.getAttribute(a.PAGE_TYPE));
|
|
21
|
+
r.set(s, (r.get(s) ?? 0) + 1);
|
|
22
|
+
});
|
|
23
|
+
const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
|
|
24
|
+
return t.length ? (c({
|
|
25
|
+
type: i.Error,
|
|
26
|
+
message: p(t.length > 1 ? g : t[0])
|
|
37
27
|
}), !1) : !0;
|
|
38
|
-
}, validateUnsubscribeBlockHasTemplate: (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
}, validateUnsubscribeBlockHasTemplate: (n) => {
|
|
29
|
+
const o = new DOMParser().parseFromString(n, "text/html");
|
|
30
|
+
return Array.from(o.querySelectorAll(l)).some((t) => {
|
|
31
|
+
const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
|
|
32
|
+
return !e || !s;
|
|
33
|
+
}) ? (c({
|
|
34
|
+
type: i.Warning,
|
|
35
|
+
message: p(b)
|
|
36
|
+
}), !1) : !0;
|
|
37
|
+
} };
|
|
42
38
|
};
|
|
43
39
|
export {
|
|
44
|
-
|
|
45
|
-
b as countUnsubBlocksWithoutPage,
|
|
46
|
-
m as findDuplicateUnsubPageTypes,
|
|
47
|
-
y as useUnsubscribeBlockValidator
|
|
40
|
+
P as useUnsubscribeBlockValidator
|
|
48
41
|
};
|
|
@@ -2,14 +2,15 @@ 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
|
-
|
|
5
|
+
import { migrateRadioButton as n } from "./radioButtonMigrator.js";
|
|
6
|
+
import { migrateRecommendation as c } from "./recommendationMigrator.js";
|
|
7
|
+
import { migrateRecommendationTitle as g } from "./recommendationTitleMigrator.js";
|
|
8
|
+
import { migrateSocialIcons as p } from "./socialIconMigrator.js";
|
|
9
|
+
import { migrateUnsubscribe as f } from "./unsubscribeMigrator.js";
|
|
10
|
+
const C = async (o, r = {}) => {
|
|
11
|
+
let m = o;
|
|
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;
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
C as migrate
|
|
15
16
|
};
|
|
@@ -381,7 +381,7 @@ class H {
|
|
|
381
381
|
* Supports all block types by detecting prefix and using appropriate type:
|
|
382
382
|
*
|
|
383
383
|
* Examples:
|
|
384
|
-
* - {{ins_apr_img_1}} → https://
|
|
384
|
+
* - {{ins_apr_img_1}} → https://web-image.useinsider.com/.../img_1.jpeg (CART_ITEMS)
|
|
385
385
|
* - {{browsed_item_name_2}} → 'Set of Sprite Yoga Straps' (BROWSED_ITEMS)
|
|
386
386
|
* - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
|
|
387
387
|
*/
|
|
@@ -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_RECOMMENDATION_TITLE as l, ATTR_CUSTOM_PREFIX as k, ATTR_PRODUCT_BUTTON as A, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as h, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as O } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
|
+
import { mapTextTheme as b, mapButtonTheme as y, mapImageTheme as N } from "./themeMapper.js";
|
|
4
|
+
const C = "__title__", T = "product_attribute.";
|
|
5
|
+
function P(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: O, kind: "image" };
|
|
12
12
|
case "p_name":
|
|
13
|
-
return { key:
|
|
13
|
+
return { key: E, kind: "text" };
|
|
14
14
|
case "p_price":
|
|
15
|
-
return { key:
|
|
15
|
+
return { key: h, 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: R, kind: "text" };
|
|
22
22
|
case "p_button":
|
|
23
|
-
return { key:
|
|
23
|
+
return { key: A, 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(T) ? o.slice(T.length) : o;
|
|
27
27
|
if (!s)
|
|
28
28
|
return null;
|
|
29
|
-
const e = o || `${
|
|
29
|
+
const e = o || `${T}${s}`;
|
|
30
30
|
return {
|
|
31
|
-
key: `${
|
|
31
|
+
key: `${k}${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 V(r) {
|
|
45
45
|
const t = {
|
|
46
46
|
composition: [],
|
|
47
47
|
visibility: { ...I },
|
|
@@ -54,10 +54,10 @@ function S(r) {
|
|
|
54
54
|
return t.composition = [...p], t;
|
|
55
55
|
const o = [];
|
|
56
56
|
r.forEach((e, i) => {
|
|
57
|
-
const n =
|
|
57
|
+
const n = P(e);
|
|
58
58
|
if (n) {
|
|
59
59
|
if (n.kind === "title") {
|
|
60
|
-
t.titleVariable = e;
|
|
60
|
+
t.titleVariable = e, t.visibility[l] = e.hidden !== !0;
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
o.push({
|
|
@@ -82,20 +82,20 @@ function S(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] = N(c.theme);
|
|
86
86
|
break;
|
|
87
87
|
case "button":
|
|
88
|
-
s[i] =
|
|
88
|
+
s[i] = y(c.theme);
|
|
89
89
|
break;
|
|
90
90
|
case "text":
|
|
91
91
|
case "custom": {
|
|
92
|
-
const
|
|
93
|
-
s[i] =
|
|
92
|
+
const a = b(c.theme);
|
|
93
|
+
s[i] = a, a.textTrimming && (t.anyTextTrimming = !0);
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}), t.perElementStyles = s, t;
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
V as mapComposition
|
|
101
101
|
};
|
|
@@ -1,49 +1,54 @@
|
|
|
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 A(t) {
|
|
4
|
+
var i;
|
|
5
|
+
const e = t.querySelector(".ext-recommendation-title");
|
|
6
|
+
if (!e)
|
|
7
7
|
return a;
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const r = (i = e.textContent) == null ? void 0 : i.trim();
|
|
9
|
+
return r && r.length > 0 ? r : a;
|
|
10
10
|
}
|
|
11
11
|
function m(t) {
|
|
12
|
-
const
|
|
12
|
+
const e = t.querySelector(".ext-recommendation-title");
|
|
13
|
+
return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
|
|
14
|
+
}
|
|
15
|
+
function d(t) {
|
|
16
|
+
const e = [
|
|
13
17
|
t,
|
|
14
18
|
...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
15
19
|
];
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
21
|
-
const u = (
|
|
22
|
-
return u && u[1] ? (
|
|
23
|
-
}),
|
|
20
|
+
let r = "";
|
|
21
|
+
return e.some((i) => {
|
|
22
|
+
const o = i.getAttribute("bgcolor");
|
|
23
|
+
if (o && o.trim())
|
|
24
|
+
return r = o.trim(), !0;
|
|
25
|
+
const u = (i.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
|
|
26
|
+
return u && u[1] ? (r = u[1].trim(), !0) : !1;
|
|
27
|
+
}), r;
|
|
24
28
|
}
|
|
25
29
|
function C(t) {
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
30
|
+
const e = t.getAttribute(n.CURRENCY);
|
|
31
|
+
if (!e)
|
|
28
32
|
return;
|
|
29
|
-
const
|
|
33
|
+
const r = t.getAttribute(n.SYMBOL);
|
|
30
34
|
return {
|
|
31
|
-
value:
|
|
35
|
+
value: e,
|
|
32
36
|
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
33
37
|
// the currency code as the symbol.
|
|
34
|
-
...
|
|
38
|
+
...r ? { symbol: r } : {},
|
|
35
39
|
alignment: t.getAttribute(n.ALIGNMENT) ?? "",
|
|
36
40
|
decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
|
|
37
41
|
decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
|
|
38
42
|
thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
|
-
function
|
|
45
|
+
function g(t) {
|
|
42
46
|
return t.classList.contains(c);
|
|
43
47
|
}
|
|
44
48
|
export {
|
|
45
|
-
|
|
49
|
+
d as extractCardBgColor,
|
|
46
50
|
C as extractCurrencyFromBlock,
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
A as extractTitleText,
|
|
52
|
+
m as hasVisibleTitle,
|
|
53
|
+
g as isPartnerManagedBlock
|
|
49
54
|
};
|