@rh-support/manage 2.1.20 → 2.1.22
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.
- package/lib/esm/ManageTabs.d.ts.map +1 -1
- package/lib/esm/ManageTabs.js +21 -4
- package/lib/esm/Routes.d.ts +1 -0
- package/lib/esm/Routes.d.ts.map +1 -1
- package/lib/esm/Routes.js +6 -0
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts +2 -0
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.js +15 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts +2 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsList.js +185 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts +3 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.js +112 -0
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts +8 -0
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.js +153 -0
- package/lib/esm/components/ManagePartnerships/Requests.d.ts +3 -0
- package/lib/esm/components/ManagePartnerships/Requests.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/Requests.js +203 -0
- package/lib/esm/components/ManagePartnerships/index.d.ts +2 -0
- package/lib/esm/components/ManagePartnerships/index.d.ts.map +1 -0
- package/lib/esm/components/ManagePartnerships/index.js +25 -0
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.js +3 -4
- package/lib/esm/components/ManageTable/ManageTable.d.ts +1 -0
- package/lib/esm/components/ManageTable/ManageTable.d.ts.map +1 -1
- package/lib/esm/components/ManageTable/ManageTable.js +4 -3
- package/lib/esm/context/ManagePartnershipsProvider.d.ts +11 -0
- package/lib/esm/context/ManagePartnershipsProvider.d.ts.map +1 -0
- package/lib/esm/context/ManagePartnershipsProvider.js +26 -0
- package/lib/esm/reducers/ManagePartnershipsReducer.d.ts +16 -0
- package/lib/esm/reducers/ManagePartnershipsReducer.d.ts.map +1 -0
- package/lib/esm/reducers/ManagePartnershipsReducer.js +30 -0
- package/lib/esm/scss/_main.scss +4 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"
|
|
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,eAkKvC"}
|
package/lib/esm/ManageTabs.js
CHANGED
|
@@ -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',
|
|
@@ -113,7 +130,7 @@ export function ManageTabs(props) {
|
|
|
113
130
|
const getSelectedIndex = () => {
|
|
114
131
|
if (isOnlyBasePath)
|
|
115
132
|
return 0;
|
|
116
|
-
const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname);
|
|
133
|
+
const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname.substring(0, tab.routePath.length));
|
|
117
134
|
return tabIndex > -1 ? tabIndex : 0;
|
|
118
135
|
};
|
|
119
136
|
/**
|
package/lib/esm/Routes.d.ts
CHANGED
package/lib/esm/Routes.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"PartnershipsList.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsList.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,gBAAgB,gBAsO/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'), "data-tracking-id": "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 @@
|
|
|
1
|
+
{"version":3,"file":"PartnershipsTermsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsTermsModal.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,SAAS,WAMxB;AAID,eAAO,MAAM,sBAAsB,mBAsKlC,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
setIsTermsVisited(true);
|
|
61
|
+
setVerificationFailMessage(errorMessage);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const termAck = (ackResponse) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
setIsUpdating(true);
|
|
66
|
+
setAckChoice(ackResponse);
|
|
67
|
+
try {
|
|
68
|
+
yield pcm.partnerships.partnerLinkAckResponse(linkHash, ackResponse);
|
|
69
|
+
setIsUpdating(false);
|
|
70
|
+
setIsUpdatingAccounts(dispatch, true);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
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) },
|
|
74
|
+
React.createElement(Trans, null, "Try again")));
|
|
75
|
+
setIsUpdating(false);
|
|
76
|
+
}
|
|
77
|
+
history.push({
|
|
78
|
+
search: '',
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
verifyLink();
|
|
82
|
+
const decisionAccepted = /decision-\d+=accepted/gi.exec(location.search);
|
|
83
|
+
const decisionDeclined = /rejectedTnC=true/gi.exec(location.search);
|
|
84
|
+
const ackID = get(/ackID=(\d+)/gi.exec(location.search), [1]);
|
|
85
|
+
if ((!!decisionAccepted && ackID) || !!decisionDeclined) {
|
|
86
|
+
const choice = !!decisionAccepted ? 'accept' : !!decisionDeclined ? 'decline' : undefined;
|
|
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: !isTermVisited
|
|
94
|
+
? [
|
|
95
|
+
React.createElement(Button, { href: getTnCUrl(), component: "a", variant: ButtonVariant.primary, key: "go-to-agreement", "data-tracking-id": "go-to-agreement" },
|
|
96
|
+
React.createElement(ExternalLinkAltIcon, null),
|
|
97
|
+
' ',
|
|
98
|
+
" ",
|
|
99
|
+
React.createElement(Trans, null, "Go to Agreement")),
|
|
100
|
+
React.createElement(Button, { key: "close-new-partnership-modal", "data-tracking-id": "close-new-partnership-modal", variant: ButtonVariant.secondary, onClick: () => onClose() },
|
|
101
|
+
React.createElement(Trans, null, "Close")),
|
|
102
|
+
]
|
|
103
|
+
: [
|
|
104
|
+
React.createElement(Button, { key: "close-after-link-created", "data-tracking-id": "close-after-link-created", variant: ButtonVariant.primary, onClick: () => onClose(), isDisabled: isUpdating },
|
|
105
|
+
React.createElement(Trans, null, "Close")),
|
|
106
|
+
] },
|
|
107
|
+
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" },
|
|
108
|
+
React.createElement(LoadingDots, { show: true, message: t('Verifying partner link') }))))) : !isVerifyingLink && !isTermVisited ? (React.createElement(React.Fragment, null,
|
|
109
|
+
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."),
|
|
110
|
+
React.createElement(TextContent, { className: "pf-u-mt-lg" },
|
|
111
|
+
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")))));
|
|
112
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/Requests.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,WAAW,SAAU,MAAM,WAMvC,CAAC;AACF,wBAAgB,QAAQ,gBAiPvB"}
|
|
@@ -0,0 +1,203 @@
|
|
|
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, useManagePartnershipsDispatchContext, } from '../../context/ManagePartnershipsProvider';
|
|
20
|
+
import { setIsUpdatingRequests } from '../../reducers/ManagePartnershipsReducer';
|
|
21
|
+
import { ManageTable } from '../ManageTable';
|
|
22
|
+
import { RequestCollaborationModal } from './RequestCollaborationModal';
|
|
23
|
+
// returns number of days from now
|
|
24
|
+
export const daysFromNow = (date) => {
|
|
25
|
+
let now = new Date();
|
|
26
|
+
let toDate = new Date(date);
|
|
27
|
+
let difference = toDate.getTime() - now.getTime();
|
|
28
|
+
let TotalDays = Math.ceil(difference / (1000 * 3600 * 24));
|
|
29
|
+
return TotalDays;
|
|
30
|
+
};
|
|
31
|
+
export function Requests() {
|
|
32
|
+
const { t } = useTranslation();
|
|
33
|
+
const confirmRemove = useConfirmation();
|
|
34
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
35
|
+
const [statusList, setStatusList] = useState([]);
|
|
36
|
+
const [isFetchingStatuses, setIsFetchingStatuses] = useState(false);
|
|
37
|
+
const [isRequestAgainModalOpen, setIsRequestAgainModalOpen] = useState(false);
|
|
38
|
+
const [selectedRowFriendlyName, setSelectedRowFriendlyName] = useState('');
|
|
39
|
+
const { isUpdatingRequests } = useManagePartnershipsContext();
|
|
40
|
+
const location = useLocation();
|
|
41
|
+
const { getPreferenceByKey, updatePreferences } = useUserPreferences();
|
|
42
|
+
const dispatch = useManagePartnershipsDispatchContext();
|
|
43
|
+
const onToggle = (isExpanded) => {
|
|
44
|
+
setIsExpanded(isExpanded);
|
|
45
|
+
};
|
|
46
|
+
const deleteRequest = (friendlyName) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
try {
|
|
48
|
+
yield confirmRemove({
|
|
49
|
+
catchOnCancel: true,
|
|
50
|
+
title: t('Are you sure?'),
|
|
51
|
+
description: React.createElement(Trans, null, "You will not be able to undo this action after verifying."),
|
|
52
|
+
confirmText: t('Delete'),
|
|
53
|
+
confirmButtonVariant: ButtonVariant.danger,
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
yield pcm.partnerships.removePendingPartnerLink(friendlyName);
|
|
57
|
+
setStatusList(statusList.filter((s) => s.friendlyName !== friendlyName));
|
|
58
|
+
ToastNotification.addSuccessMessage(t('Partnership removed successfully'));
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
ToastNotification.addDangerMessage(t('Partnership failed to be removed'));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// on confirm modal, cancel button is clicked
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const statusLabels = (data, prop) => {
|
|
69
|
+
if (!data)
|
|
70
|
+
return '';
|
|
71
|
+
const statusObj = {
|
|
72
|
+
PENDING: {
|
|
73
|
+
label: `Expires in ${daysFromNow(data.expiryDate)} days`,
|
|
74
|
+
color: daysFromNow(data.expiryDate) < 4 ? 'gold' : 'gray',
|
|
75
|
+
title: t('Link not used'),
|
|
76
|
+
},
|
|
77
|
+
DECLINED: { label: t('Rejected'), color: 'red', title: t('Link used') },
|
|
78
|
+
EXPIRED: { label: t('Expired'), color: 'red', title: t('Link expired') },
|
|
79
|
+
ACCEPTED: { label: t('Accepted'), color: 'green', title: t('Link accepted') },
|
|
80
|
+
};
|
|
81
|
+
return statusObj[data.status][prop] || '';
|
|
82
|
+
};
|
|
83
|
+
const columns = [
|
|
84
|
+
{
|
|
85
|
+
accessor: (data) => (data === null || data === void 0 ? void 0 : data.friendlyName) || '',
|
|
86
|
+
sortable: false,
|
|
87
|
+
id: 'frienly-name',
|
|
88
|
+
cellWidth: 25,
|
|
89
|
+
title: t('Name'),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
sortable: false,
|
|
93
|
+
id: 'link-status',
|
|
94
|
+
cellWidth: 25,
|
|
95
|
+
cell: (data) => (React.createElement(Label, { icon: React.createElement(ExclamationCircleIcon, null), color: statusLabels(data, 'color') }, statusLabels(data, 'label'))),
|
|
96
|
+
rowProps: (data) => ({
|
|
97
|
+
status: (data === null || data === void 0 ? void 0 : data.status) || '',
|
|
98
|
+
}),
|
|
99
|
+
title: t('Status'),
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
accessor: (data) => statusLabels(data, 'title'),
|
|
103
|
+
sortable: false,
|
|
104
|
+
id: 'link-description',
|
|
105
|
+
cellWidth: 50,
|
|
106
|
+
title: t('Description'),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
const requestAgain = (friendlyName) => {
|
|
110
|
+
setSelectedRowFriendlyName(friendlyName);
|
|
111
|
+
setIsRequestAgainModalOpen(true);
|
|
112
|
+
};
|
|
113
|
+
const actionResolver = (rowData) => {
|
|
114
|
+
var _a, _b, _c, _d;
|
|
115
|
+
if (!rowData)
|
|
116
|
+
return;
|
|
117
|
+
const friendlyName = ((_a = rowData.cells) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
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) || '';
|
|
120
|
+
return [
|
|
121
|
+
...(status === 'EXPIRED'
|
|
122
|
+
? [
|
|
123
|
+
{
|
|
124
|
+
title: t('Request Again'),
|
|
125
|
+
onClick: () => requestAgain(friendlyName),
|
|
126
|
+
itemKey: 'request-again',
|
|
127
|
+
'data-tracking-id': 'request-again',
|
|
128
|
+
},
|
|
129
|
+
]
|
|
130
|
+
: []),
|
|
131
|
+
{
|
|
132
|
+
title: (React.createElement("div", { className: "pf-u-danger-color-200" },
|
|
133
|
+
React.createElement(Trans, null, "Delete"))),
|
|
134
|
+
onClick: () => deleteRequest(friendlyName),
|
|
135
|
+
itemKey: 'delete-request',
|
|
136
|
+
'data-tracking-id': 'delete-request',
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
};
|
|
140
|
+
const onRequestAgainModalClose = () => {
|
|
141
|
+
setIsRequestAgainModalOpen(false);
|
|
142
|
+
};
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (location.pathname !== '/manage/partnerships')
|
|
145
|
+
return;
|
|
146
|
+
// when a customer accepts a link, as soon as partner visits
|
|
147
|
+
// the partnership page, a pop-up should show up and inform
|
|
148
|
+
// partner that customer has accepted the link
|
|
149
|
+
// to achieve this, we always save the last accepted link
|
|
150
|
+
// friendly name that is unique in user preferences data
|
|
151
|
+
const displayLinkIsVerifiedPopUp = (currentLatestAcceptedFriendlyName) => {
|
|
152
|
+
const lastSavedAcceptedFriendlyName = JSON.parse(getPreferenceByKey(UserPreferencesKeys.partnershipLastestAcceptedLink));
|
|
153
|
+
if (lastSavedAcceptedFriendlyName === currentLatestAcceptedFriendlyName)
|
|
154
|
+
return;
|
|
155
|
+
try {
|
|
156
|
+
updatePreferences(UserPreferencesKeys.partnershipLastestAcceptedLink, JSON.stringify(currentLatestAcceptedFriendlyName));
|
|
157
|
+
ToastNotification.addSuccessMessage(t('Verified request'), t('A customer has verified your collaboration. Find them in the table below.'));
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
// silently fails
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const getStatuses = () => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
setIsFetchingStatuses(true);
|
|
165
|
+
try {
|
|
166
|
+
const statuses = yield pcm.partnerships.getPartnerLinksStatuses(1, 1000, [
|
|
167
|
+
'declined',
|
|
168
|
+
'expired',
|
|
169
|
+
'pending',
|
|
170
|
+
]);
|
|
171
|
+
setStatusList(statuses.filter((s) => s.deleted === false));
|
|
172
|
+
const lastStatusesAccepted = yield pcm.partnerships.getPartnerLinksStatuses(1, 1, ['accepted']);
|
|
173
|
+
if (lastStatusesAccepted && lastStatusesAccepted[0])
|
|
174
|
+
displayLinkIsVerifiedPopUp(lastStatusesAccepted[0].friendlyName);
|
|
175
|
+
setIsFetchingStatuses(false);
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
setIsFetchingStatuses(false);
|
|
179
|
+
ToastNotification.addDangerMessage(t('Failed to get partnership requests'));
|
|
180
|
+
}
|
|
181
|
+
setIsUpdatingRequests(dispatch, false);
|
|
182
|
+
});
|
|
183
|
+
getStatuses();
|
|
184
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
185
|
+
}, [isUpdatingRequests, location.pathname]);
|
|
186
|
+
const contentId = 'requests-detached-toggle-content';
|
|
187
|
+
return (React.createElement(React.Fragment, null,
|
|
188
|
+
React.createElement("section", { id: "manage-partnerships-pending-requests" },
|
|
189
|
+
React.createElement(Stack, null,
|
|
190
|
+
React.createElement(StackItem, { className: "toolbar" },
|
|
191
|
+
React.createElement(ExpandableSectionToggle, { isExpanded: isExpanded, onToggle: onToggle, contentId: contentId },
|
|
192
|
+
React.createElement("div", null,
|
|
193
|
+
React.createElement("label", { className: "pf-u-color-100" },
|
|
194
|
+
' ',
|
|
195
|
+
React.createElement(Trans, null, "Requests"),
|
|
196
|
+
isFetchingStatuses ? (React.createElement(LoadingIndicator, { isInline: true, size: "sm", className: "pf-u-mx-sm" })) : (React.createElement(Badge, { className: "pf-u-mx-sm" }, statusList.length)))))),
|
|
197
|
+
React.createElement(StackItem, null,
|
|
198
|
+
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)
|
|
199
|
+
? actionResolver
|
|
200
|
+
: null, perPage: 5 })) : (React.createElement("p", { className: "pf-u-p-md" },
|
|
201
|
+
React.createElement(Trans, null, "No request"))))))),
|
|
202
|
+
isRequestAgainModalOpen && (React.createElement(RequestCollaborationModal, { isOpen: isRequestAgainModalOpen, onClose: onRequestAgainModalClose, sendReqAgainFriendlyName: selectedRowFriendlyName }))));
|
|
203
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAmShD"}
|
|
@@ -36,7 +36,6 @@ export function PreferencesCaseView(props) {
|
|
|
36
36
|
const defaultCaseViewID = 'default-case-view-select';
|
|
37
37
|
const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
|
|
38
38
|
const isInternalUserPermission = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
|
|
39
|
-
const { request: fetchHostnameDefault } = useFetch(accounts.getIsSharingHostname);
|
|
40
39
|
const accountNumber = loggedInUsersAccount.data.accountNumber;
|
|
41
40
|
const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
|
|
42
41
|
const originalAccountPermission = loggedInUserRights.data.isInternal();
|
|
@@ -61,11 +60,11 @@ export function PreferencesCaseView(props) {
|
|
|
61
60
|
}, [localCommentSignature, commentValidated]);
|
|
62
61
|
useEffect(() => {
|
|
63
62
|
function userOriginalHostnameValue() {
|
|
63
|
+
var _a, _b;
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
setIsSharingHostNames(fetchedHostnameStatus.shareHostnameWithRHT);
|
|
66
|
+
((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.shareHostnameWithRHT) &&
|
|
67
|
+
setIsSharingHostNames((_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.shareHostnameWithRHT);
|
|
69
68
|
}
|
|
70
69
|
catch (error) {
|
|
71
70
|
console.log(error);
|
|
@@ -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;
|
|
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,eAoDxC"}
|
|
@@ -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, isInline: true, title: errorTitle, actionClose: React.createElement(AlertActionCloseButton, null), className: "pf-u-my-sm" }, errorComponent))),
|
|
38
39
|
React.createElement(Table, Object.assign({}, tableProps),
|
|
39
|
-
React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination:
|
|
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
|
+
};
|
package/lib/esm/scss/_main.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.22",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"@patternfly/pfe-tabs": "1.12.3",
|
|
85
85
|
"@patternfly/react-core": "4.264.0",
|
|
86
86
|
"@patternfly/react-table": "4.111.33",
|
|
87
|
-
"@rh-support/components": "2.1.
|
|
87
|
+
"@rh-support/components": "2.1.19",
|
|
88
88
|
"@rh-support/configs": "2.0.9",
|
|
89
|
-
"@rh-support/react-context": "2.1.
|
|
89
|
+
"@rh-support/react-context": "2.1.20",
|
|
90
90
|
"@rh-support/types": "2.0.2",
|
|
91
|
-
"@rh-support/user-permissions": "2.1.
|
|
92
|
-
"@rh-support/utils": "2.1.
|
|
91
|
+
"@rh-support/user-permissions": "2.1.13",
|
|
92
|
+
"@rh-support/utils": "2.1.10",
|
|
93
93
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
94
94
|
"i18next": ">=17.0.1",
|
|
95
95
|
"lodash": ">=4.17.15",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"defaults and supports es6-module",
|
|
104
104
|
"maintained node versions"
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "b06b0e176b4f9016ce2aed18be239150c05d65c6"
|
|
107
107
|
}
|