@pagopa/selfcare-common-frontend 1.4.1 → 1.5.3

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 CHANGED
@@ -4,8 +4,36 @@ 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.5.3](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.2...v1.5.3)
8
+
9
+ - added useReduxCachedValueTranscoded [`#28`](https://github.com/pagopa/selfcare-common-frontend/pull/28)
10
+
11
+ #### [v1.5.2](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.1...v1.5.2)
12
+
13
+ > 14 February 2022
14
+
15
+ - Fixed useReduxCachedValue setterAction type [`#27`](https://github.com/pagopa/selfcare-common-frontend/pull/27)
16
+ - Bump follow-redirects from 1.14.7 to 1.14.8 [`#26`](https://github.com/pagopa/selfcare-common-frontend/pull/26)
17
+
18
+ #### [v1.5.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.0...v1.5.1)
19
+
20
+ > 14 February 2022
21
+
22
+ - withRetrievedValue will accept a component to show while loading [`#25`](https://github.com/pagopa/selfcare-common-frontend/pull/25)
23
+
24
+ #### [v1.5.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.4.1...v1.5.0)
25
+
26
+ > 11 February 2022
27
+
28
+ - Toast autoclosable in UserNotifyHandle and ErrorBoundaryfeatures [`#24`](https://github.com/pagopa/selfcare-common-frontend/pull/24)
29
+ - Customhook cached redux [`#23`](https://github.com/pagopa/selfcare-common-frontend/pull/23)
30
+ - fixed readme [`#22`](https://github.com/pagopa/selfcare-common-frontend/pull/22)
31
+ - fake-pagination custom hook [`#21`](https://github.com/pagopa/selfcare-common-frontend/pull/21)
32
+
7
33
  #### [v1.4.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.4.0...v1.4.1)
8
34
 
35
+ > 9 February 2022
36
+
9
37
  - edit-rolelabel - added description in roleLabels [`#20`](https://github.com/pagopa/selfcare-common-frontend/pull/20)
10
38
 
11
39
  #### [v1.4.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.3.1...v1.4.0)
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # SelfCare's common components & features
2
- This library contains utility, components and features built for the selfcare project.
2
+ This library contains [utilities](#utilities), [components](#components), [decorators](#decorators), [custom hooks](#custom-hooks) and [features](#features) built for the selfcare project.
3
3
 
4
4
  # Configuration
5
5
  In order to use these components it's necessary to set the following keys of the CONFIG object imported from /config/env as first things inside the application:
6
6
 
7
7
  | Key | Type | Description | DefaultValue |
8
+ |-----|------|-------------|--------------|
8
9
  | URL_FE.LOGIN | string | The url of the login page | /auth/login |
9
10
  | URL_FE.LOGOUT | string | The url of the logout page | /auth/logout |
10
11
  | URL_FE.ASSISTANCE | string | The url of the assistance page | /assistenza |
@@ -12,7 +13,7 @@ In order to use these components it's necessary to set the following keys of the
12
13
  | ANALYTICS.* | | See [analitics feature](#analytics) | |
13
14
  | CONSENT.* | | See [consent management feature](#consent-management) | |
14
15
 
15
- # Common components used to build pagopa/selfcare react projects
16
+ # Components
16
17
  ## Header
17
18
  SelfCare Header component
18
19
 
@@ -56,16 +57,16 @@ Modal used to show a list of values from which to choose a single value
56
57
  | Prop | Type | Mandatory | Description |
57
58
  |------|------|-----------|-------------|
58
59
  | open | boolean | Y | If the popup is to be displayed |
59
- | handleClose | React.MouseEventHandler<HTMLButtonElement> | Y | The function to be invoked when clicking on exit button or selecting a value |
60
+ | handleClose | React.MouseEventHandler`<HTMLButtonElement>` | Y | The function to be invoked when clicking on exit button or selecting a value |
60
61
  | title | string | Y | The popup title |
61
- | filterModalConfig | FilterModalConfig<any, any> | N | See below |
62
+ | filterModalConfig | FilterModalConfig`<any, any>` | N | See below |
62
63
  | height | string | N | The popup height |
63
64
  | minHeight | string | N | The popup minHeight |
64
65
 
65
66
  FilterModalConfig fields:
66
67
  | Field | Type | Mandatory | Description |
67
68
  |-------|------|-----------|-------------|
68
- | data | Array<T> | Y | The list of values between to which choose |
69
+ | data | Array`<T>` | Y | The list of values between to which choose |
69
70
  | getLabel | (e: T) => string | Y | A function that will select the label to show |
70
71
  | getValue | (e: T) => string | Y | A function that will select the value to return when selecting an item |
71
72
  | onFilterChange | (v: V) => void | Y | The function invoked when selecting a value |
@@ -78,10 +79,10 @@ Selfcare's popup
78
79
  | open | boolean | Y | If this component should be displayed or not |
79
80
  | title | string | Y | The title to show in the popup |
80
81
  | message | React.ReactNode | Y | The body to show in the popup |
81
- | onConfirm | React.MouseEventHandler<HTMLButtonElement> | N | If defined, it will render a confirm button using this function as behavior |
82
+ | onConfirm | React.MouseEventHandler`<HTMLButtonElement>` | N | If defined, it will render a confirm button using this function as behavior |
82
83
  | onConfirmLabel | string | N | The confirm label text |
83
- | handleClose | React.MouseEventHandler<HTMLButtonElement> | Y | The function invoked when clicking on close button or in the showed X icon |
84
- | handleExit | React.MouseEventHandler<HTMLButtonElement> | N | If defined, it allow to set a different behavior when clicking on X icon |
84
+ | handleClose | React.MouseEventHandler`<HTMLButtonElement>` | Y | The function invoked when clicking on close button or in the showed X icon |
85
+ | handleExit | React.MouseEventHandler`<HTMLButtonElement>` | N | If defined, it allow to set a different behavior when clicking on X icon |
85
86
  | onCloseLabel | string | N | Close button text |
86
87
  | height | string | N | The popup height |
87
88
  | minHeight | string | N | The popup minHeight |
@@ -123,7 +124,7 @@ Selfcare's ending page
123
124
  | buttonLabel | string | N | The ending page button label if any |
124
125
  | onButtonClick | () => void | N | if defined it will show a button that will performe this action on click |
125
126
 
126
- # Utility functions
127
+ # Utilities
127
128
  ## api-utils
128
129
  ### onRedirectToLogin: (store: EnhancedStore) => void
129
130
  To show an error popup to inform of the not valid session
@@ -131,7 +132,7 @@ To show an error popup to inform of the not valid session
131
132
  ### buildFetchApi = (timeoutMs: number = 300000) => fetch
132
133
  Return the implementation of fetch configured with a timeout
133
134
 
134
- ### extractResponse <R>(response: t.Validation<TypeofApiResponse<any>>, successHttpStatus: number, onRedirectToLogin: () => void, notValidTokenHttpStatus: number | null = 401, notAuthorizedTokenHttpStatus: number | null = 403, emptyResponseHttpStatus: number | null = 404): Promise<R>
135
+ ### extractResponse `<R>`(response: t.Validation`<TypeofApiResponse<any>>`, successHttpStatus: number, onRedirectToLogin: () => void, notValidTokenHttpStatus: number | null = 401, notAuthorizedTokenHttpStatus: number | null = 403, emptyResponseHttpStatus: number | null = 404): Promise`<R>`
135
136
  Extract the response of a @pagopa/openapi-codegen-ts generated client rest invocation having status code successHttpStatus.
136
137
  If notValidTokenHttpStatus is not null and the returned status is equal to notValidTokenHttpStatus, it will call the onRedirectToLogin function and will schedule the redirect towards logout path.
137
138
  If notAuthorizedTokenHttpStatus is not null and the returned status is equal to notAuthorizedTokenHttpStatus, it will throw an Error with message "Operation not allowed".
@@ -169,14 +170,63 @@ It will return a string representing the provided date in the italian format gg
169
170
  ## fixSwagger20ArraySchemaDef.js
170
171
  An utility script to use when generating the stub through @pagopa/openapi-codegen-ts in order to handle the REST api whose operations returns an array of objects
171
172
 
172
- # Common decorators used in pagopa/selfcare react projects
173
+ # Decorators
173
174
  ## withLogin
174
175
  This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
175
176
  This decorator has to be applied to components whose acces require an active session.
176
177
  Accessing to the components decorated with it without a session will brought to the login page.
177
178
  It's possible to modify the login path changing the value in [CONFIG.URL_FE.LOGIN](#Configuration) inside the index.tsx file
178
179
 
179
- # Common features used in pagopa/selfcare react projects
180
+ ## withRetrievedValue
181
+ Decorator to retrieve a value and serve it once ready to the decorated component.
182
+ Using it together with [useReduxCachedValue](#usereduxcachedvalue) will allow to build a component which will use centralized and cached data
183
+ See withRetrievedValue.test.tsx file for an example.
184
+
185
+ Given the following type parameters:
186
+ * ENTITY_TYPE extends Record`<string, any>`,
187
+ * PROP_NAME extends string,
188
+ * PROPS extends Record`<PROP_NAME, ENTITY_TYPE>`
189
+
190
+ The arguments to provide to the decorator are the following:
191
+
192
+ | Prop | Type | Mandatory | Description |
193
+ |------|------|-----------|-------------|
194
+ | propEntityName | PROP_NAME | Y | The name of the prop to which serve the value when available |
195
+ | getRetrieverService | () => () => Promise`<ENTITY_TYPE>` | Y | A function that will return an other function to retrieve the expected value. This for allow the use of custom hook |
196
+ | WrappedComponent | React.ComponentType`<PROPS>` | Y | The component to decore |
197
+ | onError | (appError: AppError) => void | N | What to do in case of error. As default, it will use the feature ErrorBoundary |
198
+ | onLoading | ReactNode | N | A component to show while waiting for the value |
199
+
200
+ # Custom Hooks
201
+ ## useFakePagination
202
+ Custom hook used to simulate paginated resources when the external service doesn't implement it, caching values when filter doesn't change and serving them a page at time.
203
+ Cached values are stored using useRef, so they are local to the component using this hook.
204
+ The sorting actually is applied using string representation
205
+
206
+ ## useReduxCachedValue
207
+ See [useReduxCachedValueTranscoded](#usereduxcachedvaluetranscoded) when RETRIEVED_VALUE === RETRIEVER_ARGS
208
+
209
+ ## useReduxCachedValueTranscoded
210
+ It will return a method that will call the retrieverService only when there are not storing values, or a condition on them is not more verified.
211
+ See useReduxCachedValue.test.tsx file for an example.
212
+
213
+ Given the following type parametes:
214
+ * RETRIEVED_VALUE the type desired
215
+ * STORED_VALUE the type stored
216
+
217
+ The arguments to provide to the custom hook are the following:
218
+
219
+ | Prop | Type | Mandatory | Description |
220
+ |------|------|-----------|-------------|
221
+ | entity | string | Y | The name of the entity, used just for logging purpose |
222
+ | retrieverService | (retrieverServiceArgs?: RETRIEVER_ARGS) => Promise`<RETRIEVED_VALUE>` | Y | The service that will retrieve the value |
223
+ | reduxSelector | (state: any) => STORED_VALUE | undefined | Y | The selector to read the value from redux |
224
+ | reduxSetterAction | (value: RETRIEVED_VALUE, retrieverServiceArgs?: RETRIEVER_ARGS) => PayloadAction`<STORED_VALUE>` | Y | The action to store the value |
225
+ | selectedValue2RetrievedValue | (value: STORED_VALUE) => RETRIEVED_VALUE | Y | A function called to transform STORED_VALUE into RETRIEVED_VALUE and called when hitting the cache |
226
+ | selectedValuePredicate2Retrieve | (value: STORED_VALUE, args?: RETRIEVER_ARGS) => boolean | N | An optional predicate evaluated when reduxSelector returned some value in order to compare it against the retrieverServiceArgs and evaluate if retrieverService should be called again |
227
+ | alwaysRetrieve | boolean | N | If true, it will always retrieve and store the new value |
228
+
229
+ # Features
180
230
  ## LoadingOverlay
181
231
  This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
182
232
  It allows to draw a loader when an async task to wait is running.
@@ -207,6 +257,8 @@ The error to be submitted has type AppError which has the following fields:
207
257
  | onClose | () => void | N | If defined, in case of not blocking error, it will be executed when closing the popup |
208
258
  | toNotify | boolean | Y | If true, it will notify the error |
209
259
  | component | string | N | Can render a SessionModal or Toast component |
260
+ | autoclosable | string | N | If component === 'Toast'. The notify will be autoclosed using this configuration, as default timer. If none, it will not be closed automatically. If timer, it will be closed after autocloseMilliseconds milliseconds |
261
+ | autocloseMilliseconds | boolean | N | If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 2000 |
210
262
 
211
263
  The error will be notified as a GENERIC_ERROR through the [analytcs feature](#analytics)
212
264
 
@@ -231,6 +283,8 @@ The user notify to be submitted has type UserNotify which has the following fiel
231
283
  | onClose | () => void | N | If defined, it will be executed when closing the popup |
232
284
  | closeLabel | string | N | If component === 'SessionModal'. The close button label |
233
285
  | component | string | N | Can render a SessionModal or Toast component |
286
+ | autoclosable | string | N | If component === 'Toast'. The notify will be autoclosed using this configuration, as default timer. If none, it will not be closed automatically. If timer, it will be closed after autocloseMilliseconds milliseconds |
287
+ | autocloseMilliseconds | boolean | N | If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 2000 |
234
288
 
235
289
  ## UnloadEventHandler
236
290
  This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
@@ -265,7 +319,7 @@ This feature can be configured with the following keys of the [CONFIG](#Configur
265
319
  | PERSISTENCE | string | Where to store session data, possible values are cookie or localStorage | localStorage |
266
320
  | LOG_IP | boolean | If the ip should be sent | false |
267
321
  | LOG_IP | boolean | If the ip should be sent | false |
268
- | PROPERTY_BLACKLIST | Array<string> | If the ip should be sent | ["$current_url", "$initial_referrer", "$referrer"] |
322
+ | PROPERTY_BLACKLIST | Array`<string>` | If the ip should be sent | ["$current_url", "$initial_referrer", "$referrer"] |
269
323
  | ADDITIONAL_PROPERTIES | {[key: string]: string} | An object containing a fixed set of properties to send every time, overridden if the actual event will report the same properties | {} |
270
324
  | ADDITIONAL_PROPERTIES_IMPORTANT | {[key: string]: string} | As ADDITIONAL_PROPERTIES, but these properties will take the precedence overriding events conflicting properties | {} |
271
325
 
package/build.info CHANGED
@@ -1,2 +1,2 @@
1
- 20220209.1 - selfcare-common-frontend.deploy(19917)
2
- tags/v1.4.1^0 d241dafce1160276a67e2aafc77b2e5c6736827d
1
+ 20220215.1 - selfcare-common-frontend.deploy(20498)
2
+ tags/v1.5.3^0 bd1e6861da1e1567290e0649fdb3d0c41c28d8c9
@@ -59,6 +59,9 @@ class ErrorBoundary extends react_1.Component {
59
59
  }
60
60
  buildErrorToast(error) {
61
61
  var _a, _b;
62
+ if (error.autoclosable === 'timer') {
63
+ setTimeout(() => this.handleClose(error), error.autocloseMilliseconds);
64
+ }
62
65
  return ((0, jsx_runtime_1.jsx)(Toast_1.default, { open: true, title: (_a = error.displayableTitle) !== null && _a !== void 0 ? _a : 'ERRORE', message: (_b = error.displayableDescription) !== null && _b !== void 0 ? _b : 'Spiacenti, qualcosa è andato storto.', logo: FaultIcon_1.default, leftBorderColor: "#C02927", onCloseToast: () => this.handleClose(error) }, void 0));
63
66
  }
64
67
  buildErrorModal(error) {
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../src/lib/components/ErrorBoundary/ErrorBoundary.tsx"],"names":[],"mappings":";;;;AACA,mCAAkC;AAClC,iCAAgF;AAChF,6CAAsC;AACtC,uCAA0C;AAC1C,oEAAgG;AAChG,8DAA2D;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,CAAC,OAAO,EAAE,CAAC;SACjB;IACH,CAAC;CACF;AACD,MAAM,cAAc,GAAG,IAAA,yBAAc,EAAC,iCAAiB,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AAE1F,SAAS,eAAe,CAAC,KAAU;IACjC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,QAA0B,EAAE,EAAE,CAAC,CAAC;IAC1D,QAAQ,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,+BAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxE,WAAW,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,+BAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;CAC/E,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAA0C,IAAA,qBAAO,EAC3E,eAAe,EACf,kBAAkB,CACnB,CAAC,aAAa,CAAC,CAAC;AACjB,kBAAe,sBAAsB,CAAC"}
@@ -16,9 +16,6 @@ function UserNotifyHandle() {
16
16
  const notifies = (0, react_redux_1.useSelector)(appStateSlice_1.appStateSelectors.selectNotifies);
17
17
  const lastNotifyToast = (0, react_1.useRef)();
18
18
  const lastNotifyModal = (0, react_1.useRef)();
19
- const { openModal, openToast } = updateCurrents(lastNotifyModal, lastNotifyToast, notifies);
20
- const notifyModal = lastNotifyModal.current;
21
- const notifyToast = lastNotifyToast.current;
22
19
  const onClose = (notify) => {
23
20
  dispatch(appStateSlice_1.appStateActions.removeNotify(notify));
24
21
  if (notify === null || notify === void 0 ? void 0 : notify.onClose) {
@@ -31,10 +28,13 @@ function UserNotifyHandle() {
31
28
  notify.onConfirm();
32
29
  }
33
30
  };
31
+ const { openModal, openToast } = updateCurrents(lastNotifyModal, lastNotifyToast, notifies, onClose);
32
+ const notifyModal = lastNotifyModal.current;
33
+ const notifyToast = lastNotifyToast.current;
34
34
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(__1.Toast, { open: openToast, title: (_a = notifyToast === null || notifyToast === void 0 ? void 0 : notifyToast.title) !== null && _a !== void 0 ? _a : 'Notify Title', message: notifyToast === null || notifyToast === void 0 ? void 0 : notifyToast.message, logo: notifyToast === null || notifyToast === void 0 ? void 0 : notifyToast.logo, leftBorderColor: notifyToast === null || notifyToast === void 0 ? void 0 : notifyToast.leftBorderColor, onCloseToast: () => onClose(notifyToast) }, void 0), (0, jsx_runtime_1.jsx)(__1.SessionModal, { open: openModal, title: (_b = notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.title) !== null && _b !== void 0 ? _b : 'Notify Title', message: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.message, onConfirm: () => onConfirm(notifyModal), onConfirmLabel: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.confirmLabel, handleClose: () => onClose(notifyModal), onCloseLabel: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.closeLabel }, void 0)] }, void 0));
35
35
  }
36
36
  exports.default = UserNotifyHandle;
37
- function updateCurrents(lastNotifyModalRef, lastNotifyToastRef, notifies) {
37
+ function updateCurrents(lastNotifyModalRef, lastNotifyToastRef, notifies, onClose) {
38
38
  const lastNotifyToast = notifies.find((e) => e.component === 'Toast');
39
39
  const lastNotifySessionModal = notifies.find((e) => e.component === 'SessionModal');
40
40
  const openToast = !!lastNotifyToast;
@@ -46,6 +46,9 @@ function updateCurrents(lastNotifyModalRef, lastNotifyToastRef, notifies) {
46
46
  if (lastNotifyToast && lastNotifyToast !== (lastNotifyToastRef === null || lastNotifyToastRef === void 0 ? void 0 : lastNotifyToastRef.current)) {
47
47
  // eslint-disable-next-line functional/immutable-data
48
48
  lastNotifyToastRef.current = lastNotifyToast;
49
+ if (lastNotifyToast.autoclosable === 'timer') {
50
+ setTimeout(() => onClose(lastNotifyToast), lastNotifyToast.autocloseMilliseconds);
51
+ }
49
52
  }
50
53
  return {
51
54
  openToast,
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotifyHandle.js","sourceRoot":"","sources":["../../src/lib/components/UserNotifyHandle.tsx"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,6CAAuD;AACvD,0BAAyC;AAEzC,iEAAmF;AAEnF;;;;wJAIwJ;AACxJ,SAAS,gBAAgB;;IACvB,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,IAAA,cAAM,GAAc,CAAC;IAC7C,MAAM,eAAe,GAAG,IAAA,cAAM,GAAc,CAAC;IAE7C,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IAE5F,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC;IAC5C,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC;IAE5C,MAAM,OAAO,GAAG,CAAC,MAAkB,EAAE,EAAE;QACrC,QAAQ,CAAC,+BAAe,CAAC,YAAY,CAAC,MAAoB,CAAC,CAAC,CAAC;QAC7D,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,EAAE;YACnB,MAAM,CAAC,OAAO,EAAE,CAAC;SAClB;IACH,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,CAAC,MAAkB,EAAE,EAAE;QACvC,QAAQ,CAAC,+BAAe,CAAC,YAAY,CAAC,MAAoB,CAAC,CAAC,CAAC;QAC7D,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,EAAE;YACrB,MAAM,CAAC,SAAS,EAAE,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,6DACE,uBAAC,SAAK,IACJ,IAAI,EAAE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5D,QAA2B,EAC3B,OAAqC;IAErC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC;IACtE,MAAM,sBAAsB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,cAAc,CAAC,CAAC;IAEpF,MAAM,SAAS,GAAY,CAAC,CAAC,eAAe,CAAC;IAC7C,MAAM,SAAS,GAAY,CAAC,CAAC,sBAAsB,CAAC;IAEpD,IAAI,sBAAsB,IAAI,sBAAsB,MAAK,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CAAA,EAAE;QACpF,qDAAqD;QACrD,kBAAkB,CAAC,OAAO,GAAG,sBAAsB,CAAC;KACrD;IACD,IAAI,eAAe,IAAI,eAAe,MAAK,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CAAA,EAAE;QACtE,qDAAqD;QACrD,kBAAkB,CAAC,OAAO,GAAG,eAAe,CAAC;QAE7C,IAAI,eAAe,CAAC,YAAY,KAAK,OAAO,EAAE;YAC5C,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;SACnF;KACF;IACD,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { AppError } from '../model/AppError';
3
+ /** Decorator to retrieve a value and serve it once ready to the decorated component */
4
+ export default function withRetrievedValue<ENTITY_TYPE extends Record<string, any>, PROP_NAME extends string, PROPS extends Record<PROP_NAME, ENTITY_TYPE>>(
5
+ /** The name of the prop to which serve the value when available */
6
+ propEntityName: PROP_NAME,
7
+ /** A function that will return an other function to retrieve the expected value. This for allow the use of custom hook */
8
+ getRetrieverService: () => () => Promise<ENTITY_TYPE>,
9
+ /** The component to decore */
10
+ WrappedComponent: React.ComponentType<PROPS>,
11
+ /** What to do in case of error. As default, it will use the feature ErrorBoundary */
12
+ onError?: (appError: AppError) => void,
13
+ /** A component to show while waiting for the value */
14
+ onLoading?: ReactNode): import("react").ComponentType<Omit<PROPS, PROP_NAME>>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const useErrorDispatcher_1 = (0, tslib_1.__importDefault)(require("../hooks/useErrorDispatcher"));
7
+ /** Decorator to retrieve a value and serve it once ready to the decorated component */
8
+ function withRetrievedValue(
9
+ /** The name of the prop to which serve the value when available */
10
+ propEntityName,
11
+ /** A function that will return an other function to retrieve the expected value. This for allow the use of custom hook */
12
+ getRetrieverService,
13
+ /** The component to decore */
14
+ WrappedComponent,
15
+ /** What to do in case of error. As default, it will use the feature ErrorBoundary */
16
+ onError,
17
+ /** A component to show while waiting for the value */
18
+ onLoading) {
19
+ const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
20
+ const ComponentWithParties = (props) => {
21
+ const [value, setValue] = (0, react_1.useState)();
22
+ const cachedRetrieve = getRetrieverService();
23
+ const addError = (0, useErrorDispatcher_1.default)();
24
+ const doRetrieve = () => {
25
+ cachedRetrieve()
26
+ .then((v) => setValue(v))
27
+ .catch((reason) => (onError !== null && onError !== void 0 ? onError : addError)({
28
+ id: `RETRIEVE_VALUE_${propEntityName}`,
29
+ blocking: false,
30
+ techDescription: `Something gone wrong while retrieving ${propEntityName}`,
31
+ toNotify: true,
32
+ error: reason,
33
+ onRetry: doRetrieve,
34
+ }));
35
+ };
36
+ (0, react_1.useEffect)(() => {
37
+ if (!value) {
38
+ doRetrieve();
39
+ }
40
+ }, []);
41
+ return value !== undefined ? ((0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, props, { [propEntityName]: value }), void 0)) : (onLoading !== null && onLoading !== void 0 ? onLoading : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0));
42
+ };
43
+ // eslint-disable-next-line functional/immutable-data
44
+ ComponentWithParties.displayName = `withRetrieve${propEntityName}(${displayName})`;
45
+ return ComponentWithParties;
46
+ }
47
+ exports.default = withRetrievedValue;
48
+ //# sourceMappingURL=withRetrievedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withRetrievedValue.js","sourceRoot":"","sources":["../../src/lib/decorators/withRetrievedValue.tsx"],"names":[],"mappings":";;;;AAAA,iCAAuD;AACvD,kGAA6D;AAG7D,uFAAuF;AACvF,SAAwB,kBAAkB;AAKxC,mEAAmE;AACnE,cAAyB;AACzB,2HAA2H;AAC3H,mBAAqD;AACrD,8BAA8B;AAC9B,gBAA4C;AAC5C,qFAAqF;AACrF,OAAsC;AACtC,sDAAsD;AACtD,SAAqB;IAErB,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;IAEzF,MAAM,oBAAoB,GAAG,CAAC,KAAY,EAAE,EAAE;QAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAe,CAAC;QAClD,MAAM,cAAc,GAAG,mBAAmB,EAAE,CAAC;QAE7C,MAAM,QAAQ,GAAG,IAAA,4BAAkB,GAAE,CAAC;QAEtC,MAAM,UAAU,GAAG,GAAS,EAAE;YAC5B,cAAc,EAAE;iBACb,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBACxB,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAChB,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,QAAQ,CAAC,CAAC;gBACpB,EAAE,EAAE,kBAAkB,cAAc,EAAE;gBACtC,QAAQ,EAAE,KAAK;gBACf,eAAe,EAAE,yCAAyC,cAAc,EAAE;gBAC1E,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,UAAU;aACpB,CAAC,CACH,CAAC;QACN,CAAC,CAAC;QAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;YACb,IAAI,CAAC,KAAK,EAAE;gBACV,UAAU,EAAE,CAAC;aACd;QACH,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAC3B,uBAAC,gBAAgB,oBAAM,KAAe,EAAM,EAAE,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,UAAI,CAC5E,CAAC,CAAC,CAAC,CACF,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,0DAAK,CACnB,CAAC;IACJ,CAAC,CAAC;IAEF,qDAAqD;IACrD,oBAAoB,CAAC,WAAW,GAAG,eAAe,cAAc,IAAI,WAAW,GAAG,CAAC;IAEnF,OAAO,oBAAmE,CAAC;AAC7E,CAAC;AAxDD,qCAwDC"}
@@ -0,0 +1,9 @@
1
+ import { PageRequest } from '../model/PageRequest';
2
+ import { PageResource } from '../model/PageResource';
3
+ /**
4
+ * Custom hook used to simulate paginated resources when the external service doesn't implement it, caching values when filter doesn't change and serving them a page at time.
5
+ * Cached values are stored using useRef, so they are local to the component using this hook.
6
+ * The sorting actually is applied using string representation
7
+ */
8
+ declare const useFakePagination: <T extends Record<string, any>>(fetch: () => Promise<T[]>) => (pageRequest: PageRequest, filterChanged: boolean) => Promise<PageResource<T>>;
9
+ export default useFakePagination;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const toPageResource = (content, page, size, totalElements) => ({
5
+ content,
6
+ page: {
7
+ number: page,
8
+ size,
9
+ totalElements,
10
+ totalPages: size > 0 ? Math.ceil(totalElements / size) : 0,
11
+ },
12
+ });
13
+ const extractPageRequest = (data, pageRequest) => {
14
+ const firstIndex = pageRequest.page * pageRequest.size;
15
+ return toPageResource(firstIndex < data.length && pageRequest.size > 0
16
+ ? data.slice(firstIndex, firstIndex + pageRequest.size)
17
+ : [], pageRequest.page, pageRequest.size, data.length);
18
+ };
19
+ const applySort = (data, sort) => {
20
+ const sortConfiguration = sort.split(' ').map((order) => {
21
+ const [key, direction] = order.split(',');
22
+ return { key, asc: direction === 'asc' };
23
+ });
24
+ // eslint-disable-next-line functional/immutable-data
25
+ data.sort((a, b) => {
26
+ for (const order of sortConfiguration) {
27
+ const compare = `${a[order.key]}`.localeCompare(`${b[order.key]}`);
28
+ if (compare !== 0) {
29
+ return compare * (order.asc ? 1 : -1);
30
+ }
31
+ }
32
+ return 0;
33
+ });
34
+ };
35
+ /**
36
+ * Custom hook used to simulate paginated resources when the external service doesn't implement it, caching values when filter doesn't change and serving them a page at time.
37
+ * Cached values are stored using useRef, so they are local to the component using this hook.
38
+ * The sorting actually is applied using string representation
39
+ */
40
+ const useFakePagination = (fetch) => {
41
+ const cachedData = (0, react_1.useRef)();
42
+ const cachedDataSort = (0, react_1.useRef)();
43
+ const checkAndApplySort = (sort) => {
44
+ if (sort && cachedDataSort.current !== sort) {
45
+ applySort(cachedData.current, sort);
46
+ // eslint-disable-next-line functional/immutable-data
47
+ cachedDataSort.current = sort;
48
+ }
49
+ };
50
+ return (pageRequest, filterChanged) => {
51
+ if (!filterChanged && cachedData.current) {
52
+ checkAndApplySort(pageRequest.sort);
53
+ return new Promise((resolve) => resolve(extractPageRequest(cachedData.current, pageRequest)));
54
+ }
55
+ else {
56
+ return fetch().then((results) => {
57
+ // eslint-disable-next-line functional/immutable-data
58
+ cachedData.current = results;
59
+ checkAndApplySort(pageRequest.sort);
60
+ return extractPageRequest(cachedData.current, pageRequest);
61
+ });
62
+ }
63
+ };
64
+ };
65
+ exports.default = useFakePagination;
66
+ //# sourceMappingURL=useFakePagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFakePagination.js","sourceRoot":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AO,EAAE,EAAE;gBAC9B,qDAAqD;gBACrD,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;gBAC7B,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpC,OAAO,kBAAkB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { PayloadAction } from '@reduxjs/toolkit';
2
+ /** @see {useReduxCachedValue} when RETRIEVED_VALUE === STORED_VALUE */
3
+ declare const useReduxCachedValue: <RETRIEVED_VALUE, RETRIEVER_ARGS>(entity: string, retrieverService: (retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => Promise<RETRIEVED_VALUE>, reduxSelector: (state: any) => RETRIEVED_VALUE | undefined, reduxSetterAction: (value: RETRIEVED_VALUE, retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => PayloadAction<any>, selectedValuePredicate2Retrieve?: ((value: RETRIEVED_VALUE, args?: RETRIEVER_ARGS | undefined) => boolean) | undefined, alwaysRetrieve?: boolean | undefined) => (retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => Promise<RETRIEVED_VALUE>;
4
+ /** It will return a method that will call the retrieverService only when there are not storing values, or a condition on them is not more verified */
5
+ export declare const useReduxCachedValueTranscoded: <RETRIEVED_VALUE, STORED_VALUE, RETRIEVER_ARGS>(entity: string, retrieverService: (retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => Promise<RETRIEVED_VALUE>, reduxSelector: (state: any) => STORED_VALUE | undefined, reduxSetterAction: (value: RETRIEVED_VALUE, retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => {
6
+ payload: STORED_VALUE;
7
+ type: string;
8
+ }, selectedValue2RetrievedValue: (value: STORED_VALUE) => RETRIEVED_VALUE, selectedValuePredicate2Retrieve?: ((value: STORED_VALUE, args?: RETRIEVER_ARGS | undefined) => boolean) | undefined, alwaysRetrieve?: boolean | undefined) => (retrieverServiceArgs?: RETRIEVER_ARGS | undefined) => Promise<RETRIEVED_VALUE>;
9
+ export default useReduxCachedValue;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useReduxCachedValueTranscoded = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_redux_1 = require("react-redux");
6
+ const constants_1 = require("../utils/constants");
7
+ const useLoading_1 = (0, tslib_1.__importDefault)(require("./useLoading"));
8
+ /** @see {useReduxCachedValue} when RETRIEVED_VALUE === STORED_VALUE */
9
+ const useReduxCachedValue = (entity, retrieverService, reduxSelector, reduxSetterAction, selectedValuePredicate2Retrieve, alwaysRetrieve) => (0, exports.useReduxCachedValueTranscoded)(entity, retrieverService, reduxSelector, reduxSetterAction, (value) => value, selectedValuePredicate2Retrieve, alwaysRetrieve);
10
+ /** It will return a method that will call the retrieverService only when there are not storing values, or a condition on them is not more verified */
11
+ const useReduxCachedValueTranscoded = (
12
+ /** The name of the entity, used just for logging purpose */
13
+ entity,
14
+ /** The service that will retrieve the value */
15
+ retrieverService,
16
+ /** The selector to read the value from redux */
17
+ reduxSelector,
18
+ /** The action to store the new value */
19
+ reduxSetterAction,
20
+ /** A function called to transform STORED_VALUE into RETRIEVED_VALUE and called when hitting the cache */
21
+ selectedValue2RetrievedValue,
22
+ /** An optional predicate evaluated when reduxSelector returned some value in order to compare it against the retrieverServiceArgs and evaluate if retrieverService should be called again */
23
+ selectedValuePredicate2Retrieve,
24
+ /** If true, it will always retrieve and store the new value */
25
+ alwaysRetrieve) => {
26
+ const dispatch = (0, react_redux_1.useDispatch)();
27
+ const entities = (0, react_redux_1.useSelector)(reduxSelector);
28
+ const setEntities = (value, retrieverServiceArgs) => dispatch(reduxSetterAction(value, retrieverServiceArgs));
29
+ const setLoading = (0, useLoading_1.default)(`${constants_1.LOADING_TASK_RETRIEVE_CACHED_VALUES}_${entity}`);
30
+ return (retrieverServiceArgs) => {
31
+ if (alwaysRetrieve ||
32
+ !entities ||
33
+ (selectedValuePredicate2Retrieve &&
34
+ selectedValuePredicate2Retrieve(entities, retrieverServiceArgs))) {
35
+ setLoading(true);
36
+ return retrieverService(retrieverServiceArgs)
37
+ .then((e) => {
38
+ setEntities(e, retrieverServiceArgs);
39
+ return e;
40
+ })
41
+ .finally(() => setLoading(false));
42
+ }
43
+ else {
44
+ return new Promise((resolve) => resolve(selectedValue2RetrievedValue(entities)));
45
+ }
46
+ };
47
+ };
48
+ exports.useReduxCachedValueTranscoded = useReduxCachedValueTranscoded;
49
+ exports.default = useReduxCachedValue;
50
+ //# sourceMappingURL=useReduxCachedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReduxCachedValue.js","sourceRoot":"","sources":["../../src/lib/hooks/useReduxCachedValue.tsx"],"names":[],"mappings":";;;;AACA,6CAAuD;AACvD,kDAAyE;AACzE,2EAAsC;AAEtC,uEAAuE;AACvE,MAAM,mBAAmB,GAAG,CAC1B,MAAc,EACd,gBAAqF,EACrF,aAA0D,EAC1D,iBAGuB,EACvB,+BAA4F,EAC5F,cAAwB,EAC+C,EAAE,CACzE,IAAA,qCAA6B,EAC3B,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAChB,+BAA+B,EAC/B,cAAc,CACf,CAAC;AAEJ,sJAAsJ;AAC/I,MAAM,6BAA6B,GAAG;AAC3C,4DAA4D;AAC5D,MAAc;AACd,+CAA+C;AAC/C,gBAAqF;AACrF,gDAAgD;AAChD,aAAuD;AACvD,wCAAwC;AACxC,iBAGgC;AAChC,yGAAyG;AACzG,4BAAsE;AACtE,8LAA8L;AAC9L,+BAAyF;AACzF,+DAA+D;AAC/D,cAAwB,EAC+C,EAAE;IACzE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,aAAa,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,oBAAqC,EAAE,EAAE,CACpF,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAE3D,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,GAAG,+CAAmC,IAAI,MAAM,EAAE,CAAC,CAAC;IAElF,OAAO,CAAC,oBAAqC,EAA4B,EAAE;QACzE,IACE,cAAc;YACd,CAAC,QAAQ;YACT,CAAC,+BAA+B;gBAC9B,+BAA+B,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,EAClE;YACA,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,gBAAgB,CAAC,oBAAoB,CAAC;iBAC1C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBACV,WAAW,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;gBACrC,OAAO,CAAC,CAAC;YACX,CAAC,CAAC;iBACD,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;SACrC;aAAM;YACL,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SAClF;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,6BAA6B,iCA4CxC;AAEF,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { ErrorInfo } from 'react';
2
+ export declare type AppError = {
3
+ /** The identifier used to recognize the error: it cannot be possible to have the same error id at the same time */
4
+ id: string;
5
+ /** The Error thrown */
6
+ error: Error;
7
+ errorInfo?: ErrorInfo;
8
+ /** If true, this error will show the error page, not allowing the user to do anything, otherwise it will show a closable popup */
9
+ blocking: boolean;
10
+ /** A description of the error to send when notifying the error */
11
+ techDescription: string;
12
+ /** A text to show as title of the popup when a not blocking error occurs */
13
+ displayableTitle?: string;
14
+ /** A text to show as body of the popup when a not blocking error occurs */
15
+ displayableDescription?: string;
16
+ /** If defined, in case of not blocking error, it will render a retry button which will execute this function */
17
+ onRetry?: () => void;
18
+ /** If defined, in case of not blocking error, it will be executed when closing the popup */
19
+ onClose?: () => void;
20
+ /** If true, it will notify the error */
21
+ toNotify: boolean;
22
+ /** Can render a SessionModal or Toast component */
23
+ component?: 'SessionModal' | 'Toast';
24
+ /** If component === 'Toast'. The notify will be autoclosed using this configuration, as default timer.
25
+ * If none, it will not be closed automatically.
26
+ * If timer, it will be closed after autocloseMilliseconds milliseconds
27
+ */
28
+ autoclosable?: 'none' | 'timer';
29
+ /** If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 2000 */
30
+ autocloseMilliseconds?: number;
31
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AppError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppError.js","sourceRoot":"","sources":["../../src/lib/model/AppError.ts"],"names":[],"mappings":""}
@@ -8,6 +8,13 @@ export declare type UserNotify = {
8
8
  message: React.ReactNode;
9
9
  /** If component === 'Toast'. The logo to be rendered. As default a confirm logo will be used */
10
10
  logo?: React.ElementType;
11
+ /** If component === 'Toast'. The notify will be autoclosed using this configuration, as default timer.
12
+ * If none, it will not be closed automatically.
13
+ * If timer, it will be closed after autocloseMilliseconds milliseconds
14
+ */
15
+ autoclosable?: 'none' | 'timer';
16
+ /** If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 2000 */
17
+ autocloseMilliseconds?: number;
11
18
  /** If component === 'Toast'. The color used for the left border */
12
19
  leftBorderColor?: string;
13
20
  /** If component === 'SessionModal'. If defined, it will render a confirm button which will execute this function */
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.4.1",
4
+ "version": "1.5.3",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",
@@ -121,8 +121,7 @@
121
121
  "src/lib/common-polyfill.ts",
122
122
  "src/lib/index.ts",
123
123
  "src/lib/components/icons/*",
124
- "src/lib/model/*",
125
- "src/store.ts"
124
+ "src/lib/model/*"
126
125
  ]
127
126
  }
128
127
  }
@@ -1,29 +1,7 @@
1
1
  import { PayloadAction } from '@reduxjs/toolkit';
2
- import { ErrorInfo } from 'react';
2
+ import { AppError } from '../../model/AppError';
3
3
  import { UserNotify } from '../../model/UserNotify';
4
- export declare type AppError = {
5
- /** The identifier used to recognize the error: it cannot be possible to have the same error id at the same time */
6
- id: string;
7
- /** The Error thrown */
8
- error: Error;
9
- errorInfo?: ErrorInfo;
10
- /** If true, this error will show the error page, not allowing the user to do anything, otherwise it will show a closable popup */
11
- blocking: boolean;
12
- /** A description of the error to send when notifying the error */
13
- techDescription: string;
14
- /** A text to show as title of the popup when a not blocking error occurs */
15
- displayableTitle?: string;
16
- /** A text to show as body of the popup when a not blocking error occurs */
17
- displayableDescription?: string;
18
- /** If defined, in case of not blocking error, it will render a retry button which will execute this function */
19
- onRetry?: () => void;
20
- /** If defined, in case of not blocking error, it will be executed when closing the popup */
21
- onClose?: () => void;
22
- /** If true, it will notify the error */
23
- toNotify: boolean;
24
- /** Can render a SessionModal or Toast component */
25
- component?: 'SessionModal' | 'Toast';
26
- };
4
+ export type { AppError } from '../../model/AppError';
27
5
  interface AppStateState {
28
6
  loading: {
29
7
  result: boolean;
@@ -96,4 +74,3 @@ export declare const appStateSelectors: {
96
74
  exitAction?: (() => void) | undefined;
97
75
  };
98
76
  };
99
- export {};
@@ -40,12 +40,30 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
40
40
  if (!action.payload.component) {
41
41
  action.payload.component = 'SessionModal';
42
42
  }
43
+ if (action.payload.component === 'Toast') {
44
+ if (action.payload.autoclosable === undefined) {
45
+ action.payload.autoclosable = 'timer';
46
+ }
47
+ if (action.payload.autoclosable === 'timer' &&
48
+ (!action.payload.autocloseMilliseconds || action.payload.autocloseMilliseconds < 0)) {
49
+ action.payload.autocloseMilliseconds = 2000;
50
+ }
51
+ }
43
52
  state.errors.push(action.payload);
44
53
  },
45
54
  removeError: (state, action) => {
46
55
  state.errors = state.errors.filter((e) => e.id !== action.payload.id);
47
56
  },
48
57
  addNotify: (state, action) => {
58
+ if (action.payload.component === 'Toast') {
59
+ if (action.payload.autoclosable === undefined) {
60
+ action.payload.autoclosable = 'timer';
61
+ }
62
+ if (action.payload.autoclosable === 'timer' &&
63
+ (!action.payload.autocloseMilliseconds || action.payload.autocloseMilliseconds < 0)) {
64
+ action.payload.autocloseMilliseconds = 2000;
65
+ }
66
+ }
49
67
  state.userNotifies.push(action.payload);
50
68
  },
51
69
  removeNotify: (state, action) => {
@@ -1 +1 @@
1
- {"version":3,"file":"appStateSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/appStateSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AA4C9D,MAAM,YAAY,GAAkB;IAClC,OAAO,EAAE;QACP,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,EAAE;KACV;IACD,MAAM,EAAE,EAAE;IACV,YAAY,EAAE,EAAE;IAChB,wBAAwB,EAAE;QACxB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,KAAK;KACZ;CACF,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,CAAoB,EAAE,EAAE;IAC1C,MAAM,OAAO,GACX,mGAAmG,CAAC;IACtG,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,qDAAqD;IACrD,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,8CAA8C;AACjC,QAAA,aAAa,GAAG,IAAA,qBAAW,EAAC;IACvC,IAAI,EAAE,UAAU;IAChB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AC,CAAC;QACtD,CAAC;QACD,6BAA6B,EAAE,CAAC,KAAK,EAAE,EAAE;YACvC,KAAK,CAAC,wBAAwB,CAAC,IAAI,GAAG,KAAK,CAAC;YAC5C,KAAK,CAAC,wBAAwB,CAAC,OAAO,GAAG,KAAK,CAAC;YAC/C,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC;QACD,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAiC,EAAE,EAAE;YAClE,KAAK,CAAC,wBAAwB,CAAC,IAAI,GAAG,IAAI,CAAC;YAC3C,KAAK,CAAC,wBAAwB,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;QAC7D,CAAC;QACD,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE;YAChC,KAAK,CAAC,wBAAwB,CAAC,IAAI,GAAG,KAAK,CAAC;YAC5C,KAAK,CAAC,wBAAwB,CAAC,UAAU,GAAG,SAAS,CAAC;QACxD,CAAC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,qBAAa,CAAC,OAAO,CAAC;AACxC,QAAA,eAAe,GAAG,qBAAa,CAAC,OAAO,CAAC;AAExC,QAAA,iBAAiB,GAAG;IAC/B,aAAa,EAAE,CAAC,KAAkC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM;IACpF,YAAY,EAAE,CAAC,KAAkC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;IAC3E,cAAc,EAAE,CAAC,KAAkC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY;IACnF,8BAA8B,EAAE,CAAC,KAAkC,EAAE,EAAE,CACrE,KAAK,CAAC,QAAQ,CAAC,wBAAwB;CAC1C,CAAC"}
@@ -3,7 +3,7 @@ import * as t from 'io-ts';
3
3
  import { EnhancedStore } from '@reduxjs/toolkit';
4
4
  /** To show an error popup to inform of the not valid session */
5
5
  export declare const onRedirectToLogin: (store: EnhancedStore) => {
6
- payload: import("../redux/slices/appStateSlice").AppError;
6
+ payload: import("../model/AppError").AppError;
7
7
  type: string;
8
8
  };
9
9
  /** Return the implementation of fetch configured with a timeout */
@@ -4,6 +4,7 @@ export declare const STORAGE_KEY_USER = "user";
4
4
  /** The key used to store in the session storage the logged user token in selfcare projects */
5
5
  export declare const STORAGE_KEY_TOKEN = "token";
6
6
  export declare const LOADING_TASK_LOGIN_CHECK = "LOGIN_CHECK";
7
+ export declare const LOADING_TASK_RETRIEVE_CACHED_VALUES = "RETRIEVE_CACHED_VALUES";
7
8
  /** The short and long labels used for the roles of selfcare's projects */
8
9
  export declare const roleLabels: {
9
10
  [key in UserRole]: {
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.roleLabels = exports.LOADING_TASK_LOGIN_CHECK = exports.STORAGE_KEY_TOKEN = exports.STORAGE_KEY_USER = void 0;
3
+ exports.roleLabels = exports.LOADING_TASK_RETRIEVE_CACHED_VALUES = exports.LOADING_TASK_LOGIN_CHECK = exports.STORAGE_KEY_TOKEN = exports.STORAGE_KEY_USER = void 0;
4
4
  /** The key used to store in the session storage the loggedUser in selfcare projects */
5
5
  exports.STORAGE_KEY_USER = 'user';
6
6
  /** The key used to store in the session storage the logged user token in selfcare projects */
7
7
  exports.STORAGE_KEY_TOKEN = 'token';
8
8
  exports.LOADING_TASK_LOGIN_CHECK = 'LOGIN_CHECK';
9
+ exports.LOADING_TASK_RETRIEVE_CACHED_VALUES = 'RETRIEVE_CACHED_VALUES';
9
10
  /** The short and long labels used for the roles of selfcare's projects */
10
11
  exports.roleLabels = {
11
- ADMIN: { shortLabel: 'Ref. Amministrativo', longLabel: 'Referente Amministrativo', description: 'Gestisce i prodotti e gli utenti attivi' },
12
- LIMITED: { shortLabel: 'Ref. Operativo', longLabel: 'Referente Operativo', description: 'Operatore prodotto' },
12
+ ADMIN: {
13
+ shortLabel: 'Ref. Amministrativo',
14
+ longLabel: 'Referente Amministrativo',
15
+ description: 'Gestisce i prodotti e gli utenti attivi',
16
+ },
17
+ LIMITED: {
18
+ shortLabel: 'Ref. Operativo',
19
+ longLabel: 'Referente Operativo',
20
+ description: 'Operatore prodotto',
21
+ },
13
22
  };
14
23
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEA,uFAAuF;AAC1E,QAAA,gBAAgB,GAAG,MAAM,CAAC;AACvC,8FAA8F;AACjF,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAE5B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AAEtD,0EAA0E;AAC7D,QAAA,UAAU,GAAyF;IAC9G,KAAK,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,0BAA0B,EAAC,WAAW,EAAC,yCAAyC,EAAE;IACzI,OAAO,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAC,oBAAoB,EAAE;CAC9G,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEA,uFAAuF;AAC1E,QAAA,gBAAgB,GAAG,MAAM,CAAC;AACvC,8FAA8F;AACjF,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAE5B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AACzC,QAAA,mCAAmC,GAAG,wBAAwB,CAAC;AAE5E,0EAA0E;AAC7D,QAAA,UAAU,GAEnB;IACF,KAAK,EAAE;QACL,UAAU,EAAE,qBAAqB;QACjC,SAAS,EAAE,0BAA0B;QACrC,WAAW,EAAE,yCAAyC;KACvD;IACD,OAAO,EAAE;QACP,UAAU,EAAE,gBAAgB;QAC5B,SAAS,EAAE,qBAAqB;QAChC,WAAW,EAAE,oBAAoB;KAClC;CACF,CAAC"}