dce-reactkit 3.6.23 → 3.6.25
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 +18 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/types/LogAction.d.ts +1 -0
- package/dist/esm/index.js +18 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/types/LogAction.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +8 -0
- package/src/types/LogAction.ts +2 -0
package/dist/esm/index.js
CHANGED
|
@@ -2480,6 +2480,8 @@ var LogAction;
|
|
|
2480
2480
|
LogAction["Resume"] = "Resume";
|
|
2481
2481
|
// Jump to/seek to/reveal/go to/navigate to a target
|
|
2482
2482
|
LogAction["Jump"] = "Jump";
|
|
2483
|
+
// Post a submission/message/etc. into the target
|
|
2484
|
+
LogAction["Post"] = "Post";
|
|
2483
2485
|
// Unknown action
|
|
2484
2486
|
LogAction["Unknown"] = "Unknown";
|
|
2485
2487
|
})(LogAction || (LogAction = {}));
|
|
@@ -42168,7 +42170,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
42168
42170
|
const genRouteHandler = (opts) => {
|
|
42169
42171
|
// Return a route handler
|
|
42170
42172
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42171
|
-
var _a, _b;
|
|
42173
|
+
var _a, _b, _c;
|
|
42172
42174
|
// Output params
|
|
42173
42175
|
const output = {};
|
|
42174
42176
|
/*----------------------------------------*/
|
|
@@ -42379,6 +42381,9 @@ const genRouteHandler = (opts) => {
|
|
|
42379
42381
|
output.userEmail = (launchInfo
|
|
42380
42382
|
? launchInfo.userEmail
|
|
42381
42383
|
: undefined);
|
|
42384
|
+
output.userAvatarURL = (launchInfo
|
|
42385
|
+
? ((_b = launchInfo.userImage) !== null && _b !== void 0 ? _b : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
42386
|
+
: undefined);
|
|
42382
42387
|
output.isLearner = (launchInfo
|
|
42383
42388
|
? !!launchInfo.isLearner
|
|
42384
42389
|
: undefined);
|
|
@@ -42389,7 +42394,7 @@ const genRouteHandler = (opts) => {
|
|
|
42389
42394
|
? !!launchInfo.isAdmin
|
|
42390
42395
|
: undefined);
|
|
42391
42396
|
output.courseId = (launchInfo
|
|
42392
|
-
? ((
|
|
42397
|
+
? ((_c = output.courseId) !== null && _c !== void 0 ? _c : launchInfo.courseId)
|
|
42393
42398
|
: undefined);
|
|
42394
42399
|
output.courseName = (launchInfo
|
|
42395
42400
|
? launchInfo.contextLabel
|
|
@@ -42467,7 +42472,7 @@ const genRouteHandler = (opts) => {
|
|
|
42467
42472
|
* @author Gabe Abrams
|
|
42468
42473
|
*/
|
|
42469
42474
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42470
|
-
var
|
|
42475
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
42471
42476
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42472
42477
|
// that indicates that this is actually a client event, but we don't
|
|
42473
42478
|
// include that in the LogFunction type because this is internal and
|
|
@@ -42499,24 +42504,24 @@ const genRouteHandler = (opts) => {
|
|
|
42499
42504
|
timestamp,
|
|
42500
42505
|
context: (typeof logOpts.context === 'string'
|
|
42501
42506
|
? logOpts.context
|
|
42502
|
-
: ((
|
|
42503
|
-
subcontext: ((
|
|
42504
|
-
tags: ((
|
|
42505
|
-
level: ((
|
|
42506
|
-
metadata: ((
|
|
42507
|
+
: ((_e = ((_d = logOpts.context) !== null && _d !== void 0 ? _d : {})._) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42508
|
+
subcontext: ((_f = logOpts.subcontext) !== null && _f !== void 0 ? _f : LogBuiltInMetadata.Context.Uncategorized),
|
|
42509
|
+
tags: ((_g = logOpts.tags) !== null && _g !== void 0 ? _g : []),
|
|
42510
|
+
level: ((_h = logOpts.level) !== null && _h !== void 0 ? _h : LogLevel$1.Info),
|
|
42511
|
+
metadata: ((_j = logOpts.metadata) !== null && _j !== void 0 ? _j : {}),
|
|
42507
42512
|
};
|
|
42508
42513
|
// Type-specific info
|
|
42509
42514
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42510
42515
|
? {
|
|
42511
42516
|
type: LogType$1.Error,
|
|
42512
|
-
errorMessage: (
|
|
42513
|
-
errorCode: (
|
|
42514
|
-
errorStack: (
|
|
42517
|
+
errorMessage: (_k = logOpts.error.message) !== null && _k !== void 0 ? _k : 'Unknown message',
|
|
42518
|
+
errorCode: (_l = logOpts.error.code) !== null && _l !== void 0 ? _l : ReactKitErrorCode$1.NoCode,
|
|
42519
|
+
errorStack: (_m = logOpts.error.stack) !== null && _m !== void 0 ? _m : 'No stack',
|
|
42515
42520
|
}
|
|
42516
42521
|
: {
|
|
42517
42522
|
type: LogType$1.Action,
|
|
42518
|
-
target: ((
|
|
42519
|
-
action: ((
|
|
42523
|
+
target: ((_o = logOpts.target) !== null && _o !== void 0 ? _o : LogBuiltInMetadata.Target.NoTarget),
|
|
42524
|
+
action: ((_p = logOpts.action) !== null && _p !== void 0 ? _p : LogAction$1.Unknown),
|
|
42520
42525
|
});
|
|
42521
42526
|
// Source-specific info
|
|
42522
42527
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|