1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const types_1 = require("./types");
4const sanitizeUrl = (url) => {
5    if (!/^https?:\/\//i.test(url)) {
6        return 'https://' + url;
7    }
8    return url;
9};
10const generateLinksSection = (input) => {
11    var _a;
12    const urls = [
13        { key: "Twitter", value: input.twitterUrl },
14        { key: "LinkedIn", value: input.linkedInUrl },
15        { key: "Github", value: input.githubUrl },
16        { key: "Book a meeting", value: input.hubspotUrl },
17        ...((_a = input.otherUrls) !== null && _a !== void 0 ? _a : []),
18    ];
19    const urlsHtml = urls
20        .filter((u) => u.value)
21        .map((u) => `<a href="${sanitizeUrl(u.value)}" style="color: #4990ff; text-decoration: none;">${u.key}</a>`)
22        .join(" | ");
23    return `<div style="line-height: 18px;">${urlsHtml}</div>`;
24};
25const typeToHtml = (input) => ({
26    [types_1.EmailSignatureType.Gmail]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">
27        <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName}</div>
28        <div style="line-height: 18px;">${input.position}</div>
29        <div style="display: flex; align-items: center;">
30            <a href="https://apify.com/">
31                <img src="https://apify.com/ext/logo-for-signatures.png" 
32                alt="Apify" style="margin-top: 12px; width:115px; margin-bottom: 12px;">
33            </a>
34        </div>
35        ${input.phoneNumber
36        ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`
37        : ""}
38        ${generateLinksSection(input)}
39        ${input.apifyUrl
40        ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 
41        text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`
42        : ""}
43        <div style="line-height: 18px; margin-top: 12px;"><a href="https://apify.com" style="color: #4990ff; 
44            text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring
45        ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 
46            text-decoration: none;">We're hiring</a>`
47        : ""}
48        </div>
49        
50        ${input.shouldDisplayG2
51        ? `<div style="display: flex; align-items: center;">
52            <a href="https://www.g2.com/products/apify/reviews">
53                <img src="https://apify.com/ext/g2badge.svg" 
54                alt="G2 badge" style="margin-top: 12px; width:90px; margin-bottom: 12px;">
55            </a>
56        </div>`
57        : ""}</div>`,
58    [types_1.EmailSignatureType.Outlook]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">
59    <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName}</div>
60    <div style="line-height: 18px;">${input.position}</div>
61    <br style="line-height: 12px;"> 
62    <a href="https://apify.com/"><img src="https://apify.com/ext/logo-for-signatures.png" 
63        alt="Apify" style="width: 115px;"></a>
64    <br style="line-height: 12px;"> 
65    ${input.phoneNumber
66        ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`
67        : ""}
68    ${generateLinksSection(input)}
69    ${input.apifyUrl
70        ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 
71    text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`
72        : ""}
73    <br style="line-height: 12px;">
74    <div style="line-height: 18px;"><a href="https://apify.com" style="color: #4990ff; 
75        text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring
76        ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 
77        text-decoration: none;">We're hiring</a>`
78        : ""}
79    </div>
80    <br style="line-height: 12px;">
81    ${input.shouldDisplayG2
82        ? `
83        <a href="https://www.g2.com/products/apify/reviews">
84            <img src="https://apify.com/ext/g2badge.svg" 
85            alt="G2 badge" style="width:90px;">
86        </a>`
87        : ""}
88</div>`,
89});
90exports.default = (input, type) => {
91    const result = typeToHtml(input)[type];
92    return result;
93};