@useinsider/guido 3.18.2-beta.ec25841 → 3.18.2-beta.ee6f685
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/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +52 -70
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +37 -23
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useCustomInterfaceAppearance.js +46 -56
- package/dist/composables/useHtmlValidator.js +79 -84
- package/dist/composables/useHttp.js +24 -22
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useStripo.js +30 -30
- package/dist/enums/extensions/recommendationBlock.js +31 -38
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +33 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +79 -176
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +17 -14
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -75
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/stores/onboarding.d.ts +0 -377
- package/dist/src/utils/genericUtil.d.ts +6 -0
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
- package/dist/stores/onboarding.js +36 -41
- package/dist/utils/genericUtil.js +63 -54
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/templatePreparation.js +60 -59
- package/package.json +5 -5
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
- package/dist/extensions/Blocks/Recommendation/utils/strategyDetach.js +0 -19
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyDetach.d.ts +0 -12
- package/dist/static/styles/components/skeleton.css.js +0 -23
|
@@ -1,77 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import T from "../static/styles/components/wide-panel.css.js";
|
|
1
|
+
import S from "../static/assets/icons/line-change.svg.js";
|
|
2
|
+
import i from "../static/assets/icons/line-delete.svg.js";
|
|
3
|
+
import n from "../static/assets/icons/line-plus.svg.js";
|
|
4
|
+
import p from "../static/styles/base.css.js";
|
|
5
|
+
import s from "../static/styles/components/alert-message.css.js";
|
|
6
|
+
import C from "../static/styles/components/amp-block.css.js";
|
|
7
|
+
import a from "../static/styles/components/base-input.css.js";
|
|
8
|
+
import f from "../static/styles/components/button-group.css.js";
|
|
9
|
+
import c from "../static/styles/components/button.css.js";
|
|
10
|
+
import u from "../static/styles/components/combobox.css.js";
|
|
11
|
+
import l from "../static/styles/components/counter.css.js";
|
|
12
|
+
import d from "../static/styles/components/dropdown-menu.css.js";
|
|
13
|
+
import h from "../static/styles/components/loader.css.js";
|
|
14
|
+
import g from "../static/styles/components/narrow-panel.css.js";
|
|
15
|
+
import I from "../static/styles/components/popup.css.js";
|
|
16
|
+
import w from "../static/styles/components/recommendation-strategy.css.js";
|
|
17
|
+
import y from "../static/styles/components/switcher.css.js";
|
|
18
|
+
import b from "../static/styles/components/tabs.css.js";
|
|
19
|
+
import B from "../static/styles/components/tools.css.js";
|
|
20
|
+
import $ from "../static/styles/components/version-history.css.js";
|
|
21
|
+
import P from "../static/styles/components/wide-panel.css.js";
|
|
23
22
|
import x from "../static/styles/variables.css.js";
|
|
24
|
-
function r(
|
|
25
|
-
return `--guido-icon-${
|
|
23
|
+
function r(t, o) {
|
|
24
|
+
return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
|
|
26
25
|
}
|
|
27
|
-
const
|
|
28
|
-
${r("line-change",
|
|
29
|
-
${r("line-delete",
|
|
30
|
-
${r("line-plus",
|
|
31
|
-
}`,
|
|
26
|
+
const A = `:host {
|
|
27
|
+
${r("line-change", S)}
|
|
28
|
+
${r("line-delete", i)}
|
|
29
|
+
${r("line-plus", n)}
|
|
30
|
+
}`, R = [
|
|
32
31
|
x,
|
|
33
32
|
// Must be on top
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
A,
|
|
34
|
+
p,
|
|
36
35
|
// Must be on top
|
|
36
|
+
s,
|
|
37
37
|
C,
|
|
38
|
+
a,
|
|
39
|
+
f,
|
|
38
40
|
c,
|
|
41
|
+
u,
|
|
39
42
|
l,
|
|
40
43
|
d,
|
|
41
|
-
u,
|
|
42
44
|
h,
|
|
43
45
|
g,
|
|
44
|
-
w,
|
|
45
|
-
y,
|
|
46
46
|
I,
|
|
47
|
-
|
|
47
|
+
y,
|
|
48
|
+
b,
|
|
48
49
|
B,
|
|
49
|
-
D,
|
|
50
50
|
$,
|
|
51
51
|
P,
|
|
52
|
-
|
|
53
|
-
T,
|
|
54
|
-
b
|
|
52
|
+
w
|
|
55
53
|
// Last: overrides button.css / wide-panel.css defaults
|
|
56
54
|
].join(`
|
|
57
55
|
|
|
58
|
-
`),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const t = (n = document.querySelector("ui-editor")) == null ? void 0 : n.shadowRoot;
|
|
67
|
-
if (t) {
|
|
68
|
-
t.adoptedStyleSheets.includes(o) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, o]);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
Date.now() < i && requestAnimationFrame(m);
|
|
72
|
-
};
|
|
73
|
-
m();
|
|
56
|
+
`), Y = () => ({ importCss: () => {
|
|
57
|
+
const o = new CSSStyleSheet();
|
|
58
|
+
o.replaceSync(R);
|
|
59
|
+
const e = document.querySelector("ui-editor");
|
|
60
|
+
if (!e)
|
|
61
|
+
return;
|
|
62
|
+
const m = e.shadowRoot;
|
|
63
|
+
m && (m.adoptedStyleSheets = [o]);
|
|
74
64
|
} });
|
|
75
65
|
export {
|
|
76
|
-
|
|
66
|
+
Y as useCustomInterfaceAppearance
|
|
77
67
|
};
|
|
@@ -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
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as m, computed as T } from "vue";
|
|
3
|
+
const X = (b = {}) => {
|
|
4
|
+
const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
|
|
5
5
|
baseURL: "",
|
|
6
6
|
timeout: 1e4,
|
|
7
7
|
retry: 0,
|
|
8
8
|
retryDelay: 1e3,
|
|
9
9
|
headers: {
|
|
10
10
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
11
|
+
"X-CSRF-TOKEN": O(),
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
"X-Requested-With": "XMLHttpRequest"
|
|
12
14
|
},
|
|
13
15
|
...b
|
|
14
16
|
}, w = (e, s) => {
|
|
@@ -22,22 +24,22 @@ const k = (b = {}) => {
|
|
|
22
24
|
}, e);
|
|
23
25
|
}), x = (e) => new Promise((s) => {
|
|
24
26
|
setTimeout(s, e);
|
|
25
|
-
}), i = async (e, s, t,
|
|
26
|
-
a.value = null,
|
|
27
|
-
const n = { ...v, ...
|
|
27
|
+
}), i = async (e, s, t, L = {}) => {
|
|
28
|
+
a.value = null, p.value = !0, u.value = new AbortController();
|
|
29
|
+
const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
|
|
28
30
|
method: e,
|
|
29
31
|
headers: { ...n.headers },
|
|
30
32
|
signal: u.value.signal,
|
|
31
33
|
...n
|
|
32
34
|
};
|
|
33
35
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
34
|
-
const E = async (
|
|
36
|
+
const E = async (h = 0) => {
|
|
35
37
|
try {
|
|
36
|
-
const o = [fetch(
|
|
38
|
+
const o = [fetch(D, c)];
|
|
37
39
|
n.timeout && o.push(P(n.timeout));
|
|
38
40
|
const r = await Promise.race(o);
|
|
39
41
|
if (!r.ok) {
|
|
40
|
-
const
|
|
42
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
41
43
|
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
42
44
|
}
|
|
43
45
|
let f;
|
|
@@ -50,19 +52,19 @@ const k = (b = {}) => {
|
|
|
50
52
|
};
|
|
51
53
|
} catch (o) {
|
|
52
54
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
|
-
if (
|
|
54
|
-
return await x(n.retryDelay || 1e3), E(
|
|
55
|
+
if (h < (n.retry || 0) && !r)
|
|
56
|
+
return await x(n.retryDelay || 1e3), E(h + 1);
|
|
55
57
|
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
60
|
try {
|
|
59
61
|
return await E();
|
|
60
62
|
} finally {
|
|
61
|
-
|
|
63
|
+
p.value = !1, u.value = null;
|
|
62
64
|
}
|
|
63
|
-
}, C = (e, s) => i("GET", e, void 0, s),
|
|
65
|
+
}, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
|
|
64
66
|
u.value && u.value.abort(e);
|
|
65
|
-
},
|
|
67
|
+
}, W = () => {
|
|
66
68
|
a.value = null;
|
|
67
69
|
};
|
|
68
70
|
return {
|
|
@@ -73,14 +75,14 @@ const k = (b = {}) => {
|
|
|
73
75
|
// Methods
|
|
74
76
|
request: i,
|
|
75
77
|
get: C,
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
78
|
+
post: R,
|
|
79
|
+
put: $,
|
|
80
|
+
patch: q,
|
|
79
81
|
delete: A,
|
|
80
|
-
cancel:
|
|
81
|
-
clearError:
|
|
82
|
+
cancel: U,
|
|
83
|
+
clearError: W
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
X as useHttp
|
|
86
88
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
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:
|
|
13
|
-
unresponsive:
|
|
12
|
+
cardsInRow: s,
|
|
13
|
+
unresponsive: n
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return (C - e) /
|
|
15
|
+
const o = n ? s : 1, e = i + c + (o - 1) * R;
|
|
16
|
+
return (C - e) / o;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const c =
|
|
20
|
-
if (!
|
|
18
|
+
getRecommendationCampaignData: (i) => {
|
|
19
|
+
const c = l(), s = Number(i), n = c.blockStates[s];
|
|
20
|
+
if (!n)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
23
23
|
orientation: "vertical",
|
|
@@ -30,59 +30,54 @@ const B = () => ({
|
|
|
30
30
|
discountBeforeTextValue: "",
|
|
31
31
|
discountAfterTextValue: ""
|
|
32
32
|
};
|
|
33
|
-
const { recommendationConfigs:
|
|
33
|
+
const { recommendationConfigs: o } = n, e = o.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
34
|
return {
|
|
35
|
-
textTrimming:
|
|
35
|
+
textTrimming: o.textTrimming,
|
|
36
36
|
orientation: e,
|
|
37
37
|
mobileLeftPadding: 0,
|
|
38
38
|
mobileRightPadding: 0,
|
|
39
|
-
cardsInRow:
|
|
40
|
-
unresponsive:
|
|
39
|
+
cardsInRow: o.cardsInRow,
|
|
40
|
+
unresponsive: o.unresponsive,
|
|
41
41
|
priceBeforeTextValue: "",
|
|
42
42
|
priceAfterTextValue: "",
|
|
43
43
|
discountBeforeTextValue: "",
|
|
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:
|
|
57
|
+
const { recommendationConfigs: r } = a;
|
|
58
58
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
strategyId:
|
|
61
|
-
language:
|
|
62
|
-
currencyCode:
|
|
63
|
-
size:
|
|
64
|
-
productIds:
|
|
65
|
-
filters:
|
|
66
|
-
shuffleProducts:
|
|
59
|
+
strategy: r.strategy,
|
|
60
|
+
strategyId: r.strategyId,
|
|
61
|
+
language: r.language,
|
|
62
|
+
currencyCode: r.currencySettings.value,
|
|
63
|
+
size: r.size,
|
|
64
|
+
productIds: r.productIds,
|
|
65
|
+
filters: r.filters,
|
|
66
|
+
shuffleProducts: r.shuffleProducts
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
if (e.strategyId &&
|
|
70
|
-
return
|
|
69
|
+
if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.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}");
|
|
82
|
-
const f = e.filters.filter((r) => r.isValid), m = b(f);
|
|
83
|
-
m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
|
|
84
|
-
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
|
|
85
|
-
return o.recommendationCampaignUrls[s] = u, u;
|
|
75
|
+
const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
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}");
|
|
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;
|
|
86
81
|
}
|
|
87
82
|
});
|
|
88
83
|
export {
|