@rh-support/manage 2.0.7 → 2.0.8-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/esm/ManageTabs.d.ts.map +1 -1
  2. package/lib/esm/ManageTabs.js +21 -4
  3. package/lib/esm/Routes.d.ts +1 -0
  4. package/lib/esm/Routes.d.ts.map +1 -1
  5. package/lib/esm/Routes.js +6 -0
  6. package/lib/esm/components/Configs/ConfigInLineEdit.d.ts.map +1 -1
  7. package/lib/esm/components/Configs/ConfigInLineEdit.js +1 -2
  8. package/lib/esm/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.d.ts.map +1 -1
  9. package/lib/esm/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.js +1 -0
  10. package/lib/esm/components/ManageBookmarkedAccountsTab/ManageGroupedBookmarkedAccountsTab.d.ts.map +1 -1
  11. package/lib/esm/components/ManageBookmarkedAccountsTab/ManageGroupedBookmarkedAccountsTab.js +2 -1
  12. package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts +2 -0
  13. package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts.map +1 -0
  14. package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.js +15 -0
  15. package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts +2 -0
  16. package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts.map +1 -0
  17. package/lib/esm/components/ManagePartnerships/PartnershipsList.js +185 -0
  18. package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts +3 -0
  19. package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts.map +1 -0
  20. package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.js +107 -0
  21. package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts +8 -0
  22. package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts.map +1 -0
  23. package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.js +153 -0
  24. package/lib/esm/components/ManagePartnerships/Requests.d.ts +3 -0
  25. package/lib/esm/components/ManagePartnerships/Requests.d.ts.map +1 -0
  26. package/lib/esm/components/ManagePartnerships/Requests.js +198 -0
  27. package/lib/esm/components/ManagePartnerships/index.d.ts +2 -0
  28. package/lib/esm/components/ManagePartnerships/index.d.ts.map +1 -0
  29. package/lib/esm/components/ManagePartnerships/index.js +25 -0
  30. package/lib/esm/components/ManageTable/ManageTable.d.ts +1 -0
  31. package/lib/esm/components/ManageTable/ManageTable.d.ts.map +1 -1
  32. package/lib/esm/components/ManageTable/ManageTable.js +4 -3
  33. package/lib/esm/context/ManagePartnershipsProvider.d.ts +11 -0
  34. package/lib/esm/context/ManagePartnershipsProvider.d.ts.map +1 -0
  35. package/lib/esm/context/ManagePartnershipsProvider.js +26 -0
  36. package/lib/esm/reducers/ManagePartnershipsReducer.d.ts +16 -0
  37. package/lib/esm/reducers/ManagePartnershipsReducer.d.ts.map +1 -0
  38. package/lib/esm/reducers/ManagePartnershipsReducer.js +30 -0
  39. package/lib/esm/scss/_main.scss +6 -2
  40. package/lib/esm/scss/_pf4-overrides.scss +2 -2
  41. package/package.json +14 -15
@@ -1 +1 @@
1
- {"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAmBvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAqIvC"}
1
+ {"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAiKvC"}
@@ -1,11 +1,13 @@
1
1
  import { ErrorBoundary, useDocumentTitle } from '@rh-support/components';
