@useinsider/guido 3.20.1-beta.2a573b4 → 3.20.1-beta.2c8da49
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/composables/useActionsApi.js +80 -63
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useStripo.js +8 -8
- package/dist/extensions/Blocks/Recommendation/block.js +33 -29
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +222 -210
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +20 -11
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +106 -50
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +3 -5
- package/dist/src/composables/useActionsApi.d.ts +5 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +10 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +13 -13
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +0 -2
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/stores/editor.js +5 -0
- package/package.json +1 -1
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { flushPendingNodeConfigWrites as P } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
2
|
+
import { useEditorStore as H } from "../stores/editor.js";
|
|
3
|
+
import { filterAmpErrors as _ } from "../utils/ampErrorFilter.js";
|
|
4
|
+
import { getEditorApi as c } from "../utils/stripoEditorApi.js";
|
|
5
|
+
import { watch as F } from "vue";
|
|
6
|
+
import { useToaster as M } from "./useToaster.js";
|
|
7
|
+
const O = 1e4, C = 3e4, L = 1e3, T = (i, n, r) => new Promise((s, l) => {
|
|
8
|
+
const p = setTimeout(
|
|
9
|
+
() => l(new Error(`${i} did not report completion within ${n}ms`)),
|
|
10
|
+
n
|
|
11
|
+
), f = (d) => (S) => {
|
|
12
|
+
clearTimeout(p), d(S);
|
|
13
|
+
}, g = f(l);
|
|
11
14
|
try {
|
|
12
|
-
|
|
13
|
-
} catch (
|
|
14
|
-
d
|
|
15
|
+
r(f(s), g);
|
|
16
|
+
} catch (d) {
|
|
17
|
+
g(d);
|
|
15
18
|
}
|
|
16
|
-
})
|
|
17
|
-
|
|
19
|
+
});
|
|
20
|
+
let A = Promise.resolve();
|
|
21
|
+
const h = () => {
|
|
22
|
+
const i = H(), n = i.changeSeq + P();
|
|
23
|
+
return i.changeSeq >= n || (A = new Promise((r) => {
|
|
24
|
+
let s = () => {
|
|
25
|
+
};
|
|
26
|
+
const l = setTimeout(() => {
|
|
27
|
+
s(), r();
|
|
28
|
+
}, L);
|
|
29
|
+
s = F(() => i.changeSeq, (p) => {
|
|
30
|
+
p >= n && (clearTimeout(l), s(), r());
|
|
31
|
+
});
|
|
32
|
+
})), A;
|
|
33
|
+
}, z = () => {
|
|
34
|
+
const { handleError: i } = M(), n = (t) => T(
|
|
18
35
|
"compileEmail",
|
|
19
|
-
|
|
20
|
-
(e,
|
|
21
|
-
const
|
|
36
|
+
C,
|
|
37
|
+
(e, o) => {
|
|
38
|
+
const m = { ...{
|
|
22
39
|
minimize: !0,
|
|
23
40
|
utmEntity: {
|
|
24
41
|
utmSource: "",
|
|
@@ -37,56 +54,56 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
37
54
|
forceAmp: !1,
|
|
38
55
|
resetDataSavedFlag: !1,
|
|
39
56
|
disableLineHeightsReplace: !0
|
|
40
|
-
}, ...t },
|
|
41
|
-
callback: (
|
|
42
|
-
|
|
43
|
-
html:
|
|
44
|
-
ampHtml:
|
|
45
|
-
ampErrors:
|
|
46
|
-
displayConditions:
|
|
57
|
+
}, ...t }, E = {
|
|
58
|
+
callback: (u, y, v, D, I) => {
|
|
59
|
+
u ? o(u) : e({
|
|
60
|
+
html: y,
|
|
61
|
+
ampHtml: v,
|
|
62
|
+
ampErrors: _(D ?? []),
|
|
63
|
+
displayConditions: I
|
|
47
64
|
});
|
|
48
65
|
},
|
|
49
|
-
...
|
|
66
|
+
...m
|
|
50
67
|
};
|
|
51
|
-
|
|
68
|
+
c().actionsApi.compileEmail(E);
|
|
69
|
+
}
|
|
70
|
+
), r = async (t = {}) => (await h(), n(t)), s = () => T(
|
|
71
|
+
"getTemplateData",
|
|
72
|
+
C,
|
|
73
|
+
(t) => {
|
|
74
|
+
const e = ({ html: o, css: a, width: m, height: w, utmParams: E, syncModulesIds: u }) => t({
|
|
75
|
+
html: o,
|
|
76
|
+
css: a,
|
|
77
|
+
width: m,
|
|
78
|
+
height: w,
|
|
79
|
+
utmParams: E,
|
|
80
|
+
syncModulesIds: u
|
|
81
|
+
});
|
|
82
|
+
c().actionsApi.getTemplateData(e);
|
|
52
83
|
}
|
|
53
84
|
);
|
|
54
85
|
return {
|
|
55
|
-
getCompiledEmail:
|
|
56
|
-
getTemplateData: () =>
|
|
57
|
-
"getTemplateData",
|
|
58
|
-
T,
|
|
59
|
-
(t) => {
|
|
60
|
-
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
61
|
-
html: i,
|
|
62
|
-
css: a,
|
|
63
|
-
width: o,
|
|
64
|
-
height: E,
|
|
65
|
-
utmParams: u,
|
|
66
|
-
syncModulesIds: m
|
|
67
|
-
});
|
|
68
|
-
s().actionsApi.getTemplateData(e);
|
|
69
|
-
}
|
|
70
|
-
),
|
|
86
|
+
getCompiledEmail: r,
|
|
87
|
+
getTemplateData: async ({ flushPendingEdits: t = !0 } = {}) => (t && await h(), s()),
|
|
71
88
|
activateCustomViewStyles: (t = !0) => {
|
|
72
|
-
|
|
89
|
+
c().actionsApi.activateCustomViewStyles(t);
|
|
73
90
|
},
|
|
74
91
|
getPreviewData: async (t) => {
|
|
75
92
|
try {
|
|
76
93
|
const {
|
|
77
94
|
html: e,
|
|
78
|
-
displayConditions:
|
|
95
|
+
displayConditions: o,
|
|
79
96
|
ampHtml: a = "",
|
|
80
|
-
ampErrors:
|
|
81
|
-
} = await
|
|
97
|
+
ampErrors: m = []
|
|
98
|
+
} = await r({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
82
99
|
return {
|
|
83
100
|
html: e,
|
|
84
101
|
ampHtml: a,
|
|
85
|
-
ampErrors:
|
|
86
|
-
displayConditions:
|
|
102
|
+
ampErrors: m,
|
|
103
|
+
displayConditions: o
|
|
87
104
|
};
|
|
88
105
|
} catch (e) {
|
|
89
|
-
return
|
|
106
|
+
return i(e, "Error loading preview"), {
|
|
90
107
|
html: "",
|
|
91
108
|
ampHtml: "",
|
|
92
109
|
ampErrors: [],
|
|
@@ -95,32 +112,32 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
95
112
|
}
|
|
96
113
|
},
|
|
97
114
|
updateTimerInClonedTemplate: () => new Promise((t) => {
|
|
98
|
-
var e,
|
|
99
|
-
if (typeof ((
|
|
115
|
+
var e, o;
|
|
116
|
+
if (typeof ((o = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : o.updateTimerInClonedTemplate) != "function") {
|
|
100
117
|
t(null);
|
|
101
118
|
return;
|
|
102
119
|
}
|
|
103
120
|
try {
|
|
104
|
-
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a,
|
|
105
|
-
a ? (
|
|
121
|
+
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, m) => {
|
|
122
|
+
a ? (i(a, "Failed to update timer in cloned template"), t(null)) : t(m || null);
|
|
106
123
|
});
|
|
107
124
|
} catch (a) {
|
|
108
|
-
|
|
125
|
+
i(a, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
109
126
|
}
|
|
110
127
|
}),
|
|
111
128
|
updateHtmlAndCss: (t, e) => {
|
|
112
|
-
const { actionsApi:
|
|
113
|
-
return
|
|
114
|
-
|
|
129
|
+
const { actionsApi: o } = c();
|
|
130
|
+
return T("updateHtmlAndCss", O, (a) => {
|
|
131
|
+
o.updateHtmlAndCss(t, e, () => a());
|
|
115
132
|
});
|
|
116
133
|
},
|
|
117
|
-
editorSave: () =>
|
|
134
|
+
editorSave: () => T(
|
|
118
135
|
"save",
|
|
119
|
-
|
|
136
|
+
C,
|
|
120
137
|
(t) => {
|
|
121
|
-
|
|
138
|
+
c().actionsApi.save((e) => {
|
|
122
139
|
if (e) {
|
|
123
|
-
|
|
140
|
+
i(e, "Failed to save template"), t(!1);
|
|
124
141
|
return;
|
|
125
142
|
}
|
|
126
143
|
t(!0);
|
|
@@ -130,5 +147,5 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
130
147
|
};
|
|
131
148
|
};
|
|
132
149
|
export {
|
|
133
|
-
|
|
150
|
+
z as useActionsApi
|
|
134
151
|
};
|
|
@@ -5,7 +5,7 @@ import { useEditorStore as w } from "../stores/editor.js";
|
|
|
5
5
|
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
6
|
import { watch as c, onUnmounted as z } from "vue";
|
|
7
7
|
const B = 500, G = () => {
|
|
8
|
-
const i = w(),
|
|
8
|
+
const i = w(), d = y(), l = T(), { getTemplateData: u } = v(), { runExclusive: m, isEditorBusy: p } = C();
|
|
9
9
|
let o = null, n = !1;
|
|
10
10
|
const r = () => {
|
|
11
11
|
o && (clearTimeout(o), o = null);
|
|
@@ -21,10 +21,10 @@ const B = 500, G = () => {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
|
-
const { html: E, css: I } = await m(
|
|
24
|
+
const { html: E, css: I } = await m(() => u({ flushPendingEdits: !1 })), b = ((s = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : s.templateId) ?? "";
|
|
25
25
|
if (n)
|
|
26
26
|
return;
|
|
27
|
-
|
|
27
|
+
d.$patch({
|
|
28
28
|
html: E ?? "",
|
|
29
29
|
css: I ?? "",
|
|
30
30
|
templateId: b,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
1
|
+
import { useActionsApi as O } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as q } from "./useBlocksConfig.js";
|
|
3
3
|
import { useConfig as H } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
@@ -17,7 +17,7 @@ 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 he = () => {
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: p } = H(), { handleError: m, showToaster: v } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } =
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: p } = H(), { handleError: m, showToaster: v } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = q(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((r, s) => {
|
|
21
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
r();
|
|
@@ -31,7 +31,7 @@ const he = () => {
|
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), D = async (r, s, o, a = [], i = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1),
|
|
34
|
+
const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), x = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
35
35
|
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
@@ -63,7 +63,7 @@ const he = () => {
|
|
|
63
63
|
copyPasteEnabled: !1,
|
|
64
64
|
selectElementAfterDrop: !0,
|
|
65
65
|
sameFontSizeForOutlook: !0,
|
|
66
|
-
allowedScriptSourceDomains:
|
|
66
|
+
allowedScriptSourceDomains: x,
|
|
67
67
|
...g ? { baseBlocks: g } : {},
|
|
68
68
|
editorFonts: {
|
|
69
69
|
showDefaultStandardFonts: !0,
|
|
@@ -89,8 +89,8 @@ const he = () => {
|
|
|
89
89
|
},
|
|
90
90
|
onTemplateLoaded() {
|
|
91
91
|
try {
|
|
92
|
-
const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } =
|
|
93
|
-
w().importCss(), t(),
|
|
92
|
+
const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = O(), { injectFullStory: L } = N();
|
|
93
|
+
w().importCss(), t(), L(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
94
94
|
e.hasChanges = !1;
|
|
95
95
|
}, 1e3);
|
|
96
96
|
} catch (t) {
|
|
@@ -107,7 +107,7 @@ const he = () => {
|
|
|
107
107
|
e.isVersionHistoryOpen = t;
|
|
108
108
|
},
|
|
109
109
|
onDataChanged() {
|
|
110
|
-
e.
|
|
110
|
+
e.markChanged();
|
|
111
111
|
},
|
|
112
112
|
onEvent: F,
|
|
113
113
|
onModuleAdd: A,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (a, l, t) =>
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var C = (a, l, t) => l in a ? b(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
|
|
3
|
+
var d = (a, l, t) => C(a, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { useConfig as g } from "../../../composables/useConfig.js";
|
|
5
|
-
import { BlockId as
|
|
6
|
-
import { getMigrationBannerHtml as
|
|
7
|
-
import { Block as
|
|
8
|
-
import { CURRENT_CONFIG_VERSION as
|
|
5
|
+
import { BlockId as A } from "../../../enums/block.js";
|
|
6
|
+
import { getMigrationBannerHtml as E } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
+
import { Block as S, BlockCompositionType as N, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { CURRENT_CONFIG_VERSION as w, PRE_RRS_CONFIG_VERSION as M } from "./constants/defaultConfig.js";
|
|
9
9
|
import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
|
|
10
|
-
import { regenerateMobileProductRows as
|
|
11
|
-
import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as
|
|
10
|
+
import { regenerateMobileProductRows as O } from "./controls/main/utils.js";
|
|
11
|
+
import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as x } from "./controls/mobileLayout/cssRules.js";
|
|
12
12
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
13
13
|
import { useRecommendationExtensionStore as h } from "./store/recommendation.js";
|
|
14
|
-
import { getDefaultTemplate as
|
|
15
|
-
import { useRecommendationBlockWarning as
|
|
16
|
-
import { registerNodeConfigWriter as
|
|
14
|
+
import { getDefaultTemplate as T } from "./templates/grid/template.js";
|
|
15
|
+
import { useRecommendationBlockWarning as H } from "./useRecommendationBlockWarning.js";
|
|
16
|
+
import { registerNodeConfigWriter as k } from "./utils/nodeConfigWriter.js";
|
|
17
17
|
import { refreshDuplicatedStrategyBlocks as $ } from "./utils/strategyCommit.js";
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
class Y extends
|
|
18
|
+
const D = A.Recommendation, u = "recommendation-block-v2", y = "hide-price";
|
|
19
|
+
let B = !1;
|
|
20
|
+
class Y extends S {
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
/**
|
|
@@ -31,13 +31,13 @@ class Y extends E {
|
|
|
31
31
|
d(this, "_unsettledDuplicateIds", /* @__PURE__ */ new Set());
|
|
32
32
|
}
|
|
33
33
|
getId() {
|
|
34
|
-
return
|
|
34
|
+
return D;
|
|
35
35
|
}
|
|
36
36
|
getIcon() {
|
|
37
37
|
return "recommendation-icon";
|
|
38
38
|
}
|
|
39
39
|
getBlockCompositionType() {
|
|
40
|
-
return
|
|
40
|
+
return N.CONTAINER;
|
|
41
41
|
}
|
|
42
42
|
getName() {
|
|
43
43
|
return this.api.translate("Recommendation Block");
|
|
@@ -48,8 +48,8 @@ class Y extends E {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
getSettingsPanelTitleHtml() {
|
|
51
|
-
return
|
|
52
|
-
|
|
51
|
+
return E(
|
|
52
|
+
D,
|
|
53
53
|
this.api.translate("Recommendation Block"),
|
|
54
54
|
this.api.translate("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.")
|
|
55
55
|
);
|
|
@@ -72,7 +72,11 @@ class Y extends E {
|
|
|
72
72
|
*/
|
|
73
73
|
getTemplate() {
|
|
74
74
|
const t = this._generateNextId();
|
|
75
|
-
return this._pendingBlockId = t,
|
|
75
|
+
return this._pendingBlockId = t, T(t);
|
|
76
|
+
}
|
|
77
|
+
// A restore can redraw blocks before any settings panel registered a document handle this session.
|
|
78
|
+
onDocumentInit() {
|
|
79
|
+
k(this.api);
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Called when a new block is dropped into the template
|
|
@@ -100,7 +104,7 @@ class Y extends E {
|
|
|
100
104
|
t,
|
|
101
105
|
{
|
|
102
106
|
recommendationId: i,
|
|
103
|
-
configVersion: n ?
|
|
107
|
+
configVersion: n ? w : M,
|
|
104
108
|
...o ? { partnerName: g().partnerName.value } : {},
|
|
105
109
|
// An RRS block picks a strategy, not an algorithm, and its algorithm control is
|
|
106
110
|
// hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
|
|
@@ -111,7 +115,7 @@ class Y extends E {
|
|
|
111
115
|
if (f.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), c) {
|
|
112
116
|
I(this.api);
|
|
113
117
|
const _ = this._getBlockElement(t);
|
|
114
|
-
_ && (R(this.api, _, !0),
|
|
118
|
+
_ && (R(this.api, _, !0), O({
|
|
115
119
|
currentNode: t,
|
|
116
120
|
documentModifier: this.api.getDocumentModifier()
|
|
117
121
|
}));
|
|
@@ -138,11 +142,11 @@ class Y extends E {
|
|
|
138
142
|
}
|
|
139
143
|
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
|
|
140
144
|
try {
|
|
141
|
-
|
|
145
|
+
B || (I(this.api), B = !0);
|
|
142
146
|
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
143
147
|
if (i) {
|
|
144
148
|
const n = !e.mobileLayoutEnabled;
|
|
145
|
-
|
|
149
|
+
x(i) !== n && R(this.api, i, n);
|
|
146
150
|
}
|
|
147
151
|
} catch {
|
|
148
152
|
}
|
|
@@ -172,7 +176,7 @@ class Y extends E {
|
|
|
172
176
|
*/
|
|
173
177
|
_warnIfMultipleBlocks() {
|
|
174
178
|
try {
|
|
175
|
-
|
|
179
|
+
H().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
176
180
|
} catch {
|
|
177
181
|
}
|
|
178
182
|
}
|
|
@@ -264,7 +268,7 @@ class Y extends E {
|
|
|
264
268
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
265
269
|
_handleDuplicate(t, e) {
|
|
266
270
|
const i = this._reassignDuplicateId(t, e), n = h();
|
|
267
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e),
|
|
271
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), k(this.api), $(e, i, s.getConfig(t)).catch((o) => console.error("[recommendation] refreshing a duplicated strategy failed", o))), this._warnIfMultipleBlocks();
|
|
268
272
|
}
|
|
269
273
|
/**
|
|
270
274
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -320,7 +324,7 @@ class Y extends E {
|
|
|
320
324
|
*/
|
|
321
325
|
_stampHidePrice(t, e) {
|
|
322
326
|
const i = this._getBlockElement(t);
|
|
323
|
-
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(
|
|
327
|
+
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(y, String(e)).apply(new p("Stamp hide-price"));
|
|
324
328
|
}
|
|
325
329
|
/**
|
|
326
330
|
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
@@ -328,7 +332,7 @@ class Y extends E {
|
|
|
328
332
|
*/
|
|
329
333
|
_healHidePriceAttr(t) {
|
|
330
334
|
const e = this._getBlockElement(t);
|
|
331
|
-
if (!e || !("getAttribute" in e) || e.getAttribute(
|
|
335
|
+
if (!e || !("getAttribute" in e) || e.getAttribute(y) !== null)
|
|
332
336
|
return;
|
|
333
337
|
const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
|
|
334
338
|
this._stampHidePrice(t, i);
|
|
@@ -365,6 +369,6 @@ class Y extends E {
|
|
|
365
369
|
}
|
|
366
370
|
}
|
|
367
371
|
export {
|
|
368
|
-
|
|
372
|
+
D as BLOCK_ID,
|
|
369
373
|
Y as RecommendationBlock
|
|
370
374
|
};
|