@useinsider/guido 3.16.0 → 3.17.0-beta.24a776b
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 +12 -6
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +66 -63
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +65 -0
- package/dist/composables/useConfig.js +37 -30
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useRecommendation.js +51 -42
- package/dist/composables/useStripo.js +30 -29
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/config/migrator/recommendation/settingsMapper.js +19 -17
- package/dist/config/migrator/recommendationMigrator.js +56 -37
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/recommendationBlock.js +4 -1
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- package/dist/extensions/Blocks/Recommendation/block.js +26 -21
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +96 -95
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +147 -150
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +136 -0
- package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +247 -107
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +72 -30
- package/dist/src/@types/config/schemas.d.ts +12 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +3 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +7 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +9 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +204 -10
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +63 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/template.d.ts +14 -0
- package/dist/src/utils/strategyInfoBox.d.ts +18 -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 +172 -0
- package/dist/stores/template.js +13 -8
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/strategyInfoBox.js +37 -0
- package/dist/utils/templatePreparation.js +37 -34
- package/package.json +2 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { useConfig as I } from "./useConfig.js";
|
|
2
|
+
import { getRecommendationFeedSourceMaps as C, URLS as R } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
import { MinDeviceViewport as b, DefaultPadding as h } from "../enums/recommendation.js";
|
|
4
|
+
import { useRecommendationExtensionStore as f } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
6
|
+
import { getPartnerRecommendationParams as P } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
7
|
+
import { sanitizeProductIds as S } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
8
|
+
import { useConfigStore as T } from "../stores/config.js";
|
|
9
|
+
const M = () => ({
|
|
8
10
|
calculateCardWidth: ({
|
|
9
|
-
mobileLeftPadding:
|
|
10
|
-
mobileRightPadding:
|
|
11
|
-
cardsInRow:
|
|
12
|
-
unresponsive:
|
|
11
|
+
mobileLeftPadding: s,
|
|
12
|
+
mobileRightPadding: c,
|
|
13
|
+
cardsInRow: a,
|
|
14
|
+
unresponsive: n
|
|
13
15
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
return (
|
|
16
|
+
const o = n ? a : 1, d = s + c + (o - 1) * h;
|
|
17
|
+
return (b - d) / o;
|
|
16
18
|
},
|
|
17
|
-
getRecommendationCampaignData: (
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
19
|
+
getRecommendationCampaignData: (s) => {
|
|
20
|
+
const c = f(), a = Number(s), n = c.blockStates[a];
|
|
21
|
+
if (!n)
|
|
20
22
|
return {
|
|
21
23
|
textTrimming: !1,
|
|
22
24
|
orientation: "vertical",
|
|
@@ -29,49 +31,56 @@ const k = () => ({
|
|
|
29
31
|
discountBeforeTextValue: "",
|
|
30
32
|
discountAfterTextValue: ""
|
|
31
33
|
};
|
|
32
|
-
const { recommendationConfigs:
|
|
34
|
+
const { recommendationConfigs: o } = n, d = o.orientation === "grid" ? "vertical" : "horizontal";
|
|
33
35
|
return {
|
|
34
|
-
textTrimming:
|
|
35
|
-
orientation:
|
|
36
|
+
textTrimming: o.textTrimming,
|
|
37
|
+
orientation: d,
|
|
36
38
|
mobileLeftPadding: 0,
|
|
37
39
|
mobileRightPadding: 0,
|
|
38
|
-
cardsInRow:
|
|
39
|
-
unresponsive:
|
|
40
|
+
cardsInRow: o.cardsInRow,
|
|
41
|
+
unresponsive: o.unresponsive,
|
|
40
42
|
priceBeforeTextValue: "",
|
|
41
43
|
priceAfterTextValue: "",
|
|
42
44
|
discountBeforeTextValue: "",
|
|
43
45
|
discountAfterTextValue: ""
|
|
44
46
|
};
|
|
45
47
|
},
|
|
46
|
-
buildCampaignUrl: (
|
|
47
|
-
var
|
|
48
|
-
const
|
|
48
|
+
buildCampaignUrl: (s, c) => {
|
|
49
|
+
var l;
|
|
50
|
+
const a = f(), n = T(), { isRrsSessionActive: o } = I(), d = Number(s);
|
|
49
51
|
let e;
|
|
50
|
-
if (
|
|
51
|
-
e =
|
|
52
|
+
if (c)
|
|
53
|
+
e = c;
|
|
52
54
|
else {
|
|
53
|
-
const i =
|
|
55
|
+
const i = a.blockStates[d];
|
|
54
56
|
if (!i)
|
|
55
57
|
return "";
|
|
56
|
-
const { recommendationConfigs:
|
|
58
|
+
const { recommendationConfigs: r } = i;
|
|
57
59
|
e = {
|
|
58
|
-
strategy:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
strategy: r.strategy,
|
|
61
|
+
strategyId: r.strategyId,
|
|
62
|
+
language: r.language,
|
|
63
|
+
currencyCode: r.currencySettings.value,
|
|
64
|
+
size: r.size,
|
|
65
|
+
productIds: r.productIds,
|
|
66
|
+
filters: r.filters,
|
|
67
|
+
shuffleProducts: r.shuffleProducts
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if (o() && e.strategyId)
|
|
71
|
+
return a.recommendationCampaignUrls[s] = {
|
|
72
|
+
strategyId: e.strategyId,
|
|
73
|
+
locale: e.language,
|
|
74
|
+
currency: e.currencyCode
|
|
75
|
+
}, "";
|
|
76
|
+
const g = ((l = C().find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
77
|
+
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", S(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
78
|
+
const p = e.filters.filter((i) => i.isValid), u = x(p);
|
|
79
|
+
u && t.set("filter", u), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(P(n.partnerName, e.strategy)).forEach(([i, r]) => t.set(i, r));
|
|
80
|
+
const y = decodeURIComponent(t.toString()), m = `${R.RECOMMENDATION_API_URL}/v2/${g}?${y}`;
|
|
81
|
+
return a.recommendationCampaignUrls[s] = m, m;
|
|
73
82
|
}
|
|
74
83
|
});
|
|
75
84
|
export {
|
|
76
|
-
|
|
85
|
+
M as useRecommendation
|
|
77
86
|
};
|
|
@@ -16,22 +16,22 @@ 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 } = q(), { handleError: p, showToaster: k } = G(), { getToken:
|
|
19
|
+
const Ce = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: B } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var l;
|
|
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/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, document.body.appendChild(
|
|
26
|
+
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`, e = document.createElement("script");
|
|
27
|
+
e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
|
|
28
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
|
+
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const
|
|
34
|
+
const e = b(), { html: l, 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 = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
|
|
35
35
|
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
@@ -57,6 +57,7 @@ const Ct = () => {
|
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
59
59
|
displayHiddenPreheader: !1,
|
|
60
|
+
keepModuleStylesEnabled: !0,
|
|
60
61
|
displayTitle: !1,
|
|
61
62
|
displayUTM: !1,
|
|
62
63
|
selectElementAfterDrop: !0,
|
|
@@ -77,38 +78,38 @@ const Ct = () => {
|
|
|
77
78
|
)
|
|
78
79
|
}
|
|
79
80
|
],
|
|
80
|
-
async onTokenRefreshRequest(
|
|
81
|
+
async onTokenRefreshRequest(t) {
|
|
81
82
|
try {
|
|
82
|
-
const d = await
|
|
83
|
-
|
|
83
|
+
const d = await M();
|
|
84
|
+
t(d);
|
|
84
85
|
} catch (d) {
|
|
85
86
|
p(d, "Failed to refresh token");
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
onTemplateLoaded() {
|
|
89
90
|
try {
|
|
90
|
-
const { importCss:
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
92
|
+
t(), d(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
|
+
e.hasChanges = !1;
|
|
93
94
|
}, 1e3);
|
|
94
|
-
} catch (
|
|
95
|
-
p(
|
|
95
|
+
} catch (t) {
|
|
96
|
+
p(t, "Failed to load custom interface appearance");
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
onCodeEditorVisibilityChanged(
|
|
99
|
-
|
|
99
|
+
onCodeEditorVisibilityChanged(t) {
|
|
100
|
+
e.isCodeEditorOpen = t;
|
|
100
101
|
},
|
|
101
|
-
onEditorVisualModeChanged(
|
|
102
|
-
|
|
102
|
+
onEditorVisualModeChanged(t) {
|
|
103
|
+
e.editorVisualMode = t.toLowerCase();
|
|
103
104
|
},
|
|
104
|
-
onVersionHistoryVisibilityChanged(
|
|
105
|
-
|
|
105
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
106
|
+
e.isVersionHistoryOpen = t;
|
|
106
107
|
},
|
|
107
108
|
onDataChanged() {
|
|
108
|
-
|
|
109
|
+
e.hasChanges = !0;
|
|
109
110
|
},
|
|
110
|
-
onEvent:
|
|
111
|
-
onModuleAdd:
|
|
111
|
+
onEvent: B,
|
|
112
|
+
onModuleAdd: F,
|
|
112
113
|
notifications: V(),
|
|
113
114
|
ignoreClickOutsideSelectors: [
|
|
114
115
|
"#guido-dynamic-content-modal",
|
|
@@ -124,11 +125,11 @@ const Ct = () => {
|
|
|
124
125
|
const a = b();
|
|
125
126
|
try {
|
|
126
127
|
await f();
|
|
127
|
-
const [r,
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const [r, e] = await Promise.all([
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
130
131
|
]);
|
|
131
|
-
a.syncModulesEnabled =
|
|
132
|
+
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
132
133
|
} catch {
|
|
133
134
|
a.loadingStatus = !1, k({
|
|
134
135
|
type: X.Error,
|
|
@@ -145,5 +146,5 @@ const Ct = () => {
|
|
|
145
146
|
} };
|
|
146
147
|
};
|
|
147
148
|
export {
|
|
148
|
-
|
|
149
|
+
Ce as useStripo
|
|
149
150
|
};
|
|
@@ -381,7 +381,7 @@ class H {
|
|
|
381
381
|
* Supports all block types by detecting prefix and using appropriate type:
|
|
382
382
|
*
|
|
383
383
|
* Examples:
|
|
384
|
-
* - {{ins_apr_img_1}} → https://
|
|
384
|
+
* - {{ins_apr_img_1}} → https://web-image.useinsider.com/.../img_1.jpeg (CART_ITEMS)
|
|
385
385
|
* - {{browsed_item_name_2}} → 'Set of Sprite Yoga Straps' (BROWSED_ITEMS)
|
|
386
386
|
* - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
|
|
387
387
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as
|
|
1
|
+
import { PRE_RRS_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
2
|
+
import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as S, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
|
|
3
3
|
import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
4
4
|
function c(t) {
|
|
5
5
|
return t === "0" || t === 0 ? "before" : "after";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function _(t) {
|
|
8
8
|
if (typeof t == "number" && Number.isFinite(t))
|
|
9
9
|
return t;
|
|
10
10
|
if (typeof t == "string") {
|
|
@@ -14,13 +14,13 @@ function I(t) {
|
|
|
14
14
|
}
|
|
15
15
|
return i.decimalCount;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function I(t) {
|
|
18
18
|
return t === "." || t === "," || t === " " || t === "" ? t : ",";
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function A(t) {
|
|
21
21
|
return t === "." || t === "," || t === " " ? t : ".";
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function L(t) {
|
|
24
24
|
if (!t || typeof t != "object")
|
|
25
25
|
return { ...i };
|
|
26
26
|
const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
|
|
@@ -28,18 +28,18 @@ function A(t) {
|
|
|
28
28
|
code: n,
|
|
29
29
|
symbol: r,
|
|
30
30
|
alignment: c(o.alignment),
|
|
31
|
-
decimalCount:
|
|
32
|
-
decimalSeparator:
|
|
33
|
-
thousandSeparator:
|
|
31
|
+
decimalCount: _(o.decimalCount),
|
|
32
|
+
decimalSeparator: A(o.decimalSeparator),
|
|
33
|
+
thousandSeparator: I(o.thousandSeparator)
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function N(t) {
|
|
37
37
|
return t === "horizontal" || t === "list" ? "list" : "grid";
|
|
38
38
|
}
|
|
39
39
|
function R(t) {
|
|
40
40
|
return l(t) || "mostPopular";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function O(t, o, n) {
|
|
43
43
|
const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
|
|
44
44
|
return {
|
|
45
45
|
recommendationId: n,
|
|
@@ -48,15 +48,15 @@ function U(t, o, n) {
|
|
|
48
48
|
size: String(u),
|
|
49
49
|
shuffleProducts: !!t.shuffleProducts,
|
|
50
50
|
language: t.language ?? "en_US",
|
|
51
|
-
currency:
|
|
51
|
+
currency: L(t.currencySettings),
|
|
52
52
|
filters: (t.filters ?? []).map((e) => ({ ...e })),
|
|
53
|
-
layout:
|
|
53
|
+
layout: N(t.orientation ?? o.orientation),
|
|
54
54
|
cardsInRow: r,
|
|
55
55
|
mobileCardsInRow: a,
|
|
56
56
|
mobileLayoutEnabled: !1,
|
|
57
57
|
previousMobileCardsInRow: a,
|
|
58
|
-
columnSpacing:
|
|
59
|
-
rowSpacing:
|
|
58
|
+
columnSpacing: f,
|
|
59
|
+
rowSpacing: S,
|
|
60
60
|
mobileColumnSpacing: d,
|
|
61
61
|
mobileRowSpacing: p,
|
|
62
62
|
omnibusPrice: { textBefore: "", textAfter: "" },
|
|
@@ -66,10 +66,12 @@ function U(t, o, n) {
|
|
|
66
66
|
// gated). New Guido blocks default differently (see DEFAULT_NODE_CONFIG).
|
|
67
67
|
priceMovedToNextLine: !!t.isPriceMovedToNextLine,
|
|
68
68
|
priceHideIfSameAsDiscounted: !!t.isPriceDeletedForZeroSale,
|
|
69
|
+
// Legacy blocks stay on the pre-RRS era marker: the campaign they belong
|
|
70
|
+
// to keeps the old settings panel until its own migration ships.
|
|
69
71
|
configVersion: s
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
L as mapCurrency,
|
|
76
|
+
O as mapSettings
|
|
75
77
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { BlockId as f } from "../../enums/block.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { PRE_RRS_CONFIG_VERSION as y, CURRENT_CONFIG_VERSION as R } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
3
|
+
import { useTemplateStore as S } from "../../stores/template.js";
|
|
4
|
+
import { mapComposition as b } from "./recommendation/compositionMapper.js";
|
|
5
|
+
import { extractCurrencyFromBlock as h, extractTitleText as C, extractCardBgColor as v, isPartnerManagedBlock as B } from "./recommendation/extractors.js";
|
|
5
6
|
import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
|
|
6
|
-
import { parseRecommendationId as x, parseLegacyConfig as
|
|
7
|
-
import { mapSettings as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
7
|
+
import { parseRecommendationId as x, parseLegacyConfig as A } from "./recommendation/parseLegacyConfig.js";
|
|
8
|
+
import { mapSettings as E } from "./recommendation/settingsMapper.js";
|
|
9
|
+
const M = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
|
|
10
|
+
function T(s, t, o) {
|
|
11
|
+
var l;
|
|
12
|
+
const e = x(t);
|
|
13
|
+
if (e === null)
|
|
13
14
|
return console.warn(
|
|
14
15
|
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
15
16
|
), !1;
|
|
16
|
-
const r =
|
|
17
|
+
const r = A(t);
|
|
17
18
|
if (!r)
|
|
18
19
|
return console.warn(
|
|
19
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
20
|
+
`[RecommendationMigrator] Aborting block id=${e} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
20
21
|
), !1;
|
|
21
|
-
const
|
|
22
|
-
currencySettings:
|
|
23
|
-
},
|
|
24
|
-
...
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const a = o[String(e)] ?? {
|
|
23
|
+
currencySettings: h(t)
|
|
24
|
+
}, n = E(a, r, e), c = b((l = r.composition) == null ? void 0 : l.variables), i = C(t), g = v(t), p = {
|
|
25
|
+
...n,
|
|
26
|
+
// Legacy blocks predate RRS — never strategy-backed.
|
|
27
|
+
strategyId: "",
|
|
28
|
+
composition: c.composition,
|
|
29
|
+
visibility: c.visibility,
|
|
30
|
+
textTrimming: c.anyTextTrimming
|
|
31
|
+
}, m = B(t), u = `
|
|
29
32
|
<table>
|
|
30
33
|
<tbody>
|
|
31
34
|
<tr>
|
|
@@ -34,9 +37,9 @@ function B(i, t, a) {
|
|
|
34
37
|
<tbody>
|
|
35
38
|
<tr>${w({
|
|
36
39
|
nodeConfig: p,
|
|
37
|
-
composition:
|
|
40
|
+
composition: c,
|
|
38
41
|
cardBg: g,
|
|
39
|
-
titleText:
|
|
42
|
+
titleText: i,
|
|
40
43
|
legacyId: t.getAttribute("id") ?? void 0,
|
|
41
44
|
legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
|
|
42
45
|
preserveInnerHtml: m ? t.innerHTML : void 0,
|
|
@@ -48,32 +51,48 @@ function B(i, t, a) {
|
|
|
48
51
|
</tr>
|
|
49
52
|
</tbody>
|
|
50
53
|
</table>
|
|
51
|
-
`,
|
|
52
|
-
return !
|
|
53
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
54
|
-
), !1) : (t.parentNode.replaceChild(
|
|
54
|
+
`, d = s.parseFromString(u, "text/html").querySelector("td.esd-structure");
|
|
55
|
+
return !d || !t.parentNode ? (console.warn(
|
|
56
|
+
`[RecommendationMigrator] Aborting block id=${e} — failed to construct new HTML element`
|
|
57
|
+
), !1) : (t.parentNode.replaceChild(d, t), !0);
|
|
55
58
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
59
|
+
function k(s, t) {
|
|
60
|
+
let o = t, e = !1;
|
|
61
|
+
return s.querySelectorAll(".recommendation-block-v2").forEach((r) => {
|
|
62
|
+
const a = r.getAttribute("esd-ext-config");
|
|
63
|
+
if (!a) {
|
|
64
|
+
o = !0;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const n = JSON.parse(a);
|
|
69
|
+
(n.configVersion ?? y) < R && (o = !0), n.strategyId && (e = !0);
|
|
70
|
+
} catch {
|
|
71
|
+
o = !0;
|
|
72
|
+
}
|
|
73
|
+
}), { hasPreRrsBlocks: o, hasAssignedStrategy: e };
|
|
74
|
+
}
|
|
75
|
+
function q(s, t = {}) {
|
|
76
|
+
const o = new DOMParser(), e = o.parseFromString(s, "text/html"), r = Array.from(e.querySelectorAll(M)), a = k(e, r.length > 0);
|
|
58
77
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
...
|
|
78
|
+
S().$patch((i) => {
|
|
79
|
+
i.migrations = {
|
|
80
|
+
...i.migrations,
|
|
62
81
|
[f.Recommendation]: r.length
|
|
63
|
-
};
|
|
82
|
+
}, i.hasPreRrsRecommendationBlocks = a.hasPreRrsBlocks, i.hasAssignedStrategyBlocks = a.hasAssignedStrategy;
|
|
64
83
|
});
|
|
65
84
|
} catch {
|
|
66
85
|
}
|
|
67
86
|
if (r.length === 0)
|
|
68
|
-
return
|
|
87
|
+
return s;
|
|
69
88
|
let n = 0;
|
|
70
89
|
return r.forEach((c) => {
|
|
71
90
|
try {
|
|
72
|
-
|
|
73
|
-
} catch (
|
|
74
|
-
console.error("[RecommendationMigrator] Unexpected error migrating block:",
|
|
91
|
+
T(o, c, t) && (n += 1);
|
|
92
|
+
} catch (i) {
|
|
93
|
+
console.error("[RecommendationMigrator] Unexpected error migrating block:", i);
|
|
75
94
|
}
|
|
76
|
-
}), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`),
|
|
95
|
+
}), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), e.documentElement.outerHTML;
|
|
77
96
|
}
|
|
78
97
|
export {
|
|
79
98
|
q as migrateRecommendation
|
package/dist/enums/academy.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const e = "https://academy.insiderone.com", o = {
|
|
2
2
|
EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
|
|
3
3
|
GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
|
|
4
|
-
AMP_FOR_EMAILS: `${e}/docs/amp-for-emails
|
|
4
|
+
AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
|
|
5
|
+
EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
|
|
5
6
|
};
|
|
6
7
|
export {
|
|
7
8
|
o as ACADEMY_LINKS
|
package/dist/enums/date.js
CHANGED
|
@@ -2,7 +2,10 @@ import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
|
2
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
|
-
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
5
|
+
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
|
+
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
|
+
// Panel route of the Recommendation Strategies listing.
|
|
8
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
6
9
|
}, c = {
|
|
7
10
|
CLIENT_ID: "clientId"
|
|
8
11
|
}, d = () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const e = 20,
|
|
1
|
+
const e = 20, t = 320, s = "vertical", m = {
|
|
2
2
|
CART_ABANDONMENT: {
|
|
3
|
-
ins_apr_img_1: "https://
|
|
4
|
-
ins_apr_img_2: "https://
|
|
5
|
-
ins_apr_img_3: "https://
|
|
6
|
-
ins_apr_img_4: "https://
|
|
3
|
+
ins_apr_img_1: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
|
|
4
|
+
ins_apr_img_2: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
|
|
5
|
+
ins_apr_img_3: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_3.png",
|
|
6
|
+
ins_apr_img_4: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_4.png"
|
|
7
7
|
},
|
|
8
8
|
BROWSE_ABANDONMENT: {
|
|
9
|
-
browsed_item_img_1: "https://
|
|
10
|
-
browsed_item_img_2: "https://
|
|
11
|
-
browsed_item_img_3: "https://
|
|
12
|
-
browsed_item_img_4: "https://
|
|
9
|
+
browsed_item_img_1: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_1.jpg",
|
|
10
|
+
browsed_item_img_2: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_2.jpg",
|
|
11
|
+
browsed_item_img_3: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_3.jpg",
|
|
12
|
+
browsed_item_img_4: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_4.jpg"
|
|
13
13
|
}
|
|
14
14
|
}, i = {
|
|
15
15
|
DISCOUNT: "discount",
|
|
@@ -23,7 +23,7 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
23
23
|
},
|
|
24
24
|
ELSE: "{% else %}",
|
|
25
25
|
END_IF: "{% endif %}"
|
|
26
|
-
},
|
|
26
|
+
}, n = {
|
|
27
27
|
ID: /recommendation-id="(.*?)"/gi,
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
@@ -31,9 +31,9 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
31
31
|
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
32
|
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
|
-
}, n = {
|
|
35
|
-
PARAGRAPH_END_TAG: "</p>"
|
|
36
34
|
}, o = {
|
|
35
|
+
PARAGRAPH_END_TAG: "</p>"
|
|
36
|
+
}, a = {
|
|
37
37
|
REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
|
|
38
38
|
TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
|
|
39
39
|
ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
|
|
@@ -47,11 +47,11 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
47
47
|
export {
|
|
48
48
|
i as ATTRIBUTES,
|
|
49
49
|
_ as CONDITIONS,
|
|
50
|
-
|
|
50
|
+
a as CSS,
|
|
51
51
|
m as DUMMY_IMAGE_MAPPINGS,
|
|
52
52
|
e as DefaultPadding,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
o as HTML,
|
|
54
|
+
t as MinDeviceViewport,
|
|
55
|
+
n as REGEX,
|
|
56
|
+
s as VerticalOrientation
|
|
57
57
|
};
|