@useinsider/guido 3.18.2-beta.a5a0a11 → 3.18.2-beta.c0ef411
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 +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/base/Toaster.vue2.js +12 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -74
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +37 -23
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/composables/useCustomInterfaceAppearance.js +46 -56
- package/dist/composables/useHtmlValidator.js +82 -87
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +20 -14
- package/dist/enums/extensions/recommendationBlock.js +31 -38
- package/dist/extensions/Blocks/Recommendation/block.js +42 -61
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +35 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +140 -260
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +16 -26
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +2 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -86
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/stores/onboarding.d.ts +0 -377
- package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
- package/dist/stores/onboarding.js +36 -41
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +1 -1
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +0 -24
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -14
- package/dist/static/styles/components/skeleton.css.js +0 -23
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
1
|
+
import { useActionsApi as L } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as q } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
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";
|
|
10
10
|
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
-
import { en as
|
|
11
|
+
import { en as w } from "../config/i18n/en/index.js";
|
|
12
12
|
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
13
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
14
14
|
import Q from "../static/styles/customEditorStyle.css.js";
|
|
15
|
-
import { useEditorStore as
|
|
15
|
+
import { useEditorStore as b } from "../stores/editor.js";
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } =
|
|
19
|
+
const Ce = () => {
|
|
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
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
@@ -29,16 +29,16 @@ const he = () => {
|
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n),
|
|
32
|
+
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e =
|
|
35
|
-
|
|
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
|
+
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
41
|
-
forceRecreate:
|
|
40
|
+
css: D,
|
|
41
|
+
forceRecreate: U,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
44
44
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -52,7 +52,7 @@ const he = () => {
|
|
|
52
52
|
conditionsEnabled: S,
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
|
-
modulesDisabled:
|
|
55
|
+
modulesDisabled: P,
|
|
56
56
|
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
@@ -62,7 +62,7 @@ const he = () => {
|
|
|
62
62
|
displayUTM: !1,
|
|
63
63
|
selectElementAfterDrop: !0,
|
|
64
64
|
sameFontSizeForOutlook: !0,
|
|
65
|
-
allowedScriptSourceDomains:
|
|
65
|
+
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
66
66
|
...g ? { baseBlocks: g } : {},
|
|
67
67
|
editorFonts: {
|
|
68
68
|
showDefaultStandardFonts: !0,
|
|
@@ -80,7 +80,7 @@ const he = () => {
|
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const l = await
|
|
83
|
+
const l = await B();
|
|
84
84
|
t(l);
|
|
85
85
|
} catch (l) {
|
|
86
86
|
p(l, "Failed to refresh token");
|
|
@@ -88,8 +88,8 @@ const he = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const {
|
|
92
|
-
|
|
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,34 +108,34 @@ const he = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
113
|
-
notifications:
|
|
111
|
+
onEvent: v,
|
|
112
|
+
onModuleAdd: F,
|
|
113
|
+
notifications: V(),
|
|
114
114
|
ignoreClickOutsideSelectors: [
|
|
115
115
|
"#guido-dynamic-content-modal",
|
|
116
116
|
".in-on-board-wrapper",
|
|
117
117
|
".in-drawer__container"
|
|
118
118
|
],
|
|
119
|
-
extensions:
|
|
119
|
+
extensions: R,
|
|
120
120
|
localePatch: J
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
return { initPlugin: async (i, s, o) => {
|
|
125
|
-
const a =
|
|
125
|
+
const a = b();
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
M(),
|
|
130
|
+
T()
|
|
131
131
|
]);
|
|
132
|
-
a.syncModulesEnabled = e, await
|
|
132
|
+
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
134
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, k({
|
|
135
135
|
type: X.Error,
|
|
136
|
-
message:
|
|
136
|
+
message: w["An error has occurred. Please report the error code to support."],
|
|
137
137
|
actionButton: {
|
|
138
|
-
text:
|
|
138
|
+
text: w["Reload page"],
|
|
139
139
|
onClick: () => window.location.reload()
|
|
140
140
|
}
|
|
141
141
|
});
|
|
@@ -146,5 +146,5 @@ const he = () => {
|
|
|
146
146
|
} };
|
|
147
147
|
};
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Ce as useStripo
|
|
150
150
|
};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
2
|
import { useToasterStore as c } from "../stores/toaster.js";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { watch as u, nextTick as f } from "vue";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const o = c();
|
|
6
|
+
let t = null;
|
|
7
|
+
const s = () => {
|
|
8
|
+
t && (clearTimeout(t), t = null);
|
|
8
9
|
};
|
|
9
|
-
function r(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
e.hideToaster(), o();
|
|
13
|
-
}, 6e3));
|
|
10
|
+
function r(e = { message: "" }) {
|
|
11
|
+
s(), o.hideToaster(), f(() => {
|
|
12
|
+
o.showToaster(e);
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
function i() {
|
|
17
|
-
|
|
16
|
+
s(), o.hideToaster();
|
|
18
17
|
}
|
|
19
|
-
function n(
|
|
20
|
-
const m =
|
|
18
|
+
function n(e, a) {
|
|
19
|
+
const m = e instanceof Error ? e.message : String(e);
|
|
21
20
|
r({ type: T.Error, message: `${a}: ${m}` });
|
|
22
21
|
}
|
|
23
|
-
return
|
|
22
|
+
return u(
|
|
23
|
+
() => o.shouldAutoHide,
|
|
24
|
+
(e) => {
|
|
25
|
+
s(), e && (t = setTimeout(() => {
|
|
26
|
+
o.hideToaster(), s();
|
|
27
|
+
}, 6e3));
|
|
28
|
+
}
|
|
29
|
+
), { showToaster: r, hideToaster: i, handleError: n };
|
|
24
30
|
};
|
|
25
31
|
export {
|
|
26
32
|
p as useToaster
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
const
|
|
1
|
+
import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
2
|
+
const l = {
|
|
3
3
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
4
|
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
|
-
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
8
|
-
|
|
9
|
-
// without this flag can never be Email-suitable and would never reach the editor's list.
|
|
10
|
-
RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
|
|
11
|
-
}, d = (e) => {
|
|
12
|
-
const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
|
|
13
|
-
return `${r}/${e}/edit?isEmail=true`;
|
|
14
|
-
}, m = {
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
8
|
+
}, c = {
|
|
15
9
|
CLIENT_ID: "clientId"
|
|
16
|
-
},
|
|
17
|
-
const e =
|
|
10
|
+
}, d = () => {
|
|
11
|
+
const e = r();
|
|
18
12
|
return [
|
|
19
13
|
{
|
|
20
14
|
id: 11,
|
|
@@ -77,14 +71,14 @@ const o = {
|
|
|
77
71
|
path: "top-sellers"
|
|
78
72
|
}
|
|
79
73
|
];
|
|
80
|
-
},
|
|
74
|
+
}, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
|
|
81
75
|
{ text: "before the amount", value: "0" },
|
|
82
76
|
{ text: "after the amount", value: "1" }
|
|
83
|
-
],
|
|
77
|
+
], v = [
|
|
84
78
|
{ text: "dot(.)", value: "." },
|
|
85
79
|
{ text: "comma(,)", value: "," },
|
|
86
80
|
{ text: "space( )", value: " " }
|
|
87
|
-
],
|
|
81
|
+
], h = [
|
|
88
82
|
{ text: "0", value: "0" },
|
|
89
83
|
{ text: "1", value: "1" },
|
|
90
84
|
{ text: "2", value: "2" },
|
|
@@ -96,55 +90,54 @@ const o = {
|
|
|
96
90
|
{ text: "contains", value: "~" },
|
|
97
91
|
{ text: "does not contain", value: "!~" },
|
|
98
92
|
{ text: "any of", value: a }
|
|
99
|
-
],
|
|
93
|
+
], n = [
|
|
100
94
|
{ text: "is exactly", value: "=" },
|
|
101
95
|
{ text: "is not exactly", value: "!==" },
|
|
102
96
|
{ text: "contains", value: "~" },
|
|
103
97
|
{ text: "does not contain", value: "!~" },
|
|
104
98
|
{ text: "any of", value: a }
|
|
105
|
-
],
|
|
99
|
+
], o = [
|
|
106
100
|
{ text: "is equal to", value: "=" },
|
|
107
101
|
{ text: "is greater than", value: ">" },
|
|
108
102
|
{ text: "is less than", value: "<" }
|
|
109
|
-
],
|
|
103
|
+
], s = [
|
|
110
104
|
{ text: "is equal to", value: "=" },
|
|
111
105
|
{ text: "after", value: ">" },
|
|
112
106
|
{ text: "before", value: "<" }
|
|
113
|
-
],
|
|
107
|
+
], i = [
|
|
114
108
|
{ text: "true", value: "==" },
|
|
115
109
|
{ text: "false", value: "!=" }
|
|
116
|
-
],
|
|
110
|
+
], x = (e) => {
|
|
117
111
|
if (!e)
|
|
118
112
|
return t;
|
|
119
113
|
switch (e) {
|
|
120
114
|
case "Boolean":
|
|
121
|
-
return
|
|
115
|
+
return i;
|
|
122
116
|
case "Date":
|
|
123
|
-
return
|
|
117
|
+
return s;
|
|
124
118
|
case "Number":
|
|
125
|
-
return
|
|
119
|
+
return o;
|
|
126
120
|
case "String":
|
|
127
121
|
return t;
|
|
128
122
|
case "Strings":
|
|
129
|
-
return
|
|
123
|
+
return n;
|
|
130
124
|
default:
|
|
131
125
|
return t;
|
|
132
126
|
}
|
|
133
127
|
};
|
|
134
128
|
export {
|
|
135
129
|
a as OP_ANY_OF,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
t as operatorOptionsForStrings
|
|
149
|
-
d as strategyEditPath
|
|
130
|
+
m as PriceAttributes,
|
|
131
|
+
c as QUERY_PARAMS,
|
|
132
|
+
l as URLS,
|
|
133
|
+
h as currencyDecimalCounts,
|
|
134
|
+
p as currencyLocationMaps,
|
|
135
|
+
v as currencyOperators,
|
|
136
|
+
x as getOperatorOptions,
|
|
137
|
+
d as getRecommendationFeedSourceMaps,
|
|
138
|
+
n as operatorOptionsForArrayOfStrings,
|
|
139
|
+
i as operatorOptionsForBooleans,
|
|
140
|
+
s as operatorOptionsForDates,
|
|
141
|
+
o as operatorOptionsForNumbers,
|
|
142
|
+
t as operatorOptionsForStrings
|
|
150
143
|
};
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { BlockId as
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var B = (a, c, t) => c in a ? R(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
|
|
3
|
+
var p = (a, c, t) => B(a, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
import { useConfig as D } from "../../../composables/useConfig.js";
|
|
5
|
+
import { BlockId as y } from "../../../enums/block.js";
|
|
6
6
|
import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
-
import { Block as
|
|
8
|
-
import { CURRENT_CONFIG_VERSION as
|
|
7
|
+
import { Block as b, BlockCompositionType as A, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { CURRENT_CONFIG_VERSION as E, PRE_RRS_CONFIG_VERSION as S } from "./constants/defaultConfig.js";
|
|
9
9
|
import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
|
|
10
|
-
import { regenerateMobileProductRows as
|
|
11
|
-
import { ensureMobileCssRulesExist as
|
|
10
|
+
import { regenerateMobileProductRows as N } from "./controls/main/utils.js";
|
|
11
|
+
import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
|
|
12
12
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
13
13
|
import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
|
|
14
|
-
import { getDefaultTemplate as
|
|
15
|
-
import { useRecommendationBlockWarning as
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
class
|
|
14
|
+
import { getDefaultTemplate as M } from "./templates/grid/template.js";
|
|
15
|
+
import { useRecommendationBlockWarning as w } from "./useRecommendationBlockWarning.js";
|
|
16
|
+
const _ = y.Recommendation, u = "recommendation-block-v2", I = "hide-price";
|
|
17
|
+
let k = !1;
|
|
18
|
+
class W extends b {
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
21
|
/**
|
|
22
22
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
23
23
|
* This avoids generating a new (different) ID in onCreated().
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
/** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
|
|
27
|
-
g(this, "_resetSourceIds", /* @__PURE__ */ new Set());
|
|
25
|
+
p(this, "_pendingBlockId", null);
|
|
28
26
|
}
|
|
29
27
|
getId() {
|
|
30
|
-
return
|
|
28
|
+
return _;
|
|
31
29
|
}
|
|
32
30
|
getIcon() {
|
|
33
31
|
return "recommendation-icon";
|
|
34
32
|
}
|
|
35
33
|
getBlockCompositionType() {
|
|
36
|
-
return
|
|
34
|
+
return A.CONTAINER;
|
|
37
35
|
}
|
|
38
36
|
getName() {
|
|
39
37
|
return this.api.translate("Recommendation Block");
|
|
@@ -45,7 +43,7 @@ class j extends E {
|
|
|
45
43
|
}
|
|
46
44
|
getSettingsPanelTitleHtml() {
|
|
47
45
|
return C(
|
|
48
|
-
|
|
46
|
+
_,
|
|
49
47
|
this.api.translate("Recommendation Block"),
|
|
50
48
|
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.")
|
|
51
49
|
);
|
|
@@ -68,7 +66,7 @@ class j extends E {
|
|
|
68
66
|
*/
|
|
69
67
|
getTemplate() {
|
|
70
68
|
const t = this._generateNextId();
|
|
71
|
-
return this._pendingBlockId = t,
|
|
69
|
+
return this._pendingBlockId = t, M(t);
|
|
72
70
|
}
|
|
73
71
|
/**
|
|
74
72
|
* Called when a new block is dropped into the template
|
|
@@ -81,37 +79,33 @@ class j extends E {
|
|
|
81
79
|
const e = this._getRecommendationId(t);
|
|
82
80
|
if (e !== null && e > 0) {
|
|
83
81
|
if (this._detectDuplicate(e)) {
|
|
84
|
-
this._handleDuplicate(t, e)
|
|
82
|
+
this._handleDuplicate(t, e);
|
|
85
83
|
return;
|
|
86
84
|
}
|
|
87
85
|
this._pendingBlockId === null && setTimeout(() => {
|
|
88
86
|
this._getBlockElement(t) && this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
89
|
-
}, 0)
|
|
87
|
+
}, 0);
|
|
90
88
|
return;
|
|
91
89
|
}
|
|
92
90
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
93
91
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
94
|
-
const
|
|
92
|
+
const { config: n, wasFreshDrop: o } = s.initializeConfig(
|
|
95
93
|
this.api,
|
|
96
94
|
t,
|
|
97
95
|
{
|
|
98
96
|
recommendationId: i,
|
|
99
|
-
configVersion:
|
|
100
|
-
// An RRS block picks a strategy, not an algorithm, and its algorithm control is
|
|
101
|
-
// hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
|
|
102
|
-
// at save for a block the user never configured.
|
|
103
|
-
...o ? { strategy: "" } : {}
|
|
97
|
+
configVersion: D().isFeatureEnabled("reusableRecommendationStrategy") ? E : S
|
|
104
98
|
}
|
|
105
|
-
),
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
99
|
+
), r = d();
|
|
100
|
+
if (r.setCurrentBlock(i), this._stampHidePrice(t, n.priceHideIfSameAsDiscounted), o) {
|
|
101
|
+
h(this.api);
|
|
102
|
+
const l = this._getBlockElement(t);
|
|
103
|
+
l && (f(this.api, l, !0), N({
|
|
110
104
|
currentNode: t,
|
|
111
105
|
documentModifier: this.api.getDocumentModifier()
|
|
112
106
|
}));
|
|
113
107
|
}
|
|
114
|
-
|
|
108
|
+
r.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
115
109
|
}
|
|
116
110
|
/**
|
|
117
111
|
* Called when the document changes or template is loaded
|
|
@@ -133,11 +127,11 @@ class j extends E {
|
|
|
133
127
|
}
|
|
134
128
|
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
|
|
135
129
|
try {
|
|
136
|
-
|
|
130
|
+
k || (h(this.api), k = !0);
|
|
137
131
|
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
138
132
|
if (i) {
|
|
139
133
|
const n = !e.mobileLayoutEnabled;
|
|
140
|
-
|
|
134
|
+
O(i) !== n && f(this.api, i, n);
|
|
141
135
|
}
|
|
142
136
|
} catch {
|
|
143
137
|
}
|
|
@@ -167,7 +161,7 @@ class j extends E {
|
|
|
167
161
|
*/
|
|
168
162
|
_warnIfMultipleBlocks() {
|
|
169
163
|
try {
|
|
170
|
-
|
|
164
|
+
w().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
171
165
|
} catch {
|
|
172
166
|
}
|
|
173
167
|
}
|
|
@@ -189,19 +183,6 @@ class j extends E {
|
|
|
189
183
|
}
|
|
190
184
|
return t + 1;
|
|
191
185
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Drops the "already fetched" claims of a block that arrived holding a baked id
|
|
194
|
-
* (saved module, paste, duplicate), so the settings panel reads its strategy again.
|
|
195
|
-
*
|
|
196
|
-
* Deferred a tick: the collision handlers rename a sibling first, and either sibling can be
|
|
197
|
-
* the renamed one depending on where the module was dropped (SD-149916).
|
|
198
|
-
*/
|
|
199
|
-
_scheduleArrivalReset(t) {
|
|
200
|
-
h().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
|
|
201
|
-
const e = this._getRecommendationId(t);
|
|
202
|
-
e !== null && e > 0 && !this._resetSourceIds.delete(e) && d().resetArrivedBlock(e);
|
|
203
|
-
}, 0);
|
|
204
|
-
}
|
|
205
186
|
/**
|
|
206
187
|
* Heals a duplicate that slipped past the create-time `_detectDuplicate`
|
|
207
188
|
* scan (or that was persisted by an older template before SD-142352).
|
|
@@ -230,9 +211,9 @@ class j extends E {
|
|
|
230
211
|
if (!o)
|
|
231
212
|
return;
|
|
232
213
|
let r = -1;
|
|
233
|
-
for (let
|
|
234
|
-
if (n[
|
|
235
|
-
r =
|
|
214
|
+
for (let l = 0; l < n.length; l++)
|
|
215
|
+
if (n[l] === o) {
|
|
216
|
+
r = l;
|
|
236
217
|
break;
|
|
237
218
|
}
|
|
238
219
|
if (r <= 0)
|
|
@@ -256,7 +237,7 @@ class j extends E {
|
|
|
256
237
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
257
238
|
_handleDuplicate(t, e) {
|
|
258
239
|
const i = this._reassignDuplicateId(t, e), n = d();
|
|
259
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i),
|
|
240
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
|
|
260
241
|
}
|
|
261
242
|
/**
|
|
262
243
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -289,7 +270,7 @@ class j extends E {
|
|
|
289
270
|
if (!("getAttribute" in t))
|
|
290
271
|
return;
|
|
291
272
|
const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, r = this.api.getDocumentModifier();
|
|
292
|
-
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new
|
|
273
|
+
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new g(
|
|
293
274
|
`Reassign recommendation instance class ${n} -> ${o}`
|
|
294
275
|
));
|
|
295
276
|
}
|
|
@@ -304,7 +285,7 @@ class j extends E {
|
|
|
304
285
|
if (!i)
|
|
305
286
|
return;
|
|
306
287
|
const n = this.api.getDocumentModifier();
|
|
307
|
-
n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new
|
|
288
|
+
n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new g(`Assign recommendation ID ${e}`));
|
|
308
289
|
}
|
|
309
290
|
/**
|
|
310
291
|
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
@@ -312,7 +293,7 @@ class j extends E {
|
|
|
312
293
|
*/
|
|
313
294
|
_stampHidePrice(t, e) {
|
|
314
295
|
const i = this._getBlockElement(t);
|
|
315
|
-
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(
|
|
296
|
+
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(I, String(e)).apply(new g("Stamp hide-price"));
|
|
316
297
|
}
|
|
317
298
|
/**
|
|
318
299
|
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
@@ -320,7 +301,7 @@ class j extends E {
|
|
|
320
301
|
*/
|
|
321
302
|
_healHidePriceAttr(t) {
|
|
322
303
|
const e = this._getBlockElement(t);
|
|
323
|
-
if (!e || !("getAttribute" in e) || e.getAttribute(
|
|
304
|
+
if (!e || !("getAttribute" in e) || e.getAttribute(I) !== null)
|
|
324
305
|
return;
|
|
325
306
|
const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
|
|
326
307
|
this._stampHidePrice(t, i);
|
|
@@ -357,6 +338,6 @@ class j extends E {
|
|
|
357
338
|
}
|
|
358
339
|
}
|
|
359
340
|
export {
|
|
360
|
-
|
|
361
|
-
|
|
341
|
+
_ as BLOCK_ID,
|
|
342
|
+
W as RecommendationBlock
|
|
362
343
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DEFAULT_COLUMN_SPACING as
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as n, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as i, ATTR_RECOMMENDATION_TITLE as U } from "./selectors.js";
|
|
3
|
+
const A = 1, u = 2, D = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, E = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
13
|
}, a = {
|
|
@@ -18,26 +18,26 @@ const U = 1, u = 2, m = 2, A = {
|
|
|
18
18
|
t,
|
|
19
19
|
_,
|
|
20
20
|
T,
|
|
21
|
+
r,
|
|
21
22
|
I,
|
|
22
|
-
|
|
23
|
-
r
|
|
23
|
+
i
|
|
24
24
|
], N = {
|
|
25
|
-
[
|
|
25
|
+
[U]: !0,
|
|
26
26
|
[o]: !0,
|
|
27
27
|
[t]: !0,
|
|
28
28
|
[T]: !0,
|
|
29
29
|
[_]: !0,
|
|
30
|
+
[r]: !1,
|
|
30
31
|
[I]: !1,
|
|
31
|
-
[
|
|
32
|
-
|
|
33
|
-
}, L = {
|
|
32
|
+
[i]: !0
|
|
33
|
+
}, m = {
|
|
34
34
|
// Settings
|
|
35
35
|
strategy: "mostPopular",
|
|
36
36
|
productIds: [],
|
|
37
37
|
size: "6",
|
|
38
38
|
shuffleProducts: !1,
|
|
39
39
|
language: "en_US",
|
|
40
|
-
currency:
|
|
40
|
+
currency: D,
|
|
41
41
|
filters: [],
|
|
42
42
|
strategyId: "",
|
|
43
43
|
// Layout
|
|
@@ -46,7 +46,7 @@ const U = 1, u = 2, m = 2, A = {
|
|
|
46
46
|
mobileCardsInRow: e,
|
|
47
47
|
mobileLayoutEnabled: !1,
|
|
48
48
|
previousMobileCardsInRow: e,
|
|
49
|
-
columnSpacing:
|
|
49
|
+
columnSpacing: R,
|
|
50
50
|
rowSpacing: s,
|
|
51
51
|
mobileColumnSpacing: O,
|
|
52
52
|
mobileRowSpacing: n,
|
|
@@ -55,7 +55,7 @@ const U = 1, u = 2, m = 2, A = {
|
|
|
55
55
|
visibility: N,
|
|
56
56
|
previousTitleHtml: "",
|
|
57
57
|
// Element settings
|
|
58
|
-
omnibusPrice:
|
|
58
|
+
omnibusPrice: E,
|
|
59
59
|
omnibusDiscount: a,
|
|
60
60
|
textTrimming: !1,
|
|
61
61
|
// Price placement (block-level, affects all cards)
|
|
@@ -66,18 +66,17 @@ const U = 1, u = 2, m = 2, A = {
|
|
|
66
66
|
// of "false" (the actual hiding happens server-side at send).
|
|
67
67
|
priceHideIfSameAsDiscounted: !1,
|
|
68
68
|
// Meta
|
|
69
|
-
configVersion:
|
|
69
|
+
configVersion: A,
|
|
70
70
|
recommendationId: 0
|
|
71
|
-
},
|
|
71
|
+
}, L = [11, 12];
|
|
72
72
|
export {
|
|
73
73
|
u as CURRENT_CONFIG_VERSION,
|
|
74
74
|
c as DEFAULT_COMPOSITION,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
D as DEFAULT_CURRENCY,
|
|
76
|
+
m as DEFAULT_NODE_CONFIG,
|
|
77
77
|
a as DEFAULT_OMNIBUS_DISCOUNT,
|
|
78
|
-
|
|
78
|
+
E as DEFAULT_OMNIBUS_PRICE,
|
|
79
79
|
N as DEFAULT_VISIBILITY,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
m as RRS_CONFIG_VERSION
|
|
80
|
+
L as EXCLUDED_ALGORITHM_IDS,
|
|
81
|
+
A as PRE_RRS_CONFIG_VERSION
|
|
83
82
|
};
|