@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.486ee9c
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 +36 -0
- package/dist/@types/config/schemas.js +70 -65
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +69 -58
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +107 -119
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -23
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/config/migrator/itemsBlockMigrator.js +127 -122
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/defaults.js +8 -4
- package/dist/extensions/Blocks/Recommendation/block.js +26 -23
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +37 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -12
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -11
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +217 -94
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +97 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +304 -209
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +237 -140
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +27 -32
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +22 -27
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +50 -38
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/ModulesTabIcons/extension.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
- package/dist/services/recommendationApi.js +11 -9
- package/dist/services/stripoApi.js +20 -17
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/enums/defaults.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +12 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +50 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +36 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -3
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/static/styles/components/notification.css.js +19 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -2
- package/dist/static/styles/customEditorStyle.css.js +59 -31
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/dist/stores/unsubscribe.js +37 -34
- package/package.json +2 -2
|
@@ -1,171 +1,159 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { TemplateTypes as
|
|
3
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import { itemsBlockDynamicVariables as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"url",
|
|
15
|
-
"name",
|
|
16
|
-
"price",
|
|
17
|
-
"currency",
|
|
18
|
-
"original_price",
|
|
19
|
-
"omnibus_price",
|
|
20
|
-
"omnibus_discount"
|
|
21
|
-
];
|
|
22
|
-
function Y() {
|
|
23
|
-
const a = j();
|
|
24
|
-
return Object.keys(a.blockStates).flatMap((d) => {
|
|
25
|
-
const f = a.blockStates[Number(d)], i = parseInt(f.recommendationConfigs.size) || 10;
|
|
26
|
-
return Array.from({ length: i }, (m, u) => u).flatMap((m) => K.map((u) => `${d}_${m}_${u}`));
|
|
27
|
-
});
|
|
1
|
+
import { useConfig as L } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as V } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as _, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as G } from "../enums/html-validator.js";
|
|
4
|
+
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
5
|
+
import { itemsBlockDynamicVariables as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
6
|
+
import { useRecommendationStore as $ } from "../stores/recommendation.js";
|
|
7
|
+
import { base64EncodeWithSpecialChars as X } from "../utils/base64.js";
|
|
8
|
+
import { useHttp as j } from "./useHttp.js";
|
|
9
|
+
import { useToaster as q } from "./useToaster.js";
|
|
10
|
+
import { useTranslations as z } from "./useTranslations.js";
|
|
11
|
+
const K = /recommendation-id="(\d+)"/g;
|
|
12
|
+
function U(i) {
|
|
13
|
+
return [...i.matchAll(K)].map((u) => u[1]);
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
function Y(i, u) {
|
|
16
|
+
return u.some((d) => i.startsWith(`${d}_`));
|
|
17
|
+
}
|
|
18
|
+
const ce = () => {
|
|
19
|
+
var y, h;
|
|
20
|
+
const { showToaster: i } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, w = async (e) => {
|
|
21
|
+
const t = await u(
|
|
33
22
|
"/newsletter/template-library/check-template-html-body",
|
|
34
|
-
{ html:
|
|
35
|
-
), { status: n, message:
|
|
36
|
-
return n ||
|
|
37
|
-
type:
|
|
38
|
-
message: n === void 0 ?
|
|
39
|
-
}),
|
|
40
|
-
type:
|
|
41
|
-
message:
|
|
23
|
+
{ html: X(e) }
|
|
24
|
+
), { status: n, message: l } = t.data;
|
|
25
|
+
return n || i({
|
|
26
|
+
type: c.Alert,
|
|
27
|
+
message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
|
|
28
|
+
}), r(P), l === r(G) && i({
|
|
29
|
+
type: c.Alert,
|
|
30
|
+
message: r("newsletter.already-in-progress")
|
|
42
31
|
}), n;
|
|
43
|
-
}, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()),
|
|
32
|
+
}, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
|
|
44
33
|
const t = e.match(/({%(.*?)%})/g);
|
|
45
34
|
let n = !0;
|
|
46
|
-
return t !== null && !
|
|
47
|
-
const o =
|
|
35
|
+
return t !== null && !p && t.forEach((l) => {
|
|
36
|
+
const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
48
37
|
if (o && o.length > 0) {
|
|
49
|
-
const [
|
|
50
|
-
b(
|
|
51
|
-
type:
|
|
52
|
-
message:
|
|
38
|
+
const [a] = o;
|
|
39
|
+
b(a) && !s.includes(a) && (i({
|
|
40
|
+
type: c.Warning,
|
|
41
|
+
message: r("custom-fields.invalid-custom-fields")
|
|
53
42
|
}), n = !1);
|
|
54
43
|
}
|
|
55
44
|
}), n;
|
|
56
|
-
},
|
|
57
|
-
const n = t ? await
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
type:
|
|
61
|
-
message:
|
|
45
|
+
}, A = async (e, s, t) => {
|
|
46
|
+
const n = t ? await w(e) : !0;
|
|
47
|
+
return E(e, s) && n;
|
|
48
|
+
}, I = (e) => e.length > 0 ? !0 : (i({
|
|
49
|
+
type: c.Warning,
|
|
50
|
+
message: r("newsletter.html-content-is-empty")
|
|
62
51
|
}), !1), k = (e) => {
|
|
63
52
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
64
|
-
return s > t &&
|
|
65
|
-
type:
|
|
66
|
-
message:
|
|
67
|
-
}), s < t &&
|
|
68
|
-
type:
|
|
69
|
-
message:
|
|
53
|
+
return s > t && i({
|
|
54
|
+
type: c.Warning,
|
|
55
|
+
message: r("custom-fields.missing-closing-braces")
|
|
56
|
+
}), s < t && i({
|
|
57
|
+
type: c.Warning,
|
|
58
|
+
message: r("custom-fields.missing-opening-braces")
|
|
70
59
|
}), s === t;
|
|
71
60
|
}, x = (e) => {
|
|
72
61
|
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
73
|
-
return s ||
|
|
74
|
-
type:
|
|
75
|
-
message:
|
|
62
|
+
return s || i({
|
|
63
|
+
type: c.Warning,
|
|
64
|
+
message: r("custom-fields.invalid-custom-fields")
|
|
76
65
|
}), s;
|
|
77
66
|
}, T = (e, s) => {
|
|
78
67
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
79
|
-
if (t && !
|
|
80
|
-
const n = new Set(s.map((
|
|
81
|
-
if (t.forEach((
|
|
82
|
-
const
|
|
83
|
-
(!n.has(
|
|
84
|
-
}),
|
|
85
|
-
const
|
|
68
|
+
if (t && !p) {
|
|
69
|
+
const n = new Set(s.map((a) => a.toLowerCase())), l = U(e), o = [];
|
|
70
|
+
if (t.forEach((a) => {
|
|
71
|
+
const m = a.slice(2, -2).trim().toLowerCase();
|
|
72
|
+
(!n.has(m) || m === "") && !Y(m, l) && o.push(m);
|
|
73
|
+
}), o.length > 0) {
|
|
74
|
+
const a = `
|
|
86
75
|
<ul>
|
|
87
|
-
${
|
|
76
|
+
${o.map((m) => `<li>${m}</li>`).join("")}
|
|
88
77
|
</ul>
|
|
89
78
|
`;
|
|
90
|
-
return
|
|
91
|
-
type:
|
|
92
|
-
message:
|
|
79
|
+
return i({
|
|
80
|
+
type: c.Alert,
|
|
81
|
+
message: r("custom-fields.invalid-custom-fields") + a
|
|
93
82
|
}), !1;
|
|
94
83
|
}
|
|
95
84
|
}
|
|
96
85
|
return !0;
|
|
97
|
-
},
|
|
86
|
+
}, F = (e) => {
|
|
98
87
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
99
88
|
let n = !0;
|
|
100
|
-
if (s && s.forEach((
|
|
101
|
-
const o =
|
|
102
|
-
(!o ||
|
|
103
|
-
type:
|
|
104
|
-
message:
|
|
105
|
-
}), n = !1), o && o.forEach((
|
|
106
|
-
|
|
107
|
-
type:
|
|
108
|
-
message:
|
|
89
|
+
if (s && s.forEach((l) => {
|
|
90
|
+
const o = l.match(_), a = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
|
|
91
|
+
(!o || l !== m) && !a && (i({
|
|
92
|
+
type: c.Alert,
|
|
93
|
+
message: r("newsletter.display-conditions-invalid-syntax")
|
|
94
|
+
}), n = !1), o && o.forEach((f) => {
|
|
95
|
+
f.trim() === "=" && (i({
|
|
96
|
+
type: c.Alert,
|
|
97
|
+
message: r("custom-conditions.wrong-equality-operators")
|
|
109
98
|
}), n = !1);
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
S(
|
|
99
|
+
const v = f.match(/^[a-zA-Z]*$/g);
|
|
100
|
+
v && v.forEach((C) => {
|
|
101
|
+
S(C) && t.push(C);
|
|
113
102
|
});
|
|
114
103
|
});
|
|
115
104
|
}), t.length) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
type:
|
|
119
|
-
message:
|
|
105
|
+
const l = t.filter((a) => a === "if"), o = t.filter((a) => a === "endif");
|
|
106
|
+
l.length !== o.length && (i({
|
|
107
|
+
type: c.Alert,
|
|
108
|
+
message: r("custom-conditions.missing-if-endif-tag")
|
|
120
109
|
}), n = !1);
|
|
121
110
|
}
|
|
122
111
|
return n;
|
|
123
|
-
},
|
|
112
|
+
}, W = (e) => {
|
|
124
113
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
125
|
-
return n ||
|
|
126
|
-
type:
|
|
127
|
-
message:
|
|
114
|
+
return n || i({
|
|
115
|
+
type: c.Warning,
|
|
116
|
+
message: r("custom-conditions.no-space-after-braces")
|
|
128
117
|
}), n;
|
|
129
|
-
},
|
|
130
|
-
type:
|
|
131
|
-
message:
|
|
132
|
-
}), !1) : !0,
|
|
133
|
-
type:
|
|
134
|
-
message:
|
|
135
|
-
}), !1) : !0,
|
|
118
|
+
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (i({
|
|
119
|
+
type: c.Warning,
|
|
120
|
+
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
121
|
+
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (i({
|
|
122
|
+
type: c.Alert,
|
|
123
|
+
message: r("newsletter.fill-all-necessary-fields")
|
|
124
|
+
}), !1) : !0, B = (e) => {
|
|
136
125
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
137
|
-
return e.match(s) === null ? !0 : (
|
|
138
|
-
type:
|
|
139
|
-
message:
|
|
126
|
+
return e.match(s) === null ? !0 : (i({
|
|
127
|
+
type: c.Alert,
|
|
128
|
+
message: r("newsletter.invalid-image-type")
|
|
140
129
|
}), !1);
|
|
141
|
-
},
|
|
130
|
+
}, R = (e) => {
|
|
142
131
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
143
132
|
return Array.from(n).find((o) => {
|
|
144
|
-
var
|
|
145
|
-
return !((
|
|
146
|
-
}) ? (
|
|
147
|
-
type:
|
|
148
|
-
message:
|
|
133
|
+
var a;
|
|
134
|
+
return !((a = o.id) != null && a.trim());
|
|
135
|
+
}) ? (i({
|
|
136
|
+
type: c.Alert,
|
|
137
|
+
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
149
138
|
}), !1) : !0;
|
|
150
|
-
},
|
|
139
|
+
}, D = (e) => {
|
|
151
140
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
152
141
|
return Array.from(n).find((o) => {
|
|
153
|
-
var
|
|
154
|
-
return !((
|
|
155
|
-
}) ? (
|
|
156
|
-
type:
|
|
157
|
-
message:
|
|
142
|
+
var a;
|
|
143
|
+
return !((a = o.id) != null && a.trim());
|
|
144
|
+
}) ? (i({
|
|
145
|
+
type: c.Alert,
|
|
146
|
+
message: r("unsubscribe-templates.select-radio-button-groups")
|
|
158
147
|
}), !1) : !0;
|
|
159
148
|
};
|
|
160
149
|
return { validateHtml: async (e, s, t = !1) => {
|
|
161
150
|
const n = [
|
|
162
151
|
...s.map((o) => o.value),
|
|
163
|
-
...
|
|
164
|
-
...Y()
|
|
152
|
+
...M
|
|
165
153
|
];
|
|
166
|
-
return await
|
|
154
|
+
return await A(e, n, t) && I(e) && k(e) && x(e) && T(e, n) && F(e) && W(e) && N(e) && O() && B(e) && R(e) && D(e);
|
|
167
155
|
} };
|
|
168
156
|
};
|
|
169
157
|
export {
|
|
170
|
-
|
|
158
|
+
ce as useHtmlValidator
|
|
171
159
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
3
|
+
import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
-
import { useConfigStore as
|
|
5
|
+
import { useConfigStore as I } from "../stores/config.js";
|
|
6
6
|
const N = () => ({
|
|
7
7
|
calculateCardWidth: ({
|
|
8
8
|
mobileLeftPadding: i,
|
|
@@ -14,7 +14,7 @@ const N = () => ({
|
|
|
14
14
|
return (R - e) / r;
|
|
15
15
|
},
|
|
16
16
|
getRecommendationCampaignData: (i) => {
|
|
17
|
-
const n =
|
|
17
|
+
const n = u(), o = Number(i), a = n.blockStates[o];
|
|
18
18
|
if (!a)
|
|
19
19
|
return {
|
|
20
20
|
textTrimming: !1,
|
|
@@ -43,16 +43,16 @@ const N = () => ({
|
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
45
|
buildCampaignUrl: (i) => {
|
|
46
|
-
var
|
|
47
|
-
const n =
|
|
46
|
+
var m;
|
|
47
|
+
const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
|
|
48
48
|
if (!r)
|
|
49
49
|
return "";
|
|
50
|
-
const { recommendationConfigs: e } = r,
|
|
51
|
-
t.set("locale", e.language), t.set("currency", e.currencySettings.value), 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}");
|
|
50
|
+
const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
51
|
+
t.set("locale", e.language), t.set("currency", e.currencySettings.value), 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}");
|
|
52
52
|
const f = e.filters.filter((s) => s.isValid), c = x(f);
|
|
53
53
|
c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
|
|
54
|
-
const
|
|
55
|
-
return n.recommendationCampaignUrls[i] =
|
|
54
|
+
const d = `${p.RECOMMENDATION_API_URL}/v2/${l}?${t.toString()}`;
|
|
55
|
+
return n.recommendationCampaignUrls[i] = d, d;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
export {
|
|
@@ -4,21 +4,22 @@ import { useConfig as v } from "./useConfig.js";
|
|
|
4
4
|
import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
|
|
6
6
|
import { useToaster as D } from "./useToaster.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import U from "../
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import H from "../
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { localePatch as I } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as M } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as U } from "../services/stripoApi.js";
|
|
10
|
+
import P from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as R } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
|
|
13
|
+
import O from "../package.json.js";
|
|
14
|
+
const Z = (c) => {
|
|
15
|
+
const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = U(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, r = []) => {
|
|
16
|
+
var m, f, g;
|
|
17
|
+
const o = R(), { html: n, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, T = ((g = y.value) == null ? void 0 : g.forceRecreate) ?? !1;
|
|
17
18
|
window.UIEditor.initEditor(
|
|
18
19
|
document.querySelector("#guido-editor"),
|
|
19
20
|
{
|
|
20
21
|
metadata: c,
|
|
21
|
-
html:
|
|
22
|
+
html: n,
|
|
22
23
|
css: p,
|
|
23
24
|
forceRecreate: T,
|
|
24
25
|
locale: "en",
|
|
@@ -30,10 +31,10 @@ const W = (c) => {
|
|
|
30
31
|
customAppearanceMergetags: !0,
|
|
31
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: P,
|
|
34
35
|
conditionsEnabled: a,
|
|
35
36
|
customConditionsEnabled: a,
|
|
36
|
-
conditionCategories:
|
|
37
|
+
conditionCategories: M,
|
|
37
38
|
enableXSSSecurity: !0,
|
|
38
39
|
modulesDisabled: k,
|
|
39
40
|
messageSettingsEnabled: !0,
|
|
@@ -46,11 +47,11 @@ const W = (c) => {
|
|
|
46
47
|
editorFonts: {
|
|
47
48
|
showDefaultStandardFonts: !0,
|
|
48
49
|
showDefaultNotStandardFonts: !0,
|
|
49
|
-
customFonts:
|
|
50
|
+
customFonts: r
|
|
50
51
|
},
|
|
51
52
|
mergeTags: [
|
|
52
53
|
{
|
|
53
|
-
entries:
|
|
54
|
+
entries: H(c.preselectedDynamicContentList)
|
|
54
55
|
}
|
|
55
56
|
],
|
|
56
57
|
async onTokenRefreshRequest(e) {
|
|
@@ -89,29 +90,30 @@ const W = (c) => {
|
|
|
89
90
|
".in-on-board-wrapper",
|
|
90
91
|
".in-drawer__container"
|
|
91
92
|
],
|
|
92
|
-
extensions: t
|
|
93
|
+
extensions: t,
|
|
94
|
+
localePatch: I
|
|
93
95
|
}
|
|
94
96
|
);
|
|
95
|
-
}, b = (i) => new Promise((
|
|
97
|
+
}, b = (i) => new Promise((r, o) => {
|
|
96
98
|
var a;
|
|
97
99
|
if (document.getElementById("UiEditorScript")) {
|
|
98
|
-
i(),
|
|
100
|
+
i(), r();
|
|
99
101
|
return;
|
|
100
102
|
}
|
|
101
|
-
const
|
|
103
|
+
const n = O.guido, s = `https://email-static.useinsider.com/guido/${(a = n == null ? void 0 : n.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
104
|
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
103
|
-
i(),
|
|
105
|
+
i(), r();
|
|
104
106
|
}, t.onerror = () => {
|
|
105
107
|
o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
106
108
|
}, document.body.appendChild(t);
|
|
107
109
|
});
|
|
108
110
|
return { initPlugin: async (i) => {
|
|
109
111
|
await b(async () => {
|
|
110
|
-
const
|
|
111
|
-
await w(i,
|
|
112
|
+
const r = await S();
|
|
113
|
+
await w(i, r);
|
|
112
114
|
});
|
|
113
115
|
} };
|
|
114
116
|
};
|
|
115
117
|
export {
|
|
116
|
-
|
|
118
|
+
Z as useStripo
|
|
117
119
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
1
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
2
2
|
function b(e, u, r, o) {
|
|
3
|
-
const
|
|
4
|
-
return o === "before" ? `${t} ${
|
|
3
|
+
const n = `{{${e}_${u}_${r}}}`, t = `{{${e}_${u}_currency}}`;
|
|
4
|
+
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
5
5
|
}
|
|
6
|
-
function p(e, u, r, o,
|
|
6
|
+
function p(e, u, r, o, n) {
|
|
7
7
|
switch (u) {
|
|
8
8
|
case "productImage": {
|
|
9
9
|
const t = e.querySelector("img");
|
|
10
|
-
t && t.setAttribute("src", `{{${r}_${o}
|
|
10
|
+
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
11
11
|
const c = e.querySelector("a");
|
|
12
12
|
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
13
13
|
break;
|
|
@@ -24,7 +24,7 @@ function p(e, u, r, o, s) {
|
|
|
24
24
|
const t = e.querySelector("p");
|
|
25
25
|
if (t) {
|
|
26
26
|
const c = t.querySelector("strong") || t;
|
|
27
|
-
c.textContent = b(r, o, "price",
|
|
27
|
+
c.textContent = b(r, o, "price", n);
|
|
28
28
|
}
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
@@ -36,7 +36,7 @@ function p(e, u, r, o, s) {
|
|
|
36
36
|
r,
|
|
37
37
|
o,
|
|
38
38
|
"original_price",
|
|
39
|
-
|
|
39
|
+
n
|
|
40
40
|
), t.setAttribute("product-attr", "discount");
|
|
41
41
|
}
|
|
42
42
|
break;
|
|
@@ -67,22 +67,22 @@ function p(e, u, r, o, s) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function $(e, u, r) {
|
|
70
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
71
|
-
|
|
72
|
-
const i =
|
|
70
|
+
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
71
|
+
n.querySelectorAll("[data-attribute-type]").forEach((s) => {
|
|
72
|
+
const i = s.getAttribute("data-attribute-type") || "", a = s.querySelectorAll(".attribute-cell");
|
|
73
73
|
a.length > 0 ? a.forEach((l) => {
|
|
74
74
|
p(l, i, u, t, r);
|
|
75
|
-
}) : p(
|
|
75
|
+
}) : p(s, i, u, t, r);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function S(e, u, r) {
|
|
80
80
|
const o = e.querySelectorAll(".recommendation-product-row");
|
|
81
81
|
if (!o.length)
|
|
82
82
|
return;
|
|
83
|
-
const [
|
|
84
|
-
o.forEach((
|
|
85
|
-
|
|
83
|
+
const [n] = o, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
84
|
+
o.forEach((s, i) => {
|
|
85
|
+
s.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
86
86
|
const f = l.getAttribute("data-attribute-type") || "";
|
|
87
87
|
l.querySelectorAll(".attribute-cell").forEach((y, m) => {
|
|
88
88
|
const A = i * c + m;
|
|
@@ -91,24 +91,29 @@ function _(e, u, r) {
|
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function q(e, u) {
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
function q(e, u, r) {
|
|
95
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
96
|
+
S(n, u, r);
|
|
97
|
+
});
|
|
97
98
|
}
|
|
98
99
|
function d(e, u) {
|
|
100
|
+
const r = e.getAttribute("data-layout") || "grid", o = e.getAttribute("currency-alignment") || "after";
|
|
101
|
+
r === "list" ? $(e, u, o) : q(e, u, o);
|
|
102
|
+
}
|
|
103
|
+
function h(e, u) {
|
|
99
104
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
100
105
|
return (r ? `${r[0]}
|
|
101
106
|
` : "") + u.documentElement.outerHTML;
|
|
102
107
|
}
|
|
103
108
|
function w(e) {
|
|
104
|
-
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".
|
|
109
|
+
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
105
110
|
if (!o.length)
|
|
106
111
|
return e;
|
|
107
|
-
const { buildCampaignUrl:
|
|
112
|
+
const { buildCampaignUrl: n } = _();
|
|
108
113
|
return o.forEach((c) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
}),
|
|
114
|
+
const s = c.getAttribute("recommendation-id");
|
|
115
|
+
s && (n(s), d(c, s));
|
|
116
|
+
}), h(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
112
117
|
}
|
|
113
118
|
export {
|
|
114
119
|
b as formatPriceVariable,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const e = "Your version has been restored successfully.", o = "Restore Image", t = "Cancel", a = {
|
|
2
|
+
"The image has been deleted.": "The image has been deleted successfully.",
|
|
3
|
+
"Aim for the drop zone!": "Drag and drop your image inside the upload area to continue.",
|
|
4
|
+
"Image processing": "The image upload is in progress. This may take some time.",
|
|
5
|
+
"Can not get image from an external source.": "The image couldn’t be uploaded from the URL. Check and update your URL to continue.",
|
|
6
|
+
"The selected basic color cannot be added to My Palette. Please choose a different one from the color picker.": "The selected color is already added to My Palette. Pick a different color to add.",
|
|
7
|
+
"Copied to clipboard": "Your Image URL has been copied to clipboard successfully.",
|
|
8
|
+
"The file {fileName} has wrong format {fileFormat}": "Upload a PNG, JPG, JPEG, or GIF image to continue.",
|
|
9
|
+
"The file {fileName} size exceeds the allowed size {maxFileSize}": "Upload an image up to 10 MB to continue.",
|
|
10
|
+
"Image link invalid": "Enter a valid Image Link to continue.",
|
|
11
|
+
"Image upload failed": "Upload a valid image to continue.",
|
|
12
|
+
"Image upload error": "Upload a valid image to continue.",
|
|
13
|
+
"Error message from video service": "The video thumbnail couldn't be loaded. Check and update your Video Link to continue.",
|
|
14
|
+
"Error message from image processing": "The Play Button couldn't be added to the Video Thumbnail right now. You can select another Play Button and try again.",
|
|
15
|
+
"The AI is fine-tuning your result... Please wait! This may take up to 1 minute.": "AI content generation is in progress. This may take some time.",
|
|
16
|
+
"Can not complete AI request. Try again later": "AI content generation couldn't be completed right now. You can reload the editor or wait for a while and try again.",
|
|
17
|
+
"Http failure response for https://plugins.stripo.email/api/v1/documents/v3/documents/link: 400 OK": "Upload a valid image to continue.",
|
|
18
|
+
"Http failure response for https://plugins.stripo.email/api/v1/documents/v3/documents/base64: 400 OK": "The video thumbnail couldn’t be uploaded from the URL. Check and update your URL to continue.",
|
|
19
|
+
"AI is processing your request": "AI content generation is in progress. This may take some time.",
|
|
20
|
+
"Whoops, something went wrong. Our experts are working to resolve this issue. Try again later please": "Your action couldn't be done right now. You can reload the editor or wait for a while and try again.",
|
|
21
|
+
"Unable to paste text. Limit is 256kB. Please trim it down.": "Add a text to Text Block of up to 256KB to continue.",
|
|
22
|
+
"Banner src included merge tag": "The image upload is in progress. This may take some time.",
|
|
23
|
+
"Module deletion error": "The module couldn't be deleted right now. You can wait for a while and try again.",
|
|
24
|
+
"Can`t delete the module": "The module couldn't be deleted right now. You can wait for a while and try again.",
|
|
25
|
+
"Block action error": "Your content couldn't added right now. You can wait for a while and try again.",
|
|
26
|
+
history_revert_to_patch: e,
|
|
27
|
+
"There is no connection to the server. Please reload the page or click 'Reconnect' to continue.": "Your server connection is lost. Reload the page to continue.",
|
|
28
|
+
"Reconnecting...": "Server reconnection is in progress. This may take some time.",
|
|
29
|
+
"Failed to load version history. Contact support for assistance.": "Your version couldn't be restored right now. You can wait for a while and try again.",
|
|
30
|
+
"Connection restored": "Server connection has been restored successfully.",
|
|
31
|
+
"Invalid base64 image format. Please replace the image link.": "This image can’t be edited.",
|
|
32
|
+
"Timer update error": "Your action couldn't be undone right now. You can reload the editor or wait for a while and try again.",
|
|
33
|
+
"Cannot edit base64 images": "This image type can't be edited.",
|
|
34
|
+
"Failed to copy URL": "Your Image Link couldn't be copied to clipboard right now. You can wait for a while and try again.",
|
|
35
|
+
"Error message from image service": "The image couldn’t be uploaded from the URL. Check and update your URL to continue.",
|
|
36
|
+
"Error message from image preload": "The image couldn't be loaded from the URL you entered. Check and update your Image Link to continue.",
|
|
37
|
+
"An error has occurred. Please report the error code to support: {trace_id} and reload the editor. Also, send a bug report with email logs to the development team.": "Your design couldn't be loaded right now. You can reload the page and try again.",
|
|
38
|
+
"The number of requests within your session has been exceeded. Please wait.": "Your requests are being processed. You can wait for a while to take new actions.",
|
|
39
|
+
"An error has occurred. Please report the error code to support.": "Your design couldn't be loaded right now. You can reload the page and try again.",
|
|
40
|
+
"Warning: custom fonts": "Use custom fonts up to 10 to continue.",
|
|
41
|
+
"Image recovery error": "The image couldn't be restored right now. You can wait for a while and try again.",
|
|
42
|
+
"Image moved to trash": "The image has been deleted successfully.",
|
|
43
|
+
Recover: o,
|
|
44
|
+
Stop: t,
|
|
45
|
+
"Can`t delete the image": "The image couldn’t be deleted right now. You can wait for a while and try again.",
|
|
46
|
+
"Can`t restore the image": "The image couldn’t be restored right now. You can wait for a while and try again.",
|
|
47
|
+
"Image delete error": "The image couldn't be deleted right now. You can wait for a while and try again.",
|
|
48
|
+
"The maximum number of users who can simultaneously work with the sheet has been exceeded. Maximum allowed number: {{max_users_per_model}}": "You can’t edit the design right now as the maximum number of users are currently editing it.",
|
|
49
|
+
"The monthly limit of Timer basic block is reached. Please change the subscription pricing plan to activate new quotas": "You have reached your monthly limit of Timer Blocks. You can contact your Account Director for more information."
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
o as Recover,
|
|
53
|
+
t as Stop,
|
|
54
|
+
a as default,
|
|
55
|
+
e as history_revert_to_patch
|
|
56
|
+
};
|