@pagopa/selfcare-common-frontend 1.5.6 → 1.5.7

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,14 @@ 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.7](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.6...v1.5.7)
8
+
9
+ - withRetrievedValue will provide reload function to decorated component [`#32`](https://github.com/pagopa/selfcare-common-frontend/pull/32)
10
+
7
11
  #### [v1.5.6](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.5...v1.5.6)
8
12
 
13
+ > 15 February 2022
14
+
9
15
  - added useReduxCachedValue overloaded versions [`#31`](https://github.com/pagopa/selfcare-common-frontend/pull/31)
10
16
 
11
17
  #### [v1.5.5](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.4...v1.5.5)
package/README.md CHANGED
@@ -178,8 +178,10 @@ Accessing to the components decorated with it without a session will brought to
178
178
  It's possible to modify the login path changing the value in [CONFIG.URL_FE.LOGIN](#Configuration) inside the index.tsx file
179
179
 
180
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
181
+ Decorator to retrieve a value and serve it once ready to the decorated component, moreover it will provide the decorated component a function to re-execute the retrieve method.
182
+
183
+ Using it together with [useReduxCachedValue](#usereduxcachedvalue) will allow to build a component which will use centralized and cached data (the reload function in this case will call again the function that will retrieve cached data).
184
+
183
185
  See withRetrievedValue.test.tsx file for an example.
184
186
 
185
187
  Given the following type parameters:
package/build.info CHANGED
@@ -1,2 +1,2 @@
1
- 20220215.4 - selfcare-common-frontend.deploy(20523)
2
- tags/v1.5.6^0 a10eb0eb4a982c94dbdc31dd302451d6f6b9ac4d
1
+ 20220217.1 - selfcare-common-frontend.deploy(20683)
2
+ tags/v1.5.7^0 3ef3ca1f646f441368263714173344943d4075cd
@@ -11,4 +11,4 @@ WrappedComponent: React.ComponentType<PROPS>,
11
11
  /** What to do in case of error. As default, it will use the feature ErrorBoundary */
12
12
  onError?: (appError: AppError) => void,
13
13
  /** A component to show while waiting for the value */
14
- onLoading?: ReactNode): import("react").ComponentType<Omit<PROPS, PROP_NAME>>;
14
+ onLoading?: ReactNode): import("react").ComponentType<Omit<PROPS, PROP_NAME | "reload">>;
@@ -19,10 +19,10 @@ onLoading) {
19
19
  const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
20
20
  const ComponentWithParties = (props) => {
21
21
  const [value, setValue] = (0, react_1.useState)();
22
- const cachedRetrieve = getRetrieverService();
22
+ const retrieverService = getRetrieverService();
23
23
  const addError = (0, useErrorDispatcher_1.default)();
24
24
  const doRetrieve = () => {
25
- cachedRetrieve()
25
+ retrieverService()
26
26
  .then((v) => setValue(v))
27
27
  .catch((reason) => (onError !== null && onError !== void 0 ? onError : addError)({
28
28
  id: `RETRIEVE_VALUE_${propEntityName}`,
@@ -38,7 +38,7 @@ onLoading) {
38
38
  doRetrieve();
39
39
  }
40
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));
41
+ return value !== undefined ? ((0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, props, { [propEntityName]: value }, { reload: doRetrieve }), void 0)) : (onLoading !== null && onLoading !== void 0 ? onLoading : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0));
42
42
  };
43
43
  // eslint-disable-next-line functional/immutable-data
44
44
  ComponentWithParties.displayName = `withRetrieve${propEntityName}(${displayName})`;
@@ -1 +1 @@
1
- {"version":3,"file":"withRetrievedValue.js","sourceRoot":"","s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AAE;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,oBACV,KAAe,EAChB,EAAE,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,IAC/B,MAAM,EAAE,UAAU,YAClB,CACH,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,oBAA8E,CAAC;AACxF,CAAC;AA5DD,qCA4DC"}
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.5.6",
4
+ "version": "1.5.7",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",