dce-reactkit 3.4.0-beta.3 → 3.4.0-beta.5

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
@@ -45,7 +45,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
45
  PERFORMANCE OF THIS SOFTWARE.
46
46
  ***************************************************************************** */
47
47
 
48
- function __awaiter$1(thisArg, _arguments, P, generator) {
48
+ function __awaiter(thisArg, _arguments, P, generator) {
49
49
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
50
50
  return new (P || (P = Promise))(function (resolve, reject) {
51
51
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -60,7 +60,7 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
60
60
  * List of error codes built into the react kit
61
61
  * @author Gabe Abrams
62
62
  */
63
- var ReactKitErrorCode$2;
63
+ var ReactKitErrorCode;
64
64
  (function (ReactKitErrorCode) {
65
65
  ReactKitErrorCode["NoResponse"] = "DRK1";
66
66
  ReactKitErrorCode["NoCode"] = "DRK2";
@@ -75,8 +75,8 @@ var ReactKitErrorCode$2;
75
75
  ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
76
76
  ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
77
77
  ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
78
- })(ReactKitErrorCode$2 || (ReactKitErrorCode$2 = {}));
79
- var ReactKitErrorCode$3 = ReactKitErrorCode$2;
78
+ })(ReactKitErrorCode || (ReactKitErrorCode = {}));
79
+ var ReactKitErrorCode$1 = ReactKitErrorCode;
80
80
 
81
81
  /**
82
82
  * Displays an error
@@ -116,7 +116,7 @@ const ErrorBox = (props) => {
116
116
  } },
117
117
  "code:",
118
118
  ' ',
119
- String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$3.NoCode).toUpperCase())));
119
+ String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$1.NoCode).toUpperCase())));
120
120
  }
121
121
  // Main UI
122
122
  return (React__default["default"].createElement("div", { className: "alert alert-danger text-center", style: {
@@ -137,7 +137,7 @@ const ErrorBox = (props) => {
137
137
  * Types of buttons in the modal
138
138
  * @author Gabe Abrams
139
139
  */
140
- var ModalButtonType$2;
140
+ var ModalButtonType;
141
141
  (function (ModalButtonType) {
142
142
  ModalButtonType["Okay"] = "okay";
143
143
  ModalButtonType["Cancel"] = "cancel";
@@ -149,14 +149,14 @@ var ModalButtonType$2;
149
149
  ModalButtonType["ImSure"] = "imSure";
150
150
  ModalButtonType["Delete"] = "delete";
151
151
  ModalButtonType["Confirm"] = "confirm";
152
- })(ModalButtonType$2 || (ModalButtonType$2 = {}));
153
- var ModalButtonType$3 = ModalButtonType$2;
152
+ })(ModalButtonType || (ModalButtonType = {}));
153
+ var ModalButtonType$1 = ModalButtonType;
154
154
 
155
155
  /**
156
156
  * Types of modals
157
157
  * @author Gabe Abrams
158
158
  */
159
- var ModalType$2;
159
+ var ModalType;
160
160
  (function (ModalType) {
161
161
  ModalType["Okay"] = "okay";
162
162
  ModalType["OkayCancel"] = "okay-cancel";
@@ -167,8 +167,8 @@ var ModalType$2;
167
167
  ModalType["DeleteCancel"] = "delete-cancel";
168
168
  ModalType["ConfirmCancel"] = "confirm-cancel";
169
169
  ModalType["NoButtons"] = "-";
170
- })(ModalType$2 || (ModalType$2 = {}));
171
- var ModalType$3 = ModalType$2;
170
+ })(ModalType || (ModalType = {}));
171
+ var ModalType$1 = ModalType;
172
172
 
173
173
  /**
174
174
  * Built-in metadata for logs
@@ -193,7 +193,7 @@ const LogBuiltInMetadata = {
193
193
  * @author Gabe Abrams
194
194
  * @param ms number of ms to wait
195
195
  */
196
- const waitMs = (ms = 0) => __awaiter$1(void 0, void 0, void 0, function* () {
196
+ const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
197
197
  return new Promise((resolve) => {
198
198
  setTimeout(resolve, ms);
199
199
  });
@@ -203,7 +203,7 @@ const waitMs = (ms = 0) => __awaiter$1(void 0, void 0, void 0, function* () {
203
203
  * Bootstrap variants
204
204
  * @author Gabe Abrams
205
205
  */
206
- var Variant$2;
206
+ var Variant;
207
207
  (function (Variant) {
208
208
  Variant["Primary"] = "primary";
209
209
  Variant["Secondary"] = "secondary";
@@ -213,21 +213,21 @@ var Variant$2;
213
213
  Variant["Danger"] = "danger";
214
214
  Variant["Light"] = "light";
215
215
  Variant["Dark"] = "dark";
216
- })(Variant$2 || (Variant$2 = {}));
217
- var Variant$3 = Variant$2;
216
+ })(Variant || (Variant = {}));
217
+ var Variant$1 = Variant;
218
218
 
219
219
  /**
220
220
  * Modal sizes
221
221
  * @author Gabe Abrams
222
222
  */
223
- var ModalSize$1;
223
+ var ModalSize;
224
224
  (function (ModalSize) {
225
225
  ModalSize["Small"] = "sm";
226
226
  ModalSize["Medium"] = "md";
227
227
  ModalSize["Large"] = "lg";
228
228
  ModalSize["ExtraLarge"] = "xl";
229
- })(ModalSize$1 || (ModalSize$1 = {}));
230
- var ModalSize$2 = ModalSize$1;
229
+ })(ModalSize || (ModalSize = {}));
230
+ var ModalSize$1 = ModalSize;
231
231
 
232
232
  /**
233
233
  * A generic popup modal
@@ -240,80 +240,80 @@ var ModalSize$2 = ModalSize$1;
240
240
  const MS_TO_ANIMATE = 200; // Animation duration
241
241
  // Modal type to list of buttons
242
242
  const modalTypeToModalButtonTypes = {
243
- [ModalType$3.Okay]: [
244
- ModalButtonType$3.Okay,
243
+ [ModalType$1.Okay]: [
244
+ ModalButtonType$1.Okay,
245
245
  ],
246
- [ModalType$3.OkayCancel]: [
247
- ModalButtonType$3.Okay,
248
- ModalButtonType$3.Cancel,
246
+ [ModalType$1.OkayCancel]: [
247
+ ModalButtonType$1.Okay,
248
+ ModalButtonType$1.Cancel,
249
249
  ],
250
- [ModalType$3.YesNo]: [
251
- ModalButtonType$3.Yes,
252
- ModalButtonType$3.No,
250
+ [ModalType$1.YesNo]: [
251
+ ModalButtonType$1.Yes,
252
+ ModalButtonType$1.No,
253
253
  ],
254
- [ModalType$3.YesNoCancel]: [
255
- ModalButtonType$3.Yes,
256
- ModalButtonType$3.No,
257
- ModalButtonType$3.Cancel,
254
+ [ModalType$1.YesNoCancel]: [
255
+ ModalButtonType$1.Yes,
256
+ ModalButtonType$1.No,
257
+ ModalButtonType$1.Cancel,
258
258
  ],
259
- [ModalType$3.AbandonGoBack]: [
260
- ModalButtonType$3.Abandon,
261
- ModalButtonType$3.GoBack,
259
+ [ModalType$1.AbandonGoBack]: [
260
+ ModalButtonType$1.Abandon,
261
+ ModalButtonType$1.GoBack,
262
262
  ],
263
- [ModalType$3.ImSureCancel]: [
264
- ModalButtonType$3.ImSure,
265
- ModalButtonType$3.Cancel,
263
+ [ModalType$1.ImSureCancel]: [
264
+ ModalButtonType$1.ImSure,
265
+ ModalButtonType$1.Cancel,
266
266
  ],
267
- [ModalType$3.DeleteCancel]: [
268
- ModalButtonType$3.Delete,
269
- ModalButtonType$3.Cancel,
267
+ [ModalType$1.DeleteCancel]: [
268
+ ModalButtonType$1.Delete,
269
+ ModalButtonType$1.Cancel,
270
270
  ],
271
- [ModalType$3.ConfirmCancel]: [
272
- ModalButtonType$3.Confirm,
273
- ModalButtonType$3.Cancel,
271
+ [ModalType$1.ConfirmCancel]: [
272
+ ModalButtonType$1.Confirm,
273
+ ModalButtonType$1.Cancel,
274
274
  ],
275
275
  };
276
276
  // Button type styling and labels
277
277
  const ModalButtonTypeToLabelAndVariant = {
278
- [ModalButtonType$3.Okay]: {
278
+ [ModalButtonType$1.Okay]: {
279
279
  label: 'Okay',
280
- variant: Variant$3.Dark,
280
+ variant: Variant$1.Dark,
281
281
  },
282
- [ModalButtonType$3.Cancel]: {
282
+ [ModalButtonType$1.Cancel]: {
283
283
  label: 'Cancel',
284
- variant: Variant$3.Secondary,
284
+ variant: Variant$1.Secondary,
285
285
  },
286
- [ModalButtonType$3.Yes]: {
286
+ [ModalButtonType$1.Yes]: {
287
287
  label: 'Yes',
288
- variant: Variant$3.Dark,
288
+ variant: Variant$1.Dark,
289
289
  },
290
- [ModalButtonType$3.No]: {
290
+ [ModalButtonType$1.No]: {
291
291
  label: 'No',
292
- variant: Variant$3.Secondary,
292
+ variant: Variant$1.Secondary,
293
293
  },
294
- [ModalButtonType$3.Abandon]: {
294
+ [ModalButtonType$1.Abandon]: {
295
295
  label: 'Abandon Changes',
296
- variant: Variant$3.Warning,
296
+ variant: Variant$1.Warning,
297
297
  },
298
- [ModalButtonType$3.GoBack]: {
298
+ [ModalButtonType$1.GoBack]: {
299
299
  label: 'Go Back',
300
- variant: Variant$3.Secondary,
300
+ variant: Variant$1.Secondary,
301
301
  },
302
- [ModalButtonType$3.Continue]: {
302
+ [ModalButtonType$1.Continue]: {
303
303
  label: 'Continue',
304
- variant: Variant$3.Dark,
304
+ variant: Variant$1.Dark,
305
305
  },
306
- [ModalButtonType$3.ImSure]: {
306
+ [ModalButtonType$1.ImSure]: {
307
307
  label: 'I am sure',
308
- variant: Variant$3.Warning,
308
+ variant: Variant$1.Warning,
309
309
  },
310
- [ModalButtonType$3.Delete]: {
310
+ [ModalButtonType$1.Delete]: {
311
311
  label: 'Yes, Delete',
312
- variant: Variant$3.Danger,
312
+ variant: Variant$1.Danger,
313
313
  },
314
- [ModalButtonType$3.Confirm]: {
314
+ [ModalButtonType$1.Confirm]: {
315
315
  label: 'Confirm',
316
- variant: Variant$3.Dark,
316
+ variant: Variant$1.Dark,
317
317
  },
318
318
  };
319
319
  /*------------------------------------------------------------------------*/
