@@ -5,7 +5,6 @@ import { RadioGroup } from "@radix-ui/react-radio-group";
5
5
import type { ActionFunction , LoaderFunctionArgs } from "@remix-run/node" ;
6
6
import { json , redirect } from "@remix-run/node" ;
7
7
import { Form , useActionData , useNavigation } from "@remix-run/react" ;
8
- import { uiComponent } from "@team-plain/typescript-sdk" ;
9
8
import { typedjson , useTypedLoaderData } from "remix-typedjson" ;
10
9
import { z } from "zod" ;
11
10
import { MainCenteredContainer } from "~/components/layout/AppLayout" ;
@@ -23,10 +22,9 @@ import { TextArea } from "~/components/primitives/TextArea";
23
22
import { useFeatures } from "~/hooks/useFeatures" ;
24
23
import { createOrganization } from "~/models/organization.server" ;
25
24
import { NewOrganizationPresenter } from "~/presenters/NewOrganizationPresenter.server" ;
26
- import { logger } from "~/services/logger.server" ;
27
25
import { requireUser , requireUserId } from "~/services/session.server" ;
26
+ import { sendNewOrgMessage } from "~/services/slack.server" ;
28
27
import { organizationPath , rootPath } from "~/utils/pathBuilder" ;
29
- import { sendToPlain } from "~/utils/plain.server" ;
30
28
31
29
const schema = z . object ( {
32
30
orgName : z . string ( ) . min ( 3 ) . max ( 50 ) ,
@@ -63,32 +61,11 @@ export const action: ActionFunction = async ({ request }) => {
63
61
const whyUseUs = formData . get ( "whyUseUs" ) ;
64
62
65
63
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
+ } ) ;
92
69
}
93
70
94
71
return redirect ( organizationPath ( organization ) ) ;
0 commit comments