@redacto.io/consent-sdk-react 5.3.0 → 6.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 +24 -0
- package/CHANGELOG.md +6 -0
- package/dist/privacy-center.d.mts +98 -38
- package/dist/privacy-center.d.ts +98 -38
- package/dist/privacy-center.js +3679 -1491
- package/dist/privacy-center.mjs +3614 -1423
- package/package.json +1 -1
- package/src/RedactoPrivacyCenter/api/actions.ts +52 -8
- package/src/RedactoPrivacyCenter/api/client.ts +58 -15
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +722 -273
- package/src/RedactoPrivacyCenter/components/ConsentManagerCells.tsx +187 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +65 -165
- package/src/RedactoPrivacyCenter/components/ConsentManagerExpandedRow.tsx +179 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerGroupedColumns.tsx +318 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerProductCards.tsx +333 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerPurposeCards.tsx +102 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +6 -2
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +8 -5
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationBell.tsx +1 -1
- package/src/RedactoPrivacyCenter/components/PrivacyCenterLayout.tsx +102 -53
- package/src/RedactoPrivacyCenter/components/types.ts +2 -5
- package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +21 -1
- package/src/RedactoPrivacyCenter/lib/api.ts +70 -28
- package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +4 -2
- package/src/RedactoPrivacyCenter/lib/types.ts +57 -36
- package/src/RedactoPrivacyCenter/locales/as/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/en/translation.json +16 -1
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +15 -1
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/or/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/te/translation.json +12 -1
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +12 -1
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +527 -5
- package/src/RedactoPrivacyCenter/styles/variables.css +5 -0
- package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +36 -16
- package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +4 -12
- package/src/RedactoPrivacyCenter/ui/PCInput.tsx +1 -1
- package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +51 -5
- package/src/RedactoPrivacyCenter/ui/ThemeToggle.tsx +2 -4
- package/src/privacy-center.ts +7 -3
|
@@ -58,10 +58,10 @@ export default function AdvancedTablePagination<
|
|
|
58
58
|
...pcStyles.flexCol,
|
|
59
59
|
...pcStyles.itemsCenter,
|
|
60
60
|
width: '100%',
|
|
61
|
-
paddingTop:
|
|
62
|
-
paddingBottom:
|
|
63
|
-
gap:
|
|
64
|
-
minHeight: '
|
|
61
|
+
paddingTop: '0.375rem',
|
|
62
|
+
paddingBottom: '0.125rem',
|
|
63
|
+
gap: '0.375rem',
|
|
64
|
+
minHeight: '44px',
|
|
65
65
|
opacity: shouldShowPagination ? 1 : 0.5,
|
|
66
66
|
pointerEvents: shouldShowPagination ? 'auto' : 'none',
|
|
67
67
|
}}
|
|
@@ -148,7 +148,6 @@ export default function AdvancedTablePagination<
|
|
|
148
148
|
disabled={!table.getCanPreviousPage()}
|
|
149
149
|
style={{
|
|
150
150
|
borderRadius: '0.5rem',
|
|
151
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
152
151
|
borderColor: getVar('--pc-border-color'),
|
|
153
152
|
color: getVar('--pc-text-primary'),
|
|
154
153
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -176,7 +175,6 @@ export default function AdvancedTablePagination<
|
|
|
176
175
|
disabled={!table.getCanPreviousPage()}
|
|
177
176
|
style={{
|
|
178
177
|
borderRadius: '0.5rem',
|
|
179
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
180
178
|
borderColor: getVar('--pc-border-color'),
|
|
181
179
|
color: getVar('--pc-text-primary'),
|
|
182
180
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -204,7 +202,6 @@ export default function AdvancedTablePagination<
|
|
|
204
202
|
disabled={!table.getCanNextPage()}
|
|
205
203
|
style={{
|
|
206
204
|
borderRadius: '0.5rem',
|
|
207
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
208
205
|
borderColor: getVar('--pc-border-color'),
|
|
209
206
|
color: getVar('--pc-text-primary'),
|
|
210
207
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -232,7 +229,6 @@ export default function AdvancedTablePagination<
|
|
|
232
229
|
disabled={!table.getCanNextPage()}
|
|
233
230
|
style={{
|
|
234
231
|
borderRadius: '0.5rem',
|
|
235
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
236
232
|
borderColor: getVar('--pc-border-color'),
|
|
237
233
|
color: getVar('--pc-text-primary'),
|
|
238
234
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -364,7 +360,6 @@ export default function AdvancedTablePagination<
|
|
|
364
360
|
disabled={!table.getCanPreviousPage()}
|
|
365
361
|
style={{
|
|
366
362
|
borderRadius: '0.5rem',
|
|
367
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
368
363
|
borderColor: getVar('--pc-border-color'),
|
|
369
364
|
color: getVar('--pc-text-primary'),
|
|
370
365
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -392,7 +387,6 @@ export default function AdvancedTablePagination<
|
|
|
392
387
|
disabled={!table.getCanPreviousPage()}
|
|
393
388
|
style={{
|
|
394
389
|
borderRadius: '0.5rem',
|
|
395
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
396
390
|
borderColor: getVar('--pc-border-color'),
|
|
397
391
|
color: getVar('--pc-text-primary'),
|
|
398
392
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -420,7 +414,6 @@ export default function AdvancedTablePagination<
|
|
|
420
414
|
disabled={!table.getCanNextPage()}
|
|
421
415
|
style={{
|
|
422
416
|
borderRadius: '0.5rem',
|
|
423
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
424
417
|
borderColor: getVar('--pc-border-color'),
|
|
425
418
|
color: getVar('--pc-text-primary'),
|
|
426
419
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -448,7 +441,6 @@ export default function AdvancedTablePagination<
|
|
|
448
441
|
disabled={!table.getCanNextPage()}
|
|
449
442
|
style={{
|
|
450
443
|
borderRadius: '0.5rem',
|
|
451
|
-
boxShadow: getVar('--pc-shadow-sm'),
|
|
452
444
|
borderColor: getVar('--pc-border-color'),
|
|
453
445
|
color: getVar('--pc-text-primary'),
|
|
454
446
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
@@ -75,7 +75,7 @@ export function PCInput({
|
|
|
75
75
|
return (
|
|
76
76
|
<div className={className} style={wrapperStyle}>
|
|
77
77
|
{label && <label style={pcStyles.inputLabel}>{label}</label>}
|
|
78
|
-
<div style={pcStyles.inputWithPrefix}>
|
|
78
|
+
<div className="pc-input-affix" style={pcStyles.inputWithPrefix}>
|
|
79
79
|
{prefix && <span style={pcStyles.inputPrefix}>{prefix}</span>}
|
|
80
80
|
<input
|
|
81
81
|
ref={inputRef}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useLayoutEffect,
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { pcStyles } from '../styles/pcStyles';
|
|
10
|
-
import { ChevronDown, X } from 'lucide-react';
|
|
10
|
+
import { ChevronDown, X, Check } from 'lucide-react';
|
|
11
11
|
|
|
12
12
|
const getVar = (varName: string): string => `var(${varName})`;
|
|
13
13
|
const useIsomorphicLayoutEffect =
|
|
@@ -32,6 +32,7 @@ export interface PCSelectProps {
|
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
size?: 'sm' | 'md' | 'lg';
|
|
34
34
|
label?: ReactNode;
|
|
35
|
+
prefix?: ReactNode;
|
|
35
36
|
/**
|
|
36
37
|
* If true, the dropdown list width will match the trigger width.
|
|
37
38
|
* Useful in tight filter rows where you want trigger + dropdown aligned.
|
|
@@ -40,6 +41,7 @@ export interface PCSelectProps {
|
|
|
40
41
|
searchPlaceholder?: string;
|
|
41
42
|
noOptionsMessage?: string;
|
|
42
43
|
clearAriaLabel?: string;
|
|
44
|
+
showSelectedCheck?: boolean;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export function PCSelect({
|
|
@@ -55,10 +57,12 @@ export function PCSelect({
|
|
|
55
57
|
disabled = false,
|
|
56
58
|
size = 'md',
|
|
57
59
|
label,
|
|
60
|
+
prefix,
|
|
58
61
|
dropdownMatchTriggerWidth = false,
|
|
59
62
|
searchPlaceholder = 'Search...',
|
|
60
63
|
noOptionsMessage = 'No options found',
|
|
61
64
|
clearAriaLabel = 'Clear selection',
|
|
65
|
+
showSelectedCheck = false,
|
|
62
66
|
}: PCSelectProps) {
|
|
63
67
|
const [isOpen, setIsOpen] = useState(false);
|
|
64
68
|
const [searchQuery, setSearchQuery] = useState('');
|
|
@@ -112,7 +116,7 @@ export function PCSelect({
|
|
|
112
116
|
const paddingLeft = parseFloat(computed.paddingLeft || '0') || 0;
|
|
113
117
|
const paddingRight = parseFloat(computed.paddingRight || '0') || 0;
|
|
114
118
|
// Chevron + spacing (and optional clear button) lives on the right
|
|
115
|
-
const iconAreaPx = clearable ? 52 : 32;
|
|
119
|
+
const iconAreaPx = clearable ? 52 : showSelectedCheck ? 46 : 32;
|
|
116
120
|
|
|
117
121
|
const maxLabelWidth = options.reduce((max, opt) => {
|
|
118
122
|
const w = measureTextWidth(opt.label ?? '', font);
|
|
@@ -267,6 +271,17 @@ export function PCSelect({
|
|
|
267
271
|
setIsOpen((prev) => !prev);
|
|
268
272
|
}}
|
|
269
273
|
>
|
|
274
|
+
{prefix && (
|
|
275
|
+
<span style={{
|
|
276
|
+
display: 'inline-flex',
|
|
277
|
+
alignItems: 'center',
|
|
278
|
+
flexShrink: 0,
|
|
279
|
+
marginRight: '0.375rem',
|
|
280
|
+
color: pcStyles.textSecondary.color,
|
|
281
|
+
}}>
|
|
282
|
+
{prefix}
|
|
283
|
+
</span>
|
|
284
|
+
)}
|
|
270
285
|
<span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
|
271
286
|
{value ? value.label : <span style={{ color: pcStyles.textSecondary.color }}>{placeholder}</span>}
|
|
272
287
|
</span>
|
|
@@ -349,10 +364,14 @@ export function PCSelect({
|
|
|
349
364
|
<div
|
|
350
365
|
key={String(option.value)}
|
|
351
366
|
className="pc-select-option"
|
|
367
|
+
data-selected={value?.value === option.value ? 'true' : 'false'}
|
|
352
368
|
style={{
|
|
353
369
|
...optionStyle,
|
|
354
370
|
backgroundColor: getVar('--pc-bg-primary'),
|
|
355
|
-
color:
|
|
371
|
+
color:
|
|
372
|
+
value?.value === option.value && showSelectedCheck
|
|
373
|
+
? getVar('--pc-primary')
|
|
374
|
+
: getVar('--pc-text-primary'),
|
|
356
375
|
transition: 'background-color 0.2s ease, color 0.2s ease',
|
|
357
376
|
whiteSpace: 'nowrap',
|
|
358
377
|
overflow: 'hidden',
|
|
@@ -360,7 +379,9 @@ export function PCSelect({
|
|
|
360
379
|
maxWidth: '100%',
|
|
361
380
|
...(option.disabled && { opacity: 0.5, cursor: 'not-allowed' }),
|
|
362
381
|
...(value?.value === option.value && {
|
|
363
|
-
backgroundColor:
|
|
382
|
+
backgroundColor: showSelectedCheck
|
|
383
|
+
? 'rgba(59, 130, 246, 0.12)'
|
|
384
|
+
: getVar('--pc-bg-hover'),
|
|
364
385
|
}),
|
|
365
386
|
}}
|
|
366
387
|
onClick={() => handleSelect(option)}
|
|
@@ -375,7 +396,32 @@ export function PCSelect({
|
|
|
375
396
|
: getVar('--pc-bg-primary');
|
|
376
397
|
}}
|
|
377
398
|
>
|
|
378
|
-
|
|
399
|
+
<span
|
|
400
|
+
style={{
|
|
401
|
+
display: 'flex',
|
|
402
|
+
alignItems: 'center',
|
|
403
|
+
justifyContent: 'space-between',
|
|
404
|
+
gap: '0.5rem',
|
|
405
|
+
width: '100%',
|
|
406
|
+
minWidth: 0,
|
|
407
|
+
}}
|
|
408
|
+
>
|
|
409
|
+
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
|
410
|
+
{option.label}
|
|
411
|
+
</span>
|
|
412
|
+
{showSelectedCheck && (
|
|
413
|
+
<span
|
|
414
|
+
style={{
|
|
415
|
+
display: 'inline-flex',
|
|
416
|
+
alignItems: 'center',
|
|
417
|
+
opacity: value?.value === option.value ? 1 : 0,
|
|
418
|
+
flexShrink: 0,
|
|
419
|
+
}}
|
|
420
|
+
>
|
|
421
|
+
<Check size={14} strokeWidth={2.5} />
|
|
422
|
+
</span>
|
|
423
|
+
)}
|
|
424
|
+
</span>
|
|
379
425
|
</div>
|
|
380
426
|
))
|
|
381
427
|
)}
|
|
@@ -54,16 +54,14 @@ export default function ThemeToggle({ className }: ThemeToggleProps) {
|
|
|
54
54
|
onClick={handleClick}
|
|
55
55
|
aria-label={tooltipLabel}
|
|
56
56
|
style={{
|
|
57
|
-
width: '32px',
|
|
58
|
-
height: '32px',
|
|
59
57
|
color: getVar('--pc-text-primary'),
|
|
60
58
|
transition: 'color 0.3s ease, transform 0.2s ease',
|
|
61
59
|
}}
|
|
62
60
|
>
|
|
63
61
|
{theme === 'light' ? (
|
|
64
|
-
<IoMoonOutline size={
|
|
62
|
+
<IoMoonOutline size={16} />
|
|
65
63
|
) : (
|
|
66
|
-
<IoSunnyOutline size={
|
|
64
|
+
<IoSunnyOutline size={16} />
|
|
67
65
|
)}
|
|
68
66
|
</PCActionIcon>
|
|
69
67
|
</div>
|
package/src/privacy-center.ts
CHANGED
|
@@ -37,11 +37,14 @@ export type {
|
|
|
37
37
|
TokenExchangeResponse,
|
|
38
38
|
FetchOrgParams,
|
|
39
39
|
ConsentDataElement,
|
|
40
|
-
|
|
40
|
+
PurposeItem,
|
|
41
|
+
ConsentGroup,
|
|
42
|
+
DisplayPurposeRow,
|
|
43
|
+
ConsentModalRecord,
|
|
44
|
+
GroupPurposesOut,
|
|
45
|
+
PaginationMeta,
|
|
41
46
|
NominatorInfo,
|
|
42
47
|
ConsentHistoryStatusSummary,
|
|
43
|
-
ProductConsentHistoryGroup,
|
|
44
|
-
NominatedPurposesGroup,
|
|
45
48
|
Pagination,
|
|
46
49
|
UserConsentDetail,
|
|
47
50
|
UserConsentResponse,
|
|
@@ -70,6 +73,7 @@ export {
|
|
|
70
73
|
createCaseRequest,
|
|
71
74
|
fetchProducts,
|
|
72
75
|
fetchUserConsents,
|
|
76
|
+
fetchGroupPurposes,
|
|
73
77
|
manageConsent,
|
|
74
78
|
fetchActivities,
|
|
75
79
|
fetchCaseHistory,
|