@pagopa/selfcare-common-frontend 1.5.5 → 1.5.6
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 +6 -0
- package/README.md +7 -1
- package/build.info +2 -2
- package/hooks/useReduxCachedValue.d.ts +8 -3
- package/hooks/useReduxCachedValue.js +10 -5
- package/hooks/useReduxCachedValue.js.map +1 -1
- package/package.json +1 -1
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.6](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.5...v1.5.6)
|
|
8
|
+
|
|
9
|
+
- added useReduxCachedValue overloaded versions [`#31`](https://github.com/pagopa/selfcare-common-frontend/pull/31)
|
|
10
|
+
|
|
7
11
|
#### [v1.5.5](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.4...v1.5.5)
|
|
8
12
|
|
|
13
|
+
> 15 February 2022
|
|
14
|
+
|
|
9
15
|
- useReduxCachedValueTranscoded transcode function will accept retrieverServiceArgs [`#30`](https://github.com/pagopa/selfcare-common-frontend/pull/30)
|
|
10
16
|
|
|
11
17
|
#### [v1.5.4](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.3...v1.5.4)
|
package/README.md
CHANGED
|
@@ -204,9 +204,15 @@ Cached values are stored using useRef, so they are local to the component using
|
|
|
204
204
|
The sorting actually is applied using string representation
|
|
205
205
|
|
|
206
206
|
## useReduxCachedValue
|
|
207
|
-
See [
|
|
207
|
+
See [useReduxCachedValueParametricRetrieverTranscoded](#usereduxcachedvaluetranscoded) when there is not RETRIEVER_ARGS and RETRIEVED_VALUE === RETRIEVER_ARGS
|
|
208
|
+
|
|
209
|
+
## useReduxCachedValueParametricRetriever
|
|
210
|
+
See [useReduxCachedValueParametricRetrieverTranscoded](#usereduxcachedvaluetranscoded) when RETRIEVED_VALUE === RETRIEVER_ARGS
|
|
208
211
|
|
|
209
212
|
## useReduxCachedValueTranscoded
|
|
213
|
+
See [useReduxCachedValueParametricRetrieverTranscoded](#usereduxcachedvaluetranscoded) when there is not RETRIEVER_ARGS
|
|
214
|
+
|
|
215
|
+
## useReduxCachedValueParametricRetrieverTranscoded
|
|
210
216
|
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
217
|
See useReduxCachedValue.test.tsx file for an example.
|
|
212
218
|
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
20220215.
|
|
2
|
-
tags/v1.5.
|
|
1
|
+
20220215.4 - selfcare-common-frontend.deploy(20523)
|
|
2
|
+
tags/v1.5.6^0 a10eb0eb4a982c94dbdc31dd302451d6f6b9ac4d
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
/** @see {useReduxCachedValue} when RETRIEVED_VALUE === STORED_VALUE */
|
|
3
|
-
declare const useReduxCachedValue: <RETRIEVED_VALUE,
|
|
2
|
+
/** @see {useReduxCachedValue} when there is not RETRIEVER_ARGS and RETRIEVED_VALUE === STORED_VALUE */
|
|
3
|
+
declare const useReduxCachedValue: <RETRIEVED_VALUE extends Record<string, any>>(entity: string, retrieverService: () => Promise<RETRIEVED_VALUE>, reduxSelector: (state: any) => RETRIEVED_VALUE | undefined, reduxSetterAction: (value: RETRIEVED_VALUE) => PayloadAction<any>, selectedValuePredicate2Retrieve?: ((value: RETRIEVED_VALUE) => boolean) | undefined, alwaysRetrieve?: boolean | undefined) => () => Promise<RETRIEVED_VALUE>;
|
|
4
|
+
/** @see {useReduxCachedValueParametricRetrieverTranscoded} when there is not RETRIEVER_ARGS */
|
|
5
|
+
export declare const useReduxCachedValueTranscoded: <RETRIEVED_VALUE, STORED_VALUE>(entity: string, retrieverService: () => Promise<RETRIEVED_VALUE>, reduxSelector: (state: any) => STORED_VALUE | undefined, reduxSetterAction: (value: RETRIEVED_VALUE) => {
|
|
6
|
+
payload: STORED_VALUE;
|
|
7
|
+
type: string;
|
|
8
|
+
}, selectedValue2RetrievedValue: (value: STORED_VALUE) => RETRIEVED_VALUE, selectedValuePredicate2Retrieve?: ((value: STORED_VALUE) => boolean) | undefined, alwaysRetrieve?: boolean | undefined) => () => Promise<RETRIEVED_VALUE>;
|
|
4
9
|
/** 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
|
|
10
|
+
export declare const useReduxCachedValueParametricRetrieverTranscoded: <RETRIEVED_VALUE, STORED_VALUE, RETRIEVER_ARGS>(entity: string, retrieverService: (retrieverServiceArgs: RETRIEVER_ARGS) => Promise<RETRIEVED_VALUE>, reduxSelector: (state: any) => STORED_VALUE | undefined, reduxSetterAction: (value: RETRIEVED_VALUE, retrieverServiceArgs: RETRIEVER_ARGS) => {
|
|
6
11
|
payload: STORED_VALUE;
|
|
7
12
|
type: string;
|
|
8
13
|
}, selectedValue2RetrievedValue: (value: STORED_VALUE, args: RETRIEVER_ARGS) => RETRIEVED_VALUE, selectedValuePredicate2Retrieve?: ((value: STORED_VALUE, args: RETRIEVER_ARGS) => boolean) | undefined, alwaysRetrieve?: boolean | undefined) => (retrieverServiceArgs: RETRIEVER_ARGS) => Promise<RETRIEVED_VALUE>;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useReduxCachedValueTranscoded = void 0;
|
|
3
|
+
exports.useReduxCachedValueParametricRetrieverTranscoded = exports.useReduxCachedValueTranscoded = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_redux_1 = require("react-redux");
|
|
6
6
|
const constants_1 = require("../utils/constants");
|
|
7
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) => (
|
|
8
|
+
/** @see {useReduxCachedValue} when there is not RETRIEVER_ARGS and RETRIEVED_VALUE === STORED_VALUE */
|
|
9
|
+
const useReduxCachedValue = (entity, retrieverService, reduxSelector, reduxSetterAction, selectedValuePredicate2Retrieve, alwaysRetrieve) => useReduxCachedValueParametricRetriever(entity, retrieverService, reduxSelector, reduxSetterAction, selectedValuePredicate2Retrieve, alwaysRetrieve);
|
|
10
|
+
/** @see {useReduxCachedValueParametricRetrieverTranscoded} when RETRIEVED_VALUE === STORED_VALUE */
|
|
11
|
+
const useReduxCachedValueParametricRetriever = (entity, retrieverService, reduxSelector, reduxSetterAction, selectedValuePredicate2Retrieve, alwaysRetrieve) => (0, exports.useReduxCachedValueParametricRetrieverTranscoded)(entity, retrieverService, reduxSelector, reduxSetterAction, (value) => value, selectedValuePredicate2Retrieve, alwaysRetrieve);
|
|
12
|
+
/** @see {useReduxCachedValueParametricRetrieverTranscoded} when there is not RETRIEVER_ARGS */
|
|
13
|
+
const useReduxCachedValueTranscoded = (entity, retrieverService, reduxSelector, reduxSetterAction, selectedValue2RetrievedValue, selectedValuePredicate2Retrieve, alwaysRetrieve) => (0, exports.useReduxCachedValueParametricRetrieverTranscoded)(entity, retrieverService, reduxSelector, reduxSetterAction, selectedValue2RetrievedValue, selectedValuePredicate2Retrieve, alwaysRetrieve);
|
|
14
|
+
exports.useReduxCachedValueTranscoded = useReduxCachedValueTranscoded;
|
|
10
15
|
/** 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
|
|
16
|
+
const useReduxCachedValueParametricRetrieverTranscoded = (
|
|
12
17
|
/** The name of the entity, used just for logging purpose */
|
|
13
18
|
entity,
|
|
14
19
|
/** The service that will retrieve the value */
|
|
@@ -45,6 +50,6 @@ alwaysRetrieve) => {
|
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
52
|
};
|
|
48
|
-
exports.
|
|
53
|
+
exports.useReduxCachedValueParametricRetrieverTranscoded = useReduxCachedValueParametricRetrieverTranscoded;
|
|
49
54
|
exports.default = useReduxCachedValue;
|
|
50
55
|
//# sourceMappingURL=useReduxCachedValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReduxCachedValue.js","sourceRoot":"","sources":["../../src/lib/hooks/useReduxCachedValue.tsx"],"names":[],"mappings":";;;;AACA,6CAAuD;AACvD,kDAAyE;AACzE,2EAAsC;AAEtC,
|
|
1
|
+
{"version":3,"file":"useReduxCachedValue.js","sourceRoot":"","sources":["../../src/lib/hooks/useReduxCachedValue.tsx"],"names":[],"mappings":";;;;AACA,6CAAuD;AACvD,kDAAyE;AACzE,2EAAsC;AAEtC,uGAAuG;AACvG,MAAM,mBAAmB,GAAG,CAC1B,MAAc,EACd,gBAAgD,EAChD,aAA0D,EAC1D,iBAAiE,EACjE,+BAAqE,EACrE,cAAwB,EACU,EAAE,CACpC,sCAAsC,CACpC,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,+BAA+B,EAC/B,cAAc,CACmB,CAAC;AAEtC,oGAAoG;AACpG,MAAM,sCAAsC,GAAG,CAC7C,MAAc,EACd,gBAAoF,EACpF,aAA0D,EAC1D,iBAGuB,EACvB,+BAA2F,EAC3F,cAAwB,EAC8C,EAAE,CACxE,IAAA,wDAAgD,EAC9C,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAChB,+BAA+B,EAC/B,cAAc,CACf,CAAC;AAEJ,+FAA+F;AACxF,MAAM,6BAA6B,GAAG,CAC3C,MAAc,EACd,gBAAgD,EAChD,aAAuD,EACvD,iBAA0E,EAC1E,4BAAsE,EACtE,+BAAkE,EAClE,cAAwB,EACU,EAAE,CACpC,IAAA,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CAAC,OAAO,EAAE,EAAE,CAC7B,OAAO,CAAC,4BAA4B,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CACtE,CAAC;SACH;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAlDW,QAAA,gDAAgD,oDAkD3D;AAEF,kBAAe,mBAAmB,CAAC"}
|
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.
|
|
4
|
+
"version": "1.5.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|