@uxland/primary-shell 7.38.4 → 7.39.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.
@@ -1,15 +1,12 @@
1
- import { IRegion } from '@uxland/regions';
1
+ import { LitElement } from 'lit';
2
2
  import { ConfirmationContentProps } from '../../interaction-service';
3
- declare const ImportDataManagerModal_base: any;
4
- export declare class ImportDataManagerModal extends ImportDataManagerModal_base implements ConfirmationContentProps<undefined, undefined> {
3
+ export declare class ImportDataManagerModal extends LitElement implements ConfirmationContentProps<undefined, undefined> {
5
4
  data: undefined;
6
5
  setResult: (result: undefined) => void;
7
6
  setIsValid: (isValid: boolean) => void;
8
7
  confirm: () => void;
9
8
  cancel: () => void;
10
- importDataRegion: IRegion | undefined;
11
9
  render(): import('lit').TemplateResult<1>;
12
10
  static styles: import('lit').CSSResult;
13
11
  _accept: () => void;
14
12
  }
15
- export {};
@@ -1,12 +1,13 @@
1
- import { PrimariaImportDataManager } from './import-data-manager';
1
+ import { ImportParams, PrimariaImportDataManager } from './import-data-manager';
2
2
  import { PrimariaInteractionService } from '../interaction-service/interaction-service';
3
3
  export declare class ImportDataManagerImpl implements PrimariaImportDataManager {
4
4
  private interactionService;
5
5
  private selectedItems;
6
6
  private currentImporterId;
7
+ private currentImportParams;
7
8
  private pluginTexts;
8
9
  constructor(interactionService: PrimariaInteractionService);
9
- import(importerId: string): Promise<{
10
+ import(importerId: string, params?: ImportParams): Promise<{
10
11
  accepted: boolean;
11
12
  data: Record<string, any[]>;
12
13
  text: {
@@ -23,5 +24,6 @@ export declare class ImportDataManagerImpl implements PrimariaImportDataManager
23
24
  };
24
25
  }): void;
25
26
  getCurrentImporterId(): string;
27
+ getCurrentImportParams(): ImportParams | undefined;
26
28
  private getConcatenatedText;
27
29
  }
@@ -1,5 +1,18 @@
1
+ export interface ImportParamsDiagnostic {
2
+ code: string;
3
+ catalog: string;
4
+ description: string;
5
+ }
6
+ export interface ImportParams {
7
+ /** Optional list of diagnostics the consumer wants the activity-history
8
+ * importer to filter by. If absent, the diagnostics filter is hidden.
9
+ * Plugins must map their own diagnostic shape to this common model. */
10
+ diagnostics?: ImportParamsDiagnostic[];
11
+ /** Open extension point for future per-importer parameters. */
12
+ [key: string]: unknown;
13
+ }
1
14
  export interface PrimariaImportDataManager {
2
- import(importerId: string): Promise<{
15
+ import(importerId: string, params?: ImportParams): Promise<{
3
16
  accepted: boolean;
4
17
  data: Record<string, any[]>;
5
18
  text: {
@@ -16,4 +29,7 @@ export interface PrimariaImportDataManager {
16
29
  };
17
30
  }): void;
18
31
  getCurrentImporterId(): string;
32
+ /** Returns the params the current importer was opened with (or undefined
33
+ * if no import is in progress). */
34
+ getCurrentImportParams(): ImportParams | undefined;
19
35
  }
@@ -10,6 +10,7 @@ export declare const shellRegions: {
10
10
  clinicalPathwaysSidenav: string;
11
11
  petitionerSidenav: string;
12
12
  importData: string;
13
+ importDataActivityHistory: string;
13
14
  };
14
15
  export declare const clinicalMonitoringRegions: {
15
16
  sidebar: string;
@@ -16,7 +16,7 @@ export * from './api/interaction-service';
16
16
  export { ExitShell } from './features/exit/request';
17
17
  export type { ExitShellPayload } from './features/exit/request';
18
18
  export type { IUserInfo } from './features/get-user-info/model';
19
- export type { IActivityHistoryItem } from '../../../plugins/activity-history/src/activity-history-item/domain/model';
19
+ export type { IActivityHistoryItem, IHistoryDataImporterContext, IHistoryDataImporterRules, } from '../../../plugins/activity-history/src/activity-history-item/domain/model';
20
20
  export type { InjectAsyncHistoryItemsPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-async-history-items/request';
21
21
  export type { AddHistoryItemPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-history-item/request';
22
22
  export type { AddHistoryItemsPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-history-items/request';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "7.38.4",
3
+ "version": "7.39.0",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -1,25 +1,17 @@
1
- import { IRegion, region } from "@uxland/regions";
2
1
  import { LitElement, css, html, unsafeCSS } from "lit";
3
2
  import { customElement } from "lit/decorators.js";
3
+ import { ConfirmationContentProps } from "../../interaction-service";
4
4
  import styles from "./styles.css?inline";
5
5
  import { template } from "./template";
6
- import { ConfirmationContentProps } from "../../interaction-service";
7
- import { PrimariaRegionHost, shellApi } from "../../api";
8
6
 
9
7
  @customElement("import-data-manager-modal")
10
- export class ImportDataManagerModal
11
- extends PrimariaRegionHost(LitElement)
12
- implements ConfirmationContentProps<undefined, undefined>
13
- {
8
+ export class ImportDataManagerModal extends LitElement implements ConfirmationContentProps<undefined, undefined> {
14
9
  data: undefined;
15
10
  setResult: (result: undefined) => void;
16
11
  setIsValid: (isValid: boolean) => void;
17
12
  confirm: () => void;
18
13
  cancel: () => void;
19
14
 
20
- @region({ targetId: "import-data-region", name: shellApi.regionManager.regions.shell.importData })
21
- importDataRegion: IRegion | undefined;
22
-
23
15
  render() {
24
16
  return html`${template(this)}`;
25
17
  }
@@ -3,8 +3,8 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  min-width: 500px;
6
- width: 90vw;
7
- height: 90vh;
6
+ width: 95vw;
7
+ height: 95vh;
8
8
  border-radius: var(--dss-radius-sm);
9
9
  overflow: hidden;
10
10
  }
@@ -27,23 +27,31 @@
27
27
 
28
28
  .content{
29
29
  display: grid;
30
- height: 100%;
31
- min-height: 1px;
30
+ flex: 1;
31
+ min-height: 0;
32
32
  grid-template-columns: 1fr 1fr;
33
- grid-auto-rows: 1fr;
34
33
  gap: 16px;
35
34
  padding: 16px;
36
- overflow-y: auto;
37
- max-height: calc(90vh - 120px);
38
35
  }
39
36
 
40
- .content > * {
37
+ .content > primaria-region {
38
+ width: 100%;
39
+ height: 100%;
40
+ min-height: 0;
41
+ }
42
+
43
+ .content primaria-region > div {
44
+ width: 100%;
45
+ height: 100%;
41
46
  border: 1px solid var(--color-neutral-200);
42
47
  border-radius: 8px;
43
48
  padding: 16px;
44
- background-color: var(--color-neutral-50);
45
- min-height: 200px;
46
- }
49
+ box-sizing: border-box;
50
+ }
51
+
52
+ .content > primaria-region[name="import-data-region"] > div {
53
+ overflow-y: auto;
54
+ }
47
55
 
48
56
  .footer {
49
57
  display: flex;
@@ -1,24 +1,33 @@
1
1
  import { html } from "lit";
2
2
  import { translate } from "../../../locales";
3
+ import { shellApi } from "../../api";
3
4
  import { ImportDataManagerModal } from "./component";
4
5
 
5
6
  export const template = (props: ImportDataManagerModal) => {
6
7
  return html`
7
8
  <div class="container">
8
- <!-- <div class="header">
9
- <div class="title">
10
- <div>${translate("importDataManager.title")}</div>
11
- </div>
12
- </div> -->
13
- <div class="content" id="import-data-region"></div>
14
- <div class="footer">
15
- <dss-button label="${translate("importDataManager.actions.cancel")}" @click="${() => {
16
- props.cancel();
17
- }}" size="md" variant="secondary"></dss-button>
18
- <dss-button label="${translate("importDataManager.actions.import")}" @click="${() => {
19
- props._accept();
20
- }}" size="md" variant="primary"></dss-button>
21
- </div>
9
+ <div class="content">
10
+ <primaria-region name="${shellApi.regionManager.regions.shell.importDataActivityHistory}"></primaria-region>
11
+ <primaria-region name="${shellApi.regionManager.regions.shell.importData}"></primaria-region>
12
+ </div>
13
+ <div class="footer">
14
+ <dss-button
15
+ label="${translate("importDataManager.actions.cancel")}"
16
+ @click="${() => {
17
+ props.cancel();
18
+ }}"
19
+ size="md"
20
+ variant="secondary"
21
+ ></dss-button>
22
+ <dss-button
23
+ label="${translate("importDataManager.actions.import")}"
24
+ @click="${() => {
25
+ props._accept();
26
+ }}"
27
+ size="md"
28
+ variant="primary"
29
+ ></dss-button>
30
+ </div>
22
31
  </div>
23
32
  `;
24
33
  };
@@ -1,6 +1,11 @@
1
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
- import { ImportDataManagerImpl } from './import-data-manager-impl';
3
- import { PrimariaInteractionService, ConfirmationOptions, ConfirmComponentUI, ConfirmationResult } from '../interaction-service/interaction-service';
2
+ import { ImportDataManagerImpl } from "./import-data-manager-impl";
3
+ import {
4
+ PrimariaInteractionService,
5
+ ConfirmationOptions,
6
+ ConfirmComponentUI,
7
+ ConfirmationResult,
8
+ } from "../interaction-service/interaction-service";
4
9
 
5
10
  // Mock del PrimariaInteractionService
6
11
  class MockInteractionService extends PrimariaInteractionService {
@@ -19,15 +24,12 @@ class MockInteractionService extends PrimariaInteractionService {
19
24
  return Promise.resolve(this.mockConfirmResult as ConfirmationResult<TResult | undefined>);
20
25
  }
21
26
 
22
- async confirmMessage(
23
- _message: string,
24
- _options?: ConfirmationOptions | undefined,
25
- ): Promise<ConfirmationResult> {
27
+ async confirmMessage(_message: string, _options?: ConfirmationOptions | undefined): Promise<ConfirmationResult> {
26
28
  return Promise.resolve({ confirmed: this.mockConfirmResult.confirmed, result: undefined });
27
29
  }
28
30
  }
29
31
 
30
- describe('ImportDataManagerImpl implements PrimariaImportDataManager', () => {
32
+ describe("ImportDataManagerImpl implements PrimariaImportDataManager", () => {
31
33
  let importDataManager: ImportDataManagerImpl;
32
34
  let mockInteractionService: MockInteractionService;
33
35
 
@@ -36,28 +38,28 @@ describe('ImportDataManagerImpl implements PrimariaImportDataManager', () => {
36
38
  importDataManager = new ImportDataManagerImpl(mockInteractionService);
37
39
  });
38
40
 
39
- describe('getCurrentImporterId', () => {
40
- it('should return empty string initially', () => {
41
- expect(importDataManager.getCurrentImporterId()).toBe('');
41
+ describe("getCurrentImporterId", () => {
42
+ it("should return empty string initially", () => {
43
+ expect(importDataManager.getCurrentImporterId()).toBe("");
42
44
  });
43
45
 
44
- it('should return the current importer ID after calling import', async () => {
46
+ it("should return the current importer ID after calling import", async () => {
45
47
  mockInteractionService.setMockConfirmResult({ confirmed: true });
46
48
 
47
- const promise = importDataManager.import('test-importer-123');
48
- expect(importDataManager.getCurrentImporterId()).toBe('test-importer-123');
49
+ const promise = importDataManager.import("test-importer-123");
50
+ expect(importDataManager.getCurrentImporterId()).toBe("test-importer-123");
49
51
 
50
52
  await promise;
51
- expect(importDataManager.getCurrentImporterId()).toBe('');
53
+ expect(importDataManager.getCurrentImporterId()).toBe("");
52
54
  });
53
55
  });
54
56
 
55
- describe('selectItems', () => {
56
- it('should store selected items correctly', () => {
57
+ describe("selectItems", () => {
58
+ it("should store selected items correctly", () => {
57
59
  const payload = {
58
- pluginId: 'test-plugin',
59
- data: [{ id: '1', name: 'Test Item' }],
60
- text: { raw: 'Test Item', html: '<p>Test Item</p>' }
60
+ pluginId: "test-plugin",
61
+ data: [{ id: "1", name: "Test Item" }],
62
+ text: { raw: "Test Item", html: "<p>Test Item</p>" },
61
63
  };
62
64
 
63
65
  importDataManager.selectItems(payload);
@@ -66,17 +68,17 @@ describe('ImportDataManagerImpl implements PrimariaImportDataManager', () => {
66
68
  expect(() => importDataManager.selectItems(payload)).not.toThrow();
67
69
  });
68
70
 
69
- it('should handle multiple plugin selections', () => {
71
+ it("should handle multiple plugin selections", () => {
70
72
  const payload1 = {
71
- pluginId: 'plugin-1',
72
- data: [{ id: '1', name: 'Item 1' }],
73
- text: { raw: 'Item 1', html: '<p>Item 1</p>' }
73
+ pluginId: "plugin-1",
74
+ data: [{ id: "1", name: "Item 1" }],
75
+ text: { raw: "Item 1", html: "<p>Item 1</p>" },
74
76
  };
75
77
 
76
78
  const payload2 = {
77
- pluginId: 'plugin-2',
78
- data: [{ id: '2', name: 'Item 2' }],
79
- text: { raw: 'Item 2', html: '<p>Item 2</p>' }
79
+ pluginId: "plugin-2",
80
+ data: [{ id: "2", name: "Item 2" }],
81
+ text: { raw: "Item 2", html: "<p>Item 2</p>" },
80
82
  };
81
83
 
82
84
  expect(() => {
@@ -85,17 +87,17 @@ describe('ImportDataManagerImpl implements PrimariaImportDataManager', () => {
85
87
  }).not.toThrow();
86
88
  });
87
89
 
88
- it('should overwrite previous selections from same plugin', () => {
90
+ it("should overwrite previous selections from same plugin", () => {
89
91
  const payload1 = {
90
- pluginId: 'test-plugin',
91
- data: [{ id: '1', name: 'First Item' }],
92
- text: { raw: 'First Item', html: '<p>First Item</p>' }
92
+ pluginId: "test-plugin",
93
+ data: [{ id: "1", name: "First Item" }],
94
+ text: { raw: "First Item", html: "<p>First Item</p>" },
93
95
  };
94
96
 
95
97
  const payload2 = {
96
- pluginId: 'test-plugin',
97
- data: [{ id: '2', name: 'Second Item' }],
98
- text: { raw: 'Second Item', html: '<p>Second Item</p>' }
98
+ pluginId: "test-plugin",
99
+ data: [{ id: "2", name: "Second Item" }],
100
+ text: { raw: "Second Item", html: "<p>Second Item</p>" },
99
101
  };
100
102
 
101
103
  expect(() => {
@@ -105,178 +107,180 @@ describe('ImportDataManagerImpl implements PrimariaImportDataManager', () => {
105
107
  });
106
108
  });
107
109
 
108
- describe('import', () => {
109
- it('should return accepted result with concatenated text when confirmed', async () => {
110
+ describe("import", () => {
111
+ it("should return accepted result with concatenated text when confirmed", async () => {
110
112
  mockInteractionService.setMockConfirmResult({ confirmed: true });
111
113
 
112
114
  // Mock the import to allow setting up items during the import process
113
115
  const originalConfirm = mockInteractionService.confirm.bind(mockInteractionService);
114
- vi.spyOn(mockInteractionService, 'confirm').mockImplementation(async (...args) => {
116
+ vi.spyOn(mockInteractionService, "confirm").mockImplementation(async (...args) => {
115
117
  // Setup some selected items during the import process (simulating user interaction)
116
118
  importDataManager.selectItems({
117
- pluginId: 'plugin-1',
118
- data: [{ id: '1', name: 'Item 1' }],
119
- text: { raw: 'Item 1', html: '<p>Item 1</p>' }
119
+ pluginId: "plugin-1",
120
+ data: [{ id: "1", name: "Item 1" }],
121
+ text: { raw: "Item 1", html: "<p>Item 1</p>" },
120
122
  });
121
123
 
122
124
  importDataManager.selectItems({
123
- pluginId: 'plugin-2',
124
- data: [{ id: '2', name: 'Item 2' }],
125
- text: { raw: 'Item 2', html: '<p>Item 2</p>' }
125
+ pluginId: "plugin-2",
126
+ data: [{ id: "2", name: "Item 2" }],
127
+ text: { raw: "Item 2", html: "<p>Item 2</p>" },
126
128
  });
127
129
 
128
130
  return originalConfirm(...args);
129
131
  });
130
132
 
131
- const result = await importDataManager.import('test-importer');
133
+ const result = await importDataManager.import("test-importer");
132
134
 
133
135
  expect(result.accepted).toBe(true);
134
136
  expect(result.data).toEqual({
135
- 'plugin-1': [{ id: '1', name: 'Item 1' }],
136
- 'plugin-2': [{ id: '2', name: 'Item 2' }]
137
+ "plugin-1": [{ id: "1", name: "Item 1" }],
138
+ "plugin-2": [{ id: "2", name: "Item 2" }],
137
139
  });
138
- expect(result.text.raw).toBe('Item 1\n\nItem 2');
139
- expect(result.text.html).toBe('<p>Item 1</p><br><br><p>Item 2</p>');
140
+ expect(result.text.raw).toBe("Item 1\n\nItem 2");
141
+ expect(result.text.html).toBe("<p>Item 1</p><br><br><p>Item 2</p>");
140
142
  });
141
143
 
142
- it('should return cancelled result with empty data when not confirmed', async () => {
144
+ it("should return cancelled result with empty data when not confirmed", async () => {
143
145
  mockInteractionService.setMockConfirmResult({ confirmed: false });
144
146
 
145
147
  // Setup some selected items
146
148
  importDataManager.selectItems({
147
- pluginId: 'plugin-1',
148
- data: [{ id: '1', name: 'Item 1' }],
149
- text: { raw: 'Item 1', html: '<p>Item 1</p>' }
149
+ pluginId: "plugin-1",
150
+ data: [{ id: "1", name: "Item 1" }],
151
+ text: { raw: "Item 1", html: "<p>Item 1</p>" },
150
152
  });
151
153
 
152
- const result = await importDataManager.import('test-importer');
154
+ const result = await importDataManager.import("test-importer");
153
155
 
154
156
  expect(result.accepted).toBe(false);
155
157
  expect(result.data).toEqual({});
156
- expect(result.text.raw).toBe('');
157
- expect(result.text.html).toBe('');
158
+ expect(result.text.raw).toBe("");
159
+ expect(result.text.html).toBe("");
158
160
  });
159
161
 
160
- it('should clear state after successful import', async () => {
162
+ it("should clear state after successful import", async () => {
161
163
  mockInteractionService.setMockConfirmResult({ confirmed: true });
162
164
 
163
165
  // Setup selected items
164
166
  importDataManager.selectItems({
165
- pluginId: 'test-plugin',
166
- data: [{ id: '1', name: 'Test Item' }],
167
- text: { raw: 'Test Item', html: '<p>Test Item</p>' }
167
+ pluginId: "test-plugin",
168
+ data: [{ id: "1", name: "Test Item" }],
169
+ text: { raw: "Test Item", html: "<p>Test Item</p>" },
168
170
  });
169
171
 
170
- await importDataManager.import('test-importer');
172
+ await importDataManager.import("test-importer");
171
173
 
172
174
  // Verify state is cleared
173
- expect(importDataManager.getCurrentImporterId()).toBe('');
175
+ expect(importDataManager.getCurrentImporterId()).toBe("");
174
176
 
175
177
  // Verify that subsequent import returns empty data
176
- const result = await importDataManager.import('another-importer');
178
+ const result = await importDataManager.import("another-importer");
177
179
  expect(result.data).toEqual({});
178
- expect(result.text.raw).toBe('');
179
- expect(result.text.html).toBe('');
180
+ expect(result.text.raw).toBe("");
181
+ expect(result.text.html).toBe("");
180
182
  });
181
183
 
182
- it('should clear state after cancelled import', async () => {
184
+ it("should clear state after cancelled import", async () => {
183
185
  mockInteractionService.setMockConfirmResult({ confirmed: false });
184
186
 
185
187
  // Setup selected items
186
188
  importDataManager.selectItems({
187
- pluginId: 'test-plugin',
188
- data: [{ id: '1', name: 'Test Item' }],
189
- text: { raw: 'Test Item', html: '<p>Test Item</p>' }
189
+ pluginId: "test-plugin",
190
+ data: [{ id: "1", name: "Test Item" }],
191
+ text: { raw: "Test Item", html: "<p>Test Item</p>" },
190
192
  });
191
193
 
192
- await importDataManager.import('test-importer');
194
+ await importDataManager.import("test-importer");
193
195
 
194
196
  // Verify state is cleared
195
- expect(importDataManager.getCurrentImporterId()).toBe('');
197
+ expect(importDataManager.getCurrentImporterId()).toBe("");
196
198
  });
197
199
 
198
- it('should handle empty selections', async () => {
200
+ it("should handle empty selections", async () => {
199
201
  mockInteractionService.setMockConfirmResult({ confirmed: true });
200
202
 
201
- const result = await importDataManager.import('test-importer');
203
+ const result = await importDataManager.import("test-importer");
202
204
 
203
205
  expect(result.accepted).toBe(true);
204
206
  expect(result.data).toEqual({});
205
- expect(result.text.raw).toBe('');
206
- expect(result.text.html).toBe('');
207
+ expect(result.text.raw).toBe("");
208
+ expect(result.text.html).toBe("");
207
209
  });
208
210
 
209
- it('should handle error and clear state', async () => {
211
+ it("should handle error and clear state", async () => {
210
212
  mockInteractionService.setMockConfirmResult({ confirmed: true });
211
213
 
212
214
  // Mock the interaction service to throw an error
213
- vi.spyOn(mockInteractionService, 'confirm').mockRejectedValueOnce(new Error('Test error'));
215
+ vi.spyOn(mockInteractionService, "confirm").mockRejectedValueOnce(new Error("Test error"));
214
216
 
215
217
  // Setup selected items
216
218
  importDataManager.selectItems({
217
- pluginId: 'test-plugin',
218
- data: [{ id: '1', name: 'Test Item' }],
219
- text: { raw: 'Test Item', html: '<p>Test Item</p>' }
219
+ pluginId: "test-plugin",
220
+ data: [{ id: "1", name: "Test Item" }],
221
+ text: { raw: "Test Item", html: "<p>Test Item</p>" },
220
222
  });
221
223
 
222
- await expect(importDataManager.import('test-importer')).rejects.toThrow('Test error');
224
+ await expect(importDataManager.import("test-importer")).rejects.toThrow("Test error");
223
225
 
224
226
  // Verify state is cleared even after error
225
- expect(importDataManager.getCurrentImporterId()).toBe('');
227
+ expect(importDataManager.getCurrentImporterId()).toBe("");
226
228
  });
227
229
 
228
- it('should handle text concatenation correctly with multiple plugins', async () => {
230
+ it("should handle text concatenation correctly with multiple plugins", async () => {
229
231
  mockInteractionService.setMockConfirmResult({ confirmed: true });
230
232
 
231
233
  // Mock the import to allow setting up items during the import process
232
234
  const originalConfirm = mockInteractionService.confirm.bind(mockInteractionService);
233
- vi.spyOn(mockInteractionService, 'confirm').mockImplementation(async (...args) => {
235
+ vi.spyOn(mockInteractionService, "confirm").mockImplementation(async (...args) => {
234
236
  importDataManager.selectItems({
235
- pluginId: 'diagnostics',
236
- data: [{ code: 'E11.9', name: 'Diabetes' }],
237
- text: { raw: 'E11.9 - Diabetes', html: '<p><strong>E11.9</strong> - Diabetes</p>' }
237
+ pluginId: "diagnostics",
238
+ data: [{ code: "E11.9", name: "Diabetes" }],
239
+ text: { raw: "E11.9 - Diabetes", html: "<p><strong>E11.9</strong> - Diabetes</p>" },
238
240
  });
239
241
 
240
242
  importDataManager.selectItems({
241
- pluginId: 'allergies',
242
- data: [{ name: 'Penicillin', severity: 'High' }],
243
- text: { raw: 'Penicillin - High severity', html: '<p><strong>Penicillin</strong> - High severity</p>' }
243
+ pluginId: "allergies",
244
+ data: [{ name: "Penicillin", severity: "High" }],
245
+ text: { raw: "Penicillin - High severity", html: "<p><strong>Penicillin</strong> - High severity</p>" },
244
246
  });
245
247
 
246
248
  return originalConfirm(...args);
247
249
  });
248
250
 
249
- const result = await importDataManager.import('test-importer');
251
+ const result = await importDataManager.import("test-importer");
250
252
 
251
- expect(result.text.raw).toBe('E11.9 - Diabetes\n\nPenicillin - High severity');
252
- expect(result.text.html).toBe('<p><strong>E11.9</strong> - Diabetes</p><br><br><p><strong>Penicillin</strong> - High severity</p>');
253
+ expect(result.text.raw).toBe("E11.9 - Diabetes\n\nPenicillin - High severity");
254
+ expect(result.text.html).toBe(
255
+ "<p><strong>E11.9</strong> - Diabetes</p><br><br><p><strong>Penicillin</strong> - High severity</p>",
256
+ );
253
257
  });
254
258
 
255
- it('should handle empty text values in concatenation', async () => {
259
+ it("should handle empty text values in concatenation", async () => {
256
260
  mockInteractionService.setMockConfirmResult({ confirmed: true });
257
261
 
258
262
  // Mock the import to allow setting up items during the import process
259
263
  const originalConfirm = mockInteractionService.confirm.bind(mockInteractionService);
260
- vi.spyOn(mockInteractionService, 'confirm').mockImplementation(async (...args) => {
264
+ vi.spyOn(mockInteractionService, "confirm").mockImplementation(async (...args) => {
261
265
  importDataManager.selectItems({
262
- pluginId: 'plugin-1',
263
- data: [{ id: '1' }],
264
- text: { raw: '', html: '' }
266
+ pluginId: "plugin-1",
267
+ data: [{ id: "1" }],
268
+ text: { raw: "", html: "" },
265
269
  });
266
270
 
267
271
  importDataManager.selectItems({
268
- pluginId: 'plugin-2',
269
- data: [{ id: '2' }],
270
- text: { raw: 'Item 2', html: '<p>Item 2</p>' }
272
+ pluginId: "plugin-2",
273
+ data: [{ id: "2" }],
274
+ text: { raw: "Item 2", html: "<p>Item 2</p>" },
271
275
  });
272
276
 
273
277
  return originalConfirm(...args);
274
278
  });
275
279
 
276
- const result = await importDataManager.import('test-importer');
280
+ const result = await importDataManager.import("test-importer");
277
281
 
278
- expect(result.text.raw).toBe('Item 2');
279
- expect(result.text.html).toBe('<p>Item 2</p>');
282
+ expect(result.text.raw).toBe("Item 2");
283
+ expect(result.text.html).toBe("<p>Item 2</p>");
280
284
  });
281
285
  });
282
- });
286
+ });