@bjsdistribution/dms-client-return 0.0.53 → 0.0.54

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.53",
2
+ "version": "0.0.54",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -93,12 +93,30 @@ export const TableData = [
93
93
  },
94
94
  ];
95
95
 
96
- export const optionsPrint = [
97
- { icon: 'runSheet', label: 'Print Runsheet' },
98
- { icon: 'loadSheet', label: 'Print Loadsheet' },
99
- { icon: 'deliveryLables', label: 'Print Delivery Labels' },
100
- { icon: 'customerLables', label: 'Print Customer Labels' },
101
- { icon: 'collectionLables', label: 'Print Collection Labels' },
96
+ interface PrintOption {
97
+ icon: string;
98
+ label: string;
99
+ type: string;
100
+ }
101
+
102
+ export const optionsPrint: PrintOption[] = [
103
+ { icon: 'runSheet', label: 'Print Runsheet', type: 'runsheet_url' },
104
+ { icon: 'loadSheet', label: 'Print Loadsheet', type: 'loadsheet_url' },
105
+ {
106
+ icon: 'deliveryLables',
107
+ label: 'Print Delivery Labels',
108
+ type: 'delivery_label_url',
109
+ },
110
+ {
111
+ icon: 'customerLables',
112
+ label: 'Print Customer Labels',
113
+ type: 'customer_label_url',
114
+ },
115
+ {
116
+ icon: 'collectionLables',
117
+ label: 'Print Return Labels',
118
+ type: 'return_label_url',
119
+ },
102
120
  ];
103
121
 
104
122
  export const optionsForReturnPrint = [
@@ -372,9 +372,9 @@ const OrderTable = ({ loadingskeleton }: any) => {
372
372
  <PrinterIcon />
373
373
  <DownIcon />
374
374
 
375
- {printToogle == index && (
375
+ {printToogle === index && (
376
376
  <div ref={dropdownRef}>
377
- <PrintDropDown legacyProductId={item.id} />
377
+ <PrintDropDown legacyProductId={item} />
378
378
  </div>
379
379
  )}
380
380
  </li>
@@ -383,13 +383,6 @@ const OrderTable = ({ loadingskeleton }: any) => {
383
383
  <LoadIcon />
384
384
  </li>
385
385
  </ul>
386
- {/* <div className="shareIconContainer">
387
- <PrinterIcon />
388
- <DownIcon />
389
- </div>
390
- <div className="downloadcontainer">
391
- <LoadIcon />
392
- </div> */}
393
386
  </td>
394
387
  </tr>
395
388
  );
@@ -8,43 +8,30 @@ const PrintDropDown = ({
8
8
  }: {
9
9
  legacyProductId: Record<string, any>;
10
10
  }) => {
11
- const downloadFiles = (label: string) => {
12
- const url =
13
- legacyProductId?.[
14
- `${label
15
- .replace('Print ', '')
16
- .toLowerCase()
17
- .replace(' ', '_')}_url`
18
- ];
11
+ const downloadFiles = (type: string) => {
12
+ let url: string | undefined;
13
+
14
+ if (type) {
15
+ url = legacyProductId[type];
16
+ }
19
17
 
20
18
  if (url) {
21
19
  window.open(url, '_blank');
22
20
  } else {
23
- console.log('URL not available for', label);
21
+ console.log('URL not available for', type);
24
22
  }
25
23
  };
26
24
 
27
- const isOptionDisabled = (label: string) => {
28
- const url =
29
- legacyProductId?.[
30
- `${label
31
- .replace('Print ', '')
32
- .toLowerCase()
33
- .replace(' ', '_')}_url`
34
- ];
35
- return !url;
36
- };
37
-
38
25
  return (
39
26
  <OptionsList>
40
- {optionsPrint.map((item, index) => {
27
+ {optionsPrint?.map((item, index) => {
41
28
  const IconComponent = PrintIconMap[item.icon];
42
- const isDisabled = isOptionDisabled(item.label);
29
+ const isDisabled = !legacyProductId[item.type];
43
30
 
44
31
  return (
45
32
  <OptionsListLi
46
33
  key={index}
47
- onClick={() => !isDisabled && downloadFiles(item.label)}
34
+ onClick={() => !isDisabled && downloadFiles(item.type)}
48
35
  disabled={isDisabled}
49
36
  >
50
37
  {IconComponent && <IconComponent />}
@@ -7,7 +7,7 @@ function useGetEventNotes() {
7
7
  const ssoToken = getCookie('id_token');
8
8
 
9
9
  const perform = async () => {
10
- const endpoint = `${getBaseEndpoint()}events/get/event_information/`;
10
+ const endpoint = `${getBaseEndpoint()}/events/get/event_information/`;
11
11
  // setLoading(true);
12
12
  try {
13
13
  const headers = {