@useinsider/guido 3.17.1-beta.1291eaa → 3.18.0
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 +1 -0
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +82 -76
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useModuleRepair.js +33 -0
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useSave.js +30 -29
- package/dist/composables/useStripo.js +15 -15
- package/dist/composables/useSyncModuleExtractor.js +15 -13
- package/dist/composables/validators/useSyncModuleBlockValidator.js +24 -0
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- 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/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +31 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Items/block.js +118 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +25 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Items/utils/constants.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +35 -29
- 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 +29 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- 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/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- 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/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +10 -6
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +18 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/composables/useSyncModuleExtractor.d.ts +2 -0
- package/dist/src/composables/validators/useSyncModuleBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +35 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +43 -0
- package/dist/src/extensions/Blocks/Items/utils/constants.d.ts +6 -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 +3 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -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/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +6 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/src/utils/itemsCurrencyRepair.d.ts +17 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/itemsCurrencyRepair.js +39 -0
- package/dist/utils/pairProductVariables.js +58 -58
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +2 -1
- package/dist/composables/useModuleDynamicContentRepair.js +0 -37
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -13
|
@@ -1,53 +1,67 @@
|
|
|
1
|
-
import S from "../static/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/components/
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import S from "../static/assets/icons/line-change.svg.js";
|
|
2
|
+
import i from "../static/assets/icons/line-delete.svg.js";
|
|
3
|
+
import n from "../static/assets/icons/line-plus.svg.js";
|
|
4
|
+
import p from "../static/styles/base.css.js";
|
|
5
|
+
import s from "../static/styles/components/alert-message.css.js";
|
|
6
|
+
import C from "../static/styles/components/amp-block.css.js";
|
|
7
|
+
import a from "../static/styles/components/base-input.css.js";
|
|
8
|
+
import f from "../static/styles/components/button-group.css.js";
|
|
9
|
+
import c from "../static/styles/components/button.css.js";
|
|
10
|
+
import u from "../static/styles/components/combobox.css.js";
|
|
11
|
+
import l from "../static/styles/components/counter.css.js";
|
|
12
|
+
import d from "../static/styles/components/dropdown-menu.css.js";
|
|
13
|
+
import h from "../static/styles/components/loader.css.js";
|
|
14
|
+
import g from "../static/styles/components/narrow-panel.css.js";
|
|
15
|
+
import I from "../static/styles/components/popup.css.js";
|
|
16
|
+
import w from "../static/styles/components/recommendation-strategy.css.js";
|
|
17
|
+
import y from "../static/styles/components/switcher.css.js";
|
|
18
|
+
import b from "../static/styles/components/tabs.css.js";
|
|
19
|
+
import B from "../static/styles/components/tools.css.js";
|
|
20
|
+
import $ from "../static/styles/components/version-history.css.js";
|
|
21
|
+
import P from "../static/styles/components/wide-panel.css.js";
|
|
22
|
+
import x from "../static/styles/variables.css.js";
|
|
23
|
+
function r(t, o) {
|
|
24
|
+
return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
|
|
25
|
+
}
|
|
26
|
+
const A = `:host {
|
|
27
|
+
${r("line-change", S)}
|
|
28
|
+
${r("line-delete", i)}
|
|
29
|
+
${r("line-plus", n)}
|
|
30
|
+
}`, R = [
|
|
31
|
+
x,
|
|
23
32
|
// Must be on top
|
|
24
|
-
|
|
25
|
-
e,
|
|
26
|
-
i,
|
|
33
|
+
A,
|
|
27
34
|
p,
|
|
28
|
-
|
|
35
|
+
// Must be on top
|
|
29
36
|
s,
|
|
30
37
|
C,
|
|
31
|
-
f,
|
|
32
38
|
a,
|
|
33
|
-
|
|
39
|
+
f,
|
|
34
40
|
c,
|
|
35
|
-
|
|
41
|
+
u,
|
|
36
42
|
l,
|
|
43
|
+
d,
|
|
37
44
|
h,
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
g,
|
|
46
|
+
I,
|
|
47
|
+
y,
|
|
48
|
+
b,
|
|
49
|
+
B,
|
|
50
|
+
$,
|
|
51
|
+
P,
|
|
52
|
+
w
|
|
53
|
+
// Last: overrides button.css / wide-panel.css defaults
|
|
40
54
|
].join(`
|
|
41
55
|
|
|
42
|
-
`),
|
|
56
|
+
`), Y = () => ({ importCss: () => {
|
|
43
57
|
const o = new CSSStyleSheet();
|
|
44
|
-
o.replaceSync(
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
58
|
+
o.replaceSync(R);
|
|
59
|
+
const e = document.querySelector("ui-editor");
|
|
60
|
+
if (!e)
|
|
47
61
|
return;
|
|
48
|
-
const
|
|
49
|
-
|
|
62
|
+
const m = e.shadowRoot;
|
|
63
|
+
m && (m.adoptedStyleSheets = [o]);
|
|
50
64
|
} });
|
|
51
65
|
export {
|
|
52
|
-
|
|
66
|
+
Y as useCustomInterfaceAppearance
|
|
53
67
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useConfig as C } from "./useConfig.js";
|
|
2
|
+
import { useToaster as T } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as g } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as D } from "../enums/toaster.js";
|
|
5
|
+
import { buildDynamicContentLookup as f, convertModuleDynamicContent as h } from "../utils/dynamicContentConverter.js";
|
|
6
|
+
import { flattenDynamicContentList as O } from "../utils/genericUtil.js";
|
|
7
|
+
import { repairItemsCurrencyAttributes as M } from "../utils/itemsCurrencyRepair.js";
|
|
8
|
+
const N = "dynamic-content.unresolved-attributes-on-drop", R = () => {
|
|
9
|
+
const { template: p, isFeatureEnabled: m } = C(), { showToaster: a } = T(), y = g();
|
|
10
|
+
return { handleModuleAdd: (e, o) => {
|
|
11
|
+
var s, l, u;
|
|
12
|
+
try {
|
|
13
|
+
if ((e == null ? void 0 : e.action) !== "ADD" && (e == null ? void 0 : e.action) !== "COPY")
|
|
14
|
+
return;
|
|
15
|
+
const t = (s = o == null ? void 0 : o.getTargetNode) == null ? void 0 : s.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
|
|
16
|
+
if (!t || typeof r != "string")
|
|
17
|
+
return;
|
|
18
|
+
let n = M(r);
|
|
19
|
+
const c = f(O((u = p.value) == null ? void 0 : u.dynamicContentList));
|
|
20
|
+
let i = [];
|
|
21
|
+
c.size > 0 && ({ html: n, unresolved: i } = h(n, c, m("liquidSyntax"))), n !== r && o.modifyHtml(t).replaceWith(n), i.length > 0 && a({
|
|
22
|
+
type: D.Warning,
|
|
23
|
+
message: y(N)
|
|
24
|
+
});
|
|
25
|
+
} catch (t) {
|
|
26
|
+
console.error("Failed to repair module on add:", t);
|
|
27
|
+
}
|
|
28
|
+
} };
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
N as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
32
|
+
R as useModuleRepair
|
|
33
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
2
|
-
import { MinDeviceViewport as C, DefaultPadding as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
|
|
3
3
|
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
-
import { generateCompleteFilterQuery as
|
|
5
|
-
import { getPartnerRecommendationParams as
|
|
4
|
+
import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
+
import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
6
|
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
7
|
import { useConfigStore as P } from "../stores/config.js";
|
|
8
8
|
const B = () => ({
|
|
9
9
|
calculateCardWidth: ({
|
|
10
|
-
mobileLeftPadding:
|
|
11
|
-
mobileRightPadding:
|
|
12
|
-
cardsInRow:
|
|
10
|
+
mobileLeftPadding: i,
|
|
11
|
+
mobileRightPadding: c,
|
|
12
|
+
cardsInRow: s,
|
|
13
13
|
unresponsive: n
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return (C - e) /
|
|
15
|
+
const o = n ? s : 1, e = i + c + (o - 1) * R;
|
|
16
|
+
return (C - e) / o;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const
|
|
18
|
+
getRecommendationCampaignData: (i) => {
|
|
19
|
+
const c = l(), s = Number(i), n = c.blockStates[s];
|
|
20
20
|
if (!n)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
@@ -30,47 +30,54 @@ const B = () => ({
|
|
|
30
30
|
discountBeforeTextValue: "",
|
|
31
31
|
discountAfterTextValue: ""
|
|
32
32
|
};
|
|
33
|
-
const { recommendationConfigs:
|
|
33
|
+
const { recommendationConfigs: o } = n, e = o.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
34
|
return {
|
|
35
|
-
textTrimming:
|
|
35
|
+
textTrimming: o.textTrimming,
|
|
36
36
|
orientation: e,
|
|
37
37
|
mobileLeftPadding: 0,
|
|
38
38
|
mobileRightPadding: 0,
|
|
39
|
-
cardsInRow:
|
|
40
|
-
unresponsive:
|
|
39
|
+
cardsInRow: o.cardsInRow,
|
|
40
|
+
unresponsive: o.unresponsive,
|
|
41
41
|
priceBeforeTextValue: "",
|
|
42
42
|
priceAfterTextValue: "",
|
|
43
43
|
discountBeforeTextValue: "",
|
|
44
44
|
discountAfterTextValue: ""
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
buildCampaignUrl: (
|
|
47
|
+
buildCampaignUrl: (i, c) => {
|
|
48
48
|
var m;
|
|
49
|
-
const
|
|
49
|
+
const s = l(), n = P(), o = Number(i);
|
|
50
50
|
let e;
|
|
51
|
-
if (
|
|
52
|
-
e =
|
|
51
|
+
if (c)
|
|
52
|
+
e = c;
|
|
53
53
|
else {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const a = s.blockStates[o];
|
|
55
|
+
if (!a)
|
|
56
56
|
return "";
|
|
57
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: r } = a;
|
|
58
58
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
strategy: r.strategy,
|
|
60
|
+
strategyId: r.strategyId,
|
|
61
|
+
language: r.language,
|
|
62
|
+
currencyCode: r.currencySettings.value,
|
|
63
|
+
size: r.size,
|
|
64
|
+
productIds: r.productIds,
|
|
65
|
+
filters: r.filters,
|
|
66
|
+
shuffleProducts: r.shuffleProducts
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
|
|
70
|
+
return s.recommendationCampaignUrls[i] = {
|
|
71
|
+
strategyId: e.strategyId,
|
|
72
|
+
locale: e.language,
|
|
73
|
+
currency: e.currencyCode
|
|
74
|
+
}, "";
|
|
75
|
+
const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
69
76
|
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}");
|
|
70
|
-
const
|
|
71
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(
|
|
72
|
-
const p = decodeURIComponent(t.toString()), u = `${
|
|
73
|
-
return
|
|
77
|
+
const f = e.filters.filter((a) => a.isValid), d = b(f);
|
|
78
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(n.partnerName, e.strategy)).forEach(([a, r]) => t.set(a, r));
|
|
79
|
+
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${g}?${p}`;
|
|
80
|
+
return s.recommendationCampaignUrls[i] = u, u;
|
|
74
81
|
}
|
|
75
82
|
});
|
|
76
83
|
export {
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as T } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as E, useSaveComplete as q } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { ToasterTypeOptions as M } from "../enums/toaster.js";
|
|
6
6
|
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
7
7
|
import { useTemplatePreparation as L } from "../utils/templatePreparation.js";
|
|
8
8
|
import { useAllowlist as P } from "./useAllowlist.js";
|
|
9
9
|
import { useHtmlValidator as U } from "./useHtmlValidator.js";
|
|
10
10
|
import { useToaster as A } from "./useToaster.js";
|
|
11
|
-
import { useCouponBlockValidator as
|
|
12
|
-
import { useLiquidValidator as
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
import { useCouponBlockValidator as h } from "./validators/useCouponBlockValidator.js";
|
|
12
|
+
import { useLiquidValidator as F } from "./validators/useLiquidValidator.js";
|
|
13
|
+
import { useSyncModuleBlockValidator as O } from "./validators/useSyncModuleBlockValidator.js";
|
|
14
|
+
import { useUnsubscribeBlockValidator as W } from "./validators/useUnsubscribeBlockValidator.js";
|
|
15
|
+
const it = () => {
|
|
16
|
+
const l = E(), n = q(), { validateHtml: c } = U(), { validateLiquidSyntax: d } = F(), { validateCouponBlockTags: m } = h(), { validateUnsubscribeBlockUniqueness: u, validateUnsubscribeBlockHasTemplate: p } = W(), { validateSyncModuleBlocks: f } = O(), { callbacks: a, isFeatureEnabled: s } = T(), { extractSyncModuleData: v } = C(), { setSyncModuleUnsubscriptionPages: S } = D(), { editorSave: b } = x(), { showToaster: w } = A(), { getBlockedDomains: V, resolveToast: y } = P();
|
|
17
|
+
return { save: async (H = !1, e = !1) => {
|
|
17
18
|
var r;
|
|
18
|
-
|
|
19
|
-
const { prepareTemplateDetails:
|
|
20
|
-
if (!m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
|
|
19
|
+
l();
|
|
20
|
+
const { prepareTemplateDetails: k } = L(), t = await k();
|
|
21
|
+
if (!f(t.rawHtml, e) || !m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
|
|
21
22
|
return;
|
|
22
|
-
if (
|
|
23
|
+
if (s("liquidSyntax")) {
|
|
23
24
|
if (!await d(t.compiledHtml))
|
|
24
25
|
return;
|
|
25
26
|
} else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
|
|
26
27
|
return;
|
|
27
|
-
if ((r =
|
|
28
|
+
if ((r = a.value) != null && r.externalValidation && !await a.value.externalValidation(t))
|
|
28
29
|
return;
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
message:
|
|
37
|
-
actionButton:
|
|
30
|
+
if (s("allowlistEnabled")) {
|
|
31
|
+
const o = await V(t.compiledHtml, t.css);
|
|
32
|
+
if (o.length) {
|
|
33
|
+
if (!e) {
|
|
34
|
+
const i = await y(o);
|
|
35
|
+
i != null && i.message && w({
|
|
36
|
+
type: M.Warning,
|
|
37
|
+
message: i.message,
|
|
38
|
+
actionButton: i.actionButton
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
if (!await
|
|
44
|
+
if (!await b())
|
|
44
45
|
return;
|
|
45
|
-
const { unsubscribePayload:
|
|
46
|
-
return await
|
|
46
|
+
const { unsubscribePayload: B, stripoModules: g } = v(t.rawHtml);
|
|
47
|
+
return await S(B), t.modules = g, H || n({ ...t, silent: e }), t;
|
|
47
48
|
} };
|
|
48
49
|
};
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
+
it as useSave
|
|
51
52
|
};
|
|
@@ -3,7 +3,7 @@ import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
|
3
3
|
import { useConfig as q } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useModuleRepair as j } from "./useModuleRepair.js";
|
|
7
7
|
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
8
|
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
9
|
import { useToaster as G } from "./useToaster.js";
|
|
@@ -17,13 +17,13 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
|
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
19
|
const Ce = () => {
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken:
|
|
21
|
-
var
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
|
+
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(
|
|
26
|
+
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
|
|
27
27
|
e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
|
|
28
28
|
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
29
|
}, document.body.appendChild(e);
|
|
@@ -31,12 +31,12 @@ const Ce = () => {
|
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e = b(), { html:
|
|
34
|
+
const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1);
|
|
35
35
|
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
|
-
html:
|
|
39
|
+
html: d,
|
|
40
40
|
css: D,
|
|
41
41
|
forceRecreate: U,
|
|
42
42
|
locale: "en",
|
|
@@ -80,16 +80,16 @@ const Ce = () => {
|
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const
|
|
84
|
-
t(
|
|
85
|
-
} catch (
|
|
86
|
-
p(
|
|
83
|
+
const l = await B();
|
|
84
|
+
t(l);
|
|
85
|
+
} catch (l) {
|
|
86
|
+
p(l, "Failed to refresh token");
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const { importCss: t } = H(), { activateCustomViewStyles:
|
|
92
|
-
t(),
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
92
|
+
t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
@@ -108,7 +108,7 @@ const Ce = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
111
|
+
onEvent: v,
|
|
112
112
|
onModuleAdd: F,
|
|
113
113
|
notifications: V(),
|
|
114
114
|
ignoreClickOutsideSelectors: [
|
|
@@ -126,8 +126,8 @@ const Ce = () => {
|
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
M(),
|
|
130
|
+
T()
|
|
131
131
|
]);
|
|
132
132
|
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as
|
|
1
|
+
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as A } from "../enums/unsubscribe.js";
|
|
2
2
|
import { DATA_ATTRIBUTES as p } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return { extractSyncModuleData: (
|
|
7
|
-
const
|
|
3
|
+
import { useEditorStore as T } from "../stores/editor.js";
|
|
4
|
+
const _ = "esd-synchronizable-module", f = `.${_}`, y = '[esd-extension-block-id="unsubscribe-block"]', M = "esd-custom-block-id", N = () => {
|
|
5
|
+
const S = T();
|
|
6
|
+
return { extractSyncModuleData: (d) => {
|
|
7
|
+
const E = {
|
|
8
8
|
unsubscribePayload: [],
|
|
9
9
|
stripoModules: []
|
|
10
10
|
};
|
|
11
|
-
if (!
|
|
12
|
-
return
|
|
13
|
-
const b = new DOMParser().parseFromString(
|
|
11
|
+
if (!S.syncModulesEnabled)
|
|
12
|
+
return E;
|
|
13
|
+
const b = new DOMParser().parseFromString(d, "text/html").querySelectorAll(f), r = [], s = [];
|
|
14
14
|
return b.forEach((o) => {
|
|
15
|
-
const t = o.getAttribute(
|
|
15
|
+
const t = o.getAttribute(M);
|
|
16
16
|
if (!t)
|
|
17
17
|
return;
|
|
18
|
-
const n = o.querySelectorAll(
|
|
18
|
+
const n = o.querySelectorAll(y);
|
|
19
19
|
if (n.length === 0) {
|
|
20
20
|
s.push(Number(t));
|
|
21
21
|
return;
|
|
@@ -24,7 +24,7 @@ const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscrib
|
|
|
24
24
|
const u = c.getAttribute(p.PAGE_LIST), i = c.getAttribute(p.PAGE_TYPE);
|
|
25
25
|
if (!u || !i)
|
|
26
26
|
return;
|
|
27
|
-
const m = parseInt(i), a =
|
|
27
|
+
const m = parseInt(i), a = A[m];
|
|
28
28
|
if (!a)
|
|
29
29
|
return;
|
|
30
30
|
const l = u.split(",").map((e) => parseInt(e.trim())).filter((e) => !Number.isNaN(e));
|
|
@@ -41,5 +41,7 @@ const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscrib
|
|
|
41
41
|
} };
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
_ as SYNC_MODULE_CLASS,
|
|
45
|
+
f as SYNC_MODULE_SELECTOR,
|
|
46
|
+
N as useSyncModuleExtractor
|
|
45
47
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SYNC_MODULE_CLASS as l, SYNC_MODULE_SELECTOR as a } from "../useSyncModuleExtractor.js";
|
|
2
|
+
import { ToasterTypeOptions as m } from "../../enums/toaster.js";
|
|
3
|
+
import { ITEMS_BLOCK_SELECTOR as d } from "../../extensions/Blocks/Items/utils/constants.js";
|
|
4
|
+
import { RECOMMENDATION_BLOCK_SELECTOR as t, isLiveRecommendationBlock as E } from "../../extensions/Blocks/Recommendation/utils/recommendationBlockCount.js";
|
|
5
|
+
import { useEditorStore as u } from "../../stores/editor.js";
|
|
6
|
+
import { useToaster as S } from "../useToaster.js";
|
|
7
|
+
import { useTranslations as f } from "../useTranslations.js";
|
|
8
|
+
const O = `${d}, ${t}`, p = "email-editor.sync-module-dynamic-block-not-allowed", C = (o) => !o.matches(t) || E(o), D = () => {
|
|
9
|
+
const o = u(), { showToaster: s } = S(), n = f();
|
|
10
|
+
return { validateSyncModuleBlocks: (e, i = !1) => {
|
|
11
|
+
if (!o.syncModulesEnabled || !e.includes(l))
|
|
12
|
+
return !0;
|
|
13
|
+
const c = new DOMParser().parseFromString(e, "text/html");
|
|
14
|
+
return Array.from(c.querySelectorAll(O)).some(
|
|
15
|
+
(r) => r.closest(a) !== null && C(r)
|
|
16
|
+
) ? (i || s({
|
|
17
|
+
type: m.Error,
|
|
18
|
+
message: n(p)
|
|
19
|
+
}), !1) : !0;
|
|
20
|
+
} };
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
D as useSyncModuleBlockValidator
|
|
24
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const e = "Items", o = "Default", t = "Custom", s = {
|
|
2
2
|
"Global Styles & Layout": "Global Styles and Layout",
|
|
3
3
|
"Structures & Modules": "Structures and Modules",
|
|
4
|
-
"Recommendation Block": "Recommendation",
|
|
4
|
+
"Recommendation Block": "Recommendation Block",
|
|
5
5
|
Items: e,
|
|
6
6
|
"This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
|
|
7
7
|
"This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|