@@ -391,7 +391,7 @@ const Modal = (props) => {
391
391
  /*------------------------------------------------------------------------*/
392
392
  var _a;
393
393
  /* -------------- Props ------------- */
394
- const { type = ModalType$3.NoButtons, size = ModalSize$2.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
394
+ const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
395
395
  /* -------------- State ------------- */
396
396
  // If true, the modal is shown
397
397
  const [visible, setVisible] = React.useState(false);
@@ -408,7 +408,7 @@ const Modal = (props) => {
408
408
  * @author Gabe Abrams
409
409
  */
410
410
  React.useEffect(() => {
411
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
411
+ (() => __awaiter(void 0, void 0, void 0, function* () {
412
412
  // Set defaults
413
413
  setVisible(false);
414
414
  setAnimatingIn(true);
@@ -434,7 +434,7 @@ const Modal = (props) => {
434
434
  * @param ModalButtonType the button that was clicked when closing the
435
435
  * modal
436
436
  */
437
- const handleClose = (ModalButtonType) => __awaiter$1(void 0, void 0, void 0, function* () {
437
+ const handleClose = (ModalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
438
438
  // Don't close if no handler
439
439
  if (!onClose) {
440
440
  return;
@@ -496,7 +496,7 @@ const Modal = (props) => {
496
496
  React__default["default"].createElement("style", null, style$8),
497
497
  React__default["default"].createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
498
498
  zIndex: 5000000003,
499
- }, onClick: () => __awaiter$1(void 0, void 0, void 0, function* () {
499
+ }, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
500
500
  // Skip if exit via backdrop not allowed
501
501
  if (dontAllowBackdropExit || !onClose) {
502
502
  // Show pop animation
@@ -509,7 +509,7 @@ const Modal = (props) => {
509
509
  return;
510
510
  }
511
511
  // Handle close
512
- handleClose(ModalButtonType$3.Cancel);
512
+ handleClose(ModalButtonType$1.Cancel);
513
513
  }) }),
514
514
  React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
515
515
  zIndex: 5000000002,
@@ -521,7 +521,7 @@ const Modal = (props) => {
521
521
  } }, title),
522
522
  onClose && (React__default["default"].createElement("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: () => {
523
523
  // Handle close
524
- handleClose(ModalButtonType$3.Cancel);
524
+ handleClose(ModalButtonType$1.Cancel);
525
525
  } }))),
526
526
  children && (React__default["default"].createElement("div", { className: "modal-body" }, children)),
527
527
  footer && (React__default["default"].createElement("div", { className: "modal-footer pt-1 pb-1" }, footer))))));
@@ -531,7 +531,7 @@ const Modal = (props) => {
531
531
  * An error with a code
532
532
  * @author Gabe Abrams
533
533
  */
534
- class ErrorWithCode$1 extends Error {
534
+ class ErrorWithCode extends Error {
535
535
  constructor(message, code) {
536
536
  super(message);
537
537
  this.name = 'ErrorWithCode';
@@ -578,23 +578,18 @@ let storedSendRequest;
578
578
  * @author Gabe Abrams
579
579
  * @returns sendRequest function
580
580
  */
581
- const getSendRequest = () => __awaiter$1(void 0, void 0, void 0, function* () {
582
- // Track timeout
583
- let timedOut = false;
584
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
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
585
  yield waitMs(5000);
586
- timedOut = true;
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
+ }
587
589
  }))(),
588
590
  // Wait for initialization
589
591
  yield initialized;
590
- // Error if no send request function
591
- if (timedOut) {
592
- showFatalError(new ErrorWithCode$1('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$3.NoCACCLSendRequestFunction));
593
- // Return dummy function that never resolves
594
- return (() => {
595
- return new Promise(() => { });
596
- });
597
- }
592
+ successful = true;
598
593
  // Return
599
594
  return storedSendRequest;
600
595
  });
@@ -649,7 +644,7 @@ const _setStubResponse = (opts) => {
649
644
  const { path, body, } = opts;
650
645
  const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase();
651
646
  const errorMessage = ((_b = opts.errorMessage) !== null && _b !== void 0 ? _b : 'An unknown error has occurred.');
652
- const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$3.NoCode);
647
+ const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$1.NoCode);
653
648
  // Store to stub responses
654
649
  if (!stubResponses[method]) {
655
650
  stubResponses[method] = {};
@@ -677,7 +672,7 @@ const _setStubResponse = (opts) => {
677
672
  * @param [opts.params] - query/body parameters to include
678
673
  * @returns response from server
679
674
  */
680
- const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
675
+ const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
681
676
  var _a, _b, _c;
682
677
  const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
683
678
  // Handle stubs
@@ -695,7 +690,7 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
695
690
  return stubResponse.body;
696
691
  }
697
692
  // Error
698
- throw new ErrorWithCode$1(stubResponse.errorMessage, stubResponse.errorCode);
693
+ throw new ErrorWithCode(stubResponse.errorMessage, stubResponse.errorCode);
699
694
  }
700
695
  // Send the request
701
696
  const sendRequest = yield getSendRequest();
@@ -706,11 +701,11 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
706
701
  });
707
702
  // Check for failure
708
703
  if (!response || !response.body) {
709
- throw new ErrorWithCode$1('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$3.NoResponse);
704
+ throw new ErrorWithCode('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$1.NoResponse);
710
705
  }
711
706
  if (!response.body.success) {
712
707
  // Session expired
713
- if (response.body.code === ReactKitErrorCode$3.SessionExpired) {
708
+ if (response.body.code === ReactKitErrorCode$1.SessionExpired) {
714
709
  // Skip notice if session was already expired
715
710
  if (sessionAlreadyExpired) {
716
711
  // Never return (browser is already reloading)
@@ -731,9 +726,9 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
731
726
  });
732
727
  }
733
728
  // Other errors
734
- throw new ErrorWithCode$1((response.body.message
729
+ throw new ErrorWithCode((response.body.message
735
730
  || 'An unknown error occurred. Please contact an admin.'), (response.body.code
736
- || ReactKitErrorCode$3.NoCode));
731
+ || ReactKitErrorCode$1.NoCode));
737
732
  }
738
733
  // Success! Extract the body
739
734
  const { body } = response.body;
@@ -745,7 +740,7 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
745
740
  * Log a user action on the client (cannot be used on the server)
746
741
  * @author Gabe Abrams
747
742
  */
748
- const logClientEvent = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
743
+ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
749
744
  var _a, _b, _c, _d, _e, _f, _g;
750
745
  return visitServerEndpoint({
751
746
  path: LOG_ROUTE_PATH,
@@ -797,7 +792,7 @@ let onAlertClosed;
797
792
  * @param title the title text to display at the top of the alert
798
793
  * @param text the text to display in the alert
799
794
  */
800
- const alert$1 = (title, text) => __awaiter$1(void 0, void 0, void 0, function* () {
795
+ const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
801
796
  // Fallback if alert not available
802
797
  if (!setAlertInfo) {
803
798
  window.alert(`${title}\n\n${text}`);
@@ -837,7 +832,7 @@ let onConfirmClosed;
837
832
  * button
838
833
  * @returns true if the user confirmed
839
834
  */
840
- const confirm = (title, text, opts) => __awaiter$1(void 0, void 0, void 0, function* () {
835
+ const confirm = (title, text, opts) => __awaiter(void 0, void 0, void 0, function* () {
841
836
  // Fallback if confirm is not available
842
837
  if (!setConfirmInfo) {
843
838
  return window.confirm(`${title}\n\n${text}`);
@@ -876,8 +871,8 @@ const showFatalError = (error, errorTitle = 'An Error Occurred') => {
876
871
  ? error.trim()
877
872
  : String((_a = error.message) !== null && _a !== void 0 ? _a : 'An unknown error occurred.'));
878
873
  const code = (typeof error === 'string'
879
- ? ReactKitErrorCode$3.NoCode
880
- : String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$3.NoCode));
874
+ ? ReactKitErrorCode$1.NoCode
875
+ : String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$1.NoCode));
881
876
  // Add log
882
877
  logClientEvent({
883
878
  context: LogBuiltInMetadata.Context.ClientFatalError,
@@ -936,7 +931,7 @@ const AppWrapper = (props) => {
936
931
  let modal;
937
932
  /* -------------- Alert ------------- */
938
933
  if (alertInfo) {
939
- modal = (React__default["default"].createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$3.Okay, onClose: () => {
934
+ modal = (React__default["default"].createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
940
935
  // Alert closed
941
936
  setAlertInfo(undefined);
942
937
  if (onAlertClosed) {
@@ -946,10 +941,10 @@ const AppWrapper = (props) => {
946
941
  }
947
942
  /* ------------- Confirm ------------ */
948
943
  if (confirmInfo) {
949
- modal = (React__default["default"].createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$3.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
944
+ modal = (React__default["default"].createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
950
945
  setConfirmInfo(undefined);
951
946
  if (onConfirmClosed) {
952
- onConfirmClosed(buttonType === ModalButtonType$3.Okay);
947
+ onConfirmClosed(buttonType === ModalButtonType$1.Okay);
953
948
  }
954
949
  }, dontAllowBackdropExit: true }, confirmInfo.text));
955
950
  }
@@ -962,8 +957,8 @@ const AppWrapper = (props) => {
962
957
  if (fatalErrorMessage || fatalErrorCode || sessionHasExpired) {
963
958
  // Re-encapsulate in an error
964
959
  const error = (sessionHasExpired
965
- ? new ErrorWithCode$1(getSessionExpiredMessage(), ReactKitErrorCode$3.SessionExpired)
966
- : new ErrorWithCode$1((fatalErrorMessage !== null && fatalErrorMessage !== void 0 ? fatalErrorMessage : 'An unknown error has occurred. Please contact support.'), (fatalErrorCode !== null && fatalErrorCode !== void 0 ? fatalErrorCode : ReactKitErrorCode$3.NoCode)));
960
+ ? new ErrorWithCode(getSessionExpiredMessage(), ReactKitErrorCode$1.SessionExpired)
961
+ : new ErrorWithCode((fatalErrorMessage !== null && fatalErrorMessage !== void 0 ? fatalErrorMessage : 'An unknown error has occurred. Please contact support.'), (fatalErrorCode !== null && fatalErrorCode !== void 0 ? fatalErrorCode : ReactKitErrorCode$1.NoCode)));
967
962
  // Build error screen
968
963
  body = (React__default["default"].createElement("div", { style: {
969
964
  display: 'block',
@@ -1188,7 +1183,7 @@ const RadioButton = (props) => {
1188
1183
  /* Setup */
1189
1184
  /*------------------------------------------------------------------------*/
1190
1185
  /* -------------- Props ------------- */
1191
- const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$3.Secondary, unselectedVariant = Variant$3.Light, small, } = props;
1186
+ const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$1.Secondary, unselectedVariant = Variant$1.Light, small, } = props;
1192
1187
  /*------------------------------------------------------------------------*/
1193
1188
  /* Render */
1194
1189
  /*------------------------------------------------------------------------*/
@@ -1216,7 +1211,7 @@ const CheckboxButton = (props) => {
1216
1211
  /* Setup */
1217
1212
  /*------------------------------------------------------------------------*/
1218
1213
  /* -------------- Props ------------- */
1219
- const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$3.Secondary, uncheckedVariant = Variant$3.Light, small, dashed, } = props;
1214
+ const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$1.Secondary, uncheckedVariant = Variant$1.Light, small, dashed, } = props;
1220
1215
  /*------------------------------------------------------------------------*/
1221
1216
  /* Render */
1222
1217
  /*------------------------------------------------------------------------*/
@@ -1862,13 +1857,13 @@ const PopPendingMark = (props) => {
1862
1857
  */
1863
1858
  /* ------------- Actions ------------ */
1864
1859
  // Types of actions
1865
- var ActionType$8;
1860
+ var ActionType$6;
1866
1861
  (function (ActionType) {
1867
1862
  // Indicate that the text was recently copied
1868
1863
  ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
1869
1864
  // Clear the status
1870
1865
  ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
1871
- })(ActionType$8 || (ActionType$8 = {}));
1866
+ })(ActionType$6 || (ActionType$6 = {}));
1872
1867
  /**
1873
1868
  * Reducer that executes actions
1874
1869
  * @author Gabe Abrams
@@ -1877,12 +1872,12 @@ var ActionType$8;
1877
1872
  */
1878
1873
  const reducer$6 = (state, action) => {
1879
1874
  switch (action.type) {
1880
- case ActionType$8.IndicateRecentlyCopied: {
1875
+ case ActionType$6.IndicateRecentlyCopied: {
1881
1876
  return {
1882
1877
  recentlyCopied: true,
1883
1878
  };
1884
1879
  }
1885
- case ActionType$8.ClearRecentlyCopiedStatus: {
1880
+ case ActionType$6.ClearRecentlyCopiedStatus: {
1886
1881
  return {
1887
1882
  recentlyCopied: false,
1888
1883
  };
@@ -1918,7 +1913,7 @@ const CopiableBox = (props) => {
1918
1913
  * Perform a copy
1919
1914
  * @author Gabe Abrams
1920
1915
  */
1921
- const performCopy = () => __awaiter$1(void 0, void 0, void 0, function* () {
1916
+ const performCopy = () => __awaiter(void 0, void 0, void 0, function* () {
1922
1917
  // Write to clipboard
1923
1918
  try {
1924
1919
  yield navigator.clipboard.writeText(text);
@@ -1928,13 +1923,13 @@ const CopiableBox = (props) => {
1928
1923
  }
1929
1924
  // Show copied notice
1930
1925
  dispatch({
1931
- type: ActionType$8.IndicateRecentlyCopied,
1926
+ type: ActionType$6.IndicateRecentlyCopied,
1932
1927
  });
1933
1928
  // Wait a moment
1934
1929
  yield waitMs(4000);
1935
1930
  // Hide copied notice
1936
1931
  dispatch({
1937
- type: ActionType$8.ClearRecentlyCopiedStatus,
1932
+ type: ActionType$6.ClearRecentlyCopiedStatus,
1938
1933
  });
1939
1934
  });
1940
1935
  /*------------------------------------------------------------------------*/
@@ -1990,11 +1985,11 @@ const CopiableBox = (props) => {
1990
1985
  */
1991
1986
  /* ------------- Actions ------------ */
1992
1987
  // Types of actions
1993
- var ActionType$7;
1988
+ var ActionType$5;
1994
1989
  (function (ActionType) {
1995
1990
  // Toggle whether a child are being shown
1996
1991
  ActionType["ToggleChild"] = "toggle-child";
1997
- })(ActionType$7 || (ActionType$7 = {}));
1992
+ })(ActionType$5 || (ActionType$5 = {}));
1998
1993
  /**
1999
1994
  * Reducer that executes actions
2000
1995
  * @author Gabe Abrams
@@ -2003,7 +1998,7 @@ var ActionType$7;
2003
1998
  */
2004
1999
  const reducer$5 = (state, action) => {
2005
2000
  switch (action.type) {
2006
- case ActionType$7.ToggleChild: {
2001
+ case ActionType$5.ToggleChild: {
2007
2002
  return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
2008
2003
  }
2009
2004
  default: {
@@ -2122,14 +2117,14 @@ const NestableItemList = (props) => {
2122
2117
  backgroundColor: 'transparent',
2123
2118
  }, type: "button", onClick: () => {
2124
2119
  dispatch({
2125
- type: ActionType$7.ToggleChild,
2120
+ type: ActionType$5.ToggleChild,
2126
2121
  id: item.id,
2127
2122
  });
2128
2123
  }, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
2129
2124
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: childExpanded[item.id] ? freeSolidSvgIcons.faChevronDown : freeSolidSvgIcons.faChevronRight })))),
2130
2125
  React__default["default"].createElement(CheckboxButton, { className: `NestableItemList-CheckboxButton-${item.id}`, text: item.name, checked: item.isGroup ? allChecked(item.children) : item.checked, dashed: item.isGroup ? !noneChecked(item.children) : false, onChanged: (checked) => {
2131
2126
  onChanged(changeChecked(item.id, checked, items));
2132
- }, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$3.Light }),
2127
+ }, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light }),
2133
2128
  (item.isGroup && childExpanded[item.id]) && (React__default["default"].createElement("div", { className: "NestableItemList-children-container", style: {
2134
2129
  paddingLeft: '2.2rem',
2135
2130
  } },
@@ -2267,7 +2262,7 @@ var LogAction$1 = LogAction;
2267
2262
  * Server-side API param types
2268
2263
  * @author Gabe Abrams
2269
2264
  */
2270
- var ParamType$2;
2265
+ var ParamType;
2271
2266
  (function (ParamType) {
2272
2267
  ParamType["Boolean"] = "boolean";
2273
2268
  ParamType["BooleanOptional"] = "boolean-optional";
@@ -2279,8 +2274,8 @@ var ParamType$2;
2279
2274
  ParamType["JSONOptional"] = "json-optional";
2280
2275
  ParamType["String"] = "string";
2281
2276
  ParamType["StringOptional"] = "string-optional";
2282
- })(ParamType$2 || (ParamType$2 = {}));
2283
- var ParamType$3 = ParamType$2;
2277
+ })(ParamType || (ParamType = {}));
2278
+ var ParamType$1 = ParamType;
2284
2279
 
2285
2280
  /**
2286
2281
  * Round a number to a certain number of decimals
@@ -2397,7 +2392,7 @@ var SortType;
2397
2392
  })(SortType || (SortType = {}));
2398
2393
  /* ------------- Actions ------------ */
2399
2394
  // Types of actions
2400
- var ActionType$6;
2395
+ var ActionType$4;
2401
2396
  (function (ActionType) {
2402
2397
  // Toggle sort column param
2403
2398
  ActionType["ToggleSortColumn"] = "toggle-sort-column";
@@ -2409,7 +2404,7 @@ var ActionType$6;
2409
2404
  ActionType["ShowAllColumns"] = "show-all-columns";
2410
2405
  // Hide all columns
2411
2406
  ActionType["HideAllColumns"] = "hide-all-columns";
2412
- })(ActionType$6 || (ActionType$6 = {}));
2407
+ })(ActionType$4 || (ActionType$4 = {}));
2413
2408
  /**
2414
2409
  * Reducer that executes actions
2415
2410
  * @author Gabe Abrams
@@ -2418,7 +2413,7 @@ var ActionType$6;
2418
2413
  */
2419
2414
  const reducer$4 = (state, action) => {
2420
2415
  switch (action.type) {
2421
- case ActionType$6.ToggleSortColumn: {
2416
+ case ActionType$4.ToggleSortColumn: {
2422
2417
  if (action.param !== state.sortColumnParam) {
2423
2418
  // Different column param
2424
2419
  return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
@@ -2430,22 +2425,22 @@ const reducer$4 = (state, action) => {
2430
2425
  // Stop sorting by column
2431
2426
  return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
2432
2427
  }
2433
- case ActionType$6.UpdateColumnVisibility: {
2428
+ case ActionType$4.UpdateColumnVisibility: {
2434
2429
  const { columnVisibilityMap } = state;
2435
2430
  columnVisibilityMap[action.param] = action.visible;
2436
2431
  return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2437
2432
  }
2438
- case ActionType$6.ToggleColVisCusModalVisibility: {
2433
+ case ActionType$4.ToggleColVisCusModalVisibility: {
2439
2434
  return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
2440
2435
  }
2441
- case ActionType$6.ShowAllColumns: {
2436
+ case ActionType$4.ShowAllColumns: {
2442
2437
  const { columnVisibilityMap } = state;
2443
2438
  Object.keys(columnVisibilityMap).forEach((param) => {
2444
2439
  columnVisibilityMap[param] = true;
2445
2440
  });
2446
2441
  return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2447
2442
  }
2448
- case ActionType$6.HideAllColumns: {
2443
+ case ActionType$4.HideAllColumns: {
2449
2444
  const { columnVisibilityMap } = state;
2450
2445
  Object.keys(columnVisibilityMap).forEach((param) => {
2451
2446
  columnVisibilityMap[param] = false;
@@ -2506,7 +2501,7 @@ const IntelliTable = (props) => {
2506
2501
  /* ------- Col Vis Customization Modal ------ */
2507
2502
  if (columnVisibilityCustomizationModalVisible) {
2508
2503
  // Create modal
2509
- modal = (React__default["default"].createElement(Modal, { type: ModalType$3.Okay, title: "Choose columns to show:", onClose: () => {
2504
+ modal = (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2510
2505
  const noColumnsSelected = (Object.values(columnVisibilityMap)
2511
2506
  .every((isSelected) => {
2512
2507
  return !isSelected;
@@ -2515,27 +2510,27 @@ const IntelliTable = (props) => {
2515
2510
  return alert$1('Choose at least one column', 'To continue, you have to choose at least one column to show');
2516
2511
  }
2517
2512
  dispatch({
2518
- type: ActionType$6.ToggleColVisCusModalVisibility,
2513
+ type: ActionType$4.ToggleColVisCusModalVisibility,
2519
2514
  });
2520
- }, okayVariant: Variant$3.Light },
2515
+ }, okayVariant: Variant$1.Light },
2521
2516
  columns.map((column) => {
2522
2517
  return (React__default["default"].createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
2523
2518
  dispatch({
2524
- type: ActionType$6.UpdateColumnVisibility,
2519
+ type: ActionType$4.UpdateColumnVisibility,
2525
2520
  param: column.param,
2526
2521
  visible: checked,
2527
2522
  });
2528
- }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$3.Light, uncheckedVariant: Variant$3.Secondary }));
2523
+ }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
2529
2524
  }),
2530
2525
  React__default["default"].createElement("div", { className: "mt-3" }, "Or you can:"),
2531
2526
  React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-select-all-columns`, className: "btn btn-secondary me-2", "aria-label": `show all columns in the ${title} table`, onClick: () => {
2532
2527
  dispatch({
2533
- type: ActionType$6.ShowAllColumns,
2528
+ type: ActionType$4.ShowAllColumns,
2534
2529
  });
2535
2530
  } }, "Select All"),
2536
2531
  React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-select-none-columns`, className: "btn btn-secondary", "aria-label": `hide all columns in the ${title} table`, onClick: () => {
2537
2532
  dispatch({
2538
- type: ActionType$6.HideAllColumns,
2533
+ type: ActionType$4.HideAllColumns,
2539
2534
  });
2540
2535
  } }, "Deselect All")));
2541
2536
  }
@@ -2586,7 +2581,7 @@ const IntelliTable = (props) => {
2586
2581
  React__default["default"].createElement("div", null,
2587
2582
  React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-sort-by-${column.param}-button`, className: `btn btn-${sortingByThisColumn ? 'light' : 'secondary'} btn-sm ms-1 ps-1 pe-1 pt-0 pb-0`, "aria-label": sortButtonAriaLabel, onClick: () => {
2588
2583
  dispatch({
2589
- type: ActionType$6.ToggleSortColumn,
2584
+ type: ActionType$4.ToggleSortColumn,
2590
2585
  param: column.param,
2591
2586
  });
2592
2587
  } },
@@ -2626,7 +2621,7 @@ const IntelliTable = (props) => {
2626
2621
  }
2627
2622
  // Sort differently based on the data type
2628
2623
  // > Boolean
2629
- if (paramType === ParamType$3.Boolean) {
2624
+ if (paramType === ParamType$1.Boolean) {
2630
2625
  if (aVal && !bVal) {
2631
2626
  return (descending ? -1 : 1);
2632
2627
  }
@@ -2636,14 +2631,14 @@ const IntelliTable = (props) => {
2636
2631
  return tiebreaker;
2637
2632
  }
2638
2633
  // > Number
2639
- if (paramType === ParamType$3.Int
2640
- || paramType === ParamType$3.Float) {
2634
+ if (paramType === ParamType$1.Int
2635
+ || paramType === ParamType$1.Float) {
2641
2636
  return (descending
2642
2637
  ? (bVal - aVal)
2643
2638
  : (aVal - bVal));
2644
2639
  }
2645
2640
  // > String
2646
- if (paramType === ParamType$3.String) {
2641
+ if (paramType === ParamType$1.String) {
2647
2642
  if (aVal < bVal) {
2648
2643
  return (descending ? 1 : -1);
2649
2644
  }
@@ -2653,7 +2648,7 @@ const IntelliTable = (props) => {
2653
2648
  return tiebreaker;
2654
2649
  }
2655
2650
  // > JSON
2656
- if (paramType === ParamType$3.JSON) {
2651
+ if (paramType === ParamType$1.JSON) {
2657
2652
  const aSize = (Array.isArray(aVal)
2658
2653
  ? aVal.length
2659
2654
  : Object.keys(aVal).length);
@@ -2685,7 +2680,7 @@ const IntelliTable = (props) => {
2685
2680
  let fullValue;
2686
2681
  let visibleValue;
2687
2682
  let title = '';
2688
- if (column.type === ParamType$3.Boolean) {
2683
+ if (column.type === ParamType$1.Boolean) {
2689
2684
  fullValue = !!(value);
2690
2685
  const noValue = (value === undefined
2691
2686
  || value === null);
@@ -2697,7 +2692,7 @@ const IntelliTable = (props) => {
2697
2692
  title = 'Empty Cell';
2698
2693
  }
2699
2694
  }
2700
- else if (column.type === ParamType$3.Int) {
2695
+ else if (column.type === ParamType$1.Int) {
2701
2696
  fullValue = Number.parseInt(value, 10);
2702
2697
  const noValue = Number.isNaN(fullValue);
2703
2698
  visibleValue = (noValue
@@ -2708,7 +2703,7 @@ const IntelliTable = (props) => {
2708
2703
  title = 'Empty Cell';
2709
2704
  }
2710
2705
  }
2711
- else if (column.type === ParamType$3.Float) {
2706
+ else if (column.type === ParamType$1.Float) {
2712
2707
  fullValue = Number.parseFloat(value);
2713
2708
  const noValue = Number.isNaN(fullValue);
2714
2709
  visibleValue = (noValue
@@ -2719,7 +2714,7 @@ const IntelliTable = (props) => {
2719
2714
  title = 'Empty Cell';
2720
2715
  }
2721
2716
  }
2722
- else if (column.type === ParamType$3.String) {
2717
+ else if (column.type === ParamType$1.String) {
2723
2718
  fullValue = String(value).trim();
2724
2719
  const noValue = (value === undefined
2725
2720
  || value === null
@@ -2732,7 +2727,7 @@ const IntelliTable = (props) => {
2732
2727
  title = 'Empty Cell';
2733
2728
  }
2734
2729
  }
2735
- else if (column.type === ParamType$3.JSON) {
2730
+ else if (column.type === ParamType$1.JSON) {
2736
2731
  fullValue = JSON.stringify(value);
2737
2732
  const noValue = (Array.isArray(value)
2738
2733
  ? (!value || value.length === 0)
@@ -2775,7 +2770,7 @@ const IntelliTable = (props) => {
2775
2770
  React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
2776
2771
  React__default["default"].createElement("button", { type: "button", className: "btn btn-secondary ms-2", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
2777
2772
  dispatch({
2778
- type: ActionType$6.ToggleColVisCusModalVisibility,
2773
+ type: ActionType$4.ToggleColVisCusModalVisibility,
2779
2774
  });
2780
2775
  } },
2781
2776
  "Show/Hide Cols",
@@ -2897,185 +2892,185 @@ const columns = [
2897
2892
  {
2898
2893
  title: 'First Name',
2899
2894
  param: 'userFirstName',
2900
- type: ParamType$3.String,
2895
+ type: ParamType$1.String,
2901
2896
  },
2902
2897
  {
2903
2898
  title: 'Last Name',
2904
2899
  param: 'userLastName',
2905
- type: ParamType$3.String,
2900
+ type: ParamType$1.String,
2906
2901
  },
2907
2902
  {
2908
2903
  title: 'Email',
2909
2904
  param: 'userEmail',
2910
- type: ParamType$3.String,
2905
+ type: ParamType$1.String,
2911
2906
  },
2912
2907
  {
2913
2908
  title: 'Canvas Id',
2914
2909
  param: 'userId',
2915
- type: ParamType$3.Int,
2910
+ type: ParamType$1.Int,
2916
2911
  },
2917
2912
  {
2918
2913
  title: 'Student?',
2919
2914
  param: 'isLearner',
2920
- type: ParamType$3.Boolean,
2915
+ type: ParamType$1.Boolean,
2921
2916
  },
2922
2917
  {
2923
2918
  title: 'Teaching Staff?',
2924
2919
  param: 'isTTM',
2925
- type: ParamType$3.Boolean,
2920
+ type: ParamType$1.Boolean,
2926
2921
  startsHidden: true,
2927
2922
  },
2928
2923
  {
2929
2924
  title: 'Admin?',
2930
2925
  param: 'isAdmin',
2931
- type: ParamType$3.Boolean,
2926
+ type: ParamType$1.Boolean,
2932
2927
  startsHidden: true,
2933
2928
  },
2934
2929
  {
2935
2930
  title: 'Course Canvas Id',
2936
2931
  param: 'courseId',
2937
- type: ParamType$3.Int,
2932
+ type: ParamType$1.Int,
2938
2933
  startsHidden: true,
2939
2934
  },
2940
2935
  {
2941
2936
  title: 'Course Name',
2942
2937
  param: 'courseName',
2943
- type: ParamType$3.String,
2938
+ type: ParamType$1.String,
2944
2939
  },
2945
2940
  {
2946
2941
  title: 'Browser Name',
2947
2942
  param: 'browser.name',
2948
- type: ParamType$3.String,
2943
+ type: ParamType$1.String,
2949
2944
  startsHidden: true,
2950
2945
  },
2951
2946
  {
2952
2947
  title: 'Browser Version',
2953
2948
  param: 'browser.version',
2954
- type: ParamType$3.String,
2949
+ type: ParamType$1.String,
2955
2950
  startsHidden: true,
2956
2951
  },
2957
2952
  {
2958
2953
  title: 'OS',
2959
2954
  param: 'device.os',
2960
- type: ParamType$3.String,
2955
+ type: ParamType$1.String,
2961
2956
  startsHidden: true,
2962
2957
  },
2963
2958
  {
2964
2959
  title: 'Mobile?',
2965
2960
  param: 'device.isMobile',
2966
- type: ParamType$3.Boolean,
2961
+ type: ParamType$1.Boolean,
2967
2962
  startsHidden: true,
2968
2963
  },
2969
2964
  {
2970
2965
  title: 'Year',
2971
2966
  param: 'year',
2972
- type: ParamType$3.Int,
2967
+ type: ParamType$1.Int,
2973
2968
  },
2974
2969
  {
2975
2970
  title: 'Month',
2976
2971
  param: 'month',
2977
- type: ParamType$3.Int,
2972
+ type: ParamType$1.Int,
2978
2973
  },
2979
2974
  {
2980
2975
  title: 'Day',
2981
2976
  param: 'day',
2982
- type: ParamType$3.Int,
2977
+ type: ParamType$1.Int,
2983
2978
  },
2984
2979
  {
2985
2980
  title: 'Hour',
2986
2981
  param: 'hour',
2987
- type: ParamType$3.Int,
2982
+ type: ParamType$1.Int,
2988
2983
  },
2989
2984
  {
2990
2985
  title: 'Minute',
2991
2986
  param: 'minute',
2992
- type: ParamType$3.Int,
2987
+ type: ParamType$1.Int,
2993
2988
  startsHidden: true,
2994
2989
  },
2995
2990
  {
2996
2991
  title: 'Timestamp',
2997
2992
  param: 'timestamp',
2998
- type: ParamType$3.Int,
2993
+ type: ParamType$1.Int,
2999
2994
  startsHidden: true,
3000
2995
  },
3001
2996
  {
3002
2997
  title: 'Context',
3003
2998
  param: 'context',
3004
- type: ParamType$3.String,
2999
+ type: ParamType$1.String,
3005
3000
  },
3006
3001
  {
3007
3002
  title: 'Subcontext',
3008
3003
  param: 'subcontext',
3009
- type: ParamType$3.String,
3004
+ type: ParamType$1.String,
3010
3005
  },
3011
3006
  {
3012
3007
  title: 'Tags',
3013
3008
  param: 'tags',
3014
- type: ParamType$3.JSON,
3009
+ type: ParamType$1.JSON,
3015
3010
  startsHidden: true,
3016
3011
  },
3017
3012
  {
3018
3013
  title: 'Log Level',
3019
3014
  param: 'level',
3020
- type: ParamType$3.String,
3015
+ type: ParamType$1.String,
3021
3016
  startsHidden: true,
3022
3017
  },
3023
3018
  {
3024
3019
  title: 'Metadata',
3025
3020
  param: 'metadata',
3026
- type: ParamType$3.JSON,
3021
+ type: ParamType$1.JSON,
3027
3022
  startsHidden: true,
3028
3023
  },
3029
3024
  {
3030
3025
  title: 'Source',
3031
3026
  param: 'source',
3032
- type: ParamType$3.String,
3027
+ type: ParamType$1.String,
3033
3028
  },
3034
3029
  {
3035
3030
  title: 'Server Route Path',
3036
3031
  param: 'routePath',
3037
- type: ParamType$3.String,
3032
+ type: ParamType$1.String,
3038
3033
  startsHidden: true,
3039
3034
  },
3040
3035
  {
3041
3036
  title: 'Server Route Template',
3042
3037
  param: 'routeTemplate',
3043
- type: ParamType$3.String,
3038
+ type: ParamType$1.String,
3044
3039
  startsHidden: true,
3045
3040
  },
3046
3041
  {
3047
3042
  title: 'Type',
3048
3043
  param: 'type',
3049
- type: ParamType$3.String,
3044
+ type: ParamType$1.String,
3050
3045
  },
3051
3046
  {
3052
3047
  title: 'Error Message',
3053
3048
  param: 'errorMessage',
3054
- type: ParamType$3.String,
3049
+ type: ParamType$1.String,
3055
3050
  startsHidden: true,
3056
3051
  },
3057
3052
  {
3058
3053
  title: 'Error Code',
3059
3054
  param: 'errorCode',
3060
- type: ParamType$3.String,
3055
+ type: ParamType$1.String,
3061
3056
  startsHidden: true,
3062
3057
  },
3063
3058
  {
3064
3059
  title: 'Error Stack',
3065
3060
  param: 'errorStack',
3066
- type: ParamType$3.String,
3061
+ type: ParamType$1.String,
3067
3062
  startsHidden: true,
3068
3063
  },
3069
3064
  {
3070
3065
  title: 'Action Target',
3071
3066
  param: 'target',
3072
- type: ParamType$3.String,
3067
+ type: ParamType$1.String,
3073
3068
  startsHidden: true,
3074
3069
  },
3075
3070
  {
3076
3071
  title: 'Action Type',
3077
3072
  param: 'action',
3078
- type: ParamType$3.String,
3073
+ type: ParamType$1.String,
3079
3074
  startsHidden: true,
3080
3075
  },
3081
3076
  ];
@@ -3141,7 +3136,7 @@ const genHumanReadableName = (machineReadableName) => {
3141
3136
  };
3142
3137
  /* ------------- Actions ------------ */
3143
3138
  // Types of actions
3144
- var ActionType$5;
3139
+ var ActionType$3;
3145
3140
  (function (ActionType) {
3146
3141
  // Show the loading bar
3147
3142
  ActionType["StartLoading"] = "start-loading";
@@ -3163,7 +3158,7 @@ var ActionType$5;
3163
3158
  ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
3164
3159
  // Update the advanced filter state
3165
3160
  ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
3166
- })(ActionType$5 || (ActionType$5 = {}));
3161
+ })(ActionType$3 || (ActionType$3 = {}));
3167
3162
  /**
3168
3163
  * Reducer that executes actions
3169
3164
  * @author Gabe Abrams
@@ -3172,36 +3167,36 @@ var ActionType$5;
3172
3167
  */
3173
3168
  const reducer$3 = (state, action) => {
3174
3169
  switch (action.type) {
3175
- case ActionType$5.StartLoading: {
3170
+ case ActionType$3.StartLoading: {
3176
3171
  return Object.assign(Object.assign({}, state), { loading: true });
3177
3172
  }
3178
- case ActionType$5.FinishLoading: {
3173
+ case ActionType$3.FinishLoading: {
3179
3174
  return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
3180
3175
  }
3181
- case ActionType$5.ToggleFilterDrawer: {
3176
+ case ActionType$3.ToggleFilterDrawer: {
3182
3177
  return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
3183
3178
  ? undefined // hide
3184
3179
  : action.filterDrawer) });
3185
3180
  }
3186
- case ActionType$5.HideFilterDrawer: {
3181
+ case ActionType$3.HideFilterDrawer: {
3187
3182
  return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
3188
3183
  }
3189
- case ActionType$5.ResetFilters: {
3184
+ case ActionType$3.ResetFilters: {
3190
3185
  return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
3191
3186
  }
3192
- case ActionType$5.UpdateDateFilterState: {
3187
+ case ActionType$3.UpdateDateFilterState: {
3193
3188
  return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
3194
3189
  }
3195
- case ActionType$5.UpdateContextFilterState: {
3190
+ case ActionType$3.UpdateContextFilterState: {
3196
3191
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
3197
3192
  }
3198
- case ActionType$5.UpdateTagFilterState: {
3193
+ case ActionType$3.UpdateTagFilterState: {
3199
3194
  return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
3200
3195
  }
3201
- case ActionType$5.UpdateActionErrorFilterState: {
3196
+ case ActionType$3.UpdateActionErrorFilterState: {
3202
3197
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
3203
3198
  }
3204
- case ActionType$5.UpdateAdvancedFilterState: {
3199
+ case ActionType$3.UpdateAdvancedFilterState: {
3205
3200
  return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
3206
3201
  }
3207
3202
  default: {
@@ -3378,10 +3373,10 @@ const LogReviewer = (props) => {
3378
3373
  * @author Gabe Abrams
3379
3374
  * @param newDateFilterState the new date filter state
3380
3375
  */
3381
- const handleDateRangeUpdated = (newDateFilterState) => __awaiter$1(void 0, void 0, void 0, function* () {
3376
+ const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
3382
3377
  // Update state
3383
3378
  dispatch({
3384
- type: ActionType$5.UpdateDateFilterState,
3379
+ type: ActionType$3.UpdateDateFilterState,
3385
3380
  dateFilterState: newDateFilterState,
3386
3381
  });
3387
3382
  // Check which year/month combos we need to load
@@ -3392,7 +3387,7 @@ const LogReviewer = (props) => {
3392
3387
  }
3393
3388
  // Start loading
3394
3389
  dispatch({
3395
- type: ActionType$5.StartLoading,
3390
+ type: ActionType$3.StartLoading,
3396
3391
  });
3397
3392
  // Load required months
3398
3393
  try {
@@ -3416,7 +3411,7 @@ const LogReviewer = (props) => {
3416
3411
  }
3417
3412
  // Finish loading
3418
3413
  dispatch({
3419
- type: ActionType$5.FinishLoading,
3414
+ type: ActionType$3.FinishLoading,
3420
3415
  logMap,
3421
3416
  });
3422
3417
  });
@@ -3455,7 +3450,7 @@ const LogReviewer = (props) => {
3455
3450
  React__default["default"].createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
3456
3451
  React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-date-filter-drawer", className: `btn btn-${FilterDrawer.Date === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle date filter drawer", onClick: () => {
3457
3452
  dispatch({
3458
- type: ActionType$5.ToggleFilterDrawer,
3453
+ type: ActionType$3.ToggleFilterDrawer,
3459
3454
  filterDrawer: FilterDrawer.Date,
3460
3455
  });
3461
3456
  } },
@@ -3463,7 +3458,7 @@ const LogReviewer = (props) => {
3463
3458
  "Date"),
3464
3459
  React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-context-filter-drawer", className: `btn btn-${FilterDrawer.Context === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle context filter drawer", onClick: () => {
3465
3460
  dispatch({
3466
- type: ActionType$5.ToggleFilterDrawer,
3461
+ type: ActionType$3.ToggleFilterDrawer,
3467
3462
  filterDrawer: FilterDrawer.Context,
3468
3463
  });
3469
3464
  } },
@@ -3471,7 +3466,7 @@ const LogReviewer = (props) => {
3471
3466
  "Context"),
3472
3467
  (LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-tag-filter-drawer", className: `btn btn-${FilterDrawer.Tag === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle tag filter drawer", onClick: () => {
3473
3468
  dispatch({
3474
- type: ActionType$5.ToggleFilterDrawer,
3469
+ type: ActionType$3.ToggleFilterDrawer,
3475
3470
  filterDrawer: FilterDrawer.Tag,
3476
3471
  });
3477
3472
  } },
@@ -3479,7 +3474,7 @@ const LogReviewer = (props) => {
3479
3474
  "Tag")),
3480
3475
  React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-action-filter-drawer", className: `btn btn-${FilterDrawer.Action === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle action and error filter drawer", onClick: () => {
3481
3476
  dispatch({
3482
- type: ActionType$5.ToggleFilterDrawer,
3477
+ type: ActionType$3.ToggleFilterDrawer,
3483
3478
  filterDrawer: FilterDrawer.Action,
3484
3479
  });
3485
3480
  } },
@@ -3487,7 +3482,7 @@ const LogReviewer = (props) => {
3487
3482
  "Action"),
3488
3483
  React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle advanced filter drawer", onClick: () => {
3489
3484
  dispatch({
3490
- type: ActionType$5.ToggleFilterDrawer,
3485
+ type: ActionType$3.ToggleFilterDrawer,
3491
3486
  filterDrawer: FilterDrawer.Advanced,
3492
3487
  });
3493
3488
  } },
@@ -3495,7 +3490,7 @@ const LogReviewer = (props) => {
3495
3490
  "Advanced"),
3496
3491
  React__default["default"].createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
3497
3492
  dispatch({
3498
- type: ActionType$5.ResetFilters,
3493
+ type: ActionType$3.ResetFilters,
3499
3494
  initActionErrorFilterState,
3500
3495
  initAdvancedFilterState,
3501
3496
  initContextFilterState,
@@ -3617,7 +3612,7 @@ const LogReviewer = (props) => {
3617
3612
  }
3618
3613
  });
3619
3614
  dispatch({
3620
- type: ActionType$5.UpdateContextFilterState,
3615
+ type: ActionType$3.UpdateContextFilterState,
3621
3616
  contextFilterState,
3622
3617
  });
3623
3618
  } }));
@@ -3632,7 +3627,7 @@ const LogReviewer = (props) => {
3632
3627
  return (React__default["default"].createElement(CheckboxButton, { key: tag, id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, checked: tagFilterState[tag], onChanged: (checked) => {
3633
3628
  tagFilterState[tag] = checked;
3634
3629
  dispatch({
3635
- type: ActionType$5.UpdateTagFilterState,
3630
+ type: ActionType$3.UpdateTagFilterState,
3636
3631
  tagFilterState,
3637
3632
  });
3638
3633
  } }));
@@ -3645,21 +3640,21 @@ const LogReviewer = (props) => {
3645
3640
  React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
3646
3641
  actionErrorFilterState.type = undefined;
3647
3642
  dispatch({
3648
- type: ActionType$5.UpdateActionErrorFilterState,
3643
+ type: ActionType$3.UpdateActionErrorFilterState,
3649
3644
  actionErrorFilterState,
3650
3645
  });
3651
3646
  }, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
3652
3647
  React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
3653
3648
  actionErrorFilterState.type = LogType$1.Action;
3654
3649
  dispatch({
3655
- type: ActionType$5.UpdateActionErrorFilterState,
3650
+ type: ActionType$3.UpdateActionErrorFilterState,
3656
3651
  actionErrorFilterState,
3657
3652
  });
3658
3653
  }, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
3659
3654
  React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
3660
3655
  actionErrorFilterState.type = LogType$1.Error;
3661
3656
  dispatch({
3662
- type: ActionType$5.UpdateActionErrorFilterState,
3657
+ type: ActionType$3.UpdateActionErrorFilterState,
3663
3658
  actionErrorFilterState,
3664
3659
  });
3665
3660
  }, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
@@ -3671,7 +3666,7 @@ const LogReviewer = (props) => {
3671
3666
  return (React__default["default"].createElement(CheckboxButton, { key: action, id: `LogReviewer-action-${action}-checkbox`, text: description, ariaLabel: `include logs with action type "${description}" in results`, noMarginOnRight: true, checked: actionErrorFilterState.action[action], onChanged: (checked) => {
3672
3667
  actionErrorFilterState.action[action] = checked;
3673
3668
  dispatch({
3674
- type: ActionType$5.UpdateActionErrorFilterState,
3669
+ type: ActionType$3.UpdateActionErrorFilterState,
3675
3670
  actionErrorFilterState,
3676
3671
  });
3677
3672
  } }));
@@ -3682,7 +3677,7 @@ const LogReviewer = (props) => {
3682
3677
  return (React__default["default"].createElement(CheckboxButton, { key: target, id: `LogReviewer-target-${target}-checkbox`, text: description, ariaLabel: `include logs with target "${description}" in results`, checked: actionErrorFilterState.target[target], noMarginOnRight: true, onChanged: (checked) => {
3683
3678
  actionErrorFilterState.target[target] = checked;
3684
3679
  dispatch({
3685
- type: ActionType$5.UpdateActionErrorFilterState,
3680
+ type: ActionType$3.UpdateActionErrorFilterState,
3686
3681
  actionErrorFilterState,
3687
3682
  });
3688
3683
  } }));
@@ -3694,7 +3689,7 @@ const LogReviewer = (props) => {
3694
3689
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for error message", value: actionErrorFilterState.errorMessage, placeholder: "e.g. undefined is not a function", onChange: (e) => {
3695
3690
  actionErrorFilterState.errorMessage = e.target.value;
3696
3691
  dispatch({
3697
- type: ActionType$5.UpdateActionErrorFilterState,
3692
+ type: ActionType$3.UpdateActionErrorFilterState,
3698
3693
  actionErrorFilterState,
3699
3694
  });
3700
3695
  } })),
@@ -3705,7 +3700,7 @@ const LogReviewer = (props) => {
3705
3700
  .trim()
3706
3701
  .toUpperCase());
3707
3702
  dispatch({
3708
- type: ActionType$5.UpdateActionErrorFilterState,
3703
+ type: ActionType$3.UpdateActionErrorFilterState,
3709
3704
  actionErrorFilterState,
3710
3705
  });
3711
3706
  } }))))));
@@ -3719,7 +3714,7 @@ const LogReviewer = (props) => {
3719
3714
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
3720
3715
  advancedFilterState.userFirstName = e.target.value;
3721
3716
  dispatch({
3722
- type: ActionType$5.UpdateAdvancedFilterState,
3717
+ type: ActionType$3.UpdateAdvancedFilterState,
3723
3718
  advancedFilterState,
3724
3719
  });
3725
3720
  } })),
@@ -3728,7 +3723,7 @@ const LogReviewer = (props) => {
3728
3723
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
3729
3724
  advancedFilterState.userLastName = e.target.value;
3730
3725
  dispatch({
3731
- type: ActionType$5.UpdateAdvancedFilterState,
3726
+ type: ActionType$3.UpdateAdvancedFilterState,
3732
3727
  advancedFilterState,
3733
3728
  });
3734
3729
  } })),
@@ -3738,7 +3733,7 @@ const LogReviewer = (props) => {
3738
3733
  advancedFilterState.userEmail = ((e.target.value)
3739
3734
  .trim());
3740
3735
  dispatch({
3741
- type: ActionType$5.UpdateAdvancedFilterState,
3736
+ type: ActionType$3.UpdateAdvancedFilterState,
3742
3737
  advancedFilterState,
3743
3738
  });
3744
3739
  } })),
@@ -3752,7 +3747,7 @@ const LogReviewer = (props) => {
3752
3747
  .trim());
3753
3748
  }
3754
3749
  dispatch({
3755
- type: ActionType$5.UpdateAdvancedFilterState,
3750
+ type: ActionType$3.UpdateAdvancedFilterState,
3756
3751
  advancedFilterState,
3757
3752
  });
3758
3753
  } })),
