@redacto.io/consent-sdk-react 3.3.0 → 3.5.0
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 +12 -0
- package/README.md +11 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +321 -155
- package/dist/index.mjs +321 -155
- package/package.json +1 -1
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +123 -1
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +924 -652
- package/src/RedactoNoticeConsent/api/index.ts +31 -65
- package/src/RedactoNoticeConsent/api/types.ts +47 -33
- package/src/RedactoNoticeConsent/constants.ts +20 -0
- package/src/RedactoNoticeConsent/styles.ts +3 -6
- package/src/RedactoNoticeConsent/types.ts +11 -5
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +12 -3
- package/src/RedactoNoticeConsentInline/api/index.ts +26 -64
- package/src/RedactoNoticeConsentInline/api/types.ts +8 -31
- package/src/RedactoNoticeConsentInline/types.ts +9 -4
- package/src/types/react-jsx.d.ts +26 -0
- package/tests/mocks.ts +53 -7
- package/tsconfig.json +1 -5
- package/src/utils/isLegacyApi.ts +0 -12
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -226,6 +226,8 @@ A modal popup component for consent collection. Displays a full-screen modal wit
|
|
|
226
226
|
| `settings` | `object` | No | - | Custom styling options |
|
|
227
227
|
| `applicationId` | `string` | No | - | Application-specific UUID |
|
|
228
228
|
| `validateAgainst` | `"all" \| "required"` | No | `"all"` | Consent validation mode (see below) |
|
|
229
|
+
| `includeFullyConsentedData` | `boolean` | No | `false` | When true, API returns 200 with pre-selected purposes instead of 409 when user has already consented |
|
|
230
|
+
| `reviewModeButtonText` | `string` | No | `"Continue"` | Button text when in fully consented review mode (magic link flow) |
|
|
229
231
|
| `onAccept` | `() => void` | Yes | - | Callback when consent is accepted |
|
|
230
232
|
| `onDecline` | `() => void` | Yes | - | Callback when consent is declined |
|
|
231
233
|
| `onError` | `(error: Error) => void` | No | - | Error handler callback |
|
|
@@ -244,6 +246,15 @@ The `validateAgainst` prop controls how the backend validates consent status whe
|
|
|
244
246
|
- Use `"required"` for reconsent scenarios or when you only need to verify mandatory consent requirements
|
|
245
247
|
- The mode affects API caching behavior: `"all"` responses are cached for performance, while `"required"` responses bypass cache to ensure up-to-date validation
|
|
246
248
|
|
|
249
|
+
**`includeFullyConsentedData` Parameter:**
|
|
250
|
+
|
|
251
|
+
When users arrive via a magic link and have already consented, the API normally returns 409 and the SDK bypasses to "Already Consented". Set `includeFullyConsentedData={true}` to instead show a **read-only review** of what they consented to, then a single Continue button.
|
|
252
|
+
|
|
253
|
+
- **Purposes**: Green tick for each selected purpose
|
|
254
|
+
- **Data elements**: Green tick = consented, empty circle = not consented (all read-only, no editing)
|
|
255
|
+
- **Partial selection**: If a purpose is selected but some data elements within it are not, the review correctly shows green ticks for consented elements and empty circles for non-consented ones
|
|
256
|
+
- Use `reviewModeButtonText` to customize the button label (default: "Continue")
|
|
257
|
+
|
|
247
258
|
### `RedactoNoticeConsentInline`
|
|
248
259
|
|
|
249
260
|
An inline component for embedding consent directly in forms. The component can load consent content without tokens and automatically submits consent when tokens are provided and all required conditions are met.
|
package/dist/index.d.mts
CHANGED
|
@@ -40,6 +40,8 @@ type Props$1 = Readonly<{
|
|
|
40
40
|
onError?: (error: Error) => void;
|
|
41
41
|
applicationId?: string;
|
|
42
42
|
validateAgainst?: "all" | "required";
|
|
43
|
+
includeFullyConsentedData?: boolean;
|
|
44
|
+
reviewModeButtonText?: string;
|
|
43
45
|
}>;
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -49,7 +51,7 @@ type Props$1 = Readonly<{
|
|
|
49
51
|
* to view and manage their consent preferences. Supports both initial consent
|
|
50
52
|
* collection and reconsent flows.
|
|
51
53
|
*/
|
|
52
|
-
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
53
55
|
|
|
54
56
|
type Settings = {
|
|
55
57
|
button: {
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ type Props$1 = Readonly<{
|
|
|
40
40
|
onError?: (error: Error) => void;
|
|
41
41
|
applicationId?: string;
|
|
42
42
|
validateAgainst?: "all" | "required";
|
|
43
|
+
includeFullyConsentedData?: boolean;
|
|
44
|
+
reviewModeButtonText?: string;
|
|
43
45
|
}>;
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -49,7 +51,7 @@ type Props$1 = Readonly<{
|
|
|
49
51
|
* to view and manage their consent preferences. Supports both initial consent
|
|
50
52
|
* collection and reconsent flows.
|
|
51
53
|
*/
|
|
52
|
-
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
53
55
|
|
|
54
56
|
type Settings = {
|
|
55
57
|
button: {
|