2
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
2
3
  import { ability, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
3
- import { CustomElements, requireCustomElement } from '@rh-support/utils';
4
+ import { CustomElements, getConfigField, PCM_CONFIG_FIELD_TYPE, requireCustomElement } from '@rh-support/utils';
4
5
  import map from 'lodash/map';
5
- import React from 'react';
6
+ import React, { useContext } from 'react';
6
7
  import { ConfigsTable } from './components/Configs/ConfigsTable';
7
8
  import { ManageGroupUsers } from './components/Groups/ManageGroupUsers';
8
9
  import { ManageGroupedBookmarkedAccountsTab } from './components/ManageBookmarkedAccountsTab';
10
+ import { ManagePartnerships } from './components/ManagePartnerships/index';
9
11
  import { ManagePreferences } from './components/ManagePreferences';
10
12
  import { NotificationEmails } from './components/NotificationEmails/index';
11
13
  import { TopContentManagement } from './components/TopContentManagement';
@@ -21,7 +23,9 @@ requireCustomElement([
21
23
  export function ManageTabs(props) {
22
24
  var _a, _b;
23
25
  const history = props.routeProps.history;
24
- const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, } = Routes.getPaths();
26
+ const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, partnershipsRoute, } = Routes.getPaths();
27
+ const { globalMetadataState: { pcmConfig }, } = useContext(GlobalMetadataStateContext);
28
+ const isPartnershipsEnabled = getConfigField(pcmConfig.data, 'isPartnershipEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
25
29
  // Changes route and saves the current path to the url query params
26
30
  const isOnlyBasePath = history.location.pathname === Routes.basePath;
27
31
  useDocumentTitle(PageTitle.MANAGE);
@@ -34,6 +38,7 @@ export function ManageTabs(props) {
34
38
  const canViewCaseGroups = ability.can(resourceActions.READ, resources.CASE_GROUPS) && canViewManageTab;
35
39
  const canManageBookmarkAccounts = ability.can(resourceActions.CREATE, resources.BOOKMARK_ACCOUNTS) && canViewManageTab;
36
40
  const canViewEmailNotificationTab = ability.can(resourceActions.READ, resources.NOTIFICATION_EMAIL);
41
+ const canViewPartnershipsTab = ability.can(resourceActions.READ, resources.PARTNERSHIPS);
37
42
  const canAddCustomNotification = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_SEND_NOTIFICATIONS);
38
43
  const canViewConfigsTab = ability.can(resourceActions.READ, resources.APP_INTERNAL_CONFIGS);
39
44
  const tabsToRender = [];
@@ -71,6 +76,18 @@ export function ManageTabs(props) {
71
76
  },
72
77
  component: React.createElement(NotificationEmails, null),
73
78
  });
79
+ canViewPartnershipsTab &&
80
+ isPartnershipsEnabled &&
81
+ tabsToRender.push({
82
+ title: 'Partnerships',
83
+ key: 'partnerships-tab',
84
+ 'data-tracking-id': 'partnerships-tab',
85
+ routePath: partnershipsRoute,
86
+ onClick: () => {
87
+ changeRouteThunk(partnershipsRoute);
88
+ },
89
+ component: React.createElement(ManagePartnerships, null),
90
+ });
74
91
  tabsToRender.push({
75
92
  title: 'Preferences',
76
93
  key: 'preferences-tab',
@@ -112,7 +129,7 @@ export function ManageTabs(props) {
112
129
  const getSelectedIndex = () => {
113
130
  if (isOnlyBasePath)
114
131
  return 0;
115
- const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname);
132
+ const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname.substring(0, tab.routePath.length));
116
133
  return tabIndex > -1 ? tabIndex : 0;
117
134
  };
118
135
  /**
@@ -16,6 +16,7 @@ interface ManageRoutes {
16
16
  preferences: Route;
17
17
  notificationEmails: Route;
18
18
  configs: Route;
19
+ partnerships: Route;
19
20
  }
20
21
  export declare const Routes: ManageRoutes;
21
22
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;IACnB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;CAClB;AAED,eAAO,MAAM,MAAM,EAAE,YAmEpB,CAAC"}
1
+ {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;IACnB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,YAAY,EAAE,KAAK,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,EAAE,YAyEpB,CAAC"}
package/lib/esm/Routes.js CHANGED
@@ -36,6 +36,12 @@ export const Routes = {
36
36
  return getPath(this);
37
37
  },
38
38
  },
39
+ partnerships: {
40
+ path: '/partnerships',
41
+ getPath() {
42
+ return getPath(this);
43
+ },
44
+ },
39
45
  notificationEmails: {
40
46
  path: '/notification-emails',
41
47
  getPath() {
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigInLineEdit.d.ts","sourceRoot":"","sources":["../../../../src/components/Configs/ConfigInLineEdit.tsx"],"names":[],"mappings":"AAKA,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAqD7C"}
1
+ {"version":3,"file":"ConfigInLineEdit.d.ts","sourceRoot":"","sources":["../../../../src/components/Configs/ConfigInLineEdit.tsx"],"names":[],"mappings":"AAKA,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAoD7C"}
@@ -25,8 +25,7 @@ export function ConfigInLineEdit(props) {
25
25
  setHasLargeInput(inputValue.length > CONFIG_FIELD_VALUE_LIMIT);
26
26
  setInput(inputValue);
27
27
  };
28
- // when user filter search result if the textarea is open, need to update the internal state
29
- // otherwise it shows wrong content
28
+ // When user filter search result if the textarea is open, need to update the internal state otherwise it shows wrong content
30
29
  useEffect(() => {
31
30
  setInput(props.fieldValue);
32
31
  }, [props.fieldValue]);
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultGroupSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAMvF,UAAU,MAAM;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,kBAAkB,UAAW,MAAM,gBA2C/C,CAAC"}
1
+ {"version":3,"file":"DefaultGroupSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAMvF,UAAU,MAAM;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,kBAAkB,UAAW,MAAM,gBA4C/C,CAAC"}
@@ -20,6 +20,7 @@ export const DefaultGroupSwitch = (props) => {
20
20
  const toggleDefaultGroupFetch = useFetch(publicApi.caseGroups.toggleDefaultGroup, {
21
21
  propgateErrors: true,
22
22
  });
23
+ // Handle Toggle
23
24
  const toggleDefault = (isChecked) => __awaiter(void 0, void 0, void 0, function* () {
24
25
  try {
25
26
  onToggle(user, isChecked);
@@ -1 +1 @@
1
- {"version":3,"file":"ManageGroupedBookmarkedAccountsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/ManageGroupedBookmarkedAccountsTab.tsx"],"names":[],"mappings":"AA6CA,UAAU,MAAM;IACZ,yBAAyB,EAAE,OAAO,CAAC;CACtC;AAED,wBAAgB,kCAAkC,CAAC,EAAE,yBAAyB,EAAE,EAAE,MAAM,eA4YvF"}
1
+ {"version":3,"file":"ManageGroupedBookmarkedAccountsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/ManageGroupedBookmarkedAccountsTab.tsx"],"names":[],"mappings":"AA8CA,UAAU,MAAM;IACZ,yBAAyB,EAAE,OAAO,CAAC;CACtC;AAED,wBAAgB,kCAAkC,CAAC,EAAE,yBAAyB,EAAE,EAAE,MAAM,eA4YvF"}
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { ActionList, ActionListItem, AlertVariant, Button, ButtonVariant, Label, LabelGroup, Popover, PopoverPosition, SearchInput, } from '@patternfly/react-core';
11
11
  import PencilAltIcon from '@patternfly/react-icons/dist/esm/icons/pencil-alt-icon';
12
12
  import TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon';
13
+ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
13
14
  import { defaultTableSortMethod, ErrorBoundary, ToastNotification, useConfirmation, } from '@rh-support/components';
14
15
  import { addEditbookmarks, getBookmarkGroups, removeGroupedBookmarks, removeWholeGroup, useGlobalDispatchContext, useGlobalStateContext, useGroupedBookmarkApiCalls, } from '@rh-support/react-context';
15
16
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
@@ -256,7 +257,7 @@ export function ManageGroupedBookmarkedAccountsTab({ canManageBookmarkAccounts }
256
257
  React.createElement("a", { href: "https://source.redhat.com/communitiesatredhat/applications/integration-community-of-practice/misplaced/lostnfound/bookmarking", target: "_blank", rel: "noopener noreferrer" },
257
258
  ' ',
258
259
  "bookmarks in the customer support tool"))), closeBtnAriaLabel: "Close" },
259
- React.createElement("i", { "aria-label": "Cluster Id Info", className: "m-l-1 fa fa-info-circle" }))))),
260
+ React.createElement(InfoCircleIcon, { className: "pf-u-ml-xs", "aria-label": "Cluster Id Info", size: "sm" }))))),
260
261
  React.createElement("div", { className: "toolbar" },
261
262
  React.createElement("form", { className: "toolbar-left" },
262
263
  React.createElement("label", { htmlFor: "bookmark-account-selector" },
@@ -0,0 +1,2 @@
1
+ export declare const NonOrgCustomerInfoModal: () => JSX.Element;
2
+ //# sourceMappingURL=NonOrgCustomerInfoModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NonOrgCustomerInfoModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/NonOrgCustomerInfoModal.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB,mBA2BnC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Button, ButtonVariant, Modal, ModalVariant } from '@patternfly/react-core';
2
+ import React from 'react';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
+ export const NonOrgCustomerInfoModal = () => {
5
+ const [isModalOpen, setIsModalOpen] = React.useState(true);
6
+ const { t } = useTranslation();
7
+ const handleModalToggle = () => {
8
+ setIsModalOpen(!isModalOpen);
9
+ };
10
+ return (React.createElement(Modal, { variant: ModalVariant.small, title: t('Confirm partnership collaboration'), isOpen: isModalOpen, onClose: handleModalToggle, actions: [
11
+ React.createElement(Button, { key: "cancel", variant: ButtonVariant.primary, onClick: handleModalToggle, "data-tracking-id": "confirm-partnership-collaboration-no-org-admin" },
12
+ React.createElement(Trans, null, "Cancel")),
13
+ ] },
14
+ React.createElement(Trans, null, "Only org admin customers can confirm partnership collaboration.")));
15
+ };
@@ -0,0 +1,2 @@
1
+ export declare function PartnershipsList(): JSX.Element;
2
+ //# sourceMappingURL=PartnershipsList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartnershipsList.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsList.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,gBAAgB,gBAqO/B"}
@@ -0,0 +1,185 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { pcm } from '@cee-eng/hydrajs';
11
+ import { AlertVariant, Button, ButtonVariant, Label, SearchInput } from '@patternfly/react-core';
12
+ import TrashIcon from '@patternfly/react-icons/dist/js/icons/trash-icon';
13
+ import { defaultTableSortMethod, LoadingIndicator, ToastNotification, useConfirmation, } from '@rh-support/components';
14
+ import { fetchAccountManagers, fetchManagedAccounts, GlobalMetadataDispatchContext, useGlobalStateContext, } from '@rh-support/react-context';
15
+ import React, { useContext, useEffect, useState } from 'react';
16
+ import { Trans, useTranslation } from 'react-i18next';
17
+ import { useLocation } from 'react-router-dom';
18
+ import { useManagePartnershipsContext, useManagePartnershipsDispatchContext, } from '../../context/ManagePartnershipsProvider';
19
+ import { setIsUpdatingAccounts } from '../../reducers/ManagePartnershipsReducer';
20
+ import { ManageTable } from '../ManageTable';
21
+ import { RequestCollaborationModal } from './RequestCollaborationModal';
22
+ export function PartnershipsList() {
23
+ const { t } = useTranslation();
24
+ const confirmRemove = useConfirmation();
25
+ const [searchString, setSearchString] = useState('');
26
+ const [isRequestCollabModalOpen, setIsRequestCollabModalOpen] = useState(false);
27
+ const [accountList, setAccountList] = useState([]);
28
+ const [isFetching, setIsFetching] = useState(false);
29
+ const [hasError, setHasError] = useState(false);
30
+ const [isDeleting, setIsdeleting] = useState(false);
31
+ const [isDeletingAccountNum, setIsdeletingAccountNum] = useState('');
32
+ const { isUpdatingPartnerAccountList } = useManagePartnershipsContext();
33
+ const dispatch = useManagePartnershipsDispatchContext();
34
+ const location = useLocation();
35
+ const { globalMetadataState: { loggedInUserRights, managedAccounts, accountManagers, loggedInUserJwtToken }, } = useGlobalStateContext();
36
+ const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
37
+ const isPartner = () => loggedInUserRights.data.isPartner();
38
+ const isCustomerOrgAdmin = () => loggedInUserRights.data.isCustomerOrgAdmin();
39
+ const removePartnership = (data) => __awaiter(this, void 0, void 0, function* () {
40
+ try {
41
+ yield confirmRemove({
42
+ catchOnCancel: true,
43
+ title: t('Are you sure?'),
44
+ description: React.createElement(Trans, null, "You will not be able to undo this action after verifying."),
45
+ confirmText: t('Delete'),
46
+ confirmButtonVariant: ButtonVariant.danger,
47
+ });
48
+ try {
49
+ setIsdeleting(true);
50
+ setIsdeletingAccountNum(data.accountNum);
51
+ if (data.isCustomerAccount) {
52
+ yield pcm.partnerships.deleteCustomerAccountByPartner(data.accountNum);
53
+ }
54
+ else {
55
+ yield pcm.partnerships.deletePartnerAccountByCustomer(data.accountNum);
56
+ }
57
+ setAccountList(accountList.filter((a) => a.accountNum !== data.accountNum));
58
+ ToastNotification.addSuccessMessage(t('Partnership removed successfully'));
59
+ setIsdeleting(false);
60
+ setIsdeletingAccountNum('');
61
+ }
62
+ catch (e) {
63
+ ToastNotification.addDangerMessage(t('Partnership failed to be removed'));
64
+ setIsdeleting(false);
65
+ setIsdeletingAccountNum('');
66
+ }
67
+ }
68
+ catch (e) {
69
+ // on confirm modal, cancel button is clicked
70
+ }
71
+ });
72
+ const columns = [
73
+ {
74
+ accessor: (data) => isPartner() && data.isPartnerAccount ? (React.createElement(React.Fragment, null,
75
+ data.name,
76
+ ' ',
77
+ React.createElement(Label, null,
78
+ React.createElement(Trans, null, "Fellow partner")))) : (data.name),
79
+ sortable: true,
80
+ id: 'customer-account-name',
81
+ title: t('Account name'),
82
+ cellWidth: 40,
83
+ sortMethod: (a, b) => {
84
+ var _a, _b;
85
+ if (typeof a !== 'string') {
86
+ a = ((_a = a === null || a === void 0 ? void 0 : a.props) === null || _a === void 0 ? void 0 : _a.children[3]) || '';
87
+ }
88
+ if (typeof b !== 'string') {
89
+ b = ((_b = b === null || b === void 0 ? void 0 : b.props) === null || _b === void 0 ? void 0 : _b.children[3]) || '';
90
+ }
91
+ return defaultTableSortMethod(a.toLowerCase(), b.toLowerCase());
92
+ },
93
+ },
94
+ {
95
+ id: 'customer-account-number',
96
+ title: t('Account number'),
97
+ sortable: false,
98
+ cellWidth: 20,
99
+ cell: (data) => data.accountNum,
100
+ },
101
+ {
102
+ id: 'customer-partnership-access-level',
103
+ title: t('Access level'),
104
+ sortable: false,
105
+ cellWidth: 30,
106
+ cell: (data) => data.partnerCaseAccess,
107
+ },
108
+ ];
109
+ if (loggedInUserRights.data.isOrgAdmin()) {
110
+ columns.push({
111
+ id: 'partnership-delete',
112
+ title: ' ',
113
+ sortable: false,
114
+ cellWidth: 10,
115
+ cell: (data) => (React.createElement(Button, { variant: ButtonVariant.plain, "aria-label": t('Remove partnership'), onClick: () => removePartnership(data) },
116
+ React.createElement(TrashIcon, null),
117
+ React.createElement(LoadingIndicator, { isInline: true, show: isDeleting && data.accountNum === isDeletingAccountNum, size: "xs" }))),
118
+ });
119
+ }
120
+ const requestCollaborationButton = () => (React.createElement("div", { className: "toolbar-right pf-u-mt-xs" },
121
+ React.createElement(Button, { variant: ButtonVariant.primary, isInline: true, onClick: () => setIsRequestCollabModalOpen(true), "data-tracking-id": "request-collaboration-button", isDisabled: false },
122
+ React.createElement(Trans, null, "Request Collaboration"))));
123
+ // Get Customer Accounts For A Partner
124
+ useEffect(() => {
125
+ if (location.pathname !== '/manage/partnerships' || !isPartner())
126
+ return;
127
+ const getManagedAccounts = () => __awaiter(this, void 0, void 0, function* () {
128
+ try {
129
+ setIsFetching(true);
130
+ setHasError(false);
131
+ yield fetchManagedAccounts(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
132
+ }
133
+ catch (e) {
134
+ setHasError(true);
135
+ }
136
+ setIsFetching(false);
137
+ });
138
+ // when partner lands on partnership tab, we need to fetch customer accounts data
139
+ getManagedAccounts();
140
+ // eslint-disable-next-line react-hooks/exhaustive-deps
141
+ }, [location.pathname]);
142
+ //Get Partner Accounts For A Customer
143
+ useEffect(() => {
144
+ const getAccountManagers = () => __awaiter(this, void 0, void 0, function* () {
145
+ try {
146
+ setIsFetching(true);
147
+ setHasError(false);
148
+ yield fetchAccountManagers(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
149
+ setIsUpdatingAccounts(dispatch, false);
150
+ }
151
+ catch (e) {
152
+ setHasError(true);
153
+ }
154
+ setIsFetching(false);
155
+ });
156
+ // when customer accepts a link, need to fetch account data
157
+ if (isCustomerOrgAdmin() && isUpdatingPartnerAccountList)
158
+ getAccountManagers();
159
+ // eslint-disable-next-line react-hooks/exhaustive-deps
160
+ }, [isUpdatingPartnerAccountList]);
161
+ useEffect(() => {
162
+ if (isPartner()) {
163
+ // partner may be customer of another partner
164
+ // we need to dispaly both partner and customer data
165
+ setAccountList([
166
+ ...managedAccounts.data.map((i) => (Object.assign(Object.assign({}, i), { isCustomerAccount: true }))),
167
+ ...accountManagers.data.map((i) => (Object.assign(Object.assign({}, i), { isPartnerAccount: true }))),
168
+ ]);
169
+ }
170
+ else {
171
+ setAccountList(accountManagers.data.map((i) => (Object.assign(Object.assign({}, i), { isPartnerAccount: true }))));
172
+ }
173
+ // eslint-disable-next-line react-hooks/exhaustive-deps
174
+ }, [managedAccounts, accountManagers]);
175
+ return (React.createElement("section", { id: "manage-partnerships-list" },
176
+ React.createElement("div", { className: "toolbar" },
177
+ React.createElement("div", { className: "toolbar-left" },
178
+ React.createElement("label", { htmlFor: "search-partnerships" }, "Filter by"),
179
+ React.createElement(SearchInput, { className: "pf-u-flex-grow-1 pf-c-search-input pf-u-background-color-100 pf-u-mr-lg", id: "search-partnerships", placeholder: t('Search for an existing partnership'), value: searchString, onChange: setSearchString, onClear: () => setSearchString(''), "aria-label": t('Search for an existing partnership') })),
180
+ isPartner() && requestCollaborationButton()),
181
+ React.createElement(ManageTable, { ariaLabel: t('Partnerships list'), columns: columns, data: accountList.filter((account) => account.name.toLowerCase().includes(searchString.toLowerCase())), sortInfo: { column: 'customer-account-name', direction: 'asc' }, errorVariant: AlertVariant.warning, isFetching: isFetching, isError: hasError, errorTitle: t('Partnerships error'), errorComponent: React.createElement(Trans, null, "Could not get partnerships list"), noResultText: t('There are no results to display.') }),
182
+ React.createElement(RequestCollaborationModal, { isOpen: isRequestCollabModalOpen, onClose: () => {
183
+ setIsRequestCollabModalOpen(false);
184
+ } })));
185
+ }
@@ -0,0 +1,3 @@
1
+ export declare function getTnCUrl(): string;
2
+ export declare const PartnershipsTermsModal: () => JSX.Element;
3
+ //# sourceMappingURL=PartnershipsTermsModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartnershipsTermsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsTermsModal.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,SAAS,WAMxB;AAID,eAAO,MAAM,sBAAsB,mBAkJlC,CAAC"}
@@ -0,0 +1,107 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { pcm } from '@cee-eng/hydrajs';
11
+ import { Button, ButtonVariant, Modal, ModalVariant, Text, TextContent, TextVariants } from '@patternfly/react-core';
12
+ import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
13
+ import { LoadingDots, LoadingIndicator, ToastNotification } from '@rh-support/components';
14
+ import { baseTnCUrl, TncConstants } from '@rh-support/utils';
15
+ import get from 'lodash/get';
16
+ import React, { useEffect, useState } from 'react';
17
+ import { Trans, useTranslation } from 'react-i18next';
18
+ import { useHistory, useLocation, useParams } from 'react-router-dom';
19
+ import { useManagePartnershipsDispatchContext } from '../../context/ManagePartnershipsProvider';
20
+ import { setIsUpdatingAccounts } from '../../reducers/ManagePartnershipsReducer';
21
+ export function getTnCUrl() {
22
+ const redirectUrl = encodeURIComponent(window.location.href);
23
+ const cancelRedirectUrl = encodeURIComponent(window.location.href + `?rejectedTnC=true`);
24
+ return `${baseTnCUrl()}?site=${TncConstants.PARTNER_SHARE_LINK_ACCOUNT_SITE_CODE}&event=${TncConstants.PARTNER_SHARE_EVENT_CODE}&redirect=${redirectUrl}&cancelRedirect=${cancelRedirectUrl}`;
25
+ }
26
+ export const PartnershipsTermsModal = () => {
27
+ const [isTermVisited, setIsTermsVisited] = useState(false);
28
+ const [isUpdating, setIsUpdating] = useState(false);
29
+ const [ackChoice, setAckChoice] = useState(undefined);
30
+ const [isTermsModalOpen, setIsTermsModalOpen] = useState(true);
31
+ const [isVerifyingLink, setIsVerifyingLink] = useState(false);
32
+ const [linkAccountName, setLinkAccountName] = useState('');
33
+ const [verificationFailMessage, setVerificationFailMessage] = useState('');
34
+ const dispatch = useManagePartnershipsDispatchContext();
35
+ const { t } = useTranslation();
36
+ const { linkHash } = useParams();
37
+ const location = useLocation();
38
+ const history = useHistory();
39
+ const onClose = () => {
40
+ if (isUpdating)
41
+ return;
42
+ setIsTermsModalOpen(false);
43
+ setIsTermsVisited(false);
44
+ setAckChoice(undefined);
45
+ setIsVerifyingLink(false);
46
+ setVerificationFailMessage('');
47
+ };
48
+ useEffect(() => {
49
+ const verifyLink = () => __awaiter(void 0, void 0, void 0, function* () {
50
+ try {
51
+ setIsVerifyingLink(true);
52
+ setVerificationFailMessage('');
53
+ const response = yield pcm.partnerships.verifyPartnerLink(linkHash);
54
+ setLinkAccountName(response.accountName);
55
+ setIsVerifyingLink(false);
56
+ }
57
+ catch (error) {
58
+ const errorCode = parseInt((error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.status)) || '';
59
+ const errorMessage = errorCode === 400 ? (React.createElement(Trans, null, "You are not authorized to accept or reject partner link.")) : errorCode === 404 ? (React.createElement(Trans, null, "Partner link is invalid. The link has been used or expired.")) : (React.createElement(Trans, null, "There was a problem and partner link cannot be verified at this moment. Please try again later."));
60
+ setVerificationFailMessage(errorMessage);
61
+ }
62
+ });
63
+ const termAck = (ackResponse) => __awaiter(void 0, void 0, void 0, function* () {
64
+ setIsUpdating(true);
65
+ setAckChoice(ackResponse);
66
+ try {
67
+ yield pcm.partnerships.partnerLinkAckResponse(linkHash, ackResponse);
68
+ setIsUpdating(false);
69
+ setIsUpdatingAccounts(dispatch, true);
70
+ }
71
+ catch (e) {
72
+ ToastNotification.addDangerMessage(ackResponse === 'accept' ? t('Failed to add partnership.') : t('Failed to decline partnership.'), React.createElement(Button, { variant: ButtonVariant.link, isInline: true, onClick: () => setIsTermsModalOpen(true) },
73
+ React.createElement(Trans, null, "Try again")));
74
+ setIsUpdating(false);
75
+ }
76
+ history.push({
77
+ search: '',
78
+ });
79
+ });
80
+ verifyLink();
81
+ const decisionAccepted = /decision-\d+=accepted/gi.exec(location.search);
82
+ const decisionDeclined = /rejectedTnC=true/gi.exec(location.search);
83
+ const ackID = get(/ackID=(\d+)/gi.exec(location.search), [1]);
84
+ if ((!!decisionAccepted && ackID) || !!decisionDeclined) {
85
+ const choice = !!decisionAccepted ? 'accept' : !!decisionDeclined ? 'decline' : undefined;
86
+ console.log('choice= ' + choice);
87
+ setAckChoice(choice);
88
+ termAck(choice);
89
+ setIsTermsVisited(true);
90
+ }
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
+ }, [linkHash]);
93
+ return (React.createElement(Modal, { id: "partnership-terms-and-conditions-modal", className: "pf-modal-overflow-visible", title: 'Confirm partnership collaboration', isOpen: isTermsModalOpen, onClose: onClose, showClose: true, onEscapePress: onClose, variant: ModalVariant.large, actions: [
94
+ React.createElement(Button, { href: getTnCUrl(), component: "a", variant: ButtonVariant.primary },
95
+ React.createElement(ExternalLinkAltIcon, null),
96
+ ' ',
97
+ " ",
98
+ React.createElement(Trans, null, "Go to Agreement")),
99
+ React.createElement(Button, { key: "back-to-prev", variant: ButtonVariant.secondary, onClick: () => onClose(), isDisabled: isUpdating },
100
+ React.createElement(Trans, null, "Close")),
101
+ ] },
102
+ React.createElement(React.Fragment, null, isVerifyingLink ? (React.createElement(React.Fragment, null, verificationFailMessage ? (React.createElement("p", { className: "pf-u-mt-xs pf-u-danger-color-100" }, verificationFailMessage)) : (React.createElement("p", { className: "pf-u-mt-xs" },
103
+ React.createElement(LoadingDots, { show: true, message: t('Verifying partner link') }))))) : !isVerifyingLink && !isTermVisited ? (React.createElement(React.Fragment, null,
104
+ React.createElement("p", null, "A partner would like to collaborate with you for support when cases are shared. Please confirm the name below and continue to accept terms and conditions."),
105
+ React.createElement(TextContent, { className: "pf-u-mt-lg" },
106
+ React.createElement(Text, { component: TextVariants.h3 }, linkAccountName)))) : isTermVisited && isUpdating ? (React.createElement(LoadingIndicator, { show: true, size: "lg" })) : isTermVisited && ackChoice === 'accept' ? (React.createElement("div", null, "Your partnership link is created successfully")) : (React.createElement("div", null, "You have not accepted terms and conditions")))));
107
+ };
@@ -0,0 +1,8 @@
1
+ interface IProps {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ sendReqAgainFriendlyName?: string;
5
+ }
6
+ export declare const RequestCollaborationModal: (props: IProps) => JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=RequestCollaborationModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestCollaborationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/RequestCollaborationModal.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAID,eAAO,MAAM,yBAAyB,UAAW,MAAM,gBAyNtD,CAAC"}
@@ -0,0 +1,153 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { pcm } from '@cee-eng/hydrajs';
11
+ import { Button, ButtonVariant, Form, FormGroup, FormHelperText, Grid, GridItem, Modal, ModalVariant, TextInput, Tooltip, TooltipPosition, } from '@patternfly/react-core';
12
+ import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
13
+ import { ToastNotification, useCopyToClipboard } from '@rh-support/components';
14
+ import { isEmpty } from 'lodash';
15
+ import React, { useRef, useState } from 'react';
16
+ import { Trans, useTranslation } from 'react-i18next';
17
+ import { useManagePartnershipsDispatchContext } from '../../context/ManagePartnershipsProvider';
18
+ import { setIsUpdatingRequests } from '../../reducers/ManagePartnershipsReducer';
19
+ export const RequestCollaborationModal = (props) => {
20
+ var _a;
21
+ const { t } = useTranslation();
22
+ const clipboardRef = useRef(null);
23
+ const { clipboardText, copyToClipboard } = useCopyToClipboard(clipboardRef);
24
+ const [validated, setValidated] = useState('default');
25
+ const [isDuplicateLinkName, setIsDuplicateLinkName] = useState(false);
26
+ const [friendlyName, setFriendlyName] = useState('');
27
+ const [generatedUrl, setGeneratedUrl] = useState('');
28
+ const [nextButtonIsClicked, setNextButtonIsClicked] = useState(false);
29
+ const [showDone, setShowDone] = useState(false);
30
+ const [isFetching, setIsFetching] = useState(false);
31
+ const [isDoneClicked, setIsDoneClicked] = useState(false);
32
+ const [isCopyClicked, setIsCopyClicked] = useState(false);
33
+ const dispatch = useManagePartnershipsDispatchContext();
34
+ const isRequestingAgain = !isEmpty((_a = props.sendReqAgainFriendlyName) === null || _a === void 0 ? void 0 : _a.trim());
35
+ const [localLinkName, setLocalLinkName] = useState('');
36
+ const handleLinkNameChange = (link, _event) => {
37
+ setLocalLinkName(link);
38
+ setFriendlyName(link);
39
+ setIsDuplicateLinkName(false);
40
+ if (isEmpty(link.trim()) && nextButtonIsClicked) {
41
+ setValidated('error');
42
+ }
43
+ else {
44
+ setValidated('success');
45
+ }
46
+ };
47
+ const handleKeyDown = (e) => __awaiter(void 0, void 0, void 0, function* () {
48
+ if (validated !== 'error' && e.keyCode === 13) {
49
+ onNext && onNext();
50
+ }
51
+ });
52
+ const reset = () => {
53
+ setValidated('default');
54
+ setIsDuplicateLinkName(false);
55
+ setFriendlyName('');
56
+ setGeneratedUrl('');
57
+ setNextButtonIsClicked(false);
58
+ setShowDone(false);
59
+ setIsDoneClicked(false);
60
+ setIsCopyClicked(false);
61
+ };
62
+ const onClose = () => {
63
+ reset();
64
+ props.onClose();
65
+ };
66
+ const onDone = () => {
67
+ setIsDoneClicked(true);
68
+ if (isCopyClicked) {
69
+ reset();
70
+ props.onClose();
71
+ }
72
+ };
73
+ const onNext = () => __awaiter(void 0, void 0, void 0, function* () {
74
+ var _b;
75
+ setNextButtonIsClicked(true);
76
+ if (!isRequestingAgain && isEmpty(friendlyName.trim())) {
77
+ setValidated('error');
78
+ return;
79
+ }
80
+ setIsFetching(true);
81
+ try {
82
+ let url;
83
+ if ((_b = props.sendReqAgainFriendlyName) === null || _b === void 0 ? void 0 : _b.trim()) {
84
+ url = yield pcm.partnerships.requestAgainLink(props.sendReqAgainFriendlyName.trim());
85
+ }
86
+ else if (!isEmpty(friendlyName.trim())) {
87
+ url = yield pcm.partnerships.generatePartnerLink(friendlyName.trim());
88
+ }
89
+ const hash = url.message.replace(/(.*\/)*/, '');
90
+ setGeneratedUrl('https://' +
91
+ window.location.host +
92
+ window.location.pathname +
93
+ '#/manage/partnerships/partnerlink/' +
94
+ hash);
95
+ setIsUpdatingRequests(dispatch, true);
96
+ setShowDone(true);
97
+ setIsFetching(false);
98
+ }
99
+ catch (error) {
100
+ console.log(error);
101
+ setIsFetching(false);
102
+ const errorCode = parseInt((error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.status)) || '';
103
+ if (errorCode === 400) {
104
+ setValidated('error');
105
+ setIsDuplicateLinkName(true);
106
+ }
107
+ else {
108
+ onClose();
109
+ ToastNotification.addDangerMessage(t('Failed to generate partner link'));
110
+ }
111
+ }
112
+ });
113
+ const onClickOnCopyToClipboardButton = () => {
114
+ copyToClipboard();
115
+ setIsCopyClicked(true);
116
+ };
117
+ const partnershipLinkId = 'partnership-link-id';
118
+ return (React.createElement(Modal, { id: "request-collaboration-modal", className: "pf-modal-overflow-visible", title: isRequestingAgain ? 'Request collaboration again' : 'Request collaboration', isOpen: props.isOpen, onClose: onClose, showClose: true, onEscapePress: onClose, variant: ModalVariant.large, actions: [
119
+ ...(showDone
120
+ ? [
121
+ React.createElement(Button, { key: "done", variant: ButtonVariant.primary, onClick: onDone, isDisabled: validated === 'error' || (!isCopyClicked && isDoneClicked), "data-tracking-id": "request-collaboration-done-button" },
122
+ React.createElement(Trans, null, "Done")),
123
+ ]
124
+ : [
125
+ React.createElement(Button, { key: "next", variant: ButtonVariant.primary, onClick: onNext, isDisabled: validated === 'error' || isFetching, isLoading: isFetching },
126
+ React.createElement(Trans, null, "Next")),
127
+ ]),
128
+ ] },
129
+ React.createElement(React.Fragment, null,
130
+ React.createElement("p", null, "Initiate a new collaboration by generating a unique link for your customer. Check the status under your requests to see if they accept or reject your collaboration."),
131
+ React.createElement(Form, { className: "pf-u-my-md" },
132
+ React.createElement(Grid, { sm: 12, md: 6, lg: 6 },
133
+ React.createElement(GridItem, null,
134
+ React.createElement(FormGroup, { label: t('Name your link'), type: "string", helperText: React.createElement(FormHelperText, { isHidden: validated === 'error' },
135
+ React.createElement(Trans, null, "Please enter a name for your request")), helperTextInvalid: isDuplicateLinkName
136
+ ? t('Link name already used. Please enter a unique name')
137
+ : t('Please enter a name for your request'), helperTextInvalidIcon: React.createElement(ExclamationCircleIcon, null), fieldId: partnershipLinkId, validated: validated, isRequired: true },
138
+ React.createElement(TextInput, { isRequired: true, validated: validated, value: localLinkName || props.sendReqAgainFriendlyName, id: partnershipLinkId, "aria-describedby": "age-1-helper", onChange: handleLinkNameChange, onKeyDown: handleKeyDown, placeholder: t('e.g. Customer name'), isDisabled: showDone }))))),
139
+ showDone && (React.createElement(React.Fragment, null,
140
+ React.createElement("h4", null,
141
+ React.createElement("strong", null, "Copy and send")),
142
+ React.createElement("div", { className: "clipboard-wrapper" },
143
+ React.createElement("div", { className: "clip-content-wrapper code-block" },
144
+ React.createElement("code", { ref: clipboardRef }, generatedUrl)),
145
+ React.createElement(Tooltip, { position: TooltipPosition.top, content: clipboardText, trigger: "click" },
146
+ React.createElement("button", { className: "nimbus-icon-clipboard clip-code-raw-btn xs-icon", "aria-hidden": "true", onClick: onClickOnCopyToClipboardButton, "data-tracking-id": "request-collaboration-link-copy-button" }))),
147
+ React.createElement("p", { className: !isCopyClicked && isDoneClicked ? 'pf-u-danger-color-100' : '' },
148
+ React.createElement(Trans, null,
149
+ ' ',
150
+ "Please ",
151
+ React.createElement("strong", null, "copy and send"),
152
+ " this unique link to your customer for approval.")))))));
153
+ };
@@ -0,0 +1,3 @@
1
+ export declare const daysFromNow: (date: string) => number;
2
+ export declare function Requests(): JSX.Element;
3
+ //# sourceMappingURL=Requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/Requests.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,WAAW,SAAU,MAAM,WAMvC,CAAC;AACF,wBAAgB,QAAQ,gBA6OvB"}
@@ -0,0 +1,198 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { pcm } from '@cee-eng/hydrajs';
11
+ import { AlertVariant, Badge, ButtonVariant, ExpandableSection, ExpandableSectionToggle, Label, Stack, StackItem, } from '@patternfly/react-core';
12
+ import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
13
+ import { LoadingIndicator, ToastNotification, useConfirmation } from '@rh-support/components';
14
+ import { UserPreferencesKeys, useUserPreferences } from '@rh-support/react-context';
15
+ import isEmpty from 'lodash/isEmpty';
16
+ import React, { useEffect, useState } from 'react';
17
+ import { Trans, useTranslation } from 'react-i18next';
18
+ import { useLocation } from 'react-router';
19
+ import { useManagePartnershipsContext } from '../../context/ManagePartnershipsProvider';
20
+ import { ManageTable } from '../ManageTable';
21
+ import { RequestCollaborationModal } from './RequestCollaborationModal';
22
+ // returns number of days from now
23
+ export const daysFromNow = (date) => {
24
+ let now = new Date();
25
+ let toDate = new Date(date);
26
+ let difference = toDate.getTime() - now.getTime();
27
+ let TotalDays = Math.ceil(difference / (1000 * 3600 * 24));
28
+ return TotalDays;
29
+ };
30
+ export function Requests() {
31
+ const { t } = useTranslation();
32
+ const confirmRemove = useConfirmation();
33
+ const [isExpanded, setIsExpanded] = useState(false);
34
+ const [statusList, setStatusList] = useState([]);
35
+ const [isFetchingStatuses, setIsFetchingStatuses] = useState(false);
36
+ const [isRequestAgainModalOpen, setIsRequestAgainModalOpen] = useState(false);
37
+ const [selectedRowFriendlyName, setSelectedRowFriendlyName] = useState('');
38
+ const { isUpdatingRequests } = useManagePartnershipsContext();
39
+ const location = useLocation();
40
+ const { getPreferenceByKey, updatePreferences } = useUserPreferences();
41
+ const onToggle = (isExpanded) => {
42
+ setIsExpanded(isExpanded);
43
+ };
44
+ const deleteRequest = (friendlyName) => __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ yield confirmRemove({
47
+ catchOnCancel: true,
48
+ title: t('Are you sure?'),
49
+ description: React.createElement(Trans, null, "You will not be able to undo this action after verifying."),
50
+ confirmText: t('Delete'),
51
+ confirmButtonVariant: ButtonVariant.danger,
52
+ });
53
+ try {
54
+ yield pcm.partnerships.removePendingPartnerLink(friendlyName);
55
+ setStatusList(statusList.filter((s) => s.friendlyName !== friendlyName));
56
+ ToastNotification.addSuccessMessage(t('Partnership removed successfully'));
57
+ }
58
+ catch (e) {
59
+ ToastNotification.addDangerMessage(t('Partnership failed to be removed'));
60
+ }
61
+ }
62
+ catch (e) {
63
+ // on confirm modal, cancel button is clicked
64
+ }
65
+ });
66
+ const statusLabels = (data, prop) => {
67
+ if (!data)
68
+ return '';
69
+ const statusObj = {
70
+ PENDING: {
71
+ label: `Expires in ${daysFromNow(data.expiryDate)} days`,
72
+ color: daysFromNow(data.expiryDate) < 4 ? 'gold' : 'gray',
73
+ title: t('Link not used'),
74
+ },
75
+ DECLINED: { label: t('Rejected'), color: 'red', title: t('Link used') },
76
+ EXPIRED: { label: t('Expired'), color: 'red', title: t('Link expired') },
77
+ ACCEPTED: { label: t('Accepted'), color: 'green', title: t('Link accepted') },
78
+ };
79
+ return statusObj[data.status][prop] || '';
80
+ };
81
+ const columns = [
82
+ {
83
+ accessor: (data) => (data === null || data === void 0 ? void 0 : data.friendlyName) || '',
84
+ sortable: false,
85
+ id: 'frienly-name',
86
+ cellWidth: 25,
87
+ title: t('Name'),
88
+ },
89
+ {
90
+ sortable: false,
91
+ id: 'link-status',
92
+ cellWidth: 25,
93
+ cell: (data) => (React.createElement(Label, { icon: React.createElement(ExclamationCircleIcon, null), color: statusLabels(data, 'color') }, statusLabels(data, 'label'))),
94
+ rowProps: (data) => ({
95
+ status: (data === null || data === void 0 ? void 0 : data.status) || '',
96
+ }),
97
+ title: t('Status'),
98
+ },
99
+ {
100
+ accessor: (data) => statusLabels(data, 'title'),
101
+ sortable: false,
102
+ id: 'link-description',
103
+ cellWidth: 50,
104
+ title: t('Description'),
105
+ },
106
+ ];
107
+ const requestAgain = (friendlyName) => {
108
+ setSelectedRowFriendlyName(friendlyName);
109
+ setIsRequestAgainModalOpen(true);
110
+ };
111
+ const actionResolver = (rowData) => {
112
+ var _a, _b, _c, _d;
113
+ if (!rowData)
114
+ return;
115
+ const friendlyName = ((_a = rowData.cells) === null || _a === void 0 ? void 0 : _a[0]) || '';
116
+ //@ts-ignore
117
+ const status = ((_d = (_c = (_b = rowData.cells) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.status) || '';
118
+ return [
119
+ ...(status === 'EXPIRED'
120
+ ? [
121
+ {
122
+ title: t('Request Again'),
123
+ onClick: () => requestAgain(friendlyName),
124
+ itemKey: 'request-again',
125
+ },
126
+ ]
127
+ : []),
128
+ {
129
+ title: (React.createElement("div", { className: "pf-u-danger-color-200" },
130
+ React.createElement(Trans, null, "Delete"))),
131
+ onClick: () => deleteRequest(friendlyName),
132
+ itemKey: 'delete-request',
133
+ },
134
+ ];
135
+ };
136
+ const onRequestAgainModalClose = () => {
137
+ setIsRequestAgainModalOpen(false);
138
+ };
139
+ useEffect(() => {
140
+ if (location.pathname !== '/manage/partnerships')
141
+ return;
142
+ // when a customer accepts a link, as soon as partner visits
143
+ // the partnership page, a pop-up should show up and inform
144
+ // partner that customer has accepted the link
145
+ // to achieve this, we always save the last accepted link
146
+ // friendly name that is unique in user preferences data
147
+ const displayLinkIsVerifiedPopUp = (currentLatestAcceptedFriendlyName) => {
148
+ const lastSavedAcceptedFriendlyName = JSON.parse(getPreferenceByKey(UserPreferencesKeys.partnershipLastestAcceptedLink));
149
+ if (lastSavedAcceptedFriendlyName === currentLatestAcceptedFriendlyName)
150
+ return;
151
+ try {
152
+ updatePreferences(UserPreferencesKeys.partnershipLastestAcceptedLink, JSON.stringify(currentLatestAcceptedFriendlyName));
153
+ ToastNotification.addSuccessMessage(t('Verified request'), t('A customer has verified your collaboration. Find them in the table below.'));
154
+ }
155
+ catch (e) {
156
+ // silently fails
157
+ }
158
+ };
159
+ const getStatuses = () => __awaiter(this, void 0, void 0, function* () {
160
+ setIsFetchingStatuses(true);
161
+ try {
162
+ const statuses = yield pcm.partnerships.getPartnerLinksStatuses(1, 1000, [
163
+ 'declined',
164
+ 'expired',
165
+ 'pending',
166
+ ]);
167
+ setStatusList(statuses.filter((s) => s.deleted === false));
168
+ const lastStatusesAccepted = yield pcm.partnerships.getPartnerLinksStatuses(1, 1, ['accepted']);
169
+ if (lastStatusesAccepted && lastStatusesAccepted[0])
170
+ displayLinkIsVerifiedPopUp(lastStatusesAccepted[0].friendlyName);
171
+ setIsFetchingStatuses(false);
172
+ }
173
+ catch (e) {
174
+ setIsFetchingStatuses(false);
175
+ ToastNotification.addDangerMessage(t('Failed to get partnership requests'));
176
+ }
177
+ });
178
+ getStatuses();
179
+ // eslint-disable-next-line react-hooks/exhaustive-deps
180
+ }, [isUpdatingRequests, location.pathname]);
181
+ const contentId = 'requests-detached-toggle-content';
182
+ return (React.createElement(React.Fragment, null,
183
+ React.createElement("section", { id: "manage-partnerships-pending-requests" },
184
+ React.createElement(Stack, null,
185
+ React.createElement(StackItem, { className: "toolbar" },
186
+ React.createElement(ExpandableSectionToggle, { isExpanded: isExpanded, onToggle: onToggle, contentId: contentId },
187
+ React.createElement("div", null,
188
+ React.createElement("label", { className: "pf-u-color-100" },
189
+ ' ',
190
+ React.createElement(Trans, null, "Requests"),
191
+ isFetchingStatuses ? (React.createElement(LoadingIndicator, { isInline: true, size: "sm", className: "pf-u-mx-sm" })) : (React.createElement(Badge, { className: "pf-u-mx-sm" }, statusList.length)))))),
192
+ React.createElement(StackItem, null,
193
+ React.createElement(ExpandableSection, { isIndented: false, isExpanded: isExpanded, isDetached: true, contentId: contentId }, !isEmpty(statusList) ? (React.createElement(ManageTable, { ariaLabel: t('Requests'), columns: columns, data: statusList, errorVariant: AlertVariant.warning, isFetching: isFetchingStatuses, isError: false, errorTitle: t('Request error'), errorComponent: React.createElement(Trans, null, "Could not get requests"), pagination: true, actionResolver: statusList && !isFetchingStatuses && !isEmpty(statusList)
194
+ ? actionResolver
195
+ : null, perPage: 5 })) : (React.createElement("p", { className: "pf-u-p-md" },
196
+ React.createElement(Trans, null, "No request"))))))),
197
+ isRequestAgainModalOpen && (React.createElement(RequestCollaborationModal, { isOpen: isRequestAgainModalOpen, onClose: onRequestAgainModalClose, sendReqAgainFriendlyName: selectedRowFriendlyName }))));
198
+ }
@@ -0,0 +1,2 @@
1
+ export declare function ManagePartnerships(): JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/index.tsx"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,gBAsCjC"}
@@ -0,0 +1,25 @@
1
+ import { ErrorBoundary } from '@rh-support/components';
2
+ import { useGlobalStateContext } from '@rh-support/react-context';
3
+ import React from 'react';
4
+ import { Trans, useTranslation } from 'react-i18next';
5
+ import { Route, Switch } from 'react-router-dom';
6
+ import { ManagePartnershipsProvider } from '../../context/ManagePartnershipsProvider';
7
+ import { NonOrgCustomerInfoModal } from './NonOrgCustomerInfoModal';
8
+ import { PartnershipsList } from './PartnershipsList';
9
+ import { PartnershipsTermsModal } from './PartnershipsTermsModal';
10
+ import { Requests } from './Requests';
11
+ export function ManagePartnerships() {
12
+ const { t } = useTranslation();
13
+ const { globalMetadataState: { loggedInUserRights }, } = useGlobalStateContext();
14
+ return (React.createElement(React.Fragment, null,
15
+ React.createElement("header", { className: "pf-u-mt-md pf-u-mb-xs" },
16
+ React.createElement("h2", null,
17
+ React.createElement(Trans, null, "Partnerships")),
18
+ React.createElement("p", null, loggedInUserRights.data.isPartner() ? (React.createElement(Trans, null, "Add, edit, or remove customer partnerships and manage your pending requests.")) : (React.createElement(Trans, null, "Confirm, filter, or remove partnerships and manage collaboration requests.")))),
19
+ React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading partnerships list') } },
20
+ React.createElement(ManagePartnershipsProvider, null,
21
+ loggedInUserRights.data.isPartner() && React.createElement(Requests, null),
22
+ React.createElement(PartnershipsList, null),
23
+ React.createElement(Switch, null,
24
+ React.createElement(Route, { path: `/manage/partnerships/partnerlink/:linkHash?` }, loggedInUserRights.data.isCustomerOrgAdmin() ? (React.createElement(PartnershipsTermsModal, null)) : (React.createElement(NonOrgCustomerInfoModal, null))))))));
25
+ }
@@ -18,6 +18,7 @@ interface IProps {
18
18
  areActionsDisabled?: IAreActionsDisabled;
19
19
  actionResolver?: IActionsResolver;
20
20
  noResultText?: string;
21
+ perPage?: number;
21
22
  }
