ayiin 1.0.16 → 1.0.18

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/index.d.ts CHANGED
@@ -1 +1,48 @@
1
+ import nodemailer from 'nodemailer';
2
+
3
+
1
4
  declare module 'ayiin';
5
+
6
+ declare class Ayiin {
7
+ constructor(
8
+ email: string,
9
+ password: string
10
+ ) {
11
+ this.email = email;
12
+ this.password = password;
13
+ this.array = [];
14
+ this.object = {};
15
+ this.mail = nodemailer.createTransport({
16
+ service: 'gmail',
17
+ host: "smtp.gmail.com",
18
+ port: 587,
19
+ auth: {
20
+ user: this.email,
21
+ pass: this.password
22
+ }
23
+ });
24
+ }
25
+
26
+ sendEmail(toEmail: string, subject: string, textHtml: string) {
27
+ let mailOptions = {
28
+ from: this.email,
29
+ to: toEmail,
30
+ subject: subject,
31
+ html: textHtml
32
+ };
33
+
34
+ this.mail.sendMail(mailOptions, (err, info) => {
35
+ if (err) {
36
+ console.log({ error: err });
37
+ }
38
+ console.log('Email sent: ' + info.response);
39
+ });
40
+ }
41
+
42
+ generateOtp(length: number) {
43
+ var chars = '0123456789';
44
+ var result = '';
45
+ for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
46
+ return result;
47
+ };
48
+ };
package/lib/core/Ayiin.js CHANGED
@@ -1,4 +1,4 @@
1
- const nodemailer = require('nodemailer');
1
+ import nodemailer from 'nodemailer';
2
2
 
3
3
 
4
4
  class Ayiin {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ayiin",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Library Pribadi Yang Gak Ada Isinya",
5
5
  "type": "module",
6
6
  "author": "AyiinXd",