@dentira/dentira-bulk-upload-widget 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -2,34 +2,27 @@
2
2
 
3
3
  ```
4
4
  type BulkUploadConfig = {
5
- id: string;
6
- type: BulkUploadType;
5
+ type: string;
7
6
  isOpen: boolean;
8
7
  handleClose: () => void;
9
8
  handleBackButton?: () => void;
10
9
  bodyText?: string;
11
10
  title?: string;
12
- fileType: FileType;
11
+ fileType: "CSV" | "EXCEL";
13
12
  rules?: string[];
14
13
  columns?: string[];
15
- downloadTemplateConfig?: {
16
- hasDynamicTemplate?: boolean;
17
- payload?: downloadTemplatePayloadType;
18
- };
14
+ downloadTemplateConfig?: DownloadTemplateConfigType;
19
15
  uploadConfig?: Record<any, any>;
20
16
  session: string;
21
17
  apiKey: string;
22
18
  };
23
19
 
24
- enum FileType {
25
- EXCEL = "EXCEL",
26
- CSV = "CSV",
27
- }
28
-
29
- enum BulkUploadType {
30
- FORMULARY_UPLOAD = "FORMULARY_UPLOAD",
31
- SAMPLE = "sample",
32
- }
20
+ type DownloadTemplateConfigType =
21
+ | {
22
+ hasDynamicTemplate?: boolean;
23
+ payload?: downloadTemplatePayloadType;
24
+ }
25
+ | undefined;
33
26
 
34
27
  type downloadTemplatePayloadType = Record<
35
28
  string,
@@ -40,7 +33,12 @@ type downloadTemplatePayloadType = Record<
40
33
  ## Example use.
41
34
 
42
35
  ```
43
- import { BulkUploadDialog, BulkUploadConfig, BulkUploadType, FileType , useDialog} from "@dentira/dentira-bulk-upload-widget";
36
+ import { Button } from "@mui/material";
37
+ import { BulkUploadDialog } from "../src/components/BulkUploadDialog.tsx";
38
+ import { useDialog } from "../src/hooks/useDialog.ts";
39
+ import { BulkUploadConfig } from "../src/types.ts";
40
+ import { session, apiKey } from "../variables.ts";
41
+ import { EXCEL } from "../src/utils/constants.ts";
44
42
 
45
43
  function App() {
46
44
  const { isOpen, closeDialog, openDialog } = useDialog();
@@ -48,10 +46,8 @@ function App() {
48
46
  const handleClose = () => {
49
47
  closeDialog();
50
48
  };
51
-
52
49
  const bodyText =
53
50
  "Lorem ipsum dolor sit amet consectetur adipisicing elit. Quospraesentium distinctio a tempora est et fugiat! Quam neque distinctio iure possimus, nam voluptatum repellat eius facere dolorem, magni vel nesciunt. Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem";
54
-
55
51
  const title = "Modal title";
56
52
 
57
53
  const rules = [
@@ -59,15 +55,10 @@ function App() {
59
55
  "sit amet consectetur adipisicing elit.",
60
56
  "Quam neque distinctio iure possimus, nam voluptatum repellat",
61
57
  ];
62
-
63
- const id = new Date().toISOString();
64
-
65
- const columns = ["Lorem", "distinctio", "nam"]; // strings here will be used to highlight these words in rules section of the modal.
66
-
67
- const fileType: FileType = FileType.EXCEL;
58
+ const columns = ["Lorem", "distinctio", "nam"];
59
+ const fileType = EXCEL;
68
60
 
69
61
  const config: BulkUploadConfig = {
70
- id,
71
62
  isOpen,
72
63
  bodyText,
73
64
  handleClose,
@@ -75,30 +66,27 @@ function App() {
75
66
  rules,
76
67
  columns,
77
68
  fileType,
78
- downloadTemplateConfig: {
79
- hasDynamicTemplate: true,
80
- payload: { testKey: "test" },
81
- },
82
69
  uploadConfig: {
83
- // additional kvp's for upload API request.
84
- testKey1: "testKey1",
85
- testKey2: "testKey2",
70
+ shoppinglist_name: "test group list bulk upload",
86
71
  },
87
- session: <sessionToken>,
88
- apiKey: <apiKey>,
89
- type: BulkUploadType.SAMPLE,
72
+ session,
73
+ apiKey,
74
+ type: "GROUPITEMLIST",
90
75
  };
91
76
 
92
77
  return (
93
78
  <>
94
- <button onClick={openDialog}>
79
+ <Button onClick={openDialog} variant="contained">
95
80
  {!isOpen ? "Open" : "Close"}
96
- </button>
97
- <BulkUploadDialog key={id} config={config} />
81
+ </Button>
82
+ <BulkUploadDialog config={config} />
98
83
  </>
99
84
  );
100
85
  }
101
86
 
102
87
  export default App;
103
88
 
89
+
90
+
91
+
104
92
  ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export { BulkUploadDialog } from './src/components/BulkUploadDialog.tsx';
2
2
  export { useDialog } from './src/hooks/useDialog';
3
3
  export type { BulkUploadConfig } from './src/types';
4
- export { BulkUploadType, FileType } from './src/types';