dce-reactkit 3.2.1 → 3.2.2-beta.2

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.
Files changed (55) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/dist/cjs/index.js +2106 -416
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/CSVDownloadButton.d.ts +19 -0
  5. package/dist/cjs/types/components/IntelliTable.d.ts +17 -0
  6. package/dist/cjs/types/components/LogReviewer.d.ts +13 -0
  7. package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -0
  8. package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
  9. package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
  10. package/dist/cjs/types/helpers/canReviewLogs.d.ts +7 -0
  11. package/dist/cjs/types/helpers/genCSV.d.ts +14 -0
  12. package/dist/cjs/types/helpers/getMonthName.d.ts +14 -0
  13. package/dist/cjs/types/index.d.ts +8 -1
  14. package/dist/cjs/types/server/initServer.d.ts +8 -0
  15. package/dist/cjs/types/types/IntelliTableColumn.d.ts +12 -0
  16. package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -0
  17. package/dist/cjs/types/types/LogMetadataType.d.ts +19 -0
  18. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +2 -1
  19. package/dist/esm/index.js +2103 -418
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/types/components/CSVDownloadButton.d.ts +19 -0
  22. package/dist/esm/types/components/IntelliTable.d.ts +17 -0
  23. package/dist/esm/types/components/LogReviewer.d.ts +13 -0
  24. package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -0
  25. package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
  26. package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
  27. package/dist/esm/types/helpers/canReviewLogs.d.ts +7 -0
  28. package/dist/esm/types/helpers/genCSV.d.ts +14 -0
  29. package/dist/esm/types/helpers/getMonthName.d.ts +14 -0
  30. package/dist/esm/types/index.d.ts +8 -1
  31. package/dist/esm/types/server/initServer.d.ts +8 -0
  32. package/dist/esm/types/types/IntelliTableColumn.d.ts +12 -0
  33. package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -0
  34. package/dist/esm/types/types/LogMetadataType.d.ts +19 -0
  35. package/dist/esm/types/types/ReactKitErrorCode.d.ts +2 -1
  36. package/dist/index.d.ts +163 -47
  37. package/package.json +1 -1
  38. package/sandbox.js +78 -17
  39. package/src/components/AppWrapper.tsx +15 -0
  40. package/src/components/CSVDownloadButton.tsx +102 -0
  41. package/src/components/IntelliTable.tsx +610 -0
  42. package/src/components/LogReviewer.tsx +2038 -0
  43. package/src/components/SimpleDateChooser.tsx +26 -27
  44. package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +9 -0
  45. package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +10 -0
  46. package/src/helpers/canReviewLogs.ts +33 -0
  47. package/src/helpers/genCSV.ts +59 -0
  48. package/src/helpers/getHumanReadableDate.ts +6 -17
  49. package/src/helpers/getMonthName.ts +29 -0
  50. package/src/index.ts +14 -0
  51. package/src/server/initServer.ts +105 -3
  52. package/src/types/IntelliTableColumn.ts +24 -0
  53. package/src/types/LogBuiltInMetadata.ts +1 -0
  54. package/src/types/LogMetadataType.ts +23 -0
  55. package/src/types/ReactKitErrorCode.tsx +2 -1
@@ -21,6 +21,8 @@ import Modal from './Modal';
21
21
 
22
22
  // Import custom errors
23
23
  import ErrorWithCode from '../errors/ErrorWithCode';
24
+ import logClientEvent from '../helpers/logClientEvent';
25
+ import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
24
26
 
25
27
  /*------------------------------------------------------------------------*/
26
28
  /* Props */
@@ -222,6 +224,19 @@ export const showFatalError = (
222
224
  : String(error.code ?? ReactKitErrorCode.NoCode)
223
225
  );
224
226
 
227
+ // Add log
228
+ logClientEvent({
229
+ context: LogBuiltInMetadata.Context.ClientFatalError,
230
+ error: {
231
+ message,
232
+ code,
233
+ stack: (error ?? {}).stack,
234
+ },
235
+ metadata: {
236
+ errorTitle,
237
+ },
238
+ });
239
+
225
240
  // Handle case where app hasn't loaded
226
241
  if (!setFatalErrorMessage || !setFatalErrorCode) {
227
242
  alert(
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Button for downloading a csv file
3
+ * @author Gabe Abrams
4
+ */
5
+
6
+ // Import React
7
+ import React from 'react';
8
+
9
+ // Import FontAwesome
10
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
+ import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons';
12
+
13
+ /*------------------------------------------------------------------------*/
14
+ /* Types */
15
+ /*------------------------------------------------------------------------*/
16
+
17
+ // Props definition
18
+ type Props = {
19
+ // The filename
20
+ filename: string,
21
+ // The contents of the CSV file to download
22
+ csv: string,
23
+ // Id of the button
24
+ id?: string,
25
+ // Class name of the button
26
+ className?: string,
27
+ // Aria label for the button
28
+ ariaLabel?: string,
29
+ // Style for the button
30
+ style?: { [k: string]: any },
31
+ // Handler for when the button is clicked (in addition to download)
32
+ onClick?: () => void,
33
+ // Contents of button
34
+ children?: React.ReactNode,
35
+ };
36
+
37
+ /*------------------------------------------------------------------------*/
38
+ /* Component */
39
+ /*------------------------------------------------------------------------*/
40
+
41
+ const CSVDownloadButton: React.FC<Props> = (props) => {
42
+ /*------------------------------------------------------------------------*/
43
+ /* Setup */
44
+ /*------------------------------------------------------------------------*/
45
+
46
+ /* -------------- Props ------------- */
47
+
48
+ // Destructure all props
49
+ const {
50
+ filename,
51
+ csv,
52
+ id,
53
+ className,
54
+ ariaLabel,
55
+ style,
56
+ onClick,
57
+ children,
58
+ } = props;
59
+
60
+ /*------------------------------------------------------------------------*/
61
+ /* Render */
62
+ /*------------------------------------------------------------------------*/
63
+
64
+ /*----------------------------------------*/
65
+ /* Main UI */
66
+ /*----------------------------------------*/
67
+
68
+ // Render the button
69
+ return (
70
+ <a
71
+ id={id}
72
+ download={filename}
73
+ href={`data:application/octet-stream,${csv}`}
74
+ className={`CSVDownloadButton-button ${className ?? 'btn btn-secondary'}`}
75
+ aria-label={(
76
+ ariaLabel
77
+ ? `Click to download ${filename}`
78
+ : ariaLabel
79
+ )}
80
+ style={style}
81
+ onClick={onClick}
82
+ >
83
+ {!children && (
84
+ <>
85
+ <FontAwesomeIcon
86
+ icon={faCloudDownloadAlt}
87
+ className="mr-2"
88
+ />
89
+ Download CSV
90
+ </>
91
+ )}
92
+ {children}
93
+ </a>
94
+ );
95
+ };
96
+
97
+ /*------------------------------------------------------------------------*/
98
+ /* Wrap Up */
99
+ /*------------------------------------------------------------------------*/
100
+
101
+ // Export component
102
+ export default CSVDownloadButton;