grm-shared-library 1.1.193 → 1.1.195

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.
Files changed (43) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js +35 -0
  4. package/dist/cjs/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js.map +1 -0
  5. package/dist/cjs/modules/alert-dispatch/index.js +23 -0
  6. package/dist/cjs/modules/alert-dispatch/index.js.map +1 -0
  7. package/dist/cjs/modules/alert-dispatch/interfaces/alert-dispatch.js +3 -0
  8. package/dist/cjs/modules/alert-dispatch/interfaces/alert-dispatch.js.map +1 -0
  9. package/dist/cjs/modules/alert-dispatch/utils/alert-dispatch.util.js +121 -0
  10. package/dist/cjs/modules/alert-dispatch/utils/alert-dispatch.util.js.map +1 -0
  11. package/dist/cjs/modules/entitlement/enums/incident-entitlement-scope.enum.js +16 -5
  12. package/dist/cjs/modules/entitlement/enums/incident-entitlement-scope.enum.js.map +1 -1
  13. package/dist/cjs/modules/incident/dtos/incident/create-incident.dto.js +18 -0
  14. package/dist/cjs/modules/incident/dtos/incident/create-incident.dto.js.map +1 -1
  15. package/dist/cjs/modules/incident/dtos/incident/incident.dto.js +11 -0
  16. package/dist/cjs/modules/incident/dtos/incident/incident.dto.js.map +1 -1
  17. package/dist/esm/index.js +1 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js +32 -0
  20. package/dist/esm/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js.map +1 -0
  21. package/dist/esm/modules/alert-dispatch/index.js +7 -0
  22. package/dist/esm/modules/alert-dispatch/index.js.map +1 -0
  23. package/dist/esm/modules/alert-dispatch/interfaces/alert-dispatch.js +2 -0
  24. package/dist/esm/modules/alert-dispatch/interfaces/alert-dispatch.js.map +1 -0
  25. package/dist/esm/modules/alert-dispatch/utils/alert-dispatch.util.js +111 -0
  26. package/dist/esm/modules/alert-dispatch/utils/alert-dispatch.util.js.map +1 -0
  27. package/dist/esm/modules/entitlement/enums/incident-entitlement-scope.enum.js +16 -5
  28. package/dist/esm/modules/entitlement/enums/incident-entitlement-scope.enum.js.map +1 -1
  29. package/dist/esm/modules/incident/dtos/incident/create-incident.dto.js +18 -0
  30. package/dist/esm/modules/incident/dtos/incident/create-incident.dto.js.map +1 -1
  31. package/dist/esm/modules/incident/dtos/incident/incident.dto.js +12 -1
  32. package/dist/esm/modules/incident/dtos/incident/incident.dto.js.map +1 -1
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/interfaces/pagination.d.ts +8 -0
  35. package/dist/types/modules/alert-dispatch/enums/incident-dispatch-scope.enum.d.ts +30 -0
  36. package/dist/types/modules/alert-dispatch/index.d.ts +3 -0
  37. package/dist/types/modules/alert-dispatch/interfaces/alert-dispatch.d.ts +46 -0
  38. package/dist/types/modules/alert-dispatch/utils/alert-dispatch.util.d.ts +79 -0
  39. package/dist/types/modules/entitlement/enums/incident-entitlement-scope.enum.d.ts +17 -6
  40. package/dist/types/modules/incident/dtos/incident/create-incident.dto.d.ts +14 -0
  41. package/dist/types/modules/incident/dtos/incident/incident.dto.d.ts +8 -0
  42. package/dist/types/modules/incident/intefaces/incident.d.ts +24 -0
  43. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -37,6 +37,7 @@ __exportStar(require("./modules/country/index"), exports);
37
37
  __exportStar(require("./modules/phone/index"), exports);
38
38
  __exportStar(require("./modules/tracking/index"), exports);
39
39
  __exportStar(require("./modules/entitlement/index"), exports);
40
+ __exportStar(require("./modules/alert-dispatch/index"), exports);
40
41
  __exportStar(require("./modules/system-user/index"), exports);
41
42
  // Interfaces