22
23
  export declare function ManageTable(props: IProps): JSX.Element;
23
24
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ManageTable.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTable/ManageTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGH,YAAY,EAQf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAmC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,cAAc,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AA0BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA4CxC"}
1
+ {"version":3,"file":"ManageTable.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTable/ManageTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGH,YAAY,EAQf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAmC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,cAAc,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AA0BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA8CxC"}
@@ -32,11 +32,12 @@ const noResultFoundRow = (noResultString = '') => [
32
32
  ];
33
33
  export function ManageTable(props) {
34
34
  const { ariaLabel, errorComponent, errorTitle, errorVariant, isError, isFetching, sortInfo, actions, keepPageNumberOnDataChange, areActionsDisabled, actionResolver } = props, tableProps = __rest(props, ["ariaLabel", "errorComponent", "errorTitle", "errorVariant", "isError", "isFetching", "sortInfo", "actions", "keepPageNumberOnDataChange", "areActionsDisabled", "actionResolver"]);
35
+ const pagination = () => (props.pagination !== undefined ? props.pagination : true);
35
36
  return (React.createElement("div", { className: "table-wrapper" },
36
37
  isError && (React.createElement(React.Fragment, null,
37
38
  React.createElement(Alert, { variant: errorVariant, title: errorTitle, actionClose: React.createElement(AlertActionCloseButton, null) }, errorComponent))),
38
39
  React.createElement(Table, Object.assign({}, tableProps),
39
- React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination: true, emptyStateRow: noResultFoundRow(props.noResultText), actions: actions, areActionsDisabled: areActionsDisabled, actionResolver: actionResolver, isLoading: isFetching, keepPageNumberOnDataChange: keepPageNumberOnDataChange }),
40
- tableProps.data.length > 0 && (React.createElement("footer", null,
41
- React.createElement(TablePagination, { variant: PaginationVariant.bottom }))))));
40
+ React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination: pagination(), emptyStateRow: noResultFoundRow(props.noResultText), actions: actions, areActionsDisabled: areActionsDisabled, actionResolver: actionResolver, isLoading: isFetching, keepPageNumberOnDataChange: keepPageNumberOnDataChange }),
41
+ tableProps.data.length > 0 && pagination() && (React.createElement("footer", null,
42
+ React.createElement(TablePagination, { variant: PaginationVariant.bottom, perPage: props.perPage || 10 }))))));
42
43
  }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { IManagePartnershipsState, ManagePartnershipsReducerDispatchType } from '../reducers/ManagePartnershipsReducer';
