@redacto.io/consent-sdk-react 10.2.0-beta.1 → 10.2.1-beta.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/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +328 -203
- package/dist/index.mjs +328 -203
- package/dist/privacy-center.d.mts +10 -2
- package/dist/privacy-center.d.ts +10 -2
- package/dist/privacy-center.js +20 -6
- package/dist/privacy-center.mjs +20 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1219,6 +1219,24 @@ var purposeCoversProduct = (purpose, productUuid) => {
|
|
|
1219
1219
|
return scope.includes(productUuid);
|
|
1220
1220
|
};
|
|
1221
1221
|
var isMultiProduct = (products) => Boolean(products && products.length > 1);
|
|
1222
|
+
var serverMarksMandatoryProducts = (products) => Boolean(
|
|
1223
|
+
products && products.length > 0 && products.every((product) => product.mandatory !== void 0)
|
|
1224
|
+
);
|
|
1225
|
+
var gatedProductUuids = (products) => new Set(
|
|
1226
|
+
(products != null ? products : []).filter((product) => product.mandatory === true).map((product) => product.uuid)
|
|
1227
|
+
);
|
|
1228
|
+
var rowProductUuid = (row, products) => {
|
|
1229
|
+
var _a;
|
|
1230
|
+
return (_a = row.productUuid) != null ? _a : (products == null ? void 0 : products.length) === 1 ? products[0].uuid : void 0;
|
|
1231
|
+
};
|
|
1232
|
+
var rowsUnderGate = (rows, products) => {
|
|
1233
|
+
const gated = gatedProductUuids(products);
|
|
1234
|
+
if (gated.size === 0) return [];
|
|
1235
|
+
return rows.filter((row) => {
|
|
1236
|
+
const productUuid = rowProductUuid(row, products);
|
|
1237
|
+
return productUuid !== void 0 && gated.has(productUuid);
|
|
1238
|
+
});
|
|
1239
|
+
};
|
|
1222
1240
|
var groupPurposesByProduct = (products, purposes, order) => {
|
|
1223
1241
|
if (!products || products.length === 0) return [];
|
|
1224
1242
|
return products.map((product) => {
|
|
@@ -1318,6 +1336,7 @@ var buildPreselection = (purposes, mode) => {
|
|
|
1318
1336
|
return { selectedPurposes, selectedDataElements };
|
|
1319
1337
|
};
|
|
1320
1338
|
var hasRequiredDataElement = (purpose) => purpose.data_elements.some((element) => element.required);
|
|
1339
|
+
var isBlockingRequiredElement = (element) => element.required && element.enabled;
|
|
1321
1340
|
|
|
1322
1341
|
// src/RedactoNoticeConsent/layout.ts
|
|
1323
1342
|
var resolveLogoPosition = (raw) => raw === "center" || raw === "right" ? raw : DEFAULT_LOGO_POSITION;
|
|
@@ -1750,6 +1769,16 @@ var CHEVRON_WRAPPER_STYLE = {
|
|
|
1750
1769
|
justifyContent: "center",
|
|
1751
1770
|
marginLeft: "5px"
|
|
1752
1771
|
};
|
|
1772
|
+
var reviewIndicatorStyle = (size) => ({
|
|
1773
|
+
display: "flex",
|
|
1774
|
+
alignItems: "center",
|
|
1775
|
+
justifyContent: "center",
|
|
1776
|
+
width: `${size}px`,
|
|
1777
|
+
height: `${size}px`,
|
|
1778
|
+
borderRadius: "50%",
|
|
1779
|
+
flexShrink: 0,
|
|
1780
|
+
boxSizing: "border-box"
|
|
1781
|
+
});
|
|
1753
1782
|
var CollapseChevron = ({ open, color }) => /* @__PURE__ */ jsx3("div", { style: CHEVRON_WRAPPER_STYLE, children: /* @__PURE__ */ jsx3(
|
|
1754
1783
|
"svg",
|
|
1755
1784
|
{
|
|
@@ -1772,6 +1801,7 @@ var CollapseChevron = ({ open, color }) => /* @__PURE__ */ jsx3("div", { style:
|
|
|
1772
1801
|
) });
|
|
1773
1802
|
var ProductSectionHeader = ({
|
|
1774
1803
|
product,
|
|
1804
|
+
isRequired,
|
|
1775
1805
|
purposeCount,
|
|
1776
1806
|
allSelected,
|
|
1777
1807
|
someSelected,
|
|
@@ -1812,7 +1842,7 @@ var ProductSectionHeader = ({
|
|
|
1812
1842
|
children: /* @__PURE__ */ jsx3(CollapseChevron, { open: !collapsed, color: headingColor })
|
|
1813
1843
|
}
|
|
1814
1844
|
),
|
|
1815
|
-
/* @__PURE__ */ jsx3("div", { style: styles4.optionTextContainer, children: /* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsx3("div", { style: styles4.optionTextContainer, children: /* @__PURE__ */ jsxs2(
|
|
1816
1846
|
"h2",
|
|
1817
1847
|
{
|
|
1818
1848
|
id: `product-name-${product.uuid}`,
|
|
@@ -1821,7 +1851,10 @@ var ProductSectionHeader = ({
|
|
|
1821
1851
|
...responsiveStyles.optionTitle,
|
|
1822
1852
|
color: headingColor
|
|
1823
1853
|
},
|
|
1824
|
-
children:
|
|
1854
|
+
children: [
|
|
1855
|
+
name,
|
|
1856
|
+
isRequired && /* @__PURE__ */ jsx3(RequiredMarker, {})
|
|
1857
|
+
]
|
|
1825
1858
|
}
|
|
1826
1859
|
) })
|
|
1827
1860
|
] }),
|
|
@@ -1841,6 +1874,7 @@ var ProductSectionHeader = ({
|
|
|
1841
1874
|
var PurposeItem = ({
|
|
1842
1875
|
purpose,
|
|
1843
1876
|
productUuid,
|
|
1877
|
+
productIsRequired,
|
|
1844
1878
|
selectedPurposes,
|
|
1845
1879
|
collapsedPurposes,
|
|
1846
1880
|
selectedDataElements,
|
|
@@ -1910,7 +1944,7 @@ var PurposeItem = ({
|
|
|
1910
1944
|
},
|
|
1911
1945
|
children: [
|
|
1912
1946
|
getTranslatedText(`purposes.name`, purpose.name, purpose.uuid),
|
|
1913
|
-
hasRequiredDataElement(purpose) && /* @__PURE__ */ jsx3(RequiredMarker, {})
|
|
1947
|
+
productIsRequired !== false && hasRequiredDataElement(purpose) && /* @__PURE__ */ jsx3(RequiredMarker, {})
|
|
1914
1948
|
]
|
|
1915
1949
|
},
|
|
1916
1950
|
`purpose-name-${purpose.uuid}-${selectedLanguage}`
|
|
@@ -1954,12 +1988,7 @@ var PurposeItem = ({
|
|
|
1954
1988
|
"div",
|
|
1955
1989
|
{
|
|
1956
1990
|
style: {
|
|
1957
|
-
|
|
1958
|
-
alignItems: "center",
|
|
1959
|
-
justifyContent: "center",
|
|
1960
|
-
width: "20px",
|
|
1961
|
-
height: "20px",
|
|
1962
|
-
borderRadius: "50%",
|
|
1991
|
+
...reviewIndicatorStyle(20),
|
|
1963
1992
|
backgroundColor: "#10B981",
|
|
1964
1993
|
marginLeft: "12px"
|
|
1965
1994
|
},
|
|
@@ -2048,12 +2077,7 @@ var PurposeItem = ({
|
|
|
2048
2077
|
"div",
|
|
2049
2078
|
{
|
|
2050
2079
|
style: {
|
|
2051
|
-
|
|
2052
|
-
alignItems: "center",
|
|
2053
|
-
justifyContent: "center",
|
|
2054
|
-
width: "16px",
|
|
2055
|
-
height: "16px",
|
|
2056
|
-
borderRadius: "50%",
|
|
2080
|
+
...reviewIndicatorStyle(16),
|
|
2057
2081
|
backgroundColor: "#10B981"
|
|
2058
2082
|
},
|
|
2059
2083
|
"aria-label": `Consented to ${getTranslatedText(
|
|
@@ -2089,12 +2113,7 @@ var PurposeItem = ({
|
|
|
2089
2113
|
"div",
|
|
2090
2114
|
{
|
|
2091
2115
|
style: {
|
|
2092
|
-
|
|
2093
|
-
alignItems: "center",
|
|
2094
|
-
justifyContent: "center",
|
|
2095
|
-
width: "16px",
|
|
2096
|
-
height: "16px",
|
|
2097
|
-
borderRadius: "50%",
|
|
2116
|
+
...reviewIndicatorStyle(16),
|
|
2098
2117
|
border: "2px solid #d0d5dd",
|
|
2099
2118
|
backgroundColor: "transparent"
|
|
2100
2119
|
},
|
|
@@ -3024,7 +3043,8 @@ var RedactoNoticeConsent = ({
|
|
|
3024
3043
|
digilockerCallbackUrl = "/digilocker-callback",
|
|
3025
3044
|
// Default callback path
|
|
3026
3045
|
includeFullyConsentedData = false,
|
|
3027
|
-
reviewModeButtonText = "Continue"
|
|
3046
|
+
reviewModeButtonText = "Continue",
|
|
3047
|
+
defaultOpenProducts
|
|
3028
3048
|
}) => {
|
|
3029
3049
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
3030
3050
|
const sandboxParams = useMemo2(
|
|
@@ -3096,6 +3116,8 @@ var RedactoNoticeConsent = ({
|
|
|
3096
3116
|
const [collapsedProducts, setCollapsedProducts] = useState({});
|
|
3097
3117
|
const [collapsedPurposes, setCollapsedPurposes] = useState({});
|
|
3098
3118
|
const [hasAlreadyConsented, setHasAlreadyConsented] = useState(false);
|
|
3119
|
+
const [consentedProducts, setConsentedProducts] = useState({});
|
|
3120
|
+
const [consentedPurposes, setConsentedPurposes] = useState({});
|
|
3099
3121
|
const [isFullyConsentedReviewMode, setIsFullyConsentedReviewMode] = useState(false);
|
|
3100
3122
|
const [isLanguageDropdownOpen, setIsLanguageDropdownOpen] = useState(false);
|
|
3101
3123
|
const [selectedLanguage, setSelectedLanguage] = useState(language);
|
|
@@ -3279,42 +3301,67 @@ var RedactoNoticeConsent = ({
|
|
|
3279
3301
|
},
|
|
3280
3302
|
[content]
|
|
3281
3303
|
);
|
|
3282
|
-
const
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
);
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
if (
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3304
|
+
const productMandatoryIsAuthoritative = useMemo2(
|
|
3305
|
+
() => serverMarksMandatoryProducts(content == null ? void 0 : content.products),
|
|
3306
|
+
[content]
|
|
3307
|
+
);
|
|
3308
|
+
const gatedProducts = useMemo2(
|
|
3309
|
+
() => gatedProductUuids(content == null ? void 0 : content.products),
|
|
3310
|
+
[content]
|
|
3311
|
+
);
|
|
3312
|
+
const productIsRequiredFor = useCallback(
|
|
3313
|
+
(productUuid) => {
|
|
3314
|
+
var _a2;
|
|
3315
|
+
if (!productMandatoryIsAuthoritative) return void 0;
|
|
3316
|
+
const resolved = productUuid != null ? productUuid : ((_a2 = content == null ? void 0 : content.products) == null ? void 0 : _a2.length) === 1 ? content.products[0].uuid : void 0;
|
|
3317
|
+
return resolved !== void 0 && gatedProducts.has(resolved);
|
|
3318
|
+
},
|
|
3319
|
+
[productMandatoryIsAuthoritative, gatedProducts, content]
|
|
3320
|
+
);
|
|
3321
|
+
const confirmSatisfiedWith = useCallback(
|
|
3322
|
+
(selection) => {
|
|
3323
|
+
var _a2;
|
|
3324
|
+
if (!content) return false;
|
|
3325
|
+
if (purposeRows.length === 0) return true;
|
|
3326
|
+
const isSatisfied = ({
|
|
3327
|
+
purpose,
|
|
3328
|
+
productUuid
|
|
3329
|
+
}) => {
|
|
3330
|
+
const key = productPurposeKey(productUuid, purpose.uuid);
|
|
3331
|
+
const requiredElements = purpose.data_elements.filter(
|
|
3332
|
+
isBlockingRequiredElement
|
|
3333
|
+
);
|
|
3334
|
+
return requiredElements.every(
|
|
3335
|
+
(element) => selection[`${key}-${element.uuid}`]
|
|
3336
|
+
);
|
|
3337
|
+
};
|
|
3338
|
+
if (serverMarksMandatoryProducts(content.products)) {
|
|
3339
|
+
return rowsUnderGate(purposeRows, content.products).every(isSatisfied);
|
|
3306
3340
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
(
|
|
3312
|
-
(
|
|
3341
|
+
const rowsByProduct = /* @__PURE__ */ new Map();
|
|
3342
|
+
for (const row of purposeRows) {
|
|
3343
|
+
const groupKey = (_a2 = row.productUuid) != null ? _a2 : "";
|
|
3344
|
+
const group = rowsByProduct.get(groupKey);
|
|
3345
|
+
if (group) {
|
|
3346
|
+
group.push(row);
|
|
3347
|
+
} else {
|
|
3348
|
+
rowsByProduct.set(groupKey, [row]);
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
const groups = [...rowsByProduct.values()];
|
|
3352
|
+
const everyProductHasMandatory = groups.every(
|
|
3353
|
+
(rows) => rows.some(
|
|
3354
|
+
({ purpose }) => purpose.data_elements.some(isBlockingRequiredElement)
|
|
3313
3355
|
)
|
|
3314
|
-
)
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3356
|
+
);
|
|
3357
|
+
return everyProductHasMandatory ? groups.some((rows) => rows.every(isSatisfied)) : purposeRows.every(isSatisfied);
|
|
3358
|
+
},
|
|
3359
|
+
[content, purposeRows]
|
|
3360
|
+
);
|
|
3361
|
+
const areAllRequiredElementsChecked = useMemo2(
|
|
3362
|
+
() => confirmSatisfiedWith(selectedDataElements),
|
|
3363
|
+
[confirmSatisfiedWith, selectedDataElements]
|
|
3364
|
+
);
|
|
3318
3365
|
const acceptDisabled = isSubmitting || !areAllRequiredElementsChecked;
|
|
3319
3366
|
useEffect2(() => {
|
|
3320
3367
|
var _a2, _b2;
|
|
@@ -3327,6 +3374,7 @@ var RedactoNoticeConsent = ({
|
|
|
3327
3374
|
setInitialDataElementSelections({});
|
|
3328
3375
|
setCollapsedPurposes({});
|
|
3329
3376
|
setCollapsedProducts({});
|
|
3377
|
+
setConsentedProducts({});
|
|
3330
3378
|
setHasAlreadyConsented(false);
|
|
3331
3379
|
setErrorMessage(null);
|
|
3332
3380
|
setFetchError(null);
|
|
@@ -3510,15 +3558,18 @@ var RedactoNoticeConsent = ({
|
|
|
3510
3558
|
{}
|
|
3511
3559
|
);
|
|
3512
3560
|
setCollapsedPurposes(initialCollapsedState);
|
|
3561
|
+
const openByDefault = new Set(defaultOpenProducts != null ? defaultOpenProducts : []);
|
|
3562
|
+
const groups = groupPurposesByProduct(
|
|
3563
|
+
activeConfig.products,
|
|
3564
|
+
activeConfig.purposes,
|
|
3565
|
+
activeConfig.product_purpose_order
|
|
3566
|
+
);
|
|
3567
|
+
const soleSection = groups.length === 1;
|
|
3513
3568
|
setCollapsedProducts(
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
activeConfig.purposes,
|
|
3517
|
-
activeConfig.product_purpose_order
|
|
3518
|
-
).reduce(
|
|
3519
|
-
(acc, group, index) => ({
|
|
3569
|
+
groups.reduce(
|
|
3570
|
+
(acc, group) => ({
|
|
3520
3571
|
...acc,
|
|
3521
|
-
[group.product.uuid]:
|
|
3572
|
+
[group.product.uuid]: !soleSection && !openByDefault.has(group.product.uuid)
|
|
3522
3573
|
}),
|
|
3523
3574
|
{}
|
|
3524
3575
|
)
|
|
@@ -3545,9 +3596,10 @@ var RedactoNoticeConsent = ({
|
|
|
3545
3596
|
activeConfig.purposes,
|
|
3546
3597
|
activeConfig.product_purpose_order
|
|
3547
3598
|
);
|
|
3599
|
+
const productPurposeSelections = consentContentData.detail.product_purpose_selections;
|
|
3548
3600
|
const recordedFor = (purposeUuid, productUuid) => {
|
|
3549
|
-
var _a3
|
|
3550
|
-
const perProduct = productUuid ? (
|
|
3601
|
+
var _a3;
|
|
3602
|
+
const perProduct = productUuid ? (_a3 = productPurposeSelections == null ? void 0 : productPurposeSelections[productUuid]) == null ? void 0 : _a3[purposeUuid] : void 0;
|
|
3551
3603
|
return perProduct != null ? perProduct : purposeSelections == null ? void 0 : purposeSelections[purposeUuid];
|
|
3552
3604
|
};
|
|
3553
3605
|
const initialPurposeState = seedRows.reduce(
|
|
@@ -3587,55 +3639,63 @@ var RedactoNoticeConsent = ({
|
|
|
3587
3639
|
{}
|
|
3588
3640
|
);
|
|
3589
3641
|
setSelectedDataElements(initialDataElementState);
|
|
3642
|
+
const rowIsRecorded = ({
|
|
3643
|
+
purpose,
|
|
3644
|
+
productUuid
|
|
3645
|
+
}) => {
|
|
3646
|
+
var _a3;
|
|
3647
|
+
return ((_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.selected) === true;
|
|
3648
|
+
};
|
|
3649
|
+
const recordedElementSelections = () => {
|
|
3650
|
+
const selections = {};
|
|
3651
|
+
seedRows.filter(rowIsRecorded).forEach(({ purpose, productUuid }) => {
|
|
3652
|
+
const rowKey = productPurposeKey(productUuid, purpose.uuid);
|
|
3653
|
+
purpose.data_elements.forEach((element) => {
|
|
3654
|
+
var _a3, _b2, _c2, _d2;
|
|
3655
|
+
selections[`${rowKey}-${element.uuid}`] = (_d2 = (_c2 = (_b2 = (_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) == null ? void 0 : _c2.selected) != null ? _d2 : false;
|
|
3656
|
+
});
|
|
3657
|
+
});
|
|
3658
|
+
return selections;
|
|
3659
|
+
};
|
|
3660
|
+
if (purposeSelections || productPurposeSelections) {
|
|
3661
|
+
const settled = {};
|
|
3662
|
+
const settledRows = {};
|
|
3663
|
+
seedRows.forEach((row) => {
|
|
3664
|
+
var _a3;
|
|
3665
|
+
const recorded = rowIsRecorded(row);
|
|
3666
|
+
if (!row.productUuid) {
|
|
3667
|
+
return;
|
|
3668
|
+
}
|
|
3669
|
+
settledRows[productPurposeKey(row.productUuid, row.purpose.uuid)] = recorded;
|
|
3670
|
+
settled[row.productUuid] = ((_a3 = settled[row.productUuid]) != null ? _a3 : true) && recorded;
|
|
3671
|
+
});
|
|
3672
|
+
setConsentedProducts(settled);
|
|
3673
|
+
setConsentedPurposes(settledRows);
|
|
3674
|
+
}
|
|
3590
3675
|
if (isReconsentRequired && newCategorizedPurposes) {
|
|
3591
3676
|
setIsFullyConsentedReviewMode(false);
|
|
3592
3677
|
const initialSelections = {};
|
|
3593
3678
|
const alreadyConsentedUuids = new Set(
|
|
3594
3679
|
newCategorizedPurposes.alreadyConsented.map((p) => p.uuid)
|
|
3595
3680
|
);
|
|
3596
|
-
seedRows.filter(
|
|
3681
|
+
seedRows.filter(
|
|
3682
|
+
(row) => alreadyConsentedUuids.has(row.purpose.uuid) || rowIsRecorded(row)
|
|
3683
|
+
).forEach(({ purpose, productUuid }) => {
|
|
3597
3684
|
const rowKey = productPurposeKey(productUuid, purpose.uuid);
|
|
3598
3685
|
purpose.data_elements.forEach((element) => {
|
|
3599
|
-
var _a3, _b2;
|
|
3686
|
+
var _a3, _b2, _c2, _d2;
|
|
3600
3687
|
const combinedId = `${rowKey}-${element.uuid}`;
|
|
3601
|
-
|
|
3602
|
-
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
3603
|
-
} else {
|
|
3604
|
-
initialSelections[combinedId] = false;
|
|
3605
|
-
}
|
|
3688
|
+
initialSelections[combinedId] = (_d2 = (_c2 = (_b2 = (_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) == null ? void 0 : _c2.selected) != null ? _d2 : false;
|
|
3606
3689
|
});
|
|
3607
3690
|
});
|
|
3608
3691
|
setInitialDataElementSelections(initialSelections);
|
|
3609
|
-
} else if (includeFullyConsentedData && purposeSelections) {
|
|
3610
|
-
const allPurposesSelected = seedRows.length > 0 && seedRows.every(
|
|
3611
|
-
({ purpose, productUuid }) => {
|
|
3612
|
-
var _a3;
|
|
3613
|
-
return ((_a3 = recordedFor(purpose.uuid, productUuid)) == null ? void 0 : _a3.selected) === true;
|
|
3614
|
-
}
|
|
3615
|
-
);
|
|
3692
|
+
} else if (includeFullyConsentedData && (purposeSelections || productPurposeSelections)) {
|
|
3693
|
+
const allPurposesSelected = seedRows.length > 0 && seedRows.every(rowIsRecorded);
|
|
3616
3694
|
setIsFullyConsentedReviewMode(allPurposesSelected);
|
|
3617
|
-
|
|
3618
|
-
const initialSelections = {};
|
|
3619
|
-
seedRows.forEach(({ purpose, productUuid }) => {
|
|
3620
|
-
const rowKey = productPurposeKey(productUuid, purpose.uuid);
|
|
3621
|
-
purpose.data_elements.forEach((element) => {
|
|
3622
|
-
var _a3, _b2;
|
|
3623
|
-
const combinedId = `${rowKey}-${element.uuid}`;
|
|
3624
|
-
if ((_b2 = (_a3 = purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
3625
|
-
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
3626
|
-
} else {
|
|
3627
|
-
initialSelections[combinedId] = false;
|
|
3628
|
-
}
|
|
3629
|
-
});
|
|
3630
|
-
});
|
|
3631
|
-
setInitialDataElementSelections(initialSelections);
|
|
3632
|
-
} else {
|
|
3633
|
-
setIsFullyConsentedReviewMode(false);
|
|
3634
|
-
setInitialDataElementSelections({});
|
|
3635
|
-
}
|
|
3695
|
+
setInitialDataElementSelections(recordedElementSelections());
|
|
3636
3696
|
} else {
|
|
3637
3697
|
setIsFullyConsentedReviewMode(false);
|
|
3638
|
-
setInitialDataElementSelections(
|
|
3698
|
+
setInitialDataElementSelections(recordedElementSelections());
|
|
3639
3699
|
}
|
|
3640
3700
|
if (consentContentData.detail.is_minor) {
|
|
3641
3701
|
setIsMinorFlow(true);
|
|
@@ -3717,6 +3777,26 @@ var RedactoNoticeConsent = ({
|
|
|
3717
3777
|
[productUuid]: !prev[productUuid]
|
|
3718
3778
|
}));
|
|
3719
3779
|
};
|
|
3780
|
+
const toggleSection = (sectionPurposes, keyProductUuid) => {
|
|
3781
|
+
const nextState = !sectionPurposes.every(
|
|
3782
|
+
(purpose) => selectedPurposes[productPurposeKey(keyProductUuid, purpose.uuid)]
|
|
3783
|
+
);
|
|
3784
|
+
setSelectedPurposes((prev) => {
|
|
3785
|
+
const updated = { ...prev };
|
|
3786
|
+
sectionPurposes.forEach((purpose) => {
|
|
3787
|
+
updated[productPurposeKey(keyProductUuid, purpose.uuid)] = nextState;
|
|
3788
|
+
});
|
|
3789
|
+
return updated;
|
|
3790
|
+
});
|
|
3791
|
+
const elementOverrides = {};
|
|
3792
|
+
sectionPurposes.forEach((purpose) => {
|
|
3793
|
+
const key = productPurposeKey(keyProductUuid, purpose.uuid);
|
|
3794
|
+
purpose.data_elements.forEach((element) => {
|
|
3795
|
+
elementOverrides[`${key}-${element.uuid}`] = nextState;
|
|
3796
|
+
});
|
|
3797
|
+
});
|
|
3798
|
+
setSelectedDataElements((prev) => ({ ...prev, ...elementOverrides }));
|
|
3799
|
+
};
|
|
3720
3800
|
const handleProductCheckboxChange = (productUuid) => {
|
|
3721
3801
|
if (!content) {
|
|
3722
3802
|
return;
|
|
@@ -3727,29 +3807,46 @@ var RedactoNoticeConsent = ({
|
|
|
3727
3807
|
if (!group) {
|
|
3728
3808
|
return;
|
|
3729
3809
|
}
|
|
3730
|
-
const
|
|
3731
|
-
(purpose) =>
|
|
3810
|
+
const editable = group.purposes.filter(
|
|
3811
|
+
(purpose) => !consentedPurposes[productPurposeKey(productUuid, purpose.uuid)]
|
|
3732
3812
|
);
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
group.purposes.forEach((purpose) => {
|
|
3736
|
-
updated[productPurposeKey(productUuid, purpose.uuid)] = nextState;
|
|
3737
|
-
});
|
|
3738
|
-
return updated;
|
|
3739
|
-
});
|
|
3740
|
-
setSelectedDataElements((prev) => {
|
|
3741
|
-
const updated = { ...prev };
|
|
3742
|
-
group.purposes.forEach((purpose) => {
|
|
3743
|
-
const key = productPurposeKey(productUuid, purpose.uuid);
|
|
3744
|
-
purpose.data_elements.forEach((element) => {
|
|
3745
|
-
updated[`${key}-${element.uuid}`] = nextState;
|
|
3746
|
-
});
|
|
3747
|
-
});
|
|
3748
|
-
return updated;
|
|
3749
|
-
});
|
|
3750
|
-
if (!nextState) {
|
|
3751
|
-
setCollapsedProducts((prev) => ({ ...prev, [productUuid]: false }));
|
|
3813
|
+
if (editable.length === 0) {
|
|
3814
|
+
return;
|
|
3752
3815
|
}
|
|
3816
|
+
toggleSection(editable, productUuid);
|
|
3817
|
+
};
|
|
3818
|
+
const soleProductSection = (rows) => {
|
|
3819
|
+
var _a2, _b2;
|
|
3820
|
+
const products = content == null ? void 0 : content.products;
|
|
3821
|
+
if (!products || products.length !== 1) {
|
|
3822
|
+
return rows;
|
|
3823
|
+
}
|
|
3824
|
+
const product = products[0];
|
|
3825
|
+
const purposes = (_a2 = content == null ? void 0 : content.purposes) != null ? _a2 : [];
|
|
3826
|
+
const selectedCount = purposes.filter(
|
|
3827
|
+
(purpose) => selectedPurposes[productPurposeKey(void 0, purpose.uuid)]
|
|
3828
|
+
).length;
|
|
3829
|
+
return /* @__PURE__ */ jsxs2("div", { children: [
|
|
3830
|
+
/* @__PURE__ */ jsx3(
|
|
3831
|
+
ProductSectionHeader,
|
|
3832
|
+
{
|
|
3833
|
+
product,
|
|
3834
|
+
isRequired: productIsRequiredFor(product.uuid),
|
|
3835
|
+
purposeCount: purposes.length,
|
|
3836
|
+
allSelected: purposes.length > 0 && selectedCount === purposes.length,
|
|
3837
|
+
someSelected: selectedCount > 0,
|
|
3838
|
+
collapsed: collapsedProducts[product.uuid] || false,
|
|
3839
|
+
locked: (_b2 = consentedProducts[product.uuid]) != null ? _b2 : isFullyConsentedReviewMode,
|
|
3840
|
+
settings,
|
|
3841
|
+
styles,
|
|
3842
|
+
responsiveStyles,
|
|
3843
|
+
onToggleCollapse: () => toggleProductCollapse(product.uuid),
|
|
3844
|
+
onToggleSelect: () => toggleSection(purposes, void 0),
|
|
3845
|
+
getTranslatedText
|
|
3846
|
+
}
|
|
3847
|
+
),
|
|
3848
|
+
!collapsedProducts[product.uuid] && /* @__PURE__ */ jsx3("div", { style: styles.sectionBody, children: rows })
|
|
3849
|
+
] });
|
|
3753
3850
|
};
|
|
3754
3851
|
const handleDataElementCheckboxChange = (elementUuid, purposeUuid, productUuid) => {
|
|
3755
3852
|
if (!content) return;
|
|
@@ -5335,49 +5432,60 @@ var RedactoNoticeConsent = ({
|
|
|
5335
5432
|
},
|
|
5336
5433
|
`purpose-section-heading-${selectedLanguage}`
|
|
5337
5434
|
),
|
|
5338
|
-
categorizedPurposes && !isMultiProduct(content == null ? void 0 : content.products) ? /* @__PURE__ */
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5435
|
+
categorizedPurposes && !isMultiProduct(content == null ? void 0 : content.products) ? /* @__PURE__ */ jsx3("div", { style: styles.optionsContainer, children: soleProductSection(
|
|
5436
|
+
/* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
5437
|
+
categorizedPurposes.alreadyConsented.map(
|
|
5438
|
+
(purpose) => /* @__PURE__ */ jsx3(
|
|
5439
|
+
PurposeItem,
|
|
5440
|
+
{
|
|
5441
|
+
purpose,
|
|
5442
|
+
productIsRequired: productIsRequiredFor(
|
|
5443
|
+
void 0
|
|
5444
|
+
),
|
|
5445
|
+
selectedPurposes,
|
|
5446
|
+
collapsedPurposes,
|
|
5447
|
+
selectedDataElements,
|
|
5448
|
+
settings,
|
|
5449
|
+
styles,
|
|
5450
|
+
responsiveStyles,
|
|
5451
|
+
onPurposeToggle: handlePurposeCheckboxChange,
|
|
5452
|
+
onPurposeCollapse: togglePurposeCollapse,
|
|
5453
|
+
onDataElementToggle: handleDataElementCheckboxChange,
|
|
5454
|
+
getTranslatedText,
|
|
5455
|
+
isAlreadyConsented: true,
|
|
5456
|
+
selectedLanguage,
|
|
5457
|
+
initialDataElementSelections
|
|
5458
|
+
},
|
|
5459
|
+
`${purpose.uuid}-${selectedLanguage}`
|
|
5460
|
+
)
|
|
5461
|
+
),
|
|
5462
|
+
categorizedPurposes.needsConsent.map((purpose) => /* @__PURE__ */ jsx3(
|
|
5463
|
+
PurposeItem,
|
|
5464
|
+
{
|
|
5465
|
+
purpose,
|
|
5466
|
+
productIsRequired: productIsRequiredFor(
|
|
5467
|
+
void 0
|
|
5468
|
+
),
|
|
5469
|
+
selectedPurposes,
|
|
5470
|
+
collapsedPurposes,
|
|
5471
|
+
selectedDataElements,
|
|
5472
|
+
settings,
|
|
5473
|
+
styles,
|
|
5474
|
+
responsiveStyles,
|
|
5475
|
+
onPurposeToggle: handlePurposeCheckboxChange,
|
|
5476
|
+
onPurposeCollapse: togglePurposeCollapse,
|
|
5477
|
+
onDataElementToggle: handleDataElementCheckboxChange,
|
|
5478
|
+
getTranslatedText,
|
|
5479
|
+
isAlreadyConsented: false,
|
|
5480
|
+
selectedLanguage
|
|
5481
|
+
},
|
|
5482
|
+
`${purpose.uuid}-${selectedLanguage}`
|
|
5483
|
+
))
|
|
5484
|
+
] })
|
|
5485
|
+
) }) : (
|
|
5379
5486
|
/* Regular consent UI */
|
|
5380
5487
|
/* @__PURE__ */ jsx3("div", { style: styles.optionsContainer, children: isMultiProduct(content == null ? void 0 : content.products) ? productGroups.map((group) => {
|
|
5488
|
+
var _a2;
|
|
5381
5489
|
const selectedInGroup = group.purposes.filter(
|
|
5382
5490
|
(purpose) => selectedPurposes[productPurposeKey(
|
|
5383
5491
|
group.product.uuid,
|
|
@@ -5389,11 +5497,14 @@ var RedactoNoticeConsent = ({
|
|
|
5389
5497
|
ProductSectionHeader,
|
|
5390
5498
|
{
|
|
5391
5499
|
product: group.product,
|
|
5500
|
+
isRequired: productIsRequiredFor(
|
|
5501
|
+
group.product.uuid
|
|
5502
|
+
),
|
|
5392
5503
|
purposeCount: group.purposes.length,
|
|
5393
5504
|
allSelected: selectedInGroup === group.purposes.length,
|
|
5394
5505
|
someSelected: selectedInGroup > 0,
|
|
5395
5506
|
collapsed: collapsedProducts[group.product.uuid] || false,
|
|
5396
|
-
locked:
|
|
5507
|
+
locked: (_a2 = consentedProducts[group.product.uuid]) != null ? _a2 : false,
|
|
5397
5508
|
settings,
|
|
5398
5509
|
styles,
|
|
5399
5510
|
responsiveStyles,
|
|
@@ -5408,50 +5519,64 @@ var RedactoNoticeConsent = ({
|
|
|
5408
5519
|
id: `product-${group.product.uuid}`,
|
|
5409
5520
|
style: styles.sectionBody,
|
|
5410
5521
|
hidden: collapsedProducts[group.product.uuid] || false,
|
|
5411
|
-
children: group.purposes.map((purpose) =>
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5522
|
+
children: group.purposes.map((purpose) => {
|
|
5523
|
+
var _a3;
|
|
5524
|
+
return /* @__PURE__ */ jsx3(
|
|
5525
|
+
PurposeItem,
|
|
5526
|
+
{
|
|
5527
|
+
purpose,
|
|
5528
|
+
productUuid: group.product.uuid,
|
|
5529
|
+
productIsRequired: productIsRequiredFor(
|
|
5530
|
+
group.product.uuid
|
|
5531
|
+
),
|
|
5532
|
+
selectedPurposes,
|
|
5533
|
+
collapsedPurposes,
|
|
5534
|
+
selectedDataElements,
|
|
5535
|
+
settings,
|
|
5536
|
+
styles,
|
|
5537
|
+
responsiveStyles,
|
|
5538
|
+
onPurposeToggle: handlePurposeCheckboxChange,
|
|
5539
|
+
onPurposeCollapse: togglePurposeCollapse,
|
|
5540
|
+
onDataElementToggle: handleDataElementCheckboxChange,
|
|
5541
|
+
getTranslatedText,
|
|
5542
|
+
isAlreadyConsented: (_a3 = consentedPurposes[productPurposeKey(
|
|
5543
|
+
group.product.uuid,
|
|
5544
|
+
purpose.uuid
|
|
5545
|
+
)]) != null ? _a3 : false,
|
|
5546
|
+
selectedLanguage,
|
|
5547
|
+
initialDataElementSelections
|
|
5548
|
+
},
|
|
5549
|
+
`${group.product.uuid}-${purpose.uuid}-${selectedLanguage}`
|
|
5550
|
+
);
|
|
5551
|
+
})
|
|
5432
5552
|
}
|
|
5433
5553
|
)
|
|
5434
5554
|
] }, group.product.uuid);
|
|
5435
|
-
}) : (
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5555
|
+
}) : soleProductSection(
|
|
5556
|
+
(_y = content == null ? void 0 : content.purposes) == null ? void 0 : _y.map((purpose) => /* @__PURE__ */ jsx3(
|
|
5557
|
+
PurposeItem,
|
|
5558
|
+
{
|
|
5559
|
+
purpose,
|
|
5560
|
+
productIsRequired: productIsRequiredFor(
|
|
5561
|
+
void 0
|
|
5562
|
+
),
|
|
5563
|
+
selectedPurposes,
|
|
5564
|
+
collapsedPurposes,
|
|
5565
|
+
selectedDataElements,
|
|
5566
|
+
settings,
|
|
5567
|
+
styles,
|
|
5568
|
+
responsiveStyles,
|
|
5569
|
+
onPurposeToggle: handlePurposeCheckboxChange,
|
|
5570
|
+
onPurposeCollapse: togglePurposeCollapse,
|
|
5571
|
+
onDataElementToggle: handleDataElementCheckboxChange,
|
|
5572
|
+
getTranslatedText,
|
|
5573
|
+
isAlreadyConsented: isFullyConsentedReviewMode,
|
|
5574
|
+
selectedLanguage,
|
|
5575
|
+
initialDataElementSelections
|
|
5576
|
+
},
|
|
5577
|
+
`${purpose.uuid}-${selectedLanguage}`
|
|
5578
|
+
))
|
|
5579
|
+
) })
|
|
5455
5580
|
),
|
|
5456
5581
|
((content == null ? void 0 : content.privacy_center_url) || (content == null ? void 0 : content.dpo_info)) && /* @__PURE__ */ jsx3(
|
|
5457
5582
|
"div",
|