@useinsider/guido 3.18.2-beta.3e1d9ab → 3.18.2-beta.6cafced
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/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -51
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useCustomInterfaceAppearance.js +56 -46
- package/dist/composables/useHtmlValidator.js +84 -79
- package/dist/composables/useHttp.js +22 -24
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/enums/extensions/recommendationBlock.js +38 -31
- package/dist/extensions/Blocks/Recommendation/block.js +43 -39
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +189 -90
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +14 -17
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +75 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/src/utils/genericUtil.d.ts +0 -6
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/onboarding.js +41 -36
- package/dist/utils/genericUtil.js +54 -63
- package/dist/utils/templatePreparation.js +59 -60
- package/package.json +1 -1
- package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
- package/dist/utils/liquidDynamicContent.js +0 -15
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
3
|
+
import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
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:
|
|
10
|
+
mobileLeftPadding: s,
|
|
11
11
|
mobileRightPadding: c,
|
|
12
|
-
cardsInRow:
|
|
13
|
-
unresponsive:
|
|
12
|
+
cardsInRow: o,
|
|
13
|
+
unresponsive: a
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return (C - e) /
|
|
15
|
+
const i = a ? o : 1, e = s + c + (i - 1) * R;
|
|
16
|
+
return (C - e) / i;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const c =
|
|
20
|
-
if (!
|
|
18
|
+
getRecommendationCampaignData: (s) => {
|
|
19
|
+
const c = g(), o = Number(s), a = c.blockStates[o];
|
|
20
|
+
if (!a)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
23
23
|
orientation: "vertical",
|
|
@@ -30,54 +30,59 @@ const B = () => ({
|
|
|
30
30
|
discountBeforeTextValue: "",
|
|
31
31
|
discountAfterTextValue: ""
|
|
32
32
|
};
|
|
33
|
-
const { recommendationConfigs:
|
|
33
|
+
const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
34
|
return {
|
|
35
|
-
textTrimming:
|
|
35
|
+
textTrimming: i.textTrimming,
|
|
36
36
|
orientation: e,
|
|
37
37
|
mobileLeftPadding: 0,
|
|
38
38
|
mobileRightPadding: 0,
|
|
39
|
-
cardsInRow:
|
|
40
|
-
unresponsive:
|
|
39
|
+
cardsInRow: i.cardsInRow,
|
|
40
|
+
unresponsive: i.unresponsive,
|
|
41
41
|
priceBeforeTextValue: "",
|
|
42
42
|
priceAfterTextValue: "",
|
|
43
43
|
discountBeforeTextValue: "",
|
|
44
44
|
discountAfterTextValue: ""
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
buildCampaignUrl: (
|
|
48
|
-
var
|
|
49
|
-
const
|
|
47
|
+
buildCampaignUrl: (s, c) => {
|
|
48
|
+
var l;
|
|
49
|
+
const o = g(), a = P(), i = Number(s);
|
|
50
50
|
let e;
|
|
51
51
|
if (c)
|
|
52
52
|
e = c;
|
|
53
53
|
else {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const r = o.blockStates[i];
|
|
55
|
+
if (!r)
|
|
56
56
|
return "";
|
|
57
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: n } = r;
|
|
58
58
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
strategyId:
|
|
61
|
-
language:
|
|
62
|
-
currencyCode:
|
|
63
|
-
size:
|
|
64
|
-
productIds:
|
|
65
|
-
filters:
|
|
66
|
-
shuffleProducts:
|
|
59
|
+
strategy: n.strategy,
|
|
60
|
+
strategyId: n.strategyId,
|
|
61
|
+
language: n.language,
|
|
62
|
+
currencyCode: n.currencySettings.value,
|
|
63
|
+
size: n.size,
|
|
64
|
+
productIds: n.productIds,
|
|
65
|
+
filters: n.filters,
|
|
66
|
+
shuffleProducts: n.shuffleProducts
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
if (e.strategyId &&
|
|
70
|
-
return
|
|
69
|
+
if (e.strategyId && a.isFeatureEnabled("reusableRecommendationStrategy"))
|
|
70
|
+
return o.recommendationCampaignUrls[s] = {
|
|
71
71
|
strategyId: e.strategyId,
|
|
72
72
|
locale: e.language,
|
|
73
73
|
currency: e.currencyCode
|
|
74
74
|
}, "";
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const d = ((l = y().find((r) => r.key === e.strategy)) == null ? void 0 : l.path) || "";
|
|
76
|
+
if (!d) {
|
|
77
|
+
const r = { ...o.recommendationCampaignUrls };
|
|
78
|
+
return delete r[s], o.recommendationCampaignUrls = r, "";
|
|
79
|
+
}
|
|
80
|
+
const t = new URLSearchParams();
|
|
81
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.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}");
|
|
82
|
+
const f = e.filters.filter((r) => r.isValid), m = b(f);
|
|
83
|
+
m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
|
|
84
|
+
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
|
|
85
|
+
return o.recommendationCampaignUrls[s] = u, u;
|
|
81
86
|
}
|
|
82
87
|
});
|
|
83
88
|
export {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
1
|
+
import { useActionsApi as O } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as q } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as H } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as w } 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 b } 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 k } 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 he = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = q(), { getStripoNotifications: _ } = $(), 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 Ce = () => {
|
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n),
|
|
32
|
+
}), n), D = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e =
|
|
35
|
-
await window.UIEditor.initEditor(
|
|
34
|
+
const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = 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
|
+
w().importCss(), 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: R,
|
|
41
|
+
forceRecreate: I,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
44
44
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -52,7 +52,7 @@ const Ce = () => {
|
|
|
52
52
|
conditionsEnabled: S,
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
|
-
modulesDisabled:
|
|
55
|
+
modulesDisabled: U,
|
|
56
56
|
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
@@ -62,7 +62,7 @@ const Ce = () => {
|
|
|
62
62
|
displayUTM: !1,
|
|
63
63
|
selectElementAfterDrop: !0,
|
|
64
64
|
sameFontSizeForOutlook: !0,
|
|
65
|
-
allowedScriptSourceDomains:
|
|
65
|
+
allowedScriptSourceDomains: x,
|
|
66
66
|
...g ? { baseBlocks: g } : {},
|
|
67
67
|
editorFonts: {
|
|
68
68
|
showDefaultStandardFonts: !0,
|
|
@@ -80,7 +80,7 @@ const Ce = () => {
|
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const l = await
|
|
83
|
+
const l = await M();
|
|
84
84
|
t(l);
|
|
85
85
|
} catch (l) {
|
|
86
86
|
p(l, "Failed to refresh token");
|
|
@@ -88,8 +88,8 @@ const Ce = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const {
|
|
92
|
-
|
|
91
|
+
const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = O(), { injectFullStory: L } = N();
|
|
92
|
+
w().importCss(), t(), L(), l(), 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 Ce = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
113
|
-
notifications:
|
|
111
|
+
onEvent: F,
|
|
112
|
+
onModuleAdd: A,
|
|
113
|
+
notifications: _(),
|
|
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: P,
|
|
120
120
|
localePatch: J
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
return { initPlugin: async (i, s, o) => {
|
|
125
|
-
const a =
|
|
125
|
+
const a = k();
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
131
131
|
]);
|
|
132
|
-
a.syncModulesEnabled = e, await
|
|
132
|
+
a.syncModulesEnabled = e, await D(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
134
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, B({
|
|
135
135
|
type: X.Error,
|
|
136
|
-
message:
|
|
136
|
+
message: b["An error has occurred. Please report the error code to support."],
|
|
137
137
|
actionButton: {
|
|
138
|
-
text:
|
|
138
|
+
text: b["Reload page"],
|
|
139
139
|
onClick: () => window.location.reload()
|
|
140
140
|
}
|
|
141
141
|
});
|
|
@@ -146,5 +146,5 @@ const Ce = () => {
|
|
|
146
146
|
} };
|
|
147
147
|
};
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
he as useStripo
|
|
150
150
|
};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
const
|
|
1
|
+
import { useTranslations as n } from "../../composables/useTranslations.js";
|
|
2
|
+
const o = {
|
|
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
|
-
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
|
|
8
|
+
// Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
|
|
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 = {
|
|
9
15
|
CLIENT_ID: "clientId"
|
|
10
|
-
},
|
|
11
|
-
const e =
|
|
16
|
+
}, p = () => {
|
|
17
|
+
const e = n();
|
|
12
18
|
return [
|
|
13
19
|
{
|
|
14
20
|
id: 11,
|
|
@@ -71,14 +77,14 @@ const l = {
|
|
|
71
77
|
path: "top-sellers"
|
|
72
78
|
}
|
|
73
79
|
];
|
|
74
|
-
},
|
|
80
|
+
}, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
|
|
75
81
|
{ text: "before the amount", value: "0" },
|
|
76
82
|
{ text: "after the amount", value: "1" }
|
|
77
|
-
],
|
|
83
|
+
], x = [
|
|
78
84
|
{ text: "dot(.)", value: "." },
|
|
79
85
|
{ text: "comma(,)", value: "," },
|
|
80
86
|
{ text: "space( )", value: " " }
|
|
81
|
-
],
|
|
87
|
+
], E = [
|
|
82
88
|
{ text: "0", value: "0" },
|
|
83
89
|
{ text: "1", value: "1" },
|
|
84
90
|
{ text: "2", value: "2" },
|
|
@@ -90,54 +96,55 @@ const l = {
|
|
|
90
96
|
{ text: "contains", value: "~" },
|
|
91
97
|
{ text: "does not contain", value: "!~" },
|
|
92
98
|
{ text: "any of", value: a }
|
|
93
|
-
],
|
|
99
|
+
], s = [
|
|
94
100
|
{ text: "is exactly", value: "=" },
|
|
95
101
|
{ text: "is not exactly", value: "!==" },
|
|
96
102
|
{ text: "contains", value: "~" },
|
|
97
103
|
{ text: "does not contain", value: "!~" },
|
|
98
104
|
{ text: "any of", value: a }
|
|
99
|
-
],
|
|
105
|
+
], i = [
|
|
100
106
|
{ text: "is equal to", value: "=" },
|
|
101
107
|
{ text: "is greater than", value: ">" },
|
|
102
108
|
{ text: "is less than", value: "<" }
|
|
103
|
-
],
|
|
109
|
+
], u = [
|
|
104
110
|
{ text: "is equal to", value: "=" },
|
|
105
111
|
{ text: "after", value: ">" },
|
|
106
112
|
{ text: "before", value: "<" }
|
|
107
|
-
],
|
|
113
|
+
], c = [
|
|
108
114
|
{ text: "true", value: "==" },
|
|
109
115
|
{ text: "false", value: "!=" }
|
|
110
|
-
],
|
|
116
|
+
], b = (e) => {
|
|
111
117
|
if (!e)
|
|
112
118
|
return t;
|
|
113
119
|
switch (e) {
|
|
114
120
|
case "Boolean":
|
|
115
|
-
return
|
|
121
|
+
return c;
|
|
116
122
|
case "Date":
|
|
117
|
-
return
|
|
123
|
+
return u;
|
|
118
124
|
case "Number":
|
|
119
|
-
return
|
|
125
|
+
return i;
|
|
120
126
|
case "String":
|
|
121
127
|
return t;
|
|
122
128
|
case "Strings":
|
|
123
|
-
return
|
|
129
|
+
return s;
|
|
124
130
|
default:
|
|
125
131
|
return t;
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
134
|
export {
|
|
129
135
|
a as OP_ANY_OF,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
t as operatorOptionsForStrings
|
|
136
|
+
v as PriceAttributes,
|
|
137
|
+
m as QUERY_PARAMS,
|
|
138
|
+
o as URLS,
|
|
139
|
+
E as currencyDecimalCounts,
|
|
140
|
+
h as currencyLocationMaps,
|
|
141
|
+
x as currencyOperators,
|
|
142
|
+
b as getOperatorOptions,
|
|
143
|
+
p as getRecommendationFeedSourceMaps,
|
|
144
|
+
s as operatorOptionsForArrayOfStrings,
|
|
145
|
+
c as operatorOptionsForBooleans,
|
|
146
|
+
u as operatorOptionsForDates,
|
|
147
|
+
i as operatorOptionsForNumbers,
|
|
148
|
+
t as operatorOptionsForStrings,
|
|
149
|
+
d as strategyEditPath
|
|
143
150
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { BlockId as
|
|
6
|
-
import { getMigrationBannerHtml as
|
|
7
|
-
import { Block as
|
|
8
|
-
import { CURRENT_CONFIG_VERSION as
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var y = (l, c, t) => c in l ? D(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
|
|
3
|
+
var f = (l, c, t) => y(l, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
import { useConfig as C } from "../../../composables/useConfig.js";
|
|
5
|
+
import { BlockId as b } from "../../../enums/block.js";
|
|
6
|
+
import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
+
import { Block as E, BlockCompositionType as S, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } 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 M } from "./controls/main/utils.js";
|
|
11
|
+
import { ensureMobileCssRulesExist as _, setMobileLayoutOptOut as I, hasMobileLayoutOptOut as w } 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 x } from "./templates/grid/template.js";
|
|
15
|
+
import { useRecommendationBlockWarning as H } from "./useRecommendationBlockWarning.js";
|
|
16
|
+
const k = b.Recommendation, u = "recommendation-block-v2", R = "hide-price";
|
|
17
|
+
let B = !1;
|
|
18
|
+
class j extends E {
|
|
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
|
-
|
|
25
|
+
f(this, "_pendingBlockId", null);
|
|
26
26
|
}
|
|
27
27
|
getId() {
|
|
28
|
-
return
|
|
28
|
+
return k;
|
|
29
29
|
}
|
|
30
30
|
getIcon() {
|
|
31
31
|
return "recommendation-icon";
|
|
32
32
|
}
|
|
33
33
|
getBlockCompositionType() {
|
|
34
|
-
return
|
|
34
|
+
return S.CONTAINER;
|
|
35
35
|
}
|
|
36
36
|
getName() {
|
|
37
37
|
return this.api.translate("Recommendation Block");
|
|
@@ -42,8 +42,8 @@ class W extends b {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
getSettingsPanelTitleHtml() {
|
|
45
|
-
return
|
|
46
|
-
|
|
45
|
+
return A(
|
|
46
|
+
k,
|
|
47
47
|
this.api.translate("Recommendation Block"),
|
|
48
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.")
|
|
49
49
|
);
|
|
@@ -66,7 +66,7 @@ class W extends b {
|
|
|
66
66
|
*/
|
|
67
67
|
getTemplate() {
|
|
68
68
|
const t = this._generateNextId();
|
|
69
|
-
return this._pendingBlockId = t,
|
|
69
|
+
return this._pendingBlockId = t, x(t);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Called when a new block is dropped into the template
|
|
@@ -89,23 +89,27 @@ class W extends b {
|
|
|
89
89
|
}
|
|
90
90
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
91
91
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
92
|
-
const { config:
|
|
92
|
+
const n = C().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
|
|
93
93
|
this.api,
|
|
94
94
|
t,
|
|
95
95
|
{
|
|
96
96
|
recommendationId: i,
|
|
97
|
-
configVersion:
|
|
97
|
+
configVersion: n ? N : O,
|
|
98
|
+
// An RRS block picks a strategy, not an algorithm, and its algorithm control is
|
|
99
|
+
// hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
|
|
100
|
+
// at save for a block the user never configured.
|
|
101
|
+
...o ? { strategy: "" } : {}
|
|
98
102
|
}
|
|
99
|
-
),
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
103
|
+
), p = d();
|
|
104
|
+
if (p.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
|
|
105
|
+
_(this.api);
|
|
106
|
+
const h = this._getBlockElement(t);
|
|
107
|
+
h && (I(this.api, h, !0), M({
|
|
104
108
|
currentNode: t,
|
|
105
109
|
documentModifier: this.api.getDocumentModifier()
|
|
106
110
|
}));
|
|
107
111
|
}
|
|
108
|
-
|
|
112
|
+
p.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
115
|
* Called when the document changes or template is loaded
|
|
@@ -127,11 +131,11 @@ class W extends b {
|
|
|
127
131
|
}
|
|
128
132
|
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
|
|
129
133
|
try {
|
|
130
|
-
|
|
134
|
+
B || (_(this.api), B = !0);
|
|
131
135
|
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
132
136
|
if (i) {
|
|
133
137
|
const n = !e.mobileLayoutEnabled;
|
|
134
|
-
|
|
138
|
+
w(i) !== n && I(this.api, i, n);
|
|
135
139
|
}
|
|
136
140
|
} catch {
|
|
137
141
|
}
|
|
@@ -161,7 +165,7 @@ class W extends b {
|
|
|
161
165
|
*/
|
|
162
166
|
_warnIfMultipleBlocks() {
|
|
163
167
|
try {
|
|
164
|
-
|
|
168
|
+
H().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
165
169
|
} catch {
|
|
166
170
|
}
|
|
167
171
|
}
|
|
@@ -211,9 +215,9 @@ class W extends b {
|
|
|
211
215
|
if (!o)
|
|
212
216
|
return;
|
|
213
217
|
let r = -1;
|
|
214
|
-
for (let
|
|
215
|
-
if (n[
|
|
216
|
-
r =
|
|
218
|
+
for (let a = 0; a < n.length; a++)
|
|
219
|
+
if (n[a] === o) {
|
|
220
|
+
r = a;
|
|
217
221
|
break;
|
|
218
222
|
}
|
|
219
223
|
if (r <= 0)
|
|
@@ -293,7 +297,7 @@ class W extends b {
|
|
|
293
297
|
*/
|
|
294
298
|
_stampHidePrice(t, e) {
|
|
295
299
|
const i = this._getBlockElement(t);
|
|
296
|
-
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(
|
|
300
|
+
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(R, String(e)).apply(new g("Stamp hide-price"));
|
|
297
301
|
}
|
|
298
302
|
/**
|
|
299
303
|
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
@@ -301,7 +305,7 @@ class W extends b {
|
|
|
301
305
|
*/
|
|
302
306
|
_healHidePriceAttr(t) {
|
|
303
307
|
const e = this._getBlockElement(t);
|
|
304
|
-
if (!e || !("getAttribute" in e) || e.getAttribute(
|
|
308
|
+
if (!e || !("getAttribute" in e) || e.getAttribute(R) !== null)
|
|
305
309
|
return;
|
|
306
310
|
const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
|
|
307
311
|
this._stampHidePrice(t, i);
|
|
@@ -338,6 +342,6 @@ class W extends b {
|
|
|
338
342
|
}
|
|
339
343
|
}
|
|
340
344
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
345
|
+
k as BLOCK_ID,
|
|
346
|
+
j as RecommendationBlock
|
|
343
347
|
};
|
|
@@ -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 i, 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 I, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_BUTTON as r, ATTR_RECOMMENDATION_TITLE as E } from "./selectors.js";
|
|
3
|
+
const U = 1, u = 2, m = 2, A = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, D = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
13
|
}, a = {
|
|
@@ -18,26 +18,26 @@ const A = 1, u = 2, D = {
|
|
|
18
18
|
t,
|
|
19
19
|
_,
|
|
20
20
|
T,
|
|
21
|
-
r,
|
|
22
21
|
I,
|
|
23
|
-
|
|
22
|
+
R,
|
|
23
|
+
r
|
|
24
24
|
], N = {
|
|
25
|
-
[
|
|
25
|
+
[E]: !0,
|
|
26
26
|
[o]: !0,
|
|
27
27
|
[t]: !0,
|
|
28
28
|
[T]: !0,
|
|
29
29
|
[_]: !0,
|
|
30
|
-
[r]: !1,
|
|
31
30
|
[I]: !1,
|
|
32
|
-
[
|
|
33
|
-
|
|
31
|
+
[R]: !1,
|
|
32
|
+
[r]: !0
|
|
33
|
+
}, L = {
|
|
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: A,
|
|
41
41
|
filters: [],
|
|
42
42
|
strategyId: "",
|
|
43
43
|
// Layout
|
|
@@ -46,7 +46,7 @@ const A = 1, u = 2, D = {
|
|
|
46
46
|
mobileCardsInRow: e,
|
|
47
47
|
mobileLayoutEnabled: !1,
|
|
48
48
|
previousMobileCardsInRow: e,
|
|
49
|
-
columnSpacing:
|
|
49
|
+
columnSpacing: i,
|
|
50
50
|
rowSpacing: s,
|
|
51
51
|
mobileColumnSpacing: O,
|
|
52
52
|
mobileRowSpacing: n,
|
|
@@ -55,7 +55,7 @@ const A = 1, u = 2, D = {
|
|
|
55
55
|
visibility: N,
|
|
56
56
|
previousTitleHtml: "",
|
|
57
57
|
// Element settings
|
|
58
|
-
omnibusPrice:
|
|
58
|
+
omnibusPrice: D,
|
|
59
59
|
omnibusDiscount: a,
|
|
60
60
|
textTrimming: !1,
|
|
61
61
|
// Price placement (block-level, affects all cards)
|
|
@@ -66,17 +66,18 @@ const A = 1, u = 2, D = {
|
|
|
66
66
|
// of "false" (the actual hiding happens server-side at send).
|
|
67
67
|
priceHideIfSameAsDiscounted: !1,
|
|
68
68
|
// Meta
|
|
69
|
-
configVersion:
|
|
69
|
+
configVersion: U,
|
|
70
70
|
recommendationId: 0
|
|
71
|
-
},
|
|
71
|
+
}, P = [11, 12];
|
|
72
72
|
export {
|
|
73
73
|
u as CURRENT_CONFIG_VERSION,
|
|
74
74
|
c as DEFAULT_COMPOSITION,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
A as DEFAULT_CURRENCY,
|
|
76
|
+
L as DEFAULT_NODE_CONFIG,
|
|
77
77
|
a as DEFAULT_OMNIBUS_DISCOUNT,
|
|
78
|
-
|
|
78
|
+
D as DEFAULT_OMNIBUS_PRICE,
|
|
79
79
|
N as DEFAULT_VISIBILITY,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
P as EXCLUDED_ALGORITHM_IDS,
|
|
81
|
+
U as PRE_RRS_CONFIG_VERSION,
|
|
82
|
+
m as RRS_CONFIG_VERSION
|
|
82
83
|
};
|