@redacto.io/consent-sdk-react 4.0.0 → 5.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/CHANGELOG.md +13 -1
- package/LICENSE +176 -0
- package/dist/index.js +231 -96
- package/dist/index.mjs +231 -96
- package/dist/privacy-center.d.mts +649 -0
- package/dist/privacy-center.d.ts +649 -0
- package/dist/privacy-center.js +20824 -0
- package/dist/privacy-center.mjs +20789 -0
- package/package.json +47 -3
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +6 -4
- package/src/RedactoNoticeConsent/api/index.ts +2 -0
- package/src/RedactoNoticeConsent/api/types.ts +2 -0
- package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +128 -62
- package/src/RedactoNoticeConsent/language-codes.ts +97 -0
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -3
- package/src/RedactoNoticeConsentInline/api/index.ts +0 -1
- package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +19 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage.tsx +154 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +17 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +79 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +30 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +173 -0
- package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +55 -0
- package/src/RedactoPrivacyCenter/api/actions.ts +476 -0
- package/src/RedactoPrivacyCenter/api/client.ts +524 -0
- package/src/RedactoPrivacyCenter/api/config.ts +33 -0
- package/src/RedactoPrivacyCenter/api/fetcher.ts +181 -0
- package/src/RedactoPrivacyCenter/api/upload.ts +93 -0
- package/src/RedactoPrivacyCenter/assets/character.svg +31 -0
- package/src/RedactoPrivacyCenter/assets/fileAttach.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/greenTick.svg +4 -0
- package/src/RedactoPrivacyCenter/assets/mail.svg +3 -0
- package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/sentImg.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +9 -0
- package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +272 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/AttachmentCard.tsx +38 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/ChatBubble.tsx +31 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/DocumentRequestCard.tsx +73 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageComposer.tsx +87 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageItem.tsx +95 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +147 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/RequestDetailsTab.tsx +171 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/StatusEvent.tsx +23 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/useFileUpload.ts +116 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +36 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/utils.ts +56 -0
- package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +469 -0
- package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +426 -0
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +732 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +238 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +7 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +155 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +189 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +118 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +66 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +304 -0
- package/src/RedactoPrivacyCenter/components/Form.tsx +1596 -0
- package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +174 -0
- package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +337 -0
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +330 -0
- package/src/RedactoPrivacyCenter/components/Pagination.tsx +140 -0
- package/src/RedactoPrivacyCenter/components/PrivacyCenterLayout.tsx +304 -0
- package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +232 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideBarPC.tsx +475 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideMenuPC.tsx +408 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +42 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/menuItemsPC.tsx +1 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +40 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/utils.ts +38 -0
- package/src/RedactoPrivacyCenter/components/ThemeTransitionOverlay.tsx +85 -0
- package/src/RedactoPrivacyCenter/components/activitiesColumns.tsx +141 -0
- package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +159 -0
- package/src/RedactoPrivacyCenter/components/constant.ts +16 -0
- package/src/RedactoPrivacyCenter/components/types.ts +76 -0
- package/src/RedactoPrivacyCenter/components/utils.tsx +10 -0
- package/src/RedactoPrivacyCenter/config/routes.ts +9 -0
- package/src/RedactoPrivacyCenter/config/table.ts +25 -0
- package/src/RedactoPrivacyCenter/context/AuthContext.tsx +137 -0
- package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +41 -0
- package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +11 -0
- package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +96 -0
- package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +30 -0
- package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +60 -0
- package/src/RedactoPrivacyCenter/context/theme.tsx +127 -0
- package/src/RedactoPrivacyCenter/context/types.ts +14 -0
- package/src/RedactoPrivacyCenter/lib/api.ts +566 -0
- package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +63 -0
- package/src/RedactoPrivacyCenter/lib/constants.ts +161 -0
- package/src/RedactoPrivacyCenter/lib/i18n.ts +81 -0
- package/src/RedactoPrivacyCenter/lib/locales.ts +105 -0
- package/src/RedactoPrivacyCenter/lib/queries.ts +134 -0
- package/src/RedactoPrivacyCenter/lib/types.ts +531 -0
- package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +37 -0
- package/src/RedactoPrivacyCenter/lib/utils.ts +626 -0
- package/src/RedactoPrivacyCenter/locales/as/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/en/translation.json +255 -0
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/or/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/te/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +280 -0
- package/src/RedactoPrivacyCenter/styles/base.css +117 -0
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +1725 -0
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +813 -0
- package/src/RedactoPrivacyCenter/styles/responsive.ts +138 -0
- package/src/RedactoPrivacyCenter/styles/variables.css +133 -0
- package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +367 -0
- package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +476 -0
- package/src/RedactoPrivacyCenter/table/index.ts +2 -0
- package/src/RedactoPrivacyCenter/types/images.d.ts +29 -0
- package/src/RedactoPrivacyCenter/ui/Footer.tsx +75 -0
- package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +54 -0
- package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +93 -0
- package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +47 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +69 -0
- package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +48 -0
- package/src/RedactoPrivacyCenter/ui/PCButton.tsx +77 -0
- package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +55 -0
- package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +107 -0
- package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +35 -0
- package/src/RedactoPrivacyCenter/ui/PCInput.tsx +132 -0
- package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +31 -0
- package/src/RedactoPrivacyCenter/ui/PCModal.tsx +106 -0
- package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +173 -0
- package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +387 -0
- package/src/RedactoPrivacyCenter/ui/PCTable.tsx +149 -0
- package/src/RedactoPrivacyCenter/ui/PCText.tsx +41 -0
- package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +43 -0
- package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +37 -0
- package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +119 -0
- package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +25 -0
- package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +53 -0
- package/src/RedactoPrivacyCenter/ui/ThemeToggle.tsx +72 -0
- package/src/RedactoPrivacyCenter/ui/index.ts +18 -0
- package/src/RedactoPrivacyCenter/utils/cn.ts +28 -0
- package/src/RedactoPrivacyCenter/utils/date.ts +48 -0
- package/src/RedactoPrivacyCenter/utils/status.ts +111 -0
- package/src/RedactoPrivacyCenter/utils/toast.ts +130 -0
- package/src/privacy-center.ts +108 -0
- package/tsconfig.json +2 -0
- package/tsup.config.ts +16 -1
- package/.turbo/turbo-build.log +0 -21
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified status color utilities for privacy center app
|
|
3
|
+
* Handles both consent statuses and case/request statuses
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const STATUS_COLORS = {
|
|
7
|
+
// Consent/Purpose statuses (uppercase)
|
|
8
|
+
ACTIVE: 'bg-green-100 text-green-800 border border-green-200',
|
|
9
|
+
INACTIVE: 'bg-gray-100 text-gray-800 border border-gray-200',
|
|
10
|
+
EXPIRED: 'bg-orange-50 text-orange-700 border border-orange-200',
|
|
11
|
+
PENDING: 'bg-yellow-50 text-yellow-800 border border-yellow-200',
|
|
12
|
+
SUSPENDED: 'bg-red-50 text-red-700 border border-red-200',
|
|
13
|
+
WITHDRAWN: 'bg-red-50 text-red-700 border border-red-200',
|
|
14
|
+
DECLINED: 'bg-red-50 text-red-700 border border-red-200',
|
|
15
|
+
REVOKED: 'bg-red-50 text-red-700 border border-red-200',
|
|
16
|
+
|
|
17
|
+
// User statuses (capitalized)
|
|
18
|
+
Active: 'bg-green-100 text-green-800 border border-green-200',
|
|
19
|
+
Revoked: 'bg-red-50 text-red-700 border border-red-200',
|
|
20
|
+
Expired: 'bg-orange-50 text-orange-700 border border-orange-200',
|
|
21
|
+
|
|
22
|
+
// Data element statuses (lowercase)
|
|
23
|
+
enabled: 'bg-green-100 text-green-800 border border-green-200',
|
|
24
|
+
disabled: 'bg-gray-100 text-gray-800 border border-gray-200',
|
|
25
|
+
required: 'bg-blue-100 text-blue-800 border border-blue-200',
|
|
26
|
+
|
|
27
|
+
// Case/Request statuses (lowercase)
|
|
28
|
+
completed: 'bg-[#00B41D1A] text-[#00B41D]',
|
|
29
|
+
processing: 'bg-[#FF9A001A] text-[#FF9A00]',
|
|
30
|
+
'in_progress': 'bg-[#FF9A001A] text-[#FF9A00]',
|
|
31
|
+
initiated: 'bg-[#4F87FF1A] text-[#4F87FF]',
|
|
32
|
+
rejected: 'bg-[#FF47471A] text-[#FF4747]',
|
|
33
|
+
declined: 'bg-[#FF47471A] text-[#FF4747]',
|
|
34
|
+
|
|
35
|
+
default: 'bg-gray-100 text-gray-800 border border-gray-200',
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
export type StatusColorParams = {
|
|
39
|
+
status: string | boolean;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type FormatDateParams = {
|
|
43
|
+
date: string | Date;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get status color class string for a given status
|
|
48
|
+
* Handles various status formats (uppercase, lowercase, capitalized, boolean)
|
|
49
|
+
*/
|
|
50
|
+
export const getStatusColor = ({ status }: StatusColorParams): string => {
|
|
51
|
+
// Handle boolean values for enabled/disabled
|
|
52
|
+
if (typeof status === 'boolean') {
|
|
53
|
+
return status ? STATUS_COLORS.enabled : STATUS_COLORS.disabled;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const statusStr = String(status);
|
|
57
|
+
const normalizedStatus = statusStr.toUpperCase();
|
|
58
|
+
const lowerStatus = statusStr.toLowerCase();
|
|
59
|
+
|
|
60
|
+
// Direct mapping for known statuses (try uppercase first)
|
|
61
|
+
if (STATUS_COLORS[normalizedStatus as keyof typeof STATUS_COLORS]) {
|
|
62
|
+
return STATUS_COLORS[normalizedStatus as keyof typeof STATUS_COLORS];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Try lowercase for case statuses
|
|
66
|
+
if (STATUS_COLORS[lowerStatus as keyof typeof STATUS_COLORS]) {
|
|
67
|
+
return STATUS_COLORS[lowerStatus as keyof typeof STATUS_COLORS];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Try capitalized (first letter uppercase)
|
|
71
|
+
const capitalizedStatus = statusStr.charAt(0).toUpperCase() + statusStr.slice(1).toLowerCase();
|
|
72
|
+
if (STATUS_COLORS[capitalizedStatus as keyof typeof STATUS_COLORS]) {
|
|
73
|
+
return STATUS_COLORS[capitalizedStatus as keyof typeof STATUS_COLORS];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Handle common status patterns
|
|
77
|
+
if (normalizedStatus.includes('ACTIVE')) {
|
|
78
|
+
return STATUS_COLORS.ACTIVE;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (normalizedStatus.includes('INACTIVE') || normalizedStatus.includes('DISABLED')) {
|
|
82
|
+
return STATUS_COLORS.INACTIVE;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (normalizedStatus.includes('EXPIRED')) {
|
|
86
|
+
return STATUS_COLORS.EXPIRED;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (normalizedStatus.includes('PENDING')) {
|
|
90
|
+
return STATUS_COLORS.PENDING;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (normalizedStatus.includes('SUSPENDED') || normalizedStatus.includes('REVOKED') || normalizedStatus.includes('WITHDRAWN')) {
|
|
94
|
+
return STATUS_COLORS.SUSPENDED;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (lowerStatus.includes('completed')) {
|
|
98
|
+
return STATUS_COLORS.completed;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (lowerStatus.includes('processing') || lowerStatus.includes('in_progress')) {
|
|
102
|
+
return STATUS_COLORS.processing;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (lowerStatus.includes('rejected') || lowerStatus.includes('declined')) {
|
|
106
|
+
return STATUS_COLORS.rejected;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Default fallback
|
|
110
|
+
return STATUS_COLORS.default;
|
|
111
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple Toast Utility
|
|
3
|
+
* Replaces react-toastify with a lightweight inline-styled solution
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
type ToastType = 'success' | 'error' | 'info' | 'warning';
|
|
7
|
+
|
|
8
|
+
interface ToastOptions {
|
|
9
|
+
duration?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let toastContainer: HTMLDivElement | null = null;
|
|
13
|
+
const activeToastKeys = new Set<string>();
|
|
14
|
+
|
|
15
|
+
const createToastContainer = () => {
|
|
16
|
+
if (typeof document === 'undefined') return null;
|
|
17
|
+
|
|
18
|
+
if (!toastContainer) {
|
|
19
|
+
toastContainer = document.createElement('div');
|
|
20
|
+
toastContainer.id = 'pc-toast-container';
|
|
21
|
+
toastContainer.style.cssText = `
|
|
22
|
+
position: fixed;
|
|
23
|
+
top: 20px;
|
|
24
|
+
right: 20px;
|
|
25
|
+
z-index: 10000;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 12px;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
`;
|
|
31
|
+
document.body.appendChild(toastContainer);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return toastContainer;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const showToast = (message: string, type: ToastType, options: ToastOptions = {}) => {
|
|
38
|
+
if (typeof document === 'undefined') {
|
|
39
|
+
// Fallback to console in SSR
|
|
40
|
+
console[type === 'error' ? 'error' : 'log'](`[${type.toUpperCase()}] ${message}`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const container = createToastContainer();
|
|
45
|
+
if (!container) return;
|
|
46
|
+
|
|
47
|
+
const toastKey = `${type}:${message}`;
|
|
48
|
+
if (activeToastKeys.has(toastKey)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
activeToastKeys.add(toastKey);
|
|
52
|
+
|
|
53
|
+
const toast = document.createElement('div');
|
|
54
|
+
const duration = options.duration || 3000;
|
|
55
|
+
|
|
56
|
+
const colors = {
|
|
57
|
+
success: { bg: '#10b981', text: '#ffffff' },
|
|
58
|
+
error: { bg: '#ef4444', text: '#ffffff' },
|
|
59
|
+
info: { bg: '#3b82f6', text: '#ffffff' },
|
|
60
|
+
warning: { bg: '#f59e0b', text: '#ffffff' },
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const color = colors[type];
|
|
64
|
+
|
|
65
|
+
toast.style.cssText = `
|
|
66
|
+
background-color: ${color.bg};
|
|
67
|
+
color: ${color.text};
|
|
68
|
+
padding: 12px 16px;
|
|
69
|
+
border-radius: 8px;
|
|
70
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
min-width: 200px;
|
|
74
|
+
max-width: 400px;
|
|
75
|
+
pointer-events: auto;
|
|
76
|
+
animation: pc-slideInRight 0.3s ease-out;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
toast.textContent = message;
|
|
83
|
+
container.appendChild(toast);
|
|
84
|
+
|
|
85
|
+
// Add animation keyframes if not already present
|
|
86
|
+
if (!document.getElementById('pc-toast-animations')) {
|
|
87
|
+
const style = document.createElement('style');
|
|
88
|
+
style.id = 'pc-toast-animations';
|
|
89
|
+
style.textContent = `
|
|
90
|
+
@keyframes pc-slideInRight {
|
|
91
|
+
from {
|
|
92
|
+
transform: translateX(100%);
|
|
93
|
+
opacity: 0;
|
|
94
|
+
}
|
|
95
|
+
to {
|
|
96
|
+
transform: translateX(0);
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
@keyframes pc-slideOutRight {
|
|
101
|
+
from {
|
|
102
|
+
transform: translateX(0);
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
to {
|
|
106
|
+
transform: translateX(100%);
|
|
107
|
+
opacity: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
document.head.appendChild(style);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
toast.style.animation = 'pc-slideOutRight 0.3s ease-out';
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
activeToastKeys.delete(toastKey);
|
|
118
|
+
if (toast.parentNode) {
|
|
119
|
+
toast.parentNode.removeChild(toast);
|
|
120
|
+
}
|
|
121
|
+
}, 300);
|
|
122
|
+
}, duration);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const toast = {
|
|
126
|
+
success: (message: string, options?: ToastOptions) => showToast(message, 'success', options),
|
|
127
|
+
error: (message: string, options?: ToastOptions) => showToast(message, 'error', options),
|
|
128
|
+
info: (message: string, options?: ToastOptions) => showToast(message, 'info', options),
|
|
129
|
+
warning: (message: string, options?: ToastOptions) => showToast(message, 'warning', options),
|
|
130
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Privacy Center - Certified UI
|
|
2
|
+
export { RedactoPrivacyCenter } from './RedactoPrivacyCenter/RedactoPrivacyCenter';
|
|
3
|
+
export { PrivacyCenterLayout } from './RedactoPrivacyCenter/PrivacyCenterLayout';
|
|
4
|
+
export { PrivacyCenterHomePage } from './RedactoPrivacyCenter/PrivacyCenterHomePage';
|
|
5
|
+
export { PrivacyCenterConsentManagerPage } from './RedactoPrivacyCenter/PrivacyCenterConsentManagerPage';
|
|
6
|
+
export { PrivacyCenterFormPage } from './RedactoPrivacyCenter/PrivacyCenterFormPage';
|
|
7
|
+
export { PrivacyCenterActivityPage } from './RedactoPrivacyCenter/PrivacyCenterActivityPage';
|
|
8
|
+
export { PrivacyCenterCaseDetailsPage } from './RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage';
|
|
9
|
+
|
|
10
|
+
// Privacy Center - Headless Core (API client & types)
|
|
11
|
+
export { createConsentClient } from './RedactoPrivacyCenter/api/client';
|
|
12
|
+
export type { BaseRequest } from './RedactoPrivacyCenter/api/client';
|
|
13
|
+
export type { ApiFetchOptions, ApiResponse } from './RedactoPrivacyCenter/api/fetcher';
|
|
14
|
+
|
|
15
|
+
// Privacy Center - Headless Core (types)
|
|
16
|
+
export type {
|
|
17
|
+
Workspace,
|
|
18
|
+
OrganizationDetail,
|
|
19
|
+
OrganizationResponse,
|
|
20
|
+
DataElement,
|
|
21
|
+
Purpose,
|
|
22
|
+
RawPurposeWrapper,
|
|
23
|
+
GrievanceValue,
|
|
24
|
+
GrievanceOptions,
|
|
25
|
+
FormData,
|
|
26
|
+
FormDataResponse,
|
|
27
|
+
NominationData,
|
|
28
|
+
UpdatePurpose,
|
|
29
|
+
UpdateCorrectionDataItem,
|
|
30
|
+
GrievanceTypeElement,
|
|
31
|
+
UpdateRequestDetails,
|
|
32
|
+
UserDataRequest,
|
|
33
|
+
CreateCaseResponse,
|
|
34
|
+
OtpResponse,
|
|
35
|
+
OtpVerificationResponse,
|
|
36
|
+
TokenExchangeResponse,
|
|
37
|
+
FetchOrgParams,
|
|
38
|
+
ConsentDataElement,
|
|
39
|
+
UserConsent,
|
|
40
|
+
NominatorInfo,
|
|
41
|
+
ConsentHistoryStatusSummary,
|
|
42
|
+
ProductConsentHistoryGroup,
|
|
43
|
+
NominatedPurposesGroup,
|
|
44
|
+
Pagination,
|
|
45
|
+
UserConsentDetail,
|
|
46
|
+
UserConsentResponse,
|
|
47
|
+
ManageConsentResponse,
|
|
48
|
+
ManageConsentParams,
|
|
49
|
+
Activity,
|
|
50
|
+
ActivityDetail,
|
|
51
|
+
ActivityResponse,
|
|
52
|
+
ActivityBadgeStatus,
|
|
53
|
+
CaseRequest,
|
|
54
|
+
CaseHistoryDetail,
|
|
55
|
+
CaseHistoryResponse,
|
|
56
|
+
} from './RedactoPrivacyCenter/lib/types';
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
RequestTypeEnum,
|
|
60
|
+
GrievanceTypeEnum,
|
|
61
|
+
ConsentStatusEnum,
|
|
62
|
+
} from './RedactoPrivacyCenter/lib/types';
|
|
63
|
+
|
|
64
|
+
export type { ConsentAction } from './RedactoPrivacyCenter/lib/types';
|
|
65
|
+
|
|
66
|
+
// Privacy Center - Headless Core (API orchestration with auth retry)
|
|
67
|
+
export {
|
|
68
|
+
getFormData,
|
|
69
|
+
createCaseRequest,
|
|
70
|
+
fetchProducts,
|
|
71
|
+
fetchUserConsents,
|
|
72
|
+
manageConsent,
|
|
73
|
+
fetchActivities,
|
|
74
|
+
fetchCaseHistory,
|
|
75
|
+
createOtp,
|
|
76
|
+
verifyOtp,
|
|
77
|
+
exchangeToken,
|
|
78
|
+
} from './RedactoPrivacyCenter/lib/api';
|
|
79
|
+
|
|
80
|
+
export type { AuthContext } from './RedactoPrivacyCenter/lib/api';
|
|
81
|
+
|
|
82
|
+
// Privacy Center - Headless Core (auth utilities)
|
|
83
|
+
export {
|
|
84
|
+
decodeJwtToken,
|
|
85
|
+
isJwtExpired,
|
|
86
|
+
ensureValidToken,
|
|
87
|
+
signOutPrivacyCenter,
|
|
88
|
+
getCookieValue,
|
|
89
|
+
setRefreshTokenCookie,
|
|
90
|
+
checkAndRefreshAuth,
|
|
91
|
+
compareEmails,
|
|
92
|
+
isUserAuthenticated,
|
|
93
|
+
getInitialState,
|
|
94
|
+
getActivityTypeStatus,
|
|
95
|
+
formatActivityType,
|
|
96
|
+
} from './RedactoPrivacyCenter/lib/utils';
|
|
97
|
+
|
|
98
|
+
// Privacy Center - Headless Hook (React Query)
|
|
99
|
+
export { useCaseHistory } from './RedactoPrivacyCenter/lib/queries';
|
|
100
|
+
|
|
101
|
+
// Privacy Center - Context providers (for custom compositions)
|
|
102
|
+
export { AuthProvider, useAuth } from './RedactoPrivacyCenter/context/AuthContext';
|
|
103
|
+
export { BaseUrlProvider, useBaseUrl } from './RedactoPrivacyCenter/context/BaseUrlContext';
|
|
104
|
+
export { NavigationProvider, useInternalNavigation } from './RedactoPrivacyCenter/context/NavigationContext';
|
|
105
|
+
export type { InternalPage } from './RedactoPrivacyCenter/context/NavigationContext';
|
|
106
|
+
|
|
107
|
+
// Privacy Center - Style injection
|
|
108
|
+
export { injectPCStyles } from './RedactoPrivacyCenter/styles/injectStyles';
|
package/tsconfig.json
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -3,14 +3,29 @@ import { defineConfig } from "tsup";
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
entry: {
|
|
5
5
|
index: "src/index.ts",
|
|
6
|
+
"privacy-center": "src/privacy-center.ts",
|
|
6
7
|
},
|
|
7
8
|
format: ["esm", "cjs"],
|
|
8
9
|
dts: true,
|
|
9
|
-
external: [
|
|
10
|
+
external: [
|
|
11
|
+
"react",
|
|
12
|
+
"react-dom",
|
|
13
|
+
"jwt-decode",
|
|
14
|
+
"@tanstack/react-query",
|
|
15
|
+
"@tanstack/react-table",
|
|
16
|
+
"i18next",
|
|
17
|
+
"i18next-browser-languagedetector",
|
|
18
|
+
"react-i18next",
|
|
19
|
+
"lucide-react",
|
|
20
|
+
"react-icons",
|
|
21
|
+
"dayjs",
|
|
22
|
+
"lodash",
|
|
23
|
+
],
|
|
10
24
|
clean: true,
|
|
11
25
|
loader: {
|
|
12
26
|
".png": "dataurl",
|
|
13
27
|
".jpg": "dataurl",
|
|
14
28
|
".svg": "dataurl",
|
|
29
|
+
".css": "local-css",
|
|
15
30
|
},
|
|
16
31
|
});
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @redacto.io/consent-sdk-react@3.5.0 build /Users/abhishekashyap/Documents/consent-sdk/packages/consent-sdk-react
|
|
4
|
-
> tsup
|
|
5
|
-
|
|
6
|
-
[34mCLI[39m Building entry: {"index":"src/index.ts"}
|
|
7
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
-
[34mCLI[39m tsup v8.5.1
|
|
9
|
-
[34mCLI[39m Using tsup config: /Users/abhishekashyap/Documents/consent-sdk/packages/consent-sdk-react/tsup.config.ts
|
|
10
|
-
[34mCLI[39m Target: es2019
|
|
11
|
-
[34mCLI[39m Cleaning output folder
|
|
12
|
-
[34mESM[39m Build start
|
|
13
|
-
[34mCJS[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m165.70 KB[39m
|
|
15
|
-
[32mESM[39m ⚡️ Build success in 66ms
|
|
16
|
-
[32mCJS[39m [1mdist/index.js [22m[32m172.18 KB[39m
|
|
17
|
-
[32mCJS[39m ⚡️ Build success in 68ms
|
|
18
|
-
DTS Build start
|
|
19
|
-
DTS ⚡️ Build success in 819ms
|
|
20
|
-
DTS dist/index.d.mts 2.92 KB
|
|
21
|
-
DTS dist/index.d.ts 2.92 KB
|