dce-reactkit 3.2.0-beta.8 → 3.2.0-beta.9

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 CHANGED
@@ -2585,13 +2585,59 @@ var LogSource$1 = LogSource;
2585
2585
  * Built-in categories for logs
2586
2586
  * @author Gabe Abrams
2587
2587
  */
2588
- var LogBuiltInCategory;
2589
- (function (LogBuiltInCategory) {
2590
- LogBuiltInCategory["Uncategorized"] = "n/a";
2591
- LogBuiltInCategory["ServerRenderedErrorPage"] = "_server-rendered-error-page";
2592
- LogBuiltInCategory["ServerEndpointError"] = "_server-endpoint-error";
2593
- })(LogBuiltInCategory || (LogBuiltInCategory = {}));
2594
- var LogBuiltInCategory$1 = LogBuiltInCategory;
2588
+ const LogBuiltInMetadata = {
2589
+ // Categories
2590
+ Category: {
2591
+ Uncategorized: 'n/a',
2592
+ ServerRenderedErrorPage: '_server-rendered-error-page',
2593
+ ServerEndpointError: '_server-endpoint-error',
2594
+ },
2595
+ // Targets
2596
+ Target: {
2597
+ NoSpecificTarget: 'n/a',
2598
+ },
2599
+ };
2600
+
2601
+ /**
2602
+ * Types of actions
2603
+ * @author Gabe Abrams
2604
+ */
2605
+ var LogAction;
2606
+ (function (LogAction) {
2607
+ // Target was opened by the user (it was not on screen, but now it is)
2608
+ LogAction["Open"] = "open";
2609
+ // Target was closed by the user (it was on screen, but now it is not)
2610
+ LogAction["Close"] = "close";
2611
+ // Target was cancelled by the user (it was on closed without saving)
2612
+ LogAction["Cancel"] = "cancel";
2613
+ // Target was expanded by the user (it always remains on screen, but size was changed)
2614
+ LogAction["Expand"] = "expand";
2615
+ // Target was collapsed by the user (it always remains on screen, but size was changed)
2616
+ LogAction["Collapse"] = "collapse";
2617
+ // Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
2618
+ LogAction["View"] = "view";
2619
+ // Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
2620
+ LogAction["Interrupt"] = "interrupt";
2621
+ // Target was created by the user (it did not exist before)
2622
+ LogAction["Create"] = "create";
2623
+ // Target was edited by the user (it existed and was changed)
2624
+ LogAction["Edit"] = "edit";
2625
+ // Target was deleted by the user (it existed and now it doesn't)
2626
+ LogAction["Delete"] = "delete";
2627
+ // Target was added by the user (it already existed and was added to another place)
2628
+ LogAction["Add"] = "add";
2629
+ // Target was removed by the user (it was removed from something but still exists)
2630
+ LogAction["Remove"] = "remove";
2631
+ // Target was activated by the user (click, check, tap, keypress, etc.)
2632
+ LogAction["Activate"] = "activate";
2633
+ // Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
2634
+ LogAction["Deactivate"] = "deactivate";
2635
+ // User showed interest in a target (hover, peek, etc.)
2636
+ LogAction["Peek"] = "peek";
2637
+ // Unknown action
2638
+ LogAction["Unknown"] = "unknown";
2639
+ })(LogAction || (LogAction = {}));
2640
+ var LogAction$1 = LogAction;
2595
2641
 
