@pagopa/selfcare-common-frontend 1.34.103 → 1.34.104
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.
- package/CHANGELOG.md +9 -2
- package/build.info +2 -2
- package/lib/components/CustomPagination.d.ts +6 -1
- package/lib/components/CustomPagination.js +7 -8
- package/lib/redux/slices/productsSlice.d.ts +204 -0
- package/lib/redux/slices/productsSlice.js +26 -0
- package/lib/utils/constants.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
#### [v1.34.
|
|
7
|
+
#### [v1.34.104](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.104)
|
|
8
8
|
|
|
9
|
+
- created a new reducer for products [`#338`](https://github.com/pagopa/selfcare-common-frontend/pull/338)
|
|
9
10
|
- Add new util to check for pec email [`#336`](https://github.com/pagopa/selfcare-common-frontend/pull/336)
|
|
10
11
|
- reset type module [`#335`](https://github.com/pagopa/selfcare-common-frontend/pull/335)
|
|
11
12
|
- update to esm [`#334`](https://github.com/pagopa/selfcare-common-frontend/pull/334)
|
|
@@ -161,10 +162,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
161
162
|
- Bump rimraf from 3.0.2 to 6.0.1 [`e6941b9`](https://github.com/pagopa/selfcare-common-frontend/commit/e6941b9e6b05c973d991e2470a851b5ca03926ce)
|
|
162
163
|
- Used a environment variable to manage correct links in the footer based to product and actual environment [`960e2fb`](https://github.com/pagopa/selfcare-common-frontend/commit/960e2fbaa8aa8f79061639b26dc1a27f28b8aae3)
|
|
163
164
|
|
|
164
|
-
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.
|
|
165
|
+
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.103...v1.35.0)
|
|
165
166
|
|
|
166
167
|
> 20 July 2023
|
|
167
168
|
|
|
169
|
+
#### [v1.34.103](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.102...v1.34.103)
|
|
170
|
+
|
|
171
|
+
> 8 April 2026
|
|
172
|
+
|
|
173
|
+
- [SELC-8372] Feat: [AR-34] Label in the name [`#8372`](https://pagopa.atlassian.net/browse/8372)
|
|
174
|
+
|
|
168
175
|
#### [v1.34.102](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.101...v1.34.102)
|
|
169
176
|
|
|
170
177
|
> 26 March 2026
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
tags/v1.29.0~1^2
|
|
1
|
+
20260421.1 - selfcare-common-frontend.deploy(268390)
|
|
2
|
+
tags/v1.29.0~1^2 39119491e40cba824e428ea851eb6424f183d834
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Page } from '../model/Page';
|
|
2
3
|
import { PageRequest } from '../model/PageRequest';
|
|
3
4
|
type Props = {
|
|
@@ -7,7 +8,11 @@ type Props = {
|
|
|
7
8
|
sort?: string;
|
|
8
9
|
/** The function to be invoked if the user change page */
|
|
9
10
|
onPageRequest: (r: PageRequest) => void;
|
|
11
|
+
/** The variant of the pagination component */
|
|
12
|
+
variant?: 'outlined' | 'text';
|
|
13
|
+
/** The component to control the page size */
|
|
14
|
+
pageSizeControl?: React.ReactNode;
|
|
10
15
|
};
|
|
11
16
|
/** Selfcare custom table available pages component */
|
|
12
|
-
export default function CustomPagination({ page, onPageRequest, sort }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default function CustomPagination({ page, onPageRequest, sort, variant, pageSizeControl, }: Readonly<Props>): import("react/jsx-runtime").JSX.Element;
|
|
13
18
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Grid, Pagination } from '@mui/material';
|
|
3
3
|
import PaginationItem from '@mui/material/PaginationItem';
|
|
4
|
-
import React from 'react';
|
|
5
4
|
function defaultLabelDisplayedRows(from, to, count) {
|
|
6
5
|
// eslint-disable-next-line sonarjs/no-nested-template-literals
|
|
7
6
|
return `${from}-${to} di ${count !== -1 ? count : `più di ${to}`}`;
|
|
@@ -13,14 +12,14 @@ const getLabelDisplayedRowsTo = (count, page, size) => {
|
|
|
13
12
|
return size === -1 ? count : Math.min(count, (page + 1) * size);
|
|
14
13
|
};
|
|
15
14
|
/** Selfcare custom table available pages component */
|
|
16
|
-
export default function CustomPagination({ page, onPageRequest, sort }) {
|
|
15
|
+
export default function CustomPagination({ page, onPageRequest, sort, variant, pageSizeControl, }) {
|
|
17
16
|
const count = page.totalElements;
|
|
18
17
|
const from = count === 0 ? 0 : page.number * page.size + 1;
|
|
19
18
|
const to = getLabelDisplayedRowsTo(count, page.number, page.size);
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
return (_jsxs(Grid, { container: true, sx: { padding: '0 10px' }, children: [_jsx(Grid, { item: true, xs: 6, display: "flex", justifyContent: "start", alignItems: 'center', children: pageSizeControl ?? defaultLabelDisplayedRows(from, to, count) }), _jsx(Grid, { item: true, xs: 6, display: "flex", justifyContent: "end", alignItems: 'center', children: page.totalElements > page.size && (_jsx(Pagination, { sx: { display: 'flex' }, color: "primary", shape: "rounded", page: page.number + 1, count: page.totalPages, renderItem: (props2) => (_jsx(PaginationItem, { ...props2, sx: { border: 'none' }, variant: variant ?? 'outlined' })), onChange: (_event, value) => (onPageRequest({
|
|
20
|
+
page: value - 1,
|
|
21
|
+
size: page.size,
|
|
22
|
+
sort,
|
|
23
|
+
}),
|
|
24
|
+
window.scrollTo(0, 0)) })) })] }));
|
|
26
25
|
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
export declare enum StatusEnum {
|
|
3
|
+
'ACTIVE' = "ACTIVE",
|
|
4
|
+
'TESTING' = "TESTING",
|
|
5
|
+
'PHASE_OUT' = "PHASE_OUT",
|
|
6
|
+
'INACTIVE' = "INACTIVE"
|
|
7
|
+
}
|
|
8
|
+
export interface SubProductResource {
|
|
9
|
+
/** Product's unique identifier */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Product's title */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Product's onBoarding status */
|
|
14
|
+
productOnBoardingStatus: 'ACTIVE' | 'PENDING' | 'INACTIVE';
|
|
15
|
+
/** Product's status */
|
|
16
|
+
status: StatusEnum;
|
|
17
|
+
/** If a product is delegable to a technical partner */
|
|
18
|
+
delegable: boolean;
|
|
19
|
+
/** Product's depict image */
|
|
20
|
+
imageUrl: string;
|
|
21
|
+
/** Product's logo */
|
|
22
|
+
logo: string;
|
|
23
|
+
/** Product logo's background color */
|
|
24
|
+
logoBgColor: string;
|
|
25
|
+
/** Product's description */
|
|
26
|
+
description: string;
|
|
27
|
+
/** URL that redirects to the public information webpage of the product */
|
|
28
|
+
urlPublic: string;
|
|
29
|
+
/** If a product is invoiceable */
|
|
30
|
+
invoiceable: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface Product {
|
|
33
|
+
description: string;
|
|
34
|
+
id: string;
|
|
35
|
+
logo: string;
|
|
36
|
+
title: string;
|
|
37
|
+
urlBO: string;
|
|
38
|
+
backOfficeEnvironmentConfigurations?: Array<{
|
|
39
|
+
environment?: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
}>;
|
|
42
|
+
urlPublic?: string;
|
|
43
|
+
tag?: string;
|
|
44
|
+
status: StatusEnum;
|
|
45
|
+
imageUrl: string;
|
|
46
|
+
subProducts?: Array<SubProductResource>;
|
|
47
|
+
logoBgColor?: string;
|
|
48
|
+
delegable: boolean;
|
|
49
|
+
invoiceable?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const InitialState: never[];
|
|
52
|
+
export declare const productsSlice: import("@reduxjs/toolkit").Slice<Product[], {
|
|
53
|
+
setProducts: (state: {
|
|
54
|
+
description: string;
|
|
55
|
+
id: string;
|
|
56
|
+
logo: string;
|
|
57
|
+
title: string;
|
|
58
|
+
urlBO: string;
|
|
59
|
+
backOfficeEnvironmentConfigurations?: {
|
|
60
|
+
environment?: string | undefined;
|
|
61
|
+
url?: string | undefined;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
urlPublic?: string | undefined;
|
|
64
|
+
tag?: string | undefined;
|
|
65
|
+
status: StatusEnum;
|
|
66
|
+
imageUrl: string;
|
|
67
|
+
subProducts?: {
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
productOnBoardingStatus: "ACTIVE" | "PENDING" | "INACTIVE";
|
|
71
|
+
status: StatusEnum;
|
|
72
|
+
delegable: boolean;
|
|
73
|
+
imageUrl: string;
|
|
74
|
+
logo: string;
|
|
75
|
+
logoBgColor: string;
|
|
76
|
+
description: string;
|
|
77
|
+
urlPublic: string;
|
|
78
|
+
invoiceable: boolean;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
logoBgColor?: string | undefined;
|
|
81
|
+
delegable: boolean;
|
|
82
|
+
invoiceable?: boolean | undefined;
|
|
83
|
+
}[], action: PayloadAction<Array<Product>>) => {
|
|
84
|
+
[x: number]: Product | {
|
|
85
|
+
description: string;
|
|
86
|
+
id: string;
|
|
87
|
+
logo: string;
|
|
88
|
+
title: string;
|
|
89
|
+
urlBO: string;
|
|
90
|
+
backOfficeEnvironmentConfigurations?: {
|
|
91
|
+
environment?: string | undefined;
|
|
92
|
+
url?: string | undefined;
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
urlPublic?: string | undefined;
|
|
95
|
+
tag?: string | undefined;
|
|
96
|
+
status: StatusEnum;
|
|
97
|
+
imageUrl: string;
|
|
98
|
+
subProducts?: {
|
|
99
|
+
id: string;
|
|
100
|
+
title: string;
|
|
101
|
+
productOnBoardingStatus: "ACTIVE" | "PENDING" | "INACTIVE";
|
|
102
|
+
status: StatusEnum;
|
|
103
|
+
delegable: boolean;
|
|
104
|
+
imageUrl: string;
|
|
105
|
+
logo: string;
|
|
106
|
+
logoBgColor: string;
|
|
107
|
+
description: string;
|
|
108
|
+
urlPublic: string;
|
|
109
|
+
invoiceable: boolean;
|
|
110
|
+
}[] | undefined;
|
|
111
|
+
logoBgColor?: string | undefined;
|
|
112
|
+
delegable: boolean;
|
|
113
|
+
invoiceable?: boolean | undefined;
|
|
114
|
+
};
|
|
115
|
+
length: number;
|
|
116
|
+
toString(): string;
|
|
117
|
+
toLocaleString(): string;
|
|
118
|
+
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
119
|
+
pop(): Product | undefined;
|
|
120
|
+
push(...items: Product[]): number;
|
|
121
|
+
concat(...items: ConcatArray<Product>[]): Product[];
|
|
122
|
+
concat(...items: (Product | ConcatArray<Product>)[]): Product[];
|
|
123
|
+
join(separator?: string): string;
|
|
124
|
+
reverse(): Product[];
|
|
125
|
+
shift(): Product | undefined;
|
|
126
|
+
slice(start?: number, end?: number): Product[];
|
|
127
|
+
sort(compareFn?: ((a: Product, b: Product) => number) | undefined): Product[];
|
|
128
|
+
splice(start: number, deleteCount?: number): Product[];
|
|
129
|
+
splice(start: number, deleteCount: number, ...items: Product[]): Product[];
|
|
130
|
+
unshift(...items: Product[]): number;
|
|
131
|
+
indexOf(searchElement: Product, fromIndex?: number): number;
|
|
132
|
+
lastIndexOf(searchElement: Product, fromIndex?: number): number;
|
|
133
|
+
every<S extends Product>(predicate: (value: Product, index: number, array: Product[]) => value is S, thisArg?: any): this is S[];
|
|
134
|
+
every(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): boolean;
|
|
135
|
+
some(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): boolean;
|
|
136
|
+
forEach(callbackfn: (value: Product, index: number, array: Product[]) => void, thisArg?: any): void;
|
|
137
|
+
map<U>(callbackfn: (value: Product, index: number, array: Product[]) => U, thisArg?: any): U[];
|
|
138
|
+
filter<S extends Product>(predicate: (value: Product, index: number, array: Product[]) => value is S, thisArg?: any): S[];
|
|
139
|
+
filter(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): Product[];
|
|
140
|
+
reduce(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product): Product;
|
|
141
|
+
reduce(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product, initialValue: Product): Product;
|
|
142
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: Product, currentIndex: number, array: Product[]) => U, initialValue: U): U;
|
|
143
|
+
reduceRight(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product): Product;
|
|
144
|
+
reduceRight(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product, initialValue: Product): Product;
|
|
145
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: Product, currentIndex: number, array: Product[]) => U, initialValue: U): U;
|
|
146
|
+
find<S extends Product>(predicate: (value: Product, index: number, obj: Product[]) => value is S, thisArg?: any): S | undefined;
|
|
147
|
+
find(predicate: (value: Product, index: number, obj: Product[]) => unknown, thisArg?: any): Product | undefined;
|
|
148
|
+
findIndex(predicate: (value: Product, index: number, obj: Product[]) => unknown, thisArg?: any): number;
|
|
149
|
+
fill(value: Product, start?: number, end?: number): Product[];
|
|
150
|
+
copyWithin(target: number, start: number, end?: number): Product[];
|
|
151
|
+
entries(): ArrayIterator<[number, Product]>;
|
|
152
|
+
keys(): ArrayIterator<number>;
|
|
153
|
+
values(): ArrayIterator<Product>;
|
|
154
|
+
includes(searchElement: Product, fromIndex?: number): boolean;
|
|
155
|
+
flatMap<U, This = undefined>(callback: (this: This, value: Product, index: number, array: Product[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
156
|
+
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
157
|
+
[Symbol.iterator](): ArrayIterator<Product>;
|
|
158
|
+
[Symbol.unscopables]: {
|
|
159
|
+
[x: number]: boolean | undefined;
|
|
160
|
+
length?: boolean | undefined;
|
|
161
|
+
toString?: boolean | undefined;
|
|
162
|
+
toLocaleString?: boolean | undefined;
|
|
163
|
+
pop?: boolean | undefined;
|
|
164
|
+
push?: boolean | undefined;
|
|
165
|
+
concat?: boolean | undefined;
|
|
166
|
+
join?: boolean | undefined;
|
|
167
|
+
reverse?: boolean | undefined;
|
|
168
|
+
shift?: boolean | undefined;
|
|
169
|
+
slice?: boolean | undefined;
|
|
170
|
+
sort?: boolean | undefined;
|
|
171
|
+
splice?: boolean | undefined;
|
|
172
|
+
unshift?: boolean | undefined;
|
|
173
|
+
indexOf?: boolean | undefined;
|
|
174
|
+
lastIndexOf?: boolean | undefined;
|
|
175
|
+
every?: boolean | undefined;
|
|
176
|
+
some?: boolean | undefined;
|
|
177
|
+
forEach?: boolean | undefined;
|
|
178
|
+
map?: boolean | undefined;
|
|
179
|
+
filter?: boolean | undefined;
|
|
180
|
+
reduce?: boolean | undefined;
|
|
181
|
+
reduceRight?: boolean | undefined;
|
|
182
|
+
find?: boolean | undefined;
|
|
183
|
+
findIndex?: boolean | undefined;
|
|
184
|
+
fill?: boolean | undefined;
|
|
185
|
+
copyWithin?: boolean | undefined;
|
|
186
|
+
entries?: boolean | undefined;
|
|
187
|
+
keys?: boolean | undefined;
|
|
188
|
+
values?: boolean | undefined;
|
|
189
|
+
includes?: boolean | undefined;
|
|
190
|
+
flatMap?: boolean | undefined;
|
|
191
|
+
flat?: boolean | undefined;
|
|
192
|
+
[Symbol.iterator]?: boolean | undefined;
|
|
193
|
+
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
194
|
+
at?: boolean | undefined;
|
|
195
|
+
};
|
|
196
|
+
at(index: number): Product | undefined;
|
|
197
|
+
};
|
|
198
|
+
resetProducts: () => never[];
|
|
199
|
+
}, "products", "products", import("@reduxjs/toolkit").SliceSelectors<Product[]>>;
|
|
200
|
+
export declare const setProducts: import("@reduxjs/toolkit").ActionCreatorWithPayload<Product[], "products/setProducts">, resetProducts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"products/resetProducts">;
|
|
201
|
+
export declare const productsReducer: import("redux").Reducer<Product[]>;
|
|
202
|
+
export declare const selectProducts: (state: {
|
|
203
|
+
products: Array<Product>;
|
|
204
|
+
}) => Product[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable functional/immutable-data */
|
|
2
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
export var StatusEnum;
|
|
4
|
+
(function (StatusEnum) {
|
|
5
|
+
StatusEnum["ACTIVE"] = "ACTIVE";
|
|
6
|
+
StatusEnum["TESTING"] = "TESTING";
|
|
7
|
+
StatusEnum["PHASE_OUT"] = "PHASE_OUT";
|
|
8
|
+
StatusEnum["INACTIVE"] = "INACTIVE";
|
|
9
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
10
|
+
export const InitialState = [];
|
|
11
|
+
export const productsSlice = createSlice({
|
|
12
|
+
name: 'products',
|
|
13
|
+
initialState: InitialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
setProducts: (state, action) => ({
|
|
16
|
+
...state,
|
|
17
|
+
...action.payload,
|
|
18
|
+
}),
|
|
19
|
+
resetProducts: () => InitialState,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
// Actions
|
|
23
|
+
export const { setProducts, resetProducts } = productsSlice.actions;
|
|
24
|
+
export const productsReducer = productsSlice.reducer;
|
|
25
|
+
// Selectors
|
|
26
|
+
export const selectProducts = (state) => state.products;
|
package/lib/utils/constants.js
CHANGED
|
@@ -73,6 +73,7 @@ export const PRODUCT_IDS = {
|
|
|
73
73
|
CIBAN: 'prod-ciban',
|
|
74
74
|
CGN: 'prod-cgn',
|
|
75
75
|
};
|
|
76
|
+
// TODO remove this. Moved this logic into env files
|
|
76
77
|
export const ALLOWED_PREFIXES = ['prod-interop', 'prod-pn'];
|
|
77
78
|
/**
|
|
78
79
|
* Validates if a product ID matches our allowed prefixes.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/selfcare-common-frontend",
|
|
3
3
|
"description": "Shared React components for the pagopa selfcare project",
|
|
4
|
-
"version": "1.34.
|
|
4
|
+
"version": "1.34.104",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|