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/esm/index.js CHANGED
@@ -19,7 +19,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
19
  PERFORMANCE OF THIS SOFTWARE.
20
20
  ***************************************************************************** */
21
21
 
22
- function __awaiter$1(thisArg, _arguments, P, generator) {
22
+ function __awaiter(thisArg, _arguments, P, generator) {
23
23
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
24
  return new (P || (P = Promise))(function (resolve, reject) {
25
25
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -34,7 +34,7 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
34
34
  * List of error codes built into the react kit
35
35
  * @author Gabe Abrams
36
36
  */
37
- var ReactKitErrorCode$2;
37
+ var ReactKitErrorCode;
38
38
  (function (ReactKitErrorCode) {
39
39
  ReactKitErrorCode["NoResponse"] = "DRK1";
40
40
  ReactKitErrorCode["NoCode"] = "DRK2";
@@ -49,8 +49,8 @@ var ReactKitErrorCode$2;
49
49
  ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
50
50
  ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
51
51
  ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
52
- })(ReactKitErrorCode$2 || (ReactKitErrorCode$2 = {}));
53
- var ReactKitErrorCode$3 = ReactKitErrorCode$2;
52
+ })(ReactKitErrorCode || (ReactKitErrorCode = {}));
53
+ var ReactKitErrorCode$1 = ReactKitErrorCode;
54
54
 
55
55
  /**
56
56
  * Displays an error
@@ -90,7 +90,7 @@ const ErrorBox = (props) => {
90
90
  } },
91
91
  "code:",
92
92
  ' ',
93
- String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$3.NoCode).toUpperCase())));
93
+ String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$1.NoCode).toUpperCase())));
94
94
  }
95
95
  // Main UI
96
96
  return (React__default.createElement("div", { className: "alert alert-danger text-center", style: {
@@ -111,7 +111,7 @@ const ErrorBox = (props) => {
111
111
  * Types of buttons in the modal
112
112
  * @author Gabe Abrams
113
113
  */
114
- var ModalButtonType$2;
114
+ var ModalButtonType;
115
115
  (function (ModalButtonType) {
116
116
  ModalButtonType["Okay"] = "okay";
117
117
  ModalButtonType["Cancel"] = "cancel";
@@ -123,14 +123,14 @@ var ModalButtonType$2;
123
123
  ModalButtonType["ImSure"] = "imSure";
124
124
  ModalButtonType["Delete"] = "delete";
125
125
  ModalButtonType["Confirm"] = "confirm";
126
- })(ModalButtonType$2 || (ModalButtonType$2 = {}));
127
- var ModalButtonType$3 = ModalButtonType$2;
126
+ })(ModalButtonType || (ModalButtonType = {}));
127
+ var ModalButtonType$1 = ModalButtonType;
128
128
 
129
129
  /**
130
130
  * Types of modals
131
131
  * @author Gabe Abrams
132
132
  */
133
- var ModalType$2;
133
+ var ModalType;
134
134
  (function (ModalType) {
135
135
  ModalType["Okay"] = "okay";
136
136
  ModalType["OkayCancel"] = "okay-cancel";
@@ -141,8 +141,8 @@ var ModalType$2;
141
141
  ModalType["DeleteCancel"] = "delete-cancel";
142
142
  ModalType["ConfirmCancel"] = "confirm-cancel";
143
143
  ModalType["NoButtons"] = "-";
144
- })(ModalType$2 || (ModalType$2 = {}));
145
- var ModalType$3 = ModalType$2;
144
+ })(ModalType || (ModalType = {}));
145
+ var ModalType$1 = ModalType;
146
146
 
147
147
  /**
148
148
  * Built-in metadata for logs
@@ -167,7 +167,7 @@ const LogBuiltInMetadata = {
167
167
  * @author Gabe Abrams
168
168
  * @param ms number of ms to wait
169
169
  */
170
- const waitMs = (ms = 0) => __awaiter$1(void 0, void 0, void 0, function* () {
170
+ const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
171
171
  return new Promise((resolve) => {
172
172
  setTimeout(resolve, ms);
173
173
  });
@@ -177,7 +177,7 @@ const waitMs = (ms = 0) => __awaiter$1(void 0, void 0, void 0, function* () {
177
177
  * Bootstrap variants
178
178
  * @author Gabe Abrams
179
179
  */
180
- var Variant$2;
180
+ var Variant;
181
181
  (function (Variant) {
182
182
  Variant["Primary"] = "primary";
183
183
  Variant["Secondary"] = "secondary";
@@ -187,21 +187,21 @@ var Variant$2;
187
187
  Variant["Danger"] = "danger";
188
188
  Variant["Light"] = "light";
189
189
  Variant["Dark"] = "dark";
190
- })(Variant$2 || (Variant$2 = {}));
191
- var Variant$3 = Variant$2;
190
+ })(Variant || (Variant = {}));
191
+ var Variant$1 = Variant;
192
192
 
193
193
  /**
194
194
  * Modal sizes
195
195
  * @author Gabe Abrams
196
196
  */
197
- var ModalSize$1;
197
+ var ModalSize;
198
198
  (function (ModalSize) {
199
199
  ModalSize["Small"] = "sm";
200
200
  ModalSize["Medium"] = "md";
201
201
  ModalSize["Large"] = "lg";
202
202
  ModalSize["ExtraLarge"] = "xl";
203
- })(ModalSize$1 || (ModalSize$1 = {}));
204
- var ModalSize$2 = ModalSize$1;
203
+ })(ModalSize || (ModalSize = {}));
204
+ var ModalSize$1 = ModalSize;
205
205
 
206
206
  /**
207
207
  * A generic popup modal
@@ -214,80 +214,80 @@ var ModalSize$2 = ModalSize$1;
214
214
  const MS_TO_ANIMATE = 200; // Animation duration
215
215
  // Modal type to list of buttons
216
216
  const modalTypeToModalButtonTypes = {
217
- [ModalType$3.Okay]: [
218
- ModalButtonType$3.Okay,
217
+ [ModalType$1.Okay]: [
218
+ ModalButtonType$1.Okay,
219
219
  ],
220
- [ModalType$3.OkayCancel]: [
221
- ModalButtonType$3.Okay,
222
- ModalButtonType$3.Cancel,
220
+ [ModalType$1.OkayCancel]: [
221
+ ModalButtonType$1.Okay,
222
+ ModalButtonType$1.Cancel,
223
223
  ],
224
- [ModalType$3.YesNo]: [
225
- ModalButtonType$3.Yes,
226
- ModalButtonType$3.No,
224
+ [ModalType$1.YesNo]: [
225
+ ModalButtonType$1.Yes,
226
+ ModalButtonType$1.No,
227
227
  ],
228
- [ModalType$3.YesNoCancel]: [
229
- ModalButtonType$3.Yes,
230
- ModalButtonType$3.No,
231
- ModalButtonType$3.Cancel,
228
+ [ModalType$1.YesNoCancel]: [
229
+ ModalButtonType$1.Yes,
230
+ ModalButtonType$1.No,
231
+ ModalButtonType$1.Cancel,
232
232
  ],
233
- [ModalType$3.AbandonGoBack]: [
234
- ModalButtonType$3.Abandon,
235
- ModalButtonType$3.GoBack,
233
+ [ModalType$1.AbandonGoBack]: [
234
+ ModalButtonType$1.Abandon,
235
+ ModalButtonType$1.GoBack,
236
236
  ],
237
- [ModalType$3.ImSureCancel]: [
238
- ModalButtonType$3.ImSure,
239
- ModalButtonType$3.Cancel,
237
+ [ModalType$1.ImSureCancel]: [
238
+ ModalButtonType$1.ImSure,
239
+ ModalButtonType$1.Cancel,
240
240
  ],
241
- [ModalType$3.DeleteCancel]: [
242
- ModalButtonType$3.Delete,
243
- ModalButtonType$3.Cancel,
241
+ [ModalType$1.DeleteCancel]: [
242
+ ModalButtonType$1.Delete,
243
+ ModalButtonType$1.Cancel,
244
244
  ],
245
- [ModalType$3.ConfirmCancel]: [
246
- ModalButtonType$3.Confirm,
247
- ModalButtonType$3.Cancel,
245
+ [ModalType$1.ConfirmCancel]: [
246
+ ModalButtonType$1.Confirm,
247
+ ModalButtonType$1.Cancel,
248
248
  ],
249
249
  };
250
250
  // Button type styling and labels
251
251
  const ModalButtonTypeToLabelAndVariant = {
252
- [ModalButtonType$3.Okay]: {
252
+ [ModalButtonType$1.Okay]: {
253
253
  label: 'Okay',
254
- variant: Variant$3.Dark,
254
+ variant: Variant$1.Dark,
255
255
  },
256
- [ModalButtonType$3.Cancel]: {
256
+ [ModalButtonType$1.Cancel]: {
257
257
  label: 'Cancel',
258
- variant: Variant$3.Secondary,
258
+ variant: Variant$1.Secondary,
259
259
  },
260
- [ModalButtonType$3.Yes]: {
260
+ [ModalButtonType$1.Yes]: {
261
261
  label: 'Yes',
262
- variant: Variant$3.Dark,
262
+ variant: Variant$1.Dark,
263
263
  },
264
- [ModalButtonType$3.No]: {
264
+ [ModalButtonType$1.No]: {
265
265
  label: 'No',
266
- variant: Variant$3.Secondary,
266
+ variant: Variant$1.Secondary,
267
267
  },
268
- [ModalButtonType$3.Abandon]: {
268
+ [ModalButtonType$1.Abandon]: {
269
269
  label: 'Abandon Changes',
270
- variant: Variant$3.Warning,
270
+ variant: Variant$1.Warning,
271
271
  },
272
- [ModalButtonType$3.GoBack]: {
272
+ [ModalButtonType$1.GoBack]: {
273
273
  label: 'Go Back',
274
- variant: Variant$3.Secondary,
274
+ variant: Variant$1.Secondary,
275
275
  },
276
- [ModalButtonType$3.Continue]: {
276
+ [ModalButtonType$1.Continue]: {
277
277
  label: 'Continue',
278
- variant: Variant$3.Dark,
278
+ variant: Variant$1.Dark,
279
279
  },
280
- [ModalButtonType$3.ImSure]: {
280
+ [ModalButtonType$1.ImSure]: {
281
281
  label: 'I am sure',
282
- variant: Variant$3.Warning,
282
+ variant: Variant$1.Warning,
283
283
  },
284
- [ModalButtonType$3.Delete]: {
284
+ [ModalButtonType$1.Delete]: {
285
285
  label: 'Yes, Delete',
286
- variant: Variant$3.Danger,
286
+ variant: Variant$1.Danger,
287
287
  },
288
- [ModalButtonType$3.Confirm]: {
288
+ [ModalButtonType$1.Confirm]: {
289
289
  label: 'Confirm',
290
- variant: Variant$3.Dark,
290
+ variant: Variant$1.Dark,
291
291
  },
292
292
  };
293
293
  /*------------------------------------------------------------------------*/
