clarion-shared-types 1.0.100 → 1.0.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/modules/alert-intake/enums/alert-intake.enum.js +54 -1
- package/dist/cjs/modules/alert-intake/enums/alert-intake.enum.js.map +1 -1
- package/dist/cjs/modules/alert-intake/index.js +1 -0
- package/dist/cjs/modules/alert-intake/index.js.map +1 -1
- package/dist/cjs/modules/alert-intake/interfaces/alert-intake-analytics.js +3 -0
- package/dist/cjs/modules/alert-intake/interfaces/alert-intake-analytics.js.map +1 -0
- package/dist/esm/modules/alert-intake/enums/alert-intake.enum.js +53 -0
- package/dist/esm/modules/alert-intake/enums/alert-intake.enum.js.map +1 -1
- package/dist/esm/modules/alert-intake/index.js +1 -0
- package/dist/esm/modules/alert-intake/index.js.map +1 -1
- package/dist/esm/modules/alert-intake/interfaces/alert-intake-analytics.js +2 -0
- package/dist/esm/modules/alert-intake/interfaces/alert-intake-analytics.js.map +1 -0
- package/dist/types/modules/alert-intake/enums/alert-intake.enum.d.ts +50 -1
- package/dist/types/modules/alert-intake/index.d.ts +1 -0
- package/dist/types/modules/alert-intake/interfaces/alert-intake-analytics.d.ts +254 -0
- package/dist/types/modules/alert-intake/interfaces/alert-intake.d.ts +89 -1
- package/dist/types/modules/incident/intefaces/incident.d.ts +7 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* app is sent to.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AlertIntakeMessageState = exports.AlertIntakeRejectionReason = exports.AlertIntakeWebhookVerification = exports.AlertIntakeRouteMatch = exports.AlertIntakeEmergencyPolicy = exports.AlertIntakeSecretSource = exports.AlertIntakeProvider = exports.AlertIntakeChannel = void 0;
|
|
10
|
+
exports.AlertIntakeScreeningDecision = exports.AlertIntakeScreeningStatus = exports.AlertIntakeScreeningSource = exports.AlertIntakeScreeningReason = exports.AlertIntakeMessageState = exports.AlertIntakeRejectionReason = exports.AlertIntakeWebhookVerification = exports.AlertIntakeRouteMatch = exports.AlertIntakeEmergencyPolicy = exports.AlertIntakeSecretSource = exports.AlertIntakeProvider = exports.AlertIntakeChannel = void 0;
|
|
11
11
|
/** The channel a message arrived on. */
|
|
12
12
|
var AlertIntakeChannel;
|
|
13
13
|
(function (AlertIntakeChannel) {
|
|
@@ -104,6 +104,7 @@ var AlertIntakeRejectionReason;
|
|
|
104
104
|
* PARKED failed and will not be retried on its own: it ran out of attempts, or it
|
|
105
105
|
* has a `rejectionReason` (no organization, organization inactive)
|
|
106
106
|
* DUPLICATE the same sender repeating themselves; not raised
|
|
107
|
+
* FILTERED screened out as not a report (a greeting, a link, an advert); held for review
|
|
107
108
|
*/
|
|
108
109
|
var AlertIntakeMessageState;
|
|
109
110
|
(function (AlertIntakeMessageState) {
|
|
@@ -112,5 +113,57 @@ var AlertIntakeMessageState;
|
|
|
112
113
|
AlertIntakeMessageState["RETRYING"] = "RETRYING";
|
|
113
114
|
AlertIntakeMessageState["PARKED"] = "PARKED";
|
|
114
115
|
AlertIntakeMessageState["DUPLICATE"] = "DUPLICATE";
|
|
116
|
+
AlertIntakeMessageState["FILTERED"] = "FILTERED";
|
|
115
117
|
})(AlertIntakeMessageState || (exports.AlertIntakeMessageState = AlertIntakeMessageState = {}));
|
|
118
|
+
/**
|
|
119
|
+
* Why a message was screened out instead of raised. Everything that arrives on a
|
|
120
|
+
* connection is kept: a screened message waits for a person to raise it or dismiss it.
|
|
121
|
+
*
|
|
122
|
+
* EMPTY nothing to read: no text, no file, no location
|
|
123
|
+
* SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
|
|
124
|
+
* UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
|
|
125
|
+
* GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
|
|
126
|
+
* LINK_ONLY a link and nothing else (a forwarded post or video)
|
|
127
|
+
* SPAM an advert, a promotion, a chain message, a scam
|
|
128
|
+
* OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
|
|
129
|
+
* TEST someone testing the number
|
|
130
|
+
*/
|
|
131
|
+
var AlertIntakeScreeningReason;
|
|
132
|
+
(function (AlertIntakeScreeningReason) {
|
|
133
|
+
AlertIntakeScreeningReason["EMPTY"] = "EMPTY";
|
|
134
|
+
AlertIntakeScreeningReason["SYSTEM_EVENT"] = "SYSTEM_EVENT";
|
|
135
|
+
AlertIntakeScreeningReason["UNSUPPORTED_CONTENT"] = "UNSUPPORTED_CONTENT";
|
|
136
|
+
AlertIntakeScreeningReason["GREETING"] = "GREETING";
|
|
137
|
+
AlertIntakeScreeningReason["LINK_ONLY"] = "LINK_ONLY";
|
|
138
|
+
AlertIntakeScreeningReason["SPAM"] = "SPAM";
|
|
139
|
+
AlertIntakeScreeningReason["OFF_TOPIC"] = "OFF_TOPIC";
|
|
140
|
+
AlertIntakeScreeningReason["TEST"] = "TEST";
|
|
141
|
+
})(AlertIntakeScreeningReason || (exports.AlertIntakeScreeningReason = AlertIntakeScreeningReason = {}));
|
|
142
|
+
/** What decided a message was not a report: a fixed rule, or the AI screening model. */
|
|
143
|
+
var AlertIntakeScreeningSource;
|
|
144
|
+
(function (AlertIntakeScreeningSource) {
|
|
145
|
+
AlertIntakeScreeningSource["RULE"] = "RULE";
|
|
146
|
+
AlertIntakeScreeningSource["AI"] = "AI";
|
|
147
|
+
})(AlertIntakeScreeningSource || (exports.AlertIntakeScreeningSource = AlertIntakeScreeningSource = {}));
|
|
148
|
+
/**
|
|
149
|
+
* A screened message, from a reviewer's side.
|
|
150
|
+
*
|
|
151
|
+
* PENDING_REVIEW screened out; nobody has looked at it yet
|
|
152
|
+
* ELEVATED a person decided it IS a report: it was raised as an incident
|
|
153
|
+
* DISMISSED a person confirmed it is not a report
|
|
154
|
+
*/
|
|
155
|
+
var AlertIntakeScreeningStatus;
|
|
156
|
+
(function (AlertIntakeScreeningStatus) {
|
|
157
|
+
AlertIntakeScreeningStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
|
|
158
|
+
AlertIntakeScreeningStatus["ELEVATED"] = "ELEVATED";
|
|
159
|
+
AlertIntakeScreeningStatus["DISMISSED"] = "DISMISSED";
|
|
160
|
+
})(AlertIntakeScreeningStatus || (exports.AlertIntakeScreeningStatus = AlertIntakeScreeningStatus = {}));
|
|
161
|
+
/** A reviewer's decision on screened messages. */
|
|
162
|
+
var AlertIntakeScreeningDecision;
|
|
163
|
+
(function (AlertIntakeScreeningDecision) {
|
|
164
|
+
/** Raise it as an incident (or a grievance, for a grievance desk) after all. */
|
|
165
|
+
AlertIntakeScreeningDecision["ELEVATE"] = "ELEVATE";
|
|
166
|
+
/** Confirm it is not a report. */
|
|
167
|
+
AlertIntakeScreeningDecision["DISMISS"] = "DISMISS";
|
|
168
|
+
})(AlertIntakeScreeningDecision || (exports.AlertIntakeScreeningDecision = AlertIntakeScreeningDecision = {}));
|
|
116
169
|
//# sourceMappingURL=alert-intake.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wCAAwC;AACxC,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,mCAAnB,mBAAmB,QAa9B;AAED;;;;;;;;;;GAUG;AACH,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,gEAAqC,CAAA;AACzC,CAAC,EAHW,uBAAuB,uCAAvB,uBAAuB,QAGlC;AAED;;;;GAIG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,mEAAqC,CAAA;IACrC,2EAA6C,CAAA;AACjD,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAED,qEAAqE;AACrE,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,oFAAoF;IACpF,4CAAmB,CAAA;IACnB,qEAAqE;IACrE,4CAAmB,CAAA;AACvB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,gEAAgE;AAChE,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACtC,8EAA8E;IAC9E,2DAAyB,CAAA;IACzB,gFAAgF;IAChF,+EAA6C,CAAA;IAC7C,mFAAmF;IACnF,mEAAiC,CAAA;AACrC,CAAC,EAPW,8BAA8B,8CAA9B,8BAA8B,QAOzC;AAED,yFAAyF;AACzF,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IAClC,uEAAyC,CAAA;IACzC,yEAA2C,CAAA;IAC3C,yEAA2C,CAAA;IAC3C,iEAAmC,CAAA;IACnC,6EAA+C,CAAA;IAC/C,2DAA6B,CAAA;AACjC,CAAC,EAPW,0BAA0B,0CAA1B,0BAA0B,QAOrC;AAED
|
|
1
|
+
{"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wCAAwC;AACxC,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAA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1B,0BAA0B,QAOrC;AAED;;;;;;;;;;;GAWG;AACH,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IAC/B,4CAAiB,CAAA;IACjB,4CAAiB,CAAA;IACjB,gDAAqB,CAAA;IACrB,4CAAiB,CAAA;IACjB,kDAAuB,CAAA;IACvB,gDAAqB,CAAA;AACzB,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAED;;;;;;;;;;;;GAYG;AACH,IAAY,0BASX;AATD,WAAY,0BAA0B;IAClC,6CAAe,CAAA;IACf,2DAA6B,CAAA;IAC7B,yEAA2C,CAAA;IAC3C,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;IACvB,2CAAa,CAAA;IACb,qDAAuB,CAAA;IACvB,2CAAa,CAAA;AACjB,CAAC,EATW,0BAA0B,0CAA1B,0BAA0B,QASrC;AAED,wFAAwF;AACxF,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,uCAAS,CAAA;AACb,CAAC,EAHW,0BAA0B,0CAA1B,0BAA0B,QAGrC;AAED;;;;;;GAMG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,+DAAiC,CAAA;IACjC,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;AAC3B,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAED,kDAAkD;AAClD,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACpC,gFAAgF;IAChF,mDAAmB,CAAA;IACnB,kCAAkC;IAClC,mDAAmB,CAAA;AACvB,CAAC,EALW,4BAA4B,4CAA5B,4BAA4B,QAKvC"}
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
__exportStar(require("./enums/alert-intake.enum"), exports);
|
|
19
19
|
// Response shapes + plain request interfaces
|
|
20
20
|
__exportStar(require("./interfaces/alert-intake"), exports);
|
|
21
|
+
__exportStar(require("./interfaces/alert-intake-analytics"), exports);
|
|
21
22
|
// Utilities
|
|
22
23
|
__exportStar(require("./utils/alert-intake.util"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-intake/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,4DAA0C;AAE1C,6CAA6C;AAC7C,4DAA0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-intake/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,4DAA0C;AAE1C,6CAA6C;AAC7C,4DAA0C;AAC1C,sEAAoD;AAEpD,YAAY;AACZ,4DAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/interfaces/alert-intake-analytics.ts"],"names":[],"mappings":""}
|
|
@@ -101,6 +101,7 @@ export var AlertIntakeRejectionReason;
|
|
|
101
101
|
* PARKED failed and will not be retried on its own: it ran out of attempts, or it
|
|
102
102
|
* has a `rejectionReason` (no organization, organization inactive)
|
|
103
103
|
* DUPLICATE the same sender repeating themselves; not raised
|
|
104
|
+
* FILTERED screened out as not a report (a greeting, a link, an advert); held for review
|
|
104
105
|
*/
|
|
105
106
|
export var AlertIntakeMessageState;
|
|
106
107
|
(function (AlertIntakeMessageState) {
|
|
@@ -109,5 +110,57 @@ export var AlertIntakeMessageState;
|
|
|
109
110
|
AlertIntakeMessageState["RETRYING"] = "RETRYING";
|
|
110
111
|
AlertIntakeMessageState["PARKED"] = "PARKED";
|
|
111
112
|
AlertIntakeMessageState["DUPLICATE"] = "DUPLICATE";
|
|
113
|
+
AlertIntakeMessageState["FILTERED"] = "FILTERED";
|
|
112
114
|
})(AlertIntakeMessageState || (AlertIntakeMessageState = {}));
|
|
115
|
+
/**
|
|
116
|
+
* Why a message was screened out instead of raised. Everything that arrives on a
|
|
117
|
+
* connection is kept: a screened message waits for a person to raise it or dismiss it.
|
|
118
|
+
*
|
|
119
|
+
* EMPTY nothing to read: no text, no file, no location
|
|
120
|
+
* SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
|
|
121
|
+
* UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
|
|
122
|
+
* GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
|
|
123
|
+
* LINK_ONLY a link and nothing else (a forwarded post or video)
|
|
124
|
+
* SPAM an advert, a promotion, a chain message, a scam
|
|
125
|
+
* OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
|
|
126
|
+
* TEST someone testing the number
|
|
127
|
+
*/
|
|
128
|
+
export var AlertIntakeScreeningReason;
|
|
129
|
+
(function (AlertIntakeScreeningReason) {
|
|
130
|
+
AlertIntakeScreeningReason["EMPTY"] = "EMPTY";
|
|
131
|
+
AlertIntakeScreeningReason["SYSTEM_EVENT"] = "SYSTEM_EVENT";
|
|
132
|
+
AlertIntakeScreeningReason["UNSUPPORTED_CONTENT"] = "UNSUPPORTED_CONTENT";
|
|
133
|
+
AlertIntakeScreeningReason["GREETING"] = "GREETING";
|
|
134
|
+
AlertIntakeScreeningReason["LINK_ONLY"] = "LINK_ONLY";
|
|
135
|
+
AlertIntakeScreeningReason["SPAM"] = "SPAM";
|
|
136
|
+
AlertIntakeScreeningReason["OFF_TOPIC"] = "OFF_TOPIC";
|
|
137
|
+
AlertIntakeScreeningReason["TEST"] = "TEST";
|
|
138
|
+
})(AlertIntakeScreeningReason || (AlertIntakeScreeningReason = {}));
|
|
139
|
+
/** What decided a message was not a report: a fixed rule, or the AI screening model. */
|
|
140
|
+
export var AlertIntakeScreeningSource;
|
|
141
|
+
(function (AlertIntakeScreeningSource) {
|
|
142
|
+
AlertIntakeScreeningSource["RULE"] = "RULE";
|
|
143
|
+
AlertIntakeScreeningSource["AI"] = "AI";
|
|
144
|
+
})(AlertIntakeScreeningSource || (AlertIntakeScreeningSource = {}));
|
|
145
|
+
/**
|
|
146
|
+
* A screened message, from a reviewer's side.
|
|
147
|
+
*
|
|
148
|
+
* PENDING_REVIEW screened out; nobody has looked at it yet
|
|
149
|
+
* ELEVATED a person decided it IS a report: it was raised as an incident
|
|
150
|
+
* DISMISSED a person confirmed it is not a report
|
|
151
|
+
*/
|
|
152
|
+
export var AlertIntakeScreeningStatus;
|
|
153
|
+
(function (AlertIntakeScreeningStatus) {
|
|
154
|
+
AlertIntakeScreeningStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
|
|
155
|
+
AlertIntakeScreeningStatus["ELEVATED"] = "ELEVATED";
|
|
156
|
+
AlertIntakeScreeningStatus["DISMISSED"] = "DISMISSED";
|
|
157
|
+
})(AlertIntakeScreeningStatus || (AlertIntakeScreeningStatus = {}));
|
|
158
|
+
/** A reviewer's decision on screened messages. */
|
|
159
|
+
export var AlertIntakeScreeningDecision;
|
|
160
|
+
(function (AlertIntakeScreeningDecision) {
|
|
161
|
+
/** Raise it as an incident (or a grievance, for a grievance desk) after all. */
|
|
162
|
+
AlertIntakeScreeningDecision["ELEVATE"] = "ELEVATE";
|
|
163
|
+
/** Confirm it is not a report. */
|
|
164
|
+
AlertIntakeScreeningDecision["DISMISS"] = "DISMISS";
|
|
165
|
+
})(AlertIntakeScreeningDecision || (AlertIntakeScreeningDecision = {}));
|
|
113
166
|
//# sourceMappingURL=alert-intake.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,MAA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C,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAED
|
|
1
|
+
{"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,gEAAqC,CAAA;AACzC,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,mEAAqC,CAAA;IACrC,2EAA6C,CAAA;AACjD,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,qEAAqE;AACrE,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,oFAAoF;IACpF,4CAAmB,CAAA;IACnB,qEAAqE;IACrE,4CAAmB,CAAA;AACvB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,8BA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,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,kDAAkD;AAClD,MAAM,CAAN,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACpC,gFAAgF;IAChF,mDAAmB,CAAA;IACnB,kCAAkC;IAClC,mDAAmB,CAAA;AACvB,CAAC,EALW,4BAA4B,KAA5B,4BAA4B,QAKvC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from './enums/alert-intake.enum';
|
|
3
3
|
// Response shapes + plain request interfaces
|
|
4
4
|
export * from './interfaces/alert-intake';
|
|
5
|
+
export * from './interfaces/alert-intake-analytics';
|
|
5
6
|
// Utilities
|
|
6
7
|
export * from './utils/alert-intake.util';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-intake/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAE1C,6CAA6C;AAC7C,cAAc,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-intake/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAE1C,6CAA6C;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AAEpD,YAAY;AACZ,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/interfaces/alert-intake-analytics.ts"],"names":[],"mappings":""}
|
|
@@ -91,11 +91,60 @@ export declare enum AlertIntakeRejectionReason {
|
|
|
91
91
|
* PARKED failed and will not be retried on its own: it ran out of attempts, or it
|
|
92
92
|
* has a `rejectionReason` (no organization, organization inactive)
|
|
93
93
|
* DUPLICATE the same sender repeating themselves; not raised
|
|
94
|
+
* FILTERED screened out as not a report (a greeting, a link, an advert); held for review
|
|
94
95
|
*/
|
|
95
96
|
export declare enum AlertIntakeMessageState {
|
|
96
97
|
QUEUED = "QUEUED",
|
|
97
98
|
RAISED = "RAISED",
|
|
98
99
|
RETRYING = "RETRYING",
|
|
99
100
|
PARKED = "PARKED",
|
|
100
|
-
DUPLICATE = "DUPLICATE"
|
|
101
|
+
DUPLICATE = "DUPLICATE",
|
|
102
|
+
FILTERED = "FILTERED"
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Why a message was screened out instead of raised. Everything that arrives on a
|
|
106
|
+
* connection is kept: a screened message waits for a person to raise it or dismiss it.
|
|
107
|
+
*
|
|
108
|
+
* EMPTY nothing to read: no text, no file, no location
|
|
109
|
+
* SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
|
|
110
|
+
* UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
|
|
111
|
+
* GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
|
|
112
|
+
* LINK_ONLY a link and nothing else (a forwarded post or video)
|
|
113
|
+
* SPAM an advert, a promotion, a chain message, a scam
|
|
114
|
+
* OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
|
|
115
|
+
* TEST someone testing the number
|
|
116
|
+
*/
|
|
117
|
+
export declare enum AlertIntakeScreeningReason {
|
|
118
|
+
EMPTY = "EMPTY",
|
|
119
|
+
SYSTEM_EVENT = "SYSTEM_EVENT",
|
|
120
|
+
UNSUPPORTED_CONTENT = "UNSUPPORTED_CONTENT",
|
|
121
|
+
GREETING = "GREETING",
|
|
122
|
+
LINK_ONLY = "LINK_ONLY",
|
|
123
|
+
SPAM = "SPAM",
|
|
124
|
+
OFF_TOPIC = "OFF_TOPIC",
|
|
125
|
+
TEST = "TEST"
|
|
126
|
+
}
|
|
127
|
+
/** What decided a message was not a report: a fixed rule, or the AI screening model. */
|
|
128
|
+
export declare enum AlertIntakeScreeningSource {
|
|
129
|
+
RULE = "RULE",
|
|
130
|
+
AI = "AI"
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A screened message, from a reviewer's side.
|
|
134
|
+
*
|
|
135
|
+
* PENDING_REVIEW screened out; nobody has looked at it yet
|
|
136
|
+
* ELEVATED a person decided it IS a report: it was raised as an incident
|
|
137
|
+
* DISMISSED a person confirmed it is not a report
|
|
138
|
+
*/
|
|
139
|
+
export declare enum AlertIntakeScreeningStatus {
|
|
140
|
+
PENDING_REVIEW = "PENDING_REVIEW",
|
|
141
|
+
ELEVATED = "ELEVATED",
|
|
142
|
+
DISMISSED = "DISMISSED"
|
|
143
|
+
}
|
|
144
|
+
/** A reviewer's decision on screened messages. */
|
|
145
|
+
export declare enum AlertIntakeScreeningDecision {
|
|
146
|
+
/** Raise it as an incident (or a grievance, for a grievance desk) after all. */
|
|
147
|
+
ELEVATE = "ELEVATE",
|
|
148
|
+
/** Confirm it is not a report. */
|
|
149
|
+
DISMISS = "DISMISS"
|
|
101
150
|
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { AlertIntakeChannel, AlertIntakeMessageState, AlertIntakeScreeningReason, AlertIntakeScreeningSource, AlertIntakeScreeningStatus } from '../enums/alert-intake.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Alert intake analytics: what arrived on an organization's channels over a period, what
|
|
4
|
+
* became of it, what the AI made of it and what that cost. One read, computed by
|
|
5
|
+
* clarion-alerts from one consistent snapshot, so every number on a dashboard agrees with
|
|
6
|
+
* every other.
|
|
7
|
+
*
|
|
8
|
+
* Counts only: no message text, sender or credential is ever part of it.
|
|
9
|
+
*/
|
|
10
|
+
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
11
|
+
export type AlertIntakeAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
12
|
+
/** The AI tasks whose calls are metered. */
|
|
13
|
+
export type AlertIntakeAiTask = 'triage' | 'analysis' | 'transcription';
|
|
14
|
+
export interface AlertIntakeAnalyticsRange {
|
|
15
|
+
/** Inclusive, ISO 8601. The first message received when the period asked for was "forever". */
|
|
16
|
+
from: string;
|
|
17
|
+
/** Exclusive, ISO 8601. */
|
|
18
|
+
to: string;
|
|
19
|
+
bucket: AlertIntakeAnalyticsBucket;
|
|
20
|
+
/** IANA time zone the buckets and the hour-of-week grid are cut in. */
|
|
21
|
+
timeZone: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The headline counts. Messages are counted by when they arrived.
|
|
25
|
+
*
|
|
26
|
+
* received = raised + screenedOut + duplicates + retrying + parked + queued: every message
|
|
27
|
+
* is in exactly one of those, as it stands now.
|
|
28
|
+
*/
|
|
29
|
+
export interface AlertIntakeAnalyticsTotals {
|
|
30
|
+
received: number;
|
|
31
|
+
/** Became incidents (grievances, for a grievance desk) - including screened messages a reviewer raised. */
|
|
32
|
+
raised: number;
|
|
33
|
+
/** Screened out as not a report and not raised since (waiting for review, or dismissed). */
|
|
34
|
+
screenedOut: number;
|
|
35
|
+
duplicates: number;
|
|
36
|
+
retrying: number;
|
|
37
|
+
parked: number;
|
|
38
|
+
/** Waiting for, or being worked on by, the pipeline. */
|
|
39
|
+
queued: number;
|
|
40
|
+
/** Distinct phone numbers, WhatsApp numbers and email addresses. Never the values themselves. */
|
|
41
|
+
uniqueSenders: number;
|
|
42
|
+
withAttachments: number;
|
|
43
|
+
sharedLocations: number;
|
|
44
|
+
/** Written in a language other than English, and translated. */
|
|
45
|
+
translated: number;
|
|
46
|
+
voiceNotes: number;
|
|
47
|
+
emergencies: number;
|
|
48
|
+
sensitive: number;
|
|
49
|
+
anonymous: number;
|
|
50
|
+
acknowledged: number;
|
|
51
|
+
acknowledgementFailed: number;
|
|
52
|
+
/** Median seconds from arrival to the incident being raised; null when nothing was raised. */
|
|
53
|
+
medianSecondsToIncident: number | null;
|
|
54
|
+
p90SecondsToIncident: number | null;
|
|
55
|
+
/** AI spend in the period, US dollars. */
|
|
56
|
+
aiCostUsd: number;
|
|
57
|
+
}
|
|
58
|
+
/** The previous period of the same length, for the change shown on each headline figure. Null for "forever". */
|
|
59
|
+
export interface AlertIntakeAnalyticsComparison {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
received: number;
|
|
63
|
+
raised: number;
|
|
64
|
+
screenedOut: number;
|
|
65
|
+
uniqueSenders: number;
|
|
66
|
+
medianSecondsToIncident: number | null;
|
|
67
|
+
aiCostUsd: number;
|
|
68
|
+
}
|
|
69
|
+
/** One point on the message timeline. `bucket` is the start of the point, local to `timeZone`, ISO 8601 without an offset. */
|
|
70
|
+
export interface AlertIntakeAnalyticsTimelinePoint {
|
|
71
|
+
bucket: string;
|
|
72
|
+
received: number;
|
|
73
|
+
raised: number;
|
|
74
|
+
screenedOut: number;
|
|
75
|
+
duplicates: number;
|
|
76
|
+
failed: number;
|
|
77
|
+
}
|
|
78
|
+
/** Where messages stand now; the parts add up to `received`. `failed` is retrying and parked together. */
|
|
79
|
+
export interface AlertIntakeAnalyticsOutcomes {
|
|
80
|
+
received: number;
|
|
81
|
+
raised: number;
|
|
82
|
+
screenedOut: number;
|
|
83
|
+
duplicates: number;
|
|
84
|
+
failed: number;
|
|
85
|
+
queued: number;
|
|
86
|
+
}
|
|
87
|
+
export interface AlertIntakeAnalyticsChannelRow extends AlertIntakeAnalyticsOutcomes {
|
|
88
|
+
channel: AlertIntakeChannel;
|
|
89
|
+
medianSecondsToIncident: number | null;
|
|
90
|
+
}
|
|
91
|
+
export interface AlertIntakeAnalyticsConnectionRow extends AlertIntakeAnalyticsOutcomes {
|
|
92
|
+
/** Null for messages received before connections existed. */
|
|
93
|
+
connectionId: string | null;
|
|
94
|
+
name: string;
|
|
95
|
+
channel: AlertIntakeChannel | null;
|
|
96
|
+
provider: string | null;
|
|
97
|
+
enabled: boolean | null;
|
|
98
|
+
lastReceivedAt: string | null;
|
|
99
|
+
/** The connection's current error, if it is failing. */
|
|
100
|
+
lastError: string | null;
|
|
101
|
+
}
|
|
102
|
+
export interface AlertIntakeAnalyticsCount<K extends string | number | null = string> {
|
|
103
|
+
key: K;
|
|
104
|
+
count: number;
|
|
105
|
+
}
|
|
106
|
+
/** Every screening decision on messages received in the period - including those a reviewer later raised. */
|
|
107
|
+
export interface AlertIntakeAnalyticsScreening {
|
|
108
|
+
byReason: AlertIntakeAnalyticsCount<AlertIntakeScreeningReason>[];
|
|
109
|
+
byDecider: AlertIntakeAnalyticsCount<AlertIntakeScreeningSource>[];
|
|
110
|
+
byStatus: AlertIntakeAnalyticsCount<AlertIntakeScreeningStatus>[];
|
|
111
|
+
/** Mean confidence of the model's screening decisions (0-1); null without any. */
|
|
112
|
+
averageAiConfidence: number | null;
|
|
113
|
+
/** Median hours from being screened out to a person's decision; null without reviews. */
|
|
114
|
+
medianHoursToReview: number | null;
|
|
115
|
+
/** Screened messages still waiting for a person - now, whatever the period. */
|
|
116
|
+
awaitingReview: number;
|
|
117
|
+
}
|
|
118
|
+
export interface AlertIntakeAnalyticsLanguageRow {
|
|
119
|
+
/** ISO 639-1, or `und` when it could not be told. */
|
|
120
|
+
language: string;
|
|
121
|
+
count: number;
|
|
122
|
+
translated: number;
|
|
123
|
+
}
|
|
124
|
+
export interface AlertIntakeAnalyticsCategoryRow {
|
|
125
|
+
categoryId: number | null;
|
|
126
|
+
/** The organization's category name; "Uncategorised" for reports filed without one. */
|
|
127
|
+
name: string;
|
|
128
|
+
count: number;
|
|
129
|
+
}
|
|
130
|
+
export interface AlertIntakeAnalyticsLocations {
|
|
131
|
+
/** Reports placed on the map, by how: the sender's shared pin, or a place named in the message. */
|
|
132
|
+
shared: number;
|
|
133
|
+
geocoded: number;
|
|
134
|
+
unresolved: number;
|
|
135
|
+
byCountry: AlertIntakeAnalyticsCount[];
|
|
136
|
+
}
|
|
137
|
+
export interface AlertIntakeAnalyticsAttachments {
|
|
138
|
+
files: number;
|
|
139
|
+
attached: number;
|
|
140
|
+
failed: number;
|
|
141
|
+
/** `image`, `audio`, `video`, `document`. */
|
|
142
|
+
byKind: Array<{
|
|
143
|
+
kind: string;
|
|
144
|
+
files: number;
|
|
145
|
+
attached: number;
|
|
146
|
+
failed: number;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
/** Arrivals by weekday (1 = Monday ... 7 = Sunday) and hour (0-23), in `timeZone`. All 168 cells, zeros included. */
|
|
150
|
+
export interface AlertIntakeAnalyticsHeatCell {
|
|
151
|
+
weekday: number;
|
|
152
|
+
hour: number;
|
|
153
|
+
count: number;
|
|
154
|
+
}
|
|
155
|
+
export interface AlertIntakeAiTaskRow {
|
|
156
|
+
task: AlertIntakeAiTask;
|
|
157
|
+
calls: number;
|
|
158
|
+
failed: number;
|
|
159
|
+
cached: number;
|
|
160
|
+
inputTokens: number;
|
|
161
|
+
cachedInputTokens: number;
|
|
162
|
+
outputTokens: number;
|
|
163
|
+
reasoningTokens: number;
|
|
164
|
+
audioSeconds: number;
|
|
165
|
+
costUsd: number;
|
|
166
|
+
averageLatencyMs: number | null;
|
|
167
|
+
p90LatencyMs: number | null;
|
|
168
|
+
}
|
|
169
|
+
export interface AlertIntakeAiModelRow {
|
|
170
|
+
model: string;
|
|
171
|
+
task: AlertIntakeAiTask;
|
|
172
|
+
calls: number;
|
|
173
|
+
inputTokens: number;
|
|
174
|
+
outputTokens: number;
|
|
175
|
+
costUsd: number;
|
|
176
|
+
/** Calls whose model had no price in the service's price table: their cost is not in `costUsd`. */
|
|
177
|
+
unpricedCalls: number;
|
|
178
|
+
}
|
|
179
|
+
export interface AlertIntakeAiTimelinePoint {
|
|
180
|
+
bucket: string;
|
|
181
|
+
calls: number;
|
|
182
|
+
inputTokens: number;
|
|
183
|
+
outputTokens: number;
|
|
184
|
+
costUsd: number;
|
|
185
|
+
}
|
|
186
|
+
export interface AlertIntakeAnalyticsAi {
|
|
187
|
+
calls: number;
|
|
188
|
+
failed: number;
|
|
189
|
+
cached: number;
|
|
190
|
+
inputTokens: number;
|
|
191
|
+
cachedInputTokens: number;
|
|
192
|
+
outputTokens: number;
|
|
193
|
+
reasoningTokens: number;
|
|
194
|
+
audioSeconds: number;
|
|
195
|
+
costUsd: number;
|
|
196
|
+
/** AI spend divided by messages received / incidents raised in the period; null when there were none. */
|
|
197
|
+
costPerMessageUsd: number | null;
|
|
198
|
+
costPerIncidentUsd: number | null;
|
|
199
|
+
byTask: AlertIntakeAiTaskRow[];
|
|
200
|
+
byModel: AlertIntakeAiModelRow[];
|
|
201
|
+
timeline: AlertIntakeAiTimelinePoint[];
|
|
202
|
+
/** When the prices used were last reviewed (the service's price table), ISO date. */
|
|
203
|
+
pricesAsOf: string;
|
|
204
|
+
}
|
|
205
|
+
/** Platform view only: one row per organization. */
|
|
206
|
+
export interface AlertIntakeAnalyticsOrganizationRow {
|
|
207
|
+
organizationId: number | null;
|
|
208
|
+
name: string;
|
|
209
|
+
received: number;
|
|
210
|
+
raised: number;
|
|
211
|
+
screenedOut: number;
|
|
212
|
+
aiCostUsd: number;
|
|
213
|
+
}
|
|
214
|
+
export interface AlertIntakeAnalytics {
|
|
215
|
+
/** Null for the platform view across every organization. */
|
|
216
|
+
organizationId: number | null;
|
|
217
|
+
range: AlertIntakeAnalyticsRange;
|
|
218
|
+
generatedAt: string;
|
|
219
|
+
totals: AlertIntakeAnalyticsTotals;
|
|
220
|
+
previous: AlertIntakeAnalyticsComparison | null;
|
|
221
|
+
timeline: AlertIntakeAnalyticsTimelinePoint[];
|
|
222
|
+
byState: AlertIntakeAnalyticsCount<AlertIntakeMessageState>[];
|
|
223
|
+
/** Every channel, zeros included. */
|
|
224
|
+
byChannel: AlertIntakeAnalyticsChannelRow[];
|
|
225
|
+
/**
|
|
226
|
+
* The organization's own connections - including those that received nothing - and any
|
|
227
|
+
* platform connection that carried its messages (without that connection's status).
|
|
228
|
+
*/
|
|
229
|
+
byConnection: AlertIntakeAnalyticsConnectionRow[];
|
|
230
|
+
screening: AlertIntakeAnalyticsScreening;
|
|
231
|
+
languages: AlertIntakeAnalyticsLanguageRow[];
|
|
232
|
+
categories: AlertIntakeAnalyticsCategoryRow[];
|
|
233
|
+
/** Low, Medium, High, Critical. */
|
|
234
|
+
priorities: AlertIntakeAnalyticsCount[];
|
|
235
|
+
locations: AlertIntakeAnalyticsLocations;
|
|
236
|
+
attachments: AlertIntakeAnalyticsAttachments;
|
|
237
|
+
heatmap: AlertIntakeAnalyticsHeatCell[];
|
|
238
|
+
ai: AlertIntakeAnalyticsAi;
|
|
239
|
+
/** Platform view only. */
|
|
240
|
+
byOrganization?: AlertIntakeAnalyticsOrganizationRow[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The period an analytics read covers (query string). Both ends optional: no `from` is
|
|
244
|
+
* "forever", no `to` is now. ISO 8601 instants; `timeZone` is an IANA name.
|
|
245
|
+
*/
|
|
246
|
+
export interface AlertIntakeAnalyticsQuery {
|
|
247
|
+
from?: string;
|
|
248
|
+
to?: string;
|
|
249
|
+
timeZone?: string;
|
|
250
|
+
}
|
|
251
|
+
/** Platform operators: every organization's analytics, or one organization's. */
|
|
252
|
+
export interface PlatformAlertIntakeAnalyticsQuery extends AlertIntakeAnalyticsQuery {
|
|
253
|
+
organizationId?: number;
|
|
254
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CountryCode } from '../../country/enums/country-code.enum';
|
|
2
|
-
import { AlertIntakeChannel, AlertIntakeEmergencyPolicy, AlertIntakeMessageState, AlertIntakeProvider, AlertIntakeRejectionReason, AlertIntakeRouteMatch, AlertIntakeSecretSource, AlertIntakeWebhookVerification } from '../enums/alert-intake.enum';
|
|
2
|
+
import { AlertIntakeChannel, AlertIntakeEmergencyPolicy, AlertIntakeMessageState, AlertIntakeProvider, AlertIntakeRejectionReason, AlertIntakeRouteMatch, AlertIntakeScreeningDecision, AlertIntakeScreeningReason, AlertIntakeScreeningSource, AlertIntakeScreeningStatus, AlertIntakeSecretSource, AlertIntakeWebhookVerification } from '../enums/alert-intake.enum';
|
|
3
3
|
/**
|
|
4
4
|
* Alert intake settings.
|
|
5
5
|
*
|
|
@@ -160,6 +160,10 @@ export interface AlertIntakeActivitySummary {
|
|
|
160
160
|
parked: number;
|
|
161
161
|
/** Enabled connections whose last attempt failed (a rejected call, a mailbox that could not be read). */
|
|
162
162
|
failingConnections: number;
|
|
163
|
+
/** Screened out as not a report, in the window. */
|
|
164
|
+
screened?: number;
|
|
165
|
+
/** Screened messages nobody has reviewed yet (as of now). */
|
|
166
|
+
awaitingReview?: number;
|
|
163
167
|
}
|
|
164
168
|
/** What is kept of a file that came with a message. Never its contents. */
|
|
165
169
|
export interface AlertIntakeMessageAttachment {
|
|
@@ -191,6 +195,8 @@ export interface AlertIntakeMessage {
|
|
|
191
195
|
routeKeyword: string | null;
|
|
192
196
|
state: AlertIntakeMessageState;
|
|
193
197
|
rejectionReason: AlertIntakeRejectionReason | null;
|
|
198
|
+
/** Why it was screened out, for FILTERED (and for one raised after review). */
|
|
199
|
+
screeningReason?: AlertIntakeScreeningReason | null;
|
|
194
200
|
/** The last error, for RETRYING and PARKED. */
|
|
195
201
|
error: string | null;
|
|
196
202
|
attempts: number;
|
|
@@ -226,6 +232,67 @@ export interface AlertIntakeMessagePage {
|
|
|
226
232
|
page: number;
|
|
227
233
|
limit: number;
|
|
228
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* A message screened out as not a report, waiting for (or after) a person's review.
|
|
237
|
+
* Kept in its own table: the review queue. Raising one ("elevate") sends it through the
|
|
238
|
+
* pipeline without the screening step, and links the incident it becomes.
|
|
239
|
+
*/
|
|
240
|
+
export interface AlertIntakeScreenedMessage {
|
|
241
|
+
id: string;
|
|
242
|
+
/** The stored message (see the messages API). */
|
|
243
|
+
messageId: string;
|
|
244
|
+
organizationId: number;
|
|
245
|
+
connectionId: string | null;
|
|
246
|
+
connectionName: string | null;
|
|
247
|
+
channel: AlertIntakeChannel;
|
|
248
|
+
sender: string | null;
|
|
249
|
+
senderName: string | null;
|
|
250
|
+
subject: string | null;
|
|
251
|
+
preview: string;
|
|
252
|
+
/** ISO 639-1 code of the language it was written in, when known. */
|
|
253
|
+
language: string | null;
|
|
254
|
+
/** English translation, when it was written in another language. */
|
|
255
|
+
translation: string | null;
|
|
256
|
+
reason: AlertIntakeScreeningReason;
|
|
257
|
+
/** One sentence, for the reviewer: why it was screened out. */
|
|
258
|
+
explanation: string;
|
|
259
|
+
decidedBy: AlertIntakeScreeningSource;
|
|
260
|
+
/** The screening model's confidence (0-1). Null for a rule. */
|
|
261
|
+
confidence: number | null;
|
|
262
|
+
status: AlertIntakeScreeningStatus;
|
|
263
|
+
reviewedBy: number | null;
|
|
264
|
+
reviewedAt: string | null;
|
|
265
|
+
reviewNote: string | null;
|
|
266
|
+
/** The incident it became, once elevated and raised. */
|
|
267
|
+
incidentId: number | null;
|
|
268
|
+
attachmentCount: number;
|
|
269
|
+
receivedAt: string;
|
|
270
|
+
screenedAt: string;
|
|
271
|
+
/** What the CALLER may do with it now. */
|
|
272
|
+
actions: {
|
|
273
|
+
elevate: boolean;
|
|
274
|
+
dismiss: boolean;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
export interface AlertIntakeScreenedMessageDetail extends AlertIntakeScreenedMessage {
|
|
278
|
+
/** Exactly as received. */
|
|
279
|
+
content: string;
|
|
280
|
+
attachments: AlertIntakeMessageAttachment[];
|
|
281
|
+
}
|
|
282
|
+
export interface AlertIntakeScreenedMessagePage {
|
|
283
|
+
items: AlertIntakeScreenedMessage[];
|
|
284
|
+
total: number;
|
|
285
|
+
page: number;
|
|
286
|
+
limit: number;
|
|
287
|
+
}
|
|
288
|
+
/** The outcome of a review: which messages changed, and why the others did not. */
|
|
289
|
+
export interface AlertIntakeScreeningReviewResult {
|
|
290
|
+
updated: string[];
|
|
291
|
+
skipped: Array<{
|
|
292
|
+
id: string;
|
|
293
|
+
reason: string;
|
|
294
|
+
}>;
|
|
295
|
+
}
|
|
229
296
|
export interface AlertIntakeConnectionTestResult {
|
|
230
297
|
success: boolean;
|
|
231
298
|
/** Operator-facing. Never contains a credential. */
|
|
@@ -298,3 +365,24 @@ export interface ListPlatformAlertIntakeMessagesQuery extends ListAlertIntakeMes
|
|
|
298
365
|
export interface AssignAlertIntakeMessage {
|
|
299
366
|
organizationId: number;
|
|
300
367
|
}
|
|
368
|
+
/** Filters for an organization's screened messages (the review queue). `limit` is at most 100. */
|
|
369
|
+
export interface ListAlertIntakeScreenedMessagesQuery {
|
|
370
|
+
/** Omit for every status. */
|
|
371
|
+
status?: AlertIntakeScreeningStatus;
|
|
372
|
+
reason?: AlertIntakeScreeningReason;
|
|
373
|
+
decidedBy?: AlertIntakeScreeningSource;
|
|
374
|
+
channel?: AlertIntakeChannel;
|
|
375
|
+
connectionId?: string;
|
|
376
|
+
page?: number;
|
|
377
|
+
limit?: number;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A reviewer's decision on 1-100 screened messages. ELEVATE raises each as an incident
|
|
381
|
+
* without screening it again; DISMISS confirms it is not a report.
|
|
382
|
+
*/
|
|
383
|
+
export interface ReviewAlertIntakeScreenedMessages {
|
|
384
|
+
ids: string[];
|
|
385
|
+
decision: AlertIntakeScreeningDecision;
|
|
386
|
+
/** At most 300 characters. */
|
|
387
|
+
note?: string;
|
|
388
|
+
}
|
|
@@ -30,6 +30,13 @@ export interface Incident {
|
|
|
30
30
|
categoryId?: number;
|
|
31
31
|
typeId?: number;
|
|
32
32
|
description?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The report as the reporter wrote it, when `description` is its English
|
|
35
|
+
* translation (messages received by SMS, WhatsApp or email in another language).
|
|
36
|
+
*/
|
|
37
|
+
originalDescription?: string | null;
|
|
38
|
+
/** ISO 639-1 code of `originalDescription`'s language, e.g. `sw`. */
|
|
39
|
+
originalLanguage?: string | null;
|
|
33
40
|
status?: IncidentStatus;
|
|
34
41
|
statusDetails?: IncidentStatusDetails;
|
|
35
42
|
priority?: IncidentPriority;
|