@escapenavigator/utils 1.6.80 → 1.6.81
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.
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
export declare function getEmailUpsalesSection({ upsales, link,
|
|
1
|
+
export declare function getEmailUpsalesSection({ upsales, link, buttonText, }: {
|
|
2
2
|
upsales: Array<{
|
|
3
3
|
title: string;
|
|
4
|
-
description
|
|
4
|
+
description?: string;
|
|
5
5
|
}>;
|
|
6
6
|
link: string;
|
|
7
|
-
title: string;
|
|
8
7
|
buttonText: string;
|
|
9
|
-
}):
|
|
10
|
-
type: "paragraph";
|
|
11
|
-
title: string;
|
|
12
|
-
text: string;
|
|
13
|
-
link?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
type: "button";
|
|
16
|
-
text: string;
|
|
17
|
-
link: string;
|
|
18
|
-
title?: undefined;
|
|
19
|
-
})[];
|
|
8
|
+
}): string;
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEmailUpsalesSection = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
function getEmailUpsalesSection({ upsales, link, buttonText, }) {
|
|
5
|
+
return `${upsales.map((u) => `<b>${u.title}<b/> - ${u.description || ''}`).join('<br/>')}
|
|
6
|
+
<a style="
|
|
7
|
+
display:block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
max-width: 300px;
|
|
10
|
+
background:#2174EF;
|
|
11
|
+
color:#FFFFFF;
|
|
12
|
+
margin-top: 16px;
|
|
13
|
+
font-family:Montserrat, Arial, sans-serif;
|
|
14
|
+
font-size:14px;
|
|
15
|
+
font-style:normal;
|
|
16
|
+
font-weight:700;
|
|
17
|
+
line-height: 48px;
|
|
18
|
+
height: 48px;
|
|
19
|
+
text-decoration:none;
|
|
20
|
+
text-transform:none;
|
|
21
|
+
mso-padding-alt:0px;
|
|
22
|
+
border-radius:6px;
|
|
23
|
+
text-align: center;
|
|
24
|
+
" target="_blank" href="${link}">
|
|
25
|
+
${buttonText}
|
|
26
|
+
</a>
|
|
27
|
+
<p>`;
|
|
17
28
|
}
|
|
18
29
|
exports.getEmailUpsalesSection = getEmailUpsalesSection;
|
package/dist/transform-text.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformText = void 0;
|
|
4
|
+
/* eslint-disable no-prototype-builtins */
|
|
4
5
|
const transformText = (text, obj) => {
|
|
5
6
|
let res = text || '';
|
|
7
|
+
const ifRegex = /\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g;
|
|
8
|
+
res = res.replace(ifRegex, (match, conditionKey, innerContent) => {
|
|
9
|
+
if (obj.hasOwnProperty(conditionKey) && obj[conditionKey]) {
|
|
10
|
+
return innerContent;
|
|
11
|
+
}
|
|
12
|
+
return '';
|
|
13
|
+
});
|
|
14
|
+
const emptyPRegex = /<p>\s*<\/p>/g;
|
|
15
|
+
res = res.replace(emptyPRegex, '');
|
|
16
|
+
const pWithBrRegex = /<p>\s*(<br\s*\/?>)+\s*<\/p>/g;
|
|
17
|
+
res = res.replace(pWithBrRegex, '');
|
|
6
18
|
Object.entries(obj).forEach(([key, value]) => {
|
|
7
|
-
|
|
19
|
+
const replacementRegex = new RegExp(`{${key}}`, 'g');
|
|
20
|
+
res = res.replace(replacementRegex, value);
|
|
8
21
|
});
|
|
9
22
|
return res;
|
|
10
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapenavigator/utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.81",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test": "jest"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@escapenavigator/types": "^1.6.
|
|
17
|
+
"@escapenavigator/types": "^1.6.79",
|
|
18
18
|
"axios": "^0.21.4",
|
|
19
19
|
"class-transformer": "^0.5.1",
|
|
20
20
|
"class-validator": "^0.13.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"node_modules"
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "9ea11bd43f4737b0acbb17c0419f2f9c74dbd813"
|
|
59
59
|
}
|