@rivm-loculus-tools/common-frontend 0.8.0 → 0.10.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.
Files changed (55) hide show
  1. package/dist/_chunks/LoculusService.js +1049 -0
  2. package/dist/_chunks/LoculusService.js.map +1 -0
  3. package/dist/_chunks/decorateParam.js +7 -0
  4. package/dist/_chunks/keycloak-dpop.js +241 -0
  5. package/dist/_chunks/keycloak-dpop.js.map +1 -0
  6. package/dist/classes/services/EmotionCacheService/index.js +27 -1
  7. package/dist/classes/services/EmotionCacheService/index.js.map +1 -0
  8. package/dist/classes/services/LoculusService/LoculusService.d.ts +26 -0
  9. package/dist/classes/services/LoculusService/index.d.ts +1 -0
  10. package/dist/classes/services/LoculusService/index.js +1 -0
  11. package/dist/classes/services/UrlService/UrlService.d.ts +18 -0
  12. package/dist/classes/services/UrlService/index.d.ts +1 -0
  13. package/dist/classes/services/UrlService/index.js +45 -0
  14. package/dist/classes/services/UrlService/index.js.map +1 -0
  15. package/dist/components/app/App/App.d.ts +4 -2
  16. package/dist/components/app/App/index.js +35 -34
  17. package/dist/components/app/App/index.js.map +1 -1
  18. package/dist/components/authentication/AuthenticationLoader/AuthenticationLoader.d.ts +3 -0
  19. package/dist/components/authentication/AuthenticationLoader/index.d.ts +1 -0
  20. package/dist/components/authentication/AuthenticationLoader/index.js +31 -0
  21. package/dist/components/authentication/AuthenticationLoader/index.js.map +1 -0
  22. package/dist/components/fasta/FastaDataImportDialog/FastaDataImportDialog.d.ts +1 -0
  23. package/dist/components/fasta/FastaDataImportDialog/index.js +80 -80
  24. package/dist/components/fasta/FastaDataImportDialog/index.js.map +1 -1
  25. package/dist/components/fasta/FastaDataImportDialogLoader/FastaDataImportDialogLoader.d.ts +2 -1
  26. package/dist/components/fasta/FastaDataImportDialogLoader/index.js +61 -52
  27. package/dist/components/fasta/FastaDataImportDialogLoader/index.js.map +1 -1
  28. package/dist/components/fasta/FastaPageHeaderResetButton/index.js +27 -24
  29. package/dist/components/fasta/FastaPageHeaderResetButton/index.js.map +1 -1
  30. package/dist/components/loculus/UploadToLoculusModal/UploadToLoculusModal.d.ts +11 -0
  31. package/dist/components/loculus/UploadToLoculusModal/index.d.ts +1 -0
  32. package/dist/components/loculus/UploadToLoculusModal/index.js +159 -0
  33. package/dist/components/loculus/UploadToLoculusModal/index.js.map +1 -0
  34. package/dist/components/ui/ButtonWithMenu/ButtonWithMenu.d.ts +1 -0
  35. package/dist/components/ui/ButtonWithMenu/index.js +5 -4
  36. package/dist/components/ui/ButtonWithMenu/index.js.map +1 -1
  37. package/dist/components/ui/PageCommon/index.js +2 -2
  38. package/dist/components/ui/PageCommon/index.js.map +1 -1
  39. package/dist/components/ui/PageCommonDrawer/index.js +1 -1
  40. package/dist/components/ui/SearchBar/index.js +1 -0
  41. package/dist/components/ui/SearchBar/index.js.map +1 -1
  42. package/dist/constants/page.constants.d.ts +1 -1
  43. package/dist/constants/page.constants.js +1 -1
  44. package/dist/constants/page.constants.js.map +1 -1
  45. package/dist/models/url.models.d.ts +9 -0
  46. package/dist/models/url.models.js +0 -0
  47. package/dist/utils/MetaDataUtil/MetaDataUtil.d.ts +2 -1
  48. package/dist/utils/MetaDataUtil/index.js +5 -2
  49. package/dist/utils/MetaDataUtil/index.js.map +1 -1
  50. package/dist/utils/UrlUtil/UrlUtil.d.ts +2 -1
  51. package/dist/utils/UrlUtil/index.js +8 -5
  52. package/dist/utils/UrlUtil/index.js.map +1 -1
  53. package/package.json +23 -2
  54. package/dist/_chunks/EmotionCacheService.js +0 -32
  55. package/dist/_chunks/EmotionCacheService.js.map +0 -1
