@@ -5,7 +5,6 @@ import { RadioGroup } from "@radix-ui/react-radio-group";
55import type { ActionFunction , LoaderFunctionArgs } from "@remix-run/node" ;
66import { json , redirect } from "@remix-run/node" ;
77import { Form , useActionData , useNavigation } from "@remix-run/react" ;
8- import { uiComponent } from "@team-plain/typescript-sdk" ;
98import { typedjson , useTypedLoaderData } from "remix-typedjson" ;
109import { z } from "zod" ;
1110import { MainCenteredContainer } from "~/components/layout/AppLayout" ;
@@ -23,10 +22,9 @@ import { TextArea } from "~/components/primitives/TextArea";
2322import { useFeatures } from "~/hooks/useFeatures" ;
2423import { createOrganization } from "~/models/organization.server" ;
2524import { NewOrganizationPresenter } from "~/presenters/NewOrganizationPresenter.server" ;
26- import { logger } from "~/services/logger.server" ;
2725import { requireUser , requireUserId } from "~/services/session.server" ;
26+ import { sendNewOrgMessage } from "~/services/slack.server" ;
2827import { organizationPath , rootPath } from "~/utils/pathBuilder" ;
29- import { sendToPlain } from "~/utils/plain.server" ;
3028
3129const schema = z . object ( {
3230 orgName : z . string ( ) . min ( 3 ) . max ( 50 ) ,
@@ -63,32 +61,11 @@ export const action: ActionFunction = async ({ request }) => {
6361 const whyUseUs = formData . get ( "whyUseUs" ) ;
6462
6563 if ( whyUseUs ) {
66- try {
67- await sendToPlain ( {
68- userId : user . id ,
69- email : user . email ,
70- name : user . name ?? user . displayName ?? user . email ,
71- title : "New org feedback" ,
72- components : [
73- uiComponent . text ( {
74- text : `${ submission . value . orgName } just created a new organization.` ,
75- } ) ,
76- uiComponent . divider ( { spacingSize : "M" } ) ,
77- uiComponent . text ( {
78- size : "L" ,
79- color : "NORMAL" ,
80- text : "What problem are you trying to solve?" ,
81- } ) ,
82- uiComponent . text ( {
83- size : "L" ,
84- color : "NORMAL" ,
85- text : whyUseUs . toString ( ) ,
86- } ) ,
87- ] ,
88- } ) ;
89- } catch ( error ) {
90- logger . error ( "Error sending data to Plain when creating an org:" , { error } ) ;
91- }
64+ await sendNewOrgMessage ( {
65+ orgName : submission . value . orgName ,
66+ whyUseUs : whyUseUs . toString ( ) ,
67+ userEmail : user . email ,
68+ } ) ;
9269 }
9370
9471 return redirect ( organizationPath ( organization ) ) ;
0 commit comments