@rh-support/troubleshoot 2.6.287 → 2.6.295

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/lib/esm/components/AccountInfo/AccountSelector.d.ts.map +1 -1
  2. package/lib/esm/components/AccountInfo/AccountSelector.js +28 -40
  3. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +42 -12
  5. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/Case.js +7 -5
  7. package/lib/esm/components/CaseEditView/CaseDetailsAside.d.ts.map +1 -1
  8. package/lib/esm/components/CaseEditView/CaseDetailsAside.js +25 -8
  9. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  10. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +14 -10
  11. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  12. package/lib/esm/components/CaseEditView/CaseOverview/index.js +24 -18
  13. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
  14. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +9 -6
  15. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
  16. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +7 -3
  17. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.d.ts.map +1 -1
  18. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +38 -34
  19. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
  20. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +9 -9
  21. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
  22. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +19 -59
  23. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.d.ts.map +1 -1
  24. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +16 -9
  25. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.d.ts.map +1 -1
  26. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.js +5 -3
  27. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.d.ts.map +1 -1
  28. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.js +3 -2
  29. package/lib/esm/components/CaseInformation/CaseInformation.d.ts.map +1 -1
  30. package/lib/esm/components/CaseInformation/CaseInformation.js +7 -5
  31. package/lib/esm/components/CaseInformation/ContactPhoneNumber.d.ts.map +1 -1
  32. package/lib/esm/components/CaseInformation/ContactPhoneNumber.js +37 -24
  33. package/lib/esm/components/CaseInformation/SupportLevel.d.ts.map +1 -1
  34. package/lib/esm/components/CaseInformation/SupportLevel.js +32 -55
  35. package/lib/esm/components/CaseManagement/CaseLanguageSelector.js +2 -2
  36. package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
  37. package/lib/esm/components/CaseManagement/CaseManagement.js +4 -9
  38. package/lib/esm/components/IdeaInformation/IdeaInformation.d.ts.map +1 -1
  39. package/lib/esm/components/IdeaInformation/IdeaInformation.js +11 -12
  40. package/lib/esm/components/OpenCase/SupportTypeSelectorPage.d.ts.map +1 -1
  41. package/lib/esm/components/OpenCase/SupportTypeSelectorPage.js +4 -2
  42. package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts +0 -1
  43. package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
  44. package/lib/esm/components/ProductSelector/AllProductsSelector.js +3 -15
  45. package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts.map +1 -1
  46. package/lib/esm/components/ProductSelector/NewProductDropdownSelector.js +13 -37
  47. package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
  48. package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +19 -53
  49. package/lib/esm/components/ProductSelector/ProductSelector.d.ts.map +1 -1
  50. package/lib/esm/components/ProductSelector/ProductSelector.js +1 -3
  51. package/lib/esm/components/Review/Review.d.ts.map +1 -1
  52. package/lib/esm/components/Review/Review.js +16 -18
  53. package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
  54. package/lib/esm/components/SessionRestore/SessionRestore.js +3 -1
  55. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +1 -1
  56. package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
  57. package/lib/esm/components/shared/useIsSectionValid.js +50 -64
  58. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  59. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +106 -23
  60. package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
  61. package/lib/esm/components/wizardLayout/WizardLayout.js +6 -7
  62. package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
  63. package/lib/esm/components/wizardLayout/WizardNavigation.js +10 -9
  64. package/lib/esm/graphql/index.d.ts +4 -0
  65. package/lib/esm/graphql/index.d.ts.map +1 -0
  66. package/lib/esm/graphql/index.js +3 -0
  67. package/lib/esm/graphql/mutations/createRMECaseEscalation.d.ts +2 -0
  68. package/lib/esm/graphql/mutations/createRMECaseEscalation.d.ts.map +1 -0
  69. package/lib/esm/graphql/mutations/createRMECaseEscalation.js +24 -0
  70. package/lib/esm/graphql/mutations/index.d.ts +2 -0
  71. package/lib/esm/graphql/mutations/index.d.ts.map +1 -0
  72. package/lib/esm/graphql/mutations/index.js +1 -0
  73. package/lib/esm/graphql/queries/getEscalationDetails.d.ts +2 -0
  74. package/lib/esm/graphql/queries/getEscalationDetails.d.ts.map +1 -0
  75. package/lib/esm/graphql/queries/getEscalationDetails.js +24 -0
  76. package/lib/esm/graphql/queries/getParentId.d.ts +2 -0
  77. package/lib/esm/graphql/queries/getParentId.d.ts.map +1 -0
  78. package/lib/esm/graphql/queries/getParentId.js +16 -0
  79. package/lib/esm/graphql/queries/index.d.ts +3 -0
  80. package/lib/esm/graphql/queries/index.d.ts.map +1 -0
  81. package/lib/esm/graphql/queries/index.js +2 -0
  82. package/lib/esm/graphql/schemas/escalation.d.ts +84 -0
  83. package/lib/esm/graphql/schemas/escalation.d.ts.map +1 -0
  84. package/lib/esm/graphql/schemas/escalation.js +1 -0
  85. package/lib/esm/graphql/schemas/index.d.ts +2 -0
  86. package/lib/esm/graphql/schemas/index.d.ts.map +1 -0
  87. package/lib/esm/graphql/schemas/index.js +1 -0
  88. package/lib/esm/hooks/useResetCaseCreate.d.ts.map +1 -1
  89. package/lib/esm/hooks/useResetCaseCreate.js +18 -11
  90. package/lib/esm/reducers/CaseConstNTypes.d.ts +86 -2
  91. package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
  92. package/lib/esm/reducers/CaseConstNTypes.js +5 -0
  93. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts +3 -1
  94. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts.map +1 -1
  95. package/lib/esm/reducers/CaseDetailsPageReducer.js +22 -5
  96. package/lib/esm/reducers/CaseHelpers.d.ts +2 -1
  97. package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
  98. package/lib/esm/reducers/CaseHelpers.js +34 -2
  99. package/lib/esm/reducers/CaseOverviewReducer.d.ts +3 -1
  100. package/lib/esm/reducers/CaseOverviewReducer.d.ts.map +1 -1
  101. package/lib/esm/reducers/CaseOverviewReducer.js +7 -5
  102. package/lib/esm/reducers/CaseReducer.d.ts +27 -8
  103. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  104. package/lib/esm/reducers/CaseReducer.js +113 -29
  105. package/package.json +5 -5