@@ -365,7 +365,7 @@ const Modal = (props) => {
365
365
  /*------------------------------------------------------------------------*/
366
366
  var _a;
367
367
  /* -------------- Props ------------- */
368
- const { type = ModalType$3.NoButtons, size = ModalSize$2.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
368
+ const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
369
369
  /* -------------- State ------------- */
370
370
  // If true, the modal is shown
371
371
  const [visible, setVisible] = useState(false);
@@ -382,7 +382,7 @@ const Modal = (props) => {
382
382
  * @author Gabe Abrams
383
383
  */
384
384
  useEffect(() => {
385
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
385
+ (() => __awaiter(void 0, void 0, void 0, function* () {
386
386
  // Set defaults
387
387
  setVisible(false);
388
388
  setAnimatingIn(true);
@@ -408,7 +408,7 @@ const Modal = (props) => {
408
408
  * @param ModalButtonType the button that was clicked when closing the
409
409
  * modal
410
410
  */
411
- const handleClose = (ModalButtonType) => __awaiter$1(void 0, void 0, void 0, function* () {
411
+ const handleClose = (ModalButtonType) => __awaiter(void 0, void 0, void 0, function* () {
412
412
  // Don't close if no handler
413
413
  if (!onClose) {
414
414
  return;
@@ -470,7 +470,7 @@ const Modal = (props) => {
470
470
  React__default.createElement("style", null, style$8),
471
471
  React__default.createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
472
472
  zIndex: 5000000003,
473
- }, onClick: () => __awaiter$1(void 0, void 0, void 0, function* () {
473
+ }, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
474
474
  // Skip if exit via backdrop not allowed
475
475
  if (dontAllowBackdropExit || !onClose) {
476
476
  // Show pop animation
@@ -483,7 +483,7 @@ const Modal = (props) => {
483
483
  return;
484
484
  }
485
485
  // Handle close
486
- handleClose(ModalButtonType$3.Cancel);
486
+ handleClose(ModalButtonType$1.Cancel);
487
487
  }) }),
488
488
  React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass}`, style: {
489
489
  zIndex: 5000000002,
@@ -495,7 +495,7 @@ const Modal = (props) => {
495
495
  } }, title),
496
496
  onClose && (React__default.createElement("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: () => {
497
497
  // Handle close
498
- handleClose(ModalButtonType$3.Cancel);
498
+ handleClose(ModalButtonType$1.Cancel);
499
499
  } }))),
500
500
  children && (React__default.createElement("div", { className: "modal-body" }, children)),
501
501
  footer && (React__default.createElement("div", { className: "modal-footer pt-1 pb-1" }, footer))))));
@@ -505,7 +505,7 @@ const Modal = (props) => {
505
505
  * An error with a code
506
506
  * @author Gabe Abrams
507
507
  */
508
- class ErrorWithCode$1 extends Error {
508
+ class ErrorWithCode extends Error {
509
509
  constructor(message, code) {
510
510
  super(message);
511
511
  this.name = 'ErrorWithCode';
@@ -552,23 +552,18 @@ let storedSendRequest;
552
552
  * @author Gabe Abrams
553
553
  * @returns sendRequest function
554
554
  */
555
- const getSendRequest = () => __awaiter$1(void 0, void 0, void 0, function* () {
556
- // Track timeout
557
- let timedOut = false;
558
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
555
+ const getSendRequest = () => __awaiter(void 0, void 0, void 0, function* () {
556
+ // Show timeout error if too much time passes
557
+ let successful = false;
558
+ (() => __awaiter(void 0, void 0, void 0, function* () {
559
559
  yield waitMs(5000);
560
- timedOut = true;
560
+ if (!successful) {
561
+ 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));
562
+ }
561
563
  }))(),
562
564
  // Wait for initialization
563
565
  yield initialized;
564
- // Error if no send request function
565
- if (timedOut) {
566
- 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));
567
- // Return dummy function that never resolves
568
- return (() => {
569
- return new Promise(() => { });
570
- });
571
- }
566
+ successful = true;
572
567
  // Return
573
568
  return storedSendRequest;
574
569
  });
@@ -623,7 +618,7 @@ const _setStubResponse = (opts) => {
623
618
  const { path, body, } = opts;
624
619
  const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase();
625
620
  const errorMessage = ((_b = opts.errorMessage) !== null && _b !== void 0 ? _b : 'An unknown error has occurred.');
626
- const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$3.NoCode);
621
+ const errorCode = ((_c = opts.errorCode) !== null && _c !== void 0 ? _c : ReactKitErrorCode$1.NoCode);
627
622
  // Store to stub responses
628
623
  if (!stubResponses[method]) {
629
624
  stubResponses[method] = {};
@@ -651,7 +646,7 @@ const _setStubResponse = (opts) => {
651
646
  * @param [opts.params] - query/body parameters to include
652
647
  * @returns response from server
653
648
  */
654
- const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
649
+ const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function* () {
655
650
  var _a, _b, _c;
656
651
  const method = ((_a = opts.method) !== null && _a !== void 0 ? _a : 'GET');
657
652
  // Handle stubs
@@ -669,7 +664,7 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
669
664
  return stubResponse.body;
670
665
  }
671
666
  // Error
672
- throw new ErrorWithCode$1(stubResponse.errorMessage, stubResponse.errorCode);
667
+ throw new ErrorWithCode(stubResponse.errorMessage, stubResponse.errorCode);
673
668
  }
674
669
  // Send the request
675
670
  const sendRequest = yield getSendRequest();
@@ -680,11 +675,11 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
680
675
  });
681
676
  // Check for failure
682
677
  if (!response || !response.body) {
683
- throw new ErrorWithCode$1('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$3.NoResponse);
678
+ throw new ErrorWithCode('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode$1.NoResponse);
684
679
  }
685
680
  if (!response.body.success) {
686
681
  // Session expired
687
- if (response.body.code === ReactKitErrorCode$3.SessionExpired) {
682
+ if (response.body.code === ReactKitErrorCode$1.SessionExpired) {
688
683
  // Skip notice if session was already expired
689
684
  if (sessionAlreadyExpired) {
690
685
  // Never return (browser is already reloading)
@@ -705,9 +700,9 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
705
700
  });
706
701
  }
707
702
  // Other errors
708
- throw new ErrorWithCode$1((response.body.message
703
+ throw new ErrorWithCode((response.body.message
709
704
  || 'An unknown error occurred. Please contact an admin.'), (response.body.code
710
- || ReactKitErrorCode$3.NoCode));
705
+ || ReactKitErrorCode$1.NoCode));
711
706
  }
712
707
  // Success! Extract the body
713
708
  const { body } = response.body;
@@ -719,7 +714,7 @@ const visitServerEndpoint = (opts) => __awaiter$1(void 0, void 0, void 0, functi
719
714
  * Log a user action on the client (cannot be used on the server)
720
715
  * @author Gabe Abrams
721
716
  */
722
- const logClientEvent = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
717
+ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
723
718
  var _a, _b, _c, _d, _e, _f, _g;
724
719
  return visitServerEndpoint({
725
720
  path: LOG_ROUTE_PATH,
@@ -771,7 +766,7 @@ let onAlertClosed;
771
766
  * @param title the title text to display at the top of the alert
772
767
  * @param text the text to display in the alert
773
768
  */
774
- const alert$1 = (title, text) => __awaiter$1(void 0, void 0, void 0, function* () {
769
+ const alert$1 = (title, text) => __awaiter(void 0, void 0, void 0, function* () {
775
770
  // Fallback if alert not available
776
771
  if (!setAlertInfo) {
777
772
  window.alert(`${title}\n\n${text}`);
@@ -811,7 +806,7 @@ let onConfirmClosed;
811
806
  * button
812
807
  * @returns true if the user confirmed
813
808
  */
814
- const confirm = (title, text, opts) => __awaiter$1(void 0, void 0, void 0, function* () {
809
+ const confirm = (title, text, opts) => __awaiter(void 0, void 0, void 0, function* () {
815
810
  // Fallback if confirm is not available
816
811
  if (!setConfirmInfo) {
817
812
  return window.confirm(`${title}\n\n${text}`);
@@ -850,8 +845,8 @@ const showFatalError = (error, errorTitle = 'An Error Occurred') => {
850
845
  ? error.trim()
851
846
  : String((_a = error.message) !== null && _a !== void 0 ? _a : 'An unknown error occurred.'));
852
847
  const code = (typeof error === 'string'
853
- ? ReactKitErrorCode$3.NoCode
854
- : String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$3.NoCode));
848
+ ? ReactKitErrorCode$1.NoCode
849
+ : String((_b = error.code) !== null && _b !== void 0 ? _b : ReactKitErrorCode$1.NoCode));
855
850
  // Add log
856
851
  logClientEvent({
857
852
  context: LogBuiltInMetadata.Context.ClientFatalError,
@@ -910,7 +905,7 @@ const AppWrapper = (props) => {
910
905
  let modal;
911
906
  /* -------------- Alert ------------- */
912
907
  if (alertInfo) {
913
- modal = (React__default.createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$3.Okay, onClose: () => {
908
+ modal = (React__default.createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
914
909
  // Alert closed
915
910
  setAlertInfo(undefined);
916
911
  if (onAlertClosed) {
@@ -920,10 +915,10 @@ const AppWrapper = (props) => {
920
915
  }
921
916
  /* ------------- Confirm ------------ */
922
917
  if (confirmInfo) {
923
- modal = (React__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) => {
918
+ modal = (React__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) => {
924
919
  setConfirmInfo(undefined);
925
920
  if (onConfirmClosed) {
926
- onConfirmClosed(buttonType === ModalButtonType$3.Okay);
921
+ onConfirmClosed(buttonType === ModalButtonType$1.Okay);
927
922
  }
928
923
  }, dontAllowBackdropExit: true }, confirmInfo.text));
929
924
  }
@@ -936,8 +931,8 @@ const AppWrapper = (props) => {
936
931
  if (fatalErrorMessage || fatalErrorCode || sessionHasExpired) {
937
932
  // Re-encapsulate in an error
938
933
  const error = (sessionHasExpired
939
- ? new ErrorWithCode$1(getSessionExpiredMessage(), ReactKitErrorCode$3.SessionExpired)
940
- : 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)));
934
+ ? new ErrorWithCode(getSessionExpiredMessage(), ReactKitErrorCode$1.SessionExpired)
935
+ : 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)));
941
936
  // Build error screen
942
937
  body = (React__default.createElement("div", { style: {
943
938
  display: 'block',
@@ -1162,7 +1157,7 @@ const RadioButton = (props) => {
1162
1157
  /* Setup */
1163
1158
  /*------------------------------------------------------------------------*/
1164
1159
  /* -------------- Props ------------- */
1165
- const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$3.Secondary, unselectedVariant = Variant$3.Light, small, } = props;
1160
+ const { text, onSelected, ariaLabel, title, selected, id, noMarginOnRight, selectedVariant = Variant$1.Secondary, unselectedVariant = Variant$1.Light, small, } = props;
1166
1161
  /*------------------------------------------------------------------------*/
1167
1162
  /* Render */
1168
1163
  /*------------------------------------------------------------------------*/
@@ -1190,7 +1185,7 @@ const CheckboxButton = (props) => {
1190
1185
  /* Setup */
1191
1186
  /*------------------------------------------------------------------------*/
1192
1187
  /* -------------- Props ------------- */
1193
- const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$3.Secondary, uncheckedVariant = Variant$3.Light, small, dashed, } = props;
1188
+ const { text, onChanged, ariaLabel, title, checked, id, className, noMarginOnRight, checkedVariant = Variant$1.Secondary, uncheckedVariant = Variant$1.Light, small, dashed, } = props;
1194
1189
  /*------------------------------------------------------------------------*/
1195
1190
  /* Render */
1196
1191
  /*------------------------------------------------------------------------*/
@@ -1836,13 +1831,13 @@ const PopPendingMark = (props) => {
1836
1831
  */
1837
1832
  /* ------------- Actions ------------ */
1838
1833
  // Types of actions
1839
- var ActionType$8;
1834
+ var ActionType$6;
1840
1835
  (function (ActionType) {
1841
1836
  // Indicate that the text was recently copied
1842
1837
  ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
1843
1838
  // Clear the status
1844
1839
  ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
1845
- })(ActionType$8 || (ActionType$8 = {}));
1840
+ })(ActionType$6 || (ActionType$6 = {}));
1846
1841
  /**
1847
1842
  * Reducer that executes actions
1848
1843
  * @author Gabe Abrams
@@ -1851,12 +1846,12 @@ var ActionType$8;
1851
1846
  */
1852
1847
  const reducer$6 = (state, action) => {
1853
1848
  switch (action.type) {
1854
- case ActionType$8.IndicateRecentlyCopied: {
1849
+ case ActionType$6.IndicateRecentlyCopied: {
1855
1850
  return {
1856
1851
  recentlyCopied: true,
1857
1852
  };
1858
1853
  }
1859
- case ActionType$8.ClearRecentlyCopiedStatus: {
1854
+ case ActionType$6.ClearRecentlyCopiedStatus: {
1860
1855
  return {
1861
1856
  recentlyCopied: false,
1862
1857
  };
@@ -1892,7 +1887,7 @@ const CopiableBox = (props) => {
1892
1887
  * Perform a copy
1893
1888
  * @author Gabe Abrams
1894
1889
  */
1895
- const performCopy = () => __awaiter$1(void 0, void 0, void 0, function* () {
1890
+ const performCopy = () => __awaiter(void 0, void 0, void 0, function* () {
1896
1891
  // Write to clipboard
1897
1892
  try {
1898
1893
  yield navigator.clipboard.writeText(text);
@@ -1902,13 +1897,13 @@ const CopiableBox = (props) => {
1902
1897
  }
1903
1898
  // Show copied notice
1904
1899
  dispatch({
1905
- type: ActionType$8.IndicateRecentlyCopied,
1900
+ type: ActionType$6.IndicateRecentlyCopied,
1906
1901
  });
1907
1902
  // Wait a moment
1908
1903
  yield waitMs(4000);
1909
1904
  // Hide copied notice
1910
1905
  dispatch({
1911
- type: ActionType$8.ClearRecentlyCopiedStatus,
1906
+ type: ActionType$6.ClearRecentlyCopiedStatus,
1912
1907
  });
1913
1908
  });
1914
1909
  /*------------------------------------------------------------------------*/
@@ -1964,11 +1959,11 @@ const CopiableBox = (props) => {
1964
1959
  */
1965
1960
  /* ------------- Actions ------------ */
1966
1961
  // Types of actions
1967
- var ActionType$7;
1962
+ var ActionType$5;
1968
1963
  (function (ActionType) {
1969
1964
  // Toggle whether a child are being shown
1970
1965
  ActionType["ToggleChild"] = "toggle-child";
1971
- })(ActionType$7 || (ActionType$7 = {}));
1966
+ })(ActionType$5 || (ActionType$5 = {}));
1972
1967
  /**
1973
1968
  * Reducer that executes actions
1974
1969
  * @author Gabe Abrams
@@ -1977,7 +1972,7 @@ var ActionType$7;
1977
1972
  */
1978
1973
  const reducer$5 = (state, action) => {
1979
1974
  switch (action.type) {
1980
- case ActionType$7.ToggleChild: {
1975
+ case ActionType$5.ToggleChild: {
1981
1976
  return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
1982
1977
  }
1983
1978
  default: {
@@ -2096,14 +2091,14 @@ const NestableItemList = (props) => {
2096
2091
  backgroundColor: 'transparent',
2097
2092
  }, type: "button", onClick: () => {
2098
2093
  dispatch({
2099
- type: ActionType$7.ToggleChild,
2094
+ type: ActionType$5.ToggleChild,
2100
2095
  id: item.id,
2101
2096
  });
2102
2097
  }, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
2103
2098
  React__default.createElement(FontAwesomeIcon, { icon: childExpanded[item.id] ? faChevronDown : faChevronRight })))),
2104
2099
  React__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) => {
2105
2100
  onChanged(changeChecked(item.id, checked, items));
2106
- }, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$3.Light }),
2101
+ }, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light }),
2107
2102
  (item.isGroup && childExpanded[item.id]) && (React__default.createElement("div", { className: "NestableItemList-children-container", style: {
2108
2103
  paddingLeft: '2.2rem',
2109
2104
  } },
@@ -2241,7 +2236,7 @@ var LogAction$1 = LogAction;
2241
2236
  * Server-side API param types
2242
2237
  * @author Gabe Abrams
2243
2238
  */
2244
- var ParamType$2;
2239
+ var ParamType;
2245
2240
  (function (ParamType) {
2246
2241
  ParamType["Boolean"] = "boolean";
2247
2242
  ParamType["BooleanOptional"] = "boolean-optional";
@@ -2253,8 +2248,8 @@ var ParamType$2;
2253
2248
  ParamType["JSONOptional"] = "json-optional";
2254
2249
  ParamType["String"] = "string";
2255
2250
  ParamType["StringOptional"] = "string-optional";
2256
- })(ParamType$2 || (ParamType$2 = {}));
2257
- var ParamType$3 = ParamType$2;
2251
+ })(ParamType || (ParamType = {}));
2252
+ var ParamType$1 = ParamType;
2258
2253
 
2259
2254
  /**
2260
2255
  * Round a number to a certain number of decimals
@@ -2371,7 +2366,7 @@ var SortType;
2371
2366
  })(SortType || (SortType = {}));
2372
2367
  /* ------------- Actions ------------ */
2373
2368
  // Types of actions
2374
- var ActionType$6;
2369
+ var ActionType$4;
2375
2370
  (function (ActionType) {
2376
2371
  // Toggle sort column param
2377
2372
  ActionType["ToggleSortColumn"] = "toggle-sort-column";
@@ -2383,7 +2378,7 @@ var ActionType$6;
2383
2378
  ActionType["ShowAllColumns"] = "show-all-columns";
2384
2379
  // Hide all columns
2385
2380
  ActionType["HideAllColumns"] = "hide-all-columns";
2386
- })(ActionType$6 || (ActionType$6 = {}));
2381
+ })(ActionType$4 || (ActionType$4 = {}));
2387
2382
  /**
2388
2383
  * Reducer that executes actions
2389
2384
  * @author Gabe Abrams
@@ -2392,7 +2387,7 @@ var ActionType$6;
2392
2387
  */
2393
2388
  const reducer$4 = (state, action) => {
2394
2389
  switch (action.type) {
2395
- case ActionType$6.ToggleSortColumn: {
2390
+ case ActionType$4.ToggleSortColumn: {
2396
2391
  if (action.param !== state.sortColumnParam) {
2397
2392
  // Different column param
2398
2393
  return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
@@ -2404,22 +2399,22 @@ const reducer$4 = (state, action) => {
2404
2399
  // Stop sorting by column
2405
2400
  return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
2406
2401
  }
2407
- case ActionType$6.UpdateColumnVisibility: {
2402
+ case ActionType$4.UpdateColumnVisibility: {
2408
2403
  const { columnVisibilityMap } = state;
2409
2404
  columnVisibilityMap[action.param] = action.visible;
2410
2405
  return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2411
2406
  }
2412
- case ActionType$6.ToggleColVisCusModalVisibility: {
2407
+ case ActionType$4.ToggleColVisCusModalVisibility: {
2413
2408
  return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
2414
2409
  }
2415
- case ActionType$6.ShowAllColumns: {
2410
+ case ActionType$4.ShowAllColumns: {
2416
2411
  const { columnVisibilityMap } = state;
2417
2412
  Object.keys(columnVisibilityMap).forEach((param) => {
2418
2413
  columnVisibilityMap[param] = true;
2419
2414
  });
2420
2415
  return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2421
2416
  }
2422
- case ActionType$6.HideAllColumns: {
2417
+ case ActionType$4.HideAllColumns: {
2423
2418
  const { columnVisibilityMap } = state;
2424
2419
  Object.keys(columnVisibilityMap).forEach((param) => {
2425
2420
  columnVisibilityMap[param] = false;
@@ -2480,7 +2475,7 @@ const IntelliTable = (props) => {
2480
2475
  /* ------- Col Vis Customization Modal ------ */
2481
2476
  if (columnVisibilityCustomizationModalVisible) {
2482
2477
  // Create modal
2483
- modal = (React__default.createElement(Modal, { type: ModalType$3.Okay, title: "Choose columns to show:", onClose: () => {
2478
+ modal = (React__default.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2484
2479
  const noColumnsSelected = (Object.values(columnVisibilityMap)
2485
2480
  .every((isSelected) => {
2486
2481
  return !isSelected;
@@ -2489,27 +2484,27 @@ const IntelliTable = (props) => {
2489
2484
  return alert$1('Choose at least one column', 'To continue, you have to choose at least one column to show');
2490
2485
  }
2491
2486
  dispatch({
2492
- type: ActionType$6.ToggleColVisCusModalVisibility,
2487
+ type: ActionType$4.ToggleColVisCusModalVisibility,
2493
2488
  });
2494
- }, okayVariant: Variant$3.Light },
2489
+ }, okayVariant: Variant$1.Light },
2495
2490
  columns.map((column) => {
2496
2491
  return (React__default.createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
2497
2492
  dispatch({
2498
- type: ActionType$6.UpdateColumnVisibility,
2493
+ type: ActionType$4.UpdateColumnVisibility,
2499
2494
  param: column.param,
2500
2495
  visible: checked,
2501
2496
  });
2502
- }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$3.Light, uncheckedVariant: Variant$3.Secondary }));
2497
+ }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
2503
2498
  }),
2504
2499
  React__default.createElement("div", { className: "mt-3" }, "Or you can:"),
2505
2500
  React__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: () => {
2506
2501
  dispatch({
2507
- type: ActionType$6.ShowAllColumns,
2502
+ type: ActionType$4.ShowAllColumns,
2508
2503
  });
2509
2504
  } }, "Select All"),
2510
2505
  React__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: () => {
2511
2506
  dispatch({
2512
- type: ActionType$6.HideAllColumns,
2507
+ type: ActionType$4.HideAllColumns,
2513
2508
  });
2514
2509
  } }, "Deselect All")));
2515
2510
  }
@@ -2560,7 +2555,7 @@ const IntelliTable = (props) => {
2560
2555
  React__default.createElement("div", null,
2561
2556
  React__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: () => {
2562
2557
  dispatch({
2563
- type: ActionType$6.ToggleSortColumn,
2558
+ type: ActionType$4.ToggleSortColumn,
2564
2559
  param: column.param,
2565
2560
  });
2566
2561
  } },
@@ -2600,7 +2595,7 @@ const IntelliTable = (props) => {
2600
2595
  }
2601
2596
  // Sort differently based on the data type
2602
2597
  // > Boolean
2603
- if (paramType === ParamType$3.Boolean) {
2598
+ if (paramType === ParamType$1.Boolean) {
2604
2599
  if (aVal && !bVal) {
2605
2600
  return (descending ? -1 : 1);
2606
2601
  }
@@ -2610,14 +2605,14 @@ const IntelliTable = (props) => {
2610
2605
  return tiebreaker;
2611
2606
  }
2612
2607
  // > Number
2613
- if (paramType === ParamType$3.Int
2614
- || paramType === ParamType$3.Float) {
2608
+ if (paramType === ParamType$1.Int
2609
+ || paramType === ParamType$1.Float) {
2615
2610
  return (descending
2616
2611
  ? (bVal - aVal)
2617
2612
  : (aVal - bVal));
2618
2613
  }
2619
2614
  // > String
2620
- if (paramType === ParamType$3.String) {
2615
+ if (paramType === ParamType$1.String) {
2621
2616
  if (aVal < bVal) {
2622
2617
  return (descending ? 1 : -1);
2623
2618
  }
@@ -2627,7 +2622,7 @@ const IntelliTable = (props) => {
2627
2622
  return tiebreaker;
2628
2623
  }
2629
2624
  // > JSON
2630
- if (paramType === ParamType$3.JSON) {
2625
+ if (paramType === ParamType$1.JSON) {
2631
2626
  const aSize = (Array.isArray(aVal)
2632
2627
  ? aVal.length
2633
2628
  : Object.keys(aVal).length);
@@ -2659,7 +2654,7 @@ const IntelliTable = (props) => {
2659
2654
  let fullValue;
2660
2655
  let visibleValue;
2661
2656
  let title = '';
2662
- if (column.type === ParamType$3.Boolean) {
2657
+ if (column.type === ParamType$1.Boolean) {
2663
2658
  fullValue = !!(value);
2664
2659
  const noValue = (value === undefined
2665
2660
  || value === null);
@@ -2671,7 +2666,7 @@ const IntelliTable = (props) => {
2671
2666
  title = 'Empty Cell';
2672
2667
  }
2673
2668
  }
2674
- else if (column.type === ParamType$3.Int) {
2669
+ else if (column.type === ParamType$1.Int) {
2675
2670
  fullValue = Number.parseInt(value, 10);
2676
2671
  const noValue = Number.isNaN(fullValue);
2677
2672
  visibleValue = (noValue
@@ -2682,7 +2677,7 @@ const IntelliTable = (props) => {
2682
2677
  title = 'Empty Cell';
2683
2678
  }
2684
2679
  }
2685
- else if (column.type === ParamType$3.Float) {
2680
+ else if (column.type === ParamType$1.Float) {
2686
2681
  fullValue = Number.parseFloat(value);
2687
2682
  const noValue = Number.isNaN(fullValue);
2688
2683
  visibleValue = (noValue
@@ -2693,7 +2688,7 @@ const IntelliTable = (props) => {
2693
2688
  title = 'Empty Cell';
2694
2689
  }
2695
2690
  }
2696
- else if (column.type === ParamType$3.String) {
2691
+ else if (column.type === ParamType$1.String) {
2697
2692
  fullValue = String(value).trim();
2698
2693
  const noValue = (value === undefined
2699
2694
  || value === null
@@ -2706,7 +2701,7 @@ const IntelliTable = (props) => {
2706
2701
  title = 'Empty Cell';
2707
2702
  }
2708
2703
  }
2709
- else if (column.type === ParamType$3.JSON) {
2704
+ else if (column.type === ParamType$1.JSON) {
2710
2705
  fullValue = JSON.stringify(value);
2711
2706
  const noValue = (Array.isArray(value)
2712
2707
  ? (!value || value.length === 0)
@@ -2749,7 +2744,7 @@ const IntelliTable = (props) => {
2749
2744
  React__default.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
2750
2745
  React__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: () => {
2751
2746
  dispatch({
2752
- type: ActionType$6.ToggleColVisCusModalVisibility,
2747
+ type: ActionType$4.ToggleColVisCusModalVisibility,
2753
2748
  });
2754
2749
  } },
2755
2750
  "Show/Hide Cols",
@@ -2871,185 +2866,185 @@ const columns = [
2871
2866
  {
2872
2867
  title: 'First Name',
2873
2868
  param: 'userFirstName',
2874
- type: ParamType$3.String,
2869
+ type: ParamType$1.String,
2875
2870
  },
2876
2871
  {
2877
2872
  title: 'Last Name',
2878
2873
  param: 'userLastName',
2879
- type: ParamType$3.String,
2874
+ type: ParamType$1.String,
2880
2875
  },
2881
2876
  {
2882
2877
  title: 'Email',
2883
2878
  param: 'userEmail',
2884
- type: ParamType$3.String,
2879
+ type: ParamType$1.String,
2885
2880
  },
2886
2881
  {
2887
2882
  title: 'Canvas Id',
2888
2883
  param: 'userId',
2889
- type: ParamType$3.Int,
2884
+ type: ParamType$1.Int,
2890
2885
  },
2891
2886
  {
2892
2887
  title: 'Student?',
2893
2888
  param: 'isLearner',
2894
- type: ParamType$3.Boolean,
2889
+ type: ParamType$1.Boolean,
2895
2890
  },
2896
2891
  {
2897
2892
  title: 'Teaching Staff?',
2898
2893
  param: 'isTTM',
2899
- type: ParamType$3.Boolean,
2894
+ type: ParamType$1.Boolean,
2900
2895
  startsHidden: true,
2901
2896
  },
2902
2897
  {
2903
2898
  title: 'Admin?',
2904
2899
  param: 'isAdmin',
2905
- type: ParamType$3.Boolean,
2900
+ type: ParamType$1.Boolean,
2906
2901
  startsHidden: true,
2907
2902
  },
2908
2903
  {
2909
2904
  title: 'Course Canvas Id',
2910
2905
  param: 'courseId',
2911
- type: ParamType$3.Int,
2906
+ type: ParamType$1.Int,
2912
2907
  startsHidden: true,
2913
2908
  },
2914
2909
  {
2915
2910
  title: 'Course Name',
2916
2911
  param: 'courseName',
2917
- type: ParamType$3.String,
2912
+ type: ParamType$1.String,
2918
2913
  },
2919
2914
  {
2920
2915
  title: 'Browser Name',
2921
2916
  param: 'browser.name',
2922
- type: ParamType$3.String,
2917
+ type: ParamType$1.String,
2923
2918
  startsHidden: true,
2924
2919
  },
2925
2920
  {
2926
2921
  title: 'Browser Version',
2927
2922
  param: 'browser.version',
2928
- type: ParamType$3.String,
2923
+ type: ParamType$1.String,
2929
2924
  startsHidden: true,
2930
2925
  },
2931
2926
  {
2932
2927
  title: 'OS',
2933
2928
  param: 'device.os',
2934
- type: ParamType$3.String,
2929
+ type: ParamType$1.String,
2935
2930
  startsHidden: true,
2936
2931
  },
2937
2932
  {
2938
2933
  title: 'Mobile?',
2939
2934
  param: 'device.isMobile',
2940
- type: ParamType$3.Boolean,
2935
+ type: ParamType$1.Boolean,
2941
2936
  startsHidden: true,
2942
2937
  },
2943
2938
  {
2944
2939
  title: 'Year',
2945
2940
  param: 'year',
2946
- type: ParamType$3.Int,
2941
+ type: ParamType$1.Int,
2947
2942
  },
2948
2943
  {
2949
2944
  title: 'Month',
2950
2945
  param: 'month',
2951
- type: ParamType$3.Int,
2946
+ type: ParamType$1.Int,
2952
2947
  },
2953
2948
  {
2954
2949
  title: 'Day',
2955
2950
  param: 'day',
2956
- type: ParamType$3.Int,
2951
+ type: ParamType$1.Int,
2957
2952
  },
2958
2953
  {
2959
2954
  title: 'Hour',
2960
2955
  param: 'hour',
2961
- type: ParamType$3.Int,
2956
+ type: ParamType$1.Int,
2962
2957
  },
2963
2958
  {
2964
2959
  title: 'Minute',
2965
2960
  param: 'minute',
2966
- type: ParamType$3.Int,
2961
+ type: ParamType$1.Int,
2967
2962
  startsHidden: true,
2968
2963
  },
2969
2964
  {
2970
2965
  title: 'Timestamp',
2971
2966
  param: 'timestamp',
2972
- type: ParamType$3.Int,
2967
+ type: ParamType$1.Int,
2973
2968
  startsHidden: true,
2974
2969
  },
2975
2970
  {
2976
2971
  title: 'Context',
2977
2972
  param: 'context',
2978
- type: ParamType$3.String,
2973
+ type: ParamType$1.String,
2979
2974
  },
2980
2975
  {
2981
2976
  title: 'Subcontext',
2982
2977
  param: 'subcontext',
2983
- type: ParamType$3.String,
2978
+ type: ParamType$1.String,
2984
2979
  },
2985
2980
  {
2986
2981
  title: 'Tags',
2987
2982
  param: 'tags',
2988
- type: ParamType$3.JSON,
2983
+ type: ParamType$1.JSON,
2989
2984
  startsHidden: true,
2990
2985
  },
2991
2986
  {
2992
2987
  title: 'Log Level',
2993
2988
  param: 'level',
2994
- type: ParamType$3.String,
2989
+ type: ParamType$1.String,
2995
2990
  startsHidden: true,
2996
2991
  },
2997
2992
  {
2998
2993
  title: 'Metadata',
2999
2994
  param: 'metadata',
3000
- type: ParamType$3.JSON,
2995
+ type: ParamType$1.JSON,
3001
2996
  startsHidden: true,
3002
2997
  },
3003
2998
  {
3004
2999
  title: 'Source',
3005
3000
  param: 'source',
3006
- type: ParamType$3.String,
3001
+ type: ParamType$1.String,
3007
3002
  },
3008
3003
  {
3009
3004
  title: 'Server Route Path',
3010
3005
  param: 'routePath',
3011
- type: ParamType$3.String,
3006
+ type: ParamType$1.String,
3012
3007
  startsHidden: true,
3013
3008
  },
3014
3009
  {
3015
3010
  title: 'Server Route Template',
3016
3011
  param: 'routeTemplate',
3017
- type: ParamType$3.String,
3012
+ type: ParamType$1.String,
3018
3013
  startsHidden: true,
3019
3014
  },
3020
3015
  {
3021
3016
  title: 'Type',
3022
3017
  param: 'type',
3023
- type: ParamType$3.String,
3018
+ type: ParamType$1.String,
3024
3019
  },
3025
3020
  {
3026
3021
  title: 'Error Message',
3027
3022
  param: 'errorMessage',
3028
- type: ParamType$3.String,
3023
+ type: ParamType$1.String,
3029
3024
  startsHidden: true,
3030
3025
  },
3031
3026
  {
3032
3027
  title: 'Error Code',
3033
3028
  param: 'errorCode',
3034
- type: ParamType$3.String,
3029
+ type: ParamType$1.String,
3035
3030
  startsHidden: true,
3036
3031
  },
3037
3032
  {
3038
3033
  title: 'Error Stack',
3039
3034
  param: 'errorStack',
3040
- type: ParamType$3.String,
3035
+ type: ParamType$1.String,
3041
3036
  startsHidden: true,
3042
3037
  },
3043
3038
  {
3044
3039
  title: 'Action Target',
3045
3040
  param: 'target',
3046
- type: ParamType$3.String,
3041
+ type: ParamType$1.String,
3047
3042
  startsHidden: true,
3048
3043
  },
3049
3044
  {
3050
3045
  title: 'Action Type',
3051
3046
  param: 'action',
3052
- type: ParamType$3.String,
3047
+ type: ParamType$1.String,
3053
3048
  startsHidden: true,
3054
3049
  },
3055
3050
  ];
@@ -3115,7 +3110,7 @@ const genHumanReadableName = (machineReadableName) => {
3115
3110
  };
3116
3111
  /* ------------- Actions ------------ */
3117
3112
  // Types of actions
3118
- var ActionType$5;
3113
+ var ActionType$3;
3119
3114
  (function (ActionType) {
3120
3115
  // Show the loading bar
3121
3116
  ActionType["StartLoading"] = "start-loading";
@@ -3137,7 +3132,7 @@ var ActionType$5;
3137
3132
  ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
3138
3133
  // Update the advanced filter state
3139
3134
  ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
3140
- })(ActionType$5 || (ActionType$5 = {}));
3135
+ })(ActionType$3 || (ActionType$3 = {}));
3141
3136
  /**
3142
3137
  * Reducer that executes actions
3143
3138
  * @author Gabe Abrams
@@ -3146,36 +3141,36 @@ var ActionType$5;
3146
3141
  */
3147
3142
  const reducer$3 = (state, action) => {
3148
3143
  switch (action.type) {
3149
- case ActionType$5.StartLoading: {
3144
+ case ActionType$3.StartLoading: {
3150
3145
  return Object.assign(Object.assign({}, state), { loading: true });
3151
3146
  }
3152
- case ActionType$5.FinishLoading: {
3147
+ case ActionType$3.FinishLoading: {
3153
3148
  return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
3154
3149
  }
3155
- case ActionType$5.ToggleFilterDrawer: {
3150
+ case ActionType$3.ToggleFilterDrawer: {
3156
3151
  return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
3157
3152
  ? undefined // hide
3158
3153
  : action.filterDrawer) });
3159
3154
  }
3160
- case ActionType$5.HideFilterDrawer: {
3155
+ case ActionType$3.HideFilterDrawer: {
3161
3156
  return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
3162
3157
  }
3163
- case ActionType$5.ResetFilters: {
3158
+ case ActionType$3.ResetFilters: {
3164
3159
  return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
3165
3160
  }
3166
- case ActionType$5.UpdateDateFilterState: {
3161
+ case ActionType$3.UpdateDateFilterState: {
3167
3162
  return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
3168
3163
  }
3169
- case ActionType$5.UpdateContextFilterState: {
3164
+ case ActionType$3.UpdateContextFilterState: {
3170
3165
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
3171
3166
  }
3172
- case ActionType$5.UpdateTagFilterState: {
3167
+ case ActionType$3.UpdateTagFilterState: {
3173
3168
  return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
3174
3169
  }
3175
- case ActionType$5.UpdateActionErrorFilterState: {
3170
+ case ActionType$3.UpdateActionErrorFilterState: {
3176
3171
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
3177
3172
  }
3178
- case ActionType$5.UpdateAdvancedFilterState: {
3173
+ case ActionType$3.UpdateAdvancedFilterState: {
3179
3174
  return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
3180
3175
  }
3181
3176
  default: {
@@ -3352,10 +3347,10 @@ const LogReviewer = (props) => {
3352
3347
  * @author Gabe Abrams
3353
3348
  * @param newDateFilterState the new date filter state
3354
3349
  */
3355
- const handleDateRangeUpdated = (newDateFilterState) => __awaiter$1(void 0, void 0, void 0, function* () {
3350
+ const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
3356
3351
  // Update state
3357
3352
  dispatch({
3358
- type: ActionType$5.UpdateDateFilterState,
3353
+ type: ActionType$3.UpdateDateFilterState,
3359
3354
  dateFilterState: newDateFilterState,
3360
3355
  });
3361
3356
  // Check which year/month combos we need to load
@@ -3366,7 +3361,7 @@ const LogReviewer = (props) => {
3366
3361
  }
3367
3362
  // Start loading
3368
3363
  dispatch({
3369
- type: ActionType$5.StartLoading,
3364
+ type: ActionType$3.StartLoading,
3370
3365
  });
3371
3366
  // Load required months
3372
3367
  try {
@@ -3390,7 +3385,7 @@ const LogReviewer = (props) => {
3390
3385
  }
3391
3386
  // Finish loading
3392
3387
  dispatch({
3393
- type: ActionType$5.FinishLoading,
3388
+ type: ActionType$3.FinishLoading,
3394
3389
  logMap,
3395
3390
  });
3396
3391
  });
@@ -3429,7 +3424,7 @@ const LogReviewer = (props) => {
3429
3424
  React__default.createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
3430
3425
  React__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: () => {
3431
3426
  dispatch({
3432
- type: ActionType$5.ToggleFilterDrawer,
3427
+ type: ActionType$3.ToggleFilterDrawer,
3433
3428
  filterDrawer: FilterDrawer.Date,
3434
3429
  });
3435
3430
  } },
@@ -3437,7 +3432,7 @@ const LogReviewer = (props) => {
3437
3432
  "Date"),
3438
3433
  React__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: () => {
3439
3434
  dispatch({
3440
- type: ActionType$5.ToggleFilterDrawer,
3435
+ type: ActionType$3.ToggleFilterDrawer,
3441
3436
  filterDrawer: FilterDrawer.Context,
3442
3437
  });
3443
3438
  } },
@@ -3445,7 +3440,7 @@ const LogReviewer = (props) => {
3445
3440
  "Context"),
3446
3441
  (LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React__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: () => {
3447
3442
  dispatch({
3448
- type: ActionType$5.ToggleFilterDrawer,
3443
+ type: ActionType$3.ToggleFilterDrawer,
3449
3444
  filterDrawer: FilterDrawer.Tag,
3450
3445
  });
3451
3446
  } },
@@ -3453,7 +3448,7 @@ const LogReviewer = (props) => {
3453
3448
  "Tag")),
3454
3449
  React__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: () => {
3455
3450
  dispatch({
3456
- type: ActionType$5.ToggleFilterDrawer,
3451
+ type: ActionType$3.ToggleFilterDrawer,
3457
3452
  filterDrawer: FilterDrawer.Action,
3458
3453
  });
3459
3454
  } },
@@ -3461,7 +3456,7 @@ const LogReviewer = (props) => {
3461
3456
  "Action"),
3462
3457
  React__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: () => {
3463
3458
  dispatch({
3464
- type: ActionType$5.ToggleFilterDrawer,
3459
+ type: ActionType$3.ToggleFilterDrawer,
3465
3460
  filterDrawer: FilterDrawer.Advanced,
3466
3461
  });
3467
3462
  } },
@@ -3469,7 +3464,7 @@ const LogReviewer = (props) => {
3469
3464
  "Advanced"),
3470
3465
  React__default.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
3471
3466
  dispatch({
3472
- type: ActionType$5.ResetFilters,
3467
+ type: ActionType$3.ResetFilters,
3473
3468
  initActionErrorFilterState,
3474
3469
  initAdvancedFilterState,
3475
3470
  initContextFilterState,
@@ -3591,7 +3586,7 @@ const LogReviewer = (props) => {
3591
3586
  }
3592
3587
  });
3593
3588
  dispatch({
3594
- type: ActionType$5.UpdateContextFilterState,
3589
+ type: ActionType$3.UpdateContextFilterState,
3595
3590
  contextFilterState,
3596
3591
  });
3597
3592
  } }));
@@ -3606,7 +3601,7 @@ const LogReviewer = (props) => {
3606
3601
  return (React__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) => {
3607
3602
  tagFilterState[tag] = checked;
3608
3603
  dispatch({
3609
- type: ActionType$5.UpdateTagFilterState,
3604
+ type: ActionType$3.UpdateTagFilterState,
3610
3605
  tagFilterState,
3611
3606
  });
3612
3607
  } }));
@@ -3619,21 +3614,21 @@ const LogReviewer = (props) => {
3619
3614
  React__default.createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
3620
3615
  actionErrorFilterState.type = undefined;
3621
3616
  dispatch({
3622
- type: ActionType$5.UpdateActionErrorFilterState,
3617
+ type: ActionType$3.UpdateActionErrorFilterState,
3623
3618
  actionErrorFilterState,
3624
3619
  });
3625
3620
  }, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
3626
3621
  React__default.createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
3627
3622
  actionErrorFilterState.type = LogType$1.Action;
3628
3623
  dispatch({
3629
- type: ActionType$5.UpdateActionErrorFilterState,
3624
+ type: ActionType$3.UpdateActionErrorFilterState,
3630
3625
  actionErrorFilterState,
3631
3626
  });
3632
3627
  }, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
3633
3628
  React__default.createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
3634
3629
  actionErrorFilterState.type = LogType$1.Error;
3635
3630
  dispatch({
3636
- type: ActionType$5.UpdateActionErrorFilterState,
3631
+ type: ActionType$3.UpdateActionErrorFilterState,
3637
3632
  actionErrorFilterState,
3638
3633
  });
3639
3634
  }, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
@@ -3645,7 +3640,7 @@ const LogReviewer = (props) => {
3645
3640
  return (React__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) => {
3646
3641
  actionErrorFilterState.action[action] = checked;
3647
3642
  dispatch({
3648
- type: ActionType$5.UpdateActionErrorFilterState,
3643
+ type: ActionType$3.UpdateActionErrorFilterState,
3649
3644
  actionErrorFilterState,
3650
3645
  });
3651
3646
  } }));
@@ -3656,7 +3651,7 @@ const LogReviewer = (props) => {
3656
3651
  return (React__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) => {
3657
3652
  actionErrorFilterState.target[target] = checked;
3658
3653
  dispatch({
3659
- type: ActionType$5.UpdateActionErrorFilterState,
3654
+ type: ActionType$3.UpdateActionErrorFilterState,
3660
3655
  actionErrorFilterState,
3661
3656
  });
3662
3657
  } }));
@@ -3668,7 +3663,7 @@ const LogReviewer = (props) => {
3668
3663
  React__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) => {
3669
3664
  actionErrorFilterState.errorMessage = e.target.value;
3670
3665
  dispatch({
3671
- type: ActionType$5.UpdateActionErrorFilterState,
3666
+ type: ActionType$3.UpdateActionErrorFilterState,
3672
3667
  actionErrorFilterState,
3673
3668
  });
3674
3669
  } })),
@@ -3679,7 +3674,7 @@ const LogReviewer = (props) => {
3679
3674
  .trim()
3680
3675
  .toUpperCase());
3681
3676
  dispatch({
3682
- type: ActionType$5.UpdateActionErrorFilterState,
3677
+ type: ActionType$3.UpdateActionErrorFilterState,
3683
3678
  actionErrorFilterState,
3684
3679
  });
3685
3680
  } }))))));
@@ -3693,7 +3688,7 @@ const LogReviewer = (props) => {
3693
3688
  React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
3694
3689
  advancedFilterState.userFirstName = e.target.value;
3695
3690
  dispatch({
3696
- type: ActionType$5.UpdateAdvancedFilterState,
3691
+ type: ActionType$3.UpdateAdvancedFilterState,
3697
3692
  advancedFilterState,
3698
3693
  });
3699
3694
  } })),
@@ -3702,7 +3697,7 @@ const LogReviewer = (props) => {
3702
3697
  React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
3703
3698
  advancedFilterState.userLastName = e.target.value;
3704
3699
  dispatch({
3705
- type: ActionType$5.UpdateAdvancedFilterState,
3700
+ type: ActionType$3.UpdateAdvancedFilterState,
3706
3701
  advancedFilterState,
3707
3702
  });
3708
3703
  } })),
@@ -3712,7 +3707,7 @@ const LogReviewer = (props) => {
3712
3707
  advancedFilterState.userEmail = ((e.target.value)
3713
3708
  .trim());
3714
3709
  dispatch({
3715
- type: ActionType$5.UpdateAdvancedFilterState,
3710
+ type: ActionType$3.UpdateAdvancedFilterState,
3716
3711
  advancedFilterState,
3717
3712
  });
3718
3713
  } })),
@@ -3726,7 +3721,7 @@ const LogReviewer = (props) => {
3726
3721
  .trim());
3727
3722
  }
3728
3723
  dispatch({
3729
- type: ActionType$5.UpdateAdvancedFilterState,
3724
+ type: ActionType$3.UpdateAdvancedFilterState,
3730
3725
  advancedFilterState,
3731
3726
  });
3732
3727
  } })),
@@ -3734,21 +3729,21 @@ const LogReviewer = (props) => {
3734
3729
  React__default.createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
3735
3730
  advancedFilterState.includeLearners = checked;
3736
3731
  dispatch({
3737
- type: ActionType$5.UpdateAdvancedFilterState,
3732
+ type: ActionType$3.UpdateAdvancedFilterState,
3738
3733
  advancedFilterState,
3739
3734
  });
3740
3735
  }, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
3741
3736
  React__default.createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
3742
3737
  advancedFilterState.includeTTMs = checked;
3743
3738
  dispatch({
3744
- type: ActionType$5.UpdateAdvancedFilterState,
3739
+ type: ActionType$3.UpdateAdvancedFilterState,
3745
3740
  advancedFilterState,
3746
3741
  });
3747
3742
  }, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
3748
3743
  React__default.createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
3749
3744
  advancedFilterState.includeAdmins = checked;
3750
3745
  dispatch({
3751
- type: ActionType$5.UpdateAdvancedFilterState,
3746
+ type: ActionType$3.UpdateAdvancedFilterState,
3752
3747
  advancedFilterState,
3753
3748
  });
3754
3749
  }, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
@@ -3758,7 +3753,7 @@ const LogReviewer = (props) => {
3758
3753
  React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
3759
3754
  advancedFilterState.courseName = e.target.value;
3760
3755
  dispatch({
3761
- type: ActionType$5.UpdateAdvancedFilterState,
3756
+ type: ActionType$3.UpdateAdvancedFilterState,
3762
3757
  advancedFilterState,
3763
3758
  });
3764
3759
  } })),
@@ -3772,7 +3767,7 @@ const LogReviewer = (props) => {
3772
3767
  .trim());
3773
3768
  }
3774
3769
  dispatch({
3775
- type: ActionType$5.UpdateAdvancedFilterState,
3770
+ type: ActionType$3.UpdateAdvancedFilterState,
3776
3771
  advancedFilterState,
3777
3772
  });
3778
3773
  } }))),
@@ -3781,21 +3776,21 @@ const LogReviewer = (props) => {
3781
3776
  React__default.createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
3782
3777
  advancedFilterState.isMobile = undefined;
3783
3778
  dispatch({
3784
- type: ActionType$5.UpdateAdvancedFilterState,
3779
+ type: ActionType$3.UpdateAdvancedFilterState,
3785
3780
  advancedFilterState,
3786
3781
  });
3787
3782
  } }),
3788
3783
  React__default.createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
3789
3784
  advancedFilterState.isMobile = true;
3790
3785
  dispatch({
3791
- type: ActionType$5.UpdateAdvancedFilterState,
3786
+ type: ActionType$3.UpdateAdvancedFilterState,
3792
3787
  advancedFilterState,
3793
3788
  });
3794
3789
  } }),
3795
3790
  React__default.createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
3796
3791
  advancedFilterState.isMobile = false;
3797
3792
  dispatch({
3798
- type: ActionType$5.UpdateAdvancedFilterState,
3793
+ type: ActionType$3.UpdateAdvancedFilterState,
3799
3794
  advancedFilterState,
3800
3795
  });
3801
3796
  }, noMarginOnRight: true }))),
@@ -3804,21 +3799,21 @@ const LogReviewer = (props) => {
3804
3799
  React__default.createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
3805
3800
  advancedFilterState.source = undefined;
3806
3801
  dispatch({
3807
- type: ActionType$5.UpdateAdvancedFilterState,
3802
+ type: ActionType$3.UpdateAdvancedFilterState,
3808
3803
  advancedFilterState,
3809
3804
  });
3810
3805
  } }),
3811
3806
  React__default.createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
3812
3807
  advancedFilterState.source = LogSource$1.Client;
3813
3808
  dispatch({
3814
- type: ActionType$5.UpdateAdvancedFilterState,
3809
+ type: ActionType$3.UpdateAdvancedFilterState,
3815
3810
  advancedFilterState,
3816
3811
  });
3817
3812
  } }),
3818
3813
  React__default.createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
3819
3814
  advancedFilterState.source = LogSource$1.Server;
3820
3815
  dispatch({
3821
- type: ActionType$5.UpdateAdvancedFilterState,
3816
+ type: ActionType$3.UpdateAdvancedFilterState,
3822
3817
  advancedFilterState,
3823
3818
  });
3824
3819
  }, noMarginOnRight: true })),
@@ -3829,7 +3824,7 @@ const LogReviewer = (props) => {
3829
3824
  advancedFilterState.courseName = ((e.target.value)
3830
3825
  .trim());
3831
3826
  dispatch({
3832
- type: ActionType$5.UpdateAdvancedFilterState,
3827
+ type: ActionType$3.UpdateAdvancedFilterState,
3833
3828
  advancedFilterState,
3834
3829
  });
3835
3830
  } })),
@@ -3839,7 +3834,7 @@ const LogReviewer = (props) => {
3839
3834
  advancedFilterState.courseName = ((e.target.value)
3840
3835
  .trim());
3841
3836
  dispatch({
3842
- type: ActionType$5.UpdateAdvancedFilterState,
3837
+ type: ActionType$3.UpdateAdvancedFilterState,
3843
3838
  advancedFilterState,
3844
3839
  });
3845
3840
  } })))))));
@@ -39439,11 +39434,11 @@ var CreatableSelect$1 = CreatableSelect;
39439
39434
  // Import React
39440
39435
  /* ------------- Actions ------------ */
39441
39436
  // Types of actions
39442
- var ActionType$4;
39437
+ var ActionType$2;
39443
39438
  (function (ActionType) {
39444
39439
  // Update the input value
39445
39440
  ActionType["SetInputValue"] = "SetInputValue";
39446
- })(ActionType$4 || (ActionType$4 = {}));
39441
+ })(ActionType$2 || (ActionType$2 = {}));
39447
39442
  /**
39448
39443
  * Reducer that executes actions
39449
39444
  * @author Yuen Ler Chow
@@ -39452,7 +39447,7 @@ var ActionType$4;
39452
39447
  */
39453
39448
  const reducer$2 = (state, action) => {
39454
39449
  switch (action.type) {
39455
- case ActionType$4.SetInputValue: {
39450
+ case ActionType$2.SetInputValue: {
39456
39451
  return Object.assign(Object.assign({}, state), { inputValue: action.value });
39457
39452
  }
39458
39453
  default: {
@@ -39543,7 +39538,7 @@ const CreatableMultiselect = (props) => {
39543
39538
  }
39544
39539
  // resets text field to empty because the values have been added
39545
39540
  dispatch({
39546
- type: ActionType$4.SetInputValue,
39541
+ type: ActionType$2.SetInputValue,
39547
39542
  value: '',
39548
39543
  });
39549
39544
  };
@@ -39582,7 +39577,7 @@ const CreatableMultiselect = (props) => {
39582
39577
  else {
39583
39578
  // simply update the input value to the new input value
39584
39579
  dispatch({
39585
- type: ActionType$4.SetInputValue,
39580
+ type: ActionType$2.SetInputValue,
39586
39581
  value: newValue,
39587
39582
  });
39588
39583
  }
@@ -39633,13 +39628,13 @@ const style = `
39633
39628
  `;
39634
39629
  /* ------------- Actions ------------ */
39635
39630
  // Types of actions
39636
- var ActionType$3;
39631
+ var ActionType$1;
39637
39632
  (function (ActionType) {
39638
39633
  // Update the DBEntry
39639
39634
  ActionType["UpdateDBEntry"] = "UpdateDBEntry";
39640
39635
  // Start the save spinner
39641
39636
  ActionType["StartSave"] = "StartSave";
39642
- })(ActionType$3 || (ActionType$3 = {}));
39637
+ })(ActionType$1 || (ActionType$1 = {}));
39643
39638
  /**
39644
39639
  * Reducer that executes actions
39645
39640
  * @author Yuen Ler Chow
@@ -39648,10 +39643,10 @@ var ActionType$3;
39648
39643
  */
39649
39644
  const reducer$1 = (state, action) => {
39650
39645
  switch (action.type) {
39651
- case ActionType$3.UpdateDBEntry: {
39646
+ case ActionType$1.UpdateDBEntry: {
39652
39647
  return Object.assign(Object.assign({}, state), { entry: action.dbEntry });
39653
39648
  }
39654
- case ActionType$3.StartSave: {
39649
+ case ActionType$1.StartSave: {
39655
39650
  return Object.assign(Object.assign({}, state), { saving: true });
39656
39651
  }
39657
39652
  default: {
@@ -39686,9 +39681,9 @@ const AddOrEditDBEntry = (props) => {
39686
39681
  * Save changes to the DBEntry and then finish
39687
39682
  * @author Yuen Ler Chow
39688
39683
  */
39689
- const save = () => __awaiter$1(void 0, void 0, void 0, function* () {
39684
+ const save = () => __awaiter(void 0, void 0, void 0, function* () {
39690
39685
  // Start the save loading indicator
39691
- dispatch({ type: ActionType$3.StartSave });
39686
+ dispatch({ type: ActionType$1.StartSave });
39692
39687
  // add all default values to the entry
39693
39688
  entryFields.forEach((field) => {
39694
39689
  if (field.defaultValue && !entry[field.objectKey]) {
@@ -39849,7 +39844,7 @@ const AddOrEditDBEntry = (props) => {
39849
39844
  return (React__default.createElement(RadioButton, { key: choice.value, text: choice.title, selected: entry[field.objectKey] === choice.value, onSelected: () => {
39850
39845
  entry[field.objectKey] = choice.value;
39851
39846
  dispatch({
39852
- type: ActionType$3.UpdateDBEntry,
39847
+ type: ActionType$1.UpdateDBEntry,
39853
39848
  dbEntry: entry,
39854
39849
  });
39855
39850
  }, ariaLabel: choice.title }));
@@ -39861,7 +39856,7 @@ const AddOrEditDBEntry = (props) => {
39861
39856
  React__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) => {
39862
39857
  entry[field.objectKey] = (e.target.value);
39863
39858
  dispatch({
39864
- type: ActionType$3.UpdateDBEntry,
39859
+ type: ActionType$1.UpdateDBEntry,
39865
39860
  dbEntry: entry,
39866
39861
  });
39867
39862
  } }))));
@@ -39874,7 +39869,7 @@ const AddOrEditDBEntry = (props) => {
39874
39869
  entry[field.objectKey] = (e.target.value
39875
39870
  .replace(/[^0-9]/g, ''));
39876
39871
  dispatch({
39877
- type: ActionType$3.UpdateDBEntry,
39872
+ type: ActionType$1.UpdateDBEntry,
39878
39873
  dbEntry: entry,
39879
39874
  });
39880
39875
  } }))));
@@ -39904,7 +39899,7 @@ const AddOrEditDBEntry = (props) => {
39904
39899
  }
39905
39900
  // Save
39906
39901
  dispatch({
39907
- type: ActionType$3.UpdateDBEntry,
39902
+ type: ActionType$1.UpdateDBEntry,
39908
39903
  dbEntry: entry,
39909
39904
  });
39910
39905
  }, ariaLabel: choice.title }));
@@ -39919,7 +39914,7 @@ const AddOrEditDBEntry = (props) => {
39919
39914
  // Update entry and save
39920
39915
  entry[field.objectKey] = values;
39921
39916
  dispatch({
39922
- type: ActionType$3.UpdateDBEntry,
39917
+ type: ActionType$1.UpdateDBEntry,
39923
39918
  dbEntry: entry,
39924
39919
  });
39925
39920
  } })))));
@@ -39932,7 +39927,7 @@ const AddOrEditDBEntry = (props) => {
39932
39927
  React__default.createElement(CreatableMultiselect, { disabled: disabled, type: DBEntryFieldType$1.NumberArray, values: entry[field.objectKey] || [], onChange: (values) => {
39933
39928
  entry[field.objectKey] = values;
39934
39929
  dispatch({
39935
- type: ActionType$3.UpdateDBEntry,
39930
+ type: ActionType$1.UpdateDBEntry,
39936
39931
  dbEntry: entry,
39937
39932
  });
39938
39933
  } })))));
@@ -39956,7 +39951,7 @@ const AddOrEditDBEntry = (props) => {
39956
39951
  return renderEntryField(field, disabled);
39957
39952
  }),
39958
39953
  React__default.createElement("div", { className: "text-center mt-2" },
39959
- React__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* () {
39954
+ React__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* () {
39960
39955
  if (validationError) {
39961
39956
  return alert$1('Please fix the following error', validationError);
39962
39957
  }
@@ -40002,7 +39997,7 @@ const generateEndpointPath = (collectionName, adminsOnly) => {
40002
39997
  */
40003
39998
  /* ------------- Actions ------------ */
40004
39999
  // Types of actions
40005
- var ActionType$2;
40000
+ var ActionType;
40006
40001
  (function (ActionType) {
40007
40002
  // Show adder
40008
40003
  ActionType["ShowAdder"] = "ShowAdder";
@@ -40016,7 +40011,7 @@ var ActionType$2;
40016
40011
  ActionType["StartDelete"] = "StartDelete";
40017
40012
  // Finish deletion process
40018
40013
  ActionType["FinishDelete"] = "FinishDelete";
40019
- })(ActionType$2 || (ActionType$2 = {}));
40014
+ })(ActionType || (ActionType = {}));
40020
40015
  /**
40021
40016
  * Reducer that executes actions
40022
40017
  * @author Yuen Ler Chow
@@ -40025,16 +40020,16 @@ var ActionType$2;
40025
40020
  */
40026
40021
  const reducer = (state, action) => {
40027
40022
  switch (action.type) {
40028
- case ActionType$2.FinishLoading: {
40023
+ case ActionType.FinishLoading: {
40029
40024
  return Object.assign(Object.assign({}, state), { loading: false, dbEntries: action.dbEntries });
40030
40025
  }
40031
- case ActionType$2.ShowAdder: {
40026
+ case ActionType.ShowAdder: {
40032
40027
  return Object.assign(Object.assign({}, state), { adding: true, dbEntryToEdit: undefined });
40033
40028
  }
40034
- case ActionType$2.ShowEditor: {
40029
+ case ActionType.ShowEditor: {
40035
40030
  return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: action.dbEntry });
40036
40031
  }
40037
- case ActionType$2.FinishAdd: {
40032
+ case ActionType.FinishAdd: {
40038
40033
  // Handle cancel
40039
40034
  const finishedEntry = action.dbEntry;
40040
40035
  if (!finishedEntry) {
@@ -40058,10 +40053,10 @@ const reducer = (state, action) => {
40058
40053
  // Update the state
40059
40054
  return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: undefined, dbEntries: updatedDbEntries });
40060
40055
  }
40061
- case ActionType$2.StartDelete: {
40056
+ case ActionType.StartDelete: {
40062
40057
  return Object.assign(Object.assign({}, state), { loading: true });
40063
40058
  }
40064
- case ActionType$2.FinishDelete: {
40059
+ case ActionType.FinishDelete: {
40065
40060
  return Object.assign(Object.assign({}, state), { loading: false,
40066
40061
  // Remove the deleted entry from the list
40067
40062
  dbEntries: state.dbEntries.filter((entry) => {
@@ -40100,7 +40095,7 @@ const DBEntryManagerPanel = (props) => {
40100
40095
  * @author Yuen Ler Chow
40101
40096
  * @param entry the database entry to delete
40102
40097
  */
40103
- const deleteEntry = (entry) => __awaiter$1(void 0, void 0, void 0, function* () {
40098
+ const deleteEntry = (entry) => __awaiter(void 0, void 0, void 0, function* () {
40104
40099
  // Confirm
40105
40100
  const confirmed = yield confirm('Remove?', `Are you sure you want to remove this ${itemName}?`, {
40106
40101
  confirmButtonText: 'Remove Item',
@@ -40113,7 +40108,7 @@ const DBEntryManagerPanel = (props) => {
40113
40108
  try {
40114
40109
  // Start loader
40115
40110
  dispatch({
40116
- type: ActionType$2.StartDelete,
40111
+ type: ActionType.StartDelete,
40117
40112
  });
40118
40113
  // Perform deletion
40119
40114
  yield visitServerEndpoint({
@@ -40122,7 +40117,7 @@ const DBEntryManagerPanel = (props) => {
40122
40117
  });
40123
40118
  // Finish loader
40124
40119
  dispatch({
40125
- type: ActionType$2.FinishDelete,
40120
+ type: ActionType.FinishDelete,
40126
40121
  dbEntry: entry,
40127
40122
  idPropName,
40128
40123
  });
@@ -40139,7 +40134,7 @@ const DBEntryManagerPanel = (props) => {
40139
40134
  * @author Yuen Ler Chow
40140
40135
  */
40141
40136
  useEffect(() => {
40142
- (() => __awaiter$1(void 0, void 0, void 0, function* () {
40137
+ (() => __awaiter(void 0, void 0, void 0, function* () {
40143
40138
  // Load list of database entries
40144
40139
  try {
40145
40140
  const data = yield visitServerEndpoint({
@@ -40151,7 +40146,7 @@ const DBEntryManagerPanel = (props) => {
40151
40146
  });
40152
40147
  // Save loaded data
40153
40148
  dispatch({
40154
- type: ActionType$2.FinishLoading,
40149
+ type: ActionType.FinishLoading,
40155
40150
  dbEntries: data,
40156
40151
  });
40157
40152
  }
@@ -40194,7 +40189,7 @@ const DBEntryManagerPanel = (props) => {
40194
40189
  React__default.createElement("span", { className: "d-none d-md-inline ms-1" }, "Remove")),
40195
40190
  !disableEdit && (React__default.createElement("button", { type: "button", id: `DBEntryManagerPanel-edit-with-id-${entry[idPropName]}`, className: "btn btn-primary", "aria-label": `edit db entry: ${entry[titlePropName]}`, onClick: () => {
40196
40191
  dispatch({
40197
- type: ActionType$2.ShowEditor,
40192
+ type: ActionType.ShowEditor,
40198
40193
  dbEntry: entry,
40199
40194
  });
40200
40195
  } },
@@ -40204,7 +40199,7 @@ const DBEntryManagerPanel = (props) => {
40204
40199
  React__default.createElement("div", { className: "d-grid" },
40205
40200
  React__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: () => {
40206
40201
  dispatch({
40207
- type: ActionType$2.ShowAdder,
40202
+ type: ActionType.ShowAdder,
40208
40203
  });
40209
40204
  } },
40210
40205
  React__default.createElement(FontAwesomeIcon, { icon: faPlus, className: "me-2" }),
@@ -40216,7 +40211,7 @@ const DBEntryManagerPanel = (props) => {
40216
40211
  if (!loading && (adding || dbEntryToEdit)) {
40217
40212
  body = (React__default.createElement(AddOrEditDBEntry, { saveEndpointPath: endpoint, validateEntry: validateEntry, modifyEntry: modifyEntry, entryFields: entryFields, dbEntryToEdit: dbEntryToEdit, idPropName: idPropName, entries: dbEntries, onFinished: (entry) => {
40218
40213
  dispatch({
40219
- type: ActionType$2.FinishAdd,
40214
+ type: ActionType.FinishAdd,
40220
40215
  dbEntry: entry,
40221
40216
  idPropName,
40222
40217
  });
@@ -40439,7 +40434,7 @@ const padZerosLeft = (num, numDigits) => {
40439
40434
  const LOG_REVIEW_STATUS_ROUTE = `${ROUTE_PATH_PREFIX}/logs/access_allowed`;
40440
40435
 
40441
40436
  // Stored copy of caccl functions
40442
- let _cacclGetLaunchInfo$1;
40437
+ let _cacclGetLaunchInfo;
40443
40438
  // Stored copy of dce-mango log collection
40444
40439
  let _logCollection;
40445
40440
  /*------------------------------------------------------------------------*/
@@ -40451,11 +40446,11 @@ let _logCollection;
40451
40446
  * @param req express request object
40452
40447
  * @returns object { launched, launchInfo }
40453
40448
  */
40454
- const cacclGetLaunchInfo$1 = (req) => {
40455
- if (!_cacclGetLaunchInfo$1) {
40456
- throw new ErrorWithCode$1('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$3.NoCACCLGetLaunchInfoFunction);
40449
+ const cacclGetLaunchInfo = (req) => {
40450
+ if (!_cacclGetLaunchInfo) {
40451
+ throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
40457
40452
  }
40458
- return _cacclGetLaunchInfo$1(req);
40453
+ return _cacclGetLaunchInfo(req);
40459
40454
  };
40460
40455
  /**
40461
40456
  * Get log collection
@@ -40487,7 +40482,7 @@ const internalGetLogCollection = () => {
40487
40482
  * to review logs
40488
40483
  */
40489
40484
  const initServer = (opts) => {
40490
- _cacclGetLaunchInfo$1 = opts.getLaunchInfo;
40485
+ _cacclGetLaunchInfo = opts.getLaunchInfo;
40491
40486
  _logCollection = opts.logCollection;
40492
40487
  /*----------------------------------------*/
40493
40488
  /* Logging */
@@ -40511,18 +40506,18 @@ const initServer = (opts) => {
40511
40506
  * @param {LogAction} [action] the type of action performed on the target
40512
40507
  * @returns {Log}
40513
40508
  */
40514
- opts.app.post(LOG_ROUTE_PATH, genRouteHandler$1({
40509
+ opts.app.post(LOG_ROUTE_PATH, genRouteHandler({
40515
40510
  paramTypes: {
40516
- context: ParamType$3.String,
40517
- subcontext: ParamType$3.String,
40518
- tags: ParamType$3.JSON,
40519
- level: ParamType$3.String,
40520
- metadata: ParamType$3.JSON,
40521
- errorMessage: ParamType$3.StringOptional,
40522
- errorCode: ParamType$3.StringOptional,
40523
- errorStack: ParamType$3.StringOptional,
40524
- target: ParamType$3.StringOptional,
40525
- action: ParamType$3.StringOptional,
40511
+ context: ParamType$1.String,
40512
+ subcontext: ParamType$1.String,
40513
+ tags: ParamType$1.JSON,
40514
+ level: ParamType$1.String,
40515
+ metadata: ParamType$1.JSON,
40516
+ errorMessage: ParamType$1.StringOptional,
40517
+ errorCode: ParamType$1.StringOptional,
40518
+ errorStack: ParamType$1.StringOptional,
40519
+ target: ParamType$1.StringOptional,
40520
+ action: ParamType$1.StringOptional,
40526
40521
  },
40527
40522
  handler: ({ params, logServerEvent }) => {
40528
40523
  // Create log info
@@ -40568,7 +40563,7 @@ const initServer = (opts) => {
40568
40563
  * @param isAdmin if true, the user is an admin
40569
40564
  * @returns true if the user can review logs
40570
40565
  */
40571
- const canReviewLogs = (userId, isAdmin) => __awaiter$1(void 0, void 0, void 0, function* () {
40566
+ const canReviewLogs = (userId, isAdmin) => __awaiter(void 0, void 0, void 0, function* () {
40572
40567
  // Immediately deny access if user is not an admin
40573
40568
  if (!isAdmin) {
40574
40569
  return false;
@@ -40600,8 +40595,8 @@ const initServer = (opts) => {
40600
40595
  * @author Gabe Abrams
40601
40596
  * @returns {boolean} true if user has access
40602
40597
  */
40603
- opts.app.get(LOG_REVIEW_STATUS_ROUTE, genRouteHandler$1({
40604
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
40598
+ opts.app.get(LOG_REVIEW_STATUS_ROUTE, genRouteHandler({
40599
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
40605
40600
  const { userId, isAdmin } = params;
40606
40601
  const canReview = yield canReviewLogs(userId, isAdmin);
40607
40602
  return canReview;
@@ -40614,18 +40609,18 @@ const initServer = (opts) => {
40614
40609
  * @param {number} month the month to query (e.g. 1 = January)
40615
40610
  * @returns {Log[]} list of logs from the given month
40616
40611
  */
40617
- opts.app.get(`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`, genRouteHandler$1({
40612
+ opts.app.get(`${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/:year/months/:month`, genRouteHandler({
40618
40613
  paramTypes: {
40619
- year: ParamType$3.Int,
40620
- month: ParamType$3.Int,
40614
+ year: ParamType$1.Int,
40615
+ month: ParamType$1.Int,
40621
40616
  },
40622
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
40617
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
40623
40618
  // Get user info
40624
40619
  const { year, month, userId, isAdmin, } = params;
40625
40620
  // Validate user
40626
40621
  const canReview = yield canReviewLogs(userId, isAdmin);
40627
40622
  if (!canReview) {
40628
- throw new ErrorWithCode$1('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$3.NotAllowedToReviewLogs);
40623
+ throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
40629
40624
  }
40630
40625
  // Query for logs
40631
40626
  const logs = yield _logCollection.find({
@@ -40651,7 +40646,7 @@ const initServer = (opts) => {
40651
40646
  * @param [opts.status=500] the https status code to use
40652
40647
  * defined)
40653
40648
  */
40654
- const handleError$1 = (res, error) => {
40649
+ const handleError = (res, error) => {
40655
40650
  // Get the error message
40656
40651
  let message;
40657
40652
  if (error && error.message) {
@@ -40666,7 +40661,7 @@ const handleError$1 = (res, error) => {
40666
40661
  message = 'An unknown error occurred.';
40667
40662
  }
40668
40663
  // Get the error code
40669
- const code = (error.code || ReactKitErrorCode$3.NoCode);
40664
+ const code = (error.code || ReactKitErrorCode$1.NoCode);
40670
40665
  // Get the status code
40671
40666
  const status = (error.status || 500);
40672
40667
  // Respond to user
@@ -40691,7 +40686,7 @@ const handleError$1 = (res, error) => {
40691
40686
  * @param res express response
40692
40687
  * @param body the body of the response to send to the client
40693
40688
  */
40694
- const handleSuccess$1 = (res, body) => {
40689
+ const handleSuccess = (res, body) => {
40695
40690
  // Send a http 200 json response
40696
40691
  res.json({
40697
40692
  // Include the body as a parameter
@@ -40720,7 +40715,7 @@ const genErrorPage = (opts = {}) => {
40720
40715
  const title = ((_a = opts.title) !== null && _a !== void 0 ? _a : 'An Error Occurred');
40721
40716
  const pageTitle = ((_b = opts.pageTitle) !== null && _b !== void 0 ? _b : title);
40722
40717
  const description = ((_c = opts.description) !== null && _c !== void 0 ? _c : 'An unknown server error occurred. Please contact support.');
40723
- const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$3.NoCode);
40718
+ const code = ((_d = opts.code) !== null && _d !== void 0 ? _d : ReactKitErrorCode$1.NoCode);
40724
40719
  return `
40725
40720
  <head>
40726
40721
  <!-- Metadata -->
@@ -40957,9 +40952,9 @@ const parseUserAgent = (userAgent) => {
40957
40952
  * userLastName, isLearner, isTTM, isAdmin, and any other variables that
40958
40953
  * are directly added to the session, if the user does have a session.
40959
40954
  */
40960
- const genRouteHandler$1 = (opts) => {
40955
+ const genRouteHandler = (opts) => {
40961
40956
  // Return a route handler
40962
- return (req, res, next) => __awaiter$1(void 0, void 0, void 0, function* () {
40957
+ return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
40963
40958
  var _a, _b;
40964
40959
  // Output params
40965
40960
  const output = {};
@@ -40975,17 +40970,17 @@ const genRouteHandler$1 = (opts) => {
40975
40970
  || req.query[name]
40976
40971
  || req.body[name]);
40977
40972
  // Parse
40978
- if (type === ParamType$3.Boolean || type === ParamType$3.BooleanOptional) {
40973
+ if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
40979
40974
  // Boolean
40980
40975
  // Handle case where value doesn't exist
40981
40976
  if (value === undefined) {
40982
- if (type === ParamType$3.BooleanOptional) {
40977
+ if (type === ParamType$1.BooleanOptional) {
40983
40978
  output[name] = undefined;
40984
40979
  }
40985
40980
  else {
40986
- return handleError$1(res, {
40981
+ return handleError(res, {
40987
40982
  message: `Parameter ${name} is required, but it was not included.`,
40988
- code: ReactKitErrorCode$3.MissingParameter,
40983
+ code: ReactKitErrorCode$1.MissingParameter,
40989
40984
  status: 422,
40990
40985
  });
40991
40986
  }
@@ -41006,17 +41001,17 @@ const genRouteHandler$1 = (opts) => {
41006
41001
  ].indexOf(simpleVal) >= 0);
41007
41002
  }
41008
41003
  }
41009
- else if (type === ParamType$3.Float || type === ParamType$3.FloatOptional) {
41004
+ else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
41010
41005
  // Float
41011
41006
  // Handle case where value doesn't exist
41012
41007
  if (value === undefined) {
41013
- if (type === ParamType$3.FloatOptional) {
41008
+ if (type === ParamType$1.FloatOptional) {
41014
41009
  output[name] = undefined;
41015
41010
  }
41016
41011
  else {
41017
- return handleError$1(res, {
41012
+ return handleError(res, {
41018
41013
  message: `Parameter ${name} is required, but it was not included.`,
41019
- code: ReactKitErrorCode$3.MissingParameter,
41014
+ code: ReactKitErrorCode$1.MissingParameter,
41020
41015
  status: 422,
41021
41016
  });
41022
41017
  }
@@ -41027,24 +41022,24 @@ const genRouteHandler$1 = (opts) => {
41027
41022
  }
41028
41023
  else {
41029
41024
  // Issue!
41030
- return handleError$1(res, {
41025
+ return handleError(res, {
41031
41026
  message: `Request data was malformed: ${name} was not a valid float.`,
41032
- code: ReactKitErrorCode$3.InvalidParameter,
41027
+ code: ReactKitErrorCode$1.InvalidParameter,
41033
41028
  status: 422,
41034
41029
  });
41035
41030
  }
41036
41031
  }
41037
- else if (type === ParamType$3.Int || type === ParamType$3.IntOptional) {
41032
+ else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
41038
41033
  // Int
41039
41034
  // Handle case where value doesn't exist
41040
41035
  if (value === undefined) {
41041
- if (type === ParamType$3.IntOptional) {
41036
+ if (type === ParamType$1.IntOptional) {
41042
41037
  output[name] = undefined;
41043
41038
  }
41044
41039
  else {
41045
- return handleError$1(res, {
41040
+ return handleError(res, {
41046
41041
  message: `Parameter ${name} is required, but it was not included.`,
41047
- code: ReactKitErrorCode$3.MissingParameter,
41042
+ code: ReactKitErrorCode$1.MissingParameter,
41048
41043
  status: 422,
41049
41044
  });
41050
41045
  }
@@ -41055,24 +41050,24 @@ const genRouteHandler$1 = (opts) => {
41055
41050
  }
41056
41051
  else {
41057
41052
  // Issue!
41058
- return handleError$1(res, {
41053
+ return handleError(res, {
41059
41054
  message: `Request data was malformed: ${name} was not a valid int.`,
41060
- code: ReactKitErrorCode$3.InvalidParameter,
41055
+ code: ReactKitErrorCode$1.InvalidParameter,
41061
41056
  status: 422,
41062
41057
  });
41063
41058
  }
41064
41059
  }
41065
- else if (type === ParamType$3.JSON || type === ParamType$3.JSONOptional) {
41060
+ else if (type === ParamType$1.JSON || type === ParamType$1.JSONOptional) {
41066
41061
  // Stringified JSON
41067
41062
  // Handle case where value doesn't exist
41068
41063
  if (value === undefined) {
41069
- if (type === ParamType$3.JSONOptional) {
41064
+ if (type === ParamType$1.JSONOptional) {
41070
41065
  output[name] = undefined;
41071
41066
  }
41072
41067
  else {
41073
- return handleError$1(res, {
41068
+ return handleError(res, {
41074
41069
  message: `Parameter ${name} is required, but it was not included.`,
41075
- code: ReactKitErrorCode$3.MissingParameter,
41070
+ code: ReactKitErrorCode$1.MissingParameter,
41076
41071
  status: 422,
41077
41072
  });
41078
41073
  }
@@ -41084,25 +41079,25 @@ const genRouteHandler$1 = (opts) => {
41084
41079
  output[name] = JSON.parse(String(value));
41085
41080
  }
41086
41081
  catch (err) {
41087
- return handleError$1(res, {
41082
+ return handleError(res, {
41088
41083
  message: `Request data was malformed: ${name} was not a valid JSON payload.`,
41089
- code: ReactKitErrorCode$3.InvalidParameter,
41084
+ code: ReactKitErrorCode$1.InvalidParameter,
41090
41085
  status: 422,
41091
41086
  });
41092
41087
  }
41093
41088
  }
41094
41089
  }
41095
- else if (type === ParamType$3.String || type === ParamType$3.StringOptional) {
41090
+ else if (type === ParamType$1.String || type === ParamType$1.StringOptional) {
41096
41091
  // String
41097
41092
  // Handle case where value doesn't exist
41098
41093
  if (value === undefined) {
41099
- if (type === ParamType$3.StringOptional) {
41094
+ if (type === ParamType$1.StringOptional) {
41100
41095
  output[name] = undefined;
41101
41096
  }
41102
41097
  else {
41103
- return handleError$1(res, {
41098
+ return handleError(res, {
41104
41099
  message: `Parameter ${name} is required, but it was not included.`,
41105
- code: ReactKitErrorCode$3.MissingParameter,
41100
+ code: ReactKitErrorCode$1.MissingParameter,
41106
41101
  status: 422,
41107
41102
  });
41108
41103
  }
@@ -41115,9 +41110,9 @@ const genRouteHandler$1 = (opts) => {
41115
41110
  }
41116
41111
  else {
41117
41112
  // No valid data type
41118
- return handleError$1(res, {
41113
+ return handleError(res, {
41119
41114
  message: `An internal error occurred: we could not determine the type of ${name}.`,
41120
- code: ReactKitErrorCode$3.InvalidParameter,
41115
+ code: ReactKitErrorCode$1.InvalidParameter,
41121
41116
  status: 422,
41122
41117
  });
41123
41118
  }
@@ -41126,15 +41121,15 @@ const genRouteHandler$1 = (opts) => {
41126
41121
  /* Launch Info */
41127
41122
  /*----------------------------------------*/
41128
41123
  // Get launch info
41129
- const { launched, launchInfo } = cacclGetLaunchInfo$1(req);
41124
+ const { launched, launchInfo } = cacclGetLaunchInfo(req);
41130
41125
  if (
41131
41126
  // Not launched
41132
41127
  (!launched || !launchInfo)
41133
41128
  // Not skipping the session check
41134
41129
  && !opts.skipSessionCheck) {
41135
- return handleError$1(res, {
41130
+ return handleError(res, {
41136
41131
  message: 'Your session has expired. Please refresh the page and try again.',
41137
- code: ReactKitErrorCode$3.SessionExpired,
41132
+ code: ReactKitErrorCode$1.SessionExpired,
41138
41133
  status: 401,
41139
41134
  });
41140
41135
  }
@@ -41152,9 +41147,9 @@ const genRouteHandler$1 = (opts) => {
41152
41147
  && !launchInfo.isAdmin))
41153
41148
  // Not skipping the session check
41154
41149
  && !opts.skipSessionCheck) {
41155
- return handleError$1(res, {
41150
+ return handleError(res, {
41156
41151
  message: 'Your session was invalid. Please refresh the page and try again.',
41157
- code: ReactKitErrorCode$3.SessionExpired,
41152
+ code: ReactKitErrorCode$1.SessionExpired,
41158
41153
  status: 401,
41159
41154
  });
41160
41155
  }
@@ -41211,9 +41206,9 @@ const genRouteHandler$1 = (opts) => {
41211
41206
  && !output.isTTM
41212
41207
  && !output.isAdmin) {
41213
41208
  // Course of interest is not the launch course
41214
- return handleError$1(res, {
41209
+ return handleError(res, {
41215
41210
  message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
41216
- code: ReactKitErrorCode$3.WrongCourse,
41211
+ code: ReactKitErrorCode$1.WrongCourse,
41217
41212
  status: 401,
41218
41213
  });
41219
41214
  }
@@ -41231,9 +41226,9 @@ const genRouteHandler$1 = (opts) => {
41231
41226
  // User is not an admin
41232
41227
  && !output.isAdmin)) {
41233
41228
  // User does not have access
41234
- return handleError$1(res, {
41229
+ return handleError(res, {
41235
41230
  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.',
41236
- code: ReactKitErrorCode$3.NotTTM,
41231
+ code: ReactKitErrorCode$1.NotTTM,
41237
41232
  status: 401,
41238
41233
  });
41239
41234
  }
@@ -41244,9 +41239,9 @@ const genRouteHandler$1 = (opts) => {
41244
41239
  // User is not an admin
41245
41240
  && !output.isAdmin) {
41246
41241
  // User does not have access
41247
- return handleError$1(res, {
41242
+ return handleError(res, {
41248
41243
  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.',
41249
- code: ReactKitErrorCode$3.NotAdmin,
41244
+ code: ReactKitErrorCode$1.NotAdmin,
41250
41245
  status: 401,
41251
41246
  });
41252
41247
  }
@@ -41258,7 +41253,7 @@ const genRouteHandler$1 = (opts) => {
41258
41253
  * Log an event on the server
41259
41254
  * @author Gabe Abrams
41260
41255
  */
41261
- const logServerEvent = (opts) => __awaiter$1(void 0, void 0, void 0, function* () {
41256
+ const logServerEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
41262
41257
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
41263
41258
  // NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
41264
41259
  // that indicates that this is actually a client event, but we don't
@@ -41302,7 +41297,7 @@ const genRouteHandler$1 = (opts) => {
41302
41297
  ? {
41303
41298
  type: LogType$1.Error,
41304
41299
  errorMessage: (_j = opts.error.message) !== null && _j !== void 0 ? _j : 'Unknown message',
41305
- errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$3.NoCode,
41300
+ errorCode: (_k = opts.error.code) !== null && _k !== void 0 ? _k : ReactKitErrorCode$1.NoCode,
41306
41301
  errorStack: (_l = opts.error.stack) !== null && _l !== void 0 ? _l : 'No stack',
41307
41302
  }
41308
41303
  : {
@@ -41462,13 +41457,13 @@ const genRouteHandler$1 = (opts) => {
41462
41457
  });
41463
41458
  // Send results to client (only if next wasn't called)
41464
41459
  if (!responseSent) {
41465
- return handleSuccess$1(res, results !== null && results !== void 0 ? results : undefined);
41460
+ return handleSuccess(res, results !== null && results !== void 0 ? results : undefined);
41466
41461
  }
41467
41462
  }
41468
41463
  catch (err) {
41469
41464
  // Send error to client (only if next wasn't called)
41470
41465
  if (!responseSent) {
41471
- handleError$1(res, err);
41466
+ handleError(res, err);
41472
41467
  // Log server-side error
41473
41468
  logServerEvent({
41474
41469
  context: LogBuiltInMetadata.Context.ServerEndpointError,
@@ -41507,7 +41502,7 @@ const startMinWait = (minWaitMs) => {
41507
41502
  * Finish the remaining time to wait
41508
41503
  * @author Gabe Abrams
41509
41504
  */
41510
- return () => __awaiter$1(void 0, void 0, void 0, function* () {
41505
+ return () => __awaiter(void 0, void 0, void 0, function* () {
41511
41506
  const endTimestamp = Date.now();
41512
41507
  // Calculate remaining time to wait
41513
41508
  const elapsedTimeMs = (endTimestamp - startTimestamp);
@@ -41594,7 +41589,7 @@ const onlyKeepLetters = (str) => {
41594
41589
  * once
41595
41590
  * @returns array of resolved values in the same order as the task functions
41596
41591
  */
41597
- const parallelLimit = (taskFunctions, limit) => __awaiter$1(void 0, void 0, void 0, function* () {
41592
+ const parallelLimit = (taskFunctions, limit) => __awaiter(void 0, void 0, void 0, function* () {
41598
41593
  const results = [];
41599
41594
  // Wait until finished with all tasks
41600
41595
  yield new Promise((resolve) => {
@@ -41605,7 +41600,7 @@ const parallelLimit = (taskFunctions, limit) => __awaiter$1(void 0, void 0, void
41605
41600
  * Start the next task
41606
41601
  * @author Gabe Abrams
41607
41602
  */
41608
- const startTask = () => __awaiter$1(void 0, void 0, void 0, function* () {
41603
+ const startTask = () => __awaiter(void 0, void 0, void 0, function* () {
41609
41604
  const taskIndex = nextTaskIndex++;
41610
41605
  // Get the task
41611
41606
  const taskFunction = taskFunctions[taskIndex];
@@ -41658,7 +41653,7 @@ let canReview = undefined;
41658
41653
  * @author Gabe Abrams
41659
41654
  * @returns true if current user can review logs
41660
41655
  */
41661
- const canReviewLogs = () => __awaiter$1(void 0, void 0, void 0, function* () {
41656
+ const canReviewLogs = () => __awaiter(void 0, void 0, void 0, function* () {
41662
41657
  // If cached, use that value
41663
41658
  if (canReview !== undefined) {
41664
41659
  return canReview;
@@ -41772,649 +41767,6 @@ const getLocalTimeInfo = (dateOrTimestamp) => {
41772
41767
  };
41773
41768
  };
41774
41769
 
41775
- /******************************************************************************
41776
- Copyright (c) Microsoft Corporation.
41777
-
41778
- Permission to use, copy, modify, and/or distribute this software for any
41779
- purpose with or without fee is hereby granted.
41780
-
41781
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
41782
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41783
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41784
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41785
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41786
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41787
- PERFORMANCE OF THIS SOFTWARE.
41788
- ***************************************************************************** */
41789
-
41790
- function __awaiter(thisArg, _arguments, P, generator) {
41791
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41792
- return new (P || (P = Promise))(function (resolve, reject) {
41793
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
41794
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41795
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41796
- step((generator = generator.apply(thisArg, _arguments || [])).next());
41797
- });
41798
- }
41799
-
41800
- // Highest error code = DRK10
41801
- /**
41802
- * List of error codes built into the react kit
41803
- * @author Gabe Abrams
41804
- */
41805
- var ReactKitErrorCode;
41806
- (function (ReactKitErrorCode) {
41807
- ReactKitErrorCode["NoResponse"] = "DRK1";
41808
- ReactKitErrorCode["NoCode"] = "DRK2";
41809
- ReactKitErrorCode["SessionExpired"] = "DRK3";
41810
- ReactKitErrorCode["MissingParameter"] = "DRK4";
41811
- ReactKitErrorCode["InvalidParameter"] = "DRK5";
41812
- ReactKitErrorCode["WrongCourse"] = "DRK6";
41813
- ReactKitErrorCode["NoCACCLSendRequestFunction"] = "DRK7";
41814
- ReactKitErrorCode["NoCACCLGetLaunchInfoFunction"] = "DRK8";
41815
- ReactKitErrorCode["NotTTM"] = "DRK9";
41816
- ReactKitErrorCode["NotAdmin"] = "DRK10";
41817
- })(ReactKitErrorCode || (ReactKitErrorCode = {}));
41818
- var ReactKitErrorCode$1 = ReactKitErrorCode;
41819
-
41820
- /**
41821
- * Types of buttons in the modal
41822
- * @author Gabe Abrams
41823
- */
41824
- var ModalButtonType;
41825
- (function (ModalButtonType) {
41826
- ModalButtonType["Okay"] = "okay";
41827
- ModalButtonType["Cancel"] = "cancel";
41828
- ModalButtonType["Yes"] = "yes";
41829
- ModalButtonType["No"] = "no";
41830
- ModalButtonType["Abandon"] = "abandon";
41831
- ModalButtonType["GoBack"] = "goBack";
41832
- ModalButtonType["Continue"] = "continue";
41833
- ModalButtonType["ImSure"] = "imSure";
41834
- ModalButtonType["Delete"] = "delete";
41835
- ModalButtonType["Confirm"] = "confirm";
41836
- })(ModalButtonType || (ModalButtonType = {}));
41837
- var ModalButtonType$1 = ModalButtonType;
41838
-
41839
- /**
41840
- * Types of modals
41841
- * @author Gabe Abrams
41842
- */
41843
- var ModalType;
41844
- (function (ModalType) {
41845
- ModalType["Okay"] = "okay";
41846
- ModalType["OkayCancel"] = "okay-cancel";
41847
- ModalType["YesNo"] = "yes-no";
41848
- ModalType["YesNoCancel"] = "yes-no-cancel";
41849
- ModalType["AbandonGoBack"] = "abandon-goBack";
41850
- ModalType["ImSureCancel"] = "imSure-cancel";
41851
- ModalType["DeleteCancel"] = "delete-cancel";
41852
- ModalType["ConfirmCancel"] = "confirm-cancel";
41853
- ModalType["NoButtons"] = "-";
41854
- })(ModalType || (ModalType = {}));
41855
- var ModalType$1 = ModalType;
41856
-
41857
- /**
41858
- * Bootstrap variants
41859
- * @author Gabe Abrams
41860
- */
41861
- var Variant;
41862
- (function (Variant) {
41863
- Variant["Primary"] = "primary";
41864
- Variant["Secondary"] = "secondary";
41865
- Variant["Success"] = "success";
41866
- Variant["Warning"] = "warning";
41867
- Variant["Info"] = "info";
41868
- Variant["Danger"] = "danger";
41869
- Variant["Light"] = "light";
41870
- Variant["Dark"] = "dark";
41871
- })(Variant || (Variant = {}));
41872
- var Variant$1 = Variant;
41873
-
41874
- /**
41875
- * Modal sizes
41876
- * @author Gabe Abrams
41877
- */
41878
- var ModalSize;
41879
- (function (ModalSize) {
41880
- ModalSize["Small"] = "sm";
41881
- ModalSize["Medium"] = "md";
41882
- ModalSize["Large"] = "lg";
41883
- ModalSize["ExtraLarge"] = "xl";
41884
- })(ModalSize || (ModalSize = {}));
41885
- // Modal type to list of buttons
41886
- ({
41887
- [ModalType$1.Okay]: [
41888
- ModalButtonType$1.Okay,
41889
- ],
41890
- [ModalType$1.OkayCancel]: [
41891
- ModalButtonType$1.Okay,
41892
- ModalButtonType$1.Cancel,
41893
- ],
41894
- [ModalType$1.YesNo]: [
41895
- ModalButtonType$1.Yes,
41896
- ModalButtonType$1.No,
41897
- ],
41898
- [ModalType$1.YesNoCancel]: [
41899
- ModalButtonType$1.Yes,
41900
- ModalButtonType$1.No,
41901
- ModalButtonType$1.Cancel,
41902
- ],
41903
- [ModalType$1.AbandonGoBack]: [
41904
- ModalButtonType$1.Abandon,
41905
- ModalButtonType$1.GoBack,
41906
- ],
41907
- [ModalType$1.ImSureCancel]: [
41908
- ModalButtonType$1.ImSure,
41909
- ModalButtonType$1.Cancel,
41910
- ],
41911
- [ModalType$1.DeleteCancel]: [
41912
- ModalButtonType$1.Delete,
41913
- ModalButtonType$1.Cancel,
41914
- ],
41915
- [ModalType$1.ConfirmCancel]: [
41916
- ModalButtonType$1.Confirm,
41917
- ModalButtonType$1.Cancel,
41918
- ],
41919
- });
41920
- // Button type styling and labels
41921
- ({
41922
- [ModalButtonType$1.Okay]: {
41923
- label: 'Okay',
41924
- variant: Variant$1.Dark,
41925
- },
41926
- [ModalButtonType$1.Cancel]: {
41927
- label: 'Cancel',
41928
- variant: Variant$1.Secondary,
41929
- },
41930
- [ModalButtonType$1.Yes]: {
41931
- label: 'Yes',
41932
- variant: Variant$1.Dark,
41933
- },
41934
- [ModalButtonType$1.No]: {
41935
- label: 'No',
41936
- variant: Variant$1.Secondary,
41937
- },
41938
- [ModalButtonType$1.Abandon]: {
41939
- label: 'Abandon Changes',
41940
- variant: Variant$1.Warning,
41941
- },
41942
- [ModalButtonType$1.GoBack]: {
41943
- label: 'Go Back',
41944
- variant: Variant$1.Secondary,
41945
- },
41946
- [ModalButtonType$1.Continue]: {
41947
- label: 'Continue',
41948
- variant: Variant$1.Dark,
41949
- },
41950
- [ModalButtonType$1.ImSure]: {
41951
- label: 'I am sure',
41952
- variant: Variant$1.Warning,
41953
- },
41954
- [ModalButtonType$1.Delete]: {
41955
- label: 'Yes, Delete',
41956
- variant: Variant$1.Danger,
41957
- },
41958
- [ModalButtonType$1.Confirm]: {
41959
- label: 'Confirm',
41960
- variant: Variant$1.Dark,
41961
- },
41962
- });
41963
-
41964
- /**
41965
- * An error with a code
41966
- * @author Gabe Abrams
41967
- */
41968
- class ErrorWithCode extends Error {
41969
- constructor(message, code) {
41970
- super(message);
41971
- this.name = 'ErrorWithCode';
41972
- this.code = code;
41973
- }
41974
- }
41975
-
41976
- /**
41977
- * Copiable text box
41978
- * @author Gabe Abrams
41979
- */
41980
- /* ------------- Actions ------------ */
41981
- // Types of actions
41982
- var ActionType$1;
41983
- (function (ActionType) {
41984
- // Indicate that the text was recently copied
41985
- ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
41986
- // Clear the status
41987
- ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
41988
- })(ActionType$1 || (ActionType$1 = {}));
41989
-
41990
- /**
41991
- * Reusable nested item picker
41992
- * @author Yuen Ler Chow
41993
- */
41994
- /* ------------- Actions ------------ */
41995
- // Types of actions
41996
- var ActionType;
41997
- (function (ActionType) {
41998
- // Toggle whether the children are being shown
41999
- ActionType["ToggleItems"] = "toggle-items";
42000
- })(ActionType || (ActionType = {}));
42001
-
42002
- // Import custom error
42003
- // Stored copy of caccl functions
42004
- let _cacclGetLaunchInfo;
42005
- /*------------------------------------------------------------------------*/
42006
- /* Helpers */
42007
- /*------------------------------------------------------------------------*/
42008
- /**
42009
- * Get launch info via CACCL
42010
- * @author Gabe Abrams
42011
- * @param req express request object
42012
- * @returns object { launched, launchInfo }
42013
- */
42014
- const cacclGetLaunchInfo = (req) => {
42015
- {
42016
- throw new ErrorWithCode('Could not get launch info because server was not initialized with dce-reactkit\'s initServer function', ReactKitErrorCode$1.NoCACCLGetLaunchInfoFunction);
42017
- }
42018
- };
42019
-
42020
- /**
42021
- * Server-side API param types
42022
- * @author Gabe Abrams
42023
- */
42024
- var ParamType;
42025
- (function (ParamType) {
42026
- ParamType["Boolean"] = "boolean";
42027
- ParamType["BooleanOptional"] = "boolean-optional";
42028
- ParamType["Float"] = "float";
42029
- ParamType["FloatOptional"] = "float-optional";
42030
- ParamType["Int"] = "int";
42031
- ParamType["IntOptional"] = "int-optional";
42032
- ParamType["JSON"] = "json";
42033
- ParamType["JSONOptional"] = "json-optional";
42034
- ParamType["String"] = "string";
42035
- ParamType["StringOptional"] = "string-optional";
42036
- })(ParamType || (ParamType = {}));
42037
- var ParamType$1 = ParamType;
42038
-
42039
- // Import shared types
42040
- /**
42041
- * Handle an error and respond to the client
42042
- * @author Gabe Abrams
42043
- * @param res express response
42044
- * @param error error info
42045
- * @param opts.err the error to send to the client
42046
- * or the error message
42047
- * @param [opts.code] an error code (only used if err.code is not
42048
- * included)
42049
- * @param [opts.status=500] the https status code to use
42050
- * defined)
42051
- */
42052
- const handleError = (res, error) => {
42053
- // Get the error message
42054
- let message;
42055
- if (error && error.message) {
42056
- message = (error.message || 'An unknown error occurred.');
42057
- }
42058
- else if (typeof error === 'string') {
42059
- message = (error.trim().length > 0
42060
- ? error
42061
- : 'An unknown error occurred.');
42062
- }
42063
- else {
42064
- message = 'An unknown error occurred.';
42065
- }
42066
- // Get the error code
42067
- const code = (error.code || ReactKitErrorCode$1.NoCode);
42068
- // Get the status code
42069
- const status = (error.status || 500);
42070
- // Respond to user
42071
- res
42072
- // Set the http status code
42073
- .status(status)
42074
- // Send a JSON response
42075
- .json({
42076
- // Error message
42077
- message,
42078
- // Error code
42079
- code,
42080
- // Success = false flag so client can detect server-side errors
42081
- success: false,
42082
- });
42083
- return undefined;
42084
- };
42085
-
42086
- /**
42087
- * Send successful API response
42088
- * @author Gabe Abrams
42089
- * @param res express response
42090
- * @param body the body of the response to send to the client
42091
- */
42092
- const handleSuccess = (res, body) => {
42093
- // Send a http 200 json response
42094
- res.json({
42095
- // Include the body as a parameter
42096
- body,
42097
- // Success = true flag so client can detect successful responses
42098
- success: true,
42099
- });
42100
- return undefined;
42101
- };
42102
-
42103
- /**
42104
- * Generate an express API route handler
42105
- * @author Gabe Abrams
42106
- * @param opts object containing all arguments
42107
- * @param opts.paramTypes map containing the types for each parameter that is
42108
- * included in the request (map: param name => type)
42109
- * @param opts.handler function that processes the request
42110
- * @returns express route handler that takes the following arguments:
42111
- * params (map: param name => value), handleSuccess (function for handling
42112
- * successful requests), handleError (function for handling failed requests),
42113
- * req (express request object), res (express response object),
42114
- * next (express next function). Params also has userId, userFirstName,
42115
- * userLastName, isLearner, isTTM, isAdmin, and any other variables that
42116
- * are directly added to the session
42117
- */
42118
- const genRouteHandler = (opts) => {
42119
- // Return a route handler
42120
- return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
42121
- var _a, _b;
42122
- // Output params
42123
- const output = {};
42124
- /*----------------------------------------*/
42125
- /* Parse Params */
42126
- /*----------------------------------------*/
42127
- // Process items one by one
42128
- const paramList = Object.entries((_a = opts.paramTypes) !== null && _a !== void 0 ? _a : {});
42129
- for (let i = 0; i < paramList.length; i++) {
42130
- const [name, type] = paramList[i];
42131
- // Find the value as a string
42132
- const value = (req.params[name]
42133
- || req.query[name]
42134
- || req.body[name]);
42135
- // Parse
42136
- if (type === ParamType$1.Boolean || type === ParamType$1.BooleanOptional) {
42137
- // Boolean
42138
- // Handle case where value doesn't exist
42139
- if (value === undefined) {
42140
- if (type === ParamType$1.BooleanOptional) {
42141
- output[name] = undefined;
42142
- }
42143
- else {
42144
- return handleError(res, {
42145
- message: `Parameter ${name} is required, but it was not included.`,
42146
- code: ReactKitErrorCode$1.MissingParameter,
42147
- status: 422,
42148
- });
42149
- }
42150
- }
42151
- else {
42152
- // Value exists
42153
- // Simplify value
42154
- const simpleVal = (String(value)
42155
- .trim()
42156
- .toLowerCase());
42157
- // Parse
42158
- output[name] = ([
42159
- 'true',
42160
- 'yes',
42161
- 'y',
42162
- '1',
42163
- 't',
42164
- ].indexOf(simpleVal) >= 0);
42165
- }
42166
- }
42167
- else if (type === ParamType$1.Float || type === ParamType$1.FloatOptional) {
42168
- // Float
42169
- // Handle case where value doesn't exist
42170
- if (value === undefined) {
42171
- if (type === ParamType$1.FloatOptional) {
42172
- output[name] = undefined;
42173
- }
42174
- else {
42175
- return handleError(res, {
42176
- message: `Parameter ${name} is required, but it was not included.`,
42177
- code: ReactKitErrorCode$1.MissingParameter,
42178
- status: 422,
42179
- });
42180
- }
42181
- }
42182
- else if (!Number.isNaN(Number.parseFloat(String(value)))) {
42183
- // Value is a number
42184
- output[name] = Number.parseFloat(String(value));
42185
- }
42186
- else {
42187
- // Issue!
42188
- return handleError(res, {
42189
- message: `Request data was malformed: ${name} was not a valid float.`,
42190
- code: ReactKitErrorCode$1.InvalidParameter,
42191
- status: 422,
42192
- });
42193
- }
42194
- }
42195
- else if (type === ParamType$1.Int || type === ParamType$1.IntOptional) {
42196
- // Int
42197
- // Handle case where value doesn't exist
42198
- if (value === undefined) {
42199
- if (type === ParamType$1.IntOptional) {
42200
- output[name] = undefined;
42201
- }
42202
- else {
42203
- return handleError(res, {
42204
- message: `Parameter ${name} is required, but it was not included.`,
42205
- code: ReactKitErrorCode$1.MissingParameter,
42206
- status: 422,
42207
- });
42208
- }
42209
- }
42210
- else if (!Number.isNaN(Number.parseInt(String(value), 10))) {
42211
- // Value is a number
42212
- output[name] = Number.parseInt(String(value), 10);
42213
- }
42214
- else {
42215
- // Issue!
42216
- return handleError(res, {
42217
- message: `Request data was malformed: ${name} was not a valid int.`,
42218
- code: ReactKitErrorCode$1.InvalidParameter,
42219
- status: 422,
42220
- });
42221
- }
42222
- }
42223
- else if (type === ParamType$1.JSON || type === ParamType$1.JSONOptional) {
42224
- // Stringified JSON
42225
- // Handle case where value doesn't exist
42226
- if (value === undefined) {
42227
- if (type === ParamType$1.JSONOptional) {
42228
- output[name] = undefined;
42229
- }
42230
- else {
42231
- return handleError(res, {
42232
- message: `Parameter ${name} is required, but it was not included.`,
42233
- code: ReactKitErrorCode$1.MissingParameter,
42234
- status: 422,
42235
- });
42236
- }
42237
- }
42238
- else {
42239
- // Value exists
42240
- // Parse
42241
- try {
42242
- output[name] = JSON.parse(String(value));
42243
- }
42244
- catch (err) {
42245
- return handleError(res, {
42246
- message: `Request data was malformed: ${name} was not a valid JSON payload.`,
42247
- code: ReactKitErrorCode$1.InvalidParameter,
42248
- status: 422,
42249
- });
42250
- }
42251
- }
42252
- }
42253
- else if (type === ParamType$1.String || type === ParamType$1.StringOptional) {
42254
- // String
42255
- // Handle case where value doesn't exist
42256
- if (value === undefined) {
42257
- if (type === ParamType$1.StringOptional) {
42258
- output[name] = undefined;
42259
- }
42260
- else {
42261
- return handleError(res, {
42262
- message: `Parameter ${name} is required, but it was not included.`,
42263
- code: ReactKitErrorCode$1.MissingParameter,
42264
- status: 422,
42265
- });
42266
- }
42267
- }
42268
- else {
42269
- // Value exists
42270
- // Leave as is
42271
- output[name] = value;
42272
- }
42273
- }
42274
- else {
42275
- // No valid data type
42276
- return handleError(res, {
42277
- message: `An internal error occurred: we could not determine the type of ${name}.`,
42278
- code: ReactKitErrorCode$1.InvalidParameter,
42279
- status: 422,
42280
- });
42281
- }
42282
- }
42283
- /*----------------------------------------*/
42284
- /* Launch Info */
42285
- /*----------------------------------------*/
42286
- // Get launch info
42287
- const { launched, launchInfo } = cacclGetLaunchInfo(req);
42288
- if (!launched || !launchInfo) {
42289
- return handleError(res, {
42290
- message: 'Your session has expired. Please refresh the page and try again.',
42291
- code: ReactKitErrorCode$1.SessionExpired,
42292
- status: 440,
42293
- });
42294
- }
42295
- // Error if user info cannot be found
42296
- if (!launchInfo.userId
42297
- || !launchInfo.userFirstName
42298
- || !launchInfo.userLastName
42299
- || (launchInfo.notInCourse
42300
- && !launchInfo.isAdmin)
42301
- || (!launchInfo.isTTM
42302
- && !launchInfo.isLearner
42303
- && !launchInfo.isAdmin)) {
42304
- return handleError(res, {
42305
- message: 'Your session was invalid. Please refresh the page and try again.',
42306
- code: ReactKitErrorCode$1.SessionExpired,
42307
- status: 440,
42308
- });
42309
- }
42310
- // Add launch info to output
42311
- output.userId = launchInfo.userId;
42312
- output.userFirstName = launchInfo.userFirstName;
42313
- output.userLastName = launchInfo.userLastName;
42314
- output.userEmail = launchInfo.userEmail;
42315
- output.isLearner = !!launchInfo.isLearner;
42316
- output.isTTM = !!launchInfo.isTTM;
42317
- output.isAdmin = !!launchInfo.isAdmin;
42318
- output.courseId = ((_b = output.courseId) !== null && _b !== void 0 ? _b : launchInfo.courseId);
42319
- output.courseName = launchInfo.contextLabel;
42320
- // Add other session variables
42321
- Object.keys(req.session).forEach((propName) => {
42322
- // Skip if prop already in output
42323
- if (output[propName] !== undefined) {
42324
- return;
42325
- }
42326
- // Add to output
42327
- const value = req.session[propName];
42328
- if (typeof value === 'string'
42329
- || typeof value === 'boolean'
42330
- || typeof value === 'number') {
42331
- output[propName] = value;
42332
- }
42333
- });
42334
- /*----------------------------------------*/
42335
- /* Require Course Consistency */
42336
- /*----------------------------------------*/
42337
- // Make sure the user actually launched from the appropriate course
42338
- if (output.courseId
42339
- && launchInfo.courseId
42340
- && output.courseId !== launchInfo.courseId
42341
- && !output.isTTM
42342
- && !output.isAdmin) {
42343
- // Course of interest is not the launch course
42344
- return handleError(res, {
42345
- message: 'You switched sessions by opening this app in another tab. Please refresh the page and try again.',
42346
- code: ReactKitErrorCode$1.WrongCourse,
42347
- status: 401,
42348
- });
42349
- }
42350
- /*----------------------------------------*/
42351
- /* Require Proper Permissions */
42352
- /*----------------------------------------*/
42353
- // Add TTM endpoint security
42354
- if (
42355
- // This is a TTM endpoint
42356
- req.path.startsWith('/api/ttm')
42357
- // User is not a TTM
42358
- && (
42359
- // User is not a TTM
42360
- !output.isTTM
42361
- // User is not an admin
42362
- && !output.isAdmin)) {
42363
- // User does not have access
42364
- return handleError(res, {
42365
- 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.',
42366
- code: ReactKitErrorCode$1.NotTTM,
42367
- status: 401,
42368
- });
42369
- }
42370
- // Add Admin endpoint security
42371
- if (
42372
- // This is an admin endpoint
42373
- req.path.startsWith('/api/admin')
42374
- // User is not an admin
42375
- && !output.isAdmin) {
42376
- // User does not have access
42377
- return handleError(res, {
42378
- 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.',
42379
- code: ReactKitErrorCode$1.NotAdmin,
42380
- status: 401,
42381
- });
42382
- }
42383
- /*------------------------------------------------------------------------*/
42384
- /* Call handler */
42385
- /*------------------------------------------------------------------------*/
42386
- try {
42387
- const results = yield opts.handler({
42388
- params: output,
42389
- req,
42390
- res,
42391
- next,
42392
- });
42393
- // Send results to client
42394
- handleSuccess(res, results !== null && results !== void 0 ? results : undefined);
42395
- }
42396
- catch (err) {
42397
- // Send error to client
42398
- handleError(res, err);
42399
- }
42400
- });
42401
- };
42402
-
42403
- /**
42404
- * Days of the week
42405
- * @author Gabe Abrams
42406
- */
42407
- var DayOfWeek$2;
42408
- (function (DayOfWeek) {
42409
- DayOfWeek["Monday"] = "m";
42410
- DayOfWeek["Tuesday"] = "t";
42411
- DayOfWeek["Wednesday"] = "w";
42412
- DayOfWeek["Thursday"] = "r";
42413
- DayOfWeek["Friday"] = "f";
42414
- DayOfWeek["Saturday"] = "s";
42415
- DayOfWeek["Sunday"] = "u";
42416
- })(DayOfWeek$2 || (DayOfWeek$2 = {}));
42417
-
42418
41770
  /**
42419
41771
  * Add all routes for the DBEditor
42420
41772
  * @author Yuen Ler Chow
@@ -42435,7 +41787,7 @@ const addDBEditorEndpoints = (opts) => {
42435
41787
  paramTypes: {
42436
41788
  filterQuery: ParamType$1.JSONOptional,
42437
41789
  },
42438
- handler: ({ params }) => __awaiter$1(void 0, void 0, void 0, function* () {
41790
+ handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
42439
41791
  var _a;
42440
41792
  const filterQuery = (_a = params.filterQuery) !== null && _a !== void 0 ? _a : {};
42441
41793
  const categories = yield collection.find(filterQuery);
@@ -42451,7 +41803,7 @@ const addDBEditorEndpoints = (opts) => {
42451
41803
  paramTypes: {
42452
41804
  item: ParamType$1.JSON,
42453
41805
  },
42454
- handler: ({ params, }) => __awaiter$1(void 0, void 0, void 0, function* () {
41806
+ handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
42455
41807
  // Destructure params
42456
41808
  const { item, } = params;
42457
41809
  yield collection.insert(item);
@@ -42465,7 +41817,7 @@ const addDBEditorEndpoints = (opts) => {
42465
41817
  paramTypes: {
42466
41818
  id: ParamType$1.String,
42467
41819
  },
42468
- handler: ({ params, }) => __awaiter$1(void 0, void 0, void 0, function* () {
41820
+ handler: ({ params, }) => __awaiter(void 0, void 0, void 0, function* () {
42469
41821
  // Destructure params
42470
41822
  const { id, } = params;
42471
41823
  yield collection.delete({ id });
@@ -42489,5 +41841,5 @@ var DayOfWeek;
42489
41841
  })(DayOfWeek || (DayOfWeek = {}));
42490
41842
  var DayOfWeek$1 = DayOfWeek;
42491
41843
 
42492
- export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode$1 as ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$3 as ModalButtonType, ModalSize$2 as ModalSize, ModalType$3 as ModalType, ParamType$3 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$3 as ReactKitErrorCode, SimpleDateChooser, TabBox, Variant$3 as Variant, abbreviate, addDBEditorEndpoints, alert$1 as alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler$1 as genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError$1 as handleError, handleSuccess$1 as handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
41844
+ export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, Variant$1 as Variant, abbreviate, addDBEditorEndpoints, alert$1 as alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
42493
41845
  //# sourceMappingURL=index.js.map