dce-reactkit 3.6.25 → 3.6.26

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.
@@ -16,10 +16,12 @@ import LogFunction from '../types/LogFunction';
16
16
  * send (a function that sends a string to the client),
17
17
  * redirect (takes a url and redirects the user to that url),
18
18
  * renderErrorPage (shows a static error page to the user),
19
+ * renderInfoPage (shows a static info page to the user),
19
20
  * and returns the value to send to the client as a JSON API response, or
20
21
  * calls next() or redirect(...) or send(...) or renderErrorPage(...).
21
22
  * Note: params also has userId, userFirstName,
22
- * userLastName, isLearner, isTTM, isAdmin, and any other variables that
23
+ * userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
24
+ * and any other variables that
23
25
  * are directly added to the session, if the user does have a session.
24
26
  */
25
27
  declare const genRouteHandler: (opts: {
@@ -41,6 +43,10 @@ declare const genRouteHandler: (opts: {
41
43
  pageTitle?: string;
42
44
  status?: number;
43
45
  }) => void;
46
+ renderInfoPage: (opts: {
47
+ title: string;
48
+ body: string;
49
+ }) => void;
44
50
  logServerEvent: LogFunction;
45
51
  }) => any;
46
52
  skipSessionCheck?: boolean | undefined;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generate a static info page
3
+ * @author Gabe Abrams
4
+ * @param opts object containing all arguments
5
+ * @param opts.title title of the info box
6
+ * @param opts.body a human-readable text body for the info alert
7
+ */
8
+ declare const genInfoPage: (opts: {
9
+ title: string;
10
+ body: string;
11
+ }) => string;
12
+ export default genInfoPage;
package/dist/esm/index.js CHANGED
@@ -42161,10 +42161,12 @@ const parseUserAgent = (userAgent) => {
42161
42161
  * send (a function that sends a string to the client),
42162
42162
  * redirect (takes a url and redirects the user to that url),
42163
42163
  * renderErrorPage (shows a static error page to the user),
42164
+ * renderInfoPage (shows a static info page to the user),
42164
42165
  * and returns the value to send to the client as a JSON API response, or
42165
42166
  * calls next() or redirect(...) or send(...) or renderErrorPage(...).
42166
42167
  * Note: params also has userId, userFirstName,
42167
- * userLastName, isLearner, isTTM, isAdmin, and any other variables that
42168
+ * userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
42169
+ * and any other variables that
42168
42170
  * are directly added to the session, if the user does have a session.
42169
42171
  */
42170
42172
  const genRouteHandler = (opts) => {
@@ -42660,6 +42662,17 @@ const genRouteHandler = (opts) => {
42660
42662
  },
42661
42663
  });
42662
42664
  };
42665
+ /**
42666
+ * Render an info page
42667
+ * @author Gabe Abrams
42668
+ * @param renderOpts object containing all arguments
42669
+ * @param renderOpts.title title of the info box
42670
+ * @param renderOpts.body a human-readable text body for the info alert
42671
+ */
42672
+ const renderInfoPage = (renderOpts) => {
42673
+ const html = genErrorPage(renderOpts);
42674
+ send(html, 200);
42675
+ };
42663
42676
  // Call the handler
42664
42677
  try {
42665
42678
  const results = yield opts.handler({
@@ -42672,6 +42685,7 @@ const genRouteHandler = (opts) => {
42672
42685
  },
42673
42686
  redirect,
42674
42687
  renderErrorPage,
42688
+ renderInfoPage,
42675
42689
  logServerEvent,
42676
42690
  });
42677
42691
  // Send results to client (only if next wasn't called)