clarion-shared-types 1.0.84 → 1.0.85

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.
@@ -6,17 +6,25 @@ exports.IncidentDispatchScope = void 0;
6
6
  * whether the reporter asked for the service provider to be alerted at all.
7
7
  *
8
8
  * ALL - no dispatch filter (default; preserves legacy behaviour).
9
- * DISPATCHED - only incidents the provider was asked to receive. Used by the
10
- * primary admin incident list, map and kanban views.
9
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
10
+ * Used by the primary admin incident list, map and kanban views.
11
11
  * SUPPRESSED - only incidents the reporter explicitly withheld from the
12
- * provider. Backs the "Incident List - Marked Ignore" admin
13
- * view.
12
+ * provider. Backs the "Marked Ignore" admin views.
13
+ *
14
+ * Both read what the reporter ASKED FOR, not what they got. Entitlement can
15
+ * close the provider channel on its own, and an operator looking at a
16
+ * "Marked Ignore" list wants the alerts somebody chose to withhold - not the
17
+ * ones billing withheld for them.
14
18
  *
15
19
  * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
16
20
  * billing fact about the reporter, dispatch is a choice the reporter made on
17
- * this one alert. The two compose - the control room asks for
18
- * `ENTITLED` + `DISPATCHED`, "Marked Ignore" asks for `ENTITLED` + `SUPPRESSED`,
19
- * and "Free Users" asks for `FREE` on the entitlement dimension alone.
21
+ * this one alert. The two compose into the admin's operator views:
22
+ *
23
+ * Incidents (list/map/kanban) ENTITLED + DISPATCHED
24
+ * Incident List - Marked Ignore ENTITLED + SUPPRESSED
25
+ * Incident List - Uncovered Types UNCOVERED_TYPE + DISPATCHED
26
+ * Uncovered Types - Marked Ignore UNCOVERED_TYPE + SUPPRESSED
27
+ * Incident List - Free Users FREE
20
28
  */
21
29
  var IncidentDispatchScope;
