@hmcts/media-viewer 4.2.22-nodejs-healthcheck → 4.2.22

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 (31) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/README.md +207 -5
  3. package/package.json +3 -3
  4. package/package.tgz +0 -0
  5. package/assets/pdfjs/images/altText_add.svg:Zone.Identifier +0 -0
  6. package/assets/pdfjs/images/altText_disclaimer.svg:Zone.Identifier +0 -0
  7. package/assets/pdfjs/images/altText_done.svg:Zone.Identifier +0 -0
  8. package/assets/pdfjs/images/altText_spinner.svg:Zone.Identifier +0 -0
  9. package/assets/pdfjs/images/altText_warning.svg:Zone.Identifier +0 -0
  10. package/assets/pdfjs/images/annotation-check.svg:Zone.Identifier +0 -0
  11. package/assets/pdfjs/images/annotation-comment.svg:Zone.Identifier +0 -0
  12. package/assets/pdfjs/images/annotation-help.svg:Zone.Identifier +0 -0
  13. package/assets/pdfjs/images/annotation-insert.svg:Zone.Identifier +0 -0
  14. package/assets/pdfjs/images/annotation-key.svg:Zone.Identifier +0 -0
  15. package/assets/pdfjs/images/annotation-newparagraph.svg:Zone.Identifier +0 -0
  16. package/assets/pdfjs/images/annotation-noicon.svg:Zone.Identifier +0 -0
  17. package/assets/pdfjs/images/annotation-note.svg:Zone.Identifier +0 -0
  18. package/assets/pdfjs/images/annotation-paperclip.svg:Zone.Identifier +0 -0
  19. package/assets/pdfjs/images/annotation-paragraph.svg:Zone.Identifier +0 -0
  20. package/assets/pdfjs/images/annotation-pushpin.svg:Zone.Identifier +0 -0
  21. package/assets/pdfjs/images/cursor-editorFreeHighlight.svg:Zone.Identifier +0 -0
  22. package/assets/pdfjs/images/cursor-editorFreeText.svg:Zone.Identifier +0 -0
  23. package/assets/pdfjs/images/cursor-editorInk.svg:Zone.Identifier +0 -0
  24. package/assets/pdfjs/images/cursor-editorTextHighlight.svg:Zone.Identifier +0 -0
  25. package/assets/pdfjs/images/editor-toolbar-delete.svg:Zone.Identifier +0 -0
  26. package/assets/pdfjs/images/loading-icon.gif:Zone.Identifier +0 -0
  27. package/assets/pdfjs/images/messageBar_closingButton.svg:Zone.Identifier +0 -0
  28. package/assets/pdfjs/images/messageBar_warning.svg:Zone.Identifier +0 -0
  29. package/assets/pdfjs/images/toolbarButton-editorHighlight.svg:Zone.Identifier +0 -0
  30. package/assets/pdfjs/images/toolbarButton-menuArrow.svg:Zone.Identifier +0 -0
  31. package/assets/pdfjs/pdf_viewer.css:Zone.Identifier +0 -0
Binary file
package/README.md CHANGED
@@ -1,12 +1,214 @@
1
1
  # @hmcts/media-viewer
