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 +95 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +95 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +11 -4
package/dist/esm/index.js
CHANGED
|
@@ -42040,6 +42040,96 @@ const genErrorPage = (opts = {}) => {
|
|
|
42040
42040
|
`;
|
|
42041
42041
|
};
|
|
42042
42042
|
|
|
42043
|
+
/**
|
|
42044
|
+
* Generate a static info page
|
|
42045
|
+
* @author Gabe Abrams
|
|
42046
|
+
* @param opts object containing all arguments
|
|
42047
|
+
* @param opts.title title of the info box
|
|
42048
|
+
* @param opts.body a human-readable text body for the info alert
|
|
42049
|
+
*/
|
|
42050
|
+
const genInfoPage = (opts) => {
|
|
42051
|
+
const { title, body, } = opts;
|
|
42052
|
+
return `
|
|
42053
|
+
<head>
|
|
42054
|
+
<!-- Metadata -->
|
|
42055
|
+
<meta
|
|
42056
|
+
name="viewport"
|
|
42057
|
+
content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0"
|
|
42058
|
+
>
|
|
42059
|
+
|
|
42060
|
+
<!-- Title -->
|
|
42061
|
+
<title>${title}</title>
|
|
42062
|
+
|
|
42063
|
+
<!-- Bootstrap -->
|
|
42064
|
+
<link
|
|
42065
|
+
rel="stylesheet"
|
|
42066
|
+
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/css/bootstrap.min.css"
|
|
42067
|
+
integrity="sha512-siwe/oXMhSjGCwLn+scraPOWrJxHlUgMBMZXdPe2Tnk3I0x3ESCoLz7WZ5NTH6SZrywMY+PB1cjyqJ5jAluCOg=="
|
|
42068
|
+
crossorigin="anonymous"
|
|
42069
|
+
referrerpolicy="no-referrer"
|
|
42070
|
+
/>
|
|
42071
|
+
<script
|
|
42072
|
+
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/js/bootstrap.min.js"
|
|
42073
|
+
integrity="sha512-vyRAVI0IEm6LI/fVSv/Wq/d0KUfrg3hJq2Qz5FlfER69sf3ZHlOrsLriNm49FxnpUGmhx+TaJKwJ+ByTLKT+Yg=="
|
|
42074
|
+
crossorigin="anonymous"
|
|
42075
|
+
referrerpolicy="no-referrer"
|
|
42076
|
+
></script>
|
|
42077
|
+
|
|
42078
|
+
<!-- FontAwesome -->
|
|
42079
|
+
<link
|
|
42080
|
+
rel="stylesheet"
|
|
42081
|
+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
|
|
42082
|
+
integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A=="
|
|
42083
|
+
crossorigin="anonymous"
|
|
42084
|
+
referrerpolicy="no-referrer"
|
|
42085
|
+
/>
|
|
42086
|
+
|
|
42087
|
+
<!-- Style -->
|
|
42088
|
+
<style>
|
|
42089
|
+
.DCEReactKit-pop-in {
|
|
42090
|
+
animation-name: DCEReactKit-pop-in;
|
|
42091
|
+
animation-duration: 0.5s;
|
|
42092
|
+
animation-iteration-count: 1;
|
|
42093
|
+
animation-timing-function: ease-out;
|
|
42094
|
+
animation-fill-mode: both;
|
|
42095
|
+
|
|
42096
|
+
transform-origin: center;
|
|
42097
|
+
}
|
|
42098
|
+
|
|
42099
|
+
@keyframes DCEReactKit-pop-in {
|
|
42100
|
+
0% {
|
|
42101
|
+
opacity: 0;
|
|
42102
|
+
transform: scale(0.9);
|
|
42103
|
+
}
|
|
42104
|
+
100% {
|
|
42105
|
+
opacity: 1;
|
|
42106
|
+
transform: scale(1);
|
|
42107
|
+
}
|
|
42108
|
+
}
|
|
42109
|
+
</style>
|
|
42110
|
+
</head>
|
|
42111
|
+
|
|
42112
|
+
<!-- Body -->
|
|
42113
|
+
<body class="bg-dark text-center pt-3 ps-3 pe-3">
|
|
42114
|
+
<!-- Alert -->
|
|
42115
|
+
<div
|
|
42116
|
+
class="DCEReactKit-pop-in alert alert-info d-inline-block"
|
|
42117
|
+
style="width: 50em; max-width: 100%"
|
|
42118
|
+
>
|
|
42119
|
+
<!-- Title -->
|
|
42120
|
+
<h2>
|
|
42121
|
+
<i class="me-1 fa-solid fa-circle-info"></i>
|
|
42122
|
+
${title}
|
|
42123
|
+
</h2>
|
|
42124
|
+
<!-- Body -->
|
|
42125
|
+
<div>
|
|
42126
|
+
${body}
|
|
42127
|
+
</div>
|
|
42128
|
+
</div>
|
|
42129
|
+
</body>
|
|
42130
|
+
`;
|
|
42131
|
+
};
|
|
42132
|
+
|
|
42043
42133
|
/**
|
|
42044
42134
|
* Perform a rudimentary parsing of the user's browser agent string
|
|
42045
42135
|
* @author Gabe Abrams
|
|
@@ -42416,7 +42506,7 @@ const genRouteHandler = (opts) => {
|
|
|
42416
42506
|
}
|
|
42417
42507
|
});
|
|
42418
42508
|
/*----------------------------------------*/
|
|
42419
|
-
/*
|
|
42509
|
+
/* ----- Require Course Consistency ----- */
|
|
42420
42510
|
/*----------------------------------------*/
|
|
42421
42511
|
// Make sure the user actually launched from the appropriate course
|
|
42422
42512
|
if (output.courseId
|
|
@@ -42466,7 +42556,7 @@ const genRouteHandler = (opts) => {
|
|
|
42466
42556
|
});
|
|
42467
42557
|
}
|
|
42468
42558
|
/*----------------------------------------*/
|
|
42469
|
-
/*
|
|
42559
|
+
/* ------------- Log Handler ------------ */
|
|
42470
42560
|
/*----------------------------------------*/
|
|
42471
42561
|
// Create a log handler function
|
|
42472
42562
|
/**
|
|
@@ -42474,7 +42564,7 @@ const genRouteHandler = (opts) => {
|
|
|
42474
42564
|
* @author Gabe Abrams
|
|
42475
42565
|
*/
|
|
42476
42566
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42477
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
42567
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
42478
42568
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42479
42569
|
// that indicates that this is actually a client event, but we don't
|
|
42480
42570
|
// include that in the LogFunction type because this is internal and
|
|
@@ -42558,7 +42648,7 @@ const genRouteHandler = (opts) => {
|
|
|
42558
42648
|
catch (err) {
|
|
42559
42649
|
// Print because we cannot store the error
|
|
42560
42650
|
// eslint-disable-next-line no-console
|
|
42561
|
-
console.error('Could not log the following:',
|
|
42651
|
+
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);
|
|
42562
42652
|
// Create a dummy log to return
|
|
42563
42653
|
const dummyMainInfo = {
|
|
42564
42654
|
id: '-1',
|
|
@@ -42670,7 +42760,7 @@ const genRouteHandler = (opts) => {
|
|
|
42670
42760
|
* @param renderOpts.body a human-readable text body for the info alert
|
|
42671
42761
|
*/
|
|
42672
42762
|
const renderInfoPage = (renderOpts) => {
|
|
42673
|
-
const html =
|
|
42763
|
+
const html = genInfoPage(renderOpts);
|
|
42674
42764
|
send(html, 200);
|
|
42675
42765
|
};
|
|
42676
42766
|
// Call the handler
|