@@ -127,6 +127,8 @@ type State = {
127127 inviteePermissionLevel : string ,
128128 isConfirmModalOpen : boolean ,
129129 isEmailLinkSectionExpanded : boolean ,
130+ isExternalUserInEmailSharedLinkContacts : boolean ,
131+ isExternalUserIninviteCollabsContacts : boolean ,
130132 isFetching : boolean ,
131133 isInviteSectionExpanded : boolean ,
132134 sharedLinkLoaded : boolean ,
@@ -157,6 +159,8 @@ class UnifiedShareModal extends React.Component<Props, State> {
157159 inviteePermissionLevel : '' ,
158160 isConfirmModalOpen : false ,
159161 isEmailLinkSectionExpanded : false ,
162+ isExternalUserInEmailSharedLinkContacts : false ,
163+ isExternalUserIninviteCollabsContacts : false ,
160164 isFetching : true ,
161165 isInviteSectionExpanded : false ,
162166 showCollaboratorList : false ,
@@ -367,16 +371,28 @@ class UnifiedShareModal extends React.Component<Props, State> {
367371 this . setState ( { isEmailLinkSectionExpanded : false } ) ;
368372 } ;
369373
374+ hasExternalContact = ( contacts : Array < Contact > ) => {
375+ return contacts . some ( contact => contact . isExternalUser ) ;
376+ } ;
377+
370378 updateInviteCollabsContacts = ( inviteCollabsContacts : Array < Contact > ) => {
371379 const { setUpdatedContacts } = this . props ;
372- this . setState ( { inviteCollabsContacts } ) ;
380+ const hasExternalContact = this . hasExternalContact ( inviteCollabsContacts ) ;
381+ this . setState ( {
382+ inviteCollabsContacts,
383+ isExternalUserIninviteCollabsContacts : hasExternalContact ,
384+ } ) ;
373385 if ( setUpdatedContacts ) {
374386 setUpdatedContacts ( inviteCollabsContacts ) ;
375387 }
376388 } ;
377389
378390 updateEmailSharedLinkContacts = ( emailSharedLinkContacts : Array < Contact > ) => {
379- this . setState ( { emailSharedLinkContacts } ) ;
391+ const hasExternalContact = this . hasExternalContact ( emailSharedLinkContacts ) ;
392+ this . setState ( {
393+ emailSharedLinkContacts,
394+ isExternalUserInEmailSharedLinkContacts : hasExternalContact ,
395+ } ) ;
380396 } ;
381397
382398 shouldAutoFocusSharedLink = ( ) => {
@@ -409,7 +425,7 @@ class UnifiedShareModal extends React.Component<Props, State> {
409425 trackingProps,
410426 } = this . props ;
411427 const { type } = item ;
412- const { isInviteSectionExpanded, shouldRenderFTUXTooltip } = this . state ;
428+ const { isExternalUserIninviteCollabsContacts , isInviteSectionExpanded, shouldRenderFTUXTooltip } = this . state ;
413429 const { inviteCollabsEmailTracking, modalTracking } = trackingProps ;
414430 const contactsFieldDisabledTooltip =
415431 type === ITEM_TYPE_WEBLINK ? (
@@ -470,6 +486,7 @@ class UnifiedShareModal extends React.Component<Props, State> {
470486 inlineNotice = { inlineNotice }
471487 isContactsFieldEnabled = { canInvite }
472488 isExpanded = { isInviteSectionExpanded }
489+ isExternalUserSelected = { isExternalUserIninviteCollabsContacts }
473490 onContactInput = { this . openInviteCollaborators }
474491 onRequestClose = { this . closeInviteCollaborators }
475492 onSubmit = { this . handleSendInvites }
@@ -652,6 +669,7 @@ class UnifiedShareModal extends React.Component<Props, State> {
652669 const { modalProps } = modalTracking ;
653670 const {
654671 isEmailLinkSectionExpanded,
672+ isExternalUserInEmailSharedLinkContacts,
655673 isFetching,
656674 isInviteSectionExpanded,
657675 isConfirmModalOpen,
@@ -710,6 +728,7 @@ class UnifiedShareModal extends React.Component<Props, State> {
710728 } }
711729 isContactsFieldEnabled
712730 isExpanded
731+ isExternalUserSelected = { isExternalUserInEmailSharedLinkContacts }
713732 onRequestClose = { this . closeEmailSharedLinkForm }
714733 onSubmit = { this . handleSendSharedLink }
715734 showEnterEmailsCallout = { showEnterEmailsCallout }
0 commit comments