|
@@ -6,6 +6,7 @@ import {MEMBER_ROLES} from 'app/constants';
|
|
|
import {ModalRenderProps} from 'app/actionCreators/modal';
|
|
|
import InlineSvg from 'app/components/inlineSvg';
|
|
|
import Button from 'app/components/button';
|
|
|
+import HookOrDefault from 'app/components/hookOrDefault';
|
|
|
import space from 'app/styles/space';
|
|
|
import AsyncComponent from 'app/components/asyncComponent';
|
|
|
import {Organization} from 'app/types';
|
|
@@ -30,6 +31,14 @@ type State = AsyncComponent['state'] & {
|
|
|
|
|
|
const DEFAULT_ROLE = 'member';
|
|
|
|
|
|
+const InviteModalHook = HookOrDefault({
|
|
|
+ hookName: 'member-invite-modal:customization',
|
|
|
+ defaultComponent: ({onSendInvites, children}) =>
|
|
|
+ children({sendInvites: onSendInvites, canSend: true}),
|
|
|
+});
|
|
|
+
|
|
|
+type InviteModalRenderFunc = React.ComponentProps<typeof InviteModalHook>['children'];
|
|
|
+
|
|
|
class InviteMembersModal extends AsyncComponent<Props, State> {
|
|
|
get inviteTemplate(): InviteRow {
|
|
|
return {emails: new Set(), teams: new Set(), role: DEFAULT_ROLE};
|
|
@@ -239,7 +248,8 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
|
|
|
|
|
|
const disableInputs = sendingInvites || complete;
|
|
|
|
|
|
- return (
|
|
|
+ // eslint-disable-next-line react/prop-types
|
|
|
+ const hookRenderer: InviteModalRenderFunc = ({sendInvites, canSend, headerInfo}) => (
|
|
|
<React.Fragment>
|
|
|
<Heading>
|
|
|
<InlineSvg src="icon-mail" size="36px" />
|
|
@@ -266,6 +276,8 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
|
|
|
)}
|
|
|
</Subtext>
|
|
|
|
|
|
+ {headerInfo}
|
|
|
+
|
|
|
<InviteeHeadings>
|
|
|
<div>{t('Email addresses')}</div>
|
|
|
<div>{t('Role')}</div>
|
|
@@ -332,8 +344,8 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
|
|
|
size="small"
|
|
|
data-test-id="send-invites"
|
|
|
priority="primary"
|
|
|
- disabled={!this.isValidInvites || disableInputs}
|
|
|
- onClick={this.sendInvites}
|
|
|
+ disabled={!canSend || !this.isValidInvites || disableInputs}
|
|
|
+ onClick={sendInvites}
|
|
|
>
|
|
|
{this.inviteButtonLabel}
|
|
|
</Button>
|
|
@@ -343,6 +355,16 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
|
|
|
</Footer>
|
|
|
</React.Fragment>
|
|
|
);
|
|
|
+
|
|
|
+ return (
|
|
|
+ <InviteModalHook
|
|
|
+ organization={this.props.organization}
|
|
|
+ willInvite={this.willInvite}
|
|
|
+ onSendInvites={this.sendInvites}
|
|
|
+ >
|
|
|
+ {hookRenderer}
|
|
|
+ </InviteModalHook>
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|