@@ -11,112 +11,34 @@ import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree'
1111import  {  handleInput ,  checkMappedFields  }  from  './BuddyBossCommonFunc' 
1212import  BuddyBossAuthorization  from  './BuddyBossAuthorization' 
1313import  BuddyBossIntegLayout  from  './BuddyBossIntegLayout' 
14+ import  { 
15+   ADD_POST_GRP_ACTIVITY_STREAM_PRO , 
16+   ADD_POST_SITE_WIDE_ACTIVITY_STREAM_PRO , 
17+   ADD_POST_USER_ACTIVITY_STREAM_PRO , 
18+   ADD_USER_GROUP , 
19+   CREATE_GROUP_PRO , 
20+   END_FRIENDSHIP_WITH_USER_PRO , 
21+   FOLLOW_USER_PRO , 
22+   isDisabled , 
23+   POST_REPLY_TOPIC_FORUM_PRO , 
24+   POST_TOPIC_FORUM_PRO , 
25+   REMOVE_USER_FROM_GROUP_PRO , 
26+   SEND_FRIENDSHIP_REQ_USER_PRO , 
27+   SEND_NOTIFICATION_MEMBER_GRP_PRO , 
28+   SEND_NOTIFICATION_USER_PRO , 
29+   SEND_PRIVATE_MSG_MEMBER_GRP_PRO , 
30+   SEND_PRIVATE_MSG_USER_PRO , 
31+   SET_USER_STATUS_PRO , 
32+   STOP_FOLLOWING_USER_PRO , 
33+   SUBSCRIBE_USER_FORUM_PRO 
34+ }  from  './IntegrationHelpers' 
1435
1536function  BuddyBoss ( {  formFields,  setFlow,  flow,  allIntegURL,  isInfo,  edit } )  { 
1637  const  navigate  =  useNavigate ( ) 
1738  const  {  formID }  =  useParams ( ) 
1839  const  [ isLoading ,  setIsLoading ]  =  useState ( false ) 
1940  const  [ step ,  setStep ]  =  useState ( 1 ) 
2041  const  [ snack ,  setSnackbar ]  =  useState ( {  show : false  } ) 
21- 
22-   const  allActions  =  [ 
23-     {  key : '1' ,  label : __ ( 'Create Group Pro' ,  'bit-integrations' )  } , 
24-     {  key : '2' ,  label : __ ( 'Add the user to a group' ,  'bit-integrations' )  } , 
25-     {  key : '3' ,  label : __ ( 'End friendship with a user Pro' ,  'bit-integrations' )  } , 
26-     {  key : '4' ,  label : __ ( 'Follow a user Pro' ,  'bit-integrations' )  } , 
27-     {  key : '5' ,  label : __ ( 'Post a topic in a forum Pro' ,  'bit-integrations' )  } , 
28-     {  key : '6' ,  label : __ ( 'Remove user from a group Pro' ,  'bit-integrations' )  } , 
29-     {  key : '7' ,  label : __ ( 'Send a friendship request to a user Pro' ,  'bit-integrations' )  } , 
30-     { 
31-       key : '8' , 
32-       label : __ ( 'Send a notification to all members of a group Pro' ,  'bit-integrations' ) 
33-     } , 
34-     { 
35-       key : '9' , 
36-       label : __ ( 'Send a private message to all members of a group Pro' ,  'bit-integrations' ) 
37-     } , 
38-     {  key : '10' ,  label : __ ( 'Send a private message to a user Pro' ,  'bit-integrations' )  } , 
39-     {  key : '11' ,  label : __ ( 'Send a notification to a user Pro' ,  'bit-integrations' )  } , 
40-     {  key : '12' ,  label : __ ( 'Stop following a user Pro' ,  'bit-integrations' )  } , 
41-     {  key : '13' ,  label : __ ( 'Subscribe the user to a forum Pro' ,  'bit-integrations' )  } , 
42-     { 
43-       key : '14' , 
44-       label : __ ( 'Add a post to the activity stream of a group Pro' ,  'bit-integrations' ) 
45-     } , 
46-     {  key : '15' ,  label : __ ( 'Add a post to the site wide activity stream Pro' ,  'bit-integrations' )  } , 
47-     {  key : '16' ,  label : __ ( "Add a post to the user's activity stream Pro" ,  'bit-integrations' )  } , 
48-     {  key : '17' ,  label : __ ( 'Post a reply to a topic in a forum' ,  'bit-integrations' )  } , 
49-     {  key : '18' ,  label : __ ( "Set the user's status to a specific status" ,  'bit-integrations' )  } 
50-   ] 
51- 
52-   // for action 1 
53-   const  createGroupFields  =  [ 
54-     {  key : 'group_name' ,  label : __ ( 'Group Name' ,  'bit-integrations' ) ,  required : true  } 
55-   ] 
56- 
57-   // for action 5 
58-   const  topicInForumFields  =  [ 
59-     {  key : 'topic_content' ,  label : __ ( 'Topic Content' ,  'bit-integrations' ) ,  required : true  } , 
60-     {  key : 'topic_title' ,  label : __ ( 'Topic Title' ,  'bit-integrations' ) ,  required : false  } 
61-   ] 
62- 
63-   // for action 8 
64- 
65-   const  sendAllUserNotificationFields  =  [ 
66-     { 
67-       key : 'notification_content' , 
68-       label : __ ( 'Notification Content' ,  'bit-integrations' ) , 
69-       required : true 
70-     } , 
71-     { 
72-       key : 'notification_link' , 
73-       label : __ ( 'Notification Link' ,  'bit-integrations' ) , 
74-       required : false 
75-     } 
76-   ] 
77- 
78-   // for action 9 
79-   const  sendAllGroupPrivateMessageFields  =  [ 
80-     {  key : 'message_content' ,  label : __ ( 'Message Content' ,  'bit-integrations' ) ,  required : true  } , 
81-     {  key : 'message_subject' ,  label : __ ( 'Message subject' ,  'bit-integrations' ) ,  required : false  } 
82-   ] 
83- 
84-   // for action 14 
85- 
86-   const  addPostToGroupFields  =  [ 
87-     {  key : 'activity_action' ,  label : __ ( 'activity_action' ,  'bit-integrations' ) ,  required : true  } , 
88-     {  key : 'activity_content' ,  label : __ ( 'activity_content' ,  'bit-integrations' ) ,  required : true  } 
89-   ] 
90- 
91-   // for action 15 
92- 
93-   const  addPostSiteWideActivityStreamFields  =  [ 
94-     {  key : 'activity_action' ,  label : __ ( 'activity_action' ,  'bit-integrations' ) ,  required : false  } , 
95-     { 
96-       key : 'activity_action_link' , 
97-       label : __ ( 'activity_action_link' ,  'bit-integrations' ) , 
98-       required : false 
99-     } , 
100-     {  key : 'activity_content' ,  label : __ ( 'activity_content' ,  'bit-integrations' ) ,  required : true  } 
101-   ] 
102- 
103-   // for action 17 
104-   const  postReplyTopicForumFields  =  [ 
105-     {  key : 'reply_content' ,  label : __ ( 'Reply Content' ,  'bit-integrations' ) ,  required : true  } 
106-   ] 
107- 
108-   const  groupPrivacyOptions  =  [ 
109-     {  key : '1' ,  label : __ ( 'Public' ,  'bit-integrations' )  } , 
110-     {  key : '2' ,  label : __ ( 'Private' ,  'bit-integrations' )  } , 
111-     {  key : '3' ,  label : __ ( 'Hidden' ,  'bit-integrations' )  } 
112-   ] 
113- 
114-   // for action 18 
115-   const  userStatusOptions  =  [ 
116-     {  key : '1' ,  label : __ ( 'Active' ,  'bit-integrations' )  } , 
117-     {  key : '2' ,  label : __ ( 'Suspend' ,  'bit-integrations' )  } 
118-   ] 
119- 
12042  const  [ buddyBossConf ,  setBuddyBossConf ]  =  useState ( { 
12143    name : 'BuddyBoss' , 
12244    type : 'BuddyBoss' , 
@@ -138,10 +60,7 @@ function BuddyBoss({ formFields, setFlow, flow, allIntegURL, isInfo, edit }) {
13860    setTimeout ( ( )  =>  { 
13961      document . getElementById ( 'btcd-settings-wrp' ) . scrollTop  =  0 
14062    } ,  300 ) 
141-     if  ( 
142-       [ '1' ,  '5' ,  '8' ,  '9' ,  '10' ,  '11' ,  '14' ,  '15' ,  '16' ,  '17' ] . includes ( buddyBossConf . mainAction )  && 
143-       ! checkMappedFields ( buddyBossConf ) 
144-     )  { 
63+     if  ( ! checkMappedFields ( buddyBossConf ) )  { 
14564      setSnackbar ( {  show : true ,  msg : __ ( 'Please map fields to continue.' ,  'bit-integrations' )  } ) 
14665      return 
14766    } 
@@ -150,47 +69,6 @@ function BuddyBoss({ formFields, setFlow, flow, allIntegURL, isInfo, edit }) {
15069    } 
15170  } 
15271
153-   function  isDisabled ( )  { 
154-     switch  ( buddyBossConf . mainAction )  { 
155-       case  '1' :
156-         return  buddyBossConf . privacyId  ===  undefined 
157-       case  '2' :
158-         return  buddyBossConf . groupId  ===  undefined 
159-       case  '3' :
160-         return  buddyBossConf . friendId  ===  undefined 
161-       case  '4' :
162-         return  buddyBossConf . friendId  ===  undefined 
163-       case  '5' :
164-         return  buddyBossConf . forumId  ===  undefined 
165-       case  '6' :
166-         return  buddyBossConf . groupId  ===  undefined 
167-       case  '7' :
168-         return  buddyBossConf . friendId  ===  undefined 
169-       case  '8' :
170-         return  buddyBossConf . groupId  ===  undefined  ||  buddyBossConf . friendId  ===  undefined 
171-       case  '9' :
172-         return  buddyBossConf . groupId  ===  undefined  ||  buddyBossConf . friendId  ===  undefined 
173-       case  '10' :
174-         return  buddyBossConf . friendId  ===  undefined 
175-       case  '12' :
176-         return  buddyBossConf . friendId  ===  undefined 
177-       case  '13' :
178-         return  buddyBossConf . forumId  ===  undefined 
179-       case  '14' :
180-         return  buddyBossConf . groupId  ===  undefined  ||  buddyBossConf . friendId  ===  undefined 
181-       case  '15' :
182-         return  buddyBossConf . friendId  ===  undefined 
183-       case  '16' :
184-         return  buddyBossConf . friendId  ===  undefined 
185-       case  '17' :
186-         return  buddyBossConf . topicId  ===  undefined  ||  buddyBossConf . forumId  ===  undefined 
187-       case  '18' :
188-         return  buddyBossConf . userStatusId  ===  undefined 
189-       default :
190-         return  false 
191-     } 
192-   } 
193- 
19472  return  ( 
19573    < div > 
19674      < SnackMsg  snack = { snack }  setSnackbar = { setSnackbar }  /> 
@@ -231,7 +109,12 @@ function BuddyBoss({ formFields, setFlow, flow, allIntegURL, isInfo, edit }) {
231109
232110        < button 
233111          onClick = { ( )  =>  nextPage ( 3 ) } 
234-           disabled = { ! buddyBossConf . mainAction  ||  isLoading  ||  isDisabled ( ) } 
112+           disabled = { 
113+             ! buddyBossConf . mainAction  || 
114+             ! checkMappedFields ( buddyBossConf )  || 
115+             isLoading  || 
116+             isDisabled ( buddyBossConf ) 
117+           } 
235118          className = "btn f-right btcd-btn-lg purple sh-sm flx" 
236119          type = "button" > 
237120          { __ ( 'Next' ,  'bit-integrations' ) } 
@@ -264,3 +147,128 @@ function BuddyBoss({ formFields, setFlow, flow, allIntegURL, isInfo, edit }) {
264147} 
265148
266149export  default  BuddyBoss 
150+ 
151+ const  allActions  =  [ 
152+   {  key : CREATE_GROUP_PRO ,  label : __ ( 'Create Group Pro' ,  'bit-integrations' )  } , 
153+   {  key : ADD_USER_GROUP ,  label : __ ( 'Add the user to a group' ,  'bit-integrations' )  } , 
154+   { 
155+     key : END_FRIENDSHIP_WITH_USER_PRO , 
156+     label : __ ( 'End friendship with a user Pro' ,  'bit-integrations' ) 
157+   } , 
158+   {  key : FOLLOW_USER_PRO ,  label : __ ( 'Follow a user Pro' ,  'bit-integrations' )  } , 
159+   {  key : POST_TOPIC_FORUM_PRO ,  label : __ ( 'Post a topic in a forum Pro' ,  'bit-integrations' )  } , 
160+   {  key : REMOVE_USER_FROM_GROUP_PRO ,  label : __ ( 'Remove user from a group Pro' ,  'bit-integrations' )  } , 
161+   { 
162+     key : SEND_FRIENDSHIP_REQ_USER_PRO , 
163+     label : __ ( 'Send a friendship request to a user Pro' ,  'bit-integrations' ) 
164+   } , 
165+   { 
166+     key : SEND_NOTIFICATION_MEMBER_GRP_PRO , 
167+     label : __ ( 'Send a notification to all members of a group Pro' ,  'bit-integrations' ) 
168+   } , 
169+   { 
170+     key : SEND_PRIVATE_MSG_MEMBER_GRP_PRO , 
171+     label : __ ( 'Send a private message to all members of a group Pro' ,  'bit-integrations' ) 
172+   } , 
173+   { 
174+     key : SEND_PRIVATE_MSG_USER_PRO , 
175+     label : __ ( 'Send a private message to a user Pro' ,  'bit-integrations' ) 
176+   } , 
177+   { 
178+     key : SEND_NOTIFICATION_USER_PRO , 
179+     label : __ ( 'Send a notification to a user Pro' ,  'bit-integrations' ) 
180+   } , 
181+   {  key : STOP_FOLLOWING_USER_PRO ,  label : __ ( 'Stop following a user Pro' ,  'bit-integrations' )  } , 
182+   { 
183+     key : SUBSCRIBE_USER_FORUM_PRO , 
184+     label : __ ( 'Subscribe the user to a forum Pro' ,  'bit-integrations' ) 
185+   } , 
186+   { 
187+     key : ADD_POST_GRP_ACTIVITY_STREAM_PRO , 
188+     label : __ ( 'Add a post to the activity stream of a group Pro' ,  'bit-integrations' ) 
189+   } , 
190+   { 
191+     key : ADD_POST_SITE_WIDE_ACTIVITY_STREAM_PRO , 
192+     label : __ ( 'Add a post to the site wide activity stream Pro' ,  'bit-integrations' ) 
193+   } , 
194+   { 
195+     key : ADD_POST_USER_ACTIVITY_STREAM_PRO , 
196+     label : __ ( "Add a post to the user's activity stream Pro" ,  'bit-integrations' ) 
197+   } , 
198+   { 
199+     key : POST_REPLY_TOPIC_FORUM_PRO , 
200+     label : __ ( 'Post a reply to a topic in a forum' ,  'bit-integrations' ) 
201+   } , 
202+   { 
203+     key : SET_USER_STATUS_PRO , 
204+     label : __ ( "Set the user's status to a specific status" ,  'bit-integrations' ) 
205+   } 
206+ ] 
207+ 
208+ // for action 1 
209+ const  createGroupFields  =  [ 
210+   {  key : 'group_name' ,  label : __ ( 'Group Name' ,  'bit-integrations' ) ,  required : true  } 
211+ ] 
212+ 
213+ // for action 5 
214+ const  topicInForumFields  =  [ 
215+   {  key : 'topic_content' ,  label : __ ( 'Topic Content' ,  'bit-integrations' ) ,  required : true  } , 
216+   {  key : 'topic_title' ,  label : __ ( 'Topic Title' ,  'bit-integrations' ) ,  required : false  } 
217+ ] 
218+ 
219+ // for action 8 
220+ 
221+ const  sendAllUserNotificationFields  =  [ 
222+   { 
223+     key : 'notification_content' , 
224+     label : __ ( 'Notification Content' ,  'bit-integrations' ) , 
225+     required : true 
226+   } , 
227+   { 
228+     key : 'notification_link' , 
229+     label : __ ( 'Notification Link' ,  'bit-integrations' ) , 
230+     required : false 
231+   } 
232+ ] 
233+ 
234+ // for action 9 
235+ const  sendAllGroupPrivateMessageFields  =  [ 
236+   {  key : 'message_content' ,  label : __ ( 'Message Content' ,  'bit-integrations' ) ,  required : true  } , 
237+   {  key : 'message_subject' ,  label : __ ( 'Message subject' ,  'bit-integrations' ) ,  required : false  } 
238+ ] 
239+ 
240+ // for action 14 
241+ 
242+ const  addPostToGroupFields  =  [ 
243+   {  key : 'activity_action' ,  label : __ ( 'activity_action' ,  'bit-integrations' ) ,  required : true  } , 
244+   {  key : 'activity_content' ,  label : __ ( 'activity_content' ,  'bit-integrations' ) ,  required : true  } 
245+ ] 
246+ 
247+ // for action 15 
248+ 
249+ const  addPostSiteWideActivityStreamFields  =  [ 
250+   {  key : 'activity_action' ,  label : __ ( 'activity_action' ,  'bit-integrations' ) ,  required : false  } , 
251+   { 
252+     key : 'activity_action_link' , 
253+     label : __ ( 'activity_action_link' ,  'bit-integrations' ) , 
254+     required : false 
255+   } , 
256+   {  key : 'activity_content' ,  label : __ ( 'activity_content' ,  'bit-integrations' ) ,  required : true  } 
257+ ] 
258+ 
259+ // for action 17 
260+ const  postReplyTopicForumFields  =  [ 
261+   {  key : 'reply_content' ,  label : __ ( 'Reply Content' ,  'bit-integrations' ) ,  required : true  } 
262+ ] 
263+ 
264+ const  groupPrivacyOptions  =  [ 
265+   {  key : '1' ,  label : __ ( 'Public' ,  'bit-integrations' )  } , 
266+   {  key : '2' ,  label : __ ( 'Private' ,  'bit-integrations' )  } , 
267+   {  key : '3' ,  label : __ ( 'Hidden' ,  'bit-integrations' )  } 
268+ ] 
269+ 
270+ // for action 18 
271+ const  userStatusOptions  =  [ 
272+   {  key : '1' ,  label : __ ( 'Active' ,  'bit-integrations' )  } , 
273+   {  key : '2' ,  label : __ ( 'Suspend' ,  'bit-integrations' )  } 
274+ ] 
0 commit comments