3
+ export declare const intialManagePartnershipsContext: IManagePartnershipsState;
4
+ export declare const ManagePartnershipsStateContext: React.Context<IManagePartnershipsState>;
5
+ export declare const ManagePartnershipsDispatchContext: React.Context<ManagePartnershipsReducerDispatchType>;
6
+ export declare function useManagePartnershipsContext(): IManagePartnershipsState;
7
+ export declare function useManagePartnershipsDispatchContext(): ManagePartnershipsReducerDispatchType;
8
+ export declare function ManagePartnershipsProvider({ children }: {
9
+ children: any;
10
+ }): JSX.Element;
11
+ //# sourceMappingURL=ManagePartnershipsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagePartnershipsProvider.d.ts","sourceRoot":"","sources":["../../../src/context/ManagePartnershipsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EACH,wBAAwB,EAExB,qCAAqC,EACxC,MAAM,uCAAuC,CAAC;AAE/C,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC;AAGF,eAAO,MAAM,8BAA8B,yCAE1C,CAAC;AACF,eAAO,MAAM,iCAAiC,sDAA6C,CAAC;AAE5F,wBAAgB,4BAA4B,6BAM3C;AAED,wBAAgB,oCAAoC,0CAMnD;AAED,wBAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAE;;CAAA,eAStD"}
@@ -0,0 +1,26 @@
1
+ import React, { useContext, useReducer } from 'react';
2
+ import { ManagePartnershipsReducer, } from '../reducers/ManagePartnershipsReducer';
3
+ export const intialManagePartnershipsContext = {
4
+ isUpdatingPartnerAccountList: false,
5
+ isUpdatingRequests: false,
6
+ };
7
+ const initalDispatchContext = null;
8
+ export const ManagePartnershipsStateContext = React.createContext(intialManagePartnershipsContext);
9
+ export const ManagePartnershipsDispatchContext = React.createContext(initalDispatchContext);
10
+ export function useManagePartnershipsContext() {
11
+ if (ManagePartnershipsStateContext === undefined) {
12
+ throw new Error(`useManagePartnershipsContext must be used within a ManagePartnershipsContextProvider`);
13
+ }
14
+ return useContext(ManagePartnershipsStateContext);
15
+ }
16
+ export function useManagePartnershipsDispatchContext() {
17
+ if (ManagePartnershipsDispatchContext === undefined) {
18
+ throw new Error(`useManagePartnershipsContext must be used within a ManagePartnershipsContextProvider`);
19
+ }
20
+ return useContext(ManagePartnershipsDispatchContext);
21
+ }
22
+ export function ManagePartnershipsProvider({ children }) {
23
+ const [managePartnershipsState, dispatch] = useReducer(ManagePartnershipsReducer, intialManagePartnershipsContext);
24
+ return (React.createElement(ManagePartnershipsStateContext.Provider, { value: Object.assign({}, managePartnershipsState) },
25
+ React.createElement(ManagePartnershipsDispatchContext.Provider, { value: dispatch }, children)));
26
+ }
@@ -0,0 +1,16 @@
1
+ import { IAction } from '@rh-support/types/shared';
2
+ export interface IManagePartnershipsState {
3
+ isUpdatingPartnerAccountList: boolean;
4
+ isUpdatingRequests: boolean;
5
+ }
6
+ export declare enum ManagePartnershipsReducerConstants {
7
+ setIsUpdatingAccounts = "setIsUpdatingAccounts",
8
+ setIsUpdatingRequests = "setIsUpdatingRequests"
9
+ }
10
+ declare type IActionType = IAction<ManagePartnershipsReducerConstants, IManagePartnershipsState>;
11
+ export declare type ManagePartnershipsReducerDispatchType = (value: IActionType) => void;
12
+ export declare const ManagePartnershipsReducer: (state: IManagePartnershipsState, action: IActionType) => IManagePartnershipsState;
13
+ export declare const setIsUpdatingAccounts: (dispatch: ManagePartnershipsReducerDispatchType, isUpdatingPartnerAccountList: boolean) => void;
14
+ export declare const setIsUpdatingRequests: (dispatch: ManagePartnershipsReducerDispatchType, isUpdatingRequests: boolean) => void;
15
+ export {};
16
+ //# sourceMappingURL=ManagePartnershipsReducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagePartnershipsReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/ManagePartnershipsReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,MAAM,WAAW,wBAAwB;IACrC,4BAA4B,EAAE,OAAO,CAAC;IACtC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,oBAAY,kCAAkC;IAC1C,qBAAqB,0BAA0B;IAC/C,qBAAqB,0BAA0B;CAClD;AAED,aAAK,WAAW,GAAG,OAAO,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AACzF,oBAAY,qCAAqC,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAEjF,eAAO,MAAM,yBAAyB,UAC3B,wBAAwB,0BAEhC,wBAYF,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACpB,qCAAqC,gCACjB,OAAO,SAMxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,qCAAqC,sBAAsB,OAAO,SAKjH,CAAC"}
@@ -0,0 +1,30 @@
1
+ export var ManagePartnershipsReducerConstants;
2
+ (function (ManagePartnershipsReducerConstants) {
3
+ ManagePartnershipsReducerConstants["setIsUpdatingAccounts"] = "setIsUpdatingAccounts";
4
+ ManagePartnershipsReducerConstants["setIsUpdatingRequests"] = "setIsUpdatingRequests";
5
+ })(ManagePartnershipsReducerConstants || (ManagePartnershipsReducerConstants = {}));
6
+ export const ManagePartnershipsReducer = (state, action) => {
7
+ switch (action.type) {
8
+ case ManagePartnershipsReducerConstants.setIsUpdatingAccounts: {
9
+ return Object.assign(Object.assign({}, state), { isUpdatingPartnerAccountList: action.payload.isUpdatingPartnerAccountList });
10
+ }
11
+ case ManagePartnershipsReducerConstants.setIsUpdatingRequests: {
12
+ return Object.assign(Object.assign({}, state), { isUpdatingRequests: action.payload.isUpdatingRequests });
13
+ }
14
+ default: {
15
+ return state;
16
+ }
17
+ }
18
+ };
19
+ export const setIsUpdatingAccounts = (dispatch, isUpdatingPartnerAccountList) => {
20
+ dispatch({
21
+ type: ManagePartnershipsReducerConstants.setIsUpdatingAccounts,
22
+ payload: { isUpdatingPartnerAccountList },
23
+ });
24
+ };
25
+ export const setIsUpdatingRequests = (dispatch, isUpdatingRequests) => {
26
+ dispatch({
27
+ type: ManagePartnershipsReducerConstants.setIsUpdatingRequests,
28
+ payload: { isUpdatingRequests },
29
+ });
30
+ };
@@ -309,9 +309,13 @@ svg.hostnameSpinner {
309
309
  }
