@useinsider/guido 3.12.0-beta.cfe6433 → 3.12.0-beta.d77b0d2
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/@types/config/schemas.js +9 -4
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +50 -49
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +38 -0
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +271 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
- package/dist/composables/useHtmlValidator.js +68 -60
- package/dist/composables/useHttp.js +61 -52
- package/dist/composables/usePreviewInteractionGuard.js +36 -11
- package/dist/composables/useRecommendation.js +56 -40
- package/dist/composables/useRecommendationPreview.js +61 -60
- package/dist/composables/useSave.js +22 -22
- package/dist/composables/useStrategyFilters.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +7 -4
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/filteringV2.js +1024 -0
- package/dist/enums/extensions/recommendationBlock.js +45 -24
- package/dist/enums/extensions/strategyDetail.js +149 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +141 -123
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +297 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +16 -2
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +137 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +549 -165
- package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyNavigation.js +8 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +95 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyUrl.js +43 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -10
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
- package/dist/extensions/Blocks/common-control.js +37 -35
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +127 -33
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +2 -0
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
- package/dist/src/composables/useRecommendation.d.ts +2 -0
- package/dist/src/composables/useStrategyFilters.d.ts +24 -0
- package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +33 -0
- package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +118 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +958 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyNavigation.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyUrl.d.ts +51 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +8 -1
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -2
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +9 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/utils/genericUtil.d.ts +9 -0
- package/dist/src/utils/urlSchemes.d.ts +6 -0
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +10 -1
- package/dist/utils/templatePreparation.js +70 -57
- package/dist/utils/urlSchemes.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { FilterTypeNames as f, OperatorAbbreviations as N, UserEvents as y, UserEventKeys as d } from "../../../../enums/extensions/strategyDetail.js";
|
|
2
|
+
import { formatShortDate as p } from "../../../../utils/dateUtil.js";
|
|
3
|
+
const L = /* @__PURE__ */ new Set([
|
|
4
|
+
d.CURRENTLY_VIEWED_ITEM,
|
|
5
|
+
d.LEGACY_CURRENTLY_VIEWED_ITEM
|
|
6
|
+
]), g = /^(\d+)([whd])$/, h = (t) => t ? t.charAt(0).toUpperCase() + t.slice(1) : "", v = (t, e) => {
|
|
7
|
+
const r = y.find((n) => n.value === t);
|
|
8
|
+
return r ? e(r.text) : t;
|
|
9
|
+
}, C = (t, e) => {
|
|
10
|
+
if (t.userAttribute)
|
|
11
|
+
return t.userAttribute;
|
|
12
|
+
if (!t.userEvent)
|
|
13
|
+
return "";
|
|
14
|
+
const r = v(t.userEvent, e);
|
|
15
|
+
if (L.has(t.userEvent))
|
|
16
|
+
return r;
|
|
17
|
+
const n = t.userEventCount ?? 0;
|
|
18
|
+
if (n <= 0)
|
|
19
|
+
return r;
|
|
20
|
+
const a = e(
|
|
21
|
+
n === 1 ? "discovery-strategy-filtering.item" : "discovery-strategy-filtering.items"
|
|
22
|
+
);
|
|
23
|
+
return `${r} ${n} ${a}`;
|
|
24
|
+
}, O = [
|
|
25
|
+
f.USER_ATTRIBUTE_FILTER,
|
|
26
|
+
f.USER_EVENT_FILTER,
|
|
27
|
+
f.USER_CONTEXT_FILTER
|
|
28
|
+
], V = (t) => O.includes(t ?? ""), S = (t, e, r) => {
|
|
29
|
+
if (!t)
|
|
30
|
+
return "";
|
|
31
|
+
const n = g.exec(t);
|
|
32
|
+
if (!n)
|
|
33
|
+
return "";
|
|
34
|
+
const [, a, c] = n, s = e.find((T) => T.value === c), $ = s ? s.text.toLowerCase() : c;
|
|
35
|
+
return ` ${r("purchase-history.in-last")} ${a} ${$}`;
|
|
36
|
+
}, R = (t, e) => t.map((r) => `[${r}]`).join(` ${e} `), b = (t) => {
|
|
37
|
+
let e;
|
|
38
|
+
try {
|
|
39
|
+
e = JSON.parse(t);
|
|
40
|
+
} catch {
|
|
41
|
+
return t.split(",");
|
|
42
|
+
}
|
|
43
|
+
return Array.isArray(e) ? e.map((r) => String(r)) : [String(e)];
|
|
44
|
+
};
|
|
45
|
+
function w(t) {
|
|
46
|
+
const {
|
|
47
|
+
condition: e,
|
|
48
|
+
selectedOperator: r,
|
|
49
|
+
filterValue: n,
|
|
50
|
+
timeUnit: a,
|
|
51
|
+
inBetweenValues: c,
|
|
52
|
+
timeUnitOptions: s,
|
|
53
|
+
isDateAttribute: $,
|
|
54
|
+
isMultiSelect: T,
|
|
55
|
+
isInOrNotInOperator: U,
|
|
56
|
+
trans: E
|
|
57
|
+
} = t, { IN_LAST: A, IN_BETWEEN: _ } = N.OPERATOR, l = E("action-builder.and");
|
|
58
|
+
if (V(e.type)) {
|
|
59
|
+
const i = C(e, E);
|
|
60
|
+
if (i)
|
|
61
|
+
return `${i}${S(e.duration, s, E)}`;
|
|
62
|
+
}
|
|
63
|
+
const u = e.type === f.EVENT_BASED_FILTER ? S(e.duration, s, E) : "";
|
|
64
|
+
if (e.time && r !== _)
|
|
65
|
+
return `${p(e.time)}${u}`;
|
|
66
|
+
if (r === A) {
|
|
67
|
+
const [i] = n.match(/\d+/g) || [];
|
|
68
|
+
if (!i)
|
|
69
|
+
return n;
|
|
70
|
+
const o = s.find((m) => m.value === a);
|
|
71
|
+
return `${i} ${h((o == null ? void 0 : o.text) ?? "")}`.trimEnd();
|
|
72
|
+
}
|
|
73
|
+
if (r === _) {
|
|
74
|
+
if ($() && e.time) {
|
|
75
|
+
const [m = "", I = ""] = e.time.split(":");
|
|
76
|
+
return `${p(m)} ${l} ${p(I)}${u}`;
|
|
77
|
+
}
|
|
78
|
+
const [i = "", o = ""] = c ?? [];
|
|
79
|
+
return `${i} ${l} ${o}${u}`;
|
|
80
|
+
}
|
|
81
|
+
if (T())
|
|
82
|
+
return `${R(b(n), l)}${u}`;
|
|
83
|
+
if (U()) {
|
|
84
|
+
const i = n.split(",");
|
|
85
|
+
return `${i.length > 1 ? R(i, l) : n}${u}`;
|
|
86
|
+
}
|
|
87
|
+
return `${n}${u}`;
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
R as bracketJoin,
|
|
91
|
+
h as capitalizeFirstLetter,
|
|
92
|
+
S as getDurationSuffix,
|
|
93
|
+
w as getSuitableValue,
|
|
94
|
+
C as getUserContextValue,
|
|
95
|
+
v as getUserEventLabel,
|
|
96
|
+
b as parseMultiSelectValue
|
|
97
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { STRATEGY_PAGES as a } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
const o = (t) => {
|
|
3
|
+
window.location.assign(t);
|
|
4
|
+
}, e = (t) => a.EDIT.replace("{{id}}", String(t));
|
|
5
|
+
export {
|
|
6
|
+
e as buildStrategyEditPath,
|
|
7
|
+
o as navigateToStrategyPage
|
|
8
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { TimeAbbreviations as g, Operators as y, OperatorNames as c, OperatorAbbreviations as I, DataTypes as O, MultiSelectDataTypes as E } from "../../../../enums/extensions/filteringV2.js";
|
|
2
|
+
import { capitalizeFirstLetter as d, bracketJoin as T, parseMultiSelectValue as v } from "./strategyHumanizer.js";
|
|
3
|
+
import { formatShortDate as f } from "../../../../utils/dateUtil.js";
|
|
4
|
+
import { parseJsonField as b } from "../../../../utils/genericUtil.js";
|
|
5
|
+
const S = "CHEF", _ = "MIXED", M = [S, _], N = 2, h = 4, A = (e) => `recommendation-algorithm-names.${(e || "").replaceAll("_", "-").toLowerCase()}`, x = (e) => ({
|
|
6
|
+
[S]: "discovery-strategy.chef",
|
|
7
|
+
[_]: "discovery-strategy.mixed-algorithm"
|
|
8
|
+
})[e] ?? "discovery-strategy.single-algorithm", L = (e, t) => {
|
|
9
|
+
if (!M.includes(e.algorithm))
|
|
10
|
+
return t(A(e.algorithm));
|
|
11
|
+
const o = t(x(e.algorithm)), i = (e.algorithm_used || "").split(",").map((r) => r.trim()).filter(Boolean).map((r) => t(A(r))), n = [...new Set(i)];
|
|
12
|
+
if (n.length > 1) {
|
|
13
|
+
const r = t("strategy-info-box-content.and-more", { count: n.length - 1 });
|
|
14
|
+
return `${o} - ${n[0]} ${r}`;
|
|
15
|
+
}
|
|
16
|
+
return `${o} - ${n.join(", ")}`;
|
|
17
|
+
}, C = (e, t) => {
|
|
18
|
+
const o = [
|
|
19
|
+
e.exclude_view && "viewed",
|
|
20
|
+
e.exclude_purchase && "purchased",
|
|
21
|
+
e.exclude_cart && "cart"
|
|
22
|
+
].filter(Boolean);
|
|
23
|
+
return o.length ? o.map((n, r) => {
|
|
24
|
+
if (r === 0)
|
|
25
|
+
return t(`recommendation-strategy.recently_${n}`) + (o.length > 2 ? "," : "");
|
|
26
|
+
const s = t(`recommendation-strategy.${n}`);
|
|
27
|
+
return r === o.length - 1 ? `${t("ds-condition.and")} ${s}` : s;
|
|
28
|
+
}).join(" ") : t("recommendation-strategy.none");
|
|
29
|
+
}, D = (e, t) => {
|
|
30
|
+
var n;
|
|
31
|
+
const i = (y[((n = e.attribute) == null ? void 0 : n.attributeType) ?? ""] || []).find((r) => r.value === e.selectedOperator);
|
|
32
|
+
return i ? t(i.text) : "";
|
|
33
|
+
}, w = ({ attribute: e }) => (e == null ? void 0 : e.attributeType) === O.DATE, R = (e) => {
|
|
34
|
+
var r;
|
|
35
|
+
const t = ((r = e.attribute) == null ? void 0 : r.attributeType) ?? "", o = e.selectedOperator ?? "";
|
|
36
|
+
if (!E.includes(t) || [c.CONTAINS, c.NOT_CONTAINS].includes(o))
|
|
37
|
+
return !1;
|
|
38
|
+
const i = [c.IS_EXACTLY, c.IS_NOT_EXACTLY].includes(o);
|
|
39
|
+
return !((e.isHierarchyCategory || t === O.STRING) && i);
|
|
40
|
+
}, j = (e, t, o) => {
|
|
41
|
+
const i = e.value ?? "", n = t("action-builder.and"), { IN_LAST: r, IN_BETWEEN: s } = I.OPERATOR;
|
|
42
|
+
if (e.time && e.selectedOperator !== s)
|
|
43
|
+
return f(e.time);
|
|
44
|
+
if (e.selectedOperator === r) {
|
|
45
|
+
const [a] = i.match(/\d+/g) || [], l = o[e.timeUnit ?? ""];
|
|
46
|
+
return a && l ? `${a} ${l}` : i;
|
|
47
|
+
}
|
|
48
|
+
if (e.selectedOperator === s) {
|
|
49
|
+
if (w(e)) {
|
|
50
|
+
const [m = "", u = ""] = (e.time ?? "").split(":");
|
|
51
|
+
return `${f(m)} ${n} ${f(u)}`;
|
|
52
|
+
}
|
|
53
|
+
const [a = "", l = ""] = e.inBetweenValues ?? [];
|
|
54
|
+
return `${a} ${n} ${l}`;
|
|
55
|
+
}
|
|
56
|
+
if (R(e))
|
|
57
|
+
return T(v(i), n);
|
|
58
|
+
if ([c.IN, c.NOT_IN].includes(e.selectedOperator)) {
|
|
59
|
+
const a = i.split(",");
|
|
60
|
+
return a.length > 1 ? T(a, n) : i;
|
|
61
|
+
}
|
|
62
|
+
return i;
|
|
63
|
+
}, F = (e, t) => {
|
|
64
|
+
var $;
|
|
65
|
+
const o = b(e.filters, {}), n = Object.values(o).slice(0, N).flatMap((p) => (p == null ? void 0 : p.conditionList) ?? []), [r] = n;
|
|
66
|
+
if (!r)
|
|
67
|
+
return t("recommendation-strategy.none");
|
|
68
|
+
const s = {
|
|
69
|
+
[g.WEEK]: d(t("journey-builder.weeks")),
|
|
70
|
+
[g.DAY]: d(t("settings.day-s")),
|
|
71
|
+
[g.HOUR]: d(t("settings.hour-s"))
|
|
72
|
+
}, a = d((($ = r.attribute) == null ? void 0 : $.text) ?? ""), l = D(r, t), m = j(r, t, s), u = `${a} ${t("input.value")} ${l} ${m}`;
|
|
73
|
+
return n.length > 1 ? `${u} ${t("strategy-info-box-content.and-more", { count: n.length - 1 })}` : u;
|
|
74
|
+
}, H = (e, t) => {
|
|
75
|
+
const o = b(e.manual_merchandising_products, []), i = b(e.mixed_strategies, []), n = (Array.isArray(i) ? i : []).map((s) => s == null ? void 0 : s.productId).filter(Boolean), r = [.../* @__PURE__ */ new Set([...Array.isArray(o) ? o : [], ...n])];
|
|
76
|
+
if (!r.length)
|
|
77
|
+
return t("recommendation-strategy.none");
|
|
78
|
+
if (r.length > h) {
|
|
79
|
+
const s = t("strategy-info-box-content.and-more", {
|
|
80
|
+
count: r.length - h
|
|
81
|
+
});
|
|
82
|
+
return `${r.slice(0, h).join(", ")} ${s}`;
|
|
83
|
+
}
|
|
84
|
+
return r.join(", ");
|
|
85
|
+
}, V = (e, t) => [
|
|
86
|
+
{ title: t("gpt-app-builder.algorithms-and-method"), value: L(e, t) },
|
|
87
|
+
{ title: t("gpt-app-builder.exclusions"), value: C(e, t) },
|
|
88
|
+
{ title: t("gpt-app-builder.filters"), value: F(e, t) },
|
|
89
|
+
{ title: t("gpt-app-builder.manual-merchandising"), value: H(e, t) }
|
|
90
|
+
];
|
|
91
|
+
export {
|
|
92
|
+
V as buildStrategySummary,
|
|
93
|
+
A as getAlgorithmTranslationKey,
|
|
94
|
+
x as getMethodTranslationKey
|
|
95
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useConfigStore as I } from "../../../../stores/config.js";
|
|
2
|
+
const l = {
|
|
3
|
+
LOCALE: ["{locale}", "{language}"],
|
|
4
|
+
CURRENCY: ["{currency}"],
|
|
5
|
+
CAMPAIGN_ID: ["{campaignId}"],
|
|
6
|
+
STRATEGY_ID: ["{strategyId}"],
|
|
7
|
+
CLIENT_ID: ["{clientId}"],
|
|
8
|
+
PARTNER_NAME: ["{partnerName}", "{partnerId}"],
|
|
9
|
+
SIZE: ["{size}"]
|
|
10
|
+
}, d = {
|
|
11
|
+
// Both spellings are in use: the legacy email templates say `{user_id}`,
|
|
12
|
+
// the web runtime's say `{userId}`.
|
|
13
|
+
USER_ID: ["{userId}", "{user_id}"]
|
|
14
|
+
}, E = (e, r, s) => r.reduce((t, n) => t.replaceAll(n, s), e), u = (e) => {
|
|
15
|
+
const r = e.indexOf("?");
|
|
16
|
+
if (r === -1)
|
|
17
|
+
return e;
|
|
18
|
+
const s = e.slice(0, r), t = e.slice(r + 1), n = t.indexOf("#"), i = n === -1 ? t : t.slice(0, n), c = n === -1 ? "" : t.slice(n), a = i.split("&").filter((o) => !/\{[^}]*\}/.test(o.slice(o.indexOf("=") + 1)));
|
|
19
|
+
return a.length ? `${s}?${a.join("&")}${c}` : `${s}${c}`;
|
|
20
|
+
}, A = (e) => {
|
|
21
|
+
const r = I();
|
|
22
|
+
return {
|
|
23
|
+
LOCALE: e.language,
|
|
24
|
+
CURRENCY: e.currencyCode,
|
|
25
|
+
CAMPAIGN_ID: r.variationId,
|
|
26
|
+
STRATEGY_ID: e.strategyId,
|
|
27
|
+
CLIENT_ID: "6KcLM9TwheVB1mgK",
|
|
28
|
+
PARTNER_NAME: r.partnerName,
|
|
29
|
+
SIZE: e.size
|
|
30
|
+
};
|
|
31
|
+
}, C = (e, r, s) => {
|
|
32
|
+
if (!e)
|
|
33
|
+
return "";
|
|
34
|
+
const t = Object.entries(l).reduce(
|
|
35
|
+
(n, [i, c]) => E(n, c, r[i]),
|
|
36
|
+
e
|
|
37
|
+
);
|
|
38
|
+
return s === "preview" ? u(t) : E(t, d.USER_ID, "{user_id}");
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
A as buildStrategyUrlValues,
|
|
42
|
+
C as resolveStrategyUrl
|
|
43
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = [
|
|
2
2
|
{
|
|
3
3
|
key: "locale",
|
|
4
4
|
getValue: (e) => e.language,
|
|
@@ -9,25 +9,39 @@ const l = [
|
|
|
9
9
|
getValue: (e) => e.currencySettings.value,
|
|
10
10
|
getAvailableOptions: (e) => e.currencyList.map((n) => n.text),
|
|
11
11
|
canBeEmpty: !0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
// Only a *deleted* strategy blocks the save (SD-145578 AC-4). An empty
|
|
15
|
+
// strategyId is legitimate: blocks saved before RRS keep running on their
|
|
16
|
+
// algorithm URL, and with the flag on by default those templates must stay
|
|
17
|
+
// saveable.
|
|
18
|
+
//
|
|
19
|
+
// `canValidateStrategy` gates the whole check — mid-fetch the listing is
|
|
20
|
+
// empty and every assigned id would look deleted.
|
|
21
|
+
key: "strategy",
|
|
22
|
+
optional: !0,
|
|
23
|
+
getValue: (e) => e.strategyId,
|
|
24
|
+
getAvailableOptions: (e) => e.strategyIds,
|
|
25
|
+
condition: (e, n) => n.isRrsEnabled && n.canValidateStrategy
|
|
12
26
|
}
|
|
13
27
|
], o = "newsletter.recommendation-fill-required-fields";
|
|
14
|
-
function c(e, n,
|
|
15
|
-
return
|
|
16
|
-
var
|
|
17
|
-
if (t.condition && !t.condition(e))
|
|
28
|
+
function c(e, n, l = u) {
|
|
29
|
+
return l.filter((t) => {
|
|
30
|
+
var i;
|
|
31
|
+
if (t.condition && !t.condition(e, n))
|
|
18
32
|
return !1;
|
|
19
|
-
const
|
|
20
|
-
if (t.canBeEmpty && (
|
|
33
|
+
const a = (i = t.getAvailableOptions) == null ? void 0 : i.call(t, n);
|
|
34
|
+
if (t.canBeEmpty && (a == null ? void 0 : a.length) === 0)
|
|
21
35
|
return !1;
|
|
22
|
-
const
|
|
23
|
-
return
|
|
36
|
+
const r = t.getValue(e);
|
|
37
|
+
return r ? a !== void 0 && !a.includes(r) : !t.optional;
|
|
24
38
|
}).map((t) => t.key);
|
|
25
39
|
}
|
|
26
40
|
function s(e, n) {
|
|
27
41
|
return c(e, n).length === 0;
|
|
28
42
|
}
|
|
29
43
|
export {
|
|
30
|
-
|
|
44
|
+
u as REQUIRED_RECOMMENDATION_FIELDS,
|
|
31
45
|
o as RecommendationRequiredFieldsKey,
|
|
32
46
|
c as getInvalidFields,
|
|
33
47
|
s as isConfigValid
|
|
@@ -5,9 +5,10 @@ const s = {
|
|
|
5
5
|
PAGE_TYPE: "data-unsubscribe-page-type",
|
|
6
6
|
PAGE_LIST: "data-unsubscribe-page-list",
|
|
7
7
|
BLOCK_ID: "data-unsubscribe-block-id"
|
|
8
|
-
}, c = ".unsubscribe-block-v2";
|
|
8
|
+
}, c = ".unsubscribe-block-v2", u = 'a[data-unsubscribe-link="true"], a.unsubscribe-link';
|
|
9
9
|
export {
|
|
10
10
|
b as DATA_ATTRIBUTES,
|
|
11
11
|
c as UNSUBSCRIBE_BLOCK_SELECTOR,
|
|
12
|
-
s as UNSUBSCRIBE_EVENTS
|
|
12
|
+
s as UNSUBSCRIBE_EVENTS,
|
|
13
|
+
u as UNSUBSCRIBE_LINK_SELECTOR
|
|
13
14
|
};
|
|
@@ -47,15 +47,15 @@ class d extends I {
|
|
|
47
47
|
const t = this.getBlockInstanceId();
|
|
48
48
|
if (!t)
|
|
49
49
|
return !1;
|
|
50
|
-
const
|
|
51
|
-
return e(),
|
|
50
|
+
const E = t !== this.lastBlockInstanceId;
|
|
51
|
+
return e(), E && (this.lastBlockInstanceId = t), E;
|
|
52
52
|
}
|
|
53
|
-
_GuLabel({ text: e, name: t = "", hint:
|
|
53
|
+
_GuLabel({ text: e, name: t = "", hint: E }) {
|
|
54
54
|
return `
|
|
55
55
|
<${n.LABEL}
|
|
56
56
|
${$.LABEL.text}="${e}"
|
|
57
57
|
${$.LABEL.name}="${t || `${e} Label`}"
|
|
58
|
-
${
|
|
58
|
+
${E ? `${$.LABEL.hint}="${E}"` : ""}>
|
|
59
59
|
</${n.LABEL}>
|
|
60
60
|
`;
|
|
61
61
|
}
|
|
@@ -73,7 +73,7 @@ class d extends I {
|
|
|
73
73
|
* Use in getTemplate() — the icon is registered in a hidden store so Stripo initializes it.
|
|
74
74
|
* Pair with _setInfoMessageValue() in onRender() to set the text content.
|
|
75
75
|
*/
|
|
76
|
-
_GuOnPageMessage({ name: e, icon: t = "not-found", type:
|
|
76
|
+
_GuOnPageMessage({ name: e, icon: t = "not-found", type: E = "info" }) {
|
|
77
77
|
return `
|
|
78
78
|
<div data-info-message="${e}" style="display: none; padding: 16px 16px 0;">
|
|
79
79
|
<div class="icon-store" style="display: none;">
|
|
@@ -81,7 +81,7 @@ class d extends I {
|
|
|
81
81
|
${this._GuIcon({ src: t, className: "icon" })}
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
|
-
${this._GuMessage({ name: e, type:
|
|
84
|
+
${this._GuMessage({ name: e, type: E })}
|
|
85
85
|
</div>
|
|
86
86
|
`;
|
|
87
87
|
}
|
|
@@ -91,7 +91,7 @@ class d extends I {
|
|
|
91
91
|
* and combines it with the text in Stripo's alert-message layout.
|
|
92
92
|
*/
|
|
93
93
|
_setInfoMessageValue(e, t) {
|
|
94
|
-
const
|
|
94
|
+
const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`), a = o == null ? void 0 : o.querySelector("ue-icon-component"), l = (a == null ? void 0 : a.outerHTML) ?? "";
|
|
95
95
|
this.api.setUIEAttribute(
|
|
96
96
|
e,
|
|
97
97
|
"value",
|
|
@@ -104,7 +104,7 @@ class d extends I {
|
|
|
104
104
|
</div>
|
|
105
105
|
`
|
|
106
106
|
);
|
|
107
|
-
const T =
|
|
107
|
+
const T = E.querySelector(`[data-info-message="${e}"]`);
|
|
108
108
|
T && (T.style.display = "");
|
|
109
109
|
}
|
|
110
110
|
_GuToggle(e) {
|
|
@@ -121,59 +121,60 @@ class d extends I {
|
|
|
121
121
|
${$.SELECT_ITEM.value}="${t}">
|
|
122
122
|
</${n.SELECT_ITEM}>`;
|
|
123
123
|
}
|
|
124
|
-
_GuSelect({ name: e, placeholder: t, options:
|
|
124
|
+
_GuSelect({ name: e, placeholder: t, options: E, className: o = "es-180w", searchable: a = !1 }) {
|
|
125
125
|
return `
|
|
126
126
|
<${n.SELECTPICKER}
|
|
127
|
-
class="${
|
|
127
|
+
class="${o}"
|
|
128
128
|
${$.SELECTPICKER.name}="${e}"
|
|
129
|
+
${a ? `${$.SELECTPICKER.searchable}="true"` : ""}
|
|
129
130
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
130
|
-
${
|
|
131
|
+
${E.map((l) => this._GuSelectItem(l)).join("")}
|
|
131
132
|
</${n.SELECTPICKER}>
|
|
132
133
|
`;
|
|
133
134
|
}
|
|
134
|
-
_GuTextInput({ name: e, placeholder: t, className:
|
|
135
|
+
_GuTextInput({ name: e, placeholder: t, className: E = "", disabled: o = !1 }) {
|
|
135
136
|
return `
|
|
136
137
|
<${n.TEXT}
|
|
137
|
-
class=${
|
|
138
|
+
class=${E}
|
|
138
139
|
${$.TEXT.name}="${e}"
|
|
139
140
|
placeholder="${t || e}"
|
|
140
|
-
${
|
|
141
|
+
${o ? `${$.TEXT.disabled}="true"` : ""}>
|
|
141
142
|
</${n.TEXT}>
|
|
142
143
|
`;
|
|
143
144
|
}
|
|
144
|
-
_GuCounter({ name: e, maxValue: t, minValue:
|
|
145
|
+
_GuCounter({ name: e, maxValue: t, minValue: E = 1, step: o = 1 }) {
|
|
145
146
|
return `
|
|
146
147
|
<${n.COUNTER}
|
|
147
148
|
${$.COUNTER.name}="${e}"
|
|
148
|
-
${$.COUNTER.minValue}="${
|
|
149
|
+
${$.COUNTER.minValue}="${E}"
|
|
149
150
|
${$.COUNTER.maxValue}="${t}"
|
|
150
|
-
${$.COUNTER.step}="${
|
|
151
|
+
${$.COUNTER.step}="${o}">
|
|
151
152
|
</${n.COUNTER}>
|
|
152
153
|
`;
|
|
153
154
|
}
|
|
154
|
-
_GuRadioButtonItem({ text: e, value: t, icon:
|
|
155
|
+
_GuRadioButtonItem({ text: e, value: t, icon: E }) {
|
|
155
156
|
return `
|
|
156
157
|
<${n.RADIO_ITEM}
|
|
157
158
|
${$.RADIO_ITEM.value}="${t}"
|
|
158
159
|
${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
|
|
159
|
-
${
|
|
160
|
+
${E ? `${$.RADIO_ITEM.icon}="${E}"` : ""}>
|
|
160
161
|
</${n.RADIO_ITEM}>
|
|
161
162
|
`;
|
|
162
163
|
}
|
|
163
|
-
_GuRadioButton({ name: e, buttons: t, id:
|
|
164
|
+
_GuRadioButton({ name: e, buttons: t, id: E = "" }) {
|
|
164
165
|
return `
|
|
165
166
|
<${n.RADIO_BUTTONS}
|
|
166
|
-
${
|
|
167
|
+
${E ? `id="${E}"` : ""}
|
|
167
168
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
168
|
-
${t.map((
|
|
169
|
+
${t.map((o) => this._GuRadioButtonItem(o)).join("")}
|
|
169
170
|
</${n.RADIO_BUTTONS}>
|
|
170
171
|
`;
|
|
171
172
|
}
|
|
172
|
-
_GuButton({ name: e, label: t, id:
|
|
173
|
+
_GuButton({ name: e, label: t, id: E = "" }) {
|
|
173
174
|
return `
|
|
174
175
|
<${n.BUTTON}
|
|
175
176
|
${$.BUTTON.name}="${e}"
|
|
176
|
-
${
|
|
177
|
+
${E ? `id="${E}"` : ""}
|
|
177
178
|
${$.BUTTON.caption}="${t}"}>
|
|
178
179
|
</${n.BUTTON}>
|
|
179
180
|
`;
|
|
@@ -191,10 +192,11 @@ class d extends I {
|
|
|
191
192
|
* @param param0
|
|
192
193
|
* @returns It returns a button with an icon.
|
|
193
194
|
*/
|
|
194
|
-
_GuIconButton({ name: e, icon: t, className: o = "" }) {
|
|
195
|
+
_GuIconButton({ name: e, icon: t, className: E = "", id: o = "" }) {
|
|
195
196
|
return `
|
|
196
197
|
<${n.BUTTON}
|
|
197
|
-
class="${
|
|
198
|
+
class="${E}"
|
|
199
|
+
${o ? `id="${o}"` : ""}
|
|
198
200
|
${$.BUTTON.name}="${e}"
|
|
199
201
|
${$.BUTTON.icon}="${t}">
|
|
200
202
|
</${n.BUTTON}>
|
|
@@ -222,19 +224,19 @@ class d extends I {
|
|
|
222
224
|
* @returns HTML string for the orderable control
|
|
223
225
|
*/
|
|
224
226
|
_GuOrderable(e, t) {
|
|
225
|
-
let
|
|
227
|
+
let E = "";
|
|
226
228
|
t.forEach((a) => {
|
|
227
229
|
const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
228
|
-
|
|
230
|
+
E += `
|
|
229
231
|
<${n.ORDERABLE_ITEM} ${l}="${a.key}">
|
|
230
232
|
${a.content}
|
|
231
233
|
</${n.ORDERABLE_ITEM}>
|
|
232
234
|
`;
|
|
233
235
|
});
|
|
234
|
-
const
|
|
236
|
+
const o = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
|
|
235
237
|
return `
|
|
236
|
-
<${n.ORDERABLE} ${
|
|
237
|
-
${
|
|
238
|
+
<${n.ORDERABLE} ${o}="${e}">
|
|
239
|
+
${E}
|
|
238
240
|
</${n.ORDERABLE}>
|
|
239
241
|
`;
|
|
240
242
|
}
|
|
@@ -275,16 +277,16 @@ class d extends I {
|
|
|
275
277
|
`;
|
|
276
278
|
}
|
|
277
279
|
_GuRadioButtons(e, t) {
|
|
278
|
-
const
|
|
280
|
+
const E = t.map((o) => `
|
|
279
281
|
<${n.RADIO_ITEM}
|
|
280
|
-
${$.RADIO_ITEM.text}="${
|
|
281
|
-
${$.RADIO_ITEM.value}="${
|
|
282
|
+
${$.RADIO_ITEM.text}="${o.text}"
|
|
283
|
+
${$.RADIO_ITEM.value}="${o.value}">
|
|
282
284
|
</${n.RADIO_ITEM}>
|
|
283
285
|
`).join("");
|
|
284
286
|
return `
|
|
285
287
|
<${n.RADIO_BUTTONS}
|
|
286
288
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
287
|
-
${
|
|
289
|
+
${E}
|
|
288
290
|
</${n.RADIO_BUTTONS}>
|
|
289
291
|
`;
|
|
290
292
|
}
|