@bjsdistribution/dms-client-return 0.0.40 → 0.0.41

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.40",
2
+ "version": "0.0.41",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "testEnvironment": "jest-environment-jsdom-sixteen"
60
60
  },
61
61
  "devDependencies": {
62
- "@bjsdistribution/dms-component-library": "0.1.4",
62
+ "@bjsdistribution/dms-component-library": "0.1.11",
63
63
  "@size-limit/preset-small-lib": "^11.0.1",
64
64
  "@tippyjs/react": "^4.2.6",
65
65
  "@types/react": "^18.2.47",
@@ -70,6 +70,31 @@ function SelectionFilter() {
70
70
  localStorage.setItem('clientName', option?.label);
71
71
  localStorage.setItem('clientId', value?.toString());
72
72
  localStorage.setItem('account_number', option?.account_number);
73
+ const storedClientId = localStorage.getItem('clientId');
74
+
75
+ const filteredClient = clientOptions?.find(
76
+ (client: any) => client?.value == storedClientId
77
+ );
78
+
79
+ if (filteredClient) {
80
+ const mappedActions = Array.isArray(filteredClient?.actions)
81
+ ? filteredClient?.actions?.map((action: any) => ({
82
+ label: action,
83
+ value: action,
84
+ }))
85
+ : [];
86
+
87
+ setActionTypeOptions(mappedActions);
88
+
89
+ const mappedLocations = Array.isArray(filteredClient?.return_locations)
90
+ ? filteredClient?.return_locations?.map((location: any) => ({
91
+ label: location?.location_name,
92
+ value: location?.token,
93
+ }))
94
+ : [];
95
+
96
+ setLocationOptions(mappedLocations);
97
+ }
73
98
 
74
99
  //set payload
75
100
  setReturnPayload((prevState: any) => ({
@@ -55,7 +55,7 @@ const ModalManager = () => {
55
55
  data: response,
56
56
  setShouldPerformAction,
57
57
  loading: confirmLoading,
58
- error: apiError,
58
+ // error: apiError,
59
59
  setError,
60
60
  } = useApiHook<{
61
61
  data: ApiResponse[];
@@ -80,11 +80,12 @@ const ModalManager = () => {
80
80
 
81
81
  useEffect(() => {
82
82
  // @ts-ignore
83
- if (apiError && apiError?.code !== 200) {
83
+ if (response && response?.code == 500) {
84
+ // @ts-ignore
84
85
  notification.error({
85
86
  message: 'Failure',
86
87
  // @ts-ignore
87
- description: `${apiError?.message}`,
88
+ description: `${response?.message}`,
88
89
  });
89
90
  dispatch({ type: 'close' });
90
91
  setSelectedReturnOrder([]);
@@ -115,7 +116,7 @@ const ModalManager = () => {
115
116
  // for dev
116
117
  navigate('/returnclient/order-return');
117
118
  }
118
- }, [response, apiError, postLoading]);
119
+ }, [postLoading]);
119
120
 
120
121
  return (
121
122
  <>