2
- [![Coverage Status](https://coveralls.io/repos/github/hmcts/media-viewer/badge.svg?branch=master)](https://coveralls.io/github/hmcts/media-viewer?branch=upload-npm-in-pipeline)
3
- [![Build Status](https://travis-ci.com/hmcts/media-viewer.svg?branch=master)](https://travis-ci.com/hmcts/media-viewer)
2
+ [![Node.js Package](https://github.com/hmcts/rpx-xui-media-viewer/actions/workflows/npmpublish.yml/badge.svg)](https://github.com/hmcts/rpx-xui-media-viewer/actions/workflows/npmpublish.yml)
4
3
 
5
4
  This is an angular library that can be used to view and annotate PDF documents and images
6
5
 
7
- ## Running demo app
8
- - yarn package
9
- - yarn start:ng
6
+ ## Running the demo app locally
7
+ For the static local demo:
8
+
9
+ ```
10
+ yarn package
11
+ yarn start:ng
12
+ ```
13
+
14
+ For the AAT-connected standalone app, use the runbook below.
15
+
16
+ ## Running locally against AAT
17
+ The standalone demo can run on your machine while its bundled Express API proxies Media Viewer calls to AAT. This is the local replacement path for the old `em-showcase` media-viewer checks.
18
+
19
+ Local URLs:
20
+ - Angular app: `http://localhost:3000/`
21
+ - Media Viewer route: `http://localhost:3000/#/media-viewer`
22
+ - Retired DM Store compatibility route: `http://localhost:3000/#/dm-store`
23
+ - Local API health: `http://localhost:1337/health`
24
+
25
+ The local browser talks to Angular on port `3000`. Angular uses `proxy.config.js` to send `/documents`, `/em-anno`, `/api`, `/icp`, `/hearing-recordings`, and `/doc-assembly` to the local API on port `1337`. The local API then connects to AAT services.
26
+
27
+ ### Prerequisites
28
+ - Azure CLI installed.
29
+ - Logged in to the HMCTS Azure tenant with access to `rpx-aat` Key Vault.
30
+ - Yarn dependencies installed for this repo.
31
+ - Network access to AAT internal service URLs.
32
+
33
+ Check Azure access:
34
+
35
+ ```
36
+ az account show
37
+ az keyvault secret show --vault-name rpx-aat --name show-oauth2-token --query id -o tsv
38
+ ```
39
+
40
+ ### 1. Generate the local `.env`
41
+ Generate `.env` from `.env.example` and `rpx-aat` Key Vault:
42
+
43
+ ```
44
+ yarn env:populate:aat
45
+ ```
46
+
47
+ The generated `.env` is ignored by git and must not be committed.
48
+
49
+ The script populates:
50
+ - `IDAM_SECRET` from `show-oauth2-token`
51
+ - `IDAM_PASSWORD` from `password`
52
+ - `S2S_KEY` from `microservicekey-em-gw`
53
+
54
+ To write to a different file:
55
+
56
+ ```
57
+ bash ./scripts/populate-env-from-keyvault.sh aat /tmp/media-viewer.env .env.example
58
+ ```
59
+
60
+ ### 2. Validate the AAT config
61
+ Run this before starting the app if you only want to prove the endpoint wiring:
62
+
63
+ ```
64
+ yarn check:aat-config
65
+ ```
66
+
67
+ This compiles the local API and checks the resolved AAT targets for document assembly, DM Store, HRS, annotations, NPA, ICP, IdAM, and S2S.
68
+
69
+ ### 3. Start Media Viewer against AAT
70
+ Start both the local API and Angular app:
71
+
72
+ ```
73
+ yarn start:aat
74
+ ```
75
+
76
+ This command:
77
+ - loads `.env`
78
+ - sets `MV_USE_AAT=true`
79
+ - builds the Media Viewer library assets needed by the demo
80
+ - compiles the local API into `dist/api`
81
+ - starts the local API on `PORT` or `1337`
82
+ - starts Angular with `proxy.config.js`
83
+
84
+ Open:
85
+
86
+ ```
87
+ http://localhost:3000/#/media-viewer
88
+ ```
89
+
90
+ ### 4. Smoke test a running local instance
91
+ In another terminal, run:
92
+
93
+ ```
94
+ yarn smoke:local:aat
95
+ ```
96
+
97
+ The smoke check verifies:
98
+ - `http://localhost:3000/`
99
+ - `http://localhost:1337/health` returns `UP`
100
+
101
+ Use a browser for route-level checks because `#/media-viewer` and `#/dm-store` are Angular hash routes, not server paths.
102
+
103
+ For browser-level proof that the standalone viewer is using AAT-backed services, keep
104
+ `yarn start:aat` running, then run:
105
+
106
+ ```
107
+ yarn test:local:aat
108
+ ```
109
+
110
+ This opens `http://localhost:3000/#/media-viewer`, loads
111
+ `/documents/<MV_SMOKE_PDF_DOCUMENT_ID>/binary`, and waits for the rendered PDF viewer
112
+ and first page. If `MV_SMOKE_PDF_DOCUMENT_ID` is blank, the smoke uses the demo app's
113
+ default AAT PDF document id.
114
+
115
+ ### 5. Create isolated AAT test documents
116
+ For mutation-heavy functional tests, do not share one document across parallel workers.
117
+ Create fresh AAT DM Store documents through the local API proxy while `yarn start:aat`
118
+ is running:
119
+
120
+ ```
121
+ yarn local-aat:documents -- --pdf-count 7 --image-count 1 --output .local-aat-documents.env
122
+ ```
123
+
124
+ This writes:
125
+ - `MV_SMOKE_PDF_DOCUMENT_ID`
126
+ - `MV_SMOKE_IMAGE_DOCUMENT_ID`
127
+ - `MV_FUNCTIONAL_PDF_DOCUMENT_IDS`
128
+ - `MV_FUNCTIONAL_IMAGE_DOCUMENT_IDS`
129
+
130
+ The upload path mirrors em-showcase: multipart `files`, `classification=PUBLIC`,
131
+ and civil/probate metadata are posted to `/documents`.
132
+
133
+ ### 6. Run isolated local functional tests
134
+ With `yarn start:aat` still running, execute the functional groups with separate
135
+ documents and separate reports:
136
+
137
+ ```
138
+ yarn test:functional:local:isolated
139
+ ```
140
+
141
+ By default this creates fresh documents, runs up to three feature files at a time,
142
+ and writes reports under `functional-output/local-isolated/`. Override with:
143
+ - `MV_LOCAL_PARALLEL_MAX_JOBS=1` to run the same isolated groups serially
144
+ - `MV_CREATE_LOCAL_AAT_DOCS=false` to reuse IDs from `.local-aat-documents.env`
145
+ - `E2E_PARALLEL_OUTPUT_ROOT=<path>` to change report location
146
+
147
+ Each feature writes its own report directory, including:
148
+ - `mv-e2e-result.html`
149
+ - `mv-e2e-result.json`
150
+ - `result.xml`
151
+
152
+ The validated local AAT sequence is:
153
+
154
+ ```
155
+ yarn check:aat-config
156
+ yarn start:aat
157
+ yarn smoke:local:aat
158
+ yarn test:local:aat
159
+ yarn test:functional:local:isolated
160
+ ```
161
+
162
+ Expected `test:functional:local:isolated` feature groups:
163
+ - `annotationsAndComments`
164
+ - `bookMarks`
165
+ - `redact`
166
+ - `printAndDownload`
167
+ - `rotate`
168
+ - `search`
169
+ - `zoomAndnavigation`
170
+ - `imageViewerAnnotationsAndComments`
171
+
172
+ For the strongest isolation proof, make each scenario upload and use its own document:
173
+
174
+ ```
175
+ yarn test:functional:local:self-contained
176
+ ```
177
+
178
+ This is slower because it creates a fresh AAT DM Store document for each scenario, but
179
+ it is the best local check when diagnosing interference between bookmarks,
180
+ annotations, comments, and redactions.
181
+
182
+ ### Useful overrides
183
+ Most developers should use the defaults from `.env.example`. Override only when you are deliberately testing a different endpoint or registered client setting.
184
+
185
+ Common overrides:
186
+ - `PORT`: local API port, default `1337`
187
+ - `DOCASSEMBLY_URL`
188
+ - `DM_STORE_APP_URL`
189
+ - `HRS_API_URL`
190
+ - `ANNOTATION_API_URL`
191
+ - `NPA_URL`
192
+ - `ICP_API_URL`
193
+ - `IDAM_URL`
194
+ - `REDIRECT_URL`
195
+ - `S2S_URL`
196
+
197
+ The default `REDIRECT_URL` uses the registered AAT `xui-media-viewer` callback. Do not change it to a localhost callback unless the IdAM client registration supports that callback.
198
+
199
+ ### Troubleshooting
200
+ - Missing `IDAM_SECRET`, `IDAM_PASSWORD`, or `S2S_KEY`: run `yarn env:populate:aat` again and confirm Azure access to `rpx-aat`.
201
+ - IdAM token errors: confirm `IDAM_URL=https://idam-api.aat.platform.hmcts.net`.
202
+ - Blank viewer or missing toolbar assets: restart with `yarn start:aat`; it runs `build:lib`, `copy:lib-js-dependencies`, and `copy:lib-assets` before serving.
203
+ - Port conflict on `1337`: set `PORT` in `.env` and restart.
204
+ - Service connectivity failures: check VPN/network access to AAT internal service URLs.
205
+
206
+ ## Replacing em-showcase media-viewer use
207
+ This standalone app replaces `em-showcase` for Media Viewer validation against AAT. It keeps compatible local navigation for `/`, `#/media-viewer`, and `#/dm-store`.
208
+
209
+ The `#/dm-store` route is intentionally a retired compatibility route. It points users back to the Media Viewer document ID flow instead of carrying the old DM Store showcase UI.
210
+
211
+ Supported Media Viewer checks include document loading, annotations, redactions, redaction search, ICP, multimedia, hearing-recording, and document-assembly proxy paths.
10
212
 
11
213
  ## Integrating into your own Angular application
12
214
  add @hmcts/media-viewer as a dependency in package.json
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@hmcts/media-viewer",
3
- "version": "4.2.22-nodejs-healthcheck",
3
+ "version": "4.2.22",
4
4
  "description": "Media Viewer",
5
5
  "keywords": [
6
6
  "Angular",
7
7
  "PDF",
8
8
  "Annotation"
9
9
  ],
10
- "homepage": "https://github.com/hmcts/rpa-annotation-ui-demo",
10
+ "homepage": "https://github.com/hmcts/rpx-xui-media-viewer",
11
11
  "license": "SEE LICENSE IN LICENSE",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/hmcts/em-media-viewer"
14
+ "url": "https://github.com/hmcts/rpx-xui-media-viewer"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"
package/package.tgz CHANGED
Binary file
File without changes