@uxland/primary-shell 8.3.3 → 8.3.5

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 (154) hide show
  1. package/README.md +18 -1
  2. package/dist/{component-BYXgNvke.js → component-Dv2Cw4dX.js} +2 -2
  3. package/dist/{component-BYXgNvke.js.map → component-Dv2Cw4dX.js.map} +1 -1
  4. package/dist/{index-CDpyZ5Yt.js → index-CCC4rQo1.js} +2629 -2628
  5. package/dist/{index-CDpyZ5Yt.js.map → index-CCC4rQo1.js.map} +1 -1
  6. package/dist/index.js +21 -22
  7. package/dist/index.js.map +1 -1
  8. package/dist/{plugin-CMgpCPh9.js → plugin-D3sg1ev9.js} +5 -6
  9. package/dist/{plugin-CMgpCPh9.js.map → plugin-D3sg1ev9.js.map} +1 -1
  10. package/package.json +7 -15
  11. package/src/UI/bootstrapper.ts +0 -14
  12. package/src/UI/components/bootstrapper.ts +0 -25
  13. package/src/UI/components/clinical-pathways-action-menu/clinical-pathways-action-menu.ts +0 -13
  14. package/src/UI/components/communication-action-menu/communication-action-menu.ts +0 -13
  15. package/src/UI/components/error-view/component.ts +0 -17
  16. package/src/UI/components/error-view/styles.css +0 -27
  17. package/src/UI/components/error-view/template.ts +0 -12
  18. package/src/UI/components/nav-divider/nav-divider.ts +0 -41
  19. package/src/UI/components/nav-divider/styles.css +0 -21
  20. package/src/UI/components/nav-divider/template.ts +0 -8
  21. package/src/UI/components/petitioner-action-menu/petitioner-action-menu.ts +0 -13
  22. package/src/UI/components/primaria-accordion/primaria-accordion.ts +0 -45
  23. package/src/UI/components/primaria-shell/constants.ts +0 -4
  24. package/src/UI/components/primaria-shell/primaria-shell.ts +0 -105
  25. package/src/UI/components/primaria-shell/shell-header/header-divider/header-divider.ts +0 -13
  26. package/src/UI/components/primaria-shell/shell-header/header-divider/styles.css +0 -5
  27. package/src/UI/components/primaria-shell/shell-header/header-divider/template.ts +0 -8
  28. package/src/UI/components/primaria-shell/shell-header/shell-header.ts +0 -71
  29. package/src/UI/components/primaria-shell/shell-header/styles.css +0 -45
  30. package/src/UI/components/primaria-shell/shell-header/template.ts +0 -37
  31. package/src/UI/components/primaria-shell/styles.css +0 -185
  32. package/src/UI/components/primaria-shell/template.ts +0 -72
  33. package/src/UI/components/sidenav-action-menu/sidenav-action-menu.ts +0 -62
  34. package/src/UI/components/sidenav-action-menu/styles.css +0 -25
  35. package/src/UI/components/sidenav-action-menu/template.ts +0 -24
  36. package/src/UI/fonts/fonts.css +0 -48
  37. package/src/UI/fonts/open-sans-v40-latin-300.woff2 +0 -0
  38. package/src/UI/fonts/open-sans-v40-latin-500.woff2 +0 -0
  39. package/src/UI/fonts/open-sans-v40-latin-600.woff2 +0 -0
  40. package/src/UI/fonts/open-sans-v40-latin-700.woff2 +0 -0
  41. package/src/UI/fonts/open-sans-v40-latin-800.woff2 +0 -0
  42. package/src/UI/fonts/open-sans-v40-latin-regular.woff2 +0 -0
  43. package/src/UI/images/Gencat_Logotip.svg +0 -70
  44. package/src/UI/images/Salut_Logotip.svg +0 -8
  45. package/src/UI/index.ts +0 -1
  46. package/src/UI/internal-views/administrative-nav-menu.ts +0 -302
  47. package/src/UI/internal-views/common-nav-menu.ts +0 -94
  48. package/src/UI/internal-views/doctor-nav-menu.ts +0 -297
  49. package/src/UI/internal-views/doctor-quick-action-menu.ts +0 -16
  50. package/src/UI/internal-views/handle-views.ts +0 -24
  51. package/src/UI/shared-components/bootstrapper.ts +0 -18
  52. package/src/UI/shared-components/index.ts +0 -1
  53. package/src/UI/shared-components/primaria-character-limit-badge/primaria-character-limit-badge.ts +0 -27
  54. package/src/UI/shared-components/primaria-character-limit-badge/styles.css +0 -8
  55. package/src/UI/shared-components/primaria-content-switcher/primaria-content-switcher.ts +0 -78
  56. package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +0 -71
  57. package/src/UI/shared-components/primaria-nav-item/styles.css +0 -25
  58. package/src/UI/shared-components/primaria-nav-item/template.ts +0 -27
  59. package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +0 -41
  60. package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +0 -11
  61. package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +0 -46
  62. package/src/UI/shared-components/primaria-region/index.ts +0 -1
  63. package/src/UI/shared-components/primaria-region/primaria-region.ts +0 -199
  64. package/src/UI/shared-components/primaria-text-editor/primaria-rich-text-editor.ts +0 -261
  65. package/src/UI/shared-components/primaria-text-editor/styles.css +0 -966
  66. package/src/UI/shared-components/primaria-text-editor/template.ts +0 -8
  67. package/src/UI/shared-components/primaria-text-editor/utils.ts +0 -39
  68. package/src/UI/shared-components/quick-action-item/quick-action-item.ts +0 -21
  69. package/src/UI/shared-components/quick-action-item/template.ts +0 -8
  70. package/src/UI/shared-components/typings.ts +0 -19
  71. package/src/api/activity-monitor/activity-monitor.test.ts +0 -67
  72. package/src/api/activity-monitor/activity-monitor.ts +0 -26
  73. package/src/api/api.test.ts +0 -37
  74. package/src/api/api.ts +0 -119
  75. package/src/api/broker/broker-events.ts +0 -39
  76. package/src/api/broker/broker-requests.ts +0 -20
  77. package/src/api/broker/factory.test.ts +0 -378
  78. package/src/api/broker/factory.ts +0 -151
  79. package/src/api/broker/primaria-broker.ts +0 -20
  80. package/src/api/context-manager/context-manager.test.ts +0 -86
  81. package/src/api/context-manager/context-manager.ts +0 -42
  82. package/src/api/ecap-event-manager/ecap-event-manager.test.ts +0 -100
  83. package/src/api/ecap-event-manager/ecap-event-manager.ts +0 -58
  84. package/src/api/ecap-event-manager/typings.ts +0 -6
  85. package/src/api/exit-guard-manager/exit-guard-manager.test.ts +0 -75
  86. package/src/api/exit-guard-manager/exit-guard-manager.ts +0 -31
  87. package/src/api/global-state/global-state.test.ts +0 -45
  88. package/src/api/global-state/global-state.ts +0 -38
  89. package/src/api/http-client/http-client.test.ts +0 -196
  90. package/src/api/http-client/http-client.ts +0 -97
  91. package/src/api/import-data-manager/component/component.ts +0 -29
  92. package/src/api/import-data-manager/component/styles.css +0 -79
  93. package/src/api/import-data-manager/component/template.ts +0 -49
  94. package/src/api/import-data-manager/import-data-manager-impl.test.ts +0 -364
  95. package/src/api/import-data-manager/import-data-manager-impl.ts +0 -121
  96. package/src/api/import-data-manager/import-data-manager.ts +0 -42
  97. package/src/api/import-data-manager/index.ts +0 -2
  98. package/src/api/interaction-service/confirmation-message.tsx +0 -5
  99. package/src/api/interaction-service/index.ts +0 -1
  100. package/src/api/interaction-service/interaction-service-impl.tsx +0 -260
  101. package/src/api/interaction-service/interaction-service.ts +0 -52
  102. package/src/api/interaction-service/modal-styles.css +0 -97
  103. package/src/api/localization/localization.test.ts +0 -61
  104. package/src/api/localization/localization.ts +0 -58
  105. package/src/api/notification-service/notification-service-impl.test.ts +0 -84
  106. package/src/api/notification-service/notification-service.ts +0 -6
  107. package/src/api/notification-service/notification.service-impl.ts +0 -67
  108. package/src/api/pdf-viewer-manager/constants.ts +0 -1
  109. package/src/api/pdf-viewer-manager/events.ts +0 -5
  110. package/src/api/pdf-viewer-manager/handle-views.ts +0 -32
  111. package/src/api/pdf-viewer-manager/pdf-viewer-manager.test.ts +0 -126
  112. package/src/api/pdf-viewer-manager/pdf-viewer-manager.ts +0 -96
  113. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/pdf-selector.ts +0 -39
  114. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/styles.css +0 -45
  115. package/src/api/pdf-viewer-manager/pdf-visor/pdf-selector/template.ts +0 -32
  116. package/src/api/pdf-viewer-manager/pdf-visor/pdf-visor.ts +0 -122
  117. package/src/api/pdf-viewer-manager/pdf-visor/styles.css +0 -29
  118. package/src/api/pdf-viewer-manager/pdf-visor/utils.ts +0 -16
  119. package/src/api/quick-action-busy-manager/quick-action-busy-manager.test.ts +0 -61
  120. package/src/api/quick-action-busy-manager/quick-action-busy-manager.ts +0 -45
  121. package/src/api/region-manager/region-manager.test.ts +0 -239
  122. package/src/api/region-manager/region-manager.ts +0 -263
  123. package/src/api/region-manager/regions.ts +0 -30
  124. package/src/api/region-manager/remove-view-idempotency.test.ts +0 -98
  125. package/src/api/session-refresh-timer/session-refresh-timer.test.ts +0 -102
  126. package/src/api/session-refresh-timer/session-refresh-timer.ts +0 -75
  127. package/src/api/token-manager/token-manager.test.ts +0 -146
  128. package/src/api/token-manager/token-manager.ts +0 -70
  129. package/src/api/user-manager/user-manager.ts +0 -79
  130. package/src/bootstrapper.ts +0 -41
  131. package/src/constants.ts +0 -1
  132. package/src/disposer.ts +0 -19
  133. package/src/features/bootstrapper.ts +0 -21
  134. package/src/features/exit/bootstrapper.ts +0 -17
  135. package/src/features/exit/handler.test.ts +0 -187
  136. package/src/features/exit/handler.ts +0 -58
  137. package/src/features/exit/request.ts +0 -10
  138. package/src/features/get-patient-cip/action.ts +0 -5
  139. package/src/features/get-user-info/backend-adapter.ts +0 -48
  140. package/src/features/get-user-info/bootstrapper.ts +0 -20
  141. package/src/features/get-user-info/handler.test.ts +0 -66
  142. package/src/features/get-user-info/handler.ts +0 -23
  143. package/src/features/get-user-info/model.ts +0 -10
  144. package/src/features/get-user-info/pds-token.ts +0 -28
  145. package/src/features/get-user-info/request.ts +0 -4
  146. package/src/features/get-visi-id/action.ts +0 -11
  147. package/src/features/navigate-to-ecap/navigate-to-ecap.ts +0 -21
  148. package/src/features/utils.ts +0 -27
  149. package/src/handle-plugins.ts +0 -82
  150. package/src/index.ts +0 -101
  151. package/src/infrastructure/ioc/container.ts +0 -14
  152. package/src/infrastructure/ioc/types.ts +0 -5
  153. package/src/locales.ts +0 -70
  154. package/src/types/custom.d.ts +0 -30