22
30
  (function (IncidentDispatchScope) {
@@ -1 +1 @@
1
- {"version":3,"file":"incident-dispatch-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/enums/incident-dispatch-scope.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,kDAAyB,CAAA;IACzB,kDAAyB,CAAA;AAC7B,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
1
+ {"version":3,"file":"incident-dispatch-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/enums/incident-dispatch-scope.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,kDAAyB,CAAA;IACzB,kDAAyB,CAAA;AAC7B,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reachesControlRoom = reachesControlRoom;
4
4
  exports.reachesGuardians = reachesGuardians;
5
5
  exports.isMarkedIgnore = isMarkedIgnore;
6
+ exports.isUncoveredIncidentType = isUncoveredIncidentType;
7
+ exports.isUnentitledReporter = isUnentitledReporter;
6
8
  exports.resolveIncidentAlertDispatch = resolveIncidentAlertDispatch;
7
9
  exports.reachesNobody = reachesNobody;
8
10
  exports.parseIncidentDispatchScope = parseIncidentDispatchScope;
11
+ const entitlement_decision_reason_enum_1 = require("../../entitlement/enums/entitlement-decision-reason.enum");
9
12
  const entitlement_util_1 = require("../../entitlement/utils/entitlement.util");
10
13
  const incident_dispatch_scope_enum_1 = require("../enums/incident-dispatch-scope.enum");
11
14
  /**
@@ -15,9 +18,11 @@ const incident_dispatch_scope_enum_1 = require("../enums/incident-dispatch-scope
15
18
  * Two independent reasons keep an alert out, and this is the single place both
16
19
  * are expressed so no consumer can honour one and forget the other:
17
20
  *
18
- * 1. the reporter is a Free user, so the provider was never entitled to it;
19
- * 2. the reporter explicitly unchecked the provider option ("Marked Ignore").
21
+ * 1. the reporter was not entitled to send it (no subscription, or one that
22
+ * does not cover this incident type), so the provider was never asked;
23
+ * 2. the reporter explicitly unchecked the provider option.
20
24
  *
25
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
21
26
  * A missing flag counts as dispatched: incidents written before this feature
22
27
  * existed, and every operator-created record, keep their original behaviour.
23
28
  */
@@ -33,15 +38,36 @@ function reachesGuardians(incident) {
33
38
  return !incident || incident.notifyGuardians !== false;
34
39
  }
35
40
  /**
36
- * Whether the reporter deliberately withheld this alert from the provider, as
37
- * opposed to never having been entitled to send it. Only the former belongs in
38
- * the "Marked Ignore" admin list; a Free user's alert belongs in
39
- * "Incident List - Free Users".
41
+ * Whether the reporter deliberately withheld this alert from the provider.
42
+ *
43
+ * Reads the REQUEST, not the outcome. An alert entitlement withheld is not an
44
+ * alert somebody chose to withhold, and only the second belongs in a
45
+ * "Marked Ignore" view - a free user never had the option to decline, so their
46
+ * alert is not "marked ignore" however the resolved flag ended up.
47
+ *
48
+ * Independent of entitlement, so it holds equally for a subscriber who declined
49
+ * on a covered type and one who declined on a type their package excludes.
50
+ * Which of the two Marked Ignore lists they land in is decided by pairing this
51
+ * with the entitlement scope.
40
52
  */
41
53
  function isMarkedIgnore(incident) {
42
- if (!incident)
43
- return false;
44
- return incident.notifyServiceProvider === false && !(0, entitlement_util_1.isFreeUserTier)(incident.entitlementTier);
54
+ return (incident === null || incident === void 0 ? void 0 : incident.notifyServiceProviderRequested) === false;
55
+ }
56
+ /**
57
+ * Whether the reporter pays for cover, but not for the incident type they
58
+ * raised. Distinct from having no entitlement at all: this is a paying customer
59
+ * finding a gap in their package, not someone to upsell from scratch.
60
+ */
61
+ function isUncoveredIncidentType(incident) {
62
+ return (incident === null || incident === void 0 ? void 0 : incident.entitlementReason) === entitlement_decision_reason_enum_1.EntitlementDecisionReason.INCIDENT_TYPE_NOT_COVERED;
63
+ }
64
+ /**
65
+ * Whether the reporter had no entitlement whatsoever - never subscribed,
66
+ * lapsed, or a spent/expired trial. Deliberately excludes the uncovered-type
67
+ * case, which carries the same FREE tier but is a different conversation.
68
+ */
69
+ function isUnentitledReporter(incident) {
70
+ return (0, entitlement_util_1.isFreeUserTier)(incident === null || incident === void 0 ? void 0 : incident.entitlementTier) && !isUncoveredIncidentType(incident);
45
71
  }
46
72
  /**
47
73
  * Applies dispatch policy to what the client asked for.
@@ -52,20 +78,29 @@ function isMarkedIgnore(incident) {
52
78
  * defaults to "notify", so existing callers (web admin, older app builds) are
53
79
  * unaffected.
54
80
  *
55
- * Returns resolved flags only - it deliberately does not reject the
56
- * both-off combination, so callers can decide whether that is a validation
57
- * error (the SOS path) or simply nobody to notify.
81
+ * Returns both what was asked for and what will happen, because the two diverge
82
+ * exactly when entitlement overrides the reporter - and that difference is what
83
+ * the admin's Marked Ignore views are built on.
84
+ *
85
+ * It deliberately does not reject the both-off combination, so callers can
86
+ * decide whether that is a validation error (the SOS path) or simply nobody to
87
+ * notify.
58
88
  */
59
89
  function resolveIncidentAlertDispatch(request) {
60
90
  const applies = request.applies !== false;
61
91
  if (!applies) {
62
- return { notifyServiceProvider: true, notifyGuardians: true };
92
+ return {
93
+ notifyServiceProvider: true,
94
+ notifyGuardians: true,
95
+ notifyServiceProviderRequested: true,
96
+ };
63
97
  }
64
98
  const notifyGuardians = request.notifyGuardians !== false;
99
+ const notifyServiceProviderRequested = request.notifyServiceProvider !== false;
65
100
  const notifyServiceProvider = (0, entitlement_util_1.isFreeUserTier)(request.tier)
66
101
  ? false
67
- : request.notifyServiceProvider !== false;
68
- return { notifyServiceProvider, notifyGuardians };
102
+ : notifyServiceProviderRequested;
103
+ return { notifyServiceProvider, notifyGuardians, notifyServiceProviderRequested };
69
104
  }
70
105
  /** True when an alert would reach nobody at all. */
71
106
  function reachesNobody(dispatch) {
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dispatch.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/utils/alert-dispatch.util.ts"],"names":[],"mappings":";;AAkBA,gDAMC;AAGD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,QAAQ,uBAAR,QAAQ,CAAE,eAAe,MAAK,KAAK,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,KAAqB;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,oDAAqB,CAAC,GAAG,CAAC;IAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAQ,MAAM,CAAC,MAAM,CAAC,oDAAqB,CAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC1E,CAAC,CAAE,UAAoC;QACvC,CAAC,CAAC,oDAAqB,CAAC,GAAG,CAAC;AACpC,CAAC"}
@@ -4,16 +4,27 @@ exports.IncidentEntitlementScope = void 0;
4
4
  /**
5
5
  * List filter applied to incident queries.
6
6
  *
7
- * ALL — no entitlement filter (default; preserves legacy behaviour).
8
- * ENTITLED — everything except Free-user incidents. Used by the primary admin
9
- * incident list, map and kanban views.
10
- * FREE — only Free-user incidents. Backs the "Incident List - Free Users"
11
- * admin view.
7
+ * ALL — no entitlement filter (default; preserves legacy behaviour).
8
+ * ENTITLED — everything except incidents the reporter was not entitled
9
+ * to send. Used by the primary admin list, map and kanban.
10
+ * FREE — reporters with no entitlement at all: never subscribed,
11
+ * lapsed, or a spent/expired trial. Backs
12
+ * "Incident List - Free Users".
13
+ * UNCOVERED_TYPE — reporters who DO pay, but whose package excludes the
14
+ * incident type they raised. Backs
15
+ * "Incident List - Uncovered Types".
16
+ *
17
+ * The last two both carry tier FREE, because that is what billing stamps in
18
+ * either case, but they are very different situations for an operator: one is
19
+ * an upsell, the other is a paying customer discovering a gap in their cover.
20
+ * `FREE` therefore excludes uncovered-type incidents rather than absorbing
21
+ * them, so the three scopes partition the data with no overlap and no gaps.
12
22
  */
13
23
  var IncidentEntitlementScope;
14
24
  (function (IncidentEntitlementScope) {
15
25
  IncidentEntitlementScope["ALL"] = "ALL";
16
26
  IncidentEntitlementScope["ENTITLED"] = "ENTITLED";
17
27
  IncidentEntitlementScope["FREE"] = "FREE";
28
+ IncidentEntitlementScope["UNCOVERED_TYPE"] = "UNCOVERED_TYPE";
18
29
  })(IncidentEntitlementScope || (exports.IncidentEntitlementScope = IncidentEntitlementScope = {}));
19
30
  //# sourceMappingURL=incident-entitlement-scope.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incident-entitlement-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/entitlement/enums/incident-entitlement-scope.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAChC,uCAAW,CAAA;IACX,iDAAqB,CAAA;IACrB,yCAAa,CAAA;AACjB,CAAC,EAJW,wBAAwB,wCAAxB,wBAAwB,QAInC"}
1
+ {"version":3,"file":"incident-entitlement-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/entitlement/enums/incident-entitlement-scope.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAChC,uCAAW,CAAA;IACX,iDAAqB,CAAA;IACrB,yCAAa,CAAA;IACb,6DAAiC,CAAA;AACrC,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC"}
@@ -3,17 +3,25 @@
3
3
  * whether the reporter asked for the service provider to be alerted at all.
4
4
  *
5
5
  * ALL - no dispatch filter (default; preserves legacy behaviour).
6
- * DISPATCHED - only incidents the provider was asked to receive. Used by the
7
- * primary admin incident list, map and kanban views.
6
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
7
+ * Used by the primary admin incident list, map and kanban views.
8
8
  * SUPPRESSED - only incidents the reporter explicitly withheld from the
9
- * provider. Backs the "Incident List - Marked Ignore" admin
10
- * view.
9
+ * provider. Backs the "Marked Ignore" admin views.
10
+ *
11
+ * Both read what the reporter ASKED FOR, not what they got. Entitlement can
12
+ * close the provider channel on its own, and an operator looking at a
13
+ * "Marked Ignore" list wants the alerts somebody chose to withhold - not the
14
+ * ones billing withheld for them.
11
15
  *
12
16
  * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
13
17
  * billing fact about the reporter, dispatch is a choice the reporter made on
14
- * this one alert. The two compose - the control room asks for
15
- * `ENTITLED` + `DISPATCHED`, "Marked Ignore" asks for `ENTITLED` + `SUPPRESSED`,
16
- * and "Free Users" asks for `FREE` on the entitlement dimension alone.
18
+ * this one alert. The two compose into the admin's operator views:
19
+ *
20
+ * Incidents (list/map/kanban) ENTITLED + DISPATCHED
21
+ * Incident List - Marked Ignore ENTITLED + SUPPRESSED
22
+ * Incident List - Uncovered Types UNCOVERED_TYPE + DISPATCHED
23
+ * Uncovered Types - Marked Ignore UNCOVERED_TYPE + SUPPRESSED
24
+ * Incident List - Free Users FREE
17
25
  */
18
26
  export var IncidentDispatchScope;
19
27
  (function (IncidentDispatchScope) {
@@ -1 +1 @@
1
- {"version":3,"file":"incident-dispatch-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/enums/incident-dispatch-scope.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,kDAAyB,CAAA;IACzB,kDAAyB,CAAA;AAC7B,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC"}
1
+ {"version":3,"file":"incident-dispatch-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/enums/incident-dispatch-scope.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,kDAAyB,CAAA;IACzB,kDAAyB,CAAA;AAC7B,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC"}
@@ -1,3 +1,4 @@
1
+ import { EntitlementDecisionReason } from '../../entitlement/enums/entitlement-decision-reason.enum';
1
2
  import { isFreeUserTier } from '../../entitlement/utils/entitlement.util';
2
3
  import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
3
4
  /**
@@ -7,9 +8,11 @@ import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
7
8
  * Two independent reasons keep an alert out, and this is the single place both
8
9
  * are expressed so no consumer can honour one and forget the other:
9
10
  *
10
- * 1. the reporter is a Free user, so the provider was never entitled to it;
11
- * 2. the reporter explicitly unchecked the provider option ("Marked Ignore").
11
+ * 1. the reporter was not entitled to send it (no subscription, or one that
12
+ * does not cover this incident type), so the provider was never asked;
13
+ * 2. the reporter explicitly unchecked the provider option.
12
14
  *
15
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
13
16
  * A missing flag counts as dispatched: incidents written before this feature
14
17
  * existed, and every operator-created record, keep their original behaviour.
15
18
  */
@@ -25,15 +28,36 @@ export function reachesGuardians(incident) {
25
28
  return !incident || incident.notifyGuardians !== false;
26
29
  }
27
30
  /**
28
- * Whether the reporter deliberately withheld this alert from the provider, as
29
- * opposed to never having been entitled to send it. Only the former belongs in
30
- * the "Marked Ignore" admin list; a Free user's alert belongs in
31
- * "Incident List - Free Users".
31
+ * Whether the reporter deliberately withheld this alert from the provider.
32
+ *
33
+ * Reads the REQUEST, not the outcome. An alert entitlement withheld is not an
34
+ * alert somebody chose to withhold, and only the second belongs in a
35
+ * "Marked Ignore" view - a free user never had the option to decline, so their
36
+ * alert is not "marked ignore" however the resolved flag ended up.
37
+ *
38
+ * Independent of entitlement, so it holds equally for a subscriber who declined
39
+ * on a covered type and one who declined on a type their package excludes.
40
+ * Which of the two Marked Ignore lists they land in is decided by pairing this
41
+ * with the entitlement scope.
32
42
  */
33
43
  export function isMarkedIgnore(incident) {
34
- if (!incident)
35
- return false;
36
- return incident.notifyServiceProvider === false && !isFreeUserTier(incident.entitlementTier);
44
+ return (incident === null || incident === void 0 ? void 0 : incident.notifyServiceProviderRequested) === false;
45
+ }
46
+ /**
47
+ * Whether the reporter pays for cover, but not for the incident type they
48
+ * raised. Distinct from having no entitlement at all: this is a paying customer
49
+ * finding a gap in their package, not someone to upsell from scratch.
50
+ */
51
+ export function isUncoveredIncidentType(incident) {
52
+ return (incident === null || incident === void 0 ? void 0 : incident.entitlementReason) === EntitlementDecisionReason.INCIDENT_TYPE_NOT_COVERED;
53
+ }
54
+ /**
55
+ * Whether the reporter had no entitlement whatsoever - never subscribed,
56
+ * lapsed, or a spent/expired trial. Deliberately excludes the uncovered-type
57
+ * case, which carries the same FREE tier but is a different conversation.
58
+ */
59
+ export function isUnentitledReporter(incident) {
60
+ return isFreeUserTier(incident === null || incident === void 0 ? void 0 : incident.entitlementTier) && !isUncoveredIncidentType(incident);
37
61
  }
38
62
  /**
39
63
  * Applies dispatch policy to what the client asked for.
@@ -44,20 +68,29 @@ export function isMarkedIgnore(incident) {
44
68
  * defaults to "notify", so existing callers (web admin, older app builds) are
45
69
  * unaffected.
46
70
  *
47
- * Returns resolved flags only - it deliberately does not reject the
48
- * both-off combination, so callers can decide whether that is a validation
49
- * error (the SOS path) or simply nobody to notify.
71
+ * Returns both what was asked for and what will happen, because the two diverge
72
+ * exactly when entitlement overrides the reporter - and that difference is what
73
+ * the admin's Marked Ignore views are built on.
74
+ *
75
+ * It deliberately does not reject the both-off combination, so callers can
76
+ * decide whether that is a validation error (the SOS path) or simply nobody to
77
+ * notify.
50
78
  */
51
79
  export function resolveIncidentAlertDispatch(request) {
52
80
  const applies = request.applies !== false;
53
81
  if (!applies) {
54
- return { notifyServiceProvider: true, notifyGuardians: true };
82
+ return {
83
+ notifyServiceProvider: true,
84
+ notifyGuardians: true,
85
+ notifyServiceProviderRequested: true,
86
+ };
55
87
  }
56
88
  const notifyGuardians = request.notifyGuardians !== false;
89
+ const notifyServiceProviderRequested = request.notifyServiceProvider !== false;
57
90
  const notifyServiceProvider = isFreeUserTier(request.tier)
58
91
  ? false
59
- : request.notifyServiceProvider !== false;
60
- return { notifyServiceProvider, notifyGuardians };
92
+ : notifyServiceProviderRequested;
93
+ return { notifyServiceProvider, notifyGuardians, notifyServiceProviderRequested };
61
94
  }
62
95
  /** True when an alert would reach nobody at all. */
63
96
  export function reachesNobody(dispatch) {
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dispatch.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/utils/alert-dispatch.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAG9E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAC9B,QAA+F;IAE/F,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3D,OAAO,QAAQ,CAAC,qBAAqB,KAAK,KAAK,CAAC;AACpD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,QAA+B;IAC5D,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,eAAe,KAAK,KAAK,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC1B,QAA+F;IAE/F,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAO,QAAQ,CAAC,qBAAqB,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AACjG,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAA6B;IACtE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;IAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAClE,CAAC;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O,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,8BAA8B,CAAC;IAErC,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,8BAA8B,EAAE,CAAC;AACtF,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,QAA+B;IACzD,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,qBAAqB,MAAK,KAAK,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,MAAK,KAAK,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAqB;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,qBAAqB,CAAC,GAAG,CAAC;IAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAQ,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC1E,CAAC,CAAE,UAAoC;QACvC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC;AACpC,CAAC"}
@@ -1,16 +1,27 @@
1
1
  /**
2
2
  * List filter applied to incident queries.
3
3
  *
4
- * ALL — no entitlement filter (default; preserves legacy behaviour).
5
- * ENTITLED — everything except Free-user incidents. Used by the primary admin
6
- * incident list, map and kanban views.
7
- * FREE — only Free-user incidents. Backs the "Incident List - Free Users"
8
- * admin view.
4
+ * ALL — no entitlement filter (default; preserves legacy behaviour).
5
+ * ENTITLED — everything except incidents the reporter was not entitled
6
+ * to send. Used by the primary admin list, map and kanban.
7
+ * FREE — reporters with no entitlement at all: never subscribed,
8
+ * lapsed, or a spent/expired trial. Backs
9
+ * "Incident List - Free Users".
10
+ * UNCOVERED_TYPE — reporters who DO pay, but whose package excludes the
11
+ * incident type they raised. Backs
12
+ * "Incident List - Uncovered Types".
13
+ *
14
+ * The last two both carry tier FREE, because that is what billing stamps in
15
+ * either case, but they are very different situations for an operator: one is
16
+ * an upsell, the other is a paying customer discovering a gap in their cover.
17
+ * `FREE` therefore excludes uncovered-type incidents rather than absorbing
18
+ * them, so the three scopes partition the data with no overlap and no gaps.
9
19
  */
10
20
  export var IncidentEntitlementScope;
11
21
  (function (IncidentEntitlementScope) {
12
22
  IncidentEntitlementScope["ALL"] = "ALL";
13
23
  IncidentEntitlementScope["ENTITLED"] = "ENTITLED";
14
24
  IncidentEntitlementScope["FREE"] = "FREE";
25
+ IncidentEntitlementScope["UNCOVERED_TYPE"] = "UNCOVERED_TYPE";
15
26
  })(IncidentEntitlementScope || (IncidentEntitlementScope = {}));
16
27
  //# sourceMappingURL=incident-entitlement-scope.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incident-entitlement-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/entitlement/enums/incident-entitlement-scope.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAChC,uCAAW,CAAA;IACX,iDAAqB,CAAA;IACrB,yCAAa,CAAA;AACjB,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC"}
1
+ {"version":3,"file":"incident-entitlement-scope.enum.js","sourceRoot":"","sources":["../../../../../src/modules/entitlement/enums/incident-entitlement-scope.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAChC,uCAAW,CAAA;IACX,iDAAqB,CAAA;IACrB,yCAAa,CAAA;IACb,6DAAiC,CAAA;AACrC,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC"}
@@ -3,17 +3,25 @@
3
3
  * whether the reporter asked for the service provider to be alerted at all.
4
4
  *
5
5
  * ALL - no dispatch filter (default; preserves legacy behaviour).
6
- * DISPATCHED - only incidents the provider was asked to receive. Used by the
7
- * primary admin incident list, map and kanban views.
6
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
7
+ * Used by the primary admin incident list, map and kanban views.
8
8
  * SUPPRESSED - only incidents the reporter explicitly withheld from the
9
- * provider. Backs the "Incident List - Marked Ignore" admin
10
- * view.
9
+ * provider. Backs the "Marked Ignore" admin views.
10
+ *
11
+ * Both read what the reporter ASKED FOR, not what they got. Entitlement can
12
+ * close the provider channel on its own, and an operator looking at a
13
+ * "Marked Ignore" list wants the alerts somebody chose to withhold - not the
14
+ * ones billing withheld for them.
11
15
  *
12
16
  * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
13
17
  * billing fact about the reporter, dispatch is a choice the reporter made on
14
- * this one alert. The two compose - the control room asks for
15
- * `ENTITLED` + `DISPATCHED`, "Marked Ignore" asks for `ENTITLED` + `SUPPRESSED`,
16
- * and "Free Users" asks for `FREE` on the entitlement dimension alone.
18
+ * this one alert. The two compose into the admin's operator views:
19
+ *
20
+ * Incidents (list/map/kanban) ENTITLED + DISPATCHED
21
+ * Incident List - Marked Ignore ENTITLED + SUPPRESSED
22
+ * Incident List - Uncovered Types UNCOVERED_TYPE + DISPATCHED
23
+ * Uncovered Types - Marked Ignore UNCOVERED_TYPE + SUPPRESSED
24
+ * Incident List - Free Users FREE
17
25
  */
18
26
  export declare enum IncidentDispatchScope {
19
27
  ALL = "ALL",
@@ -20,6 +20,19 @@ export interface IncidentAlertDispatch {
20
20
  * chat or notified about the alert.
21
21
  */
22
22
  notifyGuardians?: boolean;
23
+ /**
24
+ * What the reporter actually asked for, before entitlement had its say.
25
+ *
26
+ * Kept apart from `notifyServiceProvider` because that one records the
27
+ * OUTCOME, and once entitlement forces it false the reporter's own choice
28
+ * is no longer recoverable from it. The distinction is the whole basis of
29
+ * the "Marked Ignore" views: an alert billing withheld is not an alert
30
+ * somebody chose to withhold.
31
+ *
32
+ * Absent on incidents raised before the option existed, and on records the
33
+ * option does not govern - both of which count as "did not withhold".
34
+ */
35
+ notifyServiceProviderRequested?: boolean;
23
36
  }
24
37
  /** The inputs {@link resolveIncidentAlertDispatch} decides from. */
25
38
  export interface AlertDispatchRequest extends IncidentAlertDispatch {
@@ -1,6 +1,13 @@
1
+ import { EntitlementDecisionReason } from '../../entitlement/enums/entitlement-decision-reason.enum';
1
2
  import { IncidentEntitlementTier } from '../../entitlement/enums/incident-entitlement-tier.enum';
2
3
  import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
3
4
  import { AlertDispatchRequest, IncidentAlertDispatch } from '../interfaces/alert-dispatch';
5
+ /** The two entitlement facts an incident carries, as the helpers below read them. */
6
+ export interface IncidentEntitlementFacts {
7
+ entitlementTier?: IncidentEntitlementTier | string | null;
8
+ /** Promoted out of the entitlement snapshot so it can be filtered and indexed. */
9
+ entitlementReason?: EntitlementDecisionReason | string | null;
10
+ }
4
11
  /**
5
12
  * Whether an incident reaches the provider control room - live map, live list,
6
13
  * kanban, operator assignment and operator notifications.
@@ -8,26 +15,43 @@ import { AlertDispatchRequest, IncidentAlertDispatch } from '../interfaces/alert
8
15
  * Two independent reasons keep an alert out, and this is the single place both
9
16
  * are expressed so no consumer can honour one and forget the other:
10
17
  *
11
- * 1. the reporter is a Free user, so the provider was never entitled to it;
12
- * 2. the reporter explicitly unchecked the provider option ("Marked Ignore").
18
+ * 1. the reporter was not entitled to send it (no subscription, or one that
19
+ * does not cover this incident type), so the provider was never asked;
20
+ * 2. the reporter explicitly unchecked the provider option.
13
21
  *
22
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
14
23
  * A missing flag counts as dispatched: incidents written before this feature
15
24
  * existed, and every operator-created record, keep their original behaviour.
16
25
  */
17
- export declare function reachesControlRoom(incident: IncidentAlertDispatch & {
18
- entitlementTier?: IncidentEntitlementTier | string | null;
19
- }): boolean;
26
+ export declare function reachesControlRoom(incident: IncidentAlertDispatch & IncidentEntitlementFacts): boolean;
20
27
  /** Whether the reporter's guardians should be pulled in and notified. */
21
28
  export declare function reachesGuardians(incident: IncidentAlertDispatch): boolean;
22
29
  /**
23
- * Whether the reporter deliberately withheld this alert from the provider, as
24
- * opposed to never having been entitled to send it. Only the former belongs in
25
- * the "Marked Ignore" admin list; a Free user's alert belongs in
26
- * "Incident List - Free Users".
30
+ * Whether the reporter deliberately withheld this alert from the provider.
31
+ *
32
+ * Reads the REQUEST, not the outcome. An alert entitlement withheld is not an
33
+ * alert somebody chose to withhold, and only the second belongs in a
34
+ * "Marked Ignore" view - a free user never had the option to decline, so their
35
+ * alert is not "marked ignore" however the resolved flag ended up.
36
+ *
37
+ * Independent of entitlement, so it holds equally for a subscriber who declined
38
+ * on a covered type and one who declined on a type their package excludes.
39
+ * Which of the two Marked Ignore lists they land in is decided by pairing this
40
+ * with the entitlement scope.
27
41
  */
28
- export declare function isMarkedIgnore(incident: IncidentAlertDispatch & {
29
- entitlementTier?: IncidentEntitlementTier | string | null;
30
- }): boolean;
42
+ export declare function isMarkedIgnore(incident: IncidentAlertDispatch & Partial<IncidentEntitlementFacts>): boolean;
43
+ /**
44
+ * Whether the reporter pays for cover, but not for the incident type they
45
+ * raised. Distinct from having no entitlement at all: this is a paying customer
46
+ * finding a gap in their package, not someone to upsell from scratch.
47
+ */
48
+ export declare function isUncoveredIncidentType(incident: IncidentEntitlementFacts): boolean;
49
+ /**
50
+ * Whether the reporter had no entitlement whatsoever - never subscribed,
51
+ * lapsed, or a spent/expired trial. Deliberately excludes the uncovered-type
52
+ * case, which carries the same FREE tier but is a different conversation.
53
+ */
54
+ export declare function isUnentitledReporter(incident: IncidentEntitlementFacts): boolean;
31
55
  /**
32
56
  * Applies dispatch policy to what the client asked for.
33
57
  *
@@ -37,9 +61,13 @@ export declare function isMarkedIgnore(incident: IncidentAlertDispatch & {
37
61
  * defaults to "notify", so existing callers (web admin, older app builds) are
38
62
  * unaffected.
39
63
  *
40
- * Returns resolved flags only - it deliberately does not reject the
41
- * both-off combination, so callers can decide whether that is a validation
42
- * error (the SOS path) or simply nobody to notify.
64
+ * Returns both what was asked for and what will happen, because the two diverge
65
+ * exactly when entitlement overrides the reporter - and that difference is what
66
+ * the admin's Marked Ignore views are built on.
67
+ *
68
+ * It deliberately does not reject the both-off combination, so callers can
69
+ * decide whether that is a validation error (the SOS path) or simply nobody to
70
+ * notify.
43
71
  */
44
72
  export declare function resolveIncidentAlertDispatch(request: AlertDispatchRequest): Required<IncidentAlertDispatch>;
45
73
  /** True when an alert would reach nobody at all. */
@@ -1,14 +1,25 @@
1
1
  /**
2
2
  * List filter applied to incident queries.
3
3
  *
4
- * ALL — no entitlement filter (default; preserves legacy behaviour).
5
- * ENTITLED — everything except Free-user incidents. Used by the primary admin
6
- * incident list, map and kanban views.
7
- * FREE — only Free-user incidents. Backs the "Incident List - Free Users"
8
- * admin view.
4
+ * ALL — no entitlement filter (default; preserves legacy behaviour).
5
+ * ENTITLED — everything except incidents the reporter was not entitled
6
+ * to send. Used by the primary admin list, map and kanban.
7
+ * FREE — reporters with no entitlement at all: never subscribed,
8
+ * lapsed, or a spent/expired trial. Backs
9
+ * "Incident List - Free Users".
10
+ * UNCOVERED_TYPE — reporters who DO pay, but whose package excludes the
11
+ * incident type they raised. Backs
12
+ * "Incident List - Uncovered Types".
13
+ *
14
+ * The last two both carry tier FREE, because that is what billing stamps in
15
+ * either case, but they are very different situations for an operator: one is
16
+ * an upsell, the other is a paying customer discovering a gap in their cover.
17
+ * `FREE` therefore excludes uncovered-type incidents rather than absorbing
18
+ * them, so the three scopes partition the data with no overlap and no gaps.
9
19
  */
10
20
  export declare enum IncidentEntitlementScope {
11
21
  ALL = "ALL",
12
22
  ENTITLED = "ENTITLED",
13
- FREE = "FREE"
23
+ FREE = "FREE",
24
+ UNCOVERED_TYPE = "UNCOVERED_TYPE"
14
25
  }
@@ -16,6 +16,7 @@ import { IncidentReport } from "./incident-report";
16
16
  import { IncidentEmergencyType } from "../enums/incident-emergency-type.enum";
17
17
  import { IncidentEntitlementSnapshot } from "../../entitlement/interfaces/entitlement-evaluation";
18
18
  import { IncidentEntitlementTier } from "../../entitlement/enums/incident-entitlement-tier.enum";
19
+ import { EntitlementDecisionReason } from "../../entitlement/enums/entitlement-decision-reason.enum";
19
20
  export interface Incident {
20
21
  id?: number;
21
22
  appId: IncidentAppId;
@@ -52,6 +53,14 @@ export interface Incident {
52
53
  entitlementTier?: IncidentEntitlementTier;
53
54
  /** Point-in-time audit of how `entitlementTier` was decided. */
54
55
  entitlementSnapshot?: IncidentEntitlementSnapshot | null;
56
+ /**
57
+ * Why `entitlementTier` came out the way it did, promoted out of the
58
+ * snapshot so it can be filtered and indexed. It is what separates a
59
+ * reporter with no entitlement at all from a paying one whose package
60
+ * excludes the incident type they raised - both carry tier FREE, but they
61
+ * are different conversations and get their own admin views.
62
+ */
63
+ entitlementReason?: EntitlementDecisionReason;
55
64
  /**
56
65
  * Who the reporter asked to be alerted, resolved against their entitlement
57
66
  * at creation. `false` on the provider flag withholds the incident from the
@@ -62,6 +71,12 @@ export interface Incident {
62
71
  */
63
72
  notifyServiceProvider?: boolean;
64
73
  notifyGuardians?: boolean;
74
+ /**
75
+ * What the reporter asked for before entitlement had its say. The
76
+ * "Marked Ignore" views read this rather than the outcome above: an alert
77
+ * billing withheld is not an alert somebody chose to withhold.
78
+ */
79
+ notifyServiceProviderRequested?: boolean;
65
80
  createdAt?: string;
66
81
  updatedAt?: string;
67
82
  category?: IncidentCategory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarion-shared-types",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",