310
310
 
311
311
  #version-dropdown-selector {
312
- z-index: 299;
312
+ z-index: 89;
313
313
  }
314
314
 
315
315
  #tc-product-dropdown-selector {
316
- z-index: 299;
316
+ z-index: 89;
317
+ }
318
+
319
+ #requests-detached-toggle-content thead {
320
+ display: none;
317
321
  }
@@ -53,7 +53,7 @@ div#top-content-major-version-performance-metric.pf-c-modal-box {
53
53
  position: sticky;
54
54
  top: 0;
55
55
  background: var(--pf-c-modal-box--BackgroundColor);
56
- z-index: 101; // As .pf-c-toggle-group__button is having z-index: var(--pf-c-toggle-group__button--ZIndex) (100) need to set z-index 101;
56
+ z-index: 89; // As .pf-c-toggle-group__button is having z-index: var(--pf-c-toggle-group__button--ZIndex)
57
57
  padding-bottom: var(--pf-global--spacer--sm);
58
58
  }
59
59
  .content {
@@ -128,5 +128,5 @@ div.performance-metrics-modal {
128
128
  }
129
129
 
130
130
  .top-content-panel {
131
- z-index: 100;
131
+ z-index: 9;
132
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "2.0.7",
3
+ "version": "2.0.8-beta-2",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -45,13 +45,8 @@
45
45
  "prepublish": "npm run clean && npm run build:esm",
46
46
  "prepublishOnly": "npm run build"
47
47
  },
48
- "browserslist": [
49
- ">0.2%",
50
- "not ie <= 11",
51
- "not op_mini all"
52
- ],
53
48
  "peerDependencies": {
54
- "@cee-eng/hydrajs": "4.15.78",
49
+ "@cee-eng/hydrajs": "4.16.4",
55
50
  "@patternfly/patternfly": "4.196.7",
56
51
  "@patternfly/pfe-accordion": "1.12.3",
57
52
  "@patternfly/pfe-collapse": "1.12.3",
@@ -82,19 +77,19 @@
82
77
  "typescript": "4.3.5"
83
78
  },
84
79
  "dependencies": {
85
- "@cee-eng/hydrajs": "4.15.78",
80
+ "@cee-eng/hydrajs": "4.16.4",
86
81
  "@patternfly/patternfly": "4.196.7",
87
82
  "@patternfly/pfe-accordion": "1.12.3",
88
83
  "@patternfly/pfe-collapse": "1.12.3",
89
84
  "@patternfly/pfe-tabs": "1.12.3",
90
85
  "@patternfly/react-core": "4.264.0",
91
86
  "@patternfly/react-table": "4.111.33",
92
- "@rh-support/components": "2.0.5",
93
- "@rh-support/configs": "2.0.4",
94
- "@rh-support/react-context": "2.0.5",
95
- "@rh-support/types": "2.0.1",
96
- "@rh-support/user-permissions": "2.0.5",
97
- "@rh-support/utils": "2.0.5",
87
+ "@rh-support/components": "2.0.7-beta.1",
88
+ "@rh-support/configs": "2.0.9",
89
+ "@rh-support/react-context": "2.0.7-beta-1",
90
+ "@rh-support/types": "2.0.2",
91
+ "@rh-support/user-permissions": "2.0.3-beta-1",
92
+ "@rh-support/utils": "2.0.1-beta-1",
98
93
  "@types/react-beautiful-dnd": "^13.0.0",
99
94
  "i18next": ">=17.0.1",
100
95
  "lodash": ">=4.17.15",
@@ -104,5 +99,9 @@
104
99
  "react-i18next": ">=10.11.0",
105
100
  "react-router-dom": ">=5.1.2"
106
101
  },
107
- "gitHead": "a2b0cdd179ebcac6eb18d7e3387337a1d6cb6c6c"
102
+ "browserslist": [
103
+ "defaults and supports es6-module",
104
+ "maintained node versions"
105
+ ],
106
+ "gitHead": "0227f4cbd5f46c54167a7e6e7a7694df73fae5e3"
108
107
  }