send creator guide on D1

This commit is contained in:
mantikoros 2022-08-20 15:34:22 -05:00
parent ef127ea335
commit c6dc852cd8
4 changed files with 230 additions and 258 deletions

View File

@ -103,82 +103,7 @@
</head> </head>
<body style="word-spacing: normal; background-color: #f4f4f4"> <body style="word-spacing: normal; background-color: #f4f4f4">
<div style="background-color: #f4f4f4">
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="
background: #ffffff;
background-color: #ffffff;
margin: 0px auto;
max-width: 600px;
">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
style="background: #ffffff; background-color: #ffffff; width: 100%">
<tbody>
<tr>
<td style="
direction: ltr;
font-size: 0px;
padding: 0px 0px 0px 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
text-align: center;
">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix" style="
font-size: 0px;
text-align: left;
direction: ltr;
display: inline-block;
vertical-align: top;
width: 100%;
">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align: top"
width="100%">
<tbody>
<tr>
<td align="center" style="
font-size: 0px;
padding: 0px 25px 0px 25px;
padding-top: 0px;
padding-right: 25px;
padding-bottom: 0px;
padding-left: 25px;
word-break: break-word;
">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="
border-collapse: collapse;
border-spacing: 0px;
">
<tbody>
<tr>
<td style="width: 550px">
<a href="https://manifold.markets/home" target="_blank"><img alt="" height="auto"
src="https://03jlj.mjt.lu/img/03jlj/b/96u/omk8.gif" style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: auto;
width: 100%;
font-size: 13px;
" width="550" /></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style=" <div style="
background: #ffffff; background: #ffffff;
@ -189,6 +114,15 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
style="background: #ffffff; background-color: #ffffff; width: 100%"> style="background: #ffffff; background-color: #ffffff; width: 100%">
<tbody> <tbody>
<tr>
<td style="width:550px;">
<a href="https://manifold.markets" target="_blank">
<img alt="banner logo" height="auto" src="https://manifold.markets/logo-banner.png"
style="border:none;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;"
title="" width="550">
</a>
</td>
</tr>
<tr> <tr>
<td style=" <td style="
direction: ltr; direction: ltr;
@ -252,25 +186,55 @@
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
">Congrats on creating your first market on <a class="link-build-content" ">Did you know you create your own prediction market on <a class="link-build-content"
style="color: #55575d" target="_blank" style="color: #55575d" target="_blank" href="https://manifold.markets">Manifold</a> for
href="https://manifold.markets">Manifold</a>!</span> any question you care about?</span>
</p> </p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" <p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
<span style="
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 17px;
">Whether it's current events like <a class="link-build-content" style="color: #55575d"
target="_blank"
href="https://manifold.markets/SG/will-elon-musk-buy-twitter-this-yea">Musk buying
Twitter</a> or <a class="link-build-content" style="color: #55575d" target="_blank"
href="https://manifold.markets/NathanpmYoung/will-biden-be-the-2024-democratic-n">2024
elections</a> or personal matters
like <a class="link-build-content" style="color: #55575d" target="_blank"
href="https://manifold.markets/dreev/which-book-will-i-like-best">book
recommendations</a> or <a class="link-build-content" style="color: #55575d"
target="_blank"
href="https://manifold.markets/agentydragon/will-my-weight-go-under-115-kg-in-2">losing
weight</a>,
Manifold can help you find the answer.</span>
</p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0;margin-bottom: 20px;"
data-testid="3Q8BP69fq"> data-testid="3Q8BP69fq">
<span style=" <span style="
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
">The following is a short guide to creating markets.</span> ">The following is a
short guide to creating markets.</span>
</p> </p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0"
data-testid="3Q8BP69fq"> <table cellspacing="0" cellpadding="0" align="center">
<tr>
<td style="border-radius: 4px;" bgcolor="#4337c9">
<a href="https://manifold.markets/create" target="_blank"
style="padding: 12px 16px; border: 1px solid #4337c9;border-radius: 16px;font-family: Helvetica, Arial, sans-serif;font-size: 24px; color: #ffffff;text-decoration: none;font-weight:semibold;display: inline-block;">
Create a market
</a>
</td>
</tr>
</table>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
&nbsp; &nbsp;
</p> </p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" <p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
data-testid="3Q8BP69fq">
<span style=" <span style="
color: #292fd7; color: #292fd7;
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
@ -313,7 +277,7 @@
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
"><b>Add it to a group. </b>Groups are the "><b>Part of a group. </b>Groups are the
primary way users filter for relevant markets. primary way users filter for relevant markets.
Also, consider making your own groups and Also, consider making your own groups and
inviting friends/interested communities to inviting friends/interested communities to
@ -324,7 +288,7 @@
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
"><b>Share it on social media</b>. You'll earn the <a class="link-build-content" "><b>Sharing it on social media</b>. You'll earn the <a class="link-build-content"
style="color: inherit; text-decoration: none" target="_blank" style="color: inherit; text-decoration: none" target="_blank"
href="https://manifold.markets/referrals"><span style=" href="https://manifold.markets/referrals"><span style="
color: #55575d; color: #55575d;
@ -335,85 +299,34 @@
referral bonus</u></span></a> if you get new users to sign up!</span> referral bonus</u></span></a> if you get new users to sign up!</span>
</li> </li>
</ul> </ul>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" <p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
data-testid="3Q8BP69fq">
&nbsp; &nbsp;
</p> </p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0"
data-testid="3Q8BP69fq"> <p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
<span style="
color: #292fd7;
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 20px;
"><b>Examples of markets you should
emulate!&nbsp;</b></span>
</p>
<ul>
<li style="line-height: 23px">
<a class="link-build-content" style="color: inherit; text-decoration: none"
target="_blank"
href="https://manifold.markets/DavidChee/will-our-upcoming-twitch-bot-be-a-s"><span
style="
color: #55575d;
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 17px;
"><u>This complex market</u></span></a><span style="
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 17px;
">
about the project I am working on.</span>
</li>
<li style="line-height: 23px">
<a class="link-build-content" style="color: inherit; text-decoration: none"
target="_blank"
href="https://manifold.markets/SneakySly/will-manifold-reach-1000-weekly-act"><span
style="
color: #55575d;
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 17px;
"><u>This simple market</u></span></a><span style="
font-family: Readex Pro, Arial, Helvetica,
sans-serif;
font-size: 17px;
">
about Manifold&apos;s weekly active
users.</span>
</li>
</ul>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0"
data-testid="3Q8BP69fq">
&nbsp;
</p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0"
data-testid="3Q8BP69fq">
<span style=" <span style="
color: #000000; color: #000000;
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
">Why not </span> ">Why not </span>
<a class="link-build-content" style="color: inherit; text-decoration: none" target="_blank" <a class="link-build-content" style="color: inherit; text-decoration: none" target="_blank"
href="https://manifold.markets/create"><span style=" href="https://manifold.markets/create"><span style="
color: #55575d; color: #55575d;
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
"><u>create another market</u></span></a><span style=" "><u>create a market</u></span></a><span style="
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
sans-serif; sans-serif;
font-size: 17px; font-size: 17px;
"> ">
while it is still fresh on your mind? while it is still fresh on your mind?
</p> </p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" <p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
data-testid="3Q8BP69fq"> &nbsp;
</p>
<p class="text-build-content" style="line-height: 23px; margin: 10px 0" data-testid="3Q8BP69fq">
<span style=" <span style="
color: #000000; color: #000000;
font-family: Readex Pro, Arial, Helvetica, font-family: Readex Pro, Arial, Helvetica,
@ -445,6 +358,83 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div style="background-color: #f4f4f4">
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" bgcolor="#ffffff" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="
background: #ffffff;
background-color: #ffffff;
margin: 0px auto;
max-width: 600px;
">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
style="background: #ffffff; background-color: #ffffff; width: 100%">
<tbody>
<tr>
<td style="
direction: ltr;
font-size: 0px;
padding: 0px 0px 0px 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
text-align: center;
">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix" style="
font-size: 0px;
text-align: left;
direction: ltr;
display: inline-block;
vertical-align: top;
width: 100%;
">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align: top"
width="100%">
<tbody>
<tr>
<td align="center" style="
font-size: 0px;
padding: 0px 25px 0px 25px;
padding-top: 0px;
padding-right: 25px;
padding-bottom: 0px;
padding-left: 25px;
word-break: break-word;
">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="
border-collapse: collapse;
border-spacing: 0px;
">
<tbody>
<tr>
<td style="width: 550px">
<a href="https://manifold.markets/create" target="_blank"><img alt="" height="auto"
src="https://03jlj.mjt.lu/img/03jlj/b/96u/omk8.gif" style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: auto;
width: 100%;
font-size: 13px;
" width="550" /></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]--> <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin: 0px auto; max-width: 600px"> <div style="margin: 0px auto; max-width: 600px">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width: 100%"> <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width: 100%">

