dce-reactkit 3.1.20 → 3.2.0-beta.1
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 +363 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/constants/LOG_ROUTE_PATH.d.ts +6 -0
- package/dist/cjs/types/constants/ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +2 -0
- package/dist/cjs/types/helpers/logClientEvent.d.ts +7 -0
- package/dist/cjs/types/helpers/parseUserAgent.d.ts +17 -0
- package/dist/cjs/types/index.d.ts +5 -1
- package/dist/cjs/types/server/initServer.d.ts +13 -0
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +37 -0
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +13 -0
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +17 -0
- package/dist/cjs/types/types/Log/index.d.ts +10 -0
- package/dist/cjs/types/types/LogAction.d.ts +22 -0
- package/dist/cjs/types/types/LogFunction.d.ts +20 -0
- package/dist/cjs/types/types/LogSource.d.ts +9 -0
- package/dist/cjs/types/types/LogType.d.ts +9 -0
- package/dist/esm/index.js +361 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/constants/LOG_ROUTE_PATH.d.ts +6 -0
- package/dist/esm/types/constants/ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/esm/types/helpers/genRouteHandler.d.ts +2 -0
- package/dist/esm/types/helpers/logClientEvent.d.ts +7 -0
- package/dist/esm/types/helpers/parseUserAgent.d.ts +17 -0
- package/dist/esm/types/index.d.ts +5 -1
- package/dist/esm/types/server/initServer.d.ts +13 -0
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +37 -0
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +13 -0
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +17 -0
- package/dist/esm/types/types/Log/index.d.ts +10 -0
- package/dist/esm/types/types/LogAction.d.ts +22 -0
- package/dist/esm/types/types/LogFunction.d.ts +20 -0
- package/dist/esm/types/types/LogSource.d.ts +9 -0
- package/dist/esm/types/types/LogType.d.ts +9 -0
- package/dist/index.d.ts +137 -1
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +1 -1
- package/src/constants/LOG_ROUTE_PATH.ts +9 -0
- package/src/constants/ROUTE_PATH_PREFIX.ts +7 -0
- package/src/helpers/genRouteHandler.ts +129 -1
- package/src/helpers/logClientEvent.tsx +50 -0
- package/src/helpers/parseUserAgent.ts +108 -0
- package/src/index.ts +8 -0
- package/src/server/initServer.ts +90 -0
- package/src/types/Log/LogMainInfo.ts +64 -0
- package/src/types/Log/LogSourceSpecificInfo.ts +25 -0
- package/src/types/Log/LogTypeSpecificInfo.ts +33 -0
- package/src/types/Log/index.ts +17 -0
- package/src/types/LogAction.ts +38 -0
- package/src/types/LogFunction.ts +41 -0
- package/src/types/LogSource.ts +12 -0
- package/src/types/LogType.ts +12 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main information in a log event
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
type LogMainInfo = {
|
|
6
|
+
// Unique id of the log event
|
|
7
|
+
id: string,
|
|
8
|
+
// First name of the user
|
|
9
|
+
userFirstName: string,
|
|
10
|
+
// Last name of the user
|
|
11
|
+
userLastName: string,
|
|
12
|
+
// User email
|
|
13
|
+
userEmail: string,
|
|
14
|
+
// User Canvas Id
|
|
15
|
+
userId: number,
|
|
16
|
+
// If true, the user is a learner
|
|
17
|
+
isLearner: boolean,
|
|
18
|
+
// If true, the user is an admin
|
|
19
|
+
isAdmin: boolean,
|
|
20
|
+
// If true, the user is a ttm
|
|
21
|
+
isTTM: boolean,
|
|
22
|
+
// The id of the Canvas course that the user launched from
|
|
23
|
+
courseId: number,
|
|
24
|
+
// The name of the Canvas course
|
|
25
|
+
courseName: string,
|
|
26
|
+
// Browser info
|
|
27
|
+
browser: {
|
|
28
|
+
// Name of the browser
|
|
29
|
+
name: string,
|
|
30
|
+
// Version of the browser
|
|
31
|
+
version: string,
|
|
32
|
+
},
|
|
33
|
+
// Device info
|
|
34
|
+
device: {
|
|
35
|
+
// Name of the operating system
|
|
36
|
+
os: string,
|
|
37
|
+
// If true, device is a mobile device
|
|
38
|
+
isMobile: boolean,
|
|
39
|
+
},
|
|
40
|
+
// Calendar year that the event is from
|
|
41
|
+
year: number,
|
|
42
|
+
// Month that the event is from (1 = Jan, 12 = Dec)
|
|
43
|
+
month: number,
|
|
44
|
+
// Day of the month that the event is from
|
|
45
|
+
day: number,
|
|
46
|
+
// Hour of the day (24hr) when the event occurred
|
|
47
|
+
hour: number,
|
|
48
|
+
// Minute of the day when the event occurred
|
|
49
|
+
minute: number,
|
|
50
|
+
// Timestamp of event (ms since epoch)
|
|
51
|
+
timestamp: number,
|
|
52
|
+
// Category of the event (each app determines how to categorize its events)
|
|
53
|
+
category: string,
|
|
54
|
+
// Subcategory of the event (each app determines how to categorize its events)
|
|
55
|
+
subcategory: string,
|
|
56
|
+
// List of tags that apply to this action (each app determines tag usage)
|
|
57
|
+
tags: string[],
|
|
58
|
+
// Additional optional custom metadata
|
|
59
|
+
metadata?: {
|
|
60
|
+
[k: string]: any,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default LogMainInfo;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import LogSource from '../LogSource';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Log info that is specific to the type of source
|
|
6
|
+
* @author Gabe Abrams
|
|
7
|
+
*/
|
|
8
|
+
type LogSourceSpecificInfo = (
|
|
9
|
+
// Client
|
|
10
|
+
| {
|
|
11
|
+
// Source of the event
|
|
12
|
+
source: LogSource.Client,
|
|
13
|
+
}
|
|
14
|
+
// Server
|
|
15
|
+
| {
|
|
16
|
+
// Source of the event
|
|
17
|
+
source: LogSource.Server,
|
|
18
|
+
// Route path (e.g. /api/admin/courses/53450/blocks)
|
|
19
|
+
routePath: string,
|
|
20
|
+
// Route template (e.g. /api/admin/courses/:courseId/blocks)
|
|
21
|
+
routeTemplate: string,
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export default LogSourceSpecificInfo;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import LogAction from '../LogAction';
|
|
3
|
+
import LogType from '../LogType';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Log info that is specific to the type of log
|
|
7
|
+
* @author Gabe Abrams
|
|
8
|
+
*/
|
|
9
|
+
type LogTypeSpecificInfo = (
|
|
10
|
+
// Error
|
|
11
|
+
| {
|
|
12
|
+
// Type of the event
|
|
13
|
+
type: LogType.Error,
|
|
14
|
+
// The error message
|
|
15
|
+
errorMessage: string,
|
|
16
|
+
// The error code
|
|
17
|
+
errorCode: string,
|
|
18
|
+
// Error stack trace
|
|
19
|
+
errorStack: string,
|
|
20
|
+
}
|
|
21
|
+
// Action
|
|
22
|
+
| {
|
|
23
|
+
// Type of the event
|
|
24
|
+
type: LogType.Action,
|
|
25
|
+
// Target of the action (each app determines the list of targets)
|
|
26
|
+
// These are usually buttons, panels, elements, etc.
|
|
27
|
+
target: string,
|
|
28
|
+
// The type of action performed on the target
|
|
29
|
+
action: LogAction,
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export default LogTypeSpecificInfo;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import LogMainInfo from './LogMainInfo';
|
|
3
|
+
import LogSourceSpecificInfo from './LogSourceSpecificInfo';
|
|
4
|
+
import LogTypeSpecificInfo from './LogTypeSpecificInfo';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A single log event corresponding to an action performed by a user or an
|
|
8
|
+
* error encountered by a user
|
|
9
|
+
* @author Gabe Abrams
|
|
10
|
+
*/
|
|
11
|
+
type Log = (
|
|
12
|
+
LogMainInfo
|
|
13
|
+
& LogSourceSpecificInfo
|
|
14
|
+
& LogTypeSpecificInfo
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default Log;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of actions
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
enum LogAction {
|
|
6
|
+
// Target was opened by the user (it was not on screen, but now it is)
|
|
7
|
+
Open = 'open',
|
|
8
|
+
// Target was closed by the user (it was on screen, but now it is not)
|
|
9
|
+
Close = 'close',
|
|
10
|
+
// Target was expanded by the user (it always remains on screen, but size was changed)
|
|
11
|
+
Expand = 'expand',
|
|
12
|
+
// Target was collapsed by the user (it always remains on screen, but size was changed)
|
|
13
|
+
Collapse = 'collapse',
|
|
14
|
+
// Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
|
|
15
|
+
View = 'view',
|
|
16
|
+
// Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
|
|
17
|
+
Interrupt = 'interrupt',
|
|
18
|
+
// Target was created by the user (it did not exist before)
|
|
19
|
+
Create = 'create',
|
|
20
|
+
// Target was edited by the user (it existed and was changed)
|
|
21
|
+
Edit = 'edit',
|
|
22
|
+
// Target was deleted by the user (it existed and now it doesn't)
|
|
23
|
+
Delete = 'delete',
|
|
24
|
+
// Target was added by the user (it already existed and was added to another place)
|
|
25
|
+
Add = 'add',
|
|
26
|
+
// Target was removed by the user (it was removed from something but still exists)
|
|
27
|
+
Remove = 'remove',
|
|
28
|
+
// Target was activated by the user (click, check, tap, keypress, etc.)
|
|
29
|
+
Activate = 'activate',
|
|
30
|
+
// Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
|
|
31
|
+
Deactivate = 'deactivate',
|
|
32
|
+
// User showed interest in a target (hover, peek, etc.)
|
|
33
|
+
Peek = 'peek',
|
|
34
|
+
// Unknown action
|
|
35
|
+
Unknown = 'unknown',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default LogAction;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import Log from './Log';
|
|
3
|
+
import LogAction from './LogAction';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type of a log action function
|
|
7
|
+
* @author Gabe Abrams
|
|
8
|
+
*/
|
|
9
|
+
type LogFunction = (
|
|
10
|
+
opts: (
|
|
11
|
+
// Shared info
|
|
12
|
+
{
|
|
13
|
+
// Category of the event (each app determines how to categorize its events)
|
|
14
|
+
category: string,
|
|
15
|
+
// Subcategory of the event (each app determines how to categorize its events)
|
|
16
|
+
subcategory?: string,
|
|
17
|
+
// List of tags that apply to this action (each app determines tag usage)
|
|
18
|
+
tags?: string[],
|
|
19
|
+
// Additional optional custom metadata
|
|
20
|
+
metadata?: {
|
|
21
|
+
[k: string]: any,
|
|
22
|
+
},
|
|
23
|
+
} & (
|
|
24
|
+
// Error
|
|
25
|
+
| {
|
|
26
|
+
// The error object to log
|
|
27
|
+
error: any,
|
|
28
|
+
}
|
|
29
|
+
// Action
|
|
30
|
+
| {
|
|
31
|
+
// Target of the action (each app determines the list of targets)
|
|
32
|
+
// These are usually buttons, panels, elements, etc.
|
|
33
|
+
target: string,
|
|
34
|
+
// The type of action performed on the target
|
|
35
|
+
action: LogAction,
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
),
|
|
39
|
+
) => Promise<Log>;
|
|
40
|
+
|
|
41
|
+
export default LogFunction;
|