@uxland/primary-shell 5.3.2 → 5.3.4

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 (51) hide show
  1. package/dist/index.js +6323 -6232
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +444 -435
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/UI/internal-views/lower-nav-menu-views.d.ts +1 -0
  6. package/dist/primary/shell/src/UI/internal-views/upper-nav-views.d.ts +1 -0
  7. package/dist/primary/shell/src/features/get-user-info/backend-adapter.d.ts +1 -0
  8. package/dist/primary/shell/src/features/visit/finalize-visit/bootstrapper.d.ts +4 -0
  9. package/dist/primary/shell/src/features/visit/finalize-visit/component/finalize-visit-button.d.ts +9 -0
  10. package/dist/primary/shell/src/features/visit/finalize-visit/component/template.d.ts +3 -0
  11. package/dist/primary/shell/src/features/visit/finalize-visit/handler.d.ts +8 -0
  12. package/dist/primary/shell/src/features/visit/finalize-visit/request.d.ts +4 -0
  13. package/dist/primary/shell/src/features/visit/get-visit-id/bootstrapper.d.ts +4 -0
  14. package/dist/primary/shell/src/features/visit/get-visit-id/handler.d.ts +9 -0
  15. package/dist/primary/shell/src/features/visit/get-visit-id/request.d.ts +2 -0
  16. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/business-rules.d.ts +2 -1
  17. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/model.d.ts +9 -1
  18. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/selectors.d.ts +4 -4
  19. package/dist/primary/shell/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.d.ts +1 -1
  20. package/dist/primary/shell/src/locales.d.ts +1 -0
  21. package/package.json +4 -4
  22. package/src/UI/bootstrapper.ts +2 -0
  23. package/src/UI/components/bootstrapper.ts +2 -0
  24. package/src/UI/components/primaria-shell/shell-header/template.ts +2 -1
  25. package/src/UI/internal-views/handle-views.ts +13 -0
  26. package/src/UI/internal-views/lower-nav-menu-views.ts +19 -0
  27. package/src/UI/internal-views/upper-nav-views.ts +200 -0
  28. package/src/bootstrapper.ts +0 -2
  29. package/src/features/bootstrapper.ts +6 -0
  30. package/src/features/get-user-info/backend-adapter.ts +14 -3
  31. package/src/features/visit/finalize-visit/bootstrapper.ts +17 -0
  32. package/src/features/visit/finalize-visit/component/finalize-visit-button.ts +36 -0
  33. package/src/features/visit/finalize-visit/component/template.ts +9 -0
  34. package/src/features/visit/finalize-visit/handler.ts +18 -0
  35. package/src/features/visit/finalize-visit/request.ts +3 -0
  36. package/src/features/visit/get-visit-id/bootstrapper.ts +17 -0
  37. package/src/features/visit/get-visit-id/handler.ts +27 -0
  38. package/src/features/visit/get-visit-id/request.ts +1 -0
  39. package/src/internal-plugins/activity-history/activity-history-item/domain/business-rules.ts +25 -1
  40. package/src/internal-plugins/activity-history/activity-history-item/domain/is-valid-history-item/is-valid-history-item.test.ts +48 -6
  41. package/src/internal-plugins/activity-history/activity-history-item/domain/is-valid-history-item/is-valid-history-item.ts +13 -7
  42. package/src/internal-plugins/activity-history/activity-history-item/domain/model.ts +10 -1
  43. package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/activity-history-timeline.ts +20 -3
  44. package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/styles.css +8 -4
  45. package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/template.ts +10 -10
  46. package/src/internal-plugins/activity-history/activity-history-item/list/group-history-items/group-history-items.ts +7 -4
  47. package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.test.ts +6 -6
  48. package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.ts +4 -7
  49. package/src/locales.ts +1 -0
  50. package/src/handle-views.ts +0 -255
  51. /package/dist/primary/shell/src/{handle-views.d.ts → UI/internal-views/handle-views.d.ts} +0 -0