@@ -3760,21 +3755,21 @@ const LogReviewer = (props) => {
3760
3755
  React__default["default"].createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
3761
3756
  advancedFilterState.includeLearners = checked;
3762
3757
  dispatch({
3763
- type: ActionType$5.UpdateAdvancedFilterState,
3758
+ type: ActionType$3.UpdateAdvancedFilterState,
3764
3759
  advancedFilterState,
3765
3760
  });
3766
3761
  }, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
3767
3762
  React__default["default"].createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
3768
3763
  advancedFilterState.includeTTMs = checked;
3769
3764
  dispatch({
3770
- type: ActionType$5.UpdateAdvancedFilterState,
3765
+ type: ActionType$3.UpdateAdvancedFilterState,
3771
3766
  advancedFilterState,
3772
3767
  });
3773
3768
  }, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
3774
3769
  React__default["default"].createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
3775
3770
  advancedFilterState.includeAdmins = checked;
3776
3771
  dispatch({
3777
- type: ActionType$5.UpdateAdvancedFilterState,
3772
+ type: ActionType$3.UpdateAdvancedFilterState,
3778
3773
  advancedFilterState,
3779
3774
  });
3780
3775
  }, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
@@ -3784,7 +3779,7 @@ const LogReviewer = (props) => {
3784
3779
  React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
3785
3780
  advancedFilterState.courseName = e.target.value;
3786
3781
  dispatch({
3787
- type: ActionType$5.UpdateAdvancedFilterState,
3782
+ type: ActionType$3.UpdateAdvancedFilterState,
3788
3783
  advancedFilterState,
3789
3784
  });
3790
3785
  } })),
