@@ -8,19 +8,55 @@ import { sendToPlain } from "~/utils/plain.server";
88
99let client : PlainClient | undefined ;
1010
11- export const feedbackTypeLabel = {
12- bug : "Bug report" ,
13- feature : "Feature request" ,
14- help : "Help me out" ,
15- enterprise : "Enterprise enquiry" ,
16- feedback : "General feedback" ,
17- concurrency : "Increase my concurrency" ,
18- region : "Suggest a new region" ,
19- } ;
11+ export const feedbackTypes = {
12+ bug : {
13+ label : "Bug report" ,
14+ labelTypeId : "lt_01HB920BTPFS36KH1JT9C36YVY" ,
15+ threadTitle : "Contact form: Bug report" ,
16+ } ,
17+ feature : {
18+ label : "Feature request" ,
19+ labelTypeId : "lt_01HB920BV8CJGYXVE15WWN6P07" ,
20+ threadTitle : "Contact form: Feature request" ,
21+ } ,
22+ help : {
23+ label : "Help me out" ,
24+ labelTypeId : undefined ,
25+ threadTitle : "Contact form: Help me out" ,
26+ } ,
27+ enterprise : {
28+ label : "Enterprise enquiry" ,
29+ labelTypeId : "lt_01K7PF5EV2877EH4SZYB667FW4" ,
30+ threadTitle : "Contact form: Enterprise enquiry" ,
31+ } ,
32+ feedback : {
33+ label : "General feedback" ,
34+ labelTypeId : "lt_01HB920BT61HB7T776BCK4GC7X" ,
35+ threadTitle : "Contact form: General feedback" ,
36+ } ,
37+ concurrency : {
38+ label : "Increase my concurrency" ,
39+ labelTypeId : undefined ,
40+ threadTitle : "Contact form: Increase my concurrency" ,
41+ } ,
42+ region : {
43+ label : "Suggest a new region" ,
44+ labelTypeId : undefined ,
45+ threadTitle : "Contact form: Suggest a new region" ,
46+ } ,
47+ hipaa : {
48+ label : "HIPAA BAA request" ,
49+ labelTypeId : "lt_01KS54WBRYKE6DY369KPK2SS4W" ,
50+ threadTitle : "Contact form: HIPAA BAA request" ,
51+ } ,
52+ } as const satisfies Record <
53+ string ,
54+ { label : string ; labelTypeId ?: string ; threadTitle : string }
55+ > ;
2056
21- export type FeedbackType = keyof typeof feedbackTypeLabel ;
57+ export type FeedbackType = keyof typeof feedbackTypes ;
2258
23- const feedbackTypeLiterals = Object . keys ( feedbackTypeLabel ) . map ( ( key ) => z . literal ( key ) ) ;
59+ const feedbackTypeLiterals = Object . keys ( feedbackTypes ) . map ( ( key ) => z . literal ( key ) ) ;
2460
2561const feedbackType = z . union (
2662 [ feedbackTypeLiterals [ 0 ] , feedbackTypeLiterals [ 1 ] , ...feedbackTypeLiterals . slice ( 2 ) ] ,
@@ -46,16 +82,17 @@ export async function action({ request }: ActionFunctionArgs) {
4682 return json ( submission ) ;
4783 }
4884
49- const title = feedbackTypeLabel [ submission . value . feedbackType as FeedbackType ] ;
85+ const inquiry = feedbackTypes [ submission . value . feedbackType as FeedbackType ] ;
5086 try {
5187 await sendToPlain ( {
5288 userId : user . id ,
5389 email : user . email ,
5490 name : user . name ?? user . displayName ?? user . email ,
55- title,
91+ title : inquiry . threadTitle ,
92+ labelTypeIds : inquiry . labelTypeId ? [ inquiry . labelTypeId ] : undefined ,
5693 components : [
5794 uiComponent . text ( {
58- text : `New ${ title } reported by ${ user . name } (${ user . email } )` ,
95+ text : `New ${ inquiry . label } reported by ${ user . name } (${ user . email } )` ,
5996 } ) ,
6097 uiComponent . divider ( { spacingSize : "M" } ) ,
6198 uiComponent . text ( {
0 commit comments