@newageerp/node-contactform
v1.0.3
Published
## install ```bash npm i @newageerp/node-contactform ```
Downloads
102
Readme
Contact form implementation
install
npm i @newageerp/node-contactform
ENV
AMQP_MAIN_QUEUE=
SUPPORT_EMAIL=
REVIEW_EMAIL=
values for .env
AMQP_MAIN_QUEUE=internal.crm.main
SUPPORT_EMAIL= you can use yoyr email for testing
values for .env.stg
AMQP_MAIN_QUEUE=internal.crm.main
[email protected]
[email protected]
values for .env.prod
AMQP_MAIN_QUEUE= biofema.crm.main | mellow.crm.main | parenting.crm.main | today.crm.main | wingman.crm.main
SUPPORT_EMAIL=hello@ place here production domain ([email protected], [email protected] ...)
REVIEW_EMAIL= klausti PM
Middleware
import { contactFormNextSrv } from '@newageerp/node-contactform'
export async function middleware(req: NextRequest) {
...
const contactFormResp = await contactFormNextSrv.checkForRoutes(req)
if (contactFormResp) {
return contactFormResp
}
}
Browser
Cancel form request
Send cancel request to db.
When refactoring, replace request to /api/cancel-request with this and remove /api/cancel-request/route.ts file
await contactFormBrowser.sendCancelRequest({
email: decodeURIComponent(email),
topic1,
topic2,
description,
action,
})
Contact form request
Send contact form data to support email
When refactoring, replace request to /api/contactform with this and remove /api/contactform/route.ts file
await contactFormBrowser.sendContactForm({
from,
subject,
body,
});
Review form request
Send review form data to review email
await contactFormBrowser.sendReviewForm({
from,
subject,
body,
});