@@ -3798,7 +3793,7 @@ const LogReviewer = (props) => {
3798
3793
  .trim());
3799
3794
  }
3800
3795
  dispatch({
3801
- type: ActionType$5.UpdateAdvancedFilterState,
3796
+ type: ActionType$3.UpdateAdvancedFilterState,
3802
3797
  advancedFilterState,
3803
3798
  });
3804
3799
  } }))),
@@ -3807,21 +3802,21 @@ const LogReviewer = (props) => {
3807
3802
  React__default["default"].createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
3808
3803
  advancedFilterState.isMobile = undefined;
3809
3804
  dispatch({
3810
- type: ActionType$5.UpdateAdvancedFilterState,
3805
+ type: ActionType$3.UpdateAdvancedFilterState,
3811
3806
  advancedFilterState,
3812
3807
  });
3813
3808
  } }),
3814
3809
  React__default["default"].createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
3815
3810
  advancedFilterState.isMobile = true;
3816
3811
  dispatch({
3817
- type: ActionType$5.UpdateAdvancedFilterState,
3812
+ type: ActionType$3.UpdateAdvancedFilterState,
3818
3813
  advancedFilterState,
3819
3814
  });
3820
3815
  } }),
3821
3816
  React__default["default"].createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
3822
3817
  advancedFilterState.isMobile = false;
3823
3818
  dispatch({
3824
- type: ActionType$5.UpdateAdvancedFilterState,
3819
+ type: ActionType$3.UpdateAdvancedFilterState,
3825
3820
  advancedFilterState,
3826
3821
  });
3827
3822
  }, noMarginOnRight: true }))),
@@ -3830,21 +3825,21 @@ const LogReviewer = (props) => {
3830
3825
  React__default["default"].createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
3831
3826
  advancedFilterState.source = undefined;
3832
3827
  dispatch({
3833
- type: ActionType$5.UpdateAdvancedFilterState,
3828
+ type: ActionType$3.UpdateAdvancedFilterState,
3834
3829
  advancedFilterState,
3835
3830
  });
3836
3831
  } }),
3837
3832
  React__default["default"].createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
3838
3833
  advancedFilterState.source = LogSource$1.Client;
3839
3834
  dispatch({
3840
- type: ActionType$5.UpdateAdvancedFilterState,
3835
+ type: ActionType$3.UpdateAdvancedFilterState,
3841
3836
  advancedFilterState,
3842
3837
  });
3843
3838
  } }),
3844
3839
  React__default["default"].createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
3845
3840
  advancedFilterState.source = LogSource$1.Server;
3846
3841
  dispatch({
3847
- type: ActionType$5.UpdateAdvancedFilterState,
3842
+ type: ActionType$3.UpdateAdvancedFilterState,
3848
3843
  advancedFilterState,
3849
3844
  });
3850
3845
  }, noMarginOnRight: true })),
@@ -3855,7 +3850,7 @@ const LogReviewer = (props) => {
3855
3850
  advancedFilterState.courseName = ((e.target.value)
3856
3851
  .trim());
3857
3852
  dispatch({
3858
- type: ActionType$5.UpdateAdvancedFilterState,
3853
+ type: ActionType$3.UpdateAdvancedFilterState,
3859
3854
  advancedFilterState,
3860
3855
  });
3861
3856
  } })),
@@ -3865,7 +3860,7 @@ const LogReviewer = (props) => {
3865
3860
  advancedFilterState.courseName = ((e.target.value)
3866
3861
  .trim());
3867
3862
  dispatch({
3868
- type: ActionType$5.UpdateAdvancedFilterState,
3863
+ type: ActionType$3.UpdateAdvancedFilterState,
3869
3864
  advancedFilterState,
3870
3865
  });
3871
3866
  } })))))));
@@ -39465,11 +39460,11 @@ var CreatableSelect$1 = CreatableSelect;
39465
39460
  // Import React
39466
39461
  /* ------------- Actions ------------ */
39467
39462
  // Types of actions
