Skip to content

Commit 821b712

Browse files
committed
Merge branch 'dev' into hotfix/PIN-7381_resolve-bug-multiple-agreements-management-in-eservice-page
2 parents 9b0d9ea + ddc12a4 commit 821b712

File tree

51 files changed

+457
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+457
-147
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "interop-dashboard-frontend",
3-
"version": "1.6.0",
3+
"version": "1.6.3",
44
"type": "module",
55
"scripts": {
66
"dev": "vite",

public/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ window.pagopa_env = {
2222
FEATURE_FLAG_NOTIFICATION_CONFIG: 'true',
2323
FEATURE_FLAG_ESERVICE_PERSONAL_DATA: 'true',
2424
FEATURE_FLAG_USE_SIGNED_DOCUMENT: 'true',
25+
AVATAR_BASEPATH: 'https://selc-u-checkout-cdn-endpoint.azureedge.net',
2526
}

setupTests.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const testConfigs = {
2727
FEATURE_FLAG_NOTIFICATION_CONFIG: 'true',
2828
FEATURE_FLAG_ESERVICE_PERSONAL_DATA: 'true',
2929
FEATURE_FLAG_USE_SIGNED_DOCUMENT: 'true',
30+
AVATAR_BASEPATH: 'http://selc-u-checkout-cdn-endpoint.azureedge.net',
3031
}
3132

3233
// runs a cleanup after each test case (e.g. clearing jsdom)

src/App.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@ import { MaintenanceBanner } from './components/shared/banners/MaintenanceBanner
1515
import { FirstLoadingSpinner } from './components/shared/FirstLoadingSpinner'
1616
import { queryClient } from './config/query-client'
1717
import type { EnvironmentBannerProps } from '@pagopa/mui-italia'
18+
1819
import { AuthQueries } from './api/auth'
20+
import i18n from './config/react-i18next'
21+
22+
// --- Init application ----
23+
24+
const urlParams = new URLSearchParams(window.location.search)
25+
const redirectUrl = urlParams.get('redirectUrl')
1926

20-
queryClient.prefetchQuery(AuthQueries.getSessionToken())
27+
if (redirectUrl) {
28+
const selfCareIdentityToken = window.location.hash.replace('#id=', '')
29+
const url = `/ui/${i18n.language}${redirectUrl}#id=${selfCareIdentityToken}`
30+
window.location.replace(url)
31+
} else {
32+
queryClient.prefetchQuery(AuthQueries.getSessionToken())
33+
}
34+
35+
// end init ---
2136

2237
function App() {
2338
const { t } = useTranslation('shared-components')
24-
2539
let envBannerProps: EnvironmentBannerProps | undefined = undefined
2640

2741
if (STAGE === 'UAT') {

src/api/api.generatedTypes.ts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ export interface CatalogEService {
623623
id: string
624624
name: string
625625
description: string
626-
producer: CompactOrganization
626+
producer: CatalogTenant
627627
isMine: boolean
628628
activeDescriptor?: CompactDescriptor
629629
/** Indicates if there are unread notifications for this e-service */
@@ -827,6 +827,16 @@ export interface CompactOrganization {
827827
hasUnreadNotifications?: boolean
828828
}
829829

830+
export interface CatalogTenant {
831+
/** @format uuid */
832+
id: string
833+
name: string
834+
/** Indicates if there are unread notifications for this organization */
835+
hasUnreadNotifications?: boolean
836+
/** @format uuid */
837+
selfcareId?: string
838+
}
839+
830840
export type TenantKind = 'PA' | 'PRIVATE' | 'GSP' | 'SCP'
831841

832842
export type TargetTenantKind = 'PA' | 'PRIVATE'
@@ -1162,7 +1172,7 @@ export interface CatalogPurposeTemplate {
11621172
targetTenantKind: TargetTenantKind
11631173
purposeTitle: string
11641174
purposeDescription: string
1165-
creator: CompactOrganization
1175+
creator: CatalogTenant
11661176
}
11671177

11681178
export interface CatalogPurposeTemplates {
@@ -2169,7 +2179,7 @@ export interface CatalogEServiceTemplate {
21692179
id: string
21702180
name: string
21712181
description: string
2172-
creator: CompactOrganization
2182+
creator: CatalogTenant
21732183
publishedVersion: CompactEServiceTemplateVersion
21742184
}
21752185

@@ -2228,7 +2238,7 @@ export interface Problem {
22282238
*/
22292239
detail?: string
22302240
/** @minItems 1 */
2231-
errors: ProblemError[]
2241+
errors?: ProblemError[]
22322242
}
22332243

22342244
export interface UpdateEServiceTemplateVersionSeed {
@@ -3272,6 +3282,15 @@ export interface MarkNotificationsAsUnreadPayload {
32723282
ids: string[]
32733283
}
32743284

3285+
export interface GetNotificationDeeplinkParams {
3286+
/** The selfcare ID for the institution (optional, falls back to generic URL if not provided) */
3287+
selfcareId?: string
3288+
/** The type of the notification */
3289+
notificationType: string
3290+
/** The id of the entity */
3291+
entityId: string
3292+
}
3293+
32753294
export namespace Consumers {
32763295
/**
32773296
* @description retrieves a list of consumer agreements
@@ -8562,6 +8581,7 @@ export namespace InAppNotifications {
85628581
* @name GetNotifications
85638582
* @summary Retrieves a list of notifications
85648583
* @request GET:/inAppNotifications
8584+
* @secure
85658585
*/
85668586
export namespace GetNotifications {
85678587
export type RequestParams = {}
@@ -8727,6 +8747,7 @@ export namespace TenantNotificationConfigs {
87278747
* @name GetTenantNotificationConfig
87288748
* @summary Retrieve the tenant's notification configuration
87298749
* @request GET:/tenantNotificationConfigs
8750+
* @secure
87308751
*/
87318752
export namespace GetTenantNotificationConfig {
87328753
export type RequestParams = {}
@@ -8741,6 +8762,7 @@ export namespace TenantNotificationConfigs {
87418762
* @name UpdateTenantNotificationConfig
87428763
* @summary Update the tenant's notification configuration
87438764
* @request POST:/tenantNotificationConfigs
8765+
* @secure
87448766
*/
87458767
export namespace UpdateTenantNotificationConfig {
87468768
export type RequestParams = {}
@@ -8758,6 +8780,7 @@ export namespace UserNotificationConfigs {
87588780
* @name GetUserNotificationConfig
87598781
* @summary Retrieve the user's notification configuration
87608782
* @request GET:/userNotificationConfigs
8783+
* @secure
87618784
*/
87628785
export namespace GetUserNotificationConfig {
87638786
export type RequestParams = {}
@@ -8772,6 +8795,7 @@ export namespace UserNotificationConfigs {
87728795
* @name UpdateUserNotificationConfig
87738796
* @summary Update the user's notification configuration
87748797
* @request POST:/userNotificationConfigs
8798+
* @secure
87758799
*/
87768800
export namespace UpdateUserNotificationConfig {
87778801
export type RequestParams = {}
@@ -8789,6 +8813,7 @@ export namespace EmailDeepLink {
87898813
* @name GetNotificationDeeplink
87908814
* @summary Redirect the user to the correct deepLink based on notification type and entity id
87918815
* @request GET:/emailDeepLink/{notificationType}/{entityId}
8816+
* @secure
87928817
*/
87938818
export namespace GetNotificationDeeplink {
87948819
export type RequestParams = {
@@ -8797,7 +8822,10 @@ export namespace EmailDeepLink {
87978822
/** The id of the entity */
87988823
entityId: string
87998824
}
8800-
export type RequestQuery = {}
8825+
export type RequestQuery = {
8826+
/** The selfcare ID for the institution (optional, falls back to generic URL if not provided) */
8827+
selfcareId?: string
8828+
}
88018829
export type RequestBody = never
88028830
export type RequestHeaders = {}
88038831
export type ResponseBody = any

src/api/maintenance/maintenance.services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { INTEROP_RESOURCES_BASE_URL, APP_MODE } from '@/config/env'
2-
import { BannerData } from '@/hooks/bannerHooks/utils'
2+
import type { BannerData } from '@/hooks/bannerHooks/utils'
33
import axios from 'axios'
44

55
async function getMaintenanceJson() {

src/api/notification/notification.services.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axiosInstance from '@/config/axios'
2+
import axios from 'axios'
23
import {
34
APP_MODE,
45
BACKEND_FOR_FRONTEND_URL,
@@ -82,7 +83,7 @@ async function getNotificationsBannerConfigJson() {
8283
} as BannerData
8384
}
8485

85-
const response = await axiosInstance.get<BannerData>(
86+
const response = await axios.get<BannerData>(
8687
`${INTEROP_RESOURCES_BASE_URL}/notifications-window/data.json`
8788
)
8889
return response.data

src/api/purposeTemplate/__test__/purposeTemplate.downloads.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ vi.mock('react-i18next', () => ({
2121
t: (key: string) => {
2222
if (ns === 'mutations-feedback' && keyPrefix === 'purposeTemplate.downloadDocument') {
2323
return `mutations-feedback:purposeTemplate.downloadDocument.${key}`
24+
} else if (
25+
ns === 'mutations-feedback' &&
26+
keyPrefix === 'purposeTemplate.downloadRiskAnalysis'
27+
) {
28+
return `mutations-feedback:purposeTemplate.downloadRiskAnalysis.${key}`
2429
}
2530
return key
2631
},
@@ -84,4 +89,29 @@ describe('PurposeTemplateDownloads', () => {
8489
expect(result).toBe(mockDownloadFn)
8590
})
8691
})
92+
93+
describe('useDownloadSignedRiskAnalysis', () => {
94+
it('should call useDownloadFile with correct service and labels', () => {
95+
const mockUseDownloadFile = vi.fn().mockReturnValue(vi.fn())
96+
vi.mocked(useDownloadFile).mockImplementation(mockUseDownloadFile)
97+
98+
PurposeTemplateDownloads.useDownloadSignedRiskAnalysis()
99+
100+
expect(useDownloadFile).toHaveBeenCalledWith(
101+
PurposeTemplateServices.downloadSignedRiskAnalysis,
102+
{
103+
errorToastLabel: 'mutations-feedback:purposeTemplate.downloadRiskAnalysis.outcome.error',
104+
loadingLabel: 'mutations-feedback:purposeTemplate.downloadRiskAnalysis.loading',
105+
}
106+
)
107+
})
108+
109+
it('should return the function from useDownloadSignedRiskAnalysis', () => {
110+
const mockDownloadFn = vi.fn()
111+
vi.mocked(useDownloadFile).mockReturnValue(mockDownloadFn)
112+
113+
const result = PurposeTemplateDownloads.useDownloadSignedRiskAnalysis()
114+
expect(result).toBe(mockDownloadFn)
115+
})
116+
})
87117
})

src/api/purposeTemplate/__test__/purposeTemplate.services.test.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,6 @@ describe('PurposeTemplateServices', () => {
354354
`${BACKEND_FOR_FRONTEND_URL}/purposeTemplates/test-id/archive`
355355
)
356356
})
357-
358-
// TODO: Update this test when real API calls are implemented
359-
// it('should make correct API call to archive purpose template', async () => {
360-
// await PurposeTemplateServices.archivePurposeTemplate({ id: TEST_ID })
361-
//
362-
// expect(axiosInstance.post).toHaveBeenCalledWith(
363-
// `${BACKEND_FOR_FRONTEND_URL}/purposeTemplates/test-id/archive`
364-
// )
365-
// })
366357
})
367358

368359
describe('updateDocumentPrettyNameForAnnotation', () => {
@@ -382,4 +373,17 @@ describe('PurposeTemplateServices', () => {
382373
)
383374
})
384375
})
376+
377+
describe('downloadSignedRiskAnalysis', () => {
378+
it('should make correct API call with purpose template id', async () => {
379+
const purposeTemplateId = 'template-id'
380+
381+
await PurposeTemplateServices.downloadSignedRiskAnalysis({ purposeTemplateId })
382+
383+
expect(axiosInstance.get).toHaveBeenCalledWith(
384+
`${BACKEND_FOR_FRONTEND_URL}/purposeTemplates/${purposeTemplateId}/riskAnalysisDocument/signed`,
385+
{ responseType: 'arraybuffer' }
386+
)
387+
})
388+
})
385389
})

0 commit comments

Comments
 (0)