This repository has been archived by the owner on Jan 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
mailgo-types.d.ts
120 lines (92 loc) · 3.51 KB
/
mailgo-types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Type definitions for mailgo
// Project: mailgo
// Definitions by: Matteo Manzinello <https://matteomanzinello.com>
declare module "mailgo" {
export type MailgoConfig = {
mailto?: boolean; // enable mailgo for mailto, default is obviously true
tel?: boolean; // enable mailgo for tel, default is true
sms?: boolean; // enable mailgo for sms, at the moment default is false
desktop?: boolean; // enable mailgo for desktop, default true
mobile?: boolean; // enable mailgo for mobile, default true
actions?: MailgoActions; // enable/disable actions, default all trues
details?: MailgoDetails; // show/hide the modal details
dark?: boolean; // dark mode for mailgo, default false
lang?: string; // language of the modal, default is english
validateEmail?: boolean; // validate an email, default is true
validateTel?: boolean; // validate a phone number, default is true
office365?: boolean; // the particular case of Outlook link: can be outlook.live.com or outlook.office365.com, by default the first but with this parameter you can change the behaviour
showFooter?: boolean; // show the footer with a link to mailgo.dev, default true, please!
initEvent?: string; // the event which is attached the mailgo init, default DOMContentLoaded
listenerOptions?: ListenerOptions | boolean; // the options of the listener if initEvent is specified
loadCSS?: boolean; // loadCSS for mailgo, default true
};
export type MailgoModalType = "mailgo" | "mailgo-tel" | "mailgo-sms"; // type of mailgo modal
export type MailgoInstallationType = "classic" | "less-spam"; // type of mailgo, in classic the link is all in href attribute (like a classic mailto:)
export type MailgoType = {
type?: MailgoModalType;
installation?: MailgoInstallationType;
};
export type MailgoAction =
| "gmail"
| "outlook"
| "yahoo"
| "telegram"
| "whatsapp"
| "skype"
| "copy"
| "default"
| "custom";
type MailgoActions = {
[action in MailgoAction]?: boolean;
};
export type MailgoDetail = "cc" | "bcc" | "subject" | "body" | "msg";
type MailgoDetails = {
[detail in MailgoDetail]?: boolean;
};
export type MailgoTranslation = {
open_in_?: string;
cc_?: string;
bcc_?: string;
subject_?: string;
body_?: string;
gmail?: string;
outlook?: string;
yahoo?: string;
telegram?: string;
whatsapp?: string;
skype?: string;
call?: string;
open?: string;
_default?: string;
_as_default?: string;
copy?: string;
copied?: string;
open_in_template?: string; // WIP
};
// language codes array that follow ISO 639-1 Code
export type MailgoLanguages = string[];
export type MailgoTranslations = {
// language codes array that follow ISO 639-1 Code
[language: string]: MailgoTranslation;
};
export type MailgoI18n = {
languages: string[];
translations: MailgoTranslations;
};
export type ListenerOptions = {
capture?: boolean;
once?: boolean;
passive?: boolean;
};
export function getMailgoTypeByElement(
element: HTMLElement
): MailgoType | null;
export function mailgoClickListener(event: Event): boolean;
export function mailgoPreRender(
mailgoElementOrUrl: HTMLLinkElement | string
): boolean;
export function mailgoDirectRender(directUrl: string): boolean;
export function mailgoRender(): boolean;
export function mailgoValidateEmail(email: string): boolean;
export default function mailgo(mailgoConfig?: MailgoConfig): boolean;
}