@rh-support/troubleshoot 2.1.5 → 2.1.7
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/components/AccountInfo/AccountSelector.d.ts.map +1 -1
- package/lib/esm/components/AccountInfo/AccountSelector.js +12 -4
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardNavigation.js +15 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/AccountSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAOnC,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAcrE,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,eAAO,MAAM,YAAY,EAAE,MAG1B,CAAC;AAEF,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/AccountSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAOnC,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAcrE,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,eAAO,MAAM,YAAY,EAAE,MAG1B,CAAC;AAEF,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA4KrC;kBA5KQ,eAAe;;;AAgLxB,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -80,6 +80,12 @@ function AccountSelector(props) {
|
|
|
80
80
|
// customer account doesn't have entitlement, we show an error
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
const getAccountEntitlement = () => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
// internal user doesn't open case for customer. No need to check account entitlement
|
|
84
|
+
if (selectedAccountDetails.data.accountNumber === loggedInUsersAccount.data.accountNumber) {
|
|
85
|
+
setNoValidEntitlement(routeDispatch, false);
|
|
86
|
+
setShowNotEntitledMessage(false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
83
89
|
setShowNotEntitledMessage(false);
|
|
84
90
|
try {
|
|
85
91
|
const res = yield accounts.getAccountEntitlementByInternalUser(selectedAccountDetails.data.accountNumber);
|
|
@@ -87,14 +93,16 @@ function AccountSelector(props) {
|
|
|
87
93
|
setShowNotEntitledMessage(true);
|
|
88
94
|
setNoValidEntitlement(routeDispatch, true);
|
|
89
95
|
}
|
|
96
|
+
else {
|
|
97
|
+
setShowNotEntitledMessage(false);
|
|
98
|
+
setNoValidEntitlement(routeDispatch, false);
|
|
99
|
+
}
|
|
90
100
|
}
|
|
91
101
|
catch (e) {
|
|
92
102
|
console.log(e);
|
|
93
103
|
}
|
|
94
104
|
});
|
|
95
|
-
if (loggedInUserRights.data.isInternal() &&
|
|
96
|
-
selectedAccountDetails.data.accountNumber &&
|
|
97
|
-
selectedAccountDetails.data.accountNumber !== loggedInUsersAccount.data.accountNumber) {
|
|
105
|
+
if (loggedInUserRights.data.isInternal() && selectedAccountDetails.data.accountNumber) {
|
|
98
106
|
getAccountEntitlement();
|
|
99
107
|
}
|
|
100
108
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -102,7 +110,7 @@ function AccountSelector(props) {
|
|
|
102
110
|
if (isEmpty(loggedInUserRights.data))
|
|
103
111
|
return React.createElement(React.Fragment, null);
|
|
104
112
|
return (React.createElement("div", { id: props.id, className: `form-group ${props.className}` },
|
|
105
|
-
React.createElement(AlertMessage, { show: showNotEntitledMessage, variant: AlertType.DANGER, isInline: true, title: "The selected account
|
|
113
|
+
React.createElement(AlertMessage, { show: showNotEntitledMessage, variant: AlertType.DANGER, isInline: true, title: t("The selected account doesn't have entitlement"), className: "pf-u-mb-lg" }),
|
|
106
114
|
React.createElement("div", { className: "account-selector-label-wrapper pf-u-display-flex" },
|
|
107
115
|
React.createElement("label", { htmlFor: "account-selector" },
|
|
108
116
|
React.createElement(Trans, null, "Account"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,EAAoB,eAAe,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAI3G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,EAAE,CAAC,2BAA2B,EAAE,OAAO,EAAE,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/G,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAoGtC;kBApGQ,gBAAgB;;;AAsGzB,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { GlobalMetadataStateContext, useCanCreateCase } from '@rh-support/react-context';
|
|
2
|
+
import find from 'lodash/find';
|
|
3
|
+
import isEqual from 'lodash/isEqual';
|
|
2
4
|
import React, { useContext } from 'react';
|
|
3
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useCaseSelector } from '../../context/CaseContext';
|
|
4
7
|
import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
|
|
5
8
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
6
9
|
import { updateisNextBtnClickedToShowValidationError } from '../../reducers/RouteReducer';
|
|
7
10
|
import { useIsSectionValid } from '../shared/useIsSectionValid';
|
|
8
11
|
const defaultProps = {};
|
|
9
12
|
function WizardNavigation(props) {
|
|
13
|
+
var _a, _b;
|
|
10
14
|
const { t } = useTranslation();
|
|
11
15
|
const canCreateCase = useCanCreateCase();
|
|
12
|
-
const { routeState: { activeSection, isNextBtnClickedToShowValidationError, noValidEntitlement }, } = useContext(RouteContext);
|
|
13
|
-
const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
16
|
+
const { routeState: { activeSection, isNextBtnClickedToShowValidationError, noValidEntitlement, isSearchIntent }, } = useContext(RouteContext);
|
|
17
|
+
const { globalMetadataState: { loggedInUsersAccount, allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
18
|
+
const { caseState } = useCaseSelector((state) => ({
|
|
19
|
+
caseState: state,
|
|
20
|
+
}), isEqual);
|
|
21
|
+
// To check if the user is entitled or not
|
|
22
|
+
const isEntitledProduct = (_b = find((_a = allProducts === null || allProducts === void 0 ? void 0 : allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult, (p) => p.product === caseState.caseDetails.product)) === null || _b === void 0 ? void 0 : _b.isEntitledProduct;
|
|
14
23
|
const dispatchToRouteReducer = useContext(RouteDispatchContext);
|
|
15
24
|
const { activeSectionError, isSectionValidFn } = useIsSectionValid(activeSection);
|
|
16
25
|
const onNext = () => {
|
|
@@ -50,9 +59,12 @@ function WizardNavigation(props) {
|
|
|
50
59
|
props.onShowRestUpdate(false);
|
|
51
60
|
props.onBack();
|
|
52
61
|
};
|
|
62
|
+
// To handle entitled products
|
|
63
|
+
const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
|
|
53
64
|
return (React.createElement(React.Fragment, null,
|
|
54
65
|
props.activeStep.order !== 0 && (React.createElement("button", { onClick: () => onBack(), className: "btn btn-app btn-open-white", "data-tracking-id": `prev-of-${activeSection}` }, t('Go back'))),
|
|
55
|
-
React.createElement("button", { disabled: (!
|
|
66
|
+
React.createElement("button", { disabled: (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
|
|
67
|
+
(!isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
|
|
56
68
|
noValidEntitlement, onClick: onNext, className: "btn btn-app btn-primary", "data-tracking-id": `next-of-${activeSection}` }, t(props.activeStep.nextButtonLabel)),
|
|
57
69
|
activeSectionError ? (React.createElement("small", { className: "pf-u-align-self-center pf-u-ml-md text-red" }, t(activeSectionError))) : null));
|
|
58
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"not ie <= 11",
|
|
135
135
|
"not op_mini all"
|
|
136
136
|
],
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "81f772293e311afe41a2b5b09d0e122c9aa168b6"
|
|
138
138
|
}
|