hooks.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. import type {Route, RouteComponentProps, RouteContextInterface} from 'react-router';
  2. import type {ChildrenRenderFn} from 'sentry/components/acl/feature';
  3. import type {Guide} from 'sentry/components/assistant/types';
  4. import type {ButtonProps} from 'sentry/components/button';
  5. import type {
  6. ProductSelectionProps,
  7. ProductSolution,
  8. } from 'sentry/components/onboarding/productSelection';
  9. import type SidebarItem from 'sentry/components/sidebar/sidebarItem';
  10. import type DateRange from 'sentry/components/timeRangeSelector/dateRange';
  11. import type SelectorItems from 'sentry/components/timeRangeSelector/selectorItems';
  12. import type {SVGIconProps} from 'sentry/icons/svgIcon';
  13. import type {Group} from 'sentry/types';
  14. import type {UseExperiment} from 'sentry/utils/useExperiment';
  15. import type {StatusToggleButtonProps} from 'sentry/views/monitors/components/statusToggleButton';
  16. import type {OrganizationStatsProps} from 'sentry/views/organizationStats/index';
  17. import type {RouteAnalyticsContext} from 'sentry/views/routeAnalyticsContextProvider';
  18. import type {NavigationItem, NavigationSection} from 'sentry/views/settings/types';
  19. import type {ExperimentKey} from './experiments';
  20. import type {Integration, IntegrationProvider} from './integrations';
  21. import type {Member, Organization} from './organization';
  22. import type {Project} from './project';
  23. import type {User} from './user';
  24. // XXX(epurkhiser): A Note about `_`.
  25. //
  26. // We add the `_: any` type int our hooks list to stop
  27. // typescript from doing too much type tightening. We should absolutely revisit
  28. // this in the future because all callbacks _should_ be allowed to be
  29. // functions, but doing so causes some unexpected issues and makes typescript
  30. // not happy. We still get a huge advantage of typing just by having each hook
  31. // type here however.
  32. /**
  33. * The Hooks type mapping is the master interface for all external Hooks into
  34. * the sentry frontend application.
  35. */
  36. export interface Hooks
  37. extends RouteHooks,
  38. ComponentHooks,
  39. CustomizationHooks,
  40. AnalyticsHooks,
  41. FeatureDisabledHooks,
  42. InterfaceChromeHooks,
  43. OnboardingHooks,
  44. SettingsHooks,
  45. FeatureSpecificHooks,
  46. ReactHooks,
  47. CallbackHooks {
  48. _: any;
  49. }
  50. export type HookName = keyof Hooks;
  51. /**
  52. * Route hooks.
  53. */
  54. export type RouteHooks = {
  55. 'routes:api': RoutesHook;
  56. 'routes:organization': RoutesHook;
  57. 'routes:root': RoutesHook;
  58. };
  59. /**
  60. * Component specific hooks for DateRange and SelectorItems
  61. * These components have plan specific overrides in getsentry
  62. */
  63. type DateRangeProps = React.ComponentProps<typeof DateRange>;
  64. type SelectorItemsProps = React.ComponentProps<typeof SelectorItems>;
  65. type DisabledMemberViewProps = RouteComponentProps<{orgId: string}, {}>;
  66. type MemberListHeaderProps = {
  67. members: Member[];
  68. organization: Organization;
  69. };
  70. type DisabledAppStoreConnectMultiple = {
  71. children: React.ReactNode;
  72. organization: Organization;
  73. };
  74. type DisabledCustomSymbolSources = {
  75. children: React.ReactNode;
  76. organization: Organization;
  77. };
  78. type DisabledMemberTooltipProps = {children: React.ReactNode};
  79. type DashboardHeadersProps = {organization: Organization};
  80. type ReplayFeedbackButton = {children: React.ReactNode};
  81. type ReplayListPageHeaderProps = {children?: React.ReactNode};
  82. type ReplayOnboardingAlertProps = {children: React.ReactNode};
  83. type ReplayOnboardingCTAProps = {children: React.ReactNode; organization: Organization};
  84. type ProductUnavailableCTAProps = {organization: Organization};
  85. type ProfilingBetaAlertBannerProps = {
  86. organization: Organization;
  87. };
  88. type ProfilingUpgradePlanButtonProps = ButtonProps & {
  89. children: React.ReactNode;
  90. fallback: React.ReactNode;
  91. organization: Organization;
  92. };
  93. type ProfilingAM1OrMMXUpgradeProps = {
  94. fallback: React.ReactNode;
  95. organization: Organization;
  96. };
  97. type CronsBillingBannerProps = {
  98. organization: Organization;
  99. };
  100. type OrganizationHeaderProps = {
  101. organization: Organization;
  102. };
  103. type ProductSelectionAvailabilityProps = Pick<
  104. ProductSelectionProps,
  105. 'lazyLoader' | 'skipLazyLoader' | 'platform' | 'withBottomMargin'
  106. > & {
  107. organization: Organization;
  108. };
  109. type FirstPartyIntegrationAlertProps = {
  110. integrations: Integration[];
  111. hideCTA?: boolean;
  112. wrapWithContainer?: boolean;
  113. };
  114. type FirstPartyIntegrationAdditionalCTAProps = {
  115. integrations: Integration[];
  116. };
  117. type AttemptCloseAttemptProps = {
  118. handleRemoveAccount: () => void;
  119. organizationSlugs: string[];
  120. };
  121. type CodecovLinkProps = {
  122. organization: Organization;
  123. };
  124. type QualitativeIssueFeedbackProps = {
  125. group: Group;
  126. organization: Organization;
  127. };
  128. // on-create-project-product-selection
  129. type CreateProjectProductSelectionChangedCallback = (options: {
  130. defaultProducts: ProductSolution[];
  131. organization: Organization;
  132. selectedProducts: ProductSolution[];
  133. }) => void;
  134. type GuideUpdateCallback = (nextGuide: Guide | null, opts: {dismissed?: boolean}) => void;
  135. type MonitorCreatedCallback = (organization: Organization) => void;
  136. type SentryLogoProps = SVGIconProps & {
  137. pride?: boolean;
  138. };
  139. export type ParntershipAgreementType = 'standard' | 'partner_presence';
  140. export type PartnershipAgreementProps = {
  141. agreements: Array<ParntershipAgreementType>;
  142. partnerDisplayName: string;
  143. onSubmitSuccess?: () => void;
  144. organizationSlug?: string;
  145. };
  146. /**
  147. * Component wrapping hooks
  148. */
  149. export type ComponentHooks = {
  150. 'component:codecov-integration-settings-link': () => React.ComponentType<CodecovLinkProps>;
  151. 'component:confirm-account-close': () => React.ComponentType<AttemptCloseAttemptProps>;
  152. 'component:crons-list-page-header': () => React.ComponentType<CronsBillingBannerProps>;
  153. 'component:dashboards-header': () => React.ComponentType<DashboardHeadersProps>;
  154. 'component:disabled-app-store-connect-multiple': () => React.ComponentType<DisabledAppStoreConnectMultiple>;
  155. 'component:disabled-custom-symbol-sources': () => React.ComponentType<DisabledCustomSymbolSources>;
  156. 'component:disabled-member': () => React.ComponentType<DisabledMemberViewProps>;
  157. 'component:disabled-member-tooltip': () => React.ComponentType<DisabledMemberTooltipProps>;
  158. 'component:enhanced-org-stats': () => React.ComponentType<OrganizationStatsProps>;
  159. 'component:escalating-issues-banner-feedback': () => React.ComponentType<QualitativeIssueFeedbackProps>;
  160. 'component:first-party-integration-additional-cta': () => React.ComponentType<FirstPartyIntegrationAdditionalCTAProps>;
  161. 'component:first-party-integration-alert': () => React.ComponentType<FirstPartyIntegrationAlertProps>;
  162. 'component:header-date-range': () => React.ComponentType<DateRangeProps>;
  163. 'component:header-selector-items': () => React.ComponentType<SelectorItemsProps>;
  164. 'component:issue-priority-feedback': () => React.ComponentType<QualitativeIssueFeedbackProps>;
  165. 'component:member-list-header': () => React.ComponentType<MemberListHeaderProps>;
  166. 'component:monitor-status-toggle': () => React.ComponentType<StatusToggleButtonProps>;
  167. 'component:org-stats-banner': () => React.ComponentType<DashboardHeadersProps>;
  168. 'component:organization-header': () => React.ComponentType<OrganizationHeaderProps>;
  169. 'component:partnership-agreement': React.ComponentType<PartnershipAgreementProps>;
  170. 'component:product-selection-availability': () => React.ComponentType<ProductSelectionAvailabilityProps>;
  171. 'component:product-unavailable-cta': () => React.ComponentType<ProductUnavailableCTAProps>;
  172. 'component:profiling-am1-or-mmx-upgrade': () => React.ComponentType<ProfilingAM1OrMMXUpgradeProps>;
  173. 'component:profiling-billing-banner': () => React.ComponentType<ProfilingBetaAlertBannerProps>;
  174. 'component:profiling-upgrade-plan-button': () => React.ComponentType<ProfilingUpgradePlanButtonProps>;
  175. 'component:replay-feedback-button': () => React.ComponentType<ReplayFeedbackButton>;
  176. 'component:replay-list-page-header': () => React.ComponentType<ReplayListPageHeaderProps> | null;
  177. 'component:replay-onboarding-alert': () => React.ComponentType<ReplayOnboardingAlertProps>;
  178. 'component:replay-onboarding-cta': () => React.ComponentType<ReplayOnboardingCTAProps>;
  179. 'component:replay-onboarding-cta-button': () => React.ComponentType<{}> | null;
  180. 'component:sentry-logo': () => React.ComponentType<SentryLogoProps>;
  181. 'component:superuser-access-category': React.ComponentType<any>;
  182. 'component:superuser-warning': React.ComponentType<any>;
  183. 'component:superuser-warning-excluded': SuperuserWarningExcluded;
  184. };
  185. /**
  186. * Customization hooks are advanced hooks that return render-prop style
  187. * components the allow for specific customizations of components.
  188. *
  189. * These are very similar to the component wrapping hooks
  190. */
  191. export type CustomizationHooks = {
  192. 'integrations:feature-gates': IntegrationsFeatureGatesHook;
  193. 'member-invite-button:customization': InviteButtonCustomizationHook;
  194. 'member-invite-modal:customization': InviteModalCustomizationHook;
  195. };
  196. /**
  197. * Analytics / tracking / and operational metrics backend hooks.
  198. */
  199. export type AnalyticsHooks = {
  200. 'analytics:init-user': AnalyticsInitUser;
  201. 'analytics:log-experiment': AnalyticsLogExperiment;
  202. 'analytics:raw-track-event': AnalyticsRawTrackEvent;
  203. 'metrics:event': MetricsEvent;
  204. };
  205. /**
  206. * feature-disabled:<feature-flag> hooks return components that will be
  207. * rendered in place for Feature components when the feature is not enabled.
  208. */
  209. export type FeatureDisabledHooks = {
  210. 'feature-disabled:alert-wizard-performance': FeatureDisabledHook;
  211. 'feature-disabled:alerts-page': FeatureDisabledHook;
  212. 'feature-disabled:codecov-integration-setting': FeatureDisabledHook;
  213. 'feature-disabled:custom-inbound-filters': FeatureDisabledHook;
  214. 'feature-disabled:dashboards-edit': FeatureDisabledHook;
  215. 'feature-disabled:dashboards-page': FeatureDisabledHook;
  216. 'feature-disabled:dashboards-sidebar-item': FeatureDisabledHook;
  217. 'feature-disabled:data-forwarding': FeatureDisabledHook;
  218. 'feature-disabled:discard-groups': FeatureDisabledHook;
  219. 'feature-disabled:discover-page': FeatureDisabledHook;
  220. 'feature-disabled:discover-saved-query-create': FeatureDisabledHook;
  221. 'feature-disabled:discover-sidebar-item': FeatureDisabledHook;
  222. 'feature-disabled:discover2-page': FeatureDisabledHook;
  223. 'feature-disabled:discover2-sidebar-item': FeatureDisabledHook;
  224. 'feature-disabled:events-page': FeatureDisabledHook;
  225. 'feature-disabled:events-sidebar-item': FeatureDisabledHook;
  226. 'feature-disabled:grid-editable-actions': FeatureDisabledHook;
  227. 'feature-disabled:incidents-sidebar-item': FeatureDisabledHook;
  228. 'feature-disabled:open-discover': FeatureDisabledHook;
  229. 'feature-disabled:open-in-discover': FeatureDisabledHook;
  230. 'feature-disabled:performance-new-project': FeatureDisabledHook;
  231. 'feature-disabled:performance-page': FeatureDisabledHook;
  232. 'feature-disabled:performance-quick-trace': FeatureDisabledHook;
  233. 'feature-disabled:performance-sidebar-item': FeatureDisabledHook;
  234. 'feature-disabled:profiling-page': FeatureDisabledHook;
  235. 'feature-disabled:profiling-sidebar-item': FeatureDisabledHook;
  236. 'feature-disabled:project-performance-score-card': FeatureDisabledHook;
  237. 'feature-disabled:project-selector-all-projects': FeatureDisabledHook;
  238. 'feature-disabled:project-selector-checkbox': FeatureDisabledHook;
  239. 'feature-disabled:rate-limits': FeatureDisabledHook;
  240. 'feature-disabled:relay': FeatureDisabledHook;
  241. 'feature-disabled:replay-sidebar-item': FeatureDisabledHook;
  242. 'feature-disabled:sso-basic': FeatureDisabledHook;
  243. 'feature-disabled:sso-saml2': FeatureDisabledHook;
  244. 'feature-disabled:starfish-view': FeatureDisabledHook;
  245. 'feature-disabled:trace-view-link': FeatureDisabledHook;
  246. };
  247. /**
  248. * Interface chrome hooks.
  249. */
  250. export type InterfaceChromeHooks = {
  251. footer: GenericComponentHook;
  252. 'help-modal:footer': HelpModalFooterHook;
  253. 'sidebar:bottom-items': SidebarBottomItemsHook;
  254. 'sidebar:help-menu': GenericOrganizationComponentHook;
  255. 'sidebar:item-label': SidebarItemLabelHook;
  256. 'sidebar:organization-dropdown-menu': GenericOrganizationComponentHook;
  257. 'sidebar:organization-dropdown-menu-bottom': GenericOrganizationComponentHook;
  258. };
  259. /**
  260. * Onboarding experience hooks
  261. */
  262. export type OnboardingHooks = {
  263. 'onboarding-wizard:skip-help': GenericOrganizationComponentHook;
  264. 'onboarding:block-hide-sidebar': () => boolean;
  265. 'onboarding:extra-chrome': GenericComponentHook;
  266. 'onboarding:targeted-onboarding-header': (opts: {source: string}) => React.ReactNode;
  267. };
  268. /**
  269. * Settings navigation hooks.
  270. */
  271. export type SettingsHooks = {
  272. 'settings:api-navigation-config': SettingsItemsHook;
  273. 'settings:organization-navigation': OrganizationSettingsHook;
  274. 'settings:organization-navigation-config': SettingsConfigHook;
  275. };
  276. /**
  277. * Feature Specific Hooks
  278. */
  279. export interface FeatureSpecificHooks extends SpendVisibilityHooks {}
  280. /**
  281. * Hooks related to Spend Visibitlity
  282. * (i.e. Per-Project Spike Protection + Spend Allocations)
  283. */
  284. export type SpendVisibilityHooks = {
  285. 'spend-visibility:spike-protection-project-settings': GenericProjectComponentHook;
  286. };
  287. /**
  288. * Hooks that are actually React Hooks as well
  289. */
  290. export type ReactHooks = {
  291. 'react-hook:route-activated': (
  292. props: RouteContextInterface
  293. ) => React.ContextType<typeof RouteAnalyticsContext>;
  294. 'react-hook:use-button-tracking': (props: ButtonProps) => () => void;
  295. 'react-hook:use-experiment': UseExperiment;
  296. };
  297. /**
  298. * Callback hooks.
  299. * These hooks just call a function that has no return value
  300. * and perform some sort of callback logic
  301. */
  302. type CallbackHooks = {
  303. 'callback:on-create-project-product-selection': CreateProjectProductSelectionChangedCallback;
  304. 'callback:on-guide-update': GuideUpdateCallback;
  305. 'callback:on-monitor-created': MonitorCreatedCallback;
  306. };
  307. /**
  308. * Renders a React node with no props
  309. */
  310. type GenericComponentHook = () => React.ReactNode;
  311. /**
  312. * A route hook provides an injection point for a list of routes.
  313. */
  314. type RoutesHook = () => Route[];
  315. /**
  316. * Receives an organization object and should return a React node.
  317. */
  318. type GenericOrganizationComponentHook = (opts: {
  319. organization: Organization;
  320. }) => React.ReactNode;
  321. /**
  322. * Receives a project object and should return a React node.
  323. */
  324. type GenericProjectComponentHook = (opts: {project: Project}) => React.ReactNode;
  325. /**
  326. * A FeatureDisabledHook returns a react element when a feature is not enabled.
  327. */
  328. type FeatureDisabledHook = (opts: {
  329. /**
  330. * Children can either be a node, or a function that accepts a renderDisabled prop containing
  331. * a function/component to render when the feature is not enabled.
  332. */
  333. children: React.ReactNode | ChildrenRenderFn;
  334. /**
  335. * The list of features that are controlled by this hook.
  336. */
  337. features: string[];
  338. /**
  339. * Weather the feature is or is not enabled.
  340. */
  341. hasFeature: boolean;
  342. /**
  343. * The organization that is associated to this feature.
  344. */
  345. organization: Organization;
  346. /**
  347. * The project that is associated to this feature.
  348. */
  349. project?: Project;
  350. }) => React.ReactNode;
  351. /**
  352. * Called to check if the superuser warning should be excluded for the given organization.
  353. */
  354. type SuperuserWarningExcluded = (organization: Organization | null) => boolean;
  355. /**
  356. * Called when the app is mounted.
  357. */
  358. type AnalyticsInitUser = (user: User) => void;
  359. /**
  360. * Trigger analytics tracking in the hook store.
  361. */
  362. type AnalyticsRawTrackEvent = (
  363. data: {
  364. /**
  365. * Arbitrary data to track
  366. */
  367. [key: string]: any;
  368. /**
  369. * The Reload event key.
  370. */
  371. eventKey: string;
  372. /**
  373. * The Amplitude event name. Set to null if event should not go to Amplitude.
  374. */
  375. eventName: string | null;
  376. /**
  377. * Organization to pass in. If full org object not available, pass in just the Id.
  378. * If no org, pass in null.
  379. */
  380. organization: Organization | string | null;
  381. },
  382. options?: {
  383. /**
  384. * An arbitrary function to map the parameters to new parameters
  385. */
  386. mapValuesFn?: (params: Record<string, any>) => Record<string, any>;
  387. /**
  388. * If true, starts an analytics session. This session can be used
  389. * to construct funnels. The start of the funnel should have
  390. * startSession set to true.
  391. */
  392. startSession?: boolean;
  393. /**
  394. * Optional unix timestamp
  395. */
  396. time?: number;
  397. }
  398. ) => void;
  399. /**
  400. * Trigger experiment observed logging.
  401. */
  402. type AnalyticsLogExperiment = (opts: {
  403. /**
  404. * The experiment key
  405. */
  406. key: ExperimentKey;
  407. /**
  408. * The organization. Must be provided for organization experiments.
  409. */
  410. organization?: Organization;
  411. }) => void;
  412. /**
  413. * Trigger recording a metric in the hook store.
  414. */
  415. type MetricsEvent = (
  416. /**
  417. * Metric name
  418. */
  419. name: string,
  420. /**
  421. * Value to record for this metric
  422. */
  423. value: number,
  424. /**
  425. * An additional tags object
  426. */
  427. tags?: object
  428. ) => void;
  429. /**
  430. * Provides additional navigation components
  431. */
  432. type OrganizationSettingsHook = (organization: Organization) => React.ReactElement;
  433. /**
  434. * Provides additional setting configurations
  435. */
  436. type SettingsConfigHook = (organization: Organization) => NavigationSection;
  437. /**
  438. * Provides additional setting navigation items
  439. */
  440. type SettingsItemsHook = (organization?: Organization) => NavigationItem[];
  441. /**
  442. * Each sidebar label is wrapped with this hook, to allow sidebar item
  443. * augmentation.
  444. */
  445. type SidebarItemLabelHook = () => React.ComponentType<{
  446. /**
  447. * The item label being wrapped
  448. */
  449. children: React.ReactNode;
  450. /**
  451. * The key of the item label currently being rendered. If no id is provided
  452. * the hook will have no effect.
  453. */
  454. id?: string;
  455. }>;
  456. type SidebarProps = Pick<
  457. React.ComponentProps<typeof SidebarItem>,
  458. 'orientation' | 'collapsed' | 'hasPanel'
  459. >;
  460. /**
  461. * Returns an additional list of sidebar items.
  462. */
  463. type SidebarBottomItemsHook = (
  464. opts: SidebarProps & {organization: Organization}
  465. ) => React.ReactNode;
  466. /**
  467. * Provides augmentation of the help modal footer
  468. */
  469. type HelpModalFooterHook = (opts: {
  470. closeModal: () => void;
  471. organization: Organization;
  472. }) => React.ReactNode;
  473. /**
  474. * The DecoratedIntegrationFeature differs from the IntegrationFeature as it is
  475. * expected to have been transformed into marked up content.
  476. */
  477. type DecoratedIntegrationFeature = {
  478. /**
  479. * Marked up description
  480. */
  481. description: React.ReactNode;
  482. featureGate: string;
  483. };
  484. type IntegrationFeatureGroup = {
  485. /**
  486. * The list of features within this group
  487. */
  488. features: DecoratedIntegrationFeature[];
  489. /**
  490. * Weather the group has all of the features enabled within this group
  491. * or not.
  492. */
  493. hasFeatures: boolean;
  494. };
  495. type FeatureGateSharedProps = {
  496. /**
  497. * The list of features, typically this is provided by the backend.
  498. */
  499. features: DecoratedIntegrationFeature[];
  500. /**
  501. * Organization of the integration we're querying feature gate details for.
  502. */
  503. organization: Organization;
  504. };
  505. type IntegrationFeaturesProps = FeatureGateSharedProps & {
  506. /**
  507. * The children function which will be provided with gating details.
  508. */
  509. children: (opts: {
  510. /**
  511. * Is the integration disabled for installation because of feature gating?
  512. */
  513. disabled: boolean;
  514. /**
  515. * The translated reason that the integration is disabled.
  516. */
  517. disabledReason: React.ReactNode;
  518. /**
  519. * Features grouped based on specific gating criteria (for example, in
  520. * sentry.io this is features grouped by plans).
  521. */
  522. gatedFeatureGroups: IntegrationFeatureGroup[];
  523. /**
  524. * This is the list of features which have *not* been gated in any way.
  525. */
  526. ungatedFeatures: DecoratedIntegrationFeature[];
  527. }) => React.ReactElement;
  528. };
  529. type IntegrationFeatureListProps = FeatureGateSharedProps & {
  530. provider: Pick<IntegrationProvider, 'key'>;
  531. };
  532. /**
  533. * The integration features gate hook provides components to customize
  534. * integration feature lists.
  535. */
  536. type IntegrationsFeatureGatesHook = () => {
  537. /**
  538. * This component renders the list of integration features.
  539. */
  540. FeatureList: React.ComponentType<IntegrationFeatureListProps>;
  541. /**
  542. * This is a render-prop style component that given a set of integration
  543. * features will call the children function with gating details about the
  544. * features.
  545. */
  546. IntegrationFeatures: React.ComponentType<IntegrationFeaturesProps>;
  547. };
  548. /**
  549. * Invite Button customization allows for a render-props component to replace
  550. * or intercept props of the button element.
  551. */
  552. type InviteButtonCustomizationHook = () => React.ComponentType<{
  553. children: (opts: {
  554. /**
  555. * Whether the Invite Members button is active or not
  556. */
  557. disabled: boolean;
  558. onTriggerModal: () => void;
  559. }) => React.ReactElement;
  560. onTriggerModal: () => void;
  561. organization: Organization;
  562. }>;
  563. /**
  564. * Invite Modal customization allows for a render-prop component to add
  565. * additional react elements into the modal, and add invite-send middleware.
  566. */
  567. type InviteModalCustomizationHook = () => React.ComponentType<{
  568. children: (opts: {
  569. /**
  570. * Indicates that the modal's send invites button should be enabled and
  571. * invites may currently be sent.
  572. */
  573. canSend: boolean;
  574. /**
  575. * Trigger sending invites
  576. */
  577. sendInvites: () => void;
  578. /**
  579. * Additional react elements to render in the header of the modal, just
  580. * under the description.
  581. */
  582. headerInfo?: React.ReactNode;
  583. }) => React.ReactElement;
  584. /**
  585. * When the children's sendInvites renderProp is called, this will also be
  586. * triggered.
  587. */
  588. onSendInvites: () => void;
  589. /**
  590. * The organization that members will be invited to.
  591. */
  592. organization: Organization;
  593. /**
  594. * Indicates if clicking 'send invites' will immediately send invites, or
  595. * would just create invite requests.
  596. */
  597. willInvite: boolean;
  598. }>;