@@ -4,7 +4,7 @@ import { WindowService as t } from "@gen-epix/ui-core/classes/services/WindowSer
4
4
  var n = class {
5
5
  static clearSearchParams() {
6
6
  let n = new URL(e.resolve(t).window.location.href);
7
- n.search = "", e.resolve(t).window.history.replaceState(null, "", n.toString());
7
+ n.search = "", e.resolve(t).window.history.replaceState(null, "", n.toString()), e.resolve(t).window.dispatchEvent(new Event("loculus:urlparamschange"));
8
8
  }
9
9
  static fastaLabelFromUrl(e) {
10
10
  try {
@@ -14,15 +14,18 @@ var n = class {
14
14
  return "remote-alignment.fasta";
15
15
  }
16
16
  }
17
- static validateFastaUrl(e) {
17
+ static getBaseURLWithPath() {
18
+ let n = new URL(e.resolve(t).window.location.href);
19
+ return n.pathname ? `${n.protocol}//${n.host}/${n.pathname.split("/").filter(Boolean).shift()}` : `${n.protocol}//${n.host}`;
20
+ }
21
+ static isValidResourceUrl(e) {
18
22
  let t;
19
23
  try {
20
24
  t = new URL(e.trim());
21
25
  } catch {
22
- throw Error("Enter a valid FASTA URL.");
26
+ return !1;
23
27
  }
24
- if (t.protocol !== "http:" && t.protocol !== "https:") throw Error("FASTA URLs must use HTTP or HTTPS.");
25
- return t.href;
28
+ return t.protocol === "http:" || t.protocol === "https:";
26
29
  }
27
30
  };
28
31
  export { n as UrlUtil };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["UrlUtil","url","container","WindowService","urlObject","segment"],"sources":["../../../src/utils/UrlUtil/UrlUtil.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\n\nexport class UrlUtil {\n public static clearSearchParams(): void {\n const url = new URL(container.resolve(WindowService).window.location.href);\n url.search = '';\n container.resolve(WindowService).window.history.replaceState(null, '', url.toString());\n }\n\n public static fastaLabelFromUrl(url: string): string {\n try {\n const urlObject = new URL(url);\n const segment = urlObject.pathname.split('/').filter(Boolean).pop();\n if (segment) {\n return decodeURIComponent(segment);\n }\n return `${urlObject.hostname}.fasta`;\n } catch {\n return 'remote-alignment.fasta';\n }\n }\n\n public static validateFastaUrl(url: string): string {\n let urlObject: URL;\n try {\n urlObject = new URL(url.trim());\n } catch {\n throw new Error('Enter a valid FASTA URL.');\n }\n if (urlObject.protocol !== 'http:' && urlObject.protocol !== 'https:') {\n throw new Error('FASTA URLs must use HTTP or HTTPS.');\n }\n return urlObject.href;\n }\n}\n"],"mappings":";;;AAIA,IAAaA,IAAb,MAAqB;CACnB,OAAc,oBAA0B;EACtC,IAAMC,IAAM,IAAI,IAAIC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,SAAS,IAAI;EAEzE,AADA,EAAI,SAAS,IACbD,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,QAAQ,aAAa,MAAM,IAAIF,EAAI,SAAS,CAAC;CACvF;CAEA,OAAc,kBAAkB,GAAqB;EACnD,IAAI;GACF,IAAMG,IAAY,IAAI,IAAIH,CAAG,GACvBI,IAAUD,EAAU,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI;GAIlE,OAHIC,IACK,mBAAmBA,CAAO,IAE5B,GAAGD,EAAU,SAAS;EAC/B,QAAQ;GACN,OAAO;EACT;CACF;CAEA,OAAc,iBAAiB,GAAqB;EAClD,IAAIA;EACJ,IAAI;GACF,IAAY,IAAI,IAAIH,EAAI,KAAK,CAAC;EAChC,QAAQ;GACN,MAAU,MAAM,0BAA0B;EAC5C;EACA,IAAIG,EAAU,aAAa,WAAWA,EAAU,aAAa,UAC3D,MAAU,MAAM,oCAAoC;EAEtD,OAAOA,EAAU;CACnB;AACF"}
1
+ {"version":3,"file":"index.js","names":["UrlUtil","url","container","WindowService","urlObject","segment"],"sources":["../../../src/utils/UrlUtil/UrlUtil.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\n\nexport class UrlUtil {\n public static clearSearchParams(): void {\n const url = new URL(container.resolve(WindowService).window.location.href);\n url.search = '';\n container.resolve(WindowService).window.history.replaceState(null, '', url.toString());\n container.resolve(WindowService).window.dispatchEvent(new Event('loculus:urlparamschange'));\n }\n\n public static fastaLabelFromUrl(url: string): string {\n try {\n const urlObject = new URL(url);\n const segment = urlObject.pathname.split('/').filter(Boolean).pop();\n if (segment) {\n return decodeURIComponent(segment);\n }\n return `${urlObject.hostname}.fasta`;\n } catch {\n return 'remote-alignment.fasta';\n }\n }\n\n public static getBaseURLWithPath(): string {\n const url = new URL(container.resolve(WindowService).window.location.href);\n if (url.pathname) {\n return `${url.protocol}//${url.host}/${url.pathname.split('/').filter(Boolean).shift()}`;\n }\n return `${url.protocol}//${url.host}`;\n }\n\n\n public static isValidResourceUrl(url: string): boolean {\n let urlObject: URL;\n try {\n urlObject = new URL(url.trim());\n } catch {\n return false;\n }\n if (urlObject.protocol !== 'http:' && urlObject.protocol !== 'https:') {\n return false;\n }\n return true;\n }\n}\n"],"mappings":";;;AAIA,IAAaA,IAAb,MAAqB;CACnB,OAAc,oBAA0B;EACtC,IAAMC,IAAM,IAAI,IAAIC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,SAAS,IAAI;EAGzE,AAFA,EAAI,SAAS,IACbD,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,QAAQ,aAAa,MAAM,IAAIF,EAAI,SAAS,CAAC,GACrFC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,cAAc,IAAI,MAAM,yBAAyB,CAAC;CAC5F;CAEA,OAAc,kBAAkB,GAAqB;EACnD,IAAI;GACF,IAAMC,IAAY,IAAI,IAAIH,CAAG,GACvBI,IAAUD,EAAU,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI;GAIlE,OAHIC,IACK,mBAAmBA,CAAO,IAE5B,GAAGD,EAAU,SAAS;EAC/B,QAAQ;GACN,OAAO;EACT;CACF;CAEA,OAAc,qBAA6B;EACzC,IAAMH,IAAM,IAAI,IAAIC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,SAAS,IAAI;EAIzE,OAHIF,EAAI,WACC,GAAGA,EAAI,SAAS,IAAIA,EAAI,KAAK,GAAGA,EAAI,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,MAEhF,GAAGA,EAAI,SAAS,IAAIA,EAAI;CACjC;CAGA,OAAc,mBAAmB,GAAsB;EACrD,IAAIG;EACJ,IAAI;GACF,IAAY,IAAI,IAAIH,EAAI,KAAK,CAAC;EAChC,QAAQ;GACN,OAAO;EACT;EAIA,OAHIG,EAAU,aAAa,WAAWA,EAAU,aAAa;CAI/D;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivm-loculus-tools/common-frontend",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "license": "EUPL-1.2",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "lodash": "4.18.1",
32
- "zustand": "5.0.16"
32
+ "zustand": "5.0.16",
33
+ "keycloak-js": "26.2.5"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@emotion/cache": "11.14.0",
@@ -79,10 +80,22 @@
79
80
  "types": "./dist/classes/services/FastaDataEventBusService/index.d.ts",
80
81
  "import": "./dist/classes/services/FastaDataEventBusService/index.js"
81
82
  },
83
+ "./classes/services/LoculusService": {
84
+ "types": "./dist/classes/services/LoculusService/index.d.ts",
85
+ "import": "./dist/classes/services/LoculusService/index.js"
86
+ },
87
+ "./classes/services/UrlService": {
88
+ "types": "./dist/classes/services/UrlService/index.d.ts",
89
+ "import": "./dist/classes/services/UrlService/index.js"
90
+ },
82
91
  "./components/app/App": {
83
92
  "types": "./dist/components/app/App/index.d.ts",
84
93
  "import": "./dist/components/app/App/index.js"
85
94
  },
95
+ "./components/authentication/AuthenticationLoader": {
96
+ "types": "./dist/components/authentication/AuthenticationLoader/index.d.ts",
97
+ "import": "./dist/components/authentication/AuthenticationLoader/index.js"
98
+ },
86
99
  "./components/fasta/FastaDataImportDialog": {
87
100
  "types": "./dist/components/fasta/FastaDataImportDialog/index.d.ts",
88
101
  "import": "./dist/components/fasta/FastaDataImportDialog/index.js"
@@ -107,6 +120,10 @@
107
120
  "types": "./dist/components/fasta/FastaPageHeaderResetButton/index.d.ts",
108
121
  "import": "./dist/components/fasta/FastaPageHeaderResetButton/index.js"
109
122
  },
123
+ "./components/loculus/UploadToLoculusModal": {
124
+ "types": "./dist/components/loculus/UploadToLoculusModal/index.d.ts",
125
+ "import": "./dist/components/loculus/UploadToLoculusModal/index.js"
126
+ },
110
127
  "./components/ui/ButtonWithMenu": {
111
128
  "types": "./dist/components/ui/ButtonWithMenu/index.d.ts",
112
129
  "import": "./dist/components/ui/ButtonWithMenu/index.js"
@@ -167,6 +184,10 @@
167
184
  "types": "./dist/models/metadata.models.d.ts",
168
185
  "import": "./dist/models/metadata.models.js"
169
186
  },
187
+ "./models/url.models": {
188
+ "types": "./dist/models/url.models.d.ts",
189
+ "import": "./dist/models/url.models.js"
190
+ },
170
191
  "./pages/ErrorPage": {
171
192
  "types": "./dist/pages/ErrorPage/index.d.ts",
172
193
  "import": "./dist/pages/ErrorPage/index.js"
@@ -1,32 +0,0 @@
1
- import { CONFIG_TOKEN as e } from "../constants/config.constants.js";
2
- import { t } from "./decorate.js";
3
- import { inject as n, singleton as r } from "tsyringe";
4
- import { WindowService as i } from "@gen-epix/ui-core/classes/services/WindowService";
5
- import a from "@emotion/cache";
6
- // \0@oxc-project+runtime@0.155.0/helpers/esm/decorateParam.js
7
- function o(e, t) {
8
- return function(n, r) {
9
- t(n, r, e);
10
- };
11
- }
12
- // src/classes/services/EmotionCacheService/EmotionCacheService.ts
13
- var s = class {
14
- emotionCache;
15
- constructor(e, t) {
16
- this.emotionCache = a({
17
- container: t.document.head,
18
- key: "loculus-tools",
19
- nonce: e.nonce,
20
- prepend: !!e.nonce,
21
- stylisPlugins: []
22
- });
23
- }
24
- };
25
- s = t([
26
- r(),
27
- o(0, n(e)),
28
- o(1, n(i))
29
- ], s);
30
- export { s as t };
31
-
32
- //# sourceMappingURL=EmotionCacheService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmotionCacheService.js","names":["_decorate","_decorateParam","createCache","__decorateParam","target","key","paramIndex","EmotionCacheService","windowService","config","__decorate","singleton","inject","CONFIG_TOKEN","WindowService"],"sources":["../../src/classes/services/EmotionCacheService/EmotionCacheService.ts"],"sourcesContent":["import type { EmotionCache } from '@emotion/cache';\nimport createCache from '@emotion/cache';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\n\n@singleton()\nexport class EmotionCacheService {\n public readonly emotionCache: EmotionCache;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(WindowService) windowService: WindowService,\n ) {\n this.emotionCache = createCache({\n container: windowService.document.head,\n key: 'loculus-tools',\n nonce: config.nonce,\n prepend: !!config.nonce,\n stylisPlugins: [],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAaO,IAAMO,IAAN,MAA0B;CAC/B;CAEA,YACE,GACA,GACA;EACA,KAAK,eAAeL,EAAY;GAC9B,WAAWM,EAAc,SAAS;GAClC,KAAK;GACL,OAAOC,EAAO;GACd,SAAS,CAAC,CAACA,EAAO;GAClB,eAAe,CAAC;EAClB,CAAC;CACH;AACF;;CAhBCE,EAAU;CAKNV,EAAA,GAAAW,EAAOC,CAAY,CAAA;CACnBZ,EAAA,GAAAW,EAAOE,CAAa,CAAA"}