@useinsider/guido 3.16.0-beta.0faee0c → 3.16.0-beta.c615198
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/useRecommendation.js +20 -19
- package/dist/composables/useStripo.js +29 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +21 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -12
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/package.json +1 -1
|
@@ -3,20 +3,21 @@ import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommenda
|
|
|
3
3
|
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
5
|
import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
|
+
import { useConfigStore as P } from "../stores/config.js";
|
|
8
|
+
const B = () => ({
|
|
8
9
|
calculateCardWidth: ({
|
|
9
10
|
mobileLeftPadding: a,
|
|
10
11
|
mobileRightPadding: s,
|
|
11
12
|
cardsInRow: c,
|
|
12
|
-
unresponsive:
|
|
13
|
+
unresponsive: n
|
|
13
14
|
}) => {
|
|
14
|
-
const r =
|
|
15
|
+
const r = n ? c : 1, e = a + s + (r - 1) * b;
|
|
15
16
|
return (C - e) / r;
|
|
16
17
|
},
|
|
17
18
|
getRecommendationCampaignData: (a) => {
|
|
18
|
-
const s = l(), c = Number(a),
|
|
19
|
-
if (!
|
|
19
|
+
const s = l(), c = Number(a), n = s.blockStates[c];
|
|
20
|
+
if (!n)
|
|
20
21
|
return {
|
|
21
22
|
textTrimming: !1,
|
|
22
23
|
orientation: "vertical",
|
|
@@ -29,7 +30,7 @@ const k = () => ({
|
|
|
29
30
|
discountBeforeTextValue: "",
|
|
30
31
|
discountAfterTextValue: ""
|
|
31
32
|
};
|
|
32
|
-
const { recommendationConfigs: r } =
|
|
33
|
+
const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
33
34
|
return {
|
|
34
35
|
textTrimming: r.textTrimming,
|
|
35
36
|
orientation: e,
|
|
@@ -45,7 +46,7 @@ const k = () => ({
|
|
|
45
46
|
},
|
|
46
47
|
buildCampaignUrl: (a, s) => {
|
|
47
48
|
var m;
|
|
48
|
-
const c = l(),
|
|
49
|
+
const c = l(), n = P(), r = Number(a);
|
|
49
50
|
let e;
|
|
50
51
|
if (s)
|
|
51
52
|
e = s;
|
|
@@ -53,25 +54,25 @@ const k = () => ({
|
|
|
53
54
|
const i = c.blockStates[r];
|
|
54
55
|
if (!i)
|
|
55
56
|
return "";
|
|
56
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: o } = i;
|
|
57
58
|
e = {
|
|
58
|
-
strategy:
|
|
59
|
-
language:
|
|
60
|
-
currencyCode:
|
|
61
|
-
size:
|
|
62
|
-
productIds:
|
|
63
|
-
filters:
|
|
64
|
-
shuffleProducts:
|
|
59
|
+
strategy: o.strategy,
|
|
60
|
+
language: o.language,
|
|
61
|
+
currencyCode: o.currencySettings.value,
|
|
62
|
+
size: o.size,
|
|
63
|
+
productIds: o.productIds,
|
|
64
|
+
filters: o.filters,
|
|
65
|
+
shuffleProducts: o.shuffleProducts
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
68
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
69
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
69
70
|
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
70
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(
|
|
71
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
|
|
71
72
|
const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
72
73
|
return c.recommendationCampaignUrls[a] = u, u;
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
export {
|
|
76
|
-
|
|
77
|
+
B as useRecommendation
|
|
77
78
|
};
|
|
@@ -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 Ct = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: T, getCustomFonts: v, getSyncModulesStatus: B } = K(), { handleEvent: F } = z(), { handleModuleAdd: M } = 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`, t = document.createElement("script");
|
|
27
|
+
t.id = "UiEditorScript", t.type = "module", t.src = r, t.onload = () => i(), t.onerror = () => {
|
|
28
|
+
t.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
|
+
}, document.body.appendChild(t);
|
|
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 t = 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,7 +57,6 @@ const Ce = () => {
|
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
59
59
|
displayHiddenPreheader: !1,
|
|
60
|
-
keepModuleStylesEnabled: !0,
|
|
61
60
|
displayTitle: !1,
|
|
62
61
|
displayUTM: !1,
|
|
63
62
|
selectElementAfterDrop: !0,
|
|
@@ -78,38 +77,38 @@ const Ce = () => {
|
|
|
78
77
|
)
|
|
79
78
|
}
|
|
80
79
|
],
|
|
81
|
-
async onTokenRefreshRequest(
|
|
80
|
+
async onTokenRefreshRequest(e) {
|
|
82
81
|
try {
|
|
83
|
-
const d = await
|
|
84
|
-
|
|
82
|
+
const d = await T();
|
|
83
|
+
e(d);
|
|
85
84
|
} catch (d) {
|
|
86
85
|
p(d, "Failed to refresh token");
|
|
87
86
|
}
|
|
88
87
|
},
|
|
89
88
|
onTemplateLoaded() {
|
|
90
89
|
try {
|
|
91
|
-
const { importCss:
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
const { importCss: e } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
91
|
+
e(), d(), x(), I(), o.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
92
|
+
t.hasChanges = !1;
|
|
94
93
|
}, 1e3);
|
|
95
|
-
} catch (
|
|
96
|
-
p(
|
|
94
|
+
} catch (e) {
|
|
95
|
+
p(e, "Failed to load custom interface appearance");
|
|
97
96
|
}
|
|
98
97
|
},
|
|
99
|
-
onCodeEditorVisibilityChanged(
|
|
100
|
-
|
|
98
|
+
onCodeEditorVisibilityChanged(e) {
|
|
99
|
+
t.isCodeEditorOpen = e;
|
|
101
100
|
},
|
|
102
|
-
onEditorVisualModeChanged(
|
|
103
|
-
|
|
101
|
+
onEditorVisualModeChanged(e) {
|
|
102
|
+
t.editorVisualMode = e.toLowerCase();
|
|
104
103
|
},
|
|
105
|
-
onVersionHistoryVisibilityChanged(
|
|
106
|
-
|
|
104
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
105
|
+
t.isVersionHistoryOpen = e;
|
|
107
106
|
},
|
|
108
107
|
onDataChanged() {
|
|
109
|
-
|
|
108
|
+
t.hasChanges = !0;
|
|
110
109
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
110
|
+
onEvent: F,
|
|
111
|
+
onModuleAdd: M,
|
|
113
112
|
notifications: V(),
|
|
114
113
|
ignoreClickOutsideSelectors: [
|
|
115
114
|
"#guido-dynamic-content-modal",
|
|
@@ -125,11 +124,11 @@ const Ce = () => {
|
|
|
125
124
|
const a = b();
|
|
126
125
|
try {
|
|
127
126
|
await f();
|
|
128
|
-
const [r,
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const [r, t] = await Promise.all([
|
|
128
|
+
v(),
|
|
129
|
+
B()
|
|
131
130
|
]);
|
|
132
|
-
a.syncModulesEnabled =
|
|
131
|
+
a.syncModulesEnabled = t, await _(i, s, o, r, t);
|
|
133
132
|
} catch {
|
|
134
133
|
a.loadingStatus = !1, k({
|
|
135
134
|
type: X.Error,
|
|
@@ -146,5 +145,5 @@ const Ce = () => {
|
|
|
146
145
|
} };
|
|
147
146
|
};
|
|
148
147
|
export {
|
|
149
|
-
|
|
148
|
+
Ct as useStripo
|
|
150
149
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var c = (r, s, t) => h(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as g } from "../../../common-control.js";
|
|
6
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
|
|
8
|
-
import { mapLegacyStrategy as
|
|
9
|
-
const
|
|
8
|
+
import { mapLegacyStrategy as u } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const p = "recommendation-algorithm-control", i = {
|
|
10
10
|
ALGORITHM: "strategy",
|
|
11
11
|
PRODUCT_IDS: "productIds"
|
|
12
12
|
};
|
|
13
|
-
class R extends
|
|
13
|
+
class R extends g {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
17
|
-
|
|
17
|
+
c(this, "store", m());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return p;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
@@ -46,11 +46,10 @@ class R extends d {
|
|
|
46
46
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
47
47
|
}
|
|
48
48
|
_setFormValues() {
|
|
49
|
-
const t = n.getConfig(this.currentNode), e =
|
|
50
|
-
this._setProductIdsVisibility(e)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
49
|
+
const t = n.getConfig(this.currentNode), e = u(t.strategy) ?? t.strategy;
|
|
50
|
+
this._setProductIdsVisibility(e);
|
|
51
|
+
const o = { [i.ALGORITHM]: e }, a = t.productIds.join(",");
|
|
52
|
+
this.api.getValues()[i.PRODUCT_IDS] !== a && (o[i.PRODUCT_IDS] = a), this.api.updateValues(o);
|
|
54
53
|
}
|
|
55
54
|
_initializeSelectItems() {
|
|
56
55
|
var e;
|
|
@@ -59,35 +58,47 @@ class R extends d {
|
|
|
59
58
|
try {
|
|
60
59
|
this.api.setUIEAttribute(
|
|
61
60
|
i.ALGORITHM,
|
|
62
|
-
|
|
61
|
+
l.SELECTPICKER.items,
|
|
63
62
|
t
|
|
64
63
|
);
|
|
65
|
-
} catch (
|
|
66
|
-
console.warn("[AlgorithmControl] Failed to set algorithm options:",
|
|
64
|
+
} catch (o) {
|
|
65
|
+
console.warn("[AlgorithmControl] Failed to set algorithm options:", o);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
_setProductIdsVisibility(t) {
|
|
70
|
-
const
|
|
71
|
-
this.api.setVisibility(i.PRODUCT_IDS,
|
|
69
|
+
const o = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
70
|
+
this.api.setVisibility(i.PRODUCT_IDS, o), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, o);
|
|
72
71
|
}
|
|
73
72
|
_onAlgorithmChange(t) {
|
|
74
|
-
|
|
73
|
+
if (!this.currentNode)
|
|
74
|
+
return;
|
|
75
|
+
const e = n.getConfig(this.currentNode);
|
|
76
|
+
if (e.strategy === t) {
|
|
77
|
+
this.store.recommendationConfigs.strategy !== t && this.store.patchCurrentBlockConfig({ strategy: e.strategy, filters: e.filters });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
n.updateConfig(
|
|
75
81
|
this.api,
|
|
76
82
|
this.currentNode,
|
|
77
83
|
{ strategy: t },
|
|
78
84
|
`Changed algorithm to ${t}`
|
|
79
|
-
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t)
|
|
85
|
+
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t);
|
|
80
86
|
}
|
|
81
87
|
_onProductIdsChange(t) {
|
|
82
88
|
if (!this.currentNode)
|
|
83
89
|
return;
|
|
84
|
-
const e =
|
|
90
|
+
const e = n.getConfig(this.currentNode);
|
|
91
|
+
if (e.productIds.join(",") === t) {
|
|
92
|
+
this.store.recommendationConfigs.productIds.join(",") !== t && this.store.patchCurrentBlockConfig({ productIds: e.productIds, filters: e.filters });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const o = t === "" ? [] : t.split(",");
|
|
85
96
|
n.updateConfig(
|
|
86
97
|
this.api,
|
|
87
98
|
this.currentNode,
|
|
88
|
-
{ productIds:
|
|
99
|
+
{ productIds: o },
|
|
89
100
|
"Updated product IDs"
|
|
90
|
-
), this.store.patchCurrentBlockConfig({ productIds:
|
|
101
|
+
), this.store.patchCurrentBlockConfig({ productIds: o });
|
|
91
102
|
}
|
|
92
103
|
_listenToFormUpdates() {
|
|
93
104
|
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
@@ -98,6 +109,6 @@ class R extends d {
|
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
export {
|
|
101
|
-
|
|
112
|
+
p as ALGORITHM_CONTROL_ID,
|
|
102
113
|
R as AlgorithmControl
|
|
103
114
|
};
|
|
@@ -3,7 +3,7 @@ var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
5
|
import { DEFAULT_NODE_CONFIG as c } from "../../constants/defaultConfig.js";
|
|
6
|
-
import { RecommendationConfigService as
|
|
6
|
+
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
8
|
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
9
|
import { ALGORITHM_CONTROL_ID as tt } from "./algorithm.js";
|
|
@@ -17,15 +17,15 @@ import { LocaleControl as b } from "./locale.js";
|
|
|
17
17
|
import { LOCALE_CONTROL_ID as lt } from "./locale.js";
|
|
18
18
|
import { PricePlacementControl as T } from "./pricePlacement.js";
|
|
19
19
|
import { PRICE_PLACEMENT_CONTROL_ID as ut } from "./pricePlacement.js";
|
|
20
|
-
import { ProductCountControl as
|
|
21
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
22
|
-
import { ProductLayoutControl as
|
|
20
|
+
import { ProductCountControl as O } from "./productCount.js";
|
|
21
|
+
import { PRODUCT_COUNT_CONTROL_ID as ht } from "./productCount.js";
|
|
22
|
+
import { ProductLayoutControl as P } from "./productLayout.js";
|
|
23
23
|
import { PRODUCT_LAYOUT_CONTROL_ID as Ct } from "./productLayout.js";
|
|
24
|
-
import { ShuffleControl as
|
|
24
|
+
import { ShuffleControl as S } from "./shuffle.js";
|
|
25
25
|
import { SHUFFLE_CONTROL_ID as pt } from "./shuffle.js";
|
|
26
|
-
import { setCurrencyAttributes as
|
|
26
|
+
import { setCurrencyAttributes as L, getBlockElement as k, isPartnerManagedBlock as D, updateProductContentInPlace as E, regenerateProductRowsWithStyles as A } from "./utils.js";
|
|
27
27
|
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, regenerateMobileProductRows as _t, updatePricesInPlace as bt, updateSingleProductContent as Tt } from "./utils.js";
|
|
28
|
-
import { useDebounceFn as
|
|
28
|
+
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
29
29
|
const v = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
30
30
|
class Q extends g {
|
|
31
31
|
constructor() {
|
|
@@ -47,7 +47,7 @@ class Q extends g {
|
|
|
47
47
|
/**
|
|
48
48
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
49
49
|
*/
|
|
50
|
-
s(this, "_debouncedFetchProducts",
|
|
50
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
51
51
|
this.store.fetchRecommendationProducts();
|
|
52
52
|
}, 500));
|
|
53
53
|
/**
|
|
@@ -61,7 +61,7 @@ class Q extends g {
|
|
|
61
61
|
* count. The store pads products to the configured size, so in-place only
|
|
62
62
|
* fails when the size actually changed.
|
|
63
63
|
*/
|
|
64
|
-
s(this, "_debouncedRegenerateWithProducts",
|
|
64
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
65
65
|
const t = this.store.recommendationProducts;
|
|
66
66
|
if (!this.currentNode || !this.api || D(this.currentNode))
|
|
67
67
|
return;
|
|
@@ -81,7 +81,7 @@ class Q extends g {
|
|
|
81
81
|
return w;
|
|
82
82
|
}
|
|
83
83
|
getTemplate() {
|
|
84
|
-
return this.algorithmControl = new N(), this.localeControl = new b(), this.currencyControl = new R(), this.productCountControl = new
|
|
84
|
+
return this.algorithmControl = new N(), this.localeControl = new b(), this.currencyControl = new R(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new I(), this.shuffleControl = new S(), this.pricePlacementControl = new T(), this.layoutOrientationControl = new _(), [
|
|
85
85
|
this.algorithmControl,
|
|
86
86
|
this.localeControl,
|
|
87
87
|
this.currencyControl,
|
|
@@ -186,7 +186,7 @@ class Q extends g {
|
|
|
186
186
|
*/
|
|
187
187
|
_syncNodeConfigToStore() {
|
|
188
188
|
var r;
|
|
189
|
-
const t =
|
|
189
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
190
190
|
this.store.patchCurrentBlockConfig({
|
|
191
191
|
strategy: t.strategy,
|
|
192
192
|
language: t.language,
|
|
@@ -249,7 +249,7 @@ class Q extends g {
|
|
|
249
249
|
_applySmartDefaults() {
|
|
250
250
|
if (!this.currentNode || !this.api)
|
|
251
251
|
return;
|
|
252
|
-
const t =
|
|
252
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
253
253
|
let o = null, r = null, n = null;
|
|
254
254
|
if (t.currency.code === c.currency.code) {
|
|
255
255
|
const { currencyList: i } = this.store;
|
|
@@ -273,12 +273,12 @@ class Q extends g {
|
|
|
273
273
|
(u) => u.value === c.language
|
|
274
274
|
) || (n = i[0].value, e.language = n));
|
|
275
275
|
}
|
|
276
|
-
!o && !r && !n || (
|
|
276
|
+
!o && !r && !n || (h.updateConfig(
|
|
277
277
|
this.api,
|
|
278
278
|
this.currentNode,
|
|
279
279
|
e,
|
|
280
280
|
"Applied smart defaults"
|
|
281
|
-
), o && e.currency &&
|
|
281
|
+
), o && e.currency && L({
|
|
282
282
|
currentNode: this.currentNode,
|
|
283
283
|
documentModifier: this.api.getDocumentModifier(),
|
|
284
284
|
currency: e.currency
|
|
@@ -346,8 +346,8 @@ class Q extends g {
|
|
|
346
346
|
_persistFiltersToNodeConfig() {
|
|
347
347
|
if (!this.currentNode || !this.api)
|
|
348
348
|
return;
|
|
349
|
-
const { filters: t } = this.store.recommendationConfigs;
|
|
350
|
-
|
|
349
|
+
const { filters: t } = this.store.recommendationConfigs, e = h.getConfig(this.currentNode).filters;
|
|
350
|
+
JSON.stringify(e) !== JSON.stringify(t) && h.updateConfig(
|
|
351
351
|
this.api,
|
|
352
352
|
this.currentNode,
|
|
353
353
|
{ filters: t },
|
|
@@ -368,14 +368,14 @@ export {
|
|
|
368
368
|
_ as LayoutOrientationControl,
|
|
369
369
|
b as LocaleControl,
|
|
370
370
|
ut as PRICE_PLACEMENT_CONTROL_ID,
|
|
371
|
-
|
|
371
|
+
ht as PRODUCT_COUNT_CONTROL_ID,
|
|
372
372
|
Ct as PRODUCT_LAYOUT_CONTROL_ID,
|
|
373
373
|
T as PricePlacementControl,
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
O as ProductCountControl,
|
|
375
|
+
P as ProductLayoutControl,
|
|
376
376
|
Q as RecommendationBlockControl,
|
|
377
377
|
pt as SHUFFLE_CONTROL_ID,
|
|
378
|
-
|
|
378
|
+
S as ShuffleControl,
|
|
379
379
|
yt as adjustProductsToSize,
|
|
380
380
|
Nt as formatProductPrice,
|
|
381
381
|
k as getBlockElement,
|
|
@@ -384,7 +384,7 @@ export {
|
|
|
384
384
|
D as isPartnerManagedBlock,
|
|
385
385
|
_t as regenerateMobileProductRows,
|
|
386
386
|
A as regenerateProductRowsWithStyles,
|
|
387
|
-
|
|
387
|
+
L as setCurrencyAttributes,
|
|
388
388
|
bt as updatePricesInPlace,
|
|
389
389
|
E as updateProductContentInPlace,
|
|
390
390
|
Tt as updateSingleProductContent
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
|
-
import { defineStore as
|
|
4
|
+
import { defineStore as P } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as F, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
|
|
7
7
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
8
8
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
9
9
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
10
10
|
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { sanitizeProductIds as N } from "../utils/productIds.js";
|
|
12
|
+
import { isFilterValid as x } from "../validation/filterSchema.js";
|
|
13
|
+
import { isConfigValid as L } from "../validation/requiredFields.js";
|
|
13
14
|
const h = y();
|
|
14
15
|
let m = null, u = null, d = null;
|
|
15
16
|
function k() {
|
|
@@ -28,7 +29,7 @@ function k() {
|
|
|
28
29
|
productIds: [],
|
|
29
30
|
id: 1,
|
|
30
31
|
language: "en_US",
|
|
31
|
-
mobileCardsInRow:
|
|
32
|
+
mobileCardsInRow: F,
|
|
32
33
|
mobileLayoutEnabled: !1,
|
|
33
34
|
orientation: "grid",
|
|
34
35
|
recommendedProducts: [],
|
|
@@ -54,7 +55,7 @@ function I() {
|
|
|
54
55
|
filterSnapshot: null
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
+
const U = () => ({
|
|
58
59
|
recommendationCampaignUrls: {},
|
|
59
60
|
activePredictiveAlgorithms: [],
|
|
60
61
|
languages: {},
|
|
@@ -63,8 +64,8 @@ const L = () => ({
|
|
|
63
64
|
blockStates: {},
|
|
64
65
|
currentRecommendationId: null,
|
|
65
66
|
configVersion: 0
|
|
66
|
-
}),
|
|
67
|
-
state: () =>
|
|
67
|
+
}), H = P("guidoRecommendationExtension", {
|
|
68
|
+
state: () => U(),
|
|
68
69
|
getters: {
|
|
69
70
|
// ====================================================================
|
|
70
71
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -383,7 +384,7 @@ const L = () => ({
|
|
|
383
384
|
const n = [...e.recommendationConfigs.filters];
|
|
384
385
|
n[r] = {
|
|
385
386
|
...t,
|
|
386
|
-
isValid:
|
|
387
|
+
isValid: x(t)
|
|
387
388
|
}, e.recommendationConfigs.filters = n;
|
|
388
389
|
}
|
|
389
390
|
},
|
|
@@ -429,7 +430,7 @@ const L = () => ({
|
|
|
429
430
|
* every block's recommendationConfigs across user edits.
|
|
430
431
|
*/
|
|
431
432
|
hasInvalidBlock() {
|
|
432
|
-
return Object.values(this.blockStates).some((t) => !
|
|
433
|
+
return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
|
|
433
434
|
},
|
|
434
435
|
// ====================================================================
|
|
435
436
|
// Per-Block Product Fetching
|
|
@@ -458,7 +459,7 @@ const L = () => ({
|
|
|
458
459
|
details: !0,
|
|
459
460
|
campaignId: o.variationId
|
|
460
461
|
};
|
|
461
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds
|
|
462
|
+
r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
462
463
|
a,
|
|
463
464
|
v(o.partnerName, r.strategy)
|
|
464
465
|
);
|
|
@@ -479,5 +480,5 @@ const L = () => ({
|
|
|
479
480
|
}
|
|
480
481
|
});
|
|
481
482
|
export {
|
|
482
|
-
|
|
483
|
+
H as useRecommendationExtensionStore
|
|
483
484
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the request/URL `productId` value from raw product ID segments.
|
|
3
|
+
* Trimming happens here — NOT on input change — so the user's in-progress
|
|
4
|
+
* text (trailing commas, spaces) is never rewritten under the caret (SD-147111).
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeProductIds(ids: readonly (string | number | null | undefined)[]): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.16.0-beta.
|
|
3
|
+
"version": "3.16.0-beta.c615198",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|