@useinsider/guido 3.15.0-beta.244c73c → 3.15.0-beta.31fdfec
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/useAllowlist.js +48 -30
- package/dist/composables/useHtmlCompiler.js +19 -16
- package/dist/composables/useRecommendation.js +19 -20
- package/dist/config/compiler/htmlCompilerRules.js +34 -7
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +34 -33
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -13
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +0 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +0 -6
|
@@ -1,50 +1,68 @@
|
|
|
1
1
|
import { useAllowlistApi as A } from "../services/allowlistApi.js";
|
|
2
|
-
import { base64EncodeWithSpecialChars as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { useUserRole as
|
|
5
|
-
const
|
|
2
|
+
import { base64EncodeWithSpecialChars as f } from "../utils/base64.js";
|
|
3
|
+
import { useTranslations as D } from "./useTranslations.js";
|
|
4
|
+
import { useUserRole as E } from "./useUserRole.js";
|
|
5
|
+
const _ = /(?:https?:\/\/|www\.)[^\s"'<>()]+/gi, L = /"\/\//gi, w = "s3-eu-west-1.amazonaws.com", d = [
|
|
6
|
+
"insider-email",
|
|
7
|
+
"web-image.useinsider.com",
|
|
8
|
+
"image.useinsider.com",
|
|
9
|
+
"panel-assets.useinsider.com",
|
|
10
|
+
"stripo-editor-image"
|
|
11
|
+
], N = ({ hostname: r, pathname: l }) => {
|
|
12
|
+
const n = r.toLowerCase();
|
|
13
|
+
if (n === w) {
|
|
14
|
+
const i = l.split("/")[1].toLowerCase();
|
|
15
|
+
return d.includes(i);
|
|
16
|
+
}
|
|
17
|
+
return d.some((i) => n === `${i}.${w}`);
|
|
18
|
+
}, m = {
|
|
6
19
|
MANAGE: "journey-builder.domain-allowlist-warning",
|
|
7
20
|
NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
|
|
8
21
|
ADD_BUTTON: "settings.allow-list-warning-add-button"
|
|
9
|
-
},
|
|
10
|
-
const { checkDomain:
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
const
|
|
22
|
+
}, g = /* @__PURE__ */ new Set(), O = (r) => `/settings?openAddModal=true&type=domain&values=${f(r)}#security`, C = () => {
|
|
23
|
+
const { checkDomain: r } = A(), { getIsManageUser: l } = E(), n = D(), i = (t, e) => {
|
|
24
|
+
const a = `${t || ""} ${e || ""}`.replace(L, "https://").match(_) || [], s = /* @__PURE__ */ new Set();
|
|
25
|
+
return a.forEach((c) => {
|
|
26
|
+
const h = /^https?:\/\//i.test(c) ? c : `https://${c}`;
|
|
14
27
|
try {
|
|
15
|
-
const
|
|
16
|
-
|
|
28
|
+
const u = new URL(h);
|
|
29
|
+
if (N(u))
|
|
30
|
+
return;
|
|
31
|
+
u.hostname && s.add(u.hostname.replace(/^www\./i, "").toLowerCase());
|
|
17
32
|
} catch {
|
|
18
33
|
}
|
|
19
|
-
}), [...
|
|
20
|
-
},
|
|
21
|
-
if (
|
|
34
|
+
}), [...s];
|
|
35
|
+
}, p = async (t) => {
|
|
36
|
+
if (g.has(t))
|
|
22
37
|
return !0;
|
|
23
38
|
try {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
} catch (
|
|
27
|
-
return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t,
|
|
39
|
+
const e = await r(t);
|
|
40
|
+
return e && g.add(t), e;
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t, e), !0;
|
|
28
43
|
}
|
|
29
44
|
};
|
|
30
|
-
return { getBlockedDomains: async (t,
|
|
45
|
+
return { getBlockedDomains: async (t, e) => {
|
|
31
46
|
try {
|
|
32
|
-
const o =
|
|
47
|
+
const o = i(t, e);
|
|
33
48
|
return o.length ? (await Promise.all(
|
|
34
|
-
o.map(async (
|
|
35
|
-
)).filter((
|
|
49
|
+
o.map(async (s) => ({ domain: s, allowlisted: await p(s) }))
|
|
50
|
+
)).filter((s) => !s.allowlisted).map((s) => s.domain) : [];
|
|
36
51
|
} catch (o) {
|
|
37
52
|
return console.error("[GUIDO_ALLOWLIST] getBlockedDomains failed", o), [];
|
|
38
53
|
}
|
|
39
|
-
}, resolveToast: async (t) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
}, resolveToast: async (t) => {
|
|
55
|
+
const e = await l(), o = t.length ? ` (${t.join(", ")})` : "", a = (s) => `${s}${o}`;
|
|
56
|
+
return e ? {
|
|
57
|
+
message: a(n(m.MANAGE)),
|
|
58
|
+
actionButton: {
|
|
59
|
+
text: n(m.ADD_BUTTON),
|
|
60
|
+
onClick: () => window.open(O(t.join(",")), "_blank")
|
|
61
|
+
}
|
|
62
|
+
} : { message: a(n(m.NON_MANAGE)) };
|
|
63
|
+
} };
|
|
46
64
|
};
|
|
47
65
|
export {
|
|
48
66
|
O as buildAllowlistSettingsUrl,
|
|
49
|
-
|
|
67
|
+
C as useAllowlist
|
|
50
68
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
1
|
+
import { defaultHtmlCompilerRules as g } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as R } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as b } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
|
|
5
5
|
import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
-
import { socialCompilerRules as
|
|
7
|
-
import { unsubscribeCompilerRules as
|
|
6
|
+
import { socialCompilerRules as y } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as H } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
8
|
import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
|
|
9
|
-
import { useConfig as
|
|
10
|
-
const
|
|
9
|
+
import { useConfig as x } from "./useConfig.js";
|
|
10
|
+
const h = /* @__PURE__ */ new Set([
|
|
11
11
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
12
12
|
"fix-url-encoding-start",
|
|
13
13
|
"fix-url-encoding-end",
|
|
@@ -18,6 +18,9 @@ const y = /* @__PURE__ */ new Set([
|
|
|
18
18
|
// Image domain corrections — plain string replacement.
|
|
19
19
|
"replace-old-image-domain",
|
|
20
20
|
"replace-old-v2-image-domain",
|
|
21
|
+
"replace-s3-path-style-web-image-domain",
|
|
22
|
+
"replace-s3-path-style-image-domain",
|
|
23
|
+
"replace-s3-path-style-panel-assets-domain",
|
|
21
24
|
// Unsubscribe domain — the actual fix: injects the real unsubscribe href in
|
|
22
25
|
// place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
|
|
23
26
|
// unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
|
|
@@ -32,21 +35,21 @@ const y = /* @__PURE__ */ new Set([
|
|
|
32
35
|
"remove-contenteditable"
|
|
33
36
|
]), M = () => {
|
|
34
37
|
var i, m, r;
|
|
35
|
-
const { compiler: o, isFeatureEnabled:
|
|
36
|
-
...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] :
|
|
38
|
+
const { compiler: o, isFeatureEnabled: a, partner: n } = x(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
|
|
39
|
+
...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : g,
|
|
37
40
|
...v,
|
|
38
|
-
...x,
|
|
39
|
-
...g,
|
|
40
|
-
...b,
|
|
41
41
|
...H,
|
|
42
|
-
...
|
|
42
|
+
...R,
|
|
43
|
+
...C,
|
|
44
|
+
...y,
|
|
45
|
+
...a("liquidSyntax") ? b : [],
|
|
43
46
|
...p.map((e, f) => ({
|
|
44
47
|
...e,
|
|
45
48
|
priority: e.priority + 1e3 + f
|
|
46
49
|
// Ensure additional rules run after default rules
|
|
47
50
|
}))
|
|
48
|
-
],
|
|
49
|
-
return { compileHtml: (e) =>
|
|
51
|
+
], c = s(l), u = l.filter((e) => h.has(e.id)), d = s(u), t = (r = n.value) == null ? void 0 : r.fallbackFont;
|
|
52
|
+
return { compileHtml: (e) => c.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
|
|
50
53
|
};
|
|
51
54
|
export {
|
|
52
55
|
M as useHtmlCompiler
|
|
@@ -3,21 +3,20 @@ 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
|
-
|
|
8
|
-
const B = () => ({
|
|
6
|
+
import { useConfigStore as x } from "../stores/config.js";
|
|
7
|
+
const k = () => ({
|
|
9
8
|
calculateCardWidth: ({
|
|
10
9
|
mobileLeftPadding: a,
|
|
11
10
|
mobileRightPadding: s,
|
|
12
11
|
cardsInRow: c,
|
|
13
|
-
unresponsive:
|
|
12
|
+
unresponsive: o
|
|
14
13
|
}) => {
|
|
15
|
-
const r =
|
|
14
|
+
const r = o ? c : 1, e = a + s + (r - 1) * b;
|
|
16
15
|
return (C - e) / r;
|
|
17
16
|
},
|
|
18
17
|
getRecommendationCampaignData: (a) => {
|
|
19
|
-
const s = l(), c = Number(a),
|
|
20
|
-
if (!
|
|
18
|
+
const s = l(), c = Number(a), o = s.blockStates[c];
|
|
19
|
+
if (!o)
|
|
21
20
|
return {
|
|
22
21
|
textTrimming: !1,
|
|
23
22
|
orientation: "vertical",
|
|
@@ -30,7 +29,7 @@ const B = () => ({
|
|
|
30
29
|
discountBeforeTextValue: "",
|
|
31
30
|
discountAfterTextValue: ""
|
|
32
31
|
};
|
|
33
|
-
const { recommendationConfigs: r } =
|
|
32
|
+
const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
33
|
return {
|
|
35
34
|
textTrimming: r.textTrimming,
|
|
36
35
|
orientation: e,
|
|
@@ -46,7 +45,7 @@ const B = () => ({
|
|
|
46
45
|
},
|
|
47
46
|
buildCampaignUrl: (a, s) => {
|
|
48
47
|
var m;
|
|
49
|
-
const c = l(),
|
|
48
|
+
const c = l(), o = x(), r = Number(a);
|
|
50
49
|
let e;
|
|
51
50
|
if (s)
|
|
52
51
|
e = s;
|
|
@@ -54,25 +53,25 @@ const B = () => ({
|
|
|
54
53
|
const i = c.blockStates[r];
|
|
55
54
|
if (!i)
|
|
56
55
|
return "";
|
|
57
|
-
const { recommendationConfigs:
|
|
56
|
+
const { recommendationConfigs: n } = i;
|
|
58
57
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
language:
|
|
61
|
-
currencyCode:
|
|
62
|
-
size:
|
|
63
|
-
productIds:
|
|
64
|
-
filters:
|
|
65
|
-
shuffleProducts:
|
|
58
|
+
strategy: n.strategy,
|
|
59
|
+
language: n.language,
|
|
60
|
+
currencyCode: n.currencySettings.value,
|
|
61
|
+
size: n.size,
|
|
62
|
+
productIds: n.productIds,
|
|
63
|
+
filters: n.filters,
|
|
64
|
+
shuffleProducts: n.shuffleProducts
|
|
66
65
|
};
|
|
67
66
|
}
|
|
68
67
|
const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
69
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
68
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
70
69
|
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
71
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(
|
|
70
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(o.partnerName, e.strategy)).forEach(([i, n]) => t.set(i, n));
|
|
72
71
|
const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
73
72
|
return c.recommendationCampaignUrls[a] = u, u;
|
|
74
73
|
}
|
|
75
74
|
});
|
|
76
75
|
export {
|
|
77
|
-
|
|
76
|
+
k as useRecommendation
|
|
78
77
|
};
|
|
@@ -122,10 +122,10 @@ const d = [
|
|
|
122
122
|
], i = /<head>([\S\s]*)<\/head>/, o = new RegExp(i);
|
|
123
123
|
if (!e.match(o))
|
|
124
124
|
return e;
|
|
125
|
-
let
|
|
126
|
-
return t.forEach((
|
|
127
|
-
|
|
128
|
-
}),
|
|
125
|
+
let s = e;
|
|
126
|
+
return t.forEach((r) => {
|
|
127
|
+
s = s.replace("</head>", `${r}</head>`);
|
|
128
|
+
}), s;
|
|
129
129
|
},
|
|
130
130
|
priority: 30
|
|
131
131
|
},
|
|
@@ -147,6 +147,33 @@ const d = [
|
|
|
147
147
|
replaceAll: !0,
|
|
148
148
|
priority: 41
|
|
149
149
|
},
|
|
150
|
+
{
|
|
151
|
+
id: "replace-s3-path-style-web-image-domain",
|
|
152
|
+
description: "Rewriting path-style S3 asset URLs to the web-image.useinsider.com domain",
|
|
153
|
+
type: "replace",
|
|
154
|
+
search: "s3-eu-west-1.amazonaws.com/web-image.useinsider.com",
|
|
155
|
+
replacement: "web-image.useinsider.com",
|
|
156
|
+
replaceAll: !0,
|
|
157
|
+
priority: 42
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "replace-s3-path-style-image-domain",
|
|
161
|
+
description: "Rewriting path-style S3 asset URLs to the image.useinsider.com domain",
|
|
162
|
+
type: "replace",
|
|
163
|
+
search: "s3-eu-west-1.amazonaws.com/image.useinsider.com",
|
|
164
|
+
replacement: "image.useinsider.com",
|
|
165
|
+
replaceAll: !0,
|
|
166
|
+
priority: 43
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "replace-s3-path-style-panel-assets-domain",
|
|
170
|
+
description: "Rewriting path-style S3 asset URLs to the panel-assets.useinsider.com domain",
|
|
171
|
+
type: "replace",
|
|
172
|
+
search: "s3-eu-west-1.amazonaws.com/panel-assets.useinsider.com",
|
|
173
|
+
replacement: "panel-assets.useinsider.com",
|
|
174
|
+
replaceAll: !0,
|
|
175
|
+
priority: 46
|
|
176
|
+
},
|
|
150
177
|
{
|
|
151
178
|
id: "convert-rgb-to-hex",
|
|
152
179
|
// SD-142395: rgb()/6-digit hex are verbose; hex/3-digit shorthand is byte-identical
|
|
@@ -156,9 +183,9 @@ const d = [
|
|
|
156
183
|
type: "custom",
|
|
157
184
|
processor: (e) => {
|
|
158
185
|
const t = (i) => i.toString(16).padStart(2, "0");
|
|
159
|
-
return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o,
|
|
160
|
-
const [
|
|
161
|
-
return
|
|
186
|
+
return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, a, s) => {
|
|
187
|
+
const [r, n, c] = [Number(o), Number(a), Number(s)];
|
|
188
|
+
return r > 255 || n > 255 || c > 255 ? i : `#${t(r)}${t(n)}${t(c)}`;
|
|
162
189
|
}).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
|
|
163
190
|
},
|
|
164
191
|
priority: 44
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
|
|
3
|
+
var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as d } 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 g } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const u = "recommendation-algorithm-control", i = {
|
|
10
10
|
ALGORITHM: "strategy",
|
|
11
11
|
PRODUCT_IDS: "productIds"
|
|
12
12
|
};
|
|
13
|
-
class
|
|
13
|
+
class R extends d {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
17
|
-
|
|
17
|
+
a(this, "store", m());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return u;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
@@ -25,13 +25,13 @@ class S extends g {
|
|
|
25
25
|
${this._GuTwoColumns([
|
|
26
26
|
this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
|
|
27
27
|
this._GuSelect({
|
|
28
|
-
name:
|
|
28
|
+
name: i.ALGORITHM,
|
|
29
29
|
placeholder: this.api.translate("Select Recommendation Algorithm"),
|
|
30
30
|
options: this.store.getActivePredictiveAlgorithms
|
|
31
31
|
}),
|
|
32
|
-
this._GuLabel({ text: this.api.translate("Product Ids"), name: `${
|
|
32
|
+
this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
|
|
33
33
|
this._GuTextInput({
|
|
34
|
-
name:
|
|
34
|
+
name: i.PRODUCT_IDS,
|
|
35
35
|
placeholder: this.api.translate("Enter Product Ids"),
|
|
36
36
|
className: "es-180w"
|
|
37
37
|
})
|
|
@@ -46,28 +46,29 @@ class S extends g {
|
|
|
46
46
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
47
47
|
}
|
|
48
48
|
_setFormValues() {
|
|
49
|
-
const t = n.getConfig(this.currentNode),
|
|
50
|
-
this._setProductIdsVisibility(
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const t = n.getConfig(this.currentNode), e = g(t.strategy) ?? t.strategy;
|
|
50
|
+
this._setProductIdsVisibility(e), this.api.updateValues({
|
|
51
|
+
[i.ALGORITHM]: e,
|
|
52
|
+
[i.PRODUCT_IDS]: t.productIds.join(",")
|
|
53
|
+
});
|
|
53
54
|
}
|
|
54
55
|
_initializeSelectItems() {
|
|
55
|
-
var
|
|
56
|
-
const t = (
|
|
56
|
+
var e;
|
|
57
|
+
const t = (e = this.store) == null ? void 0 : e.getActivePredictiveAlgorithms;
|
|
57
58
|
if (t != null && t.length)
|
|
58
59
|
try {
|
|
59
60
|
this.api.setUIEAttribute(
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
i.ALGORITHM,
|
|
62
|
+
h.SELECTPICKER.items,
|
|
62
63
|
t
|
|
63
64
|
);
|
|
64
|
-
} catch (
|
|
65
|
-
console.warn("[AlgorithmControl] Failed to set algorithm options:",
|
|
65
|
+
} catch (r) {
|
|
66
|
+
console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
_setProductIdsVisibility(t) {
|
|
69
|
-
const
|
|
70
|
-
this.api.setVisibility(
|
|
70
|
+
const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
71
|
+
this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
|
|
71
72
|
}
|
|
72
73
|
_onAlgorithmChange(t) {
|
|
73
74
|
!this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
|
|
@@ -78,25 +79,25 @@ class S extends g {
|
|
|
78
79
|
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t));
|
|
79
80
|
}
|
|
80
81
|
_onProductIdsChange(t) {
|
|
81
|
-
if (!this.currentNode
|
|
82
|
+
if (!this.currentNode)
|
|
82
83
|
return;
|
|
83
|
-
const
|
|
84
|
+
const e = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
84
85
|
n.updateConfig(
|
|
85
86
|
this.api,
|
|
86
87
|
this.currentNode,
|
|
87
|
-
{ productIds:
|
|
88
|
+
{ productIds: e },
|
|
88
89
|
"Updated product IDs"
|
|
89
|
-
), this.store.patchCurrentBlockConfig({ productIds:
|
|
90
|
+
), this.store.patchCurrentBlockConfig({ productIds: e });
|
|
90
91
|
}
|
|
91
92
|
_listenToFormUpdates() {
|
|
92
|
-
this.api.onValueChanged(
|
|
93
|
+
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
93
94
|
this._onAlgorithmChange(t);
|
|
94
|
-
}), this.api.onValueChanged(
|
|
95
|
+
}), this.api.onValueChanged(i.PRODUCT_IDS, (t) => {
|
|
95
96
|
this._onProductIdsChange(t);
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
u as ALGORITHM_CONTROL_ID,
|
|
102
|
+
R as AlgorithmControl
|
|
102
103
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
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 F } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as P, 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 {
|
|
13
|
-
import { isConfigValid as L } from "../validation/requiredFields.js";
|
|
11
|
+
import { isFilterValid as N } from "../validation/filterSchema.js";
|
|
12
|
+
import { isConfigValid as x } from "../validation/requiredFields.js";
|
|
14
13
|
const h = y();
|
|
15
14
|
let m = null, u = null, d = null;
|
|
16
15
|
function k() {
|
|
@@ -29,7 +28,7 @@ function k() {
|
|
|
29
28
|
productIds: [],
|
|
30
29
|
id: 1,
|
|
31
30
|
language: "en_US",
|
|
32
|
-
mobileCardsInRow:
|
|
31
|
+
mobileCardsInRow: P,
|
|
33
32
|
mobileLayoutEnabled: !1,
|
|
34
33
|
orientation: "grid",
|
|
35
34
|
recommendedProducts: [],
|
|
@@ -55,7 +54,7 @@ function I() {
|
|
|
55
54
|
filterSnapshot: null
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
|
-
const
|
|
57
|
+
const L = () => ({
|
|
59
58
|
recommendationCampaignUrls: {},
|
|
60
59
|
activePredictiveAlgorithms: [],
|
|
61
60
|
languages: {},
|
|
@@ -64,8 +63,8 @@ const U = () => ({
|
|
|
64
63
|
blockStates: {},
|
|
65
64
|
currentRecommendationId: null,
|
|
66
65
|
configVersion: 0
|
|
67
|
-
}),
|
|
68
|
-
state: () =>
|
|
66
|
+
}), $ = F("guidoRecommendationExtension", {
|
|
67
|
+
state: () => L(),
|
|
69
68
|
getters: {
|
|
70
69
|
// ====================================================================
|
|
71
70
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -384,7 +383,7 @@ const U = () => ({
|
|
|
384
383
|
const n = [...e.recommendationConfigs.filters];
|
|
385
384
|
n[r] = {
|
|
386
385
|
...t,
|
|
387
|
-
isValid:
|
|
386
|
+
isValid: N(t)
|
|
388
387
|
}, e.recommendationConfigs.filters = n;
|
|
389
388
|
}
|
|
390
389
|
},
|
|
@@ -430,7 +429,7 @@ const U = () => ({
|
|
|
430
429
|
* every block's recommendationConfigs across user edits.
|
|
431
430
|
*/
|
|
432
431
|
hasInvalidBlock() {
|
|
433
|
-
return Object.values(this.blockStates).some((t) => !
|
|
432
|
+
return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
|
|
434
433
|
},
|
|
435
434
|
// ====================================================================
|
|
436
435
|
// Per-Block Product Fetching
|
|
@@ -459,7 +458,7 @@ const U = () => ({
|
|
|
459
458
|
details: !0,
|
|
460
459
|
campaignId: o.variationId
|
|
461
460
|
};
|
|
462
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
461
|
+
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
463
462
|
a,
|
|
464
463
|
v(o.partnerName, r.strategy)
|
|
465
464
|
);
|
|
@@ -480,5 +479,5 @@ const U = () => ({
|
|
|
480
479
|
}
|
|
481
480
|
});
|
|
482
481
|
export {
|
|
483
|
-
|
|
482
|
+
$ as useRecommendationExtensionStore
|
|
484
483
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.15.0-beta.
|
|
3
|
+
"version": "3.15.0-beta.31fdfec",
|
|
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",
|
|
@@ -1,6 +0,0 @@
|
|
|
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: string[]): string;
|