dce-reactkit 3.5.14 → 3.6.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.
package/dist/cjs/index.js CHANGED
@@ -83,17 +83,17 @@ var ReactKitErrorCode$1 = ReactKitErrorCode;
83
83
  * @author Gabe Abrams
84
84
  */
85
85
  /*------------------------------------------------------------------------*/
86
- /* Component */
86
+ /* ------------------------------ Component ----------------------------- */
87
87
  /*------------------------------------------------------------------------*/
88
88
  const ErrorBox = (props) => {
89
89
  /*------------------------------------------------------------------------*/
90
- /* Setup */
90
+ /* -------------------------------- Setup ------------------------------- */
91
91
  /*------------------------------------------------------------------------*/
92
92
  var _a;
93
93
  /* -------------- Props ------------- */
94
94
  const { error, title = 'An Error Occurred', onClose, } = props;
95
95
  /*------------------------------------------------------------------------*/
96
- /* Render */
96
+ /* ------------------------------- Render ------------------------------- */
97
97
  /*------------------------------------------------------------------------*/
98
98
  // Determine error text
99
99
  const errorText = (typeof error === 'string'
@@ -230,11 +230,89 @@ var ModalSize;
230
230
  var ModalSize$1 = ModalSize;
231
231
 
232
232
  /**
233
- * A generic popup modal
233
+ * An error with a code
234
234
  * @author Gabe Abrams
235
235
  */
236
+ class ErrorWithCode extends Error {
237
+ constructor(message, code) {
238
+ super(message);
239
+ this.name = 'ErrorWithCode';
240
+ this.code = code;
241
+ }
242
+ }
243
+
244
+ /*----------------------------------------*/
245
+ /* ---- Static Variables and Getters ---- */
246
+ /*----------------------------------------*/
247
+ /* ----------- Initialized ---------- */
248
+ let onInitialized;
249
+ const initialized = new Promise((resolve) => {
250
+ onInitialized = resolve;
251
+ });
252
+ /* ---------- Send Request ---------- */
253
+ let storedSendRequest;
254
+ /**
255
+ * Get the send request function
256
+ * @author Gabe Abrams
257
+ * @returns sendRequest function
258
+ */
259
+ const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
260
+ // Show timeout error if too much time passes
261
+ let successful = false;
262
+ (() => __awaiter(void 0, void 0, void 0, function* () {
263
+ yield waitMs(5000);
264
+ if (!successful) {
265
+ showFatalError(new ErrorWithCode('Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.', ReactKitErrorCode$1.NoCACCLSendRequestFunction));
266
+ }
267
+ }))();
268
+ // Wait for initialization
269
+ yield initialized;
270
+ successful = true;
271
+ // Return
272
+ return storedSendRequest;
273
+ });
274
+ /* ----- Session Expired Message ---- */
275
+ let sessionExpiredMessage;
276
+ /**
277
+ * Get the custom session expired message
278
+ * @author Gabe Abrams
279
+ * @returns session expired message
280
+ */
281
+ const getSessionExpiredMessage = () => {
282
+ // Return
283
+ return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
284
+ };
285
+ /* ------------ Dark Mode ----------- */
286
+ let darkModeOn = false;
287
+ /**
288
+ * Get whether dark mode is enabled or not
289
+ * @returns true if dark mode is enabled
290
+ */
291
+ const isDarkModeOn = () => {
292
+ return darkModeOn;
293
+ };
294
+ /*----------------------------------------*/
295
+ /* ---------------- Init ---------------- */
296
+ /*----------------------------------------*/
297
+ /**
298
+ * Initialize the client-side version of reactkit
299
+ * @author Gabe Abrams
300
+ * @param opts object containing all arguments
301
+ * @param opts.sendRequest caccl send request functions
302
+ * @param [opts.sessionExpiredMessage] a custom session expired message
303
+ */
304
+ const initClient = (opts) => {
305
+ // Store values
306
+ storedSendRequest = opts.sendRequest;
307
+ sessionExpiredMessage = opts.sessionExpiredMessage;
308
+ darkModeOn = !!opts.darkModeOn;
309
+ // Mark as initialized
310
+ onInitialized(null);
311
+ };
312
+
313
+ /* eslint-disable react/no-unused-prop-types */
236
314
  /*------------------------------------------------------------------------*/
237
- /* Constants */
315
+ /* ------------------------------ Constants ----------------------------- */
238
316
  /*------------------------------------------------------------------------*/
239
317
  // Constants
240
318
  const MS_TO_ANIMATE = 200; // Animation duration
@@ -273,51 +351,66 @@ const modalTypeToModalButtonTypes = {
273
351
  ModalButtonType$1.Cancel,
274
352
  ],
275
353
  };
276
- // Button type styling and labels
277
- const ModalButtonTypeToLabelAndVariant = {
278
- [ModalButtonType$1.Okay]: {
279
- label: 'Okay',
280
- variant: Variant$1.Dark,
281
- },
282
- [ModalButtonType$1.Cancel]: {
283
- label: 'Cancel',
284
- variant: Variant$1.Secondary,
285
- },
286
- [ModalButtonType$1.Yes]: {
287
- label: 'Yes',
288
- variant: Variant$1.Dark,
289
- },
290
- [ModalButtonType$1.No]: {
291
- label: 'No',
292
- variant: Variant$1.Secondary,
293
- },
294
- [ModalButtonType$1.Abandon]: {
295
- label: 'Abandon Changes',
296
- variant: Variant$1.Warning,
297
- },
298
- [ModalButtonType$1.GoBack]: {
299
- label: 'Go Back',
300
- variant: Variant$1.Secondary,
301
- },
302
- [ModalButtonType$1.Continue]: {
303
- label: 'Continue',
304
- variant: Variant$1.Dark,
305
- },
306
- [ModalButtonType$1.ImSure]: {
307
- label: 'I am sure',
308
- variant: Variant$1.Warning,
309
- },
310
- [ModalButtonType$1.Delete]: {
311
- label: 'Yes, Delete',
312
- variant: Variant$1.Danger,
313
- },
314
- [ModalButtonType$1.Confirm]: {
315
- label: 'Confirm',
316
- variant: Variant$1.Dark,
317
- },
354
+ /**
355
+ * Get button type styling and labels
356
+ * @author Gabe Abrams
357
+ * @returns map of button type to label and variant
358
+ */
359
+ const getModalButtonTypeToLabelAndVariant = () => {
360
+ const dark = isDarkModeOn();
361
+ return {
362
+ [ModalButtonType$1.Okay]: {
363
+ label: 'Okay',
364
+ variant: (dark
365
+ ? Variant$1.Light
366
+ : Variant$1.Dark),
367
+ },
368
+ [ModalButtonType$1.Cancel]: {
369
+ label: 'Cancel',
370
+ variant: Variant$1.Secondary,
371
+ },
372
+ [ModalButtonType$1.Yes]: {
373
+ label: 'Yes',
374
+ variant: (dark
375
+ ? Variant$1.Light
376
+ : Variant$1.Dark),
377
+ },
378
+ [ModalButtonType$1.No]: {
379
+ label: 'No',
380
+ variant: Variant$1.Secondary,
381
+ },
382
+ [ModalButtonType$1.Abandon]: {
383
+ label: 'Abandon Changes',
384
+ variant: Variant$1.Warning,
385
+ },
386
+ [ModalButtonType$1.GoBack]: {
387
+ label: 'Go Back',
388
+ variant: Variant$1.Secondary,
389
+ },
390
+ [ModalButtonType$1.Continue]: {
391
+ label: 'Continue',
392
+ variant: (dark
393
+ ? Variant$1.Light
394
+ : Variant$1.Dark),
395
+ },
396
+ [ModalButtonType$1.ImSure]: {
397
+ label: 'I am sure',
398
+ variant: Variant$1.Warning,
399
+ },
400
+ [ModalButtonType$1.Delete]: {
401
+ label: 'Yes, Delete',
402
+ variant: Variant$1.Danger,
403
+ },
404
+ [ModalButtonType$1.Confirm]: {
405
+ label: 'Confirm',
406
+ variant: (dark
407
+ ? Variant$1.Light
408
+ : Variant$1.Dark),
409
+ },
410
+ };
318
411
  };
319
412
  /*------------------------------------------------------------------------*/
320
- /* Style */
413
+ /* -------------------------------- Style ------------------------------- */
321
414
  /*------------------------------------------------------------------------*/
322
415
  const style$b = `
323
416
  .Modal-backdrop {
@@ -383,25 +476,23 @@ const style$b = `
383
476
  }