42
43
  __exportStar(require("./interfaces/server-message"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;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"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IncidentDispatchScope = void 0;
4
+ /**
5
+ * List filter applied to incident queries on the *dispatch* dimension - i.e.
6
+ * whether the reporter asked for the service provider to be alerted at all.
7
+ *
8
+ * ALL - no dispatch filter (default; preserves legacy behaviour).
9
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
10
+ * Used by the primary admin incident list, map and kanban views.
11
+ * SUPPRESSED - only incidents the reporter explicitly withheld from the
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.
18
+ *
19
+ * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
20
+ * billing fact about the reporter, dispatch is a choice the reporter made on
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
28
+ */
29
+ var IncidentDispatchScope;
30
+ (function (IncidentDispatchScope) {
31
+ IncidentDispatchScope["ALL"] = "ALL";
32
+ IncidentDispatchScope["DISPATCHED"] = "DISPATCHED";
33
+ IncidentDispatchScope["SUPPRESSED"] = "SUPPRESSED";
34
+ })(IncidentDispatchScope || (exports.IncidentDispatchScope = IncidentDispatchScope = {}));
35
+ //# sourceMappingURL=incident-dispatch-scope.enum.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,kDAAyB,CAAA;IACzB,kDAAyB,CAAA;AAC7B,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Enums
18
+ __exportStar(require("./enums/incident-dispatch-scope.enum"), exports);
19
+ // Interfaces
20
+ __exportStar(require("./interfaces/alert-dispatch"), exports);
21
+ // Utilities
22
+ __exportStar(require("./utils/alert-dispatch.util"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-dispatch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,uEAAqD;AAErD,aAAa;AACb,8DAA4C;AAE5C,YAAY;AACZ,8DAA4C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=alert-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-dispatch.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/interfaces/alert-dispatch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reachesControlRoom = reachesControlRoom;
4
+ exports.reachesGuardians = reachesGuardians;
5
+ exports.isMarkedIgnore = isMarkedIgnore;
6
+ exports.isUncoveredIncidentType = isUncoveredIncidentType;
7
+ exports.isUnentitledReporter = isUnentitledReporter;
8
+ exports.resolveIncidentAlertDispatch = resolveIncidentAlertDispatch;
9
+ exports.reachesNobody = reachesNobody;
10
+ exports.parseIncidentDispatchScope = parseIncidentDispatchScope;
11
+ const entitlement_decision_reason_enum_1 = require("../../entitlement/enums/entitlement-decision-reason.enum");
12
+ const entitlement_util_1 = require("../../entitlement/utils/entitlement.util");
13
+ const incident_dispatch_scope_enum_1 = require("../enums/incident-dispatch-scope.enum");
14
+ /**
15
+ * Whether an incident reaches the provider control room - live map, live list,
16
+ * kanban, operator assignment and operator notifications.
17
+ *
18
+ * Two independent reasons keep an alert out, and this is the single place both
19
+ * are expressed so no consumer can honour one and forget the other:
20
+ *
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.
24
+ *
25
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
26
+ * A missing flag counts as dispatched: incidents written before this feature
27
+ * existed, and every operator-created record, keep their original behaviour.
28
+ */
29
+ function reachesControlRoom(incident) {
30
+ if (!incident)
31
+ return true;
32
+ if ((0, entitlement_util_1.isFreeUserTier)(incident.entitlementTier))
33
+ return false;
34
+ return incident.notifyServiceProvider !== false;
35
+ }
36
+ /** Whether the reporter's guardians should be pulled in and notified. */
37
+ function reachesGuardians(incident) {
38
+ return !incident || incident.notifyGuardians !== false;
39
+ }
40
+ /**
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.
52
+ */
53
+ function isMarkedIgnore(incident) {
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);
71
+ }
72
+ /**
73
+ * Applies dispatch policy to what the client asked for.
74
+ *
75
+ * The client's checkboxes are an intent, never the decision: a Free user's
76
+ * provider option is unchecked and read-only in the app, and this is what makes
77
+ * that true even for a caller that ignores the UI. Anything the client omits
78
+ * defaults to "notify", so existing callers (web admin, older app builds) are
79
+ * unaffected.
80
+ *
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.
88
+ */
89
+ function resolveIncidentAlertDispatch(request) {
90
+ const applies = request.applies !== false;
91
+ if (!applies) {
92
+ return {
93
+ notifyServiceProvider: true,
94
+ notifyGuardians: true,
95
+ notifyServiceProviderRequested: true,
96
+ };
97
+ }
98
+ const notifyGuardians = request.notifyGuardians !== false;
99
+ const notifyServiceProviderRequested = request.notifyServiceProvider !== false;
100
+ const notifyServiceProvider = (0, entitlement_util_1.isFreeUserTier)(request.tier)
101
+ ? false
102
+ : notifyServiceProviderRequested;
103
+ return { notifyServiceProvider, notifyGuardians, notifyServiceProviderRequested };
104
+ }
105
+ /** True when an alert would reach nobody at all. */
106
+ function reachesNobody(dispatch) {
107
+ return (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyServiceProvider) === false && (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyGuardians) === false;
108
+ }
109
+ /**
110
+ * Parses a client-supplied dispatch scope. Unknown/absent values fall back to
111
+ * `ALL` so an unrecognised query string never silently hides incidents.
112
+ */
113
+ function parseIncidentDispatchScope(value) {
114
+ if (!value)
115
+ return incident_dispatch_scope_enum_1.IncidentDispatchScope.ALL;
116
+ const normalized = value.trim().toUpperCase();
117
+ return Object.values(incident_dispatch_scope_enum_1.IncidentDispatchScope).includes(normalized)
118
+ ? normalized
119
+ : incident_dispatch_scope_enum_1.IncidentDispatchScope.ALL;
120
+ }
121
+ //# sourceMappingURL=alert-dispatch.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-dispatch.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/utils/alert-dispatch.util.ts"],"names":[],"mappings":";;AA4BA,gDAMC;AAGD,4CAEC;AAeD,wCAIC;AAOD,0DAEC;AAOD,oDAEC;AAmBD,oEAoBC;AAGD,sCAEC;AAMD,gEAMC;AApID,+GAAqG;AAErG,+EAA0E;AAC1E,wFAA8E;AAU9E;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB,CAC9B,QAA0D;IAE1D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,IAAA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I,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,SAAgB,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,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"}
@@ -267,4 +267,22 @@ __decorate([
267
267
  (0, class_validator_1.IsNotEmpty)(),
268
268
  __metadata("design:type", Number)
269
269
  ], CreateIncidentDto.prototype, "organizationId", void 0);
270
+ __decorate([
271
+ (0, swagger_1.ApiPropertyOptional)({
272
+ description: "Whether the service provider's control room should be alerted. Defaults to true.",
273
+ example: true
274
+ }),
275
+ (0, class_validator_1.IsBoolean)(),
276
+ (0, class_validator_1.IsOptional)(),
277
+ __metadata("design:type", Boolean)
278
+ ], CreateIncidentDto.prototype, "notifyServiceProvider", void 0);
279
+ __decorate([
280
+ (0, swagger_1.ApiPropertyOptional)({
281
+ description: "Whether the reporter's guardians should be alerted and added to the incident chat. Defaults to true.",
282
+ example: true
283
+ }),
284
+ (0, class_validator_1.IsBoolean)(),
285
+ (0, class_validator_1.IsOptional)(),
286
+ __metadata("design:type", Boolean)
287
+ ], CreateIncidentDto.prototype, "notifyGuardians", void 0);
270
288
  //# sourceMappingURL=create-incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyH;AACzH,6CAAmE;AACnE,2EAAiE;AACjE,yEAAgE;AAChE,6EAAoE;AACpE,yDAAyC;AACzC,+EAAsE;AACtE,4CAAiD;AACjD,2EAAkE;AAClE,qGAA8F;AAC9F,2FAAqF;AACrF,2FAAiF;AACjF,6FAAsF;AAEtF,MAAa,iBAAiB;CAwN7B;AAxND,8CAwNC;AAhNG;IAPC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,+CAA+C;QAC5D,IAAI,EAAE,oCAAa;QACnB,OAAO,EAAE,oCAAa,CAAC,KAAK;KAC/B,CAAC;IACD,IAAA,wBAAM,EAAC,oCAAa,CAAC;IACrB,IAAA,4BAAU,GAAE;;gDACS;AAStB;IAPC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,mCAAa;QACnB,OAAO,EAAE,mCAAa,CAAC,QAAQ;KAClC,CAAC;IACD,IAAA,wBAAM,EAAC,mCAAa,CAAC;IACrB,IAAA,4BAAU,GAAE;;gDACS;AAStB;IA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,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KACtB,CAAC;IACD,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,4BAAU,GAAE;;wDACY;AASzB;IAPC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,sDAAsD;QACnE,IAAI,EAAE,iEAA6B;QACnC,OAAO,EAAE,iEAA6B,CAAC,cAAc;KACxD,CAAC;IACD,IAAA,wBAAM,EAAC,iEAA6B,CAAC;IACrC,IAAA,4BAAU,GAAE;;gEACyC;AAQtD;IANC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACY;AAQzB;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACW"}
1
+ {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyH;AACzH,6CAAmE;AACnE,2EAAiE;AACjE,yEAAgE;AAChE,6EAAoE;AACpE,yDAAyC;AACzC,+EAAsE;AACtE,4CAAiD;AACjD,2EAAkE;AAClE,qGAA8F;AAC9F,2FAAqF;AACrF,2FAAiF;AACjF,6FAAsF;AAEtF,MAAa,iBAAiB;CAoP7B;AApPD,8CAoPC;AA5OG;IAPC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,+CAA+C;QAC5D,IAAI,EAAE,oCAAa;QACnB,OAAO,EAAE,oCAAa,CAAC,KAAK;KAC/B,CAAC;IACD,IAAA,wBAAM,EAAC,oCAAa,CAAC;IACrB,IAAA,4BAAU,G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 +21,7 @@ const incident_assignment_dto_1 = require("../assignment/incident-assignment.dto
21
21
  const update_incident_response_unit_assignment_dto_1 = require("../response-unit-assignment/update-incident-response-unit-assignment.dto");
22
22
  const incident_reporter_dto_1 = require("../reporter/incident-reporter.dto");
23
23
  const incident_status_details_dto_1 = require("./incident-status-details.dto");
24
+ const incident_entitlement_tier_enum_1 = require("../../../entitlement/enums/incident-entitlement-tier.enum");
24
25
  class IncidentDto extends (0, swagger_1.OmitType)(create_incident_dto_1.CreateIncidentDto, ['reporter', 'statusDetails']) {
25
26
  }
26
27
  exports.IncidentDto = IncidentDto;
@@ -124,4 +125,14 @@ __decorate([
124
125
  (0, class_validator_1.IsNotEmpty)(),
125
126
  __metadata("design:type", String)
126
127
  ], IncidentDto.prototype, "updatedAt", void 0);
128
+ __decorate([
129
+ (0, swagger_1.ApiPropertyOptional)({
130
+ description: 'Premium entitlement tier stamped on the incident at creation',
131
+ enum: incident_entitlement_tier_enum_1.IncidentEntitlementTier,
132
+ example: incident_entitlement_tier_enum_1.IncidentEntitlementTier.PREMIUM
133
+ }),
134
+ (0, class_validator_1.IsEnum)(incident_entitlement_tier_enum_1.IncidentEntitlementTier),
135
+ (0, class_validator_1.IsOptional)(),
136
+ __metadata("design:type", String)
137
+ ], IncidentDto.prototype, "entitlementTier", void 0);
127
138
  //# sourceMappingURL=incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA0G;AAC1G,6CAA6E;AAC7E,+DAA0D;AAC1D,yDAAyC;AACzC,2FAAqF;AACrF,+EAAyE;AACzE,uEAAkE;AAClE,mFAA8E;AAC9E,2IAA6H;AAC7H,6EAAwE;AACxE,+EAAyE;AAEzE,MAAa,WAAY,SAAQ,IAAA,kBAAQ,EAAC,uCAAiB,EAAE,CAAC,UAAU,EAAE,eAAe,CAAU,CAAC;CA0Fn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AAE;IACZ,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,uCAAiB,CAAC;;4CACA;AAU9B;IARC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,CAAC,+CAAqB,CAAC;KAChC,CAAC;IACD,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;IACZ,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+CAAqB,CAAC;;gDACI;AAUtC;IARC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,CAAC,gFAAiC,CAAC;KAC5C,CAAC;IACD,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;IACZ,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,gFAAiC,CAAC;;4DACgB;AAQ9D;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,IAAA,8BAAY,GAAE;IACd,IAAA,4BAAU,GAAE;;8CACM;AAQnB;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,IAAA,8BAAY,GAAE;IACd,IAAA,4BAAU,GAAE;;8CACM"}
1
+ {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkH;AAClH,6CAA6E;AAC7E,+DAA0D;AAC1D,yDAAyC;AACzC,2FAAqF;AACrF,+EAAyE;AACzE,uEAAkE;AAClE,mFAA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8D;QAC3E,IAAI,EAAE,wDAAuB;QAC7B,OAAO,EAAE,wDAAuB,CAAC,OAAO;KAC3C,CAAC;IACD,IAAA,wBAAM,EAAC,wDAAuB,CAAC;IAC/B,IAAA,4BAAU,GAAE;;oDAC6B"}
package/dist/esm/index.js CHANGED
@@ -21,6 +21,7 @@ export * from './modules/country/index';
21
21
  export * from './modules/phone/index';
22
22
  export * from './modules/tracking/index';
23
23
  export * from './modules/entitlement/index';
24
+ export * from './modules/alert-dispatch/index';
24
25
  export * from './modules/system-user/index';
25
26
  // Interfaces
26
27
  export * from './interfaces/server-message';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAE5C,aAAa;AACb,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAExC,YAAY;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,32 @@
1
+ /**
2
+ * List filter applied to incident queries on the *dispatch* dimension - i.e.
3
+ * whether the reporter asked for the service provider to be alerted at all.
4
+ *
5
+ * ALL - no dispatch filter (default; preserves legacy behaviour).
6
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
7
+ * Used by the primary admin incident list, map and kanban views.
8
+ * SUPPRESSED - only incidents the reporter explicitly withheld from the
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.
15
+ *
16
+ * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
17
+ * billing fact about the reporter, dispatch is a choice the reporter made on
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
25
+ */
26
+ export var IncidentDispatchScope;
27
+ (function (IncidentDispatchScope) {
28
+ IncidentDispatchScope["ALL"] = "ALL";
29
+ IncidentDispatchScope["DISPATCHED"] = "DISPATCHED";
30
+ IncidentDispatchScope["SUPPRESSED"] = "SUPPRESSED";
31
+ })(IncidentDispatchScope || (IncidentDispatchScope = {}));
32
+ //# sourceMappingURL=incident-dispatch-scope.enum.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;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"}
@@ -0,0 +1,7 @@
1
+ // Enums
2
+ export * from './enums/incident-dispatch-scope.enum';
3
+ // Interfaces
4
+ export * from './interfaces/alert-dispatch';
5
+ // Utilities
6
+ export * from './utils/alert-dispatch.util';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-dispatch/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,sCAAsC,CAAC;AAErD,aAAa;AACb,cAAc,6BAA6B,CAAC;AAE5C,YAAY;AACZ,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-dispatch.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/interfaces/alert-dispatch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ import { EntitlementDecisionReason } from '../../entitlement/enums/entitlement-decision-reason.enum';
2
+ import { isFreeUserTier } from '../../entitlement/utils/entitlement.util';
3
+ import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
4
+ /**
5
+ * Whether an incident reaches the provider control room - live map, live list,
6
+ * kanban, operator assignment and operator notifications.
7
+ *
8
+ * Two independent reasons keep an alert out, and this is the single place both
9
+ * are expressed so no consumer can honour one and forget the other:
10
+ *
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.
14
+ *
15
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
16
+ * A missing flag counts as dispatched: incidents written before this feature
17
+ * existed, and every operator-created record, keep their original behaviour.
18
+ */
19
+ export function reachesControlRoom(incident) {
20
+ if (!incident)
21
+ return true;
22
+ if (isFreeUserTier(incident.entitlementTier))
23
+ return false;
24
+ return incident.notifyServiceProvider !== false;
25
+ }
26
+ /** Whether the reporter's guardians should be pulled in and notified. */
27
+ export function reachesGuardians(incident) {
28
+ return !incident || incident.notifyGuardians !== false;
29
+ }
30
+ /**
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.
42
+ */
43
+ export function isMarkedIgnore(incident) {
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);
61
+ }
62
+ /**
63
+ * Applies dispatch policy to what the client asked for.
64
+ *
65
+ * The client's checkboxes are an intent, never the decision: a Free user's
66
+ * provider option is unchecked and read-only in the app, and this is what makes
67
+ * that true even for a caller that ignores the UI. Anything the client omits
68
+ * defaults to "notify", so existing callers (web admin, older app builds) are
69
+ * unaffected.
70
+ *
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.
78
+ */
79
+ export function resolveIncidentAlertDispatch(request) {
80
+ const applies = request.applies !== false;
81
+ if (!applies) {
82
+ return {
83
+ notifyServiceProvider: true,
84
+ notifyGuardians: true,
85
+ notifyServiceProviderRequested: true,
86
+ };
87
+ }
88
+ const notifyGuardians = request.notifyGuardians !== false;
89
+ const notifyServiceProviderRequested = request.notifyServiceProvider !== false;
90
+ const notifyServiceProvider = isFreeUserTier(request.tier)
91
+ ? false
92
+ : notifyServiceProviderRequested;
93
+ return { notifyServiceProvider, notifyGuardians, notifyServiceProviderRequested };
94
+ }
95
+ /** True when an alert would reach nobody at all. */
96
+ export function reachesNobody(dispatch) {
97
+ return (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyServiceProvider) === false && (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyGuardians) === false;
98
+ }
99
+ /**
100
+ * Parses a client-supplied dispatch scope. Unknown/absent values fall back to
101
+ * `ALL` so an unrecognised query string never silently hides incidents.
102
+ */
103
+ export function parseIncidentDispatchScope(value) {
104
+ if (!value)
105
+ return IncidentDispatchScope.ALL;
106
+ const normalized = value.trim().toUpperCase();
107
+ return Object.values(IncidentDispatchScope).includes(normalized)
108
+ ? normalized
109
+ : IncidentDispatchScope.ALL;
110
+ }
111
+ //# sourceMappingURL=alert-dispatch.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-dispatch.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/utils/alert-dispatch.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AAErG,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,qB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M,eAAe,GAAG,OAAO,CAAC,eAAe,KAAK,KAAK,CAAC;IAC1D,MAAM,8BAA8B,GAAG,OAAO,CAAC,qBAAqB,KAAK,KAAK,CAAC;IAC/E,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,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"}
@@ -263,4 +263,22 @@ __decorate([
263
263
  IsNotEmpty(),
264
264
  __metadata("design:type", Number)
265
265
  ], CreateIncidentDto.prototype, "organizationId", void 0);
266
+ __decorate([
267
+ ApiPropertyOptional({
268
+ description: "Whether the service provider's control room should be alerted. Defaults to true.",
269
+ example: true
270
+ }),
271
+ IsBoolean(),
272
+ IsOptional(),
273
+ __metadata("design:type", Boolean)
274
+ ], CreateIncidentDto.prototype, "notifyServiceProvider", void 0);
275
+ __decorate([
276
+ ApiPropertyOptional({
277
+ description: "Whether the reporter's guardians should be alerted and added to the incident chat. Defaults to true.",
278
+ example: true
279
+ }),
280
+ IsBoolean(),
281
+ IsOptional(),
282
+ __metadata("design:type", Boolean)
283
+ ], CreateIncidentDto.prototype, "notifyGuardians", void 0);
266
284
  //# sourceMappingURL=create-incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,6BAA6B,E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AAE,IAAI,EAAE,CAAC;IAC5B,UAAU,EAAE;;0DACc;AAU3B;IARC,mBAAmB,CAAC;QACjB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KACtB,CAAC;IACD,OAAO,EAAE;IACT,QAAQ,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC5B,UAAU,EAAE;;wDACY;AASzB;IAPC,WAAW,CAAC;QACT,WAAW,EAAE,sDAAsD;QACnE,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,6BAA6B,CAAC,cAAc;KACxD,CAAC;IACD,MAAM,CAAC,6BAA6B,CAAC;IACrC,UAAU,EAAE;;gEACyC;AAQtD;IANC,mBAAmB,CAAC;QACjB,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;0DACY;AAQzB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;yDACW"}
1
+ {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,I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-7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsOptional, ValidateNested } from "class-validator";
10
+ import { IsArray, IsDateString, IsEnum, IsNotEmpty, IsNumber, IsOptional, ValidateNested } from "class-validator";
11
11
  import { ApiProperty, ApiPropertyOptional, OmitType } from "@nestjs/swagger";
12
12
  import { CreateIncidentDto } from "./create-incident.dto";
13
13
  import { Type } from "class-transformer";
@@ -18,6 +18,7 @@ import { IncidentAssignmentDto } from "../assignment/incident-assignment.dto";
18
18
  import { IncidentResponseUnitAssignmentDto } from "../response-unit-assignment/update-incident-response-unit-assignment.dto";
19
19
  import { IncidentReporterDto } from "../reporter/incident-reporter.dto";
20
20
  import { IncidentStatusDetailsDto } from "./incident-status-details.dto";
21
+ import { IncidentEntitlementTier } from "../../../entitlement/enums/incident-entitlement-tier.enum";
21
22
  export class IncidentDto extends OmitType(CreateIncidentDto, ['reporter', 'statusDetails']) {
22
23
  }
23
24
  __decorate([
@@ -120,4 +121,14 @@ __decorate([
120
121
  IsNotEmpty(),
121
122
  __metadata("design:type", String)
122
123
  ], IncidentDto.prototype, "updatedAt", void 0);
124
+ __decorate([
125
+ ApiPropertyOptional({
126
+ description: 'Premium entitlement tier stamped on the incident at creation',
127
+ enum: IncidentEntitlementTier,
128
+ example: IncidentEntitlementTier.PREMIUM
129
+ }),
130
+ IsEnum(IncidentEntitlementTier),
131
+ IsOptional(),
132
+ __metadata("design:type", String)
133
+ ], IncidentDto.prototype, "entitlementTier", void 0);
123
134
  //# sourceMappingURL=incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,O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ACT,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM;AAQnB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM"}
1
+ {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,iCAAiC,EAAE,MAAM,0EAA0E,CAAC;AAC7H,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2DAA2D,CAAC;AAEpG,MAAM,OAAO,WAAY,SAAQ,QAAQ,CAAC,iBAAiB,EAAE,CAAC,UAAU,EAAE,eAAe,CAAU,CAAC;CAyGnG;AAlGG;IANC,WAAW,CAAC;QACT,WAAW,EAAE,mCAAmC;QAChD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,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC;;gDACI;AAUtC;IARC,mBAAmB,CAAC;QACjB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,CAAC,iCAAiC,CAAC;KAC5C,CAAC;IACD,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,iCAAiC,CAAC;;4DACgB;AAQ9D;IANC,WAAW,CAAC;QACT,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM;AAQnB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM;AAenB;IAPC,mBAAmB,CAAC;QACjB,WAAW,EAAE,8DAA8D;QAC3E,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,uBAAuB,CAAC,OAAO;KAC3C,CAAC;IACD,MAAM,CAAC,uBAAuB,CAAC;IAC/B,UAAU,EAAE;;oDAC6B"}
@@ -20,6 +20,7 @@ export * from './modules/country/index';
20
20
  export * from './modules/phone/index';
21
21
  export * from './modules/tracking/index';
22
22
  export * from './modules/entitlement/index';
23
+ export * from './modules/alert-dispatch/index';
23
24
  export * from './modules/system-user/index';
24
25
  export * from './interfaces/server-message';
25
26
  export * from './interfaces/i-request-with-user';
@@ -6,6 +6,7 @@ import { ResponseUnit } from "../modules/response-unit";
6
6
  import { User } from "../modules/user";
7
7
  import { WebNotification } from "../modules/web-notification";
8
8
  import { IncidentEntitlementScope } from "../modules/entitlement/enums/incident-entitlement-scope.enum";
9
+ import { IncidentDispatchScope } from "../modules/alert-dispatch/enums/incident-dispatch-scope.enum";
9
10
  export interface CursorPaginatedResponse<T> {
10
11
  data: T[];
11
12
  nextCursor: string | null;
@@ -26,6 +27,13 @@ export interface PaginationParams {
26
27
  */
27
28
  export interface IncidentQueryParams extends PaginationParams {
28
29
  entitlementScope?: IncidentEntitlementScope;
30
+ /**
31
+ * Independent of `entitlementScope`: filters on whether the reporter asked
32
+ * for the provider to be alerted at all. The control room combines
33
+ * `ENTITLED` + `DISPATCHED`; the "Incident List - Marked Ignore" view asks
34
+ * for `ENTITLED` + `SUPPRESSED`. Omitting it applies no dispatch filter.
35
+ */
36
+ dispatchScope?: IncidentDispatchScope;
29
37
  }
30
38
  export interface PaginatedResponse<T> {
31
39
  data: T[];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * List filter applied to incident queries on the *dispatch* dimension - i.e.
3
+ * whether the reporter asked for the service provider to be alerted at all.
4
+ *
5
+ * ALL - no dispatch filter (default; preserves legacy behaviour).
6
+ * DISPATCHED - only incidents the reporter asked the provider to receive.
7
+ * Used by the primary admin incident list, map and kanban views.
8
+ * SUPPRESSED - only incidents the reporter explicitly withheld from the
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.
15
+ *
16
+ * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
17
+ * billing fact about the reporter, dispatch is a choice the reporter made on
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
25
+ */
26
+ export declare enum IncidentDispatchScope {
27
+ ALL = "ALL",
28
+ DISPATCHED = "DISPATCHED",
29
+ SUPPRESSED = "SUPPRESSED"
30
+ }
@@ -0,0 +1,3 @@
1
+ export * from './enums/incident-dispatch-scope.enum';
2
+ export * from './interfaces/alert-dispatch';
3
+ export * from './utils/alert-dispatch.util';
@@ -0,0 +1,46 @@
1
+ import { IncidentEntitlementTier } from '../../entitlement/enums/incident-entitlement-tier.enum';
2
+ /**
3
+ * Who an incident's alert was actually dispatched to.
4
+ *
5
+ * Both flags are resolved server-side at creation and then stored on the
6
+ * incident, so every downstream consumer (realtime publisher, notification
7
+ * service, admin lists, the mobile confirmation dialog) reads one recorded fact
8
+ * rather than re-deriving policy. `undefined` means "not recorded" and is
9
+ * always treated as `true`, which is what every incident written before this
10
+ * existed implicitly did.
11
+ */
12
+ export interface IncidentAlertDispatch {
13
+ /**
14
+ * False when the alert must not reach the provider control room: the
15
+ * reporter unchecked the option, or they are a Free user who never had it.
16
+ */
17
+ notifyServiceProvider?: boolean;
18
+ /**
19
+ * False when the reporter's guardians must not be pulled into the incident
20
+ * chat or notified about the alert.
21
+ */
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;
36
+ }
37
+ /** The inputs {@link resolveIncidentAlertDispatch} decides from. */
38
+ export interface AlertDispatchRequest extends IncidentAlertDispatch {
39
+ /** Entitlement tier already decided for this incident. */
40
+ tier?: IncidentEntitlementTier | string | null;
41
+ /**
42
+ * False for records that predate or sit outside the SOS flow (grievances,
43
+ * operator-created incidents), which keep both channels on.
44
+ */
45
+ applies?: boolean;
46
+ }
@@ -0,0 +1,79 @@
1
+ import { EntitlementDecisionReason } from '../../entitlement/enums/entitlement-decision-reason.enum';
2
+ import { IncidentEntitlementTier } from '../../entitlement/enums/incident-entitlement-tier.enum';
3
+ import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
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
+ }
11
+ /**
12
+ * Whether an incident reaches the provider control room - live map, live list,
13
+ * kanban, operator assignment and operator notifications.
14
+ *
15
+ * Two independent reasons keep an alert out, and this is the single place both
16
+ * are expressed so no consumer can honour one and forget the other:
17
+ *
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.
21
+ *
22
+ * Reads `notifyServiceProvider`, the resolved OUTCOME - never the request.
23
+ * A missing flag counts as dispatched: incidents written before this feature
24
+ * existed, and every operator-created record, keep their original behaviour.
25
+ */
26
+ export declare function reachesControlRoom(incident: IncidentAlertDispatch & IncidentEntitlementFacts): boolean;
27
+ /** Whether the reporter's guardians should be pulled in and notified. */
28
+ export declare function reachesGuardians(incident: IncidentAlertDispatch): boolean;
29
+ /**
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.
41
+ */
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;
55
+ /**
56
+ * Applies dispatch policy to what the client asked for.
57
+ *
58
+ * The client's checkboxes are an intent, never the decision: a Free user's
59
+ * provider option is unchecked and read-only in the app, and this is what makes
60
+ * that true even for a caller that ignores the UI. Anything the client omits
61
+ * defaults to "notify", so existing callers (web admin, older app builds) are
62
+ * unaffected.
63
+ *
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.
71
+ */
72
+ export declare function resolveIncidentAlertDispatch(request: AlertDispatchRequest): Required<IncidentAlertDispatch>;
73
+ /** True when an alert would reach nobody at all. */
74
+ export declare function reachesNobody(dispatch: IncidentAlertDispatch): boolean;
75
+ /**
76
+ * Parses a client-supplied dispatch scope. Unknown/absent values fall back to
77
+ * `ALL` so an unrecognised query string never silently hides incidents.
78
+ */
79
+ export declare function parseIncidentDispatchScope(value?: string | null): IncidentDispatchScope;
@@ -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
  }
@@ -34,4 +34,18 @@ export declare class CreateIncidentDto {
34
34
  workflowTaskQueueName: IncidentWorkflowTaskQueueName;
35
35
  controlCentreId?: number;
36
36
  organizationId: number;
37
+ /**
38
+ * Whether the service provider's control room should receive this alert.
39
+ *
40
+ * The reporter's choice, not the decision: clarion-incident resolves it
41
+ * against the reporter's entitlement before storing it (a Free user's option
42
+ * is always off). Omitting it means "notify", so callers that predate the
43
+ * option - the web admin, older app builds - are unaffected.
44
+ */
45
+ notifyServiceProvider?: boolean;
46
+ /**
47
+ * Whether the reporter's guardians should join the incident chat and be
48
+ * notified. Omitting it means "notify".
49
+ */
50
+ notifyGuardians?: boolean;
37
51
  }
@@ -6,6 +6,7 @@ import { IncidentAssignmentDto } from "../assignment/incident-assignment.dto";
6
6
  import { IncidentResponseUnitAssignmentDto } from "../response-unit-assignment/update-incident-response-unit-assignment.dto";
7
7
  import { IncidentReporterDto } from "../reporter/incident-reporter.dto";
8
8
  import { IncidentStatusDetailsDto } from "./incident-status-details.dto";
9
+ import { IncidentEntitlementTier } from "../../../entitlement/enums/incident-entitlement-tier.enum";
9
10
  declare const IncidentDto_base: import("@nestjs/common").Type<Omit<CreateIncidentDto, "reporter" | "statusDetails">>;
10
11
  export declare class IncidentDto extends IncidentDto_base {
11
12
  id: number;
@@ -18,5 +19,12 @@ export declare class IncidentDto extends IncidentDto_base {
18
19
  responseUnitAssignments?: IncidentResponseUnitAssignmentDto[];
19
20
  createdAt: string;
20
21
  updatedAt: string;
22
+ /**
23
+ * Premium standing of the reporter when the alert was raised. Server-derived
24
+ * and read-only; it appears here so Kafka consumers (notably
25
+ * clarion-notification, which whitelists this DTO) can tell a Free-user
26
+ * alert from an entitled one without calling back into billing.
27
+ */
28
+ entitlementTier?: IncidentEntitlementTier;
21
29
  }
22
30
  export {};
@@ -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;
@@ -57,6 +58,29 @@ export interface Incident {
57
58
  entitlementTier?: IncidentEntitlementTier;
58
59
  /** Point-in-time audit of how `entitlementTier` was decided. */
59
60
  entitlementSnapshot?: IncidentEntitlementSnapshot | null;
61
+ /**
62
+ * Why `entitlementTier` came out the way it did, promoted out of the
63
+ * snapshot so it can be filtered and indexed. It is what separates a
64
+ * reporter with no entitlement at all from a paying one whose package
65
+ * excludes the incident type they raised - both carry tier FREE, but they
66
+ * are different conversations and get their own admin views.
67
+ */
68
+ entitlementReason?: EntitlementDecisionReason;
69
+ /**
70
+ * Who the reporter asked to be alerted, resolved against their entitlement
71
+ * at creation. `false` on the provider flag withholds the incident from the
72
+ * control room exactly as a Free tier does; `false` on the guardian flag
73
+ * keeps guardians out of the incident chat and its notifications. Absent on
74
+ * incidents raised before the options existed, which notified both.
75
+ */
76
+ notifyServiceProvider?: boolean;
77
+ notifyGuardians?: boolean;
78
+ /**
79
+ * What the reporter asked for before entitlement had its say. The
80
+ * "Marked Ignore" views read this rather than the outcome above: an alert
81
+ * billing withheld is not an alert somebody chose to withhold.
82
+ */
83
+ notifyServiceProviderRequested?: boolean;
60
84
  createdAt?: string;
61
85
  updatedAt?: string;
62
86
  category?: IncidentCategory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.1.193",
3
+ "version": "1.1.195",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",