@@ -1,8 +0,0 @@
1
- import { html } from "lit";
2
-
3
- export const template = (props) => html`
4
- <div class="container">
5
- <div id="rte">
6
- </div>
7
- </div>
8
- `;
@@ -1,39 +0,0 @@
1
- //Hay una issue detectada en el component quilljs que borra algunas palabras/parrafos al corregir palabras con el corrector del navegador
2
- //Sólo pasa cuando el texto se ha copiado y enganchado de una fuente externa y contiene estilos(negritas, colores, etc).
3
- //https://github.com/quilljs/quill/issues/2096
4
- //Este fix corrige este comportamiento.
5
- export const fixSpellCheckerIssue = (Quill) => {
6
- const Inline = Quill.import("blots/inline");
7
-
8
- class CustomAttributes extends Inline {
9
- constructor(domNode, value) {
10
- super(domNode, value);
11
-
12
- const span = this.replaceWith(new Inline(Inline.create()));
13
-
14
- span.children.forEach((child) => {
15
- if (child.attributes) child.attributes.copy(span);
16
- if (child.unwrap) child.unwrap();
17
- });
18
-
19
- // here we apply every attribute from <font> tag to span as a style
20
- Object.keys(domNode.attributes).forEach(function (key) {
21
- if (domNode.attributes[key].name != "style") {
22
- const val = domNode.attributes[key].value;
23
- let name = domNode.attributes[key].name;
24
- if (name == "face") name = "font-family";
25
- span.format(name, val);
26
- }
27
- });
28
-
29
- this.remove();
30
-
31
- return span;
32
- }
33
- }
34
-
35
- CustomAttributes.blotName = "customAttributes";
36
- CustomAttributes.tagName = "FONT";
37
-
38
- Quill.register(CustomAttributes, true);
39
- };
@@ -1,21 +0,0 @@
1
- import { LitElement, html } from "lit";
2
- import { template } from "./template";
3
- import { customElement, property } from "lit/decorators.js";
4
-
5
- @customElement("quick-action-item")
6
- export class QuickActionItem extends LitElement {
7
- constructor(icon: string, label: string, callbackFn: () => void) {
8
- super();
9
- this.icon = icon;
10
- this.label = label;
11
- this.callbackFn = callbackFn;
12
- }
13
-
14
- render() {
15
- return html`${template(this)}`;
16
- }
17
-
18
- @property({ type: String }) icon = "";
19
- @property({ type: String }) label = "";
20
- @property({ attribute: false }) callbackFn = () => {};
21
- }
@@ -1,8 +0,0 @@
1
- import { html } from "lit";
2
- import { QuickActionItem } from "./quick-action-item";
3
-
4
- export const template = (props: QuickActionItem) => {
5
- return html`
6
- <dss-action-menu-item @click=${props.callbackFn} notificationsStatus="error" rightIcon=${props.icon} label=${props.label}></dss-action-menu-item>
7
- `;
8
- };
@@ -1,19 +0,0 @@
1
- interface MenuItem {
2
- icon: string;
3
- label: string;
4
- }
5
-
6
- export interface PrimariaNavItemConfig extends MenuItem {
7
- callbackFn?: () => void;
8
- showArrow?: boolean;
9
- fill?: boolean;
10
- rotateIcon?: boolean;
11
- hasNestedMenu?: boolean;
12
- nestedMenuItems?: PrimariaNavItemConfig[];
13
- }
14
-
15
- export interface PrimariaNavTreeMenuConfig {
16
- icon: string;
17
- label: string;
18
- actionMenuItems: PrimariaNavItemConfig[];
19
- }
@@ -1,67 +0,0 @@
1
- // @vitest-environment happy-dom
2
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import { ActivityMonitorImpl } from "./activity-monitor";
4
-
5
- describe("ActivityMonitor", () => {
6
- let monitor: ActivityMonitorImpl;
7
-
8
- beforeEach(() => {
9
- vi.useFakeTimers();
10
- monitor = new ActivityMonitorImpl();
11
- });
12
-
13
- afterEach(() => {
14
- monitor.stop();
15
- vi.useRealTimers();
16
- });
17
-
18
- it("should return 0 before any activity", () => {
19
- expect(monitor.getLastActivityTimestamp()).toBe(0);
20
- });
21
-
22
- it("should update timestamp on keydown", () => {
23
- monitor.start();
24
- const before = Date.now();
25
- window.dispatchEvent(new Event("keydown"));
26
- expect(monitor.getLastActivityTimestamp()).toBeGreaterThanOrEqual(before);
27
- });
28
-
29
- it("should update timestamp on click", () => {
30
- monitor.start();
31
- const before = Date.now();
32
- window.dispatchEvent(new Event("click"));
33
- expect(monitor.getLastActivityTimestamp()).toBeGreaterThanOrEqual(before);
34
- });
35
-
36
- it("should update timestamp on scroll", () => {
37
- monitor.start();
38
- const before = Date.now();
39
- window.dispatchEvent(new Event("scroll"));
40
- expect(monitor.getLastActivityTimestamp()).toBeGreaterThanOrEqual(before);
41
- });
42
-
43
- it("should reflect the most recent activity time", () => {
44
- monitor.start();
45
-
46
- window.dispatchEvent(new Event("keydown"));
47
- const first = monitor.getLastActivityTimestamp();
48
-
49
- vi.advanceTimersByTime(5000);
50
- window.dispatchEvent(new Event("click"));
51
- const second = monitor.getLastActivityTimestamp();
52
-
53
- expect(second).toBeGreaterThan(first);
54
- });
55
-
56
- it("should not update timestamp after stop", () => {
57
- monitor.start();
58
- window.dispatchEvent(new Event("keydown"));
59
- const timestampBeforeStop = monitor.getLastActivityTimestamp();
60
-
61
- monitor.stop();
62
- vi.advanceTimersByTime(5000);
63
- window.dispatchEvent(new Event("click"));
64
-
65
- expect(monitor.getLastActivityTimestamp()).toBe(timestampBeforeStop);
66
- });
67
- });
@@ -1,26 +0,0 @@
1
- const ACTIVITY_EVENTS = ["keydown", "click", "scroll"] as const;
2
-
3
- export interface ActivityMonitor {
4
- start: () => void;
5
- stop: () => void;
6
- getLastActivityTimestamp: () => number;
7
- }
8
-
9
- export class ActivityMonitorImpl implements ActivityMonitor {
10
- private lastActivityTimestamp = 0;
11
- private readonly activityHandler = () => {
12
- this.lastActivityTimestamp = Date.now();
13
- };
14
-
15
- start = () => {
16
- for (const e of ACTIVITY_EVENTS) window.addEventListener(e, this.activityHandler);
17
- };
18
-
19
- stop = () => {
20
- for (const e of ACTIVITY_EVENTS) window.removeEventListener(e, this.activityHandler);
21
- };
22
-
23
- getLastActivityTimestamp = () => this.lastActivityTimestamp;
24
- }
25
-
26
- export const createActivityMonitor = (): ActivityMonitor => new ActivityMonitorImpl();
@@ -1,37 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { primariaApiFactory, shellApi } from "./api";
3
-
4
- /**
5
- * Contracte d'aïllament: l'objecte que rep un plugin no porta cap operació destructiva o
6
- * d'arrencada del shell. Es comprova l'objecte en temps d'execució, no el tipus: un plugin de
7
- * tercers no passa pel nostre TypeScript.
8
- */
9
- describe("PrimariaApi que rep un plugin", () => {
10
- const hostOnly: [string, string][] = [
11
- ["broker", "_clear"],
12
- ["broker", "clear"],
13
- ["regionManager", "_removeAllViews"],
14
- ["regionManager", "_destroy"],
15
- ["regionManager", "destroy"],
16
- ["globalStateManager", "clearData"],
17
- ["quickActionBusyManager", "clearAll"],
18
- ["interactionService", "dispose"],
19
- ["tokenManager", "setInitialTokens"],
20
- ["contextManager", "initializeContext"],
21
- ];
22
-
23
- for (const api of [primariaApiFactory({ pluginId: "plugin-x" }), shellApi]) {
24
- it.each(hostOnly)(`${api.pluginInfo.pluginId}: %s no exposa %s`, (manager, method) => {
25
- expect(method in (api as any)[manager]).toBe(false);
26
- });
27
- }
28
-
29
- it("conserva les operacions públiques", () => {
30
- const api = primariaApiFactory({ pluginId: "plugin-x" });
31
- expect(typeof api.tokenManager.getToken).toBe("function");
32
- expect(typeof api.tokenManager.refreshToken).toBe("function");
33
- expect(typeof api.contextManager.getContext).toBe("function");
34
- expect(typeof api.interactionService.confirm).toBe("function");
35
- expect(typeof api.interactionService.confirmMessage).toBe("function");
36
- });
37
- });
package/src/api/api.ts DELETED
@@ -1,119 +0,0 @@
1
- import { ApiFactory, HarmonixApi, PluginInfo, RegionManager, createRegionHost, createRegionManager } from "@uxland/harmonix";
2
- import { primariaShellId } from "../constants";
3
- import { createBroker } from "./broker/factory";
4
- import { PrimariaBroker } from "./broker/primaria-broker";
5
- import { EcapEventManager, createEcapEventManager } from "./ecap-event-manager/ecap-event-manager";
6
- import { ExitGuardManager, ExitGuardManagerImpl } from "./exit-guard-manager/exit-guard-manager";
7
- import { PrimariaGlobalStateManager, createGlobalStateManager } from "./global-state/global-state";
8
- import { createActivityMonitor } from "./activity-monitor/activity-monitor";
9
- import { HttpClient, createHttpClient } from "./http-client/http-client";
10
- import { PrimariaInteractionService } from "./interaction-service";
11
- import { createSessionRefreshTimer } from "./session-refresh-timer/session-refresh-timer";
12
- import { PrimariaInteractionServiceImpl } from "./interaction-service/interaction-service-impl";
13
- import { createLocaleManager } from "./localization/localization";
14
- import { PrimariaNotificationService } from "./notification-service/notification-service";
15
- import { PrimariaNotificationServiceImpl } from "./notification-service/notification.service-impl";
16
- import { PdfViewerManager, createPdfViewerManager } from "./pdf-viewer-manager/pdf-viewer-manager";
17
- import { QuickActionBusyManager, QuickActionBusyManagerImpl } from "./quick-action-busy-manager/quick-action-busy-manager";
18
- import { PrimariaRegionManager, createRegionManagerProxy, removeAllViews } from "./region-manager/region-manager";
19
- import { TokenManager, createTokenManager } from "./token-manager/token-manager";
20
- import { UserManager, createUserManager } from "./user-manager/user-manager";
21
- import { PrimariaImportDataManager, ImportDataManagerImpl } from "./import-data-manager";
22
- import { EcapContext, PrimariaContextManager, createContextManager } from "./context-manager/context-manager";
23
-
24
- const { broker, clear: clearBroker } = createBroker();
25
-
26
- export interface PrimariaApi extends HarmonixApi {
27
- httpClient: HttpClient;
28
- interactionService: PrimariaInteractionService;
29
- notificationService: PrimariaNotificationService;
30
- broker: PrimariaBroker;
31
- regionManager: PrimariaRegionManager;
32
- globalStateManager: PrimariaGlobalStateManager;
33
- contextManager: PrimariaContextManager;
34
- tokenManager: TokenManager;
35
- userManager: UserManager;
36
- ecapEventManager: EcapEventManager;
37
- exitGuardManager: ExitGuardManager;
38
- quickActionBusyManager: QuickActionBusyManager;
39
- pdfViewerManager: PdfViewerManager;
40
- importDataManager: PrimariaImportDataManager;
41
- }
42
-
43
- const regionManager: RegionManager = createRegionManager("primaria");
44
- export const PrimariaRegionHost: any = createRegionHost(regionManager as any);
45
- const tokenManager = createTokenManager(broker);
46
- const userManager = createUserManager(tokenManager);
47
- export const activityMonitor = createActivityMonitor();
48
- export const sessionRefreshTimer = createSessionRefreshTimer(tokenManager, activityMonitor);
49
- const globalStateManager: PrimariaGlobalStateManager = createGlobalStateManager(broker);
50
- const contextManager = createContextManager();
51
- const exitGuardManager = new ExitGuardManagerImpl();
52
- const quickActionBusyManager = new QuickActionBusyManagerImpl(broker);
53
- const interactionService = new PrimariaInteractionServiceImpl();
54
- const notificationService = new PrimariaNotificationServiceImpl();
55
- const ecapEventManager = createEcapEventManager(globalStateManager);
56
- const pdfViewerManager = createPdfViewerManager(broker, notificationService);
57
- const importDataManager = new ImportDataManagerImpl(interactionService);
58
-
59
- // Vistes del que reben els plugins. Els singletons de token, context i interacció tenen mètodes
60
- // que només pot fer servir el host (fixar els tokens, fixar el context d'ECAP, tancar tots els
61
- // diàlegs). Amagar-los al tipus no n'hi ha prou: un plugin de tercers no passa pel nostre
62
- // TypeScript. Per això el plugin rep un objecte que no els porta.
63
- const publicTokenManager: TokenManager = {
64
- getToken: () => tokenManager.getToken(),
65
- refreshToken: () => tokenManager.refreshToken(),
66
- };
67
- const publicContextManager: PrimariaContextManager = {
68
- getContext: () => contextManager.getContext(),
69
- };
70
- const publicInteractionService: PrimariaInteractionService = {
71
- confirm: (data, componentUI, options) => interactionService.confirm(data, componentUI, options),
72
- confirmMessage: (message, options) => interactionService.confirmMessage(message, options),
73
- };
74
-
75
- /**
76
- * Operacions destructives o d'arrencada que només pot fer el shell. No surten de `index.ts` i cap
77
- * no és a la `PrimariaApi`, així que cap plugin no les pot cridar.
78
- */
79
- export const shellInternals = {
80
- /** Fixa els tokens inicials. Només funciona una vegada (`Token already initialized`). */
81
- setInitialTokens: (accessToken: string, refreshToken: string) => tokenManager.setInitialTokens(accessToken, refreshToken),
82
- initializeContext: (context: EcapContext) => contextManager.initializeContext(context),
83
- /** Desmunta totes les vistes de totes les regions i espera que acabin. */
84
- removeAllViews: () => removeAllViews(regionManager),
85
- destroyRegions: () => regionManager.destroy(),
86
- clearBroker,
87
- closeAllDialogs: () => interactionService.dispose(),
88
- };
89
-
90
- /**
91
- * Factory function that creates a Primaria API instance.
92
- *
93
- * @param {PluginInfo} pluginInfo - Information about the plugin
94
- * @return {PrimariaApi} The created Primaria API instance
95
- */
96
- export const primariaApiFactory: ApiFactory<PrimariaApi> = (pluginInfo: PluginInfo): PrimariaApi => {
97
- const regionManagerProxy = createRegionManagerProxy(pluginInfo, regionManager, broker);
98
-
99
- return {
100
- pluginInfo: pluginInfo,
101
- regionManager: regionManagerProxy,
102
- httpClient: createHttpClient(tokenManager, broker),
103
- broker,
104
- createLocaleManager: createLocaleManager(pluginInfo.pluginId) as any,
105
- globalStateManager,
106
- contextManager: publicContextManager,
107
- tokenManager: publicTokenManager,
108
- userManager,
109
- ecapEventManager,
110
- exitGuardManager,
111
- quickActionBusyManager,
112
- interactionService: publicInteractionService,
113
- notificationService,
114
- pdfViewerManager,
115
- importDataManager,
116
- };
117
- };
118
-
119
- export const shellApi = primariaApiFactory({ pluginId: primariaShellId }) as PrimariaApi;
@@ -1,39 +0,0 @@
1
- import { PLUGIN_BROKER_EVENTS } from "@primaria/plugins-core";
2
-
3
- /**
4
- * Diccionari centralitzat d'events del broker.
5
- * Events agrupats per plugin/iniciativa per facilitar l'organització i escalabilitat.
6
- *
7
- * Els grups que hi ha aquí escrits són els que el shell publica o consumeix. Els
8
- * contractes entre iniciatives, en què el shell no és part, es declaren a
9
- * `@primaria/plugins-core` i s'hi escampen a sota: el shell només fa de canal de
10
- * distribució, perquè és l'únic paquet que instal·len les iniciatives externes.
11
- * Els que porten resposta no són aquí, sinó a `BROKER_REQUESTS`.
12
- */
13
- export const BROKER_EVENTS = {
14
- ...PLUGIN_BROKER_EVENTS,
15
- activityHistory: {
16
- refreshDataRequested: "refresh_history_data_requested",
17
- errorLoadingData: "error_loading_activity_history_data",
18
- searched: "activity_history_searched",
19
- filtersCleaned: "activity_history_filters_cleaned",
20
- diagnosticFilterDeactivated: "activity_history_diagnostic_filter_deactivated",
21
- injectAsyncHistoryItemsRequest: "inject_async_history_items_request",
22
- addHistoryItemRequest: "add_history_item_request",
23
- addHistoryItemsRequest: "add_history_items_request",
24
- updateHistoryItemRequest: "update_history_item_request",
25
- removeHistoryItemRequest: "remove_history_item_request",
26
- },
27
- shell: {
28
- appCrashed: "appCrashed",
29
- mainViewChanged: "mainViewChanged",
30
- refreshTokenFailed: "refreshTokenFailed",
31
- mpidHeaderInvalid: "mpidHeaderInvalid",
32
- quickActionBusyChanged: "quickActionBusyChanged",
33
- },
34
- administrativeManagement: {
35
- tabSelected: "administrative_management_tab_selected",
36
- },
37
- } as const;
38
-
39
- export type BrokerEvents = typeof BROKER_EVENTS;
@@ -1,20 +0,0 @@
1
- import { PLUGIN_BROKER_REQUESTS } from "@primaria/plugins-core";
2
-
3
- /**
4
- * Diccionari centralitzat de requests del broker: els missatges que porten
5
- * resposta i es criden amb `send` / `registerRequest`.
6
- *
7
- * Separat de `BROKER_EVENTS` a propòsit. Un event (`publish`/`subscribe`) i una
8
- * request (`send`/`registerRequest`) són mecanismes diferents, i barrejar-los
9
- * en una constant que es diu "events" deixa qui l'autocompleta sense saber quin
10
- * dels dos ha de cridar.
11
- *
12
- * Ara mateix només conté contractes entre iniciatives, declarats a
13
- * `@primaria/plugins-core`. Si algun dia el shell exposa requests pròpies,
14
- * s'escriuen aquí al costat, igual que a `BROKER_EVENTS`.
15
- */
16
- export const BROKER_REQUESTS = {
17
- ...PLUGIN_BROKER_REQUESTS,
18
- } as const;
19
-
20
- export type BrokerRequests = typeof BROKER_REQUESTS;