@useinsider/guido 3.18.1-beta.e9a6c91 → 3.18.1-beta.fefef3c
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 +21 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +72 -70
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -9
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +83 -72
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -26
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/composables/useCustomInterfaceAppearance.js +46 -42
- package/dist/composables/useHtmlValidator.js +79 -84
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useRecommendation.js +18 -21
- package/dist/enums/extensions/recommendationBlock.js +25 -29
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -71
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +70 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +108 -138
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +72 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +93 -84
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +54 -50
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +44 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/onboarding.d.ts +421 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +74 -43
- package/dist/stores/config.js +74 -60
- package/dist/stores/onboarding.js +6 -1
- package/dist/utils/templatePreparation.js +50 -50
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useConfig as V } from "./useConfig.js";
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as W } from "../enums/defaults.js";
|
|
4
|
-
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as
|
|
4
|
+
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DATA_ATTRIBUTE_REGEX as $, DYNAMIC_CONTENT_TAG_REGEX as K, ALLOWED_DYNAMIC_SYSTEM_TOKENS as Y, VALID_DYNAMIC_VARIABLE_REGEX as U } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
6
|
import { BLOCK_ROOT_SELECTOR as j } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
7
|
import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
@@ -9,58 +9,58 @@ import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/RadioButton/const
|
|
|
9
9
|
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
10
10
|
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
11
|
import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
12
|
-
import {
|
|
13
|
-
import { useRecommendationStore as
|
|
14
|
-
import { base64EncodeWithSpecialChars as
|
|
15
|
-
import { computed as
|
|
16
|
-
import { useHttp as
|
|
17
|
-
import { useToaster as
|
|
18
|
-
import { useTranslations as
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
return [...s.matchAll(
|
|
12
|
+
import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
+
import { useRecommendationStore as te } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
|
|
15
|
+
import { computed as se } from "vue";
|
|
16
|
+
import { useHttp as re } from "./useHttp.js";
|
|
17
|
+
import { useToaster as oe } from "./useToaster.js";
|
|
18
|
+
import { useTranslations as ie } from "./useTranslations.js";
|
|
19
|
+
const ae = /recommendation-id="(\d+)"/g;
|
|
20
|
+
function ce(s) {
|
|
21
|
+
return [...s.matchAll(ae)].map((l) => l[1]);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function me(s, l) {
|
|
24
|
+
return l.some((f) => s.startsWith(`${f}_`));
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
return
|
|
26
|
+
const le = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function ue(s) {
|
|
28
|
+
const l = s.match(le);
|
|
29
|
+
return l ? { recoId: l[1], attribute: l[2] } : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
31
|
+
function de(s) {
|
|
32
|
+
const l = new Set(Z);
|
|
33
33
|
return Object.values(s).forEach((f) => {
|
|
34
|
-
|
|
35
|
-
}),
|
|
34
|
+
l.add(Q(f).toLowerCase());
|
|
35
|
+
}), l;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function fe(s, l, f, o, d) {
|
|
38
38
|
const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
39
39
|
if (!u)
|
|
40
40
|
return [];
|
|
41
|
-
const
|
|
41
|
+
const g = new Set(l.map((C) => C.toLowerCase())), E = [];
|
|
42
42
|
return u.forEach((C) => {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
43
|
+
const p = C.slice(2, -2).trim().toLowerCase();
|
|
44
|
+
if (p !== "" && g.has(p))
|
|
45
45
|
return;
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
if (!d || d.has(
|
|
46
|
+
const h = ue(p);
|
|
47
|
+
if (h && o.has(h.recoId)) {
|
|
48
|
+
if (!d || d.has(h.attribute))
|
|
49
49
|
return;
|
|
50
|
-
E.push(
|
|
50
|
+
E.push(p);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
me(p, f) || p.includes(".") || E.push(p);
|
|
54
54
|
}), E;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return (s.replace(
|
|
58
|
-
const d = o.slice(2, -2), u = d.indexOf("|"),
|
|
59
|
-
return
|
|
56
|
+
function pe(s) {
|
|
57
|
+
return (s.replace($, "$1").match(K) ?? []).filter((o) => {
|
|
58
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
|
|
59
|
+
return Y.includes(g) ? !1 : U.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
const { showToaster: s } =
|
|
62
|
+
const De = () => {
|
|
63
|
+
const { showToaster: s } = oe(), { post: l } = re(), { config: f } = V(), o = ie(), d = te(), u = J(), g = se(
|
|
64
64
|
() => {
|
|
65
65
|
var e, t;
|
|
66
66
|
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
@@ -73,27 +73,27 @@ const ke = () => {
|
|
|
73
73
|
} catch {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
return
|
|
76
|
+
return de(u.filterList);
|
|
77
77
|
}, C = async (e) => {
|
|
78
|
-
const n = await
|
|
78
|
+
const n = await l(
|
|
79
79
|
"/newsletter/template-library/check-template-html-body",
|
|
80
|
-
{ html:
|
|
80
|
+
{ html: ne(e) }
|
|
81
81
|
), { status: r, message: a } = n.data;
|
|
82
82
|
return r || s({
|
|
83
83
|
type: c.Error,
|
|
84
84
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
85
|
-
}), o(
|
|
85
|
+
}), o(P), a === o(X) && s({
|
|
86
86
|
type: c.Error,
|
|
87
87
|
message: o("newsletter.already-in-progress")
|
|
88
88
|
}), r;
|
|
89
|
-
},
|
|
89
|
+
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, t) => {
|
|
90
90
|
const n = e.match(/({%(.*?)%})/g);
|
|
91
91
|
let r = !0;
|
|
92
|
-
return n !== null && !
|
|
92
|
+
return n !== null && !g.value && n.forEach((a) => {
|
|
93
93
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
94
94
|
if (i && i.length > 0) {
|
|
95
|
-
const [
|
|
96
|
-
|
|
95
|
+
const [m] = i;
|
|
96
|
+
p(m) && !t.includes(m) && (s({
|
|
97
97
|
type: c.Warning,
|
|
98
98
|
message: o("custom-fields.invalid-custom-fields")
|
|
99
99
|
}), r = !1);
|
|
@@ -101,11 +101,11 @@ const ke = () => {
|
|
|
101
101
|
}), r;
|
|
102
102
|
}, R = async (e, t, n) => {
|
|
103
103
|
const r = n ? await C(e) : !0;
|
|
104
|
-
return
|
|
105
|
-
},
|
|
104
|
+
return T(e, t) && r;
|
|
105
|
+
}, b = (e) => e.length > 0 ? !0 : (s({
|
|
106
106
|
type: c.Warning,
|
|
107
107
|
message: o("newsletter.html-content-is-empty")
|
|
108
|
-
}), !1),
|
|
108
|
+
}), !1), A = (e) => {
|
|
109
109
|
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
110
110
|
return t > n && s({
|
|
111
111
|
type: c.Warning,
|
|
@@ -114,26 +114,26 @@ const ke = () => {
|
|
|
114
114
|
type: c.Warning,
|
|
115
115
|
message: o("custom-fields.missing-opening-braces")
|
|
116
116
|
}), t === n;
|
|
117
|
-
},
|
|
118
|
-
const t =
|
|
117
|
+
}, _ = (e) => {
|
|
118
|
+
const t = pe(e).length === 0;
|
|
119
119
|
return t || s({
|
|
120
120
|
type: c.Warning,
|
|
121
121
|
message: o("custom-fields.invalid-custom-fields")
|
|
122
122
|
}), t;
|
|
123
123
|
}, O = (e, t, n, r) => {
|
|
124
|
-
if (
|
|
124
|
+
if (g.value)
|
|
125
125
|
return !0;
|
|
126
|
-
const a =
|
|
126
|
+
const a = fe(
|
|
127
127
|
e,
|
|
128
128
|
t,
|
|
129
|
-
|
|
129
|
+
ce(e),
|
|
130
130
|
n,
|
|
131
131
|
r
|
|
132
132
|
);
|
|
133
133
|
if (a.length > 0) {
|
|
134
134
|
const i = `
|
|
135
135
|
<ul>
|
|
136
|
-
${a.map((
|
|
136
|
+
${a.map((m) => `<li>${m}</li>`).join("")}
|
|
137
137
|
</ul>
|
|
138
138
|
`;
|
|
139
139
|
return s({
|
|
@@ -146,22 +146,22 @@ const ke = () => {
|
|
|
146
146
|
const t = e.match(/{%(.*?)%}/g), n = [];
|
|
147
147
|
let r = !0;
|
|
148
148
|
if (t && t.forEach((a) => {
|
|
149
|
-
const i = a.match(G),
|
|
150
|
-
(!i || a !== v) && !
|
|
149
|
+
const i = a.match(G), m = a.match(H), v = (i == null ? void 0 : i.join("")) || "";
|
|
150
|
+
(!i || a !== v) && !m && (s({
|
|
151
151
|
type: c.Error,
|
|
152
152
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
153
|
-
}), r = !1), i && i.forEach((
|
|
154
|
-
|
|
153
|
+
}), r = !1), i && i.forEach((y) => {
|
|
154
|
+
y.trim() === "=" && (s({
|
|
155
155
|
type: c.Error,
|
|
156
156
|
message: o("custom-conditions.wrong-equality-operators")
|
|
157
157
|
}), r = !1);
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const I = y.match(/^[a-zA-Z]*$/g);
|
|
159
|
+
I && I.forEach((S) => {
|
|
160
|
+
h(S) && n.push(S);
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
163
|
}), n.length) {
|
|
164
|
-
const a = n.filter((
|
|
164
|
+
const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
|
|
165
165
|
a.length !== i.length && (s({
|
|
166
166
|
type: c.Error,
|
|
167
167
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
@@ -177,28 +177,23 @@ const ke = () => {
|
|
|
177
177
|
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
178
178
|
type: c.Warning,
|
|
179
179
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
180
|
-
}), !1) : !0, B = () => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return s({
|
|
185
|
-
type: e ? c.Warning : c.Error,
|
|
186
|
-
message: o(e ? te : ne)
|
|
187
|
-
}), !1;
|
|
188
|
-
}, x = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
180
|
+
}), !1) : !0, B = () => u.hasInvalidBlock() ? (s({
|
|
181
|
+
type: c.Error,
|
|
182
|
+
message: o(ee)
|
|
183
|
+
}), !1) : !0, x = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
189
184
|
type: c.Error,
|
|
190
185
|
message: o("newsletter.fill-all-necessary-fields")
|
|
191
|
-
}), !1) : !0,
|
|
186
|
+
}), !1) : !0, D = (e) => {
|
|
192
187
|
const t = /src="[^"]*\.(svg|pst)"/gm;
|
|
193
188
|
return e.match(t) === null ? !0 : (s({
|
|
194
189
|
type: c.Error,
|
|
195
190
|
message: o("newsletter.invalid-image-type")
|
|
196
191
|
}), !1);
|
|
197
|
-
},
|
|
192
|
+
}, F = (e) => {
|
|
198
193
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(j);
|
|
199
194
|
return Array.from(r).find((i) => {
|
|
200
|
-
var
|
|
201
|
-
return !((
|
|
195
|
+
var m;
|
|
196
|
+
return !((m = i.id) != null && m.trim());
|
|
202
197
|
}) ? (s({
|
|
203
198
|
type: c.Error,
|
|
204
199
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
@@ -206,26 +201,26 @@ const ke = () => {
|
|
|
206
201
|
}, k = (e) => {
|
|
207
202
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
|
|
208
203
|
return Array.from(r).find((i) => {
|
|
209
|
-
var
|
|
210
|
-
return !((
|
|
204
|
+
var m;
|
|
205
|
+
return !((m = i.id) != null && m.trim());
|
|
211
206
|
}) ? (s({
|
|
212
207
|
type: c.Error,
|
|
213
208
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
214
209
|
}), !1) : !0;
|
|
215
210
|
};
|
|
216
211
|
return { validateHtml: async (e, t, n = !1) => {
|
|
217
|
-
var v,
|
|
212
|
+
var v, y;
|
|
218
213
|
const r = [
|
|
219
|
-
...t.map((
|
|
214
|
+
...t.map((I) => I.value),
|
|
220
215
|
...q,
|
|
221
|
-
...((
|
|
216
|
+
...((y = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : y.customFieldAttributes) ?? []
|
|
222
217
|
], a = M(e), i = await E(a);
|
|
223
|
-
return await R(e, r, n) &&
|
|
218
|
+
return await R(e, r, n) && b(e) && A(e) && _(e) && O(e, r, a, i) && w(e) && L(e) && N(e) && B() && x() && D(e) && F(e) && k(e);
|
|
224
219
|
} };
|
|
225
220
|
};
|
|
226
221
|
export {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
222
|
+
de as buildPartnerAttributeNameSet,
|
|
223
|
+
fe as findInvalidCustomFields,
|
|
224
|
+
ue as parseRecommendationVariable,
|
|
225
|
+
De as useHtmlValidator
|
|
231
226
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useRecommendation as f } from "./useRecommendation.js";
|
|
2
|
+
import { useToaster as S } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as I } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as C } from "../enums/toaster.js";
|
|
5
|
+
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
|
+
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
+
import { useRecommendationExtensionStore as v } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { resolveMigrationTarget as b, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { useConfigStore as h } from "../stores/config.js";
|
|
11
|
+
const V = () => {
|
|
12
|
+
const t = v(), o = h(), { buildCampaignUrl: s } = f(), { showToaster: m } = S(), g = I();
|
|
13
|
+
return { convertLegacyStrategy: async () => {
|
|
14
|
+
const e = t.currentRecommendationId;
|
|
15
|
+
if (e === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
|
|
16
|
+
return "";
|
|
17
|
+
const { strategy: d, productIds: l, filters: y } = t.recommendationConfigs, i = b({
|
|
18
|
+
campaignId: o.campaignId,
|
|
19
|
+
templateLibraryId: o.templateLibraryId
|
|
20
|
+
}), p = R({
|
|
21
|
+
blockId: e,
|
|
22
|
+
url: s(String(e)),
|
|
23
|
+
campaignId: o.campaignId,
|
|
24
|
+
variationId: o.variationId,
|
|
25
|
+
strategy: d,
|
|
26
|
+
productIds: l,
|
|
27
|
+
filters: y,
|
|
28
|
+
attributes: t.getFilterList,
|
|
29
|
+
target: i
|
|
30
|
+
});
|
|
31
|
+
let r;
|
|
32
|
+
try {
|
|
33
|
+
r = await t.convertLegacyStrategy(p, i);
|
|
34
|
+
} catch (n) {
|
|
35
|
+
return console.error("[useLegacyStrategyConversion] migration failed", n), m({
|
|
36
|
+
type: C.Error,
|
|
37
|
+
message: g("email-editor.legacy-strategy-update-failed")
|
|
38
|
+
}), "";
|
|
39
|
+
}
|
|
40
|
+
const c = t.currentRecommendationId === e;
|
|
41
|
+
if (c)
|
|
42
|
+
try {
|
|
43
|
+
await t.fetchRecommendationProducts();
|
|
44
|
+
} catch (n) {
|
|
45
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", n);
|
|
46
|
+
}
|
|
47
|
+
const a = t.blockStates[e];
|
|
48
|
+
if (!a)
|
|
49
|
+
return r;
|
|
50
|
+
const { size: u } = a.recommendationConfigs;
|
|
51
|
+
return T(
|
|
52
|
+
e,
|
|
53
|
+
{ strategyId: r, size: u, configVersion: L },
|
|
54
|
+
a.recommendationProducts,
|
|
55
|
+
"Converted legacy recommendation strategy"
|
|
56
|
+
), c && t.openLegacyStrategyUpdatedModal(), r;
|
|
57
|
+
} };
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
V as useLegacyStrategyConversion
|
|
61
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
3
|
+
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
5
|
import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
6
|
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
7
|
import { useConfigStore as P } from "../stores/config.js";
|
|
8
8
|
const B = () => ({
|
|
9
9
|
calculateCardWidth: ({
|
|
10
|
-
mobileLeftPadding:
|
|
10
|
+
mobileLeftPadding: i,
|
|
11
11
|
mobileRightPadding: c,
|
|
12
|
-
cardsInRow:
|
|
12
|
+
cardsInRow: s,
|
|
13
13
|
unresponsive: n
|
|
14
14
|
}) => {
|
|
15
|
-
const o = n ?
|
|
15
|
+
const o = n ? s : 1, e = i + c + (o - 1) * R;
|
|
16
16
|
return (C - e) / o;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const c =
|
|
18
|
+
getRecommendationCampaignData: (i) => {
|
|
19
|
+
const c = l(), s = Number(i), n = c.blockStates[s];
|
|
20
20
|
if (!n)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
@@ -44,17 +44,17 @@ const B = () => ({
|
|
|
44
44
|
discountAfterTextValue: ""
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
buildCampaignUrl: (
|
|
48
|
-
var
|
|
49
|
-
const
|
|
47
|
+
buildCampaignUrl: (i, c) => {
|
|
48
|
+
var m;
|
|
49
|
+
const s = l(), n = P(), o = Number(i);
|
|
50
50
|
let e;
|
|
51
51
|
if (c)
|
|
52
52
|
e = c;
|
|
53
53
|
else {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const a = s.blockStates[o];
|
|
55
|
+
if (!a)
|
|
56
56
|
return "";
|
|
57
|
-
const { recommendationConfigs: r } =
|
|
57
|
+
const { recommendationConfigs: r } = a;
|
|
58
58
|
e = {
|
|
59
59
|
strategy: r.strategy,
|
|
60
60
|
strategyId: r.strategyId,
|
|
@@ -67,20 +67,17 @@ const B = () => ({
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
|
|
70
|
-
return
|
|
70
|
+
return s.recommendationCampaignUrls[i] = {
|
|
71
71
|
strategyId: e.strategyId,
|
|
72
72
|
locale: e.language,
|
|
73
73
|
currency: e.currencyCode
|
|
74
74
|
}, "";
|
|
75
|
-
const
|
|
76
|
-
if (!d)
|
|
77
|
-
return delete i.recommendationCampaignUrls[a], "";
|
|
78
|
-
const t = new URLSearchParams();
|
|
75
|
+
const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
79
76
|
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}");
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
const p = decodeURIComponent(t.toString()),
|
|
83
|
-
return
|
|
77
|
+
const f = e.filters.filter((a) => a.isValid), d = b(f);
|
|
78
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(n.partnerName, e.strategy)).forEach(([a, r]) => t.set(a, r));
|
|
79
|
+
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${g}?${p}`;
|
|
80
|
+
return s.recommendationCampaignUrls[i] = u, u;
|
|
84
81
|
}
|
|
85
82
|
});
|
|
86
83
|
export {
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
const
|
|
1
|
+
import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
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
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
7
|
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
|
|
11
|
-
}, d = (e) => {
|
|
12
|
-
const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
|
|
13
|
-
return `${r}/${e}/edit`;
|
|
14
|
-
}, m = {
|
|
8
|
+
NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations"
|
|
9
|
+
}, c = "migrate-strategies", d = "template", m = {
|
|
15
10
|
CLIENT_ID: "clientId"
|
|
16
11
|
}, p = () => {
|
|
17
|
-
const e =
|
|
12
|
+
const e = r();
|
|
18
13
|
return [
|
|
19
14
|
{
|
|
20
15
|
id: 11,
|
|
@@ -84,7 +79,7 @@ const o = {
|
|
|
84
79
|
{ text: "dot(.)", value: "." },
|
|
85
80
|
{ text: "comma(,)", value: "," },
|
|
86
81
|
{ text: "space( )", value: " " }
|
|
87
|
-
],
|
|
82
|
+
], E = [
|
|
88
83
|
{ text: "0", value: "0" },
|
|
89
84
|
{ text: "1", value: "1" },
|
|
90
85
|
{ text: "2", value: "2" },
|
|
@@ -96,55 +91,56 @@ const o = {
|
|
|
96
91
|
{ text: "contains", value: "~" },
|
|
97
92
|
{ text: "does not contain", value: "!~" },
|
|
98
93
|
{ text: "any of", value: a }
|
|
99
|
-
],
|
|
94
|
+
], n = [
|
|
100
95
|
{ text: "is exactly", value: "=" },
|
|
101
96
|
{ text: "is not exactly", value: "!==" },
|
|
102
97
|
{ text: "contains", value: "~" },
|
|
103
98
|
{ text: "does not contain", value: "!~" },
|
|
104
99
|
{ text: "any of", value: a }
|
|
105
|
-
],
|
|
100
|
+
], o = [
|
|
106
101
|
{ text: "is equal to", value: "=" },
|
|
107
102
|
{ text: "is greater than", value: ">" },
|
|
108
103
|
{ text: "is less than", value: "<" }
|
|
109
|
-
],
|
|
104
|
+
], s = [
|
|
110
105
|
{ text: "is equal to", value: "=" },
|
|
111
106
|
{ text: "after", value: ">" },
|
|
112
107
|
{ text: "before", value: "<" }
|
|
113
|
-
],
|
|
108
|
+
], i = [
|
|
114
109
|
{ text: "true", value: "==" },
|
|
115
110
|
{ text: "false", value: "!=" }
|
|
116
|
-
],
|
|
111
|
+
], T = (e) => {
|
|
117
112
|
if (!e)
|
|
118
113
|
return t;
|
|
119
114
|
switch (e) {
|
|
120
115
|
case "Boolean":
|
|
121
|
-
return
|
|
116
|
+
return i;
|
|
122
117
|
case "Date":
|
|
123
|
-
return
|
|
118
|
+
return s;
|
|
124
119
|
case "Number":
|
|
125
|
-
return
|
|
120
|
+
return o;
|
|
126
121
|
case "String":
|
|
127
122
|
return t;
|
|
128
123
|
case "Strings":
|
|
129
|
-
return
|
|
124
|
+
return n;
|
|
130
125
|
default:
|
|
131
126
|
return t;
|
|
132
127
|
}
|
|
133
128
|
};
|
|
134
129
|
export {
|
|
130
|
+
c as MIGRATE_STRATEGIES_SEGMENT,
|
|
135
131
|
a as OP_ANY_OF,
|
|
136
132
|
v as PriceAttributes,
|
|
137
133
|
m as QUERY_PARAMS,
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
d as TEMPLATE_MIGRATION_SCOPE_SEGMENT,
|
|
135
|
+
l as URLS,
|
|
136
|
+
E as currencyDecimalCounts,
|
|
140
137
|
h as currencyLocationMaps,
|
|
141
138
|
x as currencyOperators,
|
|
142
|
-
|
|
139
|
+
T as getOperatorOptions,
|
|
143
140
|
p as getRecommendationFeedSourceMaps,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
t as operatorOptionsForStrings
|
|
149
|
-
d as strategyEditPath
|
|
141
|
+
n as operatorOptionsForArrayOfStrings,
|
|
142
|
+
i as operatorOptionsForBooleans,
|
|
143
|
+
s as operatorOptionsForDates,
|
|
144
|
+
o as operatorOptionsForNumbers,
|
|
145
|
+
t as operatorOptionsForStrings
|
|
150
146
|
};
|