93b4715967
## Summary HIPAA BAA is offered as a paid add-on on every paid plan. Each paid tier on the in-app pricing card now has a "HIPAA BAA add-on" row with a "Request a BAA" link that opens the existing contact dialog pre-filled with a new `hipaa` inquiry type, prompting the user for their company name and a brief description of the PHI workload. The contact form's `feedbackTypes` are restructured to match the marketing /contact form: every inquiry type carries a Plain label ID and a "Contact form: ..." thread title, so threads land in Plain identically whether they come from the dashboard or the marketing site. The included-compute line on each tier also picks up the credits wording from the marketing pricing page, and the Enterprise tier lifts its title above the features row.
69 lines
1.4 KiB
TypeScript
69 lines
1.4 KiB
TypeScript
import { PlainClient, uiComponent } from "@team-plain/typescript-sdk";
|
|
import { env } from "~/env.server";
|
|
|
|
type Input = {
|
|
userId: string;
|
|
email: string;
|
|
name: string;
|
|
title: string;
|
|
components: ReturnType<typeof uiComponent.text>[];
|
|
labelTypeIds?: string[];
|
|
};
|
|
|
|
export async function sendToPlain({
|
|
userId,
|
|
email,
|
|
name,
|
|
title,
|
|
components,
|
|
labelTypeIds,
|
|
}: Input) {
|
|
if (!env.PLAIN_API_KEY) {
|
|
return;
|
|
}
|
|
|
|
const client = new PlainClient({
|
|
apiKey: env.PLAIN_API_KEY,
|
|
});
|
|
|
|
const upsertCustomerRes = await client.upsertCustomer({
|
|
identifier: {
|
|
emailAddress: email,
|
|
},
|
|
onCreate: {
|
|
externalId: userId,
|
|
fullName: name,
|
|
email: {
|
|
email: email,
|
|
isVerified: true,
|
|
},
|
|
},
|
|
onUpdate: {
|
|
externalId: { value: userId },
|
|
fullName: { value: name },
|
|
email: {
|
|
email: email,
|
|
isVerified: true,
|
|
},
|
|
},
|
|
});
|
|
|
|
if (upsertCustomerRes.error) {
|
|
console.error("Failed to upsert customer in Plain", upsertCustomerRes.error);
|
|
return;
|
|
}
|
|
|
|
const createThreadRes = await client.createThread({
|
|
customerIdentifier: {
|
|
customerId: upsertCustomerRes.data.customer.id,
|
|
},
|
|
title: title,
|
|
components: components,
|
|
labelTypeIds,
|
|
});
|
|
|
|
if (createThreadRes.error) {
|
|
console.error("Failed to create thread in Plain", createThreadRes.error);
|
|
}
|
|
}
|