@ministryofjustice/hmpps-connect-dps-shared-items 1.0.0

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/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # hmpps-connect-dps-shared-items-package
2
+ A library for sharing dps components across applications
3
+
4
+ ## Contents
5
+
6
+ 1. [Publishing to NPM](readme/publishing.md)
7
+
8
+ ## Installation
9
+
10
+ To install the package, run the following command:
11
+
12
+ ```bash
13
+ npm install @ministryofjustice/hmpps-connect-dps-shared-items
14
+ ```
15
+
16
+ ## Nunjucks macro usage
17
+
18
+ Add the `hmpps-connect-dps-shared-items` assets directory to nunjucks configuration in your application:
19
+
20
+ ```javascript
21
+ const njkEnv = nunjucks.configure(
22
+ [
23
+ path.join(__dirname, '../../server/views'),
24
+ ...,
25
+ 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/',
26
+ ],
27
+ {
28
+ autoescape: true,
29
+ express: app,
30
+ },
31
+ )
32
+ ```
33
+ Include the package scss within the all.scss file. You can either import all:
34
+ ```scss
35
+ @import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/scss/all';
36
+ ```
37
+ or import the specific component scss you are using, e.g:
38
+ ```scss
39
+ @import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/dps/components/alrt-flag/alert-flag';
40
+ ```
41
+ import the component into your nunkucks file:
42
+ ```javascript
43
+ {% from "dps/components/alert-flag/macro.njk" import alertFlag %}
44
+ ```
45
+
46
+ ## Components:
47
+
48
+ 1. [Alert flag](readme/components/alert-flag)
@@ -0,0 +1,9 @@
1
+ import Alert from './types/Alert';
2
+ import AlertFlagLabel from './types/AlertFlagLabel';
3
+ export declare const alertFlagLabels: {
4
+ alertCodes: string[];
5
+ classes: string;
6
+ label: string;
7
+ }[];
8
+ declare const _default: (prisonerAlerts: Alert[]) => AlertFlagLabel[];
9
+ export default _default;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alertFlagLabels = void 0;
4
+ const Alert_1 = require("./types/Alert");
5
+ exports.alertFlagLabels = [
6
+ { alertCodes: ['HA'], classes: 'dps-alert-status dps-alert-status--self-harm', label: 'ACCT open' },
7
+ {
8
+ alertCodes: ['HA1'],
9
+ classes: 'dps-alert-status dps-alert-status--self-harm',
10
+ label: 'ACCT post closure',
11
+ },
12
+ {
13
+ alertCodes: ['XSA', 'SA'],
14
+ classes: 'dps-alert-status dps-alert-status--security',
15
+ label: 'Staff assaulter',
16
+ },
17
+ {
18
+ alertCodes: ['XA'],
19
+ classes: 'dps-alert-status dps-alert-status--security',
20
+ label: 'Arsonist',
21
+ },
22
+ {
23
+ alertCodes: ['PEEP'],
24
+ classes: 'dps-alert-status dps-alert-status--medical',
25
+ label: 'PEEP',
26
+ },
27
+ {
28
+ alertCodes: ['HID'],
29
+ classes: 'dps-alert-status dps-alert-status--medical',
30
+ label: 'Hidden disability',
31
+ },
32
+ { alertCodes: ['XEL'], classes: 'dps-alert-status dps-alert-status--security', label: 'E-list' },
33
+ { alertCodes: ['XELH'], classes: 'dps-alert-status dps-alert-status--security', label: 'E-list heightened' },
34
+ { alertCodes: ['XER'], classes: 'dps-alert-status dps-alert-status--security', label: 'Escape risk' },
35
+ {
36
+ alertCodes: ['XRF'],
37
+ classes: 'dps-alert-status dps-alert-status--security',
38
+ label: 'Risk to females',
39
+ },
40
+ { alertCodes: ['XTACT'], classes: 'dps-alert-status dps-alert-status--security', label: 'TACT' },
41
+ {
42
+ alertCodes: ['XCO'],
43
+ classes: 'dps-alert-status dps-alert-status--security',
44
+ label: 'Corruptor',
45
+ },
46
+ {
47
+ alertCodes: ['XCA'],
48
+ classes: 'dps-alert-status dps-alert-status--security',
49
+ label: 'Chemical attacker',
50
+ },
51
+ {
52
+ alertCodes: ['XCI'],
53
+ classes: 'dps-alert-status dps-alert-status--security',
54
+ label: 'Concerted indiscipline',
55
+ },
56
+ { alertCodes: ['XR'], classes: 'dps-alert-status dps-alert-status--security', label: 'Racist' },
57
+ {
58
+ alertCodes: ['RTP', 'RLG'],
59
+ classes: 'dps-alert-status dps-alert-status--risk',
60
+ label: 'Risk to LGBT',
61
+ },
62
+ {
63
+ alertCodes: ['XHT'],
64
+ classes: 'dps-alert-status dps-alert-status--security',
65
+ label: 'Hostage taker',
66
+ },
67
+ {
68
+ alertCodes: ['XCU'],
69
+ classes: 'dps-alert-status dps-alert-status--security',
70
+ label: 'Controlled unlock',
71
+ },
72
+ {
73
+ alertCodes: ['XGANG'],
74
+ classes: 'dps-alert-status dps-alert-status--security',
75
+ label: 'Gang member',
76
+ },
77
+ { alertCodes: ['CSIP'], classes: 'dps-alert-status dps-alert-status--other', label: 'CSIP' },
78
+ { alertCodes: ['F1'], classes: 'dps-alert-status dps-alert-status--ex-armed-forces', label: 'Veteran' },
79
+ {
80
+ alertCodes: ['LCE'],
81
+ classes: 'dps-alert-status dps-alert-status--care-leaver',
82
+ label: 'Care experienced',
83
+ },
84
+ {
85
+ alertCodes: ['RNO121'],
86
+ classes: 'dps-alert-status dps-alert-status--risk',
87
+ label: 'No one-to-one',
88
+ },
89
+ { alertCodes: ['RCON'], classes: 'dps-alert-status dps-alert-status--risk', label: 'Conflict' },
90
+ {
91
+ alertCodes: ['RCDR'],
92
+ classes: 'dps-alert-status dps-alert-status--quarantined',
93
+ label: 'Quarantined',
94
+ },
95
+ {
96
+ alertCodes: ['URCU'],
97
+ classes: 'dps-alert-status dps-alert-status--reverse-cohorting-unit',
98
+ label: 'Reverse Cohorting Unit',
99
+ },
100
+ {
101
+ alertCodes: ['UPIU'],
102
+ classes: 'dps-alert-status dps-alert-status--protective-isolation-unit',
103
+ label: 'Protective Isolation Unit',
104
+ },
105
+ { alertCodes: ['USU'], classes: 'dps-alert-status dps-alert-status--shielding-unit', label: 'Shielding Unit' },
106
+ {
107
+ alertCodes: ['URS'],
108
+ classes: 'dps-alert-status dps-alert-status--refusing-to-shield',
109
+ label: 'Refusing to shield',
110
+ },
111
+ {
112
+ alertCodes: ['RKS'],
113
+ classes: 'dps-alert-status dps-alert-status--risk-to-known-adults',
114
+ label: 'Risk to known adults',
115
+ },
116
+ { alertCodes: ['VIP'], classes: 'dps-alert-status dps-alert-status--isolated-prisoner', label: 'Isolated' },
117
+ {
118
+ alertCodes: ['PVN'],
119
+ classes: 'dps-alert-status dps-alert-status--multicase dps-alert-status--visor',
120
+ label: 'ViSOR',
121
+ },
122
+ ].sort((a, b) => a.label.localeCompare(b.label));
123
+ exports.default = (prisonerAlerts) => {
124
+ return exports.alertFlagLabels.reduce((acc, flag) => {
125
+ const alertIds = prisonerAlerts
126
+ .filter(alert => {
127
+ const alertsServiceAlert = (0, Alert_1.isAlertsServiceAlert)(alert);
128
+ const alertIsActive = alertsServiceAlert ? alert.isActive : alert.active && !alert.expired;
129
+ const prisonerAlertCode = alertsServiceAlert ? alert.alertCode.code : alert.alertCode;
130
+ return alertIsActive && flag.alertCodes.includes(prisonerAlertCode);
131
+ })
132
+ .map(alert => ((0, Alert_1.isAlertsServiceAlert)(alert) ? alert.alertUuid : alert.alertCode));
133
+ return alertIds.length ? [...acc, { ...flag, alertIds }] : acc;
134
+ }, []);
135
+ };
136
+ //# sourceMappingURL=getAlertFlagLabelsForAlerts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAlertFlagLabelsForAlerts.js","sourceRoot":"","sources":["../../src/alertFlags/getAlertFlagLabelsForAlerts.ts"],"names":[],"mappings":";;;AAAA,yCAA2D;AAG9C,QAAA,eAAe,GAAG;IAC7B,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,8CAA8C,EAAE,KAAK,EAAE,WAAW,EAAE;IACnG;QACE,UAAU,EAAE,CAAC,KAAK,CAAC;QACnB,OAAO,EAAE,8CAA8C;QACvD,KAAK,EAAE,mBAAmB;KAC3B;IACD;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;QACz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AAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAA,4BAAoB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;QAElF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAChE,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA"}
@@ -0,0 +1,61 @@
1
+ type Alert = BasicAlert | PrisonApiAlert | AlertsServiceAlert;
2
+ export default Alert;
3
+ export interface BasicAlert {
4
+ alertType: string;
5
+ alertCode: string;
6
+ active: boolean;
7
+ expired: boolean;
8
+ }
9
+ export interface PrisonApiAlert {
10
+ alertId: string;
11
+ alertType: string;
12
+ alertTypeDescription: string;
13
+ alertCode: string;
14
+ alertCodeDescription: string;
15
+ comment?: string;
16
+ dateCreated: string;
17
+ modifiedDateTime?: string;
18
+ dateExpires?: string;
19
+ expired: boolean;
20
+ active: boolean;
21
+ addedByFirstName?: string;
22
+ addedByLastName?: string;
23
+ addedByFullName?: string;
24
+ expiredByFirstName?: string;
25
+ expiredByLastName?: string;
26
+ expiredByFullName?: string;
27
+ }
28
+ export interface AlertsServiceAlert {
29
+ alertUuid?: string;
30
+ prisonNumber?: string;
31
+ alertCode: {
32
+ alertTypeCode: string;
33
+ alertTypeDescription: string;
34
+ code: string;
35
+ description: string;
36
+ };
37
+ description: string;
38
+ authorisedBy?: string;
39
+ activeFrom: string;
40
+ activeTo?: string;
41
+ isActive: boolean;
42
+ comments?: [
43
+ {
44
+ commentUuid: string;
45
+ comment: string;
46
+ createdAt: string;
47
+ createdBy: string;
48
+ createdByDisplayName: string;
49
+ }
50
+ ];
51
+ createdAt?: string;
52
+ createdBy?: string;
53
+ createdByDisplayName: string;
54
+ lastModifiedAt?: string;
55
+ lastModifiedBy?: string;
56
+ lastModifiedByDisplayName?: string;
57
+ activeToLastSetAt?: string;
58
+ activeToLastSetBy?: string;
59
+ activeToLastSetByDisplayName?: string;
60
+ }
61
+ export declare function isAlertsServiceAlert(alert: Alert): alert is AlertsServiceAlert;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAlertsServiceAlert = isAlertsServiceAlert;
4
+ function isAlertsServiceAlert(alert) {
5
+ return typeof alert.alertCode !== 'string';
6
+ }
7
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../src/alertFlags/types/Alert.ts"],"names":[],"mappings":";;AAgEA,oDAEC;AAFD,SAAgB,oBAAoB,CAAC,KAAY;IAC/C,OAAO,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,6 @@
1
+ export default interface AlertFlagLabel {
2
+ alertCodes: string[];
3
+ classes: string;
4
+ label: string;
5
+ alertIds?: string[];
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AlertFlagLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertFlagLabel.js","sourceRoot":"","sources":["../../../src/alertFlags/types/AlertFlagLabel.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ %status-style {
2
+ @media screen {
3
+ justify-content: center;
4
+ border: 3px solid;
5
+ padding: 0px 10px;
6
+ font-size: 16px;
7
+ text-align: center;
8
+ line-height: 1;
9
+ user-select: none;
10
+ border-radius: 5px
11
+ }
12
+
13
+ @media print {
14
+ margin-bottom: 0px !important;
15
+ font-size: 12px;
16
+ color: black !important;
17
+ border: none !important;
18
+ background: none !important;
19
+ min-width: auto;
20
+ }
21
+ }
@@ -0,0 +1,206 @@
1
+ %status-style {
2
+ @media screen {
3
+ justify-content: center;
4
+ border: 3px solid;
5
+ padding: 5px 10px;
6
+ font-size: 16px;
7
+ text-align: center;
8
+ line-height: 1;
9
+ user-select: none;
10
+ border-radius: 5px;
11
+ min-height: 30px;
12
+ }
13
+
14
+ @media print {
15
+ margin-bottom: 0px !important;
16
+ font-size: 12px;
17
+ color: black !important;
18
+ border: none !important;
19
+ background: none !important;
20
+ min-width: auto;
21
+ }
22
+ }
23
+
24
+ @mixin alertType($colour) {
25
+ border-color: $colour;
26
+
27
+ &:hover, &:focus {
28
+ text-decoration: none;
29
+ background-color: $colour;
30
+ color: white;
31
+ }
32
+
33
+ &:focus {
34
+ box-shadow: 0 0 0 3px $govuk-focus-colour;
35
+ }
36
+ }
37
+
38
+ .dps-alert-status {
39
+ @extend %status-style;
40
+ margin-right: 0;
41
+ display: inline-flex;
42
+ align-items: center;
43
+
44
+ height: 26px;
45
+ color: black;
46
+ background-color: white;
47
+
48
+ &--care-leaver {
49
+ @include alertType(#00703c);
50
+ }
51
+
52
+ &--ex-armed-forces {
53
+ @include alertType(#85994b);
54
+ }
55
+
56
+ &--medical {
57
+ @include alertType(#5694ca);
58
+ }
59
+
60
+ &--other {
61
+ @include alertType(#d53880);
62
+ }
63
+
64
+ &--MAPPP-case {
65
+ @include alertType(#28a197);
66
+ }
67
+
68
+ &--security {
69
+ @include alertType(#003078);
70
+ }
71
+
72
+ &--risk {
73
+ @include alertType(#d4351c);
74
+ }
75
+
76
+ &--self-harm {
77
+ @include alertType(#f47738);
78
+ }
79
+
80
+
81
+
82
+ &--acct {
83
+ @include alertType(#d34700);
84
+ }
85
+
86
+ &--assault {
87
+ @include alertType(#4c2c92);
88
+ }
89
+
90
+ &--disability {
91
+ @include alertType(#2b88c8);
92
+ }
93
+
94
+ &--arsonist {
95
+ @include alertType(#df3034);
96
+ }
97
+
98
+ &--elist {
99
+ @include alertType(#28a197);
100
+ }
101
+
102
+ &--risk-females {
103
+ @include alertType(#6f71af);
104
+ }
105
+
106
+ &--tact {
107
+ @include alertType(#d53880);
108
+ }
109
+
110
+ &--corruptor {
111
+ @include alertType(#b10e1e);
112
+ }
113
+
114
+ &--chemical-attacker {
115
+ @include alertType(#69831e);
116
+ }
117
+
118
+ &--concerted-indiscipline {
119
+ @include alertType(#444);
120
+ }
121
+
122
+ &--racist {
123
+ @include alertType(#8f5f11);
124
+ }
125
+
126
+ &--risk-lgbt {
127
+ @include alertType(#912b88);
128
+ }
129
+
130
+ &--hostage-taker {
131
+ @include alertType(#c6545f);
132
+ }
133
+
134
+ &--controlled-unlock {
135
+ @include alertType(#2e358b);
136
+ }
137
+
138
+ &--gang-member {
139
+ @include alertType(#005f9e);
140
+ }
141
+
142
+ &--csip {
143
+ @include alertType(#4c2c92);
144
+ }
145
+
146
+ &--veteran {
147
+ @include alertType(#006435);
148
+ }
149
+
150
+ &--care-experienced {
151
+ @include alertType(#3f90ae);
152
+ }
153
+
154
+ &--acct-post-closure {
155
+ border: 3px dashed;
156
+ @include alertType(#f47738);
157
+ }
158
+
159
+ &--conflict {
160
+ @include alertType(#800000);
161
+ }
162
+
163
+ &--no-one-to-one {
164
+ @include alertType(#903);
165
+ }
166
+
167
+ &--quarantined {
168
+ @include alertType(#330);
169
+ }
170
+
171
+ &--reverse-cohorting-unit {
172
+ @include alertType(mix(white, #00703c, 20%));
173
+ }
174
+
175
+ &--protective-isolation-unit {
176
+ @include alertType(#006637);
177
+ }
178
+
179
+ &--shielding-unit {
180
+ @include alertType(#004424);
181
+ }
182
+
183
+ &--refusing-to-shield {
184
+ @include alertType(#b58840);
185
+ }
186
+
187
+ &--risk-to-known-adults {
188
+ @include alertType(#003078);
189
+ }
190
+
191
+ &--isolated-prisoner {
192
+ @include alertType(#00753f);
193
+ }
194
+
195
+ &--visor {
196
+ @include alertType(#003078);
197
+ }
198
+ }
199
+
200
+ .alert-status--multicase {
201
+ @media screen {
202
+ text-transform: none;
203
+ min-height: 30px;
204
+ }
205
+ }
206
+
@@ -0,0 +1,16 @@
1
+ {% macro alertFlag(alertData) %}
2
+ {% if alertData.href %}
3
+ <a href="{{ alertData.href }}"
4
+ class="govuk-link govuk-link--no-underline govuk-link--text-colour {{ alertData.alert.classes }}"
5
+ {% for attribute, value in alertData.attributes %}
6
+ {{ attribute }}="{{ value }}"
7
+ {% endfor %}
8
+ >
9
+ {{ alertData.alert.label }}
10
+ </a>
11
+ {% else %}
12
+ <div class="{{ alertData.alert.classes }}">
13
+ {{ alertData.alert.label }}
14
+ </div>
15
+ {% endif %}
16
+ {% endmacro %}
@@ -0,0 +1 @@
1
+ @import '../dps/components/alert-flag/alert-flag';
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ alertFlags: {
3
+ getAlertFlagLabelsForAlerts: (prisonerAlerts: import("./alertFlags/types/Alert").default[]) => import("./alertFlags/types/AlertFlagLabel").default[];
4
+ };
5
+ };
6
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const getAlertFlagLabelsForAlerts_1 = __importDefault(require("./alertFlags/getAlertFlagLabelsForAlerts"));
7
+ exports.default = {
8
+ alertFlags: {
9
+ getAlertFlagLabelsForAlerts: getAlertFlagLabelsForAlerts_1.default,
10
+ },
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,2GAAkF;AAElF,kBAAe;IACb,UAAU,EAAE;QACV,2BAA2B,EAA3B,qCAA2B;KAC5B;CACF,CAAA"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@ministryofjustice/hmpps-connect-dps-shared-items",
3
+ "version": "1.0.0",
4
+ "description": "A package to share connect dps functionality across applications",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist/**/*"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc && npm run copy:assets",
12
+ "test": "jest --passWithNoTests",
13
+ "test:ci": "jest --runInBand --passWithNoTests",
14
+ "lint": "eslint . --cache --max-warnings 0",
15
+ "copy:assets": "rm -rf dist/assets && cp -r src/assets dist/assets",
16
+ "security_audit": "npx audit-ci --config audit-ci.json"
17
+ },
18
+ "jest": {
19
+ "transform": {
20
+ "^.+\\.tsx?$": [
21
+ "ts-jest",
22
+ {
23
+ "isolatedModules": true
24
+ }
25
+ ]
26
+ },
27
+ "testMatch": [
28
+ "<rootDir>/**/**/?(*.)(cy|test).{ts,js,jsx,mjs}"
29
+ ],
30
+ "testEnvironment": "node",
31
+ "reporters": [
32
+ "default",
33
+ [
34
+ "jest-junit",
35
+ {
36
+ "outputDirectory": "test_results/jest/"
37
+ }
38
+ ],
39
+ [
40
+ "./node_modules/jest-html-reporter",
41
+ {
42
+ "outputPath": "test_results/unit-test-reports.html"
43
+ }
44
+ ]
45
+ ],
46
+ "moduleFileExtensions": [
47
+ "web.js",
48
+ "js",
49
+ "json",
50
+ "node",
51
+ "ts"
52
+ ]
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+ssh://git@github.com/ministryofjustice/hmpps-connect-dps-shared-items-package.git"
57
+ },
58
+ "author": "",
59
+ "license": "MIT",
60
+ "bugs": {
61
+ "url": "https://github.com/ministryofjustice/hmpps-connect-dps-shared-items-package/issues"
62
+ },
63
+ "homepage": "https://github.com/ministryofjustice/hmpps-connect-dps-shared-items-package#readme",
64
+ "devDependencies": {
65
+ "@types/jest": "^29.5.12",
66
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
67
+ "eslint": "^8.57.0",
68
+ "eslint-config-airbnb-base": "^15.0.0",
69
+ "eslint-config-prettier": "^9.1.0",
70
+ "eslint-import-resolver-typescript": "^3.6.1",
71
+ "eslint-plugin-cypress": "^2.15.2",
72
+ "eslint-plugin-import": "^2.29.1",
73
+ "eslint-plugin-no-only-tests": "^3.1.0",
74
+ "eslint-plugin-prettier": "^5.1.3",
75
+ "jest": "^29.7.0",
76
+ "jest-html-reporter": "^3.10.2",
77
+ "jest-junit": "^16.0.0",
78
+ "ts-jest": "^29.1.5"
79
+ }
80
+ }