dce-reactkit 3.6.26 → 3.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -42066,6 +42066,96 @@ const genErrorPage = (opts = {}) => {
42066
42066
  `;
42067
42067
  };
42068
42068
 
42069
+ /**
42070
+ * Generate a static info page
42071
+ * @author Gabe Abrams
42072
+ * @param opts object containing all arguments
42073
+ * @param opts.title title of the info box
42074
+ * @param opts.body a human-readable text body for the info alert
42075
+ */
42076
+ const genInfoPage = (opts) => {
42077
+ const { title, body, } = opts;
42078
+ return `
42079
+ <head>
42080
+ <!-- Metadata -->
42081
+ <meta
42082
+ name="viewport"
42083
+ content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0"
42084
+ >
42085
+
42086
+ <!-- Title -->
42087
+ <title>${title}</title>
42088
+
42089
+ <!-- Bootstrap -->
42090
+ <link
42091
+ rel="stylesheet"
42092
+ href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/css/bootstrap.min.css"
42093
+ integrity="sha512-siwe/oXMhSjGCwLn+scraPOWrJxHlUgMBMZXdPe2Tnk3I0x3ESCoLz7WZ5NTH6SZrywMY+PB1cjyqJ5jAluCOg=="
42094
+ crossorigin="anonymous"
42095
+ referrerpolicy="no-referrer"
42096
+ />
42097
+ <script
42098
+ src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/js/bootstrap.min.js"
42099
+ integrity="sha512-vyRAVI0IEm6LI/fVSv/Wq/d0KUfrg3hJq2Qz5FlfER69sf3ZHlOrsLriNm49FxnpUGmhx+TaJKwJ+ByTLKT+Yg=="
42100
+ crossorigin="anonymous"
42101
+ referrerpolicy="no-referrer"
42102
+ ></script>
42103
+
42104
+ <!-- FontAwesome -->
42105
+ <link
42106
+ rel="stylesheet"
42107
+ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
42108
+ integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A=="
42109
+ crossorigin="anonymous"
42110
+ referrerpolicy="no-referrer"
42111
+ />
42112
+
42113
+ <!-- Style -->
42114
+ <style>
42115
+ .DCEReactKit-pop-in {
42116
+ animation-name: DCEReactKit-pop-in;
42117
+ animation-duration: 0.5s;
42118
+ animation-iteration-count: 1;
42119
+ animation-timing-function: ease-out;
42120
+ animation-fill-mode: both;
42121
+
42122
+ transform-origin: center;
42123
+ }
42124
+
42125
+ @keyframes DCEReactKit-pop-in {
42126
+ 0% {
42127
+ opacity: 0;
42128
+ transform: scale(0.9);
42129
+ }
42130
+ 100% {
42131
+ opacity: 1;
42132
+ transform: scale(1);
42133
+ }
42134
+ }
42135
+ </style>
42136
+ </head>
42137
+
42138
+ <!-- Body -->
42139
+ <body class="bg-dark text-center pt-3 ps-3 pe-3">
42140
+ <!-- Alert -->
42141
+ <div
42142
+ class="DCEReactKit-pop-in alert alert-info d-inline-block"
42143
+ style="width: 50em; max-width: 100%"
42144
+ >
42145
+ <!-- Title -->
42146
+ <h2>
42147
+ <i class="me-1 fa-solid fa-circle-info"></i>
42148
+ ${title}
42149
+ </h2>
42150
+ <!-- Body -->
42151
+ <div>
42152
+ ${body}
42153
+ </div>
42154
+ </div>
42155
+ </body>
42156
+ `;
42157
+ };
42158
+
42069
42159
  /**
42070
42160
  * Perform a rudimentary parsing of the user's browser agent string
42071
42161
  * @author Gabe Abrams
@@ -42442,7 +42532,7 @@ const genRouteHandler = (opts) => {
42442
42532
  }
42443
42533
  });
42444
42534
  /*----------------------------------------*/
42445
- /* Require Course Consistency */
42535
+ /* ----- Require Course Consistency ----- */
42446
42536
  /*----------------------------------------*/
42447
42537
  // Make sure the user actually launched from the appropriate course
42448
42538
  if (output.courseId
@@ -42492,7 +42582,7 @@ const genRouteHandler = (opts) => {
42492
42582
  });
42493
42583
  }
42494
42584
  /*----------------------------------------*/
42495
- /* Log Handler */
42585
+ /* ------------- Log Handler ------------ */
42496
42586
  /*----------------------------------------*/
42497
42587
  // Create a log handler function
42498
42588
  /**
@@ -42500,7 +42590,7 @@ const genRouteHandler = (opts) => {
42500
42590
  * @author Gabe Abrams
42501
42591
  */
42502
42592
  const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
42503
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
42593
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
42504
42594
  // NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
42505
42595
  // that indicates that this is actually a client event, but we don't
42506
42596
  // include that in the LogFunction type because this is internal and
@@ -42584,7 +42674,7 @@ const genRouteHandler = (opts) => {
42584
42674
  catch (err) {
42585
42675
  // Print because we cannot store the error
42586
42676
  // eslint-disable-next-line no-console
42587
- console.error('Could not log the following:', opts);
42677
+ console.error('Could not log the following:', logOpts, 'due to this error:', ((_q = err) !== null && _q !== void 0 ? _q : {}).message, ((_r = err) !== null && _r !== void 0 ? _r : {}).stack);
42588
42678
  // Create a dummy log to return
42589
42679
  const dummyMainInfo = {
42590
42680
  id: '-1',
@@ -42696,7 +42786,7 @@ const genRouteHandler = (opts) => {
42696
42786
  * @param renderOpts.body a human-readable text body for the info alert
42697
42787
  */
42698
42788
  const renderInfoPage = (renderOpts) => {
42699
- const html = genErrorPage(renderOpts);
42789
+ const html = genInfoPage(renderOpts);
42700
42790
  send(html, 200);
42701
42791
  };
42702
42792
  // Call the handler