@redacto.io/consent-sdk-react 10.2.1-beta.1 → 10.2.1

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/dist/index.js CHANGED
@@ -4023,14 +4023,39 @@ var RedactoNoticeConsent = ({
4023
4023
  if (purposeSelections || productPurposeSelections) {
4024
4024
  const settled = {};
4025
4025
  const settledRows = {};
4026
+ const rowNeedsAttention = ({
4027
+ purpose,
4028
+ productUuid
4029
+ }) => {
4030
+ var _a3;
4031
+ return ((_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.needs_reconsent) === true;
4032
+ };
4033
+ const gated = gatedProductUuids(activeConfig.products);
4034
+ const marksMandatory = serverMarksMandatoryProducts(
4035
+ activeConfig.products
4036
+ );
4037
+ const rowIsMandatory = (row) => {
4038
+ const resolved = rowProductUuid(row, activeConfig.products);
4039
+ return (!marksMandatory || !!resolved && gated.has(resolved)) && hasRequiredDataElement(row.purpose);
4040
+ };
4041
+ const rowsByProduct = /* @__PURE__ */ new Map();
4026
4042
  seedRows.forEach((row) => {
4027
4043
  var _a3;
4028
- const recorded = rowIsRecorded(row);
4029
- if (!row.productUuid) {
4044
+ const resolved = rowProductUuid(row, activeConfig.products);
4045
+ if (!resolved) {
4030
4046
  return;
4031
4047
  }
4032
- settledRows[productPurposeKey(row.productUuid, row.purpose.uuid)] = recorded;
4033
- settled[row.productUuid] = ((_a3 = settled[row.productUuid]) != null ? _a3 : true) && recorded;
4048
+ settledRows[productPurposeKey(row.productUuid, row.purpose.uuid)] = rowIsRecorded(row) && !rowNeedsAttention(row);
4049
+ const rows = (_a3 = rowsByProduct.get(resolved)) != null ? _a3 : [];
4050
+ rows.push(row);
4051
+ rowsByProduct.set(resolved, rows);
4052
+ });
4053
+ rowsByProduct.forEach((rows, productUuid) => {
4054
+ const mandatory = rows.filter(rowIsMandatory);
4055
+ const deciding = mandatory.length > 0 ? mandatory : rows;
4056
+ settled[productUuid] = deciding.every(
4057
+ (row) => rowIsRecorded(row) && !rowNeedsAttention(row)
4058
+ );
4034
4059
  });
4035
4060
  setConsentedProducts(settled);
4036
4061
  setConsentedPurposes(settledRows);
package/dist/index.mjs CHANGED
@@ -3698,14 +3698,39 @@ var RedactoNoticeConsent = ({
3698
3698
  if (purposeSelections || productPurposeSelections) {
3699
3699
  const settled = {};
3700
3700
  const settledRows = {};
3701
+ const rowNeedsAttention = ({
3702
+ purpose,
3703
+ productUuid
3704
+ }) => {
3705
+ var _a3;
3706
+ return ((_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.needs_reconsent) === true;
3707
+ };
3708
+ const gated = gatedProductUuids(activeConfig.products);
3709
+ const marksMandatory = serverMarksMandatoryProducts(
3710
+ activeConfig.products
3711
+ );
3712
+ const rowIsMandatory = (row) => {
3713
+ const resolved = rowProductUuid(row, activeConfig.products);
3714
+ return (!marksMandatory || !!resolved && gated.has(resolved)) && hasRequiredDataElement(row.purpose);
3715
+ };
3716
+ const rowsByProduct = /* @__PURE__ */ new Map();
3701
3717
  seedRows.forEach((row) => {
3702
3718
  var _a3;
3703
- const recorded = rowIsRecorded(row);
3704
- if (!row.productUuid) {
3719
+ const resolved = rowProductUuid(row, activeConfig.products);
3720
+ if (!resolved) {
3705
3721
  return;
3706
3722
  }
3707
- settledRows[productPurposeKey(row.productUuid, row.purpose.uuid)] = recorded;
3708
- settled[row.productUuid] = ((_a3 = settled[row.productUuid]) != null ? _a3 : true) && recorded;
3723
+ settledRows[productPurposeKey(row.productUuid, row.purpose.uuid)] = rowIsRecorded(row) && !rowNeedsAttention(row);
3724
+ const rows = (_a3 = rowsByProduct.get(resolved)) != null ? _a3 : [];
3725
+ rows.push(row);
3726
+ rowsByProduct.set(resolved, rows);
3727
+ });
3728
+ rowsByProduct.forEach((rows, productUuid) => {
3729
+ const mandatory = rows.filter(rowIsMandatory);
3730
+ const deciding = mandatory.length > 0 ? mandatory : rows;
3731
+ settled[productUuid] = deciding.every(
3732
+ (row) => rowIsRecorded(row) && !rowNeedsAttention(row)
3733
+ );
3709
3734
  });
3710
3735
  setConsentedProducts(settled);
3711
3736
  setConsentedPurposes(settledRows);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react",
3
- "version": "10.2.1-beta.1",
3
+ "version": "10.2.1",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",