dce-reactkit 3.6.25 → 3.6.27
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 +107 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +7 -1
- package/dist/cjs/types/html/genInfoPage.d.ts +12 -0
- package/dist/esm/index.js +107 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/genRouteHandler.d.ts +7 -1
- package/dist/esm/types/html/genInfoPage.d.ts +12 -0
- package/dist/index.d.ts +7 -1
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +30 -3
- package/src/html/genInfoPage.ts +100 -0
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
|
|
@@ -42187,10 +42277,12 @@ const parseUserAgent = (userAgent) => {
|
|
|
42187
42277
|
* send (a function that sends a string to the client),
|
|
42188
42278
|
* redirect (takes a url and redirects the user to that url),
|
|
42189
42279
|
* renderErrorPage (shows a static error page to the user),
|
|
42280
|
+
* renderInfoPage (shows a static info page to the user),
|
|
42190
42281
|
* and returns the value to send to the client as a JSON API response, or
|
|
42191
42282
|
* calls next() or redirect(...) or send(...) or renderErrorPage(...).
|
|
42192
42283
|
* Note: params also has userId, userFirstName,
|
|
42193
|
-
* userLastName, isLearner, isTTM, isAdmin,
|
|
42284
|
+
* userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
|
|
42285
|
+
* and any other variables that
|
|
42194
42286
|
* are directly added to the session, if the user does have a session.
|
|
42195
42287
|
*/
|
|
42196
42288
|
const genRouteHandler = (opts) => {
|
|
@@ -42440,7 +42532,7 @@ const genRouteHandler = (opts) => {
|
|
|
42440
42532
|
}
|
|
42441
42533
|
});
|
|
42442
42534
|
/*----------------------------------------*/
|
|
42443
|
-
/*
|
|
42535
|
+
/* ----- Require Course Consistency ----- */
|
|
42444
42536
|
/*----------------------------------------*/
|
|
42445
42537
|
// Make sure the user actually launched from the appropriate course
|
|
42446
42538
|
if (output.courseId
|
|
@@ -42490,7 +42582,7 @@ const genRouteHandler = (opts) => {
|
|
|
42490
42582
|
});
|
|
42491
42583
|
}
|
|
42492
42584
|
/*----------------------------------------*/
|
|
42493
|
-
/*
|
|
42585
|
+
/* ------------- Log Handler ------------ */
|
|
42494
42586
|
/*----------------------------------------*/
|
|
42495
42587
|
// Create a log handler function
|
|
42496
42588
|
/**
|
|
@@ -42686,6 +42778,17 @@ const genRouteHandler = (opts) => {
|
|
|
42686
42778
|
},
|
|
42687
42779
|
});
|
|
42688
42780
|
};
|
|
42781
|
+
/**
|
|
42782
|
+
* Render an info page
|
|
42783
|
+
* @author Gabe Abrams
|
|
42784
|
+
* @param renderOpts object containing all arguments
|
|
42785
|
+
* @param renderOpts.title title of the info box
|
|
42786
|
+
* @param renderOpts.body a human-readable text body for the info alert
|
|
42787
|
+
*/
|
|
42788
|
+
const renderInfoPage = (renderOpts) => {
|
|
42789
|
+
const html = genInfoPage(renderOpts);
|
|
42790
|
+
send(html, 200);
|
|
42791
|
+
};
|
|
42689
42792
|
// Call the handler
|
|
42690
42793
|
try {
|
|
42691
42794
|
const results = yield opts.handler({
|
|
@@ -42698,6 +42801,7 @@ const genRouteHandler = (opts) => {
|
|
|
42698
42801
|
},
|
|
42699
42802
|
redirect,
|
|
42700
42803
|
renderErrorPage,
|
|
42804
|
+
renderInfoPage,
|
|
42701
42805
|
logServerEvent,
|
|
42702
42806
|
});
|
|
42703
42807
|
// Send results to client (only if next wasn't called)
|