@rh-support/react-context 2.5.303 → 2.5.304
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/context/CaseStatusContext.d.ts +9 -0
- package/lib/esm/context/CaseStatusContext.d.ts.map +1 -0
- package/lib/esm/context/CaseStatusContext.js +5 -0
- package/lib/esm/hooks/useCanEditCase.d.ts +2 -1
- package/lib/esm/hooks/useCanEditCase.d.ts.map +1 -1
- package/lib/esm/hooks/useCanEditCase.js +20 -3
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export declare const CaseStatusContext: React.Context<string>;
|
|
3
|
+
interface CaseStatusProviderProps {
|
|
4
|
+
caseStatus?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function CaseStatusProvider({ caseStatus, children }: CaseStatusProviderProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=CaseStatusContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaseStatusContext.d.ts","sourceRoot":"","sources":["../../../src/context/CaseStatusContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,eAAO,MAAM,iBAAiB,uBAA+C,CAAC;AAE9E,UAAU,uBAAuB;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAEnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanEditCase.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCanEditCase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCanEditCase.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCanEditCase.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,CAAC,kBAAkB,CAAC,EAAE,MAAM;;;;EA0BzD"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import { ToastNotification } from '@rh-support/components';
|
|
2
|
+
import { isCaseArchivedStatus } from '@rh-support/utils';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { CaseStatusContext } from '../context/CaseStatusContext';
|
|
1
6
|
import { useSubscriptionAbused } from './useSubscriptionAbused';
|
|
2
|
-
export function useCanEditCase() {
|
|
7
|
+
export function useCanEditCase(caseStatusOverride) {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const contextCaseStatus = useContext(CaseStatusContext);
|
|
10
|
+
const caseStatus = caseStatusOverride !== null && caseStatusOverride !== void 0 ? caseStatusOverride : contextCaseStatus;
|
|
3
11
|
const { checkAndShowSubscriptionAbused, isAccountFreezed } = useSubscriptionAbused();
|
|
12
|
+
const isCaseArchived = isCaseArchivedStatus(caseStatus);
|
|
13
|
+
const alert = () => {
|
|
14
|
+
if (isCaseArchived) {
|
|
15
|
+
ToastNotification.addInfoMessage(t('This case has been archived and can no longer be updated. Contact us or open a new case if you need further assistance.'));
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return checkAndShowSubscriptionAbused();
|
|
19
|
+
};
|
|
4
20
|
return {
|
|
5
|
-
alert
|
|
6
|
-
isCaseNotEditable: isAccountFreezed,
|
|
21
|
+
alert,
|
|
22
|
+
isCaseNotEditable: isAccountFreezed || isCaseArchived,
|
|
23
|
+
isCaseArchived,
|
|
7
24
|
};
|
|
8
25
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { GlobalContextWrapper } from './GlobalContextWrapper';
|
|
|
5
5
|
export { GlobalMetadataContextProvider, GlobalMetadataStateContext, GlobalMetadataDispatchContext, IGlobalMetadataStateContext, useGlobalDispatchContext, useGlobalStateContext, } from './context/GlobalMetadataContext';
|
|
6
6
|
export { GlobalTranslationContext, GlobalTranslationProvider, cacheTrans, SELECTED_TRANS_LANGUAGE, } from './context/GlobalTranslationProvider';
|
|
7
7
|
export { GlobalAlertMessageContextProvider, GlobalAlertMessageStateContext, GlobalAlertMessageDispatchContext, IGlobalAlertMessageStateContext, useGlobalAlertMessageDispatchContext, useGlobalAlertMessageStateContext, } from './context/GlobalAlertMessageContext';
|
|
8
|
+
export { CaseStatusContext, CaseStatusProvider } from './context/CaseStatusContext';
|
|
8
9
|
export * from './utils';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACH,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,uBAAuB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,GACpC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACH,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,uBAAuB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,GACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEpF,cAAc,SAAS,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -6,5 +6,6 @@ export { GlobalContextWrapper } from './GlobalContextWrapper';
|
|
|
6
6
|
export { GlobalMetadataContextProvider, GlobalMetadataStateContext, GlobalMetadataDispatchContext, useGlobalDispatchContext, useGlobalStateContext, } from './context/GlobalMetadataContext';
|
|
7
7
|
export { GlobalTranslationContext, GlobalTranslationProvider, cacheTrans, SELECTED_TRANS_LANGUAGE, } from './context/GlobalTranslationProvider';
|
|
8
8
|
export { GlobalAlertMessageContextProvider, GlobalAlertMessageStateContext, GlobalAlertMessageDispatchContext, useGlobalAlertMessageDispatchContext, useGlobalAlertMessageStateContext, } from './context/GlobalAlertMessageContext';
|
|
9
|
+
export { CaseStatusContext, CaseStatusProvider } from './context/CaseStatusContext';
|
|
9
10
|
export * from './utils';
|
|
10
11
|
// dummy change for publish
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.304",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@cee-eng/hydrajs": "^4.18.114",
|
|
38
38
|
"@patternfly/react-core": "6.2.1",
|
|
39
39
|
"@patternfly/react-icons": "6.2.1",
|
|
40
|
-
"@rh-support/components": "2.5.
|
|
40
|
+
"@rh-support/components": "2.5.209",
|
|
41
41
|
"@rh-support/types": "2.0.26",
|
|
42
|
-
"@rh-support/user-permissions": "2.5.
|
|
43
|
-
"@rh-support/utils": "2.5.
|
|
42
|
+
"@rh-support/user-permissions": "2.5.156",
|
|
43
|
+
"@rh-support/utils": "2.5.137",
|
|
44
44
|
"i18next": "^23.15.0",
|
|
45
45
|
"localforage": "^1.10.0",
|
|
46
46
|
"lodash": "^4.17.21",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"defaults and supports es6-module",
|
|
93
93
|
"maintained node versions"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "56082a7ae9e90099d5504236da82ee1d2688048c"
|
|
96
96
|
}
|