invite.js 3.77 KB
import { Email } from 'meteor/email'
import {moment} from 'meteor/momentjs:moment'
moment.locale('en-au');

export const sendInviteEmail = ({email, firstName, orgName, token}) => {
  const url = Meteor.absoluteUrl(`invite/${token}`);
  const text = `
Hello, ${firstName}!

You have been invited to join the ${orgName} on Blok8 wallet.
To join, use the following link:

${url}
`;

  Email.send({
    from:     'YoungDesk <support@youngdesk.com>',
    to:       email,
    subject:  `[YoungDesk] Invitation`,
    text:     text,
  });

};

export const sendChangeSharePriceEmail = ({orgName, firstName, lastName, price, email}) => {
  const text = `
Hi ${firstName},

The current share price has been changed to $A${price} for the company ${orgName}.
`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] Share price has changed for ${orgName}.`,
    text:     text,
  });

};

export const sendChangeNameEmail = ({firstName, lastName, email}) => {

  console.log(firstName);
  console.log(lastName);
  console.log(email);
  const text = `
Hi ${firstName},

Your name has been changed to "${firstName} ${lastName}".

If you did not change your name, please reset your password.
`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] - Name Change`,
    text:     text,
  });

};

export const sendChangePasswordEmail = ({firstName, lastName, email}) => {

  console.log(firstName);
  console.log(lastName);
  console.log(email);
  let date = moment().format('LLL');
  const text = `
Hi ${firstName},

Your password was recently changed on ${date}.

If you did not change your password, please reset your password immediately.
`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] - Password Change`,
    text:     text,
  });

};

export const sendChangeEmail = ({firstName, lastName, email, newEmail}) => {

  console.log(firstName);
  console.log(lastName);
  console.log(email);
  let date = moment().format('LLL');
  const text = `
Hi ${firstName},

Your email address  was recently changed on ${newEmail} on ${date}.

If you did not change your email address, please contact us immediately by responding to this email.
`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] - Email Change`,
    text:     text,
  });

};


export const sendIssueSharesEmail = ({orgName, firstName, lastName, quantity, purchasePrice, shareClass,email}) => {
  console.log(quantity);
  console.log(purchasePrice);
  console.log(shareClass);
  console.log(email);
  const text = `
Hi ${firstName},

${quantity} ${shareClass} shares in ${orgName} have been issued to you for A$${purchasePrice} in total.

`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] New shares have been issued to you in ${orgName}.`,
    text:     text,
  });

};

export const sendNewAnnouncementsEmail = ({orgId, orgName, createdByUser, title, description, uniqueUrl, firstName, lastName, email}) => {
  const text = `
Hi ${firstName},

A new announcement has been issued by the company secretary!

Title: ${title}.

`;

  Email.send({
    from:     'Blok 8 <support@youngdesk.com>',
    to:       email,
    subject:  `[Blok8] ${orgName} - New Announcement`,
    text:     text,
  });

};


export const sendIssueDividendsEmail = ({ orgId, orgName, dividend, firstName, lastName, email }) => {
  const text = `
Hi ${firstName}!

A new dividend has been issued at $A${dividend} per ordinary share for the company "${orgName}".

`;

  Email.send({
    from:     'Blok 8 <support@mystake.io>',
    to:       email,
    subject:  `[Blok8] A new dividend has been issued by ${orgName}`,
    text:     text,
  });

};