39468
- var ActionType$4;
39463
+ var ActionType$2;
39469
39464
  (function (ActionType) {
39470
39465
  // Update the input value
39471
39466
  ActionType["SetInputValue"] = "SetInputValue";
39472
- })(ActionType$4 || (ActionType$4 = {}));
39467
+ })(ActionType$2 || (ActionType$2 = {}));
39473
39468
  /**
39474
39469
  * Reducer that executes actions
39475
39470
  * @author Yuen Ler Chow
@@ -39478,7 +39473,7 @@ var ActionType$4;
39478
39473
  */
39479
39474
  const reducer$2 = (state, action) => {
39480
39475
  switch (action.type) {
39481
- case ActionType$4.SetInputValue: {
39476
+ case ActionType$2.SetInputValue: {
39482
39477
  return Object.assign(Object.assign({}, state), { inputValue: action.value });
39483
39478
  }
39484
39479
  default: {
@@ -39569,7 +39564,7 @@ const CreatableMultiselect = (props) => {
39569
39564
  }
39570
39565
  // resets text field to empty because the values have been added
39571
39566
  dispatch({
39572
- type: ActionType$4.SetInputValue,
39567
+ type: ActionType$2.SetInputValue,
39573
39568
  value: '',
39574
39569
  });
39575
39570
  };
@@ -39608,7 +39603,7 @@ const CreatableMultiselect = (props) => {
39608
39603
  else {
39609
39604
  // simply update the input value to the new input value
39610
39605
  dispatch({
39611
- type: ActionType$4.SetInputValue,
39606
+ type: ActionType$2.SetInputValue,
39612
39607
  value: newValue,
39613
39608
  });
39614
39609
  }
@@ -39659,13 +39654,13 @@ const style = `
39659
39654
  `;
39660
39655
  /* ------------- Actions ------------ */
39661
39656
  // Types of actions
39662
- var ActionType$3;
39657
+ var ActionType$1;
39663
39658
  (function (ActionType) {
39664
39659
  // Update the DBEntry
39665
39660
  ActionType["UpdateDBEntry"] = "UpdateDBEntry";
39666
39661
  // Start the save spinner
39667
39662
  ActionType["StartSave"] = "StartSave";
39668
- })(ActionType$3 || (ActionType$3 = {}));
39663
+ })(ActionType$1 || (ActionType$1 = {}));
39669
39664
  /**
39670
39665
  * Reducer that executes actions
39671
39666
  * @author Yuen Ler Chow
@@ -39674,10 +39669,10 @@ var ActionType$3;
39674
39669
  */
39675
39670
  const reducer$1 = (state, action) => {
39676
39671
  switch (action.type) {
39677
- case ActionType$3.UpdateDBEntry: {
39672
+ case ActionType$1.UpdateDBEntry: {
39678
39673
  return Object.assign(Object.assign({}, state), { entry: action.dbEntry });
39679
39674
  }
39680
- case ActionType$3.StartSave: {
39675
+ case ActionType$1.StartSave: {
39681
39676
  return Object.assign(Object.assign({}, state), { saving: true });
39682
39677
  }
39683
39678
  default: {
@@ -39712,9 +39707,9 @@ const AddOrEditDBEntry = (props) => {
39712
39707
  * Save changes to the DBEntry and then finish
39713
39708
  * @author Yuen Ler Chow
39714
39709
  */
39715
- const save = () => __awaiter$1(void 0, void 0, void 0, function* () {
39710
+ const save = () => __awaiter(void 0, void 0, void 0, function* () {
39716
39711
  // Start the save loading indicator
39717
- dispatch({ type: ActionType$3.StartSave });
39712
+ dispatch({ type: ActionType$1.StartSave });
39718
39713
  // add all default values to the entry
39719
39714
  entryFields.forEach((field) => {
39720
39715
  if (field.defaultValue && !entry[field.objectKey]) {
@@ -39875,7 +39870,7 @@ const AddOrEditDBEntry = (props) => {
39875
39870
  return (React__default["default"].createElement(RadioButton, { key: choice.value, text: choice.title, selected: entry[field.objectKey] === choice.value, onSelected: () => {
39876
39871
  entry[field.objectKey] = choice.value;
39877
39872
  dispatch({
39878
- type: ActionType$3.UpdateDBEntry,
39873
+ type: ActionType$1.UpdateDBEntry,
39879
39874
  dbEntry: entry,
39880
39875
  });
39881
39876
  }, ariaLabel: choice.title }));
@@ -39887,7 +39882,7 @@ const AddOrEditDBEntry = (props) => {
39887
39882
  React__default["default"].createElement("input", { disabled: disabled, type: "text", className: "form-control", placeholder: field.placeholder, "aria-describedby": "AddOrEditDBEntry-form-name-label", value: entry[field.objectKey] || '', onChange: (e) => {
39888
39883
  entry[field.objectKey] = (e.target.value);
39889
39884
  dispatch({
39890
- type: ActionType$3.UpdateDBEntry,
39885
+ type: ActionType$1.UpdateDBEntry,
39891
39886
  dbEntry: entry,
39892
39887
  });
39893
39888
  } }))));
@@ -39900,7 +39895,7 @@ const AddOrEditDBEntry = (props) => {
39900
39895
  entry[field.objectKey] = (e.target.value
39901
39896
  .replace(/[^0-9]/g, ''));
39902
39897
  dispatch({
39903
- type: ActionType$3.UpdateDBEntry,
39898
+ type: ActionType$1.UpdateDBEntry,
39904
39899
  dbEntry: entry,
39905
39900
  });
39906
39901
  } }))));
@@ -39930,7 +39925,7 @@ const AddOrEditDBEntry = (props) => {
39930
39925
  }
39931
39926
  // Save
39932
39927
  dispatch({
39933
- type: ActionType$3.UpdateDBEntry,
39928
+ type: ActionType$1.UpdateDBEntry,
39934
39929
  dbEntry: entry,
39935
39930
  });
39936
39931
  }, ariaLabel: choice.title }));
@@ -39945,7 +39940,7 @@ const AddOrEditDBEntry = (props) => {
39945
39940
  // Update entry and save
39946
39941
  entry[field.objectKey] = values;
39947
39942
  dispatch({
39948
- type: ActionType$3.UpdateDBEntry,
39943
+ type: ActionType$1.UpdateDBEntry,
39949
39944
  dbEntry: entry,
39950
39945
  });
39951
39946
  } })))));
@@ -39958,7 +39953,7 @@ const AddOrEditDBEntry = (props) => {
39958
39953
  React__default["default"].createElement(CreatableMultiselect, { disabled: disabled, type: DBEntryFieldType$1.NumberArray, values: entry[field.objectKey] || [], onChange: (values) => {
39959
39954
  entry[field.objectKey] = values;
39960
39955
  dispatch({
39961
- type: ActionType$3.UpdateDBEntry,
39956
+ type: ActionType$1.UpdateDBEntry,
39962
39957
  dbEntry: entry,
39963
39958
  });
39964
39959
  } })))));
@@ -39982,7 +39977,7 @@ const AddOrEditDBEntry = (props) => {
39982
39977
  return renderEntryField(field, disabled);
39983
39978
  }),