2596
2642
  /**
2597
2643
  * Generate an express API route handler
@@ -2949,10 +2995,10 @@ const genRouteHandler = (opts) => {
2949
2995
  timestamp,
2950
2996
  category: (typeof opts.category === 'string'
2951
2997
  ? opts.category
2952
- : ((_d = ((_c = opts.category) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInCategory$1.Uncategorized)),
2998
+ : ((_d = ((_c = opts.category) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Category.Uncategorized)),
2953
2999
  subcategory: (typeof opts.category === 'string'
2954
3000
  ? opts.subcategory
2955
- : ((_f = ((_e = opts.subcategory) !== null && _e !== void 0 ? _e : {})._) !== null && _f !== void 0 ? _f : LogBuiltInCategory$1.Uncategorized)),
3001
+ : ((_f = ((_e = opts.subcategory) !== null && _e !== void 0 ? _e : {})._) !== null && _f !== void 0 ? _f : LogBuiltInMetadata.Category.Uncategorized)),
2956
3002
  tags: (_g = opts.tags) !== null && _g !== void 0 ? _g : [],
2957
3003
  metadata: (_h = opts.metadata) !== null && _h !== void 0 ? _h : {},
2958
3004
  };
@@ -2966,8 +3012,8 @@ const genRouteHandler = (opts) => {
2966
3012
  }
2967
3013
  : {
2968
3014
  type: LogType$1.Action,
2969
- target: (_m = opts.target) !== null && _m !== void 0 ? _m : 'Unknown',
2970
- action: (_o = opts.action) !== null && _o !== void 0 ? _o : 'Unknown'
3015
+ target: ((_m = opts.target) !== null && _m !== void 0 ? _m : LogBuiltInMetadata.Target.NoSpecificTarget),
3016
+ action: ((_o = opts.action) !== null && _o !== void 0 ? _o : LogAction$1.Unknown),
2971
3017
  });
2972
3018
  // Source-specific info
2973
3019
  const sourceSpecificInfo = (opts.overrideAsClientEvent
@@ -3030,8 +3076,8 @@ const genRouteHandler = (opts) => {
3030
3076
  timestamp: Date.now(),
3031
3077
  tags: [],
3032
3078
  metadata: {},
3033
- category: LogBuiltInCategory$1.Uncategorized,
3034
- subcategory: LogBuiltInCategory$1.Uncategorized,
3079
+ category: LogBuiltInMetadata.Category.Uncategorized,
3080
+ subcategory: LogBuiltInMetadata.Category.Uncategorized,
3035
3081
  };
3036
3082
  const dummyTypeSpecificInfo = {
3037
3083
  type: LogType$1.Error,
@@ -3090,7 +3136,7 @@ const genRouteHandler = (opts) => {
3090
3136
  send(html, (_a = opts.status) !== null && _a !== void 0 ? _a : 500);
3091
3137
  // Log
3092
3138
  logServerEvent({
3093
- category: LogBuiltInCategory$1.ServerRenderedErrorPage,
3139
+ category: LogBuiltInMetadata.Category.ServerRenderedErrorPage,
3094
3140
  error: {
3095
3141
  message: `${opts.title}: ${opts.description}`,
3096
3142
  code: opts.code,
@@ -3129,7 +3175,7 @@ const genRouteHandler = (opts) => {
3129
3175
  handleError(res, err);
3130
3176
  // Log server-side error
3131
3177
  logServerEvent({
3132
- category: LogBuiltInCategory$1.ServerEndpointError,
3178
+ category: LogBuiltInMetadata.Category.ServerEndpointError,
3133
3179
  error: err,
3134
3180
  });
3135
3181
  return;
@@ -3331,17 +3377,17 @@ const parallelLimit = (taskFunctions, limit) => __awaiter(void 0, void 0, void 0
3331
3377
  * @author Gabe Abrams
3332
3378
  */