@@ -0,0 +1,27 @@
1
+ import { TYPES } from "../../../infrastructure/ioc/types";
2
+ import { inject } from "inversify";
3
+ import { PrimariaApi } from "../../../api/api";
4
+ import { GetVisitId } from "./request";
5
+
6
+ export class GetVisitIdHandler {
7
+ constructor(
8
+ @inject(TYPES.primaryApi) private api: PrimariaApi,
9
+ ) {}
10
+ async handle(message: GetVisitId): Promise<string | undefined> {
11
+ try {
12
+ const visitIdData = await this.getVisitId();
13
+ console.log("Visit ID obtenido: ", visitIdData);
14
+ return visitIdData;
15
+ } catch (error) {
16
+ this.api.notificationService.error(error.message);
17
+ return undefined;
18
+ }
19
+ }
20
+
21
+ private getVisitId(): Promise<string | undefined> {
22
+ const urlParams = new URLSearchParams(window.location.search);
23
+ console.log("Paràmetres de la URL: ", window.location.search);
24
+ const visitId = urlParams.get("visit_id");
25
+ return Promise.resolve(visitId || undefined);
26
+ }
27
+ }
@@ -0,0 +1 @@
1
+ export class GetVisitId {}
@@ -1,5 +1,29 @@
1
- import { IActivityHistoryItem } from "./model";
1
+ import { IActivityHistoryItem, IActivityHistoryItemWithComponent } from "./model";
2
2
 
3
3
  export function shouldShowRole(item: IActivityHistoryItem): boolean {
4
4
  return !item.professional.speciality.description;
5
5
  }
