@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.
@@ -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
+ CLI Building entry: {"index":"src/index.ts"}
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Using tsup config: /Users/sadanmianredacto/Developer/consent-sdk/packages/consent-sdk-react/tsup.config.ts
10
+ CLI Target: es2019
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ CJS Build start
14
+ ESM dist/index.mjs 151.83 KB
15
+ ESM ⚡️ Build success in 13ms
16
+ CJS dist/index.js 157.63 KB
17
+ CJS ⚡️ 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
@@ -1,5 +1,17 @@
1
1
  # @redacto.io/consent-sdk-react
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - downgrade react version in sdk
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - accessibility voice over cahnges
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
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 19.1.0 or higher
722
- - React DOM 19.1.0 or higher
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
- ISC
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
- const allRequiredElementsChecked = requiredElements.every(
1966
- (el) => newState[`${purposeUuid}-${el.uuid}`]
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]: allRequiredElementsChecked
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
- const allRequiredElementsChecked = requiredElements.every(
1939
- (el) => newState[`${purposeUuid}-${el.uuid}`]
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]: allRequiredElementsChecked
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": "2.0.0",
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
- const allRequiredElementsChecked = requiredElements.every(
1324
- (el) => newState[`${purposeUuid}-${el.uuid}`]
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]: allRequiredElementsChecked,
1340
+ [purposeUuid]: shouldCheckPurpose,
1330
1341
  }));
1331
1342
  }
1332
1343