3333
3379
  const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* () {
3334
- var _a, _b, _c, _d, _e, _f;
3380
+ var _a, _b, _c, _d, _e, _f, _g;
3335
3381
  return visitServerEndpoint({
3336
3382
  path: LOG_ROUTE_PATH,
3337
3383
  method: 'POST',
3338
3384
  params: {
3339
3385
  category: (typeof opts.category === 'string'
3340
3386
  ? opts.category
3341
- : ((_b = ((_a = opts.category) !== null && _a !== void 0 ? _a : {})._) !== null && _b !== void 0 ? _b : LogBuiltInCategory$1.Uncategorized)),
3387
+ : ((_b = ((_a = opts.category) !== null && _a !== void 0 ? _a : {})._) !== null && _b !== void 0 ? _b : LogBuiltInMetadata.Category.Uncategorized)),
3342
3388
  subcategory: (typeof opts.category === 'string'
3343
3389
  ? opts.subcategory
3344
- : ((_d = ((_c = opts.subcategory) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInCategory$1.Uncategorized)),
3390
+ : ((_d = ((_c = opts.subcategory) !== null && _c !== void 0 ? _c : {})._) !== null && _d !== void 0 ? _d : LogBuiltInMetadata.Category.Uncategorized)),
3345
3391
  tags: JSON.stringify((_e = opts.tags) !== null && _e !== void 0 ? _e : []),
3346
3392
  metadata: JSON.stringify((_f = opts.metadata) !== null && _f !== void 0 ? _f : {}),
3347
3393
  errorMessage: (opts.error
@@ -3353,8 +3399,8 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
3353
3399
  errorStack: (opts.error
3354
3400
  ? opts.error.stack
3355
3401
  : undefined),
3356
- target: (opts.target
3357
- ? opts.target
3402
+ target: (opts.action
3403
+ ? ((_g = opts.target) !== null && _g !== void 0 ? _g : LogBuiltInMetadata.Target.NoSpecificTarget)
3358
3404
  : undefined),
3359
3405
  action: (opts.action
3360
3406
  ? opts.action
@@ -3397,47 +3443,6 @@ var DayOfWeek;
3397
3443
  })(DayOfWeek || (DayOfWeek = {}));
3398
3444
  var DayOfWeek$1 = DayOfWeek;
3399
3445
 
3400
- /**
3401
- * Types of actions
3402
- * @author Gabe Abrams
3403
- */
3404
- var LogAction;
3405
- (function (LogAction) {
3406
- // Target was opened by the user (it was not on screen, but now it is)
3407
- LogAction["Open"] = "open";
3408
- // Target was closed by the user (it was on screen, but now it is not)
3409
- LogAction["Close"] = "close";
3410
- // Target was cancelled by the user (it was on closed without saving)
3411
- LogAction["Cancel"] = "cancel";
3412
- // Target was expanded by the user (it always remains on screen, but size was changed)
3413
- LogAction["Expand"] = "expand";
3414
- // Target was collapsed by the user (it always remains on screen, but size was changed)
3415
- LogAction["Collapse"] = "collapse";
3416
- // Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
3417
- LogAction["View"] = "view";
3418
- // Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
3419
- LogAction["Interrupt"] = "interrupt";
3420
- // Target was created by the user (it did not exist before)
3421
- LogAction["Create"] = "create";
3422
- // Target was edited by the user (it existed and was changed)
3423
- LogAction["Edit"] = "edit";
3424
- // Target was deleted by the user (it existed and now it doesn't)
3425
- LogAction["Delete"] = "delete";
3426
- // Target was added by the user (it already existed and was added to another place)
3427
- LogAction["Add"] = "add";
3428
- // Target was removed by the user (it was removed from something but still exists)
3429
- LogAction["Remove"] = "remove";
3430
- // Target was activated by the user (click, check, tap, keypress, etc.)
3431
- LogAction["Activate"] = "activate";
3432
- // Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
3433
- LogAction["Deactivate"] = "deactivate";
3434
- // User showed interest in a target (hover, peek, etc.)
3435
- LogAction["Peek"] = "peek";
3436
- // Unknown action
3437
- LogAction["Unknown"] = "unknown";
3438
- })(LogAction || (LogAction = {}));
3439
- var LogAction$1 = LogAction;
3440
-
3441
3446
  exports.AppWrapper = AppWrapper;
3442
3447
  exports.ButtonInputGroup = ButtonInputGroup;
3443
3448
  exports.CheckboxButton = CheckboxButton;
@@ -3451,7 +3456,7 @@ exports.HOUR_IN_MS = HOUR_IN_MS;
3451
3456
  exports.ItemPicker = ItemPicker;
3452
3457
  exports.LoadingSpinner = LoadingSpinner;
3453
3458
  exports.LogAction = LogAction$1;
3454
- exports.LogBuiltInCategory = LogBuiltInCategory$1;
3459
+ exports.LogBuiltInCategory = LogBuiltInMetadata;
3455
3460
  exports.LogSource = LogSource$1;
3456
3461
  exports.LogType = LogType$1;
3457
3462
  exports.MINUTE_IN_MS = MINUTE_IN_MS;