@@ -1,32 +1,23 @@
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 { contacts } from '@cee-eng/hydrajs';
1
+ // import { contacts } from '@cee-eng/hydrajs';
11
2
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
12
- import find from 'lodash/find';
3
+ // import find from 'lodash/find';
13
4
  import isEmpty from 'lodash/isEmpty';
14
5
  import isEqual from 'lodash/isEqual';
15
- import React, { useContext, useEffect, useState } from 'react';
6
+ import React, { useContext } from 'react';
7
+ // import React, { useContext, useEffect, useState } from 'react';
16
8
  import { Trans } from 'react-i18next';
17
9
  import { useCaseSelector } from '../../context/CaseContext';
18
- import { RouteContext, useRouteDispatchContext } from '../../context/RouteContext';
10
+ import { RouteContext } from '../../context/RouteContext';
11
+ // import { RouteContext, useRouteDispatchContext } from '../../context/RouteContext';
19
12
  import { TCStateContext } from '../../context/TopContentContext';
20
13
  import { useAB } from '../../hooks/useAB';
21
14
  import { CASE_DEATILS_ENVIRONMENT_LIMIT, CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, HOSTNAME_LENGTH_LIMIT, ISSUE_SUMMARY_LENGTH_LIMIT, KTQUESTION_MAX_LIMIT, TITLE_SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
22
15
  import { isCaseInformationSectionValid, isCaseManagementStateValid, isCaseStateValid, isClusterIDValid, isIdeaCaseStateValid, } from '../../reducers/CaseHelpers';
23
16
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
24
- import { setNoValidEntitlement } from '../../reducers/RouteReducer';
25
17
  import { AttachmentStateContext } from './fileUpload/reducer/AttachmentReducerContext';
26
18
  export function useIsSectionValid(sectionName) {
27
- var _a, _b;
28
19
  const { isVariationA } = useAB();
29
- const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, hostname, contactInfo24x7, alternateId, selectedAccountDetails, issue, environment, timeFramesAndUrgency, periodicityOfIssue, ssoUsername, manageSupportCases, } = useCaseSelector((state) => ({
20
+ const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, hostname, contactInfo24x7, alternateId, selectedAccountDetails, issue, environment, timeFramesAndUrgency, periodicityOfIssue, manageSupportCases, } = useCaseSelector((state) => ({
30
21
  caseState: state,
31
22
  caseType: state.caseDetails.caseType,
32
23
  product: state.caseDetails.product,
@@ -42,35 +33,38 @@ export function useIsSectionValid(sectionName) {
42
33
  environment: state.caseDetails.environment,
43
34
  timeFramesAndUrgency: state.caseDetails.timeFramesAndUrgency,
44
35
  periodicityOfIssue: state.caseDetails.periodicityOfIssue,
45
- ssoUsername: state.selectedOwner.data.ssoUsername,
36
+ // ssoUsername: state.selectedOwner.data.ssoUsername,
46
37
  manageSupportCases: state.selectedOwner.data.manageSupportCases,
47
38
  }), isEqual);
48
- const routeDispatch = useRouteDispatchContext();
49
- const [isEntitlement, setIsEntitlement] = useState(null);
50
- useEffect(() => {
51
- const fetchContactDetails = () => __awaiter(this, void 0, void 0, function* () {
52
- var _a;
53
- if (ssoUsername) {
54
- try {
55
- const response = yield contacts.getSFDCContactBySso(ssoUsername);
56
- setIsEntitlement((_a = response === null || response === void 0 ? void 0 : response.isEntitled) !== null && _a !== void 0 ? _a : null);
57
- setNoValidEntitlement(routeDispatch, !(response === null || response === void 0 ? void 0 : response.isEntitled));
58
- }
59
- catch (error) {
60
- console.error('Error fetching contact details:', error);
61
- setIsEntitlement(null);
62
- setNoValidEntitlement(routeDispatch, null);
63
- }
64
- }
65
- });
66
- fetchContactDetails();
67
- }, [ssoUsername, routeDispatch]);
68
- //&seSessionId=8e8960ac-680b-443e-bf67-9e13f2acd64e
39
+ // const routeDispatch = useRouteDispatchContext();
40
+ // const [isEntitlement, setIsEntitlement] = useState<boolean | null>(null);
41
+ // useEffect(() => {
42
+ // const fetchContactDetails = async () => {
43
+ // if (ssoUsername) {
44
+ // try {
45
+ // const response = await contacts.getSFDCContactBySso(ssoUsername);
46
+ // setIsEntitlement(response?.isEntitled ?? null);
47
+ // setNoValidEntitlement(routeDispatch, !response?.isEntitled);
48
+ // } catch (error) {
49
+ // console.error('Error fetching contact details:', error);
50
+ // setIsEntitlement(null);
51
+ // setNoValidEntitlement(routeDispatch, null);
52
+ // }
53
+ // }
54
+ // };
55
+ // fetchContactDetails();
56
+ // }, [ssoUsername, routeDispatch]);
57
+ // Contact-level entitlement hardcoded to true — now resolved from SFDCProductJSON__c
58
+ const isEntitlement = true;
69
59
  const { routeState: { isCaseCreate }, } = useContext(RouteContext);
70
60
  const { globalMetadataState: { allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
71
61
  const { topContentState: { topContent }, } = useContext(TCStateContext);
72
- 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;
73
- const { routeState: { activeSection, isSearchIntent }, } = useContext(RouteContext);
62
+ // isEntitledProduct commented out; product-level entitlement now resolved from SFDCProductJSON__c
63
+ // const isEntitledProduct = find(
64
+ // allProducts?.data?.productsResult,
65
+ // (p) => p.product === caseState.caseDetails.product
66
+ // )?.isEntitledProduct;
67
+ const { routeState: { activeSection }, } = useContext(RouteContext);
74
68
  const { attachmentState } = useContext(AttachmentStateContext);
75
69
  const selectedLocalFiles = attachmentState.caseFiles.selectedLocalFiles;
76
70
  const allowedTypesIdea = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
@@ -111,8 +105,6 @@ export function useIsSectionValid(sectionName) {
111
105
  }
112
106
  return (!isEmpty(product) &&
113
107
  !isEmpty(version) &&
114
- !isEmpty(accountNumber) &&
115
- !isEmpty(contactSSOName) &&
116
108
  !isEmpty(summary) &&
117
109
  (summary === null || summary === void 0 ? void 0 : summary.length) <= TITLE_SUMMARY_LENGTH_LIMIT &&
118
110
  !isEmpty(issue) &&
@@ -129,23 +121,22 @@ export function useIsSectionValid(sectionName) {
129
121
  };
130
122
  const isResourcesSectionValid = () => {
131
123
  var _a;
132
- // don't check for entitled product if user is on search intent flow
133
- const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
134
- // Skip cluster ID validation for Variant A
124
+ // isEntitledProduct check removed product-level entitlement now resolved from SFDCProductJSON__c
135
125
  const clusterIdValid = isVariationA ? true : isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
136
- return isEntitledProductLocal && clusterIdValid;
126
+ return clusterIdValid;
137
127
  };
138
128
  const isReviewSectionValid = () => {
139
129
  var _a;
140
- return (isEntitledProduct &&
141
- isCaseStateValid(caseState, loggedInUserRights) &&
130
+ return (
131
+ // isEntitledProduct — product-level entitlement now resolved from SFDCProductJSON__c
132
+ isCaseStateValid(caseState, loggedInUserRights) &&
142
133
  isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) &&
143
134
  isSummarizeSectionValid() &&
144
135
  isAdditionalInformationSectionValidLocal());
145
136
  };
146
137
  const isDescribeIdeaSectionValid = () => {
147
138
  return (isCaseManagementStateValid(caseState, loggedInUserRights) &&
148
- isEntitledProduct &&
139
+ // isEntitledProduct — product-level entitlement now resolved from SFDCProductJSON__c
149
140
  isIdeaCaseStateValid(caseState, loggedInUserRights) &&
150
141
  checkUnallowedFiles());
151
142
  };
@@ -185,14 +176,8 @@ export function useIsSectionValid(sectionName) {
185
176
  }
186
177
  };
187
178
  const recommendationSectionError = () => {
188
- if (!product)
189
- return '';
190
- const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
191
- return !isEntitledProductLocal ? (React.createElement(Trans, { i18nKey: "i18ValidEntitlementContactCustomerService" },
192
- "You need a valid entitlement to create a case.\u00A0 Please contact",
193
- ' ',
194
- React.createElement("a", { href: "/support/contact/customerService" }, "Customer Service"),
195
- " for assistance.")) : ('');
179
+ // isEntitledProduct check removed — product-level entitlement now resolved from SFDCProductJSON__c
180
+ return '';
196
181
  };
197
182
  const getSupportSectionError = () => {
198
183
  if (manageSupportCases === false) {
@@ -202,13 +187,14 @@ export function useIsSectionValid(sectionName) {
202
187
  React.createElement("a", { href: "/support/contact/customerService" }, "Customer Service"),
203
188
  " for assistance."));
204
189
  }
205
- if (isEntitlement === false) {
206
- return (React.createElement(Trans, { i18nKey: "i18ValidEntitlementContactCustomerService" },
207
- "You need a valid entitlement to create a case.\u00A0 Please contact",
208
- ' ',
209
- React.createElement("a", { href: "/support/contact/customerService" }, "Customer Service"),
210
- " for assistance."));
211
- }
190
+ // if (isEntitlement === false) {
191
+ // return (
192
+ // <Trans i18nKey="i18ValidEntitlementContactCustomerService">
193
+ // You need a valid entitlement to create a case.&nbsp; Please contact{' '}
194
+ // <a href="/support/contact/customerService">Customer Service</a> for assistance.
195
+ // </Trans>
196
+ // );
197
+ // }
212
198
  return '';
213
199
  };
214
200
  const activeSectionError = (sectionNameLocal) => {
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AASA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBAgUtD"}
1
+ {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBA4atD"}
@@ -7,9 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useApolloClient } from '@apollo/client/react';
10
11
  import { useDebounce } from '@rh-support/components';
11
12
  import { GlobalMetadataStateContext, useUserPreferences } from '@rh-support/react-context';
12
13
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
14
+ import { GET_ACCOUNT_CONTACTS, resolveProductServiceLevelsForAccount, } from '@rh-support/utils';
13
15
  import findIndex from 'lodash/findIndex';
14
16
  import includes from 'lodash/includes';
15
17
  import isEmpty from 'lodash/isEmpty';
@@ -23,7 +25,7 @@ import { TCDispatchContext, TCStateContext } from '../../context/TopContentConte
23
25
  import { useResetCaseCreate } from '../../hooks/useResetCaseCreate';
24
26
  import { CASE_DEATILS_SOURCE_REFERRER_LIMIT } from '../../reducers/CaseConstNTypes';
25
27
  import { getDescriptionWOQues } from '../../reducers/CaseHelpers';
26
- import { setCaseAccountNumber, setCaseDetails, setCaseOwner } from '../../reducers/CaseReducer';
28
+ import { setCaseAccountNumber, setCaseDetails, setCaseOwner, setCaseState } from '../../reducers/CaseReducer';
27
29
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
28
30
  import { setActiveSectionChanged, setRouteFlags, updateisNextBtnClickedToShowValidationError, } from '../../reducers/RouteReducer';
29
31
  import { fetchEdmundAbbottRules } from '../../reducers/RulesReducer';
@@ -34,23 +36,28 @@ import { AttachmentStateContext } from '../shared/fileUpload/reducer/AttachmentR
34
36
  export function GlobalTroubleshootEffects(props) {
35
37
  const [initDefaultSection, setInitDefaultSection] = useState(false);
36
38
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
37
- const { globalMetadataState: { allProducts, loggedInUser, managedAccounts, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
39
+ const { globalMetadataState: { allProducts, loggedInUser, managedAccounts, loggedInUserRights, loggedInUsersAccount, loggedInUserJwtToken, }, } = useContext(GlobalMetadataStateContext);
38
40
  const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
39
- const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, } = useCaseSelector((state) => ({
40
- accountNumber: state.caseDetails.accountNumberRef,
41
- product: state.caseDetails.product,
42
- version: state.caseDetails.version,
43
- contactSsoUsername: state.caseDetails.contactSSOName,
44
- summary: state.caseDetails.summary,
45
- issue: state.caseDetails.issue,
46
- environment: state.caseDetails.environment,
47
- periodicityOfIssue: state.caseDetails.periodicityOfIssue,
48
- timeFramesAndUrgency: state.caseDetails.timeFramesAndUrgency,
49
- caseType: state.caseDetails.caseType,
50
- language: state.caseDetails.caseLanguage,
51
- selectedAccountDetails: state.selectedAccountDetails,
52
- }), isEqual);
41
+ const { accountNumber, contactSsoUsername, product, version, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, selectedOwnerContactId, } = useCaseSelector((state) => {
42
+ var _a, _b;
43
+ return ({
44
+ accountNumber: state.caseDetails.accountNumberRef,
45
+ contactSsoUsername: state.caseDetails.contactSSOName,
46
+ product: state.caseDetails.product,
47
+ version: state.caseDetails.version,
48
+ summary: state.caseDetails.summary,
49
+ issue: state.caseDetails.issue,
50
+ environment: state.caseDetails.environment,
51
+ periodicityOfIssue: state.caseDetails.periodicityOfIssue,
52
+ timeFramesAndUrgency: state.caseDetails.timeFramesAndUrgency,
53
+ caseType: state.caseDetails.caseType,
54
+ language: state.caseDetails.caseLanguage,
55
+ selectedAccountDetails: state.selectedAccountDetails,
56
+ selectedOwnerContactId: (_b = (_a = state.selectedOwner) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.id,
57
+ });
58
+ }, isEqual);
53
59
  const caseDispatch = useCaseDispatch();
60
+ const apolloClient = useApolloClient();
54
61
  const isCaseCreate = RouteUtils.getQueryParams(props.routeProps).caseCreate === 'true';
55
62
  const urlQueryParams = RouteUtils.getQueryParams(props.routeProps);
56
63
  const isFirstMount = useRef(true);
@@ -155,20 +162,78 @@ export function GlobalTroubleshootEffects(props) {
155
162
  // eslint-disable-next-line react-hooks/exhaustive-deps
156
163
  }, [dispatchToRouteReducer, props.routeProps.location.pathname, isCaseCreate, isSearchIntent]);
157
164
  /**
158
- * Setting Default AccountNumber and ContactSsoUsername from loggedInUsersAccount
159
- * Disabling exhaustive-deps rule as we don't want to reset default values if user manually clears these from UI.
160
- * This is a one time thing when loggedInUserJwtToken is set.
165
+ * Auto-populate account and owner for external users.
166
+ * For org admin: dropdowns are visible but disabled sets initial values.
167
+ * For non-org admin: dropdowns are hidden fires the same queries in background.
161
168
  */
162
169
  useEffect(() => {
170
+ var _a, _b;
163
171
  if (!isCaseCreate)
164
172
  return;
165
- isEmpty(accountNumber) && setCaseAccountNumber(caseDispatch, loggedInUserRights.data.getAccountNumber());
166
- isEmpty(contactSsoUsername) &&
173
+ if (isEmpty(loggedInUserRights.data))
174
+ return;
175
+ if (loggedInUserRights.data.isInternal())
176
+ return;
177
+ const resolvedAccountNumber = ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.accountNumber) ||
178
+ loggedInUserRights.data.getAccountNumber() ||
179
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.account_number) ||
180
+ '';
181
+ if (isEmpty(accountNumber) && !isEmpty(resolvedAccountNumber)) {
182
+ const hasFullAccountData = !isEmpty((_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.accountNumber);
183
+ setCaseAccountNumber(caseDispatch, resolvedAccountNumber, hasFullAccountData, hasFullAccountData ? loggedInUsersAccount.data : {}, apolloClient);
184
+ }
185
+ if (isEmpty(contactSsoUsername)) {
167
186
  setCaseOwner(caseDispatch, loggedInUserRights.data.getHydraContactFromLoggedInUser(), product, undefined, undefined, true, undefined, true, undefined, undefined, loggedInUserRights.data.isInternal()
168
187
  ? accountNumber || loggedInUserRights.data.getAccountNumber()
169
188
  : undefined);
189
+ }
170
190
  // eslint-disable-next-line react-hooks/exhaustive-deps
171
- }, [caseDispatch, loggedInUserRights.data]);
191
+ }, [
192
+ caseDispatch,
193
+ loggedInUserRights.data,
194
+ loggedInUsersAccount.data,
195
+ apolloClient,
196
+ accountNumber,
197
+ contactSsoUsername,
198
+ ]);
199
+ useEffect(() => {
200
+ if (isEmpty(loggedInUserRights.data) || loggedInUserRights.data.isInternal())
201
+ return;
202
+ if (isEmpty(accountNumber) || isEmpty(contactSsoUsername))
203
+ return;
204
+ if (selectedAccountDetails.isFetching)
205
+ return;
206
+ if (selectedOwnerContactId)
207
+ return;
208
+ const ownerSso = loggedInUserRights.data.getSSOUsername();
209
+ const fetchContacts = () => __awaiter(this, void 0, void 0, function* () {
210
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
211
+ try {
212
+ const { data } = yield apolloClient.query({
213
+ query: GET_ACCOUNT_CONTACTS,
214
+ variables: {
215
+ accountNumber: { eq: accountNumber },
216
+ first: 200,
217
+ orderBy: { Name: { order: 'ASC' } },
218
+ },
219
+ });
220
+ const response = data;
221
+ const contactEdges = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.Contacts) === null || _g === void 0 ? void 0 : _g.edges) !== null && _h !== void 0 ? _h : [];
222
+ const matchingContact = contactEdges.find(({ node }) => { var _a, _b; return ((_b = (_a = node.SSOUserName__c) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (ownerSso === null || ownerSso === void 0 ? void 0 : ownerSso.toLowerCase()); });
223
+ if ((_j = matchingContact === null || matchingContact === void 0 ? void 0 : matchingContact.node) === null || _j === void 0 ? void 0 : _j.Id) {
224
+ const ownerWithId = Object.assign(Object.assign({}, loggedInUserRights.data.getHydraContactFromLoggedInUser()), { id: matchingContact.node.Id });
225
+ setCaseState(caseDispatch, {
226
+ selectedOwner: { data: ownerWithId, isFetching: false, isError: false, errorMessage: '' },
227
+ });
228
+ }
229
+ }
230
+ catch (e) {
231
+ // Contact fetch failed; case proceeds with owner from JWT
232
+ }
233
+ });
234
+ fetchContacts();
235
+ // eslint-disable-next-line react-hooks/exhaustive-deps
236
+ }, [accountNumber, contactSsoUsername, selectedAccountDetails.isFetching, selectedOwnerContactId]);
172
237
  /**
173
238
  * handling top content call
174
239
  */
@@ -180,6 +245,22 @@ export function GlobalTroubleshootEffects(props) {
180
245
  return;
181
246
  fetchTopContent(tcDispatch, { product, version });
182
247
  }, [product, tcDispatch, topContentPayload, version]);
248
+ useEffect(() => {
249
+ if (isEmpty(product) || selectedAccountDetails.isFetching || isEmpty(selectedAccountDetails.data))
250
+ return;
251
+ const serviceLevels = resolveProductServiceLevelsForAccount(selectedAccountDetails.data, allProducts.data.productsResult, product);
252
+ if (!serviceLevels)
253
+ return;
254
+ setCaseState(caseDispatch, {
255
+ productServiceLevel: serviceLevels.productServiceLevel,
256
+ otherServiceLevels: serviceLevels.otherServiceLevels,
257
+ selectedEntitlementId: serviceLevels.defaultEntitlementId,
258
+ });
259
+ if (serviceLevels.entitlementSla) {
260
+ setCaseDetails(caseDispatch, { entitlementSla: serviceLevels.entitlementSla });
261
+ }
262
+ // eslint-disable-next-line react-hooks/exhaustive-deps
263
+ }, [product, selectedAccountDetails.data, allProducts.data.productsResult]);
183
264
  // set case language to preferred language
184
265
  useEffect(() => {
185
266
  const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
@@ -256,11 +337,13 @@ export function GlobalTroubleshootEffects(props) {
256
337
  * each case create. Currently we refetch the account details when user clicks on troubleshoot a new session
257
338
  */
258
339
  useEffect(() => {
340
+ if (loggedInUserRights.data.isInternal())
341
+ return;
259
342
  if (!isEmpty(loggedInUsersAccount.data) &&
260
343
  !isEmpty(selectedAccountDetails.data) &&
261
344
  loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber) &&
262
345
  !isEqual(loggedInUsersAccount.data, selectedAccountDetails.data)) {
263
- setCaseAccountNumber(caseDispatch, loggedInUsersAccount.data.accountNumber, true, loggedInUsersAccount.data);
346
+ setCaseAccountNumber(caseDispatch, loggedInUsersAccount.data.accountNumber, true, loggedInUsersAccount.data, apolloClient);
264
347
  }
265
348
  // eslint-disable-next-line react-hooks/exhaustive-deps
266
349
  }, [loggedInUsersAccount.data]);
@@ -1 +1 @@
1
- {"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"AASA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAcvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,qBAqLzC"}
1
+ {"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAcvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,qBAoLzC"}
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useApolloClient } from '@apollo/client/react';
10
11
  import { Grid, GridItem } from '@patternfly/react-core';
11
12
  import { SupportFeedbackForm } from '@rh-support/components';
12
13
  import { fetchProducts, GlobalMetadataDispatchContext, GlobalMetadataStateContext } from '@rh-support/react-context';
@@ -37,10 +38,9 @@ export function WizardLayout(props) {
37
38
  const { routeState: { activeSection, isCaseCreate }, } = useContext(RouteContext);
38
39
  const { getMetadata } = useMetadata();
39
40
  const [isAIChatMode, setIsAIChatMode] = useState(false);
40
- const { caseCreationError, contactSSOName, caseType, product, caseState, hasInvalidEntitlements } = useCaseSelector((state) => ({
41
+ const { caseCreationError, caseType, product, caseState, hasInvalidEntitlements } = useCaseSelector((state) => ({
41
42
  caseState: state,
42
43
  caseCreationError: state.caseCreationError,
43
- contactSSOName: state.caseDetails.contactSSOName,
44
44
  caseType: state.caseDetails.caseType,
45
45
  product: state.caseDetails.product,
46
46
  hasInvalidEntitlements: state.hasInvalidEntitlements,
@@ -50,6 +50,7 @@ export function WizardLayout(props) {
50
50
  const { sessionRestore: { activeSessionId, previousSessions }, } = useContext(SessionRestoreStateContext);
51
51
  const { globalMetadataState: { allProducts, loggedInUser, loggedInUsersAccount, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
52
52
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
53
+ const apolloClient = useApolloClient();
53
54
  const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
54
55
  const { attachmentState } = useContext(AttachmentStateContext);
55
56
  const isAnyFileAttachedLocal = isAnyFileAttached(attachmentState.caseFiles.selectedLocalFiles);
@@ -101,7 +102,7 @@ export function WizardLayout(props) {
101
102
  "Try submitting again after a minute. Please ",
102
103
  React.createElement(SupportFeedbackForm, { isInline: true }),
103
104
  " if you continue to see this message.")));
104
- submitCase(caseDispatch, sessionRestoreDispatch, caseState, isCaseCreate, errorMessageCaseSubmit500, loggedInUser.data.ssoUsername, loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data.secureSupport, isReSubmitting || false, RouteUtils.getQueryParams(props.routeProps).caseCreate === 'true', sessionItem);
105
+ submitCase(caseDispatch, sessionRestoreDispatch, caseState, isCaseCreate, errorMessageCaseSubmit500, loggedInUser.data.ssoUsername, loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data.secureSupport, isReSubmitting || false, RouteUtils.getQueryParams(props.routeProps).caseCreate === 'true', sessionItem, apolloClient);
105
106
  // reset viewedModals on case submit
106
107
  viewedConfirmationModalsList.current = [];
107
108
  !isReSubmitting &&
@@ -120,11 +121,9 @@ export function WizardLayout(props) {
120
121
  }
121
122
  setConfirmationModalType(null);
122
123
  };
123
- // Loading app metadata
124
124
  useEffect(() => {
125
- fetchProducts(dispatchToGlobalMetadataReducer, contactSSOName);
126
- // eslint-disable-next-line react-hooks/exhaustive-deps
127
- }, [contactSSOName, dispatchToGlobalMetadataReducer]);
125
+ fetchProducts(dispatchToGlobalMetadataReducer, apolloClient);
126
+ }, [dispatchToGlobalMetadataReducer, apolloClient]);
128
127
  return (React.createElement(React.Fragment, null,
129
128
  React.createElement(GlobalTroubleshootEffects, { routeProps: props.routeProps }),
130
129
  activeSection !== AppRouteSections.DESCRIBE_IDEA && (React.createElement(PreCaseConfirmationModals, { onModalClose: onModalClose, confirmationModalType: confirmationModalType, onConfirm: () => submitCaseAndNavigate(caseCreationError) })),
@@ -1 +1 @@
1
- {"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAAoB,eAAe,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAM3G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5E,kCAAkC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACpF,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gCAAgC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACjF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAkbtC;kBAlbQ,gBAAgB;;;AAobzB,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAAoB,eAAe,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAM3G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5E,kCAAkC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACpF,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gCAAgC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACjF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBA8atC;kBA9aQ,gBAAgB;;;AAgbzB,eAAe,gBAAgB,CAAC"}
@@ -12,7 +12,6 @@ import { Button, ButtonVariant, WizardFooterWrapper } from '@patternfly/react-co
12
12
  import { useFetch, usePrevious } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext, useCanCreateCase } from '@rh-support/react-context';
14
14
  import { dtmTrackEventCaseCreationStepEncountered, getResTypeFromUrl, isFunctionalCookieAccepted, PreviousToNewCaseTypeMap, scrollIntoView, } from '@rh-support/utils';
15
- import find from 'lodash/find';
16
15
  import isEmpty from 'lodash/isEmpty';
17
16
  import isEqual from 'lodash/isEqual';
18
17
  import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
@@ -32,14 +31,15 @@ import { RecommendationFeedbackModal } from '../Recommendations/RecommendationFe
32
31
  import { useIsSectionValid } from '../shared/useIsSectionValid';
33
32
  const defaultProps = {};
34
33
  function WizardNavigation(props) {
35
- var _a, _b;
36
34
  const { t } = useTranslation();
37
35
  const { isVariationA } = useAB();
38
36
  const canCreateCase = useCanCreateCase();
39
37
  const { recommendationState } = useContext(RecommendationStateContext);
40
38
  const aiResponseState = useAIResponseState();
41
- const { routeState: { activeSection, isNextBtnClickedToShowValidationError, noValidEntitlement, isSearchIntent, isCaseCreate, }, } = useContext(RouteContext);
42
- const { globalMetadataState: { loggedInUsersAccount, allProducts, navBarRef }, } = useContext(GlobalMetadataStateContext);
39
+ const { routeState: { activeSection, isNextBtnClickedToShowValidationError,
40
+ // noValidEntitlement,
41
+ isCaseCreate, }, } = useContext(RouteContext);
42
+ const { globalMetadataState: { loggedInUsersAccount, navBarRef }, } = useContext(GlobalMetadataStateContext);
43
43
  const { caseState, issue, summary, product, version, caseType } = useCaseSelector((state) => ({
44
44
  caseState: state,
45
45
  issue: state.caseDetails.issue,
@@ -49,8 +49,11 @@ function WizardNavigation(props) {
49
49
  caseType: state.caseDetails.caseType,
50
50
  manageSupportCases: state.selectedOwner.data.manageSupportCases,
51
51
  }), isEqual);
52
- // To check if the user is entitled or not
53
- 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;
52
+ // isEntitledProduct commented out; product-level entitlement now resolved from SFDCProductJSON__c
53
+ // const isEntitledProduct = find(
54
+ // allProducts?.data?.productsResult,
55
+ // (p) => p.product === caseState.caseDetails.product
56
+ // )?.isEntitledProduct;
54
57
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
55
58
  const { activeSectionError, isSectionValidFn } = useIsSectionValid(activeSection);
56
59
  const [isRecsModalVisible, setIsRecsModalVisible] = useState(false);
@@ -251,7 +254,6 @@ function WizardNavigation(props) {
251
254
  }
252
255
  catch (e) { }
253
256
  });
254
- const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
255
257
  const nextButtonDisabledLogic = () => {
256
258
  const isLoadingARH = props.isLoadingARH &&
257
259
  props.activeStep.id === AppRouteSections.RESOURCES &&
@@ -263,10 +265,9 @@ function WizardNavigation(props) {
263
265
  let value = isLoadingARH ||
264
266
  ((isEmpty(summary) || isEmpty(issue) || isEmpty(product) || isEmpty(version)) &&
265
267
  props.activeStep.id === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) ||
266
- (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
267
268
  props.activeStep.nextButtonLabel === 'Troubleshoot' ||
268
269
  (isSectionValidFn && !isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
269
- noValidEntitlement ||
270
+ // noValidEntitlement ||
270
271
  isLoadingRecs;
271
272
  return value;
272
273
  };
@@ -0,0 +1,4 @@
1
+ export * from './queries';
2
+ export * from './mutations';
3
+ export * from './schemas';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './queries';
2
+ export * from './mutations';
3
+ export * from './schemas';
@@ -0,0 +1,2 @@
1
+ export declare const CREATE_RME_CASE_ESCALATION: import("@apollo/client").DocumentNode;
2
+ //# sourceMappingURL=createRMECaseEscalation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRMECaseEscalation.d.ts","sourceRoot":"","sources":["../../../../src/graphql/mutations/createRMECaseEscalation.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,uCAsBtC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { gql } from '@apollo/client/core';
2
+ export const CREATE_RME_CASE_ESCALATION = gql `
3
+ mutation CreateRMECaseEscalation($caseInput: SalesforceSupportCaseCreateRepresentation!) {
4
+ salesforce_support_uiapi {
5
+ CaseCreate(input: { SalesforceSupportCase: $caseInput }) {
6
+ SalesforceSupportRecord {
7
+ Id
8
+ CaseNumber {
9
+ value
10
+ }
11
+ Status {
12
+ value
13
+ }
14
+ Subject {
15
+ value
16
+ }
17
+ ParentId {
18
+ value
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `;
@@ -0,0 +1,2 @@
1
+ export { CREATE_RME_CASE_ESCALATION } from './createRMECaseEscalation';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/graphql/mutations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export { CREATE_RME_CASE_ESCALATION } from './createRMECaseEscalation';
@@ -0,0 +1,2 @@
1
+ export declare const GET_ESCALATION_DETAILS: import("@apollo/client").DocumentNode;
2
+ //# sourceMappingURL=getEscalationDetails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEscalationDetails.d.ts","sourceRoot":"","sources":["../../../../src/graphql/queries/getEscalationDetails.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,uCAsBlC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { gql } from '@apollo/client/core';
2
+ export const GET_ESCALATION_DETAILS = gql `
3
+ query getEscalationDetails($where: SalesforceSupportCase_Filter) {
4
+ salesforce_support_uiapi {
5
+ query {
6
+ SalesforceSupportCase(where: $where) {
7
+ edges {
8
+ node {
9
+ CaseNumber {
10
+ value
11
+ }
12
+ Subject {
13
+ value
14
+ }
15
+ Status {
16
+ value
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `;
@@ -0,0 +1,2 @@
1
+ export declare const GET_PARENT_ID: import("@apollo/client").DocumentNode;
2
+ //# sourceMappingURL=getParentId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getParentId.d.ts","sourceRoot":"","sources":["../../../../src/graphql/queries/getParentId.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,uCAczB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { gql } from '@apollo/client/core';
2
+ export const GET_PARENT_ID = gql `
3
+ query Query($where: SalesforceSupportCase_Filter) {
4
+ salesforce_support_uiapi {
5
+ query {
6
+ SalesforceSupportCase(where: $where) {
7
+ edges {
8
+ node {
9
+ Id
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
15
+ }
16
+ `;