@openmrs/esm-stock-management-app 1.0.1-pre.418 → 1.0.1-pre.433

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/314.js +1 -0
  2. package/dist/314.js.map +1 -0
  3. package/dist/main.js +1 -1
  4. package/dist/main.js.map +1 -1
  5. package/dist/openmrs-esm-stock-management-app.js +1 -1
  6. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +31 -31
  7. package/dist/openmrs-esm-stock-management-app.js.map +1 -1
  8. package/dist/routes.json +1 -1
  9. package/package.json +1 -1
  10. package/src/core/api/types/stockItem/StockItemReference.ts +18 -0
  11. package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +2 -0
  12. package/src/core/components/carbon/controlled-text-input/controlled-text-input.component.tsx +2 -2
  13. package/src/core/components/tabs/vertical-tabs.scss +6 -3
  14. package/src/stock-items/add-stock-item/add-stock-item.component.tsx +8 -0
  15. package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +26 -6
  16. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +3 -2
  17. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.component.tsx +264 -0
  18. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.resource.ts +39 -0
  19. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +23 -0
  20. package/src/stock-items/add-stock-item/stock-item-references/stock-references-selector.component.tsx +66 -0
  21. package/src/stock-items/add-stock-item/stock-item-references/validation-schema.ts +8 -0
  22. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +5 -2
  23. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +0 -1
  24. package/src/stock-items/stock-items.resource.ts +72 -1
  25. package/src/stock-operations/stock-operation.utils.tsx +1 -1
  26. package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +1 -1
  27. package/src/stock-operations/stock-operations-table.component.tsx +8 -1
  28. package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +8 -3
  29. package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +8 -3
  30. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +7 -4
  31. package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +8 -3
  32. package/src/utils.ts +7 -0
  33. package/dist/39.js +0 -1
  34. package/dist/39.js.map +0 -1
  35. package/src/stock-items/add-stock-item/stock-rules/stock-rules.component.tsx +0 -16
  36. package/src/stock-items/add-stock-item/stock-rules/stock-rules.resource.tsx +0 -0
  37. package/src/stock-items/add-stock-item/stock-rules/stock-rules.scss +0 -0
  38. package/src/stock-operations/swr-revalidation.ts +0 -7
  39. package/src/stock-sources/swr-revalidation.ts +0 -7
  40. package/src/stock-user-role-scopes/swr-revalidation.ts +0 -7
@@ -3,8 +3,13 @@ import { Button, InlineLoading } from "@carbon/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { TrashCan } from "@carbon/react/icons";
5
5
  import { deleteUserRoleScopes } from "../stock-user-role-scopes.resource";
6
- import { showModal, showNotification, showToast } from "@openmrs/esm-framework";
7
- import { handleMutate } from "../swr-revalidation";
6
+ import {
7
+ restBaseUrl,
8
+ showModal,
9
+ showNotification,
10
+ showToast,
11
+ } from "@openmrs/esm-framework";
12
+ import { handleMutate } from "../../utils";
8
13
 
9
14
  interface StockUserScopDeleteActionMenuProps {
10
15
  uuid: string;
@@ -27,7 +32,7 @@ const StockUserScopeDeleteActionMenu: React.FC<
27
32
  deleteUserRoleScopes(ids)
28
33
  .then(
29
34
  () => {
30
- handleMutate("ws/rest/v1/stockmanagement/userrolescope");
35
+ handleMutate(`${restBaseUrl}/stockmanagement/userrolescope`);
31
36
  setDeletingUserScope(false);
32
37
  showToast({
33
38
  critical: true,
package/src/utils.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { showNotification } from "@openmrs/esm-framework";
2
+ import { mutate } from "swr";
2
3
 
3
4
  export function errorAlert(msg: string, error?: Error) {
4
5
  showNotification({
@@ -8,3 +9,9 @@ export function errorAlert(msg: string, error?: Error) {
8
9
  description: error?.message,
9
10
  });
10
11
  }
12
+
13
+ export const handleMutate = (url: string) => {
14
+ mutate((key) => typeof key === "string" && key.startsWith(url), undefined, {
15
+ revalidate: true,
16
+ });
17
+ };