@redacto.io/consent-sdk-react 10.2.1-beta.0 → 10.2.1-beta.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 +66 -11
- package/dist/index.mjs +66 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -745,7 +745,9 @@ var DPO_AUDIO_ELEMENT_MAP = [
|
|
|
745
745
|
{ audioKey: "dpo_anchor_text_audio_url", elementId: "dpo-dpo-link" }
|
|
746
746
|
];
|
|
747
747
|
var PRODUCT_SECTION_COPY = {
|
|
748
|
-
toggleSelection: (productName, purposeCount) => `Toggle all ${purposeCount} purposes for ${productName}
|
|
748
|
+
toggleSelection: (productName, purposeCount) => `Toggle all ${purposeCount} purposes for ${productName}`,
|
|
749
|
+
toggleRequired: (productName, purposeCount) => `Toggle the ${purposeCount} required purposes for ${productName}`,
|
|
750
|
+
settled: (productName) => `Already consented to ${productName}`
|
|
749
751
|
};
|
|
750
752
|
|
|
751
753
|
// src/RedactoNoticeConsent/styles.ts
|
|
@@ -2128,6 +2130,7 @@ var ProductSectionHeader = ({
|
|
|
2128
2130
|
product,
|
|
2129
2131
|
isRequired,
|
|
2130
2132
|
purposeCount,
|
|
2133
|
+
requiredOnly,
|
|
2131
2134
|
allSelected,
|
|
2132
2135
|
someSelected,
|
|
2133
2136
|
collapsed,
|
|
@@ -2183,7 +2186,39 @@ var ProductSectionHeader = ({
|
|
|
2183
2186
|
}
|
|
2184
2187
|
) })
|
|
2185
2188
|
] }),
|
|
2186
|
-
|
|
2189
|
+
locked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2190
|
+
"div",
|
|
2191
|
+
{
|
|
2192
|
+
role: "img",
|
|
2193
|
+
style: {
|
|
2194
|
+
...reviewIndicatorStyle(20),
|
|
2195
|
+
backgroundColor: "#10B981",
|
|
2196
|
+
marginLeft: "12px"
|
|
2197
|
+
},
|
|
2198
|
+
"aria-label": PRODUCT_SECTION_COPY.settled(name),
|
|
2199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2200
|
+
"svg",
|
|
2201
|
+
{
|
|
2202
|
+
width: "12",
|
|
2203
|
+
height: "12",
|
|
2204
|
+
viewBox: "0 0 12 12",
|
|
2205
|
+
fill: "none",
|
|
2206
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2207
|
+
"aria-hidden": "true",
|
|
2208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2209
|
+
"path",
|
|
2210
|
+
{
|
|
2211
|
+
d: "M4 6L5.5 7.5L8.5 4.5",
|
|
2212
|
+
stroke: "white",
|
|
2213
|
+
strokeWidth: "2",
|
|
2214
|
+
strokeLinecap: "round",
|
|
2215
|
+
strokeLinejoin: "round"
|
|
2216
|
+
}
|
|
2217
|
+
)
|
|
2218
|
+
}
|
|
2219
|
+
)
|
|
2220
|
+
}
|
|
2221
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2187
2222
|
"input",
|
|
2188
2223
|
{
|
|
2189
2224
|
ref: checkboxRef,
|
|
@@ -2191,7 +2226,7 @@ var ProductSectionHeader = ({
|
|
|
2191
2226
|
type: "checkbox",
|
|
2192
2227
|
checked: allSelected,
|
|
2193
2228
|
onChange: handleToggleSelect,
|
|
2194
|
-
"aria-label": PRODUCT_SECTION_COPY.toggleSelection(name, purposeCount)
|
|
2229
|
+
"aria-label": requiredOnly ? PRODUCT_SECTION_COPY.toggleRequired(name, purposeCount) : PRODUCT_SECTION_COPY.toggleSelection(name, purposeCount)
|
|
2195
2230
|
}
|
|
2196
2231
|
)
|
|
2197
2232
|
] });
|
|
@@ -2312,6 +2347,7 @@ var PurposeItem = ({
|
|
|
2312
2347
|
isAlreadyConsented && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2313
2348
|
"div",
|
|
2314
2349
|
{
|
|
2350
|
+
role: "img",
|
|
2315
2351
|
style: {
|
|
2316
2352
|
...reviewIndicatorStyle(20),
|
|
2317
2353
|
backgroundColor: "#10B981",
|
|
@@ -2401,6 +2437,7 @@ var PurposeItem = ({
|
|
|
2401
2437
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2402
2438
|
"div",
|
|
2403
2439
|
{
|
|
2440
|
+
role: "img",
|
|
2404
2441
|
style: {
|
|
2405
2442
|
...reviewIndicatorStyle(16),
|
|
2406
2443
|
backgroundColor: "#10B981"
|
|
@@ -2437,6 +2474,7 @@ var PurposeItem = ({
|
|
|
2437
2474
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2438
2475
|
"div",
|
|
2439
2476
|
{
|
|
2477
|
+
role: "img",
|
|
2440
2478
|
style: {
|
|
2441
2479
|
...reviewIndicatorStyle(16),
|
|
2442
2480
|
border: "2px solid #d0d5dd",
|
|
@@ -4122,6 +4160,16 @@ var RedactoNoticeConsent = ({
|
|
|
4122
4160
|
});
|
|
4123
4161
|
setSelectedDataElements((prev) => ({ ...prev, ...elementOverrides }));
|
|
4124
4162
|
};
|
|
4163
|
+
const productBoxPurposes = (0, import_react3.useCallback)(
|
|
4164
|
+
(product, purposes) => {
|
|
4165
|
+
if (productIsRequiredFor(product) === false) {
|
|
4166
|
+
return purposes;
|
|
4167
|
+
}
|
|
4168
|
+
const required = purposes.filter(hasRequiredDataElement);
|
|
4169
|
+
return required.length > 0 ? required : purposes;
|
|
4170
|
+
},
|
|
4171
|
+
[productIsRequiredFor]
|
|
4172
|
+
);
|
|
4125
4173
|
const handleProductCheckboxChange = (productUuid) => {
|
|
4126
4174
|
if (!content) {
|
|
4127
4175
|
return;
|
|
@@ -4132,7 +4180,7 @@ var RedactoNoticeConsent = ({
|
|
|
4132
4180
|
if (!group) {
|
|
4133
4181
|
return;
|
|
4134
4182
|
}
|
|
4135
|
-
const editable = group.purposes.filter(
|
|
4183
|
+
const editable = productBoxPurposes(productUuid, group.purposes).filter(
|
|
4136
4184
|
(purpose) => !consentedPurposes[productPurposeKey(productUuid, purpose.uuid)]
|
|
4137
4185
|
);
|
|
4138
4186
|
if (editable.length === 0) {
|
|
@@ -4148,7 +4196,8 @@ var RedactoNoticeConsent = ({
|
|
|
4148
4196
|
}
|
|
4149
4197
|
const product = products[0];
|
|
4150
4198
|
const purposes = (_a2 = content == null ? void 0 : content.purposes) != null ? _a2 : [];
|
|
4151
|
-
const
|
|
4199
|
+
const boxPurposes = productBoxPurposes(product.uuid, purposes);
|
|
4200
|
+
const selectedCount = boxPurposes.filter(
|
|
4152
4201
|
(purpose) => selectedPurposes[productPurposeKey(void 0, purpose.uuid)]
|
|
4153
4202
|
).length;
|
|
4154
4203
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
@@ -4157,8 +4206,9 @@ var RedactoNoticeConsent = ({
|
|
|
4157
4206
|
{
|
|
4158
4207
|
product,
|
|
4159
4208
|
isRequired: productIsRequiredFor(product.uuid),
|
|
4160
|
-
purposeCount:
|
|
4161
|
-
|
|
4209
|
+
purposeCount: boxPurposes.length,
|
|
4210
|
+
requiredOnly: boxPurposes.length < purposes.length,
|
|
4211
|
+
allSelected: boxPurposes.length > 0 && selectedCount === boxPurposes.length,
|
|
4162
4212
|
someSelected: selectedCount > 0,
|
|
4163
4213
|
collapsed: collapsedProducts[product.uuid] || false,
|
|
4164
4214
|
locked: (_b2 = consentedProducts[product.uuid]) != null ? _b2 : isFullyConsentedReviewMode,
|
|
@@ -4166,7 +4216,7 @@ var RedactoNoticeConsent = ({
|
|
|
4166
4216
|
styles,
|
|
4167
4217
|
responsiveStyles,
|
|
4168
4218
|
onToggleCollapse: () => toggleProductCollapse(product.uuid),
|
|
4169
|
-
onToggleSelect: () => toggleSection(
|
|
4219
|
+
onToggleSelect: () => toggleSection(boxPurposes, void 0),
|
|
4170
4220
|
getTranslatedText
|
|
4171
4221
|
}
|
|
4172
4222
|
),
|
|
@@ -5811,7 +5861,11 @@ var RedactoNoticeConsent = ({
|
|
|
5811
5861
|
/* Regular consent UI */
|
|
5812
5862
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.optionsContainer, children: isMultiProduct(content == null ? void 0 : content.products) ? productGroups.map((group) => {
|
|
5813
5863
|
var _a2;
|
|
5814
|
-
const
|
|
5864
|
+
const boxPurposes = productBoxPurposes(
|
|
5865
|
+
group.product.uuid,
|
|
5866
|
+
group.purposes
|
|
5867
|
+
);
|
|
5868
|
+
const selectedInGroup = boxPurposes.filter(
|
|
5815
5869
|
(purpose) => selectedPurposes[productPurposeKey(
|
|
5816
5870
|
group.product.uuid,
|
|
5817
5871
|
purpose.uuid
|
|
@@ -5825,8 +5879,9 @@ var RedactoNoticeConsent = ({
|
|
|
5825
5879
|
isRequired: productIsRequiredFor(
|
|
5826
5880
|
group.product.uuid
|
|
5827
5881
|
),
|
|
5828
|
-
purposeCount:
|
|
5829
|
-
|
|
5882
|
+
purposeCount: boxPurposes.length,
|
|
5883
|
+
requiredOnly: boxPurposes.length < group.purposes.length,
|
|
5884
|
+
allSelected: selectedInGroup === boxPurposes.length,
|
|
5830
5885
|
someSelected: selectedInGroup > 0,
|
|
5831
5886
|
collapsed: collapsedProducts[group.product.uuid] || false,
|
|
5832
5887
|
locked: (_a2 = consentedProducts[group.product.uuid]) != null ? _a2 : false,
|
package/dist/index.mjs
CHANGED
|
@@ -621,7 +621,9 @@ var DPO_AUDIO_ELEMENT_MAP = [
|
|
|
621
621
|
{ audioKey: "dpo_anchor_text_audio_url", elementId: "dpo-dpo-link" }
|
|
622
622
|
];
|
|
623
623
|
var PRODUCT_SECTION_COPY = {
|
|
624
|
-
toggleSelection: (productName, purposeCount) => `Toggle all ${purposeCount} purposes for ${productName}
|
|
624
|
+
toggleSelection: (productName, purposeCount) => `Toggle all ${purposeCount} purposes for ${productName}`,
|
|
625
|
+
toggleRequired: (productName, purposeCount) => `Toggle the ${purposeCount} required purposes for ${productName}`,
|
|
626
|
+
settled: (productName) => `Already consented to ${productName}`
|
|
625
627
|
};
|
|
626
628
|
|
|
627
629
|
// src/RedactoNoticeConsent/styles.ts
|
|
@@ -1803,6 +1805,7 @@ var ProductSectionHeader = ({
|
|
|
1803
1805
|
product,
|
|
1804
1806
|
isRequired,
|
|
1805
1807
|
purposeCount,
|
|
1808
|
+
requiredOnly,
|
|
1806
1809
|
allSelected,
|
|
1807
1810
|
someSelected,
|
|
1808
1811
|
collapsed,
|
|
@@ -1858,7 +1861,39 @@ var ProductSectionHeader = ({
|
|
|
1858
1861
|
}
|
|
1859
1862
|
) })
|
|
1860
1863
|
] }),
|
|
1861
|
-
|
|
1864
|
+
locked ? /* @__PURE__ */ jsx3(
|
|
1865
|
+
"div",
|
|
1866
|
+
{
|
|
1867
|
+
role: "img",
|
|
1868
|
+
style: {
|
|
1869
|
+
...reviewIndicatorStyle(20),
|
|
1870
|
+
backgroundColor: "#10B981",
|
|
1871
|
+
marginLeft: "12px"
|
|
1872
|
+
},
|
|
1873
|
+
"aria-label": PRODUCT_SECTION_COPY.settled(name),
|
|
1874
|
+
children: /* @__PURE__ */ jsx3(
|
|
1875
|
+
"svg",
|
|
1876
|
+
{
|
|
1877
|
+
width: "12",
|
|
1878
|
+
height: "12",
|
|
1879
|
+
viewBox: "0 0 12 12",
|
|
1880
|
+
fill: "none",
|
|
1881
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1882
|
+
"aria-hidden": "true",
|
|
1883
|
+
children: /* @__PURE__ */ jsx3(
|
|
1884
|
+
"path",
|
|
1885
|
+
{
|
|
1886
|
+
d: "M4 6L5.5 7.5L8.5 4.5",
|
|
1887
|
+
stroke: "white",
|
|
1888
|
+
strokeWidth: "2",
|
|
1889
|
+
strokeLinecap: "round",
|
|
1890
|
+
strokeLinejoin: "round"
|
|
1891
|
+
}
|
|
1892
|
+
)
|
|
1893
|
+
}
|
|
1894
|
+
)
|
|
1895
|
+
}
|
|
1896
|
+
) : /* @__PURE__ */ jsx3(
|
|
1862
1897
|
"input",
|
|
1863
1898
|
{
|
|
1864
1899
|
ref: checkboxRef,
|
|
@@ -1866,7 +1901,7 @@ var ProductSectionHeader = ({
|
|
|
1866
1901
|
type: "checkbox",
|
|
1867
1902
|
checked: allSelected,
|
|
1868
1903
|
onChange: handleToggleSelect,
|
|
1869
|
-
"aria-label": PRODUCT_SECTION_COPY.toggleSelection(name, purposeCount)
|
|
1904
|
+
"aria-label": requiredOnly ? PRODUCT_SECTION_COPY.toggleRequired(name, purposeCount) : PRODUCT_SECTION_COPY.toggleSelection(name, purposeCount)
|
|
1870
1905
|
}
|
|
1871
1906
|
)
|
|
1872
1907
|
] });
|
|
@@ -1987,6 +2022,7 @@ var PurposeItem = ({
|
|
|
1987
2022
|
isAlreadyConsented && /* @__PURE__ */ jsx3(
|
|
1988
2023
|
"div",
|
|
1989
2024
|
{
|
|
2025
|
+
role: "img",
|
|
1990
2026
|
style: {
|
|
1991
2027
|
...reviewIndicatorStyle(20),
|
|
1992
2028
|
backgroundColor: "#10B981",
|
|
@@ -2076,6 +2112,7 @@ var PurposeItem = ({
|
|
|
2076
2112
|
return /* @__PURE__ */ jsx3(
|
|
2077
2113
|
"div",
|
|
2078
2114
|
{
|
|
2115
|
+
role: "img",
|
|
2079
2116
|
style: {
|
|
2080
2117
|
...reviewIndicatorStyle(16),
|
|
2081
2118
|
backgroundColor: "#10B981"
|
|
@@ -2112,6 +2149,7 @@ var PurposeItem = ({
|
|
|
2112
2149
|
return /* @__PURE__ */ jsx3(
|
|
2113
2150
|
"div",
|
|
2114
2151
|
{
|
|
2152
|
+
role: "img",
|
|
2115
2153
|
style: {
|
|
2116
2154
|
...reviewIndicatorStyle(16),
|
|
2117
2155
|
border: "2px solid #d0d5dd",
|
|
@@ -3797,6 +3835,16 @@ var RedactoNoticeConsent = ({
|
|
|
3797
3835
|
});
|
|
3798
3836
|
setSelectedDataElements((prev) => ({ ...prev, ...elementOverrides }));
|
|
3799
3837
|
};
|
|
3838
|
+
const productBoxPurposes = useCallback(
|
|
3839
|
+
(product, purposes) => {
|
|
3840
|
+
if (productIsRequiredFor(product) === false) {
|
|
3841
|
+
return purposes;
|
|
3842
|
+
}
|
|
3843
|
+
const required = purposes.filter(hasRequiredDataElement);
|
|
3844
|
+
return required.length > 0 ? required : purposes;
|
|
3845
|
+
},
|
|
3846
|
+
[productIsRequiredFor]
|
|
3847
|
+
);
|
|
3800
3848
|
const handleProductCheckboxChange = (productUuid) => {
|
|
3801
3849
|
if (!content) {
|
|
3802
3850
|
return;
|
|
@@ -3807,7 +3855,7 @@ var RedactoNoticeConsent = ({
|
|
|
3807
3855
|
if (!group) {
|
|
3808
3856
|
return;
|
|
3809
3857
|
}
|
|
3810
|
-
const editable = group.purposes.filter(
|
|
3858
|
+
const editable = productBoxPurposes(productUuid, group.purposes).filter(
|
|
3811
3859
|
(purpose) => !consentedPurposes[productPurposeKey(productUuid, purpose.uuid)]
|
|
3812
3860
|
);
|
|
3813
3861
|
if (editable.length === 0) {
|
|
@@ -3823,7 +3871,8 @@ var RedactoNoticeConsent = ({
|
|
|
3823
3871
|
}
|
|
3824
3872
|
const product = products[0];
|
|
3825
3873
|
const purposes = (_a2 = content == null ? void 0 : content.purposes) != null ? _a2 : [];
|
|
3826
|
-
const
|
|
3874
|
+
const boxPurposes = productBoxPurposes(product.uuid, purposes);
|
|
3875
|
+
const selectedCount = boxPurposes.filter(
|
|
3827
3876
|
(purpose) => selectedPurposes[productPurposeKey(void 0, purpose.uuid)]
|
|
3828
3877
|
).length;
|
|
3829
3878
|
return /* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -3832,8 +3881,9 @@ var RedactoNoticeConsent = ({
|
|
|
3832
3881
|
{
|
|
3833
3882
|
product,
|
|
3834
3883
|
isRequired: productIsRequiredFor(product.uuid),
|
|
3835
|
-
purposeCount:
|
|
3836
|
-
|
|
3884
|
+
purposeCount: boxPurposes.length,
|
|
3885
|
+
requiredOnly: boxPurposes.length < purposes.length,
|
|
3886
|
+
allSelected: boxPurposes.length > 0 && selectedCount === boxPurposes.length,
|
|
3837
3887
|
someSelected: selectedCount > 0,
|
|
3838
3888
|
collapsed: collapsedProducts[product.uuid] || false,
|
|
3839
3889
|
locked: (_b2 = consentedProducts[product.uuid]) != null ? _b2 : isFullyConsentedReviewMode,
|
|
@@ -3841,7 +3891,7 @@ var RedactoNoticeConsent = ({
|
|
|
3841
3891
|
styles,
|
|
3842
3892
|
responsiveStyles,
|
|
3843
3893
|
onToggleCollapse: () => toggleProductCollapse(product.uuid),
|
|
3844
|
-
onToggleSelect: () => toggleSection(
|
|
3894
|
+
onToggleSelect: () => toggleSection(boxPurposes, void 0),
|
|
3845
3895
|
getTranslatedText
|
|
3846
3896
|
}
|
|
3847
3897
|
),
|
|
@@ -5486,7 +5536,11 @@ var RedactoNoticeConsent = ({
|
|
|
5486
5536
|
/* Regular consent UI */
|
|
5487
5537
|
/* @__PURE__ */ jsx3("div", { style: styles.optionsContainer, children: isMultiProduct(content == null ? void 0 : content.products) ? productGroups.map((group) => {
|
|
5488
5538
|
var _a2;
|
|
5489
|
-
const
|
|
5539
|
+
const boxPurposes = productBoxPurposes(
|
|
5540
|
+
group.product.uuid,
|
|
5541
|
+
group.purposes
|
|
5542
|
+
);
|
|
5543
|
+
const selectedInGroup = boxPurposes.filter(
|
|
5490
5544
|
(purpose) => selectedPurposes[productPurposeKey(
|
|
5491
5545
|
group.product.uuid,
|
|
5492
5546
|
purpose.uuid
|
|
@@ -5500,8 +5554,9 @@ var RedactoNoticeConsent = ({
|
|
|
5500
5554
|
isRequired: productIsRequiredFor(
|
|
5501
5555
|
group.product.uuid
|
|
5502
5556
|
),
|
|
5503
|
-
purposeCount:
|
|
5504
|
-
|
|
5557
|
+
purposeCount: boxPurposes.length,
|
|
5558
|
+
requiredOnly: boxPurposes.length < group.purposes.length,
|
|
5559
|
+
allSelected: selectedInGroup === boxPurposes.length,
|
|
5505
5560
|
someSelected: selectedInGroup > 0,
|
|
5506
5561
|
collapsed: collapsedProducts[group.product.uuid] || false,
|
|
5507
5562
|
locked: (_a2 = consentedProducts[group.product.uuid]) != null ? _a2 : false,
|