39984
39979
  React__default["default"].createElement("div", { className: "text-center mt-2" },
39985
- React__default["default"].createElement("button", { type: "button", id: "AddOrEditDBEntry-save-changes-button", className: "btn btn-primary btn-lg me-1", "aria-label": "Save changes", onClick: () => __awaiter$1(void 0, void 0, void 0, function* () {
39980
+ React__default["default"].createElement("button", { type: "button", id: "AddOrEditDBEntry-save-changes-button", className: "btn btn-primary btn-lg me-1", "aria-label": "Save changes", onClick: () => __awaiter(void 0, void 0, void 0, function* () {
39986
39981
  if (validationError) {
39987
39982
  return alert$1('Please fix the following error', validationError);
39988
39983
  }
@@ -40028,7 +40023,7 @@ const generateEndpointPath = (collectionName, adminsOnly) => {
40028
40023
  */
40029
40024
  /* ------------- Actions ------------ */
40030
40025
  // Types of actions
40031
- var ActionType$2;
40026
+ var ActionType;
40032
40027
  (function (ActionType) {
40033
40028
  // Show adder
40034
40029
  ActionType["ShowAdder"] = "ShowAdder";
@@ -40042,7 +40037,7 @@ var ActionType$2;
40042
40037
  ActionType["StartDelete"] = "StartDelete";
40043
40038
  // Finish deletion process
40044
40039
  ActionType["FinishDelete"] = "FinishDelete";
40045
- })(ActionType$2 || (ActionType$2 = {}));
40040
+ })(ActionType || (ActionType = {}));
40046
40041
  /**
40047
40042
  * Reducer that executes actions
40048
40043
  * @author Yuen Ler Chow
@@ -40051,16 +40046,16 @@ var ActionType$2;
40051
40046
  */
40052
40047
  const reducer = (state, action) => {
40053
40048
  switch (action.type) {
40054
- case ActionType$2.FinishLoading: {
40049
+ case ActionType.FinishLoading: {
40055
40050
  return Object.assign(Object.assign({}, state), { loading: false, dbEntries: action.dbEntries });
40056
40051
  }
40057
- case ActionType$2.ShowAdder: {
40052
+ case ActionType.ShowAdder: {
40058
40053
  return Object.assign(Object.assign({}, state), { adding: true, dbEntryToEdit: undefined });
40059
40054
  }
40060
- case ActionType$2.ShowEditor: {
40055
+ case ActionType.ShowEditor: {
40061
40056
  return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: action.dbEntry });
40062
40057
  }
40063
- case ActionType$2.FinishAdd: {
40058
+ case ActionType.FinishAdd: {
40064
40059
  // Handle cancel
40065
40060
  const finishedEntry = action.dbEntry;
40066
40061
  if (!finishedEntry) {
@@ -40084,10 +40079,10 @@ const reducer = (state, action) => {
40084
40079
  // Update the state
40085
40080
  return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: undefined, dbEntries: updatedDbEntries });
40086
40081
  }
40087
- case ActionType$2.StartDelete: {
40082
+ case ActionType.StartDelete: {
40088
40083
  return Object.assign(Object.assign({}, state), { loading: true });
40089
40084
  }
40090
- case ActionType$2.FinishDelete: {
40085
+ case ActionType.FinishDelete: {
40091
40086
  return Object.assign(Object.assign({}, state), { loading: false,
40092
40087
  // Remove the deleted entry from the list
40093
40088
  dbEntries: state.dbEntries.filter((entry) => {
@@ -40126,7 +40121,7 @@ const DBEntryManagerPanel = (props) => {
40126
40121
  * @author Yuen Ler Chow
40127
40122
  * @param entry the database entry to delete
40128
40123
  */
40129
- const deleteEntry = (entry) => __awaiter$1(void 0, void 0, void 0, function* () {
40124
+ const deleteEntry = (entry) => __awaiter(void 0, void 0, void 0, function* () {
40130
40125
  // Confirm
40131
40126
  const confirmed = yield confirm('Remove?', `Are you sure you want to remove this ${itemName}?`, {
40132
40127
  confirmButtonText: 'Remove Item',
@@ -40139,7 +40134,7 @@ const DBEntryManagerPanel = (props) => {
40139
40134
  try {
40140
40135
  // Start loader
40141
40136
  dispatch({
40142
- type: ActionType$2.StartDelete,
40137
+ type: ActionType.StartDelete,
40143
40138
  });
40144
40139
  // Perform deletion
40145
40140
  yield visitServerEndpoint({
@@ -40148,7 +40143,7 @@ const DBEntryManagerPanel = (props) => {
40148
40143
  });
40149
40144
  // Finish loader
40150
40145
  dispatch({
40151
- type: ActionType$2.FinishDelete,
40146
+ type: ActionType.FinishDelete,
40152
40147
  dbEntry: entry,
40153
40148
  idPropName,
40154
40149
  });
@@ -40165,7 +40160,7 @@ const DBEntryManagerPanel = (props) => {
40165
40160
  * @author Yuen Ler Chow
40166
40161
  */
40167
40162
  React.useEffect(() => {
40168
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
40163
+ (() => __awaiter(void 0, void 0, void 0, function* () {
40169
40164
  // Load list of database entries
40170
40165
  try {
40171
40166
  const data = yield visitServerEndpoint({
@@ -40177,7 +40172,7 @@ const DBEntryManagerPanel = (props) => {
40177
40172
  });
40178
40173
  // Save loaded data
40179
40174
  dispatch({
40180
- type: ActionType$2.FinishLoading,
40175
+ type: ActionType.FinishLoading,
40181
40176
  dbEntries: data,
40182
40177
  });
40183
40178
  }
@@ -40220,7 +40215,7 @@ const DBEntryManagerPanel = (props) => {
40220
40215
  React__default["default"].createElement("span", { className: "d-none d-md-inline ms-1" }, "Remove")),
40221
40216
  !disableEdit && (React__default["default"].createElement("button", { type: "button", id: `DBEntryManagerPanel-edit-with-id-${entry[idPropName]}`, className: "btn btn-primary", "aria-label": `edit db entry: ${entry[titlePropName]}`, onClick: () => {
40222
40217
  dispatch({
40223
- type: ActionType$2.ShowEditor,
40218
+ type: ActionType.ShowEditor,
40224
40219
  dbEntry: entry,
40225
40220
  });
40226
40221
  } },
@@ -40230,7 +40225,7 @@ const DBEntryManagerPanel = (props) => {
40230
40225
  React__default["default"].createElement("div", { className: "d-grid" },
40231
40226
  React__default["default"].createElement("button", { type: "button", id: "DBEntryManagerPanel-add-entry", className: "btn btn-lg btn-primary", "aria-label": `add a new ${itemName} entry to the list of entries`, onClick: () => {
40232
40227
  dispatch({
40233
- type: ActionType$2.ShowAdder,
40228
+ type: ActionType.ShowAdder,
40234
40229
  });
40235
40230
  } },
40236
40231
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faPlus, className: "me-2" }),
@@ -40242,7 +40237,7 @@ const DBEntryManagerPanel = (props) => {
40242
40237
  if (!loading && (adding || dbEntryToEdit)) {
40243
40238
  body = (React__default["default"].createElement(AddOrEditDBEntry, { saveEndpointPath: endpoint, validateEntry: validateEntry, modifyEntry: modifyEntry, entryFields: entryFields, dbEntryToEdit: dbEntryToEdit, idPropName: idPropName, entries: dbEntries, onFinished: (entry) => {
40244
40239
  dispatch({
40245
- type: ActionType$2.FinishAdd,
40240
+ type: ActionType.FinishAdd,
40246
40241
  dbEntry: entry,
40247
40242
  idPropName,
40248
40243
  });
@@ -40465,7 +40460,7 @@ const padZerosLeft = (num, numDigits) => {
40465
40460
  const LOG_REVIEW_STATUS_ROUTE = `${ROUTE_PATH_PREFIX}/logs/access_allowed`;
40466
40461
 
40467
40462
  // Stored copy of caccl functions
40468
- let _cacclGetLaunchInfo$1;
40463
+ let _cacclGetLaunchInfo;
40469
40464
  // Stored copy of dce-mango log collection
40470
40465
  let _logCollection;
40471
40466
  /*------------------------------------------------------------------------*/
@@ -40477,11 +40472,11 @@ let _logCollection;
40477
40472
  * @param req express request object
40478
40473
  * @returns object { launched, launchInfo }
40479
40474
  */
40480
- const cacclGetLaunchInfo$1 = (req) => {
40481
- if (!_cacclGetLaunchInfo$1) {
40482
- throw new ErrorWithCode$1('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$3.NoCACCLGetLaunchInfoFunction);
40475
+ const cacclGetLaunchInfo = (req) => {
40476
+ if (!_cacclGetLaunchInfo) {
40477
+ throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
40483
40478
  }
40484
- return _cacclGetLaunchInfo$1(req);
40479
+ return _cacclGetLaunchInfo(req);
40485
40480
  };
40486
40481
  /**
40487
40482
  * Get log collection
@@ -40513,7 +40508,7 @@ const internalGetLogCollection = () => {
40513
40508
  * to review logs
40514
40509
  */
40515
40510
  const initServer = (opts) => {
40516
- _cacclGetLaunchInfo$1 = opts.getLaunchInfo;
40511
+ _cacclGetLaunchInfo = opts.getLaunchInfo;
40517
40512
  _logCollection = opts.logCollection;
40518
40513
  /*----------------------------------------*/
40519
40514
  /* Logging */
@@ -40537,18 +40532,18 @@ const initServer = (opts) => {
40537
40532
  * @param {LogAction} [action] the type of action performed on the target
40538
40533
  * @returns {Log}
40539
40534
  */
40540
- opts.app.post(LOG_ROUTE_PATH, genRouteHandler$1({
40535
+ opts.app.post(LOG_ROUTE_PATH, genRouteHandler({
40541
40536
  paramTypes: {
40542
- context: ParamType$3.String,
40543
- subcontext: ParamType$3.String,
40544
- tags: ParamType$3.JSON,
40545
- level: ParamType$3.String,
40546
- metadata: ParamType$3.JSON,
40547
- errorMessage: ParamType$3.StringOptional,
40548
- errorCode: ParamType$3.StringOptional,
40549
- errorStack: ParamType$3.StringOptional,
40550
- target: ParamType$3.StringOptional,
40551
- action: ParamType$3.StringOptional,
40537
+ context: ParamType$1.String,
40538
+ subcontext: ParamType$1.String,
40539
+ tags: ParamType$1.JSON,
40540
+ level: ParamType$1.String,
40541
+ metadata: ParamType$1.JSON,
40542
+ errorMessage: ParamType$1.StringOptional,
40543
+ errorCode: ParamType$1.StringOptional,
40544
+ errorStack: ParamType$1.StringOptional,
40545
+ target: ParamType$1.StringOptional,
40546
+ action: ParamType$1.StringOptional,
40552
40547
  },
40553
40548
  handler: ({ params, logServerEvent }) => {
40554
40549
  // Create log info
@@ -40594,7 +40589,7 @@ const initServer = (opts) => {
40594
40589
  * @param isAdmin if true, the user is an admin
40595
40590
  * @returns true if the user can review logs
40596
40591
  */
40597
- const canReviewLogs = (userId, isAdmin) => __awaiter$1(void 0, void 0, void 0, function* () {
40592
+ const canReviewLogs = (userId, isAdmin) => __awaiter(void 0, void 0, void 0, function* () {
40598
40593
  // Immediately deny access if user is not an admin
40599
40594
  if (!isAdmin) {
40600
40595
  return false;
@@ -40626,8 +40621,8 @@ const initServer = (opts) => {
40626
40621
  * @author Gabe Abrams
40627
40622
  * @returns {boolean} true if user has access
40628
40623
  */
40629
- opts.app.get(LOG_REVIEW_STATUS_ROUTE, genRouteHandler$1({
40630
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
40624
+ opts.app.get(LOG_REVIEW_STATUS_ROUTE, genRouteHandler({
40625
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
40631
40626
  const { userId, isAdmin } = params;
40632
40627
  const canReview = yield canReviewLogs(userId, isAdmin);
40633
40628
  return canReview;
@@ -40640,18 +40635,18 @@ const initServer = (opts) => {
40640
40635
  * @param {number} month the month to query (e.g. 1 = January)
40641
40636
  * @returns {Log[]} list of logs from the given month
40642
40637
  */
40643
- opts.app.get(`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`, genRouteHandler$1({
40638
+ opts.app.get(`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`, genRouteHandler({
40644
40639
  paramTypes: {
40645
- year: ParamType$3.Int,
40646
- month: ParamType$3.Int,
40640
+ year: ParamType$1.Int,
40641
+ month: ParamType$1.Int,
40647
40642
  },
40648
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
40643
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
40649
40644
  // Get user info
40650
40645
  const { year, month, userId, isAdmin, } = params;
40651
40646
  // Validate user
40652
40647
  const canReview = yield canReviewLogs(userId, isAdmin);
40653
40648
  if (!canReview) {
40654
- throw new ErrorWithCode$1('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$3.NotAllowedToReviewLogs);
40649
+ throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
40655
40650
  }
40656
40651
  // Query for logs
40657
40652
  const logs = yield _logCollection.find({
@@ -40677,7 +40672,7 @@ const initServer = (opts) => {
40677
40672
  * @param [opts.status=500] the https status code to use
40678
40673
  * defined)
40679
40674
  */
40680
- const handleError$1 = (res, error) => {
40675
+ const handleError = (res, error) => {
40681
40676
  // Get the error message
40682
40677
  let message;
40683
40678
  if (error && error.message) {
@@ -40692,7 +40687,7 @@ const handleError$1 = (res, error) => {
40692
40687
  message = 'An unknown error occurred.';
40693
40688
  }
40694
40689
  // Get the error code
40695
- const code = (error.code || ReactKitErrorCode$3.NoCode);
40690
+ const code = (error.code || ReactKitErrorCode$1.NoCode);
40696
40691
  // Get the status code
40697
40692
  const status = (error.status || 500);
40698
40693
  // Respond to user
@@ -40717,7 +40712,7 @@ const handleError$1 = (res, error) => {
40717
40712
  * @param res express response
40718
40713
  * @param body the body of the response to send to the client
40719
40714
  */
40720
- const handleSuccess$1 = (res, body) => {
40715
+ const handleSuccess = (res, body) => {
40721
40716
  // Send a http 200 json response
40722
40717
  res.json({
40723
40718
  // Include the body as a parameter
@@ -40746,7 +40741,7 @@ const genErrorPage = (opts = {}) => {
40746
40741
  const title = ((_a = opts.title) !== null && _a !== void 0 ? _a : 'An Error Occurred');
40747
40742
  const pageTitle = ((_b = opts.pageTitle) !== null && _b !== void 0 ? _b : title);
40748
40743
  const description = ((_c = opts.description) !== null && _c !== void 0 ? _c : 'An unknown server error occurred. Please contact support.');
40749
- const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$3.NoCode);
40744
+ const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$1.NoCode);
40750
40745
  return `
40751
40746
  <head>
40752
40747
  <!-- Metadata -->
@@ -40983,9 +40978,9 @@ const parseUserAgent = (userAgent) => {
40983
40978
  * userLastName, isLearner, isTTM, isAdmin, and any other variables that
40984
40979
  * are directly added to the session, if the user does have a session.
40985
40980
  */
40986
- const genRouteHandler$1 = (opts) => {
40981
+ const genRouteHandler = (opts) => {
40987
40982
  // Return a route handler
40988
- return (req, res, next) => __awaiter$1(void 0, void 0, void 0, function* () {
40983
+ return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
40989
40984
  var _a, _b;
40990
40985
  // Output params
40991
40986
  const output = {};
@@ -41001,17 +40996,17 @@ const genRouteHandler$1 = (opts) => {
41001
40996
  || req.query[name]
41002
40997
  || req.body[name]);
41003
40998
  // Parse
41004
- if (type === ParamType$3.Boolean || type === ParamType$3.BooleanOptional) {
40999
+ if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
41005
41000
  // Boolean
41006
41001
  // Handle case where value doesn't exist
41007
41002
  if (value === undefined) {
41008
- if (type === ParamType$3.BooleanOptional) {
41003
+ if (type === ParamType$1.BooleanOptional) {
41009
41004
  output[name] = undefined;
41010
41005
  }
41011
41006
  else {
41012
- return handleError$1(res, {
41007
+ return handleError(res, {
41013
41008
  message: `Parameter ${name} is required, but it was not included.`,
41014
- code: ReactKitErrorCode$3.MissingParameter,
41009
+ code: ReactKitErrorCode$1.MissingParameter,
41015
41010
  status: 422,
41016
41011
  });
41017
41012
  }
@@ -41032,17 +41027,17 @@ const genRouteHandler$1 = (opts) => {
41032
41027
  ].indexOf(simpleVal) >= 0);
41033
41028
  }
41034
41029
  }
41035
- else if (type === ParamType$3.Float || type === ParamType$3.FloatOptional) {
41030
+ else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
41036
41031
  // Float
41037
41032
  // Handle case where value doesn't exist
41038
41033
  if (value === undefined) {
41039
- if (type === ParamType$3.FloatOptional) {
41034
+ if (type === ParamType$1.FloatOptional) {
41040
41035
  output[name] = undefined;
41041
41036
  }
41042
41037
  else {
41043
- return handleError$1(res, {
41038
+ return handleError(res, {
41044
41039
  message: `Parameter ${name} is required, but it was not included.`,
41045
- code: ReactKitErrorCode$3.MissingParameter,
41040
+ code: ReactKitErrorCode$1.MissingParameter,
41046
41041
  status: 422,
41047
41042
  });
41048
41043
  }
@@ -41053,24 +41048,24 @@ const genRouteHandler$1 = (opts) => {
41053
41048
  }
41054
41049
  else {
41055
41050
  // Issue!
41056
- return handleError$1(res, {
41051
+ return handleError(res, {
41057
41052
  message: `Request data was malformed: ${name} was not a valid float.`,
41058
- code: ReactKitErrorCode$3.InvalidParameter,
41053
+ code: ReactKitErrorCode$1.InvalidParameter,
41059
41054
  status: 422,
41060
41055
  });
41061
41056
  }
41062
41057
  }
41063
- else if (type === ParamType$3.Int || type === ParamType$3.IntOptional) {
41058
+ else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
41064
41059
  // Int
41065
41060
  // Handle case where value doesn't exist
41066
41061
  if (value === undefined) {
41067
- if (type === ParamType$3.IntOptional) {
41062
+ if (type === ParamType$1.IntOptional) {
41068
41063
  output[name] = undefined;
41069
41064
  }
41070
41065
  else {
41071
- return handleError$1(res, {
41066
+ return handleError(res, {
41072
41067
  message: `Parameter ${name} is required, but it was not included.`,
41073
- code: ReactKitErrorCode$3.MissingParameter,
41068
+ code: ReactKitErrorCode$1.MissingParameter,
41074
41069
  status: 422,
41075
41070
  });
41076
41071
  }
@@ -41081,24 +41076,24 @@ const genRouteHandler$1 = (opts) => {
41081
41076
  }
41082
41077
  else {
41083
41078
  // Issue!
41084
- return handleError$1(res, {
41079
+ return handleError(res, {
41085
41080
  message: `Request data was malformed: ${name} was not a valid int.`,
41086
- code: ReactKitErrorCode$3.InvalidParameter,
41081
+ code: ReactKitErrorCode$1.InvalidParameter,
41087
41082
  status: 422,
41088
41083
  });
41089
41084
  }
41090
41085
  }
41091
- else if (type === ParamType$3.JSON || type === ParamType$3.JSONOptional) {
41086
+ else if (type === ParamType$1.JSON || type === ParamType$1.JSONOptional) {
41092
41087
  // Stringified JSON
41093
41088
  // Handle case where value doesn't exist
41094
41089
  if (value === undefined) {
41095
- if (type === ParamType$3.JSONOptional) {
41090
+ if (type === ParamType$1.JSONOptional) {
41096
41091
  output[name] = undefined;
41097
41092
  }
41098
41093
  else {
41099
- return handleError$1(res, {
41094
+ return handleError(res, {
41100
41095
  message: `Parameter ${name} is required, but it was not included.`,
41101
- code: ReactKitErrorCode$3.MissingParameter,
41096
+ code: ReactKitErrorCode$1.MissingParameter,
41102
41097
  status: 422,
41103
41098
  });
41104
41099
  }
@@ -41110,25 +41105,25 @@ const genRouteHandler$1 = (opts) => {
41110
41105
  output[name] = JSON.parse(String(value));
41111
41106
  }
41112
41107
  catch (err) {
41113
- return handleError$1(res, {
41108
+ return handleError(res, {
41114
41109
  message: `Request data was malformed: ${name} was not a valid JSON payload.`,
41115
- code: ReactKitErrorCode$3.InvalidParameter,
41110
+ code: ReactKitErrorCode$1.InvalidParameter,
41116
41111
  status: 422,
41117
41112
  });
41118
41113
  }
41119
41114
  }
41120
41115
  }
41121
- else if (type === ParamType$3.String || type === ParamType$3.StringOptional) {
41116
+ else if (type === ParamType$1.String || type === ParamType$1.StringOptional) {
41122
41117
  // String
41123
41118
  // Handle case where value doesn't exist
41124
41119
  if (value === undefined) {
41125
- if (type === ParamType$3.StringOptional) {
41120
+ if (type === ParamType$1.StringOptional) {
41126
41121
  output[name] = undefined;
41127
41122
  }
41128
41123
  else {
41129
- return handleError$1(res, {
41124
+ return handleError(res, {
41130
41125
  message: `Parameter ${name} is required, but it was not included.`,
41131
- code: ReactKitErrorCode$3.MissingParameter,
41126
+ code: ReactKitErrorCode$1.MissingParameter,
41132
41127
  status: 422,
41133
41128
  });
41134
41129
  }
@@ -41141,9 +41136,9 @@ const genRouteHandler$1 = (opts) => {
41141
41136
  }
41142
41137
  else {
41143
41138
  // No valid data type
41144
- return handleError$1(res, {
41139
+ return handleError(res, {
41145
41140
  message: `An internal error occurred: we could not determine the type of ${name}.`,
41146
- code: ReactKitErrorCode$3.InvalidParameter,
41141
+ code: ReactKitErrorCode$1.InvalidParameter,
41147
41142
  status: 422,
41148
41143
  });
41149
41144
  }
@@ -41152,15 +41147,15 @@ const genRouteHandler$1 = (opts) => {
41152
41147
  /* Launch Info */
41153
41148
  /*----------------------------------------*/
41154
41149
  // Get launch info
41155
- const { launched, launchInfo } = cacclGetLaunchInfo$1(req);
41150
+ const { launched, launchInfo } = cacclGetLaunchInfo(req);
41156
41151
  if (
41157
41152
  // Not launched
41158
41153
  (!launched || !launchInfo)
41159
41154
  // Not skipping the session check
41160
41155
  && !opts.skipSessionCheck) {
41161
- return handleError$1(res, {
41156
+ return handleError(res, {
41162
41157
  message: 'Your session has expired. Please refresh the page and try again.',
41163
- code: ReactKitErrorCode$3.SessionExpired,
41158
+ code: ReactKitErrorCode$1.SessionExpired,
41164
41159
  status: 401,
41165
41160
  });
41166
41161
  }
@@ -41178,9 +41173,9 @@ const genRouteHandler$1 = (opts) => {
41178
41173
  && !launchInfo.isAdmin))
41179
41174
  // Not skipping the session check
41180
41175
  && !opts.skipSessionCheck) {
41181
- return handleError$1(res, {
41176
+ return handleError(res, {
41182
41177
  message: 'Your session was invalid. Please refresh the page and try again.',
41183
- code: ReactKitErrorCode$3.SessionExpired,
41178
+ code: ReactKitErrorCode$1.SessionExpired,
41184
41179
  status: 401,
41185
41180
  });
41186
41181
  }
@@ -41237,9 +41232,9 @@ const genRouteHandler$1 = (opts) => {
41237
41232
  && !output.isTTM
41238
41233
  && !output.isAdmin) {
41239
41234
  // Course of interest is not the launch course
41240
- return handleError$1(res, {
41235
+ return handleError(res, {
41241
41236
  message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
41242
- code: ReactKitErrorCode$3.WrongCourse,
41237
+ code: ReactKitErrorCode$1.WrongCourse,
41243
41238
  status: 401,
41244
41239
  });
41245
41240
  }
@@ -41257,9 +41252,9 @@ const genRouteHandler$1 = (opts) => {
41257
41252
  // User is not an admin
41258
41253
  && !output.isAdmin)) {
41259
41254
  // User does not have access
41260
- return handleError$1(res, {
41255
+ return handleError(res, {
41261
41256
  message: 'This action is only allowed if you are a teaching team member for the course. Please go back to Canvas, log in as a teaching team member, and try again.',
41262
- code: ReactKitErrorCode$3.NotTTM,
41257
+ code: ReactKitErrorCode$1.NotTTM,
41263
41258
  status: 401,
41264
41259
  });
41265
41260
  }
@@ -41270,9 +41265,9 @@ const genRouteHandler$1 = (opts) => {
41270
41265
  // User is not an admin
41271
41266
  && !output.isAdmin) {
41272
41267
  // User does not have access
41273
- return handleError$1(res, {
41268
+ return handleError(res, {
41274
41269
  message: 'This action is only allowed if you are a Canvas admin. Please go back to Canvas, log in as an admin, and try again.',
41275
- code: ReactKitErrorCode$3.NotAdmin,
41270
+ code: ReactKitErrorCode$1.NotAdmin,
41276
41271
  status: 401,
41277
41272
  });
41278
41273
  }
@@ -41284,7 +41279,7 @@ const genRouteHandler$1 = (opts) => {
41284
41279
  * Log an event on the server
41285
41280
  * @author Gabe Abrams
41286
41281
  */
41287
- const logServerEvent = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
41282
+ const logServerEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
41288
41283
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
41289
41284
  // NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
41290
41285
  // that indicates that this is actually a client event, but we don't
@@ -41328,7 +41323,7 @@ const genRouteHandler$1 = (opts) => {
41328
41323
  ? {
41329
41324
  type: LogType$1.Error,
41330
41325
  errorMessage: (_j = opts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
41331
- errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$3.NoCode,
41326
+ errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
41332
41327
  errorStack: (_l = opts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
41333
41328
  }
41334
41329
  : {
@@ -41488,13 +41483,13 @@ const genRouteHandler$1 = (opts) => {
41488
41483
  });
41489
41484
  // Send results to client (only if next wasn't called)
41490
41485
  if (!responseSent) {
41491
- return handleSuccess$1(res, results !== null && results !== void 0 ? results : undefined);
41486
+ return handleSuccess(res, results !== null && results !== void 0 ? results : undefined);
41492
41487
  }
41493
41488
  }
41494
41489
  catch (err) {
41495
41490
  // Send error to client (only if next wasn't called)
41496
41491
  if (!responseSent) {
41497
- handleError$1(res, err);
41492
+ handleError(res, err);
41498
41493
  // Log server-side error
41499
41494
  logServerEvent({
41500
41495
  context: LogBuiltInMetadata.Context.ServerEndpointError,
@@ -41533,7 +41528,7 @@ const startMinWait = (minWaitMs) => {
41533
41528
  * Finish the remaining time to wait
41534
41529
  * @author Gabe Abrams
41535
41530
  */
41536
- return () => __awaiter$1(void 0, void 0, void 0, function* () {
41531
+ return () => __awaiter(void 0, void 0, void 0, function* () {
41537
41532
  const endTimestamp = Date.now();
41538
41533
  // Calculate remaining time to wait
41539
41534
  const elapsedTimeMs = (endTimestamp - startTimestamp);
@@ -41620,7 +41615,7 @@ const onlyKeepLetters = (str) => {
41620
41615
  * once
41621
41616
  * @returns array of resolved values in the same order as the task functions
41622
41617
  */
41623
- const parallelLimit = (taskFunctions, limit) => __awaiter$1(void 0, void 0, void 0, function* () {
41618
+ const parallelLimit = (taskFunctions, limit) => __awaiter(void 0, void 0, void 0, function* () {
41624
41619
  const results = [];
41625
41620
  // Wait until finished with all tasks
41626
41621
  yield new Promise((resolve) => {
@@ -41631,7 +41626,7 @@ const parallelLimit = (taskFunctions, limit) => __awaiter$1(void 0, void 0, void
41631
41626
  * Start the next task
41632
41627
  * @author Gabe Abrams
41633
41628
  */
41634
- const startTask = () => __awaiter$1(void 0, void 0, void 0, function* () {
41629
+ const startTask = () => __awaiter(void 0, void 0, void 0, function* () {
41635
41630
  const taskIndex = nextTaskIndex++;
41636
41631
  // Get the task
41637
41632
  const taskFunction = taskFunctions[taskIndex];
@@ -41684,7 +41679,7 @@ let canReview = undefined;
41684
41679
  * @author Gabe Abrams
41685
41680
  * @returns true if current user can review logs
41686
41681
  */
41687
- const canReviewLogs = () => __awaiter$1(void 0, void 0, void 0, function* () {
41682
+ const canReviewLogs = () => __awaiter(void 0, void 0, void 0, function* () {
41688
41683
  // If cached, use that value
41689
41684
  if (canReview !== undefined) {
41690
41685
  return canReview;
@@ -41798,649 +41793,6 @@ const getLocalTimeInfo = (dateOrTimestamp) => {
41798
41793
  };
41799
41794
  };
41800
41795
 
41801
- /******************************************************************************
41802
- Copyright (c) Microsoft Corporation.
41803
-
41804
- Permission to use, copy, modify, and/or distribute this software for any
41805
- purpose with or without fee is hereby granted.
41806
-
41807
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
41808
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41809
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41810
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41811
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41812
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41813
- PERFORMANCE OF THIS SOFTWARE.
41814
- ***************************************************************************** */
41815
-
41816
- function __awaiter(thisArg, _arguments, P, generator) {
41817
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41818
- return new (P || (P = Promise))(function (resolve, reject) {
41819
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
41820
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41821
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41822
- step((generator = generator.apply(thisArg, _arguments || [])).next());
41823
- });
41824
- }
41825
-
41826
- // Highest error code = DRK10
41827
- /**
41828
- * List of error codes built into the react kit
41829
- * @author Gabe Abrams
41830
- */
41831
- var ReactKitErrorCode;
41832
- (function (ReactKitErrorCode) {
41833
- ReactKitErrorCode["NoResponse"] = "DRK1";
41834
- ReactKitErrorCode["NoCode"] = "DRK2";
41835
- ReactKitErrorCode["SessionExpired"] = "DRK3";
41836
- ReactKitErrorCode["MissingParameter"] = "DRK4";
41837
- ReactKitErrorCode["InvalidParameter"] = "DRK5";
41838
- ReactKitErrorCode["WrongCourse"] = "DRK6";
41839
- ReactKitErrorCode["NoCACCLSendRequestFunction"] = "DRK7";
41840
- ReactKitErrorCode["NoCACCLGetLaunchInfoFunction"] = "DRK8";
41841
- ReactKitErrorCode["NotTTM"] = "DRK9";
41842
- ReactKitErrorCode["NotAdmin"] = "DRK10";
41843
- })(ReactKitErrorCode || (ReactKitErrorCode = {}));
41844
- var ReactKitErrorCode$1 = ReactKitErrorCode;
41845
-
41846
- /**
41847
- * Types of buttons in the modal
41848
- * @author Gabe Abrams
41849
- */
41850
- var ModalButtonType;
41851
- (function (ModalButtonType) {
41852
- ModalButtonType["Okay"] = "okay";
41853
- ModalButtonType["Cancel"] = "cancel";
41854
- ModalButtonType["Yes"] = "yes";
41855
- ModalButtonType["No"] = "no";
41856
- ModalButtonType["Abandon"] = "abandon";
41857
- ModalButtonType["GoBack"] = "goBack";
41858
- ModalButtonType["Continue"] = "continue";
41859
- ModalButtonType["ImSure"] = "imSure";
41860
- ModalButtonType["Delete"] = "delete";
41861
- ModalButtonType["Confirm"] = "confirm";
41862
- })(ModalButtonType || (ModalButtonType = {}));
41863
- var ModalButtonType$1 = ModalButtonType;
41864
-
41865
- /**
41866
- * Types of modals
41867
- * @author Gabe Abrams
41868
- */
41869
- var ModalType;
41870
- (function (ModalType) {
41871
- ModalType["Okay"] = "okay";
41872
- ModalType["OkayCancel"] = "okay-cancel";
41873
- ModalType["YesNo"] = "yes-no";
41874
- ModalType["YesNoCancel"] = "yes-no-cancel";
41875
- ModalType["AbandonGoBack"] = "abandon-goBack";
41876
- ModalType["ImSureCancel"] = "imSure-cancel";
41877
- ModalType["DeleteCancel"] = "delete-cancel";
41878
- ModalType["ConfirmCancel"] = "confirm-cancel";
41879
- ModalType["NoButtons"] = "-";
41880
- })(ModalType || (ModalType = {}));
41881
- var ModalType$1 = ModalType;
41882
-
41883
- /**
41884
- * Bootstrap variants
41885
- * @author Gabe Abrams
41886
- */
41887
- var Variant;
41888
- (function (Variant) {
41889
- Variant["Primary"] = "primary";
41890
- Variant["Secondary"] = "secondary";
41891
- Variant["Success"] = "success";
41892
- Variant["Warning"] = "warning";
41893
- Variant["Info"] = "info";
41894
- Variant["Danger"] = "danger";
41895
- Variant["Light"] = "light";
41896
- Variant["Dark"] = "dark";
41897
- })(Variant || (Variant = {}));
41898
- var Variant$1 = Variant;
41899
-
41900
- /**
41901
- * Modal sizes
41902
- * @author Gabe Abrams
41903
- */
41904
- var ModalSize;
41905
- (function (ModalSize) {
41906
- ModalSize["Small"] = "sm";
41907
- ModalSize["Medium"] = "md";
41908
- ModalSize["Large"] = "lg";
41909
- ModalSize["ExtraLarge"] = "xl";
41910
- })(ModalSize || (ModalSize = {}));
41911
- // Modal type to list of buttons
41912
- ({
41913
- [ModalType$1.Okay]: [
41914
- ModalButtonType$1.Okay,
41915
- ],
41916
- [ModalType$1.OkayCancel]: [
41917
- ModalButtonType$1.Okay,
41918
- ModalButtonType$1.Cancel,
41919
- ],
41920
- [ModalType$1.YesNo]: [
41921
- ModalButtonType$1.Yes,
41922
- ModalButtonType$1.No,
41923
- ],
41924
- [ModalType$1.YesNoCancel]: [
41925
- ModalButtonType$1.Yes,
41926
- ModalButtonType$1.No,
41927
- ModalButtonType$1.Cancel,
41928
- ],
41929
- [ModalType$1.AbandonGoBack]: [
41930
- ModalButtonType$1.Abandon,
41931
- ModalButtonType$1.GoBack,
41932
- ],
41933
- [ModalType$1.ImSureCancel]: [
41934
- ModalButtonType$1.ImSure,
41935
- ModalButtonType$1.Cancel,
41936
- ],
41937
- [ModalType$1.DeleteCancel]: [
41938
- ModalButtonType$1.Delete,
41939
- ModalButtonType$1.Cancel,
41940
- ],
41941
- [ModalType$1.ConfirmCancel]: [
41942
- ModalButtonType$1.Confirm,
41943
- ModalButtonType$1.Cancel,
41944
- ],
41945
- });
41946
- // Button type styling and labels
41947
- ({
41948
- [ModalButtonType$1.Okay]: {
41949
- label: 'Okay',
41950
- variant: Variant$1.Dark,
41951
- },
41952
- [ModalButtonType$1.Cancel]: {
41953
- label: 'Cancel',
41954
- variant: Variant$1.Secondary,
41955
- },
41956
- [ModalButtonType$1.Yes]: {
41957
- label: 'Yes',
41958
- variant: Variant$1.Dark,
41959
- },
41960
- [ModalButtonType$1.No]: {
41961
- label: 'No',
41962
- variant: Variant$1.Secondary,
41963
- },
41964
- [ModalButtonType$1.Abandon]: {
41965
- label: 'Abandon Changes',
41966
- variant: Variant$1.Warning,
41967
- },
41968
- [ModalButtonType$1.GoBack]: {
41969
- label: 'Go Back',
41970
- variant: Variant$1.Secondary,
41971
- },
41972
- [ModalButtonType$1.Continue]: {
41973
- label: 'Continue',
41974
- variant: Variant$1.Dark,
41975
- },
41976
- [ModalButtonType$1.ImSure]: {
41977
- label: 'I am sure',
41978
- variant: Variant$1.Warning,
41979
- },
41980
- [ModalButtonType$1.Delete]: {
41981
- label: 'Yes, Delete',
41982
- variant: Variant$1.Danger,
41983
- },
41984
- [ModalButtonType$1.Confirm]: {
41985
- label: 'Confirm',
41986
- variant: Variant$1.Dark,
41987
- },
41988
- });
41989
-
41990
- /**
41991
- * An error with a code
41992
- * @author Gabe Abrams
41993
- */
41994
- class ErrorWithCode extends Error {
41995
- constructor(message, code) {
41996
- super(message);
41997
- this.name = 'ErrorWithCode';
41998
- this.code = code;
41999
- }
42000
- }
42001
-
42002
- /**
42003
- * Copiable text box
42004
- * @author Gabe Abrams
42005
- */
42006
- /* ------------- Actions ------------ */
42007
- // Types of actions
42008
- var ActionType$1;
42009
- (function (ActionType) {
42010
- // Indicate that the text was recently copied
42011
- ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
42012
- // Clear the status
42013
- ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
42014
- })(ActionType$1 || (ActionType$1 = {}));
42015
-
42016
- /**
42017
- * Reusable nested item picker
42018
- * @author Yuen Ler Chow
42019
- */
42020
- /* ------------- Actions ------------ */
42021
- // Types of actions
42022
- var ActionType;
42023
- (function (ActionType) {
42024
- // Toggle whether the children are being shown
42025
- ActionType["ToggleItems"] = "toggle-items";
42026
- })(ActionType || (ActionType = {}));
42027
-
42028
- // Import custom error
42029
- // Stored copy of caccl functions
42030
- let _cacclGetLaunchInfo;
42031
- /*------------------------------------------------------------------------*/
42032
- /* Helpers */
42033
- /*------------------------------------------------------------------------*/
42034
- /**
42035
- * Get launch info via CACCL
42036
- * @author Gabe Abrams
42037
- * @param req express request object
42038
- * @returns object { launched, launchInfo }
42039
- */
42040
- const cacclGetLaunchInfo = (req) => {
42041
- {
42042
- throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
42043
- }
42044
- };
42045
-
42046
- /**
42047
- * Server-side API param types
42048
- * @author Gabe Abrams
42049
- */
42050
- var ParamType;
42051
- (function (ParamType) {
42052
- ParamType["Boolean"] = "boolean";
42053
- ParamType["BooleanOptional"] = "boolean-optional";
42054
- ParamType["Float"] = "float";
42055
- ParamType["FloatOptional"] = "float-optional";
42056
- ParamType["Int"] = "int";
42057
- ParamType["IntOptional"] = "int-optional";
42058
- ParamType["JSON"] = "json";
42059
- ParamType["JSONOptional"] = "json-optional";
42060
- ParamType["String"] = "string";
42061
- ParamType["StringOptional"] = "string-optional";
42062
- })(ParamType || (ParamType = {}));
42063
- var ParamType$1 = ParamType;
42064
-
42065
- // Import shared types
42066
- /**
42067
- * Handle an error and respond to the client
42068
- * @author Gabe Abrams
42069
- * @param res express response
42070
- * @param error error info
42071
- * @param opts.err the error to send to the client
42072
- * or the error message
42073
- * @param [opts.code] an error code (only used if err.code is not
42074
- * included)
42075
- * @param [opts.status=500] the https status code to use
42076
- * defined)
42077
- */
42078
- const handleError = (res, error) => {
42079
- // Get the error message
42080
- let message;
42081
- if (error && error.message) {
42082
- message = (error.message || 'An unknown error occurred.');
42083
- }
42084
- else if (typeof error === 'string') {
42085
- message = (error.trim().length > 0
42086
- ? error
42087
- : 'An unknown error occurred.');
42088
- }
42089
- else {
42090
- message = 'An unknown error occurred.';
42091
- }
42092
- // Get the error code
42093
- const code = (error.code || ReactKitErrorCode$1.NoCode);
42094
- // Get the status code
42095
- const status = (error.status || 500);
42096
- // Respond to user
42097
- res
42098
- // Set the http status code
42099
- .status(status)
42100
- // Send a JSON response
42101
- .json({
42102
- // Error message
42103
- message,
42104
- // Error code
42105
- code,
42106
- // Success = false flag so client can detect server-side errors
42107
- success: false,
42108
- });
42109
- return undefined;
42110
- };
42111
-
42112
- /**
42113
- * Send successful API response
42114
- * @author Gabe Abrams
42115
- * @param res express response
42116
- * @param body the body of the response to send to the client
42117
- */
42118
- const handleSuccess = (res, body) => {
42119
- // Send a http 200 json response
42120
- res.json({
42121
- // Include the body as a parameter
42122
- body,
42123
- // Success = true flag so client can detect successful responses
42124
- success: true,
42125
- });
42126
- return undefined;
42127
- };
42128
-
42129
- /**
42130
- * Generate an express API route handler
42131
- * @author Gabe Abrams
42132
- * @param opts object containing all arguments
42133
- * @param opts.paramTypes map containing the types for each parameter that is
42134
- * included in the request (map: param name => type)
42135
- * @param opts.handler function that processes the request
42136
- * @returns express route handler that takes the following arguments:
42137
- * params (map: param name => value), handleSuccess (function for handling
42138
- * successful requests), handleError (function for handling failed requests),
42139
- * req (express request object), res (express response object),
42140
- * next (express next function). Params also has userId, userFirstName,
42141
- * userLastName, isLearner, isTTM, isAdmin, and any other variables that
42142
- * are directly added to the session
42143
- */
42144
- const genRouteHandler = (opts) => {
42145
- // Return a route handler
42146
- return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
42147
- var _a, _b;
42148
- // Output params
42149
- const output = {};
42150
- /*----------------------------------------*/
42151
- /* Parse Params */
42152
- /*----------------------------------------*/
42153
- // Process items one by one
42154
- const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
42155
- for (let i = 0; i < paramList.length; i++) {
42156
- const [name, type] = paramList[i];
42157
- // Find the value as a string
42158
- const value = (req.params[name]
42159
- || req.query[name]
42160
- || req.body[name]);
42161
- // Parse
42162
- if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
42163
- // Boolean
42164
- // Handle case where value doesn't exist
42165
- if (value === undefined) {
42166
- if (type === ParamType$1.BooleanOptional) {
42167
- output[name] = undefined;
42168
- }
42169
- else {
42170
- return handleError(res, {
42171
- message: `Parameter ${name} is required, but it was not included.`,
42172
- code: ReactKitErrorCode$1.MissingParameter,
42173
- status: 422,
42174
- });
42175
- }
42176
- }
42177
- else {
42178
- // Value exists
42179
- // Simplify value
42180
- const simpleVal = (String(value)
42181
- .trim()
42182
- .toLowerCase());
42183
- // Parse
42184
- output[name] = ([
42185
- 'true',
42186
- 'yes',
42187
- 'y',
42188
- '1',
42189
- 't',
42190
- ].indexOf(simpleVal) >= 0);
42191
- }
42192
- }
42193
- else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
42194
- // Float
42195
- // Handle case where value doesn't exist
42196
- if (value === undefined) {
42197
- if (type === ParamType$1.FloatOptional) {
42198
- output[name] = undefined;
42199
- }
42200
- else {
42201
- return handleError(res, {
42202
- message: `Parameter ${name} is required, but it was not included.`,
42203
- code: ReactKitErrorCode$1.MissingParameter,
42204
- status: 422,
42205
- });
42206
- }
42207
- }
42208
- else if (!Number.isNaN(Number.parseFloat(String(value)))) {
42209
- // Value is a number
42210
- output[name] = Number.parseFloat(String(value));
42211
- }
42212
- else {
42213
- // Issue!
42214
- return handleError(res, {
42215
- message: `Request data was malformed: ${name} was not a valid float.`,
42216
- code: ReactKitErrorCode$1.InvalidParameter,
42217
- status: 422,
42218
- });
42219
- }
42220
- }
42221
- else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
42222
- // Int
42223
- // Handle case where value doesn't exist
42224
- if (value === undefined) {
42225
- if (type === ParamType$1.IntOptional) {
42226
- output[name] = undefined;
42227
- }
42228
- else {
42229
- return handleError(res, {
42230
- message: `Parameter ${name} is required, but it was not included.`,
42231
- code: ReactKitErrorCode$1.MissingParameter,
42232
- status: 422,
42233
- });
42234
- }
42235
- }
42236
- else if (!Number.isNaN(Number.parseInt(String(value), 10))) {
42237
- // Value is a number
42238
- output[name] = Number.parseInt(String(value), 10);
42239
- }
42240
- else {
42241
- // Issue!
42242
- return handleError(res, {
42243
- message: `Request data was malformed: ${name} was not a valid int.`,
42244
- code: ReactKitErrorCode$1.InvalidParameter,
42245
- status: 422,
42246
- });
42247
- }
42248
- }
42249
- else if (type === ParamType$1.JSON || type === ParamType$1.JSONOptional) {
42250
- // Stringified JSON
42251
- // Handle case where value doesn't exist
42252
- if (value === undefined) {
42253
- if (type === ParamType$1.JSONOptional) {
42254
- output[name] = undefined;
42255
- }
42256
- else {
42257
- return handleError(res, {
42258
- message: `Parameter ${name} is required, but it was not included.`,
42259
- code: ReactKitErrorCode$1.MissingParameter,
42260
- status: 422,
42261
- });
42262
- }
42263
- }
42264
- else {
42265
- // Value exists
42266
- // Parse
42267
- try {
42268
- output[name] = JSON.parse(String(value));
42269
- }
42270
- catch (err) {
42271
- return handleError(res, {
42272
- message: `Request data was malformed: ${name} was not a valid JSON payload.`,
42273
- code: ReactKitErrorCode$1.InvalidParameter,
42274
- status: 422,
42275
- });
42276
- }
42277
- }
42278
- }
42279
- else if (type === ParamType$1.String || type === ParamType$1.StringOptional) {
42280
- // String
42281
- // Handle case where value doesn't exist
42282
- if (value === undefined) {
42283
- if (type === ParamType$1.StringOptional) {
42284
- output[name] = undefined;
42285
- }
42286
- else {
42287
- return handleError(res, {
42288
- message: `Parameter ${name} is required, but it was not included.`,
42289
- code: ReactKitErrorCode$1.MissingParameter,
42290
- status: 422,
42291
- });
42292
- }
42293
- }
42294
- else {
42295
- // Value exists
42296
- // Leave as is
42297
- output[name] = value;
42298
- }
42299
- }
42300
- else {
42301
- // No valid data type
42302
- return handleError(res, {
42303
- message: `An internal error occurred: we could not determine the type of ${name}.`,
42304
- code: ReactKitErrorCode$1.InvalidParameter,
42305
- status: 422,
42306
- });
42307
- }
42308
- }
42309
- /*----------------------------------------*/
42310
- /* Launch Info */
42311
- /*----------------------------------------*/
42312
- // Get launch info
42313
- const { launched, launchInfo } = cacclGetLaunchInfo(req);
42314
- if (!launched || !launchInfo) {
42315
- return handleError(res, {
42316
- message: 'Your session has expired. Please refresh the page and try again.',
42317
- code: ReactKitErrorCode$1.SessionExpired,
42318
- status: 440,
42319
- });
42320
- }
42321
- // Error if user info cannot be found
42322
- if (!launchInfo.userId
42323
- || !launchInfo.userFirstName
42324
- || !launchInfo.userLastName
42325
- || (launchInfo.notInCourse
42326
- && !launchInfo.isAdmin)
42327
- || (!launchInfo.isTTM
42328
- && !launchInfo.isLearner
42329
- && !launchInfo.isAdmin)) {
42330
- return handleError(res, {
42331
- message: 'Your session was invalid. Please refresh the page and try again.',
42332
- code: ReactKitErrorCode$1.SessionExpired,
42333
- status: 440,
42334
- });
42335
- }
42336
- // Add launch info to output
42337
- output.userId = launchInfo.userId;
42338
- output.userFirstName = launchInfo.userFirstName;
42339
- output.userLastName = launchInfo.userLastName;
42340
- output.userEmail = launchInfo.userEmail;
42341
- output.isLearner = !!launchInfo.isLearner;
42342
- output.isTTM = !!launchInfo.isTTM;
42343
- output.isAdmin = !!launchInfo.isAdmin;
42344
- output.courseId = ((_b = output.courseId) !== null && _b !== void 0 ? _b : launchInfo.courseId);
42345
- output.courseName = launchInfo.contextLabel;
42346
- // Add other session variables
42347
- Object.keys(req.session).forEach((propName) => {
42348
- // Skip if prop already in output
42349
- if (output[propName] !== undefined) {
42350
- return;
42351
- }
42352
- // Add to output
42353
- const value = req.session[propName];
42354
- if (typeof value === 'string'
42355
- || typeof value === 'boolean'
42356
- || typeof value === 'number') {
42357
- output[propName] = value;
42358
- }
42359
- });
42360
- /*----------------------------------------*/
42361
- /* Require Course Consistency */
42362
- /*----------------------------------------*/
42363
- // Make sure the user actually launched from the appropriate course
42364
- if (output.courseId
42365
- && launchInfo.courseId
42366
- && output.courseId !== launchInfo.courseId
42367
- && !output.isTTM
42368
- && !output.isAdmin) {
42369
- // Course of interest is not the launch course
42370
- return handleError(res, {
42371
- message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
42372
- code: ReactKitErrorCode$1.WrongCourse,
42373
- status: 401,
42374
- });
42375
- }
42376
- /*----------------------------------------*/
42377
- /* Require Proper Permissions */
42378
- /*----------------------------------------*/
42379
- // Add TTM endpoint security
42380
- if (
42381
- // This is a TTM endpoint
42382
- req.path.startsWith('/api/ttm')
42383
- // User is not a TTM
42384
- && (
42385
- // User is not a TTM
42386
- !output.isTTM
42387
- // User is not an admin
42388
- && !output.isAdmin)) {
42389
- // User does not have access
42390
- return handleError(res, {
42391
- message: 'This action is only allowed if you are a teaching team member for the course. Please go back to Canvas, log in as a teaching team member, and try again.',
42392
- code: ReactKitErrorCode$1.NotTTM,
42393
- status: 401,
42394
- });
42395
- }
42396
- // Add Admin endpoint security
42397
- if (
42398
- // This is an admin endpoint
42399
- req.path.startsWith('/api/admin')
42400
- // User is not an admin
42401
- && !output.isAdmin) {
42402
- // User does not have access
42403
- return handleError(res, {
42404
- message: 'This action is only allowed if you are a Canvas admin. Please go back to Canvas, log in as an admin, and try again.',
42405
- code: ReactKitErrorCode$1.NotAdmin,
42406
- status: 401,
42407
- });
42408
- }
42409
- /*------------------------------------------------------------------------*/
42410
- /* Call handler */
42411
- /*------------------------------------------------------------------------*/
42412
- try {
42413
- const results = yield opts.handler({
42414
- params: output,
42415
- req,
42416
- res,
42417
- next,
42418
- });
42419
- // Send results to client
42420
- handleSuccess(res, results !== null && results !== void 0 ? results : undefined);
42421
- }
42422
- catch (err) {
42423
- // Send error to client
42424
- handleError(res, err);
42425
- }
42426
- });
42427
- };
42428
-
42429
- /**
42430
- * Days of the week
42431
- * @author Gabe Abrams
42432
- */
42433
- var DayOfWeek$2;
42434
- (function (DayOfWeek) {
42435
- DayOfWeek["Monday"] = "m";
42436
- DayOfWeek["Tuesday"] = "t";
42437
- DayOfWeek["Wednesday"] = "w";
42438
- DayOfWeek["Thursday"] = "r";
42439
- DayOfWeek["Friday"] = "f";
42440
- DayOfWeek["Saturday"] = "s";
42441
- DayOfWeek["Sunday"] = "u";
42442
- })(DayOfWeek$2 || (DayOfWeek$2 = {}));
42443
-
42444
41796
  /**
42445
41797
  * Add all routes for the DBEditor
42446
41798
  * @author Yuen Ler Chow
@@ -42461,7 +41813,7 @@ const addDBEditorEndpoints = (opts) => {
42461
41813
  paramTypes: {
42462
41814
  filterQuery: ParamType$1.JSONOptional,
42463
41815
  },
42464
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
41816
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
42465
41817
  var _a;
42466
41818
  const filterQuery = (_a = params.filterQuery) !== null && _a !== void 0 ? _a : {};
42467
41819
  const categories = yield collection.find(filterQuery);
@@ -42477,7 +41829,7 @@ const addDBEditorEndpoints = (opts) => {
42477
41829
  paramTypes: {
42478
41830
  item: ParamType$1.JSON,
42479
41831
  },
42480
- handler: ({ params, }) => __awaiter$1(void 0, void 0, void 0, function* () {
41832
+ handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
42481
41833
  // Destructure params
42482
41834
  const { item, } = params;
42483
41835
  yield collection.insert(item);
@@ -42491,7 +41843,7 @@ const addDBEditorEndpoints = (opts) => {
42491
41843
  paramTypes: {
42492
41844
  id: ParamType$1.String,
42493
41845
  },
42494
- handler: ({ params, }) => __awaiter$1(void 0, void 0, void 0, function* () {
41846
+ handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
42495
41847
  // Destructure params
42496
41848
  const { id, } = params;
42497
41849
  yield collection.delete({ id });
@@ -42527,7 +41879,7 @@ exports.DayOfWeek = DayOfWeek$1;
42527
41879
  exports.Drawer = Drawer;
42528
41880
  exports.DynamicWord = DynamicWord;
42529
41881
  exports.ErrorBox = ErrorBox;
42530
- exports.ErrorWithCode = ErrorWithCode$1;
41882
+ exports.ErrorWithCode = ErrorWithCode;
42531
41883
  exports.HOUR_IN_MS = HOUR_IN_MS;
42532
41884
  exports.IntelliTable = IntelliTable;
42533
41885
  exports.ItemPicker = ItemPicker;
@@ -42539,18 +41891,18 @@ exports.LogSource = LogSource$1;
42539
41891
  exports.LogType = LogType$1;
42540
41892
  exports.MINUTE_IN_MS = MINUTE_IN_MS;
42541
41893
  exports.Modal = Modal;
42542
- exports.ModalButtonType = ModalButtonType$3;
42543
- exports.ModalSize = ModalSize$2;
42544
- exports.ModalType = ModalType$3;
42545
- exports.ParamType = ParamType$3;
41894
+ exports.ModalButtonType = ModalButtonType$1;
41895
+ exports.ModalSize = ModalSize$1;
41896
+ exports.ModalType = ModalType$1;
41897
+ exports.ParamType = ParamType$1;
42546
41898
  exports.PopFailureMark = PopFailureMark;
42547
41899
  exports.PopPendingMark = PopPendingMark;
42548
41900
  exports.PopSuccessMark = PopSuccessMark;
42549
41901
  exports.RadioButton = RadioButton;
42550
- exports.ReactKitErrorCode = ReactKitErrorCode$3;
41902
+ exports.ReactKitErrorCode = ReactKitErrorCode$1;
42551
41903
  exports.SimpleDateChooser = SimpleDateChooser;
42552
41904
  exports.TabBox = TabBox;
42553
- exports.Variant = Variant$3;
41905
+ exports.Variant = Variant$1;
42554
41906
  exports.abbreviate = abbreviate;
42555
41907
  exports.addDBEditorEndpoints = addDBEditorEndpoints;
42556
41908
  exports.alert = alert$1;
@@ -42563,15 +41915,15 @@ exports.extractProp = extractProp;
42563
41915
  exports.floorToNumDecimals = floorToNumDecimals;
42564
41916
  exports.forceNumIntoBounds = forceNumIntoBounds;
42565
41917
  exports.genCSV = genCSV;
42566
- exports.genRouteHandler = genRouteHandler$1;
41918
+ exports.genRouteHandler = genRouteHandler;
42567
41919
  exports.getHumanReadableDate = getHumanReadableDate;
42568
41920
  exports.getLocalTimeInfo = getLocalTimeInfo;
42569
41921
  exports.getMonthName = getMonthName;
42570
41922
  exports.getOrdinal = getOrdinal;
42571
41923
  exports.getPartOfDay = getPartOfDay;
42572
41924
  exports.getTimeInfoInET = getTimeInfoInET;
42573
- exports.handleError = handleError$1;
42574
- exports.handleSuccess = handleSuccess$1;
41925
+ exports.handleError = handleError;
41926
+ exports.handleSuccess = handleSuccess;
42575
41927
  exports.initClient = initClient;
42576
41928
  exports.initLogCollection = initLogCollection;
42577
41929
  exports.initServer = initServer;