@rh-support/manage 2.0.16-beta.0 → 2.0.17
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 +4 -21
- package/lib/esm/Routes.d.ts +0 -1
- package/lib/esm/Routes.d.ts.map +1 -1
- package/lib/esm/Routes.js +0 -6
- package/lib/esm/components/ManageTable/ManageTable.d.ts +0 -1
- package/lib/esm/components/ManageTable/ManageTable.d.ts.map +1 -1
- package/lib/esm/components/ManageTable/ManageTable.js +3 -4
- package/lib/esm/scss/_main.scss +2 -6
- package/lib/esm/scss/_pf4-overrides.scss +2 -2
- package/package.json +8 -8
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts +0 -2
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/NonOrgCustomerInfoModal.js +0 -15
- package/lib/esm/components/ManagePartnerships/PartnerLinkNameForm.d.ts +0 -12
- package/lib/esm/components/ManagePartnerships/PartnerLinkNameForm.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/PartnerLinkNameForm.js +0 -21
- package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts +0 -2
- package/lib/esm/components/ManagePartnerships/PartnershipsList.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/PartnershipsList.js +0 -183
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts +0 -3
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/PartnershipsTermsModal.js +0 -108
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts +0 -8
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/RequestCollaborationModal.js +0 -134
- package/lib/esm/components/ManagePartnerships/Requests.d.ts +0 -3
- package/lib/esm/components/ManagePartnerships/Requests.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/Requests.js +0 -198
- package/lib/esm/components/ManagePartnerships/index.d.ts +0 -2
- package/lib/esm/components/ManagePartnerships/index.d.ts.map +0 -1
- package/lib/esm/components/ManagePartnerships/index.js +0 -25
- package/lib/esm/context/ManagePartnershipsProvider.d.ts +0 -11
- package/lib/esm/context/ManagePartnershipsProvider.d.ts.map +0 -1
- package/lib/esm/context/ManagePartnershipsProvider.js +0 -26
- package/lib/esm/reducers/ManagePartnershipsReducer.d.ts +0 -16
- package/lib/esm/reducers/ManagePartnershipsReducer.d.ts.map +0 -1
- package/lib/esm/reducers/ManagePartnershipsReducer.js +0 -30
|
@@ -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":"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"}
|
package/lib/esm/ManageTabs.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ErrorBoundary, useDocumentTitle } from '@rh-support/components';
|
|
2
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
3
2
|
import { ability, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
|
-
import { CustomElements,
|
|
3
|
+
import { CustomElements, requireCustomElement } from '@rh-support/utils';
|
|
5
4
|
import map from 'lodash/map';
|
|
6
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
7
6
|
import { ConfigsTable } from './components/Configs/ConfigsTable';
|
|
8
7
|
import { ManageGroupUsers } from './components/Groups/ManageGroupUsers';
|
|
9
8
|
import { ManageGroupedBookmarkedAccountsTab } from './components/ManageBookmarkedAccountsTab';
|
|
10
|
-
import { ManagePartnerships } from './components/ManagePartnerships/index';
|
|
11
9
|
import { ManagePreferences } from './components/ManagePreferences';
|
|
12
10
|
import { NotificationEmails } from './components/NotificationEmails/index';
|
|
13
11
|
import { TopContentManagement } from './components/TopContentManagement';
|
|
@@ -23,9 +21,7 @@ requireCustomElement([
|
|
|
23
21
|
export function ManageTabs(props) {
|
|
24
22
|
var _a, _b;
|
|
25
23
|
const history = props.routeProps.history;
|
|
26
|
-
const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute,
|
|
27
|
-
const { globalMetadataState: { pcmConfig }, } = useContext(GlobalMetadataStateContext);
|
|
28
|
-
const isPartnershipsEnabled = getConfigField(pcmConfig.data, 'isPartnershipEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
|
|
24
|
+
const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, } = Routes.getPaths();
|
|
29
25
|
// Changes route and saves the current path to the url query params
|
|
30
26
|
const isOnlyBasePath = history.location.pathname === Routes.basePath;
|
|
31
27
|
useDocumentTitle(PageTitle.MANAGE);
|
|
@@ -38,7 +34,6 @@ export function ManageTabs(props) {
|
|
|
38
34
|
const canViewCaseGroups = ability.can(resourceActions.READ, resources.CASE_GROUPS) && canViewManageTab;
|
|
39
35
|
const canManageBookmarkAccounts = ability.can(resourceActions.CREATE, resources.BOOKMARK_ACCOUNTS) && canViewManageTab;
|
|
40
36
|
const canViewEmailNotificationTab = ability.can(resourceActions.READ, resources.NOTIFICATION_EMAIL);
|
|
41
|
-
const canViewPartnershipsTab = ability.can(resourceActions.READ, resources.PARTNERSHIPS);
|
|
42
37
|
const canAddCustomNotification = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_SEND_NOTIFICATIONS);
|
|
43
38
|
const canViewConfigsTab = ability.can(resourceActions.READ, resources.APP_INTERNAL_CONFIGS);
|
|
44
39
|
const tabsToRender = [];
|
|
@@ -76,18 +71,6 @@ export function ManageTabs(props) {
|
|
|
76
71
|
},
|
|
77
72
|
component: React.createElement(NotificationEmails, null),
|
|
78
73
|
});
|
|
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
|
-
});
|
|
91
74
|
tabsToRender.push({
|
|
92
75
|
title: 'Preferences',
|
|
93
76
|
key: 'preferences-tab',
|
|
@@ -129,7 +112,7 @@ export function ManageTabs(props) {
|
|
|
129
112
|
const getSelectedIndex = () => {
|
|
130
113
|
if (isOnlyBasePath)
|
|
131
114
|
return 0;
|
|
132
|
-
const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname
|
|
115
|
+
const tabIndex = tabsToRender.findIndex((tab) => tab.routePath === history.location.pathname);
|
|
133
116
|
return tabIndex > -1 ? tabIndex : 0;
|
|
134
117
|
};
|
|
135
118
|
/**
|
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;CAClB;AAED,eAAO,MAAM,MAAM,EAAE,YAmEpB,CAAC"}
|
package/lib/esm/Routes.js
CHANGED
|
@@ -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;CACzB;AA0BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA4CxC"}
|
|
@@ -32,12 +32,11 @@ 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);
|
|
36
35
|
return (React.createElement("div", { className: "table-wrapper" },
|
|
37
36
|
isError && (React.createElement(React.Fragment, null,
|
|
38
37
|
React.createElement(Alert, { variant: errorVariant, title: errorTitle, actionClose: React.createElement(AlertActionCloseButton, null) }, errorComponent))),
|
|
39
38
|
React.createElement(Table, Object.assign({}, tableProps),
|
|
40
|
-
React.createElement(PFTable, { sortInfo: sortInfo, "aria-label": ariaLabel, pagination:
|
|
41
|
-
tableProps.data.length > 0 &&
|
|
42
|
-
React.createElement(TablePagination, { variant: PaginationVariant.bottom
|
|
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 }))))));
|
|
43
42
|
}
|
package/lib/esm/scss/_main.scss
CHANGED
|
@@ -309,13 +309,9 @@ svg.hostnameSpinner {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
#version-dropdown-selector {
|
|
312
|
-
z-index:
|
|
312
|
+
z-index: 89;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
#tc-product-dropdown-selector {
|
|
316
|
-
z-index:
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
#requests-detached-toggle-content thead {
|
|
320
|
-
display: none;
|
|
316
|
+
z-index: 89;
|
|
321
317
|
}
|
|
@@ -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:
|
|
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:
|
|
131
|
+
z-index: 89;
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prepublishOnly": "npm run build"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@cee-eng/hydrajs": "4.15.
|
|
49
|
+
"@cee-eng/hydrajs": "4.15.82",
|
|
50
50
|
"@patternfly/patternfly": "4.196.7",
|
|
51
51
|
"@patternfly/pfe-accordion": "1.12.3",
|
|
52
52
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
@@ -77,19 +77,19 @@
|
|
|
77
77
|
"typescript": "4.3.5"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@cee-eng/hydrajs": "4.15.
|
|
80
|
+
"@cee-eng/hydrajs": "4.15.82",
|
|
81
81
|
"@patternfly/patternfly": "4.196.7",
|
|
82
82
|
"@patternfly/pfe-accordion": "1.12.3",
|
|
83
83
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
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.0.
|
|
87
|
+
"@rh-support/components": "2.0.13",
|
|
88
88
|
"@rh-support/configs": "2.0.9",
|
|
89
|
-
"@rh-support/react-context": "2.0.
|
|
89
|
+
"@rh-support/react-context": "2.0.13",
|
|
90
90
|
"@rh-support/types": "2.0.2",
|
|
91
|
-
"@rh-support/user-permissions": "2.0.11
|
|
92
|
-
"@rh-support/utils": "2.0.11
|
|
91
|
+
"@rh-support/user-permissions": "2.0.11",
|
|
92
|
+
"@rh-support/utils": "2.0.11",
|
|
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": "85c2e3c4430046b6e7e7b5efbee6ed47d7941feb"
|
|
107
107
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NonOrgCustomerInfoModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/NonOrgCustomerInfoModal.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB,mBA2BnC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare type validate = 'success' | 'warning' | 'error' | 'default';
|
|
2
|
-
interface IProps {
|
|
3
|
-
onLinkNameChange: (linkName: string) => void;
|
|
4
|
-
isDuplicateLinkName: boolean;
|
|
5
|
-
validated: validate;
|
|
6
|
-
currentLinkName?: string;
|
|
7
|
-
inputLabel?: string;
|
|
8
|
-
friendlyName?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function PartnerLinkNameForm(props: IProps): JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=PartnerLinkNameForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartnerLinkNameForm.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnerLinkNameForm.tsx"],"names":[],"mappings":"AAKA,aAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D,UAAU,MAAM;IACZ,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAgDhD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Form, FormGroup, FormHelperText, Grid, GridItem, TextInput } from '@patternfly/react-core';
|
|
2
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
5
|
-
export function PartnerLinkNameForm(props) {
|
|
6
|
-
const [localLinkName, setLocalLinkName] = useState('');
|
|
7
|
-
const { t } = useTranslation();
|
|
8
|
-
const handleLinkNameChange = (link, _event) => {
|
|
9
|
-
setLocalLinkName(link);
|
|
10
|
-
props.onLinkNameChange(link);
|
|
11
|
-
};
|
|
12
|
-
const partnershipLinkId = 'partnership-link-id';
|
|
13
|
-
return (React.createElement(Form, { className: "pf-u-my-md" },
|
|
14
|
-
React.createElement(Grid, { sm: 12, md: 6, lg: 6 },
|
|
15
|
-
React.createElement(GridItem, null,
|
|
16
|
-
React.createElement(FormGroup, { label: props.inputLabel || t('Name your link'), type: "string", helperText: React.createElement(FormHelperText, { isHidden: props.validated === 'error' },
|
|
17
|
-
React.createElement(Trans, null, "Please enter a name for your request")), helperTextInvalid: props.isDuplicateLinkName
|
|
18
|
-
? t('Link name already used. Please enter a unique name')
|
|
19
|
-
: t('Please enter a name for your request'), helperTextInvalidIcon: React.createElement(ExclamationCircleIcon, null), fieldId: partnershipLinkId, validated: props.validated, isRequired: true },
|
|
20
|
-
React.createElement(TextInput, { isRequired: true, validated: props.validated, value: localLinkName || props.currentLinkName, id: partnershipLinkId, "aria-describedby": "age-1-helper", onChange: handleLinkNameChange, placeholder: t('e.g. Customer name') }))))));
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartnershipsList.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsList.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,gBAAgB,gBAkO/B"}
|
|
@@ -1,183 +0,0 @@
|
|
|
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
|
-
id: 'partnership-delete',
|
|
110
|
-
title: ' ',
|
|
111
|
-
sortable: false,
|
|
112
|
-
cellWidth: 10,
|
|
113
|
-
cell: (data) => (React.createElement(Button, { variant: ButtonVariant.plain, "aria-label": t('Remove partnership'), onClick: () => removePartnership(data) },
|
|
114
|
-
React.createElement(TrashIcon, null),
|
|
115
|
-
React.createElement(LoadingIndicator, { isInline: true, show: isDeleting && data.accountNum === isDeletingAccountNum, size: "xs" }))),
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
const requestCollaborationButton = () => (React.createElement("div", { className: "toolbar-right pf-u-mt-xs" },
|
|
119
|
-
React.createElement(Button, { variant: ButtonVariant.primary, isInline: true, onClick: () => setIsRequestCollabModalOpen(true), "data-tracking-id": "request-collaboration-button", isDisabled: false },
|
|
120
|
-
React.createElement(Trans, null, "Request Collaboration"))));
|
|
121
|
-
// Get Customer Accounts For A Partner
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
if (location.pathname !== '/manage/partnerships' || !isPartner())
|
|
124
|
-
return;
|
|
125
|
-
const getManagedAccounts = () => __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
try {
|
|
127
|
-
setIsFetching(true);
|
|
128
|
-
setHasError(false);
|
|
129
|
-
yield fetchManagedAccounts(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
setHasError(true);
|
|
133
|
-
}
|
|
134
|
-
setIsFetching(false);
|
|
135
|
-
});
|
|
136
|
-
// when partner lands on partnership tab, we need to fetch customer accounts data
|
|
137
|
-
getManagedAccounts();
|
|
138
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
139
|
-
}, [location.pathname]);
|
|
140
|
-
//Get Partner Accounts For A Customer
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
const getAccountManagers = () => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
try {
|
|
144
|
-
setIsFetching(true);
|
|
145
|
-
setHasError(false);
|
|
146
|
-
yield fetchAccountManagers(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
147
|
-
setIsUpdatingAccounts(dispatch, false);
|
|
148
|
-
}
|
|
149
|
-
catch (e) {
|
|
150
|
-
setHasError(true);
|
|
151
|
-
}
|
|
152
|
-
setIsFetching(false);
|
|
153
|
-
});
|
|
154
|
-
// when customer accepts a link, need to fetch account data
|
|
155
|
-
if (isCustomerOrgAdmin() && isUpdatingPartnerAccountList)
|
|
156
|
-
getAccountManagers();
|
|
157
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
158
|
-
}, [isUpdatingPartnerAccountList]);
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
if (isPartner()) {
|
|
161
|
-
// partner may be customer of another partner
|
|
162
|
-
// we need to dispaly both partner and customer data
|
|
163
|
-
setAccountList([
|
|
164
|
-
...managedAccounts.data.map((i) => (Object.assign(Object.assign({}, i), { isCustomerAccount: true }))),
|
|
165
|
-
...accountManagers.data.map((i) => (Object.assign(Object.assign({}, i), { isPartnerAccount: true }))),
|
|
166
|
-
]);
|
|
167
|
-
}
|
|
168
|
-
else if (isCustomerOrgAdmin()) {
|
|
169
|
-
setAccountList(accountManagers.data.map((i) => (Object.assign(Object.assign({}, i), { isPartnerAccount: true }))));
|
|
170
|
-
}
|
|
171
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
|
-
}, [managedAccounts, accountManagers]);
|
|
173
|
-
return (React.createElement("section", { id: "manage-partnerships-list" },
|
|
174
|
-
React.createElement("div", { className: "toolbar" },
|
|
175
|
-
React.createElement("div", { className: "toolbar-left" },
|
|
176
|
-
React.createElement("label", { htmlFor: "search-partnerships" }, "Filter by"),
|
|
177
|
-
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') })),
|
|
178
|
-
isPartner() && requestCollaborationButton()),
|
|
179
|
-
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.') }),
|
|
180
|
-
React.createElement(RequestCollaborationModal, { isOpen: isRequestCollabModalOpen, onClose: () => {
|
|
181
|
-
setIsRequestCollabModalOpen(false);
|
|
182
|
-
} })));
|
|
183
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartnershipsTermsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/PartnershipsTermsModal.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,SAAS,WAMxB;AAID,eAAO,MAAM,sBAAsB,mBAqJlC,CAAC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
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, { key: "back-to-prev", variant: ButtonVariant.primary, onClick: () => onClose(), isDisabled: isUpdating },
|
|
95
|
-
React.createElement(Trans, null, "Close")),
|
|
96
|
-
] },
|
|
97
|
-
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" },
|
|
98
|
-
React.createElement(LoadingDots, { show: true, message: t('Verifying partner link') }))))) : !isVerifyingLink && !isTermVisited ? (React.createElement(React.Fragment, null,
|
|
99
|
-
React.createElement("p", null, "A partner would like to collaborate on your company's technical support cases in concert with Red Hat support engineers. Please accept the request with the enclosed URL."),
|
|
100
|
-
React.createElement(TextContent, { className: "pf-u-mt-lg" },
|
|
101
|
-
React.createElement(Text, { component: TextVariants.h3 }, linkAccountName)),
|
|
102
|
-
React.createElement("p", { className: "pf-u-mt-lg" },
|
|
103
|
-
React.createElement("a", { href: getTnCUrl() },
|
|
104
|
-
React.createElement(ExternalLinkAltIcon, null),
|
|
105
|
-
' ',
|
|
106
|
-
" ",
|
|
107
|
-
React.createElement(Trans, null, "Go to Agreement"))))) : isTermVisited && isUpdating ? (React.createElement(LoadingIndicator, { show: true, size: "lg" })) : isTermVisited && ackChoice === 'accept' ? (React.createElement("div", null, "You parterneship link has been created successfully")) : (React.createElement("div", null, "You have declined terms and conditions")))));
|
|
108
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestCollaborationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/RequestCollaborationModal.tsx"],"names":[],"mappings":"AAUA,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAGD,eAAO,MAAM,yBAAyB,UAAW,MAAM,gBA2KtD,CAAC"}
|
|
@@ -1,134 +0,0 @@
|
|
|
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, Tooltip, TooltipPosition } from '@patternfly/react-core';
|
|
12
|
-
import { ToastNotification, useCopyToClipboard } from '@rh-support/components';
|
|
13
|
-
import { isEmpty } from 'lodash';
|
|
14
|
-
import React, { useRef, useState } from 'react';
|
|
15
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
16
|
-
import { useManagePartnershipsDispatchContext } from '../../context/ManagePartnershipsProvider';
|
|
17
|
-
import { setIsUpdatingRequests } from '../../reducers/ManagePartnershipsReducer';
|
|
18
|
-
import { PartnerLinkNameForm } from './PartnerLinkNameForm';
|
|
19
|
-
export const RequestCollaborationModal = (props) => {
|
|
20
|
-
const { t } = useTranslation();
|
|
21
|
-
const clipboardRef = useRef(null);
|
|
22
|
-
const { clipboardText, copyToClipboard } = useCopyToClipboard(clipboardRef);
|
|
23
|
-
const [validated, setValidated] = useState('default');
|
|
24
|
-
const [isDuplicateLinkName, setIsDuplicateLinkName] = useState(false);
|
|
25
|
-
const [friendlyName, setFriendlyName] = useState('');
|
|
26
|
-
const [generatedUrl, setGeneratedUrl] = useState('');
|
|
27
|
-
const [nextButtonIsClicked, setNextButtonIsClicked] = useState(false);
|
|
28
|
-
const [showDone, setShowDone] = useState(false);
|
|
29
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
30
|
-
const [isDoneClicked, setIsDoneClicked] = useState(false);
|
|
31
|
-
const [isCopyClicked, setIsCopyClicked] = useState(false);
|
|
32
|
-
const dispatch = useManagePartnershipsDispatchContext();
|
|
33
|
-
const isRequestingAgain = !isEmpty(props.sendReqAgainFriendlyName);
|
|
34
|
-
const reset = () => {
|
|
35
|
-
setValidated('default');
|
|
36
|
-
setIsDuplicateLinkName(false);
|
|
37
|
-
setFriendlyName('');
|
|
38
|
-
setGeneratedUrl('');
|
|
39
|
-
setNextButtonIsClicked(false);
|
|
40
|
-
setShowDone(false);
|
|
41
|
-
setIsDoneClicked(false);
|
|
42
|
-
setIsCopyClicked(false);
|
|
43
|
-
};
|
|
44
|
-
const onClose = () => {
|
|
45
|
-
reset();
|
|
46
|
-
props.onClose();
|
|
47
|
-
};
|
|
48
|
-
const onDone = () => {
|
|
49
|
-
setIsDoneClicked(true);
|
|
50
|
-
if (isCopyClicked) {
|
|
51
|
-
reset();
|
|
52
|
-
props.onClose();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const onNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
setNextButtonIsClicked(true);
|
|
57
|
-
if (isEmpty(friendlyName.trim())) {
|
|
58
|
-
setValidated('error');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setIsFetching(true);
|
|
62
|
-
try {
|
|
63
|
-
// request again: delete the link to create new one
|
|
64
|
-
if (isRequestingAgain) {
|
|
65
|
-
yield pcm.partnerships.removePendingPartnerLink(props.sendReqAgainFriendlyName);
|
|
66
|
-
}
|
|
67
|
-
const url = yield pcm.partnerships.generatePartnerLink(friendlyName);
|
|
68
|
-
const hash = url.message.replace(/(.*\/)*/, '');
|
|
69
|
-
setGeneratedUrl('https://' +
|
|
70
|
-
window.location.host +
|
|
71
|
-
window.location.pathname +
|
|
72
|
-
'#/manage/partnerships/partnerlink/' +
|
|
73
|
-
hash);
|
|
74
|
-
setIsUpdatingRequests(dispatch, true);
|
|
75
|
-
setShowDone(true);
|
|
76
|
-
setIsFetching(false);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
setIsFetching(false);
|
|
80
|
-
const errorCode = parseInt((error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.status)) || '';
|
|
81
|
-
if (errorCode === 400) {
|
|
82
|
-
setValidated('error');
|
|
83
|
-
setIsDuplicateLinkName(true);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
onClose();
|
|
87
|
-
ToastNotification.addSuccessMessage(t('Failed to generate partner link'));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
const onLinkNameChange = (link) => {
|
|
92
|
-
setFriendlyName(link);
|
|
93
|
-
setIsDuplicateLinkName(false);
|
|
94
|
-
const trimmedName = link.trim();
|
|
95
|
-
if (trimmedName === '' && nextButtonIsClicked) {
|
|
96
|
-
setValidated('error');
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
setValidated('success');
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const onClickOnCopyToClipboardButton = () => {
|
|
103
|
-
copyToClipboard();
|
|
104
|
-
setIsCopyClicked(true);
|
|
105
|
-
};
|
|
106
|
-
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: [
|
|
107
|
-
...(showDone
|
|
108
|
-
? [
|
|
109
|
-
React.createElement(Button, { key: "done", variant: ButtonVariant.primary, onClick: onDone, isDisabled: validated === 'error' || (!isCopyClicked && isDoneClicked), "data-tracking-id": "request-collaboration-done-button" },
|
|
110
|
-
React.createElement(Trans, null, "Done")),
|
|
111
|
-
]
|
|
112
|
-
: [
|
|
113
|
-
React.createElement(Button, { key: "next", variant: ButtonVariant.primary, onClick: onNext, isDisabled: validated === 'error' || isFetching, isLoading: isFetching },
|
|
114
|
-
React.createElement(Trans, null, "Next")),
|
|
115
|
-
]),
|
|
116
|
-
] },
|
|
117
|
-
React.createElement(React.Fragment, null,
|
|
118
|
-
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."),
|
|
119
|
-
React.createElement(PartnerLinkNameForm, { onLinkNameChange: onLinkNameChange, isDuplicateLinkName: isDuplicateLinkName, validated: validated, currentLinkName: props.sendReqAgainFriendlyName }),
|
|
120
|
-
showDone && (React.createElement(React.Fragment, null,
|
|
121
|
-
React.createElement("h4", null,
|
|
122
|
-
React.createElement("strong", null, "Copy and send")),
|
|
123
|
-
React.createElement("div", { className: "clipboard-wrapper" },
|
|
124
|
-
React.createElement("div", { className: "clip-content-wrapper code-block" },
|
|
125
|
-
React.createElement("code", { ref: clipboardRef }, generatedUrl)),
|
|
126
|
-
React.createElement(Tooltip, { position: TooltipPosition.top, content: clipboardText, trigger: "click" },
|
|
127
|
-
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" }))),
|
|
128
|
-
React.createElement("p", { className: !isCopyClicked && isDoneClicked ? 'pf-u-danger-color-100' : '' },
|
|
129
|
-
React.createElement(Trans, null,
|
|
130
|
-
' ',
|
|
131
|
-
"Please ",
|
|
132
|
-
React.createElement("strong", null, "copy and send"),
|
|
133
|
-
" this unique link to your customer for approval.")))))));
|
|
134
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,gBA2OvB"}
|
|
@@ -1,198 +0,0 @@
|
|
|
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);
|
|
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
|
-
React.createElement(RequestCollaborationModal, { isOpen: isRequestAgainModalOpen, onClose: onRequestAgainModalClose, sendReqAgainFriendlyName: selectedRowFriendlyName })));
|
|
198
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManagePartnerships/index.tsx"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,gBAsCjC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
};
|