@ministryofjustice/hmpps-mpop-frontend-components-lib 0.0.1 → 0.0.3
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 +59 -1
- package/dist/MPoPComponents.d.ts +2 -1
- package/dist/MPoPComponents.test.d.ts +1 -0
- package/dist/SuppressingRestClient.test.d.ts +1 -0
- package/dist/components/supervision-package/supervisionPackage.test.d.ts +1 -0
- package/dist/index.cjs.js +52 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.esm.js +52 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/mpop/components/supervision-package/template.njk +9 -3
- package/dist/types/TierCalculation.d.ts +10 -2
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
1
|
# hmpps-mpop-frontend-components-lib
|
|
2
|
-
MPoP front-end library
|
|
2
|
+
MPoP front-end library
|
|
3
|
+
|
|
4
|
+
## Releasing
|
|
5
|
+
|
|
6
|
+
This package is published to npm using GitHub Releases and npm Trusted Publishing.
|
|
7
|
+
|
|
8
|
+
### Release process
|
|
9
|
+
|
|
10
|
+
1. Create a branch from the latest `main` and update the package version:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git checkout main
|
|
14
|
+
git pull
|
|
15
|
+
git checkout -b chore/bump-package-version
|
|
16
|
+
|
|
17
|
+
npm version patch --no-git-tag-version
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Alternatively:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm version minor --no-git-tag-version
|
|
24
|
+
npm version major --no-git-tag-version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. Commit the version change:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git add package.json package-lock.json
|
|
31
|
+
git commit -m "Bump package version"
|
|
32
|
+
git push -u origin HEAD
|
|
33
|
+
```
|
|
34
|
+
3. Raise a pull request and merge it into `main`.
|
|
35
|
+
|
|
36
|
+
4. Ensure your local `main` is up to date, then create a draft GitHub release for the version:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git checkout main
|
|
40
|
+
git pull
|
|
41
|
+
|
|
42
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
43
|
+
|
|
44
|
+
// Add a step to say github cli needs to be installed and you need to login to the github cli
|
|
45
|
+
|
|
46
|
+
gh release create "v$VERSION" \
|
|
47
|
+
--target main \
|
|
48
|
+
--title "v$VERSION" \
|
|
49
|
+
--generate-notes \
|
|
50
|
+
--draft
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
5. Publish the GitHub release (i.e. mark it as not a draft) to trigger the publish workflow and publish the package to npm.
|
|
54
|
+
|
|
55
|
+
### Notes
|
|
56
|
+
|
|
57
|
+
- The GitHub release tag should be `v<version>`, where `<version>` matches the version in `package.json`.
|
|
58
|
+
- The package version must be greater than the latest version published to npm.
|
|
59
|
+
- Publishing uses npm Trusted Publishing via GitHub Actions and does not require an npm token.
|
|
60
|
+
- If the version already exists on npm, the publish workflow will skip publishing.
|
package/dist/MPoPComponents.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { AuthOptions } from '@ministryofjustice/hmpps-rest-client';
|
|
|
2
2
|
import type { AuthenticationClient } from '@ministryofjustice/hmpps-auth-clients';
|
|
3
3
|
import type Logger from 'bunyan';
|
|
4
4
|
import type { MPoPComponentsConfig } from './types/MPoPComponentsConfig';
|
|
5
|
-
import type { LatestTierResponse } from './types/TierCalculation';
|
|
5
|
+
import type { LatestTierResponse, TierTag } from './types/TierCalculation';
|
|
6
|
+
export declare const tierTags: Record<string, TierTag>;
|
|
6
7
|
export default class MPoPComponents {
|
|
7
8
|
private readonly tierApiRestClient;
|
|
8
9
|
constructor(authenticationClient: AuthenticationClient, config: MPoPComponentsConfig, logger?: Logger | Console);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -21,32 +21,70 @@ class SuppressingRestClient {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
const tierTags = {
|
|
25
|
+
missing: { text: 'Missing', color: 'red' },
|
|
26
|
+
provisional: { text: 'Provisional', color: 'orange' },
|
|
27
|
+
unavailable: { text: 'Unavailable', color: 'grey' },
|
|
28
|
+
none: { text: null, color: null },
|
|
29
|
+
};
|
|
24
30
|
class MPoPComponents {
|
|
25
31
|
constructor(authenticationClient, config, logger = console) {
|
|
26
32
|
this.tierApiRestClient = new SuppressingRestClient(new hmppsRestClient.RestClient('Tier API', config, logger, authenticationClient), logger);
|
|
27
33
|
}
|
|
28
34
|
async getTierDetails(authOptions, crn) {
|
|
29
|
-
|
|
35
|
+
let error = null;
|
|
36
|
+
let tierDetails;
|
|
30
37
|
try {
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
calculation:
|
|
38
|
+
const calculation = await this.tierApiRestClient.get(`/v3/crn/${crn}/tier`, authOptions);
|
|
39
|
+
if (!calculation) {
|
|
40
|
+
tierDetails = {
|
|
41
|
+
calculation: {
|
|
42
|
+
tierScore: '',
|
|
43
|
+
calculationId: '',
|
|
44
|
+
calculationDate: '',
|
|
45
|
+
changeReason: '',
|
|
46
|
+
provisional: false,
|
|
47
|
+
tag: { ...tierTags.unavailable },
|
|
48
|
+
},
|
|
35
49
|
httpStatus: 404,
|
|
36
50
|
};
|
|
37
51
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
else {
|
|
53
|
+
let tag;
|
|
54
|
+
if (calculation.tierScore === 'MISSING') {
|
|
55
|
+
tag = { ...tierTags.missing };
|
|
56
|
+
}
|
|
57
|
+
else if (calculation.tierScore && calculation.provisional) {
|
|
58
|
+
tag = { ...tierTags.provisional };
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
tag = { ...tierTags.none };
|
|
62
|
+
}
|
|
63
|
+
tierDetails = {
|
|
64
|
+
calculation: { ...calculation, tag },
|
|
65
|
+
httpStatus: 200,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
|
-
catch (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
69
|
+
catch (err) {
|
|
70
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
71
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
72
|
+
tierDetails = {
|
|
73
|
+
calculation: {
|
|
74
|
+
tierScore: '',
|
|
75
|
+
calculationId: '',
|
|
76
|
+
calculationDate: '',
|
|
77
|
+
changeReason: '',
|
|
78
|
+
provisional: false,
|
|
79
|
+
tag: { ...tierTags.unavailable },
|
|
80
|
+
},
|
|
81
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
48
82
|
};
|
|
49
83
|
}
|
|
84
|
+
return {
|
|
85
|
+
...tierDetails,
|
|
86
|
+
error,
|
|
87
|
+
};
|
|
50
88
|
}
|
|
51
89
|
}
|
|
52
90
|
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/SuppressingRestClient.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null],"names":["RestClient"],"mappings":";;;;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/SuppressingRestClient.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null],"names":["RestClient"],"mappings":";;;;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;ACfM,MAAM,QAAQ,GAA4B;IAC/C,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;IAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE;IACrD,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,E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AACL,oBAAA,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE;gBAC5B;AAEA,gBAAA,WAAW,GAAG;AACZ,oBAAA,WAAW,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,EAAE;AACpC,oBAAA,UAAU,EAAE,GAAG;iBAChB;YACH;QACF;QAAE,OAAO,GAAG,EAAE;AACZ,YAAA,KAAK,GAAG,GAAG,YAAY,KAAK,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,2BAA2B,CAAC;YAC3E,MAAM,cAAc,GAAI,GAA0C,KAAA,IAAA,IAA1C,GAAG,KAAA,MAAA,GAAA,MAAA,GAAH,GAAG,CAAyC,cAAc;AAElF,YAAA,WAAW,GAAG;AACZ,gBAAA,WAAW,EAAE;AACX,oBAAA,SAAS,EAAE,EAAE;AACb,oBAAA,aAAa,EAAE,EAAE;AACjB,oBAAA,eAAe,EAAE,EAAE;AACnB,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,WAAW,EAAE,KAAK;AAClB,oBAAA,GAAG,EAAE,EAAE,GAAG,QAAQ,CAAC,WAAW,EAAE;AACjC,iBAAA;AACD,gBAAA,UAAU,EAAE,cAAc,KAAA,IAAA,IAAd,cAAc,KAAA,MAAA,GAAd,cAAc,GAAI,GAAG;aAClC;QACH;QAEA,OAAO;AACL,YAAA,GAAG,WAAW;YACd,KAAK;SACN;IACH;AACD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,16 +5,24 @@ import Logger from 'bunyan';
|
|
|
5
5
|
interface MPoPComponentsConfig extends ApiConfig {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
type
|
|
8
|
+
type TierTag = {
|
|
9
|
+
text: 'Missing' | 'Provisional' | 'Unavailable' | null;
|
|
10
|
+
color: 'red' | 'orange' | 'grey' | null;
|
|
11
|
+
};
|
|
12
|
+
type LatestTierApiResponse = {
|
|
9
13
|
tierScore: string;
|
|
10
14
|
calculationId: string;
|
|
11
15
|
calculationDate: string;
|
|
12
16
|
changeReason: string;
|
|
13
17
|
provisional: boolean;
|
|
14
18
|
};
|
|
19
|
+
type LatestTier = LatestTierApiResponse & {
|
|
20
|
+
tag: TierTag;
|
|
21
|
+
};
|
|
15
22
|
type LatestTierResponse = {
|
|
16
|
-
calculation: LatestTier
|
|
23
|
+
calculation: LatestTier;
|
|
17
24
|
httpStatus: number;
|
|
25
|
+
error?: Error | null;
|
|
18
26
|
};
|
|
19
27
|
|
|
20
28
|
declare class MPoPComponents {
|
package/dist/index.esm.js
CHANGED
|
@@ -19,32 +19,70 @@ class SuppressingRestClient {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const tierTags = {
|
|
23
|
+
missing: { text: 'Missing', color: 'red' },
|
|
24
|
+
provisional: { text: 'Provisional', color: 'orange' },
|
|
25
|
+
unavailable: { text: 'Unavailable', color: 'grey' },
|
|
26
|
+
none: { text: null, color: null },
|
|
27
|
+
};
|
|
22
28
|
class MPoPComponents {
|
|
23
29
|
constructor(authenticationClient, config, logger = console) {
|
|
24
30
|
this.tierApiRestClient = new SuppressingRestClient(new RestClient('Tier API', config, logger, authenticationClient), logger);
|
|
25
31
|
}
|
|
26
32
|
async getTierDetails(authOptions, crn) {
|
|
27
|
-
|
|
33
|
+
let error = null;
|
|
34
|
+
let tierDetails;
|
|
28
35
|
try {
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
|
|
32
|
-
calculation:
|
|
36
|
+
const calculation = await this.tierApiRestClient.get(`/v3/crn/${crn}/tier`, authOptions);
|
|
37
|
+
if (!calculation) {
|
|
38
|
+
tierDetails = {
|
|
39
|
+
calculation: {
|
|
40
|
+
tierScore: '',
|
|
41
|
+
calculationId: '',
|
|
42
|
+
calculationDate: '',
|
|
43
|
+
changeReason: '',
|
|
44
|
+
provisional: false,
|
|
45
|
+
tag: { ...tierTags.unavailable },
|
|
46
|
+
},
|
|
33
47
|
httpStatus: 404,
|
|
34
48
|
};
|
|
35
49
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
else {
|
|
51
|
+
let tag;
|
|
52
|
+
if (calculation.tierScore === 'MISSING') {
|
|
53
|
+
tag = { ...tierTags.missing };
|
|
54
|
+
}
|
|
55
|
+
else if (calculation.tierScore && calculation.provisional) {
|
|
56
|
+
tag = { ...tierTags.provisional };
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
tag = { ...tierTags.none };
|
|
60
|
+
}
|
|
61
|
+
tierDetails = {
|
|
62
|
+
calculation: { ...calculation, tag },
|
|
63
|
+
httpStatus: 200,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
40
66
|
}
|
|
41
|
-
catch (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
catch (err) {
|
|
68
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
69
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
70
|
+
tierDetails = {
|
|
71
|
+
calculation: {
|
|
72
|
+
tierScore: '',
|
|
73
|
+
calculationId: '',
|
|
74
|
+
calculationDate: '',
|
|
75
|
+
changeReason: '',
|
|
76
|
+
provisional: false,
|
|
77
|
+
tag: { ...tierTags.unavailable },
|
|
78
|
+
},
|
|
79
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
46
80
|
};
|
|
47
81
|
}
|
|
82
|
+
return {
|
|
83
|
+
...tierDetails,
|
|
84
|
+
error,
|
|
85
|
+
};
|
|
48
86
|
}
|
|
49
87
|
}
|
|
50
88
|
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/SuppressingRestClient.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/SuppressingRestClient.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;ACfM,MAAM,QAAQ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-tag--
|
|
11
|
+
{% if params.tag.text and params.tag.color %}
|
|
12
|
+
<strong class="govuk-tag govuk-tag--{{ params.tag.color }}">{{ params.tag.text }}</strong>
|
|
13
13
|
{% endif %}
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
{% if params.
|
|
16
|
+
{% if params.tag.text == 'Provisional' %}
|
|
17
17
|
<p class="govuk-body">
|
|
18
18
|
We will calculate the supervision package once the tier is confirmed.
|
|
19
19
|
</p>
|
|
20
20
|
{% endif %}
|
|
21
21
|
|
|
22
|
+
{% if params.tag.text == 'Unavailable' %}
|
|
23
|
+
<p class="govuk-body">
|
|
24
|
+
Tier information is currently unavailable.
|
|
25
|
+
</p>
|
|
26
|
+
{% endif %}
|
|
27
|
+
|
|
22
28
|
{% if params.historyHref %}
|
|
23
29
|
<p class="govuk-body">
|
|
24
30
|
<a href="{{ params.historyHref }}" class="govuk-link govuk-link--no-visited-state">
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type TierTag = {
|
|
2
|
+
text: 'Missing' | 'Provisional' | 'Unavailable' | null;
|
|
3
|
+
color: 'red' | 'orange' | 'grey' | null;
|
|
4
|
+
};
|
|
5
|
+
export type LatestTierApiResponse = {
|
|
2
6
|
tierScore: string;
|
|
3
7
|
calculationId: string;
|
|
4
8
|
calculationDate: string;
|
|
5
9
|
changeReason: string;
|
|
6
10
|
provisional: boolean;
|
|
7
11
|
};
|
|
12
|
+
export type LatestTier = LatestTierApiResponse & {
|
|
13
|
+
tag: TierTag;
|
|
14
|
+
};
|
|
8
15
|
export type LatestTierResponse = {
|
|
9
|
-
calculation: LatestTier
|
|
16
|
+
calculation: LatestTier;
|
|
10
17
|
httpStatus: number;
|
|
18
|
+
error?: Error | null;
|
|
11
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-mpop-frontend-components-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "MPOP front-end components library",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"ts"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/ministryofjustice/hmpps-mpop-frontend-components-lib.git"
|
|
58
|
+
},
|
|
55
59
|
"keywords": [],
|
|
56
60
|
"author": "",
|
|
57
61
|
"license": "ISC",
|
|
@@ -88,7 +92,7 @@
|
|
|
88
92
|
},
|
|
89
93
|
"type": "commonjs",
|
|
90
94
|
"dependencies": {
|
|
91
|
-
"@ministryofjustice/hmpps-auth-clients": "^
|
|
95
|
+
"@ministryofjustice/hmpps-auth-clients": "^3.0.0",
|
|
92
96
|
"@ministryofjustice/hmpps-rest-client": "^1.2.1",
|
|
93
97
|
"@types/nunjucks": "3.2.6",
|
|
94
98
|
"sass": "^1.100.0"
|