@redacto.io/consent-sdk-react 2.0.0 → 3.0.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/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +12 -0
- package/README.md +3 -10
- package/dist/index.js +11 -4
- package/dist/index.mjs +11 -4
- package/package.json +6 -4
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +15 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @redacto.io/consent-sdk-react@2.1.0 build /Users/sadanmianredacto/Developer/consent-sdk/packages/consent-sdk-react
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: {"index":"src/index.ts"}
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/sadanmianredacto/Developer/consent-sdk/packages/consent-sdk-react/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2019
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[34mCJS[39m Build start
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m151.83 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 13ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m157.63 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 13ms
|
|
18
|
+
DTS Build start
|
|
19
|
+
DTS ⚡️ Build success in 671ms
|
|
20
|
+
DTS dist/index.d.mts 2.79 KB
|
|
21
|
+
DTS dist/index.d.ts 2.79 KB
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -28,12 +28,10 @@ The SDK follows a client-server architecture pattern:
|
|
|
28
28
|
### How It Works
|
|
29
29
|
|
|
30
30
|
1. **Your Backend Server**: Your server acts as a proxy between your React application and Redacto's API. It handles:
|
|
31
|
-
|
|
32
31
|
- Generating access tokens
|
|
33
32
|
- Token refresh operations
|
|
34
33
|
|
|
35
34
|
2. **React Application**: Your React app uses the SDK components to:
|
|
36
|
-
|
|
37
35
|
- Display consent notices
|
|
38
36
|
- Collect user consent choices
|
|
39
37
|
- Submit consent records to Redacto API
|
|
@@ -58,25 +56,21 @@ The SDK follows a client-server architecture pattern:
|
|
|
58
56
|
## Features
|
|
59
57
|
|
|
60
58
|
- **Consent Notice Display**
|
|
61
|
-
|
|
62
59
|
- Customizable consent notices
|
|
63
60
|
- Multiple display formats (modal popup, inline form)
|
|
64
61
|
- Responsive design
|
|
65
62
|
|
|
66
63
|
- **Consent Collection**
|
|
67
|
-
|
|
68
64
|
- User consent choices (accept, reject, manage preferences)
|
|
69
65
|
- Granular consent management
|
|
70
66
|
- Persistent consent storage
|
|
71
67
|
|
|
72
68
|
- **API Integration**
|
|
73
|
-
|
|
74
69
|
- Seamless communication with Redacto CMP API
|
|
75
70
|
- Automatic error handling and retries
|
|
76
71
|
- Token-based authentication
|
|
77
72
|
|
|
78
73
|
- **Configuration**
|
|
79
|
-
|
|
80
74
|
- Customizable UI settings
|
|
81
75
|
- Language preferences
|
|
82
76
|
- API endpoint configuration
|
|
@@ -194,7 +188,6 @@ app.post(
|
|
|
194
188
|
Your backend needs to call the following Redacto API endpoints:
|
|
195
189
|
|
|
196
190
|
1. **Generate Access Token**
|
|
197
|
-
|
|
198
191
|
- **Endpoint**: `POST /public/organisations/{organisation_uuid}/workspaces/{workspace_uuid}/tokens/generate-access-token`
|
|
199
192
|
- **Headers**: `X-CMS-API-Key: {your-cms-api-key}`
|
|
200
193
|
- **Body**: `{ email, expires_in_days? }`
|
|
@@ -718,8 +711,8 @@ npm test --workspace=@redacto.io/consent-sdk-react
|
|
|
718
711
|
|
|
719
712
|
### Requirements
|
|
720
713
|
|
|
721
|
-
- React
|
|
722
|
-
- React DOM
|
|
714
|
+
- React 16.8.0 or higher (including React 17, 18, and 19)
|
|
715
|
+
- React DOM 16.8.0 or higher (including React DOM 17, 18, and 19)
|
|
723
716
|
|
|
724
717
|
### Additional Features
|
|
725
718
|
|
|
@@ -732,4 +725,4 @@ npm test --workspace=@redacto.io/consent-sdk-react
|
|
|
732
725
|
|
|
733
726
|
## License
|
|
734
727
|
|
|
735
|
-
|
|
728
|
+
Apache-2.0
|
package/dist/index.js
CHANGED
|
@@ -1962,12 +1962,19 @@ var RedactoNoticeConsent = ({
|
|
|
1962
1962
|
const requiredElements = purpose.data_elements.filter(
|
|
1963
1963
|
(el) => el.required
|
|
1964
1964
|
);
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1965
|
+
let shouldCheckPurpose;
|
|
1966
|
+
if (requiredElements.length > 0) {
|
|
1967
|
+
shouldCheckPurpose = requiredElements.every(
|
|
1968
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1969
|
+
);
|
|
1970
|
+
} else {
|
|
1971
|
+
shouldCheckPurpose = purpose.data_elements.every(
|
|
1972
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1973
|
+
);
|
|
1974
|
+
}
|
|
1968
1975
|
setSelectedPurposes((prevPurposes) => ({
|
|
1969
1976
|
...prevPurposes,
|
|
1970
|
-
[purposeUuid]:
|
|
1977
|
+
[purposeUuid]: shouldCheckPurpose
|
|
1971
1978
|
}));
|
|
1972
1979
|
}
|
|
1973
1980
|
return newState;
|
package/dist/index.mjs
CHANGED
|
@@ -1935,12 +1935,19 @@ var RedactoNoticeConsent = ({
|
|
|
1935
1935
|
const requiredElements = purpose.data_elements.filter(
|
|
1936
1936
|
(el) => el.required
|
|
1937
1937
|
);
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1938
|
+
let shouldCheckPurpose;
|
|
1939
|
+
if (requiredElements.length > 0) {
|
|
1940
|
+
shouldCheckPurpose = requiredElements.every(
|
|
1941
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1942
|
+
);
|
|
1943
|
+
} else {
|
|
1944
|
+
shouldCheckPurpose = purpose.data_elements.every(
|
|
1945
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1946
|
+
);
|
|
1947
|
+
}
|
|
1941
1948
|
setSelectedPurposes((prevPurposes) => ({
|
|
1942
1949
|
...prevPurposes,
|
|
1943
|
-
[purposeUuid]:
|
|
1950
|
+
[purposeUuid]: shouldCheckPurpose
|
|
1944
1951
|
}));
|
|
1945
1952
|
}
|
|
1946
1953
|
return newState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redacto.io/consent-sdk-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"jwt-decode": "^4.0.0"
|
|
23
|
-
"react": "^19.1.0",
|
|
24
|
-
"react-dom": "^19.1.0"
|
|
22
|
+
"jwt-decode": "^4.0.0"
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
27
25
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -34,6 +32,10 @@
|
|
|
34
32
|
"typescript": "5.8.2",
|
|
35
33
|
"vitest": "^3.1.3"
|
|
36
34
|
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "^16.8.0 || ^17 || ^18 || ^19",
|
|
37
|
+
"react-dom": "^16.8.0 || ^17 || ^18 || ^19"
|
|
38
|
+
},
|
|
37
39
|
"scripts": {
|
|
38
40
|
"build": "tsup",
|
|
39
41
|
"dev": "tsup --watch",
|
|
@@ -1320,13 +1320,24 @@ export const RedactoNoticeConsent = ({
|
|
|
1320
1320
|
const requiredElements = purpose.data_elements.filter(
|
|
1321
1321
|
(el) => el.required
|
|
1322
1322
|
);
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1323
|
+
|
|
1324
|
+
let shouldCheckPurpose: boolean;
|
|
1325
|
+
|
|
1326
|
+
if (requiredElements.length > 0) {
|
|
1327
|
+
// Has required elements: check purpose when all required are selected
|
|
1328
|
+
shouldCheckPurpose = requiredElements.every(
|
|
1329
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1330
|
+
);
|
|
1331
|
+
} else {
|
|
1332
|
+
// No required elements: check purpose only when ALL elements are selected
|
|
1333
|
+
shouldCheckPurpose = purpose.data_elements.every(
|
|
1334
|
+
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1326
1337
|
|
|
1327
1338
|
setSelectedPurposes((prevPurposes) => ({
|
|
1328
1339
|
...prevPurposes,
|
|
1329
|
-
[purposeUuid]:
|
|
1340
|
+
[purposeUuid]: shouldCheckPurpose,
|
|
1330
1341
|
}));
|
|
1331
1342
|
}
|
|
1332
1343
|
|