View File

@ -1,4 +1,3 @@
import { DOMAIN } from '../../common/envs/constants' import { DOMAIN } from '../../common/envs/constants'
import { Answer } from '../../common/answer' import { Answer } from '../../common/answer'
import { Bet } from '../../common/bet' import { Bet } from '../../common/bet'
@ -192,7 +191,6 @@ Cofounder of Manifold Markets
https://manifold.markets https://manifold.markets
` `
await sendTextEmail( await sendTextEmail(
privateUser.email, privateUser.email,
'How are you finding Manifold?', 'How are you finding Manifold?',
@ -238,7 +236,8 @@ export const sendOneWeekBonusEmail = async (
export const sendCreatorGuideEmail = async ( export const sendCreatorGuideEmail = async (
user: User, user: User,
privateUser: PrivateUser privateUser: PrivateUser,
sendTime: string
) => { ) => {
if ( if (
!privateUser || !privateUser ||
@ -255,7 +254,7 @@ export const sendCreatorGuideEmail = async (
return await sendTemplateEmail( return await sendTemplateEmail(
privateUser.email, privateUser.email,
'Market creation guide', 'Create your own prediction market',
'creating-market', 'creating-market',
{ {
name: firstName, name: firstName,
@ -263,6 +262,7 @@ export const sendCreatorGuideEmail = async (
}, },
{ {
from: 'David from Manifold <david@manifold.markets>', from: 'David from Manifold <david@manifold.markets>',
'o:deliverytime': sendTime,
} }
) )
} }

View File

@ -1,13 +1,10 @@
import * as functions from 'firebase-functions' import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { getPrivateUser, getUser } from './utils' import { getUser } from './utils'
import { createNotification } from './create-notification' import { createNotification } from './create-notification'
import { Contract } from '../../common/contract' import { Contract } from '../../common/contract'
import { parseMentions, richTextToString } from '../../common/util/parse' import { parseMentions, richTextToString } from '../../common/util/parse'
import { JSONContent } from '@tiptap/core' import { JSONContent } from '@tiptap/core'
import { User } from 'common/user'
import { sendCreatorGuideEmail } from './emails'
export const onCreateContract = functions export const onCreateContract = functions
.runWith({ secrets: ['MAILGUN_KEY'] }) .runWith({ secrets: ['MAILGUN_KEY'] })
@ -31,23 +28,4 @@ export const onCreateContract = functions
richTextToString(desc), richTextToString(desc),
{ contract, recipients: mentioned } { contract, recipients: mentioned }
) )
await sendGuideEmail(contractCreator)
}) })
const firestore = admin.firestore()
const sendGuideEmail = async (contractCreator: User) => {
const query = await firestore
.collection(`contracts`)
.where('creatorId', '==', contractCreator.id)
.limit(2)
.get()
if (query.size >= 2) return
const privateUser = await getPrivateUser(contractCreator.id)
if (!privateUser) return
await sendCreatorGuideEmail(contractCreator, privateUser)
}

View File

@ -6,6 +6,7 @@ dayjs.extend(utc)
import { getPrivateUser } from './utils' import { getPrivateUser } from './utils'
import { User } from 'common/user' import { User } from 'common/user'
import { import {
sendCreatorGuideEmail,
sendInterestingMarketsEmail, sendInterestingMarketsEmail,
sendPersonalFollowupEmail, sendPersonalFollowupEmail,
sendWelcomeEmail, sendWelcomeEmail,
@ -22,6 +23,9 @@ export const onCreateUser = functions
await sendWelcomeEmail(user, privateUser) await sendWelcomeEmail(user, privateUser)
const guideSendTime = dayjs().add(28, 'hours').toString()
await sendCreatorGuideEmail(user, privateUser, guideSendTime)
const followupSendTime = dayjs().add(48, 'hours').toString() const followupSendTime = dayjs().add(48, 'hours').toString()
await sendPersonalFollowupEmail(user, privateUser, followupSendTime) await sendPersonalFollowupEmail(user, privateUser, followupSendTime)