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/cjs/index.js
CHANGED
|
@@ -2506,6 +2506,8 @@ var LogAction;
|
|
|
2506
2506
|
LogAction["Resume"] = "Resume";
|
|
2507
2507
|
// Jump to/seek to/reveal/go to/navigate to a target
|
|
2508
2508
|
LogAction["Jump"] = "Jump";
|
|
2509
|
+
// Post a submission/message/etc. into the target
|
|
2510
|
+
LogAction["Post"] = "Post";
|
|
2509
2511
|
// Unknown action
|
|
2510
2512
|
LogAction["Unknown"] = "Unknown";
|
|
2511
2513
|
})(LogAction || (LogAction = {}));
|
|
@@ -42194,7 +42196,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
42194
42196
|
const genRouteHandler = (opts) => {
|
|
42195
42197
|
// Return a route handler
|
|
42196
42198
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42197
|
-
var _a, _b;
|
|
42199
|
+
var _a, _b, _c;
|
|
42198
42200
|
// Output params
|
|
42199
42201
|
const output = {};
|
|
42200
42202
|
/*----------------------------------------*/
|
|
@@ -42405,6 +42407,9 @@ const genRouteHandler = (opts) => {
|
|
|
42405
42407
|
output.userEmail = (launchInfo
|
|
42406
42408
|
? launchInfo.userEmail
|
|
42407
42409
|
: undefined);
|
|
42410
|
+
output.userAvatarURL = (launchInfo
|
|
42411
|
+
? ((_b = launchInfo.userImage) !== null && _b !== void 0 ? _b : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
42412
|
+
: undefined);
|
|
42408
42413
|
output.isLearner = (launchInfo
|
|
42409
42414
|
? !!launchInfo.isLearner
|
|
42410
42415
|
: undefined);
|
|
@@ -42415,7 +42420,7 @@ const genRouteHandler = (opts) => {
|
|
|
42415
42420
|
? !!launchInfo.isAdmin
|
|
42416
42421
|
: undefined);
|
|
42417
42422
|
output.courseId = (launchInfo
|
|
42418
|
-
? ((
|
|
42423
|
+
? ((_c = output.courseId) !== null && _c !== void 0 ? _c : launchInfo.courseId)
|
|
42419
42424
|
: undefined);
|
|
42420
42425
|
output.courseName = (launchInfo
|
|
42421
42426
|
? launchInfo.contextLabel
|
|
@@ -42493,7 +42498,7 @@ const genRouteHandler = (opts) => {
|
|
|
42493
42498
|
* @author Gabe Abrams
|
|
42494
42499
|
*/
|
|
42495
42500
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42496
|
-
var
|
|
42501
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
42497
42502
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42498
42503
|
// that indicates that this is actually a client event, but we don't
|
|
42499
42504
|
// include that in the LogFunction type because this is internal and
|
|
@@ -42525,24 +42530,24 @@ const genRouteHandler = (opts) => {
|
|
|
42525
42530
|
timestamp,
|
|
42526
42531
|
context: (typeof logOpts.context === 'string'
|
|
42527
42532
|
? logOpts.context
|
|
42528
|
-
: ((
|
|
42529
|
-
subcontext: ((
|
|
42530
|
-
tags: ((
|
|
42531
|
-
level: ((
|
|
42532
|
-
metadata: ((
|
|
42533
|
+
: ((_e = ((_d = logOpts.context) !== null && _d !== void 0 ? _d : {})._) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42534
|
+
subcontext: ((_f = logOpts.subcontext) !== null && _f !== void 0 ? _f : LogBuiltInMetadata.Context.Uncategorized),
|
|
42535
|
+
tags: ((_g = logOpts.tags) !== null && _g !== void 0 ? _g : []),
|
|
42536
|
+
level: ((_h = logOpts.level) !== null && _h !== void 0 ? _h : LogLevel$1.Info),
|
|
42537
|
+
metadata: ((_j = logOpts.metadata) !== null && _j !== void 0 ? _j : {}),
|
|
42533
42538
|
};
|
|
42534
42539
|
// Type-specific info
|
|
42535
42540
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42536
42541
|
? {
|
|
42537
42542
|
type: LogType$1.Error,
|
|
42538
|
-
errorMessage: (
|
|
42539
|
-
errorCode: (
|
|
42540
|
-
errorStack: (
|
|
42543
|
+
errorMessage: (_k = logOpts.error.message) !== null && _k !== void 0 ? _k : 'Unknown message',
|
|
42544
|
+
errorCode: (_l = logOpts.error.code) !== null && _l !== void 0 ? _l : ReactKitErrorCode$1.NoCode,
|
|
42545
|
+
errorStack: (_m = logOpts.error.stack) !== null && _m !== void 0 ? _m : 'No stack',
|
|
42541
42546
|
}
|
|
42542
42547
|
: {
|
|
42543
42548
|
type: LogType$1.Action,
|
|
42544
|
-
target: ((
|
|
42545
|
-
action: ((
|
|
42549
|
+
target: ((_o = logOpts.target) !== null && _o !== void 0 ? _o : LogBuiltInMetadata.Target.NoTarget),
|
|
42550
|
+
action: ((_p = logOpts.action) !== null && _p !== void 0 ? _p : LogAction$1.Unknown),
|
|
42546
42551
|
});
|
|
42547
42552
|
// Source-specific info
|
|
42548
42553
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|