@useinsider/guido 3.2.0-beta.c2a858e → 3.2.0-beta.caa22bf
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 +92 -0
- package/dist/@types/config/schemas.js +150 -94
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +88 -87
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useRecommendation.js +46 -26
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +21 -18
- package/dist/composables/useStripo.js +14 -16
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- package/dist/enums/onboarding.js +7 -2
- package/dist/extensions/Blocks/Recommendation/block.js +35 -32
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
- package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +213 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +56 -0
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +504 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/dist/utils/templatePreparation.js +72 -32
- package/package.json +7 -3
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -1,74 +1,63 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { defineComponent as l, computed as c, watch as g } from "vue";
|
|
2
|
+
import { useRibbonOffset as b } from "../../../composables/useRibbonOffset.js";
|
|
3
|
+
import { useTranslations as x } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useOnboardingStore as u } from "../../../stores/onboarding.js";
|
|
5
|
+
import { InOnboard as p } from "@useinsider/design-system-vue";
|
|
6
|
+
const O = /* @__PURE__ */ l({
|
|
6
7
|
__name: "TextBlockOnboarding",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
const n = window.innerHeight - 128, r = Math.max(90, n * 0.15), s = Math.max(490, n * 0.71), d = 200, g = 40;
|
|
10
|
-
return {
|
|
11
|
-
settings: {
|
|
12
|
-
top: `${r}px`,
|
|
13
|
-
position: r + d + g > n ? "Right Bottom" : "Right Top"
|
|
14
|
-
},
|
|
15
|
-
dynamic: {
|
|
16
|
-
top: `${s}px`,
|
|
17
|
-
position: s + d + g > n ? "Right Bottom" : "Right Top"
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}), c = a(() => [
|
|
8
|
+
setup(k) {
|
|
9
|
+
const n = x(), o = u(), { getTopPosition: i } = b(), r = c(() => [
|
|
21
10
|
{
|
|
22
11
|
classes: "guido-text-block-onboarding-settings",
|
|
23
12
|
right: "426px",
|
|
24
|
-
top:
|
|
25
|
-
position:
|
|
26
|
-
title:
|
|
27
|
-
description:
|
|
13
|
+
top: i(90),
|
|
14
|
+
position: "Right Top",
|
|
15
|
+
title: n("email-editor.onboarding-text-block-title"),
|
|
16
|
+
description: n("email-editor.onboarding-text-block-description"),
|
|
28
17
|
imageSource: "",
|
|
29
18
|
backButtonClick: () => {
|
|
30
19
|
},
|
|
31
20
|
nextButtonType: "text",
|
|
32
|
-
nextButtonText:
|
|
21
|
+
nextButtonText: n("products.next"),
|
|
33
22
|
nextButtonClick: () => {
|
|
34
23
|
o.next("textBlockOnboarding");
|
|
35
24
|
}
|
|
36
25
|
},
|
|
37
26
|
{
|
|
38
27
|
classes: "guido-text-block-onboarding-dynamic",
|
|
39
|
-
right: "
|
|
40
|
-
top:
|
|
41
|
-
position:
|
|
42
|
-
title:
|
|
43
|
-
description:
|
|
28
|
+
right: "409px",
|
|
29
|
+
top: i(607),
|
|
30
|
+
position: "Right Top",
|
|
31
|
+
title: n("email-editor.onboarding-dynamic-content-title"),
|
|
32
|
+
description: n("email-editor.onboarding-dynamic-content-description"),
|
|
44
33
|
imageSource: "",
|
|
45
34
|
backButtonType: "text",
|
|
46
|
-
backButtonText:
|
|
35
|
+
backButtonText: n("ds-steps.back"),
|
|
47
36
|
backButtonClick: () => {
|
|
48
37
|
o.previous("textBlockOnboarding");
|
|
49
38
|
},
|
|
50
39
|
nextButtonType: "text",
|
|
51
|
-
nextButtonText:
|
|
40
|
+
nextButtonText: n("action-builder.ok"),
|
|
52
41
|
nextButtonClick: () => {
|
|
53
42
|
o.close("textBlockOnboarding");
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
|
-
]),
|
|
57
|
-
var t,
|
|
58
|
-
(
|
|
59
|
-
},
|
|
60
|
-
var t,
|
|
61
|
-
(
|
|
45
|
+
]), a = c(() => o.onboardings.textBlockOnboarding.config.length > 0 && o.onboardings.textBlockOnboarding.isActive), s = () => {
|
|
46
|
+
var t, e;
|
|
47
|
+
(e = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.nextButtonClick) == null || e.call(t);
|
|
48
|
+
}, d = () => {
|
|
49
|
+
var t, e;
|
|
50
|
+
(e = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.backButtonClick) == null || e.call(t);
|
|
62
51
|
};
|
|
63
|
-
return
|
|
52
|
+
return g(
|
|
64
53
|
() => o.isActive("textBlockOnboarding"),
|
|
65
54
|
(t) => {
|
|
66
|
-
t && o.setConfig("textBlockOnboarding",
|
|
55
|
+
t && o.setConfig("textBlockOnboarding", r.value);
|
|
67
56
|
},
|
|
68
57
|
{ immediate: !0 }
|
|
69
|
-
), { __sfc: !0, trans:
|
|
58
|
+
), { __sfc: !0, trans: n, onboardingStore: o, getTopPosition: i, onboardingCardsConfig: r, isVisible: a, handleNext: s, handleBack: d, InOnboard: p };
|
|
70
59
|
}
|
|
71
60
|
});
|
|
72
61
|
export {
|
|
73
|
-
|
|
62
|
+
O as default
|
|
74
63
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { defineComponent as g, computed as s, watch as b } from "vue";
|
|
2
|
+
import { useRibbonOffset as u } from "../../../composables/useRibbonOffset.js";
|
|
3
|
+
import { useTranslations as l } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useOnboardingStore as m } from "../../../stores/onboarding.js";
|
|
5
|
+
import { InOnboard as p } from "@useinsider/design-system-vue";
|
|
6
|
+
const k = /* @__PURE__ */ g({
|
|
6
7
|
__name: "VersionHistoryOnboarding",
|
|
7
|
-
setup(
|
|
8
|
-
const t =
|
|
8
|
+
setup(f) {
|
|
9
|
+
const t = l(), n = m(), { getTopPosition: r } = u(), e = s(() => [
|
|
9
10
|
{
|
|
10
11
|
classes: "guido-version-history-onboarding",
|
|
11
12
|
left: "409px",
|
|
12
|
-
top:
|
|
13
|
+
top: r(192),
|
|
13
14
|
position: "Left Top",
|
|
14
15
|
title: t("email-editor.onboarding-version-history-title"),
|
|
15
16
|
description: t("email-editor.onboarding-version-history-description"),
|
|
@@ -20,18 +21,18 @@ const C = /* @__PURE__ */ c({
|
|
|
20
21
|
nextButtonText: t("action-builder.ok"),
|
|
21
22
|
nextButtonClick: () => void n.close("versionHistoryOnboarding")
|
|
22
23
|
}
|
|
23
|
-
]),
|
|
24
|
+
]), a = s(() => n.onboardings.versionHistoryOnboarding.config.length > 0 && n.onboardings.versionHistoryOnboarding.isActive), d = () => {
|
|
24
25
|
var o, i;
|
|
25
26
|
(i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.nextButtonClick) == null || i.call(o);
|
|
26
|
-
},
|
|
27
|
+
}, c = () => {
|
|
27
28
|
var o, i;
|
|
28
29
|
(i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.backButtonClick) == null || i.call(o);
|
|
29
30
|
};
|
|
30
|
-
return
|
|
31
|
-
o && n.setConfig("versionHistoryOnboarding",
|
|
32
|
-
}, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n,
|
|
31
|
+
return b(() => n.onboardings.versionHistoryOnboarding.isActive, (o) => {
|
|
32
|
+
o && n.setConfig("versionHistoryOnboarding", e.value);
|
|
33
|
+
}, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, getTopPosition: r, onboardingCardsConfig: e, isVisible: a, handleNext: d, handleBack: c, InOnboard: p };
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
k as default
|
|
37
38
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as
|
|
1
|
+
import { RecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { generateCompleteFilterQuery as
|
|
5
|
-
import { useConfigStore as
|
|
6
|
-
const
|
|
3
|
+
import { useRecommendationExtensionStore as m } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
+
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
+
import { useConfigStore as x } from "../stores/config.js";
|
|
6
|
+
const w = () => ({
|
|
7
7
|
calculateCardWidth: ({
|
|
8
|
-
mobileLeftPadding:
|
|
9
|
-
mobileRightPadding:
|
|
10
|
-
cardsInRow:
|
|
11
|
-
unresponsive:
|
|
8
|
+
mobileLeftPadding: s,
|
|
9
|
+
mobileRightPadding: a,
|
|
10
|
+
cardsInRow: c,
|
|
11
|
+
unresponsive: n
|
|
12
12
|
}) => {
|
|
13
|
-
const r =
|
|
13
|
+
const r = n ? c : 1, e = s + a + (r - 1) * b;
|
|
14
14
|
return (R - e) / r;
|
|
15
15
|
},
|
|
16
|
-
getRecommendationCampaignData: (
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
16
|
+
getRecommendationCampaignData: (s) => {
|
|
17
|
+
const a = m(), c = Number(s), n = a.blockStates[c];
|
|
18
|
+
if (!n)
|
|
19
19
|
return {
|
|
20
20
|
textTrimming: !1,
|
|
21
21
|
orientation: "vertical",
|
|
@@ -28,7 +28,7 @@ const N = () => ({
|
|
|
28
28
|
discountBeforeTextValue: "",
|
|
29
29
|
discountAfterTextValue: ""
|
|
30
30
|
};
|
|
31
|
-
const { recommendationConfigs: r } =
|
|
31
|
+
const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
32
32
|
return {
|
|
33
33
|
textTrimming: r.textTrimming,
|
|
34
34
|
orientation: e,
|
|
@@ -42,19 +42,39 @@ const N = () => ({
|
|
|
42
42
|
discountAfterTextValue: ""
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
|
-
buildCampaignUrl: (
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
buildCampaignUrl: (s, a) => {
|
|
46
|
+
var l;
|
|
47
|
+
const c = m(), n = x(), r = Number(s);
|
|
48
|
+
let e;
|
|
49
|
+
if (a)
|
|
50
|
+
e = a;
|
|
51
|
+
else {
|
|
52
|
+
const i = c.blockStates[r];
|
|
53
|
+
if (!i)
|
|
54
|
+
return "";
|
|
55
|
+
const { recommendationConfigs: o } = i;
|
|
56
|
+
e = {
|
|
57
|
+
strategy: o.strategy,
|
|
58
|
+
language: o.language,
|
|
59
|
+
currencyCode: o.currencySettings.value,
|
|
60
|
+
size: o.size,
|
|
61
|
+
productIds: o.productIds,
|
|
62
|
+
filters: o.filters,
|
|
63
|
+
shuffleProducts: o.shuffleProducts
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const f = ((l = I.find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
67
|
+
if (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") {
|
|
68
|
+
const i = parseInt(e.size) || 6;
|
|
69
|
+
t.set("productId", e.productIds.slice(0, i).join(","));
|
|
70
|
+
} else e.strategy === "similarViewed" && t.set("productId", "{itemId}");
|
|
71
|
+
e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
72
|
+
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
73
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
|
|
74
|
+
const p = decodeURIComponent(t.toString()), u = `${C.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
75
|
+
return c.recommendationCampaignUrls[s] = u, u;
|
|
56
76
|
}
|
|
57
77
|
});
|
|
58
78
|
export {
|
|
59
|
-
|
|
79
|
+
w as useRecommendation
|
|
60
80
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RIBBON_SELECTOR as r } from "../enums/onboarding.js";
|
|
2
|
+
import { ref as f, onMounted as c, onBeforeUnmount as i } from "vue";
|
|
3
|
+
const m = () => {
|
|
4
|
+
const o = f(0);
|
|
5
|
+
let e = null;
|
|
6
|
+
const n = () => {
|
|
7
|
+
const t = document.querySelector(r), s = (t == null ? void 0 : t.offsetHeight) ?? 0;
|
|
8
|
+
o.value !== s && (o.value = s);
|
|
9
|
+
}, u = (t) => `${t + o.value}px`;
|
|
10
|
+
return c(() => {
|
|
11
|
+
n(), e = new MutationObserver(n), e.observe(document.body, {
|
|
12
|
+
childList: !0,
|
|
13
|
+
subtree: !0
|
|
14
|
+
});
|
|
15
|
+
}), i(() => {
|
|
16
|
+
e == null || e.disconnect();
|
|
17
|
+
}), { ribbonOffset: o, getTopPosition: u };
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
m as useRibbonOffset
|
|
21
|
+
};
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useActionsApi as V } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as x } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as y, useSaveComplete as w } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as q } from "./useHtmlValidator.js";
|
|
8
|
+
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
+
const h = () => {
|
|
11
|
+
const o = y(), s = w(), { validateHtml: r } = q(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { callbacks: a, isFeatureEnabled: d } = x(), { extractSyncModuleData: u } = C(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = V();
|
|
12
|
+
return { save: async (p = !1) => {
|
|
12
13
|
var i;
|
|
13
14
|
o();
|
|
14
|
-
const { prepareTemplateDetails:
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
const { prepareTemplateDetails: f } = b(), t = await f();
|
|
16
|
+
if (!n(t.compiledHtml))
|
|
17
|
+
return;
|
|
18
|
+
if (d("liquidSyntax")) {
|
|
19
|
+
if (!await l(t.compiledHtml))
|
|
17
20
|
return;
|
|
18
21
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
19
22
|
return;
|
|
20
23
|
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
21
24
|
return;
|
|
22
|
-
await
|
|
23
|
-
const { unsubscribePayload:
|
|
24
|
-
return await
|
|
25
|
+
await m();
|
|
26
|
+
const { unsubscribePayload: v, stripoModules: S } = u(t.rawHtml);
|
|
27
|
+
return await c(v), t.modules = S, p || s(t), t;
|
|
25
28
|
} };
|
|
26
29
|
};
|
|
27
30
|
export {
|
|
28
|
-
|
|
31
|
+
h as useSave
|
|
29
32
|
};
|
|
@@ -6,20 +6,19 @@ import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
|
6
6
|
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
7
|
import { useToaster as x } from "./useToaster.js";
|
|
8
8
|
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
9
|
+
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
+
import j from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
|
|
13
|
+
import $ from "../package.json.js";
|
|
14
|
+
const se = (C, l) => {
|
|
15
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
17
16
|
var g, S, y;
|
|
18
|
-
const e =
|
|
17
|
+
const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
19
18
|
window.UIEditor.initEditor(
|
|
20
19
|
document.querySelector("#guido-editor"),
|
|
21
20
|
{
|
|
22
|
-
metadata:
|
|
21
|
+
metadata: C,
|
|
23
22
|
html: p,
|
|
24
23
|
css: a,
|
|
25
24
|
forceRecreate: v,
|
|
@@ -32,10 +31,9 @@ const ae = (E, l) => {
|
|
|
32
31
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
33
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
34
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
35
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: j,
|
|
36
35
|
conditionsEnabled: f,
|
|
37
36
|
customConditionsEnabled: f,
|
|
38
|
-
conditionCategories: O,
|
|
39
37
|
enableXSSSecurity: !0,
|
|
40
38
|
modulesDisabled: F,
|
|
41
39
|
syncModulesEnabled: s,
|
|
@@ -54,7 +52,7 @@ const ae = (E, l) => {
|
|
|
54
52
|
},
|
|
55
53
|
mergeTags: [
|
|
56
54
|
{
|
|
57
|
-
entries:
|
|
55
|
+
entries: L(
|
|
58
56
|
l.preselectedDynamicContentList,
|
|
59
57
|
u("liquidSyntax")
|
|
60
58
|
)
|
|
@@ -106,7 +104,7 @@ const ae = (E, l) => {
|
|
|
106
104
|
i(), r();
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
|
-
const e =
|
|
107
|
+
const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
110
108
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
111
109
|
i(), r();
|
|
112
110
|
}, o.onerror = () => {
|
|
@@ -115,7 +113,7 @@ const ae = (E, l) => {
|
|
|
115
113
|
});
|
|
116
114
|
return { initPlugin: async (i) => {
|
|
117
115
|
await _(async () => {
|
|
118
|
-
const r =
|
|
116
|
+
const r = E(), [s, e] = await Promise.all([
|
|
119
117
|
b(),
|
|
120
118
|
k()
|
|
121
119
|
]);
|
|
@@ -124,5 +122,5 @@ const ae = (E, l) => {
|
|
|
124
122
|
} };
|
|
125
123
|
};
|
|
126
124
|
export {
|
|
127
|
-
|
|
125
|
+
se as useStripo
|
|
128
126
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
} };
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
A as useCouponBlockValidator
|
|
24
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as y, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as h } from "../../enums/recommendation.js";
|
|
3
3
|
import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
|
|
4
4
|
const w = [
|
|
5
5
|
{
|
|
@@ -8,7 +8,7 @@ const w = [
|
|
|
8
8
|
type: "custom",
|
|
9
9
|
processor: (c) => {
|
|
10
10
|
let e = c;
|
|
11
|
-
return Object.entries(
|
|
11
|
+
return Object.entries(y).forEach(([, l]) => {
|
|
12
12
|
Object.entries(l).forEach(([n, s]) => {
|
|
13
13
|
e = e.replaceAll(s, `{{${n}}}`);
|
|
14
14
|
});
|
|
@@ -30,13 +30,13 @@ const w = [
|
|
|
30
30
|
description: "Adding recommendation unresponsive css",
|
|
31
31
|
type: "custom",
|
|
32
32
|
processor: (c) => {
|
|
33
|
-
const { calculateCardWidth: e, getRecommendationCampaignData: l } =
|
|
33
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: l } = N();
|
|
34
34
|
let n = c;
|
|
35
35
|
const s = n.match(T.ID);
|
|
36
36
|
if (s) {
|
|
37
37
|
const a = [];
|
|
38
38
|
if (s.forEach((i) => {
|
|
39
|
-
const
|
|
39
|
+
const u = /recommendation-id="(.*?)"/i.exec(i), _ = u ? u[1].trim() : "", R = l(_);
|
|
40
40
|
R.textTrimming && R.orientation === M && a.push(e(R));
|
|
41
41
|
}), a.length) {
|
|
42
42
|
const i = `width:${Math.min(...a)}px!important;`;
|
|
@@ -60,25 +60,25 @@ const w = [
|
|
|
60
60
|
type: "custom",
|
|
61
61
|
processor: (c) => {
|
|
62
62
|
let e = c;
|
|
63
|
-
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } =
|
|
63
|
+
const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = N();
|
|
64
64
|
return l !== null && l.forEach((s) => {
|
|
65
65
|
const a = s.match(T.CUSTOM_FIELD);
|
|
66
66
|
if (!a)
|
|
67
67
|
return;
|
|
68
|
-
const [i] = a,
|
|
69
|
-
if (!
|
|
68
|
+
const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
|
+
if (!u || !_ || !R)
|
|
70
70
|
return;
|
|
71
|
-
const [S] =
|
|
71
|
+
const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
|
|
72
72
|
let t = i;
|
|
73
73
|
if (r) {
|
|
74
|
-
const I = S.substring(2, S.length - 3),
|
|
75
|
-
o === A.OMNIBUS_PRICE && (
|
|
74
|
+
const I = S.substring(2, S.length - 3), m = n(I);
|
|
75
|
+
o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const p = S.substring(2);
|
|
78
78
|
let f = "";
|
|
79
|
-
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${
|
|
80
|
-
const $ = `${
|
|
81
|
-
e = e.replace(s,
|
|
79
|
+
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
|
|
80
|
+
const $ = `${d}${t}${h.PARAGRAPH_END_TAG}`, C = `${f}${r ? $ : s}${g.ELSE}${d}${h.PARAGRAPH_END_TAG}${g.END_IF}`;
|
|
81
|
+
e = e.replace(s, C);
|
|
82
82
|
}), e;
|
|
83
83
|
},
|
|
84
84
|
priority: 53
|
|
@@ -136,7 +136,7 @@ const w = [
|
|
|
136
136
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
137
137
|
(l, n) => {
|
|
138
138
|
const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
139
|
-
return s.every((
|
|
139
|
+
return s.every((u) => a.test(u)) ? "" : l;
|
|
140
140
|
}
|
|
141
141
|
)), e;
|
|
142
142
|
},
|
|
@@ -151,7 +151,7 @@ const w = [
|
|
|
151
151
|
/<a\b[^>]*\bes-button\b[^>]*>/g,
|
|
152
152
|
(o) => o.replace(
|
|
153
153
|
/([;"]color:)([^;"]+)/g,
|
|
154
|
-
(r, t,
|
|
154
|
+
(r, t, p) => p.includes("!important") ? r : `${t}${p} !important`
|
|
155
155
|
)
|
|
156
156
|
), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
|
|
157
157
|
let a = l.exec(e);
|
|
@@ -163,12 +163,12 @@ const w = [
|
|
|
163
163
|
}
|
|
164
164
|
n.lastIndex = 0, a = l.exec(e);
|
|
165
165
|
}
|
|
166
|
-
const i = /* @__PURE__ */ new Map(),
|
|
166
|
+
const i = /* @__PURE__ */ new Map(), u = [];
|
|
167
167
|
let _ = 0;
|
|
168
168
|
if (s.forEach((o, r) => {
|
|
169
169
|
if (o >= 6) {
|
|
170
|
-
const t = `rc${_++}
|
|
171
|
-
i.set(r, t),
|
|
170
|
+
const t = `rc${_++}`, p = r.endsWith(";") ? r : `${r};`;
|
|
171
|
+
i.set(r, t), u.push(`.${t}{${p}}`);
|
|
172
172
|
}
|
|
173
173
|
}), i.size === 0) {
|
|
174
174
|
let o = e;
|
|
@@ -182,23 +182,23 @@ const w = [
|
|
|
182
182
|
caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
-
let
|
|
186
|
-
return
|
|
185
|
+
let d = e.replace("</style>", `${u.join("")}</style>`);
|
|
186
|
+
return d = d.replace(
|
|
187
187
|
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
188
188
|
(o, r) => {
|
|
189
189
|
let t = r;
|
|
190
|
-
return i.forEach((
|
|
190
|
+
return i.forEach((p, f) => {
|
|
191
191
|
const $ = b.get(f);
|
|
192
192
|
t = t.replace(
|
|
193
193
|
$.caseA,
|
|
194
|
-
(
|
|
194
|
+
(C, I, m) => S(I, p) + m
|
|
195
195
|
), t = t.replace(
|
|
196
196
|
$.caseB,
|
|
197
|
-
(
|
|
198
|
-
), t = t.replaceAll(` style="${f}"`, ` class="${
|
|
197
|
+
(C, I, m) => I + S(m, p)
|
|
198
|
+
), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
|
|
199
199
|
}), t;
|
|
200
200
|
}
|
|
201
|
-
),
|
|
201
|
+
), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
|
|
202
202
|
},
|
|
203
203
|
priority: 58
|
|
204
204
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
3
|
-
import { migrateItemsBlock as
|
|
4
|
-
import { migrateRadioButton as
|
|
5
|
-
import { migrateRecommendation as
|
|
6
|
-
import { migrateUnsubscribe as
|
|
7
|
-
const
|
|
1
|
+
import { migrateCheckbox as o } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
|
+
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
|
+
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
7
|
+
const b = async (r, t = {}) => {
|
|
8
8
|
let m = r;
|
|
9
|
-
return m =
|
|
9
|
+
return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
b as migrate
|
|
13
13
|
};
|