384
477
  `;
385
478
  /*------------------------------------------------------------------------*/
386
- /* Component */
479
+ /* ------------------------------ Component ----------------------------- */
387
480
  /*------------------------------------------------------------------------*/
388
481
  const Modal = (props) => {
389
482
  /*------------------------------------------------------------------------*/
390
- /* Setup */
483
+ /* -------------------------------- Setup ------------------------------- */
391
484
  /*------------------------------------------------------------------------*/
392
485
  var _a;
393
486
  /* -------------- Props ------------- */
394
487
  const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
395
488
  /* -------------- State ------------- */
396
- // If true, the modal is shown
397
- const [visible, setVisible] = React.useState(false);
398
489
  // True if animation is in use
399
490
  const [animatingIn, setAnimatingIn] = React.useState(true);
400
491
  const [animatingPop, setAnimatingPop] = React.useState(false);
401
492
  // Keep track of whether modal is still mounted
402
493
  const mounted = React.useRef(false);
403
494
  /*------------------------------------------------------------------------*/
404
- /* Lifecycle Functions */
495
+ /* ------------------------- Lifecycle Functions ------------------------ */
405
496
  /*------------------------------------------------------------------------*/
406
497
  /**
407
498
  * Mount
@@ -410,14 +501,12 @@ const Modal = (props) => {
410
501
  React.useEffect(() => {
411
502
  (() => __awaiter(void 0, void 0, void 0, function* () {
412
503
  // Set defaults
413
- setVisible(false);
414
504
  setAnimatingIn(true);
415
505
  setAnimatingPop(false);
416
506
  // Wait for animation
417
507
  yield waitMs(MS_TO_ANIMATE);
418
508
  // Update to state after animated in
419
509
  if (mounted.current) {
420
- setVisible(true);
421
510
  setAnimatingIn(false);
422
511
  }
423
512
  }))();
@@ -426,47 +515,46 @@ const Modal = (props) => {
426
515
  };
427
516
  }, []);
428
517
  /*------------------------------------------------------------------------*/
429
- /* Component Functions */
518
+ /* ------------------------- Component Functions ------------------------ */
430
519
  /*------------------------------------------------------------------------*/
431
520
  /**
432
521
  * Handles the closing of the modal
433
522
  * @author Gabe Abrams
434
- * @param ModalButtonType the button that was clicked when closing the
523
+ * @param modalButtonType the button that was clicked when closing the
435
524
  * modal
436
525
  */
437
- const handleClose = (ModalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
526
+ const handleClose = (modalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
438
527
  // Don't close if no handler
439
528
  if (!onClose) {
440
529
  return;
441
530
  }
442
- onClose(ModalButtonType);
531
+ onClose(modalButtonType);
443
532
  });
444
533
  /*------------------------------------------------------------------------*/
445
- /* Render */
534
+ /* ------------------------------- Render ------------------------------- */
446
535
  /*------------------------------------------------------------------------*/
447
- /*----------------------------------------*/
448
- /* Footer */
449
- /*----------------------------------------*/
450
536
  // Get list of buttons for this modal type
451
537
  const ModalButtonTypes = (_a = modalTypeToModalButtonTypes[type]) !== null && _a !== void 0 ? _a : [];
538
+ // Get map of button type to label and variant
539
+ const ModalButtonTypeToLabelAndVariant = getModalButtonTypeToLabelAndVariant();
452
540
  // Create buttons
453
- const buttons = ModalButtonTypes.map((ModalButtonType, i) => {
541
+ const buttons = ModalButtonTypes.map((modalButtonType, i) => {
454
542
  // Get default style
455
- let { label, variant, } = ModalButtonTypeToLabelAndVariant[ModalButtonType];
543
+ let { label, variant, } = ModalButtonTypeToLabelAndVariant[modalButtonType];
456
544
  // Override with customizations
457
- const newLabel = props[`${ModalButtonType}Label`];
545
+ const newLabel = props[`${modalButtonType}Label`];
458
546
  if (newLabel) {
459
547
  label = newLabel;
460
548
  }
461
- const newVariant = props[`${ModalButtonType}Variant`];
549
+ const newVariant = props[`${modalButtonType}Variant`];
462
550
  if (newVariant) {
463
551
  variant = newVariant;
464
552
  }
465
553
  // Check if this button is last
466
554
  const last = (i === ModalButtonTypes.length - 1);
467
555
  // Create the button
468
- return (React__default["default"].createElement("button", { key: ModalButtonType, type: "button", className: `Modal-${ModalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
469
- handleClose(ModalButtonType);
556
+ return (React__default["default"].createElement("button", { key: modalButtonType, type: "button", className: `Modal-${modalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
557
+ handleClose(modalButtonType);
470
558
  } }, label));
471
559
  });
472
560
  // Put all buttons in a footer
@@ -484,7 +572,7 @@ const Modal = (props) => {
484
572
  animationClass = 'Modal-animating-pop';
485
573
  }
486
574
  // Render the modal
487
- return (React__default["default"].createElement("div", { className: `modal show modal-dialog-scrollable modal-dialog-centered`, tabIndex: -1, style: {
575
+ return (React__default["default"].createElement("div", { className: "modal show modal-dialog-scrollable modal-dialog-centered", tabIndex: -1, style: {
488
576
  zIndex: (onTopOfOtherModals
489
577
  ? 5000000001
490
578
  : 5000000000),
@@ -514,8 +602,22 @@ const Modal = (props) => {
514
602
  React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
515
603
  zIndex: 5000000002,
516
604
  } },
517
- React__default["default"].createElement("div", { className: "modal-content" },
518
- React__default["default"].createElement("div", { className: "modal-header" },
605
+ React__default["default"].createElement("div", { className: "modal-content", style: {
606
+ borderColor: (isDarkModeOn()
607
+ ? 'gray'
608
+ : undefined),
609
+ } },
610
+ React__default["default"].createElement("div", { className: "modal-header", style: {
611
+ color: (isDarkModeOn()
612
+ ? 'white'
613
+ : undefined),
614
+ backgroundColor: (isDarkModeOn()
615
+ ? '#444'
616
+ : undefined),
617
+ borderBottom: (isDarkModeOn()
618
+ ? '0.1rem solid gray'
619
+ : undefined),
620
+ } },
519
621
  React__default["default"].createElement("h5", { className: "modal-title", style: {
520
622
  fontWeight: 'bold',
521
623
  } }, title),
@@ -523,22 +625,27 @@ const Modal = (props) => {
523
625
  // Handle close
524
626
  handleClose(ModalButtonType$1.Cancel);
525
627
  } }))),
526
- children && (React__default["default"].createElement("div", { className: "modal-body" }, children)),
527
- footer && (React__default["default"].createElement("div", { className: "modal-footer pt-1 pb-1" }, footer))))));
628
+ children && (React__default["default"].createElement("div", { className: "modal-body", style: {
629
+ color: (isDarkModeOn()
630
+ ? 'white'
631
+ : undefined),
632
+ backgroundColor: (isDarkModeOn()
633
+ ? '#444'
634
+ : undefined),
635
+ } }, children)),
636
+ footer && (React__default["default"].createElement("div", { className: "modal-footer pt-1 pb-1", style: {
637
+ color: (isDarkModeOn()
638
+ ? 'white'
639
+ : undefined),
640
+ backgroundColor: (isDarkModeOn()
641
+ ? '#444'
642
+ : undefined),
643
+ borderTop: (isDarkModeOn()
644
+ ? '0.1rem solid gray'
645
+ : undefined),
646
+ } }, footer))))));
528
647
  };
529
648
 
530
- /**
531
- * An error with a code
532
- * @author Gabe Abrams
533
- */
534
- class ErrorWithCode extends Error {
535
- constructor(message, code) {
536
- super(message);
537
- this.name = 'ErrorWithCode';
538
- this.code = code;
539
- }
540
- }
541
-
542
649
  /**
543
650
  * Path that all routes start with
544
651
  * @author Gabe Abrams
@@ -563,65 +670,6 @@ var LogLevel;
563
670
  })(LogLevel || (LogLevel = {}));
564
671
  var LogLevel$1 = LogLevel;
565
672
 
566
- /*----------------------------------------*/
567
- /* ---- Static Variables and Getters ---- */
568
- /*----------------------------------------*/
569
- /* ----------- Initialized ---------- */
570
- let onInitialized;
571
- let initialized = new Promise((resolve) => {
572
- onInitialized = resolve;
573
- });
574
- /* ---------- Send Request ---------- */
575
- let storedSendRequest;
576
- /**
577
- * Get the send request function
578
- * @author Gabe Abrams
579
- * @returns sendRequest function
580
- */
581
- const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
582
- // Show timeout error if too much time passes
583
- let successful = false;
584
- (() => __awaiter(void 0, void 0, void 0, function* () {
585
- yield waitMs(5000);
586
- if (!successful) {
587
- showFatalError(new ErrorWithCode('Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.', ReactKitErrorCode$1.NoCACCLSendRequestFunction));
588
- }
589
- }))(),
590
- // Wait for initialization
591
- yield initialized;
592
- successful = true;
593
- // Return
594
- return storedSendRequest;
595
- });
596
- /* ----- Session Expired Message ---- */
597
- let sessionExpiredMessage;
598
- /**
599
- * Get the custom session expired message
600
- * @author Gabe Abrams
601
- * @returns session expired message
602
- */
603
- const getSessionExpiredMessage = () => {
604
- // Return
605
- return (sessionExpiredMessage !== null && sessionExpiredMessage !== void 0 ? sessionExpiredMessage : 'Your session has expired. Please go back to Canvas and start over.');
606
- };
607
- /*----------------------------------------*/
608
- /* ---------------- Init ---------------- */
609
- /*----------------------------------------*/
610
- /**
611
- * Initialize the client-side version of reactkit
612
- * @author Gabe Abrams
613
- * @param opts object containing all arguments
614
- * @param opts.sendRequest caccl send request functions
615
- * @param [opts.sessionExpiredMessage] a custom session expired message
616
- */
617
- const initClient = (opts) => {
618
- // Store values
619
- storedSendRequest = opts.sendRequest;
620
- sessionExpiredMessage = opts.sessionExpiredMessage;
621
- // Mark as initialized
622
- onInitialized(null);
623
- };
624
-
625
673
  // Keep track of whether or not session expiry has already been handled
626
674
  let sessionAlreadyExpired = false;
627
675
  /*------------------------------------------------------------------------*/
@@ -780,6 +828,28 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
780
828
  /*------------------------------------------------------------------------*/
781
829
  /* --------------------------- Static Helpers --------------------------- */
782
830
  /*------------------------------------------------------------------------*/
831
+ // Timestamp after initialization when helpers should be available
832
+ const timestampWhenHelpersShouldBeAvailable = Date.now() + 2000;
833
+ /**
834
+ * Wait for a little while for a helper to exist
835
+ * @author Gabe Abrams
836
+ * @param checkForHelper a function that returns true if the helper exists
837
+ * @returns true if the helper exists, false if the process timed out
838
+ */
839
+ const waitForHelper = (checkForHelper) => __awaiter(void 0, void 0, void 0, function* () {
840
+ // Wait for helper to exist
841
+ while (!checkForHelper()) {
842
+ // Check if we should stop waiting
843
+ if (Date.now() > timestampWhenHelpersShouldBeAvailable) {
844
+ // Stop waiting
845
+ return false;
846
+ }
847
+ // Wait a little while
848
+ yield waitMs(10);
849
+ }
850
+ // Helper exists
851
+ return true;
852
+ });
783
853
  /*----------------------------------------*/
784
854
  /* ----------- Redirect/Leave ----------- */
785
855
  /*----------------------------------------*/
@@ -826,6 +896,10 @@ let onAlertClosed;
826
896
  * @param text the text to display in the alert
827
897
  */
828
898
  const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
899
+ // Wait for helper to exist
900
+ yield waitForHelper(() => {
901
+ return !!setAlertInfo;
902
+ });
829
903
  // Fallback if alert not available
830
904
  if (!setAlertInfo) {
831
905
  // eslint-disable-next-line no-alert
@@ -867,6 +941,10 @@ let onConfirmClosed;
867
941
  * @returns true if the user confirmed
868
942
  */
869
943
  const confirm = (title, text, opts) => __awaiter(void 0, void 0, void 0, function* () {
944
+ // Wait for helper to exist
945
+ yield waitForHelper(() => {
946
+ return !!setConfirmInfo;
947
+ });
870
948
  // Fallback if confirm is not available
871
949
  if (!setConfirmInfo) {
872
950
  // eslint-disable-next-line no-alert
@@ -901,7 +979,7 @@ const fatalErrorHandlers = [];
901
979
  * @param error the error to show
902
980
  * @param [errorTitle] title of the error box
903
981
  */
904
- const showFatalError = (error, errorTitle = 'An Error Occurred') => {
982
+ const showFatalError = (error, errorTitle = 'An Error Occurred') => __awaiter(void 0, void 0, void 0, function* () {
905
983
  var _a, _b;
906
984
  // Determine message and code
907
985
  const message = (typeof error === 'string'
@@ -931,17 +1009,21 @@ const showFatalError = (error, errorTitle = 'An Error Occurred') => {
931
1009
  errorTitle,
932
1010
  },
933
1011
  });
1012
+ // Wait for helper to exist
1013
+ yield waitForHelper(() => {
1014
+ return (!!setFatalErrorMessage
1015
+ && !!setFatalErrorCode);
1016
+ });
934
1017
  // Handle case where app hasn't loaded
935
1018
  if (!setFatalErrorMessage || !setFatalErrorCode) {
936
1019
  alert$1(errorTitle, `${message} (code: ${code}). Please contact support.`);
937
- return undefined;
1020
+ return;
938
1021
  }
939
1022
  // Use setters
940
1023
  setFatalErrorMessage(message);
941
1024
  setFatalErrorCode(code);
942
1025
  setFatalErrorTitle(errorTitle);
943
- return undefined;
944
- };
1026
+ });
945
1027
  /**
946
1028
  * Add a handler for when a fatal error occurs
947
1029
  * @author Gabe Abrams
@@ -981,7 +1063,7 @@ const AppWrapper = (props) => {
981
1063
  /* -------------------------------- Setup ------------------------------- */
982
1064
  /*------------------------------------------------------------------------*/
983
1065
  /* -------------- Props ------------- */
984
- const { children, dark, } = props;
1066
+ const { children, } = props;
985
1067
  /* -------------- State ------------- */
986
1068
  // Leave to URL
987
1069
  const [urlToLeaveTo, setURLToLeaveToInner,] = React.useState();
@@ -1064,7 +1146,7 @@ const AppWrapper = (props) => {
1064
1146
  width: '100vw',
1065
1147
  minHeight: '100vh',
1066
1148
  paddingTop: '2rem',
1067
- backgroundColor: (dark
1149
+ backgroundColor: (isDarkModeOn()
1068
1150
  ? '#222'
1069
1151
  : '#fff'),
1070
1152
  } },
@@ -1077,7 +1159,7 @@ const AppWrapper = (props) => {
1077
1159
  body = children;
1078
1160
  }
1079
1161
  /*----------------------------------------*/
1080
- /* Main UI */
1162
+ /* --------------- Main UI -------------- */
1081
1163
  /*----------------------------------------*/
1082
1164
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
1083
1165
  React__default["default"].createElement("style", null, style$a),
@@ -1090,7 +1172,7 @@ const AppWrapper = (props) => {
1090
1172
  * @author Gabe Abrams
1091
1173
  */
1092
1174
  /*------------------------------------------------------------------------*/
1093
- /* Style */
1175
+ /* -------------------------------- Style ------------------------------- */
1094
1176
  /*------------------------------------------------------------------------*/
1095
1177
  const style$9 = `
1096
1178
  /* Container fades in */
@@ -1162,11 +1244,11 @@ const style$9 = `
1162
1244
  }
1163
1245
  `;
1164
1246
  /*------------------------------------------------------------------------*/
1165
- /* Component */
1247
+ /* ------------------------------ Component ----------------------------- */
1166
1248
  /*------------------------------------------------------------------------*/
1167
1249
  const LoadingSpinner = () => {
1168
1250
  /*------------------------------------------------------------------------*/
1169
- /* Render */
1251
+ /* ------------------------------- Render ------------------------------- */
1170
1252
  /*------------------------------------------------------------------------*/
1171
1253
  // Add all four blips to a container
1172
1254
  return (React__default["default"].createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
@@ -1182,7 +1264,7 @@ const LoadingSpinner = () => {
1182
1264
  * @author Gabe Abrams
1183
1265
  */
1184
1266
  /*------------------------------------------------------------------------*/
1185
- /* Style */
1267
+ /* -------------------------------- Style ------------------------------- */
1186
1268
  /*------------------------------------------------------------------------*/
1187
1269
  const style$8 = `
1188
1270
  /* Tab Box */
@@ -1248,19 +1330,19 @@ const style$8 = `
1248
1330
  }
1249
1331
  `;
1250
1332
  /*------------------------------------------------------------------------*/
1251
- /* Component */
1333
+ /* ------------------------------ Component ----------------------------- */
1252
1334
  /*------------------------------------------------------------------------*/
1253
1335
  const TabBox = (props) => {
1254
1336
  /*------------------------------------------------------------------------*/
1255
- /* Setup */
1337
+ /* -------------------------------- Setup ------------------------------- */
1256
1338
  /*------------------------------------------------------------------------*/
1257
1339
  /* -------------- Props ------------- */
1258
1340
  const { title, children, noBottomPadding, noBottomMargin, } = props;
1259
1341
  /*------------------------------------------------------------------------*/
1260
- /* Render */
1342
+ /* ------------------------------- Render ------------------------------- */
1261
1343
  /*------------------------------------------------------------------------*/
1262
1344
  /*----------------------------------------*/
1263
- /* Main UI */
1345
+ /* --------------- Main UI -------------- */
1264
1346
  /*----------------------------------------*/
1265
1347
  // Full UI
1266
1348
  return (React__default["default"].createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
@@ -1276,19 +1358,23 @@ const TabBox = (props) => {
1276
1358
  * @author Gabe Abrams
1277
1359
  */
1278
1360
  /*------------------------------------------------------------------------*/
1279
- /* Component */
1361
+ /* ------------------------------ Component ----------------------------- */
1280
1362
  /*------------------------------------------------------------------------*/
1281
1363
  const RadioButton = (props) => {
1282
1364
  /*------------------------------------------------------------------------*/
1283
- /* Setup */
1365
+ /* -------------------------------- Setup ------------------------------- */
1284
1366
  /*------------------------------------------------------------------------*/
1285
1367
  /* -------------- Props ------------- */
1286
- const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$1.Secondary, unselectedVariant = Variant$1.Light, small, } = props;
1368
+ const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = (isDarkModeOn()
1369
+ ? Variant$1.Light
1370
+ : Variant$1.Secondary), unselectedVariant = (isDarkModeOn()
1371
+ ? Variant$1.Secondary
1372
+ : Variant$1.Light), small, } = props;
1287
1373
  /*------------------------------------------------------------------------*/
1288
- /* Render */
1374
+ /* ------------------------------- Render ------------------------------- */
1289
1375
  /*------------------------------------------------------------------------*/
1290
1376
  /*----------------------------------------*/
1291
- /* Main UI */
1377
+ /* --------------- Main UI -------------- */
1292
1378
  /*----------------------------------------*/
1293
1379
  return (React__default["default"].createElement("button", { type: "button", id: id, title: title, className: `btn btn-${selected ? selectedVariant : unselectedVariant}${selected ? ' selected' : ''}${small ? ' btn-sm' : ''} m-0${noMarginOnRight ? '' : ' me-1'}`, "aria-label": `${ariaLabel}${selected ? ': currently selected' : ''}`, onClick: () => {
1294
1380
  if (!selected) {
@@ -1304,19 +1390,23 @@ const RadioButton = (props) => {
1304
1390
  * @author Gabe Abrams
1305
1391
  */
1306
1392
  /*------------------------------------------------------------------------*/
1307
- /* Component */
1393
+ /* ------------------------------ Component ----------------------------- */
1308
1394
  /*------------------------------------------------------------------------*/
1309
1395
  const CheckboxButton = (props) => {
1310
1396
  /*------------------------------------------------------------------------*/
1311
- /* Setup */
1397
+ /* -------------------------------- Setup ------------------------------- */
1312
1398
  /*------------------------------------------------------------------------*/
1313
1399
  /* -------------- Props ------------- */
1314
- const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$1.Secondary, uncheckedVariant = Variant$1.Light, small, dashed, } = props;
1400
+ const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = (isDarkModeOn()
1401
+ ? Variant$1.Light
1402
+ : Variant$1.Secondary), uncheckedVariant = (isDarkModeOn()
1403
+ ? Variant$1.Secondary
1404
+ : Variant$1.Light), small, dashed, } = props;
1315
1405
  /*------------------------------------------------------------------------*/
1316
- /* Render */
1406
+ /* ------------------------------- Render ------------------------------- */
1317
1407
  /*------------------------------------------------------------------------*/
1318
1408
  /*----------------------------------------*/
1319
- /* Main UI */
1409
+ /* --------------- Main UI -------------- */
1320
1410
  /*----------------------------------------*/
1321
1411
  // Determine the icon
1322
1412
  let icon;
@@ -1341,20 +1431,20 @@ const CheckboxButton = (props) => {
1341
1431
  * @author Gabe Abrams
1342
1432
  */
1343
1433
  /*------------------------------------------------------------------------*/
1344
- /* Component */
1434
+ /* ------------------------------ Component ----------------------------- */
1345
1435
  /*------------------------------------------------------------------------*/
1346
1436
  const ButtonInputGroup = (props) => {
1347
1437
  /*------------------------------------------------------------------------*/
1348
- /* Setup */
1438
+ /* -------------------------------- Setup ------------------------------- */
1349
1439
  /*------------------------------------------------------------------------*/
1350
1440
  /* -------------- Props ------------- */
1351
1441
  // Destructure all props
1352
1442
  const { label, minLabelWidth, children, className, wrapButtonsAndAddGaps, } = props;
1353
1443
  /*------------------------------------------------------------------------*/
1354
- /* Render */
1444
+ /* ------------------------------- Render ------------------------------- */
1355
1445
  /*------------------------------------------------------------------------*/
1356
1446
  /*----------------------------------------*/
1357
- /* Main UI */
1447
+ /* --------------- Main UI -------------- */
1358
1448
  /*----------------------------------------*/
1359
1449
  return (React__default["default"].createElement("div", { className: `input-group ${className !== null && className !== void 0 ? className : ''}` },
1360
1450
  React__default["default"].createElement("div", { className: "input-group-prepend d-flex w-100" },
@@ -1480,21 +1570,19 @@ const getTimeInfoInET = (dateOrTimestamp) => {
1480
1570
  * @author Gabe Abrams
1481
1571
  */
1482
1572
  /*------------------------------------------------------------------------*/
1483
- /* Component */
1573
+ /* ------------------------------ Component ----------------------------- */
1484
1574
  /*------------------------------------------------------------------------*/
1485
1575
  const SimpleDateChooser = (props) => {
1486
1576
  /*------------------------------------------------------------------------*/
1487
- /* Setup */
1577
+ /* -------------------------------- Setup ------------------------------- */
1488
1578
  /*------------------------------------------------------------------------*/
1489
- var _a;
1490
1579
  /* -------------- Props ------------- */
1491
- const { ariaLabel, name, month, day, year, onChange, chooseFromPast, } = props;
1492
- const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
1580
+ const { ariaLabel, name, onChange, chooseFromPast, numMonthsToShow = 6, } = props;
1493
1581
  /*------------------------------------------------------------------------*/
1494
- /* Render */
1582
+ /* ------------------------------- Render ------------------------------- */
1495
1583
  /*------------------------------------------------------------------------*/
1496
1584
  /*----------------------------------------*/
1497
- /* Main UI */
1585
+ /* --------------- Main UI -------------- */
1498
1586
  /*----------------------------------------*/
1499
1587
  // Determine the set of choices allowed
1500
1588
  const today = getTimeInfoInET();
@@ -1549,6 +1637,7 @@ const SimpleDateChooser = (props) => {
1549
1637
  });
1550
1638
  }
1551
1639
  // Create choice options
1640
+ const { month, day, year, } = props;
1552
1641
  const monthOptions = [];
1553
1642
  const dayOptions = [];
1554
1643
  choices.forEach((choice) => {
@@ -1584,7 +1673,7 @@ const SimpleDateChooser = (props) => {
1584
1673
  * @author Gabe Abrams
1585
1674
  */
1586
1675
  /*------------------------------------------------------------------------*/
1587
- /* Style */
1676
+ /* -------------------------------- Style ------------------------------- */
1588
1677
  /*------------------------------------------------------------------------*/
1589
1678
  const style$7 = `
1590
1679
  .Drawer-container {
@@ -1602,20 +1691,20 @@ const style$7 = `
1602
1691
  }
1603
1692
  `;
1604
1693
  /*------------------------------------------------------------------------*/
1605
- /* Component */
1694
+ /* ------------------------------ Component ----------------------------- */
1606
1695
  /*------------------------------------------------------------------------*/
1607
1696
  const Drawer = (props) => {
1608
1697
  /*------------------------------------------------------------------------*/
1609
- /* Setup */
1698
+ /* -------------------------------- Setup ------------------------------- */
1610
1699
  /*------------------------------------------------------------------------*/
1611
1700
  /* -------------- Props ------------- */
1612
1701
  // Destructure all props
1613
1702
  const { customBackgroundColor, children, } = props;
1614
1703
  /*------------------------------------------------------------------------*/
1615
- /* Render */
1704
+ /* ------------------------------- Render ------------------------------- */
1616
1705
  /*------------------------------------------------------------------------*/
1617
1706
  /*----------------------------------------*/
1618
- /* Main UI */
1707
+ /* --------------- Main UI -------------- */
1619
1708
  /*----------------------------------------*/
1620
1709
  return (React__default["default"].createElement("div", { className: "Drawer-container", style: {
1621
1710
  backgroundColor: (customBackgroundColor !== null && customBackgroundColor !== void 0 ? customBackgroundColor : undefined),
@@ -1629,7 +1718,7 @@ const Drawer = (props) => {
1629
1718
  * @author Gabe Abrams
1630
1719
  */
1631
1720
  /*------------------------------------------------------------------------*/
1632
- /* Style */
1721
+ /* -------------------------------- Style ------------------------------- */
1633
1722
  /*------------------------------------------------------------------------*/
1634
1723
  const style$6 = `
1635
1724
  .PopSuccessMark-outer-container {
@@ -1717,20 +1806,20 @@ const style$6 = `
1717
1806
  }
1718
1807
  `;
1719
1808
  /*------------------------------------------------------------------------*/
1720
- /* Component */
1809
+ /* ------------------------------ Component ----------------------------- */
1721
1810
  /*------------------------------------------------------------------------*/
1722
1811
  const PopSuccessMark = (props) => {
1723
1812
  /*------------------------------------------------------------------------*/
1724
- /* Setup */
1813
+ /* -------------------------------- Setup ------------------------------- */
1725
1814
  /*------------------------------------------------------------------------*/
1726
1815
  /* -------------- Props ------------- */
1727
1816
  // Destructure all props
1728
1817
  const { sizeRem = 3, circleVariant = 'success', checkVariant = 'white', } = props;
1729
1818
  /*------------------------------------------------------------------------*/
1730
- /* Render */
1819
+ /* ------------------------------- Render ------------------------------- */
1731
1820
  /*------------------------------------------------------------------------*/
1732
1821
  /*----------------------------------------*/
1733
- /* Main UI */
1822
+ /* --------------- Main UI -------------- */
1734
1823
  /*----------------------------------------*/
1735
1824
  return (React__default["default"].createElement("div", { className: `PopSuccessMark-outer-container bg-${circleVariant}`, style: {
1736
1825
  width: `${sizeRem}rem`,
@@ -1750,7 +1839,7 @@ const PopSuccessMark = (props) => {
1750
1839
  * @author Gabe Abrams
1751
1840
  */
1752
1841
  /*------------------------------------------------------------------------*/
1753
- /* Style */
1842
+ /* -------------------------------- Style ------------------------------- */
1754
1843
  /*------------------------------------------------------------------------*/
1755
1844
  const style$5 = `
1756
1845
  .PopFailureMark-outer-container {
@@ -1837,20 +1926,20 @@ const style$5 = `
1837
1926
  }
1838
1927
  `;
1839
1928
  /*------------------------------------------------------------------------*/
1840
- /* Component */
1929
+ /* ------------------------------ Component ----------------------------- */
1841
1930
  /*------------------------------------------------------------------------*/
1842
1931
  const PopFailureMark = (props) => {
1843
1932
  /*------------------------------------------------------------------------*/
1844
- /* Setup */
1933
+ /* -------------------------------- Setup ------------------------------- */
1845
1934
  /*------------------------------------------------------------------------*/
1846
1935
  /* -------------- Props ------------- */
1847
1936
  // Destructure all props
1848
1937
  const { sizeRem = 3, circleVariant = 'danger', xVariant = 'white', } = props;
1849
1938
  /*------------------------------------------------------------------------*/
1850
- /* Render */
1939
+ /* ------------------------------- Render ------------------------------- */
1851
1940
  /*------------------------------------------------------------------------*/
1852
1941
  /*----------------------------------------*/
1853
- /* Main UI */
1942
+ /* --------------- Main UI -------------- */
1854
1943
  /*----------------------------------------*/
1855
1944
  return (React__default["default"].createElement("div", { className: `PopFailureMark-outer-container bg-${circleVariant}`, style: {
1856
1945
  width: `${sizeRem}rem`,
@@ -1870,7 +1959,7 @@ const PopFailureMark = (props) => {
1870
1959
  * @author Gabe Abrams
1871
1960
  */
1872
1961
  /*------------------------------------------------------------------------*/
1873
- /* Style */
1962
+ /* -------------------------------- Style ------------------------------- */
1874
1963
  /*------------------------------------------------------------------------*/
1875
1964
  const style$4 = `
1876
1965
  .PopPendingMark-outer-container {
@@ -1926,20 +2015,20 @@ const style$4 = `
1926
2015
  }
1927
2016
  `;
1928
2017
  /*------------------------------------------------------------------------*/
1929
- /* Component */
2018
+ /* ------------------------------ Component ----------------------------- */
1930
2019
  /*------------------------------------------------------------------------*/
1931
2020
  const PopPendingMark = (props) => {
1932
2021
  /*------------------------------------------------------------------------*/
1933
- /* Setup */
2022
+ /* -------------------------------- Setup ------------------------------- */
1934
2023
  /*------------------------------------------------------------------------*/
1935
2024
  /* -------------- Props ------------- */
1936
2025
  // Destructure all props
1937
2026
  const { sizeRem = 3, circleVariant = 'warning', hourglassVariant = 'white', } = props;
1938
2027
  /*------------------------------------------------------------------------*/
1939
- /* Render */
2028
+ /* ------------------------------- Render ------------------------------- */
1940
2029
  /*------------------------------------------------------------------------*/
1941
2030
  /*----------------------------------------*/
1942
- /* Main UI */
2031
+ /* --------------- Main UI -------------- */
1943
2032
  /*----------------------------------------*/
1944
2033
  return (React__default["default"].createElement("div", { className: `PopPendingMark-outer-container bg-${circleVariant}`, style: {
1945
2034
  width: `${sizeRem}rem`,
@@ -1989,11 +2078,11 @@ const reducer$8 = (state, action) => {
1989
2078
  }
1990
2079
  };
1991
2080
  /*------------------------------------------------------------------------*/
1992
- /* Component */
2081
+ /* ------------------------------ Component ----------------------------- */
1993
2082
  /*------------------------------------------------------------------------*/
1994
2083
  const CopiableBox = (props) => {
1995
2084
  /*------------------------------------------------------------------------*/
1996
- /* Setup */
2085
+ /* -------------------------------- Setup ------------------------------- */
1997
2086
  /*------------------------------------------------------------------------*/
1998
2087
  /* -------------- Props ------------- */
1999
2088
  // Destructure all props
@@ -2008,7 +2097,7 @@ const CopiableBox = (props) => {
2008
2097
  // Destructure common state
2009
2098
  const { recentlyCopied, } = state;
2010
2099
  /*------------------------------------------------------------------------*/
2011
- /* Component Functions */
2100
+ /* ------------------------- Component Functions ------------------------ */
2012
2101
  /*------------------------------------------------------------------------*/
2013
2102
  /**
2014
2103
  * Perform a copy
@@ -2034,10 +2123,10 @@ const CopiableBox = (props) => {
2034
2123
  });
2035
2124
  });
2036
2125
  /*------------------------------------------------------------------------*/
2037
- /* Render */
2126
+ /* ------------------------------- Render ------------------------------- */
2038
2127
  /*------------------------------------------------------------------------*/
2039
2128
  /*----------------------------------------*/
2040
- /* Main UI */
2129
+ /* --------------- Main UI -------------- */
2041
2130
  /*----------------------------------------*/
2042
2131
  return (React__default["default"].createElement("div", { className: "input-group mb-2" },
2043
2132
  (label || labelIcon) && (React__default["default"].createElement("span", { className: "input-group-text", style: {
@@ -2108,11 +2197,11 @@ const reducer$7 = (state, action) => {
2108
2197
  }
2109
2198
  };
2110
2199
  /*------------------------------------------------------------------------*/
2111
- /* Component */
2200
+ /* ------------------------------ Component ----------------------------- */
2112
2201
  /*------------------------------------------------------------------------*/
2113
2202
  const NestableItemList = (props) => {
2114
2203
  /*------------------------------------------------------------------------*/
2115
- /* Setup */
2204
+ /* -------------------------------- Setup ------------------------------- */
2116
2205
  /*------------------------------------------------------------------------*/
2117
2206
  /* -------------- Props ------------- */
2118
2207
  // Destructure all props
@@ -2132,7 +2221,7 @@ const NestableItemList = (props) => {
2132
2221
  // Destructure common state
2133
2222
  const { childExpanded, } = state;
2134
2223
  /*------------------------------------------------------------------------*/
2135
- /* Component Functions */
2224
+ /* ------------------------- Component Functions ------------------------ */
2136
2225
  /*------------------------------------------------------------------------*/
2137
2226
  /**
2138
2227
  * Checks if all items in a list are checked
@@ -2207,7 +2296,7 @@ const NestableItemList = (props) => {
2207
2296
  });
2208
2297
  };
2209
2298
  /*------------------------------------------------------------------------*/
2210
- /* Render */
2299
+ /* ------------------------------- Render ------------------------------- */
2211
2300
  /*------------------------------------------------------------------------*/
2212
2301
  return (React__default["default"].createElement("div", null, items.map((item) => {
2213
2302
  return (React__default["default"].createElement("div", { key: item.id },
@@ -2240,23 +2329,23 @@ const NestableItemList = (props) => {
2240
2329
  * @author Yuen Ler Chow
2241
2330
  */
2242
2331
  /*------------------------------------------------------------------------*/
2243
- /* Component */
2332
+ /* ------------------------------ Component ----------------------------- */
2244
2333
  /*------------------------------------------------------------------------*/
2245
2334
  const ItemPicker = (props) => {
2246
2335
  /*------------------------------------------------------------------------*/
2247
- /* Setup */
2336
+ /* -------------------------------- Setup ------------------------------- */
2248
2337
  /*------------------------------------------------------------------------*/
2249
2338
  /* -------------- Props ------------- */
2250
2339
  // Destructure all props
2251
2340
  const { title, items, onChanged, noBottomMargin, } = props;
2252
2341
  /*------------------------------------------------------------------------*/
2253
- /* Component Functions */
2342
+ /* ------------------------- Component Functions ------------------------ */
2254
2343
  /*------------------------------------------------------------------------*/
2255
2344
  /*------------------------------------------------------------------------*/
2256
- /* Render */
2345
+ /* ------------------------------- Render ------------------------------- */
2257
2346
  /*------------------------------------------------------------------------*/
2258
2347
  /*----------------------------------------*/
2259
- /* Main UI */
2348
+ /* --------------- Main UI -------------- */
2260
2349
  /*----------------------------------------*/
2261
2350
  return (React__default["default"].createElement(TabBox, { title: title, noBottomMargin: noBottomMargin },
2262
2351
  React__default["default"].createElement("div", { style: { overflowX: 'auto' } },
@@ -2454,20 +2543,20 @@ const genCSV = (data, columns) => {
2454
2543
  * @author Gabe Abrams
2455
2544
  */
2456
2545
  /*------------------------------------------------------------------------*/
2457
- /* Component */
2546
+ /* ------------------------------ Component ----------------------------- */
2458
2547
  /*------------------------------------------------------------------------*/
2459
2548
  const CSVDownloadButton = (props) => {
2460
2549
  /*------------------------------------------------------------------------*/
2461
- /* Setup */
2550
+ /* -------------------------------- Setup ------------------------------- */
2462
2551
  /*------------------------------------------------------------------------*/
2463
2552
  /* -------------- Props ------------- */
2464
2553
  // Destructure all props
2465
2554
  const { filename, csv, id, className, ariaLabel, style, onClick, children, } = props;
2466
2555
  /*------------------------------------------------------------------------*/
2467
- /* Render */
2556
+ /* ------------------------------- Render ------------------------------- */
2468
2557
  /*------------------------------------------------------------------------*/
2469
2558
  /*----------------------------------------*/
2470
- /* Main UI */
2559
+ /* --------------- Main UI -------------- */
2471
2560
  /*----------------------------------------*/
2472
2561
  // Render the button
2473
2562
  return (React__default["default"].createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${encodeURIComponent(csv)}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
@@ -2555,26 +2644,26 @@ const reducer$6 = (state, action) => {
2555
2644
  }
2556
2645
  };
2557
2646
  /*------------------------------------------------------------------------*/
2558
- /* Component */
2647
+ /* ------------------------------ Component ----------------------------- */
2559
2648
  /*------------------------------------------------------------------------*/
2560
2649
  const IntelliTable = (props) => {
2561
2650
  /*------------------------------------------------------------------------*/
2562
- /* Setup */
2651
+ /* -------------------------------- Setup ------------------------------- */
2563
2652
  /*------------------------------------------------------------------------*/
2564
2653
  var _a;
2565
2654
  /* -------------- Props ------------- */
2566
2655
  // Destructure all props
2567
- const { title, id, columns, } = props;
2656
+ const { title, id, columns, csvName, data = [], } = props;
2568
2657
  // Get data, show empty row if none
2569
- const data = ((props.data && props.data.length > 0)
2570
- ? props.data
2571
- : [{ id: 'empty-row' }]);
2658
+ if (data.length === 0) {
2659
+ data.push({ id: 'empty-row' });
2660
+ }
2572
2661
  // Get CSV filename
2573
2662
  let filename = `${title}.csv`;
2574
- if (props.csvName) {
2575
- filename = (props.csvName.endsWith('.csv')
2576
- ? props.csvName
2577
- : `${props.csvName}.csv`);
2663
+ if (csvName) {
2664
+ filename = (csvName.endsWith('.csv')
2665
+ ? csvName
2666
+ : `${csvName}.csv`);
2578
2667
  }
2579
2668
  /* -------------- State ------------- */
2580
2669
  // Initial state
@@ -2593,10 +2682,10 @@ const IntelliTable = (props) => {
2593
2682
  // Destructure common state
2594
2683
  const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
2595
2684
  /*------------------------------------------------------------------------*/
2596
- /* Render */
2685
+ /* ------------------------------- Render ------------------------------- */
2597
2686
  /*------------------------------------------------------------------------*/
2598
2687
  /*----------------------------------------*/
2599
- /* Modal */
2688
+ /* ---------------- Modal --------------- */
2600
2689
  /*----------------------------------------*/
2601
2690
  // Modal that may be defined
2602
2691
  let modal;
@@ -2637,7 +2726,7 @@ const IntelliTable = (props) => {
2637
2726
  } }, "Deselect All")));
2638
2727
  }
2639
2728
  /*----------------------------------------*/
2640
- /* Main UI */
2729
+ /* --------------- Main UI -------------- */
2641
2730
  /*----------------------------------------*/
2642
2731
  // Table header
2643
2732
  const headerCells = (columns
@@ -2692,7 +2781,7 @@ const IntelliTable = (props) => {
2692
2781
  const tableHeader = (React__default["default"].createElement("thead", null,
2693
2782
  React__default["default"].createElement("tr", null, headerCells)));
2694
2783
  // Sort data
2695
- let sortedData = [...data];
2784
+ const sortedData = [...data];
2696
2785
  const paramType = (_a = columns.find((column) => {
2697
2786
  return (column.param === sortColumnParam);
2698
2787
  })) === null || _a === void 0 ? void 0 : _a.type;
@@ -2781,7 +2870,7 @@ const IntelliTable = (props) => {
2781
2870
  });
2782
2871
  let fullValue;
2783
2872
  let visibleValue;
2784
- let title = '';
2873
+ let colTitle = '';
2785
2874
  if (column.type === ParamType$1.Boolean) {
2786
2875
  fullValue = !!(value);
2787
2876
  const noValue = (value === undefined
@@ -2789,9 +2878,9 @@ const IntelliTable = (props) => {
2789
2878
  visibleValue = (noValue
2790
2879
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2791
2880
  : (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: fullValue ? freeSolidSvgIcons.faCheckCircle : freeSolidSvgIcons.faXmarkCircle })));
2792
- title = (fullValue ? 'True' : 'False');
2881
+ colTitle = (fullValue ? 'True' : 'False');
2793
2882
  if (noValue) {
2794
- title = 'Empty Cell';
2883
+ colTitle = 'Empty Cell';
2795
2884
  }
2796
2885
  }
2797
2886
  else if (column.type === ParamType$1.Int) {
@@ -2800,9 +2889,9 @@ const IntelliTable = (props) => {
2800
2889
  visibleValue = (noValue
2801
2890
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2802
2891
  : fullValue);
2803
- title = String(fullValue);
2892
+ colTitle = String(fullValue);
2804
2893
  if (noValue) {
2805
- title = 'Empty Cell';
2894
+ colTitle = 'Empty Cell';
2806
2895
  }
2807
2896
  }
2808
2897
  else if (column.type === ParamType$1.Float) {
@@ -2811,9 +2900,9 @@ const IntelliTable = (props) => {
2811
2900
  visibleValue = (noValue
2812
2901
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2813
2902
  : roundToNumDecimals(fullValue, 2));
2814
- title = String(fullValue);
2903
+ colTitle = String(fullValue);
2815
2904
  if (noValue) {
2816
- title = 'Empty Cell';
2905
+ colTitle = 'Empty Cell';
2817
2906
  }
2818
2907
  }
2819
2908
  else if (column.type === ParamType$1.String) {
@@ -2824,9 +2913,9 @@ const IntelliTable = (props) => {
2824
2913
  visibleValue = (noValue
2825
2914
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2826
2915
  : fullValue);
2827
- title = `"${value}"`;
2916
+ colTitle = `"${value}"`;
2828
2917
  if (noValue) {
2829
- title = 'Empty Cell';
2918
+ colTitle = 'Empty Cell';
2830
2919
  }
2831
2920
  }
2832
2921
  else if (column.type === ParamType$1.JSON) {
@@ -2837,10 +2926,10 @@ const IntelliTable = (props) => {
2837
2926
  visibleValue = (noValue
2838
2927
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2839
2928
  : fullValue);
2840
- title = "JSON Object";
2929
+ colTitle = 'JSON Object';
2841
2930
  }
2842
2931
  // Create UI
2843
- return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title: title, style: {
2932
+ return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title: colTitle, style: {
2844
2933
  borderRight: '0.05rem solid #555',
2845
2934
  borderLeft: '0.05rem solid #555',
2846
2935
  } }, visibleValue));
@@ -2902,7 +2991,7 @@ var FilterDrawer;
2902
2991
  FilterDrawer["Advanced"] = "advanced";
2903
2992
  })(FilterDrawer || (FilterDrawer = {}));
2904
2993
  /*------------------------------------------------------------------------*/
2905
- /* Style */
2994
+ /* -------------------------------- Style ------------------------------- */
2906
2995
  /*------------------------------------------------------------------------*/
2907
2996
  const style$3 = `
2908
2997
  .LogReviewer-outer-container {
@@ -2988,7 +3077,7 @@ const style$3 = `
2988
3077
  }
2989
3078
  `;
2990
3079
  /*------------------------------------------------------------------------*/
2991
- /* Constants */
3080
+ /* ------------------------------ Constants ----------------------------- */
2992
3081
  /*------------------------------------------------------------------------*/
2993
3082
  const columns = [
2994
3083
  {
@@ -3177,7 +3266,7 @@ const columns = [
3177
3266
  },
3178
3267
  ];
3179
3268
  /*------------------------------------------------------------------------*/
3180
- /* Static Functions */
3269
+ /* -------------------------- Static Functions -------------------------- */
3181
3270
  /*------------------------------------------------------------------------*/
3182
3271
  /**
3183
3272
  * Turn a machine-readable name into a human-readable name
@@ -3307,11 +3396,11 @@ const reducer$5 = (state, action) => {
3307
3396
  }
3308
3397
  };
3309
3398
  /*------------------------------------------------------------------------*/
3310
- /* Component */
3399
+ /* ------------------------------ Component ----------------------------- */
3311
3400
  /*------------------------------------------------------------------------*/
3312
3401
  const LogReviewer = (props) => {
3313
3402
  /*------------------------------------------------------------------------*/
3314
- /* Setup */
3403
+ /* -------------------------------- Setup ------------------------------- */
3315
3404
  /*------------------------------------------------------------------------*/
3316
3405
  var _a, _b, _c, _d;
3317
3406
  /* -------------- Props ------------- */
@@ -3431,7 +3520,7 @@ const LogReviewer = (props) => {
3431
3520
  // Destructure common state
3432
3521
  const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
3433
3522
  /*------------------------------------------------------------------------*/
3434
- /* Component Functions */
3523
+ /* ------------------------- Component Functions ------------------------ */
3435
3524
  /*------------------------------------------------------------------------*/
3436
3525
  /**
3437
3526
  * Get the list of year/month combos that need to be loaded given a new
@@ -3444,8 +3533,7 @@ const LogReviewer = (props) => {
3444
3533
  // List of year/month combos that need to be loaded
3445
3534
  const toLoad = [];
3446
3535
  // Loop through dates
3447
- let year = newDateFilterState.startDate.year;
3448
- let month = newDateFilterState.startDate.month;
3536
+ let { year, month } = newDateFilterState.startDate;
3449
3537
  while (
3450
3538
  // Earlier year
3451
3539
  (year < newDateFilterState.endDate.year)
@@ -3518,7 +3606,7 @@ const LogReviewer = (props) => {
3518
3606
  });
3519
3607
  });
3520
3608
  /*------------------------------------------------------------------------*/
3521
- /* Lifecycle Functions */
3609
+ /* ------------------------- Lifecycle Functions ------------------------ */
3522
3610
  /*------------------------------------------------------------------------*/
3523
3611
  /**
3524
3612
  * Mount
@@ -3529,10 +3617,10 @@ const LogReviewer = (props) => {
3529
3617
  handleDateRangeUpdated(dateFilterState);
3530
3618
  }, []);
3531
3619
  /*------------------------------------------------------------------------*/
3532
- /* Render */
3620
+ /* ------------------------------- Render ------------------------------- */
3533
3621
  /*------------------------------------------------------------------------*/
3534
3622
  /*----------------------------------------*/
3535
- /* Main UI */
3623
+ /* --------------- Main UI -------------- */
3536
3624
  /*----------------------------------------*/
3537
3625
  // Body that will be filled with the contents of the panel
3538
3626
  let body;
@@ -3544,7 +3632,7 @@ const LogReviewer = (props) => {
3544
3632
  /* ------------ Review UI ----------- */
3545
3633
  if (!loading) {
3546
3634
  /*----------------------------------------*/
3547
- /* Filters */
3635
+ /* --------------- Filters -------------- */
3548
3636
  /*----------------------------------------*/
3549
3637
  // Filter toggle
3550
3638
  const filterToggles = (React__default["default"].createElement("div", { className: "LogReviewer-filter-toggles" },
@@ -3843,7 +3931,7 @@ const LogReviewer = (props) => {
3843
3931
  React__default["default"].createElement("span", { className: "input-group-text" }, "User Canvas Id"),
3844
3932
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user canvas id", value: advancedFilterState.userId, placeholder: "e.g. 104985", onChange: (e) => {
3845
3933
  const { value } = e.target;
3846
- // Only update if value contains only numbers
3934
+ // Only update if value contains only numbers
3847
3935
  if (/^\d+$/.test(value)) {
3848
3936
  advancedFilterState.userId = ((e.target.value)
3849
3937
  .trim());
@@ -3889,7 +3977,7 @@ const LogReviewer = (props) => {
3889
3977
  React__default["default"].createElement("span", { className: "input-group-text" }, "Course Canvas Id"),
3890
3978
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for course canvas id", value: advancedFilterState.courseId, placeholder: "e.g. 15948", onChange: (e) => {
3891
3979
  const { value } = e.target;
3892
- // Only update if value contains only numbers
3980
+ // Only update if value contains only numbers
3893
3981
  if (/^\d+$/.test(value)) {
3894
3982
  advancedFilterState.courseId = ((e.target.value)
3895
3983
  .trim());
@@ -4222,7 +4310,7 @@ const LogReviewer = (props) => {
4222
4310
  });
4223
4311
  });
4224
4312
  /*----------------------------------------*/
4225
- /* Data */
4313
+ /* ---------------- Data ---------------- */
4226
4314
  /*----------------------------------------*/
4227
4315
  // Nothing to show notice
4228
4316
  const noLogsNotice = (logs.length === 0
@@ -41805,7 +41893,7 @@ const genRouteHandler = (opts) => {
41805
41893
  // Output params
41806
41894
  const output = {};
41807
41895
  /*----------------------------------------*/
41808
- /* Parse Params */
41896
+ /* ------------ Parse Params ------------ */
41809
41897
  /*----------------------------------------*/
41810
41898
  // Process items one by one
41811
41899
  const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
@@ -41964,7 +42052,7 @@ const genRouteHandler = (opts) => {
41964
42052
  }
41965
42053
  }
41966
42054
  /*----------------------------------------*/
41967
- /* Launch Info */
42055
+ /* ------------- Launch Info ------------ */
41968
42056
  /*----------------------------------------*/
41969
42057
  // Get launch info
41970
42058
  const { launched, launchInfo } = cacclGetLaunchInfo(req);
@@ -42099,7 +42187,7 @@ const genRouteHandler = (opts) => {
42099
42187
  * Log an event on the server
42100
42188
  * @author Gabe Abrams
42101
42189
  */
42102
- const logServerEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
42190
+ const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
42103
42191
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
42104
42192
  // NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
42105
42193
  // that indicates that this is actually a client event, but we don't
@@ -42130,29 +42218,29 @@ const genRouteHandler = (opts) => {
42130
42218
  hour,
42131
42219
  minute,
42132
42220
  timestamp,
42133
- context: (typeof opts.context === 'string'
42134
- ? opts.context
42135
- : ((_d = ((_c = opts.context) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Context.Uncategorized)),
42136
- subcontext: ((_e = opts.subcontext) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized),
42137
- tags: ((_f = opts.tags) !== null && _f !== void 0 ? _f : []),
42138
- level: ((_g = opts.level) !== null && _g !== void 0 ? _g : LogLevel$1.Info),
42139
- metadata: ((_h = opts.metadata) !== null && _h !== void 0 ? _h : {}),
42221
+ context: (typeof logOpts.context === 'string'
42222
+ ? logOpts.context
42223
+ : ((_d = ((_c = logOpts.context) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Context.Uncategorized)),
42224
+ subcontext: ((_e = logOpts.subcontext) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized),
42225
+ tags: ((_f = logOpts.tags) !== null && _f !== void 0 ? _f : []),
42226
+ level: ((_g = logOpts.level) !== null && _g !== void 0 ? _g : LogLevel$1.Info),
42227
+ metadata: ((_h = logOpts.metadata) !== null && _h !== void 0 ? _h : {}),
42140
42228
  };
42141
42229
  // Type-specific info
42142
42230
  const typeSpecificInfo = (('error' in opts && opts.error)
42143
42231
  ? {
42144
42232
  type: LogType$1.Error,
42145
- errorMessage: (_j = opts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
42146
- errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
42147
- errorStack: (_l = opts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
42233
+ errorMessage: (_j = logOpts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
42234
+ errorCode: (_k = logOpts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
42235
+ errorStack: (_l = logOpts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
42148
42236
  }
42149
42237
  : {
42150
42238
  type: LogType$1.Action,
42151
- target: ((_m = opts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
42152
- action: ((_o = opts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
42239
+ target: ((_m = logOpts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoTarget),
42240
+ action: ((_o = logOpts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
42153
42241
  });
42154
42242
  // Source-specific info
42155
- const sourceSpecificInfo = (opts.overrideAsClientEvent
42243
+ const sourceSpecificInfo = (logOpts.overrideAsClientEvent
42156
42244
  ? {
42157
42245
  source: LogSource$1.Client,
42158
42246
  }
@@ -42169,20 +42257,21 @@ const genRouteHandler = (opts) => {
42169
42257
  // Store to the log collection
42170
42258
  yield logCollection.insert(log);
42171
42259
  }
42172
- else {
42260
+ else if (log.type === LogType$1.Error) {
42173
42261
  // Print to console
42174
- if (log.type === LogType$1.Error) {
42175
- console.error('dce-reactkit error log:', log);
42176
- }
42177
- else {
42178
- console.log('dce-reactkit action log:', log);
42179
- }
42262
+ // eslint-disable-next-line no-console
42263
+ console.error('dce-reactkit error log:', log);
42264
+ }
42265
+ else {
42266
+ // eslint-disable-next-line no-console
42267
+ console.log('dce-reactkit action log:', log);
42180
42268
  }
42181
42269
  // Return log entry
42182
42270
  return log;
42183
42271
  }
42184
42272
  catch (err) {
42185
42273
  // Print because we cannot store the error
42274
+ // eslint-disable-next-line no-console
42186
42275
  console.error('Could not log the following:', opts);
42187
42276
  // Create a dummy log to return
42188
42277
  const dummyMainInfo = {
@@ -42258,32 +42347,32 @@ const genRouteHandler = (opts) => {
42258
42347
  /**
42259
42348
  * Render an error page
42260
42349
  * @author Gabe Abrams
42261
- * @param opts object containing all arguments
42262
- * @param [opts.title=An Error Occurred] title of the error box
42263
- * @param [opts.description=An unknown server error occurred. Please contact support.]
42350
+ * @param renderOpts object containing all arguments
42351
+ * @param [renderOpts.title=An Error Occurred] title of the error box
42352
+ * @param [renderOpts.description=An unknown server error occurred. Please contact support.]
42264
42353
  * a human-readable description of the error
42265
- * @param [opts.code=ReactKitErrorCode.NoCode] error code to show
42266
- * @param [opts.pageTitle=opts.title] title of the page/tab if it differs from
42354
+ * @param [renderOpts.code=ReactKitErrorCode.NoCode] error code to show
42355
+ * @param [renderOpts.pageTitle=renderOpts.title] title of the page/tab if it differs from
42267
42356
  * the title of the error
42268
- * @param [opts.status=500] http status code
42357
+ * @param [renderOpts.status=500] http status code
42269
42358
  */
42270
- const renderErrorPage = (opts = {}) => {
42359
+ const renderErrorPage = (renderOpts = {}) => {
42271
42360
  var _a, _b;
42272
- const html = genErrorPage(opts);
42273
- send(html, (_a = opts.status) !== null && _a !== void 0 ? _a : 500);
42361
+ const html = genErrorPage(renderOpts);
42362
+ send(html, (_a = renderOpts.status) !== null && _a !== void 0 ? _a : 500);
42274
42363
  // Log
42275
42364
  logServerEvent({
42276
42365
  context: LogBuiltInMetadata.Context.ServerRenderedErrorPage,
42277
42366
  error: {
42278
- message: `${opts.title}: ${opts.description}`,
42279
- code: opts.code,
42367
+ message: `${renderOpts.title}: ${renderOpts.description}`,
42368
+ code: renderOpts.code,
42280
42369
  },
42281
42370
  metadata: {
42282
- title: opts.title,
42283
- description: opts.description,
42284
- code: opts.code,
42285
- pageTitle: opts.pageTitle,
42286
- status: (_b = opts.status) !== null && _b !== void 0 ? _b : 500,
42371
+ title: renderOpts.title,
42372
+ description: renderOpts.description,
42373
+ code: renderOpts.code,
42374
+ pageTitle: renderOpts.pageTitle,
42375
+ status: (_b = renderOpts.status) !== null && _b !== void 0 ? _b : 500,
42287
42376
  },
42288
42377
  });
42289
42378
  };
@@ -42318,6 +42407,7 @@ const genRouteHandler = (opts) => {
42318
42407
  return;
42319
42408
  }
42320
42409
  // Log error that was not responded with
42410
+ // eslint-disable-next-line no-console
42321
42411
  console.log('Error occurred but could not be sent to client because a response was already sent:', err);
42322
42412
  }
42323
42413
  });