@useinsider/guido 3.28.0 → 3.28.1-beta.556323d
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 +3 -3
- package/dist/@types/email-be/html-validation.js +28 -0
- package/dist/composables/useRecommendation.js +8 -16
- package/dist/composables/useSave.js +19 -17
- package/dist/composables/useSaveValidation.js +134 -252
- package/dist/composables/useTranslations.js +14 -9
- package/dist/config/compiler/recommendationCompilerRules.js +29 -41
- package/dist/enums/email-be.js +27 -0
- package/dist/enums/recommendation.js +4 -5
- package/dist/enums/save-validation.js +2 -2
- package/dist/node_modules/valibot/dist/index.js +232 -154
- package/dist/package.json.js +2 -2
- package/dist/services/emailBe/errors/ApiError.js +50 -0
- package/dist/services/emailBe/errors/handleApiError.js +31 -0
- package/dist/services/emailBe/errors/toApiError.js +71 -0
- package/dist/services/emailBe/html/HtmlValidationService.js +35 -0
- package/dist/services/emailBe/html/index.js +6 -0
- package/dist/services/emailBe/http/HttpManager.js +68 -0
- package/dist/services/emailBe/http/RetryStack.js +24 -0
- package/dist/services/emailBe/http/client.js +61 -0
- package/dist/services/emailBe/http/index.js +10 -0
- package/dist/services/emailBe/http/transportErrors.js +20 -0
- package/dist/src/@types/email-be/html-validation.d.ts +51 -0
- package/dist/src/composables/useRecommendation.d.ts +0 -4
- package/dist/src/composables/useSaveValidation.d.ts +2 -2
- package/dist/src/enums/email-be.d.ts +26 -0
- package/dist/src/enums/recommendation.d.ts +0 -1
- package/dist/src/enums/save-validation.d.ts +3 -15
- package/dist/src/services/emailBe/errors/ApiError.d.ts +40 -0
- package/dist/src/services/emailBe/errors/handleApiError.d.ts +11 -0
- package/dist/src/services/emailBe/errors/toApiError.d.ts +2 -0
- package/dist/src/services/emailBe/html/HtmlValidationService.d.ts +8 -0
- package/dist/src/services/emailBe/html/index.d.ts +2 -0
- package/dist/src/services/emailBe/http/HttpManager.d.ts +13 -0
- package/dist/src/services/emailBe/http/RetryStack.d.ts +6 -0
- package/dist/src/services/emailBe/http/client.d.ts +3 -0
- package/dist/src/services/emailBe/http/index.d.ts +2 -0
- package/dist/src/services/emailBe/http/transportErrors.d.ts +15 -0
- package/dist/src/services/emailBe/http/types.d.ts +46 -0
- package/package.json +1 -1
|
@@ -4,15 +4,20 @@ import memoize from "../node_modules/lodash-es/memoize.js";
|
|
|
4
4
|
import { ref } from "vue";
|
|
5
5
|
import { useConfig } from "./useConfig.js";
|
|
6
6
|
const useTranslations = () => {
|
|
7
|
-
var
|
|
8
|
-
const { config } = useConfig(), translationsPath = ((
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var s, i;
|
|
8
|
+
const { config } = useConfig(), translationsPath = ((i = (s = config.value) == null ? void 0 : s.editor) == null ? void 0 : i.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
+
var a;
|
|
10
|
+
const o = (a = translations.value) == null ? void 0 : a[t];
|
|
11
|
+
if (!o)
|
|
12
|
+
return console.warn(`Translation key not found: ${t}`), t;
|
|
13
|
+
const r = Object.keys(n ?? {}).filter(Boolean).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
14
|
+
if (n && r.length) {
|
|
15
|
+
const e = new RegExp(`{(${r.join("|")})}|:(${r.join("|")})\\b`, "g");
|
|
16
|
+
return o.replace(e, (f, l, c) => String(
|
|
17
|
+
n[l ?? c]
|
|
18
|
+
));
|
|
19
|
+
}
|
|
20
|
+
return o;
|
|
16
21
|
};
|
|
17
22
|
return memoize(
|
|
18
23
|
trans,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
3
|
-
import { prepareRecommendationBlocks as
|
|
4
|
-
const
|
|
1
|
+
import { useRecommendation as R } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as A, REGEX as m, VerticalOrientation as y, CSS as n, CONDITIONS as u, ATTRIBUTES as l, HTML as I } from "../../enums/recommendation.js";
|
|
3
|
+
import { prepareRecommendationBlocks as S } from "./utils/recommendationCompilerUtils.js";
|
|
4
|
+
const f = [
|
|
5
5
|
{
|
|
6
6
|
id: "replace-images-with-variable-names",
|
|
7
7
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
8
|
type: "custom",
|
|
9
9
|
processor: (t) => {
|
|
10
10
|
let e = t;
|
|
11
|
-
return Object.entries(
|
|
11
|
+
return Object.entries(A).forEach(([, r]) => {
|
|
12
12
|
Object.entries(r).forEach(([o, i]) => {
|
|
13
13
|
e = e.replaceAll(i, `{{${o}}}`);
|
|
14
14
|
});
|
|
@@ -42,17 +42,17 @@ const H = [
|
|
|
42
42
|
description: "Adding recommendation unresponsive css",
|
|
43
43
|
type: "custom",
|
|
44
44
|
processor: (t) => {
|
|
45
|
-
const { calculateCardWidth: e, getRecommendationCampaignData: r } =
|
|
45
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: r } = R();
|
|
46
46
|
let o = t;
|
|
47
|
-
const i = o.match(
|
|
47
|
+
const i = o.match(m.ID);
|
|
48
48
|
if (i) {
|
|
49
|
-
const
|
|
50
|
-
if (i.forEach((
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${
|
|
49
|
+
const c = [];
|
|
50
|
+
if (i.forEach((s) => {
|
|
51
|
+
const a = /recommendation-id="(.*?)"/i.exec(s), d = a ? a[1].trim() : "", p = r(d);
|
|
52
|
+
p.textTrimming && p.orientation === y && c.push(e(p));
|
|
53
|
+
}), c.length) {
|
|
54
|
+
const s = `width:${Math.min(...c)}px!important;`;
|
|
55
|
+
o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${s} ${n.ELLIPSIS}`).replace(n.REGULAR_NAME_CONTAINER_HEIGHT, n.TRIMMED_NAME_CONTAINER_CSS).replace(n.RESPONSIVE_NAME_SIZE, `${n.RESPONSIVE_NAME_HEIGHT} ${s} ${n.ELLIPSIS}`).replace(n.RESPONSIVE_NAME_CONTAINER_HEIGHT, n.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return o;
|
|
@@ -63,36 +63,24 @@ const H = [
|
|
|
63
63
|
id: "prepare-recommendations",
|
|
64
64
|
description: "Replacing product data with template variables in recommendation blocks",
|
|
65
65
|
type: "custom",
|
|
66
|
-
processor: (t) =>
|
|
66
|
+
processor: (t) => S(t),
|
|
67
67
|
priority: 48
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
id: "add-discount-conditions",
|
|
71
71
|
description: "Adding discount conditions to the recommendation block",
|
|
72
72
|
type: "custom",
|
|
73
|
-
processor: (t) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
let a = c;
|
|
85
|
-
if (S) {
|
|
86
|
-
const y = T.substring(2, T.length - 3), l = o(y);
|
|
87
|
-
b === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), b === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
|
|
88
|
-
}
|
|
89
|
-
const R = T.substring(2);
|
|
90
|
-
let f = "";
|
|
91
|
-
b in A.IF && (f = A.IF[b].replaceAll(`{${p.DISCOUNT}}`, `${R}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${R}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${R}${p.OMNIBUS_PRICE}`));
|
|
92
|
-
const M = `${_}${a}${g.PARAGRAPH_END_TAG}`, C = `${f}${S ? M : i}${A.ELSE}${_}${g.PARAGRAPH_END_TAG}${A.END_IF}`;
|
|
93
|
-
e = e.replace(i, C);
|
|
94
|
-
}), e;
|
|
95
|
-
},
|
|
73
|
+
processor: (t) => t.replace(m.ATTRIBUTE_PARAGRAPH, (e) => {
|
|
74
|
+
const r = e.match(m.CUSTOM_FIELD);
|
|
75
|
+
if (!r)
|
|
76
|
+
return e;
|
|
77
|
+
const [o] = r, i = o.match(m.CUSTOM_FIELD_INDEXES_PART), c = o.match(m.CUSTOM_FIELD_NAME_PART), s = e.match(m.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
78
|
+
if (!i || !c || !s)
|
|
79
|
+
return e;
|
|
80
|
+
const [a] = i, [d] = c, [p] = s, b = d.substring(1, d.length - 2), E = a.substring(2);
|
|
81
|
+
let _ = "";
|
|
82
|
+
return b in u.IF && (_ = u.IF[b].replaceAll(`{${l.DISCOUNT}}`, `${E}${l.DISCOUNT}`).replaceAll(`{${l.OMNIBUS_DISCOUNT}}`, `${E}${l.OMNIBUS_DISCOUNT}`).replaceAll(`{${l.OMNIBUS_PRICE}}`, `${E}${l.OMNIBUS_PRICE}`)), `${_}${e}${u.ELSE}${p}${I.PARAGRAPH_END_TAG}${u.END_IF}`;
|
|
83
|
+
}),
|
|
96
84
|
priority: 53
|
|
97
85
|
},
|
|
98
86
|
{
|
|
@@ -147,8 +135,8 @@ const H = [
|
|
|
147
135
|
), e = e.replace(
|
|
148
136
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
149
137
|
(r, o) => {
|
|
150
|
-
const i = o.match(/[^{}]+\{[^{}]*\}/g) || [],
|
|
151
|
-
return i.every((
|
|
138
|
+
const i = o.match(/[^{}]+\{[^{}]*\}/g) || [], c = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
139
|
+
return i.every((a) => c.test(a)) ? "" : r;
|
|
152
140
|
}
|
|
153
141
|
)), e;
|
|
154
142
|
},
|
|
@@ -208,5 +196,5 @@ const H = [
|
|
|
208
196
|
}
|
|
209
197
|
];
|
|
210
198
|
export {
|
|
211
|
-
|
|
199
|
+
f as recommendationCompilerRules
|
|
212
200
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const E = "/email-proxy", e = {
|
|
2
|
+
HTML_VALIDATE: "/v1/html/validate"
|
|
3
|
+
}, n = {
|
|
4
|
+
BAD_GATEWAY: "bad_gateway",
|
|
5
|
+
BAD_REQUEST: "bad_request",
|
|
6
|
+
CONFLICT: "conflict",
|
|
7
|
+
FORBIDDEN: "forbidden",
|
|
8
|
+
INTERNAL_ERROR: "internal_error",
|
|
9
|
+
NOT_FOUND: "not_found",
|
|
10
|
+
RATE_LIMITED: "rate_limited",
|
|
11
|
+
UNAUTHENTICATED: "unauthenticated",
|
|
12
|
+
VALIDATION_FAILED: "validation_failed",
|
|
13
|
+
SESSION_EXPIRED: "session_expired",
|
|
14
|
+
INVALID_RESPONSE: "invalid_response",
|
|
15
|
+
NETWORK: "network_error",
|
|
16
|
+
TIMEOUT: "timeout",
|
|
17
|
+
UNKNOWN: "unknown"
|
|
18
|
+
}, t = {
|
|
19
|
+
PONGO: "pongo",
|
|
20
|
+
LIQUID: "liquid"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
E as EMAIL_BE_BASE_URL,
|
|
24
|
+
e as EmailBeEndPoints,
|
|
25
|
+
n as EmailBeErrorCodes,
|
|
26
|
+
t as HtmlSyntax
|
|
27
|
+
};
|
|
@@ -27,13 +27,12 @@ const e = 20, t = 320, s = "vertical", m = {
|
|
|
27
27
|
ID: /recommendation-id="(.*?)"/gi,
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
30
|
-
COMPOSITION: /composition="true"/gm,
|
|
31
30
|
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
31
|
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
|
|
33
32
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
|
-
}, o = {
|
|
35
|
-
PARAGRAPH_END_TAG: "</p>"
|
|
36
33
|
}, a = {
|
|
34
|
+
PARAGRAPH_END_TAG: "</p>"
|
|
35
|
+
}, o = {
|
|
37
36
|
REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
|
|
38
37
|
TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
|
|
39
38
|
ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
|
|
@@ -47,10 +46,10 @@ const e = 20, t = 320, s = "vertical", m = {
|
|
|
47
46
|
export {
|
|
48
47
|
i as ATTRIBUTES,
|
|
49
48
|
_ as CONDITIONS,
|
|
50
|
-
|
|
49
|
+
o as CSS,
|
|
51
50
|
m as DUMMY_IMAGE_MAPPINGS,
|
|
52
51
|
e as DefaultPadding,
|
|
53
|
-
|
|
52
|
+
a as HTML,
|
|
54
53
|
t as MinDeviceViewport,
|
|
55
54
|
n as REGEX,
|
|
56
55
|
s as VerticalOrientation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var r = /* @__PURE__ */ ((n) => (n.CustomFieldScript = "custom-field-script", n.InvalidDynamicTag = "invalid-dynamic-tag", n.InvalidCustomField = "invalid-custom-field", n.MissingIfEndif = "missing-if-endif", n.RecommendationRequiredFields = "recommendation-required-fields", n.RecommendationFilters = "recommendation-filters", n.CheckboxUnsubGroup = "checkbox-unsub-group", n.RadioButtonUnsubGroup = "radio-button-unsub-group", n.ExternallyManagedUnsubscribe = "externally-managed-unsubscribe", n.EmailBeHtml = "email-be-html", n))(r || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
r as SaveValidationRule
|
|
4
4
|
};
|