6
+
7
+ export const hasItemDivider = (
8
+ item: IActivityHistoryItemWithComponent,
9
+ items: IActivityHistoryItemWithComponent[],
10
+ ): boolean => {
11
+ const currentIndex = items.findIndex((i) => i.id === item.id);
12
+
13
+ if (currentIndex === -1) {
14
+ // Item no encontrado, por seguridad
15
+ return false;
16
+ }
17
+
18
+ if (currentIndex === items.length - 1) {
19
+ // Es el último elemento
20
+ return true;
21
+ }
22
+
23
+ const currentDate = new Date(item.date).getTime();
24
+ const nextDate = new Date(items[currentIndex + 1].date).getTime();
25
+
26
+ const diffMinutes = Math.abs(nextDate - currentDate) / (1000 * 60);
27
+
28
+ return diffMinutes > 15;
29
+ };
@@ -13,7 +13,7 @@ describe("isValidActivityHistoryItem", () => {
13
13
  role: { id: "role-1", description: "Lead Doctor" },
14
14
  },
15
15
  relevant: true,
16
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
16
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
17
17
  center: { id: "center-1", description: "Main Hospital" },
18
18
  up: { id: "up-1", description: "Unit A" },
19
19
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -33,7 +33,7 @@ describe("isValidActivityHistoryItem", () => {
33
33
  role: { id: "role-1", description: "Lead Doctor" },
34
34
  },
35
35
  relevant: true,
36
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
36
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
37
37
  center: { id: "center-1", description: "Main Hospital" },
38
38
  up: { id: "up-1", description: "Unit A" },
39
39
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -53,7 +53,7 @@ describe("isValidActivityHistoryItem", () => {
53
53
  role: { id: "role-1", description: "Lead Doctor" },
54
54
  },
55
55
  relevant: true,
56
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
56
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
57
57
  center: { id: "center-1", description: "Main Hospital" },
58
58
  up: { id: "up-1", description: "Unit A" },
59
59
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -74,7 +74,7 @@ describe("isValidActivityHistoryItem", () => {
74
74
  role: { id: "role-1", description: "Lead Doctor" },
75
75
  },
76
76
  relevant: true,
77
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
77
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
78
78
  center: { id: "center-1", description: "Main Hospital" },
79
79
  up: { id: "up-1", description: "Unit A" },
80
80
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -105,6 +105,48 @@ describe("isValidActivityHistoryItem", () => {
105
105
  expect(isValidActivityHistoryItem(invalidItem)).toBe(false);
106
106
  });
107
107
 
108
+ it('should return true if "diagnostics" is null', () => {
109
+ const validItem = {
110
+ id: "123",
111
+ date: "2023-10-07",
112
+ professional: {
113
+ id: "prof-1",
114
+ name: "Dr. John Doe",
115
+ speciality: { id: "spec-1", description: "Cardiology" },
116
+ role: { id: "role-1", description: "Lead Doctor" },
117
+ },
118
+ relevant: true,
119
+ diagnostics: null,
120
+ center: { id: "center-1", description: "Main Hospital" },
121
+ up: { id: "up-1", description: "Unit A" },
122
+ ep: { id: "ep-1", description: "Emergency Room" },
123
+ service: { id: "service-1", description: "Cardiac Service" },
124
+ };
125
+
126
+ expect(isValidActivityHistoryItem(validItem)).toBe(true);
127
+ });
128
+
129
+ it('should return false if "diagnostics" are invalid', () => {
130
+ const invalidItem = {
131
+ id: "123",
132
+ date: "2023-10-07",
133
+ professional: {
134
+ id: "prof-1",
135
+ name: "Dr. John Doe",
136
+ speciality: { id: "spec-1", description: "Cardiology" },
137
+ role: { id: "role-1", description: "Lead Doctor" },
138
+ },
139
+ relevant: true,
140
+ diagnostics: [{ codi: null, cataleg: "001", descripcio: "High Blood Pressure" }],
141
+ center: { id: "center-1", description: "Main Hospital" },
142
+ up: { id: "up-1", description: "Unit A" },
143
+ ep: { id: "ep-1", description: "Emergency Room" },
144
+ service: { id: "service-1", description: "Cardiac Service" },
145
+ };
146
+
147
+ expect(isValidActivityHistoryItem(invalidItem)).toBe(false);
148
+ });
149
+
108
150
  it('should return false if "relevant" is not a boolean', () => {
109
151
  const invalidItem = {
110
152
  id: "123",
@@ -116,7 +158,7 @@ describe("isValidActivityHistoryItem", () => {
116
158
  role: { id: "role-1", description: "Lead Doctor" },
117
159
  },
118
160
  relevant: "not a boolean", // Should be boolean
119
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
161
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
120
162
  center: { id: "center-1", description: "Main Hospital" },
121
163
  up: { id: "up-1", description: "Unit A" },
122
164
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -136,7 +178,7 @@ describe("isValidActivityHistoryItem", () => {
136
178
  role: { id: "role-1", description: "Lead Doctor" },
137
179
  },
138
180
  relevant: true,
139
- diagnostics: [{ id: "diag-1", description: "High Blood Pressure" }],
181
+ diagnostics: [{ codi: "diag-1", cataleg: "001", descripcio: "High Blood Pressure" }],
140
182
  center: { id: "center-1", description: "Main Hospital" },
141
183
  up: { id: "up-1", description: "Unit A" },
142
184
  ep: { id: "ep-1", description: "Emergency Room" },
@@ -23,14 +23,20 @@ export const isValidActivityHistoryItem = (obj: IActivityHistoryItem) => {
23
23
 
24
24
  // Comprueba las propiedades de un diagnóstico
25
25
  const hasValidDiagnostics = (diagnostics) => {
26
+ if (diagnostics === null || diagnostics === undefined) {
27
+ return true;
28
+ }
29
+
26
30
  return (
27
- (diagnostics === null || isArray(diagnostics)) && // null or array
28
- (diagnostics === null ||
29
- diagnostics.every(
30
- (diagnostic) =>
31
- diagnostic === null ||
32
- (diagnostic && isString(diagnostic.id) && isString(diagnostic.description)), // Permite que un diagnóstico sea null o tenga id y description válidos
33
- ))
31
+ Array.isArray(diagnostics) &&
32
+ diagnostics.every(
33
+ (diagnostic) =>
34
+ diagnostic !== null &&
35
+ diagnostic !== undefined &&
36
+ typeof diagnostic.codi === "string" &&
37
+ typeof diagnostic.cataleg === "string" &&
38
+ typeof diagnostic.descripcio === "string",
39
+ )
34
40
  );
35
41
  };
36
42
 
@@ -14,12 +14,21 @@ export type TSearchActivityHistoryItemPredicate = (
14
14
  item: IActivityHistoryItem,
15
15
  ) => boolean;
16
16
 
17
+ export interface IActivityHistoryDiagnostic {
18
+ codi: string;
19
+ cataleg: string;
20
+ descripcio: string;
21
+ idEcap: string;
22
+ idCipds: string;
23
+ idCdr: string;
24
+ }
25
+
17
26
  export interface IActivityHistoryItem {
18
27
  id: string;
19
28
  date: string;
20
29
  professional: IOwner;
21
30
  relevant: boolean;
22
- diagnostics: IEntityDescription[];
31
+ diagnostics: IActivityHistoryDiagnostic[];
23
32
  center: IEntityDescription;
24
33
  up: IEntityDescription;
25
34
  ep: IEntityDescription;
@@ -1,4 +1,4 @@
1
- import { LitElement, css, html, unsafeCSS } from "lit";
1
+ import { LitElement, PropertyValues, css, html, unsafeCSS } from "lit";
2
2
  import { customElement } from "lit/decorators.js";
3
3
  import { connectedProperty } from "../../../../infrastructure/state/connected-property";
4
4
  import { IActivityHistoryGroup } from "../../../domain/model";
@@ -12,11 +12,27 @@ import styles from "./styles.css?inline";
12
12
  import { template } from "./template";
13
13
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
14
14
 
15
+ const createZIndexStyles = (max: number) => {
16
+ let styles = "";
17
+ for (let i = 0; i <= max; i++) {
18
+ styles += `.zIndex${i} { z-index: ${i} !important; }\n`;
19
+ }
20
+ return styles;
21
+ };
22
+
15
23
  //@ts-ignore
16
24
  @customElement("activity-history-timeline")
17
25
  export class ActivityHistoryTimeline extends LitElement {
18
26
  render() {
19
- return html`${template(this)}`;
27
+ const maxIndex = this.historyGroups?.length ?? 0;
28
+ const dynamicStyles = createZIndexStyles(maxIndex);
29
+
30
+ return html`
31
+ <style>
32
+ ${unsafeCSS(dynamicStyles)}
33
+ </style>
34
+ ${template(this)}
35
+ `;
20
36
  }
21
37
 
22
38
  static styles = css`
@@ -37,7 +53,8 @@ export class ActivityHistoryTimeline extends LitElement {
37
53
 
38
54
  _hasUpdatedOnce = false;
39
55
 
40
- firstUpdated() {
56
+ firstUpdated(_changeProps: PropertyValues) {
57
+ super.firstUpdated(_changeProps);
41
58
  this._hasUpdatedOnce = true;
42
59
  }
43
60
 
@@ -60,8 +60,8 @@
60
60
  display: flex;
61
61
  flex-direction: column;
62
62
  gap: 16px;
63
- .item {
64
- border-bottom: var(--dss-border-width-sm) solid va(--color-neutral-200);
63
+ .item[has-divider] {
64
+ border-bottom: var(--dss-border-width-sm) solid var(--color-neutral-200);
65
65
  &:last-of-type {
66
66
  border: none;
67
67
  }
@@ -71,6 +71,10 @@
71
71
  display: flex;
72
72
  flex-direction: column;
73
73
  gap: 16px;
74
+ border-bottom: var(--dss-border-width-sm) solid var(--color-neutral-200);
75
+ &:last-of-type {
76
+ border: none;
77
+ }
74
78
  .diagnostics__header {
75
79
  display: flex;
76
80
  flex-direction: row;
@@ -80,8 +84,8 @@
80
84
  .diagnostics__items {
81
85
  display: flex;
82
86
  flex-direction: column;
83
- .item {
84
- border-bottom: var(--dss-border-width-sm) solid va(--color-neutral-200);
87
+ .item[has-divider] {
88
+ border-bottom: var(--dss-border-width-sm) solid var(--color-neutral-200);
85
89
  &:last-of-type {
86
90
  border: none;
87
91
  }
@@ -1,11 +1,11 @@
1
1
  import { html, nothing } from "lit";
2
2
  import { ActivityHistoryTimeline } from "./activity-history-timeline";
3
3
  import { repeat } from "lit/directives/repeat.js";
4
- import { IEntityDescription } from "@primaria/plugins-core";
5
4
  import { format } from "date-fns";
6
5
  import notFound from "../../../../../../UI/images/not-found.svg";
7
6
  import { ifDefined } from "lit/directives/if-defined.js";
8
7
  import {
8
+ IActivityHistoryDiagnostic,
9
9
  IActivityHistoryGroup,
10
10
  IActivityHistoryItem,
11
11
  IActivityHistoryItemWithComponent,
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../../domain/model";
14
14
  import { translate } from "../../../../localization";
15
15
  import { virtualize } from "@lit-labs/virtualizer/virtualize.js";
16
- import { shouldShowRole } from "../../../domain/business-rules";
16
+ import { hasItemDivider, shouldShowRole } from "../../../domain/business-rules";
17
17
 
18
18
  export const template = (props: ActivityHistoryTimeline) => {
19
19
  if (!props._hasUpdatedOnce) {
@@ -27,15 +27,15 @@ export const template = (props: ActivityHistoryTimeline) => {
27
27
  <div class="virtualizer">
28
28
  ${virtualize({
29
29
  items: props.historyGroups,
30
- renderItem: (itemGroup: IActivityHistoryGroup) => html`
31
- <div class="visit" data-date=${ifDefined(itemGroup.items[0]?.date || itemGroup.subGroups[0]?.items[0]?.date)}>
30
+ renderItem: (itemGroup: IActivityHistoryGroup, index: number) => html`
31
+ <div class="visit zIndex${props.historyGroups.length - index}" data-date=${ifDefined(itemGroup.items[0]?.date || itemGroup.subGroups[0]?.items[0]?.date)}>
32
32
  ${visitHeaderTemplate(props, itemGroup.items[0] || itemGroup.subGroups[0]?.items[0])}
33
33
  <div class="visit__items">
34
34
  ${repeat(
35
35
  itemGroup.items,
36
36
  (item) => item.id,
37
37
  (item: IActivityHistoryItemWithComponent) =>
38
- html`<div class="item">${item.component}</div> `,
38
+ html`<div class="item" ?has-divider=${hasItemDivider(item, itemGroup.items as IActivityHistoryItemWithComponent[])}>${item.component}</div> `,
39
39
  )}
40
40
  ${repeat(
41
41
  itemGroup.subGroups,
@@ -47,7 +47,7 @@ export const template = (props: ActivityHistoryTimeline) => {
47
47
  subGroup.items,
48
48
  (item) => item.id,
49
49
  (item: IActivityHistoryItemWithComponent) =>
50
- html`<div class="item">${item?.component}</div>`,
50
+ html`<div class="item" ?has-divider=${hasItemDivider(item, subGroup.items as IActivityHistoryItemWithComponent[])}>${item?.component}</div>`,
51
51
  )}
52
52
  </div>
53
53
  </div>
@@ -114,13 +114,13 @@ const diagnosticHeaderTemplate = (item: IActivityHistoryItem | undefined) =>
114
114
 
115
115
  ${item.diagnostics
116
116
  .filter(
117
- (diagnostic: IEntityDescription) =>
118
- diagnostic.description != null && diagnostic.description.trim() !== "",
117
+ (diagnostic: IActivityHistoryDiagnostic) =>
118
+ diagnostic.descripcio != null && diagnostic.descripcio.trim() !== "",
119
119
  )
120
120
  .map(
121
- (diagnostic: IEntityDescription) =>
121
+ (diagnostic: IActivityHistoryDiagnostic) =>
122
122
  html`<dss-badge text=${
123
- diagnostic.description?.toUpperCase() as string
123
+ diagnostic.descripcio?.toUpperCase() as string
124
124
  } state="info" size="sm" outlined></dss-badge>`,
125
125
  )}
126
126
  </div>
@@ -1,8 +1,8 @@
1
- import { IEntityDescription } from "@primaria/plugins-core";
2
1
  import {
3
2
  IActivityHistoryItem,
4
3
  IActivityHistoryGroup,
5
4
  IActivityHistorySubGroup,
5
+ IActivityHistoryDiagnostic,
6
6
  } from "../../domain/model";
7
7
 
8
8
  const isSameVisit = (item1: IActivityHistoryItem, item2: IActivityHistoryItem): boolean => {
@@ -26,13 +26,16 @@ const withinEightHours = (date1: Date, date2: Date): boolean => {
26
26
  return timeDifference <= 8 * 60 * 60 * 1000; // 8 hours in milliseconds
27
27
  };
28
28
 
29
- const areSameDiagnostics = (diag1: IEntityDescription[], diag2: IEntityDescription[]): boolean => {
29
+ const areSameDiagnostics = (
30
+ diag1: IActivityHistoryDiagnostic[],
31
+ diag2: IActivityHistoryDiagnostic[],
32
+ ): boolean => {
30
33
  if (diag1.length !== diag2.length) {
31
34
  return false;
32
35
  }
33
36
 
34
- const sortedDiag1 = diag1.map((d) => d.id).sort();
35
- const sortedDiag2 = diag2.map((d) => d.id).sort();
37
+ const sortedDiag1 = diag1.map((d) => d.codi).sort();
38
+ const sortedDiag2 = diag2.map((d) => d.codi).sort();
36
39
 
37
40
  return sortedDiag1.every((id, index) => id === sortedDiag2[index]);
38
41
  };
@@ -12,8 +12,8 @@ describe("getUniqueObjects", () => {
12
12
  const result = getUniqueObjects(items, ["data", "id"], ["data", "label"]);
13
13
 
14
14
  expect(result).toEqual([
15
- { id: "1", description: "Item 1 (duplicate)" }, // 👈 el último
16
- { id: "2", description: "Item 2" },
15
+ { id: "1", title: "Item 1 (duplicate)" }, // 👈 el último
16
+ { id: "2", title: "Item 2" },
17
17
  ]);
18
18
  });
19
19
 
@@ -26,7 +26,7 @@ describe("getUniqueObjects", () => {
26
26
 
27
27
  const result = getUniqueObjects(items, ["data", "id"], ["data", "label"]);
28
28
 
29
- expect(result).toEqual([{ id: "1", description: "Valid" }]);
29
+ expect(result).toEqual([{ id: "1", title: "Valid" }]);
30
30
  });
31
31
 
32
32
  it("should return an empty array if input is empty", () => {
@@ -43,8 +43,8 @@ describe("getUniqueObjects", () => {
43
43
  const result = getUniqueObjects(items, ["a", "b", "c", "id"], ["a", "b", "c", "name"]);
44
44
 
45
45
  expect(result).toEqual([
46
- { id: "x1", description: "Deep 1" },
47
- { id: "x2", description: "Deep 2" },
46
+ { id: "x1", title: "Deep 1" },
47
+ { id: "x2", title: "Deep 2" },
48
48
  ]);
49
49
  });
50
50
 
@@ -56,6 +56,6 @@ describe("getUniqueObjects", () => {
56
56
 
57
57
  const result = getUniqueObjects(items, ["a", "b", "id"], ["a", "b", "name"]);
58
58
 
59
- expect(result).toEqual([{ id: "1", description: "Good" }]);
59
+ expect(result).toEqual([{ id: "1", title: "Good" }]);
60
60
  });
61
61
  });
@@ -2,18 +2,15 @@ export function getUniqueObjects<T>(
2
2
  items: T[],
3
3
  propPathId: string[],
4
4
  propPathDescription: string[],
5
- ): { id: string; description: string }[] {
5
+ ): { id: string; title: string }[] {
6
6
  return Array.from(
7
7
  items
8
8
  .map((item) => ({
9
9
  id: propPathId.reduce((acc, key) => acc?.[key], item),
10
- description: propPathDescription.reduce((acc, key) => acc?.[key], item),
10
+ title: propPathDescription.reduce((acc, key) => acc?.[key], item),
11
11
  }))
12
- .filter((obj) => typeof obj.id === "string" && typeof obj.description === "string")
13
- .reduce(
14
- (map, obj) => map.set(obj.id, obj),
15
- new Map<string, { id: string; description: string }>(),
16
- )
12
+ .filter((obj) => typeof obj.id === "string" && typeof obj.title === "string")
13
+ .reduce((map, obj) => map.set(obj.id, obj), new Map<string, { id: string; title: string }>())
17
14
  .values(),
18
15
  );
19
16
  }
package/src/locales.ts CHANGED
@@ -36,6 +36,7 @@ export const locales = {
36
36
  toggleMenuClose: "Tancar menú",
37
37
  toggleMenuOpen: "Expandir menú",
38
38
  askExit: "Atenció, vols sortir igualment?",
39
+ finalizeVisit: "Finalitzar visita",
39
40
  },
40
41
  clinicalMonitoring: {
41
42
  title: "Seguiment clínic",